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,6 +3,7 @@
3
3
  const MAX_CHARS = 4e5;
4
4
  const entries = /* @__PURE__ */ new Map();
5
5
  let chars = 0;
6
+ let inserts = 0;
6
7
  const ids = /* @__PURE__ */ new WeakMap();
7
8
  let nextId = 1;
8
9
  function idOf(value) {
@@ -37,6 +38,7 @@ function cachedMarkdown(text, key, parse) {
37
38
  chars -= hit.text.length;
38
39
  }
39
40
  const element = parse();
41
+ inserts++;
40
42
  entries.set(id, {
41
43
  element,
42
44
  text
@@ -53,5 +55,14 @@ function cachedMarkdown(text, key, parse) {
53
55
  function clearMarkdownCache() {
54
56
  entries.clear();
55
57
  chars = 0;
58
+ inserts = 0;
56
59
  }
57
- export { cachedMarkdown, clearMarkdownCache };
60
+ /** What the cache holds, and how many parses it took in since it was last emptied (tests, benches). */
61
+ function markdownCacheStats() {
62
+ return {
63
+ entries: entries.size,
64
+ chars,
65
+ inserts
66
+ };
67
+ }
68
+ export { cachedMarkdown, clearMarkdownCache, markdownCacheStats };
@@ -3,13 +3,14 @@ import { CodeFrame } from "../../components/CodeFrame.js";
3
3
  import { useExtensionItems } from "../../extensions/ExtensionsProvider.js";
4
4
  import { renderersFor } from "../../extensions/headless/select.js";
5
5
  import { useLinkRouter } from "../../extensions/links.js";
6
- import { openFenceOf, splitMarkdown, withoutPartialEmphasis, withoutPartialFence } from "../headless/markdown-chunks.js";
6
+ import { splitMarkdown } from "../headless/markdown-chunks.js";
7
+ import { MarkdownStream } from "../headless/markdown-stream.js";
7
8
  import { DiagramsContext } from "./diagrams-scope.js";
8
9
  import { useBackgroundMount, useForceMountRows } from "./LazyRow.js";
9
10
  import { cachedMarkdown } from "./markdown-cache.js";
10
11
  import { useShellBlockRunner } from "./shell-block-scope.js";
11
12
  import { ChunkFencesContext, ChunkFencesScope, ViewFencePart, chunkFencesFor, fenceIndexIn, preloadViews, useViewTurn, useViewsEnabled, viewFenceStarts } from "./view-scope.js";
12
- import { Fragment, Suspense, createContext, lazy, memo, useContext, useEffect, useMemo, useRef, useState } from "react";
13
+ import { Suspense, createContext, lazy, memo, useContext, useEffect, useMemo, useRef, useState } from "react";
13
14
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
14
15
  import { isShellFence, mayHoldViewFence } from "zidane/chat/pure";
15
16
  import ReactMarkdown, { defaultUrlTransform } from "react-markdown";
@@ -246,16 +247,55 @@ const documentComponents = {
246
247
  em: ({ children }) => /* @__PURE__ */ jsx("em", { children })
247
248
  };
248
249
  const REMARK_PLUGINS = [remarkGfm];
249
- const MarkdownChunk = memo(({ text, document, plugins, urlTransform }) => cachedMarkdown(text, {
250
- document: Boolean(document),
251
- plugins: plugins ?? void 0,
252
- urlTransform
253
- }, () => ReactMarkdown({
254
- remarkPlugins: plugins,
255
- components: document ? documentComponents : components,
256
- ...urlTransform ? { urlTransform } : {},
257
- children: text
258
- })));
250
+ function sameParseKey(a, b) {
251
+ return a.document === b.document && a.plugins === b.plugins && a.urlTransform === b.urlTransform;
252
+ }
253
+ const MarkdownChunk = memo(({ text, document, plugins, urlTransform, live = false }) => {
254
+ const key = {
255
+ document: Boolean(document),
256
+ plugins: plugins ?? void 0,
257
+ urlTransform
258
+ };
259
+ const last = useRef(null);
260
+ const parse = () => ReactMarkdown({
261
+ remarkPlugins: plugins,
262
+ components: document ? documentComponents : components,
263
+ ...urlTransform ? { urlTransform } : {},
264
+ children: text
265
+ });
266
+ const held = last.current;
267
+ const element = live ? parse() : cachedMarkdown(text, key, () => held && held.text === text && sameParseKey(held.key, key) ? held.element : parse());
268
+ last.current = {
269
+ text,
270
+ key,
271
+ element
272
+ };
273
+ return element;
274
+ });
275
+ /** One chunk: its parse, in its view fences' scope with views on. */
276
+ function ChunkPart({ text, fences, document, plugins, urlTransform, live = false }) {
277
+ const parsed = /* @__PURE__ */ jsx(MarkdownChunk, {
278
+ text,
279
+ document,
280
+ plugins,
281
+ urlTransform,
282
+ live
283
+ });
284
+ return fences ? /* @__PURE__ */ jsx(ChunkFencesScope, {
285
+ base: fences.base,
286
+ starts: fences.starts,
287
+ children: parsed
288
+ }) : parsed;
289
+ }
290
+ /**
291
+ * The chunks that no longer change, as siblings in the prose box. It renders again only when one more closes (the
292
+ * stream keeps the array until then), so a frame of a long streaming reply reconciles its tail, not every chunk.
293
+ */
294
+ const SettledChunks = memo(({ chunks, count, fences, ...rest }) => /* @__PURE__ */ jsx(Fragment$1, { children: chunks.slice(0, count).map((chunk, i) => /* @__PURE__ */ jsx(ChunkPart, {
295
+ text: chunk,
296
+ fences: fences?.[i],
297
+ ...rest
298
+ }, i)) }));
259
299
  /** Chunks rendered in a long text's first commit, then per frame until all are in. */
260
300
  const CHUNKS_PER_FRAME = 2;
261
301
  /**
@@ -270,16 +310,35 @@ const CHUNKS_PER_FRAME = 2;
270
310
  * @param props - The {@link MarkdownProps}.
271
311
  */
272
312
  const Markdown = memo(({ children, className, style, document, streaming = false, remarkPlugins = REMARK_PLUGINS, urlTransform, CodeBlock = HighlightedCode, Link = PlainLink, InlineCode, Image }) => {
273
- const streamed = useRef(streaming);
274
- if (streaming) streamed.current = true;
275
- const fine = streamed.current;
313
+ const stream = useRef(null);
314
+ if (streaming) stream.current ??= new MarkdownStream();
276
315
  const views = useViewsEnabled();
277
- const chunks = useMemo(() => splitMarkdown(streaming ? withoutPartialEmphasis(withoutPartialFence(children)) : children, { streaming: fine }), [
278
- children,
279
- streaming,
280
- fine
281
- ]);
282
- const chunkFences = useMemo(() => views ? chunkFencesFor(chunks) : null, [chunks, views]);
316
+ const { closed, tail, fence } = useMemo(() => {
317
+ if (!stream.current) {
318
+ const chunks = splitMarkdown(children);
319
+ return {
320
+ closed: chunks.slice(0, -1),
321
+ tail: chunks.at(-1),
322
+ fence: null
323
+ };
324
+ }
325
+ return stream.current.frame(children, streaming);
326
+ }, [children, streaming]);
327
+ const fencesMemo = useRef(null);
328
+ const closedFences = useMemo(() => {
329
+ if (!views) return null;
330
+ const fences = chunkFencesFor(closed, fencesMemo.current);
331
+ fencesMemo.current = {
332
+ chunks: closed,
333
+ fences
334
+ };
335
+ return fences;
336
+ }, [closed, views]);
337
+ const lastFences = closedFences?.at(-1);
338
+ const tailFences = views ? {
339
+ base: lastFences ? lastFences.base + lastFences.starts.length : 0,
340
+ starts: viewFenceStarts(tail)
341
+ } : null;
283
342
  const parts = useMemo(() => ({
284
343
  CodeBlock,
285
344
  Link,
@@ -291,16 +350,16 @@ const Markdown = memo(({ children, className, style, document, streaming = false
291
350
  InlineCode,
292
351
  Image
293
352
  ]);
294
- const tail = streaming ? openFenceOf(chunks[chunks.length - 1]) : null;
295
353
  const searching = useForceMountRows();
296
354
  const renderers = useExtensionItems("renderer");
297
355
  const diagrams = useContext(DiagramsContext) && !claimsLanguage(renderers, "mermaid");
298
- if (views && streaming && mayHoldViewFence(chunks[chunks.length - 1] ?? "") && !claimsLanguage(renderers, "view")) preloadViews();
356
+ if (views && streaming && mayHoldViewFence(tail) && !claimsLanguage(renderers, "view")) preloadViews();
299
357
  const background = useBackgroundMount();
300
358
  const [shown, setShown] = useState(CHUNKS_PER_FRAME);
301
- const complete = useRef(!background || chunks.length <= CHUNKS_PER_FRAME);
302
- if (searching || shown >= chunks.length) complete.current = true;
303
- const visible = complete.current ? chunks.length : shown;
359
+ const total = closed.length + 1;
360
+ const complete = useRef(!background || total <= CHUNKS_PER_FRAME);
361
+ if (searching || shown >= total) complete.current = true;
362
+ const visible = complete.current ? total : shown;
304
363
  useEffect(() => {
305
364
  if (complete.current) return void 0;
306
365
  let timer = 0;
@@ -312,38 +371,41 @@ const Markdown = memo(({ children, className, style, document, streaming = false
312
371
  window.clearTimeout(timer);
313
372
  };
314
373
  }, [visible]);
374
+ const plugins = remarkPlugins;
375
+ const transform = Image ? withMediaSources(urlTransform) : urlTransform;
376
+ const tailText = fence ? fence.before : tail;
377
+ const tailShown = closed.length < visible;
315
378
  return /* @__PURE__ */ jsx(PartsContext.Provider, {
316
379
  value: parts,
317
- children: /* @__PURE__ */ jsx("div", {
380
+ children: /* @__PURE__ */ jsxs("div", {
318
381
  className: `zg-md${views ? " zg-md-views" : ""} ${className ?? ""}`,
319
382
  style,
320
- children: chunks.slice(0, visible).map((chunk, i) => {
321
- const fence = tail && i === chunks.length - 1 ? tail : null;
322
- const text = fence ? fence.before : chunk;
323
- const parsed = text ? /* @__PURE__ */ jsx(MarkdownChunk, {
324
- text,
325
- document,
326
- plugins: remarkPlugins,
327
- urlTransform: Image ? withMediaSources(urlTransform) : urlTransform
328
- }) : null;
329
- const fences = chunkFences?.[i];
330
- return /* @__PURE__ */ jsxs(Fragment, { children: [fences && parsed ? /* @__PURE__ */ jsx(ChunkFencesScope, {
331
- base: fences.base,
332
- starts: fences.starts,
333
- children: parsed
334
- }) : parsed, fence ? diagrams && fence.language === "mermaid" && fence.code.trim() ? /* @__PURE__ */ jsx(DiagramFence, {
335
- code: fence.code,
336
- streaming: true
337
- }) : views && fence.language === "view" ? /* @__PURE__ */ jsx(ViewFenceBlock, {
338
- code: fence.code,
339
- index: (fences?.base ?? 0) + viewFenceStarts(fence.before).length,
340
- streaming: true,
341
- CodeBlock
342
- }) : /* @__PURE__ */ jsx(CodeBlock, {
343
- code: fence.code,
344
- language: fence.language
345
- }) : null] }, i);
346
- })
383
+ children: [/* @__PURE__ */ jsx(SettledChunks, {
384
+ chunks: closed,
385
+ count: Math.min(visible, closed.length),
386
+ fences: closedFences,
387
+ document,
388
+ plugins,
389
+ urlTransform: transform
390
+ }), tailShown ? /* @__PURE__ */ jsxs(Fragment$1, { children: [tailText ? /* @__PURE__ */ jsx(ChunkPart, {
391
+ text: tailText,
392
+ fences: tailFences,
393
+ document,
394
+ plugins,
395
+ urlTransform: transform,
396
+ live: streaming
397
+ }) : null, fence ? diagrams && fence.language === "mermaid" && fence.code.trim() ? /* @__PURE__ */ jsx(DiagramFence, {
398
+ code: fence.code,
399
+ streaming: true
400
+ }) : views && fence.language === "view" ? /* @__PURE__ */ jsx(ViewFenceBlock, {
401
+ code: fence.code,
402
+ index: (tailFences?.base ?? 0) + viewFenceStarts(fence.before).length,
403
+ streaming: true,
404
+ CodeBlock
405
+ }) : /* @__PURE__ */ jsx(CodeBlock, {
406
+ code: fence.code,
407
+ language: fence.language
408
+ }) : null] }) : null]
347
409
  })
348
410
  });
349
411
  });
@@ -13,6 +13,7 @@
13
13
  import { ChatEvent } from "../headless/host.js";
14
14
  import { TranscriptActions } from "./actions.js";
15
15
  import { MouseEvent, ReactNode } from "react";
16
+ import { TranscriptEvents } from "zidane/chat/pure";
16
17
  /** What a medium's component hands the gallery: its key, and for the menu what it is and where it loads from. */
17
18
  export interface GalleryMedium {
18
19
  /** Its key in its exchange (`mediumKey`). */
@@ -43,8 +44,8 @@ export declare function useMediaGallery(): MediaGallery | null;
43
44
  export declare function messageMediaUrlOf(actions: Pick<TranscriptActions, 'messageMediaUrl'>, src: string): string | undefined;
44
45
  /** Props for {@link MediaGalleryProvider}. */
45
46
  export interface MediaGalleryProviderProps {
46
- /** The transcript's events, whose media the gallery steps through. */
47
- events: readonly ChatEvent[];
47
+ /** The transcript's events, whose media the gallery steps through, or its transcript store (read when a medium opens). */
48
+ events: readonly ChatEvent[] | TranscriptEvents<ChatEvent>;
48
49
  children?: ReactNode;
49
50
  }
50
51
  /**
@@ -5,11 +5,11 @@ import { exchangesMedia } from "../headless/transcript/exchange-media.js";
5
5
  import { PdfPreview } from "../PdfPreview.js";
6
6
  import { TextPreview } from "../TextPreview.js";
7
7
  import { useChatLabels } from "../useChatLabels.js";
8
- import { useTranscriptActions } from "./actions.js";
8
+ import { attachmentSrcOf, toolMediaSrcOf, useTranscriptActions } from "./actions.js";
9
9
  import { useTranscriptRenderers } from "./renderers.js";
10
10
  import { Suspense, createContext, lazy, useCallback, useContext, useMemo, useRef, useState } from "react";
11
11
  import { jsx, jsxs } from "react/jsx-runtime";
12
- import { messageMediaOf } from "zidane/chat/pure";
12
+ import { messageMediaOf, transcriptArray } from "zidane/chat/pure";
13
13
  // src/chat/transcript/media-gallery.tsx
14
14
  const RowActionsMenu = lazy(() => import("../../components/RowActionsMenu.js").then((m) => ({ default: m.RowActionsMenu })));
15
15
  const GalleryContext = createContext(null);
@@ -170,7 +170,7 @@ function lightboxItemOf(medium, { actions, mediumActions, TextPreview, isLoaded
170
170
  };
171
171
  }
172
172
  if (medium.from === "tool") {
173
- const url = actions.toolMediaUrl?.(medium.callId, medium.index);
173
+ const url = toolMediaSrcOf(actions, medium.callId, medium);
174
174
  if (!url) return null;
175
175
  return {
176
176
  key: medium.key,
@@ -257,17 +257,20 @@ function MediaGalleryProvider({ events, children }) {
257
257
  const live = useRef({
258
258
  itemOf,
259
259
  lightbox,
260
- mediumActions
260
+ mediumActions,
261
+ actions
261
262
  });
262
263
  live.current = {
263
264
  itemOf,
264
265
  lightbox,
265
- mediumActions
266
+ mediumActions,
267
+ actions
266
268
  };
267
269
  const gallery = useMemo(() => ({
268
270
  open(key, origin) {
269
- const { itemOf, lightbox } = live.current;
270
- const exchanges = exchangesMedia(eventsRef.current);
271
+ const { itemOf, lightbox, actions: current } = live.current;
272
+ const source = eventsRef.current;
273
+ const exchanges = exchangesMedia(Array.isArray(source) ? source : transcriptArray(source), (att) => attachmentSrcOf(current, att));
271
274
  const row = origin.closest("[data-row]");
272
275
  const prompts = rootRef.current ? [...rootRef.current.querySelectorAll("[data-prompt]")] : [];
273
276
  const at = row ? prompts.filter((p) => p === row || p.compareDocumentPosition(row) & Node.DOCUMENT_POSITION_FOLLOWING).length : -1;
@@ -67,6 +67,24 @@ export interface ErrorRowProps {
67
67
  }
68
68
  /** Renders an error line in the transcript's error tone. */
69
69
  export declare const ErrorRow: import("react").MemoExoticComponent<({ text, className, style }: ErrorRowProps) => import("react").JSX.Element>;
70
+ /** Props for {@link RepairedRow}. */
71
+ export interface RepairedRowProps {
72
+ /** The error the run stopped on, for the tooltip. */
73
+ text: string;
74
+ /** Its detail: `environment.failure` picks the words. */
75
+ detail?: StreamEvent['detail'];
76
+ /** Extra classes on the root element. */
77
+ className?: string;
78
+ /** Inline styles on the root element, merged after the component's own. */
79
+ style?: CSSProperties;
80
+ }
81
+ /**
82
+ * An error on a broken environment that was fixed since (a later setup or
83
+ * reply, `markRunFailures`' `repaired`): one quiet line, "Environment set up
84
+ * again" or "answered again", the error kept for its tooltip. No button:
85
+ * there is nothing left to do.
86
+ */
87
+ export declare const RepairedRow: import("react").MemoExoticComponent<({ text, detail, className, style }: RepairedRowProps) => import("react").JSX.Element>;
70
88
  /** Props for {@link FailureRow}. */
71
89
  export interface FailureRowProps {
72
90
  /** The reason the run stopped, in muted text after `Stopped`. */
@@ -91,7 +109,11 @@ export interface FailureRowProps {
91
109
  * had done something, Retry (the same prompt) when it had not. Both hand
92
110
  * their prompt to `onResume` (the desktop app: the composer's send); without
93
111
  * it there is no button. A run stopped by a failed sign-in (`detail.auth`)
94
- * shows the sign-in's card instead (`AuthFailureCard`).
112
+ * shows the sign-in's card instead (`AuthFailureCard`). A run stopped by a
113
+ * broken environment (`detail.environment`) repairs it first
114
+ * (`TranscriptActions.retryEnvironment`), then sends: the prompt waits in the
115
+ * host's queue until it is back. Setting a gone one up anew asks first (the
116
+ * app's confirm dialog), as it can cost work.
95
117
  */
96
118
  export declare const FailureRow: import("react").MemoExoticComponent<({ text, detail, failure, resumable, onResume, className, style }: FailureRowProps) => import("react").JSX.Element>;
97
119
  /** Props for {@link SessionEventRow}. */
@@ -1,11 +1,15 @@
1
+ import { useOptionalConfirm } from "../../app/useConfirm.js";
2
+ import { useTooltip } from "../../components/Tooltip.js";
1
3
  import { useStaysMounted } from "../../motion/collapse.js";
2
4
  import { failureTooltip } from "../headless/transcript/run-failures.js";
3
5
  import { useChatLabels } from "../useChatLabels.js";
6
+ import { useTranscriptActions } from "./actions.js";
4
7
  import { AuthFailureCard } from "./AuthFailureCard.js";
5
8
  import { Caret } from "./frame.js";
6
9
  import { useTranscriptRenderers } from "./renderers.js";
10
+ import { useRowPartKey, useRowUiState } from "./row-ui-state.js";
7
11
  import { memo, useId, useState } from "react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
12
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
13
  import { CONTINUE_PROMPT, SESSION_EVENT_STATUS_STYLE, describeSpawnEnd, sessionDirLabel, sessionEventExcerpt, sessionEventMeta, shortSessionId, spawnStartParts } from "zidane/chat/pure";
10
14
  // src/chat/transcript/notices.tsx
11
15
  /**
@@ -67,13 +71,17 @@ const NoticeRow = memo(({ notice, text, className, style }) => {
67
71
  style,
68
72
  title: notice.label,
69
73
  children: [/* @__PURE__ */ jsxs("span", {
70
- className: `inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full shadow-[inset_0_0_0_1px_var(--zg-hairline)] font-medium ${tone}`,
74
+ className: `inline-flex max-w-full items-center gap-1.5 px-2 py-0.5 rounded-full shadow-[inset_0_0_0_1px_var(--zg-hairline)] font-medium ${tone}`,
71
75
  children: [/* @__PURE__ */ jsx("span", {
72
76
  "aria-hidden": true,
73
77
  className: `${icon} shrink-0`
74
- }), head]
78
+ }), /* @__PURE__ */ jsx("span", {
79
+ className: "min-w-0 truncate",
80
+ title: head,
81
+ children: head
82
+ })]
75
83
  }), details.length > 0 && /* @__PURE__ */ jsx("span", {
76
- className: "min-w-0 flex flex-col gap-0.5 pl-1.5 text-[var(--zg-text-muted)]",
84
+ className: "min-w-0 max-w-full flex flex-col gap-0.5 px-2 break-words text-[var(--zg-text-muted)]",
77
85
  children: details.map((line, i) => /* @__PURE__ */ jsx("span", { children: line }, i))
78
86
  })]
79
87
  });
@@ -89,16 +97,64 @@ const ErrorRow = memo(({ text, className, style }) => {
89
97
  });
90
98
  });
91
99
  /**
100
+ * An error on a broken environment that was fixed since (a later setup or
101
+ * reply, `markRunFailures`' `repaired`): one quiet line, "Environment set up
102
+ * again" or "answered again", the error kept for its tooltip. No button:
103
+ * there is nothing left to do.
104
+ */
105
+ const RepairedRow = memo(({ text, detail, className, style }) => {
106
+ const labels = useChatLabels();
107
+ const why = failureTooltip(text, detail, labels.resetsAt);
108
+ const tip = useTooltip(why ? /* @__PURE__ */ jsx("span", {
109
+ className: "whitespace-pre-line",
110
+ children: why
111
+ }) : null, { maxWidth: 360 });
112
+ return /* @__PURE__ */ jsxs("div", {
113
+ className: [`flex items-center gap-1.5 min-w-0 ${BODY_TEXT} text-[var(--zg-text-muted)]`, className].filter(Boolean).join(" "),
114
+ style,
115
+ "data-testid": "environment-repaired",
116
+ children: [
117
+ /* @__PURE__ */ jsx("span", {
118
+ "aria-hidden": true,
119
+ className: "i-ph-arrow-counter-clockwise text-zg-ui shrink-0"
120
+ }),
121
+ /* @__PURE__ */ jsx("span", {
122
+ ...tip.anchorProps,
123
+ className: "min-w-0 truncate",
124
+ children: labels.environmentRepaired[detail?.environment?.failure ?? "lost"]
125
+ }),
126
+ tip.tip
127
+ ]
128
+ });
129
+ });
130
+ RepairedRow.displayName = "RepairedRow";
131
+ /**
92
132
  * How a run that ended early reads: one quiet line (`Stopped`, then the
93
133
  * reason in muted text, for a failure; `Stopped by you` for a stop), and on the transcript's last
94
134
  * word a small button that picks the work back up: Continue when the run
95
135
  * had done something, Retry (the same prompt) when it had not. Both hand
96
136
  * their prompt to `onResume` (the desktop app: the composer's send); without
97
137
  * it there is no button. A run stopped by a failed sign-in (`detail.auth`)
98
- * shows the sign-in's card instead (`AuthFailureCard`).
138
+ * shows the sign-in's card instead (`AuthFailureCard`). A run stopped by a
139
+ * broken environment (`detail.environment`) repairs it first
140
+ * (`TranscriptActions.retryEnvironment`), then sends: the prompt waits in the
141
+ * host's queue until it is back. Setting a gone one up anew asks first (the
142
+ * app's confirm dialog), as it can cost work.
99
143
  */
100
144
  const FailureRow = memo(({ text, detail, failure, resumable, onResume, className, style }) => {
101
145
  const labels = useChatLabels();
146
+ const { retryEnvironment } = useTranscriptActions();
147
+ const confirm = useOptionalConfirm();
148
+ const [repairing, setRepairing] = useState(false);
149
+ const broken = detail?.environment;
150
+ const repairs = broken !== void 0 && retryEnvironment !== void 0;
151
+ const retry = failure.resume === "retry" && failure.prompt;
152
+ const tip = useTooltip(repairs ? labels.retryEnvironmentHint : retry ? labels.retryHint : labels.continueHint);
153
+ const whyText = failureTooltip(text, detail, labels.resetsAt);
154
+ const why = useTooltip(whyText ? /* @__PURE__ */ jsx("span", {
155
+ className: "whitespace-pre-line",
156
+ children: whyText
157
+ }) : null, { maxWidth: 360 });
102
158
  if (detail?.auth && failure.cause === "error") return /* @__PURE__ */ jsx(AuthFailureCard, {
103
159
  auth: detail.auth,
104
160
  text,
@@ -109,33 +165,59 @@ const FailureRow = memo(({ text, detail, failure, resumable, onResume, className
109
165
  className,
110
166
  style
111
167
  });
112
- const retry = failure.resume === "retry" && failure.prompt;
113
168
  const byUser = failure.cause === "aborted";
169
+ const resume = async (send) => {
170
+ const prompt = retry ? failure.prompt : CONTINUE_PROMPT;
171
+ if (!broken || !retryEnvironment) {
172
+ send(prompt);
173
+ return;
174
+ }
175
+ if (broken.failure === "lost" && confirm) {
176
+ if (!await confirm({
177
+ title: labels.retryEnvironmentLostTitle,
178
+ message: broken.context === "sandbox" ? labels.retryEnvironmentLostSandboxDetail : labels.retryEnvironmentLostDetail,
179
+ confirmLabel: labels.retryEnvironmentLostConfirm,
180
+ destructive: true
181
+ })) return;
182
+ }
183
+ setRepairing(true);
184
+ try {
185
+ await Promise.resolve(retryEnvironment()).catch(() => void 0);
186
+ } finally {
187
+ setRepairing(false);
188
+ }
189
+ send(prompt);
190
+ };
114
191
  return /* @__PURE__ */ jsxs("div", {
115
192
  className: [`flex items-center gap-2 min-w-0 ${BODY_TEXT}`, className].filter(Boolean).join(" "),
116
193
  style,
117
194
  "data-testid": "run-failure",
118
195
  "data-cause": failure.cause,
119
- children: [/* @__PURE__ */ jsxs("span", {
120
- className: "min-w-0 truncate",
121
- title: failureTooltip(text, detail, labels.resetsAt),
122
- children: [/* @__PURE__ */ jsx("span", {
123
- className: byUser ? "text-[var(--zg-text-muted)]" : ERROR_TONE,
124
- children: byUser ? labels.stoppedByYou : labels.stopped
125
- }), text && /* @__PURE__ */ jsxs("span", {
126
- className: "text-[var(--zg-text-muted)]",
127
- children: [" ", text]
128
- })]
129
- }), resumable && onResume && /* @__PURE__ */ jsxs("button", {
130
- type: "button",
131
- onClick: () => onResume(retry ? failure.prompt : CONTINUE_PROMPT),
132
- title: retry ? labels.retryHint : labels.continueHint,
133
- className: "zg-segment-item zg-press-soft shrink-0 inline-flex items-center gap-1 h-6 px-2 -my-px rounded-full border-0 bg-transparent cursor-pointer text-[var(--zg-text-muted)] zg-focus-ring",
134
- children: [/* @__PURE__ */ jsx("span", {
135
- className: "i-ph-arrow-clockwise text-zg-ui",
136
- "aria-hidden": true
137
- }), retry ? labels.retry : labels.continueRun]
138
- })]
196
+ children: [
197
+ /* @__PURE__ */ jsxs("span", {
198
+ ...why.anchorProps,
199
+ className: "min-w-0 truncate",
200
+ children: [/* @__PURE__ */ jsx("span", {
201
+ className: byUser ? "text-[var(--zg-text-muted)]" : ERROR_TONE,
202
+ children: byUser ? labels.stoppedByYou : labels.stopped
203
+ }), text && /* @__PURE__ */ jsxs("span", {
204
+ className: "text-[var(--zg-text-muted)]",
205
+ children: [" ", text]
206
+ })]
207
+ }),
208
+ why.tip,
209
+ resumable && onResume && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
210
+ ...tip.anchorProps,
211
+ type: "button",
212
+ disabled: repairing,
213
+ onClick: () => void resume(onResume),
214
+ className: "zg-segment-item zg-press-soft shrink-0 inline-flex items-center gap-1 h-6 px-2 -my-px rounded-full border-0 bg-transparent cursor-pointer text-[var(--zg-text-muted)] zg-focus-ring",
215
+ children: [/* @__PURE__ */ jsx("span", {
216
+ className: "i-ph-arrow-clockwise text-zg-ui",
217
+ "aria-hidden": true
218
+ }), retry ? labels.retry : labels.continueRun]
219
+ }), tip.tip] })
220
+ ]
139
221
  });
140
222
  });
141
223
  /**
@@ -254,7 +336,7 @@ const COMMAND_DETAIL_LINE = "26.4px";
254
336
  * monospace `<pre>` would misrender them as a wall of mono.
255
337
  */
256
338
  const CommandDetailRow = memo(({ label, text, syntax, className, style }) => {
257
- const [open, setOpen] = useState(false);
339
+ const [open, setOpen] = useRowUiState(useRowPartKey("command-detail"), false);
258
340
  const mounted = useStaysMounted(open);
259
341
  const labels = useChatLabels();
260
342
  const { Markdown, CodeBlock } = useTranscriptRenderers();
@@ -344,4 +426,4 @@ const SpawnEndRow = memo(({ row, className, style }) => {
344
426
  }, value))]
345
427
  });
346
428
  });
347
- export { COMMAND_DETAIL_LINE, CommandDetailRow, CommandNoteRow, ErrorRow, FailureRow, InfoRow, NoticeRow, SessionEventRow, SpawnEndRow, SpawnStartRow };
429
+ export { COMMAND_DETAIL_LINE, CommandDetailRow, CommandNoteRow, ErrorRow, FailureRow, InfoRow, NoticeRow, RepairedRow, SessionEventRow, SpawnEndRow, SpawnStartRow };
@@ -4,6 +4,7 @@ import { mediumKey } from "../headless/transcript/exchange-media.js";
4
4
  import { PdfPreview } from "../PdfPreview.js";
5
5
  import { TextPreview } from "../TextPreview.js";
6
6
  import { useChatLabels } from "../useChatLabels.js";
7
+ import { attachmentSrcOf, useTranscriptActions } from "./actions.js";
7
8
  import { Dot, useRowIcons } from "./frame.js";
8
9
  import { useMediaGallery } from "./media-gallery.js";
9
10
  import { MessageMedia, promptMediaOf } from "./message-media.js";
@@ -65,13 +66,14 @@ function UserPromptAttachments({ items, className, style }) {
65
66
  const labels = useChatLabels();
66
67
  const lightbox = useLightbox();
67
68
  const mediaGallery = useMediaGallery();
69
+ const actions = useTranscriptActions();
68
70
  const { TextPreview: TextPreview$1 = TextPreview } = useTranscriptRenderers();
69
71
  const [failed, setFailed] = useState(() => /* @__PURE__ */ new Set());
70
72
  const isImage = (att) => att.mediaType.startsWith("image/");
71
73
  const gallery = items.map((att, idx) => ({
72
74
  att,
73
75
  idx,
74
- src: att.dataUrl
76
+ src: attachmentSrcOf(actions, att)
75
77
  })).filter((entry) => entry.src !== void 0 && (isImage(entry.att) ? !failed.has(entry.idx) : isPdfAttachment(entry.att) || isTextLike(entry.att)));
76
78
  const galleryItems = gallery.map(({ att, idx, src }) => isImage(att) ? {
77
79
  key: String(idx),
@@ -115,14 +117,14 @@ function UserPromptAttachments({ items, className, style }) {
115
117
  title: att.name,
116
118
  "aria-label": labels.viewAttachment(att.name),
117
119
  onClick: (event) => openAt(idx, position, event.currentTarget),
118
- onContextMenu: mediaGallery && att.dataUrl ? (event) => mediaGallery.menu(event, {
120
+ onContextMenu: mediaGallery ? (event) => mediaGallery.menu(event, {
119
121
  key: mediumKey.attachment(idx),
120
122
  kind: "image",
121
- url: att.dataUrl
123
+ url: gallery[position].src
122
124
  }) : void 0,
123
125
  className: "zg-press-subtle block p-0 border-0 bg-transparent cursor-zoom-in rounded-zg-md focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--zg-ring)]",
124
126
  children: /* @__PURE__ */ jsx("img", {
125
- src: att.dataUrl,
127
+ src: gallery[position].src,
126
128
  alt: att.name,
127
129
  onError: () => setFailed((prev) => new Set(prev).add(idx)),
128
130
  className: "block w-16 h-16 object-cover rounded-zg-md bg-[var(--zg-tray)] shadow-[inset_0_0_0_1px_var(--zg-hairline)]"
@@ -2,6 +2,7 @@ import { useStaysMounted } from "../../motion/collapse.js";
2
2
  import { useChatLabels } from "../useChatLabels.js";
3
3
  import { Caret } from "./frame.js";
4
4
  import { useTranscriptRenderers } from "./renderers.js";
5
+ import { useRowPartKey, useRowUiState } from "./row-ui-state.js";
5
6
  import { ToolTiming } from "./tool-parts.js";
6
7
  import { memo, useState } from "react";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -56,6 +57,7 @@ const ThinkingRow = memo(({ text, thinkingMs, live, autoExpand = false, classNam
56
57
  children: mounted && /* @__PURE__ */ jsx("div", {
57
58
  className: "pt-1 text-sm italic text-[var(--zg-text-muted)] leading-relaxed",
58
59
  children: /* @__PURE__ */ jsx(Markdown, {
60
+ className: live ? "zg-streaming" : void 0,
59
61
  streaming: live,
60
62
  children: text
61
63
  })
@@ -73,7 +75,7 @@ const ThinkingRow = memo(({ text, thinkingMs, live, autoExpand = false, classNam
73
75
  * groups); replayed groups render a bare count.
74
76
  */
75
77
  const ThinkingBatchRow = memo(({ thoughts, totalMs, autoExpand = false, className, style }) => {
76
- const [open, setOpen] = useState(false);
78
+ const [open, setOpen] = useRowUiState(useRowPartKey("thoughts"), false);
77
79
  const labels = useChatLabels();
78
80
  return /* @__PURE__ */ jsxs("div", {
79
81
  className: ["text-xs", className].filter(Boolean).join(" "),
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The receipt's cells, shared by the run receipt and the compaction line
3
+ * (`run-rows.tsx`, the fold's compaction step). Internal: not re-exported.
4
+ */
5
+ import { RunReceiptCell, RunReceiptSegment } from "zidane/chat/pure";
6
+ import { StreamEvent } from "zidane/chat";
7
+ export declare const RUN_RECEIPT_TINT: Record<RunReceiptCell['kind'], string>;
8
+ export declare const RUN_RECEIPT_SEGMENT_TINT: Record<RunReceiptSegment['kind'], string>;
9
+ /** A receipt value (`↻3`, `↑520k`), its leading glyph as an icon. */
10
+ export declare function ReceiptValue({ text, className }: {
11
+ text: string;
12
+ className: string;
13
+ }): import("react").JSX.Element;
14
+ /**
15
+ * A compaction's facts as one quiet line: the summary call's model, its cost
16
+ * when priced, and the tokens it sent and received. The compaction card and
17
+ * the run's fold step (`fold.tsx`) both show it.
18
+ */
19
+ export declare function CompactMeta({ meta, className }: {
20
+ meta: NonNullable<StreamEvent['compact']>;
21
+ className?: string;
22
+ }): import("react").JSX.Element;