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
@@ -3,14 +3,16 @@ import { useStaysMounted } from "../../motion/collapse.js";
3
3
  import { useChatLabels } from "../useChatLabels.js";
4
4
  import { useModelName } from "./actions.js";
5
5
  import { AnsiText } from "./AnsiText.js";
6
+ import { ClippedOutputControls, useClippedOutput } from "./clipped-output.js";
6
7
  import { EditDiffBlock } from "./EditDiffBlock.js";
7
8
  import { Caret, FailedMark } from "./frame.js";
8
9
  import { ImageGenerationBlock, drawsImageGeneration } from "./ImageGenerationBlock.js";
9
10
  import { useTranscriptRenderers } from "./renderers.js";
10
11
  import { Rolling } from "./rolling.js";
12
+ import { useRowUiState } from "./row-ui-state.js";
11
13
  import { scriptInputProps } from "./script-input.js";
12
14
  import { ToolMedia, useToolMedia } from "./tool-media.js";
13
- import { CODE_PANEL, LoadFullOutputButton, ReadFileBlock, ToolGlyph, ToolInput, ToolTiming, useFullOutput } from "./tool-parts.js";
15
+ import { CODE_PANEL, LoadFullOutputButton, ReadFileBlock, ToolGlyph, ToolInput, ToolTiming, useFullToolCall } from "./tool-parts.js";
14
16
  import { Fragment, memo, useEffect, useMemo, useState } from "react";
15
17
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
16
18
  import { computeLineDiff, isMcpJobDone, scriptProgressView } from "zidane/chat/pure";
@@ -27,7 +29,7 @@ function toolRowPropsEqual(prev, next) {
27
29
  if (prev.mode !== next.mode || prev.showResult !== next.showResult || prev.showDiff !== next.showDiff || prev.lineState !== next.lineState || prev.className !== next.className || prev.style !== next.style) return false;
28
30
  const a = prev.tool;
29
31
  const b = next.tool;
30
- return a.name === b.name && a.displayName === b.displayName && a.result === b.result && a.ok === b.ok && a.edit === b.edit && a.rawInput === b.rawInput && a.resultClipped === b.resultClipped && a.callId === b.callId && a.startedAt === b.startedAt && a.durationMs === b.durationMs && a.waitingFor === b.waitingFor && a.resuming === b.resuming && a.scriptProgress === b.scriptProgress && a.mcpJob === b.mcpJob && a.approval === b.approval && formattedEqual(a.formatted, b.formatted);
32
+ return a.name === b.name && a.displayName === b.displayName && a.result === b.result && a.ok === b.ok && a.edit === b.edit && a.rawInput === b.rawInput && a.resultClipped === b.resultClipped && a.inputClipped === b.inputClipped && a.callId === b.callId && a.turnId === b.turnId && a.startedAt === b.startedAt && a.durationMs === b.durationMs && a.waitingFor === b.waitingFor && a.resuming === b.resuming && a.scriptProgress === b.scriptProgress && a.mcpJob === b.mcpJob && a.approval === b.approval && formattedEqual(a.formatted, b.formatted);
31
33
  }
