@opengeni/react 6.37.3 → 6.37.4-canary.45279257475001

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 (1192) hide show
  1. package/dist/app/app-state.js +32 -32
  2. package/dist/app/components/Composer.css +1 -1
  3. package/dist/app/components/Composer.css.map +1 -1
  4. package/dist/app/components/Composer.js +44 -43
  5. package/dist/app/components/add-card-dialog.js +3 -2
  6. package/dist/app/components/add-card-dialog.js.map +1 -1
  7. package/dist/app/components/add-card.js +3 -3
  8. package/dist/app/components/agent/agent-capability-picker.js +9 -9
  9. package/dist/app/components/agents/agent-can-use.js +48 -47
  10. package/dist/app/components/agents/agent-form-page.js +143 -142
  11. package/dist/app/components/agents/agent-form-page.js.map +1 -1
  12. package/dist/app/components/agents/agent-page.js +124 -123
  13. package/dist/app/components/agents/agent-setup-sections.js +78 -77
  14. package/dist/app/components/agents/agent-skills.js +14 -13
  15. package/dist/app/components/agents/agent-trigger-chat-field.js +6 -6
  16. package/dist/app/components/agents/agent-trigger-dialog.js +34 -33
  17. package/dist/app/components/agents/agent-trigger-picker.js +8 -8
  18. package/dist/app/components/agents/agent-trigger-repositories.js +16 -16
  19. package/dist/app/components/agents/agents-page.js +96 -95
  20. package/dist/app/components/agents/agents-page.js.map +1 -1
  21. package/dist/app/components/agents/composer-agent-chip.js +60 -59
  22. package/dist/app/components/agents/session-agent-chip.js +55 -54
  23. package/dist/app/components/artifacts/app-package.js +13 -12
  24. package/dist/app/components/artifacts/artifact-browse-controls.js +3 -3
  25. package/dist/app/components/artifacts/artifact-library.js +29 -28
  26. package/dist/app/components/artifacts/artifact-page-chrome.js +1 -1
  27. package/dist/app/components/artifacts/artifact-viewer.js +67 -66
  28. package/dist/app/components/artifacts/artifact-viewer.js.map +1 -1
  29. package/dist/app/components/artifacts/chat-interactive-block.js +30 -29
  30. package/dist/app/components/artifacts/chat-interactive-block.js.map +1 -1
  31. package/dist/app/components/artifacts/copy-artifact-link.js +2 -2
  32. package/dist/app/components/artifacts/file-reach-dialog.js +13 -12
  33. package/dist/app/components/artifacts/inline-chat-image.js +52 -51
  34. package/dist/app/components/artifacts/ready-made-apps.js +13 -12
  35. package/dist/app/components/artifacts/retained-file-preview.js +58 -57
  36. package/dist/app/components/artifacts/retained-text-preview.js +8 -8
  37. package/dist/app/components/artifacts/site-actions.js +12 -12
  38. package/dist/app/components/artifacts/site-audience.js +9 -8
  39. package/dist/app/components/artifacts/site-conversations.js +35 -35
  40. package/dist/app/components/artifacts/site-data.js +27 -26
  41. package/dist/app/components/artifacts/site-public-link.js +3 -3
  42. package/dist/app/components/artifacts/site-publishing-page.js +69 -68
  43. package/dist/app/components/artifacts/site-publishing.js +54 -53
  44. package/dist/app/components/artifacts/site-settings.js +68 -67
  45. package/dist/app/components/artifacts/site-version-menu.js +10 -10
  46. package/dist/app/components/billing-class-mark.js +7 -7
  47. package/dist/app/components/capabilities/capability-detail-sheet.js +18 -17
  48. package/dist/app/components/capabilities/capability-logo-source.js +29 -28
  49. package/dist/app/components/capabilities/capability-logo.js +1 -1
  50. package/dist/app/components/capabilities/connection-account-picker.js +2 -2
  51. package/dist/app/components/capabilities/connection-ownership-selector.js +4 -3
  52. package/dist/app/components/capabilities/connector-tool-permissions.js +8 -8
  53. package/dist/app/components/capabilities/detail-dialog.js +3 -2
  54. package/dist/app/components/capabilities/native-connect-setup.js +32 -31
  55. package/dist/app/components/capabilities/own-logins-shared-heads-up.js +6 -6
  56. package/dist/app/components/capabilities/perform-capability-action.js +2 -2
  57. package/dist/app/components/capabilities/prepared-mcp-setup-card.js +32 -31
  58. package/dist/app/components/capabilities/session-capability-card.css +1 -1
  59. package/dist/app/components/capabilities/session-capability-card.css.map +1 -1
  60. package/dist/app/components/capabilities/session-capability-card.js +136 -135
  61. package/dist/app/components/capabilities/session-capability-card.js.map +1 -1
  62. package/dist/app/components/capabilities/session-chrome-card.css +1 -1
  63. package/dist/app/components/capabilities/session-chrome-card.css.map +1 -1
  64. package/dist/app/components/capabilities/session-chrome-card.js +49 -48
  65. package/dist/app/components/capabilities/session-connect-inputs-card.js +34 -33
  66. package/dist/app/components/capabilities/session-custom-mcp-card.js +39 -38
  67. package/dist/app/components/capabilities/session-github-card.js +45 -44
  68. package/dist/app/components/capabilities/session-machine-card.css +1 -1
  69. package/dist/app/components/capabilities/session-machine-card.css.map +1 -1
  70. package/dist/app/components/capabilities/session-machine-card.js +50 -49
  71. package/dist/app/components/capabilities/session-personal-github-card.js +33 -32
  72. package/dist/app/components/capabilities/session-plugin-card.js +21 -20
  73. package/dist/app/components/capabilities/use-capabilities-catalog.js +1 -1
  74. package/dist/app/components/capabilities/use-connection-accounts.js +2 -2
  75. package/dist/app/components/chat-payment-pages.js +2 -2
  76. package/dist/app/components/command-menu/chat-status.js +26 -26
  77. package/dist/app/components/command-menu/chat-switcher.js +87 -86
  78. package/dist/app/components/command-menu/chat-switcher.js.map +1 -1
  79. package/dist/app/components/command-menu/command-menu.js +332 -330
  80. package/dist/app/components/command-menu/command-menu.js.map +1 -1
  81. package/dist/app/components/command-menu/shortcut-sheet.js +27 -26
  82. package/dist/app/components/command-menu/shortcut-sheet.js.map +1 -1
  83. package/dist/app/components/composer-capabilities-menu-body.js +7 -7
  84. package/dist/app/components/composer-mobile-plus-panel.js +29 -28
  85. package/dist/app/components/composer-mobile-plus-panel.js.map +1 -1
  86. package/dist/app/components/composer-mobile-plus.js +5 -4
  87. package/dist/app/components/credit-required-gate.js +7 -7
  88. package/dist/app/components/credit-required-prompt.js +25 -24
  89. package/dist/app/components/credit-required-prompt.js.map +1 -1
  90. package/dist/app/components/credits/checkout-credits-celebration.js +4 -3
  91. package/dist/app/components/credits/checkout-return.js +4 -3
  92. package/dist/app/components/credits/checkout-return.js.map +1 -1
  93. package/dist/app/components/credits/coupon-redeem.js +1 -1
  94. package/dist/app/components/credits/credit-refusal-notice.js +7 -7
  95. package/dist/app/components/credits/own-subscription-plan-notice.js +3 -3
  96. package/dist/app/components/desktop/app-shots.css +1 -1
  97. package/dist/app/components/desktop/app-shots.css.map +1 -1
  98. package/dist/app/components/desktop/app-shots.js +10 -9
  99. package/dist/app/components/desktop/app-update.js +3 -3
  100. package/dist/app/components/desktop/computer-use.js +3 -3
  101. package/dist/app/components/desktop/this-computer.css +1 -1
  102. package/dist/app/components/desktop/this-computer.css.map +1 -1
  103. package/dist/app/components/desktop/this-computer.js +7 -6
  104. package/dist/app/components/feedback.js +11 -10
  105. package/dist/app/components/follow-up-repository-menu-body.js +13 -13
  106. package/dist/app/components/follow-up-repository-picker.js +1 -1
  107. package/dist/app/components/github-app-connect-launcher.js +3 -3
  108. package/dist/app/components/in-app-help-link.js +3 -3
  109. package/dist/app/components/knowledge/agent-learning-settings.js +3 -3
  110. package/dist/app/components/machines/connect-machine-dialog.css +1 -1
  111. package/dist/app/components/machines/connect-machine-dialog.css.map +1 -1
  112. package/dist/app/components/machines/connect-machine-dialog.js +25 -24
  113. package/dist/app/components/manual-repository-editor.js +3 -3
  114. package/dist/app/components/markdown.js +16 -15
  115. package/dist/app/components/model-identity.js +3 -3
  116. package/dist/app/components/models/models-ui.js +17 -16
  117. package/dist/app/components/models/provider-mark.js +3 -3
  118. package/dist/app/components/models/subscription-usage.js +5 -5
  119. package/dist/app/components/my-things.js +16 -15
  120. package/dist/app/components/my-things.js.map +1 -1
  121. package/dist/app/components/own-where-it-works.js +11 -10
  122. package/dist/app/components/personal-resource-attachment-surface.js +4 -4
  123. package/dist/app/components/pickers.js +11 -11
  124. package/dist/app/components/rail/channel-create-dialog.js +7 -6
  125. package/dist/app/components/rail/project-glyph.js +53 -52
  126. package/dist/app/components/rail/project-profile.js +74 -73
  127. package/dist/app/components/rail/rail-context.js +2 -2
  128. package/dist/app/components/rail/rail-sections.js +155 -154
  129. package/dist/app/components/rail/session-header.js +125 -124
  130. package/dist/app/components/rail/session-list.js +152 -151
  131. package/dist/app/components/rail/session-row-content.js +6 -6
  132. package/dist/app/components/rail/session-row-hover-details.js +36 -36
  133. package/dist/app/components/rail/session-shell.js +192 -191
  134. package/dist/app/components/rail/site-session-group-heading.js +36 -36
  135. package/dist/app/components/repository-picker.js +13 -13
  136. package/dist/app/components/secrets/session-secrets-panel.js +4 -4
  137. package/dist/app/components/session/agent-configuration-panel.js +45 -44
  138. package/dist/app/components/session/agent-configuration-panel.js.map +1 -1
  139. package/dist/app/components/session/artifact-session-page.js +7 -7
  140. package/dist/app/components/session/banners.js +20 -19
  141. package/dist/app/components/session/chat-avatar.js +53 -52
  142. package/dist/app/components/session/console-new-conversation.css +1 -1
  143. package/dist/app/components/session/console-new-conversation.css.map +1 -1
  144. package/dist/app/components/session/console-new-conversation.js +110 -109
  145. package/dist/app/components/session/descendant-requests.js +110 -109
  146. package/dist/app/components/session/descendant-requests.js.map +1 -1
  147. package/dist/app/components/session/editable-artifacts-workspace.js +60 -59
  148. package/dist/app/components/session/editable-artifacts-workspace.js.map +1 -1
  149. package/dist/app/components/session/failed-session-banner.js +29 -28
  150. package/dist/app/components/session/failed-session-banner.js.map +1 -1
  151. package/dist/app/components/session/failure-recovery-boundary.js +3 -3
  152. package/dist/app/components/session/human-input-delegation-record.js +3 -3
  153. package/dist/app/components/session/human-input.js +88 -87
  154. package/dist/app/components/session/inspector.js +146 -145
  155. package/dist/app/components/session/inspector.js.map +1 -1
  156. package/dist/app/components/session/linked-panel.js +3 -3
  157. package/dist/app/components/session/message-actions.js +11 -10
  158. package/dist/app/components/session/message-actions.js.map +1 -1
  159. package/dist/app/components/session/model-recovery-notice.js +4 -4
  160. package/dist/app/components/session/new-session-settings-menu.css +1 -1
  161. package/dist/app/components/session/new-session-settings-menu.css.map +1 -1
  162. package/dist/app/components/session/new-session-settings-menu.js +30 -29
  163. package/dist/app/components/session/new-session-setup-strip.js +56 -55
  164. package/dist/app/components/session/pull-request-panel.js +25 -24
  165. package/dist/app/components/session/sandbox-recovery-actions.js +5 -4
  166. package/dist/app/components/session/sandbox-switcher.js +22 -22
  167. package/dist/app/components/session/sandbox-workspace.js +120 -119
  168. package/dist/app/components/session/search-markdown-highlight.js +17 -16
  169. package/dist/app/components/session/search-results-view.js +18 -17
  170. package/dist/app/components/session/session-admin-access.js +14 -13
  171. package/dist/app/components/session/session-admission-notice.js +11 -11
  172. package/dist/app/components/session/session-avatar-picker.js +60 -59
  173. package/dist/app/components/session/session-avatar.js +55 -54
  174. package/dist/app/components/session/session-machine-access-notice.js +11 -11
  175. package/dist/app/components/session/session-profile-dialog.js +71 -70
  176. package/dist/app/components/session/session-profile-editor.js +72 -71
  177. package/dist/app/components/session/session-retention.js +6 -6
  178. package/dist/app/components/session/session-search-dialog.js +21 -20
  179. package/dist/app/components/session/session-search-dialog.js.map +1 -1
  180. package/dist/app/components/session/session-skill-reviews.js +5 -5
  181. package/dist/app/components/session/session-tenancy-control.js +32 -31
  182. package/dist/app/components/session/session-tenancy-control.js.map +1 -1
  183. package/dist/app/components/session/session-unattended-setting.js +1 -1
  184. package/dist/app/components/session/session-usage-limit-section.js +11 -11
  185. package/dist/app/components/session/share-chat-dialog.js +11 -10
  186. package/dist/app/components/session/subagents.js +23 -23
  187. package/dist/app/components/session/subscription-account-indicator.js +25 -25
  188. package/dist/app/components/session/subscription-account-menu.js +7 -7
  189. package/dist/app/components/session-connectors-menu-body.js +10 -10
  190. package/dist/app/components/settings/row-select.js +6 -6
  191. package/dist/app/components/toaster.js +2 -2
  192. package/dist/app/components/transcription-settings.js +10 -10
  193. package/dist/app/components/ui/destructive-confirm.js +11 -10
  194. package/dist/app/components/usage/usage-entry.js +8 -8
  195. package/dist/app/components/window-bar.js +26 -26
  196. package/dist/app/components/workspace-composer-plus.js +44 -43
  197. package/dist/app/components/workspace-reach.js +6 -6
  198. package/dist/app/embed/session-app.css +1 -1
  199. package/dist/app/embed/session-app.css.map +1 -1
  200. package/dist/app/embed/session-app.js +388 -387
  201. package/dist/app/lib/actions/actions-provider.js +19 -19
  202. package/dist/app/lib/agent-capabilities.js +4 -4
  203. package/dist/app/lib/app-connect-card.js +15 -14
  204. package/dist/app/lib/app-shared-key-dialog.js +9 -8
  205. package/dist/app/lib/app-surfaces.js +2 -2
  206. package/dist/app/lib/app-sync-opt-in.js +6 -5
  207. package/dist/app/lib/codex-usage-query.js +3 -3
  208. package/dist/app/lib/composer-agent.js +2 -2
  209. package/dist/app/lib/composer-connectors.js +33 -32
  210. package/dist/app/lib/composer-send-blocking.js +2 -2
  211. package/dist/app/lib/console-site.js +8 -7
  212. package/dist/app/lib/console-text.js +2 -2
  213. package/dist/app/lib/events.js +30 -29
  214. package/dist/app/lib/failed-session-copy.js +5 -5
  215. package/dist/app/lib/feedback-capture.js +2 -2
  216. package/dist/app/lib/model-access-onboarding.js +4 -4
  217. package/dist/app/lib/move-chat-to-machine.js +5 -5
  218. package/dist/app/lib/personal-resource-attachments.js +1 -1
  219. package/dist/app/lib/session-branch-cache.js +19 -19
  220. package/dist/app/lib/session-create.js +5 -5
  221. package/dist/app/lib/session-group-pagination.js +19 -19
  222. package/dist/app/lib/session-hover-facts.js +26 -26
  223. package/dist/app/lib/session-list-dirty-scopes.js +20 -20
  224. package/dist/app/lib/session-model.js +2 -2
  225. package/dist/app/lib/session-rail.js +16 -16
  226. package/dist/app/lib/session-rename.js +3 -3
  227. package/dist/app/lib/sessions-group.js +23 -23
  228. package/dist/app/lib/site-tool-consent-dialog.js +25 -24
  229. package/dist/app/lib/site-tool-consent-dialog.js.map +1 -1
  230. package/dist/app/lib/site-tool-consent.js +1 -1
  231. package/dist/app/lib/turn-failure-analytics.js +6 -6
  232. package/dist/app/lib/use-artifact-catalog.js +2 -2
  233. package/dist/app/lib/use-duplicate-site.js +5 -5
  234. package/dist/app/lib/use-follow-up-repositories.js +7 -6
  235. package/dist/app/lib/use-personal-resource-attachment.js +2 -2
  236. package/dist/app/lib/use-workspace-machines.js +9 -9
  237. package/dist/app/lib/use-workspace-model-catalog.js +5 -5
  238. package/dist/app/lib/use-workspace-rigs.js +6 -6
  239. package/dist/app/lib/workspace-navigation-preference.js +5 -5
  240. package/dist/app/lib/workspace-scope-context.js +4 -4
  241. package/dist/app/routes/app-page-view.js +22 -21
  242. package/dist/app/routes/app-page-view.js.map +1 -1
  243. package/dist/app/routes/app-page.js +2 -2
  244. package/dist/app/routes/artifacts.js +153 -152
  245. package/dist/app/routes/artifacts.js.map +1 -1
  246. package/dist/app/routes/retained-artifact.js +106 -105
  247. package/dist/app/routes/retained-artifact.js.map +1 -1
  248. package/dist/app/routes/session-unavailable.js +6 -6
  249. package/dist/app/routes/session.css +1 -1
  250. package/dist/app/routes/session.css.map +1 -1
  251. package/dist/app/routes/session.js +246 -245
  252. package/dist/app/routes/sessions-index-hydration.js +6 -6
  253. package/dist/app/routes/sessions-index.css +1 -1
  254. package/dist/app/routes/sessions-index.css.map +1 -1
  255. package/dist/app/routes/sessions-index.js +202 -201
  256. package/dist/app/routes/site-view.css +1 -1
  257. package/dist/app/routes/site-view.css.map +1 -1
  258. package/dist/app/routes/site-view.js +195 -194
  259. package/dist/app/routes/site-view.js.map +1 -1
  260. package/dist/artifacts-document.js +4 -4
  261. package/dist/artifacts-presentation.js +9 -8
  262. package/dist/artifacts-spreadsheet.js +4 -4
  263. package/dist/artifacts.js +51 -50
  264. package/dist/automation-model.js +6 -6
  265. package/dist/automations.js +71 -70
  266. package/dist/automations.js.map +1 -1
  267. package/dist/browser-viewer-O5FJOWWI.js +23 -0
  268. package/dist/chat-interactive-block-TQTOUHRC.js +22 -0
  269. package/dist/chunk-23TTCFRP.js +3690 -0
  270. package/dist/chunk-2BOFLWNJ.js +129 -0
  271. package/dist/chunk-2NO5QJCL.js +438 -0
  272. package/dist/chunk-2NO5QJCL.js.map +1 -0
  273. package/dist/chunk-3DMD2KHT.js +851 -0
  274. package/dist/chunk-3DOISS3I.js +132 -0
  275. package/dist/chunk-3KWTXE4O.js +199 -0
  276. package/dist/chunk-3TRERIPD.js +93 -0
  277. package/dist/chunk-3UXBTL7Z.js +92 -0
  278. package/dist/chunk-3XEKXNB4.js +283 -0
  279. package/dist/chunk-3ZJUQG4K.js +428 -0
  280. package/dist/chunk-42WTAUUW.js +335 -0
  281. package/dist/chunk-46ZC5VNC.js +38 -0
  282. package/dist/chunk-4BVEFGX7.js +166 -0
  283. package/dist/chunk-4IOFV4S4.js +401 -0
  284. package/dist/chunk-4ISXBLJV.js +137 -0
  285. package/dist/chunk-4L2MBYLH.js +283 -0
  286. package/dist/chunk-4N3B25HA.js +850 -0
  287. package/dist/chunk-4N3B25HA.js.map +1 -0
  288. package/dist/chunk-4NWUZ6SL.js +176 -0
  289. package/dist/chunk-4QVX6CTT.js +318 -0
  290. package/dist/chunk-4YARO4Y5.js +2984 -0
  291. package/dist/chunk-4Z7BPBS7.js +34 -0
  292. package/dist/chunk-55ILMX6B.js +794 -0
  293. package/dist/chunk-57OAQTWD.js +103 -0
  294. package/dist/chunk-5BRPLALX.js +380 -0
  295. package/dist/chunk-5BRPLALX.js.map +1 -0
  296. package/dist/chunk-5EF4JI6Q.js +214 -0
  297. package/dist/chunk-5EF4JI6Q.js.map +1 -0
  298. package/dist/chunk-5GXX3NI7.js +46 -0
  299. package/dist/chunk-5VE3PPSK.js +353 -0
  300. package/dist/chunk-62T2ZPD5.js +266 -0
  301. package/dist/chunk-655JT4VH.js +251 -0
  302. package/dist/chunk-65OPNLE4.js +505 -0
  303. package/dist/chunk-67PIP46J.js +229 -0
  304. package/dist/chunk-6CAK65QV.js +211 -0
  305. package/dist/chunk-6CDBX3XG.js +33 -0
  306. package/dist/chunk-6D3D2JWY.js +278 -0
  307. package/dist/chunk-6DGQB6GT.js +107 -0
  308. package/dist/chunk-6NFK3J2O.js +188 -0
  309. package/dist/chunk-6R3QX3AC.js +538 -0
  310. package/dist/chunk-6S5OMLAL.js +400 -0
  311. package/dist/chunk-6SG2VVVB.js +249 -0
  312. package/dist/chunk-6U57GGJI.js +110 -0
  313. package/dist/chunk-6V2PEFPS.js +98 -0
  314. package/dist/chunk-6VASZZVV.js +3321 -0
  315. package/dist/chunk-7BBYH5R5.js +168 -0
  316. package/dist/chunk-7EO3T3IX.js +209 -0
  317. package/dist/chunk-7EZQ6EKM.js +158 -0
  318. package/dist/chunk-7HI53NPP.js +15 -0
  319. package/dist/chunk-7J4BFENI.js +37 -0
  320. package/dist/chunk-7LSGNY2L.js +114 -0
  321. package/dist/chunk-7MMONDFK.js +1236 -0
  322. package/dist/chunk-7MWPBGDX.js +175 -0
  323. package/dist/chunk-7NSDIQMY.js +371 -0
  324. package/dist/chunk-7XPDLT5G.js +231 -0
  325. package/dist/chunk-A3BCF4MV.js +378 -0
  326. package/dist/chunk-A5GX3CAE.js +849 -0
  327. package/dist/chunk-AAHQJWEP.js +515 -0
  328. package/dist/chunk-AAWEPZOG.js +144 -0
  329. package/dist/chunk-ABRT345L.js +598 -0
  330. package/dist/chunk-AJ7KJ7XZ.js +4519 -0
  331. package/dist/chunk-AJ7KJ7XZ.js.map +1 -0
  332. package/dist/chunk-ANXFE2EP.js +91 -0
  333. package/dist/chunk-AQNE4XWU.js +271 -0
  334. package/dist/chunk-AV2OMWDS.js +4979 -0
  335. package/dist/chunk-AYHMHAU5.js +1019 -0
  336. package/dist/chunk-AZ637XK3.js +50 -0
  337. package/dist/chunk-B6AH43UQ.js +2434 -0
  338. package/dist/chunk-BBECLK22.js +383 -0
  339. package/dist/chunk-BWYPJG3P.js +158 -0
  340. package/dist/chunk-CI7F4Y26.js +396 -0
  341. package/dist/chunk-CNLSXEQC.js +931 -0
  342. package/dist/chunk-COCB4HE3.js +65 -0
  343. package/dist/chunk-CPEVLG3B.js +357 -0
  344. package/dist/chunk-CRHH5C6Z.js +5920 -0
  345. package/dist/chunk-CRHH5C6Z.js.map +1 -0
  346. package/dist/chunk-CVC4RO7D.js +155 -0
  347. package/dist/chunk-CY6RLRHJ.js +3110 -0
  348. package/dist/chunk-D3WLSMCL.js +117 -0
  349. package/dist/chunk-D7SSOJEU.js +178 -0
  350. package/dist/chunk-DBOD5WXT.js +818 -0
  351. package/dist/chunk-DFWSRIFL.js +162 -0
  352. package/dist/chunk-DITZUBOK.js +126 -0
  353. package/dist/chunk-DKD2ZZSJ.js +287 -0
  354. package/dist/chunk-DOJWHSRD.js +246 -0
  355. package/dist/chunk-DR6LZXJI.js +187 -0
  356. package/dist/chunk-DV73XOVB.js +650 -0
  357. package/dist/chunk-DYO7DNDD.js +316 -0
  358. package/dist/chunk-DYZASWWT.js +234 -0
  359. package/dist/chunk-EAJHD44A.js +573 -0
  360. package/dist/chunk-EAJHD44A.js.map +1 -0
  361. package/dist/chunk-EC5HUNXI.js +1263 -0
  362. package/dist/chunk-ECQ7FV3E.js +247 -0
  363. package/dist/chunk-ECVCSZWY.js +406 -0
  364. package/dist/chunk-EMXO5HCY.js +333 -0
  365. package/dist/chunk-ENJX5TAA.js +265 -0
  366. package/dist/chunk-EQSYPIAI.js +66 -0
  367. package/dist/chunk-EV73XMK3.js +1152 -0
  368. package/dist/chunk-F2SGC74A.js +2553 -0
  369. package/dist/chunk-F3LIUDXN.js +738 -0
  370. package/dist/chunk-F3LIUDXN.js.map +1 -0
  371. package/dist/chunk-F5ABIEWA.js +1029 -0
  372. package/dist/chunk-F5ABIEWA.js.map +1 -0
  373. package/dist/chunk-F5DEBD4D.js +230 -0
  374. package/dist/chunk-F6JJBUQ2.js +566 -0
  375. package/dist/chunk-FEVZDJOZ.js +1024 -0
  376. package/dist/chunk-FF22IUY3.js +121 -0
  377. package/dist/chunk-FILRDNUQ.js +256 -0
  378. package/dist/chunk-FLB3BP2E.js +227 -0
  379. package/dist/chunk-FZVMMHPC.js +639 -0
  380. package/dist/chunk-G6D5NVWM.js +112 -0
  381. package/dist/chunk-GGH5STTP.js +192 -0
  382. package/dist/chunk-GGHX6GS7.js +187 -0
  383. package/dist/chunk-GIHE7U3Y.js +174 -0
  384. package/dist/chunk-GO5VIAA7.js +264 -0
  385. package/dist/chunk-GSK637QS.js +27 -0
  386. package/dist/chunk-HBYO34CP.js +56 -0
  387. package/dist/chunk-HFROJDFQ.js +118 -0
  388. package/dist/chunk-HGEDFQ7G.js +251 -0
  389. package/dist/chunk-HH3QTFGV.js +1356 -0
  390. package/dist/chunk-HHFFPE67.js +220 -0
  391. package/dist/chunk-HHYTB5OL.js +246 -0
  392. package/dist/chunk-HPKWAHHI.js +48 -0
  393. package/dist/chunk-HSPOCEGP.js +373 -0
  394. package/dist/chunk-IC74VN2I.js +608 -0
  395. package/dist/chunk-ICSQO2CV.js +1021 -0
  396. package/dist/chunk-IEZE7SL6.js +3070 -0
  397. package/dist/chunk-IGHNTARW.js +170 -0
  398. package/dist/chunk-IKYS56PQ.js +138 -0
  399. package/dist/chunk-IO474NRY.js +56 -0
  400. package/dist/chunk-IP2CCFAV.js +723 -0
  401. package/dist/chunk-IT5GF54F.js +3851 -0
  402. package/dist/chunk-IX67G5FD.js +270 -0
  403. package/dist/chunk-IXNJK7KJ.js +292 -0
  404. package/dist/chunk-IZWTARYT.js +276 -0
  405. package/dist/chunk-JBV2HY43.js +108 -0
  406. package/dist/chunk-JE62XK5K.js +33 -0
  407. package/dist/chunk-JFAWCALM.js +85 -0
  408. package/dist/chunk-JQGPATQZ.js +83 -0
  409. package/dist/chunk-JYZGX5UZ.js +274 -0
  410. package/dist/chunk-K227GMSM.js +72 -0
  411. package/dist/chunk-KB2O7JIJ.js +449 -0
  412. package/dist/chunk-KT6GC67G.js +12 -0
  413. package/dist/chunk-KTGKGHEA.js +75 -0
  414. package/dist/chunk-KU77XHWB.js +285 -0
  415. package/dist/chunk-KZIRVLCM.js +175 -0
  416. package/dist/chunk-L3DUSTRN.js +259 -0
  417. package/dist/chunk-L6WVCO6D.js +61 -0
  418. package/dist/chunk-L7PCZEEG.js +79 -0
  419. package/dist/chunk-LEN2DVU6.js +311 -0
  420. package/dist/chunk-LGOQW2CE.js +191 -0
  421. package/dist/chunk-LK2JO72Y.js +389 -0
  422. package/dist/chunk-LSJPFW34.js +3996 -0
  423. package/dist/chunk-LSJPFW34.js.map +1 -0
  424. package/dist/chunk-LXLHIOJM.js +584 -0
  425. package/dist/chunk-LYQQ4VBE.js +1333 -0
  426. package/dist/chunk-M22ZHQ7S.js +1628 -0
  427. package/dist/chunk-M5RKFV6K.js +20 -0
  428. package/dist/chunk-MCPKUVMQ.js +99 -0
  429. package/dist/chunk-MDGNCUAC.js +145 -0
  430. package/dist/chunk-MFLU3466.js +99 -0
  431. package/dist/chunk-MIUJ3EH5.js +60 -0
  432. package/dist/chunk-MO3XJQN2.js +629 -0
  433. package/dist/chunk-MTHAYXDH.js +107 -0
  434. package/dist/chunk-MVYQDBE6.js +79 -0
  435. package/dist/chunk-NA7VZQPL.js +307 -0
  436. package/dist/chunk-ND6FWOSO.js +2431 -0
  437. package/dist/chunk-NGTCSS53.js +24 -0
  438. package/dist/chunk-NGTCSS53.js.map +1 -0
  439. package/dist/chunk-NIFPH34L.js +351 -0
  440. package/dist/chunk-NKYC6WHQ.js +103 -0
  441. package/dist/chunk-NML7VKLU.js +391 -0
  442. package/dist/chunk-NPAWLKJB.js +41 -0
  443. package/dist/chunk-NQSKI2YD.js +1185 -0
  444. package/dist/chunk-NXQFBC22.js +114 -0
  445. package/dist/chunk-NXRZMHVM.js +43 -0
  446. package/dist/chunk-NYU5DE4K.js +1309 -0
  447. package/dist/chunk-O2EEYPIZ.js +48 -0
  448. package/dist/chunk-O4TOEISQ.js +67 -0
  449. package/dist/chunk-O533L2TG.js +129 -0
  450. package/dist/chunk-O664PL2U.js +47 -0
  451. package/dist/chunk-O664PL2U.js.map +1 -0
  452. package/dist/chunk-ON6ZGJDW.js +532 -0
  453. package/dist/chunk-OPELE3Z4.js +311 -0
  454. package/dist/chunk-OTSUC6PP.js +234 -0
  455. package/dist/chunk-OXM267RC.js +128 -0
  456. package/dist/chunk-OXM267RC.js.map +1 -0
  457. package/dist/chunk-OZNL5OKT.js +1184 -0
  458. package/dist/chunk-P3PDKPLK.js +432 -0
  459. package/dist/chunk-PCZBYN2H.js +372 -0
  460. package/dist/chunk-PIPXXQFV.js +57 -0
  461. package/dist/chunk-PMUZUPPE.js +131 -0
  462. package/dist/chunk-PN52EIFV.js +113 -0
  463. package/dist/chunk-PPQJIVGM.js +175 -0
  464. package/dist/chunk-PQYFOTNI.js +469 -0
  465. package/dist/chunk-PUX4YJAW.js +1095 -0
  466. package/dist/chunk-PYMQM65Y.js +125 -0
  467. package/dist/chunk-Q5UO7GT5.js +404 -0
  468. package/dist/chunk-QA5UNVHD.js +85 -0
  469. package/dist/chunk-QDZR7FXG.js +215 -0
  470. package/dist/chunk-QNOWKKZ4.js +40 -0
  471. package/dist/chunk-QUXQYYZO.js +73 -0
  472. package/dist/chunk-QVOTPOXK.js +29 -0
  473. package/dist/chunk-R2DSOIME.js +772 -0
  474. package/dist/chunk-RFQQXXJ6.js +366 -0
  475. package/dist/chunk-RLWI34XM.js +27 -0
  476. package/dist/chunk-RMWCGSEP.js +124 -0
  477. package/dist/chunk-ROTEQD2Z.js +441 -0
  478. package/dist/chunk-RPCWZFP7.js +296 -0
  479. package/dist/chunk-RW5QRWVI.js +141 -0
  480. package/dist/chunk-RZZHOHL6.js +5089 -0
  481. package/dist/chunk-S5STZCBZ.js +133 -0
  482. package/dist/chunk-SD4A5P24.js +1803 -0
  483. package/dist/chunk-SJM4TCWJ.js +197 -0
  484. package/dist/chunk-SJXK56WZ.js +905 -0
  485. package/dist/chunk-SJXK56WZ.js.map +1 -0
  486. package/dist/chunk-SQYTYXR4.js +100 -0
  487. package/dist/chunk-SRDHDIRQ.js +177 -0
  488. package/dist/chunk-SVC674IM.js +263 -0
  489. package/dist/chunk-SYYFA7W7.js +23 -0
  490. package/dist/chunk-T2UUHB7V.js +1187 -0
  491. package/dist/chunk-TBOH54QP.js +298 -0
  492. package/dist/chunk-TG2GO424.js +196 -0
  493. package/dist/chunk-TOJNLC42.js +107 -0
  494. package/dist/chunk-TW75KM7T.js +412 -0
  495. package/dist/chunk-TWWAPJYE.js +26 -0
  496. package/dist/chunk-UARZCGWU.js +202 -0
  497. package/dist/chunk-UCNTAS2U.js +2580 -0
  498. package/dist/chunk-UD7IARSL.js +162 -0
  499. package/dist/chunk-UDKZKGUQ.js +379 -0
  500. package/dist/chunk-UEUYUUZA.js +3183 -0
  501. package/dist/chunk-UEUYUUZA.js.map +1 -0
  502. package/dist/chunk-UJRSZ6ZB.js +391 -0
  503. package/dist/chunk-UTM23O3G.js +50 -0
  504. package/dist/chunk-UUJSS56V.js +4570 -0
  505. package/dist/chunk-UWSF733U.js +42 -0
  506. package/dist/chunk-V4ZYJWU3.js +386 -0
  507. package/dist/chunk-VEIT2EGK.js +207 -0
  508. package/dist/chunk-VGG6DOTN.js +172 -0
  509. package/dist/chunk-VGSGAQJX.js +82 -0
  510. package/dist/chunk-VHK5CBIG.js +2317 -0
  511. package/dist/chunk-VLA2DTYG.js +154 -0
  512. package/dist/chunk-VSN6XKZ5.js +278 -0
  513. package/dist/chunk-VW6TOTDQ.js +111 -0
  514. package/dist/chunk-W3HKBWPM.js +406 -0
  515. package/dist/chunk-WDYM5SFM.js +73 -0
  516. package/dist/chunk-WJ4AZ2AR.js +2551 -0
  517. package/dist/chunk-WMQHP4E3.js +214 -0
  518. package/dist/chunk-WP5A6F6P.js +269 -0
  519. package/dist/chunk-WUR2DYJX.js +527 -0
  520. package/dist/chunk-WUR2DYJX.js.map +1 -0
  521. package/dist/chunk-WWQH3L6M.js +407 -0
  522. package/dist/chunk-WYIC3CXE.js +157 -0
  523. package/dist/chunk-WYIC3CXE.js.map +1 -0
  524. package/dist/chunk-X3T6ULUZ.js +297 -0
  525. package/dist/chunk-XA32OUL4.js +52 -0
  526. package/dist/chunk-XCICIQIE.js +113 -0
  527. package/dist/chunk-XHRIUCBD.js +138 -0
  528. package/dist/chunk-XJBWVT5X.js +1177 -0
  529. package/dist/chunk-XKQRWJFE.js +270 -0
  530. package/dist/chunk-XN3EVUB5.js +134 -0
  531. package/dist/chunk-XT6GBN2G.js +828 -0
  532. package/dist/chunk-XYVDTM4D.js +184 -0
  533. package/dist/chunk-XZO5X3KH.js +84 -0
  534. package/dist/chunk-Y34DIEOG.js +201 -0
  535. package/dist/chunk-YAIYUFCX.js +114 -0
  536. package/dist/chunk-YFLRBEDS.js +200 -0
  537. package/dist/chunk-YIKMBS4B.js +10053 -0
  538. package/dist/chunk-YIKMBS4B.js.map +1 -0
  539. package/dist/chunk-YQX227EF.js +403 -0
  540. package/dist/chunk-YVAB57JZ.js +340 -0
  541. package/dist/chunk-YWHSODBB.js +250 -0
  542. package/dist/chunk-YWJHCJQW.js +218 -0
  543. package/dist/chunk-Z37DSW2K.js +570 -0
  544. package/dist/chunk-ZELN2B72.js +399 -0
  545. package/dist/chunk-ZFGGR2JW.js +236 -0
  546. package/dist/chunk-ZL7SEED7.js +773 -0
  547. package/dist/composer.js +37 -36
  548. package/dist/computer-viewer-CNYFTUGF.js +21 -0
  549. package/dist/connect.js +31 -30
  550. package/dist/connection-step-up-EZRZW2LY.js +147 -0
  551. package/dist/connection-step-up-EZRZW2LY.js.map +1 -0
  552. package/dist/desktop-dictation.js +24 -24
  553. package/dist/desktop.js +2 -2
  554. package/dist/editor.js +2 -2
  555. package/dist/embedded-new-voice-A56WDECM.js +25 -0
  556. package/dist/embedded-voice-CBTSMIWW.js +25 -0
  557. package/dist/fleet-decision-row-6PQTGI2U.js +361 -0
  558. package/dist/in-chat-connect-model.js +5 -5
  559. package/dist/index.js +299 -298
  560. package/dist/interaction.js +9 -9
  561. package/dist/latest-question-F3VPDR7U.js +1 -1
  562. package/dist/lib/modal-layer.d.ts +11 -0
  563. package/dist/machine-request-model.js +1 -1
  564. package/dist/machines.js +8 -8
  565. package/dist/meetings-recorder.js +1 -1
  566. package/dist/meetings.js +117 -116
  567. package/dist/meetings.js.map +1 -1
  568. package/dist/messages/en.d.ts +1 -0
  569. package/dist/messages.js +1 -1
  570. package/dist/model-policy-picker-menu-ZU72JATS.js +23 -0
  571. package/dist/payment-page-card-5VEUANFD.js +227 -0
  572. package/dist/payment-page-card-5VEUANFD.js.map +1 -0
  573. package/dist/platform-activity-row-5IQT6R5Z.js +156 -0
  574. package/dist/queue-surface-implementation-TPCJ4R6N.js +933 -0
  575. package/dist/queue-surface-implementation-TPCJ4R6N.js.map +1 -0
  576. package/dist/realtime.js +17 -17
  577. package/dist/recorder-host-G5M676VM.js +80 -0
  578. package/dist/recordings.js +3 -3
  579. package/dist/sandbox-files-HCXOP6ZO.js +29 -0
  580. package/dist/session-app.css +1 -1
  581. package/dist/session-app.css.map +1 -1
  582. package/dist/session-app.js +388 -387
  583. package/dist/session-connect-cards-MYJRQWSA.js +28 -0
  584. package/dist/session-list-model.js +2 -2
  585. package/dist/session-realtime-YFVGQFJK.js +30 -0
  586. package/dist/session-realtime.js +2 -2
  587. package/dist/session-ui.js +96 -95
  588. package/dist/session.js +42 -42
  589. package/dist/sites.js +3 -3
  590. package/dist/terminal.js +2 -2
  591. package/dist/this-computer.js +4 -3
  592. package/dist/timeline-annotation-markers-5ELTFV5B.js +157 -0
  593. package/dist/timeline-annotation-selection-XHUOFRIY.js +208 -0
  594. package/dist/timeline-annotations-dialog-X2VNDYZ4.js +283 -0
  595. package/dist/timeline-model.js +58 -58
  596. package/dist/ui/access-list.js +24 -23
  597. package/dist/ui/access-list.js.map +1 -1
  598. package/dist/ui/cadence-picker.js +7 -7
  599. package/dist/ui/choice-cards.js +3 -3
  600. package/dist/ui/confirm-dialog.js +4 -3
  601. package/dist/ui/copy-field.js +3 -3
  602. package/dist/ui/detail-page.js +6 -5
  603. package/dist/ui/detail-sheet.js +6 -5
  604. package/dist/ui/dialog.js +2 -1
  605. package/dist/ui/diff-view.js +3 -3
  606. package/dist/ui/disclosure.js +7 -6
  607. package/dist/ui/email-chips-input.js +3 -3
  608. package/dist/ui/field.js +2 -2
  609. package/dist/ui/flush-form-page.js +8 -7
  610. package/dist/ui/form-dialog.js +7 -6
  611. package/dist/ui/list-row.js +6 -6
  612. package/dist/ui/load-failure.js +3 -3
  613. package/dist/ui/relative-time.js +3 -3
  614. package/dist/ui/revision-history.js +13 -13
  615. package/dist/ui/role-select.js +12 -11
  616. package/dist/ui/select-menu.js +5 -5
  617. package/dist/ui/settings-nav.js +6 -6
  618. package/dist/ui/sheet.js +3 -2
  619. package/dist/ui/usage-meter.js +4 -4
  620. package/dist/usage.js +3 -3
  621. package/dist/workbench.js +11 -11
  622. package/package.json +6 -5
  623. package/src/app/components/command-menu/command-menu.tsx +232 -228
  624. package/src/components/automations/automation-model.ts +1 -0
  625. package/src/components/file-browser.tsx +69 -64
  626. package/src/components/session-capability-frame.tsx +36 -34
  627. package/src/components/this-computer/this-computer-setup.tsx +36 -29
  628. package/src/lib/modal-layer.tsx +33 -0
  629. package/src/messages/en.ts +1 -0
  630. package/src/timeline/screenshot-lightbox.tsx +137 -128
  631. package/src/ui/detail-sheet.tsx +44 -40
  632. package/src/ui/dialog.tsx +39 -35
  633. package/src/ui/form-dialog-layer.test.tsx +4 -3
  634. package/src/ui/form-dialog.tsx +28 -26
  635. package/src/ui/sheet.tsx +36 -46
  636. package/styles/compiled.css +57 -12
  637. package/styles/index.css +19 -0
  638. package/styles/this-computer.css +1 -1
  639. package/dist/browser-viewer-J6O65JXH.js +0 -23
  640. package/dist/chat-interactive-block-R5JEJYMR.js +0 -22
  641. package/dist/chunk-236GMLCR.js +0 -50
  642. package/dist/chunk-24S44WBL.js +0 -200
  643. package/dist/chunk-27HN57HE.js +0 -274
  644. package/dist/chunk-2FLGURHP.js +0 -297
  645. package/dist/chunk-2SH6CLOR.js +0 -378
  646. package/dist/chunk-2XZ3EUSP.js +0 -505
  647. package/dist/chunk-2ZC62PY4.js +0 -113
  648. package/dist/chunk-36YTBVYF.js +0 -197
  649. package/dist/chunk-3775TQE5.js +0 -10053
  650. package/dist/chunk-3775TQE5.js.map +0 -1
  651. package/dist/chunk-3CF2B2LD.js +0 -110
  652. package/dist/chunk-3GENISSH.js +0 -129
  653. package/dist/chunk-3IEVQMGO.js +0 -2431
  654. package/dist/chunk-3N3EN7FA.js +0 -34
  655. package/dist/chunk-3NMKLLEB.js +0 -218
  656. package/dist/chunk-3VSKLEUE.js +0 -4570
  657. package/dist/chunk-3X4HTUUR.js +0 -538
  658. package/dist/chunk-3XHPCZ6N.js +0 -380
  659. package/dist/chunk-3XHPCZ6N.js.map +0 -1
  660. package/dist/chunk-4GFLP4OY.js +0 -131
  661. package/dist/chunk-4GUPD7CJ.js +0 -234
  662. package/dist/chunk-4OGDD2EM.js +0 -2434
  663. package/dist/chunk-4T2RJ2HY.js +0 -93
  664. package/dist/chunk-4XEPZARK.js +0 -391
  665. package/dist/chunk-4YJGB22T.js +0 -570
  666. package/dist/chunk-4YNWA5YG.js +0 -236
  667. package/dist/chunk-4ZRGFCSP.js +0 -5919
  668. package/dist/chunk-4ZRGFCSP.js.map +0 -1
  669. package/dist/chunk-54NTSBQO.js +0 -33
  670. package/dist/chunk-5BRK72J5.js +0 -214
  671. package/dist/chunk-5BRK72J5.js.map +0 -1
  672. package/dist/chunk-5CGZOJN7.js +0 -111
  673. package/dist/chunk-5ERDSF2C.js +0 -79
  674. package/dist/chunk-5I6CWDA6.js +0 -3176
  675. package/dist/chunk-5I6CWDA6.js.map +0 -1
  676. package/dist/chunk-5JG277OH.js +0 -92
  677. package/dist/chunk-5JOTMM3F.js +0 -3996
  678. package/dist/chunk-5JOTMM3F.js.map +0 -1
  679. package/dist/chunk-5ORXRVXV.js +0 -469
  680. package/dist/chunk-5XVOL3KH.js +0 -931
  681. package/dist/chunk-67BMBRTK.js +0 -406
  682. package/dist/chunk-67JCL67N.js +0 -84
  683. package/dist/chunk-6F34IWSA.js +0 -47
  684. package/dist/chunk-6F34IWSA.js.map +0 -1
  685. package/dist/chunk-6GCMLYER.js +0 -432
  686. package/dist/chunk-6GODDS6F.js +0 -103
  687. package/dist/chunk-6GYRHQVL.js +0 -5089
  688. package/dist/chunk-6LF2ZE52.js +0 -851
  689. package/dist/chunk-6MSTIFAL.js +0 -406
  690. package/dist/chunk-6OMREP52.js +0 -187
  691. package/dist/chunk-6P3QOMPV.js +0 -57
  692. package/dist/chunk-6SPEMI7K.js +0 -850
  693. package/dist/chunk-6SPEMI7K.js.map +0 -1
  694. package/dist/chunk-6WGJB6GO.js +0 -65
  695. package/dist/chunk-72PGXQDN.js +0 -399
  696. package/dist/chunk-75LF7LSI.js +0 -307
  697. package/dist/chunk-7CIMPDGL.js +0 -26
  698. package/dist/chunk-7EJWP62C.js +0 -271
  699. package/dist/chunk-7FY47EN2.js +0 -138
  700. package/dist/chunk-7I4KWTJS.js +0 -112
  701. package/dist/chunk-7J3TLTPI.js +0 -50
  702. package/dist/chunk-7M5DPUGZ.js +0 -215
  703. package/dist/chunk-7ZQVRVNI.js +0 -1263
  704. package/dist/chunk-A2QOUEU3.js +0 -256
  705. package/dist/chunk-A36WG3BT.js +0 -175
  706. package/dist/chunk-ADFUTR45.js +0 -138
  707. package/dist/chunk-ADNH5GSP.js +0 -1236
  708. package/dist/chunk-AGW5H6QV.js +0 -1356
  709. package/dist/chunk-AHBEBGLO.js +0 -27
  710. package/dist/chunk-AJIGRQIO.js +0 -311
  711. package/dist/chunk-AP63EUPJ.js +0 -145
  712. package/dist/chunk-ATWXYAWP.js +0 -227
  713. package/dist/chunk-AU2DT7O2.js +0 -29
  714. package/dist/chunk-AX65L6QV.js +0 -316
  715. package/dist/chunk-AZHZ2EU4.js +0 -333
  716. package/dist/chunk-B57G2C45.js +0 -357
  717. package/dist/chunk-BIQMUTVW.js +0 -1333
  718. package/dist/chunk-BOZN54YB.js +0 -149
  719. package/dist/chunk-BOZN54YB.js.map +0 -1
  720. package/dist/chunk-BPCI4ZGR.js +0 -4979
  721. package/dist/chunk-BRJLN3ZL.js +0 -67
  722. package/dist/chunk-BY7AWWDB.js +0 -177
  723. package/dist/chunk-CBSBNUGV.js +0 -523
  724. package/dist/chunk-CBSBNUGV.js.map +0 -1
  725. package/dist/chunk-CGS44LYC.js +0 -1022
  726. package/dist/chunk-CGS44LYC.js.map +0 -1
  727. package/dist/chunk-CHKHQHOO.js +0 -3070
  728. package/dist/chunk-CSGKUDNB.js +0 -1024
  729. package/dist/chunk-CZPN2HP3.js +0 -441
  730. package/dist/chunk-D2VP4C5B.js +0 -515
  731. package/dist/chunk-D32VVOBJ.js +0 -738
  732. package/dist/chunk-D32VVOBJ.js.map +0 -1
  733. package/dist/chunk-D4AF4SOJ.js +0 -246
  734. package/dist/chunk-DCML4SXQ.js +0 -201
  735. package/dist/chunk-DECSYLBP.js +0 -572
  736. package/dist/chunk-DECSYLBP.js.map +0 -1
  737. package/dist/chunk-DEKCTHXM.js +0 -639
  738. package/dist/chunk-DGS62JWP.js +0 -828
  739. package/dist/chunk-DHXRMZPQ.js +0 -276
  740. package/dist/chunk-DJ4X4U4A.js +0 -1021
  741. package/dist/chunk-DLMMQMKZ.js +0 -2551
  742. package/dist/chunk-DWPE3Y7M.js +0 -144
  743. package/dist/chunk-EFD4DD3E.js +0 -113
  744. package/dist/chunk-EGSRY63C.js +0 -251
  745. package/dist/chunk-EIVA3MAH.js +0 -85
  746. package/dist/chunk-EJYHPNXD.js +0 -103
  747. package/dist/chunk-EQ263DHZ.js +0 -27
  748. package/dist/chunk-EVJ42E62.js +0 -137
  749. package/dist/chunk-EW3N5SCT.js +0 -1628
  750. package/dist/chunk-F47X7XPQ.js +0 -124
  751. package/dist/chunk-F4ESDJTE.js +0 -400
  752. package/dist/chunk-F7NV3EL5.js +0 -2580
  753. package/dist/chunk-FFWVFU6S.js +0 -48
  754. package/dist/chunk-FPPPLIGK.js +0 -1184
  755. package/dist/chunk-FUJ6DWRZ.js +0 -207
  756. package/dist/chunk-FWEMP52Y.js +0 -199
  757. package/dist/chunk-FX4HG4FR.js +0 -37
  758. package/dist/chunk-FZOK37SC.js +0 -155
  759. package/dist/chunk-GBGJIR6F.js +0 -404
  760. package/dist/chunk-GCURVP5U.js +0 -211
  761. package/dist/chunk-GFMRMSFN.js +0 -196
  762. package/dist/chunk-GH4VY3H5.js +0 -178
  763. package/dist/chunk-GJFTPSGN.js +0 -278
  764. package/dist/chunk-GKOIWZ4C.js +0 -794
  765. package/dist/chunk-GNTEF5TL.js +0 -158
  766. package/dist/chunk-GQF2HWQE.js +0 -407
  767. package/dist/chunk-GXYS6BI3.js +0 -311
  768. package/dist/chunk-H27MS36Q.js +0 -318
  769. package/dist/chunk-H4NDK35I.js +0 -85
  770. package/dist/chunk-H6DJIEO6.js +0 -269
  771. package/dist/chunk-HC7C4ZN2.js +0 -608
  772. package/dist/chunk-HUKGLWAY.js +0 -174
  773. package/dist/chunk-HUS2QEPV.js +0 -428
  774. package/dist/chunk-HUTQJY3F.js +0 -23
  775. package/dist/chunk-HWOYJOKK.js +0 -266
  776. package/dist/chunk-I46F7LUI.js +0 -15
  777. package/dist/chunk-I57PYKVN.js +0 -386
  778. package/dist/chunk-IBI3N3P7.js +0 -56
  779. package/dist/chunk-IEUZ4ASX.js +0 -3110
  780. package/dist/chunk-IHLF7R6Q.js +0 -1309
  781. package/dist/chunk-J3XWJ2A6.js +0 -209
  782. package/dist/chunk-J45WTHTL.js +0 -229
  783. package/dist/chunk-J4OOKDRV.js +0 -40
  784. package/dist/chunk-J6YVN3W7.js +0 -162
  785. package/dist/chunk-JOZFVEBN.js +0 -2984
  786. package/dist/chunk-K7GGLL2U.js +0 -231
  787. package/dist/chunk-KDHWX7XH.js +0 -292
  788. package/dist/chunk-KMLELG4O.js +0 -46
  789. package/dist/chunk-KQY4P4EO.js +0 -373
  790. package/dist/chunk-KSDCQPJY.js +0 -12
  791. package/dist/chunk-KW4OJ3RS.js +0 -175
  792. package/dist/chunk-KWOYMJKM.js +0 -1803
  793. package/dist/chunk-KYDLVMKA.js +0 -99
  794. package/dist/chunk-KZYQNVXE.js +0 -449
  795. package/dist/chunk-L3GNEC6B.js +0 -1019
  796. package/dist/chunk-L5JV7MAF.js +0 -372
  797. package/dist/chunk-LC5E7CVA.js +0 -191
  798. package/dist/chunk-LEYZQZFS.js +0 -121
  799. package/dist/chunk-LFMTPBET.js +0 -265
  800. package/dist/chunk-LFQI2C46.js +0 -175
  801. package/dist/chunk-LH3SDMDC.js +0 -172
  802. package/dist/chunk-LJKZGQTI.js +0 -192
  803. package/dist/chunk-LQDSZPB5.js +0 -73
  804. package/dist/chunk-LTYUE572.js +0 -117
  805. package/dist/chunk-M3WCB73E.js +0 -379
  806. package/dist/chunk-M47MKLW2.js +0 -283
  807. package/dist/chunk-M5FX5KH5.js +0 -629
  808. package/dist/chunk-MHL727ZE.js +0 -129
  809. package/dist/chunk-N3AAMSBH.js +0 -170
  810. package/dist/chunk-N4TJ7A7I.js +0 -41
  811. package/dist/chunk-NFZAMHSR.js +0 -401
  812. package/dist/chunk-NRAVQJE2.js +0 -61
  813. package/dist/chunk-NU4HYZ3C.js +0 -48
  814. package/dist/chunk-NUZNJSL5.js +0 -285
  815. package/dist/chunk-NY5DX43C.js +0 -133
  816. package/dist/chunk-O3C4BASC.js +0 -773
  817. package/dist/chunk-O5JDQZGV.js +0 -176
  818. package/dist/chunk-OMYT3X2Y.js +0 -107
  819. package/dist/chunk-OSQ6YGZW.js +0 -412
  820. package/dist/chunk-OWXSWGP3.js +0 -263
  821. package/dist/chunk-PBCSPCF6.js +0 -43
  822. package/dist/chunk-PBKG2OPJ.js +0 -849
  823. package/dist/chunk-PCP5GF77.js +0 -366
  824. package/dist/chunk-PCSRHFRF.js +0 -75
  825. package/dist/chunk-PHNHJKEL.js +0 -287
  826. package/dist/chunk-PIPD74PT.js +0 -650
  827. package/dist/chunk-PMBZMVKE.js +0 -33
  828. package/dist/chunk-PMVZYQ5W.js +0 -107
  829. package/dist/chunk-POUIWV6K.js +0 -2553
  830. package/dist/chunk-PTSRBKQC.js +0 -118
  831. package/dist/chunk-Q5AQJQXU.js +0 -114
  832. package/dist/chunk-QAS2OFG5.js +0 -371
  833. package/dist/chunk-QCJ6SNCP.js +0 -532
  834. package/dist/chunk-QFMPAR74.js +0 -73
  835. package/dist/chunk-QHF4B7R4.js +0 -166
  836. package/dist/chunk-QHGWFKTK.js +0 -52
  837. package/dist/chunk-QJ4YC4PM.js +0 -353
  838. package/dist/chunk-QMFX5BDA.js +0 -3851
  839. package/dist/chunk-QSG6FWOK.js +0 -126
  840. package/dist/chunk-QTT5574G.js +0 -154
  841. package/dist/chunk-R6CFPY3F.js +0 -278
  842. package/dist/chunk-R6OBJ7LF.js +0 -131
  843. package/dist/chunk-R6OBJ7LF.js.map +0 -1
  844. package/dist/chunk-RAUWORZV.js +0 -1187
  845. package/dist/chunk-RG7PMYWW.js +0 -82
  846. package/dist/chunk-RLS563ST.js +0 -403
  847. package/dist/chunk-RQAE6DI7.js +0 -259
  848. package/dist/chunk-RWWQLVGV.js +0 -184
  849. package/dist/chunk-S6GFECVG.js +0 -56
  850. package/dist/chunk-SBWVYYRA.js +0 -283
  851. package/dist/chunk-SHW2QUOE.js +0 -158
  852. package/dist/chunk-SQJQVTHA.js +0 -3690
  853. package/dist/chunk-STTCF3OR.js +0 -202
  854. package/dist/chunk-SVG5U7UN.js +0 -270
  855. package/dist/chunk-SY6V3Z2U.js +0 -270
  856. package/dist/chunk-T3WYQHAO.js +0 -42
  857. package/dist/chunk-TCDDOFRG.js +0 -79
  858. package/dist/chunk-TGG3ODCS.js +0 -99
  859. package/dist/chunk-TL6UOSMX.js +0 -4519
  860. package/dist/chunk-TL6UOSMX.js.map +0 -1
  861. package/dist/chunk-TU6FW6IJ.js +0 -566
  862. package/dist/chunk-TXSZR2SB.js +0 -188
  863. package/dist/chunk-TYZ3WUKG.js +0 -1095
  864. package/dist/chunk-U3GQZEAO.js +0 -584
  865. package/dist/chunk-U4EMW7RP.js +0 -249
  866. package/dist/chunk-UBSHJB6M.js +0 -83
  867. package/dist/chunk-UFRXYZCJ.js +0 -125
  868. package/dist/chunk-UHBIXNRW.js +0 -100
  869. package/dist/chunk-UJB54P4M.js +0 -335
  870. package/dist/chunk-UJKVMFFF.js +0 -114
  871. package/dist/chunk-UJSXNGKJ.js +0 -141
  872. package/dist/chunk-UNOJ5PNN.js +0 -3321
  873. package/dist/chunk-UOBJFO25.js +0 -351
  874. package/dist/chunk-UPRN4FBY.js +0 -38
  875. package/dist/chunk-UQQUMT5P.js +0 -91
  876. package/dist/chunk-UTFX46TK.js +0 -1177
  877. package/dist/chunk-V5HRUE42.js +0 -396
  878. package/dist/chunk-VCWRMKTQ.js +0 -296
  879. package/dist/chunk-VJAP57SP.js +0 -114
  880. package/dist/chunk-VMJN6YQL.js +0 -391
  881. package/dist/chunk-VUNGU657.js +0 -20
  882. package/dist/chunk-VWEGG7JQ.js +0 -134
  883. package/dist/chunk-VWT7ORWC.js +0 -437
  884. package/dist/chunk-VWT7ORWC.js.map +0 -1
  885. package/dist/chunk-VXGQVX53.js +0 -1152
  886. package/dist/chunk-W7UFWXZ6.js +0 -72
  887. package/dist/chunk-WKBJNGYV.js +0 -230
  888. package/dist/chunk-WZZV7DUU.js +0 -723
  889. package/dist/chunk-XDWW2DLJ.js +0 -247
  890. package/dist/chunk-XF55A7CC.js +0 -162
  891. package/dist/chunk-XGUBIE35.js +0 -187
  892. package/dist/chunk-XIUJL352.js +0 -66
  893. package/dist/chunk-XKPVWLMM.js +0 -383
  894. package/dist/chunk-XSR6J5LY.js +0 -234
  895. package/dist/chunk-Y2LD4FTV.js +0 -132
  896. package/dist/chunk-Y3TQ2M2O.js +0 -214
  897. package/dist/chunk-Y5HXP2NR.js +0 -251
  898. package/dist/chunk-Y6CNWBV3.js +0 -264
  899. package/dist/chunk-YGPMLIFT.js +0 -2317
  900. package/dist/chunk-YIR4KVJO.js +0 -389
  901. package/dist/chunk-YN6UVG4Z.js +0 -250
  902. package/dist/chunk-YNIDJOGT.js +0 -340
  903. package/dist/chunk-YP4SNX4P.js +0 -220
  904. package/dist/chunk-YPIOAMHD.js +0 -246
  905. package/dist/chunk-YPM3T3UM.js +0 -598
  906. package/dist/chunk-YRJZYQ5A.js +0 -898
  907. package/dist/chunk-YRJZYQ5A.js.map +0 -1
  908. package/dist/chunk-YVODOJZG.js +0 -298
  909. package/dist/chunk-ZAGLLXX5.js +0 -107
  910. package/dist/chunk-ZD67RM6G.js +0 -60
  911. package/dist/chunk-ZLY7M463.js +0 -1185
  912. package/dist/chunk-ZNIG3CPB.js +0 -98
  913. package/dist/chunk-ZOQKWIFS.js +0 -108
  914. package/dist/chunk-ZU5WVSHV.js +0 -168
  915. package/dist/chunk-ZWEVJPXC.js +0 -818
  916. package/dist/chunk-ZWFLYN7T.js +0 -772
  917. package/dist/computer-viewer-ZISZUM4L.js +0 -21
  918. package/dist/connection-step-up-UQHDCXFE.js +0 -146
  919. package/dist/connection-step-up-UQHDCXFE.js.map +0 -1
  920. package/dist/embedded-new-voice-UWSSA7AB.js +0 -25
  921. package/dist/embedded-voice-T34K465A.js +0 -25
  922. package/dist/fleet-decision-row-REAWMEHI.js +0 -361
  923. package/dist/model-policy-picker-menu-2CTRKSDJ.js +0 -23
  924. package/dist/payment-page-card-OOOFGIMH.js +0 -226
  925. package/dist/payment-page-card-OOOFGIMH.js.map +0 -1
  926. package/dist/platform-activity-row-EZYTZPYR.js +0 -156
  927. package/dist/queue-surface-implementation-HDZ42LN7.js +0 -932
  928. package/dist/queue-surface-implementation-HDZ42LN7.js.map +0 -1
  929. package/dist/recorder-host-6HFQQTNI.js +0 -80
  930. package/dist/sandbox-files-6JY7WVMO.js +0 -28
  931. package/dist/session-connect-cards-VTSJODCX.js +0 -27
  932. package/dist/session-realtime-G3ZGG3KR.js +0 -30
  933. package/dist/timeline-annotation-markers-S6DMHCI6.js +0 -157
  934. package/dist/timeline-annotation-selection-UFZOKL5E.js +0 -208
  935. package/dist/timeline-annotations-dialog-FPJ4MPHD.js +0 -283
  936. /package/dist/{browser-viewer-J6O65JXH.js.map → browser-viewer-O5FJOWWI.js.map} +0 -0
  937. /package/dist/{chat-interactive-block-R5JEJYMR.js.map → chat-interactive-block-TQTOUHRC.js.map} +0 -0
  938. /package/dist/{chunk-SQJQVTHA.js.map → chunk-23TTCFRP.js.map} +0 -0
  939. /package/dist/{chunk-3GENISSH.js.map → chunk-2BOFLWNJ.js.map} +0 -0
  940. /package/dist/{chunk-6LF2ZE52.js.map → chunk-3DMD2KHT.js.map} +0 -0
  941. /package/dist/{chunk-Y2LD4FTV.js.map → chunk-3DOISS3I.js.map} +0 -0
  942. /package/dist/{chunk-FWEMP52Y.js.map → chunk-3KWTXE4O.js.map} +0 -0
  943. /package/dist/{chunk-4T2RJ2HY.js.map → chunk-3TRERIPD.js.map} +0 -0
  944. /package/dist/{chunk-5JG277OH.js.map → chunk-3UXBTL7Z.js.map} +0 -0
  945. /package/dist/{chunk-M47MKLW2.js.map → chunk-3XEKXNB4.js.map} +0 -0
  946. /package/dist/{chunk-HUS2QEPV.js.map → chunk-3ZJUQG4K.js.map} +0 -0
  947. /package/dist/{chunk-UJB54P4M.js.map → chunk-42WTAUUW.js.map} +0 -0
  948. /package/dist/{chunk-UPRN4FBY.js.map → chunk-46ZC5VNC.js.map} +0 -0
  949. /package/dist/{chunk-QHF4B7R4.js.map → chunk-4BVEFGX7.js.map} +0 -0
  950. /package/dist/{chunk-NFZAMHSR.js.map → chunk-4IOFV4S4.js.map} +0 -0
  951. /package/dist/{chunk-EVJ42E62.js.map → chunk-4ISXBLJV.js.map} +0 -0
  952. /package/dist/{chunk-SBWVYYRA.js.map → chunk-4L2MBYLH.js.map} +0 -0
  953. /package/dist/{chunk-O5JDQZGV.js.map → chunk-4NWUZ6SL.js.map} +0 -0
  954. /package/dist/{chunk-H27MS36Q.js.map → chunk-4QVX6CTT.js.map} +0 -0
  955. /package/dist/{chunk-JOZFVEBN.js.map → chunk-4YARO4Y5.js.map} +0 -0
  956. /package/dist/{chunk-3N3EN7FA.js.map → chunk-4Z7BPBS7.js.map} +0 -0
  957. /package/dist/{chunk-GKOIWZ4C.js.map → chunk-55ILMX6B.js.map} +0 -0
  958. /package/dist/{chunk-6GODDS6F.js.map → chunk-57OAQTWD.js.map} +0 -0
  959. /package/dist/{chunk-KMLELG4O.js.map → chunk-5GXX3NI7.js.map} +0 -0
  960. /package/dist/{chunk-QJ4YC4PM.js.map → chunk-5VE3PPSK.js.map} +0 -0
  961. /package/dist/{chunk-HWOYJOKK.js.map → chunk-62T2ZPD5.js.map} +0 -0
  962. /package/dist/{chunk-EGSRY63C.js.map → chunk-655JT4VH.js.map} +0 -0
  963. /package/dist/{chunk-2XZ3EUSP.js.map → chunk-65OPNLE4.js.map} +0 -0
  964. /package/dist/{chunk-J45WTHTL.js.map → chunk-67PIP46J.js.map} +0 -0
  965. /package/dist/{chunk-GCURVP5U.js.map → chunk-6CAK65QV.js.map} +0 -0
  966. /package/dist/{chunk-PMBZMVKE.js.map → chunk-6CDBX3XG.js.map} +0 -0
  967. /package/dist/{chunk-R6CFPY3F.js.map → chunk-6D3D2JWY.js.map} +0 -0
  968. /package/dist/{chunk-PMVZYQ5W.js.map → chunk-6DGQB6GT.js.map} +0 -0
  969. /package/dist/{chunk-TXSZR2SB.js.map → chunk-6NFK3J2O.js.map} +0 -0
  970. /package/dist/{chunk-3X4HTUUR.js.map → chunk-6R3QX3AC.js.map} +0 -0
  971. /package/dist/{chunk-F4ESDJTE.js.map → chunk-6S5OMLAL.js.map} +0 -0
  972. /package/dist/{chunk-U4EMW7RP.js.map → chunk-6SG2VVVB.js.map} +0 -0
  973. /package/dist/{chunk-3CF2B2LD.js.map → chunk-6U57GGJI.js.map} +0 -0
  974. /package/dist/{chunk-ZNIG3CPB.js.map → chunk-6V2PEFPS.js.map} +0 -0
  975. /package/dist/{chunk-UNOJ5PNN.js.map → chunk-6VASZZVV.js.map} +0 -0
  976. /package/dist/{chunk-ZU5WVSHV.js.map → chunk-7BBYH5R5.js.map} +0 -0
  977. /package/dist/{chunk-J3XWJ2A6.js.map → chunk-7EO3T3IX.js.map} +0 -0
  978. /package/dist/{chunk-SHW2QUOE.js.map → chunk-7EZQ6EKM.js.map} +0 -0
  979. /package/dist/{chunk-I46F7LUI.js.map → chunk-7HI53NPP.js.map} +0 -0
  980. /package/dist/{chunk-FX4HG4FR.js.map → chunk-7J4BFENI.js.map} +0 -0
  981. /package/dist/{chunk-Q5AQJQXU.js.map → chunk-7LSGNY2L.js.map} +0 -0
  982. /package/dist/{chunk-ADNH5GSP.js.map → chunk-7MMONDFK.js.map} +0 -0
  983. /package/dist/{chunk-KW4OJ3RS.js.map → chunk-7MWPBGDX.js.map} +0 -0
  984. /package/dist/{chunk-QAS2OFG5.js.map → chunk-7NSDIQMY.js.map} +0 -0
  985. /package/dist/{chunk-K7GGLL2U.js.map → chunk-7XPDLT5G.js.map} +0 -0
  986. /package/dist/{chunk-2SH6CLOR.js.map → chunk-A3BCF4MV.js.map} +0 -0
  987. /package/dist/{chunk-PBKG2OPJ.js.map → chunk-A5GX3CAE.js.map} +0 -0
  988. /package/dist/{chunk-D2VP4C5B.js.map → chunk-AAHQJWEP.js.map} +0 -0
  989. /package/dist/{chunk-DWPE3Y7M.js.map → chunk-AAWEPZOG.js.map} +0 -0
  990. /package/dist/{chunk-YPM3T3UM.js.map → chunk-ABRT345L.js.map} +0 -0
  991. /package/dist/{chunk-UQQUMT5P.js.map → chunk-ANXFE2EP.js.map} +0 -0
  992. /package/dist/{chunk-7EJWP62C.js.map → chunk-AQNE4XWU.js.map} +0 -0
  993. /package/dist/{chunk-BPCI4ZGR.js.map → chunk-AV2OMWDS.js.map} +0 -0
  994. /package/dist/{chunk-L3GNEC6B.js.map → chunk-AYHMHAU5.js.map} +0 -0
  995. /package/dist/{chunk-7J3TLTPI.js.map → chunk-AZ637XK3.js.map} +0 -0
  996. /package/dist/{chunk-4OGDD2EM.js.map → chunk-B6AH43UQ.js.map} +0 -0
  997. /package/dist/{chunk-XKPVWLMM.js.map → chunk-BBECLK22.js.map} +0 -0
  998. /package/dist/{chunk-GNTEF5TL.js.map → chunk-BWYPJG3P.js.map} +0 -0
  999. /package/dist/{chunk-V5HRUE42.js.map → chunk-CI7F4Y26.js.map} +0 -0
  1000. /package/dist/{chunk-5XVOL3KH.js.map → chunk-CNLSXEQC.js.map} +0 -0
  1001. /package/dist/{chunk-6WGJB6GO.js.map → chunk-COCB4HE3.js.map} +0 -0
  1002. /package/dist/{chunk-B57G2C45.js.map → chunk-CPEVLG3B.js.map} +0 -0
  1003. /package/dist/{chunk-FZOK37SC.js.map → chunk-CVC4RO7D.js.map} +0 -0
  1004. /package/dist/{chunk-IEUZ4ASX.js.map → chunk-CY6RLRHJ.js.map} +0 -0
  1005. /package/dist/{chunk-LTYUE572.js.map → chunk-D3WLSMCL.js.map} +0 -0
  1006. /package/dist/{chunk-GH4VY3H5.js.map → chunk-D7SSOJEU.js.map} +0 -0
  1007. /package/dist/{chunk-ZWEVJPXC.js.map → chunk-DBOD5WXT.js.map} +0 -0
  1008. /package/dist/{chunk-J6YVN3W7.js.map → chunk-DFWSRIFL.js.map} +0 -0
  1009. /package/dist/{chunk-QSG6FWOK.js.map → chunk-DITZUBOK.js.map} +0 -0
  1010. /package/dist/{chunk-PHNHJKEL.js.map → chunk-DKD2ZZSJ.js.map} +0 -0
  1011. /package/dist/{chunk-YPIOAMHD.js.map → chunk-DOJWHSRD.js.map} +0 -0
  1012. /package/dist/{chunk-XGUBIE35.js.map → chunk-DR6LZXJI.js.map} +0 -0
  1013. /package/dist/{chunk-PIPD74PT.js.map → chunk-DV73XOVB.js.map} +0 -0
  1014. /package/dist/{chunk-AX65L6QV.js.map → chunk-DYO7DNDD.js.map} +0 -0
  1015. /package/dist/{chunk-4GUPD7CJ.js.map → chunk-DYZASWWT.js.map} +0 -0
  1016. /package/dist/{chunk-7ZQVRVNI.js.map → chunk-EC5HUNXI.js.map} +0 -0
  1017. /package/dist/{chunk-XDWW2DLJ.js.map → chunk-ECQ7FV3E.js.map} +0 -0
  1018. /package/dist/{chunk-67BMBRTK.js.map → chunk-ECVCSZWY.js.map} +0 -0
  1019. /package/dist/{chunk-AZHZ2EU4.js.map → chunk-EMXO5HCY.js.map} +0 -0
  1020. /package/dist/{chunk-LFMTPBET.js.map → chunk-ENJX5TAA.js.map} +0 -0
  1021. /package/dist/{chunk-XIUJL352.js.map → chunk-EQSYPIAI.js.map} +0 -0
  1022. /package/dist/{chunk-VXGQVX53.js.map → chunk-EV73XMK3.js.map} +0 -0
  1023. /package/dist/{chunk-POUIWV6K.js.map → chunk-F2SGC74A.js.map} +0 -0
  1024. /package/dist/{chunk-WKBJNGYV.js.map → chunk-F5DEBD4D.js.map} +0 -0
  1025. /package/dist/{chunk-TU6FW6IJ.js.map → chunk-F6JJBUQ2.js.map} +0 -0
  1026. /package/dist/{chunk-CSGKUDNB.js.map → chunk-FEVZDJOZ.js.map} +0 -0
  1027. /package/dist/{chunk-LEYZQZFS.js.map → chunk-FF22IUY3.js.map} +0 -0
  1028. /package/dist/{chunk-A2QOUEU3.js.map → chunk-FILRDNUQ.js.map} +0 -0
  1029. /package/dist/{chunk-ATWXYAWP.js.map → chunk-FLB3BP2E.js.map} +0 -0
  1030. /package/dist/{chunk-DEKCTHXM.js.map → chunk-FZVMMHPC.js.map} +0 -0
  1031. /package/dist/{chunk-7I4KWTJS.js.map → chunk-G6D5NVWM.js.map} +0 -0
  1032. /package/dist/{chunk-LJKZGQTI.js.map → chunk-GGH5STTP.js.map} +0 -0
  1033. /package/dist/{chunk-6OMREP52.js.map → chunk-GGHX6GS7.js.map} +0 -0
  1034. /package/dist/{chunk-HUKGLWAY.js.map → chunk-GIHE7U3Y.js.map} +0 -0
  1035. /package/dist/{chunk-Y6CNWBV3.js.map → chunk-GO5VIAA7.js.map} +0 -0
  1036. /package/dist/{chunk-AHBEBGLO.js.map → chunk-GSK637QS.js.map} +0 -0
  1037. /package/dist/{chunk-S6GFECVG.js.map → chunk-HBYO34CP.js.map} +0 -0
  1038. /package/dist/{chunk-PTSRBKQC.js.map → chunk-HFROJDFQ.js.map} +0 -0
  1039. /package/dist/{chunk-Y5HXP2NR.js.map → chunk-HGEDFQ7G.js.map} +0 -0
  1040. /package/dist/{chunk-AGW5H6QV.js.map → chunk-HH3QTFGV.js.map} +0 -0
  1041. /package/dist/{chunk-YP4SNX4P.js.map → chunk-HHFFPE67.js.map} +0 -0
  1042. /package/dist/{chunk-D4AF4SOJ.js.map → chunk-HHYTB5OL.js.map} +0 -0
  1043. /package/dist/{chunk-FFWVFU6S.js.map → chunk-HPKWAHHI.js.map} +0 -0
  1044. /package/dist/{chunk-KQY4P4EO.js.map → chunk-HSPOCEGP.js.map} +0 -0
  1045. /package/dist/{chunk-HC7C4ZN2.js.map → chunk-IC74VN2I.js.map} +0 -0
  1046. /package/dist/{chunk-DJ4X4U4A.js.map → chunk-ICSQO2CV.js.map} +0 -0
  1047. /package/dist/{chunk-CHKHQHOO.js.map → chunk-IEZE7SL6.js.map} +0 -0
  1048. /package/dist/{chunk-N3AAMSBH.js.map → chunk-IGHNTARW.js.map} +0 -0
  1049. /package/dist/{chunk-7FY47EN2.js.map → chunk-IKYS56PQ.js.map} +0 -0
  1050. /package/dist/{chunk-IBI3N3P7.js.map → chunk-IO474NRY.js.map} +0 -0
  1051. /package/dist/{chunk-WZZV7DUU.js.map → chunk-IP2CCFAV.js.map} +0 -0
  1052. /package/dist/{chunk-QMFX5BDA.js.map → chunk-IT5GF54F.js.map} +0 -0
  1053. /package/dist/{chunk-SVG5U7UN.js.map → chunk-IX67G5FD.js.map} +0 -0
  1054. /package/dist/{chunk-KDHWX7XH.js.map → chunk-IXNJK7KJ.js.map} +0 -0
  1055. /package/dist/{chunk-DHXRMZPQ.js.map → chunk-IZWTARYT.js.map} +0 -0
  1056. /package/dist/{chunk-ZOQKWIFS.js.map → chunk-JBV2HY43.js.map} +0 -0
  1057. /package/dist/{chunk-54NTSBQO.js.map → chunk-JE62XK5K.js.map} +0 -0
  1058. /package/dist/{chunk-EIVA3MAH.js.map → chunk-JFAWCALM.js.map} +0 -0
  1059. /package/dist/{chunk-UBSHJB6M.js.map → chunk-JQGPATQZ.js.map} +0 -0
  1060. /package/dist/{chunk-27HN57HE.js.map → chunk-JYZGX5UZ.js.map} +0 -0
  1061. /package/dist/{chunk-W7UFWXZ6.js.map → chunk-K227GMSM.js.map} +0 -0
  1062. /package/dist/{chunk-KZYQNVXE.js.map → chunk-KB2O7JIJ.js.map} +0 -0
  1063. /package/dist/{chunk-KSDCQPJY.js.map → chunk-KT6GC67G.js.map} +0 -0
  1064. /package/dist/{chunk-PCSRHFRF.js.map → chunk-KTGKGHEA.js.map} +0 -0
  1065. /package/dist/{chunk-NUZNJSL5.js.map → chunk-KU77XHWB.js.map} +0 -0
  1066. /package/dist/{chunk-A36WG3BT.js.map → chunk-KZIRVLCM.js.map} +0 -0
  1067. /package/dist/{chunk-RQAE6DI7.js.map → chunk-L3DUSTRN.js.map} +0 -0
  1068. /package/dist/{chunk-NRAVQJE2.js.map → chunk-L6WVCO6D.js.map} +0 -0
  1069. /package/dist/{chunk-TCDDOFRG.js.map → chunk-L7PCZEEG.js.map} +0 -0
  1070. /package/dist/{chunk-GXYS6BI3.js.map → chunk-LEN2DVU6.js.map} +0 -0
  1071. /package/dist/{chunk-LC5E7CVA.js.map → chunk-LGOQW2CE.js.map} +0 -0
  1072. /package/dist/{chunk-YIR4KVJO.js.map → chunk-LK2JO72Y.js.map} +0 -0
  1073. /package/dist/{chunk-U3GQZEAO.js.map → chunk-LXLHIOJM.js.map} +0 -0
  1074. /package/dist/{chunk-BIQMUTVW.js.map → chunk-LYQQ4VBE.js.map} +0 -0
  1075. /package/dist/{chunk-EW3N5SCT.js.map → chunk-M22ZHQ7S.js.map} +0 -0
  1076. /package/dist/{chunk-VUNGU657.js.map → chunk-M5RKFV6K.js.map} +0 -0
  1077. /package/dist/{chunk-TGG3ODCS.js.map → chunk-MCPKUVMQ.js.map} +0 -0
  1078. /package/dist/{chunk-AP63EUPJ.js.map → chunk-MDGNCUAC.js.map} +0 -0
  1079. /package/dist/{chunk-KYDLVMKA.js.map → chunk-MFLU3466.js.map} +0 -0
  1080. /package/dist/{chunk-ZD67RM6G.js.map → chunk-MIUJ3EH5.js.map} +0 -0
  1081. /package/dist/{chunk-M5FX5KH5.js.map → chunk-MO3XJQN2.js.map} +0 -0
  1082. /package/dist/{chunk-OMYT3X2Y.js.map → chunk-MTHAYXDH.js.map} +0 -0
  1083. /package/dist/{chunk-5ERDSF2C.js.map → chunk-MVYQDBE6.js.map} +0 -0
  1084. /package/dist/{chunk-75LF7LSI.js.map → chunk-NA7VZQPL.js.map} +0 -0
  1085. /package/dist/{chunk-3IEVQMGO.js.map → chunk-ND6FWOSO.js.map} +0 -0
  1086. /package/dist/{chunk-UOBJFO25.js.map → chunk-NIFPH34L.js.map} +0 -0
  1087. /package/dist/{chunk-EJYHPNXD.js.map → chunk-NKYC6WHQ.js.map} +0 -0
  1088. /package/dist/{chunk-4XEPZARK.js.map → chunk-NML7VKLU.js.map} +0 -0
  1089. /package/dist/{chunk-N4TJ7A7I.js.map → chunk-NPAWLKJB.js.map} +0 -0
  1090. /package/dist/{chunk-ZLY7M463.js.map → chunk-NQSKI2YD.js.map} +0 -0
  1091. /package/dist/{chunk-VJAP57SP.js.map → chunk-NXQFBC22.js.map} +0 -0
  1092. /package/dist/{chunk-PBCSPCF6.js.map → chunk-NXRZMHVM.js.map} +0 -0
  1093. /package/dist/{chunk-IHLF7R6Q.js.map → chunk-NYU5DE4K.js.map} +0 -0
  1094. /package/dist/{chunk-NU4HYZ3C.js.map → chunk-O2EEYPIZ.js.map} +0 -0
  1095. /package/dist/{chunk-BRJLN3ZL.js.map → chunk-O4TOEISQ.js.map} +0 -0
  1096. /package/dist/{chunk-MHL727ZE.js.map → chunk-O533L2TG.js.map} +0 -0
  1097. /package/dist/{chunk-QCJ6SNCP.js.map → chunk-ON6ZGJDW.js.map} +0 -0
  1098. /package/dist/{chunk-AJIGRQIO.js.map → chunk-OPELE3Z4.js.map} +0 -0
  1099. /package/dist/{chunk-XSR6J5LY.js.map → chunk-OTSUC6PP.js.map} +0 -0
  1100. /package/dist/{chunk-FPPPLIGK.js.map → chunk-OZNL5OKT.js.map} +0 -0
  1101. /package/dist/{chunk-6GCMLYER.js.map → chunk-P3PDKPLK.js.map} +0 -0
  1102. /package/dist/{chunk-L5JV7MAF.js.map → chunk-PCZBYN2H.js.map} +0 -0
  1103. /package/dist/{chunk-6P3QOMPV.js.map → chunk-PIPXXQFV.js.map} +0 -0
  1104. /package/dist/{chunk-4GFLP4OY.js.map → chunk-PMUZUPPE.js.map} +0 -0
  1105. /package/dist/{chunk-EFD4DD3E.js.map → chunk-PN52EIFV.js.map} +0 -0
  1106. /package/dist/{chunk-LFQI2C46.js.map → chunk-PPQJIVGM.js.map} +0 -0
  1107. /package/dist/{chunk-5ORXRVXV.js.map → chunk-PQYFOTNI.js.map} +0 -0
  1108. /package/dist/{chunk-TYZ3WUKG.js.map → chunk-PUX4YJAW.js.map} +0 -0
  1109. /package/dist/{chunk-UFRXYZCJ.js.map → chunk-PYMQM65Y.js.map} +0 -0
  1110. /package/dist/{chunk-GBGJIR6F.js.map → chunk-Q5UO7GT5.js.map} +0 -0
  1111. /package/dist/{chunk-H4NDK35I.js.map → chunk-QA5UNVHD.js.map} +0 -0
  1112. /package/dist/{chunk-7M5DPUGZ.js.map → chunk-QDZR7FXG.js.map} +0 -0
  1113. /package/dist/{chunk-J4OOKDRV.js.map → chunk-QNOWKKZ4.js.map} +0 -0
  1114. /package/dist/{chunk-QFMPAR74.js.map → chunk-QUXQYYZO.js.map} +0 -0
  1115. /package/dist/{chunk-AU2DT7O2.js.map → chunk-QVOTPOXK.js.map} +0 -0
  1116. /package/dist/{chunk-ZWFLYN7T.js.map → chunk-R2DSOIME.js.map} +0 -0
  1117. /package/dist/{chunk-PCP5GF77.js.map → chunk-RFQQXXJ6.js.map} +0 -0
  1118. /package/dist/{chunk-EQ263DHZ.js.map → chunk-RLWI34XM.js.map} +0 -0
  1119. /package/dist/{chunk-F47X7XPQ.js.map → chunk-RMWCGSEP.js.map} +0 -0
  1120. /package/dist/{chunk-CZPN2HP3.js.map → chunk-ROTEQD2Z.js.map} +0 -0
  1121. /package/dist/{chunk-VCWRMKTQ.js.map → chunk-RPCWZFP7.js.map} +0 -0
  1122. /package/dist/{chunk-UJSXNGKJ.js.map → chunk-RW5QRWVI.js.map} +0 -0
  1123. /package/dist/{chunk-6GYRHQVL.js.map → chunk-RZZHOHL6.js.map} +0 -0
  1124. /package/dist/{chunk-NY5DX43C.js.map → chunk-S5STZCBZ.js.map} +0 -0
  1125. /package/dist/{chunk-KWOYMJKM.js.map → chunk-SD4A5P24.js.map} +0 -0
  1126. /package/dist/{chunk-36YTBVYF.js.map → chunk-SJM4TCWJ.js.map} +0 -0
  1127. /package/dist/{chunk-UHBIXNRW.js.map → chunk-SQYTYXR4.js.map} +0 -0
  1128. /package/dist/{chunk-BY7AWWDB.js.map → chunk-SRDHDIRQ.js.map} +0 -0
  1129. /package/dist/{chunk-OWXSWGP3.js.map → chunk-SVC674IM.js.map} +0 -0
  1130. /package/dist/{chunk-HUTQJY3F.js.map → chunk-SYYFA7W7.js.map} +0 -0
  1131. /package/dist/{chunk-RAUWORZV.js.map → chunk-T2UUHB7V.js.map} +0 -0
  1132. /package/dist/{chunk-YVODOJZG.js.map → chunk-TBOH54QP.js.map} +0 -0
  1133. /package/dist/{chunk-GFMRMSFN.js.map → chunk-TG2GO424.js.map} +0 -0
  1134. /package/dist/{chunk-ZAGLLXX5.js.map → chunk-TOJNLC42.js.map} +0 -0
  1135. /package/dist/{chunk-OSQ6YGZW.js.map → chunk-TW75KM7T.js.map} +0 -0
  1136. /package/dist/{chunk-7CIMPDGL.js.map → chunk-TWWAPJYE.js.map} +0 -0
  1137. /package/dist/{chunk-STTCF3OR.js.map → chunk-UARZCGWU.js.map} +0 -0
  1138. /package/dist/{chunk-F7NV3EL5.js.map → chunk-UCNTAS2U.js.map} +0 -0
  1139. /package/dist/{chunk-XF55A7CC.js.map → chunk-UD7IARSL.js.map} +0 -0
  1140. /package/dist/{chunk-M3WCB73E.js.map → chunk-UDKZKGUQ.js.map} +0 -0
  1141. /package/dist/{chunk-VMJN6YQL.js.map → chunk-UJRSZ6ZB.js.map} +0 -0
  1142. /package/dist/{chunk-236GMLCR.js.map → chunk-UTM23O3G.js.map} +0 -0
  1143. /package/dist/{chunk-3VSKLEUE.js.map → chunk-UUJSS56V.js.map} +0 -0
  1144. /package/dist/{chunk-T3WYQHAO.js.map → chunk-UWSF733U.js.map} +0 -0
  1145. /package/dist/{chunk-I57PYKVN.js.map → chunk-V4ZYJWU3.js.map} +0 -0
  1146. /package/dist/{chunk-FUJ6DWRZ.js.map → chunk-VEIT2EGK.js.map} +0 -0
  1147. /package/dist/{chunk-LH3SDMDC.js.map → chunk-VGG6DOTN.js.map} +0 -0
  1148. /package/dist/{chunk-RG7PMYWW.js.map → chunk-VGSGAQJX.js.map} +0 -0
  1149. /package/dist/{chunk-YGPMLIFT.js.map → chunk-VHK5CBIG.js.map} +0 -0
  1150. /package/dist/{chunk-QTT5574G.js.map → chunk-VLA2DTYG.js.map} +0 -0
  1151. /package/dist/{chunk-GJFTPSGN.js.map → chunk-VSN6XKZ5.js.map} +0 -0
  1152. /package/dist/{chunk-5CGZOJN7.js.map → chunk-VW6TOTDQ.js.map} +0 -0
  1153. /package/dist/{chunk-6MSTIFAL.js.map → chunk-W3HKBWPM.js.map} +0 -0
  1154. /package/dist/{chunk-LQDSZPB5.js.map → chunk-WDYM5SFM.js.map} +0 -0
  1155. /package/dist/{chunk-DLMMQMKZ.js.map → chunk-WJ4AZ2AR.js.map} +0 -0
  1156. /package/dist/{chunk-Y3TQ2M2O.js.map → chunk-WMQHP4E3.js.map} +0 -0
  1157. /package/dist/{chunk-H6DJIEO6.js.map → chunk-WP5A6F6P.js.map} +0 -0
  1158. /package/dist/{chunk-GQF2HWQE.js.map → chunk-WWQH3L6M.js.map} +0 -0
  1159. /package/dist/{chunk-2FLGURHP.js.map → chunk-X3T6ULUZ.js.map} +0 -0
  1160. /package/dist/{chunk-QHGWFKTK.js.map → chunk-XA32OUL4.js.map} +0 -0
  1161. /package/dist/{chunk-2ZC62PY4.js.map → chunk-XCICIQIE.js.map} +0 -0
  1162. /package/dist/{chunk-ADFUTR45.js.map → chunk-XHRIUCBD.js.map} +0 -0
  1163. /package/dist/{chunk-UTFX46TK.js.map → chunk-XJBWVT5X.js.map} +0 -0
  1164. /package/dist/{chunk-SY6V3Z2U.js.map → chunk-XKQRWJFE.js.map} +0 -0
  1165. /package/dist/{chunk-VWEGG7JQ.js.map → chunk-XN3EVUB5.js.map} +0 -0
  1166. /package/dist/{chunk-DGS62JWP.js.map → chunk-XT6GBN2G.js.map} +0 -0
  1167. /package/dist/{chunk-RWWQLVGV.js.map → chunk-XYVDTM4D.js.map} +0 -0
  1168. /package/dist/{chunk-67JCL67N.js.map → chunk-XZO5X3KH.js.map} +0 -0
  1169. /package/dist/{chunk-DCML4SXQ.js.map → chunk-Y34DIEOG.js.map} +0 -0
  1170. /package/dist/{chunk-UJKVMFFF.js.map → chunk-YAIYUFCX.js.map} +0 -0
  1171. /package/dist/{chunk-24S44WBL.js.map → chunk-YFLRBEDS.js.map} +0 -0
  1172. /package/dist/{chunk-RLS563ST.js.map → chunk-YQX227EF.js.map} +0 -0
  1173. /package/dist/{chunk-YNIDJOGT.js.map → chunk-YVAB57JZ.js.map} +0 -0
  1174. /package/dist/{chunk-YN6UVG4Z.js.map → chunk-YWHSODBB.js.map} +0 -0
  1175. /package/dist/{chunk-3NMKLLEB.js.map → chunk-YWJHCJQW.js.map} +0 -0
  1176. /package/dist/{chunk-4YJGB22T.js.map → chunk-Z37DSW2K.js.map} +0 -0
  1177. /package/dist/{chunk-72PGXQDN.js.map → chunk-ZELN2B72.js.map} +0 -0
  1178. /package/dist/{chunk-4YNWA5YG.js.map → chunk-ZFGGR2JW.js.map} +0 -0
  1179. /package/dist/{chunk-O3C4BASC.js.map → chunk-ZL7SEED7.js.map} +0 -0
  1180. /package/dist/{computer-viewer-ZISZUM4L.js.map → computer-viewer-CNYFTUGF.js.map} +0 -0
  1181. /package/dist/{embedded-new-voice-UWSSA7AB.js.map → embedded-new-voice-A56WDECM.js.map} +0 -0
  1182. /package/dist/{embedded-voice-T34K465A.js.map → embedded-voice-CBTSMIWW.js.map} +0 -0
  1183. /package/dist/{fleet-decision-row-REAWMEHI.js.map → fleet-decision-row-6PQTGI2U.js.map} +0 -0
  1184. /package/dist/{model-policy-picker-menu-2CTRKSDJ.js.map → model-policy-picker-menu-ZU72JATS.js.map} +0 -0
  1185. /package/dist/{platform-activity-row-EZYTZPYR.js.map → platform-activity-row-5IQT6R5Z.js.map} +0 -0
  1186. /package/dist/{recorder-host-6HFQQTNI.js.map → recorder-host-G5M676VM.js.map} +0 -0
  1187. /package/dist/{sandbox-files-6JY7WVMO.js.map → sandbox-files-HCXOP6ZO.js.map} +0 -0
  1188. /package/dist/{session-connect-cards-VTSJODCX.js.map → session-connect-cards-MYJRQWSA.js.map} +0 -0
  1189. /package/dist/{session-realtime-G3ZGG3KR.js.map → session-realtime-YFVGQFJK.js.map} +0 -0
  1190. /package/dist/{timeline-annotation-markers-S6DMHCI6.js.map → timeline-annotation-markers-5ELTFV5B.js.map} +0 -0
  1191. /package/dist/{timeline-annotation-selection-UFZOKL5E.js.map → timeline-annotation-selection-XHUOFRIY.js.map} +0 -0
  1192. /package/dist/{timeline-annotations-dialog-FPJ4MPHD.js.map → timeline-annotations-dialog-X2VNDYZ4.js.map} +0 -0
