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
@@ -0,0 +1,579 @@
1
+ import { FloatingSurface } from "../../components/floating/FloatingSurface.js";
2
+ import "../../components/floating/hover-delay.js";
3
+ import { useKeyCommands } from "../../keybindings/KeyCommands.js";
4
+ import { useReducedMotion } from "../../motion/reduced.js";
5
+ import { constant, useReadable } from "../headless/store.js";
6
+ import { EMPTY_RAIL, computeRailModel, computeRailModelParts, createTranscriptRailStore, dataRowSelector, railWithOutline } from "../headless/transcript/rail.js";
7
+ import { useChatLabels } from "../useChatLabels.js";
8
+ import { useModelName } from "./actions.js";
9
+ import { RUN_RECEIPT_TINT, ReceiptValue } from "./receipt-parts.js";
10
+ import { revealRow } from "./row-mount.js";
11
+ import { SelectCursor } from "./SelectCursor.js";
12
+ import { createContext, memo, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
13
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
14
+ import { formatRunReceiptCells } from "zidane/chat/pure";
15
+ // src/chat/transcript/TranscriptRail.tsx
16
+ /** The rail's width: its ticks' hit area. */
17
+ const RAIL_WIDTH_PX = 16;
18
+ /**
19
+ * The farthest the rail sits from the pane's left edge. In a narrow pane it centres in the space left of the text;
20
+ * once that space is wider than twice this, it stays this far from the edge, clear of the conversation.
21
+ */
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;
29
+ /** Where a jump puts the prompt: this far below the view's top. */
30
+ const JUMP_MARGIN_PX = 16;
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`. */
32
+ const SPY_LINE_SHARE = .3;
33
+ const SPY_LINE_MAX_PX = 160;
34
+ /** A jump farther than this many views goes there at once (a glide that long reads as lag). */
35
+ const FAR_VIEWS = 1.5;
36
+ /** A scroll still for this long ends a jump: the spy reads the view again. */
37
+ const JUMP_SETTLE_MS = 140;
38
+ /** A far jump aims again each frame until its target holds still this many frames, for at most `AIM_MAX_FRAMES`. */
39
+ const AIM_STILL_FRAMES = 2;
40
+ const AIM_MAX_FRAMES = 12;
41
+ const CARD_WIDTH_PX = 320;
42
+ /** A tick's accessible name: the prompt's start, cut at a word. */
43
+ const TICK_LABEL_CHARS = 80;
44
+ const RailContext = createContext(null);
45
+ const NO_RAIL = constant(createTranscriptRailStore().get());
46
+ /**
47
+ * Holds the rail's store for the transcript and the rail below it.
48
+ *
49
+ * @param props - The {@link TranscriptRailProviderProps}.
50
+ */
51
+ function TranscriptRailProvider({ children }) {
52
+ const [store] = useState(createTranscriptRailStore);
53
+ return /* @__PURE__ */ jsx(RailContext.Provider, {
54
+ value: store,
55
+ children
56
+ });
57
+ }
58
+ /** The rail store of the nearest {@link TranscriptRailProvider}, or `null` outside one. */
59
+ function useTranscriptRailStore() {
60
+ return useContext(RailContext);
61
+ }
62
+ /**
63
+ * The transcript's side of the rail: publishes its exchanges and the cursor's exchange to the provider's store.
64
+ * Outside a provider it computes nothing.
65
+ *
66
+ * @param clusters - The root clusters the transcript paints, or their settled and open parts (the settled ones fold once).
67
+ * @param isHidden - Whether a row paints nothing.
68
+ * @param receipts - The receipts docked on reply rows.
69
+ * @param selectedTurn - Select-turn mode's selected stop (a turn id), or `null`.
70
+ */
71
+ function useRailPublish(clusters, isHidden, receipts, selectedTurn) {
72
+ const store = useContext(RailContext);
73
+ const model = useMemo(() => store ? Array.isArray(clusters) ? computeRailModel(clusters, {
74
+ isHidden,
75
+ receipts
76
+ }) : computeRailModelParts(clusters, {
77
+ isHidden,
78
+ receipts
79
+ }) : null, [
80
+ store,
81
+ clusters,
82
+ isHidden,
83
+ receipts
84
+ ]);
85
+ useLayoutEffect(() => {
86
+ if (store && model) store.publish(model);
87
+ }, [store, model]);
88
+ useLayoutEffect(() => store ? () => store.publish(EMPTY_RAIL) : void 0, [store]);
89
+ const selected = selectedTurn && model ? model.exchangeOfTurn.get(selectedTurn) ?? null : null;
90
+ useLayoutEffect(() => {
91
+ store?.select(selected);
92
+ }, [store, selected]);
93
+ return store;
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
+ }
162
+ /**
163
+ * The hovered exchange's tint, behind the transcript's rows (the select cursor's element, without following).
164
+ *
165
+ * @param props - The rail's store.
166
+ */
167
+ const RailTint = memo(({ store }) => {
168
+ const { exchanges, hovered, selected } = useReadable(store);
169
+ const exchange = hovered && selected === null ? exchanges.find((e) => e.id === hovered) : void 0;
170
+ const first = exchange?.firstRowId;
171
+ const last = exchange?.lastRowId;
172
+ const span = useMemo(() => first && last ? {
173
+ first,
174
+ last
175
+ } : null, [first, last]);
176
+ return /* @__PURE__ */ jsx(SelectCursor, {
177
+ selected: span ? hovered : null,
178
+ layout: exchanges,
179
+ span,
180
+ follow: false,
181
+ className: "zg-rail-tint"
182
+ });
183
+ });
184
+ RailTint.displayName = "RailTint";
185
+ /** The prompt row of an exchange in the scroller. */
186
+ function promptRow(scroller, id) {
187
+ return scroller.querySelector(dataRowSelector(id));
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
+ }
219
+ /** A tick's accessible name: the prompt, past `TICK_LABEL_CHARS` cut at a word boundary with an ellipsis. */
220
+ function tickLabel(prompt) {
221
+ if (prompt.length <= TICK_LABEL_CHARS) return prompt;
222
+ const cut = prompt.slice(0, TICK_LABEL_CHARS);
223
+ const space = cut.lastIndexOf(" ");
224
+ return `${(space > TICK_LABEL_CHARS / 2 ? cut.slice(0, space) : cut).trimEnd()}…`;
225
+ }
226
+ /** The exchange in view: the last one whose prompt starts above the spy line (the last at the bottom). */
227
+ function spyExchange(scroller, exchanges) {
228
+ if (exchanges.length === 0) return null;
229
+ if (scroller.scrollHeight - scroller.scrollTop - scroller.clientHeight <= 2) return exchanges[exchanges.length - 1].id;
230
+ const line = scroller.getBoundingClientRect().top + Math.min(scroller.clientHeight * SPY_LINE_SHARE, SPY_LINE_MAX_PX);
231
+ let lo = 0;
232
+ let hi = exchanges.length - 1;
233
+ let found = 0;
234
+ while (lo <= hi) {
235
+ const mid = lo + hi >> 1;
236
+ const row = promptRow(scroller, exchanges[mid].id);
237
+ if (row && row.getBoundingClientRect().top <= line) {
238
+ found = mid;
239
+ lo = mid + 1;
240
+ } else hi = mid - 1;
241
+ }
242
+ return exchanges[found].id;
243
+ }
244
+ /**
245
+ * Renders the prompt rail left of a transcript's column: a tick per prompt, the one in view raised, a card on hover,
246
+ * a jump on click.
247
+ *
248
+ * @param props - The {@link TranscriptRailProps}.
249
+ */
250
+ function TranscriptRail({ scroller, keys = false, className, style }) {
251
+ const store = useContext(RailContext);
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);
262
+ const labels = useChatLabels();
263
+ const reduced = useReducedMotion();
264
+ const root = useRef(null);
265
+ const list = useRef(null);
266
+ const [place, setPlace] = useState(null);
267
+ const home = useRef(null);
268
+ const tickCount = useRef(exchanges.length);
269
+ tickCount.current = exchanges.length;
270
+ const any = exchanges.length > 0;
271
+ useLayoutEffect(() => {
272
+ const el = scroller.current;
273
+ const rail = root.current;
274
+ if (!el || !rail) return void 0;
275
+ const measure = () => {
276
+ const parent = rail.offsetParent;
277
+ const column = el.querySelector(".zg-transcript-column");
278
+ if (!parent || !column) {
279
+ setPlace(null);
280
+ return;
281
+ }
282
+ const textLeft = column.getBoundingClientRect().left + (Number.parseFloat(getComputedStyle(column).paddingLeft) || 0);
283
+ const view = el.getBoundingClientRect();
284
+ const edge = view.left + el.clientLeft;
285
+ const room = textLeft - edge;
286
+ if (room < 24) {
287
+ setPlace(null);
288
+ return;
289
+ }
290
+ const base = parent.getBoundingClientRect();
291
+ const left = Math.round(edge + Math.min((room - RAIL_WIDTH_PX) / 2, RAIL_EDGE_INSET_PX) - base.left);
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 : {
295
+ left,
296
+ top,
297
+ room: height
298
+ });
299
+ };
300
+ measure();
301
+ const ro = new ResizeObserver(measure);
302
+ ro.observe(el);
303
+ const column = el.querySelector(".zg-transcript-column");
304
+ if (column) ro.observe(column);
305
+ return () => ro.disconnect();
306
+ }, [scroller, any]);
307
+ const [spied, setSpied] = useState(null);
308
+ const jumping = useRef(null);
309
+ const aimFrame = useRef(0);
310
+ const exchangesRef = useRef(exchanges);
311
+ exchangesRef.current = exchanges;
312
+ useEffect(() => {
313
+ const el = scroller.current;
314
+ if (!el) return void 0;
315
+ let frame = 0;
316
+ const read = () => {
317
+ frame = 0;
318
+ if (!jumping.current) setSpied(spyExchange(el, loadedOnly(exchangesRef.current)));
319
+ };
320
+ const onScroll = () => {
321
+ const jump = jumping.current;
322
+ if (jump) {
323
+ window.clearTimeout(jump.timer);
324
+ jump.timer = window.setTimeout(() => {
325
+ jumping.current = null;
326
+ read();
327
+ }, JUMP_SETTLE_MS);
328
+ return;
329
+ }
330
+ if (!frame) frame = requestAnimationFrame(read);
331
+ };
332
+ read();
333
+ el.addEventListener("scroll", onScroll, { passive: true });
334
+ return () => {
335
+ el.removeEventListener("scroll", onScroll);
336
+ cancelAnimationFrame(frame);
337
+ };
338
+ }, [scroller, exchanges]);
339
+ useEffect(() => () => {
340
+ window.clearTimeout(jumping.current?.timer);
341
+ cancelAnimationFrame(aimFrame.current);
342
+ }, []);
343
+ const active = selected ?? spied;
344
+ const glide = (el, id, end, targetOf) => {
345
+ const target = targetOf();
346
+ const far = Math.abs(target - el.scrollTop) > el.clientHeight * FAR_VIEWS;
347
+ window.clearTimeout(jumping.current?.timer);
348
+ cancelAnimationFrame(aimFrame.current);
349
+ jumping.current = {
350
+ id,
351
+ end,
352
+ timer: window.setTimeout(() => {
353
+ jumping.current = null;
354
+ }, JUMP_SETTLE_MS)
355
+ };
356
+ setSpied(id);
357
+ el.scrollTo({
358
+ top: target,
359
+ behavior: far || reduced ? "auto" : "smooth"
360
+ });
361
+ if (!far) return;
362
+ let frames = 0;
363
+ let still = 0;
364
+ const aim = () => {
365
+ const off = targetOf() - el.scrollTop;
366
+ if (Math.abs(off) > 1) {
367
+ el.scrollTop += off;
368
+ still = 0;
369
+ } else still++;
370
+ aimFrame.current = still < AIM_STILL_FRAMES && ++frames < AIM_MAX_FRAMES ? requestAnimationFrame(aim) : 0;
371
+ };
372
+ aimFrame.current = requestAnimationFrame(aim);
373
+ };
374
+ const land = (id) => {
375
+ const el = scroller.current;
376
+ const row = el ? revealRow(el, id) : null;
377
+ if (!el || !row) return;
378
+ glide(el, id, false, () => el.scrollTop + row.getBoundingClientRect().top - el.getBoundingClientRect().top - JUMP_MARGIN_PX);
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
+ };
392
+ const step = (dir) => {
393
+ const el = scroller.current;
394
+ const all = exchangesRef.current;
395
+ if (!el || all.length === 0) return;
396
+ const inFlight = selected === null ? jumping.current : null;
397
+ const current = selected ?? inFlight?.id ?? spyExchange(el, loadedOnly(all));
398
+ let at = all.findIndex((e) => e.id === current);
399
+ if (dir > 0) at++;
400
+ else if (inFlight) {
401
+ if (!inFlight.end) at--;
402
+ } else if (at >= 0) {
403
+ const row = promptRow(el, all[at].id);
404
+ if (!(row ? row.getBoundingClientRect().top < el.getBoundingClientRect().top + JUMP_MARGIN_PX - 4 : false)) at--;
405
+ }
406
+ if (at < 0) return;
407
+ if (at < all.length) jump(all[at].id);
408
+ else glide(el, all[all.length - 1].id, true, () => el.scrollHeight - el.clientHeight);
409
+ };
410
+ useKeyCommands(keys ? {
411
+ previousPrompt: () => step(-1),
412
+ nextPrompt: () => step(1)
413
+ } : {});
414
+ const [card, setCard] = useState(null);
415
+ const cardOpen = useRef(false);
416
+ const cardTimer = useRef(void 0);
417
+ useEffect(() => () => window.clearTimeout(cardTimer.current), []);
418
+ const showCard = useCallback((next) => {
419
+ cardOpen.current = next !== null;
420
+ setCard(next);
421
+ }, []);
422
+ const point = useCallback((id, anchor) => {
423
+ store?.hover(id);
424
+ window.clearTimeout(cardTimer.current);
425
+ if (cardOpen.current) showCard({
426
+ id,
427
+ anchor
428
+ });
429
+ else cardTimer.current = window.setTimeout(showCard, 250, {
430
+ id,
431
+ anchor
432
+ });
433
+ }, [store, showCard]);
434
+ const leave = useCallback(() => {
435
+ store?.hover(null);
436
+ window.clearTimeout(cardTimer.current);
437
+ cardTimer.current = window.setTimeout(showCard, 150, null);
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
+ ]);
459
+ useEffect(() => {
460
+ const box = list.current;
461
+ const tick = active ? [...box?.querySelectorAll("[data-exchange]") ?? []].find((el) => el.dataset.exchange === active) : null;
462
+ if (!box || !tick) return;
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]);
467
+ const onKeyDown = (e) => {
468
+ if (e.key === "Escape") {
469
+ if (!cardOpen.current && hovered === null) return;
470
+ e.preventDefault();
471
+ e.stopPropagation();
472
+ window.clearTimeout(cardTimer.current);
473
+ showCard(null);
474
+ store?.hover(null);
475
+ return;
476
+ }
477
+ if (e.key !== "ArrowUp" && e.key !== "ArrowDown" && e.key !== "Home" && e.key !== "End") return;
478
+ const ticks = [...list.current?.querySelectorAll("button") ?? []];
479
+ const at = ticks.indexOf(document.activeElement);
480
+ const to = e.key === "Home" ? 0 : e.key === "End" ? ticks.length - 1 : at + (e.key === "ArrowUp" ? -1 : 1);
481
+ const next = ticks[Math.max(0, Math.min(ticks.length - 1, to))];
482
+ if (!next) return;
483
+ e.preventDefault();
484
+ e.stopPropagation();
485
+ next.focus();
486
+ };
487
+ const shown = store !== null && exchanges.length >= 2 && place !== null;
488
+ const tabStop = active && exchanges.some((e) => e.id === active) ? active : exchanges[exchanges.length - 1]?.id;
489
+ const carded = card ? exchanges.find((e) => e.id === card.id) : void 0;
490
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
491
+ ref: root,
492
+ "aria-hidden": shown ? void 0 : true,
493
+ className: ["zg-prompt-rail", className].filter(Boolean).join(" "),
494
+ "data-on": shown,
495
+ style: {
496
+ ...place ? {
497
+ left: place.left,
498
+ top: place.top
499
+ } : {},
500
+ width: RAIL_WIDTH_PX,
501
+ ...style
502
+ },
503
+ children: /* @__PURE__ */ jsx("div", {
504
+ ref: list,
505
+ role: "toolbar",
506
+ "aria-orientation": "vertical",
507
+ "aria-label": labels.promptRail,
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,
513
+ onPointerLeave: leave,
514
+ onBlur: (e) => {
515
+ if (!e.currentTarget.contains(e.relatedTarget)) leave();
516
+ },
517
+ onKeyDown,
518
+ children: exchanges.length >= 2 && exchanges.map((exchange) => /* @__PURE__ */ jsx("button", {
519
+ type: "button",
520
+ className: "zg-prompt-rail-tick",
521
+ "data-exchange": exchange.id,
522
+ "data-hover": exchange.id === hovered ? "" : void 0,
523
+ "data-pending": exchange.id === pending ? "" : void 0,
524
+ "aria-busy": exchange.id === pending || void 0,
525
+ "aria-label": tickLabel(exchange.prompt),
526
+ "aria-current": exchange.id === active ? "location" : void 0,
527
+ tabIndex: exchange.id === tabStop ? 0 : -1,
528
+ onPointerEnter: (e) => point(exchange.id, e.currentTarget),
529
+ onFocus: (e) => point(exchange.id, e.currentTarget),
530
+ onClick: () => jump(exchange.id)
531
+ }, exchange.id))
532
+ })
533
+ }), /* @__PURE__ */ jsx(FloatingSurface, {
534
+ open: shown && carded !== void 0,
535
+ anchor: { element: card?.anchor ?? null },
536
+ side: "right",
537
+ align: "center",
538
+ offset: 10,
539
+ width: CARD_WIDTH_PX,
540
+ className: "zg-prompt-rail-card",
541
+ children: carded && /* @__PURE__ */ jsx(RailCard, { exchange: carded })
542
+ })] });
543
+ }
544
+ /** The run receipt's cells the card shows, as the receipt row's chips: the model that answered and how long it took. */
545
+ const CARD_CELLS = /* @__PURE__ */ new Set(["model", "duration"]);
546
+ /**
547
+ * The hover card's content: the prompt and the start of its answer, each clamped (a long message never grows the card,
548
+ * a long word or path wraps inside it), then the receipt's chips.
549
+ */
550
+ function RailCard({ exchange }) {
551
+ const modelName = useModelName();
552
+ const cells = exchange.receipt ? formatRunReceiptCells(exchange.receipt, modelName).filter((c) => CARD_CELLS.has(c.kind)) : [];
553
+ return /* @__PURE__ */ jsxs("div", {
554
+ className: "flex flex-col gap-1.5 px-3 py-2.5",
555
+ "aria-hidden": true,
556
+ children: [
557
+ /* @__PURE__ */ jsx("p", {
558
+ className: "m-0 text-zg-ui leading-zg-ui font-medium text-[var(--zg-text)] line-clamp-2 break-words",
559
+ children: exchange.prompt
560
+ }),
561
+ exchange.answer && /* @__PURE__ */ jsx("p", {
562
+ className: "m-0 text-zg-label leading-zg-label text-[var(--zg-text-muted)] line-clamp-3 break-words",
563
+ children: exchange.answer
564
+ }),
565
+ cells.length > 0 && /* @__PURE__ */ jsx("div", {
566
+ className: "zg-meta flex flex-wrap items-center gap-1 min-w-0 mt-0.5",
567
+ children: cells.map((cell) => /* @__PURE__ */ jsx("span", {
568
+ className: "zg-meta-chip shrink min-w-0 max-w-full overflow-hidden",
569
+ "data-cell": cell.kind,
570
+ children: /* @__PURE__ */ jsx(ReceiptValue, {
571
+ text: cell.text,
572
+ className: RUN_RECEIPT_TINT[cell.kind]
573
+ })
574
+ }, cell.kind))
575
+ })
576
+ ]
577
+ });
578
+ }
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>;
@@ -5,10 +5,11 @@ import { ExchangeFoldRow } from "./fold.js";
5
5
  import { Dot, RowFrame, lineStateOf, useRowIcons } from "./frame.js";
6
6
  import { LazyRow } from "./LazyRow.js";
7
7
  import { MessageGroupRow } from "./messages.js";
8
- import { COMMAND_DETAIL_LINE, CommandDetailRow, CommandNoteRow, ErrorRow, FailureRow, InfoRow, NoticeRow, SessionEventRow, SpawnEndRow, SpawnStartRow } from "./notices.js";
8
+ import { COMMAND_DETAIL_LINE, CommandDetailRow, CommandNoteRow, ErrorRow, FailureRow, InfoRow, NoticeRow, RepairedRow, SessionEventRow, SpawnEndRow, SpawnStartRow } from "./notices.js";
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";
@@ -157,7 +158,10 @@ const TranscriptRow = memo(({ row, showCaret, receipt, resumable, ctx, renderRow
157
158
  notice: row.notice,
158
159
  text: row.text
159
160
  }) : /* @__PURE__ */ jsx(InfoRow, { text: row.text })),
160
- row.kind === "error" && (row.failure ? /* @__PURE__ */ jsx(FailureRow, {
161
+ row.kind === "error" && (row.repaired ? /* @__PURE__ */ jsx(RepairedRow, {
162
+ text: row.text,
163
+ detail: row.detail
164
+ }) : row.failure ? /* @__PURE__ */ jsx(FailureRow, {
161
165
  text: row.text,
162
166
  detail: row.detail,
163
167
  failure: row.failure,
@@ -218,11 +222,11 @@ const TranscriptRow = memo(({ row, showCaret, receipt, resumable, ctx, renderRow
218
222
  });
219
223
  TranscriptRow.displayName = "TranscriptRow";
220
224
  /** One root transcript row in its lazy wrapper, memoised on the row's own inputs. */
221
- const TranscriptRowSlot = memo(({ eager, estimatePx, style, stop, sel, className, ...row }) => {
225
+ const TranscriptRowSlot = memo(({ style, stop, sel, className, ...row }) => {
222
226
  return /* @__PURE__ */ jsx(LazyRow, {
223
227
  className,
224
- eager,
225
- estimatePx,
228
+ itemKey: row.row.id,
229
+ estimatePx: rowEstimatePx(row.row),
226
230
  style,
227
231
  "data-stop": stop,
228
232
  "data-sel": sel,