@opengeni/react 4.0.2 → 4.0.5-canary.39120434730001

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 (916) hide show
  1. package/README.md +787 -26
  2. package/dist/accounts.js +2 -0
  3. package/dist/accounts.js.map +1 -1
  4. package/dist/approvals.d.ts +2 -1
  5. package/dist/artifacts-document.js +6 -3
  6. package/dist/artifacts-presentation.js +6 -3
  7. package/dist/artifacts-spreadsheet.d.ts +1 -1
  8. package/dist/artifacts-spreadsheet.js +6 -3
  9. package/dist/artifacts.d.ts +5 -1
  10. package/dist/artifacts.js +542 -278
  11. package/dist/artifacts.js.map +1 -1
  12. package/dist/browser-viewer-GEHX3KYE.js +20 -0
  13. package/dist/capability-catalog-row.d.ts +20 -0
  14. package/dist/capability-logo-fallback.d.ts +3 -0
  15. package/dist/chat-interactive-block-5V3BGLXT.js +15 -0
  16. package/dist/chunk-2DDJ6YH6.js +41 -0
  17. package/dist/chunk-2DDJ6YH6.js.map +1 -0
  18. package/dist/chunk-2EGXXUG4.js +1161 -0
  19. package/dist/chunk-2EGXXUG4.js.map +1 -0
  20. package/dist/chunk-2XKRY4GF.js +302 -0
  21. package/dist/chunk-2XKRY4GF.js.map +1 -0
  22. package/dist/chunk-2ZUUIMBY.js +343 -0
  23. package/dist/chunk-2ZUUIMBY.js.map +1 -0
  24. package/dist/chunk-4F4FGCH2.js +34 -0
  25. package/dist/chunk-4F4FGCH2.js.map +1 -0
  26. package/dist/{chunk-Z7WBDB4E.js → chunk-4M2MJLY3.js} +848 -867
  27. package/dist/chunk-4M2MJLY3.js.map +1 -0
  28. package/dist/chunk-4U7SHFQ2.js +193 -0
  29. package/dist/chunk-4U7SHFQ2.js.map +1 -0
  30. package/dist/chunk-5I4VRWBB.js +56 -0
  31. package/dist/chunk-5I4VRWBB.js.map +1 -0
  32. package/dist/{chunk-24M4YBCL.js → chunk-62XZ3IX3.js} +1751 -845
  33. package/dist/chunk-62XZ3IX3.js.map +1 -0
  34. package/dist/chunk-77THWHSU.js +308 -0
  35. package/dist/chunk-77THWHSU.js.map +1 -0
  36. package/dist/chunk-7CZLTFXF.js +466 -0
  37. package/dist/chunk-7CZLTFXF.js.map +1 -0
  38. package/dist/chunk-7N5AD2TC.js +327 -0
  39. package/dist/chunk-7N5AD2TC.js.map +1 -0
  40. package/dist/chunk-7SZ7MMCY.js +325 -0
  41. package/dist/chunk-7SZ7MMCY.js.map +1 -0
  42. package/dist/chunk-7TG6KTR2.js +3153 -0
  43. package/dist/chunk-7TG6KTR2.js.map +1 -0
  44. package/dist/chunk-AIX25FIQ.js +409 -0
  45. package/dist/chunk-AIX25FIQ.js.map +1 -0
  46. package/dist/chunk-AT2HD6RQ.js +1936 -0
  47. package/dist/chunk-AT2HD6RQ.js.map +1 -0
  48. package/dist/chunk-B27E3V37.js +29 -0
  49. package/dist/chunk-B27E3V37.js.map +1 -0
  50. package/dist/{chunk-5M6VTFJ5.js → chunk-B4EDAXMC.js} +37 -13
  51. package/dist/chunk-B4EDAXMC.js.map +1 -0
  52. package/dist/chunk-BOG2FED3.js +35 -0
  53. package/dist/chunk-BOG2FED3.js.map +1 -0
  54. package/dist/chunk-BQYQU5QW.js +109 -0
  55. package/dist/chunk-BQYQU5QW.js.map +1 -0
  56. package/dist/{chunk-PAJU5KKL.js → chunk-BRIOXCLH.js} +68 -25
  57. package/dist/chunk-BRIOXCLH.js.map +1 -0
  58. package/dist/chunk-CM7LVUKC.js +35 -0
  59. package/dist/chunk-CM7LVUKC.js.map +1 -0
  60. package/dist/{chunk-KCGXPP5V.js → chunk-CXIGFHVL.js} +35 -23
  61. package/dist/chunk-CXIGFHVL.js.map +1 -0
  62. package/dist/chunk-DHXKEJBH.js +71 -0
  63. package/dist/chunk-DHXKEJBH.js.map +1 -0
  64. package/dist/{chunk-NOSYBS2D.js → chunk-DN3TKURW.js} +12 -9
  65. package/dist/chunk-DN3TKURW.js.map +1 -0
  66. package/dist/chunk-DNJ23AWQ.js +35 -0
  67. package/dist/chunk-DNJ23AWQ.js.map +1 -0
  68. package/dist/chunk-ESAMXNBZ.js +3237 -0
  69. package/dist/chunk-ESAMXNBZ.js.map +1 -0
  70. package/dist/{chunk-4MDLEHXL.js → chunk-EWATYP5L.js} +64 -44
  71. package/dist/chunk-EWATYP5L.js.map +1 -0
  72. package/dist/{chunk-YBM6CQRU.js → chunk-FQ5CXNUG.js} +65 -42
  73. package/dist/chunk-FQ5CXNUG.js.map +1 -0
  74. package/dist/chunk-FVROZ7HR.js +14396 -0
  75. package/dist/chunk-FVROZ7HR.js.map +1 -0
  76. package/dist/chunk-HEVQKE27.js +150 -0
  77. package/dist/chunk-HEVQKE27.js.map +1 -0
  78. package/dist/chunk-HZ47S3DP.js +1086 -0
  79. package/dist/chunk-HZ47S3DP.js.map +1 -0
  80. package/dist/chunk-I5BJ7ENY.js +174 -0
  81. package/dist/chunk-I5BJ7ENY.js.map +1 -0
  82. package/dist/chunk-IGFZFLI2.js +1390 -0
  83. package/dist/chunk-IGFZFLI2.js.map +1 -0
  84. package/dist/chunk-IGVL3ELX.js +46 -0
  85. package/dist/chunk-IGVL3ELX.js.map +1 -0
  86. package/dist/chunk-IOD24LGR.js +384 -0
  87. package/dist/chunk-IOD24LGR.js.map +1 -0
  88. package/dist/chunk-IOYHDEP3.js +38 -0
  89. package/dist/chunk-IOYHDEP3.js.map +1 -0
  90. package/dist/chunk-IQL77TMM.js +803 -0
  91. package/dist/chunk-IQL77TMM.js.map +1 -0
  92. package/dist/chunk-IZV5FTJC.js +55 -0
  93. package/dist/chunk-IZV5FTJC.js.map +1 -0
  94. package/dist/{chunk-H5YGYNXS.js → chunk-JAYYFOOB.js} +75 -28
  95. package/dist/chunk-JAYYFOOB.js.map +1 -0
  96. package/dist/chunk-KN2MYSCC.js +409 -0
  97. package/dist/chunk-KN2MYSCC.js.map +1 -0
  98. package/dist/{chunk-PEI6RANI.js → chunk-KYVJMTXL.js} +434 -145
  99. package/dist/chunk-KYVJMTXL.js.map +1 -0
  100. package/dist/{chunk-ZYRGEKWS.js → chunk-LJUMYUBO.js} +3 -1
  101. package/dist/{chunk-ZYRGEKWS.js.map → chunk-LJUMYUBO.js.map} +1 -1
  102. package/dist/{chunk-ICA6R6TW.js → chunk-LNUD3JNI.js} +1532 -395
  103. package/dist/chunk-LNUD3JNI.js.map +1 -0
  104. package/dist/chunk-M357MHH3.js +2 -0
  105. package/dist/{chunk-BV5A4OTE.js → chunk-MEL6PH2I.js} +1218 -537
  106. package/dist/chunk-MEL6PH2I.js.map +1 -0
  107. package/dist/chunk-MF6WS2XF.js +386 -0
  108. package/dist/chunk-MF6WS2XF.js.map +1 -0
  109. package/dist/chunk-MK2TQO4Y.js +24 -0
  110. package/dist/chunk-MK2TQO4Y.js.map +1 -0
  111. package/dist/chunk-N7S72EXK.js +25 -0
  112. package/dist/chunk-N7S72EXK.js.map +1 -0
  113. package/dist/{chunk-KZ73RL76.js → chunk-NAWXARTY.js} +58 -9
  114. package/dist/chunk-NAWXARTY.js.map +1 -0
  115. package/dist/chunk-NX4ADH73.js +14 -0
  116. package/dist/chunk-NX4ADH73.js.map +1 -0
  117. package/dist/chunk-OYQQJL3J.js +16 -0
  118. package/dist/chunk-OYQQJL3J.js.map +1 -0
  119. package/dist/chunk-P4MKPCTC.js +51 -0
  120. package/dist/chunk-P4MKPCTC.js.map +1 -0
  121. package/dist/{chunk-JVYQRRC4.js → chunk-PEHTX3V7.js} +21 -1
  122. package/dist/chunk-PEHTX3V7.js.map +1 -0
  123. package/dist/chunk-PMV53IMM.js +26 -0
  124. package/dist/chunk-PMV53IMM.js.map +1 -0
  125. package/dist/{chunk-HUIKIDM5.js → chunk-QOEWDOFW.js} +295 -156
  126. package/dist/chunk-QOEWDOFW.js.map +1 -0
  127. package/dist/chunk-QV3DJVRZ.js +11 -0
  128. package/dist/chunk-QV3DJVRZ.js.map +1 -0
  129. package/dist/{chunk-HUMIRRYI.js → chunk-QYUYVSNG.js} +1103 -1699
  130. package/dist/chunk-QYUYVSNG.js.map +1 -0
  131. package/dist/{chunk-6J56T3MG.js → chunk-RRAQ5FV5.js} +186 -60
  132. package/dist/chunk-RRAQ5FV5.js.map +1 -0
  133. package/dist/{chunk-5YK2ZDIG.js → chunk-TNEZNMSN.js} +4 -10
  134. package/dist/chunk-TNEZNMSN.js.map +1 -0
  135. package/dist/{chunk-22KP6LR5.js → chunk-TXS65BB2.js} +3 -1
  136. package/dist/{chunk-22KP6LR5.js.map → chunk-TXS65BB2.js.map} +1 -1
  137. package/dist/chunk-UIWIOB4U.js +2215 -0
  138. package/dist/chunk-UIWIOB4U.js.map +1 -0
  139. package/dist/chunk-UNJPZGNK.js +63 -0
  140. package/dist/chunk-UNJPZGNK.js.map +1 -0
  141. package/dist/chunk-V7UGCQHQ.js +86 -0
  142. package/dist/chunk-V7UGCQHQ.js.map +1 -0
  143. package/dist/chunk-VU4QUISJ.js +3405 -0
  144. package/dist/chunk-VU4QUISJ.js.map +1 -0
  145. package/dist/chunk-WEY5J52U.js +467 -0
  146. package/dist/chunk-WEY5J52U.js.map +1 -0
  147. package/dist/chunk-WH2CBESG.js +409 -0
  148. package/dist/chunk-WH2CBESG.js.map +1 -0
  149. package/dist/{chunk-VZTQ73XT.js → chunk-XEA5BCMA.js} +3 -1
  150. package/dist/{chunk-VZTQ73XT.js.map → chunk-XEA5BCMA.js.map} +1 -1
  151. package/dist/{chunk-NLTS7JHI.js → chunk-XEIHS3RN.js} +834 -403
  152. package/dist/chunk-XEIHS3RN.js.map +1 -0
  153. package/dist/chunk-YNXZRE3F.js +408 -0
  154. package/dist/chunk-YNXZRE3F.js.map +1 -0
  155. package/dist/chunk-YSRBFJMQ.js +43 -0
  156. package/dist/chunk-YSRBFJMQ.js.map +1 -0
  157. package/dist/{chunk-NEXLLTP4.js → chunk-ZGFU4LVW.js} +6 -5
  158. package/dist/chunk-ZGFU4LVW.js.map +1 -0
  159. package/dist/chunk-ZO35BAMO.js +172 -0
  160. package/dist/chunk-ZO35BAMO.js.map +1 -0
  161. package/dist/chunk-ZUWF4NF7.js +13 -0
  162. package/dist/chunk-ZUWF4NF7.js.map +1 -0
  163. package/dist/client.d.ts +15 -6
  164. package/dist/clipboard.js +3 -1
  165. package/dist/commands/registry.d.ts +2 -1
  166. package/dist/commands/types.d.ts +2 -0
  167. package/dist/components/anthropic-mark.d.ts +3 -0
  168. package/dist/components/approval-surface.d.ts +21 -7
  169. package/dist/components/artifacts/artifact-chrome.d.ts +121 -0
  170. package/dist/components/artifacts/artifact-sandbox.d.ts +30 -0
  171. package/dist/components/artifacts/artifact-surface.d.ts +4 -2
  172. package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
  173. package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
  174. package/dist/components/artifacts/document-editor.d.ts +4 -2
  175. package/dist/components/artifacts/editable-artifact-ui.d.ts +4 -2
  176. package/dist/components/artifacts/editable-artifact-view.d.ts +48 -0
  177. package/dist/components/artifacts/editable-document.d.ts +3 -2
  178. package/dist/components/artifacts/editable-presentation.d.ts +4 -3
  179. package/dist/components/artifacts/editable-spreadsheet.d.ts +8 -3
  180. package/dist/components/artifacts/index.d.ts +8 -1
  181. package/dist/components/artifacts/inline-html-document.d.ts +2 -0
  182. package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
  183. package/dist/components/artifacts/presentation-editor.d.ts +6 -2
  184. package/dist/components/artifacts/published-html-artifact-frame.d.ts +17 -40
  185. package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
  186. package/dist/components/artifacts/site-view.d.ts +26 -0
  187. package/dist/components/artifacts/spreadsheet-command-queue.d.ts +20 -0
  188. package/dist/components/artifacts/spreadsheet-download.d.ts +7 -0
  189. package/dist/components/artifacts/spreadsheet-general-display.d.ts +24 -0
  190. package/dist/components/artifacts/spreadsheet-grid.d.ts +11 -4
  191. package/dist/components/artifacts/spreadsheet-resize.d.ts +50 -0
  192. package/dist/components/artifacts/spreadsheet-submissions.d.ts +9 -0
  193. package/dist/components/artifacts/visualization-assets.gen.d.ts +2 -0
  194. package/dist/components/browser-select-control.d.ts +16 -0
  195. package/dist/components/browser-viewer.d.ts +11 -2
  196. package/dist/components/chat-composer.d.ts +21 -3
  197. package/dist/components/child-session-link.d.ts +5 -1
  198. package/dist/components/claude-mark.d.ts +3 -0
  199. package/dist/components/code-editor.d.ts +1 -4
  200. package/dist/components/command-palette.d.ts +1 -1
  201. package/dist/components/composer-transcription-control.d.ts +7 -0
  202. package/dist/components/composer.d.ts +30 -67
  203. package/dist/components/computer-viewer.d.ts +1 -1
  204. package/dist/components/copy-button.d.ts +3 -1
  205. package/dist/components/desktop-viewer.d.ts +1 -1
  206. package/dist/components/generated-video-player.d.ts +1 -1
  207. package/dist/components/grok-mark.d.ts +26 -0
  208. package/dist/components/human-input-form.d.ts +26 -32
  209. package/dist/components/human-input-surface.d.ts +5 -1
  210. package/dist/components/linkified-text.d.ts +18 -0
  211. package/dist/components/machine-input-display.d.ts +25 -3
  212. package/dist/components/machine-status-pill.d.ts +3 -2
  213. package/dist/components/machines/agent-status-icon.d.ts +6 -0
  214. package/dist/components/machines/health.d.ts +2 -1
  215. package/dist/components/machines/machine-detail.d.ts +7 -1
  216. package/dist/components/machines/machine-status.d.ts +49 -0
  217. package/dist/components/machines/metric-history-chart.d.ts +1 -1
  218. package/dist/components/machines/series.d.ts +3 -2
  219. package/dist/components/markdown-table-layout.d.ts +11 -2
  220. package/dist/components/markdown.d.ts +37 -4
  221. package/dist/components/message-timeline.d.ts +79 -7
  222. package/dist/components/model-mark.d.ts +29 -0
  223. package/dist/components/model-picker.d.ts +1 -1
  224. package/dist/components/model-policy-picker.d.ts +31 -22
  225. package/dist/components/new-conversation.d.ts +32 -0
  226. package/dist/components/open-geni-chat.d.ts +73 -0
  227. package/dist/components/open-geni-links.d.ts +69 -0
  228. package/dist/components/openrouter-mark.d.ts +6 -0
  229. package/dist/components/opper-mark.d.ts +7 -0
  230. package/dist/components/preview-loading.d.ts +2 -0
  231. package/dist/components/provider-recovery-notice.d.ts +17 -0
  232. package/dist/components/queue-item-content.d.ts +10 -0
  233. package/dist/components/rehype-secret-refs.d.ts +23 -0
  234. package/dist/components/remark-soft-line-breaks.d.ts +38 -0
  235. package/dist/components/sandbox-workspace.d.ts +18 -0
  236. package/dist/components/secret-question-field.d.ts +31 -0
  237. package/dist/components/secret-ref-chip.d.ts +35 -0
  238. package/dist/components/session-capability-frame.d.ts +37 -0
  239. package/dist/components/session-chrome.d.ts +20 -7
  240. package/dist/components/session-commands.d.ts +6 -0
  241. package/dist/components/session-connection-request.d.ts +8 -0
  242. package/dist/components/session-conversation.d.ts +147 -6
  243. package/dist/components/session-list.d.ts +39 -0
  244. package/dist/components/session-mcp-capability-card.d.ts +41 -0
  245. package/dist/components/session-proxy-scope.d.ts +35 -0
  246. package/dist/components/session-status.d.ts +6 -2
  247. package/dist/components/session-usage-limit-notice.d.ts +39 -0
  248. package/dist/components/this-computer/illustrations.d.ts +38 -0
  249. package/dist/components/this-computer/labels.d.ts +111 -0
  250. package/dist/components/this-computer/this-computer-card.d.ts +40 -0
  251. package/dist/components/this-computer/this-computer-setup.d.ts +35 -0
  252. package/dist/components/this-computer/this-computer-status.d.ts +42 -0
  253. package/dist/components/this-computer/use-this-computer.d.ts +29 -0
  254. package/dist/components/timeline-anchor.d.ts +3 -0
  255. package/dist/components/timeline-annotation-shared.d.ts +3 -2
  256. package/dist/components/timeline-annotations-dialog.d.ts +2 -1
  257. package/dist/components/timeline-annotations.d.ts +5 -1
  258. package/dist/components/timeline-reading-progress.d.ts +11 -0
  259. package/dist/components/timeline-search.d.ts +34 -0
  260. package/dist/components/timeline-settlement.d.ts +16 -0
  261. package/dist/components/tool-action-review.d.ts +48 -0
  262. package/dist/components/tool-review-history.d.ts +25 -0
  263. package/dist/components/usage-limit-notice.d.ts +50 -0
  264. package/dist/components/usage-member-list.d.ts +92 -0
  265. package/dist/components/usage-meter.d.ts +74 -0
  266. package/dist/components/use-viewer-menu-dismiss.d.ts +2 -0
  267. package/dist/components/user-message-body.d.ts +10 -1
  268. package/dist/components/workbench-changes.d.ts +2 -1
  269. package/dist/composer-messages.d.ts +75 -0
  270. package/dist/composer-messages.js +9 -0
  271. package/dist/composer-messages.js.map +1 -0
  272. package/dist/composer-voice-events.d.ts +8 -0
  273. package/dist/composer.d.ts +3 -3
  274. package/dist/composer.js +25 -12
  275. package/dist/computer-viewer-VOIOZGVZ.js +21 -0
  276. package/dist/computer-viewer-VOIOZGVZ.js.map +1 -0
  277. package/dist/connect-account-identity.d.ts +8 -0
  278. package/dist/connect-accounts.d.ts +15 -0
  279. package/dist/connect-chooser.d.ts +18 -0
  280. package/dist/connect-panel.d.ts +18 -0
  281. package/dist/connect-setup.d.ts +18 -0
  282. package/dist/connect.d.ts +21 -0
  283. package/dist/connect.js +2216 -0
  284. package/dist/connect.js.map +1 -0
  285. package/dist/connection-catalog.d.ts +38 -0
  286. package/dist/connection-discovery.d.ts +12 -0
  287. package/dist/connection-installed.d.ts +17 -0
  288. package/dist/connection-logo.d.ts +9 -0
  289. package/dist/connection-service-logo.d.ts +8 -0
  290. package/dist/connection-service-presentation.d.ts +13 -0
  291. package/dist/connection-skeleton.d.ts +5 -0
  292. package/dist/connection-type-picker.d.ts +6 -0
  293. package/dist/conversation-timeline.d.ts +1 -1
  294. package/dist/desktop.d.ts +7 -0
  295. package/dist/desktop.js +28 -0
  296. package/dist/desktop.js.map +1 -0
  297. package/dist/device-authorization.d.ts +23 -0
  298. package/dist/diffs.d.ts +8 -0
  299. package/dist/diffs.js +15 -0
  300. package/dist/diffs.js.map +1 -0
  301. package/dist/discovery-cache.d.ts +5 -0
  302. package/dist/editor.d.ts +7 -0
  303. package/dist/editor.js +23 -0
  304. package/dist/editor.js.map +1 -0
  305. package/dist/embedded-new-voice-KPLC5UJZ.js +19 -0
  306. package/dist/embedded-new-voice-KPLC5UJZ.js.map +1 -0
  307. package/dist/embedded-voice-V2RFSLIU.js +19 -0
  308. package/dist/embedded-voice-V2RFSLIU.js.map +1 -0
  309. package/dist/fleet-decision-row-FE73NSQ6.js +361 -0
  310. package/dist/fleet-decision-row-FE73NSQ6.js.map +1 -0
  311. package/dist/hooks/internal.d.ts +27 -2
  312. package/dist/hooks/latest-question.d.ts +26 -0
  313. package/dist/hooks/session-view-cache.d.ts +38 -0
  314. package/dist/hooks/shared-machines-list.d.ts +4 -0
  315. package/dist/hooks/shared-query.d.ts +123 -0
  316. package/dist/hooks/use-attached-browsers.d.ts +1 -1
  317. package/dist/hooks/use-auth-runs.d.ts +1 -4
  318. package/dist/hooks/use-available-models.d.ts +8 -3
  319. package/dist/hooks/use-browser-frame-stream.d.ts +1 -1
  320. package/dist/hooks/use-browser-session.d.ts +12 -1
  321. package/dist/hooks/use-client-config-flags.d.ts +49 -0
  322. package/dist/hooks/use-codex-accounts.d.ts +48 -9
  323. package/dist/hooks/use-composer.d.ts +24 -3
  324. package/dist/hooks/use-computer-frame-stream.d.ts +1 -1
  325. package/dist/hooks/use-computer-input-posture.d.ts +13 -0
  326. package/dist/hooks/use-computer-session.d.ts +5 -0
  327. package/dist/hooks/use-connect.d.ts +23 -0
  328. package/dist/hooks/use-desktop-stream.d.ts +1 -1
  329. package/dist/hooks/use-file-attachments.d.ts +4 -0
  330. package/dist/hooks/use-goal.d.ts +2 -1
  331. package/dist/hooks/use-last-started-turn-policy.d.ts +5 -1
  332. package/dist/hooks/use-machine-chip.d.ts +3 -2
  333. package/dist/hooks/use-new-conversation.d.ts +56 -0
  334. package/dist/hooks/use-new-session-draft.d.ts +74 -0
  335. package/dist/hooks/use-realtime-voice-models.d.ts +7 -0
  336. package/dist/hooks/use-sandbox-files.d.ts +3 -2
  337. package/dist/hooks/use-session-conversation.d.ts +49 -0
  338. package/dist/hooks/use-session-events.d.ts +21 -2
  339. package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
  340. package/dist/hooks/use-session-model-account.d.ts +48 -0
  341. package/dist/hooks/use-supergrok-accounts.d.ts +7 -1
  342. package/dist/hooks/use-terminal-stream.d.ts +11 -5
  343. package/dist/hooks/use-transcription.d.ts +2 -1
  344. package/dist/hooks/use-usage.d.ts +40 -0
  345. package/dist/hooks/use-vaults.d.ts +53 -0
  346. package/dist/hooks/use-voice-input.d.ts +8 -1
  347. package/dist/hooks/use-workspace-sessions.d.ts +24 -5
  348. package/dist/human-input-model.d.ts +123 -0
  349. package/dist/identity-link-accounts.d.ts +11 -0
  350. package/dist/identity-link-consent.d.ts +18 -0
  351. package/dist/index.d.ts +83 -18
  352. package/dist/index.js +2317 -6453
  353. package/dist/index.js.map +1 -1
  354. package/dist/interaction.d.ts +1 -1
  355. package/dist/interaction.js +20 -29
  356. package/dist/interaction.js.map +1 -1
  357. package/dist/latest-question-SXBXROBT.js +118 -0
  358. package/dist/latest-question-SXBXROBT.js.map +1 -0
  359. package/dist/lib/client-config-read.d.ts +31 -0
  360. package/dist/lib/clipboard.d.ts +7 -0
  361. package/dist/lib/error-message.d.ts +7 -0
  362. package/dist/lib/format.d.ts +59 -9
  363. package/dist/lib/host-theme.d.ts +77 -0
  364. package/dist/lib/interaction-errors.d.ts +3 -0
  365. package/dist/lib/menu-styles.d.ts +22 -0
  366. package/dist/lib/notify-observer.d.ts +2 -0
  367. package/dist/lib/pierre-diffs-loader.d.ts +20 -0
  368. package/dist/lib/provider-recovery.d.ts +56 -0
  369. package/dist/lib/scrollbars.d.ts +11 -0
  370. package/dist/lib/terminal-input-readiness.d.ts +11 -0
  371. package/dist/lib/transient-retry.d.ts +26 -0
  372. package/dist/lib/workbench-peers.d.ts +36 -0
  373. package/dist/lib/xterm-theme.d.ts +7 -5
  374. package/dist/machines.js +12 -6
  375. package/dist/{markdown-table-layout-3Z3AWBY7.js → markdown-table-layout-3PV2UAAH.js} +51 -9
  376. package/dist/markdown-table-layout-3PV2UAAH.js.map +1 -0
  377. package/dist/mcp-connection-status.d.ts +15 -0
  378. package/dist/messages/en.d.ts +3328 -0
  379. package/dist/messages/runtime.d.ts +69 -0
  380. package/dist/messages.d.ts +3 -0
  381. package/dist/messages.js +16 -0
  382. package/dist/messages.js.map +1 -0
  383. package/dist/model-mark-paths.d.ts +34 -0
  384. package/dist/model-mark-paths.js +16 -0
  385. package/dist/model-mark-paths.js.map +1 -0
  386. package/dist/model-picker-model.d.ts +112 -0
  387. package/dist/model-picker-model.js +25 -0
  388. package/dist/model-picker-model.js.map +1 -0
  389. package/dist/model-policy-picker-menu-NWIETWSR.js +18 -0
  390. package/dist/model-policy-picker-menu-NWIETWSR.js.map +1 -0
  391. package/dist/model-policy.d.ts +35 -10
  392. package/dist/model-policy.js +12 -1
  393. package/dist/native-previews.d.ts +29 -0
  394. package/dist/native-previews.js +82 -0
  395. package/dist/native-previews.js.map +1 -0
  396. package/dist/new-session-draft.d.ts +7 -0
  397. package/dist/new-session-draft.js +639 -0
  398. package/dist/new-session-draft.js.map +1 -0
  399. package/dist/notification-text.d.ts +27 -0
  400. package/dist/{noto-sans-arabic-loader-IA2T4X2A.js → noto-sans-arabic-loader-XSH2KYWJ.js} +3 -1
  401. package/dist/{noto-sans-arabic-loader-IA2T4X2A.js.map → noto-sans-arabic-loader-XSH2KYWJ.js.map} +1 -1
  402. package/dist/{noto-sans-jp-loader.generated-HFGLYBR3.js → noto-sans-jp-loader.generated-MR5L6V7K.js} +3 -1
  403. package/dist/{noto-sans-jp-loader.generated-HFGLYBR3.js.map → noto-sans-jp-loader.generated-MR5L6V7K.js.map} +1 -1
  404. package/dist/organization-model.d.ts +33 -0
  405. package/dist/organization-model.js +65 -0
  406. package/dist/organization-model.js.map +1 -0
  407. package/dist/platform-activity-row-VSQ2FZ5T.js +119 -0
  408. package/dist/platform-activity-row-VSQ2FZ5T.js.map +1 -0
  409. package/dist/plugin-details.d.ts +14 -0
  410. package/dist/plugin-discovery.d.ts +25 -0
  411. package/dist/preview-loading-paint.d.ts +20 -0
  412. package/dist/provider.d.ts +37 -2
  413. package/dist/queue-presentation-model.d.ts +73 -0
  414. package/dist/queue-presentation-model.js +38 -0
  415. package/dist/queue-presentation-model.js.map +1 -0
  416. package/dist/{queue-surface-implementation-LK3S4BIW.js → queue-surface-implementation-MEKXXWGR.js} +189 -343
  417. package/dist/queue-surface-implementation-MEKXXWGR.js.map +1 -0
  418. package/dist/realtime/embedded-new-voice.d.ts +1 -0
  419. package/dist/realtime/embedded-voice.d.ts +1 -0
  420. package/dist/realtime/realtime-control.d.ts +4 -65
  421. package/dist/realtime/session-realtime.d.ts +79 -0
  422. package/dist/realtime.js +26 -1333
  423. package/dist/realtime.js.map +1 -1
  424. package/dist/sandbox-files-5NRC2QUT.js +24 -0
  425. package/dist/sandbox-files-5NRC2QUT.js.map +1 -0
  426. package/dist/sandbox-label-model.d.ts +31 -0
  427. package/dist/sandbox-label-model.js +20 -0
  428. package/dist/sandbox-label-model.js.map +1 -0
  429. package/dist/scrollbars.d.ts +1 -0
  430. package/dist/scrollbars.js +10 -0
  431. package/dist/scrollbars.js.map +1 -0
  432. package/dist/secret-reference-label.d.ts +15 -0
  433. package/dist/secrets-ui.d.ts +57 -0
  434. package/dist/session-agents-model.d.ts +11 -0
  435. package/dist/session-agents-model.js +25 -0
  436. package/dist/session-agents-model.js.map +1 -0
  437. package/dist/session-attention-model.d.ts +8 -0
  438. package/dist/session-attention-model.js +47 -0
  439. package/dist/session-attention-model.js.map +1 -0
  440. package/dist/session-auth-recommendation.d.ts +6 -0
  441. package/dist/session-capability-policy.d.ts +32 -0
  442. package/dist/session-context.d.ts +9 -1
  443. package/dist/session-feedback-model.d.ts +21 -0
  444. package/dist/session-feedback-model.js +56 -0
  445. package/dist/session-feedback-model.js.map +1 -0
  446. package/dist/session-list-model.d.ts +139 -0
  447. package/dist/session-list-model.js +274 -0
  448. package/dist/session-list-model.js.map +1 -0
  449. package/dist/session-realtime-OZCE6IKP.js +22 -0
  450. package/dist/session-realtime-OZCE6IKP.js.map +1 -0
  451. package/dist/session-realtime.d.ts +7 -0
  452. package/dist/session-realtime.js +20 -0
  453. package/dist/session-realtime.js.map +1 -0
  454. package/dist/session-status-model.d.ts +37 -0
  455. package/dist/session-ui.d.ts +40 -3
  456. package/dist/session-ui.js +127 -21
  457. package/dist/session-ui.js.map +1 -1
  458. package/dist/session.d.ts +10 -2
  459. package/dist/session.js +44 -20
  460. package/dist/site-snapshot.d.ts +14 -0
  461. package/dist/sites-ui.d.ts +24 -0
  462. package/dist/sites.d.ts +3 -0
  463. package/dist/sites.js +15 -0
  464. package/dist/sites.js.map +1 -0
  465. package/dist/skill-discovery.d.ts +47 -0
  466. package/dist/terminal.d.ts +8 -0
  467. package/dist/terminal.js +33 -0
  468. package/dist/terminal.js.map +1 -0
  469. package/dist/testing/session-scenarios.d.ts +10 -0
  470. package/dist/testing/session-scenarios.js +367 -0
  471. package/dist/testing/session-scenarios.js.map +1 -0
  472. package/dist/this-computer.d.ts +8 -0
  473. package/dist/this-computer.js +1042 -0
  474. package/dist/this-computer.js.map +1 -0
  475. package/dist/timeline/activity-rail.d.ts +12 -2
  476. package/dist/timeline/agent-identity.d.ts +30 -0
  477. package/dist/timeline/agent-row.d.ts +31 -0
  478. package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
  479. package/dist/timeline/compaction-copy.d.ts +47 -0
  480. package/dist/timeline/focus-sequence.d.ts +9 -0
  481. package/dist/timeline/genie-copy.d.ts +4 -0
  482. package/dist/timeline/genie-loading.d.ts +48 -0
  483. package/dist/timeline/index.d.ts +12 -5
  484. package/dist/timeline/invoked-tool.d.ts +6 -0
  485. package/dist/timeline/knowledge-receipt.d.ts +17 -0
  486. package/dist/timeline/learning-refusal-copy.d.ts +23 -0
  487. package/dist/timeline/learning-refusal-row.d.ts +19 -0
  488. package/dist/timeline/message-sender.d.ts +19 -0
  489. package/dist/timeline/notice-presentation.d.ts +14 -0
  490. package/dist/timeline/parsers.d.ts +11 -0
  491. package/dist/timeline/patch-apply-command.d.ts +19 -0
  492. package/dist/timeline/platform-activity-presentation.d.ts +26 -0
  493. package/dist/timeline/platform-activity-row.d.ts +1 -2
  494. package/dist/timeline/presented-image.d.ts +11 -0
  495. package/dist/timeline/projection.d.ts +32 -2
  496. package/dist/timeline/provider-logo.d.ts +15 -0
  497. package/dist/timeline/question-nav-model.d.ts +23 -0
  498. package/dist/timeline/registry.d.ts +10 -1
  499. package/dist/timeline/retained-image.d.ts +18 -0
  500. package/dist/timeline/retained-loaders.d.ts +27 -0
  501. package/dist/timeline/rolling-activity.d.ts +11 -0
  502. package/dist/timeline/screenshot-lightbox.d.ts +23 -1
  503. package/dist/timeline/session-usage-limit-row.d.ts +11 -0
  504. package/dist/timeline/shared.d.ts +8 -3
  505. package/dist/timeline/startup-dispatch-details.d.ts +5 -0
  506. package/dist/timeline/startup-preference.d.ts +3 -0
  507. package/dist/timeline/startup-timings.d.ts +4 -0
  508. package/dist/timeline/tool-display-name.d.ts +6 -2
  509. package/dist/timeline/tool-presentation.d.ts +185 -0
  510. package/dist/timeline/turn-summary-model.d.ts +102 -0
  511. package/dist/timeline/turn-summary.d.ts +20 -54
  512. package/dist/timeline/types.d.ts +184 -7
  513. package/dist/timeline/work-presentation.d.ts +61 -0
  514. package/dist/{timeline-annotation-markers-DRSTLEM6.js → timeline-annotation-markers-HYLRTT6S.js} +11 -6
  515. package/dist/timeline-annotation-markers-HYLRTT6S.js.map +1 -0
  516. package/dist/{timeline-annotation-selection-IHLUGVND.js → timeline-annotation-selection-LBKW5GHA.js} +15 -5
  517. package/dist/timeline-annotation-selection-LBKW5GHA.js.map +1 -0
  518. package/dist/{timeline-annotations-dialog-6Q53N5FG.js → timeline-annotations-dialog-JKVINC42.js} +34 -19
  519. package/dist/timeline-annotations-dialog-JKVINC42.js.map +1 -0
  520. package/dist/timeline-model.d.ts +29 -0
  521. package/dist/timeline-model.js +254 -0
  522. package/dist/timeline-model.js.map +1 -0
  523. package/dist/usage/allowance-copy.d.ts +26 -0
  524. package/dist/usage/session-usage-limit.d.ts +89 -0
  525. package/dist/usage/summary.d.ts +35 -0
  526. package/dist/usage.d.ts +17 -0
  527. package/dist/usage.js +1201 -0
  528. package/dist/usage.js.map +1 -0
  529. package/dist/voice-recording-owner.d.ts +7 -0
  530. package/package.json +119 -7
  531. package/src/approvals.ts +8 -1
  532. package/src/artifacts-spreadsheet.ts +1 -0
  533. package/src/artifacts.ts +41 -0
  534. package/src/assets/README.md +8 -0
  535. package/src/assets/gmail.ico +0 -0
  536. package/src/assets/outlook.ico +0 -0
  537. package/src/capability-catalog-row.tsx +96 -0
  538. package/src/capability-logo-fallback.ts +22 -0
  539. package/src/client.ts +18 -30
  540. package/src/commands/registry.ts +46 -36
  541. package/src/commands/types.ts +2 -0
  542. package/src/components/anthropic-mark.tsx +10 -0
  543. package/src/components/approval-surface.tsx +407 -142
  544. package/src/components/artifacts/artifact-chrome.tsx +425 -0
  545. package/src/components/artifacts/artifact-sandbox.tsx +193 -0
  546. package/src/components/artifacts/artifact-surface.tsx +48 -26
  547. package/src/components/artifacts/chat-interactive-block.tsx +260 -0
  548. package/src/components/artifacts/deferred-chat-media.tsx +72 -0
  549. package/src/components/artifacts/document-editor.tsx +193 -45
  550. package/src/components/artifacts/editable-artifact-ui.tsx +23 -11
  551. package/src/components/artifacts/editable-artifact-view.tsx +199 -0
  552. package/src/components/artifacts/editable-artifact-workbench.tsx +8 -3
  553. package/src/components/artifacts/editable-document.tsx +76 -54
  554. package/src/components/artifacts/editable-presentation.tsx +86 -40
  555. package/src/components/artifacts/editable-spreadsheet.tsx +581 -121
  556. package/src/components/artifacts/index.ts +42 -0
  557. package/src/components/artifacts/inline-html-document.ts +24 -0
  558. package/src/components/artifacts/latest-task-runner.ts +49 -0
  559. package/src/components/artifacts/presentation-editor.tsx +422 -122
  560. package/src/components/artifacts/published-html-artifact-frame.tsx +79 -265
  561. package/src/components/artifacts/session-artifact-viewer.tsx +381 -0
  562. package/src/components/artifacts/site-view.tsx +129 -0
  563. package/src/components/artifacts/spreadsheet-canvas.ts +5 -10
  564. package/src/components/artifacts/spreadsheet-command-queue.ts +190 -0
  565. package/src/components/artifacts/spreadsheet-download.tsx +117 -0
  566. package/src/components/artifacts/spreadsheet-general-display.ts +43 -0
  567. package/src/components/artifacts/spreadsheet-grid.tsx +390 -172
  568. package/src/components/artifacts/spreadsheet-resize.tsx +432 -0
  569. package/src/components/artifacts/spreadsheet-submissions.tsx +46 -0
  570. package/src/components/artifacts/visualization-assets/base.css +1015 -0
  571. package/src/components/artifacts/visualization-assets/helpers.html +349 -0
  572. package/src/components/artifacts/visualization-assets.gen.ts +3 -0
  573. package/src/components/browser-select-control.tsx +320 -0
  574. package/src/components/browser-viewer.tsx +1102 -505
  575. package/src/components/chat-composer.tsx +42 -3
  576. package/src/components/child-session-link.tsx +16 -5
  577. package/src/components/claude-mark.tsx +11 -0
  578. package/src/components/code-editor.tsx +38 -27
  579. package/src/components/command-palette.tsx +4 -1
  580. package/src/components/composer-transcription-control.tsx +151 -50
  581. package/src/components/composer.tsx +281 -176
  582. package/src/components/computer-viewer.tsx +1013 -341
  583. package/src/components/copy-button.tsx +17 -7
  584. package/src/components/desktop-viewer.tsx +42 -33
  585. package/src/components/diff-view.tsx +3 -1
  586. package/src/components/enrollment-consent.tsx +39 -34
  587. package/src/components/enrollment-device-flow.tsx +31 -19
  588. package/src/components/file-browser.tsx +47 -35
  589. package/src/components/fleet-tile.tsx +8 -4
  590. package/src/components/generated-video-player.tsx +10 -5
  591. package/src/components/grok-mark.tsx +34 -0
  592. package/src/components/human-input-form.tsx +438 -251
  593. package/src/components/human-input-surface.tsx +8 -0
  594. package/src/components/interaction-intervention-banner.tsx +15 -13
  595. package/src/components/linkified-text.tsx +79 -0
  596. package/src/components/machine-card.tsx +56 -89
  597. package/src/components/machine-dock-bar.tsx +10 -4
  598. package/src/components/machine-health-pill.tsx +4 -2
  599. package/src/components/machine-input-display.ts +309 -34
  600. package/src/components/machine-metrics.tsx +10 -7
  601. package/src/components/machine-status-pill.tsx +23 -15
  602. package/src/components/machines/agent-status-icon.tsx +31 -0
  603. package/src/components/machines/health.ts +53 -10
  604. package/src/components/machines/machine-detail.tsx +230 -42
  605. package/src/components/machines/machine-operation-policy.tsx +36 -29
  606. package/src/components/machines/machine-status.ts +264 -0
  607. package/src/components/machines/metric-history-chart.tsx +8 -2
  608. package/src/components/machines/series.ts +12 -11
  609. package/src/components/machines-dashboard.tsx +16 -9
  610. package/src/components/markdown-table-layout.ts +67 -9
  611. package/src/components/markdown.tsx +470 -133
  612. package/src/components/message-timeline.tsx +2290 -752
  613. package/src/components/model-mark.tsx +102 -0
  614. package/src/components/model-picker.tsx +27 -9
  615. package/src/components/model-policy-picker-menu.tsx +204 -100
  616. package/src/components/model-policy-picker.tsx +215 -152
  617. package/src/components/new-conversation.tsx +223 -0
  618. package/src/components/open-geni-chat.tsx +311 -0
  619. package/src/components/open-geni-links.tsx +183 -0
  620. package/src/components/openrouter-mark.tsx +13 -0
  621. package/src/components/opper-mark.tsx +18 -0
  622. package/src/components/pierre-diff.tsx +47 -19
  623. package/src/components/pierre-file.tsx +38 -11
  624. package/src/components/preview-loading.tsx +111 -0
  625. package/src/components/provider-recovery-notice.tsx +51 -0
  626. package/src/components/queue-item-content.ts +16 -0
  627. package/src/components/queue-surface-implementation.tsx +185 -420
  628. package/src/components/queue-surface-state.tsx +13 -8
  629. package/src/components/queue-surface.tsx +3 -1
  630. package/src/components/rehype-secret-refs.ts +98 -0
  631. package/src/components/remark-soft-line-breaks.ts +166 -0
  632. package/src/components/sandbox-files.tsx +75 -44
  633. package/src/components/sandbox-terminal.tsx +103 -22
  634. package/src/components/sandbox-workspace.tsx +168 -78
  635. package/src/components/secret-question-field.tsx +326 -0
  636. package/src/components/secret-ref-chip.tsx +187 -0
  637. package/src/components/session-capability-frame.tsx +203 -0
  638. package/src/components/session-chrome.tsx +559 -328
  639. package/src/components/session-commands-panel.tsx +34 -17
  640. package/src/components/session-commands.tsx +18 -0
  641. package/src/components/session-connection-request.tsx +99 -0
  642. package/src/components/session-conversation.tsx +853 -118
  643. package/src/components/session-list.tsx +259 -0
  644. package/src/components/session-mcp-capability-card.tsx +681 -0
  645. package/src/components/session-proxy-scope.tsx +160 -0
  646. package/src/components/session-status.tsx +35 -21
  647. package/src/components/session-usage-limit-notice.tsx +176 -0
  648. package/src/components/this-computer/illustrations.tsx +164 -0
  649. package/src/components/this-computer/labels.ts +234 -0
  650. package/src/components/this-computer/this-computer-card.tsx +203 -0
  651. package/src/components/this-computer/this-computer-setup.tsx +433 -0
  652. package/src/components/this-computer/this-computer-status.tsx +329 -0
  653. package/src/components/this-computer/use-this-computer.ts +183 -0
  654. package/src/components/timeline-anchor.tsx +43 -15
  655. package/src/components/timeline-annotation-chrome.tsx +33 -9
  656. package/src/components/timeline-annotation-markers.tsx +4 -2
  657. package/src/components/timeline-annotation-selection.tsx +11 -2
  658. package/src/components/timeline-annotation-shared.ts +9 -8
  659. package/src/components/timeline-annotations-dialog.tsx +30 -9
  660. package/src/components/timeline-annotations.tsx +24 -7
  661. package/src/components/timeline-reading-progress.ts +80 -0
  662. package/src/components/timeline-search.tsx +168 -0
  663. package/src/components/timeline-settlement.ts +60 -0
  664. package/src/components/tool-action-review.tsx +670 -0
  665. package/src/components/tool-review-history.tsx +88 -0
  666. package/src/components/usage-limit-notice.tsx +183 -0
  667. package/src/components/usage-member-list.tsx +797 -0
  668. package/src/components/usage-meter.tsx +386 -0
  669. package/src/components/use-viewer-menu-dismiss.ts +33 -0
  670. package/src/components/user-message-body.tsx +33 -2
  671. package/src/components/workbench-changes.tsx +28 -16
  672. package/src/components/workspace-dock.tsx +45 -13
  673. package/src/composer-messages.ts +153 -0
  674. package/src/composer-voice-events.ts +12 -0
  675. package/src/composer.ts +4 -0
  676. package/src/connect-account-identity.tsx +38 -0
  677. package/src/connect-accounts.tsx +233 -0
  678. package/src/connect-chooser.tsx +339 -0
  679. package/src/connect-panel.tsx +104 -0
  680. package/src/connect-setup.tsx +354 -0
  681. package/src/connect.ts +60 -0
  682. package/src/connection-assets.d.ts +4 -0
  683. package/src/connection-catalog.tsx +175 -0
  684. package/src/connection-discovery.tsx +251 -0
  685. package/src/connection-installed.tsx +56 -0
  686. package/src/connection-logo.tsx +37 -0
  687. package/src/connection-service-logo.tsx +55 -0
  688. package/src/connection-service-presentation.ts +46 -0
  689. package/src/connection-skeleton.tsx +16 -0
  690. package/src/connection-type-picker.tsx +38 -0
  691. package/src/conversation-timeline.ts +11 -2
  692. package/src/desktop.ts +24 -0
  693. package/src/device-authorization.tsx +111 -0
  694. package/src/diffs.ts +16 -0
  695. package/src/discovery-cache.ts +42 -0
  696. package/src/editor.ts +13 -0
  697. package/src/hooks/internal.ts +93 -10
  698. package/src/hooks/latest-question.ts +168 -0
  699. package/src/hooks/session-view-cache.ts +167 -0
  700. package/src/hooks/shared-machines-list.ts +34 -1
  701. package/src/hooks/shared-query.ts +744 -0
  702. package/src/hooks/use-attached-browsers.ts +1 -1
  703. package/src/hooks/use-auth-runs.ts +0 -27
  704. package/src/hooks/use-available-models.ts +20 -10
  705. package/src/hooks/use-browser-frame-stream.ts +23 -4
  706. package/src/hooks/use-browser-session.ts +684 -206
  707. package/src/hooks/use-browser-sessions.ts +32 -1
  708. package/src/hooks/use-client-config-flags.ts +102 -0
  709. package/src/hooks/use-codex-accounts.ts +216 -43
  710. package/src/hooks/use-composer.ts +240 -59
  711. package/src/hooks/use-computer-frame-stream.ts +29 -9
  712. package/src/hooks/use-computer-input-posture.ts +96 -0
  713. package/src/hooks/use-computer-session.ts +419 -100
  714. package/src/hooks/use-connect.ts +23 -0
  715. package/src/hooks/use-desktop-stream.ts +19 -28
  716. package/src/hooks/use-file-attachments.ts +19 -3
  717. package/src/hooks/use-goal.ts +172 -21
  718. package/src/hooks/use-human-input.ts +16 -2
  719. package/src/hooks/use-last-started-turn-policy.ts +37 -11
  720. package/src/hooks/use-machine-chip.ts +13 -8
  721. package/src/hooks/use-machines.ts +24 -10
  722. package/src/hooks/use-new-conversation.ts +377 -0
  723. package/src/hooks/use-new-session-draft.ts +813 -0
  724. package/src/hooks/use-realtime-voice-models.ts +46 -0
  725. package/src/hooks/use-sandbox-files.ts +22 -16
  726. package/src/hooks/use-session-background-commands.ts +2 -2
  727. package/src/hooks/use-session-capabilities.ts +3 -2
  728. package/src/hooks/use-session-conversation.ts +150 -0
  729. package/src/hooks/use-session-events.ts +403 -64
  730. package/src/hooks/use-session-lineage.ts +47 -9
  731. package/src/hooks/use-session-mcp-approval-policy.ts +13 -5
  732. package/src/hooks/use-session-model-account.ts +174 -0
  733. package/src/hooks/use-session.ts +19 -3
  734. package/src/hooks/use-slash-commands.ts +6 -11
  735. package/src/hooks/use-supergrok-accounts.ts +22 -8
  736. package/src/hooks/use-terminal-stream.ts +153 -27
  737. package/src/hooks/use-transcription.ts +45 -19
  738. package/src/hooks/use-turn-queue.ts +25 -5
  739. package/src/hooks/use-usage.ts +100 -0
  740. package/src/hooks/use-vaults.ts +153 -0
  741. package/src/hooks/use-video-artifact-playback.ts +1 -1
  742. package/src/hooks/use-voice-input.ts +127 -19
  743. package/src/hooks/use-workspace-capture.ts +3 -2
  744. package/src/hooks/use-workspace-sessions.ts +74 -7
  745. package/src/human-input-model.ts +374 -0
  746. package/src/identity-link-accounts.tsx +149 -0
  747. package/src/identity-link-consent.tsx +193 -0
  748. package/src/index.ts +282 -16
  749. package/src/interaction.ts +1 -0
  750. package/src/lib/client-config-read.ts +76 -0
  751. package/src/lib/clipboard.ts +29 -0
  752. package/src/lib/error-message.ts +37 -0
  753. package/src/lib/format.ts +231 -36
  754. package/src/lib/host-theme.ts +529 -0
  755. package/src/lib/interaction-errors.ts +15 -0
  756. package/src/lib/menu-styles.ts +44 -0
  757. package/src/lib/notify-observer.ts +15 -0
  758. package/src/lib/pierre-diffs-loader.ts +53 -0
  759. package/src/lib/provider-recovery.ts +255 -0
  760. package/src/lib/scrollbars.ts +30 -0
  761. package/src/lib/terminal-input-readiness.ts +51 -0
  762. package/src/lib/transient-retry.ts +101 -0
  763. package/src/lib/workbench-peers.ts +62 -0
  764. package/src/lib/xterm-theme.ts +23 -21
  765. package/src/mcp-connection-status.ts +39 -0
  766. package/src/messages/en.ts +3810 -0
  767. package/src/messages/runtime.tsx +175 -0
  768. package/src/messages.ts +19 -0
  769. package/src/model-mark-paths.ts +53 -0
  770. package/src/model-picker-model.ts +343 -0
  771. package/src/model-policy.ts +301 -79
  772. package/src/native-previews.ts +104 -0
  773. package/src/new-session-draft.ts +22 -0
  774. package/src/notification-text.ts +81 -0
  775. package/src/organization-model.ts +123 -0
  776. package/src/plugin-details.tsx +192 -0
  777. package/src/plugin-discovery.tsx +209 -0
  778. package/src/preview-loading-paint.ts +68 -0
  779. package/src/provider.tsx +105 -21
  780. package/src/queue-presentation-model.ts +475 -0
  781. package/src/realtime/dropdown-menu.tsx +19 -12
  782. package/src/realtime/embedded-new-voice.tsx +1 -0
  783. package/src/realtime/embedded-voice.tsx +3 -0
  784. package/src/realtime/realtime-control.tsx +240 -609
  785. package/src/realtime/session-realtime.ts +582 -0
  786. package/src/sandbox-label-model.ts +56 -0
  787. package/src/scrollbars.ts +3 -0
  788. package/src/secret-reference-label.ts +47 -0
  789. package/src/secrets-ui.tsx +59 -0
  790. package/src/session-agents-model.ts +40 -0
  791. package/src/session-attention-model.ts +62 -0
  792. package/src/session-auth-recommendation.ts +50 -0
  793. package/src/session-capability-policy.ts +200 -0
  794. package/src/session-context.ts +13 -5
  795. package/src/session-feedback-model.ts +101 -0
  796. package/src/session-list-model.ts +437 -0
  797. package/src/session-realtime.ts +18 -0
  798. package/src/session-status-model.ts +99 -0
  799. package/src/session-ui.ts +102 -3
  800. package/src/session.ts +19 -1
  801. package/src/site-snapshot.ts +74 -0
  802. package/src/sites-ui.tsx +350 -0
  803. package/src/sites.ts +3 -0
  804. package/src/skill-discovery.tsx +221 -0
  805. package/src/terminal.ts +26 -0
  806. package/src/testing/session-scenarios.ts +404 -0
  807. package/src/this-computer.ts +62 -0
  808. package/src/timeline/activity-rail.tsx +289 -119
  809. package/src/timeline/agent-identity.tsx +84 -0
  810. package/src/timeline/agent-row.tsx +235 -0
  811. package/src/timeline/allowance-exhausted-row.tsx +90 -0
  812. package/src/timeline/compaction-copy.ts +125 -0
  813. package/src/timeline/fleet-decision-row.tsx +120 -101
  814. package/src/timeline/focus-sequence.ts +44 -0
  815. package/src/timeline/genie-copy.ts +22 -0
  816. package/src/timeline/genie-loading.tsx +158 -0
  817. package/src/timeline/index.ts +37 -2
  818. package/src/timeline/invoked-tool.ts +15 -0
  819. package/src/timeline/knowledge-receipt.tsx +104 -0
  820. package/src/timeline/learning-refusal-copy.ts +67 -0
  821. package/src/timeline/learning-refusal-row.tsx +70 -0
  822. package/src/timeline/message-sender.tsx +71 -0
  823. package/src/timeline/notice-presentation.ts +67 -0
  824. package/src/timeline/parsers.ts +42 -2
  825. package/src/timeline/patch-apply-command.tsx +139 -0
  826. package/src/timeline/platform-activity-presentation.ts +219 -0
  827. package/src/timeline/platform-activity-row.tsx +34 -98
  828. package/src/timeline/presented-image.ts +63 -0
  829. package/src/timeline/projection.ts +1556 -71
  830. package/src/timeline/provider-logo.tsx +53 -0
  831. package/src/timeline/question-nav-model.ts +28 -0
  832. package/src/timeline/registry.ts +11 -1
  833. package/src/timeline/retained-image.ts +102 -0
  834. package/src/timeline/retained-loaders.ts +91 -0
  835. package/src/timeline/rolling-activity.tsx +84 -0
  836. package/src/timeline/screenshot-lightbox.tsx +250 -10
  837. package/src/timeline/session-usage-limit-row.tsx +44 -0
  838. package/src/timeline/shared.tsx +76 -29
  839. package/src/timeline/startup-dispatch-details.tsx +43 -0
  840. package/src/timeline/startup-preference.ts +33 -0
  841. package/src/timeline/startup-timings.tsx +164 -0
  842. package/src/timeline/tool-diff.tsx +3 -1
  843. package/src/timeline/tool-display-name.ts +38 -6
  844. package/src/timeline/tool-presentation.ts +1552 -0
  845. package/src/timeline/tool-renderers.tsx +1019 -1265
  846. package/src/timeline/turn-summary-model.ts +363 -0
  847. package/src/timeline/turn-summary.tsx +288 -367
  848. package/src/timeline/types.ts +191 -7
  849. package/src/timeline/work-presentation.ts +196 -0
  850. package/src/timeline-model.ts +143 -0
  851. package/src/usage/allowance-copy.ts +70 -0
  852. package/src/usage/session-usage-limit.ts +270 -0
  853. package/src/usage/summary.ts +93 -0
  854. package/src/usage.ts +70 -0
  855. package/src/voice-recording-owner.ts +22 -0
  856. package/styles/compiled.css +2010 -651
  857. package/styles/connect.css +290 -0
  858. package/styles/connect.d.ts +1 -0
  859. package/styles/effective-tokens.css +1 -0
  860. package/styles/index.css +286 -9
  861. package/styles/responsive.css +98 -6
  862. package/styles/session-capability.css +44 -0
  863. package/styles/this-computer.css +1042 -0
  864. package/styles/this-computer.d.ts +1 -0
  865. package/styles/tokens.css +132 -64
  866. package/dist/browser-viewer-NTD6UIPR.js +0 -14
  867. package/dist/chunk-24M4YBCL.js.map +0 -1
  868. package/dist/chunk-4MDLEHXL.js.map +0 -1
  869. package/dist/chunk-5M6VTFJ5.js.map +0 -1
  870. package/dist/chunk-5PQJOCX5.js +0 -902
  871. package/dist/chunk-5PQJOCX5.js.map +0 -1
  872. package/dist/chunk-5YK2ZDIG.js.map +0 -1
  873. package/dist/chunk-6J56T3MG.js.map +0 -1
  874. package/dist/chunk-BV5A4OTE.js.map +0 -1
  875. package/dist/chunk-CQG7YUJB.js +0 -10883
  876. package/dist/chunk-CQG7YUJB.js.map +0 -1
  877. package/dist/chunk-H5YGYNXS.js.map +0 -1
  878. package/dist/chunk-HUIKIDM5.js.map +0 -1
  879. package/dist/chunk-HUMIRRYI.js.map +0 -1
  880. package/dist/chunk-ICA6R6TW.js.map +0 -1
  881. package/dist/chunk-JVYQRRC4.js.map +0 -1
  882. package/dist/chunk-KCGXPP5V.js.map +0 -1
  883. package/dist/chunk-KZ73RL76.js.map +0 -1
  884. package/dist/chunk-NEXLLTP4.js.map +0 -1
  885. package/dist/chunk-NLTS7JHI.js.map +0 -1
  886. package/dist/chunk-NOSYBS2D.js.map +0 -1
  887. package/dist/chunk-PAJU5KKL.js.map +0 -1
  888. package/dist/chunk-PEI6RANI.js.map +0 -1
  889. package/dist/chunk-PLYRL5ER.js +0 -164
  890. package/dist/chunk-PLYRL5ER.js.map +0 -1
  891. package/dist/chunk-R4KRSFGA.js +0 -290
  892. package/dist/chunk-R4KRSFGA.js.map +0 -1
  893. package/dist/chunk-UMECRJRV.js +0 -223
  894. package/dist/chunk-UMECRJRV.js.map +0 -1
  895. package/dist/chunk-VRBL3F5E.js +0 -241
  896. package/dist/chunk-VRBL3F5E.js.map +0 -1
  897. package/dist/chunk-YBM6CQRU.js.map +0 -1
  898. package/dist/chunk-Z7WBDB4E.js.map +0 -1
  899. package/dist/computer-viewer-7TEZC6Y2.js +0 -16
  900. package/dist/fleet-decision-row-YZ3ZKWMM.js +0 -352
  901. package/dist/fleet-decision-row-YZ3ZKWMM.js.map +0 -1
  902. package/dist/hooks/use-environments.d.ts +0 -41
  903. package/dist/hooks/use-packs.d.ts +0 -32
  904. package/dist/markdown-table-layout-3Z3AWBY7.js.map +0 -1
  905. package/dist/model-policy-picker-menu-3R336DP2.js +0 -13
  906. package/dist/platform-activity-row-27LKAWZD.js +0 -169
  907. package/dist/platform-activity-row-27LKAWZD.js.map +0 -1
  908. package/dist/queue-surface-implementation-LK3S4BIW.js.map +0 -1
  909. package/dist/timeline-annotation-markers-DRSTLEM6.js.map +0 -1
  910. package/dist/timeline-annotation-selection-IHLUGVND.js.map +0 -1
  911. package/dist/timeline-annotations-dialog-6Q53N5FG.js.map +0 -1
  912. package/src/hooks/use-environments.ts +0 -182
  913. package/src/hooks/use-packs.ts +0 -157
  914. /package/dist/{browser-viewer-NTD6UIPR.js.map → browser-viewer-GEHX3KYE.js.map} +0 -0
  915. /package/dist/{computer-viewer-7TEZC6Y2.js.map → chat-interactive-block-5V3BGLXT.js.map} +0 -0
  916. /package/dist/{model-policy-picker-menu-3R336DP2.js.map → chunk-M357MHH3.js.map} +0 -0
