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
@@ -3,11 +3,11 @@ import "../../components/floating/hover-delay.js";
3
3
  import { useKeyCommands } from "../../keybindings/KeyCommands.js";
4
4
  import { useReducedMotion } from "../../motion/reduced.js";
5
5
  import { constant, useReadable } from "../headless/store.js";
6
- import { EMPTY_RAIL, computeRailModel, createTranscriptRailStore, dataRowSelector } from "../headless/transcript/rail.js";
6
+ import { EMPTY_RAIL, computeRailModel, computeRailModelParts, createTranscriptRailStore, dataRowSelector, railWithOutline } from "../headless/transcript/rail.js";
7
7
  import { useChatLabels } from "../useChatLabels.js";
8
8
  import { useModelName } from "./actions.js";
9
- import { mountRowNow } from "./LazyRow.js";
10
9
  import { RUN_RECEIPT_TINT, ReceiptValue } from "./receipt-parts.js";
10
+ import { revealRow } from "./row-mount.js";
11
11
  import { SelectCursor } from "./SelectCursor.js";
12
12
  import { createContext, memo, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
13
13
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -20,6 +20,12 @@ const RAIL_WIDTH_PX = 16;
20
20
  * once that space is wider than twice this, it stays this far from the edge, clear of the conversation.
21
21
  */
22
22
  const RAIL_EDGE_INSET_PX = 16;
23
+ /** A tick's height: its hit area. */
24
+ const TICK_PX = 8;
25
+ /** How far the list's scrolling edges fade (`.zg-prompt-rail-ticks[data-fade-*]`). */
26
+ const FADE_PX = 24;
27
+ /** The space kept above and below the rail when its ticks fill the view's height. */
28
+ const RAIL_FIT_INSET_PX = 24;
23
29
  /** Where a jump puts the prompt: this far below the view's top. */
24
30
  const JUMP_MARGIN_PX = 16;
25
31
  /** The exchange in view is the last one starting above this line: this share of the view down, at most `SPY_LINE_MAX_PX`. */
@@ -57,14 +63,17 @@ function useTranscriptRailStore() {
57
63
  * The transcript's side of the rail: publishes its exchanges and the cursor's exchange to the provider's store.
58
64
  * Outside a provider it computes nothing.
59
65
  *
60
- * @param clusters - The root clusters the transcript paints.
66
+ * @param clusters - The root clusters the transcript paints, or their settled and open parts (the settled ones fold once).
61
67
  * @param isHidden - Whether a row paints nothing.
62
68
  * @param receipts - The receipts docked on reply rows.
63
69
  * @param selectedTurn - Select-turn mode's selected stop (a turn id), or `null`.
64
70
  */
65
71
  function useRailPublish(clusters, isHidden, receipts, selectedTurn) {
66
72
  const store = useContext(RailContext);
67
- const model = useMemo(() => store ? computeRailModel(clusters, {
73
+ const model = useMemo(() => store ? Array.isArray(clusters) ? computeRailModel(clusters, {
74
+ isHidden,
75
+ receipts
76
+ }) : computeRailModelParts(clusters, {
68
77
  isHidden,
69
78
  receipts
70
79
  }) : null, [
@@ -83,6 +92,73 @@ function useRailPublish(clusters, isHidden, receipts, selectedTurn) {
83
92
  }, [store, selected]);
84
93
  return store;
85
94
  }
95
+ /** How long a jump to an unloaded prompt waits for its rows to be painted once its history is in. */
96
+ const LANDING_WAIT_MS = 3e3;
97
+ /**
98
+ * The transcript host's side of the rail: hands it the session's prompt outline while part of the history is not
99
+ * loaded, and how to load up to one of them. Read again when the session changes, when more history becomes
100
+ * loadable, and when the outline no longer matches the loaded rows (the history was rewritten).
101
+ *
102
+ * @param transcript - The session's transcript, from its host.
103
+ * @param hasEarlier - Older history is not loaded yet.
104
+ */
105
+ function useRailOutline(transcript, hasEarlier) {
106
+ const store = useContext(RailContext);
107
+ const read = transcript.outline;
108
+ const loadThrough = transcript.loadThrough ?? null;
109
+ const [stale, setStale] = useState(0);
110
+ useEffect(() => {
111
+ if (!store || !read || !hasEarlier) {
112
+ store?.publishOutline(null, null);
113
+ return;
114
+ }
115
+ let cancelled = false;
116
+ read().then((outline) => {
117
+ if (!cancelled) store.publishOutline(outline && outline.prompts.length > 0 ? outline.prompts : null, loadThrough);
118
+ }).catch(() => {
119
+ if (!cancelled) store.publishOutline(null, null);
120
+ });
121
+ return () => {
122
+ cancelled = true;
123
+ };
124
+ }, [
125
+ store,
126
+ read,
127
+ loadThrough,
128
+ hasEarlier,
129
+ stale
130
+ ]);
131
+ useEffect(() => {
132
+ if (!store) return void 0;
133
+ let checked = null;
134
+ return store.subscribe(() => {
135
+ const { outline, exchanges, exchangeOfTurn } = store.get();
136
+ if (!outline || exchanges.length === 0 || checked === outline) return;
137
+ checked = outline;
138
+ if (!outline.some((p) => exchangeOfTurn.has(p.turnId))) setStale((n) => n + 1);
139
+ });
140
+ }, [store]);
141
+ useEffect(() => store ? () => store.publishOutline(null, null) : void 0, [store]);
142
+ }
143
+ /** The id of the exchange holding `turnId` once the transcript paints it, or `null` past {@link LANDING_WAIT_MS}. */
144
+ function exchangeOnceLoaded(store, turnId) {
145
+ const now = store.get().exchangeOfTurn.get(turnId);
146
+ if (now) return Promise.resolve(now);
147
+ return new Promise((resolve) => {
148
+ let timer = 0;
149
+ const off = store.subscribe(() => {
150
+ const id = store.get().exchangeOfTurn.get(turnId);
151
+ if (!id) return;
152
+ window.clearTimeout(timer);
153
+ off();
154
+ resolve(id);
155
+ });
156
+ timer = window.setTimeout(() => {
157
+ off();
158
+ resolve(null);
159
+ }, LANDING_WAIT_MS);
160
+ });
161
+ }
86
162
  /**
87
163
  * The hovered exchange's tint, behind the transcript's rows (the select cursor's element, without following).
88
164
  *
@@ -110,6 +186,36 @@ RailTint.displayName = "RailTint";
110
186
  function promptRow(scroller, id) {
111
187
  return scroller.querySelector(dataRowSelector(id));
112
188
  }
189
+ /** The rail's height: its ticks, at most `RAIL_MAX_TICKS` of them and whole ones that fit in `room`. */
190
+ function railHeight(ticks, room) {
191
+ return Math.min(ticks * TICK_PX, 320, Math.floor(room / TICK_PX) * TICK_PX);
192
+ }
193
+ /**
194
+ * Where the rail's middle goes in its offset parent. Centred on the view when the view is at its tallest yet (or moved);
195
+ * as the view only gets shorter (the composer grows), it stays where it was while it fits between the view's edges
196
+ * (less `RAIL_FIT_INSET_PX`), and moves as little as it must when it doesn't.
197
+ *
198
+ * @param home - The kept centre, and the view it was taken in.
199
+ * @param viewTop - The view's top in the offset parent.
200
+ * @param viewHeight - The view's height.
201
+ * @param height - The rail's height.
202
+ */
203
+ function holdTop(home, viewTop, viewHeight, height) {
204
+ const kept = home.current;
205
+ if (!kept || kept.viewTop !== viewTop || viewHeight >= kept.viewHeight) home.current = {
206
+ center: viewTop + viewHeight / 2,
207
+ viewTop,
208
+ viewHeight
209
+ };
210
+ const center = home.current.center;
211
+ const lowest = viewTop + RAIL_FIT_INSET_PX + height / 2;
212
+ const highest = viewTop + viewHeight - RAIL_FIT_INSET_PX - height / 2;
213
+ return lowest > highest ? viewTop + viewHeight / 2 : Math.min(Math.max(center, lowest), highest);
214
+ }
215
+ /** The exchanges whose rows are loaded: the ones the view can be in. */
216
+ function loadedOnly(exchanges) {
217
+ return exchanges.length > 0 && exchanges[0].unloaded ? exchanges.filter((e) => !e.unloaded) : exchanges;
218
+ }
113
219
  /** A tick's accessible name: the prompt, past `TICK_LABEL_CHARS` cut at a word boundary with an ellipsis. */
114
220
  function tickLabel(prompt) {
115
221
  if (prompt.length <= TICK_LABEL_CHARS) return prompt;
@@ -143,12 +249,24 @@ function spyExchange(scroller, exchanges) {
143
249
  */
144
250
  function TranscriptRail({ scroller, keys = false, className, style }) {
145
251
  const store = useContext(RailContext);
146
- const { exchanges, hovered, selected } = useReadable(store ?? NO_RAIL);
252
+ const { exchanges: loaded, exchangeOfTurn, hovered, selected, outline, loadThrough } = useReadable(store ?? NO_RAIL);
253
+ const exchanges = useMemo(() => railWithOutline({
254
+ exchanges: loaded,
255
+ exchangeOfTurn
256
+ }, outline), [
257
+ loaded,
258
+ exchangeOfTurn,
259
+ outline
260
+ ]);
261
+ const [pending, setPending] = useState(null);
147
262
  const labels = useChatLabels();
148
263
  const reduced = useReducedMotion();
149
264
  const root = useRef(null);
150
265
  const list = useRef(null);
151
266
  const [place, setPlace] = useState(null);
267
+ const home = useRef(null);
268
+ const tickCount = useRef(exchanges.length);
269
+ tickCount.current = exchanges.length;
152
270
  const any = exchanges.length > 0;
153
271
  useLayoutEffect(() => {
154
272
  const el = scroller.current;
@@ -171,10 +289,12 @@ function TranscriptRail({ scroller, keys = false, className, style }) {
171
289
  }
172
290
  const base = parent.getBoundingClientRect();
173
291
  const left = Math.round(edge + Math.min((room - RAIL_WIDTH_PX) / 2, RAIL_EDGE_INSET_PX) - base.left);
174
- const top = Math.round(view.top + el.clientHeight / 2 - base.top);
175
- setPlace((prev) => prev && prev.left === left && prev.top === top ? prev : {
292
+ const height = Math.max(16, el.clientHeight - 48);
293
+ const top = Math.round(holdTop(home, view.top - base.top, el.clientHeight, railHeight(tickCount.current, height)));
294
+ setPlace((prev) => prev && prev.left === left && prev.top === top && prev.room === height ? prev : {
176
295
  left,
177
- top
296
+ top,
297
+ room: height
178
298
  });
179
299
  };
180
300
  measure();
@@ -195,7 +315,7 @@ function TranscriptRail({ scroller, keys = false, className, style }) {
195
315
  let frame = 0;
196
316
  const read = () => {
197
317
  frame = 0;
198
- if (!jumping.current) setSpied(spyExchange(el, exchangesRef.current));
318
+ if (!jumping.current) setSpied(spyExchange(el, loadedOnly(exchangesRef.current)));
199
319
  };
200
320
  const onScroll = () => {
201
321
  const jump = jumping.current;
@@ -251,19 +371,30 @@ function TranscriptRail({ scroller, keys = false, className, style }) {
251
371
  };
252
372
  aimFrame.current = requestAnimationFrame(aim);
253
373
  };
254
- const jump = (id) => {
374
+ const land = (id) => {
255
375
  const el = scroller.current;
256
- const row = el ? promptRow(el, id) : null;
376
+ const row = el ? revealRow(el, id) : null;
257
377
  if (!el || !row) return;
258
- mountRowNow(row);
259
378
  glide(el, id, false, () => el.scrollTop + row.getBoundingClientRect().top - el.getBoundingClientRect().top - JUMP_MARGIN_PX);
260
379
  };
380
+ const reach = async (id, unloaded) => {
381
+ if (!store || !loadThrough || pending === id) return;
382
+ setPending(id);
383
+ const landing = await loadThrough(unloaded.index).catch(() => false) ? await exchangeOnceLoaded(store, unloaded.turnId) : null;
384
+ setPending((at) => at === id ? null : at);
385
+ if (landing) land(landing);
386
+ };
387
+ const jump = (id) => {
388
+ const unloaded = exchangesRef.current.find((e) => e.id === id)?.unloaded;
389
+ if (unloaded) reach(id, unloaded);
390
+ else land(id);
391
+ };
261
392
  const step = (dir) => {
262
393
  const el = scroller.current;
263
394
  const all = exchangesRef.current;
264
395
  if (!el || all.length === 0) return;
265
396
  const inFlight = selected === null ? jumping.current : null;
266
- const current = selected ?? inFlight?.id ?? spyExchange(el, all);
397
+ const current = selected ?? inFlight?.id ?? spyExchange(el, loadedOnly(all));
267
398
  let at = all.findIndex((e) => e.id === current);
268
399
  if (dir > 0) at++;
269
400
  else if (inFlight) {
@@ -305,13 +436,34 @@ function TranscriptRail({ scroller, keys = false, className, style }) {
305
436
  window.clearTimeout(cardTimer.current);
306
437
  cardTimer.current = window.setTimeout(showCard, 150, null);
307
438
  }, [store, showCard]);
439
+ const [edges, setEdges] = useState({
440
+ top: false,
441
+ bottom: false
442
+ });
443
+ const readEdges = useCallback(() => {
444
+ const box = list.current;
445
+ const next = box ? {
446
+ top: box.scrollTop > 1,
447
+ bottom: box.scrollTop + box.clientHeight < box.scrollHeight - 1
448
+ } : {
449
+ top: false,
450
+ bottom: false
451
+ };
452
+ setEdges((prev) => prev.top === next.top && prev.bottom === next.bottom ? prev : next);
453
+ }, []);
454
+ useLayoutEffect(readEdges, [
455
+ readEdges,
456
+ exchanges.length,
457
+ place
458
+ ]);
308
459
  useEffect(() => {
309
460
  const box = list.current;
310
461
  const tick = active ? [...box?.querySelectorAll("[data-exchange]") ?? []].find((el) => el.dataset.exchange === active) : null;
311
462
  if (!box || !tick) return;
312
- if (tick.offsetTop < box.scrollTop) box.scrollTop = tick.offsetTop;
313
- else if (tick.offsetTop + tick.offsetHeight > box.scrollTop + box.clientHeight) box.scrollTop = tick.offsetTop + tick.offsetHeight - box.clientHeight;
314
- }, [active]);
463
+ const margin = Math.min(FADE_PX, box.clientHeight / 4);
464
+ if (tick.offsetTop < box.scrollTop + margin || tick.offsetTop + tick.offsetHeight > box.scrollTop + box.clientHeight - margin) box.scrollTop = tick.offsetTop + tick.offsetHeight / 2 - box.clientHeight / 2;
465
+ readEdges();
466
+ }, [active, readEdges]);
315
467
  const onKeyDown = (e) => {
316
468
  if (e.key === "Escape") {
317
469
  if (!cardOpen.current && hovered === null) return;
@@ -354,6 +506,10 @@ function TranscriptRail({ scroller, keys = false, className, style }) {
354
506
  "aria-orientation": "vertical",
355
507
  "aria-label": labels.promptRail,
356
508
  className: "zg-prompt-rail-ticks",
509
+ style: place ? { maxHeight: Math.min(320, Math.floor(place.room / TICK_PX) * TICK_PX) } : void 0,
510
+ "data-fade-top": edges.top ? "" : void 0,
511
+ "data-fade-bottom": edges.bottom ? "" : void 0,
512
+ onScroll: readEdges,
357
513
  onPointerLeave: leave,
358
514
  onBlur: (e) => {
359
515
  if (!e.currentTarget.contains(e.relatedTarget)) leave();
@@ -364,6 +520,8 @@ function TranscriptRail({ scroller, keys = false, className, style }) {
364
520
  className: "zg-prompt-rail-tick",
365
521
  "data-exchange": exchange.id,
366
522
  "data-hover": exchange.id === hovered ? "" : void 0,
523
+ "data-pending": exchange.id === pending ? "" : void 0,
524
+ "aria-busy": exchange.id === pending || void 0,
367
525
  "aria-label": tickLabel(exchange.prompt),
368
526
  "aria-current": exchange.id === active ? "location" : void 0,
369
527
  tabIndex: exchange.id === tabStop ? 0 : -1,
@@ -418,4 +576,4 @@ function RailCard({ exchange }) {
418
576
  ]
419
577
  });
420
578
  }
421
- export { RailTint, TranscriptRail, TranscriptRailProvider, useRailPublish, useTranscriptRailStore };
579
+ export { RailTint, TranscriptRail, TranscriptRailProvider, useRailOutline, useRailPublish, useTranscriptRailStore };
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * One transcript row: the switch from a pipeline `Row` to its component,
3
- * and the lazy slot a root row mounts through. `TranscriptRow` is memoized
3
+ * and the slot a root row mounts through. `TranscriptRow` is memoized
4
4
  * on the row's own inputs plus ONE shared `RowContext` per transcript, so a
5
5
  * render (a stream tick, a page of history arriving) builds one element per
6
- * row and bails out for every row that did not change.
6
+ * row and bails out for every row that did not change. A root row renders in
7
+ * its lazy wrapper (`TranscriptRowSlot`, `LazyRow`).
7
8
  */
8
9
  import { Cluster, Row } from "../headless/transcript/rows.js";
9
10
  import "../headless/transcript/index.js";
@@ -86,10 +87,6 @@ export interface SlotEntry {
86
87
  }
87
88
  /** Props for {@link TranscriptRowSlot}: the {@link TranscriptRowProps} of its row, plus its lazy wrapper's. */
88
89
  export interface TranscriptRowSlotProps extends Omit<TranscriptRowProps, 'className' | 'style'> {
89
- /** Mounts the row at once instead of waiting for it to approach (the transcript's tail). */
90
- eager: boolean;
91
- /** Height in pixels of the placeholder box before the row mounts. */
92
- estimatePx: number;
93
90
  /** Inline style for the row's wrapper, usually its content-visibility sizing. */
94
91
  style: CSSProperties;
95
92
  /** The select-turn stop the row belongs to; set only in select mode. */
@@ -102,4 +99,4 @@ export interface TranscriptRowSlotProps extends Omit<TranscriptRowProps, 'classN
102
99
  /** Renders one transcript row by switching on its `kind`: prompts, replies, thinking, tool calls, notices, folds, and groups. */
103
100
  export declare const TranscriptRow: import("react").MemoExoticComponent<({ row, showCaret, receipt, resumable, ctx, renderRows, status, className, style }: TranscriptRowProps) => import("react").JSX.Element | null>;
104
101
  /** One root transcript row in its lazy wrapper, memoised on the row's own inputs. */
105
- export declare const TranscriptRowSlot: import("react").MemoExoticComponent<({ eager, estimatePx, style, stop, sel, className, ...row }: TranscriptRowSlotProps) => import("react").JSX.Element>;
102
+ export declare const TranscriptRowSlot: import("react").MemoExoticComponent<({ style, stop, sel, className, ...row }: TranscriptRowSlotProps) => import("react").JSX.Element>;
@@ -9,6 +9,7 @@ import { COMMAND_DETAIL_LINE, CommandDetailRow, CommandNoteRow, ErrorRow, Failur
9
9
  import { UserPromptRow } from "./prompt.js";
10
10
  import { PromptOriginLabel } from "./PromptOriginLabel.js";
11
11
  import { TextRow, ThinkingBatchRow, ThinkingRow } from "./prose.js";
12
+ import { rowEstimatePx } from "./row-estimate.js";
12
13
  import { CompactSummaryRow, RunReceiptInline, RunSummaryRow } from "./run-rows.js";
13
14
  import { ShellBlockProvider } from "./shell-block.js";
14
15
  import { TaskBatchRow, TaskRow } from "./tasks.js";
@@ -221,11 +222,11 @@ const TranscriptRow = memo(({ row, showCaret, receipt, resumable, ctx, renderRow
221
222
  });
222
223
  TranscriptRow.displayName = "TranscriptRow";
223
224
  /** One root transcript row in its lazy wrapper, memoised on the row's own inputs. */
224
- const TranscriptRowSlot = memo(({ eager, estimatePx, style, stop, sel, className, ...row }) => {
225
+ const TranscriptRowSlot = memo(({ style, stop, sel, className, ...row }) => {
225
226
  return /* @__PURE__ */ jsx(LazyRow, {
226
227
  className,
227
- eager,
228
- estimatePx,
228
+ itemKey: row.row.id,
229
+ estimatePx: rowEstimatePx(row.row),
229
230
  style,
230
231
  "data-stop": stop,
231
232
  "data-sel": sel,
@@ -14,9 +14,12 @@
14
14
  */
15
15
  import { SettingsMcpHost } from "../../settings/headless/mcp.js";
16
16
  import { SettingsProvidersHost } from "../../settings/headless/providers.js";
17
+ import { ChatAttachment } from "../headless/host.js";
18
+ import { ToolOutputRange } from "../headless/output-pager.js";
17
19
  import { AuthSettingsTarget } from "../headless/transcript/auth-failure.js";
18
20
  import { ReactNode } from "react";
19
- import { ModelNamer } from "zidane/chat/pure";
21
+ import { ModelNamer, ToolCallDetail } from "zidane/chat/pure";
22
+ import { ToolResultSlice } from "zidane/chat";
20
23
  /**
21
24
  * The accounts of the host that holds a session's credentials, for the card
22
25
  * a run stopped by a failed sign-in shows (`AuthFailureCard`). Each member is
@@ -45,6 +48,10 @@ export interface TranscriptActions {
45
48
  sessionId: string | null;
46
49
  /** The whole text of a tool result that was clipped for transport (`ChatHost.toolOutput`). `turnId`: the call's turn, a hint where to look first. */
47
50
  toolOutput?: (callId: string, turnId?: string) => Promise<string | null>;
51
+ /** One range of a clipped tool result (`ChatHost.toolOutputRange`): with it, "Load full output" pages through the result instead of reading it whole. */
52
+ toolOutputRange?: (callId: string, range: ToolOutputRange, turnId?: string) => Promise<ToolResultSlice | null>;
53
+ /** The whole of a tool call whose row went out lean: its input, every hunk of its edit (`ChatHost.toolCall`). `turnId`: the call's turn, a hint where to look first. */
54
+ toolCall?: (callId: string, turnId?: string) => Promise<ToolCallDetail | null>;
48
55
  /** Stops a running call (`ChatHost.cancelTool`). */
49
56
  cancelTool?: (callId: string) => void;
50
57
  /**
@@ -63,6 +70,13 @@ export interface TranscriptActions {
63
70
  * inline instead of `[image: …]` stand-ins.
64
71
  */
65
72
  toolMediaUrl?: (callId: string, index: number) => string;
73
+ /**
74
+ * The address of a medium the session store holds by content hash (a prompt's attachment, a tool result's media
75
+ * block held as `attachment://<hash>`). The same bytes for good: a page caches it for good. With it, such media
76
+ * load by hash; media still inline in their turn keep `toolMediaUrl` (and a prompt's own preview). `name` only ends
77
+ * the address. `undefined`: not served now (the older address stands).
78
+ */
79
+ blobMediaUrl?: (hash: string, name?: string) => string | undefined;
66
80
  /**
67
81
  * Where a message's media loads from (`![alt](src)` in a reply or a
68
82
  * prompt): `src` as written, or the app's address for a local file;
@@ -115,5 +129,27 @@ export interface TranscriptActionsProviderProps {
115
129
  export declare function TranscriptActionsProvider({ value, children }: TranscriptActionsProviderProps): import("react").JSX.Element;
116
130
  /** Returns the {@link TranscriptActions} from the nearest {@link TranscriptActionsProvider}. Without one it returns an object with no session and no actions. */
117
131
  export declare function useTranscriptActions(): TranscriptActions;
132
+ /**
133
+ * Where a prompt's attachment loads from: its own preview (`dataUrl`), else its blob's address when the store holds
134
+ * it by hash and the app serves blobs.
135
+ *
136
+ * @param actions - The transcript's actions.
137
+ * @param att - The attachment.
138
+ */
139
+ export declare function attachmentSrcOf(actions: Pick<TranscriptActions, 'blobMediaUrl'>, att: ChatAttachment): string | undefined;
140
+ /**
141
+ * Where a tool result's `index`-th media block loads from: by hash when the store holds it so and the app serves
142
+ * blobs, else by its call and position (`toolMediaUrl`); `undefined` when the app serves neither.
143
+ *
144
+ * @param actions - The transcript's actions.
145
+ * @param callId - The call that returned it.
146
+ * @param item - The block's position, and its hash when held by one.
147
+ * @param item.index - Its position among the result's media blocks.
148
+ * @param item.hash - Its blob hash, when held by one.
149
+ */
150
+ export declare function toolMediaSrcOf(actions: Pick<TranscriptActions, 'toolMediaUrl' | 'blobMediaUrl'>, callId: string, item: {
151
+ index: number;
152
+ hash?: string;
153
+ }): string | undefined;
118
154
  /** How the transcript names a model: the app's `modelName`, else from the id. */
119
155
  export declare function useModelName(): ModelNamer;
@@ -1,3 +1,4 @@
1
+ import { blobHashOf } from "../headless/transcript/blob-media.js";
1
2
  import { createContext, useContext } from "react";
2
3
  import { jsx } from "react/jsx-runtime";
3
4
  import { nameFromModelId } from "zidane/chat/pure";
@@ -18,8 +19,33 @@ function TranscriptActionsProvider({ value, children }) {
18
19
  function useTranscriptActions() {
19
20
  return useContext(TranscriptActionsContext);
20
21
  }
22
+ /**
23
+ * Where a prompt's attachment loads from: its own preview (`dataUrl`), else its blob's address when the store holds
24
+ * it by hash and the app serves blobs.
25
+ *
26
+ * @param actions - The transcript's actions.
27
+ * @param att - The attachment.
28
+ */
29
+ function attachmentSrcOf(actions, att) {
30
+ if (att.dataUrl !== void 0) return att.dataUrl;
31
+ const hash = blobHashOf(att.ref);
32
+ return hash && actions.blobMediaUrl ? actions.blobMediaUrl(hash, att.name) : void 0;
33
+ }
34
+ /**
35
+ * Where a tool result's `index`-th media block loads from: by hash when the store holds it so and the app serves
36
+ * blobs, else by its call and position (`toolMediaUrl`); `undefined` when the app serves neither.
37
+ *
38
+ * @param actions - The transcript's actions.
39
+ * @param callId - The call that returned it.
40
+ * @param item - The block's position, and its hash when held by one.
41
+ * @param item.index - Its position among the result's media blocks.
42
+ * @param item.hash - Its blob hash, when held by one.
43
+ */
44
+ function toolMediaSrcOf(actions, callId, item) {
45
+ return (item.hash ? actions.blobMediaUrl?.(item.hash) : void 0) ?? actions.toolMediaUrl?.(callId, item.index);
46
+ }
21
47
  /** How the transcript names a model: the app's `modelName`, else from the id. */
22
48
  function useModelName() {
23
49
  return useContext(TranscriptActionsContext).modelName ?? nameFromModelId;
24
50
  }
25
- export { TranscriptActionsProvider, useModelName, useTranscriptActions };
51
+ export { TranscriptActionsProvider, attachmentSrcOf, toolMediaSrcOf, useModelName, useTranscriptActions };
@@ -9,6 +9,17 @@ export declare function useCommitInfo(cwd: string | null, sha: string): {
9
9
  value: ChatCommit | null | undefined;
10
10
  loading: boolean;
11
11
  };
12
+ /**
13
+ * The chat a token names (a `#chat` chip's, a session id in inline code), from the sessions the host lists: no
14
+ * context gauge, so a chip's face can read it as it draws. `listed`: the host lists sessions at all.
15
+ *
16
+ * @param token - The token (`#3f2a`, `3f5cf5fc`, a full id).
17
+ */
18
+ export declare function useTokenSession(token: string): {
19
+ session: ChatSessionFacts | null;
20
+ loading: boolean;
21
+ listed: boolean;
22
+ };
12
23
  /**
13
24
  * The chat a `#token` names, and its context gauge.
14
25
  *
@@ -74,6 +74,22 @@ function useCommitInfo(cwd, sha) {
74
74
  return useChipDetail(chips, cwd && commit ? `commit\0${cwd}\0${sha.toLowerCase()}` : null, () => commit(cwd, sha), Number.POSITIVE_INFINITY);
75
75
  }
76
76
  /**
77
+ * The chat a token names (a `#chat` chip's, a session id in inline code), from the sessions the host lists: no
78
+ * context gauge, so a chip's face can read it as it draws. `listed`: the host lists sessions at all.
79
+ *
80
+ * @param token - The token (`#3f2a`, `3f5cf5fc`, a full id).
81
+ */
82
+ function useTokenSession(token) {
83
+ const chips = useChips();
84
+ const { sessions } = chips;
85
+ const list = useChipDetail(chips, sessions ? "sessions" : null, () => sessions(), 1e4);
86
+ return {
87
+ session: list.value ? sessionForToken(list.value, token) : null,
88
+ loading: list.loading,
89
+ listed: sessions !== void 0
90
+ };
91
+ }
92
+ /**
77
93
  * The chat a `#token` names, and its context gauge.
78
94
  *
79
95
  * @param token - The chip's text (`#3f2a`).
@@ -122,4 +138,4 @@ function useCommand(scope, text) {
122
138
  loading: list.loading
123
139
  };
124
140
  }
125
- export { useCommand, useCommitInfo, useReferencedSession, useSkill };
141
+ export { useCommand, useCommitInfo, useReferencedSession, useSkill, useTokenSession };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The rest of a tool result the host clipped for the wire. With
3
+ * `TranscriptActions.toolOutputRange` it pages: "Load full output" reads the
4
+ * first page (`TOOL_OUTPUT_PAGE_SIZE`), which replaces the clipped preview,
5
+ * then "Load more" and "Load all" read on, under a line that says how much is
6
+ * loaded. With `toolOutput` only, it reads the whole text in one go.
7
+ * Internal to the transcript: the tool rows use it.
8
+ */
9
+ import { ToolOutputPagerState } from "../headless/output-pager.js";
10
+ import { ToolRowModel } from "../headless/transcript/rows.js";
11
+ import "../headless/transcript/index.js";
12
+ import { CSSProperties } from "react";
13
+ /** A clipped result's loaded text and the way to load more, from {@link useClippedOutput}. */
14
+ export interface ClippedOutput {
15
+ /** The text that replaces the clipped preview; `null` while none is loaded. */
16
+ text: string | null;
17
+ /** The app can load the result: without it the row offers no control. */
18
+ available: boolean;
19
+ /** The call can be addressed (a session and a call id). */
20
+ ready: boolean;
21
+ /** The pages loaded, when the app reads ranges; `null` when it reads the whole text. */
22
+ paged: (ToolOutputPagerState & {
23
+ /** The read in flight, as the user asked it. */
24
+ running: 'more' | 'all' | null;
25
+ /** Reads the next page (`more`) or the rest (`all`). */
26
+ run: (what: 'more' | 'all') => void;
27
+ /** Runs the last read again, from where it stopped. */
28
+ retry: () => void;
29
+ }) | null;
30
+ /** Reads the whole text in one go (an app without ranges), and its state. */
31
+ whole: {
32
+ full: string | 'loading' | null;
33
+ load: () => void;
34
+ };
35
+ }
36
+ /**
37
+ * The rest of a clipped result, read through the transcript's actions: paged
38
+ * with `toolOutputRange`, whole with `toolOutput` only.
39
+ *
40
+ * @param tool - The clipped tool row. Its `callId` (and `turnId`, a hint) address the result.
41
+ */
42
+ export declare function useClippedOutput(tool: ToolRowModel): ClippedOutput;
43
+ /** Props for {@link ClippedOutputControls}. */
44
+ export interface ClippedOutputControlsProps {
45
+ /** The result's state, from {@link useClippedOutput}. */
46
+ output: ClippedOutput;
47
+ /** Extra classes on the root element. */
48
+ className?: string;
49
+ /** Inline styles on the root element. */
50
+ style?: CSSProperties;
51
+ }
52
+ /**
53
+ * "Load full output" over a clipped result; once a page shows, how much is
54
+ * loaded with "Load more" and "Load all", and a failed read with Retry.
55
+ *
56
+ * @param props - The result's state, `className` and `style`.
57
+ */
58
+ export declare function ClippedOutputControls({ output, className, style }: ClippedOutputControlsProps): import("react").JSX.Element | null;