32
34
  function formattedEqual(a, b) {
33
35
  if (a === b) return true;
@@ -89,10 +91,21 @@ const ToolRow = memo(({ tool, mode, showResult, showDiff, lineState, className,
89
91
  const labels = useChatLabels();
90
92
  const display = useDisplayPath();
91
93
  const { SessionTitle, ToolBody, hasToolBody } = useTranscriptRenderers();
92
- const [open, setOpen] = useState(false);
94
+ const [open, setOpen] = useRowUiState(`tool:${tool.id}`, false);
93
95
  /** Output revealed on demand while the "Tool outputs" setting is off. */
94
- const [revealOutput, setRevealOutput] = useState(false);
95
- const { full: fullResult, load: loadFullResult, available: canLoadFull, ready: fullReady } = useFullOutput(tool);
96
+ const [revealOutput, setRevealOutput] = useRowUiState(`tool-output:${tool.id}`, false);
97
+ const clippedOutput = useClippedOutput(tool);
98
+ const fullResult = clippedOutput.text;
99
+ const { full: fullCall, load: loadFullCall, available: canLoadCall, ready: callReady } = useFullToolCall(tool);
100
+ const input = fullCall !== "loading" && fullCall?.input ? fullCall.input : tool.rawInput;
101
+ const loadInputButton = tool.inputClipped && canLoadCall && (fullCall === null || fullCall === "loading") && /* @__PURE__ */ jsx(LoadFullOutputButton, {
102
+ loading: fullCall === "loading",
103
+ disabled: !callReady,
104
+ onClick: loadFullCall,
105
+ className: "mt-1.5",
106
+ label: labels.loadFullInput,
107
+ loadingLabel: labels.loadingFullInput
108
+ });
96
109
  const bodyMounted = useStaysMounted(open);
97
110
  const media = useToolMedia(tool, typeof fullResult === "string" ? fullResult : tool.result);
98
111
  const hasDiff = showDiff && tool.edit;
@@ -119,10 +132,8 @@ const ToolRow = memo(({ tool, mode, showResult, showDiff, lineState, className,
119
132
  const scriptInline = showInputPanel && tool.name === "codemode" && tool.scriptProgress !== void 0;
120
133
  const hasExpandable = interaction || showInputPanel || hasOutput || mode === "full" && tool.rawInput || hasDiff;
121
134
  const sweep = lineState === "running" && !tool.waitingFor;
122
- const outputBody = showOutputPanel ? /* @__PURE__ */ jsxs(Fragment$1, { children: [bodyMounted && canLoadFull && tool.resultClipped && typeof fullResult !== "string" && /* @__PURE__ */ jsx(LoadFullOutputButton, {
123
- loading: fullResult === "loading",
124
- disabled: !fullReady,
125
- onClick: loadFullResult,
135
+ const outputBody = showOutputPanel ? /* @__PURE__ */ jsxs(Fragment$1, { children: [bodyMounted && tool.resultClipped && /* @__PURE__ */ jsx(ClippedOutputControls, {
136
+ output: clippedOutput,
126
137
  className: "mt-1.5"
127
138
  }), !bodyMounted ? null : media ? /* @__PURE__ */ jsxs("div", {
128
139
  className: "mt-1.5 flex flex-col gap-1.5",
@@ -230,7 +241,11 @@ const ToolRow = memo(({ tool, mode, showResult, showDiff, lineState, className,
230
241
  "data-open": open,
231
242
  children: /* @__PURE__ */ jsx("div", {
232
243
  className: "zg-collapsible-inner",
233
- children: bodyMounted && /* @__PURE__ */ jsx(EditDiffBlock, { edit: tool.edit })
244
+ children: bodyMounted && /* @__PURE__ */ jsx(EditDiffBlock, {
245
+ edit: tool.edit,
246
+ ...tool.callId ? { callId: tool.callId } : {},
247
+ ...tool.turnId ? { turnId: tool.turnId } : {}
248
+ })
234
249
  })
235
250
  }),
236
251
  interaction && ToolBody && /* @__PURE__ */ jsx("div", {
@@ -249,12 +264,16 @@ const ToolRow = memo(({ tool, mode, showResult, showDiff, lineState, className,
249
264
  "data-open": open,
250
265
  children: /* @__PURE__ */ jsx("div", {
251
266
  className: "zg-collapsible-inner",
252
- children: bodyMounted && /* @__PURE__ */ jsxs(Fragment$1, { children: [showOutputPanel && !scriptInline && /* @__PURE__ */ jsx(PanelCaption, { children: labels.inputCaption }), /* @__PURE__ */ jsx(ToolInput, {
253
- name: tool.name,
254
- input: tool.rawInput,
255
- ...scriptInputProps(tool),
256
- ...scriptInline && outputBody ? { output: outputBody } : {}
257
- })] })
267
+ children: bodyMounted && /* @__PURE__ */ jsxs(Fragment$1, { children: [
268
+ showOutputPanel && !scriptInline && /* @__PURE__ */ jsx(PanelCaption, { children: labels.inputCaption }),
269
+ /* @__PURE__ */ jsx(ToolInput, {
270
+ name: tool.name,
271
+ input,
272
+ ...scriptInputProps(tool),
273
+ ...scriptInline && outputBody ? { output: outputBody } : {}
274
+ }),
275
+ loadInputButton
276
+ ] })
258
277
  })
259
278
  }),
260
279
  hasOutput && !showOutputPanel && /* @__PURE__ */ jsx("div", {
@@ -283,11 +302,11 @@ const ToolRow = memo(({ tool, mode, showResult, showDiff, lineState, className,
283
302
  "data-open": open,
284
303
  children: /* @__PURE__ */ jsx("div", {
285
304
  className: "zg-collapsible-inner",
286
- children: bodyMounted && /* @__PURE__ */ jsx(ToolInput, {
305
+ children: bodyMounted && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ToolInput, {
287
306
  name: tool.name,
288
- input: tool.rawInput,
307
+ input: input ?? tool.rawInput,
289
308
  ...scriptInputProps(tool)
290
- })
309
+ }), loadInputButton] })
291
310
  })
292
311
  })
293
312
  ]
@@ -2,7 +2,8 @@ import { ChatEvent } from "../headless/host.js";
2
2
  import { Cluster, Row } from "../headless/transcript/rows.js";
3
3
  import { SelectStops } from "../headless/transcript/select-stops.js";
4
4
  import "../headless/transcript/index.js";
5
- import { RunReceipt } from "zidane/chat/pure";
5
+ import { TranscriptRowsSlice } from "../headless/transcript/incremental.js";
6
+ import { RunReceipt, TranscriptEvents } from "zidane/chat/pure";
6
7
  /** The display options that shape the rows. */
7
8
  export interface TranscriptRowsInput {
8
9
  /** Show cache notices (cache expired / break, dropped reasoning). */
@@ -30,15 +31,30 @@ export interface TranscriptRows {
30
31
  clusters: readonly Cluster[];
31
32
  /** The reply still streaming: the only row with a caret. */
32
33
  lastStreamingRow: Row | null | undefined;
34
+ /**
35
+ * `visibleRows` and `clusters` split at the open exchange: `settled` keeps
36
+ * its arrays (and every row and cluster in them) while only the open
37
+ * exchange streams. A renderer can read these instead of the joined arrays.
38
+ */
39
+ parts?: {
40
+ settled: TranscriptRowsSlice;
41
+ open: TranscriptRowsSlice;
42
+ };
33
43
  }
44
+ /** A transcript's events: an array, or the transcript store a session stream store holds (`TranscriptEvents`). */
45
+ export type TranscriptSource = readonly ChatEvent[] | TranscriptEvents<ChatEvent>;
46
+ /** Rows, or what holds them (read only when needed: `useTranscriptRows`' result joins its parts on first read). */
47
+ type RowsSource = readonly Row[] | {
48
+ readonly visibleRows: readonly Row[];
49
+ };
34
50
  /**
35
- * Runs the headless pipeline over a transcript's events, one `useMemo` per pass, and returns the rows to paint.
51
+ * Runs the headless pipeline over a transcript's events, incrementally (only the open exchange re-derives per tick), and returns the rows to paint.
36
52
  *
37
- * @param events - The session's events, oldest first.
53
+ * @param events - The session's events, oldest first, or its transcript store (then nothing walks the settled exchanges per tick).
38
54
  * @param streaming - A run is in flight, so the last reply may still be streaming.
39
55
  * @param input - The display options that shape the rows.
40
56
  */
41
- export declare function useTranscriptRows(events: readonly ChatEvent[], streaming: boolean, { showCacheNotices, codemodeShowCalls, showEditDiffs, groupToolCalls, showRunReceipt, compact }: TranscriptRowsInput): TranscriptRows;
57
+ export declare function useTranscriptRows(events: TranscriptSource, streaming: boolean, { showCacheNotices, codemodeShowCalls, showEditDiffs, groupToolCalls, showRunReceipt, compact }: TranscriptRowsInput): TranscriptRows;
42
58
  /**
43
59
  * Select-turn stops (`computeSelectStops`): which turns the cursor walks
44
60
  * and which rows light up. Derived per transcript change while the mode is
@@ -47,10 +63,11 @@ export declare function useTranscriptRows(events: readonly ChatEvent[], streamin
47
63
  * before the mode is on, and on every arrow), cached per input so a burst
48
64
  * of arrows computes once.
49
65
  *
50
- * @param visibleRows - The rows painted, from {@link useTranscriptRows}.
51
- * @param events - The session's events, oldest first.
66
+ * @param visibleRows - The rows painted, or {@link useTranscriptRows}' result (its rows are read only while the mode is on or asked).
67
+ * @param events - The session's events, oldest first, or its transcript store (read as one array only while the mode is on or asked).
52
68
  * @param showThinking - Reasoning rows are shown, so they can be stops.
53
69
  * @param selecting - Select-turn mode is on.
54
70
  * @param registerStops - Hands the app the stops source; returns its unregister function.
55
71
  */
56
- export declare function useSelectStops(visibleRows: readonly Row[], events: readonly ChatEvent[], showThinking: boolean, selecting: boolean, registerStops: ((source: () => SelectStops) => () => void) | undefined): SelectStops | null;
72
+ export declare function useSelectStops(visibleRows: RowsSource, events: TranscriptSource, showThinking: boolean, selecting: boolean, registerStops: ((source: () => SelectStops) => () => void) | undefined): SelectStops | null;
73
+ export {};
@@ -1,58 +1,40 @@
1
- import { batchTaskRuns, batchThinkingRuns, batchToolRuns, clusterByOwner } from "../headless/transcript/batch.js";
2
- import { collapseEvents } from "../headless/transcript/collapse.js";
3
1
  import { computeSelectStops } from "../headless/transcript/select-stops.js";
4
- import { dockRunReceipts, findLastStreamingRow, foldExchanges } from "../headless/transcript/fold.js";
5
- import { markRunFailures } from "../headless/transcript/run-failures.js";
6
- import { nestToolCalls, nestedCallVisible } from "../headless/transcript/nesting.js";
2
+ import { createTranscriptRowsDeriver } from "../headless/transcript/incremental.js";
7
3
  import { isHiddenRow } from "./TranscriptRow.js";
8
- import { useEffect, useLayoutEffect, useMemo, useRef } from "react";
9
- import { gatherCommandNotes, isCacheNotice, turnSelectionOwnership } from "zidane/chat/pure";
4
+ import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
5
+ import { transcriptArray, turnSelectionOwnership } from "zidane/chat/pure";
10
6
  // src/chat/transcript/use-transcript-rows.ts
11
- const asStream = (events) => events;
7
+ function asStream(events) {
8
+ return Array.isArray(events) ? events : transcriptArray(events);
9
+ }
10
+ const rowsOf = (rows) => Array.isArray(rows) ? rows : rows.visibleRows;
12
11
  /**
13
- * Runs the headless pipeline over a transcript's events, one `useMemo` per pass, and returns the rows to paint.
12
+ * Runs the headless pipeline over a transcript's events, incrementally (only the open exchange re-derives per tick), and returns the rows to paint.
14
13
  *
15
- * @param events - The session's events, oldest first.
14
+ * @param events - The session's events, oldest first, or its transcript store (then nothing walks the settled exchanges per tick).
16
15
  * @param streaming - A run is in flight, so the last reply may still be streaming.
17
16
  * @param input - The display options that shape the rows.
18
17
  */
19
18
  function useTranscriptRows(events, streaming, { showCacheNotices, codemodeShowCalls, showEditDiffs, groupToolCalls, showRunReceipt, compact }) {
20
- const shownEvents = useMemo(() => {
21
- const shown = showCacheNotices && codemodeShowCalls ? events : events.filter((event) => (showCacheNotices || !isCacheNotice(event.notice)) && nestedCallVisible(event, codemodeShowCalls));
22
- return gatherCommandNotes(asStream(shown));
23
- }, [
19
+ const [deriver] = useState(createTranscriptRowsDeriver);
20
+ return useMemo(() => deriver.derive(events, streaming, {
21
+ showCacheNotices,
22
+ codemodeShowCalls,
23
+ showEditDiffs,
24
+ groupToolCalls,
25
+ showRunReceipt,
26
+ compact
27
+ }), [
28
+ deriver,
24
29
  events,
30
+ streaming,
25
31
  showCacheNotices,
26
- codemodeShowCalls
27
- ]);
28
- const rows = useMemo(() => nestToolCalls(collapseEvents(shownEvents, showEditDiffs, streaming)), [
29
- shownEvents,
32
+ codemodeShowCalls,
30
33
  showEditDiffs,
31
- streaming
32
- ]);
33
- const batched = useMemo(() => batchTaskRuns(batchThinkingRuns(batchToolRuns(rows, groupToolCalls))), [rows, groupToolCalls]);
34
- const failed = useMemo(() => markRunFailures(batched), [batched]);
35
- const { visibleRows: dockedRows, receiptByRowId } = useMemo(() => dockRunReceipts(failed, showRunReceipt), [failed, showRunReceipt]);
36
- const visibleRows = useMemo(() => compact ? foldExchanges(dockedRows, streaming) : dockedRows, [
37
- dockedRows,
38
- compact,
39
- streaming
34
+ groupToolCalls,
35
+ showRunReceipt,
36
+ compact
40
37
  ]);
41
- return {
42
- visibleRows,
43
- receiptByRowId,
44
- resumableId: useMemo(() => {
45
- if (streaming) return null;
46
- for (let i = visibleRows.length - 1; i >= 0; i--) {
47
- const row = visibleRows[i];
48
- if (row.kind === "separator" || row.kind === "run-summary") continue;
49
- return row.kind === "error" && row.failure ? row.id : null;
50
- }
51
- return null;
52
- }, [visibleRows, streaming]),
53
- clusters: useMemo(() => clusterByOwner(visibleRows), [visibleRows]),
54
- lastStreamingRow: findLastStreamingRow(visibleRows)
55
- };
56
38
  }
57
39
  /**
58
40
  * Select-turn stops (`computeSelectStops`): which turns the cursor walks
@@ -62,14 +44,14 @@ function useTranscriptRows(events, streaming, { showCacheNotices, codemodeShowCa
62
44
  * before the mode is on, and on every arrow), cached per input so a burst
63
45
  * of arrows computes once.
64
46
  *
65
- * @param visibleRows - The rows painted, from {@link useTranscriptRows}.
66
- * @param events - The session's events, oldest first.
47
+ * @param visibleRows - The rows painted, or {@link useTranscriptRows}' result (its rows are read only while the mode is on or asked).
48
+ * @param events - The session's events, oldest first, or its transcript store (read as one array only while the mode is on or asked).
67
49
  * @param showThinking - Reasoning rows are shown, so they can be stops.
68
50
  * @param selecting - Select-turn mode is on.
69
51
  * @param registerStops - Hands the app the stops source; returns its unregister function.
70
52
  */
71
53
  function useSelectStops(visibleRows, events, showThinking, selecting, registerStops) {
72
- const stops = useMemo(() => selecting ? computeSelectStops(visibleRows, turnSelectionOwnership(asStream(events)), (row) => isHiddenRow(row, showThinking)) : null, [
54
+ const stops = useMemo(() => selecting ? computeSelectStops(rowsOf(visibleRows), turnSelectionOwnership(asStream(events)), (row) => isHiddenRow(row, showThinking)) : null, [
73
55
  selecting,
74
56
  visibleRows,
75
57
  events,
@@ -94,7 +76,7 @@ function useSelectStops(visibleRows, events, showThinking, selecting, registerSt
94
76
  const { rows, events: evts, showThinking: show } = stopsInput.current;
95
77
  const hit = stopsCache.current;
96
78
  if (hit && hit.rows === rows && hit.events === evts && hit.show === show) return hit.stops;
97
- const fresh = computeSelectStops(rows, turnSelectionOwnership(asStream(evts)), (row) => isHiddenRow(row, show));
79
+ const fresh = computeSelectStops(rowsOf(rows), turnSelectionOwnership(asStream(evts)), (row) => isHiddenRow(row, show));
98
80
  stopsCache.current = {
99
81
  rows,
100
82
  events: evts,
@@ -10,7 +10,9 @@ import { useLayoutEffect, useState } from "react";
10
10
  * visibly jumps while it loads.
11
11
  *
12
12
  * Veiled from the frame `ready` (the transcript hydrated) holds for `key`,
13
- * before paint. Revealed once no lookup has been in flight for two frames
13
+ * before paint, only when it loads after the thread opened: a thread already
14
+ * loaded when it opens (switching back to it) shows at once. Its chips are
15
+ * known, and hiding it to fade it back in is the blink this exists to avoid. Revealed once no lookup has been in flight for two frames
14
16
  * (a lookup's answer re-renders rows, which may start the next one), or at
15
17
  * `maxMs`, so a slow server (a Linear MCP call) never holds a thread back
16
18
  * for long: what lands later still moves, but that is the rare cold read;
@@ -37,8 +39,17 @@ async function settled(deadline) {
37
39
  */
38
40
  function useSettledReveal(key, ready, maxMs = REVEAL_MAX_MS) {
39
41
  const [veiledFor, setVeiledFor] = useState(null);
42
+ const [opened, setOpened] = useState({
43
+ key,
44
+ loaded: ready
45
+ });
46
+ if (opened.key !== key) setOpened({
47
+ key,
48
+ loaded: ready
49
+ });
50
+ const loadedAtOpen = opened.key === key ? opened.loaded : ready;
40
51
  useLayoutEffect(() => {
41
- if (!key || !ready) return void 0;
52
+ if (!key || !ready || loadedAtOpen) return void 0;
42
53
  setVeiledFor(key);
43
54
  let live = true;
44
55
  settled(performance.now() + maxMs).then(() => {
@@ -50,7 +61,8 @@ function useSettledReveal(key, ready, maxMs = REVEAL_MAX_MS) {
50
61
  }, [
51
62
  key,
52
63
  ready,
53
- maxMs
64
+ maxMs,
65
+ loadedAtOpen
54
66
  ]);
55
67
  return key !== null && veiledFor === key;
56
68
  }
@@ -1,5 +1,6 @@
1
1
  import { currentMotionTransition } from "../../motion/springs.js";
2
- import { mountRowNow } from "./LazyRow.js";
2
+ import { dataRowSelector } from "../headless/transcript/rail.js";
3
+ import { revealRow } from "./row-mount.js";
3
4
  import { mayShrink } from "./scroll-clamp.js";
4
5
  import { viewAbove } from "./view-anchor.js";
5
6
  import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
@@ -358,9 +359,8 @@ function useStickToBottom(scrollRef, { paused = false, rowSelector = ".zg-cv-row
358
359
  settle();
359
360
  };
360
361
  restoreRows.current = (rows) => {
361
- const find = (id) => el.querySelector(`[data-row="${id.replace(/["\\]/g, (c) => `\\${c}`)}"]`);
362
- const outer = rows.length > 0 ? find(rows[rows.length - 1].id) : null;
363
- if (outer) mountRowNow(outer);
362
+ const find = (id) => el.querySelector(dataRowSelector(id));
363
+ if (rows.length > 0) revealRow(el, rows[rows.length - 1].id);
364
364
  for (const [i, place] of rows.entries()) {
365
365
  const target = find(place.id);
366
366
  if (!target) continue;
@@ -1,5 +1,6 @@
1
1
  import { useHydrated } from "../../hooks/useHydrated.js";
2
- import { holdForceMountRows, useForceMountRows } from "./LazyRow.js";
2
+ import { holdForceMountRows, useForcedRows } from "./LazyRow.js";
3
+ import { mountAround } from "./row-mount.js";
3
4
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  // src/chat/transcript/useTranscriptSearch.tsx
@@ -14,9 +15,10 @@ import { jsx } from "react/jsx-runtime";
14
15
  * re-deriving text from stream events — the DOM is the source of truth
15
16
  * for "what the user can see" (markdown rendering, tool-row formatting,
16
17
  * masking all live there). `content-visibility: auto` rows keep their
17
- * text in the DOM even when paint is skipped, and rows that mount on
18
- * approach (`LazyRow`) are all mounted while a needle is active, so the
19
- * walk still finds offscreen matches. Highlighting uses the CSS Custom Highlight API
18
+ * text in the DOM even when paint is skipped, and while a needle is
19
+ * active the transcript mounts the rows whose data holds it wherever they
20
+ * are (`holdForceMountRows`), so the walk still finds matches in rows
21
+ * that never mounted or parked. Highlighting uses the CSS Custom Highlight API
20
22
  * (`CSS.highlights`) so we never mutate the transcript's DOM — wrapping
21
23
  * matches in `<mark>` would fight React's reconciler on the next
22
24
  * streaming tick.
@@ -121,10 +123,16 @@ function releaseHighlights(owner) {
121
123
  /**
122
124
  * Jump to a match's row. `block: 'center'` keeps context visible above
123
125
  * and below; on a `content-visibility: auto` row this forces render,
124
- * which is exactly what we want before the user reads the match.
126
+ * which is exactly what we want before the user reads the match. The rows
127
+ * around it that have not mounted mount first (`mountAround`), at their
128
+ * real heights: mounting after the jump, they would push the match out of
129
+ * view. Their render lands with the next commit, so the jump waits for it.
125
130
  */
126
- function scrollToRange(range) {
127
- range.startContainer.parentElement?.scrollIntoView({ block: "center" });
131
+ function scrollToRange(range, root) {
132
+ const target = range.startContainer.parentElement;
133
+ if (!target) return;
134
+ if (root && mountAround(root, target, root.clientHeight)) queueMicrotask(() => target.isConnected && target.scrollIntoView({ block: "center" }));
135
+ else target.scrollIntoView({ block: "center" });
128
136
  }
129
137
  /**
130
138
  * `revision` is any value whose identity changes when the transcript
@@ -174,9 +182,10 @@ function useTranscriptSearch(container, query, revision, { terms, revealFirstMat
174
182
  * sees the freshly-rendered rows.
175
183
  */
176
184
  const prevNeedleRef = useRef("");
177
- const rowsMounted = useForceMountRows();
185
+ const forced = useForcedRows();
178
186
  const searching = needle.key !== "";
179
- useEffect(() => searching ? holdForceMountRows() : void 0, [searching]);
187
+ useEffect(() => searching ? holdForceMountRows(needle.needles) : void 0, [searching, needle]);
188
+ const rowsMounted = forced.all || needle.needles.every((n) => forced.needles.includes(n));
180
189
  /** A rescan the transcript changing asked for, waiting out a burst of stream updates. */
181
190
  const rescanTimer = useRef(null);
182
191
  useEffect(() => () => {
@@ -188,12 +197,12 @@ function useTranscriptSearch(container, query, revision, { terms, revealFirstMat
188
197
  if (searching && !rowsMounted) return;
189
198
  const needleChanged = prevNeedleRef.current !== needle.key;
190
199
  if (needleChanged && prevNeedleRef.current !== "") revealArmed.current = false;
191
- prevNeedleRef.current = needle.key;
192
200
  if (rescanTimer.current) {
193
201
  clearTimeout(rescanTimer.current);
194
202
  rescanTimer.current = null;
195
203
  }
196
204
  if (!root || !searching) {
205
+ prevNeedleRef.current = needle.key;
197
206
  if (rangesRef.current.length === 0 && !needleChanged) return;
198
207
  rangesRef.current = [];
199
208
  setMatches((prev) => prev.count === 0 && !prev.capped ? prev : {
@@ -206,6 +215,7 @@ function useTranscriptSearch(container, query, revision, { terms, revealFirstMat
206
215
  }
207
216
  const scan = () => {
208
217
  rescanTimer.current = null;
218
+ prevNeedleRef.current = needle.key;
209
219
  const ranges = collectMatches(root, needle.needles);
210
220
  const jump = needleChanged || revealArmed.current;
211
221
  const nextIndex = needleChanged ? 0 : Math.min(activeIndexRef.current, Math.max(0, ranges.length - 1));
@@ -218,11 +228,17 @@ function useTranscriptSearch(container, query, revision, { terms, revealFirstMat
218
228
  setHighlights(owner, ranges, nextIndex);
219
229
  if (jump && ranges.length > 0) {
220
230
  revealArmed.current = false;
221
- scrollToRange(ranges[nextIndex]);
231
+ scrollToRange(ranges[nextIndex], root);
222
232
  }
223
233
  };
224
- if (needleChanged) scan();
225
- else rescanTimer.current = setTimeout(scan, RESCAN_MS);
234
+ if (needleChanged) {
235
+ let live = true;
236
+ queueMicrotask(() => live && scan());
237
+ return () => {
238
+ live = false;
239
+ };
240
+ }
241
+ rescanTimer.current = setTimeout(scan, RESCAN_MS);
226
242
  }, [
227
243
  needle,
228
244
  searching,
@@ -241,7 +257,7 @@ function useTranscriptSearch(container, query, revision, { terms, revealFirstMat
241
257
  const next = (activeIndexRef.current + direction + ranges.length) % ranges.length;
242
258
  setActiveIndex(next);
243
259
  setHighlights(ownerRef.current, ranges, next);
244
- scrollToRange(ranges[next]);
260
+ scrollToRange(ranges[next], container.current);
245
261
  }, []);
246
262
  return {
247
263
  count: matches.count,
@@ -10,7 +10,7 @@ import { ViewAnswer, ViewAnswers } from "../../views/headless/answers.js";
10
10
  import { ReplyViewPlace, TextlessExchange } from "../../views/headless/placement.js";
11
11
  import { ChatEvent } from "../headless/host.js";
12
12
  import { ReactNode } from "react";
13
- import { ViewsOrchestrationMode } from "zidane/chat/pure";
13
+ import { TranscriptEvents, ViewsOrchestrationMode } from "zidane/chat/pure";
14
14
  /** Props of the views chunk's fence: see `ui/src/views/TranscriptViews.tsx`. */
15
15
  export interface ViewFencePartProps {
16
16
  /** The fence body. */
@@ -143,8 +143,13 @@ export declare function viewFenceStarts(text: string): readonly number[];
143
143
  * The fences of each chunk of a reply.
144
144
  *
145
145
  * @param chunks - The reply's chunks.
146
+ * @param previous - The last call's chunks and result: a chunk still the same string is not read again (a streaming
147
+ * reply's closed chunks keep theirs), and keeps its value while its base does.
146
148
  */
147
- export declare function chunkFencesFor(chunks: readonly string[]): ChunkFences[];
149
+ export declare function chunkFencesFor(chunks: readonly string[], previous?: {
150
+ chunks: readonly string[];
151
+ fences: readonly ChunkFences[];
152
+ } | null): ChunkFences[];
148
153
  /**
149
154
  * Provides one chunk's fences. The value stays while its base and starts do: a streamed chunk
150
155
  * that grows with no new fence changes nothing below it.
@@ -163,21 +168,36 @@ export declare function ChunkFencesScope({ base, starts, children }: ChunkFences
163
168
  export declare function fenceIndexIn(chunk: ChunkFences, offset: number): number;
164
169
  /** Where each reply row's views go, read per row: a row draws again only when its own place changes. */
165
170
  export declare class ReplyViewPlaces {
166
- private map;
171
+ /** The places of the settled exchanges (or of a whole array). */
172
+ private base;
173
+ /** The places the open exchange sets, over `base`. */
174
+ private top;
175
+ private source;
167
176
  private events;
177
+ /** The folds of a transcript store's settled exchanges, per chunk list. */
178
+ private settled;
168
179
  private textless;
180
+ private textlessKey;
169
181
  private readonly changed;
170
182
  private readonly listeners;
171
183
  /**
172
184
  * Reads the events: the places (`viewPlacements`) and the exchanges with no reply text
173
185
  * (`textlessExchanges`). A stream tick changes neither, so it reads nothing. Rows rendering
174
- * after it read the places; {@link flush} tells the others.
186
+ * after it read the places; {@link flush} tells the others. A transcript store's settled
187
+ * exchanges are read once: a tick reads its open exchange.
175
188
  *
176
- * @param events - The session's events, oldest first.
189
+ * @param events - The session's events, oldest first, or its transcript store.
177
190
  */
178
- update(events: readonly ChatEvent[]): void;
191
+ update(events: readonly ChatEvent[] | TranscriptEvents<ChatEvent>): void;
192
+ private updateTranscript;
179
193
  /** The exchanges with no reply text, as of the last {@link update}. */
180
194
  get textlessExchanges(): readonly TextlessExchange[];
195
+ /** The places as one map (the array path's `previous`). */
196
+ private flat;
197
+ /**
198
+ * Sets the places, noting the rows whose place changed: every row when `whole`, else those the
199
+ * open exchange set before or sets now (the base is the same).
200
+ */
181
201
  private replace;
182
202
  /** Tells the rows whose place changed since the last flush. */
183
203
  flush(): void;