@@ -1,4 +1,35 @@
1
+ import { QUESTION_NAV_MARGIN_PX, questionNavTarget } from "../timeline/question-nav-model";
2
+ import { timelineGroupIndexAtSequence } from "../timeline/focus-sequence";
3
+ import { RollingActivity } from "../timeline/rolling-activity";
4
+ import {
5
+ clusterIsSettled,
6
+ compactedLandmarkCount,
7
+ durationBetween,
8
+ flattenActivityItems,
9
+ isPreparingWork,
10
+ readableWorkDefaultOpen,
11
+ readableWorkHasDetails,
12
+ readableWorkShowsPreview,
13
+ readableWorkStatus,
14
+ } from "../timeline/work-presentation";
15
+ import { useErrorMessage } from "../lib/error-message";
16
+ import { formatElapsed } from "../timeline/turn-summary";
17
+ import { ActivityNoteTextContext } from "../timeline/activity-rail";
18
+ import { timelineGroupContainsPresentedImage } from "../timeline/presented-image";
19
+ import {
20
+ isTimelineSearchTarget,
21
+ TimelineSearchRevealContext,
22
+ useTimelineSearchNavigation,
23
+ type TimelineSearchTarget,
24
+ } from "./timeline-search";
25
+ import { GenieLoadingOptionsContext, type GenieLoadingOptions } from "../timeline/genie-loading";
1
26
  import { ChildSessionLink } from "./child-session-link";