@@ -1,4519 +0,0 @@
1
- "use client";
2
- import {
3
- useSessionStartupState
4
- } from "./chunk-D6LH6JPE.js";
5
- import {
6
- deniesRetainedView,
7
- useRetainedSessionView
8
- } from "./chunk-6CKSMBLT.js";
9
- import {
10
- uploadScopeForSession,
11
- useFileAttachments
12
- } from "./chunk-IE5MZEOM.js";
13
- import {
14
- projectPendingApprovals
15
- } from "./chunk-GFUDB3SA.js";
16
- import {
17
- buildTimeline,
18
- groupTimeline,
19
- isToolOutputPreviewEvent,
20
- sessionStatusFromEvents,
21
- useToolOutputReads
22
- } from "./chunk-IYKO6BBK.js";
23
- import {
24
- forgetSessionHumanInputDrafts,
25
- pruneHumanInputDrafts
26
- } from "./chunk-UYWVK7JQ.js";
27
- import {
28
- useSharedQuery
29
- } from "./chunk-DSQNSLQW.js";
30
- import {
31
- isActionableHumanInputRequest
32
- } from "./chunk-57MB2QGY.js";
33
- import {
34
- admissionRecheckControl
35
- } from "./chunk-MRNAHGBL.js";
36
- import {
37
- readAcknowledgementFrontier,
38
- sessionAttentionReadThroughSequence
39
- } from "./chunk-IOBL5KYR.js";
40
- import {
41
- promptSendDestination,
42
- sessionArchived,
43
- sessionTurnKeepsRunControl
44
- } from "./chunk-DG5DQFS4.js";
45
- import {
46
- useClientConfigFlags
47
- } from "./chunk-XESA3B7W.js";
48
- import {
49
- joinClientConfigRead
50
- } from "./chunk-IGVL3ELX.js";
51
- import {
52
- FILE_ONLY_MESSAGE_TEXT,
53
- notifyObserver,
54
- useComposer
55
- } from "./chunk-IEUZ4ASX.js";
56
- import {
57
- modelLevelChoice,
58
- modelLevelsView
59
- } from "./chunk-X6UMGG4T.js";
60
- import {
61
- DEFAULT_TRANSIENT_READ_RETRY,
62
- projectionReadThrough,
63
- transientReadRetryStep,
64
- useDebouncedCallback,
65
- useMutationRunner,
66
- usePageLiveActivity,
67
- usePolledValue,
68
- useSessionEventTrigger
69
- } from "./chunk-SW4S6I5E.js";
70
- import {
71
- normalizeError
72
- } from "./chunk-CM7LVUKC.js";
73
- import {
74
- useEmbeddedGoal,
75
- useEmbeddedHumanInputSession,
76
- useEmbeddedSession,
77
- useEmbeddedSessionRead,
78
- useOpenGeni,
79
- useOpenGeniClient
80
- } from "./chunk-BVUAHAQX.js";
81
- import {
82
- coerceReasoningEffortForModel,
83
- defaultEffortForModel,
84
- projectPickerRows,
85
- runnableLatencyModesForModel,
86
- sortPickerRows
87
- } from "./chunk-4VEIBNC2.js";
88
- import {
89
- useOpenGeniText
90
- } from "./chunk-4ZRGFCSP.js";
91
-
92
- // src/conversation-timeline.ts
93
- function conversationTimeline(items, queue, composer) {
94
- const queued = new Set(
95
- queue.queue.filter((turn) => turn.metadata.delivery !== "steer").map((turn) => turn.triggerEventId)
96
- );
97
- const pending = composer.optimisticMessages ?? [];
98
- const pendingQueue = new Set(
99
- pending.filter(
100
- (message) => message.destination === "queue" && !(message.turnId && message.appliedQueueVersion != null && queue.snapshot && queue.snapshot.version >= message.appliedQueueVersion && !queue.queue.some((turn) => turn.id === message.turnId))
101
- ).map((message) => `user-message:${message.clientEventId}`)
102
- );
103
- const visible = items.filter(
104
- (item) => item.kind !== "user-message" || !queued.has(item.id) && !pendingQueue.has(item.reconciliationKey ?? "")
105
- );
106
- const keys = new Set(
107
- visible.flatMap((item) => item.kind === "user-message" ? [item.reconciliationKey] : [])
108
- );
109
- const optimistic = pending.filter(
110
- (message) => (message.destination === "chat" || message.state === "failed") && !keys.has(`user-message:${message.clientEventId}`) && !queue.queue.some((turn) => turn.id === message.turnId)
111
- ).map((message) => ({
112
- kind: "user-message",
113
- id: `optimistic:${message.clientEventId}`,
114
- reconciliationKey: `user-message:${message.clientEventId}`,
115
- text: message.text,
116
- annotations: message.annotations.map((annotation, ordinal) => ({ ...annotation, ordinal })),
117
- resources: message.resources,
118
- tools: [],
119
- occurredAt: message.occurredAt,
120
- delivery: {
121
- state: message.state,
122
- ...message.error ? { error: message.error } : {},
123
- ...message.state === "failed" ? {
124
- ...message.retryable !== false && composer.retryOptimisticMessage ? { onRetry: () => composer.retryOptimisticMessage?.(message.clientEventId) } : {},
125
- ...message.retryable === false && composer.restoreOptimisticMessage ? { onEdit: () => composer.restoreOptimisticMessage?.(message.clientEventId) } : {},
126
- onRemove: () => composer.removeOptimisticMessage?.(message.clientEventId)
127
- } : {}
128
- }
129
- }));
130
- const failed = optimistic.filter((message) => message.delivery?.state === "failed");
131
- const unsent = optimistic.filter((message) => message.delivery?.state !== "failed");
132
- const ids = new Set(visible.map((item) => item.id));
133
- const steers = (queue.acceptedSteers ?? []).filter((steer) => !ids.has(steer.triggerEventId)).map((steer) => ({
134
- kind: "user-message",
135
- id: steer.triggerEventId,
136
- text: steer.text,
137
- annotations: steer.annotations,
138
- resources: steer.resources,
139
- tools: steer.tools,
140
- occurredAt: steer.occurredAt,
141
- delivery: { state: steer.state }
142
- }));
143
- return [...placeFailedSends(visible, failed), ...unsent, ...steers];
144
- }
145
- function placeFailedSends(items, failed) {
146
- if (failed.length === 0) return items;
147
- const before = /* @__PURE__ */ new Map();
148
- const last = [];
149
- for (const message of failed) {
150
- const sentAt = Date.parse(message.occurredAt);
151
- const newer = items.findIndex(
152
- (item) => item.kind === "user-message" && Date.parse(item.occurredAt) > sentAt
153
- );
154
- if (newer === -1) {
155
- last.push(message);
156
- } else {
157
- before.set(newer, [...before.get(newer) ?? [], message]);
158
- }
159
- }
160
- return [...items.flatMap((item, index) => [...before.get(index) ?? [], item]), ...last];
161
- }
162
-
163
- // src/hooks/use-session.ts
164
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
165
-
166
- // src/lib/session-detail-read.ts
167
- var lastOrdinal = 0;
168
- var reads = /* @__PURE__ */ new WeakMap();
169
- function readKey(workspaceId, sessionId) {
170
- return `${workspaceId}\0${sessionId}`;
171
- }
172
- function sessionDetailReadMark() {
173
- return lastOrdinal;
174
- }
175
- function readFreshSessionDetail(client, workspaceId, sessionId, options = {}) {
176
- const promise = client.getSession(workspaceId, sessionId, { ...options, fresh: true });
177
- const read = { promise, ordinal: ++lastOrdinal };
178
- let scoped = reads.get(client);
179
- if (!scoped) {
180
- scoped = /* @__PURE__ */ new Map();
181
- reads.set(client, scoped);
182
- }
183
- const key = readKey(workspaceId, sessionId);
184
- scoped.set(key, read);
185
- promise.catch(() => {
186
- if (scoped.get(key) === read) scoped.delete(key);
187
- });
188
- return promise;
189
- }
190
- function joinSessionDetailRead(client, workspaceId, sessionId, mark) {
191
- const read = reads.get(client)?.get(readKey(workspaceId, sessionId));
192
- return read && read.ordinal > mark ? read.promise : null;
193
- }
194
-
195
- // src/hooks/use-session.ts
196
- function isTitleEvent(event) {
197
- return event.type === "session.title_set";
198
- }
199
- function isSessionDetailEvent(event) {
200
- return isTitleEvent(event) || // Description or avatar edits (by a person or the agent) refresh the header.
201
- event.type === "session.profile_set" || // The agent said it waits on a person, or stopped waiting.
202
- event.type === "session.waiting_on.changed" || // The chat's model, effort or speed changed (for example by the agent).
203
- event.type === "session.model_settings.updated" || event.type.startsWith("session.command.") || event.type.startsWith("session.wait.") || event.type === "session.status.changed" || event.type === "system.update.pending";
204
- }
205
- function useSession(sessionId, options = {}) {
206
- const { client, workspaceId, workspaceControlEvent, registerSessionReconciler } = useEmbeddedSessionRead(options);
207
- const enabled = (options.enabled ?? true) && Boolean(sessionId);
208
- const [override, setOverride] = useState(null);
209
- const nextReadRevision = useRef(0);
210
- const nextReadGeneration = useRef(0);
211
- const beginRead = options.beginRead;
212
- const { run, mutating, mutationError, clearMutationError } = useMutationRunner();
213
- const load = useCallback(
214
- async (signal) => {
215
- if (!sessionId) {
216
- return null;
217
- }
218
- let readGeneration2 = 0;
219
- const fetched = await readFreshSessionDetail(client, workspaceId, sessionId, {
220
- signal,
221
- onRequestStart: () => {
222
- readGeneration2 = beginRead?.() ?? ++nextReadGeneration.current;
223
- }
224
- });
225
- setOverride(null);
226
- return {
227
- session: fetched,
228
- revision: ++nextReadRevision.current,
229
- readGeneration: readGeneration2
230
- };
231
- },
232
- [beginRead, client, workspaceId, sessionId]
233
- );
234
- const { data, loading, error, refresh } = usePolledValue(load, {
235
- pollIntervalMs: options.pollIntervalMs,
236
- enabled
237
- });
238
- useEffect(() => {
239
- if (enabled && workspaceControlEvent) void refresh();
240
- }, [enabled, refresh, workspaceControlEvent]);
241
- useEffect(() => {
242
- if (!sessionId || !enabled) return;
243
- return registerSessionReconciler(sessionId, "session", refresh);
244
- }, [enabled, refresh, registerSessionReconciler, sessionId]);
245
- const retained = useRetainedSessionView(
246
- client,
247
- workspaceId,
248
- sessionId,
249
- "detail",
250
- data?.session ?? null,
251
- { enabled, discard: deniesRetainedView(error) }
252
- );
253
- const base = data?.session ?? null;
254
- const readRevision = data?.revision ?? 0;
255
- const readGeneration = data?.readGeneration ?? 0;
256
- const session = useMemo(
257
- () => base && override && override.id === base.id ? { ...base, title: override.title, titleSource: override.titleSource } : base ?? retained,
258
- [base, override, retained]
259
- );
260
- const sharedEvents = options.events;
261
- const refreshDetail = useCallback(() => void refresh(), [refresh]);
262
- const onTitleEvent = useCallback(
263
- (event) => {
264
- if (sharedEvents?.some(
265
- (item) => item.sessionId === sessionId && !isTitleEvent(item) && isSessionDetailEvent(item) && item.sequence > (base?.lastSequence ?? -1)
266
- )) {
267
- void refresh();
268
- } else if (!isTitleEvent(event)) {
269
- if (!base || event.sequence > base.lastSequence) void refresh();
270
- return;
271
- }
272
- if (!base || event.sequence <= base.lastSequence) {
273
- return;
274
- }
275
- const payload = event.payload ?? {};
276
- const title = payload.title;
277
- if (typeof title !== "string") {
278
- return;
279
- }
280
- const source = payload.source === "user" || payload.source === "agent" ? payload.source : null;
281
- setOverride((current) => {
282
- const next = current ?? base;
283
- return { ...next, title, titleSource: source };
284
- });
285
- },
286
- [base, refresh, sharedEvents, sessionId]
287
- );
288
- useSessionEventTrigger(client, workspaceId, sessionId, isSessionDetailEvent, onTitleEvent, {
289
- enabled,
290
- ...options.events !== void 0 ? { events: options.events } : {},
291
- // The detail row is authoritative through its lastSequence: only a later
292
- // event can make it stale, and one that arrives first waits for the read.
293
- readThrough: base ? base.lastSequence : loading ? "reading" : null,
294
- refresh: refreshDetail
295
- });
296
- const updateTitle = useCallback(
297
- async (title) => {
298
- if (!sessionId) {
299
- return null;
300
- }
301
- const result = await run(() => client.updateSession(workspaceId, sessionId, { title }));
302
- if (result) {
303
- setOverride(result);
304
- }
305
- return result;
306
- },
307
- [client, workspaceId, sessionId, run]
308
- );
309
- return {
310
- session,
311
- loading: loading && retained === null,
312
- error,
313
- readRevision,
314
- readGeneration,
315
- refresh,
316
- updateTitle,
317
- updating: mutating,
318
- mutationError,
319
- clearMutationError
320
- };
321
- }
322
-
323
- // src/lib/session-startup-timeline.tsx
324
- import { useRef as useRef2 } from "react";
325
- function currentEvents(events) {
326
- return events.filter(
327
- (event) => !event.duplicateOfEventId && (!event.turnAssociation || event.turnAssociation === "current")
328
- ).sort((a, b) => a.sequence - b.sequence);
329
- }
330
- function payloadOf(event) {
331
- return event.payload && typeof event.payload === "object" ? event.payload : {};
332
- }
333
- function sessionStartupTimeline(items, input) {
334
- const { session, optimisticMessages, hasNewer } = input;
335
- if (hasNewer || session.effectiveControl.state !== "active" || !["idle", "queued", "running"].includes(session.status) || session.status === "idle" && session.inputWait)
336
- return items;
337
- const claimed = /* @__PURE__ */ new Set();
338
- const pending = /* @__PURE__ */ new Map();
339
- let queueVersion = session.queueVersion;
340
- let newerProgress = false;
341
- let observedActiveTurn = null;
342
- let previousTurnEndedAt = null;
343
- for (const event of currentEvents(input.events)) {
344
- const payload = payloadOf(event);
345
- if (event.turnId && ["turn.completed", "turn.failed", "turn.cancelled", "turn.superseded"].includes(event.type))
346
- previousTurnEndedAt = event.occurredAt;
347
- if (event.sequence > session.lastSequence && ([
348
- "turn.started",
349
- "turn.completed",
350
- "turn.failed",
351
- "turn.cancelled",
352
- "turn.superseded"
353
- ].includes(event.type) || event.type === "session.status.changed" && payload.status !== "queued" || event.type === "session.queue.changed" && ["edit", "delete"].includes(String(payload.operation))))
354
- newerProgress = true;
355
- if (event.type === "session.queue.changed" && typeof payload.queueVersion === "number")
356
- queueVersion = Math.max(queueVersion, payload.queueVersion);
357
- const turnId2 = event.turnId ?? (typeof payload.turnId === "string" ? payload.turnId : null);
358
- if (!turnId2) continue;
359
- if (event.sequence > session.lastSequence) {
360
- if (event.type === "turn.started") observedActiveTurn = turnId2;
361
- else if (observedActiveTurn === turnId2 && ["turn.completed", "turn.failed", "turn.cancelled", "turn.superseded"].includes(event.type))
362
- observedActiveTurn = null;
363
- }
364
- if ([
365
- "turn.started",
366
- "turn.completed",
367
- "turn.failed",
368
- "turn.cancelled",
369
- "turn.superseded"
370
- ].includes(event.type) || event.type === "session.queue.changed" && ["edit", "delete"].includes(String(payload.operation)))
371
- claimed.add(turnId2);
372
- if ((event.type === "turn.queued" || event.type === "user.message") && payload.routing === "accepted_for_execution" && (session.status !== "idle" || event.sequence > session.lastSequence))
373
- pending.set(turnId2, event.occurredAt);
374
- }
375
- for (const message of optimisticMessages ?? []) {
376
- if (message.state === "queued" && message.destination === "chat" && message.delivery === "send" && message.turnId && !pending.has(message.turnId) && (session.status !== "idle" || message.appliedQueueVersion != null && message.appliedQueueVersion > session.queueVersion))
377
- pending.set(message.turnId, message.occurredAt);
378
- }
379
- const head = input.queue && input.queue.version >= queueVersion ? input.queue.items[0] : null;
380
- if (session.status === "queued" && !session.activeTurnId && head && !pending.has(head.id))
381
- pending.set(
382
- head.id,
383
- previousTurnEndedAt && previousTurnEndedAt > head.createdAt ? previousTurnEndedAt : head.createdAt
384
- );
385
- const candidate = [...pending].find(
386
- ([turnId2]) => !claimed.has(turnId2) && (!session.activeTurnId || session.activeTurnId === turnId2) && (!observedActiveTurn || observedActiveTurn === turnId2) && !items.some((item) => "turnId" in item && item.turnId === turnId2)
387
- );
388
- const fallback = !candidate && !newerProgress && session.status === "queued" && !session.activeTurnId && input.fallbackStartedAt;
389
- if (!candidate && !fallback) return items;
390
- const [turnId, startedAt] = candidate ?? [
391
- `pending-startup:${session.id}`,
392
- input.fallbackStartedAt
393
- ];
394
- return [
395
- ...items,
396
- {
397
- kind: "startup-phase",
398
- id: `${turnId}-queue`,
399
- turnId,
400
- phase: "queue",
401
- status: "running",
402
- startedAt,
403
- occurredAt: startedAt,
404
- completedAt: null,
405
- durationMs: null,
406
- outcome: null,
407
- ...session.activeTurnId ? {} : { dispatchWait: session.status === "queued" ? session.dispatchWait ?? null : null }
408
- }
409
- ];
410
- }
411
- var PENDING_SCOPE = "pending-prompt";
412
- var PENDING_PROMPT_STARTUP_ID = "pending-prompt-startup";
413
- function pendingPromptItems(prompt) {
414
- return [
415
- {
416
- kind: "user-message",
417
- id: "pending-prompt-message",
418
- text: prompt.text,
419
- resources: prompt.resources ?? [],
420
- tools: [],
421
- occurredAt: prompt.sentAt
422
- },
423
- {
424
- kind: "startup-phase",
425
- id: PENDING_PROMPT_STARTUP_ID,
426
- turnId: PENDING_SCOPE,
427
- phase: "queue",
428
- status: "running",
429
- startedAt: prompt.sentAt,
430
- occurredAt: prompt.sentAt,
431
- completedAt: null,
432
- durationMs: null,
433
- outcome: null
434
- }
435
- ];
436
- }
437
- function useSessionStartupTimeline(items, input) {
438
- const startup = useSessionStartupState(input.session);
439
- const bridgeRef = useRef2(null);
440
- const { pendingPrompt } = input;
441
- if (pendingPrompt && (!input.session || input.historyReady === false)) {
442
- bridgeRef.current = {
443
- scope: PENDING_SCOPE,
444
- id: PENDING_PROMPT_STARTUP_ID,
445
- turnId: null,
446
- since: pendingPrompt.sentAt,
447
- sequence: 0
448
- };
449
- return [...items, ...pendingPromptItems(pendingPrompt)];
450
- }
451
- if (!input.session) {
452
- bridgeRef.current = null;
453
- return items;
454
- }
455
- const scope = `${input.session.workspaceId}:${input.session.id}`;
456
- if (bridgeRef.current?.scope === PENDING_SCOPE)
457
- bridgeRef.current = { ...bridgeRef.current, scope };
458
- if (bridgeRef.current?.scope !== scope || input.hasNewer || input.session.effectiveControl.state !== "active" || !["queued", "running", "idle"].includes(input.session.status))
459
- bridgeRef.current = null;
460
- const boundTurn = bridgeRef.current?.turnId;
461
- const settled = boundTurn && currentEvents(input.events).find(
462
- (event) => event.turnId === boundTurn && ["turn.completed", "turn.failed", "turn.cancelled", "turn.superseded"].includes(event.type)
463
- );
464
- let fallbackStartedAt = bridgeRef.current?.turnId === null ? bridgeRef.current.since : startup?.startedAt;
465
- if (settled) {
466
- bridgeRef.current = null;
467
- fallbackStartedAt = input.session.status === "queued" && input.session.lastSequence >= settled.sequence ? input.session.updatedAt : void 0;
468
- }
469
- const projected = sessionStartupTimeline(items, {
470
- ...input,
471
- session: input.session,
472
- fallbackStartedAt
473
- });
474
- if (projected !== items) {
475
- const phase2 = projected.at(-1);
476
- if (phase2.kind !== "startup-phase") return projected;
477
- const turnId2 = phase2.turnId === `pending-startup:${input.session.id}` ? null : phase2.turnId;
478
- let bridge2 = bridgeRef.current;
479
- if (!bridge2 || bridge2.turnId && turnId2 && bridge2.turnId !== turnId2) {
480
- bridge2 = {
481
- scope,
482
- id: phase2.id,
483
- turnId: turnId2,
484
- since: phase2.startedAt,
485
- sequence: input.session.lastSequence
486
- };
487
- } else
488
- bridge2 = {
489
- ...bridge2,
490
- turnId: turnId2 ?? bridge2.turnId,
491
- since: bridge2.since < phase2.startedAt ? bridge2.since : phase2.startedAt
492
- };
493
- bridgeRef.current = bridge2;
494
- return [
495
- ...projected.slice(0, -1),
496
- { ...phase2, id: bridge2.id, startedAt: bridge2.since, occurredAt: bridge2.since }
497
- ];
498
- }
499
- const bridge = bridgeRef.current;
500
- if (!bridge) return items;
501
- if (input.session.status === "idle") {
502
- bridgeRef.current = null;
503
- return items;
504
- }
505
- const started = currentEvents(input.events).find(
506
- (event) => event.type === "turn.started" && (bridge.turnId ? event.turnId === bridge.turnId : event.sequence > bridge.sequence)
507
- );
508
- const turnId = bridge.turnId ?? started?.turnId ?? input.session.activeTurnId;
509
- const phase = items.find((item) => item.kind === "startup-phase" && item.turnId === turnId);
510
- if (phase?.kind === "startup-phase") {
511
- bridgeRef.current = { ...bridge, turnId };
512
- return items.map(
513
- (item) => item === phase ? {
514
- ...phase,
515
- id: bridge.id,
516
- loadingStartedAt: bridge.since < phase.startedAt ? bridge.since : phase.startedAt
517
- } : item
518
- );
519
- }
520
- if (turnId && (started || input.session.activeTurnId === turnId)) {
521
- bridgeRef.current = { ...bridge, turnId };
522
- return [
523
- ...items,
524
- {
525
- kind: "startup-phase",
526
- id: bridge.id,
527
- turnId,
528
- phase: "queue",
529
- status: "complete",
530
- startedAt: bridge.since,
531
- occurredAt: bridge.since,
532
- completedAt: started?.occurredAt ?? input.session.updatedAt,
533
- durationMs: null,
534
- outcome: null
535
- }
536
- ];
537
- }
538
- if (turnId) bridgeRef.current = null;
539
- return items;
540
- }
541
-
542
- // src/hooks/use-available-models.ts
543
- import { useCallback as useCallback2 } from "react";
544
- function useAvailableModels(options = {}) {
545
- const client = useOpenGeniClient(options);
546
- const load = useCallback2(
547
- async (signal) => await client.getClientConfig({ signal }),
548
- [client]
549
- );
550
- const state = useSharedQuery(client, ["available-models"], load, {
551
- pollIntervalMs: options.pollIntervalMs,
552
- enabled: options.enabled
553
- });
554
- return {
555
- models: state.data?.models ?? [],
556
- defaultModel: state.data?.defaultModel ?? null,
557
- loading: state.loading,
558
- error: state.error,
559
- refresh: state.refresh
560
- };
561
- }
562
- function useWorkspaceModelCatalog(options) {
563
- const t = useOpenGeniText();
564
- const client = useOpenGeniClient(options);
565
- const load = useCallback2(
566
- async (signal) => {
567
- if (!options.workspaceId) {
568
- return { models: [], defaultModel: null };
569
- }
570
- const [catalog, config] = await Promise.all([
571
- client.getWorkspaceModelCatalog(options.workspaceId, { signal }),
572
- // Joins the same workspace's config read already in flight (for
573
- // example the composer's voice availability).
574
- joinClientConfigRead(client, options.workspaceId)
575
- ]);
576
- return {
577
- models: catalog.models,
578
- defaultModel: config.defaultModel
579
- };
580
- },
581
- [client, options.workspaceId]
582
- );
583
- const state = useSharedQuery(client, ["workspace-model-catalog", options.workspaceId], load, {
584
- pollIntervalMs: options.pollIntervalMs,
585
- enabled: options.enabled !== false && Boolean(options.workspaceId)
586
- });
587
- const rows = sortPickerRows(projectPickerRows(t, state.data?.models ?? []));
588
- return {
589
- models: state.data?.models ?? [],
590
- rows,
591
- defaultModel: state.data?.defaultModel ?? null,
592
- loading: state.loading,
593
- error: state.error,
594
- refresh: state.refresh
595
- };
596
- }
597
-
598
- // src/hooks/use-human-input.ts
599
- import { useCallback as useCallback3, useEffect as useEffect2, useRef as useRef3, useState as useState2 } from "react";
600
- function isHumanInputEvent(event) {
601
- return event.type === "session.humanInput.requested" || event.type === "user.humanInputResponse" || event.type === "turn.completed" || event.type === "turn.failed" || event.type === "turn.cancelled";
602
- }
603
- function useHumanInputRequests(sessionId, options = {}) {
604
- const { client, workspaceId, registerSessionReconciler } = useEmbeddedHumanInputSession(options);
605
- const enabled = (options.enabled ?? true) && Boolean(sessionId);
606
- const load = useCallback3(async () => {
607
- if (!sessionId) return [];
608
- const readStartedAt = Date.now();
609
- const requests = await client.listHumanInputRequests(workspaceId, sessionId, {
610
- status: "pending"
611
- });
612
- const now2 = Date.now();
613
- pruneHumanInputDrafts(
614
- workspaceId,
615
- sessionId,
616
- requests.filter((request) => isActionableHumanInputRequest(request, now2)).map((request) => request.id),
617
- readStartedAt
618
- );
619
- return requests;
620
- }, [client, sessionId, workspaceId]);
621
- const state = usePolledValue(load, {
622
- enabled,
623
- pollIntervalMs: options.pollIntervalMs
624
- });
625
- const loadedRequests = state.data;
626
- const refreshRequests = state.refresh;
627
- const readDenied = enabled && Boolean(sessionId) && deniesRetainedView(state.error);
628
- useEffect2(() => {
629
- if (readDenied && sessionId) forgetSessionHumanInputDrafts(workspaceId, sessionId);
630
- }, [readDenied, sessionId, workspaceId]);
631
- const mutation = useMutationRunner(`${workspaceId}\0${sessionId ?? ""}`);
632
- const [respondingRequestId, setRespondingRequestId] = useState2(null);
633
- const [deadlineVersion, setDeadlineVersion] = useState2(0);
634
- const respondingRequestRef = useRef3(null);
635
- useEffect2(() => {
636
- respondingRequestRef.current = null;
637
- setRespondingRequestId(null);
638
- }, [sessionId, workspaceId]);
639
- useEffect2(() => {
640
- if (!sessionId || !enabled) return;
641
- return registerSessionReconciler(sessionId, "human-input", state.refresh);
642
- }, [enabled, registerSessionReconciler, sessionId, state.refresh]);
643
- const scheduleRefresh = useDebouncedCallback(() => void state.refresh());
644
- useSessionEventTrigger(client, workspaceId, sessionId, isHumanInputEvent, scheduleRefresh, {
645
- enabled,
646
- ...options.events !== void 0 ? { events: options.events } : {},
647
- readThrough: projectionReadThrough(state.data, state.loading),
648
- refresh: scheduleRefresh
649
- });
650
- const retainedRequests = useRetainedSessionView(
651
- client,
652
- workspaceId,
653
- sessionId,
654
- "human-input",
655
- state.data,
656
- { enabled, discard: deniesRetainedView(state.error) }
657
- );
658
- useEffect2(() => {
659
- const now2 = Date.now();
660
- const nextDeadline = (loadedRequests ?? []).reduce((next, request) => {
661
- if (request.status !== "pending" || !request.expiresAt) return next;
662
- const deadline = Date.parse(request.expiresAt);
663
- if (!Number.isFinite(deadline) || deadline <= now2) return next;
664
- return next === null ? deadline : Math.min(next, deadline);
665
- }, null);
666
- if (nextDeadline === null) return;
667
- const timer = globalThis.setTimeout(
668
- () => {
669
- setDeadlineVersion((current) => current + 1);
670
- void refreshRequests();
671
- },
672
- Math.min(2147483647, Math.max(0, nextDeadline - now2 + 1))
673
- );
674
- return () => globalThis.clearTimeout(timer);
675
- }, [loadedRequests, refreshRequests]);
676
- const respond = useCallback3(
677
- async (requestId, response) => {
678
- if (!sessionId || respondingRequestRef.current !== null) return null;
679
- respondingRequestRef.current = requestId;
680
- setRespondingRequestId(requestId);
681
- try {
682
- const event = await mutation.run(
683
- () => client.submitHumanInputResponse(workspaceId, sessionId, requestId, response, {
684
- clientEventId: globalThis.crypto.randomUUID()
685
- })
686
- );
687
- if (event) await state.refresh();
688
- return event;
689
- } finally {
690
- if (respondingRequestRef.current === requestId) {
691
- respondingRequestRef.current = null;
692
- setRespondingRequestId(null);
693
- }
694
- }
695
- },
696
- [client, mutation, sessionId, state, workspaceId]
697
- );
698
- const now = Date.now();
699
- void deadlineVersion;
700
- return {
701
- requests: [...state.data ?? retainedRequests ?? []].filter((request) => isActionableHumanInputRequest(request, now)).sort(
702
- (left, right) => left.createdAt.localeCompare(right.createdAt) || left.id.localeCompare(right.id)
703
- ),
704
- loading: state.loading && retainedRequests === null,
705
- error: state.error,
706
- refresh: state.refresh,
707
- respond,
708
- respondingRequestId,
709
- mutationError: mutation.mutationError,
710
- clearMutationError: mutation.clearMutationError
711
- };
712
- }
713
-
714
- // src/hooks/use-session-control.ts
715
- import { useCallback as useCallback4, useLayoutEffect, useRef as useRef4 } from "react";
716
- function useSessionControl(sessionId, options = {}) {
717
- const { client, workspaceId } = useEmbeddedSession(options);
718
- const approvalTargetKey = `${workspaceId}\0${sessionId ?? ""}`;
719
- const pendingApproval = useRef4(null);
720
- useLayoutEffect(() => {
721
- if (pendingApproval.current?.targetKey !== approvalTargetKey) {
722
- pendingApproval.current = null;
723
- }
724
- }, [approvalTargetKey]);
725
- const {
726
- run: runControl,
727
- mutating: controlling,
728
- mutationError: controlError,
729
- clearMutationError: clearControlError
730
- } = useMutationRunner(approvalTargetKey);
731
- const {
732
- run: runApproval,
733
- mutating: responding,
734
- mutationError: approvalError,
735
- clearMutationError: clearApprovalError
736
- } = useMutationRunner(approvalTargetKey);
737
- const pause = useCallback4(
738
- async (reason) => {
739
- if (!sessionId) {
740
- return null;
741
- }
742
- return await runControl(
743
- () => client.pauseSession(workspaceId, sessionId, reason !== void 0 ? { reason } : {})
744
- );
745
- },
746
- [client, workspaceId, sessionId, runControl]
747
- );
748
- const resume = useCallback4(
749
- async (reason) => {
750
- if (!sessionId) return null;
751
- return await runControl(
752
- () => client.resumeSession(workspaceId, sessionId, reason !== void 0 ? { reason } : {})
753
- );
754
- },
755
- [client, workspaceId, sessionId, runControl]
756
- );
757
- const decide = useCallback4(
758
- async (approvalId, decision, message, answer, decisionOptions = {}) => {
759
- if (!sessionId) {
760
- return null;
761
- }
762
- const decisionKey = JSON.stringify([approvalId, decision, message ?? null, answer ?? null]);
763
- if (pendingApproval.current?.decisionKey !== decisionKey) {
764
- pendingApproval.current = {
765
- targetKey: approvalTargetKey,
766
- decisionKey,
767
- clientEventId: crypto.randomUUID()
768
- };
769
- }
770
- const clientEventId = pendingApproval.current.clientEventId;
771
- let refusal = null;
772
- const accepted = await runApproval(async () => {
773
- try {
774
- return await client.sendApprovalDecision(workspaceId, sessionId, {
775
- approvalId,
776
- decision,
777
- ...message !== void 0 ? { message } : {},
778
- ...answer !== void 0 ? answer : {},
779
- clientEventId
780
- });
781
- } catch (cause) {
782
- refusal = { cause };
783
- throw cause;
784
- }
785
- });
786
- if (decisionOptions.throwOnError && refusal) throw refusal.cause;
787
- if (accepted !== null && pendingApproval.current?.targetKey === approvalTargetKey && pendingApproval.current.clientEventId === clientEventId) {
788
- pendingApproval.current = null;
789
- }
790
- return accepted;
791
- },
792
- [approvalTargetKey, client, workspaceId, sessionId, runApproval]
793
- );
794
- const approve = useCallback4(
795
- async (approvalId, message, answer, decisionOptions) => await decide(approvalId, "approve", message, answer, decisionOptions),
796
- [decide]
797
- );
798
- const reject = useCallback4(
799
- async (approvalId, message, decisionOptions) => await decide(approvalId, "reject", message, void 0, decisionOptions),
800
- [decide]
801
- );
802
- const error = approvalError ?? controlError;
803
- const clearError = useCallback4(() => {
804
- clearControlError();
805
- clearApprovalError();
806
- }, [clearControlError, clearApprovalError]);
807
- return {
808
- pause,
809
- resume,
810
- controlling,
811
- approve,
812
- reject,
813
- responding,
814
- error,
815
- clearError
816
- };
817
- }
818
-
819
- // src/older-history.ts
820
- var activeReceiptCapture;
821
- var preserveTailForAutomaticLoad = false;
822
- function invokeOlderHistoryLoaderWithReceiptCapture(load, capture, preserveTail = false) {
823
- const previousCapture = activeReceiptCapture;
824
- const previousPreserveTail = preserveTailForAutomaticLoad;
825
- activeReceiptCapture = capture;
826
- preserveTailForAutomaticLoad = preserveTail;
827
- try {
828
- return load();
829
- } finally {
830
- activeReceiptCapture = previousCapture;
831
- preserveTailForAutomaticLoad = previousPreserveTail;
832
- }
833
- }
834
- function createOlderHistoryLoadReceipt(load) {
835
- let resolveResult;
836
- let rejectResult;
837
- const result = new Promise((resolve, reject) => {
838
- resolveResult = resolve;
839
- rejectResult = reject;
840
- });
841
- result.committed = false;
842
- result.tailPreserved = false;
843
- activeReceiptCapture?.(result);
844
- try {
845
- const loaded = load(
846
- () => {
847
- result.committed = true;
848
- },
849
- preserveTailForAutomaticLoad,
850
- () => {
851
- result.tailPreserved = true;
852
- }
853
- );
854
- Promise.resolve(loaded).then(resolveResult, rejectResult);
855
- } catch (error) {
856
- rejectResult(error);
857
- }
858
- return result;
859
- }
860
-
861
- // src/hooks/use-session-events.ts
862
- import {
863
- isPresentedSessionToolCall,
864
- isRetryableStreamError,
865
- isSessionModelResponsePhase,
866
- isTransientRequestError,
867
- SESSION_EVENT_COMPAT_EXCLUDED_STEP_TYPES,
868
- SESSION_EVENT_CONTENT_STEP_TYPES,
869
- SESSION_EVENT_CONVERSATION_FILTER_VERSION,
870
- SESSION_EVENT_STEP_TYPES,
871
- sessionEventStreamCoveredThrough
872
- } from "@opengeni/sdk";
873
- import { startTransition, useCallback as useCallback6, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef5, useState as useState3 } from "react";
874
-
875
- // src/hooks/page-wake.ts
876
- var PAGE_WAKE_CHECK_INTERVAL_MS = 2e3;
877
- var PAGE_WAKE_GAP_MS = 15e3;
878
- var listeners = /* @__PURE__ */ new Set();
879
- var stopDetector = null;
880
- function subscribePageWake(listener) {
881
- listeners.add(listener);
882
- stopDetector ??= startDetector();
883
- return () => {
884
- listeners.delete(listener);
885
- if (listeners.size === 0 && stopDetector) {
886
- stopDetector();
887
- stopDetector = null;
888
- }
889
- };
890
- }
891
- function emitPageWake() {
892
- for (const listener of [...listeners]) {
893
- try {
894
- listener();
895
- } catch {
896
- }
897
- }
898
- }
899
- function startDetector() {
900
- if (typeof window === "undefined" || typeof document === "undefined") return () => {
901
- };
902
- let lastTick = Date.now();
903
- const check = () => {
904
- const now = Date.now();
905
- const elapsed = now - lastTick;
906
- lastTick = now;
907
- if (elapsed > PAGE_WAKE_GAP_MS) emitPageWake();
908
- };
909
- const onVisibility = () => {
910
- if (document.visibilityState !== "hidden") check();
911
- };
912
- const onPageShow = (event) => {
913
- lastTick = Date.now();
914
- if (event?.persisted === true) emitPageWake();
915
- };
916
- const onResume = () => {
917
- lastTick = Date.now();
918
- emitPageWake();
919
- };
920
- const timer = setInterval(check, PAGE_WAKE_CHECK_INTERVAL_MS);
921
- document.addEventListener("visibilitychange", onVisibility);
922
- document.addEventListener("resume", onResume);
923
- window.addEventListener("pageshow", onPageShow);
924
- window.addEventListener("online", onResume);
925
- return () => {
926
- clearInterval(timer);
927
- document.removeEventListener("visibilitychange", onVisibility);
928
- document.removeEventListener("resume", onResume);
929
- window.removeEventListener("pageshow", onPageShow);
930
- window.removeEventListener("online", onResume);
931
- };
932
- }
933
-
934
- // src/hooks/turnless-output-gaps.ts
935
- import { useCallback as useCallback5, useSyncExternalStore } from "react";
936
- var MAX_IDLE_ENTRIES = 256;
937
- var entries = /* @__PURE__ */ new Map();
938
- function gapKey(workspaceId, sessionId) {
939
- return `${workspaceId}\0${sessionId}`;
940
- }
941
- function gapEntry(key) {
942
- let entry = entries.get(key);
943
- if (!entry) {
944
- entry = { generation: 0, listeners: /* @__PURE__ */ new Set() };
945
- entries.set(key, entry);
946
- if (entries.size > MAX_IDLE_ENTRIES) {
947
- for (const [candidate, held] of entries) {
948
- if (entries.size <= MAX_IDLE_ENTRIES) break;
949
- if (candidate !== key && held.listeners.size === 0) entries.delete(candidate);
950
- }
951
- }
952
- }
953
- return entry;
954
- }
955
- function markTurnlessOutputGap(workspaceId, sessionId) {
956
- const entry = gapEntry(gapKey(workspaceId, sessionId));
957
- entry.generation += 1;
958
- for (const listener of [...entry.listeners]) listener();
959
- }
960
- function useTurnlessOutputGap(workspaceId, sessionId) {
961
- const key = sessionId ? gapKey(workspaceId, sessionId) : null;
962
- const subscribe = useCallback5(
963
- (listener) => {
964
- if (!key) return () => {
965
- };
966
- const entry = gapEntry(key);
967
- entry.listeners.add(listener);
968
- return () => {
969
- entry.listeners.delete(listener);
970
- };
971
- },
972
- [key]
973
- );
974
- const read = useCallback5(() => key ? entries.get(key)?.generation ?? 0 : 0, [key]);
975
- return useSyncExternalStore(subscribe, read, read);
976
- }
977
-
978
- // src/hooks/use-session-events.ts
979
- import { errorMessage } from "@opengeni/contracts/values";
980
- var SESSION_FIRST_WINDOW_PAGE_SIZE = 32;
981
- var SESSION_FIRST_WINDOW_BOUNDARY_PAGE_SIZE = 255;
982
- var SESSION_HISTORY_PAGE_SIZE = 1e3;
983
- var INITIAL_FETCH_CAP = 1;
984
- var OLDER_GROUP_TARGET = 32;
985
- var OLDER_FETCH_CAP = 2;
986
- var NEWER_GROUP_TARGET = 32;
987
- var NEWER_FETCH_CAP = 2;
988
- var OLDEST_GROUP_TARGET = 32;
989
- var OLDEST_FETCH_CAP = 2;
990
- var BOUNDARY_PAGE_CAP = 1;
991
- var FILTERED_PAGE_CAP = 32;
992
- var DIRECT_REPLAY_MAX_SEQUENCES = 16;
993
- var CATCHUP_MAX_PAGES = 2;
994
- var STRICT_REJOIN_ATTEMPTS = 5;
995
- var REJOIN_STALL_TIMEOUT_MS = 3e4;
996
- var FOREGROUND_REJOIN_RETRY_MS = 500;
997
- var FOREGROUND_REJOIN_RETRY_MAX_MS = 8e3;
998
- var EMPTY_EVENTS = [];
999
- var encoder = new TextEncoder();
1000
- var SESSION_EVENT_BROWSER_MAX_BYTES = 16 * 1024 * 1024;
1001
- var SESSION_EVENT_BROWSER_MAX_COUNT = 2e4;
1002
- var SESSION_EVENT_BROWSER_PENDING_MAX_BYTES = 1024 * 1024;
1003
- var SESSION_EVENT_BROWSER_PENDING_MAX_COUNT = 256;
1004
- var EMPTY_EVENT_WINDOW = {
1005
- events: EMPTY_EVENTS,
1006
- bytes: 2,
1007
- truncated: false
1008
- };
1009
- function useSessionEvents(sessionId, options = {}) {
1010
- const t = useOpenGeniText();
1011
- const { client, workspaceId, reconcileSession } = useEmbeddedSession(options);
1012
- const enabled = options.enabled ?? true;
1013
- const pageLive = usePageLiveActivity();
1014
- const streamEnabled = enabled && pageLive;
1015
- const after = options.after ?? 0;
1016
- const replay = options.replay ?? "windowed";
1017
- const fullReplay = replay === "full" || after !== 0;
1018
- const streamKey = `${workspaceId}\0${sessionId ?? ""}\0${after}\0${fullReplay ? "full" : "windowed"}`;
1019
- const navigationIdentityRef = useRef5({ client, streamKey, enabled });
1020
- if (navigationIdentityRef.current.client !== client || navigationIdentityRef.current.streamKey !== streamKey || navigationIdentityRef.current.enabled !== enabled) {
1021
- navigationIdentityRef.current = { client, streamKey, enabled };
1022
- }
1023
- const navigationIdentity = navigationIdentityRef.current;
1024
- const ownsNavigation = useCallback6(
1025
- () => navigationIdentityRef.current === navigationIdentity,
1026
- [navigationIdentity]
1027
- );
1028
- const [eventWindow, setEventWindow] = useState3(EMPTY_EVENT_WINDOW);
1029
- const [questionEvidence, setQuestionEvidence] = useState3(null);
1030
- const [connectionState, setConnectionState] = useState3("idle");
1031
- const [error, setError] = useState3(null);
1032
- const [newerError, setNewerError] = useState3(null);
1033
- const [hasOlder, setHasOlder] = useState3(false);
1034
- const [hasNewer, setHasNewer] = useState3(false);
1035
- const [sessionStatusProjection, setSessionStatusProjection] = useState3(
1036
- null
1037
- );
1038
- const [initialLoading, setInitialLoading] = useState3(true);
1039
- const [initialHistoryReady, setInitialHistoryReady] = useState3(false);
1040
- const [loadingOlder, setLoadingOlder] = useState3(false);
1041
- const [loadingNewer, setLoadingNewer] = useState3(false);
1042
- const [loadingOldest, setLoadingOldest] = useState3(false);
1043
- const [loadingLatest, setLoadingLatest] = useState3(false);
1044
- const [loadingTarget, setLoadingTarget] = useState3(false);
1045
- const loadingTargetRef = useRef5(false);
1046
- const [streamEpoch, setStreamEpoch] = useState3(0);
1047
- const [viewMode, setViewMode] = useState3("live");
1048
- const lastSequenceRef = useRef5(after);
1049
- const streamResumeSequenceRef = useRef5(after);
1050
- const skippedStepsThroughRef = useRef5(null);
1051
- const oldestSequenceRef = useRef5(null);
1052
- const newestSequenceRef = useRef5(null);
1053
- const hasOlderRef = useRef5(false);
1054
- const hasNewerRef = useRef5(false);
1055
- const loadingOlderRef = useRef5(false);
1056
- const loadingNewerRef = useRef5(false);
1057
- const loadingOldestRef = useRef5(false);
1058
- const loadingLatestRef = useRef5(false);
1059
- const viewModeRef = useRef5("live");
1060
- const initialWindowLoadedRef = useRef5(false);
1061
- const openedStreamKeyRef = useRef5(null);
1062
- const reconcileAfterPageResumeRef = useRef5(false);
1063
- const streamAbortRef = useRef5(null);
1064
- const streamKeyRef = useRef5(null);
1065
- const generationRef = useRef5(0);
1066
- const navigationGenerationRef = useRef5(0);
1067
- const eventWindowRef = useRef5(EMPTY_EVENT_WINDOW);
1068
- const sessionStatusRef = useRef5({
1069
- sequence: after,
1070
- status: null
1071
- });
1072
- const [stateStreamKey, setStateStreamKey] = useState3(streamKey);
1073
- const historyFilter = fullReplay ? void 0 : CONVERSATION_FILTER;
1074
- const [stepStores, setStepStores] = useState3(EMPTY_STEP_STORES);
1075
- const stepStoresRef = useRef5(EMPTY_STEP_STORES);
1076
- const [turnlessSteps, setTurnlessSteps] = useState3(EMPTY_TURNLESS_STEPS);
1077
- const turnlessStepsRef = useRef5(EMPTY_TURNLESS_STEPS);
1078
- const renderedTurnlessRef = useRef5({ appended: 0, marked: false });
1079
- useEffect3(() => {
1080
- renderedTurnlessRef.current = { appended: turnlessSteps.appended, marked: false };
1081
- }, [turnlessSteps]);
1082
- const liveThroughRef = useRef5(0);
1083
- const stepGenerationRef = useRef5(0);
1084
- const stepRequestRef = useRef5(0);
1085
- const retainedTurnsRef = useRef5(/* @__PURE__ */ new Map());
1086
- const turnStepHandlesRef = useRef5(/* @__PURE__ */ new Map());
1087
- const presentedCallIdsRef = useRef5(/* @__PURE__ */ new Set());
1088
- const presentedScanRef = useRef5(null);
1089
- const startupRef = useRef5(emptyStartupTurns());
1090
- const [presentedOutputs, setPresentedOutputs] = useState3(EMPTY_PRESENTED_OUTPUTS);
1091
- const presentedRequestedRef = useRef5(/* @__PURE__ */ new Map());
1092
- const presentedFailuresRef = useRef5(/* @__PURE__ */ new Map());
1093
- const [presentedPass, setPresentedPass] = useState3(0);
1094
- const rejoinPendingRef = useRef5(false);
1095
- const streamTransientStreakRef = useRef5(null);
1096
- const commitStepStores = useCallback6((next) => {
1097
- stepStoresRef.current = next;
1098
- setStepStores(next);
1099
- }, []);
1100
- const pruneStepStores = useCallback6(
1101
- (window2, sealedBy, rereading = null) => {
1102
- const present = windowTurns(window2);
1103
- const settled = sealedBy ? settledTurns(sealedBy) : null;
1104
- const next = /* @__PURE__ */ new Map();
1105
- for (const [turnId, store] of stepStoresRef.current) {
1106
- if (present.has(turnId) && (!settled || settled.has(turnId) || turnId === rereading)) {
1107
- next.set(turnId, store);
1108
- }
1109
- }
1110
- if (next.size !== stepStoresRef.current.size) commitStepStores(next);
1111
- if (sealedBy) {
1112
- presentedRequestedRef.current = /* @__PURE__ */ new Map();
1113
- } else {
1114
- for (const [callId, request] of presentedRequestedRef.current) {
1115
- if (request.turnId && !present.has(request.turnId)) {
1116
- presentedRequestedRef.current.delete(callId);
1117
- }
1118
- }
1119
- }
1120
- setPresentedOutputs((current) => {
1121
- let kept = null;
1122
- for (const [callId, output] of current) {
1123
- if (output.turnId && present.has(output.turnId)) continue;
1124
- kept ??= new Map(current);
1125
- kept.delete(callId);
1126
- }
1127
- return kept ?? current;
1128
- });
1129
- },
1130
- [commitStepStores]
1131
- );
1132
- const presentedCallIds = useCallback6((event) => {
1133
- const ids = presentedCallIdsRef.current;
1134
- if (event.type === "agent.toolCall.created") {
1135
- notePresentedCalls([event], ids);
1136
- } else if (event.type === "agent.toolCall.output") {
1137
- const payload = event.payload;
1138
- const windowEvents = eventWindowRef.current.events;
1139
- if (typeof payload?.id === "string" && !ids.has(payload.id) && presentedScanRef.current !== windowEvents) {
1140
- presentedScanRef.current = windowEvents;
1141
- notePresentedCalls(windowEvents, ids);
1142
- }
1143
- }
1144
- return ids;
1145
- }, []);
1146
- const startupTurns = useCallback6(() => {
1147
- const windowEvents = eventWindowRef.current.events;
1148
- if (startupRef.current.window !== windowEvents) {
1149
- const state = emptyStartupTurns();
1150
- noteStartupTurns(windowEvents, state);
1151
- state.window = windowEvents;
1152
- startupRef.current = state;
1153
- }
1154
- return startupRef.current;
1155
- }, []);
1156
- const appendLiveSteps = useCallback6(
1157
- (steps) => {
1158
- if (steps.some((event) => !event.turnId)) {
1159
- const incoming = steps.filter((event) => !event.turnId);
1160
- const turnless = appendTurnlessSteps(turnlessStepsRef.current, incoming);
1161
- const rendered = renderedTurnlessRef.current;
1162
- if (!rendered.marked && turnless.appended - rendered.appended > turnless.events.length) {
1163
- rendered.marked = true;
1164
- if (sessionId) markTurnlessOutputGap(workspaceId, sessionId);
1165
- }
1166
- turnlessStepsRef.current = turnless;
1167
- setTurnlessSteps(turnless);
1168
- }
1169
- const windowEvents = withTurnlessSteps(
1170
- eventWindowRef.current.events,
1171
- turnlessStepsRef.current
1172
- );
1173
- const next = new Map(stepStoresRef.current);
1174
- const now = Date.now();
1175
- for (const [turnId, events] of groupByTurn(steps)) {
1176
- const existing = next.get(turnId);
1177
- const store = existing ?? {
1178
- events: [],
1179
- bytes: 2,
1180
- // Earlier steps exist when the window skips sequences between the
1181
- // turn's start and this first live step.
1182
- hasOlder: turnHasHiddenSequences(windowEvents, turnId, events[0].sequence),
1183
- cursor: null,
1184
- floor: null,
1185
- pinned: null,
1186
- loading: false,
1187
- error: false,
1188
- touched: now,
1189
- requestId: 0
1190
- };
1191
- let updated = { ...store, ...appendStepEvents(store, events), touched: now };
1192
- if (!retainedTurnsRef.current.get(turnId)) updated = trimLiveStepTail(updated);
1193
- next.set(turnId, updated);
1194
- }
1195
- commitStepStores(boundStepStores(next, retainedTurnsRef.current));
1196
- },
1197
- [commitStepStores, workspaceId, sessionId]
1198
- );
1199
- const loadTurnSteps = useCallback6(
1200
- (turnId, before) => {
1201
- if (!ownsNavigation() || !sessionId || fullReplay) return;
1202
- const current = stepStoresRef.current.get(turnId);
1203
- const pinnedUpper = before ?? (current?.error && current.pinned !== null ? current.pinned : void 0);
1204
- const pinned = pinnedUpper !== void 0;
1205
- if (!pinned && current?.loading) return;
1206
- const bounds = conversationTurnBounds(eventWindowRef.current.events).get(turnId);
1207
- if (!bounds) return;
1208
- if (!pinned && current && !stepStoreHasOlder(current, bounds) && !current.error) return;
1209
- const upper = pinnedUpper ?? current?.cursor ?? current?.events[0]?.sequence ?? (bounds.terminal !== null ? bounds.terminal + 1 : Number.MAX_SAFE_INTEGER);
1210
- const exactStart = bounds.started !== null;
1211
- const lower = turnStepLowerBound(bounds);
1212
- const generation = stepGenerationRef.current;
1213
- const requestId = ++stepRequestRef.current;
1214
- const isCurrent = () => ownsNavigation() && generation === stepGenerationRef.current && stepStoresRef.current.get(turnId)?.requestId === requestId;
1215
- const base = current ?? {
1216
- events: [],
1217
- bytes: 2,
1218
- hasOlder: true,
1219
- cursor: null,
1220
- floor: null,
1221
- pinned: null,
1222
- loading: false,
1223
- error: false,
1224
- touched: 0,
1225
- requestId
1226
- };
1227
- commitStepStores(
1228
- new Map(stepStoresRef.current).set(turnId, {
1229
- ...base,
1230
- pinned: pinned ? upper : null,
1231
- loading: true,
1232
- error: false,
1233
- touched: Date.now(),
1234
- requestId
1235
- })
1236
- );
1237
- void readEventPage(client, workspaceId, sessionId, {
1238
- // Bookkeeping too, whichever read built this window: rows it already
1239
- // holds (a fallback read keeps them) merge once by id.
1240
- includeTypes: [...TURN_STEP_READ_TYPES],
1241
- after: Math.max(0, lower),
1242
- before: upper,
1243
- direction: "before",
1244
- limit: SESSION_TURN_STEP_PAGE_SIZE,
1245
- compact: true,
1246
- payloadMode: "full",
1247
- // Large tool outputs arrive as bounded previews; a row reads its
1248
- // exact output when the reader needs it (see useToolOutputReads).
1249
- toolOutputs: "preview"
1250
- }).then(
1251
- (page) => {
1252
- if (!isCurrent()) return;
1253
- const own = page.events.filter((event) => event.turnId === turnId);
1254
- const latest = stepStoresRef.current.get(turnId);
1255
- const merged = pinned ? appendStepEvents(
1256
- { events: [], bytes: 2 },
1257
- [...own, ...latest.events.filter((event) => event.sequence >= upper)].sort(
1258
- (left, right) => left.sequence - right.sequence
1259
- )
1260
- ) : appendStepEvents(latest, own);
1261
- const oldestOwn = merged.events[0]?.sequence ?? upper;
1262
- const passedStart = !exactStart && page.events.some(
1263
- (event) => !!event.turnId && event.turnId !== turnId && event.sequence < oldestOwn
1264
- );
1265
- const moreBelow = !passedStart && (page.hasMore ?? page.events.length > 0);
1266
- const reachedFloor = !moreBelow && !passedStart && !exactStart;
1267
- const next = new Map(stepStoresRef.current).set(turnId, {
1268
- ...merged,
1269
- // A page read without a continuation fact (a client without
1270
- // listEventPage) offers one more page until a read comes back empty.
1271
- hasOlder: moreBelow,
1272
- // The next page continues below this page's oldest row, even when
1273
- // the page held only other turns' rows, or below the floor.
1274
- cursor: reachedFloor ? lower + 1 : page.events.reduce((oldest, event) => Math.min(oldest, event.sequence), upper),
1275
- floor: reachedFloor ? lower : null,
1276
- pinned: null,
1277
- loading: false,
1278
- error: false,
1279
- touched: Date.now(),
1280
- requestId
1281
- });
1282
- commitStepStores(boundStepStores(next, retainedTurnsRef.current));
1283
- },
1284
- () => {
1285
- if (!isCurrent()) return;
1286
- const latest = stepStoresRef.current.get(turnId);
1287
- commitStepStores(
1288
- new Map(stepStoresRef.current).set(turnId, { ...latest, loading: false, error: true })
1289
- );
1290
- }
1291
- );
1292
- },
1293
- [client, workspaceId, sessionId, fullReplay, ownsNavigation, commitStepStores]
1294
- );
1295
- const loadTurnStepsRef = useRef5(loadTurnSteps);
1296
- useEffect3(() => {
1297
- loadTurnStepsRef.current = loadTurnSteps;
1298
- }, [loadTurnSteps]);
1299
- const turnStepHandle = useCallback6((turnId) => {
1300
- let handle = turnStepHandlesRef.current.get(turnId);
1301
- if (!handle) {
1302
- const retained = retainedTurnsRef.current;
1303
- handle = {
1304
- load: () => loadTurnStepsRef.current(turnId),
1305
- retain: () => {
1306
- retained.set(turnId, (retained.get(turnId) ?? 0) + 1);
1307
- let released = false;
1308
- return () => {
1309
- if (released) return;
1310
- released = true;
1311
- const count = (retained.get(turnId) ?? 1) - 1;
1312
- if (count > 0) retained.set(turnId, count);
1313
- else retained.delete(turnId);
1314
- };
1315
- }
1316
- };
1317
- turnStepHandlesRef.current.set(turnId, handle);
1318
- }
1319
- return handle;
1320
- }, []);
1321
- useEffect3(() => {
1322
- navigationGenerationRef.current += 1;
1323
- setNewerError(null);
1324
- loadingOlderRef.current = false;
1325
- loadingNewerRef.current = false;
1326
- loadingOldestRef.current = false;
1327
- loadingTargetRef.current = false;
1328
- setQuestionEvidence(null);
1329
- setLoadingTarget(false);
1330
- setLoadingOlder(false);
1331
- setLoadingNewer(false);
1332
- setLoadingOldest(false);
1333
- return () => {
1334
- navigationGenerationRef.current += 1;
1335
- };
1336
- }, [client, workspaceId, sessionId, after, enabled, fullReplay]);
1337
- useEffect3(() => {
1338
- if (streamKeyRef.current !== streamKey) {
1339
- streamKeyRef.current = streamKey;
1340
- setStateStreamKey(streamKey);
1341
- eventWindowRef.current = EMPTY_EVENT_WINDOW;
1342
- setEventWindow(EMPTY_EVENT_WINDOW);
1343
- setError(null);
1344
- setHasOlder(false);
1345
- setHasNewer(false);
1346
- sessionStatusRef.current = { sequence: after, status: null };
1347
- setSessionStatusProjection(null);
1348
- setLoadingOlder(false);
1349
- setLoadingNewer(false);
1350
- setLoadingOldest(false);
1351
- setLoadingLatest(false);
1352
- setInitialLoading(true);
1353
- setInitialHistoryReady(false);
1354
- lastSequenceRef.current = after;
1355
- streamResumeSequenceRef.current = after;
1356
- liveThroughRef.current = after;
1357
- skippedStepsThroughRef.current = null;
1358
- oldestSequenceRef.current = null;
1359
- newestSequenceRef.current = null;
1360
- hasOlderRef.current = false;
1361
- hasNewerRef.current = false;
1362
- loadingOlderRef.current = false;
1363
- loadingNewerRef.current = false;
1364
- loadingOldestRef.current = false;
1365
- loadingLatestRef.current = false;
1366
- viewModeRef.current = "live";
1367
- setViewMode("live");
1368
- initialWindowLoadedRef.current = false;
1369
- reconcileAfterPageResumeRef.current = false;
1370
- rejoinPendingRef.current = false;
1371
- streamTransientStreakRef.current = null;
1372
- stepGenerationRef.current += 1;
1373
- stepStoresRef.current = EMPTY_STEP_STORES;
1374
- setStepStores(EMPTY_STEP_STORES);
1375
- turnlessStepsRef.current = EMPTY_TURNLESS_STEPS;
1376
- setTurnlessSteps(EMPTY_TURNLESS_STEPS);
1377
- turnStepHandlesRef.current = /* @__PURE__ */ new Map();
1378
- presentedCallIdsRef.current = /* @__PURE__ */ new Set();
1379
- presentedScanRef.current = null;
1380
- startupRef.current = emptyStartupTurns();
1381
- presentedRequestedRef.current = /* @__PURE__ */ new Map();
1382
- presentedFailuresRef.current = /* @__PURE__ */ new Map();
1383
- setPresentedOutputs(EMPTY_PRESENTED_OUTPUTS);
1384
- }
1385
- const generation = generationRef.current + 1;
1386
- generationRef.current = generation;
1387
- if (!sessionId || !streamEnabled) {
1388
- streamTransientStreakRef.current = null;
1389
- if (sessionId && enabled && !pageLive && !fullReplay && viewModeRef.current === "live" && initialWindowLoadedRef.current) {
1390
- reconcileAfterPageResumeRef.current = true;
1391
- }
1392
- setConnectionState("idle");
1393
- return;
1394
- }
1395
- if (viewMode === "history") {
1396
- reconcileAfterPageResumeRef.current = false;
1397
- setConnectionState("idle");
1398
- setInitialLoading(false);
1399
- return;
1400
- }
1401
- const reconcileForegroundResume = reconcileAfterPageResumeRef.current && !fullReplay;
1402
- reconcileAfterPageResumeRef.current = false;
1403
- const controller = new AbortController();
1404
- const detailReadMark = sessionDetailReadMark();
1405
- const isCurrent = () => generationRef.current === generation && !controller.signal.aborted && navigationIdentityRef.current.client === client && navigationIdentityRef.current.streamKey === streamKey && navigationIdentityRef.current.enabled === enabled;
1406
- streamAbortRef.current = controller;
1407
- let transientRetryTimer = null;
1408
- const scheduleTransientRetry = (delayMs, retry) => {
1409
- if (transientRetryTimer !== null) clearTimeout(transientRetryTimer);
1410
- transientRetryTimer = setTimeout(() => {
1411
- transientRetryTimer = null;
1412
- if (isCurrent()) retry();
1413
- }, delayMs);
1414
- };
1415
- let pending = [];
1416
- let pendingBytes = 2;
1417
- let flushTimer = null;
1418
- const flush = () => {
1419
- if (flushTimer !== null) {
1420
- clearTimeout(flushTimer);
1421
- flushTimer = null;
1422
- }
1423
- if (!isCurrent()) {
1424
- pending = [];
1425
- pendingBytes = 2;
1426
- return;
1427
- }
1428
- if (pending.length === 0) {
1429
- return;
1430
- }
1431
- const batch = pending;
1432
- pending = [];
1433
- pendingBytes = 2;
1434
- const lastInBatch = batch[batch.length - 1];
1435
- if (lastInBatch) {
1436
- const batchResumeSequence = Math.max(...batch.map(eventResumeSequence));
1437
- lastSequenceRef.current = Math.max(lastSequenceRef.current, batchResumeSequence);
1438
- streamResumeSequenceRef.current = Math.max(
1439
- streamResumeSequenceRef.current,
1440
- batchResumeSequence
1441
- );
1442
- liveThroughRef.current = Math.max(liveThroughRef.current, batchResumeSequence);
1443
- }
1444
- const status = observeSessionStatus(batch, sessionStatusRef);
1445
- if (status !== void 0) {
1446
- setSessionStatusProjection(status);
1447
- }
1448
- let conversation = batch;
1449
- const steps = [];
1450
- if (!fullReplay) {
1451
- const windowNewest = newestSequenceRef.current ?? 0;
1452
- const startup = startupTurns();
1453
- conversation = [];
1454
- for (const event of batch) {
1455
- if (!isConversationHistoryEvent(event, presentedCallIds(event), startup.open)) {
1456
- steps.push(event);
1457
- } else if (event.sequence > windowNewest) conversation.push(event);
1458
- noteStartupTurns([event], startup);
1459
- }
1460
- }
1461
- if (conversation.length > 0) {
1462
- const current = eventWindowRef.current;
1463
- const next = appendBrowserSessionEventWindow(current, conversation);
1464
- const retained = {
1465
- ...next,
1466
- truncated: current.truncated || next.truncated
1467
- };
1468
- eventWindowRef.current = retained;
1469
- setEventWindow(retained);
1470
- if (!fullReplay) startupRef.current.window = retained.events;
1471
- oldestSequenceRef.current = retained.events[0]?.sequence ?? null;
1472
- newestSequenceRef.current = maxResumeSequenceOrNull(retained.events);
1473
- if (retained.truncated) {
1474
- hasOlderRef.current = true;
1475
- setHasOlder(true);
1476
- }
1477
- }
1478
- if (steps.length > 0) appendLiveSteps(steps);
1479
- };
1480
- const scheduleFlush = () => {
1481
- if (!isCurrent()) return;
1482
- flushTimer ??= setTimeout(flush, 16);
1483
- };
1484
- const installCatchup = (events, head) => {
1485
- const current = eventWindowRef.current;
1486
- const windowNewest = newestSequenceRef.current ?? 0;
1487
- const fresh = events.filter((event) => event.sequence > windowNewest);
1488
- const status = observeSessionStatus(fresh, sessionStatusRef);
1489
- const next = appendBrowserSessionEventWindow(current, fresh);
1490
- const retained = { ...next, truncated: current.truncated || next.truncated };
1491
- eventWindowRef.current = retained;
1492
- oldestSequenceRef.current = retained.events[0]?.sequence ?? oldestSequenceRef.current;
1493
- newestSequenceRef.current = maxResumeSequenceOrNull(retained.events) ?? newestSequenceRef.current;
1494
- lastSequenceRef.current = Math.max(lastSequenceRef.current, head);
1495
- streamResumeSequenceRef.current = Math.max(streamResumeSequenceRef.current, head);
1496
- if (skippedStepsThroughRef.current !== null) {
1497
- skippedStepsThroughRef.current = Math.max(skippedStepsThroughRef.current, head);
1498
- }
1499
- if (status !== void 0) setSessionStatusProjection(status);
1500
- if (fresh.length > 0) setEventWindow(retained);
1501
- if (retained.truncated) {
1502
- hasOlderRef.current = true;
1503
- setHasOlder(true);
1504
- }
1505
- };
1506
- const effectScope = { signal: controller.signal, isCurrent };
1507
- const readSessionHead = async (mark, scope) => {
1508
- const joined = joinSessionDetailRead(client, workspaceId, sessionId, mark);
1509
- if (joined) {
1510
- try {
1511
- return await joined;
1512
- } catch (cause) {
1513
- if (scope.signal.aborted) throw cause;
1514
- }
1515
- }
1516
- return await client.getSession(workspaceId, sessionId, {
1517
- fresh: true,
1518
- signal: scope.signal
1519
- });
1520
- };
1521
- const rejoinLive = async (force, {
1522
- strict = false,
1523
- mark = detailReadMark,
1524
- scope = effectScope
1525
- } = {}) => {
1526
- const activeTurn = activeConversationTurn(eventWindowRef.current.events);
1527
- if (!force && !activeTurn) return "joined";
1528
- const cursor = streamResumeSequenceRef.current;
1529
- let head;
1530
- let sessionActiveTurn = null;
1531
- try {
1532
- const session = await readSessionHead(mark, scope);
1533
- scope.progress?.();
1534
- head = session.lastSequence;
1535
- sessionActiveTurn = session.activeTurnId;
1536
- } catch (cause) {
1537
- if (!scope.isCurrent() || strict && isRetryableStreamError(cause)) throw cause;
1538
- return "joined";
1539
- }
1540
- if (!scope.isCurrent()) throw abortError();
1541
- if (!Number.isSafeInteger(head) || head - cursor <= DIRECT_REPLAY_MAX_SEQUENCES) {
1542
- return "joined";
1543
- }
1544
- let catchup;
1545
- try {
1546
- catchup = await loadConversationCatchup(
1547
- client,
1548
- workspaceId,
1549
- sessionId,
1550
- cursor,
1551
- head,
1552
- scope
1553
- );
1554
- } catch (cause) {
1555
- if (!scope.isCurrent() || strict && isRetryableStreamError(cause)) throw cause;
1556
- return "joined";
1557
- }
1558
- if (!scope.isCurrent()) throw abortError();
1559
- if (catchup === null) return "reload";
1560
- const previous = eventWindowRef.current.events;
1561
- installCatchup(catchup, head);
1562
- const working = sessionActiveTurn ?? activeConversationTurn(eventWindowRef.current.events);
1563
- pruneStepStores(eventWindowRef.current.events, previous, working);
1564
- if (working) loadTurnStepsRef.current(working, head + 1);
1565
- if (working && conversationTurnBounds(eventWindowRef.current.events).has(working)) {
1566
- skippedStepsThroughRef.current = null;
1567
- }
1568
- return "joined";
1569
- };
1570
- const loadLatestWindow = async (scope = effectScope) => {
1571
- const window2 = await loadEventWindow(t, client, workspaceId, sessionId, {
1572
- before: Number.MAX_SAFE_INTEGER,
1573
- pageSize: SESSION_FIRST_WINDOW_PAGE_SIZE,
1574
- targetGroups: Number.POSITIVE_INFINITY,
1575
- maxFetches: INITIAL_FETCH_CAP,
1576
- boundaryPageCap: BOUNDARY_PAGE_CAP,
1577
- boundaryPageSize: SESSION_FIRST_WINDOW_BOUNDARY_PAGE_SIZE,
1578
- signal: scope.signal,
1579
- ...scope.progress ? { progress: scope.progress } : {},
1580
- filter: CONVERSATION_FILTER
1581
- });
1582
- if (!scope.isCurrent()) {
1583
- return false;
1584
- }
1585
- const status = observeSessionStatus(window2.events, sessionStatusRef);
1586
- const retained = boundBrowserSessionEventWindow(window2.events);
1587
- navigationGenerationRef.current += 1;
1588
- loadingOlderRef.current = false;
1589
- loadingNewerRef.current = false;
1590
- loadingOldestRef.current = false;
1591
- setLoadingOlder(false);
1592
- setLoadingNewer(false);
1593
- setLoadingOldest(false);
1594
- const previous = eventWindowRef.current.events;
1595
- eventWindowRef.current = retained;
1596
- pruneStepStores(retained.events, previous);
1597
- oldestSequenceRef.current = retained.events[0]?.sequence ?? window2.oldestSequence ?? window2.scanCursor;
1598
- newestSequenceRef.current = maxResumeSequenceOrNull(retained.events) ?? window2.newestSequence;
1599
- hasOlderRef.current = window2.hasOlder || retained.truncated;
1600
- hasNewerRef.current = false;
1601
- lastSequenceRef.current = Math.max(lastSequenceRef.current, window2.newestSequence);
1602
- streamResumeSequenceRef.current = window2.newestSequence;
1603
- skippedStepsThroughRef.current = retained.events.length === 0 && window2.newestSequence > 0 ? window2.newestSequence : null;
1604
- initialWindowLoadedRef.current = true;
1605
- streamTransientStreakRef.current = null;
1606
- setInitialHistoryReady(true);
1607
- setError(null);
1608
- if (status !== void 0) {
1609
- setSessionStatusProjection(status);
1610
- }
1611
- setEventWindow(retained);
1612
- setHasOlder(window2.hasOlder || retained.truncated);
1613
- setHasNewer(false);
1614
- setInitialLoading(false);
1615
- return true;
1616
- };
1617
- const noteStreamResume = () => {
1618
- if (!fullReplay && streamResumeSequenceRef.current > liveThroughRef.current) {
1619
- markTurnlessOutputGap(workspaceId, sessionId);
1620
- }
1621
- liveThroughRef.current = Math.max(liveThroughRef.current, streamResumeSequenceRef.current);
1622
- };
1623
- const reconcileAfterOpen = (initialOpen, streak = null) => {
1624
- void Promise.resolve().then(() => reconcileSession(sessionId, { initialOpen })).catch((cause) => {
1625
- if (!isCurrent()) return;
1626
- if (isTransientRequestError(cause)) {
1627
- const now = Date.now();
1628
- const current = streak ?? { since: now, attempts: 0, surfaced: false };
1629
- const step = transientReadRetryStep(current, now, DEFAULT_TRANSIENT_READ_RETRY, cause);
1630
- if (step.quiet) {
1631
- scheduleTransientRetry(step.delayMs, () => reconcileAfterOpen(initialOpen, current));
1632
- return;
1633
- }
1634
- }
1635
- setError(normalizeError(cause));
1636
- });
1637
- };
1638
- const boundedRejoin = async (strict, join) => {
1639
- if (!isCurrent()) throw abortError();
1640
- const attempt = new AbortController();
1641
- let timedOut = false;
1642
- const abortAttempt = () => attempt.abort();
1643
- controller.signal.addEventListener("abort", abortAttempt, { once: true });
1644
- const stalled = () => {
1645
- timedOut = true;
1646
- attempt.abort();
1647
- };
1648
- let timer = setTimeout(stalled, REJOIN_STALL_TIMEOUT_MS);
1649
- let stopWaiting;
1650
- const stopped = new Promise((_resolve, reject) => {
1651
- stopWaiting = () => reject(abortError());
1652
- attempt.signal.addEventListener("abort", stopWaiting, { once: true });
1653
- });
1654
- const scope = {
1655
- signal: attempt.signal,
1656
- isCurrent: () => isCurrent() && !attempt.signal.aborted,
1657
- progress: () => {
1658
- if (attempt.signal.aborted) return;
1659
- clearTimeout(timer);
1660
- timer = setTimeout(stalled, REJOIN_STALL_TIMEOUT_MS);
1661
- }
1662
- };
1663
- try {
1664
- return await Promise.race([join(scope), stopped]);
1665
- } catch (cause) {
1666
- if (!isCurrent()) throw cause;
1667
- if (timedOut) {
1668
- return strict ? {
1669
- retry: new TypeError(
1670
- `rejoining the live session stalled for ${REJOIN_STALL_TIMEOUT_MS}ms`
1671
- )
1672
- } : "joined";
1673
- }
1674
- if (strict && isRetryableStreamError(cause)) return { retry: cause };
1675
- throw cause;
1676
- } finally {
1677
- clearTimeout(timer);
1678
- controller.signal.removeEventListener("abort", abortAttempt);
1679
- if (stopWaiting) attempt.signal.removeEventListener("abort", stopWaiting);
1680
- }
1681
- };
1682
- const leniently = async (join) => {
1683
- const result = await boundedRejoin(false, join);
1684
- return typeof result === "string" ? result : "joined";
1685
- };
1686
- let strictFailures = 0;
1687
- const beforeReconnect = async (cursor) => {
1688
- flush();
1689
- if (!isCurrent()) throw abortError();
1690
- const strict = strictFailures < STRICT_REJOIN_ATTEMPTS;
1691
- const mark = sessionDetailReadMark();
1692
- let result;
1693
- try {
1694
- result = await boundedRejoin(strict, async (scope) => {
1695
- if (await rejoinLive(true, { strict, mark, scope }) === "joined") return "joined";
1696
- let loaded;
1697
- try {
1698
- loaded = await loadLatestWindow(scope);
1699
- } catch (cause) {
1700
- if (!scope.isCurrent() || strict && isRetryableStreamError(cause)) throw cause;
1701
- return "joined";
1702
- }
1703
- if (!loaded) throw abortError();
1704
- if (await rejoinLive(true, { strict, mark, scope }) === "reload" && strict) {
1705
- throw new TypeError("the session outran a fresh window while rejoining it");
1706
- }
1707
- return "joined";
1708
- });
1709
- } catch (cause) {
1710
- if (!isCurrent()) throw abortError();
1711
- if (!isRetryableStreamError(cause)) throw cause;
1712
- throw new Error(`rejoining the live session failed: ${errorMessage(cause)}`, { cause });
1713
- }
1714
- if (!isCurrent()) throw abortError();
1715
- if (typeof result === "object") {
1716
- strictFailures += 1;
1717
- throw result.retry;
1718
- }
1719
- noteStreamResume();
1720
- return Math.max(cursor, streamResumeSequenceRef.current);
1721
- };
1722
- void (async () => {
1723
- try {
1724
- if (reconcileForegroundResume) {
1725
- setConnectionState("connecting");
1726
- let outcome;
1727
- for (let attempt = 0; ; attempt += 1) {
1728
- const strict = attempt < STRICT_REJOIN_ATTEMPTS;
1729
- const result = await boundedRejoin(
1730
- strict,
1731
- (scope) => rejoinLive(true, { strict, scope })
1732
- );
1733
- if (typeof result === "string") {
1734
- outcome = result;
1735
- break;
1736
- }
1737
- await abortableDelay(
1738
- Math.min(FOREGROUND_REJOIN_RETRY_MS * 2 ** attempt, FOREGROUND_REJOIN_RETRY_MAX_MS),
1739
- controller.signal
1740
- );
1741
- }
1742
- if (outcome === "reload") {
1743
- initialWindowLoadedRef.current = false;
1744
- setError(null);
1745
- }
1746
- } else if (!fullReplay && initialWindowLoadedRef.current && rejoinPendingRef.current) {
1747
- rejoinPendingRef.current = false;
1748
- if (await leniently((scope) => rejoinLive(false, { scope })) === "reload") {
1749
- initialWindowLoadedRef.current = false;
1750
- }
1751
- }
1752
- rejoinPendingRef.current = false;
1753
- const windowPasses = fullReplay ? 0 : 2;
1754
- for (let attempt = 0; attempt < windowPasses && !initialWindowLoadedRef.current; attempt += 1) {
1755
- setConnectionState("connecting");
1756
- if (!await loadLatestWindow()) {
1757
- return;
1758
- }
1759
- if (await leniently((scope) => rejoinLive(true, { scope })) === "reload" && attempt === 0) {
1760
- initialWindowLoadedRef.current = false;
1761
- }
1762
- }
1763
- if (fullReplay) {
1764
- setInitialLoading(false);
1765
- }
1766
- noteStreamResume();
1767
- const stream = client.streamEvents(workspaceId, sessionId, {
1768
- after: streamResumeSequenceRef.current,
1769
- signal: controller.signal,
1770
- // Full replay keeps the SDK's exactly-once reconnects.
1771
- ...fullReplay ? {} : { beforeReconnect },
1772
- onOpen: () => {
1773
- const initialOpen = openedStreamKeyRef.current !== streamKey;
1774
- openedStreamKeyRef.current = streamKey;
1775
- strictFailures = 0;
1776
- if (streamTransientStreakRef.current?.surfaced) setError(null);
1777
- streamTransientStreakRef.current = null;
1778
- reconcileAfterOpen(initialOpen);
1779
- },
1780
- onStateChange: (state) => {
1781
- if (isCurrent()) {
1782
- setConnectionState(state);
1783
- }
1784
- }
1785
- });
1786
- for await (const event of stream) {
1787
- if (!isCurrent()) break;
1788
- const boundedEvent = event;
1789
- const boundedEventBytes = browserJsonBytes(boundedEvent);
1790
- const separatorBytes = pending.length === 0 ? 0 : 1;
1791
- if (pending.length > 0 && (pending.length >= SESSION_EVENT_BROWSER_PENDING_MAX_COUNT || pendingBytes + separatorBytes + boundedEventBytes > SESSION_EVENT_BROWSER_PENDING_MAX_BYTES)) {
1792
- flush();
1793
- }
1794
- pending.push(boundedEvent);
1795
- pendingBytes += (pending.length === 1 ? 0 : 1) + boundedEventBytes;
1796
- if (pending.length >= SESSION_EVENT_BROWSER_PENDING_MAX_COUNT || pendingBytes >= SESSION_EVENT_BROWSER_PENDING_MAX_BYTES) {
1797
- flush();
1798
- } else {
1799
- scheduleFlush();
1800
- }
1801
- }
1802
- if (isCurrent()) {
1803
- flush();
1804
- setConnectionState("ended");
1805
- }
1806
- } catch (cause) {
1807
- if (isCurrent()) {
1808
- flush();
1809
- let announce = true;
1810
- if (isTransientRequestError(cause)) {
1811
- const now = Date.now();
1812
- const streak = streamTransientStreakRef.current ??= {
1813
- since: now,
1814
- attempts: 0,
1815
- surfaced: false
1816
- };
1817
- const step = transientReadRetryStep(streak, now, DEFAULT_TRANSIENT_READ_RETRY, cause);
1818
- scheduleTransientRetry(step.delayMs, () => setStreamEpoch((epoch) => epoch + 1));
1819
- if (step.quiet) {
1820
- setConnectionState("connecting");
1821
- return;
1822
- }
1823
- announce = !streak.surfaced;
1824
- streak.surfaced = true;
1825
- } else {
1826
- streamTransientStreakRef.current = null;
1827
- }
1828
- if (announce) setError(normalizeError(cause));
1829
- setConnectionState("error");
1830
- setInitialLoading(false);
1831
- }
1832
- }
1833
- })();
1834
- return () => {
1835
- controller.abort();
1836
- if (transientRetryTimer !== null) clearTimeout(transientRetryTimer);
1837
- if (generationRef.current === generation) {
1838
- generationRef.current = generation + 1;
1839
- }
1840
- if (streamAbortRef.current === controller) {
1841
- streamAbortRef.current = null;
1842
- }
1843
- if (flushTimer !== null) {
1844
- clearTimeout(flushTimer);
1845
- }
1846
- };
1847
- }, [
1848
- client,
1849
- workspaceId,
1850
- sessionId,
1851
- after,
1852
- enabled,
1853
- pageLive,
1854
- streamEnabled,
1855
- fullReplay,
1856
- streamKey,
1857
- streamEpoch,
1858
- viewMode,
1859
- reconcileSession,
1860
- t,
1861
- pruneStepStores,
1862
- appendLiveSteps,
1863
- presentedCallIds,
1864
- startupTurns
1865
- ]);
1866
- useEffect3(() => {
1867
- if (!sessionId || !streamEnabled) return;
1868
- return subscribePageWake(() => {
1869
- const stream = streamAbortRef.current;
1870
- if (!stream || stream.signal.aborted || viewModeRef.current !== "live") return;
1871
- if (!fullReplay && initialWindowLoadedRef.current) {
1872
- reconcileAfterPageResumeRef.current = true;
1873
- }
1874
- setStreamEpoch((epoch) => epoch + 1);
1875
- });
1876
- }, [sessionId, streamEnabled, fullReplay]);
1877
- const navigationBusy = () => loadingTargetRef.current || loadingOlderRef.current || loadingNewerRef.current || loadingOldestRef.current || loadingLatestRef.current;
1878
- const loadOlder = useCallback6(
1879
- () => createOlderHistoryLoadReceipt(async (markCommitted, preserveTail, markTailPreserved) => {
1880
- if (!ownsNavigation() || !sessionId || navigationBusy() || !hasOlderRef.current) {
1881
- return false;
1882
- }
1883
- const before = oldestSequenceRef.current;
1884
- if (before === null) {
1885
- oldestSequenceRef.current = null;
1886
- hasOlderRef.current = false;
1887
- setHasOlder(false);
1888
- return false;
1889
- }
1890
- const generation = navigationGenerationRef.current;
1891
- const isCurrent = () => ownsNavigation() && navigationGenerationRef.current === generation;
1892
- loadingOlderRef.current = true;
1893
- setLoadingOlder(true);
1894
- let published = false;
1895
- try {
1896
- const window2 = await loadEventWindow(t, client, workspaceId, sessionId, {
1897
- before,
1898
- pageSize: SESSION_HISTORY_PAGE_SIZE,
1899
- targetGroups: OLDER_GROUP_TARGET,
1900
- maxFetches: OLDER_FETCH_CAP,
1901
- filteredPageCap: FILTERED_PAGE_CAP,
1902
- isCurrent,
1903
- filter: historyFilter
1904
- });
1905
- if (!isCurrent()) {
1906
- return false;
1907
- }
1908
- if (window2.events.length === 0) {
1909
- if (window2.hasOlder && window2.scanCursor < before) {
1910
- oldestSequenceRef.current = window2.scanCursor;
1911
- return true;
1912
- }
1913
- oldestSequenceRef.current = null;
1914
- hasOlderRef.current = false;
1915
- setHasOlder(false);
1916
- return false;
1917
- }
1918
- const current = eventWindowRef.current;
1919
- assertPrependOrder(current.events, window2.events);
1920
- const next = boundBrowserSessionEventWindow([...window2.events, ...current.events], {
1921
- direction: "oldest"
1922
- });
1923
- if (preserveTail && maxResumeSequence(next.events) < maxResumeSequence(current.events)) {
1924
- markTailPreserved();
1925
- return false;
1926
- }
1927
- const status = observeSessionStatus(window2.events, sessionStatusRef);
1928
- const retained = {
1929
- ...next,
1930
- truncated: current.truncated || next.truncated
1931
- };
1932
- const retainedOldest = retained.events[0]?.sequence ?? null;
1933
- if (retainedOldest === null || retainedOldest >= before) {
1934
- throw new Error("@opengeni/react: loadOlder made no durable sequence progress");
1935
- }
1936
- const retainedNewest = maxResumeSequenceOrNull(retained.events);
1937
- const previousNewest = maxResumeSequenceOrNull(current.events);
1938
- const evictedLiveTail = previousNewest !== null && retainedNewest !== null && retainedNewest < previousNewest;
1939
- if (evictedLiveTail && viewModeRef.current === "live") {
1940
- streamAbortRef.current?.abort();
1941
- }
1942
- eventWindowRef.current = retained;
1943
- if (evictedLiveTail) {
1944
- skippedStepsThroughRef.current = null;
1945
- pruneStepStores(retained.events, current.events);
1946
- } else {
1947
- const skippedThrough = skippedStepsThroughRef.current;
1948
- if (skippedThrough !== null && windowTurns(window2.events).size > 0) {
1949
- skippedStepsThroughRef.current = null;
1950
- const working = activeConversationTurn(retained.events);
1951
- const bounds = working ? conversationTurnBounds(retained.events).get(working) : void 0;
1952
- if (working && bounds && bounds.first <= skippedThrough) {
1953
- loadTurnStepsRef.current(working, skippedThrough + 1);
1954
- }
1955
- }
1956
- }
1957
- markCommitted();
1958
- oldestSequenceRef.current = retainedOldest;
1959
- newestSequenceRef.current = retainedNewest;
1960
- if (evictedLiveTail) {
1961
- streamResumeSequenceRef.current = maxResumeSequence(retained.events);
1962
- }
1963
- const olderStillAvailable = window2.hasOlder;
1964
- hasOlderRef.current = olderStillAvailable;
1965
- let newer = null;
1966
- let enterHistory = false;
1967
- if (viewModeRef.current === "history" || evictedLiveTail) {
1968
- const highWater = lastSequenceRef.current;
1969
- newer = retainedNewest !== null && (retainedNewest < highWater || retained.truncated);
1970
- hasNewerRef.current = newer;
1971
- if (evictedLiveTail) {
1972
- viewModeRef.current = "history";
1973
- enterHistory = true;
1974
- }
1975
- }
1976
- loadingOlderRef.current = false;
1977
- startTransition(() => {
1978
- if (status !== void 0) {
1979
- setSessionStatusProjection(status);
1980
- }
1981
- setEventWindow(retained);
1982
- setHasOlder(olderStillAvailable);
1983
- if (newer !== null) {
1984
- setHasNewer(newer);
1985
- }
1986
- if (enterHistory) {
1987
- setViewMode("history");
1988
- }
1989
- setLoadingOlder(false);
1990
- });
1991
- published = true;
1992
- return olderStillAvailable;
1993
- } catch (reason) {
1994
- if (!isCurrent()) return false;
1995
- throw reason;
1996
- } finally {
1997
- if (!published && isCurrent()) {
1998
- loadingOlderRef.current = false;
1999
- setLoadingOlder(false);
2000
- }
2001
- }
2002
- }),
2003
- [client, workspaceId, sessionId, ownsNavigation, t, historyFilter, pruneStepStores]
2004
- );
2005
- const loadOldest = useCallback6(async () => {
2006
- if (!ownsNavigation() || !sessionId || navigationBusy() || !hasOlderRef.current) {
2007
- return false;
2008
- }
2009
- const generation = ++navigationGenerationRef.current;
2010
- const isCurrent = () => ownsNavigation() && navigationGenerationRef.current === generation;
2011
- setQuestionEvidence(null);
2012
- loadingOldestRef.current = true;
2013
- setLoadingOldest(true);
2014
- let published = false;
2015
- try {
2016
- const window2 = await loadForwardEventWindow(t, client, workspaceId, sessionId, {
2017
- after: 0,
2018
- pageSize: SESSION_HISTORY_PAGE_SIZE,
2019
- targetGroups: OLDEST_GROUP_TARGET,
2020
- maxFetches: OLDEST_FETCH_CAP,
2021
- isCurrent,
2022
- filter: historyFilter
2023
- });
2024
- if (!isCurrent()) {
2025
- return false;
2026
- }
2027
- if (window2.events.length === 0) {
2028
- hasOlderRef.current = false;
2029
- setHasOlder(false);
2030
- return false;
2031
- }
2032
- streamAbortRef.current?.abort();
2033
- const status = observeSessionStatus(window2.events, sessionStatusRef);
2034
- const retained = boundBrowserSessionEventWindow(window2.events, { direction: "oldest" });
2035
- const retainedOldest = retained.events[0]?.sequence ?? null;
2036
- const retainedNewest = maxResumeSequenceOrNull(retained.events);
2037
- const previous = eventWindowRef.current.events;
2038
- eventWindowRef.current = retained;
2039
- skippedStepsThroughRef.current = null;
2040
- pruneStepStores(retained.events, previous);
2041
- oldestSequenceRef.current = retainedOldest;
2042
- newestSequenceRef.current = retainedNewest;
2043
- hasOlderRef.current = false;
2044
- const highWater = Math.max(lastSequenceRef.current, retainedNewest ?? 0);
2045
- lastSequenceRef.current = highWater;
2046
- const newer = window2.hasNewer || retained.truncated || retainedNewest !== null && retainedNewest < highWater;
2047
- hasNewerRef.current = newer;
2048
- initialWindowLoadedRef.current = true;
2049
- setInitialHistoryReady(true);
2050
- setError(null);
2051
- viewModeRef.current = "history";
2052
- loadingOldestRef.current = false;
2053
- setNewerError(null);
2054
- startTransition(() => {
2055
- if (status !== void 0) {
2056
- setSessionStatusProjection(status);
2057
- }
2058
- setEventWindow(retained);
2059
- setHasOlder(false);
2060
- setHasNewer(newer);
2061
- setViewMode("history");
2062
- setLoadingOldest(false);
2063
- });
2064
- published = true;
2065
- return newer;
2066
- } catch (reason) {
2067
- if (!isCurrent()) return false;
2068
- throw reason;
2069
- } finally {
2070
- if (!published && isCurrent()) {
2071
- loadingOldestRef.current = false;
2072
- setLoadingOldest(false);
2073
- }
2074
- }
2075
- }, [client, workspaceId, sessionId, ownsNavigation, t, historyFilter, pruneStepStores]);
2076
- const loadNewer = useCallback6(async () => {
2077
- if (!ownsNavigation() || !sessionId || navigationBusy() || !hasNewerRef.current) {
2078
- return false;
2079
- }
2080
- const afterSequence = newestSequenceRef.current;
2081
- if (afterSequence === null) {
2082
- hasNewerRef.current = false;
2083
- setHasNewer(false);
2084
- return false;
2085
- }
2086
- const generation = navigationGenerationRef.current;
2087
- const isCurrent = () => ownsNavigation() && navigationGenerationRef.current === generation;
2088
- loadingNewerRef.current = true;
2089
- setLoadingNewer(true);
2090
- let published = false;
2091
- try {
2092
- const window2 = await loadForwardEventWindow(t, client, workspaceId, sessionId, {
2093
- after: afterSequence,
2094
- pageSize: SESSION_HISTORY_PAGE_SIZE,
2095
- targetGroups: NEWER_GROUP_TARGET,
2096
- maxFetches: NEWER_FETCH_CAP,
2097
- filteredPageCap: FILTERED_PAGE_CAP,
2098
- isCurrent,
2099
- filter: historyFilter
2100
- });
2101
- if (!isCurrent()) {
2102
- return false;
2103
- }
2104
- if (window2.events.length === 0) {
2105
- if (window2.hasNewer && window2.scanCursor > afterSequence) {
2106
- newestSequenceRef.current = window2.scanCursor;
2107
- return true;
2108
- }
2109
- setNewerError(null);
2110
- hasNewerRef.current = false;
2111
- setHasNewer(false);
2112
- streamResumeSequenceRef.current = afterSequence;
2113
- rejoinPendingRef.current = true;
2114
- viewModeRef.current = "live";
2115
- setViewMode("live");
2116
- setStreamEpoch((epoch) => epoch + 1);
2117
- return false;
2118
- }
2119
- const current = eventWindowRef.current;
2120
- assertAppendOrder(current.events, window2.events);
2121
- const status = observeSessionStatus(window2.events, sessionStatusRef);
2122
- const previousOldest = current.events[0]?.sequence ?? null;
2123
- const next = appendBrowserSessionEventWindow(current, window2.events);
2124
- const retained = {
2125
- ...next,
2126
- truncated: current.truncated || next.truncated || window2.hasNewer
2127
- };
2128
- const retainedOldest = retained.events[0]?.sequence ?? null;
2129
- const retainedNewest = maxResumeSequenceOrNull(retained.events);
2130
- if (retainedNewest === null || retainedNewest <= afterSequence) {
2131
- throw new Error("@opengeni/react: loadNewer made no durable sequence progress");
2132
- }
2133
- eventWindowRef.current = retained;
2134
- pruneStepStores(retained.events, null);
2135
- oldestSequenceRef.current = retainedOldest;
2136
- newestSequenceRef.current = retainedNewest;
2137
- if (retainedOldest !== null && (previousOldest === null || retainedOldest > previousOldest || retained.truncated && retained.events[0]?.type !== "session.created" && retainedOldest > 1)) {
2138
- hasOlderRef.current = true;
2139
- }
2140
- const rearmedOlder = hasOlderRef.current;
2141
- const highWater = Math.max(lastSequenceRef.current, retainedNewest);
2142
- lastSequenceRef.current = highWater;
2143
- const newer = window2.hasNewer || retainedNewest < highWater;
2144
- hasNewerRef.current = newer;
2145
- let resumeLive = false;
2146
- if (!newer) {
2147
- streamResumeSequenceRef.current = retainedNewest;
2148
- rejoinPendingRef.current = true;
2149
- viewModeRef.current = "live";
2150
- resumeLive = true;
2151
- }
2152
- loadingNewerRef.current = false;
2153
- setNewerError(null);
2154
- startTransition(() => {
2155
- if (status !== void 0) {
2156
- setSessionStatusProjection(status);
2157
- }
2158
- setEventWindow(retained);
2159
- setHasOlder(rearmedOlder);
2160
- setHasNewer(newer);
2161
- if (resumeLive) {
2162
- setViewMode("live");
2163
- setStreamEpoch((epoch) => epoch + 1);
2164
- }
2165
- setLoadingNewer(false);
2166
- });
2167
- published = true;
2168
- return newer;
2169
- } catch (reason) {
2170
- if (!isCurrent()) {
2171
- return false;
2172
- }
2173
- setNewerError(normalizeError(reason));
2174
- throw reason;
2175
- } finally {
2176
- if (!published && isCurrent()) {
2177
- loadingNewerRef.current = false;
2178
- setLoadingNewer(false);
2179
- }
2180
- }
2181
- }, [client, workspaceId, sessionId, ownsNavigation, t, historyFilter, pruneStepStores]);
2182
- const jumpToSequence = useCallback6(
2183
- async (sequence, navigationOptions) => {
2184
- const signal = navigationOptions?.signal;
2185
- if (!ownsNavigation() || !sessionId || !Number.isSafeInteger(sequence) || sequence < 1)
2186
- return false;
2187
- if (signal?.aborted) return false;
2188
- const generation = ++navigationGenerationRef.current;
2189
- setQuestionEvidence(null);
2190
- const current = () => generation === navigationGenerationRef.current && ownsNavigation();
2191
- const previousMode = viewModeRef.current;
2192
- streamAbortRef.current?.abort();
2193
- generationRef.current += 1;
2194
- viewModeRef.current = "history";
2195
- setViewMode("history");
2196
- loadingOlderRef.current = loadingNewerRef.current = loadingOldestRef.current = false;
2197
- setLoadingOlder(false);
2198
- setLoadingNewer(false);
2199
- setLoadingOldest(false);
2200
- loadingTargetRef.current = true;
2201
- setLoadingTarget(true);
2202
- let published = false;
2203
- try {
2204
- const around = (filter) => Promise.all([
2205
- loadPreviousPage(client, workspaceId, sessionId, sequence + 1, {
2206
- pageSize: 128,
2207
- filter
2208
- }),
2209
- loadNextPage(client, workspaceId, sessionId, sequence, { pageSize: 128, filter })
2210
- ]);
2211
- let [before, following] = await around(historyFilter);
2212
- if (historyFilter && current() && !before.some((event) => event.sequence === sequence)) {
2213
- [before, following] = await around(void 0);
2214
- }
2215
- if (signal?.aborted) return false;
2216
- if (!current()) return false;
2217
- if (!before.some((event) => event.sequence === sequence)) return false;
2218
- const prefix = boundBrowserSessionEventWindow(before, {
2219
- direction: "newest",
2220
- maxBytes: SESSION_EVENT_BROWSER_MAX_BYTES / 2
2221
- });
2222
- const retained = boundBrowserSessionEventWindow([...prefix.events, ...following], {
2223
- direction: "oldest"
2224
- });
2225
- if (!retained.events.some((event) => event.sequence === sequence)) return false;
2226
- streamAbortRef.current?.abort();
2227
- generationRef.current += 1;
2228
- const status = observeSessionStatus(retained.events, sessionStatusRef);
2229
- const previous = eventWindowRef.current.events;
2230
- eventWindowRef.current = retained;
2231
- pruneStepStores(retained.events, previous);
2232
- oldestSequenceRef.current = retained.events[0].sequence;
2233
- newestSequenceRef.current = maxResumeSequenceOrNull(retained.events);
2234
- lastSequenceRef.current = Math.max(lastSequenceRef.current, newestSequenceRef.current ?? 0);
2235
- hasOlderRef.current = !isLogStart(retained.events[0]);
2236
- hasNewerRef.current = following.length > 0 || retained.truncated || (newestSequenceRef.current ?? 0) < lastSequenceRef.current;
2237
- initialWindowLoadedRef.current = true;
2238
- setInitialHistoryReady(true);
2239
- setError(null);
2240
- viewModeRef.current = "history";
2241
- setEventWindow(retained);
2242
- setHasOlder(hasOlderRef.current);
2243
- setHasNewer(hasNewerRef.current);
2244
- setInitialLoading(false);
2245
- setViewMode("history");
2246
- setNewerError(null);
2247
- if (status !== void 0) setSessionStatusProjection(status);
2248
- published = true;
2249
- return true;
2250
- } catch (reason) {
2251
- if (!current() || signal?.aborted) return false;
2252
- throw reason;
2253
- } finally {
2254
- if (current()) {
2255
- loadingTargetRef.current = false;
2256
- setLoadingTarget(false);
2257
- if (!published && previousMode === "live") {
2258
- viewModeRef.current = "live";
2259
- setViewMode("live");
2260
- setStreamEpoch((epoch) => epoch + 1);
2261
- }
2262
- }
2263
- }
2264
- },
2265
- [client, workspaceId, sessionId, ownsNavigation, historyFilter, pruneStepStores]
2266
- );
2267
- const jumpToLatestQuestion = useCallback6(
2268
- async (questionOptions) => {
2269
- if (!sessionId || !ownsNavigation()) return null;
2270
- let generation = navigationGenerationRef.current;
2271
- const current = () => ownsNavigation() && generation === navigationGenerationRef.current;
2272
- try {
2273
- const { resolveLatestQuestion } = await import("./latest-question-F3VPDR7U.js");
2274
- if (!current()) return null;
2275
- const destination = await resolveLatestQuestion(t, {
2276
- client,
2277
- workspaceId,
2278
- sessionId,
2279
- isCurrent: current,
2280
- resumeSequence: maxResumeSequence,
2281
- options: questionOptions
2282
- });
2283
- if (!destination || !current()) return null;
2284
- if (!eventWindowRef.current.events.some((event) => event.sequence === destination.anchor)) {
2285
- const navigation = jumpToSequence(destination.anchor);
2286
- generation = navigationGenerationRef.current;
2287
- if (!await navigation || !current()) return null;
2288
- }
2289
- setQuestionEvidence({
2290
- client,
2291
- streamKey,
2292
- anchor: destination.anchor,
2293
- events: destination.events
2294
- });
2295
- return destination.questionSequence;
2296
- } catch (reason) {
2297
- if (!current()) return null;
2298
- throw reason;
2299
- }
2300
- },
2301
- [client, workspaceId, sessionId, streamKey, ownsNavigation, jumpToSequence, t]
2302
- );
2303
- const jumpToLatest = useCallback6(async () => {
2304
- if (!ownsNavigation()) return;
2305
- if (loadingTargetRef.current) {
2306
- navigationGenerationRef.current += 1;
2307
- loadingTargetRef.current = false;
2308
- setLoadingTarget(false);
2309
- }
2310
- if (!sessionId || navigationBusy()) {
2311
- return;
2312
- }
2313
- navigationGenerationRef.current += 1;
2314
- setQuestionEvidence(null);
2315
- loadingLatestRef.current = true;
2316
- setLoadingLatest(true);
2317
- setNewerError(null);
2318
- setError(null);
2319
- let published = false;
2320
- try {
2321
- streamAbortRef.current?.abort();
2322
- hasNewerRef.current = false;
2323
- hasOlderRef.current = false;
2324
- newestSequenceRef.current = null;
2325
- oldestSequenceRef.current = null;
2326
- eventWindowRef.current = EMPTY_EVENT_WINDOW;
2327
- initialWindowLoadedRef.current = false;
2328
- streamResumeSequenceRef.current = after;
2329
- viewModeRef.current = "live";
2330
- loadingLatestRef.current = false;
2331
- startTransition(() => {
2332
- setHasNewer(false);
2333
- setHasOlder(false);
2334
- setEventWindow(EMPTY_EVENT_WINDOW);
2335
- setInitialLoading(true);
2336
- setViewMode("live");
2337
- setStreamEpoch((epoch) => epoch + 1);
2338
- setLoadingLatest(false);
2339
- });
2340
- published = true;
2341
- await Promise.resolve();
2342
- } finally {
2343
- if (!published) {
2344
- loadingLatestRef.current = false;
2345
- setLoadingLatest(false);
2346
- }
2347
- }
2348
- }, [after, sessionId, ownsNavigation]);
2349
- const identityMatches = stateStreamKey === streamKey;
2350
- const freshTail = identityMatches && initialHistoryReady && viewMode === "live" && !fullReplay ? {
2351
- events: eventWindow.events,
2352
- hasOlder,
2353
- truncated: eventWindow.truncated,
2354
- bytes: eventWindow.bytes,
2355
- sessionStatus: sessionStatusProjection
2356
- } : null;
2357
- const retainedTail = useRetainedSessionView(client, workspaceId, sessionId, "events", freshTail, {
2358
- enabled: !fullReplay,
2359
- bytes: (tail) => tail.bytes,
2360
- budgetBytes: SESSION_EVENT_BROWSER_MAX_BYTES,
2361
- discard: identityMatches && deniesRetainedView(error)
2362
- });
2363
- const showRetained = retainedTail !== null && !(identityMatches && initialHistoryReady);
2364
- const visibleEvents = showRetained ? retainedTail.events : identityMatches ? eventWindow.events : EMPTY_EVENTS;
2365
- const visibleHasOlder = showRetained ? retainedTail.hasOlder : identityMatches && hasOlder;
2366
- const visibleTruncated = showRetained ? retainedTail.truncated : eventWindow.truncated;
2367
- const liveSteps = identityMatches && !showRetained;
2368
- const visibleStepStores = liveSteps ? stepStores : EMPTY_STEP_STORES;
2369
- const visiblePresentedOutputs = liveSteps ? presentedOutputs : EMPTY_PRESENTED_OUTPUTS;
2370
- const visibleTurnless = liveSteps ? turnlessSteps : EMPTY_TURNLESS_STEPS;
2371
- const readToolOutput = useCallback6(
2372
- async (sequence) => sessionId ? (await readEventPage(client, workspaceId, sessionId, {
2373
- includeTypes: ["agent.toolCall.output"],
2374
- after: Math.max(0, sequence - 1),
2375
- before: sequence + 1,
2376
- direction: "after",
2377
- limit: 1,
2378
- payloadMode: "full"
2379
- })).events : [],
2380
- [client, workspaceId, sessionId]
2381
- );
2382
- const toolOutputs = useToolOutputReads(readToolOutput, stepStores);
2383
- const visibleToolOutputs = liveSteps ? toolOutputs.exact : EMPTY_PRESENTED_OUTPUTS;
2384
- const loadedEvents = useMemo2(
2385
- () => mergeLoadedEvents(
2386
- visibleEvents,
2387
- visibleStepStores,
2388
- visiblePresentedOutputs,
2389
- visibleTurnless.events,
2390
- visibleToolOutputs
2391
- ),
2392
- [
2393
- visibleEvents,
2394
- visibleStepStores,
2395
- visiblePresentedOutputs,
2396
- visibleTurnless,
2397
- visibleToolOutputs
2398
- ]
2399
- );
2400
- const turnSteps = useMemo2(() => {
2401
- if (fullReplay) return void 0;
2402
- const markers = /* @__PURE__ */ new Map();
2403
- const bounded = withTurnlessSteps(visibleEvents, visibleTurnless);
2404
- for (const [turnId, bounds] of conversationTurnBounds(bounded)) {
2405
- const store = visibleStepStores.get(turnId);
2406
- if (store && !store.loading && !store.error && !stepStoreHasOlder(store, bounds)) {
2407
- if (!store.events.some((event) => CONTENT_STEP_TYPES.has(event.type))) continue;
2408
- }
2409
- const state = store ? store.loading ? "loading" : store.error ? "error" : stepStoreHasOlder(store, bounds) ? "partial" : "complete" : bounds.hidden ? "idle" : null;
2410
- if (state === null) continue;
2411
- markers.set(turnId, { state, ...liveSteps ? turnStepHandle(turnId) : RETAINED_VIEW_STEPS });
2412
- }
2413
- return markers;
2414
- }, [fullReplay, visibleEvents, visibleTurnless, visibleStepStores, liveSteps, turnStepHandle]);
2415
- const timeline = useMemo2(() => {
2416
- const witness = questionEvidence?.client === client && questionEvidence.streamKey === streamKey && visibleEvents.some((event) => event.sequence === questionEvidence.anchor) ? questionEvidence.events : EMPTY_EVENTS;
2417
- const timelineOptions = {
2418
- partialStart: visibleHasOlder || visibleTruncated || after > 0,
2419
- ...turnSteps ? { turnSteps } : {},
2420
- ...liveSteps ? { toolOutputs: toolOutputs.reader } : {}
2421
- };
2422
- if (witness.length === 0) return buildTimeline(t, loadedEvents, timelineOptions);
2423
- const ids = new Set(loadedEvents.map((event) => event.id));
2424
- return buildTimeline(
2425
- t,
2426
- [...loadedEvents, ...witness.filter((event) => !ids.has(event.id))],
2427
- timelineOptions
2428
- );
2429
- }, [
2430
- loadedEvents,
2431
- visibleEvents,
2432
- visibleHasOlder,
2433
- visibleTruncated,
2434
- after,
2435
- questionEvidence,
2436
- client,
2437
- streamKey,
2438
- turnSteps,
2439
- liveSteps,
2440
- toolOutputs.reader,
2441
- t
2442
- ]);
2443
- useEffect3(() => {
2444
- if (fullReplay || !sessionId || !identityMatches || !initialHistoryReady) return;
2445
- const resolved = new Set(presentedOutputs.keys());
2446
- const collect = (events) => {
2447
- for (const event of events) {
2448
- if (event.type !== "agent.toolCall.output" || isToolOutputPreviewEvent(event)) continue;
2449
- const id = event.payload?.id;
2450
- if (typeof id === "string") resolved.add(id);
2451
- }
2452
- };
2453
- collect(eventWindow.events);
2454
- for (const store of stepStores.values()) collect(store.events);
2455
- const requested = presentedRequestedRef.current;
2456
- let inFlight = 0;
2457
- for (const request of requested.values()) if (request.pending) inFlight += 1;
2458
- const room = PRESENTED_OUTPUT_READS_PER_PASS - inFlight;
2459
- if (room <= 0) return;
2460
- const missing = [];
2461
- for (const event of eventWindow.events) {
2462
- if (event.type !== "agent.toolCall.created") continue;
2463
- const payload = event.payload;
2464
- const callId = payload?.id;
2465
- if (typeof callId !== "string" || resolved.has(callId) || requested.has(callId) || !isPresentedSessionToolCall(payload)) {
2466
- continue;
2467
- }
2468
- missing.push({ callId, sequence: event.sequence, turnId: event.turnId ?? null });
2469
- }
2470
- if (missing.length === 0) return;
2471
- const bounds = conversationTurnBounds(eventWindow.events);
2472
- for (const { callId, sequence, turnId } of missing.slice(-room)) {
2473
- const request = { turnId, pending: true };
2474
- requested.set(callId, request);
2475
- const isCurrent = () => presentedRequestedRef.current === requested && requested.get(callId) === request;
2476
- const terminal = turnId ? bounds.get(turnId)?.terminal ?? null : null;
2477
- void findPresentedOutput(client, workspaceId, sessionId, callId, sequence, terminal).then(
2478
- (output) => {
2479
- if (!ownsNavigation() || !isCurrent()) return;
2480
- request.pending = false;
2481
- if (output) setPresentedOutputs((current) => new Map(current).set(callId, output));
2482
- setPresentedPass((pass) => pass + 1);
2483
- },
2484
- () => {
2485
- if (!isCurrent()) return;
2486
- requested.delete(callId);
2487
- const failures = (presentedFailuresRef.current.get(callId) ?? 0) + 1;
2488
- presentedFailuresRef.current.set(callId, failures);
2489
- if (failures > PRESENTED_OUTPUT_RETRIES) return;
2490
- setTimeout(() => {
2491
- if (ownsNavigation()) setPresentedPass((pass) => pass + 1);
2492
- }, PRESENTED_OUTPUT_RETRY_MS * failures);
2493
- }
2494
- );
2495
- }
2496
- }, [
2497
- fullReplay,
2498
- sessionId,
2499
- identityMatches,
2500
- initialHistoryReady,
2501
- eventWindow,
2502
- stepStores,
2503
- presentedOutputs,
2504
- presentedPass,
2505
- client,
2506
- workspaceId,
2507
- ownsNavigation
2508
- ]);
2509
- return {
2510
- events: loadedEvents,
2511
- timeline,
2512
- sessionStatus: showRetained ? retainedTail.sessionStatus : identityMatches ? sessionStatusProjection : null,
2513
- sessionStatusSequence: identityMatches ? sessionStatusRef.current.sequence : 0,
2514
- connectionState: identityMatches ? connectionState : "idle",
2515
- lastSequence: identityMatches ? lastSequenceRef.current : after,
2516
- windowBytes: identityMatches ? eventWindow.bytes : 2,
2517
- windowTruncated: identityMatches ? eventWindow.truncated : false,
2518
- initialLoading: fullReplay || showRetained ? false : identityMatches ? initialLoading : true,
2519
- initialHistoryReady: identityMatches && initialHistoryReady,
2520
- hasOlder: visibleHasOlder,
2521
- loadingOlder: !identityMatches ? false : loadingOlder,
2522
- loadOlder,
2523
- hasNewer: !identityMatches ? false : hasNewer,
2524
- loadingNewer: !identityMatches ? false : loadingNewer,
2525
- loadNewer,
2526
- loadingOldest: !identityMatches ? false : loadingOldest,
2527
- loadOldest,
2528
- loadingLatest: !identityMatches ? false : loadingLatest,
2529
- jumpToLatest,
2530
- jumpToLatestQuestion,
2531
- jumpToSequence,
2532
- loadingTarget: identityMatches && loadingTarget,
2533
- error: identityMatches ? newerError ?? error : null
2534
- };
2535
- }
2536
- function boundBrowserSessionEventWindow(events, options = {}) {
2537
- const maxBytes = Math.max(1024, options.maxBytes ?? SESSION_EVENT_BROWSER_MAX_BYTES);
2538
- const maxCount = Math.max(1, Math.floor(options.maxCount ?? SESSION_EVENT_BROWSER_MAX_COUNT));
2539
- const safe = events;
2540
- const selected = [];
2541
- let bytes = 2;
2542
- const direction = options.direction ?? "newest";
2543
- const start = direction === "newest" ? safe.length - 1 : 0;
2544
- const end = direction === "newest" ? Math.max(-1, safe.length - maxCount - 1) : safe.length;
2545
- const step = direction === "newest" ? -1 : 1;
2546
- for (let index = start; index !== end && selected.length < maxCount; index += step) {
2547
- const event = safe[index];
2548
- const eventBytes = browserJsonBytes(event);
2549
- const separator = selected.length === 0 ? 0 : 1;
2550
- if (selected.length > 0 && bytes + separator + eventBytes > maxBytes) break;
2551
- selected.push(event);
2552
- bytes += separator + eventBytes;
2553
- }
2554
- if (direction === "newest") selected.reverse();
2555
- return {
2556
- events: selected,
2557
- bytes,
2558
- truncated: selected.length < safe.length
2559
- };
2560
- }
2561
- function appendBrowserSessionEventWindow(current, batch, options = {}) {
2562
- const maxBytes = Math.max(1024, options.maxBytes ?? SESSION_EVENT_BROWSER_MAX_BYTES);
2563
- const maxCount = Math.max(1, Math.floor(options.maxCount ?? SESSION_EVENT_BROWSER_MAX_COUNT));
2564
- const events = [...current.events, ...batch];
2565
- let bytes = current.bytes;
2566
- for (let index = 0; index < batch.length; index += 1) {
2567
- bytes += browserJsonBytes(batch[index]) + (current.events.length + index > 0 ? 1 : 0);
2568
- }
2569
- let start = 0;
2570
- while (events.length - start > 1 && (bytes > maxBytes || events.length - start > maxCount)) {
2571
- bytes -= browserJsonBytes(events[start]) + 1;
2572
- start += 1;
2573
- }
2574
- return {
2575
- events: start === 0 ? events : events.slice(start),
2576
- bytes,
2577
- truncated: current.truncated || start > 0
2578
- };
2579
- }
2580
- function browserJsonBytes(value) {
2581
- return encoder.encode(JSON.stringify(value)).byteLength;
2582
- }
2583
- function observeSessionStatus(events, ref) {
2584
- let latest = null;
2585
- for (const event of events) {
2586
- const status = sessionStatusFromEvents([event]);
2587
- if (status && (!latest || event.sequence >= latest.sequence)) {
2588
- latest = { sequence: event.sequence, status };
2589
- }
2590
- }
2591
- if (!latest || latest.sequence < ref.current.sequence) return void 0;
2592
- ref.current = latest;
2593
- return latest.status;
2594
- }
2595
- async function loadConversationCatchup(client, workspaceId, sessionId, cursor, head, options) {
2596
- const events = [];
2597
- let after = cursor;
2598
- for (let fetch = 0; fetch < CATCHUP_MAX_PAGES; fetch += 1) {
2599
- if (options.signal?.aborted) throw abortError();
2600
- const page = await readConversationPage(client, workspaceId, sessionId, {
2601
- after,
2602
- before: head + 1,
2603
- direction: "after",
2604
- limit: SESSION_HISTORY_PAGE_SIZE,
2605
- compact: true,
2606
- payloadMode: "full"
2607
- });
2608
- if (!options.isCurrent()) throw abortError();
2609
- options.progress?.();
2610
- const fresh = page.filter((event) => eventResumeSequence(event) > after);
2611
- assertAscending(fresh);
2612
- events.push(...fresh);
2613
- if (page.raw.newest === null || page.raw.newest <= after) return events;
2614
- after = page.raw.newest;
2615
- if (after >= head || page.hasMore === false) return events;
2616
- }
2617
- return null;
2618
- }
2619
- async function loadEventWindow(t, client, workspaceId, sessionId, options) {
2620
- let cursor = options.before;
2621
- let buffer = [];
2622
- let reachedStart = false;
2623
- let fetches = 0;
2624
- let filteredPages = 0;
2625
- let rawNewest = 0;
2626
- const counts = (page) => {
2627
- rawNewest = Math.max(rawNewest, page.raw.newest ?? 0);
2628
- return page.length > 0 || (filteredPages += 1) > (options.filteredPageCap ?? 0);
2629
- };
2630
- while (fetches < options.maxFetches) {
2631
- if (buffer.length > 0 && groupCount(t, buffer) >= options.targetGroups) {
2632
- break;
2633
- }
2634
- const page = await loadPreviousPage(client, workspaceId, sessionId, cursor, {
2635
- pageSize: options.pageSize,
2636
- filter: options.filter,
2637
- ...options.signal ? { signal: options.signal } : {}
2638
- });
2639
- if (options.isCurrent?.() === false) throw abortError();
2640
- options.progress?.();
2641
- if (page.raw.oldest === null) {
2642
- reachedStart = true;
2643
- break;
2644
- }
2645
- if (counts(page)) fetches += 1;
2646
- assertAscending(page);
2647
- buffer = [...page, ...buffer];
2648
- cursor = page.raw.oldest;
2649
- if (page.raw.oldest <= 1 || page[0] !== void 0 && isLogStart(page[0])) {
2650
- reachedStart = true;
2651
- break;
2652
- }
2653
- }
2654
- let snapPages = 0;
2655
- while (!reachedStart && findBoundaryIndex(buffer) === -1 && snapPages < (options.boundaryPageCap ?? 0)) {
2656
- const page = await loadPreviousPage(client, workspaceId, sessionId, cursor, {
2657
- pageSize: options.boundaryPageSize ?? options.pageSize,
2658
- filter: options.filter,
2659
- ...options.signal ? { signal: options.signal } : {}
2660
- });
2661
- if (options.isCurrent?.() === false) throw abortError();
2662
- options.progress?.();
2663
- if (page.raw.oldest === null) {
2664
- reachedStart = true;
2665
- break;
2666
- }
2667
- if (counts(page)) {
2668
- fetches += 1;
2669
- snapPages += 1;
2670
- }
2671
- assertAscending(page);
2672
- buffer = [...page, ...buffer];
2673
- cursor = page.raw.oldest;
2674
- if (page.raw.oldest <= 1 || page[0] !== void 0 && isLogStart(page[0])) {
2675
- reachedStart = true;
2676
- break;
2677
- }
2678
- }
2679
- if (!reachedStart) {
2680
- const boundary = findBoundaryIndex(buffer);
2681
- if (boundary > 0) {
2682
- buffer = buffer.slice(boundary);
2683
- }
2684
- }
2685
- const densityWindow = trimBackwardToGroupTarget(t, buffer, options.targetGroups);
2686
- buffer = densityWindow.events;
2687
- const oldest = buffer[0] ?? null;
2688
- const newest = buffer[buffer.length - 1] ?? null;
2689
- return {
2690
- events: buffer,
2691
- oldestSequence: oldest?.sequence ?? null,
2692
- // A window that kept nothing resumes a live stream above the rows it read,
2693
- // not at the start of history. Otherwise rows dropped above its newest
2694
- // kept row are replayed (or caught up) into their turn's steps, so a
2695
- // working turn's latest tool calls still show.
2696
- newestSequence: newest ? maxResumeSequence(buffer) : rawNewest,
2697
- // An empty window that stopped before the start is still pageable.
2698
- hasOlder: buffer.length > 0 ? densityWindow.trimmed || !reachedStart && oldest?.type !== "session.created" : !reachedStart,
2699
- scanCursor: cursor
2700
- };
2701
- }
2702
- function findBoundaryIndex(events) {
2703
- for (let index = 0; index < events.length; index += 1) {
2704
- if (isTurnBoundary(events[index])) {
2705
- return index;
2706
- }
2707
- }
2708
- return -1;
2709
- }
2710
- function isTurnBoundary(event) {
2711
- return event.type === "session.created" || event.type === "user.message";
2712
- }
2713
- async function loadForwardEventWindow(t, client, workspaceId, sessionId, options) {
2714
- let cursor = options.after;
2715
- let buffer = [];
2716
- let fetches = 0;
2717
- let reachedEnd = false;
2718
- let filteredPages = 0;
2719
- while (fetches < options.maxFetches) {
2720
- if (buffer.length > 0 && groupCount(t, buffer) >= options.targetGroups) {
2721
- break;
2722
- }
2723
- const page = await loadNextPage(client, workspaceId, sessionId, cursor, {
2724
- pageSize: options.pageSize,
2725
- filter: options.filter,
2726
- ...options.signal ? { signal: options.signal } : {}
2727
- });
2728
- if (options.isCurrent?.() === false) throw abortError();
2729
- if (page.raw.newest === null) {
2730
- reachedEnd = true;
2731
- break;
2732
- }
2733
- if (page.length > 0 || (filteredPages += 1) > (options.filteredPageCap ?? 0)) fetches += 1;
2734
- assertAscending(page);
2735
- buffer = [...buffer, ...page];
2736
- cursor = page.raw.newest;
2737
- }
2738
- const densityWindow = trimForwardToGroupTarget(t, buffer, options.targetGroups);
2739
- buffer = densityWindow.events;
2740
- const oldest = buffer[0] ?? null;
2741
- const newest = buffer[buffer.length - 1] ?? null;
2742
- return {
2743
- events: buffer,
2744
- oldestSequence: oldest?.sequence ?? null,
2745
- newestSequence: newest ? maxResumeSequence(buffer) : 0,
2746
- // An empty window that stopped before the end is still pageable.
2747
- hasNewer: buffer.length > 0 ? densityWindow.trimmed || !reachedEnd : !reachedEnd,
2748
- scanCursor: cursor
2749
- };
2750
- }
2751
- function trimBackwardToGroupTarget(t, events, targetGroups) {
2752
- if (!Number.isFinite(targetGroups) || targetGroups <= 0 || events.length === 0) {
2753
- return { events, trimmed: false };
2754
- }
2755
- for (let index = events.length - 1; index > 0; index -= 1) {
2756
- if (!isTurnBoundary(events[index])) continue;
2757
- const candidate = events.slice(index);
2758
- if (groupCount(t, candidate) >= targetGroups) {
2759
- return { events: candidate, trimmed: true };
2760
- }
2761
- }
2762
- return { events, trimmed: false };
2763
- }
2764
- function trimForwardToGroupTarget(t, events, targetGroups) {
2765
- if (!Number.isFinite(targetGroups) || targetGroups <= 0 || events.length === 0) {
2766
- return { events, trimmed: false };
2767
- }
2768
- for (let index = 1; index < events.length; index += 1) {
2769
- if (!isTurnBoundary(events[index])) continue;
2770
- const candidate = events.slice(0, index);
2771
- if (groupCount(t, candidate) >= targetGroups) {
2772
- return { events: candidate, trimmed: true };
2773
- }
2774
- }
2775
- return { events, trimmed: false };
2776
- }
2777
- function rawPageExtent(events) {
2778
- return events.length === 0 ? { oldest: null, newest: null } : { oldest: events[0].sequence, newest: maxResumeSequence(events) };
2779
- }
2780
- function historyPage(events, requested, raw = rawPageExtent(events)) {
2781
- return Object.assign(events, { requested, raw });
2782
- }
2783
- async function loadPreviousPage(client, workspaceId, sessionId, before, options) {
2784
- if (options.signal?.aborted) {
2785
- throw abortError();
2786
- }
2787
- const requested = options.pageSize;
2788
- if (requested === 0) {
2789
- return historyPage([], requested);
2790
- }
2791
- const read = {
2792
- before,
2793
- limit: requested,
2794
- compact: true,
2795
- // Monitoring summaries omit correlation fields once a bounded durable
2796
- // payload exceeds their preview threshold. The browser timeline needs the
2797
- // exact stored payload so persisted tool outputs still match their
2798
- // calls and expose truthful truncation telemetry after a reload.
2799
- payloadMode: "full"
2800
- };
2801
- const page = options.filter ? await readConversationPage(client, workspaceId, sessionId, read) : historyPage(await client.listEvents(workspaceId, sessionId, read), requested);
2802
- if (options.signal?.aborted) {
2803
- throw abortError();
2804
- }
2805
- return Object.assign(page, { requested });
2806
- }
2807
- async function loadNextPage(client, workspaceId, sessionId, after, options) {
2808
- if (options.signal?.aborted) {
2809
- throw abortError();
2810
- }
2811
- const requested = options.pageSize;
2812
- if (requested === 0) {
2813
- return historyPage([], requested);
2814
- }
2815
- const read = {
2816
- ...options.before !== void 0 ? { before: options.before } : {},
2817
- after,
2818
- limit: requested,
2819
- compact: true,
2820
- direction: "after",
2821
- payloadMode: "full"
2822
- };
2823
- const page = options.filter ? await readConversationPage(client, workspaceId, sessionId, read) : historyPage(await client.listEvents(workspaceId, sessionId, read), requested);
2824
- if (options.signal?.aborted) {
2825
- throw abortError();
2826
- }
2827
- return Object.assign(page, { requested });
2828
- }
2829
- function groupCount(t, events) {
2830
- if (events.length === 0) {
2831
- return 0;
2832
- }
2833
- return groupTimeline(t, buildTimeline(t, events)).length;
2834
- }
2835
- function isLogStart(event) {
2836
- return event.type === "session.created" || event.sequence <= 1;
2837
- }
2838
- function maxResumeSequence(events) {
2839
- return events.reduce((max, event) => Math.max(max, eventResumeSequence(event)), 0);
2840
- }
2841
- function maxResumeSequenceOrNull(events) {
2842
- return events.length > 0 ? maxResumeSequence(events) : null;
2843
- }
2844
- function eventResumeSequence(event) {
2845
- const streamedCoverage = sessionEventStreamCoveredThrough(event);
2846
- if (streamedCoverage !== null) return streamedCoverage;
2847
- return typeof event.coveredThrough === "number" && Number.isSafeInteger(event.coveredThrough) && event.coveredThrough >= event.sequence ? event.coveredThrough : event.sequence;
2848
- }
2849
- function assertAscending(events) {
2850
- for (let index = 1; index < events.length; index += 1) {
2851
- if (events[index - 1].sequence >= events[index].sequence) {
2852
- throw new Error("@opengeni/react: session events must be ordered by ascending sequence");
2853
- }
2854
- }
2855
- }
2856
- function assertPrependOrder(existing, older) {
2857
- if (!shouldAssertDevelopment() || existing.length === 0 || older.length === 0) {
2858
- return;
2859
- }
2860
- if (older[older.length - 1].sequence >= existing[0].sequence) {
2861
- throw new Error("@opengeni/react: loadOlder returned overlapping session events");
2862
- }
2863
- }
2864
- function assertAppendOrder(existing, newer) {
2865
- if (!shouldAssertDevelopment() || existing.length === 0 || newer.length === 0) {
2866
- return;
2867
- }
2868
- if (newer[0].sequence <= existing[existing.length - 1].sequence) {
2869
- throw new Error("@opengeni/react: loadNewer returned overlapping session events");
2870
- }
2871
- }
2872
- function shouldAssertDevelopment() {
2873
- const processEnv = globalThis.process?.env;
2874
- return processEnv !== void 0 && processEnv.NODE_ENV !== "production";
2875
- }
2876
- function abortError() {
2877
- const error = new Error("The operation was aborted.");
2878
- error.name = "AbortError";
2879
- return error;
2880
- }
2881
- function abortableDelay(ms, signal) {
2882
- return new Promise((resolve, reject) => {
2883
- if (signal.aborted) {
2884
- reject(abortError());
2885
- return;
2886
- }
2887
- const onAbort = () => {
2888
- clearTimeout(timer);
2889
- reject(abortError());
2890
- };
2891
- const timer = setTimeout(() => {
2892
- signal.removeEventListener("abort", onAbort);
2893
- resolve();
2894
- }, ms);
2895
- signal.addEventListener("abort", onAbort, { once: true });
2896
- });
2897
- }
2898
- var CONTENT_STEP_TYPES = new Set(SESSION_EVENT_CONTENT_STEP_TYPES);
2899
- var COMPAT_EXCLUDED_TYPES = new Set(
2900
- SESSION_EVENT_COMPAT_EXCLUDED_STEP_TYPES
2901
- );
2902
- var CONVERSATION_FILTER = "conversation";
2903
- var SESSION_TURN_STEP_PAGE_SIZE = 200;
2904
- var SESSION_TURN_LIVE_STEP_TAIL = 200;
2905
- var SESSION_TURN_LIVE_STEP_TAIL_BYTES = 2 * 1024 * 1024;
2906
- var TURNLESS_STEP_TAIL = 1e3;
2907
- var TURNLESS_STEP_TAIL_BYTES = 4 * 1024 * 1024;
2908
- var TURN_STEP_READ_TYPES = SESSION_EVENT_STEP_TYPES.filter(
2909
- (type) => type !== "terminal.pty.output.delta"
2910
- );
2911
- var SESSION_STEP_BROWSER_MAX_BYTES = 16 * 1024 * 1024;
2912
- var TERMINAL_TURN_TYPES = /* @__PURE__ */ new Set([
2913
- "turn.completed",
2914
- "turn.failed",
2915
- "turn.cancelled",
2916
- "turn.superseded"
2917
- ]);
2918
- var EMPTY_STEP_STORES = /* @__PURE__ */ new Map();
2919
- var EMPTY_TURNLESS_STEPS = { events: [], bytes: 2, ranges: [], appended: 0 };
2920
- var TURNLESS_STEP_MAX_RANGES = 4096;
2921
- function appendTurnlessSteps(current, incoming) {
2922
- const ranges = current.ranges.map((range) => [range[0], range[1]]);
2923
- for (const event of incoming) {
2924
- const sequence = event.sequence;
2925
- const last = ranges.at(-1);
2926
- if (last && sequence >= last[0] && sequence <= last[1]) continue;
2927
- if (last && sequence === last[1] + 1) last[1] = sequence;
2928
- else if (!last || sequence > last[1]) ranges.push([sequence, sequence]);
2929
- else if (!ranges.some(([first, end]) => sequence >= first && sequence <= end)) {
2930
- ranges.push([sequence, sequence]);
2931
- ranges.sort((left, right) => left[0] - right[0]);
2932
- }
2933
- }
2934
- if (ranges.length > TURNLESS_STEP_MAX_RANGES) {
2935
- ranges.splice(0, ranges.length - TURNLESS_STEP_MAX_RANGES);
2936
- }
2937
- const next = appendStepEvents(current, incoming);
2938
- const appended = current.appended + incoming.length;
2939
- if (next.events.length <= TURNLESS_STEP_TAIL && next.bytes <= TURNLESS_STEP_TAIL_BYTES) {
2940
- return { ...next, ranges, appended };
2941
- }
2942
- const kept = boundBrowserSessionEventWindow(next.events, {
2943
- maxCount: TURNLESS_STEP_TAIL,
2944
- maxBytes: TURNLESS_STEP_TAIL_BYTES
2945
- });
2946
- return { events: kept.events, bytes: kept.bytes, ranges, appended };
2947
- }
2948
- function withTurnlessSteps(window2, turnless) {
2949
- const first = window2[0]?.sequence;
2950
- if (first === void 0 || turnless.ranges.length === 0) return window2;
2951
- const placeholders = [];
2952
- for (const [start, end] of turnless.ranges) {
2953
- if (end < first) continue;
2954
- placeholders.push({
2955
- id: `turnless-steps-${start}`,
2956
- workspaceId: window2[0].workspaceId,
2957
- sessionId: window2[0].sessionId,
2958
- sequence: start,
2959
- coveredThrough: end,
2960
- type: "terminal.pty.output.delta",
2961
- payload: null,
2962
- occurredAt: window2[0].occurredAt,
2963
- turnId: null
2964
- });
2965
- }
2966
- if (placeholders.length === 0) return window2;
2967
- return [...window2, ...placeholders].sort((left, right) => left.sequence - right.sequence);
2968
- }
2969
- function turnStepLowerBound(bounds) {
2970
- return bounds.started !== null ? bounds.started - 1 : bounds.previous;
2971
- }
2972
- function stepStoreHasOlder(store, bounds) {
2973
- return store.hasOlder || store.floor !== null && turnStepLowerBound(bounds) < store.floor;
2974
- }
2975
- function isConversationHistoryEvent(event, presentedCallIds, startupTurns) {
2976
- if (event.turnId) {
2977
- if (event.type === "agent.model.usage") return startupTurns === void 0;
2978
- if (event.type === "agent.model.request") {
2979
- return startupTurns === void 0 || startupTurns.has(event.turnId);
2980
- }
2981
- }
2982
- if (!CONTENT_STEP_TYPES.has(event.type)) return true;
2983
- const payload = event.payload;
2984
- if (event.type === "agent.toolCall.created") return isPresentedSessionToolCall(payload);
2985
- if (event.type === "agent.toolCall.output") {
2986
- return typeof payload?.id === "string" && presentedCallIds.has(payload.id);
2987
- }
2988
- return false;
2989
- }
2990
- function emptyStartupTurns() {
2991
- return { window: null, open: /* @__PURE__ */ new Set(), responded: /* @__PURE__ */ new Set() };
2992
- }
2993
- function noteStartupTurns(events, state) {
2994
- for (const event of events) {
2995
- const turnId = event.turnId;
2996
- if (!turnId) continue;
2997
- if (event.type === "turn.started") {
2998
- if (!state.responded.has(turnId)) state.open.add(turnId);
2999
- } else if (event.type === "agent.model.request" && isSessionModelResponsePhase(event.payload?.phase)) {
3000
- state.open.delete(turnId);
3001
- state.responded.add(turnId);
3002
- }
3003
- }
3004
- }
3005
- var conversationFilterModes = /* @__PURE__ */ new WeakMap();
3006
- var CONVERSATION_READS = {
3007
- v2: { excludeTypes: [...SESSION_EVENT_STEP_TYPES], presentedToolCalls: "include" },
3008
- compat: {
3009
- excludeTypes: [...SESSION_EVENT_COMPAT_EXCLUDED_STEP_TYPES],
3010
- presentedToolCalls: "include"
3011
- }
3012
- };
3013
- function conversationFilterMode(client) {
3014
- if (typeof client.listEventPage !== "function") {
3015
- return "compat";
3016
- }
3017
- return conversationFilterModes.get(client) ?? "v2";
3018
- }
3019
- async function readConversationPage(client, workspaceId, sessionId, options) {
3020
- let mode = conversationFilterMode(client);
3021
- for (; ; ) {
3022
- const read = await readEventPage(client, workspaceId, sessionId, {
3023
- ...CONVERSATION_READS[mode],
3024
- ...options
3025
- });
3026
- const announced = (read.conversationFilter ?? 0) >= SESSION_EVENT_CONVERSATION_FILTER_VERSION;
3027
- if (read.conversationFilter !== void 0) {
3028
- conversationFilterModes.set(client, announced ? "v2" : "compat");
3029
- }
3030
- if (mode === "v2" && !announced) {
3031
- mode = "compat";
3032
- continue;
3033
- }
3034
- const events = mode === "compat" ? read.events.filter(isCompatConversationEvent) : read.events;
3035
- return Object.assign(events === read.events ? [...events] : events, {
3036
- requested: options.limit,
3037
- raw: rawPageExtent(read.events),
3038
- hasMore: read.hasMore
3039
- });
3040
- }
3041
- }
3042
- function isCompatConversationEvent(event) {
3043
- if (COMPAT_EXCLUDED_TYPES.has(event.type)) return false;
3044
- if (event.type !== "agent.toolCall.created") return true;
3045
- return isPresentedSessionToolCall(event.payload);
3046
- }
3047
- function notePresentedCalls(events, ids) {
3048
- for (const event of events) {
3049
- if (event.type !== "agent.toolCall.created") continue;
3050
- const payload = event.payload;
3051
- if (typeof payload?.id === "string" && isPresentedSessionToolCall(payload)) {
3052
- ids.add(payload.id);
3053
- }
3054
- }
3055
- }
3056
- function conversationTurnBounds(events) {
3057
- const bounds = /* @__PURE__ */ new Map();
3058
- const gaps = [];
3059
- let expected = null;
3060
- let previous = 0;
3061
- for (const event of events) {
3062
- if (expected !== null && event.sequence > expected) gaps.push(expected);
3063
- const resume = eventResumeSequence(event);
3064
- expected = Math.max(expected ?? 0, resume + 1);
3065
- const turnId = event.turnId;
3066
- if (!turnId) continue;
3067
- const current = bounds.get(turnId);
3068
- if (!current) {
3069
- bounds.set(turnId, {
3070
- first: event.sequence,
3071
- started: event.type === "turn.started" ? event.sequence : null,
3072
- previous,
3073
- last: resume,
3074
- terminal: TERMINAL_TURN_TYPES.has(event.type) ? event.sequence : null,
3075
- hidden: false
3076
- });
3077
- } else {
3078
- current.last = Math.max(current.last, resume);
3079
- if (event.type === "turn.started" && current.started === null) {
3080
- current.started = event.sequence;
3081
- }
3082
- if (TERMINAL_TURN_TYPES.has(event.type)) current.terminal = event.sequence;
3083
- }
3084
- if (!PRE_START_TURN_TYPES.has(event.type)) previous = resume;
3085
- }
3086
- for (const turn of bounds.values()) {
3087
- let low = 0;
3088
- let high = gaps.length;
3089
- while (low < high) {
3090
- const middle = low + high >> 1;
3091
- if (gaps[middle] <= turn.first) low = middle + 1;
3092
- else high = middle;
3093
- }
3094
- turn.hidden = low < gaps.length && gaps[low] < turn.last;
3095
- }
3096
- return bounds;
3097
- }
3098
- function activeConversationTurn(events) {
3099
- for (let index = events.length - 1; index >= 0; index -= 1) {
3100
- const event = events[index];
3101
- if (!event.turnId) continue;
3102
- if (TERMINAL_TURN_TYPES.has(event.type)) return null;
3103
- if (event.type === "turn.started") return event.turnId;
3104
- }
3105
- return null;
3106
- }
3107
- function settledTurns(events) {
3108
- const settled = /* @__PURE__ */ new Set();
3109
- for (const event of events) {
3110
- if (event.turnId && TERMINAL_TURN_TYPES.has(event.type)) settled.add(event.turnId);
3111
- }
3112
- return settled;
3113
- }
3114
- function windowTurns(events) {
3115
- const turns = /* @__PURE__ */ new Set();
3116
- for (const event of events) if (event.turnId) turns.add(event.turnId);
3117
- return turns;
3118
- }
3119
- var EMPTY_PRESENTED_OUTPUTS = /* @__PURE__ */ new Map();
3120
- var PRE_START_TURN_TYPES = /* @__PURE__ */ new Set(["turn.queued", "turn.capacity_waiting"]);
3121
- var PRESENTED_OUTPUT_READS_PER_PASS = 8;
3122
- var PRESENTED_OUTPUT_PAGE_SIZE = 16;
3123
- var PRESENTED_OUTPUT_MAX_PAGES = 16;
3124
- var PRESENTED_OUTPUT_RETRIES = 3;
3125
- var PRESENTED_OUTPUT_RETRY_MS = 2e3;
3126
- var RETAINED_VIEW_STEPS = {
3127
- load: () => {
3128
- },
3129
- retain: () => () => {
3130
- }
3131
- };
3132
- function mergeLoadedEvents(conversation, stores, presented, turnless, exactOutputs = EMPTY_PRESENTED_OUTPUTS) {
3133
- if (stores.size === 0 && presented.size === 0 && turnless.length === 0 && exactOutputs.size === 0) {
3134
- return conversation;
3135
- }
3136
- const turns = windowTurns(conversation);
3137
- const ids = new Set(conversation.map((event) => event.id));
3138
- const extra = [];
3139
- const add = (event) => {
3140
- if (ids.has(event.id) || !event.turnId || !turns.has(event.turnId)) return;
3141
- ids.add(event.id);
3142
- extra.push(event);
3143
- };
3144
- presented.forEach(add);
3145
- exactOutputs.forEach(add);
3146
- for (const [turnId, store] of stores) if (turns.has(turnId)) store.events.forEach(add);
3147
- for (const event of turnless) {
3148
- if (ids.has(event.id)) continue;
3149
- ids.add(event.id);
3150
- extra.push(event);
3151
- }
3152
- if (extra.length === 0) return conversation;
3153
- return [...conversation, ...extra].sort((left, right) => left.sequence - right.sequence);
3154
- }
3155
- function groupByTurn(events) {
3156
- const turns = /* @__PURE__ */ new Map();
3157
- for (const event of events) {
3158
- if (!event.turnId) continue;
3159
- const list = turns.get(event.turnId);
3160
- if (list) list.push(event);
3161
- else turns.set(event.turnId, [event]);
3162
- }
3163
- return turns;
3164
- }
3165
- function appendStepEvents(store, incoming) {
3166
- if (incoming.length === 0) return { events: store.events, bytes: store.bytes };
3167
- const ids = new Set(store.events.map((event) => event.id));
3168
- let bytes = store.bytes;
3169
- const fresh = [];
3170
- for (const event of incoming) {
3171
- if (ids.has(event.id)) continue;
3172
- ids.add(event.id);
3173
- fresh.push(event);
3174
- bytes += browserJsonBytes(event) + (store.events.length + fresh.length > 1 ? 1 : 0);
3175
- }
3176
- if (fresh.length === 0) return { events: store.events, bytes: store.bytes };
3177
- const last = store.events[store.events.length - 1];
3178
- const events = [...store.events, ...fresh];
3179
- if (last && fresh.some((event) => event.sequence < last.sequence)) {
3180
- events.sort((left, right) => left.sequence - right.sequence);
3181
- } else if (!last) {
3182
- events.sort((left, right) => left.sequence - right.sequence);
3183
- }
3184
- return { events, bytes };
3185
- }
3186
- function turnHasHiddenSequences(events, turnId, before) {
3187
- const start = events.findIndex((event) => event.turnId === turnId);
3188
- if (start < 0) return true;
3189
- let expected = eventResumeSequence(events[start]) + 1;
3190
- for (let index = start + 1; index < events.length; index += 1) {
3191
- const event = events[index];
3192
- if (event.sequence >= before) break;
3193
- if (event.sequence > expected) return true;
3194
- expected = Math.max(expected, eventResumeSequence(event) + 1);
3195
- }
3196
- return expected < before;
3197
- }
3198
- function trimLiveStepTail(store) {
3199
- if (store.events.length <= SESSION_TURN_LIVE_STEP_TAIL && store.bytes <= SESSION_TURN_LIVE_STEP_TAIL_BYTES) {
3200
- return store;
3201
- }
3202
- const kept = boundBrowserSessionEventWindow(store.events, {
3203
- maxCount: SESSION_TURN_LIVE_STEP_TAIL,
3204
- maxBytes: SESSION_TURN_LIVE_STEP_TAIL_BYTES
3205
- });
3206
- return { ...store, events: kept.events, bytes: kept.bytes, hasOlder: true, cursor: null };
3207
- }
3208
- function boundStepStores(stores, retained) {
3209
- let total = 0;
3210
- for (const [turnId, store] of stores) {
3211
- if (!retained.get(turnId)) total += store.bytes;
3212
- }
3213
- if (total <= SESSION_STEP_BROWSER_MAX_BYTES) return stores;
3214
- const candidates = [...stores].filter(([turnId, store]) => !retained.get(turnId) && !store.loading).sort((left, right) => left[1].touched - right[1].touched);
3215
- for (const [turnId, store] of candidates) {
3216
- if (total <= SESSION_STEP_BROWSER_MAX_BYTES) break;
3217
- stores.delete(turnId);
3218
- total -= store.bytes;
3219
- }
3220
- return stores;
3221
- }
3222
- async function findPresentedOutput(client, workspaceId, sessionId, callId, after, terminal) {
3223
- let cursor = after;
3224
- for (let page = 0; page < PRESENTED_OUTPUT_MAX_PAGES; page += 1) {
3225
- const read = await readEventPage(client, workspaceId, sessionId, {
3226
- includeTypes: ["agent.toolCall.output"],
3227
- after: cursor,
3228
- ...terminal !== null ? { before: terminal + 1 } : {},
3229
- direction: "after",
3230
- limit: PRESENTED_OUTPUT_PAGE_SIZE,
3231
- payloadMode: "full"
3232
- });
3233
- const output = read.events.find(
3234
- (event) => event.payload?.id === callId
3235
- );
3236
- if (output) return output;
3237
- const last = read.events.at(-1);
3238
- if (!last || !(read.hasMore ?? read.events.length >= PRESENTED_OUTPUT_PAGE_SIZE)) return null;
3239
- cursor = last.sequence;
3240
- }
3241
- return null;
3242
- }
3243
- async function readEventPage(client, workspaceId, sessionId, options) {
3244
- const pageClient = client;
3245
- if (typeof pageClient.listEventPage === "function") {
3246
- const page = await pageClient.listEventPage(workspaceId, sessionId, options);
3247
- return {
3248
- events: page.events,
3249
- hasMore: page.hasMore,
3250
- // An SDK that predates the announcement reports nothing: treat it as none.
3251
- conversationFilter: page.conversationFilter ?? null
3252
- };
3253
- }
3254
- return { events: await client.listEvents(workspaceId, sessionId, options), hasMore: null };
3255
- }
3256
-
3257
- // src/hooks/use-turn-queue.ts
3258
- import { isTransientRequestError as isTransientRequestError2 } from "@opengeni/sdk";
3259
- import { useCallback as useCallback7, useEffect as useEffect4, useLayoutEffect as useLayoutEffect2, useMemo as useMemo3, useRef as useRef6, useState as useState4 } from "react";
3260
- function isTurnQueueEvent(event) {
3261
- return event.type.startsWith("turn.") || event.type.startsWith("session.queue.") || event.type.startsWith("session.control.") || event.type.startsWith("system.update.") || event.type.startsWith("workspace.inference.");
3262
- }
3263
- function queueSnapshotCovers(candidate, observed) {
3264
- return Boolean(
3265
- candidate && candidate.version >= observed.version && candidate.effectiveControl.controlVersion >= observed.effectiveControl.controlVersion
3266
- );
3267
- }
3268
- var EMPTY_PENDING_BY_TURN = {};
3269
- function useTurnQueue(sessionId, options = {}) {
3270
- const t = useOpenGeniText();
3271
- const { client, workspaceId, workspaceControlEvent, registerSessionReconciler } = useEmbeddedSession(options);
3272
- const enabled = (options.enabled ?? true) && Boolean(sessionId);
3273
- const targetKey = `${workspaceId}\0${sessionId ?? ""}`;
3274
- const pageLive = usePageLiveActivity();
3275
- const pageLiveRef = useRef6(pageLive);
3276
- pageLiveRef.current = pageLive;
3277
- const [snapshot, setSnapshot] = useState4(null);
3278
- const [stateTargetKey, setStateTargetKey] = useState4(targetKey);
3279
- const [loading, setLoading] = useState4(enabled);
3280
- const [error, setError] = useState4(null);
3281
- const [mutationError, setMutationError] = useState4(null);
3282
- const [pendingByTurn, setPendingByTurn] = useState4({});
3283
- const [acceptedSteers, setAcceptedSteers] = useState4([]);
3284
- const pendingRef = useRef6({});
3285
- const readGeneration = useRef6(0);
3286
- const targetKeyRef = useRef6(targetKey);
3287
- const snapshotRef = useRef6(null);
3288
- const transientStreakRef = useRef6(
3289
- null
3290
- );
3291
- const transientRetryTimerRef = useRef6(null);
3292
- const cancelTransientRetry = useCallback7(() => {
3293
- if (transientRetryTimerRef.current !== null) {
3294
- clearTimeout(transientRetryTimerRef.current);
3295
- transientRetryTimerRef.current = null;
3296
- }
3297
- }, []);
3298
- useLayoutEffect2(() => {
3299
- if (targetKeyRef.current === targetKey) return;
3300
- targetKeyRef.current = targetKey;
3301
- readGeneration.current += 1;
3302
- snapshotRef.current = null;
3303
- pendingRef.current = {};
3304
- setStateTargetKey(targetKey);
3305
- setSnapshot(null);
3306
- setLoading(enabled);
3307
- setError(null);
3308
- transientStreakRef.current = null;
3309
- cancelTransientRetry();
3310
- setMutationError(null);
3311
- setPendingByTurn({});
3312
- setAcceptedSteers([]);
3313
- }, [cancelTransientRetry, enabled, targetKey]);
3314
- useEffect4(() => {
3315
- if (acceptedSteers.length === 0 || options.events === void 0) return;
3316
- const durablyConsumedTurnIds = new Set(
3317
- options.events.flatMap(
3318
- (event) => [
3319
- "turn.started",
3320
- "turn.superseded",
3321
- "turn.cancelled",
3322
- "turn.failed",
3323
- "turn.completed"
3324
- ].includes(event.type) && event.turnId ? [event.turnId] : []
3325
- )
3326
- );
3327
- if (durablyConsumedTurnIds.size === 0) return;
3328
- setAcceptedSteers(
3329
- (current) => current.filter((steer) => !durablyConsumedTurnIds.has(steer.turnId))
3330
- );
3331
- }, [acceptedSteers.length, options.events]);
3332
- const acceptSnapshot = useCallback7(
3333
- (ownedTargetKey, next) => {
3334
- if (targetKeyRef.current !== ownedTargetKey) return false;
3335
- const current = snapshotRef.current;
3336
- if (next && current && (next.version < current.version || next.effectiveControl.controlVersion < current.effectiveControl.controlVersion)) {
3337
- return false;
3338
- }
3339
- snapshotRef.current = next;
3340
- setStateTargetKey(ownedTargetKey);
3341
- setSnapshot(next);
3342
- return true;
3343
- },
3344
- []
3345
- );
3346
- const load = useCallback7(
3347
- async (rejectOnFailure = false, fresh = false) => {
3348
- if (!sessionId) return;
3349
- const ownedTargetKey = `${workspaceId}\0${sessionId}`;
3350
- const ticket = ++readGeneration.current;
3351
- try {
3352
- const fetched = fresh ? await client.getQueue(workspaceId, sessionId, { fresh: true }) : await client.getQueue(workspaceId, sessionId);
3353
- if (targetKeyRef.current !== ownedTargetKey) return;
3354
- transientStreakRef.current = null;
3355
- cancelTransientRetry();
3356
- const ownsLatestRead = ticket === readGeneration.current;
3357
- if (rejectOnFailure) {
3358
- const committed = acceptSnapshot(ownedTargetKey, fetched);
3359
- if (!committed && !queueSnapshotCovers(snapshotRef.current, fetched)) {
3360
- throw new TypeError("Queue reconciliation did not commit authoritative state");
3361
- }
3362
- setError(null);
3363
- if (ownsLatestRead) setLoading(false);
3364
- } else if (ownsLatestRead) {
3365
- acceptSnapshot(ownedTargetKey, fetched);
3366
- setError(null);
3367
- setLoading(false);
3368
- }
3369
- } catch (cause) {
3370
- if (targetKeyRef.current === ownedTargetKey && (ticket === readGeneration.current || rejectOnFailure)) {
3371
- if (isTransientRequestError2(cause)) {
3372
- const now = Date.now();
3373
- const streak = transientStreakRef.current ??= {
3374
- since: now,
3375
- attempts: 0,
3376
- surfaced: false
3377
- };
3378
- const step = transientReadRetryStep(streak, now, DEFAULT_TRANSIENT_READ_RETRY, cause);
3379
- if (!step.quiet) {
3380
- if (!streak.surfaced) setError(asError(cause));
3381
- streak.surfaced = true;
3382
- if (ticket === readGeneration.current) setLoading(false);
3383
- }
3384
- if (!rejectOnFailure && pageLiveRef.current) {
3385
- cancelTransientRetry();
3386
- transientRetryTimerRef.current = setTimeout(() => {
3387
- transientRetryTimerRef.current = null;
3388
- if (targetKeyRef.current === ownedTargetKey) void loadRef.current(false, fresh);
3389
- }, step.delayMs);
3390
- }
3391
- } else {
3392
- transientStreakRef.current = null;
3393
- setError(asError(cause));
3394
- if (ticket === readGeneration.current) setLoading(false);
3395
- }
3396
- }
3397
- if (rejectOnFailure) throw cause;
3398
- }
3399
- },
3400
- [client, workspaceId, sessionId, acceptSnapshot, cancelTransientRetry]
3401
- );
3402
- const loadRef = useRef6(load);
3403
- loadRef.current = load;
3404
- useEffect4(() => cancelTransientRetry, [cancelTransientRetry]);
3405
- useEffect4(() => {
3406
- if (!enabled || !pageLive) {
3407
- cancelTransientRetry();
3408
- setLoading(false);
3409
- return;
3410
- }
3411
- setLoading(true);
3412
- const pollIntervalMs = options.pollIntervalMs;
3413
- if (pollIntervalMs === void 0 || pollIntervalMs <= 0) {
3414
- void load();
3415
- return () => {
3416
- readGeneration.current += 1;
3417
- };
3418
- }
3419
- let cancelled = false;
3420
- let timer = null;
3421
- const schedule = () => {
3422
- if (cancelled) return;
3423
- timer = setTimeout(() => {
3424
- timer = null;
3425
- void load().finally(schedule);
3426
- }, pollIntervalMs);
3427
- };
3428
- void load().finally(schedule);
3429
- return () => {
3430
- cancelled = true;
3431
- if (timer !== null) clearTimeout(timer);
3432
- readGeneration.current += 1;
3433
- };
3434
- }, [cancelTransientRetry, load, enabled, pageLive, options.pollIntervalMs]);
3435
- const loadFresh = useCallback7(() => load(false, true), [load]);
3436
- useEffect4(() => {
3437
- if (enabled && workspaceControlEvent) void loadFresh();
3438
- }, [enabled, loadFresh, workspaceControlEvent]);
3439
- useEffect4(() => {
3440
- if (!sessionId || !enabled) return;
3441
- return registerSessionReconciler(sessionId, "queue", loadFresh);
3442
- }, [enabled, loadFresh, registerSessionReconciler, sessionId]);
3443
- const scheduleRefresh = useDebouncedCallback(() => void loadFresh());
3444
- const freshSnapshot = stateTargetKey === targetKey ? snapshot : null;
3445
- const freshLoading = stateTargetKey === targetKey ? loading : enabled;
3446
- useSessionEventTrigger(
3447
- client,
3448
- workspaceId,
3449
- sessionId,
3450
- isTurnQueueEvent,
3451
- scheduleRefresh,
3452
- {
3453
- enabled,
3454
- ...options.events !== void 0 ? { events: options.events } : {},
3455
- readThrough: projectionReadThrough(freshSnapshot, freshLoading),
3456
- refresh: scheduleRefresh
3457
- },
3458
- async () => await load(true, true)
3459
- );
3460
- const retainedSnapshot = useRetainedSessionView(
3461
- client,
3462
- workspaceId,
3463
- sessionId,
3464
- "queue",
3465
- freshSnapshot,
3466
- { enabled, discard: stateTargetKey === targetKey && deniesRetainedView(error) }
3467
- );
3468
- const mutate = useCallback7(
3469
- async (turnId, kind, command, failure = {}) => {
3470
- const ownedTargetKey = targetKey;
3471
- if (!sessionId || targetKeyRef.current !== ownedTargetKey || pendingRef.current[turnId]) {
3472
- return null;
3473
- }
3474
- const current = snapshotRef.current;
3475
- const turn = current?.items.find((candidate) => candidate.id === turnId);
3476
- if (!current || !turn) return null;
3477
- pendingRef.current = { ...pendingRef.current, [turnId]: kind };
3478
- setStateTargetKey(ownedTargetKey);
3479
- setPendingByTurn(pendingRef.current);
3480
- setMutationError(null);
3481
- const clientEventId = operationKey();
3482
- try {
3483
- let result;
3484
- try {
3485
- result = await command(current, turn, clientEventId);
3486
- } catch (cause) {
3487
- if (!isOutcomeUnknownError(cause)) throw cause;
3488
- result = await command(current, turn, clientEventId);
3489
- }
3490
- if (targetKeyRef.current !== ownedTargetKey) return null;
3491
- acceptSnapshot(ownedTargetKey, result.snapshot);
3492
- return result;
3493
- } catch (cause) {
3494
- if (targetKeyRef.current === ownedTargetKey) {
3495
- if (failure.quietWhenGone) {
3496
- await loadFresh();
3497
- const stillWaiting = snapshotRef.current?.items.some(
3498
- (candidate) => candidate.id === turnId
3499
- );
3500
- if (stillWaiting !== false && targetKeyRef.current === ownedTargetKey) {
3501
- setMutationError(asError(cause));
3502
- }
3503
- } else {
3504
- setMutationError(asError(cause));
3505
- await loadFresh();
3506
- }
3507
- }
3508
- return null;
3509
- } finally {
3510
- if (targetKeyRef.current === ownedTargetKey && turnId in pendingRef.current) {
3511
- const next = { ...pendingRef.current };
3512
- delete next[turnId];
3513
- pendingRef.current = next;
3514
- setPendingByTurn(next);
3515
- }
3516
- }
3517
- },
3518
- [acceptSnapshot, loadFresh, sessionId, targetKey]
3519
- );
3520
- const moveTurn = useCallback7(
3521
- async (turnId, beforeTurnId) => {
3522
- const result = await mutate(
3523
- turnId,
3524
- "move",
3525
- (current, _turn, clientEventId) => client.moveQueueItem(workspaceId, sessionId, turnId, {
3526
- clientEventId,
3527
- expectedQueueVersion: current.version,
3528
- beforeTurnId
3529
- })
3530
- );
3531
- return result !== null;
3532
- },
3533
- [client, mutate, sessionId, workspaceId]
3534
- );
3535
- const editTurn = useCallback7(
3536
- async (turnId, edit) => {
3537
- const result = await mutate(
3538
- turnId,
3539
- "edit",
3540
- (_current, turn, clientEventId) => client.editQueueItem(workspaceId, sessionId, turnId, {
3541
- clientEventId,
3542
- expectedTurnVersion: turn.version,
3543
- expectedDraftRevision: edit.expectedDraftRevision,
3544
- replaceDraft: edit.replaceDraft
3545
- })
3546
- );
3547
- return result?.draft ?? null;
3548
- },
3549
- [client, mutate, sessionId, workspaceId]
3550
- );
3551
- const recallTurn = useCallback7(
3552
- async (turnId, recall) => {
3553
- const ownedTargetKey = targetKey;
3554
- const known = snapshotRef.current?.items.some((candidate) => candidate.id === turnId);
3555
- if (known === false) return { status: "already_sent" };
3556
- const result = await mutate(
3557
- turnId,
3558
- "edit",
3559
- (_current, turn, clientEventId) => client.editQueueItem(workspaceId, sessionId, turnId, {
3560
- clientEventId,
3561
- expectedTurnVersion: turn.version,
3562
- expectedDraftRevision: recall.expectedDraftRevision,
3563
- replaceDraft: false
3564
- }),
3565
- { quietWhenGone: true }
3566
- );
3567
- if (targetKeyRef.current !== ownedTargetKey) return { status: "failed" };
3568
- if (result?.draft) return { status: "recalled", draft: result.draft };
3569
- const stillWaiting = snapshotRef.current?.items.some((candidate) => candidate.id === turnId);
3570
- return result === null && stillWaiting === false ? { status: "already_sent" } : { status: "failed" };
3571
- },
3572
- [client, mutate, sessionId, targetKey, workspaceId]
3573
- );
3574
- const steerTurn = useCallback7(
3575
- async (turnId) => {
3576
- const ownedTargetKey = targetKey;
3577
- const turn = snapshotRef.current?.items.find((candidate) => candidate.id === turnId);
3578
- if (targetKeyRef.current !== ownedTargetKey) return false;
3579
- if (!turn) {
3580
- setMutationError(new Error(t("hooks.useTurnQueue.thatQueuedPromptChangedBefore")));
3581
- await loadFresh();
3582
- return false;
3583
- }
3584
- const optimistic = {
3585
- turnId: turn.id,
3586
- triggerEventId: turn.triggerEventId,
3587
- text: turn.prompt,
3588
- annotations: turn.annotations ?? [],
3589
- resources: turn.resources,
3590
- tools: turn.tools,
3591
- occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
3592
- state: "sending"
3593
- };
3594
- setAcceptedSteers((current) => [
3595
- ...current.filter((steer) => steer.turnId !== turnId),
3596
- optimistic
3597
- ]);
3598
- const result = await mutate(
3599
- turnId,
3600
- "steer",
3601
- (current, queuedTurn, clientEventId) => client.steerQueueItem(workspaceId, sessionId, turnId, {
3602
- clientEventId,
3603
- expectedTurnVersion: queuedTurn.version,
3604
- controlEtag: current.effectiveControl.controlEtag
3605
- })
3606
- );
3607
- if (targetKeyRef.current !== ownedTargetKey) return false;
3608
- const advancedWithoutSteer = result === null && snapshotRef.current !== null && !snapshotRef.current.items.some((candidate) => candidate.id === turnId);
3609
- if (advancedWithoutSteer) {
3610
- setMutationError(null);
3611
- setAcceptedSteers((current) => current.filter((steer) => steer.turnId !== turnId));
3612
- return true;
3613
- }
3614
- const accepted = result !== null || snapshotRef.current?.items.some(
3615
- (candidate) => candidate.id === turnId && candidate.metadata.delivery === "steer"
3616
- ) === true;
3617
- setAcceptedSteers(
3618
- (current) => accepted ? current.map(
3619
- (steer) => steer.turnId === turnId ? { ...steer, state: "queued" } : steer
3620
- ) : current.filter((steer) => steer.turnId !== turnId)
3621
- );
3622
- return accepted;
3623
- },
3624
- [client, loadFresh, mutate, sessionId, targetKey, workspaceId, t]
3625
- );
3626
- const removeTurn = useCallback7(
3627
- async (turnId) => {
3628
- const result = await mutate(
3629
- turnId,
3630
- "delete",
3631
- (_current, turn, clientEventId) => client.deleteQueueItem(workspaceId, sessionId, turnId, {
3632
- clientEventId,
3633
- expectedTurnVersion: turn.version,
3634
- reason: "Deleted from the prompt queue"
3635
- })
3636
- );
3637
- return result !== null;
3638
- },
3639
- [client, mutate, sessionId, workspaceId]
3640
- );
3641
- const identityMatches = stateTargetKey === targetKey;
3642
- const visibleSnapshot = freshSnapshot ?? retainedSnapshot;
3643
- const visiblePendingByTurn = identityMatches ? pendingByTurn : EMPTY_PENDING_BY_TURN;
3644
- const mutating = useMemo3(
3645
- () => Object.keys(visiblePendingByTurn).length > 0,
3646
- [visiblePendingByTurn]
3647
- );
3648
- const mutationFor = useCallback7(
3649
- (turnId) => visiblePendingByTurn[turnId] ?? null,
3650
- [visiblePendingByTurn]
3651
- );
3652
- return {
3653
- snapshot: visibleSnapshot,
3654
- queue: visibleSnapshot?.items ?? [],
3655
- pendingInputs: visibleSnapshot?.pendingInputs ?? [],
3656
- pendingInputAttachment: visibleSnapshot?.pendingInputAttachment ?? null,
3657
- activePersonalConnections: visibleSnapshot?.activePersonalConnections ?? [],
3658
- effectiveControl: visibleSnapshot?.effectiveControl ?? null,
3659
- stoppingPreviousAttempt: visibleSnapshot?.stoppingPreviousAttempt ?? false,
3660
- loading: freshLoading && retainedSnapshot === null,
3661
- error: identityMatches ? error : null,
3662
- refresh: load,
3663
- moveTurn,
3664
- editTurn,
3665
- recallTurn,
3666
- steerTurn,
3667
- removeTurn,
3668
- pendingByTurn: visiblePendingByTurn,
3669
- mutationFor,
3670
- mutating,
3671
- mutationError: identityMatches ? mutationError : null,
3672
- clearMutationError: useCallback7(() => {
3673
- if (targetKeyRef.current === targetKey) setMutationError(null);
3674
- }, [targetKey]),
3675
- acceptedSteers: identityMatches ? acceptedSteers : []
3676
- };
3677
- }
3678
- function operationKey() {
3679
- return globalThis.crypto.randomUUID();
3680
- }
3681
- function asError(cause) {
3682
- return normalizeError(cause);
3683
- }
3684
- function isOutcomeUnknownError(cause) {
3685
- return typeof cause === "object" && cause !== null && cause.outcomeUnknown === true;
3686
- }
3687
-
3688
- // src/hooks/use-session-conversation.ts
3689
- import { useLayoutEffect as useLayoutEffect3, useMemo as useMemo4, useRef as useRef7, useState as useState5 } from "react";
3690
- function useSessionConversation(sessionId, options = {}) {
3691
- const [initialPrompt] = useState5(() => options.pendingPrompt ?? null);
3692
- const context = useOpenGeni(options);
3693
- const scope = { client: context.client, workspaceId: context.workspaceId };
3694
- const config = useClientConfigFlags(context.client);
3695
- const showModelPicker = options.modelPicker ?? config.modelSelection;
3696
- const catalog = useWorkspaceModelCatalog({ ...scope, enabled: showModelPicker });
3697
- const feed = useSessionEvents(sessionId, scope);
3698
- const pendingPrompt = usePendingPrompt(initialPrompt, sessionId, feed.initialHistoryReady);
3699
- const eventOptions = { ...scope, events: feed.events };
3700
- const detail = useSession(sessionId, eventOptions);
3701
- const queue = useTurnQueue(sessionId, eventOptions);
3702
- const human = useHumanInputRequests(sessionId, eventOptions);
3703
- const control = useSessionControl(sessionId, scope);
3704
- const approvals = useMemo4(() => projectPendingApprovals(feed.events), [feed.events]);
3705
- const files = useFileAttachments({ ...scope, scope: uploadScopeForSession(detail.session) });
3706
- const clearFiles = files.clear;
3707
- const attachmentSession = useRef7(sessionId);
3708
- useLayoutEffect3(() => {
3709
- if (attachmentSession.current === sessionId) return;
3710
- const created = attachmentSession.current === null;
3711
- attachmentSession.current = sessionId;
3712
- if (created) return;
3713
- clearFiles();
3714
- }, [clearFiles, sessionId]);
3715
- const uploadsEnabled = (options.attachments ?? true) && config.uploads;
3716
- const status = feed.sessionStatus ?? detail.session?.status;
3717
- const terminal = status === "cancelled" || (detail.session ? sessionArchived(detail.session) : false);
3718
- const importedArchive = detail.session?.importedArchive?.readOnly === true;
3719
- const host = options.composerOptions;
3720
- const resolveExtras = () => typeof host?.sendExtras === "function" ? host.sendExtras() : host?.sendExtras;
3721
- const releaseSentFiles = (input) => files.removeReadyFiles(
3722
- (input.resources ?? []).flatMap(
3723
- (resource) => resource.kind === "file" ? [resource.fileId] : []
3724
- )
3725
- );
3726
- const composer = useComposer(sessionId, {
3727
- ...eventOptions,
3728
- initialDraft: host?.initialDraft,
3729
- busySend: host?.busySend,
3730
- offerQueue: host?.offerQueue,
3731
- effectiveControl: queue.effectiveControl ?? detail.session?.effectiveControl,
3732
- // As in the console and the native screen: a turn that is still current
3733
- // (running or recovering) means a Send waits. A turn parked on provider
3734
- // capacity does not: the Send replaces it and starts right away.
3735
- sendDestination: () => promptSendDestination({
3736
- status,
3737
- activeTurnId: detail.session?.activeTurnId,
3738
- queuedPrompts: queue.queue.length,
3739
- admissionBlock: detail.session?.admissionBlock
3740
- }),
3741
- sendExtras: () => {
3742
- const extras = resolveExtras();
3743
- return {
3744
- ...extras,
3745
- resources: [...extras?.resources ?? [], ...uploadsEnabled ? files.readyResources : []]
3746
- };
3747
- },
3748
- sendBlocked: () => sessionId === null || terminal || importedArchive || uploadsEnabled && files.hasUnresolved || host?.sendBlocked?.() === true,
3749
- onSubmitted: (text, input) => {
3750
- releaseSentFiles(input);
3751
- return host?.onSubmitted?.(text, input);
3752
- },
3753
- onSent: (text, input) => {
3754
- releaseSentFiles(input);
3755
- return host?.onSent?.(text, input);
3756
- },
3757
- onDeliveryError: host?.onDeliveryError
3758
- });
3759
- const conversation = useMemo4(
3760
- () => conversationTimeline(feed.timeline, queue, composer),
3761
- [feed.timeline, queue, composer]
3762
- );
3763
- const session = detail.session;
3764
- const sessionControl = session?.effectiveControl;
3765
- const timeline = useSessionStartupTimeline(conversation, {
3766
- session: session && sessionControl ? {
3767
- ...session,
3768
- effectiveControl: admissionRecheckControl(
3769
- sessionControl,
3770
- queue.effectiveControl,
3771
- composer.effectiveControl
3772
- )
3773
- } : null,
3774
- events: feed.events,
3775
- optimisticMessages: composer.optimisticMessages,
3776
- hasNewer: feed.hasNewer,
3777
- queue: queue.snapshot,
3778
- pendingPrompt,
3779
- historyReady: sessionId !== null && feed.initialHistoryReady
3780
- });
3781
- const error = detail.error ?? feed.error ?? human.error;
3782
- const loadFailed = Boolean(feed.error) && !feed.initialHistoryReady;
3783
- const retry = async () => {
3784
- await Promise.all([
3785
- ...detail.error ? [detail.refresh()] : [],
3786
- ...human.error ? [human.refresh()] : [],
3787
- ...feed.error ? [feed.jumpToLatest()] : []
3788
- ]);
3789
- };
3790
- return {
3791
- ...scope,
3792
- sessionId,
3793
- config,
3794
- catalog,
3795
- showModelPicker,
3796
- feed,
3797
- detail,
3798
- queue,
3799
- human,
3800
- control,
3801
- approvals,
3802
- files,
3803
- uploadsEnabled,
3804
- composer,
3805
- /** The same live application context for text and durable voice messages. */
3806
- getModelContext: () => resolveExtras()?.modelContext,
3807
- timeline,
3808
- status,
3809
- terminal,
3810
- importedArchive,
3811
- running: sessionTurnKeepsRunControl(status),
3812
- error,
3813
- loadFailed,
3814
- retry
3815
- };
3816
- }
3817
- function usePendingPrompt(prompt, sessionId, historyReady) {
3818
- const owner = useRef7({
3819
- sessionId,
3820
- retired: prompt === null
3821
- });
3822
- const current = owner.current;
3823
- if (!current.retired && current.sessionId !== sessionId) {
3824
- if (current.sessionId === null) current.sessionId = sessionId;
3825
- else current.retired = true;
3826
- }
3827
- if (!current.retired && sessionId !== null && historyReady) current.retired = true;
3828
- return current.retired ? null : prompt;
3829
- }
3830
-
3831
- // src/hooks/use-session-read-acknowledgement.ts
3832
- import { useEffect as useEffect5, useMemo as useMemo5, useRef as useRef8 } from "react";
3833
- var SESSION_READ_ACKNOWLEDGEMENT_RETRY_MS = 1e3;
3834
- function isPermanentRejection(error) {
3835
- const status = error && typeof error === "object" ? error.status : void 0;
3836
- return typeof status === "number" && status >= 400 && status < 500 && status !== 408 && status !== 429;
3837
- }
3838
- function useSessionReadAcknowledgement(input) {
3839
- const { client, workspaceId, sessionId, events, active } = input;
3840
- const session = input.session && (input.session.id ?? sessionId) === sessionId ? input.session : null;
3841
- const attentionThrough = useMemo5(() => sessionAttentionReadThroughSequence(events), [events]);
3842
- const { readThrough, unread } = readAcknowledgementFrontier(session, attentionThrough);
3843
- const hasSession = session !== null;
3844
- const receipt = useRef8(null);
3845
- const refused = useRef8(/* @__PURE__ */ new Set());
3846
- const retryTimer = useRef8(null);
3847
- useEffect5(
3848
- () => () => {
3849
- if (retryTimer.current !== null) clearTimeout(retryTimer.current);
3850
- retryTimer.current = null;
3851
- receipt.current = null;
3852
- },
3853
- []
3854
- );
3855
- useEffect5(() => {
3856
- if (!active || !hasSession || !unread || readThrough <= 0) return;
3857
- if (!workspaceId || !sessionId || typeof client.updateSessionAttention !== "function") return;
3858
- const scope = `${workspaceId}:${sessionId}`;
3859
- if (refused.current.has(scope)) return;
3860
- const key = `${scope}:${readThrough}`;
3861
- if (receipt.current === key) return;
3862
- receipt.current = key;
3863
- if (retryTimer.current !== null) clearTimeout(retryTimer.current);
3864
- retryTimer.current = null;
3865
- const attempt = (retried) => {
3866
- void Promise.resolve().then(
3867
- () => client.updateSessionAttention(workspaceId, sessionId, {
3868
- unread: false,
3869
- acknowledgedThroughSequence: readThrough
3870
- })
3871
- ).catch((error) => {
3872
- if (receipt.current !== key) return;
3873
- if (isPermanentRejection(error)) {
3874
- refused.current.add(scope);
3875
- return;
3876
- }
3877
- if (!retried) {
3878
- retryTimer.current = setTimeout(() => {
3879
- retryTimer.current = null;
3880
- if (receipt.current === key) attempt(true);
3881
- }, SESSION_READ_ACKNOWLEDGEMENT_RETRY_MS);
3882
- return;
3883
- }
3884
- receipt.current = null;
3885
- });
3886
- };
3887
- attempt(false);
3888
- }, [active, client, hasSession, readThrough, sessionId, unread, workspaceId]);
3889
- }
3890
-
3891
- // src/hooks/use-new-conversation.ts
3892
- import {
3893
- OpenGeniApiError
3894
- } from "@opengeni/sdk";
3895
- import { useCallback as useCallback8, useLayoutEffect as useLayoutEffect4, useMemo as useMemo6, useRef as useRef9, useState as useState6 } from "react";
3896
- var NOOP_ASYNC = async () => {
3897
- };
3898
- var EMPTY_CHOICE = {};
3899
- var NO_LEVELS = [];
3900
- function useNewConversation(options = {}) {
3901
- const t = useOpenGeniText();
3902
- const context = useOpenGeni(options);
3903
- const scope = { client: context.client, workspaceId: context.workspaceId };
3904
- const config = useClientConfigFlags(context.client);
3905
- const showModelPicker = options.modelPicker ?? config.modelSelection;
3906
- const catalog = useWorkspaceModelCatalog({ ...scope, enabled: showModelPicker });
3907
- const preferredModel = options.defaultModel && catalog.models.some(
3908
- (row) => row.id === options.defaultModel && row.availability?.selectable !== false
3909
- ) ? options.defaultModel : void 0;
3910
- const defaultModel = preferredModel ?? catalog.defaultModel;
3911
- const files = useFileAttachments(scope);
3912
- const uploadsEnabled = (options.attachments ?? true) && config.uploads;
3913
- const available = options.enabled !== false && (options.createSession !== void 0 || config.sessionCreation);
3914
- const [text, setText] = useState6("");
3915
- const [choice, setChoice] = useState6(EMPTY_CHOICE);
3916
- const [, setLevels] = useState6(NO_LEVELS);
3917
- const [sending, setSending] = useState6(false);
3918
- const [error, setError] = useState6(null);
3919
- const [pending, setPending] = useState6(null);
3920
- const [completion, setCompletion] = useState6(null);
3921
- const textRef = useRef9(text);
3922
- const textRevision = useRef9(0);
3923
- const choiceRef = useRef9(choice);
3924
- const levelsRef = useRef9(NO_LEVELS);
3925
- const setModelLevels = useCallback8((levels = NO_LEVELS) => {
3926
- const previous = levelsRef.current;
3927
- if (previous.length === levels.length && previous.every((level, index) => {
3928
- const next = levels[index];
3929
- return next?.model === level.model && next.effort === level.effort;
3930
- }))
3931
- return;
3932
- levelsRef.current = levels;
3933
- setLevels(levels);
3934
- }, []);
3935
- const filesRef = useRef9(files);
3936
- filesRef.current = files;
3937
- const pendingRef = useRef9(null);
3938
- const completionRef = useRef9(null);
3939
- const inFlight = useRef9(false);
3940
- const lifetime = useRef9({ mounted: true, generation: 0 }).current;
3941
- const identity = useMemo6(
3942
- () => ({
3943
- client: context.client,
3944
- workspaceId: context.workspaceId,
3945
- scopeKey: options.scopeKey
3946
- }),
3947
- [context.client, context.workspaceId, options.scopeKey]
3948
- );
3949
- const committedIdentity = useRef9(identity);
3950
- useLayoutEffect4(() => {
3951
- lifetime.mounted = true;
3952
- return () => {
3953
- lifetime.mounted = false;
3954
- lifetime.generation++;
3955
- };
3956
- }, [lifetime]);
3957
- useLayoutEffect4(() => {
3958
- if (committedIdentity.current === identity) return;
3959
- committedIdentity.current = identity;
3960
- lifetime.generation++;
3961
- inFlight.current = false;
3962
- pendingRef.current = null;
3963
- completionRef.current = null;
3964
- textRef.current = "";
3965
- textRevision.current = 0;
3966
- choiceRef.current = EMPTY_CHOICE;
3967
- setText("");
3968
- setChoice(EMPTY_CHOICE);
3969
- setSending(false);
3970
- setError(null);
3971
- setPending(null);
3972
- setCompletion(null);
3973
- filesRef.current.clear();
3974
- }, [identity, lifetime]);
3975
- const ownsScope = () => lifetime.mounted && committedIdentity.current === identity;
3976
- const updateText = (value) => {
3977
- if (!ownsScope()) return;
3978
- if (value !== textRef.current) textRevision.current++;
3979
- textRef.current = value;
3980
- setText(value);
3981
- };
3982
- const updateChoice = (patch) => {
3983
- if (!ownsScope()) return;
3984
- const base = patch.model === void 0 ? creationChoice() : choiceRef.current;
3985
- const next = { ...base, ...patch };
3986
- const model = catalog.models.find((row) => row.id === (next.model ?? defaultModel));
3987
- if (model) {
3988
- if (next.reasoningEffort)
3989
- next.reasoningEffort = coerceReasoningEffortForModel(model, next.reasoningEffort);
3990
- if (next.latencyMode && !runnableLatencyModesForModel(model).includes(next.latencyMode))
3991
- next.latencyMode = "standard";
3992
- }
3993
- choiceRef.current = next;
3994
- setChoice(choiceRef.current);
3995
- if (!pendingRef.current) setError(null);
3996
- };
3997
- const displayPolicy = (selected) => {
3998
- const model = selected.model ?? defaultModel;
3999
- const definition = catalog.models.find((row) => row.id === model);
4000
- const effort = selected.reasoningEffort ?? (definition ? defaultEffortForModel(definition) : config.defaultReasoningEffort ?? "medium");
4001
- return showModelPicker && model ? {
4002
- model,
4003
- reasoningEffort: definition ? coerceReasoningEffortForModel(definition, effort) : effort,
4004
- latencyMode: selected.latencyMode ?? "standard"
4005
- } : void 0;
4006
- };
4007
- const creationChoice = () => {
4008
- const selected = choiceRef.current;
4009
- if (preferredModel) return { model: preferredModel, ...selected };
4010
- if (selected !== EMPTY_CHOICE || !showModelPicker || catalog.loading || !levelsRef.current.length)
4011
- return selected;
4012
- const workspace = displayPolicy(EMPTY_CHOICE);
4013
- const view = modelLevelsView(t, {
4014
- levels: levelsRef.current,
4015
- rows: catalog.rows,
4016
- model: workspace?.model ?? "",
4017
- effort: workspace?.reasoningEffort ?? "medium",
4018
- latencyMode: "standard"
4019
- });
4020
- const first = view && view.index < 0 ? modelLevelChoice(view, 0, false) : null;
4021
- return first ? { model: first.model, reasoningEffort: first.effort } : selected;
4022
- };
4023
- const create = options.createSession ?? (async (initialMessage, idempotencyKey, input) => {
4024
- const creator = context.client.createSession;
4025
- if (typeof creator !== "function")
4026
- throw new Error(t("hooks.useNewConversation.newChatsAreNotEnabled"));
4027
- const created = await creator.call(context.client, context.workspaceId, {
4028
- ...input.startMode === "realtime" ? {} : { initialMessage },
4029
- idempotencyKey,
4030
- ...input
4031
- });
4032
- return created.id;
4033
- });
4034
- const finishCreation = (accepted) => {
4035
- if (!lifetime.mounted || lifetime.generation !== accepted.generation) return;
4036
- const { attempt, sessionId } = accepted;
4037
- const sentFiles = new Set(attempt.options.resources?.map((resource) => resource.fileId) ?? []);
4038
- const selected = showModelPicker ? creationChoice() : EMPTY_CHOICE;
4039
- const policyChanged = ["model", "reasoningEffort", "latencyMode"].some(
4040
- (field) => selected[field] !== attempt.options[field]
4041
- );
4042
- const draft = {
4043
- text: attempt.clearDraft && textRevision.current === attempt.textRevision ? "" : textRef.current,
4044
- resources: filesRef.current.readyResources.filter(
4045
- (resource) => !sentFiles.has(resource.fileId)
4046
- ),
4047
- // Unchanged choices are already part of the created session. Do not
4048
- // replace server-owned defaults with a browser's catalog estimate.
4049
- ...policyChanged ? { policy: displayPolicy(selected) } : {}
4050
- };
4051
- pendingRef.current = null;
4052
- completionRef.current = null;
4053
- setPending(null);
4054
- setCompletion(null);
4055
- updateText(draft.text);
4056
- filesRef.current.removeReadyFiles(sentFiles);
4057
- notifyObserver(options.onCreated, {
4058
- sessionId,
4059
- initialMessage: attempt.initialMessage,
4060
- sentAt: attempt.sentAt,
4061
- draft,
4062
- ...attempt.realtimeModel ? { realtimeModel: attempt.realtimeModel } : {}
4063
- });
4064
- };
4065
- const finishRef = useRef9(finishCreation);
4066
- finishRef.current = finishCreation;
4067
- useLayoutEffect4(() => {
4068
- if (completion && !files.hasUnresolved) finishRef.current(completion);
4069
- }, [completion, files.hasUnresolved]);
4070
- const deliver = async (attempt) => {
4071
- if (!ownsScope() || inFlight.current || completionRef.current || !available) return false;
4072
- const ownedGeneration = lifetime.generation;
4073
- inFlight.current = true;
4074
- pendingRef.current = attempt;
4075
- setSending(true);
4076
- setError(null);
4077
- setPending(null);
4078
- try {
4079
- const sessionId = await attempt.create(
4080
- attempt.initialMessage,
4081
- attempt.key,
4082
- structuredClone(attempt.options)
4083
- );
4084
- if (!lifetime.mounted || lifetime.generation !== ownedGeneration) return true;
4085
- const accepted = { sessionId, attempt, generation: ownedGeneration };
4086
- completionRef.current = accepted;
4087
- if (filesRef.current.hasUnresolved) setCompletion(accepted);
4088
- else finishCreation(accepted);
4089
- return true;
4090
- } catch (cause) {
4091
- if (!lifetime.mounted || lifetime.generation !== ownedGeneration) return false;
4092
- setError({ cause });
4093
- if (cause instanceof OpenGeniApiError && cause.outcomeUnknown === false) {
4094
- pendingRef.current = null;
4095
- } else {
4096
- setPending(attempt);
4097
- }
4098
- return false;
4099
- } finally {
4100
- if (lifetime.mounted && lifetime.generation === ownedGeneration) {
4101
- inFlight.current = false;
4102
- setSending(false);
4103
- }
4104
- }
4105
- };
4106
- const submit = async (explicit) => {
4107
- if (!ownsScope() || !available || inFlight.current || pendingRef.current || uploadsEnabled && filesRef.current.hasUnresolved)
4108
- return false;
4109
- const resources = uploadsEnabled ? filesRef.current.readyResources : [];
4110
- const draftText = explicit ?? textRef.current;
4111
- const initialMessage = draftText.trim() || (resources.length > 0 ? FILE_ONLY_MESSAGE_TEXT(t) : "");
4112
- if (!initialMessage) return false;
4113
- return deliver({
4114
- key: crypto.randomUUID(),
4115
- initialMessage,
4116
- sentAt: (/* @__PURE__ */ new Date()).toISOString(),
4117
- textRevision: textRevision.current,
4118
- clearDraft: explicit === void 0,
4119
- create,
4120
- options: {
4121
- ...resources.length ? { resources: structuredClone(resources) } : {},
4122
- ...showModelPicker ? creationChoice() : {}
4123
- }
4124
- });
4125
- };
4126
- const startRealtime = async (model) => {
4127
- if (!ownsScope() || !available || inFlight.current || pendingRef.current || !config.realtimeVoice || !(options.realtimeVoice ?? config.realtimeVoiceOffered))
4128
- return false;
4129
- if (filesRef.current.hasUnresolved) return false;
4130
- return deliver({
4131
- key: crypto.randomUUID(),
4132
- initialMessage: "",
4133
- sentAt: (/* @__PURE__ */ new Date()).toISOString(),
4134
- textRevision: textRevision.current,
4135
- clearDraft: false,
4136
- create,
4137
- options: {
4138
- ...showModelPicker ? creationChoice() : {},
4139
- startMode: "realtime"
4140
- },
4141
- realtimeModel: model
4142
- });
4143
- };
4144
- const composer = {
4145
- value: text,
4146
- setValue: updateText,
4147
- hasDraftContent: () => textRef.current.length > 0 || filesRef.current.attachments.length > 0,
4148
- send: submit,
4149
- steer: submit,
4150
- // Nothing runs before the conversation exists: Send just sends.
4151
- working: false,
4152
- sending,
4153
- canSend: available && !sending && !pending && !completion && (text.trim().length > 0 || uploadsEnabled && files.readyResources.length > 0) && !(uploadsEnabled && files.hasUnresolved),
4154
- pause: NOOP_ASYNC,
4155
- pausing: false,
4156
- resume: NOOP_ASYNC,
4157
- resumeScope: NOOP_ASYNC,
4158
- resuming: false,
4159
- draft: null,
4160
- draftRevision: 0,
4161
- draftLoading: false,
4162
- draftSaving: false,
4163
- draftConflict: null,
4164
- policy: displayPolicy(creationChoice()) ?? null,
4165
- setModel: (model) => updateChoice({ model }),
4166
- setReasoningEffort: (reasoningEffort) => updateChoice({ reasoningEffort }),
4167
- setLatencyMode: (latencyMode) => updateChoice({ latencyMode }),
4168
- draftPersistence: "disabled",
4169
- applyDraft: () => {
4170
- },
4171
- reloadDraft: NOOP_ASYNC,
4172
- resolveDraftConflict: NOOP_ASYNC,
4173
- restoredResources: [],
4174
- removeRestoredResource: () => {
4175
- },
4176
- error: null,
4177
- clearError: () => {
4178
- if (ownsScope()) setError(null);
4179
- }
4180
- };
4181
- return {
4182
- ...scope,
4183
- config,
4184
- files,
4185
- uploadsEnabled,
4186
- available,
4187
- showModelPicker,
4188
- setModelLevels,
4189
- setModelPolicy: updateChoice,
4190
- catalog,
4191
- composer,
4192
- realtimeVoiceEnabled: config.realtimeVoice && (options.realtimeVoice ?? config.realtimeVoiceOffered),
4193
- error,
4194
- finishingUploads: completion !== null,
4195
- pending: pending ? { idempotencyKey: pending.key, realtimeModel: pending.realtimeModel } : null,
4196
- retry: () => pendingRef.current ? deliver(pendingRef.current) : Promise.resolve(false),
4197
- startRealtime
4198
- };
4199
- }
4200
-
4201
- // src/hooks/use-goal.ts
4202
- import {
4203
- OpenGeniApiError as OpenGeniApiError2,
4204
- observedSessionSequence
4205
- } from "@opengeni/sdk";
4206
- import { useCallback as useCallback9, useEffect as useEffect6, useLayoutEffect as useLayoutEffect5, useRef as useRef10, useState as useState7 } from "react";
4207
- function isGoalEvent(event) {
4208
- return event.type.startsWith("goal.");
4209
- }
4210
- function isGoalRefreshEvent(event) {
4211
- const type = event.type;
4212
- return isGoalEvent(event) || type.startsWith("turn.") || type.startsWith("session.") || type.startsWith("system.update.") || type.startsWith("workspace.inference.") || type.startsWith("user.");
4213
- }
4214
- function useGoal(sessionId, options = {}) {
4215
- const { client, workspaceId } = useEmbeddedGoal(options);
4216
- const enabled = (options.enabled ?? true) && Boolean(sessionId);
4217
- const sharedEvents = options.events;
4218
- const sharedFeed = sharedEvents !== void 0;
4219
- const pageLive = usePageLiveActivity();
4220
- const [goal, setGoal] = useState7(null);
4221
- const [loading, setLoading] = useState7(enabled);
4222
- const [error, setError] = useState7(null);
4223
- const [readAbsent, setReadAbsent] = useState7(false);
4224
- const { run, mutating, mutationError, clearMutationError } = useMutationRunner();
4225
- const generation = useRef10(0);
4226
- const targetKeyRef = useRef10(null);
4227
- const goalAbsentRef = useRef10(false);
4228
- const pendingRefreshRef = useRef10("none");
4229
- const sharedEventsRef = useRef10(sharedEvents);
4230
- useLayoutEffect5(() => {
4231
- sharedEventsRef.current = sharedEvents;
4232
- }, [sharedEvents]);
4233
- const loadAbort = useRef10(null);
4234
- const scheduleRefreshRef = useRef10(() => void 0);
4235
- const retireLoads = useCallback9(() => {
4236
- generation.current += 1;
4237
- loadAbort.current?.abort();
4238
- loadAbort.current = null;
4239
- }, []);
4240
- const load = useCallback9(async () => {
4241
- if (!sessionId) {
4242
- return;
4243
- }
4244
- const ticket = ++generation.current;
4245
- pendingRefreshRef.current = "none";
4246
- loadAbort.current?.abort();
4247
- const controller = new AbortController();
4248
- loadAbort.current = controller;
4249
- let fetchedGoal = null;
4250
- try {
4251
- const fetched = typeof client.findGoal === "function" ? await client.findGoal(workspaceId, sessionId, { signal: controller.signal }) : await client.getGoal(workspaceId, sessionId, { signal: controller.signal });
4252
- fetchedGoal = fetched;
4253
- if (ticket === generation.current) {
4254
- goalAbsentRef.current = fetched === null;
4255
- setReadAbsent(fetched === null);
4256
- setGoal(fetched);
4257
- setError(null);
4258
- setLoading(false);
4259
- }
4260
- } catch (cause) {
4261
- if (ticket !== generation.current) {
4262
- return;
4263
- }
4264
- if (cause instanceof OpenGeniApiError2 && cause.status === 404) {
4265
- goalAbsentRef.current = true;
4266
- setReadAbsent(true);
4267
- setGoal(null);
4268
- setError(null);
4269
- } else {
4270
- setError(normalizeError(cause));
4271
- }
4272
- setLoading(false);
4273
- } finally {
4274
- if (loadAbort.current === controller) loadAbort.current = null;
4275
- }
4276
- if (ticket !== generation.current || pendingRefreshRef.current === "none") {
4277
- return;
4278
- }
4279
- const readThrough = fetchedGoal ? observedSessionSequence(fetchedGoal) : void 0;
4280
- if (readThrough !== void 0 && sharedEventsRef.current !== void 0) {
4281
- const events = sharedEventsRef.current;
4282
- const newest = events[events.length - 1];
4283
- if (!newest || newest.sequence <= readThrough) {
4284
- pendingRefreshRef.current = "none";
4285
- return;
4286
- }
4287
- }
4288
- if (goalAbsentRef.current && pendingRefreshRef.current === "refresh") {
4289
- const events = sharedEventsRef.current ?? [];
4290
- let latestGoalEvent;
4291
- for (let index = events.length - 1; index >= 0 && !latestGoalEvent; index -= 1) {
4292
- const event = events[index];
4293
- if (event && isGoalEvent(event)) latestGoalEvent = event;
4294
- }
4295
- if (!latestGoalEvent || latestGoalEvent.type === "goal.cleared") {
4296
- pendingRefreshRef.current = "none";
4297
- return;
4298
- }
4299
- pendingRefreshRef.current = "goal";
4300
- }
4301
- scheduleRefreshRef.current();
4302
- }, [client, workspaceId, sessionId]);
4303
- useEffect6(() => {
4304
- const targetKey = `${workspaceId} ${sessionId ?? ""}`;
4305
- if (targetKeyRef.current !== targetKey) {
4306
- targetKeyRef.current = targetKey;
4307
- goalAbsentRef.current = false;
4308
- pendingRefreshRef.current = "none";
4309
- setReadAbsent(false);
4310
- setGoal(null);
4311
- setError(null);
4312
- }
4313
- if (!enabled || !pageLive) {
4314
- retireLoads();
4315
- setLoading(false);
4316
- return;
4317
- }
4318
- if (sharedFeed) {
4319
- setLoading(true);
4320
- void load();
4321
- return () => {
4322
- retireLoads();
4323
- };
4324
- }
4325
- setLoading(true);
4326
- const pollIntervalMs = options.pollIntervalMs;
4327
- if (pollIntervalMs === void 0 || pollIntervalMs <= 0) {
4328
- void load();
4329
- return () => {
4330
- retireLoads();
4331
- };
4332
- }
4333
- let cancelled = false;
4334
- let timer = null;
4335
- const schedule = () => {
4336
- if (cancelled) return;
4337
- timer = setTimeout(() => {
4338
- timer = null;
4339
- void load().finally(schedule);
4340
- }, pollIntervalMs);
4341
- };
4342
- void load().finally(schedule);
4343
- return () => {
4344
- cancelled = true;
4345
- if (timer !== null) clearTimeout(timer);
4346
- retireLoads();
4347
- };
4348
- }, [
4349
- load,
4350
- enabled,
4351
- pageLive,
4352
- workspaceId,
4353
- sessionId,
4354
- options.pollIntervalMs,
4355
- retireLoads,
4356
- sharedFeed
4357
- ]);
4358
- const scheduleRefresh = useDebouncedCallback(() => {
4359
- const pending = pendingRefreshRef.current;
4360
- if (pending === "none" || loadAbort.current !== null) return;
4361
- if (pending === "refresh" && goalAbsentRef.current) {
4362
- pendingRefreshRef.current = "none";
4363
- return;
4364
- }
4365
- void load();
4366
- });
4367
- useLayoutEffect5(() => {
4368
- scheduleRefreshRef.current = scheduleRefresh;
4369
- }, [scheduleRefresh]);
4370
- const isRefreshEvent = useCallback9(
4371
- (event) => goalAbsentRef.current ? isGoalEvent(event) : isGoalRefreshEvent(event),
4372
- []
4373
- );
4374
- const refreshGoal = useCallback9(() => {
4375
- pendingRefreshRef.current = "goal";
4376
- scheduleRefresh();
4377
- }, [scheduleRefresh]);
4378
- const onRefreshEvent = useCallback9(
4379
- (event) => {
4380
- if (isGoalEvent(event)) pendingRefreshRef.current = "goal";
4381
- else if (pendingRefreshRef.current === "none") pendingRefreshRef.current = "refresh";
4382
- scheduleRefresh();
4383
- },
4384
- [scheduleRefresh]
4385
- );
4386
- useSessionEventTrigger(client, workspaceId, sessionId, isRefreshEvent, onRefreshEvent, {
4387
- enabled,
4388
- ...sharedEvents !== void 0 ? { events: sharedEvents } : {},
4389
- // The load settles events that arrive during its read itself (above).
4390
- readThrough: projectionReadThrough(goal, false),
4391
- refresh: refreshGoal
4392
- });
4393
- const retainedGoal = useRetainedSessionView(
4394
- client,
4395
- workspaceId,
4396
- sessionId,
4397
- "goal",
4398
- loading ? null : goal,
4399
- { enabled, discard: readAbsent || deniesRetainedView(error) }
4400
- );
4401
- const visibleGoal = loading ? goal ?? retainedGoal : goal;
4402
- const goalRef = useRef10(goal);
4403
- const shownRetainedRef = useRef10(null);
4404
- const readWaitersRef = useRef10([]);
4405
- useLayoutEffect5(() => {
4406
- goalRef.current = goal;
4407
- shownRetainedRef.current = loading && goal === null ? retainedGoal : null;
4408
- });
4409
- useEffect6(() => {
4410
- if (loading) return;
4411
- const waiters = readWaitersRef.current;
4412
- readWaitersRef.current = [];
4413
- for (const resolve of waiters) resolve();
4414
- }, [loading]);
4415
- useEffect6(
4416
- () => () => {
4417
- goalRef.current = null;
4418
- const waiters = readWaitersRef.current;
4419
- readWaitersRef.current = [];
4420
- for (const resolve of waiters) resolve();
4421
- },
4422
- [workspaceId, sessionId]
4423
- );
4424
- const aimedAtCurrentGoal = useCallback9(async () => {
4425
- const shown = shownRetainedRef.current;
4426
- if (!shown) return true;
4427
- await new Promise((resolve) => readWaitersRef.current.push(resolve));
4428
- const fresh = goalRef.current;
4429
- return fresh !== null && fresh.id === shown.id && fresh.objectiveRevision === shown.objectiveRevision;
4430
- }, []);
4431
- const pause = useCallback9(
4432
- async (rationale) => {
4433
- if (!sessionId || !await aimedAtCurrentGoal()) {
4434
- return null;
4435
- }
4436
- const result = await run(
4437
- () => client.updateGoal(workspaceId, sessionId, {
4438
- status: "paused",
4439
- ...rationale !== void 0 ? { rationale } : {}
4440
- })
4441
- );
4442
- if (result) {
4443
- setGoal(result);
4444
- }
4445
- return result;
4446
- },
4447
- [client, workspaceId, sessionId, run, aimedAtCurrentGoal]
4448
- );
4449
- const resume = useCallback9(async () => {
4450
- if (!sessionId || !await aimedAtCurrentGoal()) {
4451
- return null;
4452
- }
4453
- const result = await run(() => client.updateGoal(workspaceId, sessionId, { status: "active" }));
4454
- if (result) {
4455
- setGoal(result);
4456
- }
4457
- return result;
4458
- }, [client, workspaceId, sessionId, run, aimedAtCurrentGoal]);
4459
- const clearGoal = useCallback9(async () => {
4460
- if (!sessionId || !await aimedAtCurrentGoal()) {
4461
- return;
4462
- }
4463
- const ok = await run(async () => {
4464
- await client.deleteGoal(workspaceId, sessionId);
4465
- return true;
4466
- });
4467
- if (ok) {
4468
- retireLoads();
4469
- setReadAbsent(true);
4470
- setGoal(null);
4471
- setError(null);
4472
- }
4473
- }, [client, workspaceId, sessionId, run, retireLoads, aimedAtCurrentGoal]);
4474
- return {
4475
- goal: visibleGoal,
4476
- isActive: visibleGoal?.status === "active",
4477
- isPaused: visibleGoal?.status === "paused",
4478
- isCompleted: visibleGoal?.status === "completed",
4479
- loading: loading && retainedGoal === null,
4480
- error,
4481
- refresh: load,
4482
- pause,
4483
- resume,
4484
- clearGoal,
4485
- deleteGoal: clearGoal,
4486
- updating: mutating,
4487
- mutationError,
4488
- clearMutationError
4489
- };
4490
- }
4491
-
4492
- export {
4493
- conversationTimeline,
4494
- isTitleEvent,
4495
- useSession,
4496
- useSessionStartupTimeline,
4497
- useAvailableModels,
4498
- useWorkspaceModelCatalog,
4499
- isHumanInputEvent,
4500
- useHumanInputRequests,
4501
- useSessionControl,
4502
- invokeOlderHistoryLoaderWithReceiptCapture,
4503
- createOlderHistoryLoadReceipt,
4504
- useTurnlessOutputGap,
4505
- SESSION_EVENT_BROWSER_MAX_BYTES,
4506
- SESSION_EVENT_BROWSER_MAX_COUNT,
4507
- SESSION_EVENT_BROWSER_PENDING_MAX_BYTES,
4508
- SESSION_EVENT_BROWSER_PENDING_MAX_COUNT,
4509
- useSessionEvents,
4510
- boundBrowserSessionEventWindow,
4511
- isTurnQueueEvent,
4512
- useTurnQueue,
4513
- useSessionConversation,
4514
- useSessionReadAcknowledgement,
4515
- useNewConversation,
4516
- isGoalEvent,
4517
- useGoal
4518
- };
4519
- //# sourceMappingURL=chunk-TL6UOSMX.js.map