27
+ import { useStartupDetails } from "../timeline/startup-preference";
28
+ import {
29
+ compactionFailureDetails,
30
+ compactionSkipSubtitle,
31
+ compactionSkipTitle,
32
+ } from "../timeline/compaction-copy";
2
33
  import type {
3
34
  DraftTimelineAnnotation,
4
35
  MediaGenerationResult,
@@ -9,10 +40,13 @@ import { dequal } from "dequal/lite";
9
40
  import {
10
41
  ArrowDownIcon,
11
42
  ArrowRightIcon,
43
+ ArrowUpIcon,
12
44
  BotIcon,
13
45
  CheckCircle2Icon,
14
46
  CheckIcon,
47
+ ChevronDownIcon,
15
48
  ChevronRightIcon,
49
+ CornerDownRightIcon,
16
50
  PauseCircleIcon,
17
51
  PauseIcon,
18
52
  MessageCircleQuestionIcon,
@@ -25,16 +59,19 @@ import {
25
59
  TriangleAlertIcon,
26
60
  XCircleIcon,
27
61
  } from "lucide-react";
28
- import type { ComponentType } from "react";
29
- import { AnimatePresence, motion } from "motion/react";
30
- import { Collapsible } from "radix-ui";
62
+ import type { ComponentType, CSSProperties } from "react";
63
+ import { AnimatePresence, motion, useReducedMotion } from "motion/react";
31
64
  import {
32
65
  Component,
66
+ Fragment,
33
67
  Suspense,
68
+ createContext,
34
69
  lazy,
35
70
  memo,
36
71
  useCallback,
72
+ useContext,
37
73
  useEffect,
74
+ useId,
38
75
  useLayoutEffect,
39
76
  useMemo,
40
77
  useRef,
@@ -42,6 +79,11 @@ import {
42
79
  type ReactNode,
43
80
  } from "react";
44
81
  import { cn } from "../lib/cn";
82
+ import {
83
+ MessageSenderContext,
84
+ MessageSenderSlot,
85
+ type RenderMessageSender,
86
+ } from "../timeline/message-sender";
45
87
  import { formatClockTime, formatRelativeTime, truncate } from "../lib/format";
46
88
  import { prefersReducedMotion } from "../lib/motion";
47
89
  import {
@@ -49,17 +91,27 @@ import {
49
91
  type OlderHistoryLoadReceipt,
50
92
  type OlderHistoryLoader,
51
93
  } from "../older-history";
52
- import { Markdown } from "./markdown";
94
+ import { Markdown, type MarkdownProps } from "./markdown";
95
+ import { linkifyText } from "./linkified-text";
96
+ import { OpenGeniLinkProvider, type OpenGeniLinkResolver } from "./open-geni-links";
53
97
  import {
54
98
  TimelineBeforeLayout,
55
99
  captureTimelineAnchor,
56
100
  timelineAnchorCorrection,
101
+ timelineHasReader,
57
102
  type TimelineAnchor,
58
103
  } from "./timeline-anchor";
104
+ import { useReadingProgress } from "./timeline-reading-progress";
105
+ import {
106
+ animateTimelineSettlement,
107
+ captureTimelineSettlement,
108
+ type TimelineSettlement,
109
+ } from "./timeline-settlement";
59
110
  import {
60
111
  UserMessageBody,
61
112
  UserMessageDisclosureProvider,
62
113
  type UserMessageDisclosureContextValue,
114
+ type UserMessageDisclosureLabels,
63
115
  } from "./user-message-body";
64
116
  import {
65
117
  createTipFollowState,
@@ -96,6 +148,7 @@ import {
96
148
  type VideoArtifactPlaybackLoader,
97
149
  type ToolRegistry,
98
150
  type TurnSummaryOptions,
151
+ type TurnSummaryStatus,
99
152
  type UserMessageItem,
100
153
  type FoldRestingState,
101
154
  type WorkerCompletionItem,
@@ -106,26 +159,64 @@ import {
106
159
  useTurnSettleOpen,
107
160
  } from "../timeline";
108
161
  import { CopyHoverFrame } from "./copy-button";
162
+ import { SecretAnswerChip } from "./secret-ref-chip";
163
+ import { secretAnswerLabel } from "../human-input-model";
109
164
  import { TimelineAnnotationSourceRootContext } from "./timeline-annotation-reveal-context";
110
165
  import { GeneratedVideoPlayer } from "./generated-video-player";
111
166
  import {
112
167
  MACHINE_INPUT_META,
168
+ agentMemberSessionId,
169
+ agentMemberText,
170
+ agentMemberTitle,
113
171
  cleanMachineInputSummary,
172
+ isAgentMember,
114
173
  machineInputBatchLabel,
115
174
  machineInputSummaryIsUseful,
116
175
  readableMachineInputSource,
117
176
  } from "./machine-input-display";
177
+ import { AgentRow, AgentRowSection, AgentRowText } from "../timeline/agent-row";
178
+ import {
179
+ AgentIdentityProvider,
180
+ useAgentIdentity,
181
+ type ResolveSessionTitle,
182
+ } from "../timeline/agent-identity";
183
+ import { namedAgentTitle, type AgentTitleParts } from "../timeline/platform-activity-presentation";
118
184
  import { SESSION_STATUS_META, StatusDot } from "./session-status";
185
+ import {
186
+ noticeDisplayText,
187
+ noticeIsResolvedApproval,
188
+ noticeTone,
189
+ } from "../timeline/notice-presentation";
119
190
  import { TimelineComputeLabelProvider } from "../timeline/compute-label";
191
+ import { ProviderLogoProvider } from "../timeline/provider-logo";
120
192
  import { EntranceAnimationProvider, useEntranceAnimation } from "../timeline/entrance";
193
+ import {
194
+ AllowanceExhaustedRow,
195
+ AllowancePresentationProvider,
196
+ type RenderAllowanceExhausted,
197
+ } from "../timeline/allowance-exhausted-row";
198
+ import { SessionUsageLimitRow } from "../timeline/session-usage-limit-row";
199
+ import { LearningRefusalRow } from "../timeline/learning-refusal-row";
200
+ import type { AllowanceLabels } from "../usage/allowance-copy";
121
201
  import { SeenActivityIdsProvider } from "../timeline/seen-activity-ids";
122
202
  import { TimelineAnnotationCards } from "./timeline-annotations";
123
203
  import { TooltipProvider } from "./tooltip";
204
+ import { useOpenGeniText, type OpenGeniText } from "../messages/runtime";
124
205
 
125
206
  const TimelineAnnotationSelection = lazy(() => import("./timeline-annotation-selection"));
126
207
  const TimelineAnnotationMarkers = lazy(() => import("./timeline-annotation-markers"));
127
208
 
128
209
  export type MessageTimelineProps = {
210
+ /** Exact durable search hit; clearing it removes highlighting without moving the reader. */
211
+ searchTarget?: TimelineSearchTarget | null | undefined;
212
+ /**
213
+ * A durable event sequence to open on once (an inbox item's or notification's
214
+ * moment): the timeline lands on the row that holds it, or the nearest row
215
+ * before it, instead of the latest message. Load the window around it first.
216
+ */
217
+ focusSequence?: number | null | undefined;
218
+ /** Localized user-message disclosure actions, including custom UserMessageBody renderers. */
219
+ userMessageDisclosureLabels?: UserMessageDisclosureLabels | undefined;
129
220
  /** Raw session events (projected internally) … */
130
221
  events?: SessionEvent[] | undefined;
131
222
  /** … or pre-projected items (e.g. from `useSessionEvents().timeline`). */
@@ -134,18 +225,40 @@ export type MessageTimelineProps = {
134
225
  status?: SessionStatus | null | undefined;
135
226
  /** Host-owned controls beside Copy and the timestamp on settled message rows. */
136
227
  renderMessageActions?: ((item: AgentMessageItem | UserMessageItem) => ReactNode) | undefined;
228
+ /**
229
+ * Who sent a person's message, drawn above its bubble. Called only for
230
+ * messages that carry a sender; return null for the viewer's own messages
231
+ * or when the host has no identity to show. Omit to show no senders.
232
+ */
233
+ renderMessageSender?: RenderMessageSender | undefined;
137
234
  /** Plug a markdown renderer for message bodies (e.g. streamdown). */
138
235
  renderMessageText?:
139
- | ((text: string, item: AgentMessageItem | UserMessageItem) => ReactNode)
236
+ | ((
237
+ text: string,
238
+ item: AgentMessageItem | UserMessageItem,
239
+ context: { searchTarget: TimelineSearchTarget | null },
240
+ ) => ReactNode)
140
241
  | undefined;
242
+ /**
243
+ * Render assistant `opengeni-html` / `opengeni-site` fences in the default
244
+ * message renderer (`SessionConversation` supplies the inline Site preview).
245
+ */
246
+ renderInteractiveBlock?: MarkdownProps["renderInteractiveBlock"];
141
247
  /** Drill into a spawned worker session. */
142
248
  onOpenSession?: ((sessionId: string) => void) | undefined;
249
+ /**
250
+ * Name the agents this session spawns, messages, and hears from. Return the
251
+ * current display title for a session id, or null when unknown; the
252
+ * timeline falls back to the title given at spawn, then to generic copy.
253
+ * Keep the function identity stable across renders.
254
+ */
255
+ resolveSessionTitle?: ResolveSessionTitle | undefined;
143
256
  /**
144
257
  * Deep-link a memory row (a `memory.saved` / `memory.corrected` step) to its
145
258
  * record in the host's memory pane. Opt-in, exactly like `onReconnect`: the
146
259
  * library draws no "View in memory" affordance without a handler — the memory
147
260
  * row is then non-interactive rich content. This is the switch that makes the
148
- * deep-link a first-party OpenGeni capability without other SDK consumers
261
+ * deep-link a first-party Opengeni capability without other SDK consumers
149
262
  * opting into it. The app supplies it (it owns routing to the memory pane).
150
263
  */
151
264
  onMemoryClick?: ((memoryId: string) => void) | undefined;
@@ -157,6 +270,17 @@ export type MessageTimelineProps = {
157
270
  * a Reconnect button without a handler to run it.
158
271
  */
159
272
  onReconnect?: ((item: AuthNeededItem) => void | Promise<void>) | undefined;
273
+ /** Host-owned inline connection setup. Return undefined to use the default recovery card. */
274
+ renderAuthNeeded?: ((item: AuthNeededItem) => ReactNode | undefined) | undefined;
275
+ /**
276
+ * Replace the "usage limit reached" row shown when a workspace or member
277
+ * usage allowance stops work (an `allowance_exhausted` refusal). Receives the
278
+ * typed refusal (scope, reset time) and the default row; return undefined to
279
+ * keep the default. Use it to point people at your own plan or admin page.
280
+ */
281
+ renderAllowanceExhausted?: RenderAllowanceExhausted | undefined;
282
+ /** Replace the words of the default "usage limit reached" row. */
283
+ allowanceExhaustedLabels?: Partial<AllowanceLabels> | undefined;
160
284
  /**
161
285
  * Decide which durable authentication notices this timeline presents.
162
286
  * Defaults to showing every notice. Embedded hosts can suppress notices for
@@ -177,6 +301,16 @@ export type MessageTimelineProps = {
177
301
  * `createDefaultToolRegistry({ entries })` to add custom tool renderers.
178
302
  */
179
303
  toolRegistry?: ToolRegistry | undefined;
304
+ /**
305
+ * Open Opengeni object links the agent writes in replies and progress notes:
306
+ * `artifact:<file>`, `sandbox:<path>`, editable artifacts, and Sites. Return
307
+ * a host URL (`{ href }`) or action (`{ open }`); unhandled targets render as
308
+ * unavailable text instead of a console link that 404s inside the host.
309
+ * Applies to the default message renderer and to any `Markdown` a custom
310
+ * `renderMessageText` renders. `SessionConversation` supplies file and
311
+ * sandbox downloads by default.
312
+ */
313
+ resolveLink?: OpenGeniLinkResolver | undefined;
180
314
  /** Resolve opaque retained screenshot receipts through the authenticated host SDK. */
181
315
  loadRetainedScreenshot?: RetainedScreenshotLoader | undefined;
182
316
  /** Resolve permanent workspace image/file receipts through the authenticated host SDK. */
@@ -189,11 +323,18 @@ export type MessageTimelineProps = {
189
323
  */
190
324
  computeLabel?: string | null | undefined;
191
325
  /** Customize collapsed turn facets for this timeline instance. */
326
+ genieLoading?: GenieLoadingOptions | undefined;
192
327
  turnSummary?: TurnSummaryOptions | undefined;
193
328
  /** Follow new events when pinned to the bottom. Defaults to true. */
194
329
  autoFollow?: boolean | undefined;
195
330
  /** Capture a same-row text selection into the host's canonical composer draft. */
196
331
  onAnnotate?: ((annotation: DraftTimelineAnnotation) => void) | undefined;
332
+ /**
333
+ * Hide the floating "Back to your message" pill while the timeline viewport
334
+ * is shorter than this (px), e.g. a narrow embed above a decision card.
335
+ * Defaults to 0 (always available).
336
+ */
337
+ questionNavMinViewportHeight?: number | undefined;
197
338
  /** Composer draft quotes currently attached to the next send. */
198
339
  draftAnnotations?: readonly DraftTimelineAnnotation[] | undefined;
199
340
  /** Open the composer review list for one numbered draft badge. */
@@ -216,13 +357,16 @@ export type MessageTimelineProps = {
216
357
  hasNewer?: boolean | undefined;
217
358
  /** A newer history page is being fetched. */
218
359
  loadingNewer?: boolean | undefined;
219
- /** Page forward through history without loading the whole gap to the tip. */
220
- onLoadNewer?: (() => void) | undefined;
360
+ /** Page forward through history. Return the request promise to enable inline error/retry. */
361
+ onLoadNewer?: (() => unknown) | undefined;
221
362
  /**
222
363
  * Reload the live tip window. When omitted, Jump to latest only re-pins and
223
364
  * scrolls the in-memory window.
224
365
  */
225
366
  onJumpToLatest?: (() => void | Promise<void>) | undefined;
367
+ /** @deprecated Retained for source compatibility; contextual prompt navigation
368
+ * uses only mounted prompts and never invokes this global resolver. */
369
+ onJumpToLatestQuestion?: (() => Promise<number | null>) | undefined;
226
370
  /** Host-owned content appended after timeline groups, such as startup progress. */
227
371
  trailingState?: ReactNode | undefined;
228
372
  emptyState?: ReactNode | undefined;
@@ -261,6 +405,24 @@ const PIN_THRESHOLD_PX = 48;
261
405
  * line-sized streaming movement.
262
406
  */
263
407
  const JUMP_TO_LATEST_CATCHUP_DEBT_PX = 240;
408
+ /**
409
+ * Floating timeline navigation: two identical small round arrow buttons at fixed
410
+ * spots, centered on the conversation. Back to your message floats 12px below
411
+ * the top edge, or just below an expanded work-header strip while that strip is
412
+ * pinned (32px, 44px on coarse pointers) so the strip stays a full-width
413
+ * target. Jump to latest floats 12px above the bottom edge. They never dodge
414
+ * the content beneath them (floating over a sliver of text is fine), so they
415
+ * cannot wander as rows stream in or the host resizes. Coarse pointers get a
416
+ * larger invisible hit area instead of a larger button.
417
+ */
418
+ const NAV_BUTTON_CLASS =
419
+ "pointer-events-auto relative inline-flex size-8 items-center justify-center rounded-full border border-og-border bg-og-surface-3/90 text-og-fg-muted shadow-og-md backdrop-blur hover:border-og-border-strong hover:text-og-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-og-accent pointer-coarse:before:absolute pointer-coarse:before:-inset-1.5 pointer-coarse:before:content-['']";
420
+ const NAV_FADE = {
421
+ initial: { opacity: 0 },
422
+ animate: { opacity: 1 },
423
+ exit: { opacity: 0 },
424
+ transition: { duration: 0.15, ease: "easeOut" },
425
+ } as const;
264
426
  /**
265
427
  * Prefetch older history when the top sentinel is this far from the viewport.
266
428
  * After a page loads we stay cool until the reader leaves this band (scrolls
@@ -269,13 +431,21 @@ const JUMP_TO_LATEST_CATCHUP_DEBT_PX = 240;
269
431
  const OLDER_PREFETCH_MARGIN_PX = 400;
270
432
  const OLDER_PREFETCH_ROOT_MARGIN = `${OLDER_PREFETCH_MARGIN_PX}px 0px 0px 0px`;
271
433
  const PRIMARY_ACTION_CLASS =
272
- "inline-flex w-full shrink-0 items-center justify-center gap-1.5 rounded-og-md bg-og-accent px-3 py-1.5 text-og-menu font-medium text-og-accent-fg sm:w-auto";
434
+ "inline-flex w-full shrink-0 items-center justify-center gap-1.5 rounded-og-md border border-og-primary-border bg-og-primary text-og-primary-fg px-3 py-1.5 text-og-menu font-medium sm:w-auto";
273
435
  const MESSAGE_BUBBLE_CLASS =
274
436
  "w-fit max-w-full min-w-0 rounded-og-lg rounded-br-og-xs border border-og-border bg-og-surface-2 px-4 py-2.5 text-og-md leading-6 text-og-fg";
275
437
  const WAITING_PILL_CLASS =
276
438
  "border-og-status-waiting/35 bg-og-status-waiting/10 text-og-status-waiting";
277
439
  const LOADING_CHIP_CLASS =
278
440
  "pointer-events-none inline-flex items-center rounded-full border border-og-border bg-og-surface-3/90 px-3 py-1 text-og-control font-medium shadow-og-md backdrop-blur";
441
+ /** How long live progress notes take to fold into (or out of) their work row. */
442
+ const LIVE_NOTE_FOLD_MS = 220;
443
+ /** The timeline list's `gap-5`; a folded note gives it back with `-mt-5`. */
444
+ const LIVE_NOTE_GAP_PX = 20;
445
+ /** Longest a bottom-space loan waits for an opening work list to grow into it. */
446
+ const LIVE_NOTE_RESERVE_MS = 700;
447
+ /** Lets a live work disclosure report whether it is open (see `reportLiveFold`). */
448
+ const LiveNoteFoldContext = createContext<((workId: string, open: boolean) => void) | null>(null);
279
449
 
280
450
  // State: 0 underfill retry, 1 prefetch pending, 2 compatibility-settled,
281
451
  // 3 explicit no-progress waiting to become an underfill retry.
@@ -384,6 +554,49 @@ function isNearBottom(node: HTMLElement): boolean {
384
554
  return gap < Math.min(PIN_THRESHOLD_PX, maxScroll);
385
555
  }
386
556
 
557
+ /** Content-space top of a timeline group, or null when it is not mounted. */
558
+ function contentTopOf(node: HTMLElement, groupKey: string): number | null {
559
+ const element = node.querySelector(`[data-og-group-key="${cssEscapeAttribute(groupKey)}"]`);
560
+ if (!(element instanceof HTMLElement)) {
561
+ return null;
562
+ }
563
+ return element.getBoundingClientRect().top - node.getBoundingClientRect().top + node.scrollTop;
564
+ }
565
+
566
+ /** The question the reader is inside of, once its start has scrolled out of view. */
567
+ /**
568
+ * `belowHeader`: an expanded work header is pinned to the top of the scrollport,
569
+ * so the up arrow sits just below that strip instead of covering it.
570
+ */
571
+ type QuestionNav = { key: string; belowHeader: boolean };
572
+
573
+ function readQuestionNav(node: HTMLElement): QuestionNav | null {
574
+ const view = node.getBoundingClientRect();
575
+ const prompts = [...node.querySelectorAll<HTMLElement>("[data-og-prompt]")].flatMap((prompt) => {
576
+ const key = prompt.dataset.ogGroupKey;
577
+ if (!key) return [];
578
+ const bounds = prompt.getBoundingClientRect();
579
+ return [{ key, top: bounds.top, bottom: bounds.bottom }];
580
+ });
581
+ const key = questionNavTarget(prompts, { top: view.top, height: view.height });
582
+ return key ? { key, belowHeader: workHeaderPinned(node, view) } : null;
583
+ }
584
+
585
+ /** True while an expanded outer work header is stuck to the scrollport's top edge. */
586
+ function workHeaderPinned(node: HTMLElement, view: DOMRect): boolean {
587
+ for (const header of node.querySelectorAll<HTMLElement>(
588
+ '[data-og-work-header="outer"][data-state="open"]',
589
+ )) {
590
+ const box = header.getBoundingClientRect();
591
+ if (Math.abs(box.top - view.top) <= 1 && box.bottom > view.top) return true;
592
+ }
593
+ return false;
594
+ }
595
+
596
+ function sameQuestionNav(a: QuestionNav | null, b: QuestionNav | null): boolean {
597
+ return a === b || (!!a && !!b && a.key === b.key && a.belowHeader === b.belowHeader);
598
+ }
599
+
387
600
  /** Escape a value for use inside a CSS attribute selector. */
388
601
  function cssEscapeAttribute(value: string): string {
389
602
  if (typeof CSS !== "undefined" && typeof CSS.escape === "function") {
@@ -399,14 +612,24 @@ function cssEscapeAttribute(value: string): string {
399
612
  * with a "jump to latest" affordance when the reader scrolls back.
400
613
  */
401
614
  export function MessageTimeline({
615
+ resolveLink,
616
+ renderInteractiveBlock,
617
+ userMessageDisclosureLabels,
618
+ searchTarget,
619
+ focusSequence,
402
620
  events,
403
621
  items,
404
622
  status: _status,
405
623
  renderMessageActions,
624
+ renderMessageSender,
406
625
  renderMessageText,
407
626
  onOpenSession,
627
+ resolveSessionTitle,
408
628
  onMemoryClick,
409
629
  onReconnect,
630
+ renderAuthNeeded,
631
+ renderAllowanceExhausted,
632
+ allowanceExhaustedLabels,
410
633
  shouldRenderAuthNeeded,
411
634
  resolveProviderLogo,
412
635
  toolRegistry = defaultToolRegistry,
@@ -414,9 +637,11 @@ export function MessageTimeline({
414
637
  loadRetainedArtifact,
415
638
  loadVideoArtifactPlayback,
416
639
  computeLabel = null,
640
+ genieLoading,
417
641
  turnSummary,
418
642
  autoFollow = true,
419
643
  onAnnotate,
644
+ questionNavMinViewportHeight = 0,
420
645
  draftAnnotations,
421
646
  onDraftAnnotationSelect,
422
647
  hasOlder = false,
@@ -432,25 +657,145 @@ export function MessageTimeline({
432
657
  emptyState,
433
658
  className,
434
659
  }: MessageTimelineProps) {
660
+ const t = useOpenGeniText();
661
+ const formatError = useErrorMessage();
435
662
  const resolvedItems = useMemo(() => {
436
- const projectedItems = items ?? buildTimeline(events ?? []);
663
+ const projectedItems = items ?? buildTimeline(t, events ?? []);
437
664
  if (!shouldRenderAuthNeeded) {
438
665
  return projectedItems;
439
666
  }
440
667
  return projectedItems.filter(
441
668
  (item) => item.kind !== "auth-needed" || shouldRenderAuthNeeded(item),
442
669
  );
443
- }, [items, events, shouldRenderAuthNeeded]);
670
+ }, [items, events, shouldRenderAuthNeeded, t]);
671
+ const searchItem = searchTarget
672
+ ? resolvedItems.find((item) => isTimelineSearchTarget(item, searchTarget))
673
+ : undefined;
674
+ const searchRevealKey =
675
+ searchItem && searchTarget
676
+ ? JSON.stringify([
677
+ searchItem.id,
678
+ searchTarget.query,
679
+ searchTarget.occurrence ?? 0,
680
+ searchTarget.offset ?? null,
681
+ ])
682
+ : null;
683
+ const searchTargetRef = useRef(searchTarget);
684
+ searchTargetRef.current = searchTarget;
685
+ const renderSearchableMessageText = useMemo(
686
+ () =>
687
+ renderMessageText
688
+ ? (text: string, item: AgentMessageItem | UserMessageItem) =>
689
+ renderMessageText(text, item, {
690
+ searchTarget: searchItem?.id === item.id ? (searchTarget ?? null) : null,
691
+ })
692
+ : (text: string, item: AgentMessageItem | UserMessageItem) => {
693
+ const body = (
694
+ <Markdown
695
+ searchTarget={searchItem?.id === item.id ? searchTarget : null}
696
+ softLineBreaks
697
+ streaming={item.kind === "agent-message" && item.streaming}
698
+ renderInteractiveBlock={
699
+ item.kind === "agent-message" ? renderInteractiveBlock : undefined
700
+ }
701
+ >
702
+ {text}
703
+ </Markdown>
704
+ );
705
+ return item.kind === "user-message" ? (
706
+ <UserMessageBody messageId={item.id} text={text}>
707
+ {body}
708
+ </UserMessageBody>
709
+ ) : (
710
+ body
711
+ );
712
+ },
713
+ [renderInteractiveBlock, renderMessageText, searchItem?.id, searchTarget],
714
+ );
444
715
  // Event-window identity is independent of projected rows (partial messages
445
716
  // can acquire a different first-delta id when older text arrives).
446
717
  const sourceItems = events ?? items;
447
718
  const olderBoundaryKey = sourceItems?.[0]?.id;
719
+ const newerBoundaryKey = `${events?.[0]?.sessionId ?? ""}:${olderBoundaryKey ?? ""}`;
720
+ const newerScopeRef = useRef(newerBoundaryKey);
721
+ newerScopeRef.current = newerBoundaryKey;
722
+ const newerAttemptRef = useRef<{ pending: boolean } | null>(null);
723
+ const newerRetryButtonRef = useRef<HTMLButtonElement | null>(null);
724
+ const [newerRetryPending, setNewerRetryPending] = useState(false);
725
+ const [newerFailure, setNewerFailure] = useState<{ key: string; message: string } | null>(null);
726
+ useEffect(() => {
727
+ newerScopeRef.current = newerBoundaryKey;
728
+ newerAttemptRef.current = null;
729
+ setNewerFailure(null);
730
+ setNewerRetryPending(false);
731
+ return () => {
732
+ newerScopeRef.current = "";
733
+ newerAttemptRef.current = null;
734
+ };
735
+ }, [newerBoundaryKey]);
736
+ const requestNewer = useCallback(
737
+ (explicitRetry = false) => {
738
+ if (
739
+ newerScopeRef.current !== newerBoundaryKey ||
740
+ !onLoadNewer ||
741
+ loadingNewer ||
742
+ (newerAttemptRef.current && (!explicitRetry || newerAttemptRef.current.pending))
743
+ ) {
744
+ return;
745
+ }
746
+ const attempt = { pending: true };
747
+ newerAttemptRef.current = attempt;
748
+ if (explicitRetry) setNewerRetryPending(true);
749
+ const isCurrent = () =>
750
+ newerAttemptRef.current === attempt && newerScopeRef.current === newerBoundaryKey;
751
+ // Both synchronous host errors and rejected promises belong to this
752
+ // boundary. Retain the failed attempt so observers cannot hot-retry it.
753
+ void Promise.resolve()
754
+ .then(() => (isCurrent() ? onLoadNewer() : undefined))
755
+ .then(
756
+ () => {
757
+ if (!isCurrent()) return;
758
+ newerAttemptRef.current = null;
759
+ // The successful page removes the recovery control. Return focus
760
+ // to the reading surface without moving the reader's viewport.
761
+ if (document.activeElement === newerRetryButtonRef.current) {
762
+ scrollRef.current?.focus({ preventScroll: true });
763
+ }
764
+ setNewerFailure(null);
765
+ setNewerRetryPending(false);
766
+ },
767
+ (reason: unknown) => {
768
+ if (!isCurrent()) return;
769
+ attempt.pending = false;
770
+ setNewerRetryPending(false);
771
+ setNewerFailure({
772
+ key: newerBoundaryKey,
773
+ message: formatError(reason),
774
+ });
775
+ },
776
+ );
777
+ },
778
+ [onLoadNewer, loadingNewer, newerBoundaryKey, formatError],
779
+ );
448
780
  const previousSourceIdsRef = useRef(new Set<string>());
449
781
  const previousSourceBoundaryRef = useRef<string | undefined>(undefined);
450
782
  const readingAnchorRef = useRef<TimelineAnchor | null>(null);
783
+ const settlementRef = useRef<TimelineSettlement | null>(null);
784
+ const settlementAnimationRef = useRef<Animation | null>(null);
785
+ const stopSettlement = useCallback(() => {
786
+ settlementAnimationRef.current?.cancel();
787
+ settlementAnimationRef.current = null;
788
+ }, []);
451
789
  const olderPageBudgetRef = useRef(0);
452
790
  const [olderDemand, setOlderDemand] = useState(0);
453
- const allGroups = useMemo(() => groupTimeline(resolvedItems), [resolvedItems]);
791
+ const readableTurns = turnSummary?.rolling === true;
792
+ const projectedGroups = useMemo(
793
+ () => groupTimeline(t, resolvedItems, { readableTurns }),
794
+ [resolvedItems, readableTurns, t],
795
+ );
796
+ // A new timeline revision (including session/turn replacement) owns layout.
797
+ // Never leave an old decorative transform running on its retained rows.
798
+ useLayoutEffect(() => stopSettlement, [projectedGroups, stopSettlement]);
454
799
  const annotationSources = useMemo(() => {
455
800
  const sources = new Map<string, TimelineAnnotationSourceDescriptor>();
456
801
  for (const item of resolvedItems) {
@@ -470,6 +815,11 @@ export function MessageTimeline({
470
815
  const bottomSentinelRef = useRef<HTMLDivElement | null>(null);
471
816
  const previousBulkFirstKeyRef = useRef<string | null | undefined>(undefined);
472
817
  const [pinned, setPinned] = useState(true);
818
+ const { groups: allGroups, release: releaseProgress } = useReadingProgress(
819
+ projectedGroups,
820
+ autoFollow && pinned && !hasNewer,
821
+ scrollRef.current,
822
+ );
473
823
  const [canSkipTipCatchup, setCanSkipTipCatchup] = useState(false);
474
824
  const canSkipTipCatchupRef = useRef(false);
475
825
  const [bulkActive, setBulkActive] = useState(true);
@@ -491,6 +841,17 @@ export function MessageTimeline({
491
841
  );
492
842
  const underfillRetryReadyRef = useRef(false);
493
843
  const resizeFollowRafRef = useRef<number | null>(null);
844
+ const questionNavFrameRef = useRef<number | null>(null);
845
+ const [questionNav, setQuestionNav] = useState<QuestionNav | null>(null);
846
+ const questionNavMinViewportRef = useRef(questionNavMinViewportHeight);
847
+ questionNavMinViewportRef.current = questionNavMinViewportHeight;
848
+ const scheduleQuestionNavRef = useRef<() => void>(() => {});
849
+ // Unpinned is not the same as away from the tip: focusing a control in the
850
+ // conversation (Copy, a connection card) hands the view to the reader while
851
+ // they are still at the bottom. Offer the jump only once there is something
852
+ // below them, or a newer window / catch-up to skip.
853
+ const [awayFromTip, setAwayFromTip] = useState(false);
854
+ const jumpPillShown = autoFollow && ((!pinned && awayFromTip) || hasNewer || canSkipTipCatchup);
494
855
  const firstGroupKey = allGroups[0] ? timelineGroupKey(allGroups[0]) : null;
495
856
  // Content stays invisible until the tip is hard-parked across a short
496
857
  // post-commit settle (two rAFs). That absorbs sync late layout while hidden
@@ -537,7 +898,7 @@ export function MessageTimeline({
537
898
  * jumps (Vimium) settle via scrollend while the camera is idle.
538
899
  */
539
900
  const readerIntentArmRef = useRef(false);
540
- /** Gesture-start geometry; cumulative tiny pointer scrolls share one budget. */
901
+ /** Gesture-start geometry survives commits before the native scroll event. */
541
902
  const readerIntentStartRef = useRef<{ scrollTop: number; maxScroll: number } | null>(null);
542
903
  /**
543
904
  * Count of camera/snap scrollTop writes whose scroll echoes are not yet
@@ -563,6 +924,191 @@ export function MessageTimeline({
563
924
  // deliberate chip remounts (activity→turn wrap, nested key flips) so a fold
564
925
  // that already settled closed — or that the reader closed — never reopens.
565
926
  const foldMemoryRef = useRef<Map<string, FoldRestingState>>(new Map());
927
+ // Live work disclosures that are open. While open, that turn's progress
928
+ // notes read inside the disclosure, so their copies above it fold away.
929
+ const [openLiveFolds, setOpenLiveFolds] = useState<ReadonlySet<string>>(() => new Set());
930
+ const openLiveFoldsRef = useRef<ReadonlySet<string>>(openLiveFolds);
931
+ const liveNoteIdsByWorkRef = useRef<ReadonlyMap<string, readonly string[]>>(new Map());
932
+ const liveFoldMotionRef = useRef<{ frame: number | null; finish: () => void } | null>(null);
933
+ // The bottom-space loan currently on the scroller, by owner.
934
+ const liveFoldReserveRef = useRef<object | null>(null);
935
+ // writeScrollTop is declared further down; the fold reaches it through this.
936
+ const writeScrollTopRef = useRef<(node: HTMLElement, top: number) => void>(() => {});
937
+ const reportLiveFold = useCallback((workId: string, open: boolean) => {
938
+ const current = openLiveFoldsRef.current;
939
+ if (current.has(workId) === open) return;
940
+ const next = new Set(current);
941
+ if (open) next.add(workId);
942
+ else next.delete(workId);
943
+ openLiveFoldsRef.current = next;
944
+ liveFoldMotionRef.current?.finish();
945
+ const scroller = scrollRef.current;
946
+ const rows = (liveNoteIdsByWorkRef.current.get(workId) ?? []).flatMap((id) => {
947
+ const row = scroller?.querySelector<HTMLElement>(
948
+ `[data-og-live-note-id="${cssEscapeAttribute(id)}"]`,
949
+ );
950
+ return row ? [row] : [];
951
+ });
952
+ if (!scroller || rows.length === 0) {
953
+ setOpenLiveFolds(next);
954
+ return;
955
+ }
956
+ const header = scroller.querySelector<HTMLElement>(
957
+ `[data-og-work-id="${cssEscapeAttribute(workId)}"] [data-og-work-header="outer"]`,
958
+ );
959
+ const viewTop = scroller.getBoundingClientRect().top;
960
+ const headerTop = header?.getBoundingClientRect().top;
961
+ if (
962
+ !open &&
963
+ header &&
964
+ headerTop !== undefined &&
965
+ (headerTop < viewTop || headerTop > viewTop + scroller.clientHeight)
966
+ ) {
967
+ // Closed from the row's sticky header after reading down the list: the
968
+ // row is no longer where the reader is. Like any big collapse, land on
969
+ // it in one step — the notes return above and the closed row rests at
970
+ // the bottom edge — rather than animating content the reader can't see.
971
+ setOpenLiveFolds(next);
972
+ requestFrame(() =>
973
+ requestFrame(() => {
974
+ const row = header.closest<HTMLElement>("[data-og-timeline-group-anchor]");
975
+ if (!row?.isConnected) return;
976
+ const box = row.getBoundingClientRect();
977
+ const top = scroller.getBoundingClientRect().top;
978
+ const bottom = top + scroller.clientHeight;
979
+ // + the scroller's pb-6, as at the true end.
980
+ if (box.bottom > bottom || box.top < top)
981
+ writeScrollTopRef.current(scroller, scroller.scrollTop + box.bottom - bottom + 24);
982
+ scheduleQuestionNavRef.current();
983
+ }),
984
+ );
985
+ return;
986
+ }
987
+ // Opening a live row near the bottom drops its one-line preview while its
988
+ // list grows from nothing; closing shrinks the list before the notes have
989
+ // grown back. For that moment the page is shorter than where the reader
990
+ // is, so the browser would clamp the scroll and everything would drop.
991
+ // This runs before that frame paints: keep the reader's position and lend
992
+ // one screen of space at the bottom (the shortfall keeps changing through
993
+ // the commit) until the content has grown back into it.
994
+ const readerTop = lastScrollTopRef.current;
995
+ const reserve = readerTop > 0.5 ? scroller.clientHeight : 0;
996
+ const loan = {};
997
+ if (reserve > 0) {
998
+ liveFoldReserveRef.current = loan;
999
+ scroller.style.paddingBottom = `calc(1.5rem + ${reserve}px)`;
1000
+ if (Math.abs(scroller.scrollTop - readerTop) > 0.5)
1001
+ writeScrollTopRef.current(scroller, readerTop);
1002
+ }
1003
+ const releaseReserve = (deadline: number) => {
1004
+ // Only this motion's loan; a newer toggle may have replaced it.
1005
+ if (reserve === 0 || liveFoldReserveRef.current !== loan) return;
1006
+ const needed = scroller.scrollTop + scroller.clientHeight - (scroller.scrollHeight - reserve);
1007
+ if (needed > 0.5 && performance.now() < deadline && scroller.isConnected) {
1008
+ requestFrame(() => releaseReserve(deadline));
1009
+ return;
1010
+ }
1011
+ liveFoldReserveRef.current = null;
1012
+ scroller.style.removeProperty("padding-bottom");
1013
+ };
1014
+ // The notes fold into (or out of) the work row in one short motion. The
1015
+ // row glides to where it should rest: opening, into the first note's place
1016
+ // (or the top edge, when that note was above view) so its list starts just
1017
+ // beneath; closing, down below its returning notes but never past the
1018
+ // bottom edge. When everything is in view that is exactly what happens on
1019
+ // its own; otherwise the scroll is written in the same frame as the
1020
+ // heights, so it cannot lag. Native scroll anchoring is suspended for the
1021
+ // motion; inline styles pin the current look across the state commit, end
1022
+ // exactly at the classes' resting geometry, and are then removed.
1023
+ const workRow = header?.closest<HTMLElement>("[data-og-timeline-group-anchor]") ?? null;
1024
+ const rowStart = workRow?.getBoundingClientRect().top;
1025
+ const viewBottom = viewTop + scroller.clientHeight;
1026
+ let landing =
1027
+ open && rowStart !== undefined
1028
+ ? Math.max(rows[0]!.getBoundingClientRect().top, viewTop)
1029
+ : null;
1030
+ const heights = rows.map((row) => (open ? row.offsetHeight : 0));
1031
+ const apply = (progress: number) => {
1032
+ const shown = open ? 1 - progress : progress;
1033
+ rows.forEach((note, index) => {
1034
+ // The list gap travels inside the row as padding (margin cancels it),
1035
+ // so a shrinking row never overlaps the one above it mid-motion.
1036
+ note.style.marginTop = `${-LIVE_NOTE_GAP_PX}px`;
1037
+ note.style.paddingTop = `${LIVE_NOTE_GAP_PX * shown}px`;
1038
+ note.style.height = `${(heights[index]! + LIVE_NOTE_GAP_PX) * shown}px`;
1039
+ note.style.opacity = String(shown);
1040
+ });
1041
+ if (workRow && rowStart !== undefined && landing !== null) {
1042
+ const drift =
1043
+ workRow.getBoundingClientRect().top - (rowStart + (landing - rowStart) * progress);
1044
+ if (Math.abs(drift) > 0.5) writeScrollTopRef.current(scroller, scroller.scrollTop + drift);
1045
+ }
1046
+ };
1047
+ for (const row of rows) {
1048
+ row.style.boxSizing = "border-box";
1049
+ row.style.overflow = "hidden";
1050
+ row.style.overflowAnchor = "none";
1051
+ }
1052
+ scroller.style.overflowAnchor = "none";
1053
+ apply(0);
1054
+ const fold: { frame: number | null; finish: () => void } = {
1055
+ frame: null,
1056
+ finish: () => {
1057
+ if (fold.frame != null) cancelFrame(fold.frame);
1058
+ for (const row of rows) {
1059
+ for (const property of [
1060
+ "height",
1061
+ "margin-top",
1062
+ "padding-top",
1063
+ "opacity",
1064
+ "overflow",
1065
+ "overflow-anchor",
1066
+ "box-sizing",
1067
+ ])
1068
+ row.style.removeProperty(property);
1069
+ }
1070
+ scroller.style.removeProperty("overflow-anchor");
1071
+ releaseReserve(performance.now() + LIVE_NOTE_RESERVE_MS);
1072
+ // The row may now be pinned to the top without any scroll: re-place
1073
+ // the up arrow (it sits below a pinned work header).
1074
+ scheduleQuestionNavRef.current();
1075
+ if (liveFoldMotionRef.current === fold) liveFoldMotionRef.current = null;
1076
+ },
1077
+ };
1078
+ liveFoldMotionRef.current = fold;
1079
+ const duration = prefersReducedMotion() ? 0 : LIVE_NOTE_FOLD_MS;
1080
+ let began: number | null = null;
1081
+ const step = (now: number) => {
1082
+ fold.frame = null;
1083
+ if (!rows.every((row) => row.isConnected)) return fold.finish();
1084
+ if (!open && began === null) {
1085
+ // Unfolding: the natural heights are known only once the folded
1086
+ // class is gone; the inline styles still hold them at zero.
1087
+ rows.forEach((note, index) => (heights[index] = note.scrollHeight));
1088
+ if (workRow && rowStart !== undefined) {
1089
+ const returning = heights.reduce((sum, height) => sum + height + LIVE_NOTE_GAP_PX, 0);
1090
+ // The closed row is its header plus one preview line (its list is
1091
+ // still collapsing now, so the row's own height is not final yet).
1092
+ const closedRow = 2 * (header?.getBoundingClientRect().height ?? 0);
1093
+ const lowest = viewBottom - closedRow - 24;
1094
+ landing = Math.min(rowStart + returning, Math.max(lowest, rowStart));
1095
+ }
1096
+ }
1097
+ began ??= now;
1098
+ const linear = duration === 0 ? 1 : Math.min(1, (now - began) / duration);
1099
+ apply(1 - (1 - linear) ** 3);
1100
+ if (linear < 1) fold.frame = requestFrame(step);
1101
+ else fold.finish();
1102
+ };
1103
+ fold.frame = requestFrame(step);
1104
+ setOpenLiveFolds(next);
1105
+ }, []);
1106
+ useEffect(
1107
+ () => () => {
1108
+ liveFoldMotionRef.current?.finish();
1109
+ },
1110
+ [],
1111
+ );
566
1112
  const userMessageDisclosureMemoryRef = useRef<Map<string, boolean>>(new Map());
567
1113
  const seenActivityIdsRef = useRef<Set<string>>(new Set());
568
1114
  const firstItemGroupKeyRef = useRef<string | null>(null);
@@ -587,6 +1133,34 @@ export function MessageTimeline({
587
1133
  previousBulkFirstKeyRef.current !== firstGroupKey;
588
1134
  const bulkRender = allGroups.length > 0 && (bulkActive || firstKeyChangedForBulk);
589
1135
  const groups = useStableTimelineGroupKeys(allGroups, !bulkRender);
1136
+ // Each live progress note → whether its turn's work disclosure is open.
1137
+ const [liveNoteFolds, liveNoteIdsByWork] = useMemo(() => {
1138
+ const folds = new Map<string, boolean>();
1139
+ const byWork = new Map<string, readonly string[]>();
1140
+ for (const { group } of groups) {
1141
+ if (group.kind !== "activity" || !group.work?.liveNoteIds) continue;
1142
+ byWork.set(group.id, group.work.liveNoteIds);
1143
+ for (const id of group.work.liveNoteIds) folds.set(id, openLiveFolds.has(group.id));
1144
+ }
1145
+ return [folds, byWork] as const;
1146
+ }, [groups, openLiveFolds]);
1147
+ useLayoutEffect(() => {
1148
+ liveNoteIdsByWorkRef.current = liveNoteIdsByWork;
1149
+ }, [liveNoteIdsByWork]);
1150
+ const turnsWithOutput = useMemo(
1151
+ () =>
1152
+ new Set(
1153
+ resolvedItems.flatMap((item) =>
1154
+ "turnId" in item &&
1155
+ item.turnId &&
1156
+ (item.kind === "tool-call" ||
1157
+ ((item.kind === "agent-message" || item.kind === "reasoning") && item.text.trim()))
1158
+ ? [item.turnId]
1159
+ : [],
1160
+ ),
1161
+ ),
1162
+ [resolvedItems],
1163
+ );
590
1164
 
591
1165
  const applyCanSkipTipCatchup = useCallback((value: boolean) => {
592
1166
  if (canSkipTipCatchupRef.current !== value) {
@@ -641,6 +1215,9 @@ export function MessageTimeline({
641
1215
  if (before === next) {
642
1216
  return;
643
1217
  }
1218
+ // Unpinned camera/anchor writes invalidate return intent. A pinned
1219
+ // pointer gesture still needs its cumulative leave budget across writes.
1220
+ if (!pinnedRef.current || !readerIntentArmRef.current) readerIntentStartRef.current = null;
644
1221
  programmaticScrollRef.current += 1;
645
1222
  node.scrollTop = next;
646
1223
  if (node.scrollTop === before) {
@@ -650,6 +1227,7 @@ export function MessageTimeline({
650
1227
  programmaticScrollRef.current -= 1;
651
1228
  }
652
1229
  }, []);
1230
+ writeScrollTopRef.current = writeScrollTop;
653
1231
 
654
1232
  const cancelLeaveFallback = useCallback(() => {
655
1233
  if (leaveFallbackRafRef.current != null) {
@@ -695,6 +1273,27 @@ export function MessageTimeline({
695
1273
  }
696
1274
  }, [autoFollow, applyPinned, clearPendingReaderLeave, clearReaderIntent, stopFollow]);
697
1275
 
1276
+ useEffect(() => {
1277
+ if (!readableTurns) return;
1278
+ const node = scrollRef.current;
1279
+ if (!node) return;
1280
+ const onSelection = () => {
1281
+ const selection = node.ownerDocument.getSelection();
1282
+ if (
1283
+ selection &&
1284
+ !selection.isCollapsed &&
1285
+ node.contains(selection.anchorNode) &&
1286
+ node.contains(selection.focusNode)
1287
+ ) {
1288
+ stopSettlement();
1289
+ releasePinFromReader();
1290
+ disclosureKeepsUnpinnedRef.current = true;
1291
+ }
1292
+ };
1293
+ node.ownerDocument.addEventListener("selectionchange", onSelection);
1294
+ return () => node.ownerDocument.removeEventListener("selectionchange", onSelection);
1295
+ }, [readableTurns, releasePinFromReader, stopSettlement]);
1296
+
698
1297
  /**
699
1298
  * Settled away from the tip while the camera is idle — Vimium / unfocused
700
1299
  * PageUp. Folds are recovered by layout tip-follow before this fires at tip.
@@ -736,6 +1335,9 @@ export function MessageTimeline({
736
1335
  }, [cancelLeaveFallback, releasePinAfterScrollSettled]);
737
1336
 
738
1337
  const requestEarlierFromReader = () => {
1338
+ // Upward navigation replaces any earlier downward gesture, even when
1339
+ // already unpinned and the engine never delivered scrollend.
1340
+ clearReaderIntent();
739
1341
  releasePinFromReader();
740
1342
  wantPinRef.current = false;
741
1343
  // A stationary upward gesture is still demand. Successful short/folded
@@ -764,9 +1366,14 @@ export function MessageTimeline({
764
1366
  if (wheelConsumedByNestedScrollable(event)) {
765
1367
  return;
766
1368
  }
1369
+ stopSettlement();
767
1370
  disclosureKeepsUnpinnedRef.current = false;
768
1371
  programmaticScrollRef.current = 0;
769
1372
  if (event.deltaY >= 0) {
1373
+ const node = scrollRef.current;
1374
+ readerIntentStartRef.current = node
1375
+ ? { scrollTop: node.scrollTop, maxScroll: maxScrollOf(node) }
1376
+ : null;
770
1377
  return;
771
1378
  }
772
1379
  requestEarlierFromReader();
@@ -783,6 +1390,7 @@ export function MessageTimeline({
783
1390
  if (event.button && event.pointerType === "mouse") {
784
1391
  return;
785
1392
  }
1393
+ stopSettlement();
786
1394
  // Clicks on chips/buttons/links must not arm — their settle collapse
787
1395
  // also drops scrollTop and would false-unpin. Drag on prose/scroller may.
788
1396
  if (
@@ -792,6 +1400,7 @@ export function MessageTimeline({
792
1400
  return;
793
1401
  }
794
1402
  disclosureKeepsUnpinnedRef.current = false;
1403
+ programmaticScrollRef.current = 0;
795
1404
  const node =
796
1405
  event.currentTarget instanceof HTMLElement ? event.currentTarget : scrollRef.current;
797
1406
  readerIntentArmRef.current = true;
@@ -809,12 +1418,19 @@ export function MessageTimeline({
809
1418
  event.key === "Home" ||
810
1419
  event.key === "End"
811
1420
  ) {
1421
+ stopSettlement();
812
1422
  disclosureKeepsUnpinnedRef.current = false;
1423
+ // Reader navigation supersedes a pending camera/anchor scroll echo,
1424
+ // including downward keys that do not explicitly release the pin.
1425
+ programmaticScrollRef.current = 0;
1426
+ const node = scrollRef.current;
1427
+ readerIntentStartRef.current = node
1428
+ ? { scrollTop: node.scrollTop, maxScroll: maxScrollOf(node) }
1429
+ : null;
813
1430
  }
814
1431
  if (event.key !== "ArrowUp" && event.key !== "PageUp" && event.key !== "Home") {
815
1432
  return;
816
1433
  }
817
- programmaticScrollRef.current = 0;
818
1434
  requestEarlierFromReader();
819
1435
  };
820
1436
 
@@ -898,23 +1514,33 @@ export function MessageTimeline({
898
1514
  () => ({
899
1515
  expandedByMessageId: userMessageDisclosureMemoryRef.current,
900
1516
  beginChange: beginUserMessageDisclosureChange,
1517
+ labels: {
1518
+ showMore: userMessageDisclosureLabels?.showMore,
1519
+ showLess: userMessageDisclosureLabels?.showLess,
1520
+ },
901
1521
  }),
902
- [beginUserMessageDisclosureChange],
1522
+ [
1523
+ beginUserMessageDisclosureChange,
1524
+ userMessageDisclosureLabels?.showMore,
1525
+ userMessageDisclosureLabels?.showLess,
1526
+ ],
903
1527
  );
904
1528
  const timelineGroupEntryContext = useMemo<TimelineGroupEntryContext>(
905
1529
  () => ({
906
1530
  userMessageDisclosureContext,
907
1531
  behavior: {
908
1532
  renderMessageActions,
909
- renderMessageText,
1533
+ renderMessageText: renderSearchableMessageText,
910
1534
  onOpenSession,
911
1535
  onMemoryClick,
912
1536
  onReconnect,
1537
+ renderAuthNeeded,
913
1538
  resolveProviderLogo,
914
1539
  toolRegistry,
915
1540
  loadRetainedScreenshot,
916
1541
  loadRetainedArtifact,
917
1542
  loadVideoArtifactPlayback,
1543
+ genieLoading,
918
1544
  turnSummary,
919
1545
  },
920
1546
  }),
@@ -925,15 +1551,30 @@ export function MessageTimeline({
925
1551
  onMemoryClick,
926
1552
  onOpenSession,
927
1553
  onReconnect,
1554
+ renderAuthNeeded,
928
1555
  renderMessageActions,
929
- renderMessageText,
1556
+ renderSearchableMessageText,
930
1557
  resolveProviderLogo,
931
1558
  toolRegistry,
1559
+ genieLoading,
932
1560
  turnSummary,
933
1561
  userMessageDisclosureContext,
934
1562
  ],
935
1563
  );
936
1564
 
1565
+ const releaseSearchPin = useCallback(() => {
1566
+ applyPinned(false);
1567
+ stopFollow();
1568
+ setRevealed(true);
1569
+ }, [applyPinned, stopFollow]);
1570
+ useTimelineSearchNavigation(
1571
+ scrollRef,
1572
+ searchItem?.id,
1573
+ searchTarget,
1574
+ releaseSearchPin,
1575
+ resolvedItems,
1576
+ );
1577
+
937
1578
  const requestOlderIfUnderfilled = useCallback(
938
1579
  (node: HTMLElement, retry?: OlderLoadAttempt) => {
939
1580
  let currentAttempt = olderLoadAttemptRef.current;
@@ -987,6 +1628,74 @@ export function MessageTimeline({
987
1628
  },
988
1629
  [hasOlder, loadingOlder, olderBoundaryKey, onLoadOlder],
989
1630
  );
1631
+ const scheduleQuestionNav = useCallback(() => {
1632
+ if (!readableTurns || questionNavFrameRef.current != null) {
1633
+ return;
1634
+ }
1635
+ questionNavFrameRef.current = requestFrame(() => {
1636
+ questionNavFrameRef.current = null;
1637
+ const node = scrollRef.current;
1638
+ // A short viewport (a narrow embed above a decision card) has no room
1639
+ // for a floating pill that would cover the very rows being read.
1640
+ // clientHeight <= 1 is pre-layout/headless, not a short viewport.
1641
+ const roomy =
1642
+ node !== null &&
1643
+ (node.clientHeight <= 1 || node.clientHeight >= questionNavMinViewportRef.current);
1644
+ const next = node && roomy ? readQuestionNav(node) : null;
1645
+ setQuestionNav((current) => (sameQuestionNav(current, next) ? current : next));
1646
+ });
1647
+ }, [readableTurns]);
1648
+ scheduleQuestionNavRef.current = scheduleQuestionNav;
1649
+ useEffect(
1650
+ () => () => {
1651
+ if (questionNavFrameRef.current != null) {
1652
+ cancelFrame(questionNavFrameRef.current);
1653
+ questionNavFrameRef.current = null;
1654
+ }
1655
+ },
1656
+ [],
1657
+ );
1658
+ const jumpToQuestion = (key: string) => {
1659
+ const node = scrollRef.current;
1660
+ const top = node ? contentTopOf(node, key) : null;
1661
+ if (!node || top === null) {
1662
+ return;
1663
+ }
1664
+ // Explicit reader navigation: leave the tip and park the question on top.
1665
+ releasePinFromReader();
1666
+ wantPinRef.current = false;
1667
+ disclosureKeepsUnpinnedRef.current = false;
1668
+ writeScrollTop(node, Math.max(0, top - QUESTION_NAV_MARGIN_PX));
1669
+ // Hand keyboard/accessibility focus to the actual destination. This also
1670
+ // gives native scroll anchoring the new question rather than an old work
1671
+ // row when the bounded context subsequently gains a later history page.
1672
+ node
1673
+ .querySelector<HTMLElement>(`[data-og-group-key="${cssEscapeAttribute(key)}"]`)
1674
+ ?.focus({ preventScroll: true });
1675
+ syncScrollBaseline(node);
1676
+ scheduleQuestionNav();
1677
+ };
1678
+
1679
+ // Land once on the moment an inbox item or a notification points at.
1680
+ // Deliberately dependency-free: it retries after every commit until the
1681
+ // target row is laid out, and the ref guard makes the state update run once
1682
+ // per focus sequence, so it cannot chain renders.
1683
+ const focusedSequenceRef = useRef<number | null>(null);
1684
+ // oxlint-disable-next-line react-hooks/exhaustive-deps -- retries each commit; ref-guarded to run once
1685
+ useLayoutEffect(() => {
1686
+ if (!focusSequence || focusedSequenceRef.current === focusSequence) return;
1687
+ const index = timelineGroupIndexAtSequence(
1688
+ groups.map((entry) => entry.group),
1689
+ focusSequence,
1690
+ );
1691
+ const key = index >= 0 ? groups[index]?.key : undefined;
1692
+ const node = scrollRef.current;
1693
+ if (!key || !node || contentTopOf(node, key) === null) return;
1694
+ focusedSequenceRef.current = focusSequence;
1695
+ setRevealed(true);
1696
+ jumpToQuestion(key);
1697
+ });
1698
+
990
1699
  const driveFollowRef = useRef<(node: HTMLElement, now?: number) => void>(
991
1700
  requestOlderIfUnderfilled as (node: HTMLElement, now?: number) => void,
992
1701
  );
@@ -1147,6 +1856,8 @@ export function MessageTimeline({
1147
1856
  previousSourceIdsRef.current = new Set(sourceItems?.map((item) => item.id));
1148
1857
  const readingAnchor = readingAnchorRef.current;
1149
1858
  readingAnchorRef.current = null;
1859
+ const settlement = settlementRef.current;
1860
+ settlementRef.current = null;
1150
1861
  const attempt = olderLoadAttemptRef.current;
1151
1862
  const committedZeroOverlapOlderReplacement = !!(
1152
1863
  attempt?.[2]?.committed &&
@@ -1259,6 +1970,22 @@ export function MessageTimeline({
1259
1970
  applyPinned(false);
1260
1971
  }
1261
1972
  }
1973
+ } else if (!pinnedRef.current && readingAnchor && readableTurns) {
1974
+ // A live work row moves behind newly streamed prose. Correct only the
1975
+ // residual movement native anchoring did not absorb, using the reader's
1976
+ // retained paragraph/control rather than the moving row's outer box.
1977
+ const correction = timelineAnchorCorrection(node, readingAnchor);
1978
+ if (correction !== null && Math.abs(correction) > 1) {
1979
+ writeScrollTop(node, node.scrollTop + correction);
1980
+ }
1981
+ const focused = readingAnchor.find((anchor) => anchor.focused)?.element;
1982
+ if (
1983
+ focused &&
1984
+ node.contains(focused) &&
1985
+ node.ownerDocument.activeElement === node.ownerDocument.body
1986
+ ) {
1987
+ focused.focus({ preventScroll: true });
1988
+ }
1262
1989
  } else if (autoFollow && pinnedRef.current && !hasNewer) {
1263
1990
  // Load/remount (still hidden): hard-park. Live tip after reveal: ease.
1264
1991
  // Pending unarmed leave: tip *growth* must not yank (Vimium during stream).
@@ -1280,6 +2007,7 @@ export function MessageTimeline({
1280
2007
  if (prepended && !pinnedRef.current && node.scrollTop > OLDER_PREFETCH_MARGIN_PX) {
1281
2008
  rearmOlderPrefetchAfterLeavingTop(node);
1282
2009
  }
2010
+ scheduleQuestionNav();
1283
2011
  previousFirstItemIdRef.current = firstItemId;
1284
2012
  previousScrollHeightRef.current = node.scrollHeight;
1285
2013
  syncScrollBaseline(node);
@@ -1310,6 +2038,8 @@ export function MessageTimeline({
1310
2038
  : null;
1311
2039
  }
1312
2040
 
2041
+ if (settlement) settlementAnimationRef.current = animateTimelineSettlement(settlement);
2042
+
1313
2043
  // Promise settlement is not itself permission to retry. A receipt-marked
1314
2044
  // accepted page retires its exact owner on this commit even when projection
1315
2045
  // is empty or merges into the same first item. Without that mark, retain
@@ -1544,14 +2274,14 @@ export function MessageTimeline({
1544
2274
  // An underfilled history window has both sentinels visible. Advancing
1545
2275
  // it automatically would undo an explicit older-page navigation.
1546
2276
  if (maxScrollOf(root) > 1 && entries.some((entry) => entry.isIntersecting)) {
1547
- onLoadNewer();
2277
+ requestNewer();
1548
2278
  }
1549
2279
  },
1550
2280
  { root, rootMargin: "0px 0px 1200px 0px" },
1551
2281
  );
1552
2282
  observer.observe(target);
1553
2283
  return () => observer.disconnect();
1554
- }, [hasNewer, loadingNewer, onLoadNewer, firstGroupKey]);
2284
+ }, [hasNewer, loadingNewer, onLoadNewer, requestNewer, firstGroupKey]);
1555
2285
 
1556
2286
  // Late layout that React commits cannot see (images decoding, fonts, code
1557
2287
  // blocks) grows content without a commit. While pinned, soft-follow the tip;
@@ -1573,6 +2303,9 @@ export function MessageTimeline({
1573
2303
  if (!current) {
1574
2304
  return;
1575
2305
  }
2306
+ // A viewport that shrank below the pill's minimum hides it now, not
2307
+ // on the next scroll.
2308
+ if (questionNavMinViewportRef.current > 0) scheduleQuestionNavRef.current();
1576
2309
  requestOlderIfUnderfilled(current);
1577
2310
  if (!autoFollow || !pinnedRef.current || hasNewerRef.current) {
1578
2311
  return;
@@ -1604,6 +2337,8 @@ export function MessageTimeline({
1604
2337
  // at what just became the live bottom — paging forward to the tip must not
1605
2338
  // strand them unpinned watching new content grow below.
1606
2339
  useEffect(() => {
2340
+ // Closing find is paint-only; it must not trigger this history-to-tip rule.
2341
+ if (searchTargetRef.current) return;
1607
2342
  if (hasNewer) {
1608
2343
  stopFollow();
1609
2344
  applyPinned(false);
@@ -1626,6 +2361,15 @@ export function MessageTimeline({
1626
2361
  }
1627
2362
  }, [hasNewer, autoFollow, applyPinned, snapToBottom, stopFollow]);
1628
2363
 
2364
+ // After the scroll authority above has settled each commit, record whether
2365
+ // the reader is away from the tip (content can land below an unpinned
2366
+ // reader without any scroll event).
2367
+ // oxlint-disable-next-line react-hooks/exhaustive-deps -- Deliberately runs after every commit.
2368
+ useLayoutEffect(() => {
2369
+ const node = scrollRef.current;
2370
+ if (node && !pinnedRef.current) setAwayFromTip(!isNearBottom(node));
2371
+ });
2372
+
1629
2373
  // Pinned: layout/camera recover tip debt; wheel/keys/pointer-arm unpin
1630
2374
  // immediately; extension jumps settle via scrollend (or one-rAF fallback).
1631
2375
  // Do not tip-follow-yank an in-flight unarmed scroll-away — that ate Vimium.
@@ -1634,6 +2378,9 @@ export function MessageTimeline({
1634
2378
  if (!node) {
1635
2379
  return;
1636
2380
  }
2381
+ // Only an unpinned reader's distance matters for the jump.
2382
+ if (!pinnedRef.current) setAwayFromTip(!isNearBottom(node));
2383
+ scheduleQuestionNav();
1637
2384
  const previousTop = lastScrollTopRef.current;
1638
2385
  const previousMaxScroll = lastMaxScrollRef.current;
1639
2386
  const nextTop = node.scrollTop;
@@ -1745,17 +2492,40 @@ export function MessageTimeline({
1745
2492
  }
1746
2493
  const nearBottom = isNearBottom(node);
1747
2494
 
1748
- // Re-pin only when the reader moved toward/at the tip without a content
1749
- // insertion. Prepend restore and overflow-anchor raise scrollTop by
1750
- // roughly the same amount as maxScroll; treating that as a scroll-down
2495
+ // Re-pin only when the reader moved toward/at the tip. Prepend restore
2496
+ // and overflow-anchor raise scrollTop by roughly the same amount as
2497
+ // maxScroll; treating that as a scroll-down
1751
2498
  // re-pinned a compact-tail history reader (their preserved gap falls
1752
2499
  // inside PIN_THRESHOLD once the window is tall) and snapped them back.
1753
- const inserted = Math.max(0, nextMaxScroll - previousMaxScroll);
1754
- const towardTip = nextTop - previousTop - inserted;
1755
- const nextPinned = !hasNewer && nearBottom && towardTip > 0.5 && inserted <= 1;
2500
+ // A commit may already have adopted this scroll position into the layout
2501
+ // baseline. Explicit wheel/key/pointer intent retains its own start so
2502
+ // returning to the tip still re-pins after that interleaving.
2503
+ // Passive wheel handlers may run after compositor scrolling; retain the
2504
+ // earlier layout baseline when it still contains that reader movement.
2505
+ const returnStart =
2506
+ readerIntentStart && readerIntentStart.scrollTop <= previousTop ? readerIntentStart : null;
2507
+ const inserted = Math.max(0, nextMaxScroll - (returnStart?.maxScroll ?? previousMaxScroll));
2508
+ const towardTip = nextTop - (returnStart?.scrollTop ?? previousTop) - inserted;
2509
+ // Explicit intent may reach the exact live bottom despite intervening
2510
+ // streaming growth. Keep subtracting that growth: native anchoring alone
2511
+ // conserves the gap and must never qualify as reader movement.
2512
+ const explicitReturnToBottom = returnStart !== null && nextMaxScroll - nextTop <= 1;
2513
+ const nextPinned =
2514
+ !hasNewer && nearBottom && towardTip > 0.5 && (inserted <= 1 || explicitReturnToBottom);
1756
2515
  if (!nextPinned) {
1757
2516
  stopFollow();
1758
2517
  }
2518
+ const focused = node.ownerDocument.activeElement;
2519
+ if (
2520
+ nextPinned &&
2521
+ focused instanceof HTMLElement &&
2522
+ focused.hasAttribute("data-og-prompt") &&
2523
+ node.contains(focused)
2524
+ ) {
2525
+ // Question navigation focuses its destination. Returning to the live
2526
+ // tip releases that stale reader ownership before the commit snapshot.
2527
+ node.focus({ preventScroll: true });
2528
+ }
1759
2529
  applyPinned(nextPinned);
1760
2530
  // A far-from-bottom scroll while a Jump-to-latest is pending is the reader
1761
2531
  // changing their mind: drop the latch, or a stale one (host rejected or
@@ -1766,8 +2536,15 @@ export function MessageTimeline({
1766
2536
  wantPinRef.current = false;
1767
2537
  }
1768
2538
  if (nextPinned) {
2539
+ clearReaderIntent();
1769
2540
  return;
1770
2541
  }
2542
+ if (readerIntentStart) {
2543
+ // This scroll already accounted for the gesture's movement. Retain a
2544
+ // fresh start for continuous input across the next commit, not stale
2545
+ // movement that could turn a later native clamp into a return to tip.
2546
+ readerIntentStartRef.current = { scrollTop: nextTop, maxScroll: nextMaxScroll };
2547
+ }
1771
2548
  if (!olderPrefetchArmedRef.current) {
1772
2549
  olderPrefetchArmedRef.current = true;
1773
2550
  setOlderPrefetchArmed(true);
@@ -1783,6 +2560,9 @@ export function MessageTimeline({
1783
2560
  return;
1784
2561
  }
1785
2562
  cancelLeaveFallback();
2563
+ // Engines can emit scrollend between tiny pointer steps. Keep the pinned
2564
+ // gesture's cumulative leave budget until it actually leaves the tip.
2565
+ if (!pinnedRef.current || !readerIntentArmRef.current) clearReaderIntent();
1786
2566
  if (disclosureKeepsUnpinnedRef.current) {
1787
2567
  programmaticScrollRef.current = 0;
1788
2568
  stopFollow();
@@ -1797,332 +2577,492 @@ export function MessageTimeline({
1797
2577
  }
1798
2578
  releasePinAfterScrollSettled(node);
1799
2579
  };
2580
+ // React 18 has no `onScrollEnd` prop: it warns and never calls it, while
2581
+ // `supportsScrollEndEvent()` still makes the camera wait for scrollend. A
2582
+ // native listener (re-bound each commit, so it always sees this render's
2583
+ // handler and scroller) works on every supported React version.
2584
+ useEffect(() => {
2585
+ const node = scrollRef.current;
2586
+ if (!node) return;
2587
+ node.addEventListener("scrollend", onScrollEnd);
2588
+ return () => node.removeEventListener("scrollend", onScrollEnd);
2589
+ });
1800
2590
 
1801
- return (
1802
- <LightboxProvider>
1803
- <FoldMemoryProvider value={foldMemoryRef.current}>
1804
- <SeenActivityIdsProvider value={seenActivityIdsRef.current}>
1805
- <TimelineComputeLabelProvider value={computeLabel ?? null}>
1806
- <EntranceAnimationProvider value={false}>
1807
- <TooltipProvider delayDuration={400}>
1808
- <TimelineAnnotationSourceRootContext.Provider value={scrollRef}>
1809
- <div className={cn("og-root relative flex min-h-0 flex-col", className)}>
1810
- {onAnnotate ? (
1811
- <Suspense fallback={null}>
1812
- <TimelineAnnotationSelection
1813
- rootRef={scrollRef}
1814
- sources={annotationSources}
1815
- onAnnotate={onAnnotate}
1816
- />
1817
- </Suspense>
1818
- ) : null}
1819
- {/* Pinned: anchoring off so the tip-follow camera owns the motion.
2591
+ const timeline = (
2592
+ <AllowancePresentationProvider
2593
+ render={renderAllowanceExhausted}
2594
+ labels={allowanceExhaustedLabels}
2595
+ >
2596
+ <LightboxProvider>
2597
+ <FoldMemoryProvider value={foldMemoryRef.current}>
2598
+ <LiveNoteFoldContext.Provider value={reportLiveFold}>
2599
+ <SeenActivityIdsProvider value={seenActivityIdsRef.current}>
2600
+ <TimelineComputeLabelProvider value={computeLabel ?? null}>
2601
+ <EntranceAnimationProvider value={false}>
2602
+ <TooltipProvider delayDuration={400}>
2603
+ <TimelineAnnotationSourceRootContext.Provider value={scrollRef}>
2604
+ <div
2605
+ className={cn("og-root relative flex min-h-0 flex-col", className)}
2606
+ // Sticky insets start at the scroller's padded content edge
2607
+ // (pt-16). Subtract exactly that padding so an expanded work
2608
+ // header pins flush to the scrollport. Pinning it lower left a
2609
+ // band of scrolling rows visible above the header, which then
2610
+ // looked like it floated over the middle of the timeline.
2611
+ style={{ "--og-work-header-top": "-4rem" } as CSSProperties}
2612
+ >
2613
+ {onAnnotate ? (
2614
+ <Suspense fallback={null}>
2615
+ <TimelineAnnotationSelection
2616
+ rootRef={scrollRef}
2617
+ sources={annotationSources}
2618
+ onAnnotate={onAnnotate}
2619
+ />
2620
+ </Suspense>
2621
+ ) : null}
2622
+ {/* Pinned: anchoring off so the tip-follow camera owns the motion.
1820
2623
  Unpinned: native scroll anchoring holds the reader's place. */}
1821
- <div
1822
- ref={scrollRef}
1823
- data-og-timeline-scroller=""
1824
- data-og-bottom-follow={autoFollow && pinned && !hasNewer ? "true" : "false"}
1825
- tabIndex={-1}
1826
- onScroll={onScroll}
1827
- onScrollEnd={onScrollEnd}
1828
- onWheel={onWheel}
1829
- onTouchStart={(event) => {
1830
- const touch = event.touches.length === 1 ? event.touches[0] : undefined;
1831
- touchPositionRef.current = touch
1832
- ? { x: touch.clientX, y: touch.clientY }
1833
- : null;
1834
- }}
1835
- onTouchMove={(event) => {
1836
- const touch = event.touches[0];
1837
- const previous = touchPositionRef.current;
1838
- if (!touch || !previous || event.touches.length !== 1) {
1839
- touchPositionRef.current = null;
1840
- return;
1841
- }
1842
- const deltaX = previous.x - touch.clientX;
1843
- const deltaY = previous.y - touch.clientY;
1844
- if (Math.max(Math.abs(deltaX), Math.abs(deltaY)) < 4) return;
1845
- touchPositionRef.current = { x: touch.clientX, y: touch.clientY };
1846
- onWheel({
1847
- deltaX,
1848
- deltaY,
1849
- target: event.target,
1850
- currentTarget: event.currentTarget,
1851
- });
1852
- }}
1853
- onTouchEnd={() => {
1854
- touchPositionRef.current = null;
1855
- }}
1856
- onTouchCancel={() => {
1857
- touchPositionRef.current = null;
1858
- }}
1859
- onClickCapture={(event) => {
1860
- const target =
1861
- event.target instanceof Element
1862
- ? event.target.closest("button[aria-expanded]")
1863
- : null;
1864
- if (target) {
1865
- releasePinFromReader();
1866
- disclosureKeepsUnpinnedRef.current = true;
1867
- }
1868
- }}
1869
- onPointerDown={onPointerDown}
1870
- onKeyDown={onKeyDown}
1871
- style={groups.length > 0 && !revealed ? { visibility: "hidden" } : undefined}
1872
- className={cn(
1873
- // tabIndex=-1 is programmatic only — never paint a focus ring on
1874
- // the whole scroller (click + Shift used to flash a blue outline).
1875
- "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pt-16 pb-6 sm:px-6 outline-hidden",
1876
- autoFollow && pinned && !hasNewer
1877
- ? "[overflow-anchor:none]"
1878
- : "[overflow-anchor:auto]",
1879
- )}
1880
- >
1881
- <TimelineBeforeLayout
1882
- capture={() => {
1883
- readingAnchorRef.current =
1884
- !pinnedRef.current && scrollRef.current
1885
- ? captureTimelineAnchor(scrollRef.current)
2624
+ <div
2625
+ ref={scrollRef}
2626
+ data-og-timeline-scroller=""
2627
+ data-og-bottom-follow={
2628
+ autoFollow && pinned && !hasNewer ? "true" : "false"
2629
+ }
2630
+ tabIndex={-1}
2631
+ onScroll={onScroll}
2632
+ onWheel={onWheel}
2633
+ onTouchStart={(event) => {
2634
+ stopSettlement();
2635
+ const touch = event.touches.length === 1 ? event.touches[0] : undefined;
2636
+ touchPositionRef.current = touch
2637
+ ? { x: touch.clientX, y: touch.clientY }
1886
2638
  : null;
1887
- }}
1888
- >
1889
- <div className="relative mx-auto flex w-full max-w-3xl flex-col gap-5">
2639
+ }}
2640
+ onTouchMove={(event) => {
2641
+ const touch = event.touches[0];
2642
+ const previous = touchPositionRef.current;
2643
+ if (!touch || !previous || event.touches.length !== 1) {
2644
+ touchPositionRef.current = null;
2645
+ return;
2646
+ }
2647
+ const deltaX = previous.x - touch.clientX;
2648
+ const deltaY = previous.y - touch.clientY;
2649
+ if (Math.max(Math.abs(deltaX), Math.abs(deltaY)) < 4) return;
2650
+ touchPositionRef.current = { x: touch.clientX, y: touch.clientY };
2651
+ onWheel({
2652
+ deltaX,
2653
+ deltaY,
2654
+ target: event.target,
2655
+ currentTarget: event.currentTarget,
2656
+ });
2657
+ }}
2658
+ onTouchEnd={() => {
2659
+ touchPositionRef.current = null;
2660
+ }}
2661
+ onTouchCancel={() => {
2662
+ touchPositionRef.current = null;
2663
+ }}
2664
+ onClickCapture={(event) => {
2665
+ const target =
2666
+ event.target instanceof Element
2667
+ ? event.target.closest("button[aria-expanded]")
2668
+ : null;
2669
+ if (target) {
2670
+ if (target.hasAttribute("data-og-work-header")) {
2671
+ releaseProgress(
2672
+ target
2673
+ .closest("[data-og-group-key]")
2674
+ ?.getAttribute("data-og-group-key") ?? null,
2675
+ );
2676
+ }
2677
+ releasePinFromReader();
2678
+ disclosureKeepsUnpinnedRef.current = true;
2679
+ }
2680
+ }}
2681
+ onFocusCapture={(event) => {
2682
+ if (readableTurns && event.target !== event.currentTarget) {
2683
+ stopSettlement();
2684
+ releasePinFromReader();
2685
+ disclosureKeepsUnpinnedRef.current = true;
2686
+ }
2687
+ }}
2688
+ onPointerDown={onPointerDown}
2689
+ onKeyDown={onKeyDown}
2690
+ style={
2691
+ groups.length > 0 && !revealed ? { visibility: "hidden" } : undefined
2692
+ }
2693
+ className={cn(
2694
+ // tabIndex=-1 is programmatic only — never paint a focus ring on
2695
+ // the whole scroller (click + Shift used to flash a blue outline).
2696
+ "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pt-16 pb-6 sm:px-6 outline-hidden",
2697
+ autoFollow && pinned && !hasNewer
2698
+ ? "[overflow-anchor:none]"
2699
+ : "[overflow-anchor:auto]",
2700
+ )}
2701
+ >
2702
+ <TimelineBeforeLayout
2703
+ capture={() => {
2704
+ if (readableTurns && timelineHasReader(scrollRef.current)) {
2705
+ releasePinFromReader();
2706
+ }
2707
+ readingAnchorRef.current =
2708
+ !pinnedRef.current && scrollRef.current
2709
+ ? captureTimelineAnchor(scrollRef.current)
2710
+ : null;
2711
+ settlementRef.current =
2712
+ readableTurns &&
2713
+ autoFollow &&
2714
+ pinnedRef.current &&
2715
+ revealedRef.current &&
2716
+ !hasNewer &&
2717
+ !pendingReaderLeaveRef.current &&
2718
+ !disclosureKeepsUnpinnedRef.current &&
2719
+ !prefersReducedMotion() &&
2720
+ scrollRef.current
2721
+ ? captureTimelineSettlement(scrollRef.current, groups)
2722
+ : null;
2723
+ }}
2724
+ >
2725
+ <div className="relative mx-auto flex w-full max-w-3xl flex-col gap-5">
2726
+ <AnimatePresence>
2727
+ {loadingOlder ||
2728
+ loadingOldest ||
2729
+ (hasOlder && onJumpToStart && olderPrefetchArmed) ||
2730
+ underfillRetryReady ? (
2731
+ // Reserved top gutter: controls scroll with history and cannot
2732
+ // cover a disclosure. Visibility never changes content height.
2733
+ <motion.div
2734
+ initial={{ opacity: 0, y: -6 }}
2735
+ animate={{ opacity: 1, y: 0 }}
2736
+ exit={{ opacity: 0, y: -6 }}
2737
+ transition={{ duration: 0.15, ease: "easeOut" }}
2738
+ data-og-loading-older=""
2739
+ aria-live="polite"
2740
+ className="pointer-events-none absolute inset-x-0 -top-11 z-10 flex justify-center"
2741
+ >
2742
+ {loadingOlder || loadingOldest ? (
2743
+ <span className={LOADING_CHIP_CLASS}>
2744
+ <span className="og-shimmer-text">
2745
+ {loadingOldest
2746
+ ? t("messageTimeline.jumpingToStart")
2747
+ : t("messageTimeline.loadingEarlierActivity")}
2748
+ </span>
2749
+ </span>
2750
+ ) : null}
2751
+ {hasOlder &&
2752
+ !loadingOlder &&
2753
+ !loadingOldest &&
2754
+ (underfillRetryReady || onJumpToStart) ? (
2755
+ <button
2756
+ type="button"
2757
+ data-og-retry={underfillRetryReady || undefined}
2758
+ data-og-jump-to-start={!underfillRetryReady || undefined}
2759
+ onClick={() => {
2760
+ const node = scrollRef.current;
2761
+ if (underfillRetryReady) {
2762
+ if (node && underfillRetryReadyRef.current) {
2763
+ // AnimatePresence retains this handler during
2764
+ // exit. Current authorization plus the exact
2765
+ // attempt check prevent stale dispatch.
2766
+ requestOlderIfUnderfilled(
2767
+ node,
2768
+ underfillSettledAttempt!,
2769
+ );
2770
+ }
2771
+ return;
2772
+ }
2773
+ applyPinned(false);
2774
+ pendingJumpToStartRef.current = true;
2775
+ const seq = ++jumpToStartSeqRef.current;
2776
+ void Promise.resolve(onJumpToStart!()).then(
2777
+ () => {
2778
+ // The commit that swaps in the oldest window consumes
2779
+ // the flag against the new DOM; this write covers the
2780
+ // already-committed order and the no-window-change
2781
+ // case (jumping within the current window).
2782
+ const scroller = scrollRef.current ?? node;
2783
+ if (scroller) {
2784
+ scroller.scrollTop = 0;
2785
+ }
2786
+ // A host may resolve without ever changing the
2787
+ // window (already on the oldest page). Any swap
2788
+ // commit runs its layout effect before the next
2789
+ // frame, so a flag still armed by then is the
2790
+ // no-change case — clear it, or a LATER prepend
2791
+ // would spuriously jump the reader to the top.
2792
+ requestFrame(() => {
2793
+ if (jumpToStartSeqRef.current === seq) {
2794
+ pendingJumpToStartRef.current = false;
2795
+ }
2796
+ });
2797
+ },
2798
+ () => {
2799
+ if (jumpToStartSeqRef.current === seq) {
2800
+ pendingJumpToStartRef.current = false;
2801
+ }
2802
+ },
2803
+ );
2804
+ }}
2805
+ className="pointer-events-auto rounded-full border border-og-border px-3 py-1.5 text-og-control"
2806
+ >
2807
+ {underfillRetryReady
2808
+ ? underfillSettledAttempt?.[2]?.tailPreserved
2809
+ ? t("messageTimeline.loadEarlierActivity")
2810
+ : t("messageTimeline.retryEarlierActivity")
2811
+ : t("messageTimeline.jumpToStart")}
2812
+ </button>
2813
+ ) : null}
2814
+ </motion.div>
2815
+ ) : null}
2816
+ </AnimatePresence>
2817
+ {!groups.length
2818
+ ? (emptyState ?? (
2819
+ <p className="py-10 text-center text-og-menu text-og-fg-subtle">
2820
+ {t("messageTimeline.noActivityYet")}
2821
+ </p>
2822
+ ))
2823
+ : null}
2824
+ {hasOlder && olderPrefetchArmed ? (
2825
+ // Overlaid, not a layout row: mounting/unmounting the sentinel
2826
+ // must never shift content (that shift was itself a wobble).
2827
+ // End at the scroll origin above the pt-16 gutter so the
2828
+ // observer and scrollTop cooldown share the same 400px band.
2829
+ <div
2830
+ ref={topSentinelRef}
2831
+ data-og-top-sentinel=""
2832
+ data-og-timeline-chrome=""
2833
+ aria-hidden="true"
2834
+ className="pointer-events-none absolute inset-x-0 -top-16 h-px -translate-y-full"
2835
+ />
2836
+ ) : null}
2837
+ {groups.map(({ group, key, entranceEnabled }, index) => {
2838
+ return (
2839
+ <TimelineSearchRevealContext.Provider
2840
+ key={key}
2841
+ value={
2842
+ searchItem &&
2843
+ timelineGroupItemIds(group).includes(searchItem.id)
2844
+ ? searchRevealKey
2845
+ : null
2846
+ }
2847
+ >
2848
+ <TimelineGroupEntry
2849
+ groupKey={key}
2850
+ group={group}
2851
+ nextGroup={groups[index + 1]?.group}
2852
+ startupDismissed={
2853
+ group.kind === "activity" &&
2854
+ group.items.some(
2855
+ (item) => item.turnId && turnsWithOutput.has(item.turnId),
2856
+ )
2857
+ }
2858
+ entranceEnabled={entranceEnabled}
2859
+ liveEntranceEnabled={
2860
+ group.kind === "activity" ? !bulkRender : undefined
2861
+ }
2862
+ noteFolded={
2863
+ group.kind === "item"
2864
+ ? liveNoteFolds.get(group.item.id)
2865
+ : undefined
2866
+ }
2867
+ context={timelineGroupEntryContext}
2868
+ />
2869
+ </TimelineSearchRevealContext.Provider>
2870
+ );
2871
+ })}
2872
+ {groups.length > 0 && trailingState ? (
2873
+ <div data-og-timeline-trailing-state="">{trailingState}</div>
2874
+ ) : null}
2875
+ {hasNewer && newerFailure?.key === newerBoundaryKey ? (
2876
+ <div
2877
+ data-og-newer-error=""
2878
+ className="flex flex-col items-center gap-2 px-4 py-3 text-center text-og-menu text-og-fg-muted"
2879
+ >
2880
+ <p role="status" className="max-w-prose [overflow-wrap:anywhere]">
2881
+ {t("messageTimeline.couldnTLoadLaterActivity", {
2882
+ message: newerFailure.message,
2883
+ })}
2884
+ </p>
2885
+ <button
2886
+ ref={newerRetryButtonRef}
2887
+ type="button"
2888
+ data-og-retry-newer=""
2889
+ className="min-h-11 rounded-og-md border border-og-border px-3 py-2 text-og-fg hover:bg-og-surface-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-og-accent"
2890
+ aria-disabled={loadingNewer || newerRetryPending}
2891
+ aria-busy={newerRetryPending}
2892
+ onClick={() => requestNewer(true)}
2893
+ >
2894
+ {newerRetryPending
2895
+ ? t("messageTimeline.retryingLaterActivity")
2896
+ : t("messageTimeline.retryLaterActivity")}
2897
+ </button>
2898
+ </div>
2899
+ ) : null}
2900
+ {hasNewer ? (
2901
+ <div
2902
+ ref={bottomSentinelRef}
2903
+ data-og-bottom-sentinel=""
2904
+ data-og-timeline-chrome=""
2905
+ aria-hidden="true"
2906
+ className="h-px w-full"
2907
+ />
2908
+ ) : null}
2909
+ </div>
2910
+ </TimelineBeforeLayout>
2911
+ </div>
2912
+ {draftAnnotations && draftAnnotations.length > 0 ? (
2913
+ <Suspense fallback={null}>
2914
+ <TimelineAnnotationMarkers
2915
+ rootRef={scrollRef}
2916
+ annotations={draftAnnotations}
2917
+ onSelect={onDraftAnnotationSelect}
2918
+ />
2919
+ </Suspense>
2920
+ ) : null}
2921
+
2922
+ <div
2923
+ data-og-timeline-nav="top"
2924
+ className={cn(
2925
+ "pointer-events-none absolute inset-x-0 z-10 flex justify-center",
2926
+ questionNav?.belowHeader ? "top-10 pointer-coarse:top-13" : "top-3",
2927
+ )}
2928
+ >
2929
+ <AnimatePresence>
2930
+ {questionNav ? (
2931
+ <motion.button
2932
+ key="question-nav"
2933
+ {...NAV_FADE}
2934
+ type="button"
2935
+ data-og-question-nav=""
2936
+ data-og-jump-to-question=""
2937
+ title={t("messageTimeline.backToYourMessage")}
2938
+ onClick={() => jumpToQuestion(questionNav.key)}
2939
+ className={NAV_BUTTON_CLASS}
2940
+ >
2941
+ <ArrowUpIcon aria-hidden className="size-4" />
2942
+ <span className="sr-only">
2943
+ {t("messageTimeline.backToYourMessage")}
2944
+ </span>
2945
+ </motion.button>
2946
+ ) : null}
2947
+ </AnimatePresence>
2948
+ </div>
2949
+ <div
2950
+ data-og-timeline-nav="bottom"
2951
+ className="pointer-events-none absolute inset-x-0 bottom-3 z-10 flex flex-col items-center gap-2"
2952
+ >
1890
2953
  <AnimatePresence>
1891
- {loadingOlder ||
1892
- loadingOldest ||
1893
- (hasOlder && onJumpToStart && olderPrefetchArmed) ||
1894
- underfillRetryReady ? (
1895
- // Reserved top gutter: controls scroll with history and cannot
1896
- // cover a disclosure. Visibility never changes content height.
2954
+ {loadingNewer ? (
1897
2955
  <motion.div
1898
- initial={{ opacity: 0, y: -6 }}
1899
- animate={{ opacity: 1, y: 0 }}
1900
- exit={{ opacity: 0, y: -6 }}
1901
- transition={{ duration: 0.15, ease: "easeOut" }}
1902
- data-og-loading-older=""
2956
+ key="loading-newer"
2957
+ {...NAV_FADE}
2958
+ data-og-loading-newer=""
1903
2959
  aria-live="polite"
1904
- className="pointer-events-none absolute inset-x-0 -top-11 z-10 flex justify-center"
2960
+ className="flex max-w-full justify-center"
1905
2961
  >
1906
- {loadingOlder || loadingOldest ? (
1907
- <span className={LOADING_CHIP_CLASS}>
1908
- <span className="og-shimmer-text">
1909
- {loadingOldest
1910
- ? "Jumping to start…"
1911
- : "Loading earlier activity…"}
1912
- </span>
2962
+ <span className={LOADING_CHIP_CLASS}>
2963
+ <span className="og-shimmer-text">
2964
+ {t("messageTimeline.loadingLaterActivity")}
1913
2965
  </span>
1914
- ) : null}
1915
- {hasOlder &&
1916
- !loadingOlder &&
1917
- !loadingOldest &&
1918
- (underfillRetryReady || onJumpToStart) ? (
1919
- <button
1920
- type="button"
1921
- data-og-retry={underfillRetryReady || undefined}
1922
- data-og-jump-to-start={!underfillRetryReady || undefined}
1923
- onClick={() => {
1924
- const node = scrollRef.current;
1925
- if (underfillRetryReady) {
1926
- if (node && underfillRetryReadyRef.current) {
1927
- // AnimatePresence retains this handler during
1928
- // exit. Current authorization plus the exact
1929
- // attempt check prevent stale dispatch.
1930
- requestOlderIfUnderfilled(node, underfillSettledAttempt!);
1931
- }
1932
- return;
1933
- }
1934
- applyPinned(false);
1935
- pendingJumpToStartRef.current = true;
1936
- const seq = ++jumpToStartSeqRef.current;
1937
- void Promise.resolve(onJumpToStart!()).then(
2966
+ </span>
2967
+ </motion.div>
2968
+ ) : null}
2969
+ {jumpPillShown ? (
2970
+ <motion.button
2971
+ key="jump-to-latest"
2972
+ {...NAV_FADE}
2973
+ type="button"
2974
+ data-og-jump-to-latest=""
2975
+ title={t("messageTimeline.jumpToLatest")}
2976
+ onClick={() => {
2977
+ // Returning to the tip explicitly releases reader-owned
2978
+ // prose. Clear only this timeline's selection before the
2979
+ // synchronous ownership check on the next commit.
2980
+ const viewport = scrollRef.current;
2981
+ const selection = viewport?.ownerDocument.getSelection();
2982
+ if (
2983
+ selection &&
2984
+ !selection.isCollapsed &&
2985
+ (viewport?.contains(selection.anchorNode) ||
2986
+ viewport?.contains(selection.focusNode))
2987
+ )
2988
+ selection.removeAllRanges();
2989
+ disclosureKeepsUnpinnedRef.current = false;
2990
+ if (hasNewer) {
2991
+ // Do not pin against the current history page — its bottom
2992
+ // is not the tip. The pin + snap run when the tip window
2993
+ // actually lands (`hasNewer` flips false).
2994
+ wantPinRef.current = true;
2995
+ const node = scrollRef.current;
2996
+ if (onJumpToLatest) {
2997
+ void Promise.resolve(onJumpToLatest()).then(
1938
2998
  () => {
1939
- // The commit that swaps in the oldest window consumes
1940
- // the flag against the new DOM; this write covers the
1941
- // already-committed order and the no-window-change
1942
- // case (jumping within the current window).
1943
- const scroller = scrollRef.current ?? node;
1944
- if (scroller) {
1945
- scroller.scrollTop = 0;
2999
+ // Covers a host that flipped hasNewer before
3000
+ // resolving; otherwise the tip-window commit
3001
+ // consumes the flag.
3002
+ const current = scrollRef.current;
3003
+ if (
3004
+ current &&
3005
+ wantPinRef.current &&
3006
+ !hasNewerRef.current
3007
+ ) {
3008
+ wantPinRef.current = false;
3009
+ applyPinned(true);
3010
+ snapToBottom(current);
1946
3011
  }
1947
- // A host may resolve without ever changing the
1948
- // window (already on the oldest page). Any swap
1949
- // commit runs its layout effect before the next
1950
- // frame, so a flag still armed by then is the
1951
- // no-change case — clear it, or a LATER prepend
1952
- // would spuriously jump the reader to the top.
1953
- requestFrame(() => {
1954
- if (jumpToStartSeqRef.current === seq) {
1955
- pendingJumpToStartRef.current = false;
1956
- }
1957
- });
1958
3012
  },
1959
3013
  () => {
1960
- if (jumpToStartSeqRef.current === seq) {
1961
- pendingJumpToStartRef.current = false;
1962
- }
3014
+ // The tip reload failed (ordinary network error):
3015
+ // an armed latch would fire a surprise snap when
3016
+ // the reader later pages to the tip themselves.
3017
+ wantPinRef.current = false;
1963
3018
  },
1964
3019
  );
1965
- }}
1966
- className="pointer-events-auto rounded-full border border-og-border px-3 py-1.5 text-og-control"
1967
- >
1968
- {underfillRetryReady
1969
- ? underfillSettledAttempt?.[2]?.tailPreserved
1970
- ? "Load earlier activity"
1971
- : "Retry earlier activity"
1972
- : "Jump to start"}
1973
- </button>
1974
- ) : null}
1975
- </motion.div>
3020
+ } else if (node) {
3021
+ // No tip reload available: jump within the in-memory
3022
+ // window so the newer sentinel can page forward; the
3023
+ // latch pins if the tip window eventually lands.
3024
+ snapToBottom(node);
3025
+ }
3026
+ return;
3027
+ }
3028
+ const node = scrollRef.current;
3029
+ if (node) {
3030
+ applyPinned(true);
3031
+ snapToBottom(node);
3032
+ }
3033
+ }}
3034
+ className={NAV_BUTTON_CLASS}
3035
+ >
3036
+ <ArrowDownIcon aria-hidden className="size-4" />
3037
+ <span className="sr-only">{t("messageTimeline.jumpToLatest")}</span>
3038
+ </motion.button>
1976
3039
  ) : null}
1977
3040
  </AnimatePresence>
1978
- {!groups.length
1979
- ? (emptyState ?? (
1980
- <p className="py-10 text-center text-og-menu text-og-fg-subtle">
1981
- No activity yet.
1982
- </p>
1983
- ))
1984
- : null}
1985
- {hasOlder && olderPrefetchArmed ? (
1986
- // Overlaid, not a layout row: mounting/unmounting the sentinel
1987
- // must never shift content (that shift was itself a wobble).
1988
- // End at the scroll origin above the pt-16 gutter so the
1989
- // observer and scrollTop cooldown share the same 400px band.
1990
- <div
1991
- ref={topSentinelRef}
1992
- data-og-top-sentinel=""
1993
- data-og-timeline-chrome=""
1994
- aria-hidden="true"
1995
- className="pointer-events-none absolute inset-x-0 -top-16 h-px -translate-y-full"
1996
- />
1997
- ) : null}
1998
- {groups.map(({ group, key, entranceEnabled }, index) => {
1999
- return (
2000
- <TimelineGroupEntry
2001
- key={key}
2002
- groupKey={key}
2003
- group={group}
2004
- nextGroup={groups[index + 1]?.group}
2005
- entranceEnabled={entranceEnabled}
2006
- liveEntranceEnabled={
2007
- group.kind === "activity" ? !bulkRender : undefined
2008
- }
2009
- context={timelineGroupEntryContext}
2010
- />
2011
- );
2012
- })}
2013
- {groups.length > 0 && trailingState ? (
2014
- <div data-og-timeline-trailing-state="">{trailingState}</div>
2015
- ) : null}
2016
- {hasNewer ? (
2017
- <div
2018
- ref={bottomSentinelRef}
2019
- data-og-bottom-sentinel=""
2020
- data-og-timeline-chrome=""
2021
- aria-hidden="true"
2022
- className="h-px w-full"
2023
- />
2024
- ) : null}
2025
3041
  </div>
2026
- </TimelineBeforeLayout>
2027
- </div>
2028
- {draftAnnotations && draftAnnotations.length > 0 ? (
2029
- <Suspense fallback={null}>
2030
- <TimelineAnnotationMarkers
2031
- rootRef={scrollRef}
2032
- annotations={draftAnnotations}
2033
- onSelect={onDraftAnnotationSelect}
2034
- />
2035
- </Suspense>
2036
- ) : null}
2037
-
2038
- <AnimatePresence>
2039
- {loadingNewer ? (
2040
- <motion.div
2041
- initial={{ opacity: 0, y: 6 }}
2042
- animate={{ opacity: 1, y: 0 }}
2043
- exit={{ opacity: 0, y: 6 }}
2044
- transition={{ duration: 0.15, ease: "easeOut" }}
2045
- data-og-loading-newer=""
2046
- aria-live="polite"
2047
- className="pointer-events-none absolute inset-x-0 bottom-14 z-10 flex justify-center"
2048
- >
2049
- <span className={LOADING_CHIP_CLASS}>
2050
- <span className="og-shimmer-text">Loading later activity…</span>
2051
- </span>
2052
- </motion.div>
2053
- ) : null}
2054
- </AnimatePresence>
2055
- <AnimatePresence>
2056
- {((!pinned && autoFollow) || hasNewer || canSkipTipCatchup) && autoFollow ? (
2057
- <motion.button
2058
- type="button"
2059
- data-og-jump-to-latest=""
2060
- initial={{ opacity: 0, y: 8 }}
2061
- animate={{ opacity: 1, y: 0 }}
2062
- exit={{ opacity: 0, y: 8 }}
2063
- transition={{ duration: 0.15, ease: "easeOut" }}
2064
- onClick={() => {
2065
- disclosureKeepsUnpinnedRef.current = false;
2066
- if (hasNewer) {
2067
- // Do not pin against the current history page — its bottom
2068
- // is not the tip. The pin + snap run when the tip window
2069
- // actually lands (`hasNewer` flips false).
2070
- wantPinRef.current = true;
2071
- const node = scrollRef.current;
2072
- if (onJumpToLatest) {
2073
- void Promise.resolve(onJumpToLatest()).then(
2074
- () => {
2075
- // Covers a host that flipped hasNewer before
2076
- // resolving; otherwise the tip-window commit
2077
- // consumes the flag.
2078
- const current = scrollRef.current;
2079
- if (current && wantPinRef.current && !hasNewerRef.current) {
2080
- wantPinRef.current = false;
2081
- applyPinned(true);
2082
- snapToBottom(current);
2083
- }
2084
- },
2085
- () => {
2086
- // The tip reload failed (ordinary network error):
2087
- // an armed latch would fire a surprise snap when
2088
- // the reader later pages to the tip themselves.
2089
- wantPinRef.current = false;
2090
- },
2091
- );
2092
- } else if (node) {
2093
- // No tip reload available: jump within the in-memory
2094
- // window so the newer sentinel can page forward; the
2095
- // latch pins if the tip window eventually lands.
2096
- snapToBottom(node);
2097
- }
2098
- return;
2099
- }
2100
- const node = scrollRef.current;
2101
- if (node) {
2102
- applyPinned(true);
2103
- snapToBottom(node);
2104
- }
2105
- }}
2106
- className={cn(
2107
- "absolute inset-x-0 bottom-4 mx-auto w-fit",
2108
- "inline-flex items-center gap-1.5 rounded-full border border-og-border bg-og-surface-3/90 px-3 py-1.5",
2109
- "text-og-control font-medium text-og-fg shadow-og-md backdrop-blur",
2110
- "hover:border-og-border-strong",
2111
- )}
2112
- >
2113
- <ArrowDownIcon className="size-3.5" />
2114
- Jump to latest
2115
- </motion.button>
2116
- ) : null}
2117
- </AnimatePresence>
2118
- </div>
2119
- </TimelineAnnotationSourceRootContext.Provider>
2120
- </TooltipProvider>
2121
- </EntranceAnimationProvider>
2122
- </TimelineComputeLabelProvider>
2123
- </SeenActivityIdsProvider>
2124
- </FoldMemoryProvider>
2125
- </LightboxProvider>
3042
+ </div>
3043
+ </TimelineAnnotationSourceRootContext.Provider>
3044
+ </TooltipProvider>
3045
+ </EntranceAnimationProvider>
3046
+ </TimelineComputeLabelProvider>
3047
+ </SeenActivityIdsProvider>
3048
+ </LiveNoteFoldContext.Provider>
3049
+ </FoldMemoryProvider>
3050
+ </LightboxProvider>
3051
+ </AllowancePresentationProvider>
3052
+ );
3053
+ // Agent-authored object links resolve through the host, never the console.
3054
+ return (
3055
+ <OpenGeniLinkProvider resolveLink={resolveLink}>
3056
+ <MessageSenderContext.Provider value={renderMessageSender}>
3057
+ <AgentIdentityProvider
3058
+ items={resolvedItems}
3059
+ resolveSessionTitle={resolveSessionTitle}
3060
+ onOpenSession={onOpenSession}
3061
+ >
3062
+ <ProviderLogoProvider value={resolveProviderLogo}>{timeline}</ProviderLogoProvider>
3063
+ </AgentIdentityProvider>
3064
+ </MessageSenderContext.Provider>
3065
+ </OpenGeniLinkProvider>
2126
3066
  );
2127
3067
  }
2128
3068
 
@@ -2160,7 +3100,11 @@ function useStableTimelineGroupKeys(
2160
3100
  const previousByItemId = new Map<string, KeyedTimelineGroup>();
2161
3101
  for (const previous of previousRef.current) {
2162
3102
  for (const itemId of timelineGroupItemIds(previous.group)) {
2163
- previousByItemId.set(itemId, previous);
3103
+ // A live progress note is both its own row and listed in its work
3104
+ // history. Its own row owns the id, so the note keeps its identity.
3105
+ if (previous.group.kind === "item" || !previousByItemId.has(itemId)) {
3106
+ previousByItemId.set(itemId, previous);
3107
+ }
2164
3108
  }
2165
3109
  }
2166
3110
 
@@ -2173,7 +3117,24 @@ function useStableTimelineGroupKeys(
2173
3117
  // Retain only same-kind matches. Activity → turn wrap must NOT keep the
2174
3118
  // activity chip's React key: that reused a collapsed TurnSummary and
2175
3119
  // skipped the settle beat (insta-collapse / content flash).
2176
- if (previous && previous.group.kind === group.kind && !usedKeys.has(previous.key)) {
3120
+ const startupCompletion =
3121
+ previous?.group.kind === "activity" &&
3122
+ previous.group.items.every(
3123
+ (item) =>
3124
+ item.kind === "startup-phase" || (item.kind === "reasoning" && !item.text.trim()),
3125
+ ) &&
3126
+ group.kind === "turn" &&
3127
+ group.outcome === "complete" &&
3128
+ group.groups.every(
3129
+ (child) =>
3130
+ child.kind === "activity" &&
3131
+ child.items.every((item) => item.kind === "startup-phase"),
3132
+ );
3133
+ if (
3134
+ previous &&
3135
+ (previous.group.kind === group.kind || startupCompletion) &&
3136
+ !usedKeys.has(previous.key)
3137
+ ) {
2177
3138
  retainedGroup = previous;
2178
3139
  break;
2179
3140
  }
@@ -2244,6 +3205,23 @@ function timelineRenderResetKeysChanged(
2244
3205
  * entire conversation. Keep the boundary outside the row component so React
2245
3206
  * can replace an invalid element type (error #130) with a bounded fallback.
2246
3207
  */
3208
+ function TimelineGroupRenderError() {
3209
+ const t = useOpenGeniText();
3210
+ return (
3211
+ <div
3212
+ data-testid="timeline-group-render-error"
3213
+ role="status"
3214
+ className="flex items-start gap-2 rounded-lg border border-og-border bg-og-surface-muted px-3 py-2 text-og-menu text-og-fg-muted"
3215
+ >
3216
+ <TriangleAlertIcon aria-hidden="true" className="mt-0.5 size-4 shrink-0" />
3217
+ <div>
3218
+ <p className="font-medium text-og-fg">{t("messageTimeline.timelineItemUnavailable")}</p>
3219
+ <p>{t("messageTimeline.timelineItemUnavailableDetail")}</p>
3220
+ </div>
3221
+ </div>
3222
+ );
3223
+ }
3224
+
2247
3225
  class TimelineGroupRenderBoundary extends Component<
2248
3226
  TimelineGroupRenderBoundaryProps,
2249
3227
  TimelineGroupRenderBoundaryState
@@ -2269,21 +3247,7 @@ class TimelineGroupRenderBoundary extends Component<
2269
3247
 
2270
3248
  render(): ReactNode {
2271
3249
  if (this.state.failed) {
2272
- return (
2273
- <div
2274
- data-testid="timeline-group-render-error"
2275
- role="status"
2276
- className="flex items-start gap-2 rounded-lg border border-og-border bg-og-surface-muted px-3 py-2 text-og-menu text-og-fg-muted"
2277
- >
2278
- <TriangleAlertIcon aria-hidden="true" className="mt-0.5 size-4 shrink-0" />
2279
- <div>
2280
- <p className="font-medium text-og-fg">Timeline item unavailable</p>
2281
- <p>
2282
- This item could not be displayed. The rest of the conversation is still available.
2283
- </p>
2284
- </div>
2285
- </div>
2286
- );
3250
+ return <TimelineGroupRenderError />;
2287
3251
  }
2288
3252
  return this.props.children;
2289
3253
  }
@@ -2293,8 +3257,14 @@ type TimelineGroupEntryProps = {
2293
3257
  groupKey: string;
2294
3258
  group: TimelineGroup;
2295
3259
  nextGroup?: TimelineGroup | undefined;
3260
+ startupDismissed: boolean;
2296
3261
  entranceEnabled: boolean;
2297
3262
  liveEntranceEnabled?: boolean | undefined;
3263
+ /**
3264
+ * Present for a live progress note: true while its turn's work disclosure is
3265
+ * open (the note then reads inside it), false while it reads here.
3266
+ */
3267
+ noteFolded?: boolean | undefined;
2298
3268
  context: TimelineGroupEntryContext;
2299
3269
  };
2300
3270
 
@@ -2305,15 +3275,19 @@ type TimelineGroupEntryContext = {
2305
3275
 
2306
3276
  type TimelineGroupBehaviorProps = {
2307
3277
  renderMessageActions: MessageTimelineProps["renderMessageActions"];
2308
- renderMessageText: MessageTimelineProps["renderMessageText"];
3278
+ renderMessageText:
3279
+ | ((text: string, item: AgentMessageItem | UserMessageItem) => ReactNode)
3280
+ | undefined;
2309
3281
  onOpenSession: MessageTimelineProps["onOpenSession"];
2310
3282
  onMemoryClick: MessageTimelineProps["onMemoryClick"];
2311
3283
  onReconnect: MessageTimelineProps["onReconnect"];
3284
+ renderAuthNeeded: MessageTimelineProps["renderAuthNeeded"];
2312
3285
  resolveProviderLogo: MessageTimelineProps["resolveProviderLogo"];
2313
3286
  toolRegistry: ToolRegistry;
2314
3287
  loadRetainedScreenshot: MessageTimelineProps["loadRetainedScreenshot"];
2315
3288
  loadRetainedArtifact: MessageTimelineProps["loadRetainedArtifact"];
2316
3289
  loadVideoArtifactPlayback: MessageTimelineProps["loadVideoArtifactPlayback"];
3290
+ genieLoading: MessageTimelineProps["genieLoading"];
2317
3291
  turnSummary: MessageTimelineProps["turnSummary"];
2318
3292
  };
2319
3293
 
@@ -2326,10 +3300,13 @@ const TimelineGroupEntry = memo(function TimelineGroupEntry({
2326
3300
  groupKey,
2327
3301
  group,
2328
3302
  nextGroup,
3303
+ startupDismissed,
2329
3304
  entranceEnabled,
2330
3305
  liveEntranceEnabled,
3306
+ noteFolded,
2331
3307
  context,
2332
3308
  }: TimelineGroupEntryProps) {
3309
+ const reducedMotion = useReducedMotion();
2333
3310
  const { behavior, userMessageDisclosureContext } = context;
2334
3311
  const contextCompactionCount =
2335
3312
  group.kind === "turn"
@@ -2340,24 +3317,75 @@ const TimelineGroupEntry = memo(function TimelineGroupEntry({
2340
3317
  nextGroup.item.phase === "compacted"
2341
3318
  ? 1
2342
3319
  : 0;
3320
+ const content = (
3321
+ <ActivityNoteTextContext.Provider value={behavior.renderMessageText ?? null}>
3322
+ <TimelineGroupView
3323
+ {...behavior}
3324
+ group={group}
3325
+ foldLiveCluster={isAgentProgress(nextGroup)}
3326
+ startupDismissed={startupDismissed}
3327
+ trailingAgentText={trailingAgentTextAfterTurn(group, nextGroup)}
3328
+ contextCompactionCount={contextCompactionCount > 0 ? contextCompactionCount : undefined}
3329
+ />
3330
+ </ActivityNoteTextContext.Provider>
3331
+ );
2343
3332
  return (
2344
- <div data-og-timeline-group-anchor="" data-og-group-key={groupKey}>
2345
- <EntranceAnimationProvider value={entranceEnabled} liveValue={liveEntranceEnabled}>
2346
- <TimelineGroupRenderBoundary resetKeys={[group, behavior]}>
2347
- <UserMessageDisclosureProvider value={userMessageDisclosureContext}>
2348
- <TimelineGroupView
2349
- {...behavior}
2350
- group={group}
2351
- foldLiveCluster={isAgentProgress(nextGroup)}
2352
- trailingAgentText={trailingAgentTextAfterTurn(group, nextGroup)}
2353
- contextCompactionCount={
2354
- contextCompactionCount > 0 ? contextCompactionCount : undefined
2355
- }
2356
- />
2357
- </UserMessageDisclosureProvider>
2358
- </TimelineGroupRenderBoundary>
2359
- </EntranceAnimationProvider>
2360
- </div>
3333
+ <GenieLoadingOptionsContext.Provider value={behavior.genieLoading}>
3334
+ <div
3335
+ data-og-timeline-group-anchor=""
3336
+ data-og-group-key={groupKey}
3337
+ data-og-prompt={
3338
+ group.kind === "item" && group.item.kind === "user-message" ? "" : undefined
3339
+ }
3340
+ tabIndex={group.kind === "item" && group.item.kind === "user-message" ? -1 : undefined}
3341
+ // A live progress note reads inside its open work row instead; folded,
3342
+ // it takes no space and also gives back the list's gap-5 above it.
3343
+ data-og-live-note={noteFolded === undefined ? undefined : noteFolded ? "folded" : "shown"}
3344
+ data-og-live-note-id={
3345
+ noteFolded !== undefined && group.kind === "item" ? group.item.id : undefined
3346
+ }
3347
+ aria-hidden={noteFolded || undefined}
3348
+ inert={noteFolded || undefined}
3349
+ className={
3350
+ noteFolded ? "-mt-5 h-0 overflow-hidden opacity-0 [overflow-anchor:none]" : undefined
3351
+ }
3352
+ >
3353
+ <EntranceAnimationProvider value={entranceEnabled} liveValue={liveEntranceEnabled}>
3354
+ <TimelineGroupRenderBoundary resetKeys={[group, behavior]}>
3355
+ <UserMessageDisclosureProvider value={userMessageDisclosureContext}>
3356
+ {/* Item groups never switch the preparation/content key. Keep their
3357
+ DOM shell without mounting inert presence and motion lifecycles
3358
+ for every historical message in a prepend. */}
3359
+ {group.kind === "item" ? (
3360
+ <div>{content}</div>
3361
+ ) : (
3362
+ <AnimatePresence initial={false}>
3363
+ <motion.div
3364
+ key={
3365
+ !startupDismissed &&
3366
+ group.kind === "activity" &&
3367
+ !group.work &&
3368
+ group.items.every(
3369
+ (item) =>
3370
+ item.kind === "startup-phase" ||
3371
+ (item.kind === "reasoning" && !item.text.trim()),
3372
+ )
3373
+ ? "preparation"
3374
+ : "content"
3375
+ }
3376
+ initial={false}
3377
+ exit={{ opacity: 0, height: 0 }}
3378
+ transition={{ duration: reducedMotion ? 0 : 0.2 }}
3379
+ >
3380
+ {content}
3381
+ </motion.div>
3382
+ </AnimatePresence>
3383
+ )}
3384
+ </UserMessageDisclosureProvider>
3385
+ </TimelineGroupRenderBoundary>
3386
+ </EntranceAnimationProvider>
3387
+ </div>
3388
+ </GenieLoadingOptionsContext.Provider>
2361
3389
  );
2362
3390
  });
2363
3391
 
@@ -2373,6 +3401,7 @@ const TimelineGroupView = memo(function TimelineGroupView({
2373
3401
  onOpenSession,
2374
3402
  onMemoryClick,
2375
3403
  onReconnect,
3404
+ renderAuthNeeded,
2376
3405
  resolveProviderLogo,
2377
3406
  toolRegistry,
2378
3407
  loadRetainedScreenshot,
@@ -2382,6 +3411,7 @@ const TimelineGroupView = memo(function TimelineGroupView({
2382
3411
  insideTurn = false,
2383
3412
  nestClusterChips = false,
2384
3413
  foldLiveCluster = false,
3414
+ startupDismissed = false,
2385
3415
  trailingAgentText,
2386
3416
  contextCompactionCount,
2387
3417
  }: {
@@ -2393,6 +3423,8 @@ const TimelineGroupView = memo(function TimelineGroupView({
2393
3423
  onOpenSession?: ((sessionId: string) => void) | undefined;
2394
3424
  onMemoryClick?: ((memoryId: string) => void) | undefined;
2395
3425
  onReconnect?: ((item: AuthNeededItem) => void | Promise<void>) | undefined;
3426
+ /** Host-owned inline connection setup. Return undefined to use the default recovery card. */
3427
+ renderAuthNeeded?: ((item: AuthNeededItem) => ReactNode | undefined) | undefined;
2396
3428
  resolveProviderLogo?: ((providerDomain: string) => string | null | undefined) | undefined;
2397
3429
  toolRegistry: ToolRegistry;
2398
3430
  loadRetainedScreenshot?: RetainedScreenshotLoader | undefined;
@@ -2403,6 +3435,7 @@ const TimelineGroupView = memo(function TimelineGroupView({
2403
3435
  behind a neutral chip — the one place activity without an outcome still
2404
3436
  folds, bounding the DOM of days-long autonomous turns. */
2405
3437
  foldLiveCluster?: boolean;
3438
+ startupDismissed?: boolean;
2406
3439
  /** Rendering inside an expanded turn group: the outer chip already owns the
2407
3440
  failure surface, so nested chips stay tinted but quiet (no repeated
2408
3441
  failure text, no auto-open) — one loud error, N calm sub-expands. */
@@ -2423,15 +3456,30 @@ const TimelineGroupView = memo(function TimelineGroupView({
2423
3456
  /** Secondary chip facet when this fold sits next to a compaction landmark. */
2424
3457
  contextCompactionCount?: number | undefined;
2425
3458
  }) {
3459
+ const t = useOpenGeniText();
3460
+ const startupDetails = useStartupDetails();
2426
3461
  const enter = useEntranceAnimation();
2427
3462
  const settleChrome = useTurnSettleOpen();
3463
+ const previousSingleActivity = useRef<ActivityItem | undefined>(undefined);
3464
+ useLayoutEffect(() => {
3465
+ const work =
3466
+ group.kind === "activity" ? group.items.filter((item) => item.kind !== "startup-phase") : [];
3467
+ previousSingleActivity.current = work.length === 1 ? work[0] : undefined;
3468
+ }, [group]);
2428
3469
  const foldMemory = useFoldMemory();
3470
+ const reportLiveFold = useContext(LiveNoteFoldContext);
2429
3471
  // Settled (or live-fold) activity clusters get a chip. Inside an expanded
2430
3472
  // turn that is the second layer — quiet nested chips under the outer turn
2431
3473
  // summary when contiguous activity naturally clusters (≥2 only).
3474
+ const containsPresentedImage = timelineGroupContainsPresentedImage(group);
3475
+ const hasRememberedImageFold =
3476
+ group.kind === "activity" && containsPresentedImage && foldMemory?.has(group.id);
3477
+ // Primary images stay visible through live narration and the turn wrap.
3478
+ // Manual collapse still belongs to TurnSummary's existing fold memory.
2432
3479
  const activityShouldFold =
2433
- group.kind === "activity" && !!(group.outcome || (foldLiveCluster && clusterIsSettled(group)));
2434
- const containsGeneratedImage = timelineGroupContainsGeneratedImage(group);
3480
+ group.kind === "activity" &&
3481
+ !containsPresentedImage &&
3482
+ !!(group.outcome || (foldLiveCluster && clusterIsSettled(group)));
2435
3483
  // Latch live→folded so a top-level shell that was already mounted open can
2436
3484
  // start the settle beat without remounting bare rail → wrapper.
2437
3485
  const liveActivitySettle = useLiveSettleFold(activityShouldFold && !insideTurn);
@@ -2440,7 +3488,7 @@ const TimelineGroupView = memo(function TimelineGroupView({
2440
3488
  group.kind === "turn" &&
2441
3489
  (group.outcome === "failed" ||
2442
3490
  timelineGroupContainsAuthNeeded(group) ||
2443
- containsGeneratedImage);
3491
+ containsPresentedImage);
2444
3492
  // activity-* → turn-* remount: carry resting state so settleFold does not
2445
3493
  // re-open a chip the reader already watched collapse.
2446
3494
  if (group.kind === "turn" && foldMemory && !insideTurn) {
@@ -2451,9 +3499,167 @@ const TimelineGroupView = memo(function TimelineGroupView({
2451
3499
  );
2452
3500
  }
2453
3501
  const settleFold =
2454
- group.kind === "turn" ? !!(enter && !insideTurn && !turnDefaultOpen) : liveActivitySettle;
3502
+ !turnSummary?.rolling &&
3503
+ (group.kind === "turn" ? !!(enter && !insideTurn && !turnDefaultOpen) : liveActivitySettle);
2455
3504
  switch (group.kind) {
2456
3505
  case "activity":
3506
+ if (group.work) {
3507
+ const preparing = isPreparingWork(group, { startupDetails, startupDismissed });
3508
+ if (preparing) {
3509
+ // Preparation is primary, never hidden in an activity disclosure.
3510
+ // Keep work.startedAt unchanged for the handoff and settled duration.
3511
+ return (
3512
+ <ActivityRail
3513
+ items={group.items}
3514
+ startupActive
3515
+ bare
3516
+ toolRegistry={toolRegistry}
3517
+ onOpenSession={onOpenSession}
3518
+ onMemoryClick={onMemoryClick}
3519
+ loadRetainedScreenshot={loadRetainedScreenshot}
3520
+ loadRetainedArtifact={loadRetainedArtifact}
3521
+ />
3522
+ );
3523
+ }
3524
+ const workStatus = readableWorkStatus(t, { ...group, work: group.work });
3525
+ const status: TurnSummaryStatus =
3526
+ workStatus.kind === "working"
3527
+ ? {
3528
+ ...workStatus,
3529
+ preview: readableWorkShowsPreview(group) ? (
3530
+ <RollingActivity
3531
+ items={group.items}
3532
+ toolRegistry={toolRegistry}
3533
+ showCount={false}
3534
+ />
3535
+ ) : undefined,
3536
+ }
3537
+ : workStatus.kind === "waiting"
3538
+ ? {
3539
+ kind: "waiting",
3540
+ label: workStatus.label,
3541
+ since: workStatus.since,
3542
+ // One quiet line under the row saying what the wait needs,
3543
+ // kept visible when the work is expanded; never a second
3544
+ // warning banner.
3545
+ guidance: workStatus.detail ? (
3546
+ <span
3547
+ data-og-exchange-wait-detail=""
3548
+ className="block text-og-sm text-og-fg-subtle"
3549
+ >
3550
+ {workStatus.detail}
3551
+ </span>
3552
+ ) : undefined,
3553
+ }
3554
+ : group.work.cycles?.summary
3555
+ ? {
3556
+ ...workStatus,
3557
+ // Folded quiet cycles say what the agent is waiting on.
3558
+ preview: (
3559
+ <p
3560
+ data-og-cycles-summary=""
3561
+ className="truncate text-og-sm text-og-fg-subtle"
3562
+ title={group.work.cycles.summary}
3563
+ >
3564
+ {group.work.cycles.summary}
3565
+ </p>
3566
+ ),
3567
+ }
3568
+ : workStatus;
3569
+ return (
3570
+ // Marks this work row for the live-note fold (list keys can be carried
3571
+ // over from an earlier row, so they are not the work id).
3572
+ <div className="contents" data-og-work-id={group.id}>
3573
+ <TurnSummary
3574
+ key="work"
3575
+ items={group.items}
3576
+ bare={insideTurn || undefined}
3577
+ status={status}
3578
+ // A wait before any visible work has nothing to reveal.
3579
+ expandable={readableWorkHasDetails(
3580
+ { ...group, work: group.work },
3581
+ { startupDetails },
3582
+ )}
3583
+ outcome={group.outcome}
3584
+ failureText={group.failureText}
3585
+ foldKey={group.id}
3586
+ defaultOpen={readableWorkDefaultOpen(group)}
3587
+ facets={turnSummary?.facets}
3588
+ contextCompactionCount={compactedLandmarkCount(group.work.details)}
3589
+ onOpenStateChange={
3590
+ group.work.liveNoteIds?.length && reportLiveFold
3591
+ ? (open) => reportLiveFold(group.id, open)
3592
+ : undefined
3593
+ }
3594
+ >
3595
+ <TurnRailFrame compact>
3596
+ {renderFoldedGroups(
3597
+ group.work.details,
3598
+ {
3599
+ renderMessageActions,
3600
+ renderMessageText,
3601
+ onOpenSession,
3602
+ onMemoryClick,
3603
+ onReconnect,
3604
+ renderAuthNeeded,
3605
+ resolveProviderLogo,
3606
+ toolRegistry,
3607
+ loadRetainedScreenshot,
3608
+ loadRetainedArtifact,
3609
+ loadVideoArtifactPlayback,
3610
+ turnSummary,
3611
+ },
3612
+ true,
3613
+ )}
3614
+ </TurnRailFrame>
3615
+ </TurnSummary>
3616
+ </div>
3617
+ );
3618
+ }
3619
+ // Preparation is one quiet surface, not a fold with eight technical steps.
3620
+ // A later turn of the same exchange keeps its status row instead.
3621
+ if (
3622
+ !startupDetails &&
3623
+ !insideTurn &&
3624
+ !group.outcome &&
3625
+ group.items.every(
3626
+ (item) =>
3627
+ item.kind === "startup-phase" || (item.kind === "reasoning" && !item.text.trim()),
3628
+ )
3629
+ ) {
3630
+ return (
3631
+ <ActivityRail
3632
+ items={group.items}
3633
+ startupActive={!startupDismissed && !foldLiveCluster}
3634
+ bare
3635
+ toolRegistry={toolRegistry}
3636
+ onOpenSession={onOpenSession}
3637
+ onMemoryClick={onMemoryClick}
3638
+ loadRetainedScreenshot={loadRetainedScreenshot}
3639
+ loadRetainedArtifact={loadRetainedArtifact}
3640
+ />
3641
+ );
3642
+ }
3643
+ if (
3644
+ turnSummary?.rolling &&
3645
+ insideTurn &&
3646
+ !startupDetails &&
3647
+ !hasRememberedImageFold &&
3648
+ group.items.filter((item) => item.kind !== "startup-phase").length === 1
3649
+ ) {
3650
+ return (
3651
+ <ActivityRail
3652
+ items={group.items}
3653
+ startupActive={false}
3654
+ bare
3655
+ toolRegistry={toolRegistry}
3656
+ onOpenSession={onOpenSession}
3657
+ onMemoryClick={onMemoryClick}
3658
+ loadRetainedScreenshot={loadRetainedScreenshot}
3659
+ loadRetainedArtifact={loadRetainedArtifact}
3660
+ />
3661
+ );
3662
+ }
2457
3663
  if (insideTurn) {
2458
3664
  // Nested chips whenever the parent has ≥2 clusters. During outer settle
2459
3665
  // chrome they stay force-open so structure is visible and height stays
@@ -2465,11 +3671,22 @@ const TimelineGroupView = memo(function TimelineGroupView({
2465
3671
  // settled closed pre-wrap was showing as a CHIP, so mounting it closed
2466
3672
  // is both the stable height and the honest state — force-opening it
2467
3673
  // was the "already-collapsed cluster auto-expands at the end" reopen.
2468
- const useNestedChip = nestClusterChips && activityShouldFold && !containsGeneratedImage;
3674
+ const visibleActivity = group.items.filter((item) => item.kind !== "startup-phase");
3675
+ const singleThought =
3676
+ !startupDetails &&
3677
+ visibleActivity.length === 1 &&
3678
+ visibleActivity[0]?.kind === "reasoning";
3679
+ // Untouched images stay primary output, but a reader-owned image fold
3680
+ // must keep its shell across a multi-cluster wrap. A bare rail would
3681
+ // bypass the remembered choice; retaining either state also lets the
3682
+ // reader reopen and close the same chip after settlement.
3683
+ const useNestedChip =
3684
+ nestClusterChips && (activityShouldFold || hasRememberedImageFold) && !singleThought;
2469
3685
  if (!useNestedChip) {
2470
3686
  return (
2471
3687
  <ActivityRail
2472
3688
  items={group.items}
3689
+ {...(startupDismissed ? { startupActive: false } : {})}
2473
3690
  onOpenSession={onOpenSession}
2474
3691
  onMemoryClick={onMemoryClick}
2475
3692
  toolRegistry={toolRegistry}
@@ -2507,10 +3724,31 @@ const TimelineGroupView = memo(function TimelineGroupView({
2507
3724
  // flips settleFold (collapse) instead of remounting bare rail → wrapper.
2508
3725
  return (
2509
3726
  <TurnSummary
3727
+ // Apply the primary-output default when a rolling activity first
3728
+ // produces an image; the stable foldKey still preserves user choices.
3729
+ key={containsPresentedImage ? "primary-image" : "activity"}
2510
3730
  items={group.items}
2511
3731
  outcome={group.outcome}
2512
3732
  failureText={group.failureText}
2513
- defaultOpen={!activityShouldFold || group.outcome === "failed" ? true : undefined}
3733
+ defaultOpen={
3734
+ group.outcome === "failed" ||
3735
+ containsPresentedImage ||
3736
+ (!turnSummary?.rolling && !activityShouldFold)
3737
+ ? true
3738
+ : undefined
3739
+ }
3740
+ liveHeader={
3741
+ turnSummary?.rolling &&
3742
+ !containsPresentedImage &&
3743
+ !group.outcome &&
3744
+ !foldLiveCluster ? (
3745
+ <RollingActivity
3746
+ items={group.items}
3747
+ toolRegistry={toolRegistry}
3748
+ previousItem={previousSingleActivity.current}
3749
+ />
3750
+ ) : undefined
3751
+ }
2514
3752
  foldKey={group.id}
2515
3753
  facets={turnSummary?.facets}
2516
3754
  settleFold={settleFold}
@@ -2533,56 +3771,40 @@ const TimelineGroupView = memo(function TimelineGroupView({
2533
3771
  );
2534
3772
  case "turn": {
2535
3773
  const activityItems = flattenActivityItems(group.groups);
2536
- // Second-layer chips only when there are natural multi-cluster seams —
2537
- // otherwise the outer turn chip alone is enough ("N steps" wrapping one
2538
- // more "N steps" was the redundant double fold).
2539
- const nestClusters = foldableActivityClusterCount(group.groups) >= 2;
3774
+ if (
3775
+ !startupDetails &&
3776
+ group.outcome === "complete" &&
3777
+ group.groups.every(
3778
+ (child) =>
3779
+ child.kind === "activity" &&
3780
+ child.items.every(
3781
+ (item) => item.kind === "startup-phase" && item.status === "complete",
3782
+ ),
3783
+ )
3784
+ )
3785
+ return <ActivityRail items={activityItems} startupActive={false} bare />;
2540
3786
  const turnCopyText = collectTurnCopyText(group.groups, trailingAgentText);
2541
- const body = group.groups.map((child) => {
2542
- const key = timelineGroupKey(child);
2543
- return (
2544
- <TimelineGroupRenderBoundary
2545
- key={key}
2546
- resetKeys={[
2547
- child,
2548
- renderMessageActions,
2549
- renderMessageText,
2550
- onOpenSession,
2551
- onMemoryClick,
2552
- onReconnect,
2553
- resolveProviderLogo,
2554
- toolRegistry,
2555
- loadRetainedScreenshot,
2556
- loadRetainedArtifact,
2557
- loadVideoArtifactPlayback,
2558
- turnSummary,
2559
- ]}
2560
- >
2561
- <TimelineGroupView
2562
- group={child}
2563
- renderMessageActions={renderMessageActions}
2564
- renderMessageText={renderMessageText}
2565
- onOpenSession={onOpenSession}
2566
- onMemoryClick={onMemoryClick}
2567
- onReconnect={onReconnect}
2568
- resolveProviderLogo={resolveProviderLogo}
2569
- toolRegistry={toolRegistry}
2570
- loadRetainedScreenshot={loadRetainedScreenshot}
2571
- loadRetainedArtifact={loadRetainedArtifact}
2572
- loadVideoArtifactPlayback={loadVideoArtifactPlayback}
2573
- turnSummary={turnSummary}
2574
- insideTurn
2575
- nestClusterChips={nestClusters}
2576
- />
2577
- </TimelineGroupRenderBoundary>
2578
- );
3787
+ const body = renderFoldedGroups(group.groups, {
3788
+ renderMessageActions,
3789
+ renderMessageText,
3790
+ onOpenSession,
3791
+ onMemoryClick,
3792
+ onReconnect,
3793
+ renderAuthNeeded,
3794
+ resolveProviderLogo,
3795
+ toolRegistry,
3796
+ loadRetainedScreenshot,
3797
+ loadRetainedArtifact,
3798
+ loadVideoArtifactPlayback,
3799
+ turnSummary,
2579
3800
  });
3801
+ const durationMs = durationBetween(group.startedAt, group.endedAt);
2580
3802
  return (
2581
3803
  <TurnSummary
2582
3804
  items={activityItems}
2583
3805
  outcome={group.outcome}
2584
3806
  failureText={insideTurn ? undefined : group.failureText}
2585
- durationMs={durationBetween(group.startedAt, group.endedAt)}
3807
+ durationMs={durationMs}
2586
3808
  defaultOpen={turnDefaultOpen ? true : undefined}
2587
3809
  bare={insideTurn}
2588
3810
  foldKey={group.id}
@@ -2610,6 +3832,7 @@ const TimelineGroupView = memo(function TimelineGroupView({
2610
3832
  renderMessageActions={renderMessageActions}
2611
3833
  renderMessageText={renderMessageText}
2612
3834
  onReconnect={onReconnect}
3835
+ renderAuthNeeded={renderAuthNeeded}
2613
3836
  resolveProviderLogo={resolveProviderLogo}
2614
3837
  onOpenSession={onOpenSession}
2615
3838
  loadVideoArtifactPlayback={loadVideoArtifactPlayback}
@@ -2618,6 +3841,94 @@ const TimelineGroupView = memo(function TimelineGroupView({
2618
3841
  }
2619
3842
  });
2620
3843
 
3844
+ type FoldedGroupBehavior = {
3845
+ renderMessageActions?: ((item: AgentMessageItem | UserMessageItem) => ReactNode) | undefined;
3846
+ renderMessageText?:
3847
+ | ((text: string, item: AgentMessageItem | UserMessageItem) => ReactNode)
3848
+ | undefined;
3849
+ onOpenSession?: ((sessionId: string) => void) | undefined;
3850
+ onMemoryClick?: ((memoryId: string) => void) | undefined;
3851
+ onReconnect?: ((item: AuthNeededItem) => void | Promise<void>) | undefined;
3852
+ renderAuthNeeded?: ((item: AuthNeededItem) => ReactNode | undefined) | undefined;
3853
+ resolveProviderLogo?: ((providerDomain: string) => string | null | undefined) | undefined;
3854
+ toolRegistry: ToolRegistry;
3855
+ loadRetainedScreenshot?: RetainedScreenshotLoader | undefined;
3856
+ loadRetainedArtifact?: RetainedArtifactLoader | undefined;
3857
+ loadVideoArtifactPlayback?: VideoArtifactPlaybackLoader | undefined;
3858
+ turnSummary?: TurnSummaryOptions | undefined;
3859
+ };
3860
+
3861
+ /**
3862
+ * A search hit inside a nested work row opens that row only. The reveal key
3863
+ * is provided per top-level group, so without narrowing every nested row of
3864
+ * a folded quiet-cycle run would open at once.
3865
+ */
3866
+ function NestedSearchReveal({ group, children }: { group: TimelineGroup; children: ReactNode }) {
3867
+ const revealKey = useContext(TimelineSearchRevealContext);
3868
+ const itemId = useMemo(() => {
3869
+ if (!revealKey) return null;
3870
+ try {
3871
+ const [id] = JSON.parse(revealKey) as unknown[];
3872
+ return typeof id === "string" ? id : null;
3873
+ } catch {
3874
+ return null;
3875
+ }
3876
+ }, [revealKey]);
3877
+ const value = itemId && timelineGroupItemIds(group).includes(itemId) ? revealKey : null;
3878
+ return (
3879
+ <TimelineSearchRevealContext.Provider value={value}>
3880
+ {children}
3881
+ </TimelineSearchRevealContext.Provider>
3882
+ );
3883
+ }
3884
+
3885
+ function renderFoldedGroups(
3886
+ groups: readonly TimelineGroup[],
3887
+ behavior: FoldedGroupBehavior,
3888
+ readableWork = false,
3889
+ ) {
3890
+ // Second-layer chips only when there are natural multi-cluster seams:
3891
+ // otherwise the outer turn chip alone is enough ("N steps" wrapping one
3892
+ // more "N steps" was the redundant double fold).
3893
+ const nestClusters = foldableActivityClusterCount(groups) >= 2;
3894
+ return groups.map((child, index) => (
3895
+ <TimelineGroupRenderBoundary
3896
+ key={timelineGroupKey(child)}
3897
+ resetKeys={[
3898
+ child,
3899
+ behavior.renderMessageActions,
3900
+ behavior.renderMessageText,
3901
+ behavior.onOpenSession,
3902
+ behavior.onMemoryClick,
3903
+ behavior.onReconnect,
3904
+ behavior.renderAuthNeeded,
3905
+ behavior.resolveProviderLogo,
3906
+ behavior.toolRegistry,
3907
+ behavior.loadRetainedScreenshot,
3908
+ behavior.loadRetainedArtifact,
3909
+ behavior.loadVideoArtifactPlayback,
3910
+ behavior.turnSummary,
3911
+ ]}
3912
+ >
3913
+ {readableWork ? (
3914
+ <div
3915
+ className={
3916
+ index > 0 && (child.kind !== "activity" || groups[index - 1]?.kind !== "activity")
3917
+ ? "mt-3"
3918
+ : undefined
3919
+ }
3920
+ >
3921
+ <NestedSearchReveal group={child}>
3922
+ <TimelineGroupView {...behavior} group={child} insideTurn startupDismissed />
3923
+ </NestedSearchReveal>
3924
+ </div>
3925
+ ) : (
3926
+ <TimelineGroupView {...behavior} group={child} insideTurn nestClusterChips={nestClusters} />
3927
+ )}
3928
+ </TimelineGroupRenderBoundary>
3929
+ ));
3930
+ }
3931
+
2621
3932
  /**
2622
3933
  * Body under a turn/activity chip. Remount flashes are gated by the timeline
2623
3934
  * seen-activity-id map (not by killing entrance): FoldBody used to force
@@ -2629,9 +3940,16 @@ function FoldBody({ children }: { children: ReactNode }) {
2629
3940
 
2630
3941
  /** Stable left rule for turn/activity bodies — always present so settle wrap
2631
3942
  never inserts or removes the rail chrome. */
2632
- function TurnRailFrame({ children }: { children: ReactNode }) {
3943
+ function TurnRailFrame({ children, compact = false }: { children: ReactNode; compact?: boolean }) {
2633
3944
  return (
2634
- <div className="flex flex-col gap-4 border-l-2 border-og-border pl-3 sm:pl-4">{children}</div>
3945
+ <div
3946
+ className={cn(
3947
+ "flex flex-col border-l-2 border-og-border pl-3 sm:pl-4",
3948
+ compact ? "gap-0.5" : "gap-4",
3949
+ )}
3950
+ >
3951
+ {children}
3952
+ </div>
2635
3953
  );
2636
3954
  }
2637
3955
 
@@ -2678,26 +3996,15 @@ function timelineGroupContainsAuthNeeded(group: TimelineGroup): boolean {
2678
3996
  }
2679
3997
  }
2680
3998
 
2681
- /** Generated images are primary user-visible output, not incidental activity. */
2682
- function timelineGroupContainsGeneratedImage(group: TimelineGroup): boolean {
2683
- switch (group.kind) {
2684
- case "item":
2685
- return false;
2686
- case "activity":
2687
- return group.items.some(
2688
- (item) => item.kind === "tool-call" && item.name === "generate_image",
2689
- );
2690
- case "turn":
2691
- return group.groups.some(timelineGroupContainsGeneratedImage);
2692
- }
2693
- }
2694
-
2695
3999
  function timelineGroupItemIds(group: TimelineGroup): string[] {
2696
4000
  switch (group.kind) {
2697
4001
  case "item":
2698
4002
  return [group.item.id];
2699
4003
  case "activity":
2700
- return group.items.map((item) => item.id);
4004
+ return [
4005
+ ...(group.work?.details ?? []).flatMap(timelineGroupItemIds),
4006
+ ...group.items.map((item) => item.id),
4007
+ ];
2701
4008
  case "turn":
2702
4009
  return group.groups.flatMap(timelineGroupItemIds);
2703
4010
  }
@@ -2715,25 +4022,13 @@ function isAgentProgress(next: TimelineGroup | undefined): boolean {
2715
4022
  return (
2716
4023
  next.kind === "activity" ||
2717
4024
  next.kind === "turn" ||
2718
- (next.kind === "item" && next.item.kind === "agent-message")
4025
+ (next.kind === "item" && next.item.kind === "agent-message" && next.item.text.trim().length > 0)
2719
4026
  );
2720
4027
  }
2721
4028
 
2722
4029
  /** No item still running or streaming — the only state safe to fold live.
2723
4030
  Position alone is a broken proxy: a pending queued message (or any trailing
2724
4031
  item) can sit after the ACTIVE cluster, which must never fold mid-work. */
2725
- function clusterIsSettled(group: Extract<TimelineGroup, { kind: "activity" }>): boolean {
2726
- return group.items.every((item) => {
2727
- if (item.kind === "reasoning") {
2728
- return !item.streaming;
2729
- }
2730
- // Memory writes and fleet observations are discrete, already-settled events.
2731
- if (item.kind === "memory" || item.kind === "fleet-decision") {
2732
- return true;
2733
- }
2734
- return item.status !== "running";
2735
- });
2736
- }
2737
4032
 
2738
4033
  /** Settled activity clusters that could become nested chips under a turn. */
2739
4034
  function foldableActivityClusterCount(groups: readonly TimelineGroup[]): number {
@@ -2746,18 +4041,6 @@ function foldableActivityClusterCount(groups: readonly TimelineGroup[]): number
2746
4041
  return count;
2747
4042
  }
2748
4043
 
2749
- function flattenActivityItems(groups: TimelineGroup[]): ActivityItem[] {
2750
- const items: ActivityItem[] = [];
2751
- for (const group of groups) {
2752
- if (group.kind === "activity") {
2753
- items.push(...group.items);
2754
- } else if (group.kind === "turn") {
2755
- items.push(...flattenActivityItems(group.groups));
2756
- }
2757
- }
2758
- return items;
2759
- }
2760
-
2761
4044
  /** Assistant prose inside a turn fold (mid-turn narration), joined for copy. */
2762
4045
  function collectAgentMessageText(groups: readonly TimelineGroup[]): string {
2763
4046
  const parts: string[] = [];
@@ -2767,6 +4050,18 @@ function collectAgentMessageText(groups: readonly TimelineGroup[]): string {
2767
4050
  if (text.length > 0) {
2768
4051
  parts.push(text);
2769
4052
  }
4053
+ } else if (group.kind === "activity") {
4054
+ // Commentary folded into clusters is still the assistant's own prose.
4055
+ const nested = collectAgentMessageText(group.work?.details ?? []);
4056
+ if (nested.length > 0) {
4057
+ parts.push(nested);
4058
+ }
4059
+ for (const item of group.items) {
4060
+ const text = item.kind === "agent-message" ? item.text.trim() : "";
4061
+ if (text.length > 0) {
4062
+ parts.push(text);
4063
+ }
4064
+ }
2770
4065
  } else if (group.kind === "turn") {
2771
4066
  const nested = collectAgentMessageText(group.groups);
2772
4067
  if (nested.length > 0) {
@@ -2787,6 +4082,9 @@ function collectTurnIdsFromGroups(groups: readonly TimelineGroup[]): Set<string>
2787
4082
  ids.add(turnId);
2788
4083
  }
2789
4084
  } else if (group.kind === "activity") {
4085
+ for (const nested of collectTurnIdsFromGroups(group.work?.details ?? [])) {
4086
+ ids.add(nested);
4087
+ }
2790
4088
  for (const item of group.items) {
2791
4089
  if (item.turnId) {
2792
4090
  ids.add(item.turnId);
@@ -2841,15 +4139,6 @@ function collectTurnCopyText(
2841
4139
  return parts.join("\n\n");
2842
4140
  }
2843
4141
 
2844
- function durationBetween(startedAt: string, endedAt: string): number | undefined {
2845
- const started = Date.parse(startedAt);
2846
- const ended = Date.parse(endedAt);
2847
- if (!Number.isFinite(started) || !Number.isFinite(ended) || ended < started) {
2848
- return undefined;
2849
- }
2850
- return ended - started;
2851
- }
2852
-
2853
4142
  /* --- single rows ------------------------------------------------------------ */
2854
4143
 
2855
4144
  /**
@@ -2862,6 +4151,7 @@ export function TimelineRow({
2862
4151
  renderMessageActions,
2863
4152
  renderMessageText,
2864
4153
  onReconnect,
4154
+ renderAuthNeeded,
2865
4155
  resolveProviderLogo,
2866
4156
  onOpenSession,
2867
4157
  loadVideoArtifactPlayback,
@@ -2872,6 +4162,8 @@ export function TimelineRow({
2872
4162
  | ((text: string, item: AgentMessageItem | UserMessageItem) => ReactNode)
2873
4163
  | undefined;
2874
4164
  onReconnect?: ((item: AuthNeededItem) => void | Promise<void>) | undefined;
4165
+ /** Host-owned inline connection setup. Return undefined to use the default recovery card. */
4166
+ renderAuthNeeded?: ((item: AuthNeededItem) => ReactNode | undefined) | undefined;
2875
4167
  resolveProviderLogo?: ((providerDomain: string) => string | null | undefined) | undefined;
2876
4168
  onOpenSession?: ((sessionId: string) => void) | undefined;
2877
4169
  loadVideoArtifactPlayback?: VideoArtifactPlaybackLoader | undefined;
@@ -2915,95 +4207,144 @@ export function TimelineRow({
2915
4207
  return <CompactionRow item={item} />;
2916
4208
  case "auth-needed":
2917
4209
  return (
2918
- <AuthNeededRow
2919
- item={item}
2920
- onReconnect={onReconnect}
2921
- resolveProviderLogo={resolveProviderLogo}
2922
- />
4210
+ renderAuthNeeded?.(item) ?? (
4211
+ <AuthNeededRow
4212
+ item={item}
4213
+ onReconnect={onReconnect}
4214
+ resolveProviderLogo={resolveProviderLogo}
4215
+ />
4216
+ )
2923
4217
  );
2924
4218
  default:
2925
4219
  return null;
2926
4220
  }
2927
4221
  }
2928
4222
 
2929
- const COMPACTION_TRIGGER_LABEL: Record<NonNullable<ContextCompactionItem["trigger"]>, string> = {
2930
- auto: "Auto",
2931
- operator: "Manual",
2932
- proactive: "Auto",
2933
- overflow: "Overflow",
2934
- };
4223
+ const COMPACTION_TRIGGER_LABEL = (
4224
+ t: OpenGeniText,
4225
+ ): Record<NonNullable<ContextCompactionItem["trigger"]>, string> => ({
4226
+ auto: t("messageTimeline.auto"),
4227
+ operator: t("messageTimeline.manual"),
4228
+ proactive: t("messageTimeline.auto"),
4229
+ overflow: t("messageTimeline.overflow"),
4230
+ });
2935
4231
 
2936
4232
  function CompactionRow({ item }: { item: ContextCompactionItem }) {
4233
+ const t = useOpenGeniText();
2937
4234
  const enter = useEntranceAnimation();
4235
+ const detailsId = useId();
4236
+ const [detailsOpen, setDetailsOpen] = useState(false);
2938
4237
  const trigger =
2939
- item.trigger && item.phase !== "started" ? COMPACTION_TRIGGER_LABEL[item.trigger] : null;
4238
+ item.trigger && item.phase !== "started" ? COMPACTION_TRIGGER_LABEL(t)[item.trigger] : null;
2940
4239
  const before =
2941
4240
  item.estimatedTokensBefore != null
2942
- ? Math.round(item.estimatedTokensBefore).toLocaleString("en-US")
4241
+ ? Math.round(item.estimatedTokensBefore).toLocaleString(t.locale)
2943
4242
  : null;
2944
4243
  const after =
2945
4244
  item.estimatedTokensAfter != null
2946
- ? Math.round(item.estimatedTokensAfter).toLocaleString("en-US")
4245
+ ? Math.round(item.estimatedTokensAfter).toLocaleString(t.locale)
2947
4246
  : null;
2948
4247
  const title =
2949
4248
  item.phase === "started"
2950
- ? "Compacting conversation history…"
4249
+ ? t("messageTimeline.compactingConversationHistory")
2951
4250
  : item.phase === "compacted"
2952
4251
  ? before && after
2953
- ? `Conversation history compacted · ~${before} → ~${after} estimated history tokens`
2954
- : "Conversation history compacted"
2955
- : "Couldn’t compact conversation history";
4252
+ ? t("messageTimeline.conversationHistoryCompactedBeforeAfter", { before, after })
4253
+ : t("messageTimeline.conversationHistoryCompacted")
4254
+ : compactionSkipTitle(t, item.skipReason);
2956
4255
  const subtitle =
2957
4256
  item.phase === "compacted"
2958
- ? "Chat history above is unchanged"
4257
+ ? t("messageTimeline.chatHistoryAboveIsUnchanged")
2959
4258
  : item.phase === "skipped"
2960
- ? compactionSkipSubtitle(item.skipReason)
4259
+ ? compactionSkipSubtitle(t, item.skipReason, item.providerRejection)
2961
4260
  : null;
2962
- const pill =
2963
- item.phase === "skipped" && item.skipReason === "summarization_failed"
2964
- ? "border-og-status-failed/35 bg-og-status-failed/10 text-og-status-failed"
2965
- : item.phase === "started"
2966
- ? WAITING_PILL_CLASS
2967
- : NEUTRAL_PILL;
4261
+ // Provider identifiers are diagnostics: one short line up front, the rest on demand.
4262
+ const details = compactionFailureDetails(t, item);
4263
+ const failed = item.phase === "skipped" && item.skipReason === "summarization_failed";
4264
+ const pill = failed
4265
+ ? "border-og-status-failed/35 bg-og-status-failed/10 text-og-status-failed"
4266
+ : item.phase === "started"
4267
+ ? WAITING_PILL_CLASS
4268
+ : NEUTRAL_PILL;
2968
4269
  return (
2969
- <div className={cn(enter && "animate-og-enter", "flex justify-center")}>
4270
+ <div className={cn(enter && "animate-og-enter", "flex min-w-0 flex-col items-center gap-1.5")}>
2970
4271
  <div
2971
4272
  className={cn(
2972
- "inline-flex max-w-full flex-col items-center gap-0.5 rounded-full border px-3 py-1.5 text-og-sm",
4273
+ "inline-flex min-w-0 max-w-full flex-col items-center gap-0.5 border px-3 py-1.5 text-og-sm",
4274
+ // A failure's recovery step may wrap on narrow screens; a full pill
4275
+ // radius would pinch its second line.
4276
+ failed ? "rounded-og-lg" : "rounded-full",
2973
4277
  pill,
2974
4278
  )}
2975
4279
  role="status"
2976
4280
  >
2977
- <span className="inline-flex max-w-full items-center gap-1.5">
4281
+ <span className="inline-flex min-w-0 max-w-full items-center gap-1.5">
2978
4282
  <ShrinkIcon className="size-3.5 shrink-0" />
2979
- <span className="truncate">
4283
+ <span className="min-w-0 truncate">
2980
4284
  {title}
2981
4285
  {trigger ? ` · ${trigger}` : ""}
2982
4286
  </span>
2983
4287
  </span>
2984
- {subtitle ? <span className="truncate text-og-xs opacity-80">{subtitle}</span> : null}
4288
+ {subtitle || details ? (
4289
+ <span
4290
+ className={cn(
4291
+ "min-w-0 max-w-full text-og-xs",
4292
+ failed ? "text-balance text-center" : "inline-flex items-center gap-1",
4293
+ )}
4294
+ >
4295
+ {subtitle ? (
4296
+ <span className={cn("opacity-80", !failed && "min-w-0 truncate")}>{subtitle}</span>
4297
+ ) : null}
4298
+ {subtitle && details && failed ? " " : null}
4299
+ {details ? (
4300
+ <button
4301
+ type="button"
4302
+ aria-expanded={detailsOpen}
4303
+ aria-controls={detailsId}
4304
+ onClick={() => setDetailsOpen((open) => !open)}
4305
+ className={cn(
4306
+ "inline-flex shrink-0 items-center gap-0.5 whitespace-nowrap rounded-og-sm align-baseline font-medium underline-offset-2",
4307
+ "hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-current/40",
4308
+ "pointer-coarse:-my-2 pointer-coarse:px-1 pointer-coarse:py-2",
4309
+ )}
4310
+ >
4311
+ {t("messageTimeline.details")}
4312
+ <ChevronDownIcon
4313
+ aria-hidden
4314
+ className={cn("size-3 transition-transform", detailsOpen && "rotate-180")}
4315
+ />
4316
+ </button>
4317
+ ) : null}
4318
+ </span>
4319
+ ) : null}
2985
4320
  </div>
4321
+ {details ? (
4322
+ <div
4323
+ id={detailsId}
4324
+ hidden={!detailsOpen}
4325
+ data-og-compaction-details=""
4326
+ className="w-full max-w-md rounded-og-md border border-og-border bg-og-surface-1 px-3 py-2 text-left text-og-xs text-og-fg-muted"
4327
+ >
4328
+ {details.note ? <p className="mb-2">{details.note}</p> : null}
4329
+ <dl className="grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1">
4330
+ {details.facts.map((fact) => (
4331
+ <Fragment key={fact.label}>
4332
+ <dt className="text-og-fg-subtle">{fact.label}</dt>
4333
+ <dd className="max-h-40 min-w-0 overflow-auto whitespace-pre-wrap break-words font-mono">
4334
+ {fact.value}
4335
+ </dd>
4336
+ </Fragment>
4337
+ ))}
4338
+ </dl>
4339
+ </div>
4340
+ ) : null}
2986
4341
  </div>
2987
4342
  );
2988
4343
  }
2989
4344
 
2990
- function compactionSkipSubtitle(reason: string | null): string {
2991
- switch (reason) {
2992
- case "no_history":
2993
- return "No active history to compact";
2994
- case "replacement_not_smaller":
2995
- return "Checkpoint would not reduce memory size";
2996
- case "replacement_unchanged":
2997
- return "Checkpoint made no progress";
2998
- case "summarization_failed":
2999
- return "Request it again to retry. Chat history is unchanged.";
3000
- default:
3001
- return "Compaction was not needed. Chat history is unchanged.";
3002
- }
3003
- }
3004
-
3005
4345
  /** Hover-reveal clock beside the copy control (sent / finished). */
3006
4346
  function MessageFooterTime({ occurredAt }: { occurredAt: string }) {
4347
+ const t = useOpenGeniText();
3007
4348
  return (
3008
4349
  <time
3009
4350
  dateTime={occurredAt}
@@ -3013,7 +4354,7 @@ function MessageFooterTime({ occurredAt }: { occurredAt: string }) {
3013
4354
  "group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 pointer-coarse:opacity-100",
3014
4355
  )}
3015
4356
  >
3016
- {formatClockTime(occurredAt)}
4357
+ {formatClockTime(t, occurredAt)}
3017
4358
  </time>
3018
4359
  );
3019
4360
  }
@@ -3029,11 +4370,13 @@ function UserMessageRow({
3029
4370
  | ((text: string, item: AgentMessageItem | UserMessageItem) => ReactNode)
3030
4371
  | undefined;
3031
4372
  }) {
4373
+ const t = useOpenGeniText();
3032
4374
  const enter = useEntranceAnimation();
3033
4375
  const deliveryFailed = item.delivery?.state === "failed";
3034
4376
  return (
3035
4377
  <div className={cn(enter && "animate-og-enter", "flex justify-end")}>
3036
4378
  <div className="flex max-w-[85%] min-w-0 flex-col items-end gap-1">
4379
+ <MessageSenderSlot item={item} />
3037
4380
  <CopyHoverFrame
3038
4381
  copyText={
3039
4382
  item.text ||
@@ -3041,7 +4384,7 @@ function UserMessageRow({
3041
4384
  .map((annotation) => `${annotation.quote}\n${annotation.note}`)
3042
4385
  .join("\n\n")
3043
4386
  }
3044
- label="Copy message"
4387
+ label={t("messageTimeline.copyMessage")}
3045
4388
  className="w-fit max-w-full min-w-0"
3046
4389
  trailing={
3047
4390
  <>
@@ -3052,12 +4395,15 @@ function UserMessageRow({
3052
4395
  >
3053
4396
  <div className={MESSAGE_BUBBLE_CLASS}>
3054
4397
  {item.text ? (
3055
- <div data-og-annotation-source-key={item.annotationSource?.eventId}>
4398
+ <div
4399
+ data-og-search-item={item.id}
4400
+ data-og-annotation-source-key={item.annotationSource?.eventId}
4401
+ >
3056
4402
  {renderMessageText ? (
3057
4403
  renderMessageText(item.text, item)
3058
4404
  ) : (
3059
4405
  <UserMessageBody messageId={item.id} text={item.text}>
3060
- <Markdown>{item.text}</Markdown>
4406
+ <Markdown softLineBreaks>{item.text}</Markdown>
3061
4407
  </UserMessageBody>
3062
4408
  )}
3063
4409
  </div>
@@ -3073,30 +4419,43 @@ function UserMessageRow({
3073
4419
  {deliveryFailed ? (
3074
4420
  <div
3075
4421
  role="status"
3076
- className="flex max-w-full items-center gap-2 px-1 text-og-xs text-og-status-failed"
4422
+ className="flex max-w-full flex-col items-start gap-1 px-1 text-og-xs text-og-status-failed"
3077
4423
  >
3078
- <span className="inline-flex items-center gap-1" title={item.delivery?.error}>
4424
+ <span className="flex min-w-0 items-start gap-1">
3079
4425
  <TriangleAlertIcon className="size-3.5 shrink-0" aria-hidden="true" />
3080
- <span>Message not sent</span>
4426
+ <span className="min-w-0 break-words">
4427
+ {item.delivery?.error || t("messageTimeline.messageNotSent")}
4428
+ </span>
3081
4429
  </span>
3082
- {item.delivery?.onRetry ? (
3083
- <button
3084
- type="button"
3085
- className="font-medium text-og-status-failed underline decoration-og-status-failed/50 underline-offset-2 hover:text-og-fg"
3086
- onClick={item.delivery.onRetry}
3087
- >
3088
- Retry
3089
- </button>
3090
- ) : null}
3091
- {item.delivery?.onRemove ? (
3092
- <button
3093
- type="button"
3094
- className="font-medium text-og-fg-subtle underline decoration-og-border underline-offset-2 hover:text-og-fg"
3095
- onClick={item.delivery.onRemove}
3096
- >
3097
- Remove
3098
- </button>
3099
- ) : null}
4430
+ <div className="flex flex-wrap items-center gap-2">
4431
+ {item.delivery?.onEdit ? (
4432
+ <button
4433
+ type="button"
4434
+ className="font-medium text-og-status-failed underline decoration-og-status-failed/50 underline-offset-2 hover:text-og-fg"
4435
+ onClick={item.delivery.onEdit}
4436
+ >
4437
+ {t("messageTimeline.editMessage")}
4438
+ </button>
4439
+ ) : null}
4440
+ {item.delivery?.onRetry ? (
4441
+ <button
4442
+ type="button"
4443
+ className="font-medium text-og-status-failed underline decoration-og-status-failed/50 underline-offset-2 hover:text-og-fg"
4444
+ onClick={item.delivery.onRetry}
4445
+ >
4446
+ {t("messageTimeline.retry")}
4447
+ </button>
4448
+ ) : null}
4449
+ {item.delivery?.onRemove ? (
4450
+ <button
4451
+ type="button"
4452
+ className="font-medium text-og-fg-subtle underline decoration-og-border underline-offset-2 hover:text-og-fg"
4453
+ onClick={item.delivery.onRemove}
4454
+ >
4455
+ {t("messageTimeline.remove")}
4456
+ </button>
4457
+ ) : null}
4458
+ </div>
3100
4459
  </div>
3101
4460
  ) : null}
3102
4461
  </div>
@@ -3105,6 +4464,7 @@ function UserMessageRow({
3105
4464
  }
3106
4465
 
3107
4466
  function HumanInputConversationRow({ item }: { item: HumanInputItem }) {
4467
+ const t = useOpenGeniText();
3108
4468
  const enter = useEntranceAnimation();
3109
4469
  const multipleQuestions = Math.max(item.questions.length, item.answers.length) > 1;
3110
4470
  const questionNumberById = new Map(
@@ -3112,13 +4472,13 @@ function HumanInputConversationRow({ item }: { item: HumanInputItem }) {
3112
4472
  );
3113
4473
  const settledLabel =
3114
4474
  item.response.outcome === "answered"
3115
- ? "You answered"
4475
+ ? t("messageTimeline.youAnswered")
3116
4476
  : item.response.outcome === "skipped"
3117
- ? "Skipped"
4477
+ ? t("messageTimeline.skipped")
3118
4478
  : item.response.outcome === "expired"
3119
- ? "Expired"
3120
- : "Cancelled";
3121
- const copyText = humanInputConversationCopyText(item, settledLabel);
4479
+ ? t("messageTimeline.expired")
4480
+ : t("messageTimeline.cancelled");
4481
+ const copyText = humanInputConversationCopyText(t, item, settledLabel);
3122
4482
 
3123
4483
  return (
3124
4484
  <div
@@ -3130,13 +4490,15 @@ function HumanInputConversationRow({ item }: { item: HumanInputItem }) {
3130
4490
  <MessageCircleQuestionIcon aria-hidden="true" className="size-4" />
3131
4491
  </span>
3132
4492
  <div className="min-w-0 flex-1">
3133
- <p className="text-og-xs font-medium text-og-fg-subtle">Agent asked</p>
4493
+ <p className="text-og-xs font-medium text-og-fg-subtle">
4494
+ {t("messageTimeline.agentAsked")}
4495
+ </p>
3134
4496
  <div className="mt-1.5 space-y-3">
3135
4497
  {item.questions.length > 0 ? (
3136
4498
  item.questions.map((question, index) => (
3137
4499
  <div key={question.id}>
3138
4500
  {question.label ? (
3139
- <p className="text-og-sm font-semibold text-og-fg">
4501
+ <p className="text-og-sm font-semibold text-og-fg [overflow-wrap:anywhere]">
3140
4502
  {multipleQuestions ? (
3141
4503
  <span className="mr-1.5 tabular-nums text-og-fg-muted">{index + 1}.</span>
3142
4504
  ) : null}
@@ -3146,7 +4508,7 @@ function HumanInputConversationRow({ item }: { item: HumanInputItem }) {
3146
4508
  ) : null}
3147
4509
  <p
3148
4510
  className={cn(
3149
- "text-og-md leading-6 text-og-fg",
4511
+ "text-og-md leading-6 text-og-fg [overflow-wrap:anywhere]",
3150
4512
  question.label && "mt-0.5 text-og-sm text-og-fg-muted",
3151
4513
  )}
3152
4514
  >
@@ -3154,12 +4516,14 @@ function HumanInputConversationRow({ item }: { item: HumanInputItem }) {
3154
4516
  <span className="mr-1.5 tabular-nums text-og-fg-muted">{index + 1}.</span>
3155
4517
  ) : null}
3156
4518
  {!question.label && multipleQuestions ? " " : null}
3157
- {question.prompt}
4519
+ {linkifyText(question.prompt)}
3158
4520
  </p>
3159
4521
  </div>
3160
4522
  ))
3161
4523
  ) : (
3162
- <p className="text-og-sm text-og-fg-muted">The agent requested structured input.</p>
4524
+ <p className="text-og-sm text-og-fg-muted">
4525
+ {t("messageTimeline.theAgentRequestedStructuredInput")}
4526
+ </p>
3163
4527
  )}
3164
4528
  </div>
3165
4529
  </div>
@@ -3168,7 +4532,7 @@ function HumanInputConversationRow({ item }: { item: HumanInputItem }) {
3168
4532
  <div className="flex justify-end">
3169
4533
  <CopyHoverFrame
3170
4534
  copyText={copyText}
3171
- label="Copy answer"
4535
+ label={t("messageTimeline.copyAnswer")}
3172
4536
  className="w-fit max-w-[90%] min-w-0 sm:max-w-[82%]"
3173
4537
  trailing={<MessageFooterTime occurredAt={item.occurredAt} />}
3174
4538
  >
@@ -3188,20 +4552,25 @@ function HumanInputConversationRow({ item }: { item: HumanInputItem }) {
3188
4552
  </p>
3189
4553
  ) : null}
3190
4554
  <div className={cn("text-og-md text-og-fg", multipleQuestions && "mt-0.5")}>
3191
- {answer.values.length > 1 ? (
4555
+ {answer.secret ? (
4556
+ <SecretAnswerChip
4557
+ result={answer.secret}
4558
+ label={secretAnswerLabel(t, answer.secret)}
4559
+ />
4560
+ ) : answer.values.length > 1 ? (
3192
4561
  <ul className="list-disc space-y-0.5 pl-5">
3193
4562
  {answer.values.map((value) => (
3194
4563
  <li key={`${answer.questionId}-${value}`}>{value}</li>
3195
4564
  ))}
3196
4565
  </ul>
3197
4566
  ) : (
3198
- <p>{answer.values[0] || "Answered"}</p>
4567
+ <p>{answer.values[0] || t("messageTimeline.answered")}</p>
3199
4568
  )}
3200
4569
  </div>
3201
4570
  </div>
3202
4571
  ))
3203
4572
  ) : (
3204
- <p>Answered</p>
4573
+ <p>{t("messageTimeline.answered")}</p>
3205
4574
  )}
3206
4575
  </div>
3207
4576
  ) : null}
@@ -3212,11 +4581,15 @@ function HumanInputConversationRow({ item }: { item: HumanInputItem }) {
3212
4581
  );
3213
4582
  }
3214
4583
 
3215
- function humanInputConversationCopyText(item: HumanInputItem, settledLabel: string): string {
4584
+ function humanInputConversationCopyText(
4585
+ t: OpenGeniText,
4586
+ item: HumanInputItem,
4587
+ settledLabel: string,
4588
+ ): string {
3216
4589
  const questions = item.questions
3217
4590
  .map(
3218
4591
  (question, index) =>
3219
- `${item.questions.length > 1 ? `${index + 1}. ` : ""}${question.label || "Question"}: ${question.prompt}`,
4592
+ `${item.questions.length > 1 ? `${index + 1}. ` : ""}${question.label || t("messageTimeline.question")}: ${question.prompt}`,
3220
4593
  )
3221
4594
  .join("\n\n");
3222
4595
  const questionNumberById = new Map(
@@ -3229,7 +4602,11 @@ function humanInputConversationCopyText(item: HumanInputItem, settledLabel: stri
3229
4602
  item.questions.length > 1
3230
4603
  ? `${questionNumberById.get(answer.questionId) ?? index + 1}. `
3231
4604
  : ""
3232
- }${answer.label}: ${answer.values.join(", ") || "Answered"}`,
4605
+ }${answer.label}: ${
4606
+ answer.secret
4607
+ ? `${secretAnswerLabel(t, answer.secret)} (${answer.secret.reference})`
4608
+ : answer.values.join(", ") || t("messageTimeline.answered")
4609
+ }`,
3233
4610
  )
3234
4611
  .join("\n\n");
3235
4612
  return [questions, `${settledLabel}${answers ? `\n\n${answers}` : ""}`]
@@ -3248,20 +4625,23 @@ function AgentMessageRow({
3248
4625
  | ((text: string, item: AgentMessageItem | UserMessageItem) => ReactNode)
3249
4626
  | undefined;
3250
4627
  }) {
4628
+ const t = useOpenGeniText();
3251
4629
  const enter = useEntranceAnimation();
3252
4630
  // No streaming caret: it fought the trailing block layout (inline ↔ block)
3253
4631
  // and snapped on exit. Live text carries the stream via tip ink.
3254
4632
  const body = renderMessageText ? (
3255
4633
  renderMessageText(item.text, item)
3256
4634
  ) : (
3257
- <Markdown streaming={item.streaming}>{item.text}</Markdown>
4635
+ <Markdown softLineBreaks streaming={item.streaming}>
4636
+ {item.text}
4637
+ </Markdown>
3258
4638
  );
3259
4639
  // While streaming, copy is still useful (current text) but keep chrome calm —
3260
4640
  // stamp only after the message finishes (occurredAt tracks completion).
3261
4641
  return (
3262
4642
  <CopyHoverFrame
3263
4643
  copyText={item.text}
3264
- label="Copy message"
4644
+ label={t("messageTimeline.copyMessage")}
3265
4645
  align="start"
3266
4646
  className={cn(enter && "animate-og-enter", "min-w-0 text-og-md leading-7 text-og-fg")}
3267
4647
  trailing={
@@ -3275,6 +4655,7 @@ function AgentMessageRow({
3275
4655
  >
3276
4656
  <div
3277
4657
  data-og-wide-table-message=""
4658
+ data-og-search-item={item.id}
3278
4659
  data-og-annotation-source-key={item.annotationSource?.eventId}
3279
4660
  >
3280
4661
  {body}
@@ -3284,56 +4665,64 @@ function AgentMessageRow({
3284
4665
  }
3285
4666
 
3286
4667
  /**
3287
- * A worker session reporting back to its manager. The child's completion arrives
3288
- * as a `user.message` carrying a `childCompletion` payload (the raw message text
3289
- * used to render as an "ugly" user bubble); it projects to a `worker-completion`
3290
- * item and draws here as a quietly-confident card — an inbound result, not
3291
- * something the human said. One glyph + one line carry the outcome; the worker's
3292
- * full report, evidence, and any paused reason live behind a collapsed
3293
- * disclosure, and a "View session" affordance deep-links into the child.
3294
- *
3295
- * Color follows the timeline's restraint: green only for a completed goal, the
3296
- * waiting hue only for a paused one, red only for a failed child — everything
3297
- * else is a neutral inbound card.
4668
+ * A worker session reporting back to its manager in older history: the child's
4669
+ * completion arrived as a `user.message` carrying a `childCompletion` payload.
4670
+ * It draws as the same named agent row as every other inbound agent update:
4671
+ * the outcome and goal on the row, the report, evidence, and any paused
4672
+ * reason behind the disclosure, and a deep link into the child.
3298
4673
  */
3299
4674
  type WorkerCompletionMeta = {
3300
- label: string;
4675
+ title: AgentTitleParts;
3301
4676
  icon: ComponentType<{ className?: string }>;
3302
- iconClass: string;
3303
- /** The 2px left-accent hue — color spent only on the exceptional outcomes. */
3304
- accentClass: string;
4677
+ failed: boolean;
3305
4678
  };
3306
4679
 
3307
- function workerCompletionMeta(item: WorkerCompletionItem): WorkerCompletionMeta {
4680
+ function workerCompletionMeta(
4681
+ t: OpenGeniText,
4682
+ item: WorkerCompletionItem,
4683
+ name: string | null,
4684
+ ): WorkerCompletionMeta {
3308
4685
  if (item.childStatus === "failed") {
3309
4686
  return {
3310
- label: "Worker failed",
4687
+ title: namedAgentTitle(
4688
+ name,
4689
+ (agent) => t("messageTimeline.nameFailed", { name: agent }),
4690
+ t("messageTimeline.workerFailed"),
4691
+ ),
3311
4692
  icon: XCircleIcon,
3312
- iconClass: "text-og-status-failed",
3313
- accentClass: "border-og-status-failed/60",
4693
+ failed: true,
3314
4694
  };
3315
4695
  }
3316
4696
  if (item.goalStatus === "paused") {
3317
4697
  return {
3318
- label: "Worker paused",
4698
+ title: namedAgentTitle(
4699
+ name,
4700
+ (agent) => t("messageTimeline.namePaused", { name: agent }),
4701
+ t("messageTimeline.workerPaused"),
4702
+ ),
3319
4703
  icon: PauseCircleIcon,
3320
- iconClass: "text-og-status-waiting",
3321
- accentClass: "border-og-status-waiting/50",
4704
+ failed: false,
3322
4705
  };
3323
4706
  }
3324
4707
  if (item.goalStatus === "completed") {
3325
4708
  return {
3326
- label: "Worker completed",
4709
+ title: namedAgentTitle(
4710
+ name,
4711
+ (agent) => t("messageTimeline.nameCompletedItsGoal", { name: agent }),
4712
+ t("messageTimeline.workerCompleted"),
4713
+ ),
3327
4714
  icon: CheckCircle2Icon,
3328
- iconClass: "text-og-status-idle",
3329
- accentClass: "border-og-status-idle/45",
4715
+ failed: false,
3330
4716
  };
3331
4717
  }
3332
4718
  return {
3333
- label: "Worker reported back",
4719
+ title: namedAgentTitle(
4720
+ name,
4721
+ (agent) => t("messageTimeline.resultFromName", { name: agent }),
4722
+ t("messageTimeline.workerReportedBack"),
4723
+ ),
3334
4724
  icon: BotIcon,
3335
- iconClass: "text-og-accent",
3336
- accentClass: "border-og-border-strong",
4725
+ failed: false,
3337
4726
  };
3338
4727
  }
3339
4728
 
@@ -3344,102 +4733,70 @@ function WorkerCompletionRow({
3344
4733
  item: WorkerCompletionItem;
3345
4734
  onOpenSession?: ((sessionId: string) => void) | undefined;
3346
4735
  }) {
4736
+ const t = useOpenGeniText();
3347
4737
  const enter = useEntranceAnimation();
3348
- const [open, setOpen] = useState(false);
3349
- const meta = workerCompletionMeta(item);
4738
+ const identity = useAgentIdentity();
4739
+ const meta = workerCompletionMeta(t, item, identity.titleFor(item.childSessionId));
3350
4740
  const Icon = meta.icon;
3351
- // The worker's own report is the substance behind the fold; evidence and any
3352
- // paused reason sit alongside it as quieter, labelled context.
3353
4741
  // "Paused because" only when the outcome actually IS a pause — completion
3354
4742
  // payloads can carry a leftover pausedReason/rationale from earlier in the
3355
- // worker's life, and a "Worker completed" card must not show a pause section.
4743
+ // worker's life, and a completed row must not show a pause section.
3356
4744
  const showPausedReason =
3357
4745
  item.childStatus !== "failed" && item.goalStatus === "paused" && !!item.pausedReason?.trim();
3358
4746
  const details: { label: string; value: string; muted?: boolean }[] = [
3359
- ...(item.text.trim() ? [{ label: "Report", value: item.text.trim() }] : []),
4747
+ ...(item.text.trim() ? [{ label: t("messageTimeline.report"), value: item.text.trim() }] : []),
3360
4748
  ...(item.evidence?.trim()
3361
- ? [{ label: "Evidence", value: item.evidence.trim(), muted: true }]
4749
+ ? [{ label: t("messageTimeline.evidence"), value: item.evidence.trim(), muted: true }]
3362
4750
  : []),
3363
4751
  ...(showPausedReason
3364
- ? [{ label: "Paused because", value: item.pausedReason!.trim(), muted: true }]
4752
+ ? [
4753
+ {
4754
+ label: t("messageTimeline.pausedBecause"),
4755
+ value: item.pausedReason!.trim(),
4756
+ muted: true,
4757
+ },
4758
+ ]
3365
4759
  : []),
3366
4760
  ];
3367
- const hasDetails = details.length > 0;
3368
4761
  return (
3369
4762
  <div className={cn(enter && "animate-og-enter", "min-w-0")}>
3370
- {/* An inbound result, not a bubble: a 2px left accent carries the outcome —
3371
- no full frame, no surface fill. The report unfolds flush beneath. */}
3372
- <div className={cn("flex flex-col gap-2 border-l-2 pl-3", meta.accentClass)}>
3373
- <div className="flex items-start gap-2.5">
3374
- <span className={cn("mt-0.5 shrink-0", meta.iconClass)}>
3375
- <Icon className="size-4" />
3376
- </span>
3377
- <div className="min-w-0 flex-1">
3378
- <p className="text-og-base leading-5 text-og-fg">
3379
- <span className="font-medium">{meta.label}</span>
3380
- {item.goalText ? (
3381
- <span className="text-og-fg-muted"> · {truncate(item.goalText, 90)}</span>
3382
- ) : null}
3383
- </p>
3384
- </div>
3385
- {item.childSessionId && onOpenSession ? (
3386
- <button
3387
- type="button"
3388
- onClick={() => onOpenSession(item.childSessionId)}
3389
- className={cn(
3390
- "-my-0.5 -mr-1 inline-flex shrink-0 items-center gap-1 rounded-og-sm px-2 py-1 text-og-sm font-medium text-og-fg-muted pointer-coarse:py-2",
3391
- "outline-hidden transition-colors duration-150 hover:bg-og-surface-2 hover:text-og-fg",
3392
- "focus-visible:ring-2 focus-visible:ring-og-accent",
3393
- )}
3394
- >
3395
- View session
3396
- <ArrowRightIcon className="size-3.5" />
3397
- </button>
3398
- ) : null}
3399
- </div>
3400
- {hasDetails ? (
3401
- <Collapsible.Root open={open} onOpenChange={setOpen}>
3402
- <Collapsible.Trigger asChild>
3403
- <button
3404
- type="button"
3405
- className={cn(
3406
- "group/wc -mx-1 inline-flex w-fit items-center gap-1 rounded-og-sm px-1 py-0.5 text-og-xs font-medium text-og-fg-subtle",
3407
- "outline-hidden transition-colors duration-150 hover:text-og-fg-muted focus-visible:ring-2 focus-visible:ring-og-accent",
3408
- )}
3409
- >
3410
- <ChevronRightIcon className="size-3 transition-transform duration-150 ease-og-in-out group-data-[state=open]/wc:rotate-90" />
3411
- {open ? "Hide details" : "Show details"}
3412
- </button>
3413
- </Collapsible.Trigger>
3414
- <Collapsible.Content className="overflow-hidden data-[state=closed]:animate-og-collapse data-[state=open]:animate-og-expand">
3415
- <div className="ml-1 mt-1.5 flex flex-col gap-2.5">
3416
- {details.map((detail) => (
3417
- <div key={detail.label} className="min-w-0">
3418
- <p className="mb-1 text-og-xs font-medium uppercase tracking-[0.08em] text-og-fg-subtle">
3419
- {detail.label}
3420
- </p>
3421
- <p
3422
- className={cn(
3423
- "whitespace-pre-wrap break-words text-og-sm leading-6",
3424
- detail.muted ? "text-og-fg-subtle" : "text-og-fg-muted",
3425
- )}
3426
- >
3427
- {detail.value}
3428
- </p>
3429
- </div>
3430
- ))}
3431
- </div>
3432
- </Collapsible.Content>
3433
- </Collapsible.Root>
3434
- ) : null}
3435
- </div>
4763
+ <AgentRow
4764
+ icon={<Icon />}
4765
+ title={meta.title}
4766
+ preview={item.goalText ? truncate(item.goalText, 240) : null}
4767
+ previewLines={2}
4768
+ sessionId={item.childSessionId}
4769
+ onOpenSession={onOpenSession ?? identity.onOpenSession}
4770
+ failed={meta.failed}
4771
+ >
4772
+ {details.length > 0 ? (
4773
+ <>
4774
+ {details.map((detail) => (
4775
+ <AgentRowSection key={detail.label} label={detail.label} muted={detail.muted}>
4776
+ {detail.value}
4777
+ </AgentRowSection>
4778
+ ))}
4779
+ </>
4780
+ ) : undefined}
4781
+ </AgentRow>
3436
4782
  </div>
3437
4783
  );
3438
4784
  }
3439
4785
 
3440
- function SessionStatusRow({ item }: { item: { status: SessionStatus; occurredAt: string } }) {
4786
+ function SessionStatusRow({
4787
+ item,
4788
+ }: {
4789
+ item: {
4790
+ status: SessionStatus;
4791
+ blocked?: true;
4792
+ occurredAt: string;
4793
+ resolvedAt?: string;
4794
+ };
4795
+ }) {
4796
+ const t = useOpenGeniText();
3441
4797
  const enter = useEntranceAnimation();
3442
- const meta = SESSION_STATUS_META[item.status];
4798
+ const status = item.blocked ? "blocked" : item.status;
4799
+ const meta = SESSION_STATUS_META(t)[status];
3443
4800
  return (
3444
4801
  <div
3445
4802
  className={cn(
@@ -3450,8 +4807,9 @@ function SessionStatusRow({ item }: { item: { status: SessionStatus; occurredAt:
3450
4807
  >
3451
4808
  <span className="h-px flex-1 bg-og-border" />
3452
4809
  <span className="inline-flex items-center gap-1.5">
3453
- <StatusDot status={item.status} className="size-1" />
3454
- {meta.label.toLowerCase()} · {formatRelativeTime(item.occurredAt)}
4810
+ {item.resolvedAt ? null : <StatusDot status={status} className="size-1" />}
4811
+ {item.resolvedAt ? t("messageTimeline.workResumed") : meta.label.toLowerCase()} ·{" "}
4812
+ {formatRelativeTime(t, item.resolvedAt ?? item.occurredAt)}
3455
4813
  </span>
3456
4814
  <span className="h-px flex-1 bg-og-border" />
3457
4815
  </div>
@@ -3481,32 +4839,36 @@ const NEUTRAL_PILL = "border-og-border bg-og-surface-1 text-og-fg-muted";
3481
4839
 
3482
4840
  // Shared production chunks can be cyclic. Resolve icon bindings during render,
3483
4841
  // after their modules initialize, rather than permanently capturing undefined.
3484
- function goalMeta(action: GoalItem["action"]): GoalMeta {
4842
+ function goalMeta(t: OpenGeniText, action: GoalItem["action"]): GoalMeta {
3485
4843
  const metadata: Record<GoalItem["action"], GoalMeta> = {
3486
4844
  set: {
3487
- label: "Goal set",
4845
+ label: t("messageTimeline.goalSet"),
3488
4846
  pill: "border-og-accent/30 bg-og-accent/10 text-og-accent",
3489
4847
  icon: TargetIcon,
3490
4848
  },
3491
- updated: { label: "Goal updated", pill: NEUTRAL_PILL, icon: PencilLineIcon },
4849
+ updated: { label: t("messageTimeline.goalUpdated"), pill: NEUTRAL_PILL, icon: PencilLineIcon },
3492
4850
  completed: {
3493
- label: "Goal completed",
4851
+ label: t("messageTimeline.goalCompleted"),
3494
4852
  pill: "border-og-status-idle/30 bg-og-status-idle/10 text-og-status-idle",
3495
4853
  icon: CheckIcon,
3496
4854
  },
3497
4855
  paused: {
3498
- label: "Goal paused",
4856
+ label: t("messageTimeline.goalPaused"),
3499
4857
  pill: WAITING_PILL_CLASS,
3500
4858
  icon: PauseIcon,
3501
4859
  },
3502
- resumed: { label: "Goal resumed", pill: NEUTRAL_PILL, icon: PlayIcon },
3503
- cleared: { label: "Goal cleared", pill: NEUTRAL_PILL, icon: Trash2Icon },
4860
+ resumed: { label: t("messageTimeline.goalResumed"), pill: NEUTRAL_PILL, icon: PlayIcon },
4861
+ cleared: { label: t("messageTimeline.goalCleared"), pill: NEUTRAL_PILL, icon: Trash2Icon },
3504
4862
  held: {
3505
- label: "Goal held",
4863
+ label: t("messageTimeline.goalHeld"),
3506
4864
  pill: WAITING_PILL_CLASS,
3507
4865
  icon: PauseCircleIcon,
3508
4866
  },
3509
- continuation: { label: "Continuing toward the goal", pill: NEUTRAL_PILL, icon: ArrowRightIcon },
4867
+ continuation: {
4868
+ label: t("messageTimeline.continuingTowardTheGoal"),
4869
+ pill: NEUTRAL_PILL,
4870
+ icon: ArrowRightIcon,
4871
+ },
3510
4872
  };
3511
4873
  return metadata[action];
3512
4874
  }
@@ -3517,8 +4879,9 @@ function goalMeta(action: GoalItem["action"]): GoalMeta {
3517
4879
  * palette stays restrained — see that table for the per-action rationale.
3518
4880
  */
3519
4881
  function GoalRow({ item }: { item: GoalItem }) {
4882
+ const t = useOpenGeniText();
3520
4883
  const enter = useEntranceAnimation();
3521
- const { label, pill, icon: Icon } = goalMeta(item.action);
4884
+ const { label, pill, icon: Icon } = goalMeta(t, item.action);
3522
4885
  return (
3523
4886
  <div className={cn(enter && "animate-og-enter", "flex justify-center")}>
3524
4887
  <span
@@ -3546,8 +4909,10 @@ function MachineInputBatchRow({
3546
4909
  onOpenSession?: ((sessionId: string) => void) | undefined;
3547
4910
  loadVideoArtifactPlayback?: VideoArtifactPlaybackLoader | undefined;
3548
4911
  }) {
4912
+ const t = useOpenGeniText();
3549
4913
  const enter = useEntranceAnimation();
3550
- const label = machineInputBatchLabel(item.members);
4914
+ const identity = useAgentIdentity();
4915
+ const label = machineInputBatchLabel(t, item.members, identity.titleFor);
3551
4916
  const single = item.members.length === 1 ? item.members[0]! : null;
3552
4917
  if (single?.kind === "media_generation_result" && single.result) {
3553
4918
  return (
@@ -3558,15 +4923,22 @@ function MachineInputBatchRow({
3558
4923
  );
3559
4924
  }
3560
4925
  const singleSummary = single ? cleanMachineInputSummary(single.summary) : "";
4926
+ // An agent's words live in its named row behind the pill; the pill already
4927
+ // says who it is from, so nothing repeats beneath it.
3561
4928
  const showCollapsedSummary =
3562
- single != null && machineInputSummaryIsUseful(single.kind, singleSummary);
4929
+ !item.compact &&
4930
+ single != null &&
4931
+ !isAgentMember(single) &&
4932
+ machineInputSummaryIsUseful(t, single.kind, singleSummary);
3563
4933
 
3564
4934
  return (
3565
4935
  <div className={cn(enter && "animate-og-enter", "flex flex-col items-center gap-1.5")}>
3566
4936
  <details
3567
4937
  className="group w-full max-w-full"
3568
4938
  data-og-machine-input-batch=""
3569
- title={`Received ${formatClockTime(item.occurredAt)}`}
4939
+ title={t("messageTimeline.receivedClocktime", {
4940
+ clockTime: formatClockTime(t, item.occurredAt),
4941
+ })}
3570
4942
  >
3571
4943
  <summary className="flex cursor-pointer list-none justify-center [&::-webkit-details-marker]:hidden">
3572
4944
  <span
@@ -3582,18 +4954,27 @@ function MachineInputBatchRow({
3582
4954
  <span className="truncate">{label}</span>
3583
4955
  </span>
3584
4956
  </summary>
3585
- <div className="mx-auto mt-2 w-full max-w-lg space-y-2 border-t border-og-border/50 pt-2">
4957
+ <div className="mx-auto mt-2 w-full max-w-lg space-y-1.5 border-t border-og-border/50 pt-2">
3586
4958
  <p className="text-og-xs text-og-fg-subtle">
3587
- Received <time dateTime={item.occurredAt}>{formatClockTime(item.occurredAt)}</time>
4959
+ {t("messageTimeline.received")}{" "}
4960
+ <time dateTime={item.occurredAt}>{formatClockTime(t, item.occurredAt)}</time>
3588
4961
  </p>
3589
- {item.members.map((member) => (
3590
- <MachineInputRow
3591
- key={member.id}
3592
- member={member}
3593
- onOpenSession={onOpenSession}
3594
- loadVideoArtifactPlayback={loadVideoArtifactPlayback}
3595
- />
3596
- ))}
4962
+ {groupMachineInputMembers(item.members).map((group) =>
4963
+ group.kind === "agent" ? (
4964
+ <AgentMemberRow
4965
+ key={group.members[0]!.id}
4966
+ members={group.members}
4967
+ onOpenSession={onOpenSession}
4968
+ />
4969
+ ) : (
4970
+ <MachineInputRow
4971
+ key={group.member.id}
4972
+ member={group.member}
4973
+ onOpenSession={onOpenSession}
4974
+ loadVideoArtifactPlayback={loadVideoArtifactPlayback}
4975
+ />
4976
+ ),
4977
+ )}
3597
4978
  </div>
3598
4979
  </details>
3599
4980
  {showCollapsedSummary ? (
@@ -3605,6 +4986,88 @@ function MachineInputBatchRow({
3605
4986
  );
3606
4987
  }
3607
4988
 
4989
+ type MachineInputMemberGroup =
4990
+ | { kind: "agent"; members: MachineInputBatchItem["members"] }
4991
+ | { kind: "other"; member: MachineInputBatchItem["members"][number] };
4992
+
4993
+ /**
4994
+ * Agent members get named rows; repeated progress notes from one agent fold
4995
+ * into its single row (latest note shown, earlier ones behind the disclosure).
4996
+ */
4997
+ function groupMachineInputMembers(
4998
+ members: MachineInputBatchItem["members"],
4999
+ ): MachineInputMemberGroup[] {
5000
+ const groups: MachineInputMemberGroup[] = [];
5001
+ const progressBySource = new Map<string, MachineInputBatchItem["members"]>();
5002
+ for (const member of members) {
5003
+ if (!isAgentMember(member)) {
5004
+ groups.push({ kind: "other", member });
5005
+ continue;
5006
+ }
5007
+ if (member.kind === "child_progress") {
5008
+ const existing = progressBySource.get(member.sourceId);
5009
+ if (existing) {
5010
+ existing.push(member);
5011
+ continue;
5012
+ }
5013
+ const bucket = [member];
5014
+ progressBySource.set(member.sourceId, bucket);
5015
+ groups.push({ kind: "agent", members: bucket });
5016
+ continue;
5017
+ }
5018
+ groups.push({ kind: "agent", members: [member] });
5019
+ }
5020
+ return groups;
5021
+ }
5022
+
5023
+ function agentMemberIcon(member: MachineInputBatchItem["members"][number]): ReactNode {
5024
+ if (member.kind === "child_terminal_result" && member.classification === "failure") {
5025
+ return <XCircleIcon />;
5026
+ }
5027
+ if (member.kind === "child_paused") return <PauseCircleIcon />;
5028
+ return <CornerDownRightIcon />;
5029
+ }
5030
+
5031
+ /** One named row for an update sent by (or about) another agent. */
5032
+ function AgentMemberRow({
5033
+ members,
5034
+ onOpenSession,
5035
+ }: {
5036
+ members: MachineInputBatchItem["members"];
5037
+ onOpenSession?: ((sessionId: string) => void) | undefined;
5038
+ }) {
5039
+ const t = useOpenGeniText();
5040
+ const identity = useAgentIdentity();
5041
+ const latest = members[members.length - 1]!;
5042
+ const sessionId = agentMemberSessionId(latest);
5043
+ const title = agentMemberTitle(t, latest, identity.titleFor(sessionId));
5044
+ const texts = members.map((member) => agentMemberText(t, member));
5045
+ const latestText = texts[texts.length - 1]!;
5046
+ const bodies = texts
5047
+ .map((text, index) => ({ id: members[index]!.id, body: text.body }))
5048
+ .filter((entry) => entry.body.length > 0);
5049
+ return (
5050
+ <AgentRow
5051
+ icon={agentMemberIcon(latest)}
5052
+ title={title}
5053
+ preview={latestText.preview ? truncate(latestText.preview, 320) : null}
5054
+ previewLines={2}
5055
+ meta={members.length > 1 ? `+${members.length - 1} earlier` : null}
5056
+ sessionId={sessionId}
5057
+ onOpenSession={onOpenSession ?? identity.onOpenSession}
5058
+ failed={latest.kind === "child_terminal_result" && latest.classification === "failure"}
5059
+ >
5060
+ {bodies.length > 0 ? (
5061
+ <>
5062
+ {bodies.map((entry) => (
5063
+ <AgentRowText key={entry.id}>{entry.body}</AgentRowText>
5064
+ ))}
5065
+ </>
5066
+ ) : undefined}
5067
+ </AgentRow>
5068
+ );
5069
+ }
5070
+
3608
5071
  function MachineInputRow({
3609
5072
  member,
3610
5073
  onOpenSession,
@@ -3614,6 +5077,7 @@ function MachineInputRow({
3614
5077
  onOpenSession?: ((sessionId: string) => void) | undefined;
3615
5078
  loadVideoArtifactPlayback?: VideoArtifactPlaybackLoader | undefined;
3616
5079
  }) {
5080
+ const t = useOpenGeniText();
3617
5081
  if (member.kind === "media_generation_result" && member.result) {
3618
5082
  return (
3619
5083
  <VideoGenerationResultRow
@@ -3630,9 +5094,13 @@ function MachineInputRow({
3630
5094
  <span className="mt-2 size-1.5 shrink-0 rounded-full bg-og-fg-subtle" aria-hidden />
3631
5095
  <div className="min-w-0 flex-1">
3632
5096
  <span className="text-og-control font-medium text-og-fg-muted">
3633
- {MACHINE_INPUT_META[member.kind]}
5097
+ {MACHINE_INPUT_META(t)[member.kind]}
3634
5098
  </span>
3635
- {source && <span className="ml-1.5 text-og-control text-og-fg-subtle">from {source}</span>}
5099
+ {source && (
5100
+ <span className="ml-1.5 text-og-control text-og-fg-subtle">
5101
+ {t("messageTimeline.fromSource", { source })}
5102
+ </span>
5103
+ )}
3636
5104
  {summary ? (
3637
5105
  <p className="mt-0.5 whitespace-pre-wrap break-words text-og-menu leading-5 text-og-fg">
3638
5106
  {truncate(summary, 320)}
@@ -3657,6 +5125,7 @@ function VideoGenerationResultRow({
3657
5125
  loadVideoArtifactPlayback?: VideoArtifactPlaybackLoader | undefined;
3658
5126
  compact?: boolean | undefined;
3659
5127
  }) {
5128
+ const t = useOpenGeniText();
3660
5129
  const enter = useEntranceAnimation();
3661
5130
  if (result.status !== "ready") {
3662
5131
  return (
@@ -3668,7 +5137,7 @@ function VideoGenerationResultRow({
3668
5137
  >
3669
5138
  <div className="flex items-center gap-2 text-og-sm font-medium text-og-status-failed">
3670
5139
  <XCircleIcon aria-hidden className="size-4" />
3671
- Video generation failed
5140
+ {t("messageTimeline.videoGenerationFailed")}
3672
5141
  </div>
3673
5142
  <p className="mt-1 text-og-sm leading-5 text-og-fg-muted">{result.boundedPublicReason}</p>
3674
5143
  </div>
@@ -3678,7 +5147,7 @@ function VideoGenerationResultRow({
3678
5147
  const facts = receipt.video;
3679
5148
  return (
3680
5149
  <section
3681
- aria-label="Generated video"
5150
+ aria-label={t("messageTimeline.generatedVideo")}
3682
5151
  className={cn(
3683
5152
  enter && "animate-og-enter",
3684
5153
  "mx-auto w-full max-w-2xl overflow-hidden rounded-og-lg border border-og-border bg-og-surface-1 shadow-sm",
@@ -3698,13 +5167,16 @@ function VideoGenerationResultRow({
3698
5167
  )}
3699
5168
  <div className="flex items-center justify-between gap-4 px-3.5 py-2.5">
3700
5169
  <div className="min-w-0">
3701
- <p className="text-og-sm font-medium text-og-fg">Generated video</p>
5170
+ <p className="text-og-sm font-medium text-og-fg">{t("messageTimeline.generatedVideo")}</p>
3702
5171
  <p className="truncate text-og-xs text-og-fg-subtle">
3703
5172
  {facts.width}×{facts.height} · {formatVideoDuration(facts.durationSeconds)}
3704
5173
  {facts.hasAudio ? " · Audio" : ""}
3705
5174
  </p>
3706
5175
  </div>
3707
- <CheckCircle2Icon aria-label="Ready" className="size-4 shrink-0 text-og-status-success" />
5176
+ <CheckCircle2Icon
5177
+ aria-label={t("messageTimeline.ready")}
5178
+ className="size-4 shrink-0 text-og-status-success"
5179
+ />
3708
5180
  </div>
3709
5181
  </section>
3710
5182
  );
@@ -3715,7 +5187,11 @@ function formatVideoDuration(seconds: number): string {
3715
5187
  }
3716
5188
 
3717
5189
  function NoticeRow({ item }: { item: NoticeItem }) {
5190
+ const t = useOpenGeniText();
3718
5191
  const enter = useEntranceAnimation();
5192
+ if (item.allowance) return <AllowanceExhaustedRow refusal={item.allowance} />;
5193
+ if (item.sessionUsageLimit) return <SessionUsageLimitRow stop={item.sessionUsageLimit} />;
5194
+ if (item.learningRefusal) return <LearningRefusalRow refusal={item.learningRefusal} />;
3719
5195
  if (item.recordedOutcome) {
3720
5196
  return (
3721
5197
  <details
@@ -3728,24 +5204,20 @@ function NoticeRow({ item }: { item: NoticeItem }) {
3728
5204
  aria-hidden
3729
5205
  className="size-3.5 transition-transform group-open:rotate-90"
3730
5206
  />
3731
- <span>
3732
- Wait recorded ·{" "}
3733
- <time dateTime={item.occurredAt}>
3734
- {new Date(item.occurredAt).toLocaleString(undefined, {
3735
- dateStyle: "medium",
3736
- timeStyle: "short",
3737
- })}
3738
- </time>
5207
+ <span title={new Date(item.occurredAt).toLocaleString(t.locale)}>
5208
+ {recordedWaitSummary(t, item)}
3739
5209
  </span>
3740
5210
  </summary>
3741
5211
  <p className="mt-1 whitespace-pre-wrap break-words pl-5 text-og-fg-muted">{item.text}</p>
3742
5212
  </details>
3743
5213
  );
3744
5214
  }
5215
+ const presentedTone = noticeTone(item);
5216
+ const resolvedApproval = noticeIsResolvedApproval(item);
3745
5217
  const tone =
3746
- item.tone === "failed"
5218
+ presentedTone === "failed"
3747
5219
  ? "border-og-status-failed/35 bg-og-status-failed/10 text-og-status-failed"
3748
- : item.tone === "waiting"
5220
+ : presentedTone === "waiting"
3749
5221
  ? WAITING_PILL_CLASS
3750
5222
  : NEUTRAL_PILL;
3751
5223
  return (
@@ -3755,30 +5227,24 @@ function NoticeRow({ item }: { item: NoticeItem }) {
3755
5227
  "flex items-start gap-2.5 rounded-og-md border px-3.5 py-2.5 text-og-menu",
3756
5228
  tone,
3757
5229
  )}
3758
- role={item.recordedOutcome ? "note" : "status"}
3759
- data-og-recorded-outcome={item.recordedOutcome ? "wait" : undefined}
5230
+ role="status"
3760
5231
  >
3761
- <TriangleAlertIcon
3762
- className={cn("mt-0.5 size-4 shrink-0", item.tone === "cancelled" && "opacity-60")}
3763
- />
5232
+ {resolvedApproval ? (
5233
+ <CheckIcon className="mt-0.5 size-4 shrink-0 opacity-70" aria-hidden="true" />
5234
+ ) : (
5235
+ <TriangleAlertIcon
5236
+ className={cn("mt-0.5 size-4 shrink-0", item.tone === "cancelled" && "opacity-60")}
5237
+ />
5238
+ )}
3764
5239
  <div className="min-w-0 flex-1">
3765
- {item.recordedOutcome ? (
3766
- <p className="mb-1 text-og-control font-medium">
3767
- Wait recorded{" "}
3768
- <time dateTime={item.occurredAt}>
3769
- {new Date(item.occurredAt).toLocaleString(undefined, {
3770
- dateStyle: "medium",
3771
- timeStyle: "short",
3772
- })}
3773
- </time>
3774
- </p>
3775
- ) : null}
3776
- <span className="whitespace-pre-wrap break-words">{item.text}</span>
5240
+ <span className="whitespace-pre-wrap break-words">{noticeDisplayText(t, item)}</span>
3777
5241
  {item.details ? (
3778
5242
  <details className="mt-2 text-og-control">
3779
5243
  <summary className="cursor-pointer font-medium">{item.details.label}</summary>
3780
5244
  <pre className="mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-all rounded-og-sm bg-og-fg/5 p-2 font-mono">
3781
- {JSON.stringify(item.details.value, null, 2)}
5245
+ {typeof item.details.value === "string"
5246
+ ? item.details.value
5247
+ : JSON.stringify(item.details.value, null, 2)}
3782
5248
  </pre>
3783
5249
  </details>
3784
5250
  ) : null}
@@ -3797,6 +5263,65 @@ function NoticeRow({ item }: { item: NoticeItem }) {
3797
5263
  );
3798
5264
  }
3799
5265
 
5266
+ /**
5267
+ * "Waited for 2 agents · 3m 5s" once later input ended the wait, otherwise
5268
+ * "Waiting for 2 agents · since 10:32" (with the date on a later day). The
5269
+ * reason stays behind the disclosure.
5270
+ */
5271
+ function recordedWaitSummary(t: OpenGeniText, item: NoticeItem): ReactNode {
5272
+ const agents = item.waitingAgents ?? 0;
5273
+ const waitedMs = item.waitEndedAt
5274
+ ? durationBetween(item.occurredAt, item.waitEndedAt)
5275
+ : undefined;
5276
+ if (waitedMs !== undefined) {
5277
+ return withSlot(
5278
+ agents > 0
5279
+ ? t("timeline.noticePresentation.waitedForAgentsElapsed", { count: agents, elapsed: SLOT })
5280
+ : t("timeline.noticePresentation.waitedElapsed", { elapsed: SLOT }),
5281
+ <time dateTime={`PT${Math.floor(waitedMs / 1000)}S`}>{formatElapsed(t, waitedMs)}</time>,
5282
+ );
5283
+ }
5284
+ // An open wait is historical once its day has passed; keep its date visible.
5285
+ const started = new Date(item.occurredAt);
5286
+ const sameDay = started.toDateString() === new Date().toDateString();
5287
+ const text = item.waitEndedAt
5288
+ ? agents > 0
5289
+ ? t("timeline.noticePresentation.waitedForAgentsSince", { count: agents, since: SLOT })
5290
+ : t("timeline.noticePresentation.waitedSince", { since: SLOT })
5291
+ : agents > 0
5292
+ ? t("timeline.noticePresentation.waitingForAgentsSince", { count: agents, since: SLOT })
5293
+ : t("timeline.noticePresentation.waitingSince", { since: SLOT });
5294
+ return withSlot(
5295
+ text,
5296
+ <time dateTime={item.occurredAt}>
5297
+ {sameDay
5298
+ ? formatClockTime(t, item.occurredAt)
5299
+ : started.toLocaleString(t.locale, { dateStyle: "medium", timeStyle: "short" })}
5300
+ </time>,
5301
+ );
5302
+ }
5303
+
5304
+ /** Marks where a rendered element goes inside translated text. */
5305
+ const SLOT = "\u0000";
5306
+
5307
+ function withSlot(text: string, node: ReactNode): ReactNode {
5308
+ const at = text.indexOf(SLOT);
5309
+ if (at < 0) {
5310
+ return (
5311
+ <>
5312
+ {text} {node}
5313
+ </>
5314
+ );
5315
+ }
5316
+ return (
5317
+ <>
5318
+ {text.slice(0, at)}
5319
+ {node}
5320
+ {text.slice(at + SLOT.length)}
5321
+ </>
5322
+ );
5323
+ }
5324
+
3800
5325
  /**
3801
5326
  * The inline connection-recovery card: missing or lapsed access surfaces as a
3802
5327
  * calm, tappable affordance instead of a raw provider-domain error. The `reason`
@@ -3814,13 +5339,16 @@ function AuthNeededRow({
3814
5339
  onReconnect?: ((item: AuthNeededItem) => void | Promise<void>) | undefined;
3815
5340
  resolveProviderLogo?: ((providerDomain: string) => string | null | undefined) | undefined;
3816
5341
  }) {
5342
+ const t = useOpenGeniText();
3817
5343
  const enter = useEntranceAnimation();
3818
5344
  const [busy, setBusy] = useState(false);
3819
5345
  const [failed, setFailed] = useState(false);
3820
5346
  const recommendation = item.capability ?? null;
3821
5347
  const provider =
3822
5348
  recommendation?.name ??
3823
- (item.serverId === "codex_apps" ? "Codex Apps" : providerLabel(item.providerDomain));
5349
+ (item.serverId === "codex_apps"
5350
+ ? t("messageTimeline.codexApps")
5351
+ : providerLabel(t, item.providerDomain));
3824
5352
  const unavailable =
3825
5353
  item.reason === "personal_authority_unavailable" ||
3826
5354
  item.reason === "unsupported_auth" ||
@@ -3828,21 +5356,21 @@ function AuthNeededRow({
3828
5356
  const missing = item.reason === "missing_connection";
3829
5357
  const actionLabel = recommendation
3830
5358
  ? recommendation.action === "connect"
3831
- ? "Connect"
3832
- : "Review"
5359
+ ? t("messageTimeline.connect")
5360
+ : t("messageTimeline.review")
3833
5361
  : missing
3834
- ? "Connect"
3835
- : "Reconnect";
5362
+ ? t("messageTimeline.connect")
5363
+ : t("messageTimeline.reconnect");
3836
5364
  const title = recommendation
3837
5365
  ? recommendation.action === "connect"
3838
- ? `Connect ${provider}`
5366
+ ? t("messageTimeline.connectProvider", { provider })
3839
5367
  : recommendation.action === "add_credentials"
3840
- ? `Set up ${provider}`
3841
- : `Enable ${provider}`
5368
+ ? t("messageTimeline.setUpProvider", { provider })
5369
+ : t("messageTimeline.enableProvider", { provider })
3842
5370
  : unavailable
3843
- ? `${provider} tools unavailable`
5371
+ ? t("messageTimeline.providerToolsUnavailable", { provider })
3844
5372
  : `${actionLabel} ${provider}`;
3845
- const reasonLine = recommendation?.rationale ?? authReasonLine(item.reason);
5373
+ const reasonLine = recommendation?.rationale ?? authReasonLine(t, item.reason);
3846
5374
  const hostAuthorizationUrl = item.authoritySource === "host" ? item.authorizationUrl : null;
3847
5375
 
3848
5376
  const start = async () => {
@@ -3876,12 +5404,16 @@ function AuthNeededRow({
3876
5404
  <p className="line-clamp-2 text-og-sm text-og-fg-subtle">{reasonLine}</p>
3877
5405
  {recommendation ? (
3878
5406
  <p className="mt-1 truncate text-og-xs text-og-fg-muted">
3879
- Provider: {item.providerDomain}
5407
+ {t("messageTimeline.providerProviderdomain", {
5408
+ providerDomain: item.providerDomain,
5409
+ })}
3880
5410
  </p>
3881
5411
  ) : null}
3882
5412
  {recommendation && recommendation.requiredVariables.length > 0 ? (
3883
5413
  <p className="mt-1 truncate text-og-xs text-og-fg-muted">
3884
- Needs variables: {recommendation.requiredVariables.join(", ")}
5414
+ {t("messageTimeline.needsVariablesJoin", {
5415
+ join: recommendation.requiredVariables.join(", "),
5416
+ })}
3885
5417
  </p>
3886
5418
  ) : null}
3887
5419
  </div>
@@ -3893,7 +5425,7 @@ function AuthNeededRow({
3893
5425
  target="_blank"
3894
5426
  className={cn(
3895
5427
  PRIMARY_ACTION_CLASS,
3896
- "transition-colors hover:bg-og-accent-strong pointer-coarse:min-h-9",
5428
+ "transition-colors hover:bg-og-primary-hover pointer-coarse:min-h-9",
3897
5429
  )}
3898
5430
  >
3899
5431
  <RefreshCwIcon className="size-3.5" aria-hidden />
@@ -3906,11 +5438,11 @@ function AuthNeededRow({
3906
5438
  disabled={busy}
3907
5439
  className={cn(
3908
5440
  PRIMARY_ACTION_CLASS,
3909
- "transition-colors hover:bg-og-accent-strong disabled:opacity-70 pointer-coarse:min-h-9",
5441
+ "transition-colors hover:bg-og-primary-hover disabled:opacity-50 pointer-coarse:min-h-9",
3910
5442
  )}
3911
5443
  >
3912
5444
  <RefreshCwIcon className={cn("size-3.5", busy && "animate-og-spin")} aria-hidden />
3913
- {busy ? "Opening…" : actionLabel}
5445
+ {busy ? t("messageTimeline.opening") : actionLabel}
3914
5446
  </button>
3915
5447
  ) : item.authoritySource !== "host" && !unavailable && item.authorizationUrl ? (
3916
5448
  <a
@@ -3919,7 +5451,7 @@ function AuthNeededRow({
3919
5451
  target="_blank"
3920
5452
  className={cn(
3921
5453
  PRIMARY_ACTION_CLASS,
3922
- "transition-colors hover:bg-og-accent-strong pointer-coarse:min-h-9",
5454
+ "transition-colors hover:bg-og-primary-hover pointer-coarse:min-h-9",
3923
5455
  )}
3924
5456
  >
3925
5457
  <RefreshCwIcon className="size-3.5" aria-hidden />
@@ -3930,13 +5462,19 @@ function AuthNeededRow({
3930
5462
  {!unavailable ? (
3931
5463
  <p className="px-1 text-og-xs text-og-fg-subtle">
3932
5464
  {recommendation
3933
- ? "No access has been granted. Review and confirm the provider before continuing."
3934
- : `This tool call wasn't replayed. After ${missing ? "connecting" : "reconnecting"}, send a new message to try again.`}
5465
+ ? t("messageTimeline.noAccessHasBeenGranted")
5466
+ : t(
5467
+ missing
5468
+ ? "messageTimeline.toolCallNotReplayedAfterConnecting"
5469
+ : "messageTimeline.toolCallNotReplayedAfterReconnecting",
5470
+ )}
3935
5471
  </p>
3936
5472
  ) : null}
3937
5473
  {failed ? (
3938
5474
  <p className="px-1 text-og-xs text-og-status-failed">
3939
- Couldn't start {missing ? "connecting" : "reconnecting"} {provider}. Try again.
5475
+ {t("messageTimeline.couldnTStart")}{" "}
5476
+ {missing ? t("messageTimeline.connecting") : t("messageTimeline.reconnecting")}{" "}
5477
+ {t("messageTimeline.providerTryAgain", { provider })}
3940
5478
  </p>
3941
5479
  ) : null}
3942
5480
  </div>
@@ -3992,7 +5530,7 @@ function monogram(label: string): string {
3992
5530
 
3993
5531
  /** "linear.app" -> "Linear": the first domain label, capitalized. A calm human
3994
5532
  name for the provider — never the raw domain shown as a label. */
3995
- function providerLabel(domain: string): string {
5533
+ function providerLabel(t: OpenGeniText, domain: string): string {
3996
5534
  const host =
3997
5535
  domain
3998
5536
  .trim()
@@ -4001,29 +5539,29 @@ function providerLabel(domain: string): string {
4001
5539
  .split("/")[0] ?? "";
4002
5540
  const first = host.split(".")[0] ?? host;
4003
5541
  if (!first) {
4004
- return "this service";
5542
+ return t("messageTimeline.thisService");
4005
5543
  }
4006
5544
  return first.charAt(0).toUpperCase() + first.slice(1);
4007
5545
  }
4008
5546
 
4009
5547
  /** A calm, human helper line per reauth reason — the `reason` informs the copy
4010
5548
  but is never rendered as a raw enum/code. */
4011
- function authReasonLine(reason: AuthNeededItem["reason"]): string {
5549
+ function authReasonLine(t: OpenGeniText, reason: AuthNeededItem["reason"]): string {
4012
5550
  switch (reason) {
4013
5551
  case "insufficient_scope":
4014
- return "It needs additional access to continue.";
5552
+ return t("messageTimeline.itNeedsAdditionalAccessTo");
4015
5553
  case "missing_connection":
4016
- return "It isn't connected yet.";
5554
+ return t("messageTimeline.itIsnTConnectedYet");
4017
5555
  case "expired":
4018
5556
  case "refresh_failed":
4019
- return "Its access expired.";
5557
+ return t("messageTimeline.itsAccessExpired");
4020
5558
  case "personal_authority_unavailable":
4021
- return "This automation was not granted access to your personal connection.";
5559
+ return t("messageTimeline.thisAutomationWasNotGranted");
4022
5560
  case "unsupported_auth":
4023
- return "This connection cannot authenticate the configured tool endpoint.";
5561
+ return t("messageTimeline.thisConnectionCannotAuthenticateThe");
4024
5562
  case "resource_scope_unavailable":
4025
- return "This tool endpoint cannot enforce the selected repository access.";
5563
+ return t("messageTimeline.thisToolEndpointCannotEnforce");
4026
5564
  default:
4027
- return "Its connection needs attention.";
5565
+ return t("messageTimeline.itsConnectionNeedsAttention");
4028
5566
  }
4029
5567
  }