@opengeni/react 6.40.0 → 6.41.1-canary.45704649926001

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 (1197) hide show
  1. package/dist/app/app-state.js +34 -34
  2. package/dist/app/components/Composer.js +45 -45
  3. package/dist/app/components/add-card-dialog.js +3 -3
  4. package/dist/app/components/add-card.js +2 -2
  5. package/dist/app/components/agent/agent-capability-picker.js +10 -10
  6. package/dist/app/components/agents/agent-can-use.js +51 -50
  7. package/dist/app/components/agents/agent-cost.js +2 -2
  8. package/dist/app/components/agents/agent-form-page.js +153 -152
  9. package/dist/app/components/agents/agent-form-page.js.map +1 -1
  10. package/dist/app/components/agents/agent-page.js +134 -133
  11. package/dist/app/components/agents/agent-setup-sections.js +81 -80
  12. package/dist/app/components/agents/agent-skills.js +15 -15
  13. package/dist/app/components/agents/agent-trigger-chat-field.js +6 -6
  14. package/dist/app/components/agents/agent-trigger-dialog.js +35 -35
  15. package/dist/app/components/agents/agent-trigger-picker.js +8 -8
  16. package/dist/app/components/agents/agent-trigger-repositories.js +16 -16
  17. package/dist/app/components/agents/agents-page.js +99 -98
  18. package/dist/app/components/agents/agents-page.js.map +1 -1
  19. package/dist/app/components/agents/composer-agent-chip.js +60 -59
  20. package/dist/app/components/agents/session-agent-chip.js +55 -54
  21. package/dist/app/components/artifacts/app-package.js +13 -13
  22. package/dist/app/components/artifacts/artifact-browse-controls.js +3 -3
  23. package/dist/app/components/artifacts/artifact-library.js +30 -30
  24. package/dist/app/components/artifacts/artifact-page-chrome.js +1 -1
  25. package/dist/app/components/artifacts/artifact-viewer.js +64 -63
  26. package/dist/app/components/artifacts/artifact-viewer.js.map +1 -1
  27. package/dist/app/components/artifacts/chat-interactive-block.js +30 -28
  28. package/dist/app/components/artifacts/chat-interactive-block.js.map +1 -1
  29. package/dist/app/components/artifacts/copy-artifact-link.js +3 -3
  30. package/dist/app/components/artifacts/file-reach-dialog.js +13 -13
  31. package/dist/app/components/artifacts/inline-chat-image.js +52 -51
  32. package/dist/app/components/artifacts/ready-made-apps.js +13 -13
  33. package/dist/app/components/artifacts/retained-file-preview.js +57 -56
  34. package/dist/app/components/artifacts/retained-text-preview.js +7 -7
  35. package/dist/app/components/artifacts/site-actions.js +11 -11
  36. package/dist/app/components/artifacts/site-audience.js +8 -8
  37. package/dist/app/components/artifacts/site-conversations.js +34 -34
  38. package/dist/app/components/artifacts/site-data.js +30 -30
  39. package/dist/app/components/artifacts/site-public-link.js +1 -1
  40. package/dist/app/components/artifacts/site-publishing-page.js +72 -72
  41. package/dist/app/components/artifacts/site-publishing.js +55 -55
  42. package/dist/app/components/artifacts/site-settings.js +71 -71
  43. package/dist/app/components/artifacts/site-version-menu.js +9 -9
  44. package/dist/app/components/billing-class-mark.js +7 -7
  45. package/dist/app/components/capabilities/capability-detail-sheet.js +18 -18
  46. package/dist/app/components/capabilities/capability-logo-source.js +31 -30
  47. package/dist/app/components/capabilities/capability-logo.js +1 -1
  48. package/dist/app/components/capabilities/connection-account-picker.js +2 -2
  49. package/dist/app/components/capabilities/connection-ownership-selector.js +4 -4
  50. package/dist/app/components/capabilities/connector-tool-permissions.js +7 -7
  51. package/dist/app/components/capabilities/detail-dialog.js +3 -3
  52. package/dist/app/components/capabilities/native-connect-setup.js +36 -35
  53. package/dist/app/components/capabilities/own-logins-shared-heads-up.js +7 -7
  54. package/dist/app/components/capabilities/perform-capability-action.js +3 -3
  55. package/dist/app/components/capabilities/prepared-mcp-setup-card.js +35 -34
  56. package/dist/app/components/capabilities/session-capability-card.js +142 -141
  57. package/dist/app/components/capabilities/session-capability-card.js.map +1 -1
  58. package/dist/app/components/capabilities/session-chrome-card.js +49 -49
  59. package/dist/app/components/capabilities/session-connect-inputs-card.js +38 -37
  60. package/dist/app/components/capabilities/session-custom-mcp-card.js +43 -42
  61. package/dist/app/components/capabilities/session-github-card.js +49 -48
  62. package/dist/app/components/capabilities/session-machine-card.js +50 -50
  63. package/dist/app/components/capabilities/session-personal-github-card.js +35 -34
  64. package/dist/app/components/capabilities/session-plugin-card.js +23 -22
  65. package/dist/app/components/capabilities/use-capabilities-catalog.js +4 -4
  66. package/dist/app/components/capabilities/use-connection-accounts.js +3 -3
  67. package/dist/app/components/command-menu/chat-status.js +25 -25
  68. package/dist/app/components/command-menu/chat-switcher.js +90 -89
  69. package/dist/app/components/command-menu/chat-switcher.js.map +1 -1
  70. package/dist/app/components/command-menu/command-menu.js +118 -117
  71. package/dist/app/components/command-menu/command-menu.js.map +1 -1
  72. package/dist/app/components/command-menu/shortcut-sheet.js +26 -26
  73. package/dist/app/components/composer-capabilities-menu-body.js +7 -7
  74. package/dist/app/components/composer-mobile-plus-panel.js +32 -32
  75. package/dist/app/components/composer-mobile-plus.js +5 -5
  76. package/dist/app/components/credit-amount-picker.js +2 -2
  77. package/dist/app/components/credit-required-gate.js +6 -6
  78. package/dist/app/components/credit-required-prompt.js +27 -27
  79. package/dist/app/components/credits/checkout-credits-celebration.js +4 -4
  80. package/dist/app/components/credits/checkout-return.js +4 -4
  81. package/dist/app/components/credits/coupon-redeem.js +1 -1
  82. package/dist/app/components/credits/credit-refusal-notice.js +8 -8
  83. package/dist/app/components/credits/own-subscription-plan-notice.js +3 -3
  84. package/dist/app/components/cross-slot-deep-link-recovery.js +2 -2
  85. package/dist/app/components/desktop/app-shots.js +10 -10
  86. package/dist/app/components/desktop/app-update.js +3 -3
  87. package/dist/app/components/desktop/computer-use.js +4 -4
  88. package/dist/app/components/desktop/this-computer.js +8 -8
  89. package/dist/app/components/feedback.js +11 -11
  90. package/dist/app/components/follow-up-repository-menu-body.js +12 -12
  91. package/dist/app/components/follow-up-repository-picker.js +1 -1
  92. package/dist/app/components/github-app-connect-launcher.js +2 -2
  93. package/dist/app/components/in-app-help-link.js +3 -3
  94. package/dist/app/components/knowledge/agent-learning-settings.js +5 -5
  95. package/dist/app/components/machines/connect-machine-dialog.js +25 -25
  96. package/dist/app/components/manual-repository-editor.js +1 -1
  97. package/dist/app/components/markdown.js +18 -17
  98. package/dist/app/components/model-identity.js +3 -3
  99. package/dist/app/components/models/models-ui.js +17 -17
  100. package/dist/app/components/models/provider-mark.js +3 -3
  101. package/dist/app/components/models/subscription-usage.js +5 -5
  102. package/dist/app/components/my-things.js +19 -19
  103. package/dist/app/components/own-where-it-works.js +12 -12
  104. package/dist/app/components/personal-resource-attachment-surface.js +4 -4
  105. package/dist/app/components/pickers.js +12 -12
  106. package/dist/app/components/rail/channel-create-dialog.js +6 -6
  107. package/dist/app/components/rail/project-glyph.js +54 -53
  108. package/dist/app/components/rail/project-profile.js +76 -75
  109. package/dist/app/components/rail/rail-context.js +2 -2
  110. package/dist/app/components/rail/rail-sections.js +155 -154
  111. package/dist/app/components/rail/session-header.js +125 -124
  112. package/dist/app/components/rail/session-list.js +153 -152
  113. package/dist/app/components/rail/session-row-content.js +6 -6
  114. package/dist/app/components/rail/session-row-hover-details.js +36 -36
  115. package/dist/app/components/rail/session-shell.js +194 -193
  116. package/dist/app/components/rail/site-session-group-heading.js +37 -37
  117. package/dist/app/components/repository-picker.js +12 -12
  118. package/dist/app/components/secrets/session-secrets-panel.js +3 -3
  119. package/dist/app/components/session/agent-configuration-panel.js +53 -53
  120. package/dist/app/components/session/artifact-session-page.js +8 -8
  121. package/dist/app/components/session/banners.js +22 -21
  122. package/dist/app/components/session/chat-avatar.js +54 -53
  123. package/dist/app/components/session/console-new-conversation.js +105 -104
  124. package/dist/app/components/session/descendant-requests.js +101 -100
  125. package/dist/app/components/session/descendant-requests.js.map +1 -1
  126. package/dist/app/components/session/editable-artifacts-workspace.js +62 -60
  127. package/dist/app/components/session/editable-artifacts-workspace.js.map +1 -1
  128. package/dist/app/components/session/failed-session-banner.js +28 -28
  129. package/dist/app/components/session/failure-recovery-boundary.js +3 -3
  130. package/dist/app/components/session/human-input-delegation-record.js +3 -3
  131. package/dist/app/components/session/human-input.js +88 -87
  132. package/dist/app/components/session/inspector.js +136 -135
  133. package/dist/app/components/session/inspector.js.map +1 -1
  134. package/dist/app/components/session/linked-panel.js +3 -3
  135. package/dist/app/components/session/message-actions.js +11 -11
  136. package/dist/app/components/session/model-recovery-notice.js +4 -4
  137. package/dist/app/components/session/new-session-settings-menu.js +32 -32
  138. package/dist/app/components/session/new-session-setup-strip.js +58 -57
  139. package/dist/app/components/session/own-account-wait-notice.js +8 -8
  140. package/dist/app/components/session/pinned-account-wait-notice.js +8 -8
  141. package/dist/app/components/session/pull-request-panel.js +26 -25
  142. package/dist/app/components/session/sandbox-recovery-actions.js +5 -5
  143. package/dist/app/components/session/sandbox-switcher.js +22 -22
  144. package/dist/app/components/session/sandbox-workspace.js +118 -117
  145. package/dist/app/components/session/search-markdown-highlight.js +19 -18
  146. package/dist/app/components/session/search-results-view.js +20 -19
  147. package/dist/app/components/session/session-admin-access.js +12 -12
  148. package/dist/app/components/session/session-admission-notice.js +11 -11
  149. package/dist/app/components/session/session-avatar-picker.js +61 -60
  150. package/dist/app/components/session/session-avatar.js +56 -55
  151. package/dist/app/components/session/session-machine-access-notice.js +11 -11
  152. package/dist/app/components/session/session-profile-dialog.js +72 -71
  153. package/dist/app/components/session/session-profile-editor.js +73 -72
  154. package/dist/app/components/session/session-retention.js +8 -8
  155. package/dist/app/components/session/session-search-dialog.js +26 -25
  156. package/dist/app/components/session/session-search-dialog.js.map +1 -1
  157. package/dist/app/components/session/session-skill-reviews.js +5 -5
  158. package/dist/app/components/session/session-tenancy-control.js +25 -25
  159. package/dist/app/components/session/session-unattended-setting.js +4 -4
  160. package/dist/app/components/session/session-usage-limit-section.js +13 -13
  161. package/dist/app/components/session/share-chat-dialog.js +12 -12
  162. package/dist/app/components/session/subagents.js +22 -22
  163. package/dist/app/components/session/subscription-account-indicator.js +25 -25
  164. package/dist/app/components/session/subscription-account-menu.js +7 -7
  165. package/dist/app/components/session-connectors-menu-body.js +11 -11
  166. package/dist/app/components/settings/row-select.js +6 -6
  167. package/dist/app/components/transcription-settings.js +10 -10
  168. package/dist/app/components/ui/destructive-confirm.js +11 -11
  169. package/dist/app/components/usage/usage-entry.js +8 -8
  170. package/dist/app/components/window-bar.js +25 -25
  171. package/dist/app/components/workspace-composer-plus.js +46 -45
  172. package/dist/app/components/workspace-reach.d.ts +2 -0
  173. package/dist/app/components/workspace-reach.js +6 -6
  174. package/dist/app/embed/session-app.js +406 -405
  175. package/dist/app/lib/actions/actions-provider.js +18 -18
  176. package/dist/app/lib/agent-capabilities.js +4 -4
  177. package/dist/app/lib/app-connect-card.js +16 -16
  178. package/dist/app/lib/app-shared-key-dialog.js +9 -9
  179. package/dist/app/lib/app-surfaces.js +1 -1
  180. package/dist/app/lib/app-sync-opt-in.js +7 -7
  181. package/dist/app/lib/codex-usage-query.js +3 -3
  182. package/dist/app/lib/composer-agent.js +2 -2
  183. package/dist/app/lib/composer-connectors.js +35 -34
  184. package/dist/app/lib/composer-send-blocking.js +2 -2
  185. package/dist/app/lib/console-site.js +9 -9
  186. package/dist/app/lib/console-text.js +2 -2
  187. package/dist/app/lib/events.js +32 -31
  188. package/dist/app/lib/failed-session-copy.js +5 -5
  189. package/dist/app/lib/feedback-capture.js +2 -2
  190. package/dist/app/lib/model-access-onboarding.js +4 -4
  191. package/dist/app/lib/move-chat-to-machine.js +5 -5
  192. package/dist/app/lib/personal-resource-attachments.js +1 -1
  193. package/dist/app/lib/session-branch-cache.js +18 -18
  194. package/dist/app/lib/session-create.js +5 -5
  195. package/dist/app/lib/session-group-pagination.js +18 -18
  196. package/dist/app/lib/session-hover-facts.js +25 -25
  197. package/dist/app/lib/session-list-dirty-scopes.js +19 -19
  198. package/dist/app/lib/session-model.js +2 -2
  199. package/dist/app/lib/session-rail.js +15 -15
  200. package/dist/app/lib/session-rename.js +3 -3
  201. package/dist/app/lib/sessions-group.js +23 -23
  202. package/dist/app/lib/site-tool-consent-dialog.js +24 -24
  203. package/dist/app/lib/site-tool-consent.js +1 -1
  204. package/dist/app/lib/turn-failure-analytics.js +6 -6
  205. package/dist/app/lib/use-artifact-catalog.js +2 -2
  206. package/dist/app/lib/use-duplicate-site.js +4 -4
  207. package/dist/app/lib/use-follow-up-repositories.js +9 -9
  208. package/dist/app/lib/use-personal-resource-attachment.js +2 -2
  209. package/dist/app/lib/use-workspace-integrations.js +2 -2
  210. package/dist/app/lib/use-workspace-machines.js +10 -10
  211. package/dist/app/lib/use-workspace-model-catalog.js +6 -6
  212. package/dist/app/lib/use-workspace-rigs.js +6 -6
  213. package/dist/app/lib/workspace-navigation-preference.js +5 -5
  214. package/dist/app/lib/workspace-scope-context.js +4 -4
  215. package/dist/app/routes/app-page-view.js +52 -50
  216. package/dist/app/routes/app-page-view.js.map +1 -1
  217. package/dist/app/routes/app-page.js +2 -2
  218. package/dist/app/routes/artifacts.js +170 -168
  219. package/dist/app/routes/artifacts.js.map +1 -1
  220. package/dist/app/routes/retained-artifact.js +110 -109
  221. package/dist/app/routes/retained-artifact.js.map +1 -1
  222. package/dist/app/routes/session-unavailable.js +6 -6
  223. package/dist/app/routes/session.js +249 -248
  224. package/dist/app/routes/sessions-index-hydration.js +6 -6
  225. package/dist/app/routes/sessions-index.js +204 -203
  226. package/dist/app/routes/site-view.js +210 -209
  227. package/dist/app/routes/site-view.js.map +1 -1
  228. package/dist/artifacts-document.js +4 -4
  229. package/dist/artifacts-presentation.js +9 -9
  230. package/dist/artifacts-spreadsheet.js +4 -4
  231. package/dist/artifacts.js +53 -51
  232. package/dist/automation-model.js +6 -6
  233. package/dist/automations.js +64 -64
  234. package/dist/browser-viewer-TRPZI6NT.js +23 -0
  235. package/dist/chat-interactive-block-Y4BS4JCM.js +24 -0
  236. package/dist/chunk-22E2YJHT.js +469 -0
  237. package/dist/chunk-2T6TN2YL.js +538 -0
  238. package/dist/chunk-2WNN26NW.js +175 -0
  239. package/dist/chunk-3432A6XB.js +88 -0
  240. package/dist/chunk-35U7NSOR.js +366 -0
  241. package/dist/chunk-3EPR76WS.js +773 -0
  242. package/dist/chunk-3FXXEU5D.js +144 -0
  243. package/dist/chunk-3MXOPOEU.js +650 -0
  244. package/dist/chunk-3PKDU4JI.js +340 -0
  245. package/dist/chunk-3PMO2BIV.js +12 -0
  246. package/dist/chunk-3XWHJNFY.js +48 -0
  247. package/dist/chunk-45WD2PKE.js +401 -0
  248. package/dist/chunk-4H2OWNRA.js +598 -0
  249. package/dist/chunk-4HVGOTMU.js +263 -0
  250. package/dist/chunk-4JER2ZMV.js +818 -0
  251. package/dist/chunk-4LVZ2VOQ.js +214 -0
  252. package/dist/chunk-4OGDD2EM.js +2434 -0
  253. package/dist/chunk-4PQC6WMF.js +54 -0
  254. package/dist/chunk-4UVSWAT3.js +794 -0
  255. package/dist/chunk-53A47RBX.js +214 -0
  256. package/dist/chunk-552KKENW.js +114 -0
  257. package/dist/chunk-55F7L6M3.js +177 -0
  258. package/dist/chunk-5AHIKB3O.js +449 -0
  259. package/dist/chunk-5KQD6MLJ.js +3996 -0
  260. package/dist/chunk-5KQD6MLJ.js.map +1 -0
  261. package/dist/chunk-5N4L5WTE.js +199 -0
  262. package/dist/chunk-5OUJCVZI.js +79 -0
  263. package/dist/chunk-5OYXQ7MH.js +65 -0
  264. package/dist/chunk-5RGF74K5.js +371 -0
  265. package/dist/chunk-5RGF74K5.js.map +1 -0
  266. package/dist/chunk-5TAVVMFX.js +225 -0
  267. package/dist/chunk-5Y3LYRNH.js +269 -0
  268. package/dist/chunk-5ZJKKE4T.js +386 -0
  269. package/dist/chunk-62DPSQRZ.js +57 -0
  270. package/dist/chunk-64KMWTJ6.js +608 -0
  271. package/dist/chunk-6F34IWSA.js +47 -0
  272. package/dist/chunk-6F34IWSA.js.map +1 -0
  273. package/dist/chunk-6MZBNUS7.js +73 -0
  274. package/dist/chunk-6YCE4ZC4.js +250 -0
  275. package/dist/chunk-6YROWWMX.js +175 -0
  276. package/dist/chunk-73RZ72VU.js +1236 -0
  277. package/dist/chunk-74KV436L.js +84 -0
  278. package/dist/chunk-7HKGLPV5.js +83 -0
  279. package/dist/chunk-7JSWODT6.js +466 -0
  280. package/dist/chunk-7K3PKWER.js +428 -0
  281. package/dist/chunk-7MPWC42V.js +1356 -0
  282. package/dist/chunk-7REO6FRN.js +141 -0
  283. package/dist/chunk-7V3OL7JC.js +850 -0
  284. package/dist/chunk-7V3OL7JC.js.map +1 -0
  285. package/dist/chunk-7YMWRNRQ.js +145 -0
  286. package/dist/chunk-A6H3KJ7G.js +131 -0
  287. package/dist/chunk-AGQIE6YU.js +1769 -0
  288. package/dist/chunk-AHQM4I5V.js +373 -0
  289. package/dist/chunk-AMTRO7XF.js +172 -0
  290. package/dist/chunk-AO4LTCG7.js +91 -0
  291. package/dist/chunk-APJ22OZV.js +2580 -0
  292. package/dist/chunk-APWL37KW.js +407 -0
  293. package/dist/chunk-AQEJOBQ2.js +15 -0
  294. package/dist/chunk-ARKNT6BX.js +234 -0
  295. package/dist/chunk-B2IHDMAR.js +211 -0
  296. package/dist/chunk-BCKIV26W.js +112 -0
  297. package/dist/chunk-BE26JUSD.js +259 -0
  298. package/dist/chunk-BOVCD6KD.js +171 -0
  299. package/dist/chunk-BQWV66A6.js +129 -0
  300. package/dist/chunk-BSQJXGGP.js +441 -0
  301. package/dist/chunk-BZY3MEVZ.js +3183 -0
  302. package/dist/chunk-C3D3OOEY.js +335 -0
  303. package/dist/chunk-CDHYO3DP.js +82 -0
  304. package/dist/chunk-CDV5JGVI.js +79 -0
  305. package/dist/chunk-CNW45M7G.js +207 -0
  306. package/dist/chunk-CUVQ37HB.js +150 -0
  307. package/dist/chunk-D32T3IIC.js +532 -0
  308. package/dist/chunk-D32VVOBJ.js +738 -0
  309. package/dist/chunk-D32VVOBJ.js.map +1 -0
  310. package/dist/chunk-D65BSM64.js +371 -0
  311. package/dist/chunk-D7435DWV.js +570 -0
  312. package/dist/chunk-DFH3M7B3.js +72 -0
  313. package/dist/chunk-DGWBQ76M.js +162 -0
  314. package/dist/chunk-DHJDTGSJ.js +372 -0
  315. package/dist/chunk-DKEFTNCD.js +400 -0
  316. package/dist/chunk-DNAF6MT4.js +107 -0
  317. package/dist/chunk-DSJ7K5IF.js +380 -0
  318. package/dist/chunk-DSJ7K5IF.js.map +1 -0
  319. package/dist/chunk-E35XY7DS.js +27 -0
  320. package/dist/chunk-E5T5WIIP.js +396 -0
  321. package/dist/chunk-EL6ECD34.js +166 -0
  322. package/dist/chunk-ELR6ITRC.js +467 -0
  323. package/dist/chunk-EPE3V2VE.js +851 -0
  324. package/dist/chunk-EYGQHHVW.js +584 -0
  325. package/dist/chunk-EYQEJHYP.js +307 -0
  326. package/dist/chunk-EZTH2XMH.js +276 -0
  327. package/dist/chunk-F3QVHVFS.js +287 -0
  328. package/dist/chunk-F5VWPREQ.js +1187 -0
  329. package/dist/chunk-FM7AQUBL.js +113 -0
  330. package/dist/chunk-FP6BUXJM.js +100 -0
  331. package/dist/chunk-FVU52L3I.js +249 -0
  332. package/dist/chunk-FZKNXNNO.js +218 -0
  333. package/dist/chunk-G3IXJWRY.js +236 -0
  334. package/dist/chunk-G6EI2O3N.js +333 -0
  335. package/dist/chunk-G7KHMA3E.js +256 -0
  336. package/dist/chunk-G7KHMA3E.js.map +1 -0
  337. package/dist/chunk-GB5T6YMZ.js +401 -0
  338. package/dist/chunk-GBLD6FOG.js +157 -0
  339. package/dist/chunk-GJBFFXCY.js +137 -0
  340. package/dist/chunk-GJDP2K2S.js +66 -0
  341. package/dist/chunk-GP26XTDX.js +187 -0
  342. package/dist/chunk-GTE6WP4N.js +606 -0
  343. package/dist/chunk-GWG3OAV7.js +108 -0
  344. package/dist/chunk-GXMHTMM6.js +931 -0
  345. package/dist/chunk-GYRN5O2E.js +107 -0
  346. package/dist/chunk-GZX7W2WW.js +65 -0
  347. package/dist/chunk-H3QI2G2B.js +403 -0
  348. package/dist/chunk-H7D4DVWY.js +849 -0
  349. package/dist/chunk-HCDGBBBJ.js +191 -0
  350. package/dist/chunk-HDSH6MIJ.js +3851 -0
  351. package/dist/chunk-HOEUPZ6O.js +89 -0
  352. package/dist/chunk-HPQRWTQB.js +772 -0
  353. package/dist/chunk-HUKGLWAY.js +174 -0
  354. package/dist/chunk-HUTQJY3F.js +23 -0
  355. package/dist/chunk-HWOYJOKK.js +266 -0
  356. package/dist/chunk-HZR3WGUP.js +96 -0
  357. package/dist/chunk-I7YUDPDR.js +138 -0
  358. package/dist/chunk-IDII52M4.js +27 -0
  359. package/dist/chunk-IDPWEUM7.js +103 -0
  360. package/dist/chunk-IEWQFGEC.js +192 -0
  361. package/dist/chunk-IKWGPFT5.js +300 -0
  362. package/dist/chunk-IKWGPFT5.js.map +1 -0
  363. package/dist/chunk-IMTACEXF.js +351 -0
  364. package/dist/chunk-IVWT6M6N.js +114 -0
  365. package/dist/chunk-JE2YXAVR.js +485 -0
  366. package/dist/chunk-JE2YXAVR.js.map +1 -0
  367. package/dist/chunk-JEUPIHIP.js +111 -0
  368. package/dist/chunk-JF4WX3GQ.js +168 -0
  369. package/dist/chunk-JJPYXUKC.js +2591 -0
  370. package/dist/chunk-JNHWTYDD.js +43 -0
  371. package/dist/chunk-JP7AOJWD.js +46 -0
  372. package/dist/chunk-JTWT2WQA.js +297 -0
  373. package/dist/chunk-JW3WIHWO.js +117 -0
  374. package/dist/chunk-JW7RJMEZ.js +134 -0
  375. package/dist/chunk-K76PXR3O.js +2317 -0
  376. package/dist/chunk-KCNIQN6V.js +107 -0
  377. package/dist/chunk-KH6KHYST.js +231 -0
  378. package/dist/chunk-KK4SEN7N.js +247 -0
  379. package/dist/chunk-KOKRGAAI.js +383 -0
  380. package/dist/chunk-KQFNTGAF.js +187 -0
  381. package/dist/chunk-KRLNC6TH.js +50 -0
  382. package/dist/chunk-KYDLVMKA.js +99 -0
  383. package/dist/chunk-KZQDP2JM.js +155 -0
  384. package/dist/chunk-L2EZ2HOX.js +132 -0
  385. package/dist/chunk-L2UAFR2D.js +33 -0
  386. package/dist/chunk-L4R7ORMD.js +4596 -0
  387. package/dist/chunk-LCLWN64E.js +227 -0
  388. package/dist/chunk-LFQI2C46.js +175 -0
  389. package/dist/chunk-LLYX4F5A.js +1628 -0
  390. package/dist/chunk-LQX5QCDS.js +215 -0
  391. package/dist/chunk-LRMHASG2.js +196 -0
  392. package/dist/chunk-LVUSG56I.js +5930 -0
  393. package/dist/chunk-LVUSG56I.js.map +1 -0
  394. package/dist/chunk-M5FX5KH5.js +629 -0
  395. package/dist/chunk-MLOTUQJJ.js +201 -0
  396. package/dist/chunk-MPUKGKXZ.js +209 -0
  397. package/dist/chunk-MS6LW4VU.js +283 -0
  398. package/dist/chunk-MWN7LDYV.js +4601 -0
  399. package/dist/chunk-MWN7LDYV.js.map +1 -0
  400. package/dist/chunk-MXPW4F74.js +278 -0
  401. package/dist/chunk-MZ7GJX5S.js +158 -0
  402. package/dist/chunk-N5OUIUYD.js +1260 -0
  403. package/dist/chunk-N6FNORC7.js +412 -0
  404. package/dist/chunk-NALVKY4U.js +113 -0
  405. package/dist/chunk-NJ77ZL5T.js +5222 -0
  406. package/dist/chunk-NM2DNJDJ.js +270 -0
  407. package/dist/chunk-NNKRRF7E.js +110 -0
  408. package/dist/chunk-NP5UFWU4.js +318 -0
  409. package/dist/chunk-NV3AEIFO.js +118 -0
  410. package/dist/chunk-O6JDF7KH.js +828 -0
  411. package/dist/chunk-OERZH3J4.js +251 -0
  412. package/dist/chunk-OKHWTWWU.js +1152 -0
  413. package/dist/chunk-OLAIUVGT.js +274 -0
  414. package/dist/chunk-OO36IUMS.js +270 -0
  415. package/dist/chunk-OVDK7K2Z.js +57 -0
  416. package/dist/chunk-OX5ZCHZQ.js +63 -0
  417. package/dist/chunk-P6LLCGPO.js +515 -0
  418. package/dist/chunk-PA2CUHTD.js +505 -0
  419. package/dist/chunk-PB4CQIRA.js +4979 -0
  420. package/dist/chunk-PBV2P632.js +566 -0
  421. package/dist/chunk-PCSRHFRF.js +75 -0
  422. package/dist/chunk-PEPWW5BC.js +436 -0
  423. package/dist/chunk-PMBZMVKE.js +33 -0
  424. package/dist/chunk-PP32RE26.js +34 -0
  425. package/dist/chunk-PTXAPI3Q.js +73 -0
  426. package/dist/chunk-PULNNF7G.js +56 -0
  427. package/dist/chunk-Q6KNROUT.js +158 -0
  428. package/dist/chunk-QEGP3HSW.js +184 -0
  429. package/dist/chunk-QEGP3HSW.js.map +1 -0
  430. package/dist/chunk-QGJIFIKN.js +1032 -0
  431. package/dist/chunk-QKKKORGL.js +41 -0
  432. package/dist/chunk-QKUMMG6P.js +85 -0
  433. package/dist/chunk-QNOWKKZ4.js +40 -0
  434. package/dist/chunk-QSWD3AHE.js +84 -0
  435. package/dist/chunk-QZ4U2VL5.js +391 -0
  436. package/dist/chunk-QZJNCLHV.js +271 -0
  437. package/dist/chunk-R6CFPY3F.js +278 -0
  438. package/dist/chunk-R6QRUYUH.js +406 -0
  439. package/dist/chunk-RE3GAQI5.js +2984 -0
  440. package/dist/chunk-RFHUVPFA.js +1184 -0
  441. package/dist/chunk-RH45HT5T.js +3690 -0
  442. package/dist/chunk-RJNQTZ5O.js +439 -0
  443. package/dist/chunk-RN24AP7Q.js +247 -0
  444. package/dist/chunk-RN24AP7Q.js.map +1 -0
  445. package/dist/chunk-S2BJTAAB.js +37 -0
  446. package/dist/chunk-S56PWXIX.js +138 -0
  447. package/dist/chunk-S6BDABIC.js +1390 -0
  448. package/dist/chunk-S6BDABIC.js.map +1 -0
  449. package/dist/chunk-S6FFDIHD.js +640 -0
  450. package/dist/chunk-S6MAMIK2.js +56 -0
  451. package/dist/chunk-SERTO6H6.js +311 -0
  452. package/dist/chunk-STOOH7EI.js +200 -0
  453. package/dist/chunk-SWSTEUXX.js +121 -0
  454. package/dist/chunk-SWZN7NNZ.js +1029 -0
  455. package/dist/chunk-SYDF57KS.js +178 -0
  456. package/dist/chunk-T275CUVD.js +29 -0
  457. package/dist/chunk-T4OT7QWP.js +378 -0
  458. package/dist/chunk-TCSRY2NP.js +2582 -0
  459. package/dist/chunk-TCX5OA2X.js +1177 -0
  460. package/dist/chunk-TDW5CSO5.js +3158 -0
  461. package/dist/chunk-TGG3ODCS.js +99 -0
  462. package/dist/chunk-TILSTYUC.js +505 -0
  463. package/dist/chunk-TJ5DYWXU.js +1333 -0
  464. package/dist/chunk-TNRI4ZE6.js +391 -0
  465. package/dist/chunk-TPIFVUMF.js +188 -0
  466. package/dist/chunk-TSW6OF22.js +162 -0
  467. package/dist/chunk-TTSTBHGR.js +1095 -0
  468. package/dist/chunk-U3JYAWMR.js +170 -0
  469. package/dist/chunk-U7ODSHA5.js +124 -0
  470. package/dist/chunk-UEGEPRNP.js +48 -0
  471. package/dist/chunk-UGIA2YEJ.js +83 -0
  472. package/dist/chunk-UHLKKDNF.js +432 -0
  473. package/dist/chunk-ULVXKIPX.js +26 -0
  474. package/dist/chunk-UN37ZY6R.js +10074 -0
  475. package/dist/chunk-UN37ZY6R.js.map +1 -0
  476. package/dist/chunk-USUDKZ5G.js +98 -0
  477. package/dist/chunk-UVO6I2F6.js +85 -0
  478. package/dist/chunk-V6NVG4K2.js +357 -0
  479. package/dist/chunk-VCMQFD3G.js +1185 -0
  480. package/dist/chunk-VKPBDNIO.js +246 -0
  481. package/dist/chunk-VLDKWGHD.js +61 -0
  482. package/dist/chunk-VM2NA2EL.js +905 -0
  483. package/dist/chunk-VMZTCVEL.js +114 -0
  484. package/dist/chunk-VQH5AXZY.js +269 -0
  485. package/dist/chunk-VTBTW6N4.js +114 -0
  486. package/dist/chunk-VV7PLDX4.js +230 -0
  487. package/dist/chunk-VYGGLH5H.js +50 -0
  488. package/dist/chunk-VYQHHTQ4.js +133 -0
  489. package/dist/chunk-VYSGRD2W.js +292 -0
  490. package/dist/chunk-W4W63LTP.js +1309 -0
  491. package/dist/chunk-WFC2JA6D.js +2335 -0
  492. package/dist/chunk-WFC2JA6D.js.map +1 -0
  493. package/dist/chunk-WHTRR66J.js +197 -0
  494. package/dist/chunk-WICIQFHJ.js +42 -0
  495. package/dist/chunk-WJYYMCCC.js +283 -0
  496. package/dist/chunk-WSJOWQJE.js +399 -0
  497. package/dist/chunk-WY333GHH.js +108 -0
  498. package/dist/chunk-WY333GHH.js.map +1 -0
  499. package/dist/chunk-WYDUXZ2R.js +353 -0
  500. package/dist/chunk-X62CN4YR.js +3321 -0
  501. package/dist/chunk-XFQHKMO6.js +1024 -0
  502. package/dist/chunk-XGJ7XZHS.js +527 -0
  503. package/dist/chunk-XJFJNOEV.js +723 -0
  504. package/dist/chunk-XKJLHMXZ.js +234 -0
  505. package/dist/chunk-XLFPJVQS.js +103 -0
  506. package/dist/chunk-XM4ZLZFW.js +129 -0
  507. package/dist/chunk-Y2GAWEJD.js +1021 -0
  508. package/dist/chunk-Y3A74SVK.js +296 -0
  509. package/dist/chunk-YANEVGI3.js +92 -0
  510. package/dist/chunk-YHHSO5QR.js +128 -0
  511. package/dist/chunk-YOSOCHCB.js +52 -0
  512. package/dist/chunk-YP4SNX4P.js +220 -0
  513. package/dist/chunk-YQH6AMIH.js +176 -0
  514. package/dist/chunk-YRWL2IAE.js +165 -0
  515. package/dist/chunk-YTWRQ3WK.js +251 -0
  516. package/dist/chunk-YV5GGSLK.js +20 -0
  517. package/dist/chunk-YXUDK37V.js +126 -0
  518. package/dist/chunk-YYM5TSCR.js +75 -0
  519. package/dist/chunk-ZG2CKFQF.js +202 -0
  520. package/dist/chunk-ZGJXO2HH.js +93 -0
  521. package/dist/chunk-ZGV76PZ4.js +3070 -0
  522. package/dist/chunk-ZOBUR2VC.js +229 -0
  523. package/dist/components/artifacts/artifact-chrome.d.ts +4 -0
  524. package/dist/components/artifacts/artifact-sandbox.d.ts +13 -0
  525. package/dist/components/artifacts/inline-html-document.d.ts +10 -1
  526. package/dist/components/artifacts/published-html-artifact-frame.d.ts +17 -0
  527. package/dist/components/preview-loading.d.ts +3 -1
  528. package/dist/composer.js +37 -37
  529. package/dist/computer-viewer-S6AL3XDT.js +21 -0
  530. package/dist/connect.js +38 -37
  531. package/dist/connection-step-up-XGPZKQEL.js +149 -0
  532. package/dist/connection-step-up-XGPZKQEL.js.map +1 -0
  533. package/dist/desktop-dictation.js +23 -23
  534. package/dist/desktop.js +2 -2
  535. package/dist/editor.js +2 -2
  536. package/dist/embedded-new-voice-T3BXRYJX.js +25 -0
  537. package/dist/embedded-voice-ZJXMF3RP.js +25 -0
  538. package/dist/fleet-decision-row-AUCMLBCV.js +361 -0
  539. package/dist/in-chat-connect-model.js +5 -5
  540. package/dist/index.js +296 -295
  541. package/dist/interaction.js +9 -9
  542. package/dist/latest-question-D5BKKEP6.js +1 -1
  543. package/dist/machine-request-model.js +1 -1
  544. package/dist/machines.js +8 -8
  545. package/dist/meetings/meeting-detail-page.d.ts +14 -0
  546. package/dist/meetings/meeting-notes.d.ts +6 -2
  547. package/dist/meetings/meeting-transcript.d.ts +3 -1
  548. package/dist/meetings-recorder.js +1 -1
  549. package/dist/meetings.js +367 -260
  550. package/dist/meetings.js.map +1 -1
  551. package/dist/messages/en.d.ts +6 -2
  552. package/dist/messages.js +1 -1
  553. package/dist/model-policy-picker-menu-TO57YUQ6.js +23 -0
  554. package/dist/native-previews.js +1 -1
  555. package/dist/payment-page-card-DFGDAMTG.js +227 -0
  556. package/dist/platform-activity-row-ZMBEJGXN.js +156 -0
  557. package/dist/queue-surface-implementation-KDK5CYH6.js +933 -0
  558. package/dist/realtime.js +17 -17
  559. package/dist/recorder-host-3HLYRL4H.js +80 -0
  560. package/dist/recordings.js +3 -3
  561. package/dist/sandbox-files-UOZ4OJZU.js +29 -0
  562. package/dist/session-app.js +406 -405
  563. package/dist/session-connect-cards-VZIYLH45.js +28 -0
  564. package/dist/session-list-model.js +2 -2
  565. package/dist/session-realtime-2ZGJWVZP.js +30 -0
  566. package/dist/session-realtime.js +2 -2
  567. package/dist/session-ui.js +98 -97
  568. package/dist/session.js +40 -40
  569. package/dist/sites.js +3 -3
  570. package/dist/skills.js +32 -32
  571. package/dist/terminal.js +2 -2
  572. package/dist/testing/meetings-fixture.d.ts +8 -0
  573. package/dist/testing/meetings-fixture.js +22 -1
  574. package/dist/testing/meetings-fixture.js.map +1 -1
  575. package/dist/this-computer.js +3 -3
  576. package/dist/timeline-annotation-markers-KBTFWLME.js +157 -0
  577. package/dist/timeline-annotation-selection-VI4YSDR5.js +208 -0
  578. package/dist/timeline-annotations-dialog-4PLWNLRB.js +283 -0
  579. package/dist/timeline-model.js +37 -37
  580. package/dist/ui/access-list.js +24 -24
  581. package/dist/ui/cadence-picker.js +7 -7
  582. package/dist/ui/capability-page.js +10 -10
  583. package/dist/ui/choice-cards.js +3 -3
  584. package/dist/ui/confirm-dialog.js +4 -4
  585. package/dist/ui/copy-field.js +3 -3
  586. package/dist/ui/detail-page.js +6 -6
  587. package/dist/ui/detail-sheet.js +6 -6
  588. package/dist/ui/dialog.js +2 -2
  589. package/dist/ui/diff-view.js +3 -3
  590. package/dist/ui/disclosure.js +7 -7
  591. package/dist/ui/email-chips-input.js +3 -3
  592. package/dist/ui/field.js +2 -2
  593. package/dist/ui/flush-form-page.js +8 -8
  594. package/dist/ui/form-dialog.js +7 -7
  595. package/dist/ui/list-row.js +7 -7
  596. package/dist/ui/load-failure.js +3 -3
  597. package/dist/ui/relative-time.js +3 -3
  598. package/dist/ui/revision-history.js +16 -16
  599. package/dist/ui/role-select.js +13 -13
  600. package/dist/ui/select-menu.js +5 -5
  601. package/dist/ui/settings-nav.js +6 -6
  602. package/dist/ui/sheet.js +2 -2
  603. package/dist/ui/usage-meter.js +4 -4
  604. package/dist/usage.js +3 -3
  605. package/dist/workbench.js +11 -11
  606. package/package.json +6 -5
  607. package/src/app/components/session/sandbox-recovery-actions.test.tsx +26 -0
  608. package/src/app/components/session/sandbox-recovery-actions.tsx +2 -1
  609. package/src/app/components/workspace-reach.tsx +2 -0
  610. package/src/components/artifacts/artifact-chrome.tsx +6 -0
  611. package/src/components/artifacts/artifact-sandbox.tsx +119 -20
  612. package/src/components/artifacts/chat-interactive-block.tsx +1 -0
  613. package/src/components/artifacts/inline-html-document.ts +13 -3
  614. package/src/components/artifacts/published-html-artifact-frame.tsx +60 -4
  615. package/src/components/preview-loading.tsx +2 -2
  616. package/src/meetings/meeting-detail-page.tsx +232 -112
  617. package/src/meetings/meeting-notes.tsx +48 -24
  618. package/src/meetings/meeting-transcript.tsx +75 -57
  619. package/src/meetings/meetings-pages.test.tsx +181 -2
  620. package/src/messages/en.ts +6 -2
  621. package/src/testing/meetings-fixture.ts +35 -1
  622. package/styles/compiled.css +8 -0
  623. package/styles/index.css +7 -0
  624. package/dist/browser-viewer-KFMM5S2B.js +0 -23
  625. package/dist/chat-interactive-block-5DJ72HU7.js +0 -22
  626. package/dist/chunk-2B3RQRNQ.js +0 -584
  627. package/dist/chunk-2DA7DTHO.js +0 -83
  628. package/dist/chunk-2GXAXCS2.js +0 -401
  629. package/dist/chunk-2JTZMHQK.js +0 -57
  630. package/dist/chunk-2LRJ32SO.js +0 -114
  631. package/dist/chunk-2VK7FJNR.js +0 -307
  632. package/dist/chunk-2YJS75C3.js +0 -269
  633. package/dist/chunk-2YNEUYWM.js +0 -231
  634. package/dist/chunk-2ZR75AUO.js +0 -225
  635. package/dist/chunk-32LD46VC.js +0 -72
  636. package/dist/chunk-3FVVZW7J.js +0 -84
  637. package/dist/chunk-4327UGUS.js +0 -79
  638. package/dist/chunk-45TILHFZ.js +0 -249
  639. package/dist/chunk-4AUSS7CX.js +0 -318
  640. package/dist/chunk-4ECOHGUL.js +0 -818
  641. package/dist/chunk-4FKE42TW.js +0 -1333
  642. package/dist/chunk-4K5UVYZQ.js +0 -113
  643. package/dist/chunk-4UZE7ZT4.js +0 -54
  644. package/dist/chunk-4XQH4XPP.js +0 -400
  645. package/dist/chunk-4Z7BPBS7.js +0 -34
  646. package/dist/chunk-56KVDNOS.js +0 -98
  647. package/dist/chunk-56NHT2TZ.js +0 -56
  648. package/dist/chunk-57QWSJLX.js +0 -114
  649. package/dist/chunk-5AGRFQSH.js +0 -432
  650. package/dist/chunk-5JMX5FRF.js +0 -1309
  651. package/dist/chunk-5UTHPGFF.js +0 -93
  652. package/dist/chunk-5VPQVMJI.js +0 -84
  653. package/dist/chunk-5WJCOFIU.js +0 -207
  654. package/dist/chunk-62T2ZPD5.js +0 -266
  655. package/dist/chunk-63AVTSUI.js +0 -383
  656. package/dist/chunk-6CDBX3XG.js +0 -33
  657. package/dist/chunk-6D3D2JWY.js +0 -278
  658. package/dist/chunk-6GUG7FXP.js +0 -380
  659. package/dist/chunk-6GUG7FXP.js.map +0 -1
  660. package/dist/chunk-6JGMBTXP.js +0 -114
  661. package/dist/chunk-6LYBRPUG.js +0 -931
  662. package/dist/chunk-6PHBW7SS.js +0 -287
  663. package/dist/chunk-6S2XVKNI.js +0 -91
  664. package/dist/chunk-6TWS6AXT.js +0 -1021
  665. package/dist/chunk-6VEIDSF4.js +0 -73
  666. package/dist/chunk-76NGRVCY.js +0 -340
  667. package/dist/chunk-7FFZLLCH.js +0 -391
  668. package/dist/chunk-7RRDXPNC.js +0 -111
  669. package/dist/chunk-7TLYFHMT.js +0 -851
  670. package/dist/chunk-7V2CQLTN.js +0 -20
  671. package/dist/chunk-7VDWXFTL.js +0 -772
  672. package/dist/chunk-A2OMNLDF.js +0 -150
  673. package/dist/chunk-A3QEJ2IZ.js +0 -229
  674. package/dist/chunk-A6Q6EUBR.js +0 -209
  675. package/dist/chunk-AJSRYRJS.js +0 -138
  676. package/dist/chunk-APNPWJCK.js +0 -66
  677. package/dist/chunk-ARNQH2XE.js +0 -178
  678. package/dist/chunk-B6AH43UQ.js +0 -2434
  679. package/dist/chunk-BIXGAYDJ.js +0 -276
  680. package/dist/chunk-BJ3WRO2K.js +0 -441
  681. package/dist/chunk-BO3D22BS.js +0 -12
  682. package/dist/chunk-BR62BHVY.js +0 -357
  683. package/dist/chunk-BTMSR4OA.js +0 -214
  684. package/dist/chunk-BVZYHORS.js +0 -40
  685. package/dist/chunk-BWBBS6HJ.js +0 -42
  686. package/dist/chunk-C22UPHA2.js +0 -274
  687. package/dist/chunk-C2EERTYX.js +0 -353
  688. package/dist/chunk-C2F6SKOS.js +0 -270
  689. package/dist/chunk-C625ODRG.js +0 -92
  690. package/dist/chunk-CAF3HFJH.js +0 -184
  691. package/dist/chunk-CAF3HFJH.js.map +0 -1
  692. package/dist/chunk-CC4JBFWY.js +0 -85
  693. package/dist/chunk-CDB66JAO.js +0 -283
  694. package/dist/chunk-CG2HT7TI.js +0 -269
  695. package/dist/chunk-CNNOPEAK.js +0 -570
  696. package/dist/chunk-CRBHMSAP.js +0 -469
  697. package/dist/chunk-CSK2WOOX.js +0 -83
  698. package/dist/chunk-CTBPPPLR.js +0 -2580
  699. package/dist/chunk-CTOLX2EW.js +0 -2317
  700. package/dist/chunk-CVDY7P3E.js +0 -246
  701. package/dist/chunk-CX3Z7W5Y.js +0 -107
  702. package/dist/chunk-D5K2BS5Q.js +0 -259
  703. package/dist/chunk-DA7XLT5F.js +0 -366
  704. package/dist/chunk-DAKKJ3XM.js +0 -298
  705. package/dist/chunk-DAKKJ3XM.js.map +0 -1
  706. package/dist/chunk-DC6KFW2R.js +0 -333
  707. package/dist/chunk-DIHPR5KJ.js +0 -15
  708. package/dist/chunk-DLMYANZX.js +0 -3851
  709. package/dist/chunk-DRAG2LZP.js +0 -171
  710. package/dist/chunk-E2SGFW2B.js +0 -3321
  711. package/dist/chunk-EAXZSBWV.js +0 -412
  712. package/dist/chunk-EFKWOXBP.js +0 -428
  713. package/dist/chunk-EGD5RPRX.js +0 -401
  714. package/dist/chunk-ELC2ZPHI.js +0 -1177
  715. package/dist/chunk-EZ5ZBOGQ.js +0 -1032
  716. package/dist/chunk-F2JKNL73.js +0 -187
  717. package/dist/chunk-F3LIUDXN.js +0 -738
  718. package/dist/chunk-F3LIUDXN.js.map +0 -1
  719. package/dist/chunk-FAB5SXNO.js +0 -640
  720. package/dist/chunk-FQ33JHJN.js +0 -63
  721. package/dist/chunk-FX343J2L.js +0 -132
  722. package/dist/chunk-FXFOKD7A.js +0 -449
  723. package/dist/chunk-FY42DW2R.js +0 -515
  724. package/dist/chunk-G4E5WKY7.js +0 -65
  725. package/dist/chunk-GFTV3RR6.js +0 -187
  726. package/dist/chunk-GGBMQNAB.js +0 -33
  727. package/dist/chunk-GGU7KV4G.js +0 -124
  728. package/dist/chunk-GIHE7U3Y.js +0 -174
  729. package/dist/chunk-GRGK3JJI.js +0 -10074
  730. package/dist/chunk-GRGK3JJI.js.map +0 -1
  731. package/dist/chunk-GT3FJVU6.js +0 -4596
  732. package/dist/chunk-GTGPKGWC.js +0 -65
  733. package/dist/chunk-GY6DSWBM.js +0 -82
  734. package/dist/chunk-H3EP6GNA.js +0 -538
  735. package/dist/chunk-HD2MCYQF.js +0 -234
  736. package/dist/chunk-HE4VN5D3.js +0 -4979
  737. package/dist/chunk-HFROJDFQ.js +0 -118
  738. package/dist/chunk-HHFFPE67.js +0 -220
  739. package/dist/chunk-HJ2CDFZX.js +0 -117
  740. package/dist/chunk-HJ2J2XQI.js +0 -88
  741. package/dist/chunk-HLLZPULI.js +0 -172
  742. package/dist/chunk-HPYQ5MES.js +0 -103
  743. package/dist/chunk-HRLJNDDC.js +0 -197
  744. package/dist/chunk-HVGM5IME.js +0 -170
  745. package/dist/chunk-HZE6V7GW.js +0 -214
  746. package/dist/chunk-I5DW76GB.js +0 -200
  747. package/dist/chunk-I7MZOZGC.js +0 -121
  748. package/dist/chunk-IB2EX6GX.js +0 -292
  749. package/dist/chunk-IEDDIJ6B.js +0 -4601
  750. package/dist/chunk-IEDDIJ6B.js.map +0 -1
  751. package/dist/chunk-IGFZFLI2.js +0 -1390
  752. package/dist/chunk-IGFZFLI2.js.map +0 -1
  753. package/dist/chunk-IIMRBCA4.js +0 -271
  754. package/dist/chunk-IIWNSYFA.js +0 -129
  755. package/dist/chunk-IN2ZJR2A.js +0 -96
  756. package/dist/chunk-IUPIJWFK.js +0 -905
  757. package/dist/chunk-IZA2KBYK.js +0 -57
  758. package/dist/chunk-IZZINUFM.js +0 -527
  759. package/dist/chunk-JFEAJRG6.js +0 -1029
  760. package/dist/chunk-JG7MEMJP.js +0 -1184
  761. package/dist/chunk-JIZWFW5A.js +0 -107
  762. package/dist/chunk-JJKUERR4.js +0 -131
  763. package/dist/chunk-JL4PMUDG.js +0 -192
  764. package/dist/chunk-JTWK3VE7.js +0 -202
  765. package/dist/chunk-JV2TJLUW.js +0 -144
  766. package/dist/chunk-KBDWMUYA.js +0 -175
  767. package/dist/chunk-KF65UG2L.js +0 -1628
  768. package/dist/chunk-KFYLTQGK.js +0 -133
  769. package/dist/chunk-KJI2DVSO.js +0 -26
  770. package/dist/chunk-KLYBSXHE.js +0 -3183
  771. package/dist/chunk-KPD6TBO4.js +0 -89
  772. package/dist/chunk-KTGKGHEA.js +0 -75
  773. package/dist/chunk-KUYQTNVT.js +0 -794
  774. package/dist/chunk-KZE7M52Y.js +0 -598
  775. package/dist/chunk-KZYZ3JHS.js +0 -112
  776. package/dist/chunk-L6WVCO6D.js +0 -61
  777. package/dist/chunk-L7T7M2P3.js +0 -5222
  778. package/dist/chunk-LKF6IPFC.js +0 -247
  779. package/dist/chunk-LLU7VKCZ.js +0 -188
  780. package/dist/chunk-LWEJGMVO.js +0 -50
  781. package/dist/chunk-LX5IEXDF.js +0 -505
  782. package/dist/chunk-LYEALWBN.js +0 -251
  783. package/dist/chunk-M722GGD3.js +0 -566
  784. package/dist/chunk-MCPKUVMQ.js +0 -99
  785. package/dist/chunk-MDGNCUAC.js +0 -145
  786. package/dist/chunk-MFLU3466.js +0 -99
  787. package/dist/chunk-MITT6IZG.js +0 -134
  788. package/dist/chunk-MN4LJYKQ.js +0 -608
  789. package/dist/chunk-MNCBL5AX.js +0 -449
  790. package/dist/chunk-MNCBL5AX.js.map +0 -1
  791. package/dist/chunk-MO3XJQN2.js +0 -629
  792. package/dist/chunk-MPP6BEAN.js +0 -158
  793. package/dist/chunk-MQRUZ2LW.js +0 -335
  794. package/dist/chunk-MRJFF5KY.js +0 -351
  795. package/dist/chunk-MUB44LD3.js +0 -75
  796. package/dist/chunk-MYDFABO6.js +0 -296
  797. package/dist/chunk-NJVHMK5R.js +0 -3158
  798. package/dist/chunk-NO6VQNWH.js +0 -396
  799. package/dist/chunk-NUF43R2F.js +0 -278
  800. package/dist/chunk-NUM3QV66.js +0 -107
  801. package/dist/chunk-NW4RPGET.js +0 -48
  802. package/dist/chunk-NZBZLY7H.js +0 -165
  803. package/dist/chunk-O664PL2U.js +0 -47
  804. package/dist/chunk-O664PL2U.js.map +0 -1
  805. package/dist/chunk-OCS3KIYC.js +0 -378
  806. package/dist/chunk-OKI45WHM.js +0 -311
  807. package/dist/chunk-ONF5M5GP.js +0 -283
  808. package/dist/chunk-OPCPBLHA.js +0 -79
  809. package/dist/chunk-OROXCA6L.js +0 -251
  810. package/dist/chunk-OTMJS3FV.js +0 -56
  811. package/dist/chunk-OXM267RC.js +0 -128
  812. package/dist/chunk-P5FLGDXW.js +0 -723
  813. package/dist/chunk-PC3FWPOP.js +0 -828
  814. package/dist/chunk-PPQJIVGM.js +0 -175
  815. package/dist/chunk-PQOVMZI2.js +0 -372
  816. package/dist/chunk-PVGD2RAV.js +0 -5926
  817. package/dist/chunk-PVGD2RAV.js.map +0 -1
  818. package/dist/chunk-PYU7CLEG.js +0 -215
  819. package/dist/chunk-Q2N5UR7Q.js +0 -505
  820. package/dist/chunk-Q4GB2QU3.js +0 -199
  821. package/dist/chunk-Q4RJKXQM.js +0 -606
  822. package/dist/chunk-Q4ZNRQKH.js +0 -196
  823. package/dist/chunk-Q7QXSQ46.js +0 -1185
  824. package/dist/chunk-QAVSUXLA.js +0 -773
  825. package/dist/chunk-QBJDMSFA.js +0 -27
  826. package/dist/chunk-QCB3WNCA.js +0 -176
  827. package/dist/chunk-QIOIJ7K5.js +0 -162
  828. package/dist/chunk-QR72J6WR.js +0 -650
  829. package/dist/chunk-QUTMVW4P.js +0 -141
  830. package/dist/chunk-QUXQYYZO.js +0 -73
  831. package/dist/chunk-RDHK2NYW.js +0 -129
  832. package/dist/chunk-RFBYAUZH.js +0 -311
  833. package/dist/chunk-RFBYAUZH.js.map +0 -1
  834. package/dist/chunk-RGCCRYTY.js +0 -46
  835. package/dist/chunk-RSTS3RWN.js +0 -211
  836. package/dist/chunk-RY7YRYVT.js +0 -126
  837. package/dist/chunk-S4LRL5BA.js +0 -439
  838. package/dist/chunk-S62CVC5C.js +0 -850
  839. package/dist/chunk-S62CVC5C.js.map +0 -1
  840. package/dist/chunk-SHVW3C3Y.js +0 -50
  841. package/dist/chunk-SL4CLUHR.js +0 -48
  842. package/dist/chunk-SOPKVWZJ.js +0 -1187
  843. package/dist/chunk-ST3H53IJ.js +0 -201
  844. package/dist/chunk-SYYFA7W7.js +0 -23
  845. package/dist/chunk-TBUWK3RP.js +0 -399
  846. package/dist/chunk-TC42NAIJ.js +0 -177
  847. package/dist/chunk-TJBTP6LH.js +0 -297
  848. package/dist/chunk-TQQALBLU.js +0 -391
  849. package/dist/chunk-TW56PZBB.js +0 -407
  850. package/dist/chunk-U6XRXK2T.js +0 -1356
  851. package/dist/chunk-U735UBHS.js +0 -2431
  852. package/dist/chunk-U735UBHS.js.map +0 -1
  853. package/dist/chunk-UAKG7GLE.js +0 -155
  854. package/dist/chunk-UB4GKFCI.js +0 -1095
  855. package/dist/chunk-UEAAF27Y.js +0 -108
  856. package/dist/chunk-UITWSZH3.js +0 -162
  857. package/dist/chunk-UQ67SEGH.js +0 -234
  858. package/dist/chunk-URSNCM57.js +0 -37
  859. package/dist/chunk-V77BSX2F.js +0 -1152
  860. package/dist/chunk-VATOL3OZ.js +0 -110
  861. package/dist/chunk-VEJG6GQQ.js +0 -103
  862. package/dist/chunk-VFQZPHZR.js +0 -436
  863. package/dist/chunk-VFZJV26C.js +0 -41
  864. package/dist/chunk-VJZPVP6C.js +0 -230
  865. package/dist/chunk-VQL7FHIF.js +0 -27
  866. package/dist/chunk-VSS6LRAK.js +0 -263
  867. package/dist/chunk-VSSXDLO3.js +0 -467
  868. package/dist/chunk-VVCKB62D.js +0 -1024
  869. package/dist/chunk-VVJDYTD4.js +0 -168
  870. package/dist/chunk-VVXOG3ZC.js +0 -52
  871. package/dist/chunk-W2EX346X.js +0 -85
  872. package/dist/chunk-W3R4C7Z2.js +0 -166
  873. package/dist/chunk-W43FINJV.js +0 -218
  874. package/dist/chunk-W6PJWSZ6.js +0 -1769
  875. package/dist/chunk-WCP32H3P.js +0 -2984
  876. package/dist/chunk-WKELNNIG.js +0 -3690
  877. package/dist/chunk-WRFXCMRW.js +0 -2591
  878. package/dist/chunk-WRLEHV4A.js +0 -386
  879. package/dist/chunk-WTNQHM6Q.js +0 -43
  880. package/dist/chunk-WTZ6OJUY.js +0 -3070
  881. package/dist/chunk-WVFMFQRZ.js +0 -256
  882. package/dist/chunk-WVFMFQRZ.js.map +0 -1
  883. package/dist/chunk-WYIC3CXE.js +0 -157
  884. package/dist/chunk-WZABXFUL.js +0 -246
  885. package/dist/chunk-WZABXFUL.js.map +0 -1
  886. package/dist/chunk-X3GBTLKD.js +0 -175
  887. package/dist/chunk-XBOLFS6I.js +0 -532
  888. package/dist/chunk-XF4UH54P.js +0 -250
  889. package/dist/chunk-XHPBQTJP.js +0 -1260
  890. package/dist/chunk-XQ4TJITR.js +0 -270
  891. package/dist/chunk-XRFMGLCE.js +0 -466
  892. package/dist/chunk-XV2F7PGS.js +0 -236
  893. package/dist/chunk-Y2EQTW5Q.js +0 -100
  894. package/dist/chunk-YAOXCAQD.js +0 -371
  895. package/dist/chunk-YCDB3HPS.js +0 -137
  896. package/dist/chunk-YCONEOZQ.js +0 -191
  897. package/dist/chunk-YG243U6J.js +0 -158
  898. package/dist/chunk-YGQANOSV.js +0 -113
  899. package/dist/chunk-YKRWKRNX.js +0 -138
  900. package/dist/chunk-YKT5NYYJ.js +0 -3996
  901. package/dist/chunk-YKT5NYYJ.js.map +0 -1
  902. package/dist/chunk-YLWABUFE.js +0 -406
  903. package/dist/chunk-YOKIE7NG.js +0 -227
  904. package/dist/chunk-YRCDL3GO.js +0 -2582
  905. package/dist/chunk-YVBAYE7Y.js +0 -1236
  906. package/dist/chunk-YYKPRX4P.js +0 -29
  907. package/dist/chunk-Z4MW635R.js +0 -849
  908. package/dist/chunk-Z7IPPKG6.js +0 -403
  909. package/dist/chunk-ZFGXQ54H.js +0 -114
  910. package/dist/chunk-ZGBXHHCL.js +0 -373
  911. package/dist/computer-viewer-AVH5J4TC.js +0 -21
  912. package/dist/connection-step-up-T2B25VP7.js +0 -148
  913. package/dist/connection-step-up-T2B25VP7.js.map +0 -1
  914. package/dist/embedded-new-voice-M6PBWMQZ.js +0 -25
  915. package/dist/embedded-voice-7USALJKI.js +0 -25
  916. package/dist/fleet-decision-row-XY6OZPHA.js +0 -361
  917. package/dist/model-policy-picker-menu-S5RTVLMQ.js +0 -23
  918. package/dist/payment-page-card-XSY5NO7D.js +0 -227
  919. package/dist/platform-activity-row-77WER5O3.js +0 -156
  920. package/dist/queue-surface-implementation-SDV7I32L.js +0 -933
  921. package/dist/recorder-host-7GNQG6BB.js +0 -80
  922. package/dist/sandbox-files-JOH2Q57T.js +0 -29
  923. package/dist/session-connect-cards-HZIR4ZWT.js +0 -28
  924. package/dist/session-realtime-OPCPTIAP.js +0 -30
  925. package/dist/timeline-annotation-markers-WXCRA4BY.js +0 -157
  926. package/dist/timeline-annotation-selection-YBZQNCNX.js +0 -208
  927. package/dist/timeline-annotations-dialog-4WVXTKFW.js +0 -283
  928. /package/dist/{browser-viewer-KFMM5S2B.js.map → browser-viewer-TRPZI6NT.js.map} +0 -0
  929. /package/dist/{chat-interactive-block-5DJ72HU7.js.map → chat-interactive-block-Y4BS4JCM.js.map} +0 -0
  930. /package/dist/{chunk-CRBHMSAP.js.map → chunk-22E2YJHT.js.map} +0 -0
  931. /package/dist/{chunk-H3EP6GNA.js.map → chunk-2T6TN2YL.js.map} +0 -0
  932. /package/dist/{chunk-KBDWMUYA.js.map → chunk-2WNN26NW.js.map} +0 -0
  933. /package/dist/{chunk-HJ2J2XQI.js.map → chunk-3432A6XB.js.map} +0 -0
  934. /package/dist/{chunk-DA7XLT5F.js.map → chunk-35U7NSOR.js.map} +0 -0
  935. /package/dist/{chunk-QAVSUXLA.js.map → chunk-3EPR76WS.js.map} +0 -0
  936. /package/dist/{chunk-JV2TJLUW.js.map → chunk-3FXXEU5D.js.map} +0 -0
  937. /package/dist/{chunk-QR72J6WR.js.map → chunk-3MXOPOEU.js.map} +0 -0
  938. /package/dist/{chunk-76NGRVCY.js.map → chunk-3PKDU4JI.js.map} +0 -0
  939. /package/dist/{chunk-BO3D22BS.js.map → chunk-3PMO2BIV.js.map} +0 -0
  940. /package/dist/{chunk-SL4CLUHR.js.map → chunk-3XWHJNFY.js.map} +0 -0
  941. /package/dist/{chunk-EGD5RPRX.js.map → chunk-45WD2PKE.js.map} +0 -0
  942. /package/dist/{chunk-KZE7M52Y.js.map → chunk-4H2OWNRA.js.map} +0 -0
  943. /package/dist/{chunk-VSS6LRAK.js.map → chunk-4HVGOTMU.js.map} +0 -0
  944. /package/dist/{chunk-4ECOHGUL.js.map → chunk-4JER2ZMV.js.map} +0 -0
  945. /package/dist/{chunk-HZE6V7GW.js.map → chunk-4LVZ2VOQ.js.map} +0 -0
  946. /package/dist/{chunk-B6AH43UQ.js.map → chunk-4OGDD2EM.js.map} +0 -0
  947. /package/dist/{chunk-4UZE7ZT4.js.map → chunk-4PQC6WMF.js.map} +0 -0
  948. /package/dist/{chunk-KUYQTNVT.js.map → chunk-4UVSWAT3.js.map} +0 -0
  949. /package/dist/{chunk-BTMSR4OA.js.map → chunk-53A47RBX.js.map} +0 -0
  950. /package/dist/{chunk-57QWSJLX.js.map → chunk-552KKENW.js.map} +0 -0
  951. /package/dist/{chunk-TC42NAIJ.js.map → chunk-55F7L6M3.js.map} +0 -0
  952. /package/dist/{chunk-FXFOKD7A.js.map → chunk-5AHIKB3O.js.map} +0 -0
  953. /package/dist/{chunk-Q4GB2QU3.js.map → chunk-5N4L5WTE.js.map} +0 -0
  954. /package/dist/{chunk-4327UGUS.js.map → chunk-5OUJCVZI.js.map} +0 -0
  955. /package/dist/{chunk-GTGPKGWC.js.map → chunk-5OYXQ7MH.js.map} +0 -0
  956. /package/dist/{chunk-2ZR75AUO.js.map → chunk-5TAVVMFX.js.map} +0 -0
  957. /package/dist/{chunk-2YJS75C3.js.map → chunk-5Y3LYRNH.js.map} +0 -0
  958. /package/dist/{chunk-WRLEHV4A.js.map → chunk-5ZJKKE4T.js.map} +0 -0
  959. /package/dist/{chunk-2JTZMHQK.js.map → chunk-62DPSQRZ.js.map} +0 -0
  960. /package/dist/{chunk-MN4LJYKQ.js.map → chunk-64KMWTJ6.js.map} +0 -0
  961. /package/dist/{chunk-QUXQYYZO.js.map → chunk-6MZBNUS7.js.map} +0 -0
  962. /package/dist/{chunk-XF4UH54P.js.map → chunk-6YCE4ZC4.js.map} +0 -0
  963. /package/dist/{chunk-X3GBTLKD.js.map → chunk-6YROWWMX.js.map} +0 -0
  964. /package/dist/{chunk-YVBAYE7Y.js.map → chunk-73RZ72VU.js.map} +0 -0
  965. /package/dist/{chunk-5VPQVMJI.js.map → chunk-74KV436L.js.map} +0 -0
  966. /package/dist/{chunk-CSK2WOOX.js.map → chunk-7HKGLPV5.js.map} +0 -0
  967. /package/dist/{chunk-XRFMGLCE.js.map → chunk-7JSWODT6.js.map} +0 -0
  968. /package/dist/{chunk-EFKWOXBP.js.map → chunk-7K3PKWER.js.map} +0 -0
  969. /package/dist/{chunk-U6XRXK2T.js.map → chunk-7MPWC42V.js.map} +0 -0
  970. /package/dist/{chunk-QUTMVW4P.js.map → chunk-7REO6FRN.js.map} +0 -0
  971. /package/dist/{chunk-MDGNCUAC.js.map → chunk-7YMWRNRQ.js.map} +0 -0
  972. /package/dist/{chunk-JJKUERR4.js.map → chunk-A6H3KJ7G.js.map} +0 -0
  973. /package/dist/{chunk-W6PJWSZ6.js.map → chunk-AGQIE6YU.js.map} +0 -0
  974. /package/dist/{chunk-ZGBXHHCL.js.map → chunk-AHQM4I5V.js.map} +0 -0
  975. /package/dist/{chunk-HLLZPULI.js.map → chunk-AMTRO7XF.js.map} +0 -0
  976. /package/dist/{chunk-6S2XVKNI.js.map → chunk-AO4LTCG7.js.map} +0 -0
  977. /package/dist/{chunk-CTBPPPLR.js.map → chunk-APJ22OZV.js.map} +0 -0
  978. /package/dist/{chunk-TW56PZBB.js.map → chunk-APWL37KW.js.map} +0 -0
  979. /package/dist/{chunk-DIHPR5KJ.js.map → chunk-AQEJOBQ2.js.map} +0 -0
  980. /package/dist/{chunk-HD2MCYQF.js.map → chunk-ARKNT6BX.js.map} +0 -0
  981. /package/dist/{chunk-RSTS3RWN.js.map → chunk-B2IHDMAR.js.map} +0 -0
  982. /package/dist/{chunk-KZYZ3JHS.js.map → chunk-BCKIV26W.js.map} +0 -0
  983. /package/dist/{chunk-D5K2BS5Q.js.map → chunk-BE26JUSD.js.map} +0 -0
  984. /package/dist/{chunk-DRAG2LZP.js.map → chunk-BOVCD6KD.js.map} +0 -0
  985. /package/dist/{chunk-IIWNSYFA.js.map → chunk-BQWV66A6.js.map} +0 -0
  986. /package/dist/{chunk-BJ3WRO2K.js.map → chunk-BSQJXGGP.js.map} +0 -0
  987. /package/dist/{chunk-KLYBSXHE.js.map → chunk-BZY3MEVZ.js.map} +0 -0
  988. /package/dist/{chunk-MQRUZ2LW.js.map → chunk-C3D3OOEY.js.map} +0 -0
  989. /package/dist/{chunk-GY6DSWBM.js.map → chunk-CDHYO3DP.js.map} +0 -0
  990. /package/dist/{chunk-OPCPBLHA.js.map → chunk-CDV5JGVI.js.map} +0 -0
  991. /package/dist/{chunk-5WJCOFIU.js.map → chunk-CNW45M7G.js.map} +0 -0
  992. /package/dist/{chunk-A2OMNLDF.js.map → chunk-CUVQ37HB.js.map} +0 -0
  993. /package/dist/{chunk-XBOLFS6I.js.map → chunk-D32T3IIC.js.map} +0 -0
  994. /package/dist/{chunk-YAOXCAQD.js.map → chunk-D65BSM64.js.map} +0 -0
  995. /package/dist/{chunk-CNNOPEAK.js.map → chunk-D7435DWV.js.map} +0 -0
  996. /package/dist/{chunk-32LD46VC.js.map → chunk-DFH3M7B3.js.map} +0 -0
  997. /package/dist/{chunk-QIOIJ7K5.js.map → chunk-DGWBQ76M.js.map} +0 -0
  998. /package/dist/{chunk-PQOVMZI2.js.map → chunk-DHJDTGSJ.js.map} +0 -0
  999. /package/dist/{chunk-4XQH4XPP.js.map → chunk-DKEFTNCD.js.map} +0 -0
  1000. /package/dist/{chunk-JIZWFW5A.js.map → chunk-DNAF6MT4.js.map} +0 -0
  1001. /package/dist/{chunk-QBJDMSFA.js.map → chunk-E35XY7DS.js.map} +0 -0
  1002. /package/dist/{chunk-NO6VQNWH.js.map → chunk-E5T5WIIP.js.map} +0 -0
  1003. /package/dist/{chunk-W3R4C7Z2.js.map → chunk-EL6ECD34.js.map} +0 -0
  1004. /package/dist/{chunk-VSSXDLO3.js.map → chunk-ELR6ITRC.js.map} +0 -0
  1005. /package/dist/{chunk-7TLYFHMT.js.map → chunk-EPE3V2VE.js.map} +0 -0
  1006. /package/dist/{chunk-2B3RQRNQ.js.map → chunk-EYGQHHVW.js.map} +0 -0
  1007. /package/dist/{chunk-2VK7FJNR.js.map → chunk-EYQEJHYP.js.map} +0 -0
  1008. /package/dist/{chunk-BIXGAYDJ.js.map → chunk-EZTH2XMH.js.map} +0 -0
  1009. /package/dist/{chunk-6PHBW7SS.js.map → chunk-F3QVHVFS.js.map} +0 -0
  1010. /package/dist/{chunk-SOPKVWZJ.js.map → chunk-F5VWPREQ.js.map} +0 -0
  1011. /package/dist/{chunk-YGQANOSV.js.map → chunk-FM7AQUBL.js.map} +0 -0
  1012. /package/dist/{chunk-Y2EQTW5Q.js.map → chunk-FP6BUXJM.js.map} +0 -0
  1013. /package/dist/{chunk-45TILHFZ.js.map → chunk-FVU52L3I.js.map} +0 -0
  1014. /package/dist/{chunk-W43FINJV.js.map → chunk-FZKNXNNO.js.map} +0 -0
  1015. /package/dist/{chunk-XV2F7PGS.js.map → chunk-G3IXJWRY.js.map} +0 -0
  1016. /package/dist/{chunk-DC6KFW2R.js.map → chunk-G6EI2O3N.js.map} +0 -0
  1017. /package/dist/{chunk-2GXAXCS2.js.map → chunk-GB5T6YMZ.js.map} +0 -0
  1018. /package/dist/{chunk-WYIC3CXE.js.map → chunk-GBLD6FOG.js.map} +0 -0
  1019. /package/dist/{chunk-YCDB3HPS.js.map → chunk-GJBFFXCY.js.map} +0 -0
  1020. /package/dist/{chunk-APNPWJCK.js.map → chunk-GJDP2K2S.js.map} +0 -0
  1021. /package/dist/{chunk-GFTV3RR6.js.map → chunk-GP26XTDX.js.map} +0 -0
  1022. /package/dist/{chunk-Q4RJKXQM.js.map → chunk-GTE6WP4N.js.map} +0 -0
  1023. /package/dist/{chunk-UEAAF27Y.js.map → chunk-GWG3OAV7.js.map} +0 -0
  1024. /package/dist/{chunk-6LYBRPUG.js.map → chunk-GXMHTMM6.js.map} +0 -0
  1025. /package/dist/{chunk-NUM3QV66.js.map → chunk-GYRN5O2E.js.map} +0 -0
  1026. /package/dist/{chunk-G4E5WKY7.js.map → chunk-GZX7W2WW.js.map} +0 -0
  1027. /package/dist/{chunk-Z7IPPKG6.js.map → chunk-H3QI2G2B.js.map} +0 -0
  1028. /package/dist/{chunk-Z4MW635R.js.map → chunk-H7D4DVWY.js.map} +0 -0
  1029. /package/dist/{chunk-YCONEOZQ.js.map → chunk-HCDGBBBJ.js.map} +0 -0
  1030. /package/dist/{chunk-DLMYANZX.js.map → chunk-HDSH6MIJ.js.map} +0 -0
  1031. /package/dist/{chunk-KPD6TBO4.js.map → chunk-HOEUPZ6O.js.map} +0 -0
  1032. /package/dist/{chunk-7VDWXFTL.js.map → chunk-HPQRWTQB.js.map} +0 -0
  1033. /package/dist/{chunk-GIHE7U3Y.js.map → chunk-HUKGLWAY.js.map} +0 -0
  1034. /package/dist/{chunk-SYYFA7W7.js.map → chunk-HUTQJY3F.js.map} +0 -0
  1035. /package/dist/{chunk-62T2ZPD5.js.map → chunk-HWOYJOKK.js.map} +0 -0
  1036. /package/dist/{chunk-IN2ZJR2A.js.map → chunk-HZR3WGUP.js.map} +0 -0
  1037. /package/dist/{chunk-YKRWKRNX.js.map → chunk-I7YUDPDR.js.map} +0 -0
  1038. /package/dist/{chunk-VQL7FHIF.js.map → chunk-IDII52M4.js.map} +0 -0
  1039. /package/dist/{chunk-HPYQ5MES.js.map → chunk-IDPWEUM7.js.map} +0 -0
  1040. /package/dist/{chunk-JL4PMUDG.js.map → chunk-IEWQFGEC.js.map} +0 -0
  1041. /package/dist/{chunk-MRJFF5KY.js.map → chunk-IMTACEXF.js.map} +0 -0
  1042. /package/dist/{chunk-2LRJ32SO.js.map → chunk-IVWT6M6N.js.map} +0 -0
  1043. /package/dist/{chunk-7RRDXPNC.js.map → chunk-JEUPIHIP.js.map} +0 -0
  1044. /package/dist/{chunk-VVJDYTD4.js.map → chunk-JF4WX3GQ.js.map} +0 -0
  1045. /package/dist/{chunk-WRFXCMRW.js.map → chunk-JJPYXUKC.js.map} +0 -0
  1046. /package/dist/{chunk-WTNQHM6Q.js.map → chunk-JNHWTYDD.js.map} +0 -0
  1047. /package/dist/{chunk-RGCCRYTY.js.map → chunk-JP7AOJWD.js.map} +0 -0
  1048. /package/dist/{chunk-TJBTP6LH.js.map → chunk-JTWT2WQA.js.map} +0 -0
  1049. /package/dist/{chunk-HJ2CDFZX.js.map → chunk-JW3WIHWO.js.map} +0 -0
  1050. /package/dist/{chunk-MITT6IZG.js.map → chunk-JW7RJMEZ.js.map} +0 -0
  1051. /package/dist/{chunk-CTOLX2EW.js.map → chunk-K76PXR3O.js.map} +0 -0
  1052. /package/dist/{chunk-CX3Z7W5Y.js.map → chunk-KCNIQN6V.js.map} +0 -0
  1053. /package/dist/{chunk-2YNEUYWM.js.map → chunk-KH6KHYST.js.map} +0 -0
  1054. /package/dist/{chunk-LKF6IPFC.js.map → chunk-KK4SEN7N.js.map} +0 -0
  1055. /package/dist/{chunk-63AVTSUI.js.map → chunk-KOKRGAAI.js.map} +0 -0
  1056. /package/dist/{chunk-F2JKNL73.js.map → chunk-KQFNTGAF.js.map} +0 -0
  1057. /package/dist/{chunk-SHVW3C3Y.js.map → chunk-KRLNC6TH.js.map} +0 -0
  1058. /package/dist/{chunk-MFLU3466.js.map → chunk-KYDLVMKA.js.map} +0 -0
  1059. /package/dist/{chunk-UAKG7GLE.js.map → chunk-KZQDP2JM.js.map} +0 -0
  1060. /package/dist/{chunk-FX343J2L.js.map → chunk-L2EZ2HOX.js.map} +0 -0
  1061. /package/dist/{chunk-GGBMQNAB.js.map → chunk-L2UAFR2D.js.map} +0 -0
  1062. /package/dist/{chunk-GT3FJVU6.js.map → chunk-L4R7ORMD.js.map} +0 -0
  1063. /package/dist/{chunk-YOKIE7NG.js.map → chunk-LCLWN64E.js.map} +0 -0
  1064. /package/dist/{chunk-PPQJIVGM.js.map → chunk-LFQI2C46.js.map} +0 -0
  1065. /package/dist/{chunk-KF65UG2L.js.map → chunk-LLYX4F5A.js.map} +0 -0
  1066. /package/dist/{chunk-PYU7CLEG.js.map → chunk-LQX5QCDS.js.map} +0 -0
  1067. /package/dist/{chunk-Q4ZNRQKH.js.map → chunk-LRMHASG2.js.map} +0 -0
  1068. /package/dist/{chunk-MO3XJQN2.js.map → chunk-M5FX5KH5.js.map} +0 -0
  1069. /package/dist/{chunk-ST3H53IJ.js.map → chunk-MLOTUQJJ.js.map} +0 -0
  1070. /package/dist/{chunk-A6Q6EUBR.js.map → chunk-MPUKGKXZ.js.map} +0 -0
  1071. /package/dist/{chunk-ONF5M5GP.js.map → chunk-MS6LW4VU.js.map} +0 -0
  1072. /package/dist/{chunk-NUF43R2F.js.map → chunk-MXPW4F74.js.map} +0 -0
  1073. /package/dist/{chunk-MPP6BEAN.js.map → chunk-MZ7GJX5S.js.map} +0 -0
  1074. /package/dist/{chunk-XHPBQTJP.js.map → chunk-N5OUIUYD.js.map} +0 -0
  1075. /package/dist/{chunk-EAXZSBWV.js.map → chunk-N6FNORC7.js.map} +0 -0
  1076. /package/dist/{chunk-4K5UVYZQ.js.map → chunk-NALVKY4U.js.map} +0 -0
  1077. /package/dist/{chunk-L7T7M2P3.js.map → chunk-NJ77ZL5T.js.map} +0 -0
  1078. /package/dist/{chunk-XQ4TJITR.js.map → chunk-NM2DNJDJ.js.map} +0 -0
  1079. /package/dist/{chunk-VATOL3OZ.js.map → chunk-NNKRRF7E.js.map} +0 -0
  1080. /package/dist/{chunk-4AUSS7CX.js.map → chunk-NP5UFWU4.js.map} +0 -0
  1081. /package/dist/{chunk-HFROJDFQ.js.map → chunk-NV3AEIFO.js.map} +0 -0
  1082. /package/dist/{chunk-PC3FWPOP.js.map → chunk-O6JDF7KH.js.map} +0 -0
  1083. /package/dist/{chunk-OROXCA6L.js.map → chunk-OERZH3J4.js.map} +0 -0
  1084. /package/dist/{chunk-V77BSX2F.js.map → chunk-OKHWTWWU.js.map} +0 -0
  1085. /package/dist/{chunk-C22UPHA2.js.map → chunk-OLAIUVGT.js.map} +0 -0
  1086. /package/dist/{chunk-C2F6SKOS.js.map → chunk-OO36IUMS.js.map} +0 -0
  1087. /package/dist/{chunk-IZA2KBYK.js.map → chunk-OVDK7K2Z.js.map} +0 -0
  1088. /package/dist/{chunk-FQ33JHJN.js.map → chunk-OX5ZCHZQ.js.map} +0 -0
  1089. /package/dist/{chunk-FY42DW2R.js.map → chunk-P6LLCGPO.js.map} +0 -0
  1090. /package/dist/{chunk-LX5IEXDF.js.map → chunk-PA2CUHTD.js.map} +0 -0
  1091. /package/dist/{chunk-HE4VN5D3.js.map → chunk-PB4CQIRA.js.map} +0 -0
  1092. /package/dist/{chunk-M722GGD3.js.map → chunk-PBV2P632.js.map} +0 -0
  1093. /package/dist/{chunk-KTGKGHEA.js.map → chunk-PCSRHFRF.js.map} +0 -0
  1094. /package/dist/{chunk-VFQZPHZR.js.map → chunk-PEPWW5BC.js.map} +0 -0
  1095. /package/dist/{chunk-6CDBX3XG.js.map → chunk-PMBZMVKE.js.map} +0 -0
  1096. /package/dist/{chunk-4Z7BPBS7.js.map → chunk-PP32RE26.js.map} +0 -0
  1097. /package/dist/{chunk-6VEIDSF4.js.map → chunk-PTXAPI3Q.js.map} +0 -0
  1098. /package/dist/{chunk-OTMJS3FV.js.map → chunk-PULNNF7G.js.map} +0 -0
  1099. /package/dist/{chunk-YG243U6J.js.map → chunk-Q6KNROUT.js.map} +0 -0
  1100. /package/dist/{chunk-EZ5ZBOGQ.js.map → chunk-QGJIFIKN.js.map} +0 -0
  1101. /package/dist/{chunk-VFZJV26C.js.map → chunk-QKKKORGL.js.map} +0 -0
  1102. /package/dist/{chunk-W2EX346X.js.map → chunk-QKUMMG6P.js.map} +0 -0
  1103. /package/dist/{chunk-BVZYHORS.js.map → chunk-QNOWKKZ4.js.map} +0 -0
  1104. /package/dist/{chunk-3FVVZW7J.js.map → chunk-QSWD3AHE.js.map} +0 -0
  1105. /package/dist/{chunk-7FFZLLCH.js.map → chunk-QZ4U2VL5.js.map} +0 -0
  1106. /package/dist/{chunk-IIMRBCA4.js.map → chunk-QZJNCLHV.js.map} +0 -0
  1107. /package/dist/{chunk-6D3D2JWY.js.map → chunk-R6CFPY3F.js.map} +0 -0
  1108. /package/dist/{chunk-YLWABUFE.js.map → chunk-R6QRUYUH.js.map} +0 -0
  1109. /package/dist/{chunk-WCP32H3P.js.map → chunk-RE3GAQI5.js.map} +0 -0
  1110. /package/dist/{chunk-JG7MEMJP.js.map → chunk-RFHUVPFA.js.map} +0 -0
  1111. /package/dist/{chunk-WKELNNIG.js.map → chunk-RH45HT5T.js.map} +0 -0
  1112. /package/dist/{chunk-S4LRL5BA.js.map → chunk-RJNQTZ5O.js.map} +0 -0
  1113. /package/dist/{chunk-URSNCM57.js.map → chunk-S2BJTAAB.js.map} +0 -0
  1114. /package/dist/{chunk-AJSRYRJS.js.map → chunk-S56PWXIX.js.map} +0 -0
  1115. /package/dist/{chunk-FAB5SXNO.js.map → chunk-S6FFDIHD.js.map} +0 -0
  1116. /package/dist/{chunk-56NHT2TZ.js.map → chunk-S6MAMIK2.js.map} +0 -0
  1117. /package/dist/{chunk-OKI45WHM.js.map → chunk-SERTO6H6.js.map} +0 -0
  1118. /package/dist/{chunk-I5DW76GB.js.map → chunk-STOOH7EI.js.map} +0 -0
  1119. /package/dist/{chunk-I7MZOZGC.js.map → chunk-SWSTEUXX.js.map} +0 -0
  1120. /package/dist/{chunk-JFEAJRG6.js.map → chunk-SWZN7NNZ.js.map} +0 -0
  1121. /package/dist/{chunk-ARNQH2XE.js.map → chunk-SYDF57KS.js.map} +0 -0
  1122. /package/dist/{chunk-YYKPRX4P.js.map → chunk-T275CUVD.js.map} +0 -0
  1123. /package/dist/{chunk-OCS3KIYC.js.map → chunk-T4OT7QWP.js.map} +0 -0
  1124. /package/dist/{chunk-YRCDL3GO.js.map → chunk-TCSRY2NP.js.map} +0 -0
  1125. /package/dist/{chunk-ELC2ZPHI.js.map → chunk-TCX5OA2X.js.map} +0 -0
  1126. /package/dist/{chunk-NJVHMK5R.js.map → chunk-TDW5CSO5.js.map} +0 -0
  1127. /package/dist/{chunk-MCPKUVMQ.js.map → chunk-TGG3ODCS.js.map} +0 -0
  1128. /package/dist/{chunk-Q2N5UR7Q.js.map → chunk-TILSTYUC.js.map} +0 -0
  1129. /package/dist/{chunk-4FKE42TW.js.map → chunk-TJ5DYWXU.js.map} +0 -0
  1130. /package/dist/{chunk-TQQALBLU.js.map → chunk-TNRI4ZE6.js.map} +0 -0
  1131. /package/dist/{chunk-LLU7VKCZ.js.map → chunk-TPIFVUMF.js.map} +0 -0
  1132. /package/dist/{chunk-UITWSZH3.js.map → chunk-TSW6OF22.js.map} +0 -0
  1133. /package/dist/{chunk-UB4GKFCI.js.map → chunk-TTSTBHGR.js.map} +0 -0
  1134. /package/dist/{chunk-HVGM5IME.js.map → chunk-U3JYAWMR.js.map} +0 -0
  1135. /package/dist/{chunk-GGU7KV4G.js.map → chunk-U7ODSHA5.js.map} +0 -0
  1136. /package/dist/{chunk-NW4RPGET.js.map → chunk-UEGEPRNP.js.map} +0 -0
  1137. /package/dist/{chunk-2DA7DTHO.js.map → chunk-UGIA2YEJ.js.map} +0 -0
  1138. /package/dist/{chunk-5AGRFQSH.js.map → chunk-UHLKKDNF.js.map} +0 -0
  1139. /package/dist/{chunk-KJI2DVSO.js.map → chunk-ULVXKIPX.js.map} +0 -0
  1140. /package/dist/{chunk-56KVDNOS.js.map → chunk-USUDKZ5G.js.map} +0 -0
  1141. /package/dist/{chunk-CC4JBFWY.js.map → chunk-UVO6I2F6.js.map} +0 -0
  1142. /package/dist/{chunk-BR62BHVY.js.map → chunk-V6NVG4K2.js.map} +0 -0
  1143. /package/dist/{chunk-Q7QXSQ46.js.map → chunk-VCMQFD3G.js.map} +0 -0
  1144. /package/dist/{chunk-CVDY7P3E.js.map → chunk-VKPBDNIO.js.map} +0 -0
  1145. /package/dist/{chunk-L6WVCO6D.js.map → chunk-VLDKWGHD.js.map} +0 -0
  1146. /package/dist/{chunk-IUPIJWFK.js.map → chunk-VM2NA2EL.js.map} +0 -0
  1147. /package/dist/{chunk-6JGMBTXP.js.map → chunk-VMZTCVEL.js.map} +0 -0
  1148. /package/dist/{chunk-CG2HT7TI.js.map → chunk-VQH5AXZY.js.map} +0 -0
  1149. /package/dist/{chunk-ZFGXQ54H.js.map → chunk-VTBTW6N4.js.map} +0 -0
  1150. /package/dist/{chunk-VJZPVP6C.js.map → chunk-VV7PLDX4.js.map} +0 -0
  1151. /package/dist/{chunk-LWEJGMVO.js.map → chunk-VYGGLH5H.js.map} +0 -0
  1152. /package/dist/{chunk-KFYLTQGK.js.map → chunk-VYQHHTQ4.js.map} +0 -0
  1153. /package/dist/{chunk-IB2EX6GX.js.map → chunk-VYSGRD2W.js.map} +0 -0
  1154. /package/dist/{chunk-5JMX5FRF.js.map → chunk-W4W63LTP.js.map} +0 -0
  1155. /package/dist/{chunk-HRLJNDDC.js.map → chunk-WHTRR66J.js.map} +0 -0
  1156. /package/dist/{chunk-BWBBS6HJ.js.map → chunk-WICIQFHJ.js.map} +0 -0
  1157. /package/dist/{chunk-CDB66JAO.js.map → chunk-WJYYMCCC.js.map} +0 -0
  1158. /package/dist/{chunk-TBUWK3RP.js.map → chunk-WSJOWQJE.js.map} +0 -0
  1159. /package/dist/{chunk-C2EERTYX.js.map → chunk-WYDUXZ2R.js.map} +0 -0
  1160. /package/dist/{chunk-E2SGFW2B.js.map → chunk-X62CN4YR.js.map} +0 -0
  1161. /package/dist/{chunk-VVCKB62D.js.map → chunk-XFQHKMO6.js.map} +0 -0
  1162. /package/dist/{chunk-IZZINUFM.js.map → chunk-XGJ7XZHS.js.map} +0 -0
  1163. /package/dist/{chunk-P5FLGDXW.js.map → chunk-XJFJNOEV.js.map} +0 -0
  1164. /package/dist/{chunk-UQ67SEGH.js.map → chunk-XKJLHMXZ.js.map} +0 -0
  1165. /package/dist/{chunk-VEJG6GQQ.js.map → chunk-XLFPJVQS.js.map} +0 -0
  1166. /package/dist/{chunk-RDHK2NYW.js.map → chunk-XM4ZLZFW.js.map} +0 -0
  1167. /package/dist/{chunk-6TWS6AXT.js.map → chunk-Y2GAWEJD.js.map} +0 -0
  1168. /package/dist/{chunk-MYDFABO6.js.map → chunk-Y3A74SVK.js.map} +0 -0
  1169. /package/dist/{chunk-C625ODRG.js.map → chunk-YANEVGI3.js.map} +0 -0
  1170. /package/dist/{chunk-OXM267RC.js.map → chunk-YHHSO5QR.js.map} +0 -0
  1171. /package/dist/{chunk-VVXOG3ZC.js.map → chunk-YOSOCHCB.js.map} +0 -0
  1172. /package/dist/{chunk-HHFFPE67.js.map → chunk-YP4SNX4P.js.map} +0 -0
  1173. /package/dist/{chunk-QCB3WNCA.js.map → chunk-YQH6AMIH.js.map} +0 -0
  1174. /package/dist/{chunk-NZBZLY7H.js.map → chunk-YRWL2IAE.js.map} +0 -0
  1175. /package/dist/{chunk-LYEALWBN.js.map → chunk-YTWRQ3WK.js.map} +0 -0
  1176. /package/dist/{chunk-7V2CQLTN.js.map → chunk-YV5GGSLK.js.map} +0 -0
  1177. /package/dist/{chunk-RY7YRYVT.js.map → chunk-YXUDK37V.js.map} +0 -0
  1178. /package/dist/{chunk-MUB44LD3.js.map → chunk-YYM5TSCR.js.map} +0 -0
  1179. /package/dist/{chunk-JTWK3VE7.js.map → chunk-ZG2CKFQF.js.map} +0 -0
  1180. /package/dist/{chunk-5UTHPGFF.js.map → chunk-ZGJXO2HH.js.map} +0 -0
  1181. /package/dist/{chunk-WTZ6OJUY.js.map → chunk-ZGV76PZ4.js.map} +0 -0
  1182. /package/dist/{chunk-A3QEJ2IZ.js.map → chunk-ZOBUR2VC.js.map} +0 -0
  1183. /package/dist/{computer-viewer-AVH5J4TC.js.map → computer-viewer-S6AL3XDT.js.map} +0 -0
  1184. /package/dist/{embedded-new-voice-M6PBWMQZ.js.map → embedded-new-voice-T3BXRYJX.js.map} +0 -0
  1185. /package/dist/{embedded-voice-7USALJKI.js.map → embedded-voice-ZJXMF3RP.js.map} +0 -0
  1186. /package/dist/{fleet-decision-row-XY6OZPHA.js.map → fleet-decision-row-AUCMLBCV.js.map} +0 -0
  1187. /package/dist/{model-policy-picker-menu-S5RTVLMQ.js.map → model-policy-picker-menu-TO57YUQ6.js.map} +0 -0
  1188. /package/dist/{payment-page-card-XSY5NO7D.js.map → payment-page-card-DFGDAMTG.js.map} +0 -0
  1189. /package/dist/{platform-activity-row-77WER5O3.js.map → platform-activity-row-ZMBEJGXN.js.map} +0 -0
  1190. /package/dist/{queue-surface-implementation-SDV7I32L.js.map → queue-surface-implementation-KDK5CYH6.js.map} +0 -0
  1191. /package/dist/{recorder-host-7GNQG6BB.js.map → recorder-host-3HLYRL4H.js.map} +0 -0
  1192. /package/dist/{sandbox-files-JOH2Q57T.js.map → sandbox-files-UOZ4OJZU.js.map} +0 -0
  1193. /package/dist/{session-connect-cards-HZIR4ZWT.js.map → session-connect-cards-VZIYLH45.js.map} +0 -0
  1194. /package/dist/{session-realtime-OPCPTIAP.js.map → session-realtime-2ZGJWVZP.js.map} +0 -0
  1195. /package/dist/{timeline-annotation-markers-WXCRA4BY.js.map → timeline-annotation-markers-KBTFWLME.js.map} +0 -0
  1196. /package/dist/{timeline-annotation-selection-YBZQNCNX.js.map → timeline-annotation-selection-VI4YSDR5.js.map} +0 -0
  1197. /package/dist/{timeline-annotations-dialog-4WVXTKFW.js.map → timeline-annotations-dialog-4PLWNLRB.js.map} +0 -0
@@ -0,0 +1,3158 @@
1
+ "use client";
2
+ import {
3
+ TRANSIENT_RECONNECT_INTERVAL_MS,
4
+ isActionFailure,
5
+ isCalmServiceFailure,
6
+ isTransientServiceFailure,
7
+ markActionFailure
8
+ } from "./chunk-5AIMVW6Y.js";
9
+ import {
10
+ ComposerReconciliationRequiredError,
11
+ ComposerStateError,
12
+ ComposerWorkspaceControlUnavailableError,
13
+ composerSubmissionCanRetry,
14
+ composerSubmissionErrorMessage,
15
+ isComposerSelectionRefusalMessage
16
+ } from "./chunk-UIK52VL4.js";
17
+ import {
18
+ useSessionEventTrigger
19
+ } from "./chunk-SW4S6I5E.js";
20
+ import {
21
+ normalizeError,
22
+ useErrorMessage
23
+ } from "./chunk-CM7LVUKC.js";
24
+ import {
25
+ useEmbeddedSession
26
+ } from "./chunk-BVUAHAQX.js";
27
+ import {
28
+ useOpenGeniText
29
+ } from "./chunk-LVUSG56I.js";
30
+
31
+ // src/hooks/use-composer.ts
32
+ import {
33
+ DEFAULT_FILE_RESOURCE_MOUNT_ROOT,
34
+ OpenGeniApiError,
35
+ isMaintenanceError
36
+ } from "@opengeni/sdk";
37
+ import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
38
+
39
+ // src/lib/notify-observer.ts
40
+ function notifyObserver(observer, ...args) {
41
+ const report = (cause) => globalThis.reportError?.(cause);
42
+ try {
43
+ const result = observer?.(...args);
44
+ if (result && typeof result.then === "function") {
45
+ void Promise.resolve(result).catch(report);
46
+ }
47
+ } catch (cause) {
48
+ report(cause);
49
+ }
50
+ }
51
+
52
+ // src/hooks/use-composer.ts
53
+ function initialComposerShadow(seed) {
54
+ if (!seed || !seed.text && !seed.resources?.length && !seed.annotations?.length && !seed.policy)
55
+ return void 0;
56
+ return {
57
+ text: seed.text,
58
+ resources: [...seed.resources ?? []],
59
+ annotations: cloneAnnotations(seed.annotations ?? []),
60
+ ...seed.policy ? { policy: { ...seed.policy } } : {}
61
+ };
62
+ }
63
+ var PENDING_COMPOSER_STORAGE_PREFIX = "opengeni.pending-composer.v1:";
64
+ var OPTIMISTIC_SEND_STORAGE_PREFIX = "opengeni.optimistic-sends.v1:";
65
+ var pendingComposerOperations = /* @__PURE__ */ new Map();
66
+ var optimisticSendOperations = /* @__PURE__ */ new Map();
67
+ function pendingComposerOperationKey(workspaceId, sessionId) {
68
+ return sessionId ? `${workspaceId}\0${sessionId}` : null;
69
+ }
70
+ function pendingComposerStorage() {
71
+ try {
72
+ return typeof window === "undefined" ? null : window.sessionStorage;
73
+ } catch {
74
+ return null;
75
+ }
76
+ }
77
+ function forgetAllComposerOperations() {
78
+ pendingComposerOperations.clear();
79
+ optimisticSendOperations.clear();
80
+ const storage = pendingComposerStorage();
81
+ if (!storage) return;
82
+ try {
83
+ const keys = [];
84
+ for (let index = 0; index < storage.length; index += 1) {
85
+ const key = storage.key(index);
86
+ if (key?.startsWith(PENDING_COMPOSER_STORAGE_PREFIX) || key?.startsWith(OPTIMISTIC_SEND_STORAGE_PREFIX))
87
+ keys.push(key);
88
+ }
89
+ for (const key of keys) storage.removeItem(key);
90
+ } catch {
91
+ }
92
+ }
93
+ function pendingComposerStorageKey(key) {
94
+ return `${PENDING_COMPOSER_STORAGE_PREFIX}${encodeURIComponent(key)}`;
95
+ }
96
+ function optimisticSendStorageKey(key) {
97
+ return `${OPTIMISTIC_SEND_STORAGE_PREFIX}${encodeURIComponent(key)}`;
98
+ }
99
+ function restoreOptimisticSendOperations(t, key, canBuyCredits = true) {
100
+ if (!key) return [];
101
+ let stored = optimisticSendOperations.get(key);
102
+ if (!stored) {
103
+ const storage = pendingComposerStorage();
104
+ try {
105
+ const parsed = JSON.parse(storage?.getItem(optimisticSendStorageKey(key)) ?? "[]");
106
+ stored = Array.isArray(parsed) ? parsed.filter(
107
+ (candidate) => typeof candidate === "object" && candidate !== null && typeof candidate.clientEventId === "string" && typeof candidate.text === "string" && typeof candidate.occurredAt === "string" && (candidate.state === "sending" || candidate.state === "failed") && typeof candidate.input === "object" && candidate.input !== null && typeof candidate.input.text === "string" && typeof candidate.hasMcpCredentialUpdates === "boolean"
108
+ ) : [];
109
+ } catch {
110
+ stored = [];
111
+ }
112
+ }
113
+ return stored.map(({ hasMcpCredentialUpdates, ...operation }) => ({
114
+ ...operation,
115
+ delivery: "send",
116
+ steerOrSend: operation.steerOrSend === true,
117
+ destination: operation.destination === "queue" ? "queue" : "chat",
118
+ newerShadow: operation.newerShadow ?? { text: "", resources: [], annotations: [] },
119
+ state: operation.state === "sending" || operation.state === "queued" ? "sending" : operation.state,
120
+ outcomeUnknown: operation.state === "sending" || operation.state === "queued" ? true : operation.outcomeUnknown,
121
+ correlationId: restoredCorrelationId(operation.correlationId),
122
+ error: restoredErrorReference(
123
+ t,
124
+ operation.correlationId,
125
+ hasMcpCredentialUpdates && (operation.state === "sending" || operation.outcomeUnknown) ? composerSubmissionErrorMessage(t, new ComposerReconciliationRequiredError()) : operation.state === "sending" ? t("hooks.useComposer.deliveryWasInterruptedRetryTo") : operation.outcomeUnknown ? t("hooks.useComposer.theRequestCouldNotBe") : operation.error ? composerSubmissionErrorMessage(t, new Error(operation.error), canBuyCredits) : void 0
126
+ ),
127
+ retryable: operation.state === "sending" || operation.outcomeUnknown ? true : operation.retryable ?? (operation.error ? composerSubmissionCanRetry(new Error(operation.error)) : true),
128
+ input: operation.input,
129
+ canRetry: !hasMcpCredentialUpdates
130
+ }));
131
+ }
132
+ function restoredCorrelationId(value) {
133
+ return typeof value === "string" && /^[\w.:-]{1,128}$/u.test(value) ? value : void 0;
134
+ }
135
+ function rejectsSteerOrSend(error) {
136
+ return error instanceof OpenGeniApiError && (error.status === 400 || error.status === 422) && /\bdelivery\b/u.test(`${error.message}
137
+ ${error.body}`);
138
+ }
139
+ function restoredErrorReference(t, reference, message) {
140
+ const correlationId = restoredCorrelationId(reference);
141
+ return message && correlationId && !isComposerSelectionRefusalMessage(message) && message !== t("lib.format.modelUnavailable") && message !== t("lib.format.accountUnavailable") ? t("hooks.useComposer.messageReferenceCorrelationid", { message, correlationId }) : message;
142
+ }
143
+ function rememberOptimisticSendOperations(key, operations) {
144
+ if (!key) return;
145
+ const stored = operations.filter((operation) => operation.state !== "queued").map((operation) => {
146
+ const { canRetry: _canRetry, input, ...rest } = operation;
147
+ const { mcpCredentialUpdates: _credentials, ...safeInput } = input;
148
+ return {
149
+ ...rest,
150
+ input: safeInput,
151
+ hasMcpCredentialUpdates: input.mcpCredentialUpdates !== void 0
152
+ };
153
+ });
154
+ if (stored.length === 0) {
155
+ optimisticSendOperations.delete(key);
156
+ try {
157
+ pendingComposerStorage()?.removeItem(optimisticSendStorageKey(key));
158
+ } catch {
159
+ }
160
+ return;
161
+ }
162
+ optimisticSendOperations.set(key, stored);
163
+ try {
164
+ pendingComposerStorage()?.setItem(optimisticSendStorageKey(key), JSON.stringify(stored));
165
+ } catch {
166
+ }
167
+ }
168
+ function resourceList(value) {
169
+ return Array.isArray(value) && value.every((candidate) => {
170
+ if (typeof candidate !== "object" || candidate === null) return false;
171
+ const resource = candidate;
172
+ return resource.kind === "file" ? typeof resource.fileId === "string" : resource.kind === "repository" && typeof resource.uri === "string" && typeof resource.ref === "string";
173
+ });
174
+ }
175
+ function timelineAnnotationList(value) {
176
+ return Array.isArray(value) && value.every((candidate) => {
177
+ if (typeof candidate !== "object" || candidate === null) return false;
178
+ const annotation = candidate;
179
+ const source = annotation.source;
180
+ if (typeof source !== "object" || source === null) return false;
181
+ const sourceRecord = source;
182
+ return typeof annotation.id === "string" && typeof annotation.quote === "string" && typeof annotation.note === "string" && typeof sourceRecord.eventId === "string" && typeof sourceRecord.eventType === "string" && typeof sourceRecord.sequence === "number" && (typeof sourceRecord.turnId === "string" || sourceRecord.turnId === null) && typeof sourceRecord.startOffset === "number" && typeof sourceRecord.endOffset === "number" && typeof sourceRecord.contextBefore === "string" && typeof sourceRecord.contextAfter === "string";
183
+ });
184
+ }
185
+ function cloneAnnotations(annotations) {
186
+ return annotations.map((annotation) => ({
187
+ ...annotation,
188
+ source: { ...annotation.source }
189
+ }));
190
+ }
191
+ function readStoredPendingComposerOperation(key) {
192
+ const storage = key ? pendingComposerStorage() : null;
193
+ if (!storage || !key) return null;
194
+ try {
195
+ const parsed = JSON.parse(storage.getItem(pendingComposerStorageKey(key)) ?? "null");
196
+ if (typeof parsed !== "object" || parsed === null) return null;
197
+ const record = parsed;
198
+ const input = record.input;
199
+ const shadow = record.newerShadow;
200
+ if (typeof input !== "object" || input === null || typeof shadow !== "object" || shadow === null) {
201
+ return null;
202
+ }
203
+ const inputRecord = input;
204
+ const shadowRecord = shadow;
205
+ if (record.delivery !== "send" && record.delivery !== "steer" || typeof record.draftAtSend !== "string" || !resourceList(record.resourcesAtSend) || record.annotationsAtSend !== void 0 && !timelineAnnotationList(record.annotationsAtSend) || typeof shadowRecord.text !== "string" || !resourceList(shadowRecord.resources) || shadowRecord.annotations !== void 0 && !timelineAnnotationList(shadowRecord.annotations) || typeof record.clearDraftOnAccept !== "boolean" || typeof record.hasMcpCredentialUpdates !== "boolean" || typeof inputRecord.text !== "string" || typeof inputRecord.clientEventId !== "string" || "mcpCredentialUpdates" in inputRecord || "resources" in inputRecord && !resourceList(inputRecord.resources) || "annotations" in inputRecord && !timelineAnnotationList(inputRecord.annotations)) {
206
+ return null;
207
+ }
208
+ return {
209
+ ...record,
210
+ steerOrSend: record.steerOrSend === true,
211
+ annotationsAtSend: timelineAnnotationList(record.annotationsAtSend) ? record.annotationsAtSend : [],
212
+ newerShadow: {
213
+ ...shadow,
214
+ annotations: timelineAnnotationList(shadowRecord.annotations) ? shadowRecord.annotations : []
215
+ }
216
+ };
217
+ } catch {
218
+ return null;
219
+ }
220
+ }
221
+ function writePendingComposerOperation(key, operation) {
222
+ const storage = pendingComposerStorage();
223
+ if (!storage) return;
224
+ try {
225
+ storage.setItem(pendingComposerStorageKey(key), JSON.stringify(operation));
226
+ } catch {
227
+ }
228
+ }
229
+ function restorePendingComposerOperation(key) {
230
+ const stored = (key && pendingComposerOperations.get(key)) ?? readStoredPendingComposerOperation(key);
231
+ if (!stored) return null;
232
+ return {
233
+ ...stored,
234
+ input: stored.input,
235
+ newerShadow: stored.newerShadow ?? {
236
+ text: stored.draftAtSend,
237
+ resources: stored.resourcesAtSend,
238
+ annotations: stored.annotationsAtSend
239
+ },
240
+ canRetry: !stored.hasMcpCredentialUpdates
241
+ };
242
+ }
243
+ function rememberPendingComposerOperation(key, operation) {
244
+ if (!key) return;
245
+ const { canRetry: _retry, ...safeOperation } = operation;
246
+ const { input: originalInput, ...withoutInput } = safeOperation;
247
+ const { mcpCredentialUpdates: _storedMcp, ...safeInput } = originalInput;
248
+ const stored = {
249
+ ...withoutInput,
250
+ input: safeInput,
251
+ hasMcpCredentialUpdates: operation.input.mcpCredentialUpdates !== void 0,
252
+ newerShadow: {
253
+ text: operation.newerShadow.text,
254
+ resources: [...operation.newerShadow.resources],
255
+ annotations: cloneAnnotations(operation.newerShadow.annotations),
256
+ ...operation.newerShadow.policy ? { policy: { ...operation.newerShadow.policy } } : {}
257
+ }
258
+ };
259
+ pendingComposerOperations.set(key, stored);
260
+ writePendingComposerOperation(key, stored);
261
+ }
262
+ function forgetPendingComposerOperation(key) {
263
+ if (!key) return;
264
+ pendingComposerOperations.delete(key);
265
+ const storage = pendingComposerStorage();
266
+ if (!storage) return;
267
+ try {
268
+ storage.removeItem(pendingComposerStorageKey(key));
269
+ } catch {
270
+ }
271
+ }
272
+ function updatePendingComposerShadow(key, operation, shadow) {
273
+ if (!key || !operation) return operation;
274
+ const next = {
275
+ ...operation,
276
+ newerShadow: {
277
+ ...shadow,
278
+ resources: [...shadow.resources],
279
+ annotations: cloneAnnotations(shadow.annotations)
280
+ }
281
+ };
282
+ rememberPendingComposerOperation(key, next);
283
+ return next;
284
+ }
285
+ var SERVICE_SEND_RETRY_MAX_DELAY_MS = 8e3;
286
+ var STEERING_SETTLEMENT_EVENT_TYPES = /* @__PURE__ */ new Set([
287
+ "turn.started",
288
+ "turn.completed",
289
+ "turn.failed",
290
+ "turn.cancelled",
291
+ "turn.superseded"
292
+ ]);
293
+ function isSteeringSettlementEvent(event) {
294
+ return STEERING_SETTLEMENT_EVENT_TYPES.has(event.type);
295
+ }
296
+ function steeringAcceptedEvent(steering, events) {
297
+ return events.find(
298
+ (event) => event.type === "user.message" && steering.clientEventId !== null && event.clientEventId === steering.clientEventId
299
+ );
300
+ }
301
+ function promptTurnIdForTrigger(triggerEventId, events) {
302
+ if (!triggerEventId) return null;
303
+ const queued = events.find((event) => {
304
+ if (event.type !== "turn.queued") return false;
305
+ const payload2 = event.payload;
306
+ return typeof payload2 === "object" && payload2 !== null && "triggerEventId" in payload2 && payload2.triggerEventId === triggerEventId;
307
+ });
308
+ if (!queued) return null;
309
+ if (queued.turnId) return queued.turnId;
310
+ const payload = queued.payload;
311
+ return typeof payload === "object" && payload !== null && "turnId" in payload && typeof payload.turnId === "string" ? payload.turnId : null;
312
+ }
313
+ function steeringSettledByEvents(steering, events) {
314
+ const acceptedEventId = steering.triggerEventId ?? steeringAcceptedEvent(steering, events)?.id ?? null;
315
+ return events.some((event) => {
316
+ if (steering.turnId && event.turnId === steering.turnId && isSteeringSettlementEvent(event)) {
317
+ return true;
318
+ }
319
+ if (event.type !== "turn.started" || !acceptedEventId) return false;
320
+ const payload = event.payload;
321
+ return typeof payload === "object" && payload !== null && "triggerEventId" in payload && payload.triggerEventId === acceptedEventId;
322
+ });
323
+ }
324
+ function reconcileOptimisticSendFromEvents(operation, events) {
325
+ const accepted = events.find(
326
+ (event) => event.type === "user.message" && event.clientEventId === operation.clientEventId
327
+ );
328
+ const triggerEventId = operation.triggerEventId ?? accepted?.id ?? null;
329
+ const turnId = operation.turnId ?? promptTurnIdForTrigger(triggerEventId, events);
330
+ const acceptedRouting = promptRoutingFromAcceptedEvent(accepted ?? null);
331
+ const destination = acceptedRouting === "queued_for_execution" ? "queue" : acceptedRouting === "accepted_for_execution" || acceptedRouting === "accepted_for_steering" ? "chat" : operation.destination;
332
+ const needsAdmissionUpdate = accepted !== void 0 && (operation.state !== "queued" || operation.destination !== destination || operation.triggerEventId !== triggerEventId || operation.turnId !== turnId || operation.error !== void 0 || operation.outcomeUnknown !== false);
333
+ const reconciled = needsAdmissionUpdate ? {
334
+ ...operation,
335
+ state: "queued",
336
+ destination,
337
+ triggerEventId,
338
+ turnId,
339
+ error: void 0,
340
+ outcomeUnknown: false
341
+ } : operation;
342
+ const withdrawnFromQueue = events.some((event) => {
343
+ if (event.type !== "session.queue.changed" || !turnId) return false;
344
+ const payload = event.payload;
345
+ if (typeof payload !== "object" || payload === null || Array.isArray(payload)) return false;
346
+ const record = payload;
347
+ return record.turnId === turnId && (record.operation === "edit" || record.operation === "delete");
348
+ });
349
+ return {
350
+ operation: reconciled,
351
+ admitted: accepted !== void 0,
352
+ // Edit/Delete atomically withdraw the queued turn. Keeping its optimistic
353
+ // send alive after that point lets its old `newerShadow` become the newest
354
+ // composer draft again when a later turn settles, duplicating submitted
355
+ // text. The queue mutation is the durable terminal fact for this send.
356
+ settled: withdrawnFromQueue || steeringSettledByEvents(
357
+ {
358
+ phase: "accepted",
359
+ text: reconciled.text,
360
+ clientEventId: reconciled.clientEventId,
361
+ triggerEventId: reconciled.triggerEventId ?? null,
362
+ turnId: reconciled.turnId ?? null
363
+ },
364
+ events
365
+ )
366
+ };
367
+ }
368
+ function useComposer(sessionId, options = {}) {
369
+ const t = useOpenGeniText();
370
+ const { client, workspaceId, registerSessionReconciler, workspaceDraftsEvent } = useEmbeddedSession(options);
371
+ const formatError = useErrorMessage();
372
+ const durableDrafts = options.draftPersistence !== "disabled";
373
+ if (!durableDrafts && !options.initialPolicy) {
374
+ throw new Error("useComposer requires initialPolicy when draft persistence is disabled");
375
+ }
376
+ const targetKey = `${workspaceId}\0${sessionId ?? ""}\0${durableDrafts ? "durable" : "disabled"}`;
377
+ const pendingOperationKey = pendingComposerOperationKey(workspaceId, sessionId);
378
+ const initialPendingOperation = restorePendingComposerOperation(pendingOperationKey);
379
+ const initialOptimisticSends = restoreOptimisticSendOperations(
380
+ t,
381
+ pendingOperationKey,
382
+ options.canBuyCredits ?? true
383
+ );
384
+ const initialShadow = initialPendingOperation?.newerShadow ?? initialOptimisticSends.at(-1)?.newerShadow ?? initialComposerShadow(options.initialDraft);
385
+ const [value, setValue] = useState(() => initialShadow?.text ?? "");
386
+ const [annotations, setAnnotations] = useState(
387
+ () => initialShadow?.annotations ?? []
388
+ );
389
+ const [annotationReviewTargetId, setAnnotationReviewTargetId] = useState(null);
390
+ const [stateTargetKey, setStateTargetKey] = useState(targetKey);
391
+ const [sending, setSending] = useState(false);
392
+ const [optimisticSends, setOptimisticSends] = useState(initialOptimisticSends);
393
+ const [steering, setSteering] = useState(
394
+ () => initialPendingOperation?.delivery === "steer" ? {
395
+ phase: "failed",
396
+ text: initialPendingOperation.input.text,
397
+ clientEventId: initialPendingOperation.input.clientEventId ?? null,
398
+ triggerEventId: null,
399
+ turnId: null,
400
+ error: t("hooks.useComposer.notConfirmedRetryToCheck"),
401
+ outcomeUnknown: true
402
+ } : null
403
+ );
404
+ const [pausing, setPausing] = useState(false);
405
+ const [acceptedControl, setAcceptedControl] = useState(null);
406
+ const [resuming, setResuming] = useState(false);
407
+ const [error, setError] = useState(null);
408
+ const [draftReadError, setDraftReadError] = useState(null);
409
+ const [draftHydrationRetrying, setDraftHydrationRetrying] = useState(false);
410
+ const [draft, setDraft] = useState(null);
411
+ const [draftLoading, setDraftLoading] = useState(Boolean(sessionId) && durableDrafts);
412
+ const [draftSaving, setDraftSaving] = useState(false);
413
+ const [draftConflict, setDraftConflict] = useState(null);
414
+ const [policy, setPolicy] = useState(
415
+ () => initialShadow?.policy ?? options.initialPolicy ?? null
416
+ );
417
+ const [restoredResources, setRestoredResources] = useState(
418
+ () => initialShadow?.resources ?? []
419
+ );
420
+ const pendingOperationRef = useRef(initialPendingOperation);
421
+ const optimisticSendsRef = useRef(initialOptimisticSends);
422
+ const optimisticProcessorBusyRef = useRef(false);
423
+ const serviceWaitRef = useRef(
424
+ /* @__PURE__ */ new Map()
425
+ );
426
+ const serviceRetryTimerRef = useRef(null);
427
+ const processOptimisticSendsRef = useRef(() => void 0);
428
+ const [serviceWaiting, setServiceWaiting] = useState(false);
429
+ const [autosaveRetry, setAutosaveRetry] = useState(0);
430
+ const optimisticCallbackIdsRef = useRef(/* @__PURE__ */ new Set());
431
+ const steeringSettlementEventsRef = useRef([]);
432
+ const steeringRef = useRef(steering);
433
+ const steeringOccurredAtRef = useRef((/* @__PURE__ */ new Date()).toISOString());
434
+ const pendingClientEventId = useRef(
435
+ initialPendingOperation?.input.clientEventId ?? null
436
+ );
437
+ const valueRef = useRef(initialShadow?.text ?? "");
438
+ const annotationsRef = useRef(initialShadow?.annotations ?? []);
439
+ const policyRef = useRef(
440
+ initialShadow?.policy ?? options.initialPolicy ?? null
441
+ );
442
+ const policyPickedRef = useRef(!durableDrafts || initialShadow?.policy !== void 0);
443
+ const [policyPicked, setPolicyPicked] = useState(policyPickedRef.current);
444
+ const draftRef = useRef(null);
445
+ const restoredResourcesRef = useRef(initialShadow?.resources ?? []);
446
+ const localEditRevision = useRef(initialShadow ? 1 : 0);
447
+ const targetGeneration = useRef(0);
448
+ const draftReadGeneration = useRef(0);
449
+ const draftReadInFlightRef = useRef(null);
450
+ const draftRereadPendingRef = useRef(null);
451
+ const draftReadAbortRef = useRef(null);
452
+ const draftReadRetryRef = useRef({ targetKey, failures: 0, timer: null });
453
+ const lastSavedSignature = useRef(null);
454
+ const sendBasisRef = useRef(null);
455
+ const saveChain = useRef(Promise.resolve());
456
+ const savePickPromptlyRef = useRef(false);
457
+ const unsavedDraftRef = useRef(null);
458
+ const settledWritesRef = useRef(/* @__PURE__ */ new Map());
459
+ const draftFencedSendRef = useRef(false);
460
+ const draftWriteUnconfirmedRef = useRef(false);
461
+ const unkeptSendRef = useRef(null);
462
+ const onSentRef = useRef(options.onSent);
463
+ onSentRef.current = options.onSent;
464
+ const onSubmittedRef = useRef(options.onSubmitted);
465
+ onSubmittedRef.current = options.onSubmitted;
466
+ const onSent = useCallback((text, input) => {
467
+ notifyObserver(onSentRef.current, text, input);
468
+ }, []);
469
+ const onSubmitted = useCallback((text, input) => {
470
+ notifyObserver(onSubmittedRef.current, text, input);
471
+ }, []);
472
+ const onDeliveryErrorRef = useRef(options.onDeliveryError);
473
+ onDeliveryErrorRef.current = options.onDeliveryError;
474
+ const reviseRefusedAccountsRef = useRef(options.reviseRefusedAccounts);
475
+ reviseRefusedAccountsRef.current = options.reviseRefusedAccounts;
476
+ useLayoutEffect(() => {
477
+ steeringRef.current = steering;
478
+ }, [steering]);
479
+ const sendExtrasRef = useRef(options.sendExtras);
480
+ sendExtrasRef.current = options.sendExtras;
481
+ const sendDestinationRef = useRef(options.sendDestination);
482
+ sendDestinationRef.current = options.sendDestination;
483
+ const busySend = options.busySend ?? "queue";
484
+ const busySendRef = useRef(busySend);
485
+ busySendRef.current = busySend;
486
+ const steerOrSendUnsupportedRef = useRef(false);
487
+ const singleSend = busySend === "steer" && options.offerQueue !== true;
488
+ const sendBlockedRef = useRef(options.sendBlocked);
489
+ sendBlockedRef.current = options.sendBlocked;
490
+ const canBuyCreditsRef = useRef(options.canBuyCredits ?? true);
491
+ canBuyCreditsRef.current = options.canBuyCredits ?? true;
492
+ const effectiveControlRef = useRef(
493
+ acceptedControl ?? options.effectiveControl ?? null
494
+ );
495
+ effectiveControlRef.current = acceptedControl ?? options.effectiveControl ?? null;
496
+ const liveExtrasVersion = JSON.stringify(resolveSendExtras(options.sendExtras));
497
+ const targetKeyRef = useRef(targetKey);
498
+ useLayoutEffect(() => {
499
+ if (targetKeyRef.current === targetKey) return;
500
+ saveLeftDraft(unsavedDraftRef, settledWritesRef.current, saveChain.current);
501
+ if (draftReadRetryRef.current.timer !== null) {
502
+ clearTimeout(draftReadRetryRef.current.timer);
503
+ }
504
+ draftReadAbortRef.current?.abort();
505
+ draftReadAbortRef.current = null;
506
+ draftReadRetryRef.current = { targetKey, failures: 0, timer: null };
507
+ targetKeyRef.current = targetKey;
508
+ targetGeneration.current += 1;
509
+ draftReadGeneration.current += 1;
510
+ pendingOperationRef.current = restorePendingComposerOperation(pendingOperationKey);
511
+ const restoredOptimisticSends = restoreOptimisticSendOperations(
512
+ t,
513
+ pendingOperationKey,
514
+ canBuyCreditsRef.current
515
+ );
516
+ optimisticSendsRef.current = restoredOptimisticSends;
517
+ optimisticProcessorBusyRef.current = false;
518
+ serviceWaitRef.current = /* @__PURE__ */ new Map();
519
+ if (serviceRetryTimerRef.current !== null) clearTimeout(serviceRetryTimerRef.current);
520
+ serviceRetryTimerRef.current = null;
521
+ setServiceWaiting(false);
522
+ optimisticCallbackIdsRef.current = /* @__PURE__ */ new Set();
523
+ steeringSettlementEventsRef.current = [];
524
+ pendingClientEventId.current = pendingOperationRef.current?.input.clientEventId ?? null;
525
+ const shadow = pendingOperationRef.current?.newerShadow ?? restoredOptimisticSends.at(-1)?.newerShadow ?? initialComposerShadow(options.initialDraft);
526
+ localEditRevision.current = shadow ? 1 : 0;
527
+ valueRef.current = shadow?.text ?? "";
528
+ annotationsRef.current = shadow?.annotations ?? [];
529
+ policyRef.current = shadow?.policy ?? options.initialPolicy ?? null;
530
+ policyPickedRef.current = !durableDrafts || shadow?.policy !== void 0;
531
+ setPolicyPicked(policyPickedRef.current);
532
+ draftRef.current = null;
533
+ sendBasisRef.current = null;
534
+ draftWriteUnconfirmedRef.current = false;
535
+ restoredResourcesRef.current = shadow?.resources ?? [];
536
+ lastSavedSignature.current = null;
537
+ savePickPromptlyRef.current = false;
538
+ saveChain.current = Promise.resolve();
539
+ setStateTargetKey(targetKey);
540
+ setValue(shadow?.text ?? "");
541
+ setAnnotations(shadow?.annotations ?? []);
542
+ setPolicy(policyRef.current);
543
+ setAnnotationReviewTargetId(null);
544
+ setSending(false);
545
+ setOptimisticSends(restoredOptimisticSends);
546
+ setSteering(
547
+ pendingOperationRef.current?.delivery === "steer" ? {
548
+ phase: "failed",
549
+ text: pendingOperationRef.current.input.text,
550
+ clientEventId: pendingOperationRef.current.input.clientEventId ?? null,
551
+ triggerEventId: null,
552
+ turnId: null,
553
+ error: t("hooks.useComposer.notConfirmedRetryToCheck"),
554
+ outcomeUnknown: true
555
+ } : null
556
+ );
557
+ setPausing(false);
558
+ setAcceptedControl(null);
559
+ setResuming(false);
560
+ setError(null);
561
+ setDraftReadError(null);
562
+ setDraftHydrationRetrying(false);
563
+ setDraft(null);
564
+ setDraftLoading(Boolean(sessionId) && durableDrafts);
565
+ setDraftSaving(false);
566
+ setDraftConflict(null);
567
+ setRestoredResources(shadow?.resources ?? []);
568
+ }, [
569
+ durableDrafts,
570
+ options.initialPolicy,
571
+ options.initialDraft,
572
+ pendingOperationKey,
573
+ sessionId,
574
+ targetKey,
575
+ t
576
+ ]);
577
+ useEffect(
578
+ () => () => {
579
+ saveLeftDraft(unsavedDraftRef, settledWritesRef.current, saveChain.current);
580
+ if (draftReadRetryRef.current.timer !== null) {
581
+ clearTimeout(draftReadRetryRef.current.timer);
582
+ }
583
+ if (serviceRetryTimerRef.current !== null) clearTimeout(serviceRetryTimerRef.current);
584
+ serviceRetryTimerRef.current = null;
585
+ targetGeneration.current += 1;
586
+ draftReadGeneration.current += 1;
587
+ draftReadInFlightRef.current = null;
588
+ draftRereadPendingRef.current = null;
589
+ draftReadAbortRef.current?.abort();
590
+ draftReadAbortRef.current = null;
591
+ },
592
+ []
593
+ );
594
+ const setOptimisticDraftShadow = useCallback(
595
+ (shadow) => {
596
+ if (optimisticSendsRef.current.length === 0) return;
597
+ const next = optimisticSendsRef.current.map((operation) => ({
598
+ ...operation,
599
+ newerShadow: {
600
+ text: shadow.text,
601
+ resources: [...shadow.resources],
602
+ annotations: cloneAnnotations(shadow.annotations),
603
+ ...shadow.policy ? { policy: { ...shadow.policy } } : {}
604
+ }
605
+ }));
606
+ optimisticSendsRef.current = next;
607
+ rememberOptimisticSendOperations(pendingOperationKey, next);
608
+ setOptimisticSends(next);
609
+ },
610
+ [pendingOperationKey]
611
+ );
612
+ const applyDraft = useCallback(
613
+ (next) => {
614
+ if (targetKeyRef.current !== targetKey) return;
615
+ if (!durableDrafts) {
616
+ const nextPolicy2 = policyFromDraft(next);
617
+ localEditRevision.current += 1;
618
+ valueRef.current = next.text;
619
+ annotationsRef.current = next.annotations ?? [];
620
+ policyRef.current = nextPolicy2;
621
+ restoredResourcesRef.current = next.resources;
622
+ draftRef.current = null;
623
+ sendBasisRef.current = null;
624
+ lastSavedSignature.current = null;
625
+ setDraft(null);
626
+ setValue(next.text);
627
+ setAnnotations(next.annotations ?? []);
628
+ setPolicy(nextPolicy2);
629
+ setRestoredResources(next.resources);
630
+ pendingOperationRef.current = updatePendingComposerShadow(
631
+ pendingOperationKey,
632
+ pendingOperationRef.current,
633
+ {
634
+ text: next.text,
635
+ resources: mergeResources(
636
+ next.resources,
637
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
638
+ ),
639
+ annotations: next.annotations ?? [],
640
+ policy: nextPolicy2
641
+ }
642
+ );
643
+ setOptimisticDraftShadow({
644
+ text: next.text,
645
+ resources: mergeResources(
646
+ next.resources,
647
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
648
+ ),
649
+ annotations: next.annotations ?? [],
650
+ policy: nextPolicy2
651
+ });
652
+ setDraftConflict(null);
653
+ return;
654
+ }
655
+ const nextPolicy = policyFromDraft(next);
656
+ valueRef.current = next.text;
657
+ annotationsRef.current = next.annotations ?? [];
658
+ policyRef.current = nextPolicy;
659
+ policyPickedRef.current = !next.policyFollowsSession;
660
+ setPolicyPicked(policyPickedRef.current);
661
+ draftRef.current = next;
662
+ sendBasisRef.current = next.revision;
663
+ restoredResourcesRef.current = next.resources;
664
+ lastSavedSignature.current = draftSignature(draftPayload(next));
665
+ localEditRevision.current += 1;
666
+ setDraft(next);
667
+ setValue(next.text);
668
+ setAnnotations(next.annotations ?? []);
669
+ setPolicy(nextPolicy);
670
+ setRestoredResources(next.resources);
671
+ pendingOperationRef.current = updatePendingComposerShadow(
672
+ pendingOperationKey,
673
+ pendingOperationRef.current,
674
+ {
675
+ text: next.text,
676
+ resources: mergeResources(
677
+ next.resources,
678
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
679
+ ),
680
+ annotations: next.annotations ?? [],
681
+ policy: pickedPolicy(policyPickedRef, policyRef)
682
+ }
683
+ );
684
+ setOptimisticDraftShadow({
685
+ text: next.text,
686
+ resources: mergeResources(
687
+ next.resources,
688
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
689
+ ),
690
+ annotations: next.annotations ?? [],
691
+ policy: pickedPolicy(policyPickedRef, policyRef)
692
+ });
693
+ setDraftConflict(null);
694
+ },
695
+ [durableDrafts, pendingOperationKey, setOptimisticDraftShadow, targetKey]
696
+ );
697
+ const keepNewerDraftAfterSend = useCallback(() => {
698
+ const base = draftRef.current;
699
+ if (!base || !policyRef.current || valueRef.current !== "" || restoredResourcesRef.current.length > 0 || annotationsRef.current.length > 0) {
700
+ return;
701
+ }
702
+ lastSavedSignature.current = draftSignature(
703
+ composerDraftPayload(
704
+ base,
705
+ valueRef.current,
706
+ restoredResourcesRef.current,
707
+ annotationsRef.current,
708
+ pickedPolicy(policyPickedRef, policyRef),
709
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
710
+ )
711
+ );
712
+ }, []);
713
+ const loadDraft = useCallback(
714
+ async (replaceLocal) => {
715
+ if (targetKeyRef.current !== targetKey) return;
716
+ if (!sessionId || !durableDrafts) {
717
+ setDraftLoading(false);
718
+ setDraftReadError(null);
719
+ setDraftHydrationRetrying(false);
720
+ return;
721
+ }
722
+ let retry = draftReadRetryRef.current;
723
+ if (retry.targetKey !== targetKey) {
724
+ if (retry.timer !== null) clearTimeout(retry.timer);
725
+ retry = { targetKey, failures: 0, timer: null };
726
+ draftReadRetryRef.current = retry;
727
+ }
728
+ const scheduleRetry = () => {
729
+ if (retry.timer !== null) return;
730
+ retry.timer = setTimeout(
731
+ () => {
732
+ if (draftReadRetryRef.current !== retry || targetKeyRef.current !== targetKey) return;
733
+ retry.timer = null;
734
+ void loadDraft(false);
735
+ },
736
+ Math.min(25e3, 1e3 * 2 ** (retry.failures - 1)) * (0.8 + Math.random() * 0.4)
737
+ );
738
+ };
739
+ if (!replaceLocal && retry.timer !== null) return;
740
+ if (draftReadInFlightRef.current === targetKey) {
741
+ if (!replaceLocal) draftRereadPendingRef.current = targetKey;
742
+ return;
743
+ }
744
+ if (retry.timer !== null) {
745
+ clearTimeout(retry.timer);
746
+ retry.timer = null;
747
+ }
748
+ draftReadInFlightRef.current = targetKey;
749
+ const generation = targetGeneration.current;
750
+ const readTicket = ++draftReadGeneration.current;
751
+ const requestAbort = new AbortController();
752
+ draftReadAbortRef.current?.abort();
753
+ draftReadAbortRef.current = requestAbort;
754
+ const localAtStart = localEditRevision.current;
755
+ const baseAtStart = draftRef.current;
756
+ const policyAtStart = policyRef.current;
757
+ const localSignatureAtStart = baseAtStart ? policyAtStart ? draftSignature(
758
+ composerDraftPayload(
759
+ baseAtStart,
760
+ valueRef.current,
761
+ restoredResourcesRef.current,
762
+ annotationsRef.current,
763
+ pickedPolicy(policyPickedRef, policyRef),
764
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
765
+ )
766
+ ) : null : null;
767
+ const localWasDirtyAtStart = localSignatureAtStart === null ? localAtStart !== 0 : localSignatureAtStart !== lastSavedSignature.current;
768
+ const showLoading = replaceLocal || draftRef.current === null;
769
+ if (showLoading) {
770
+ setDraftLoading(true);
771
+ }
772
+ try {
773
+ const leftSave = leftDraftSaves.get(`${workspaceId}\0${sessionId}`);
774
+ if (leftSave) await Promise.race([leftSave, delay(LEFT_DRAFT_SAVE_WAIT_MS)]);
775
+ const fetched = await client.getComposerDraft(workspaceId, sessionId, {
776
+ signal: requestAbort.signal
777
+ });
778
+ if (generation !== targetGeneration.current || targetKeyRef.current !== targetKey || readTicket !== draftReadGeneration.current) {
779
+ return;
780
+ }
781
+ if (retry.timer !== null) clearTimeout(retry.timer);
782
+ retry.failures = 0;
783
+ retry.timer = null;
784
+ setDraftReadError(null);
785
+ setDraftHydrationRetrying(false);
786
+ const currentRevision = draftRef.current?.revision ?? -1;
787
+ const adoptFetchedPolicy = () => {
788
+ const fetchedPolicy = policyFromDraft(fetched);
789
+ policyPickedRef.current = !fetched.policyFollowsSession;
790
+ setPolicyPicked(policyPickedRef.current);
791
+ if (samePolicy(policyRef.current, fetchedPolicy)) return;
792
+ policyRef.current = fetchedPolicy;
793
+ setPolicy(fetchedPolicy);
794
+ };
795
+ if (replaceLocal || fetched.revision > currentRevision) {
796
+ const fetchedIsSendBasis = currentRevision === -1 || !composerDraftHasContent(fetched) || isPageDraftWrite(
797
+ `${workspaceId}\0${sessionId}`,
798
+ draftContentKey(draftPayload(fetched))
799
+ );
800
+ draftRef.current = fetched;
801
+ setDraft(fetched);
802
+ setDraftConflict(null);
803
+ const shadow = pendingOperationRef.current?.newerShadow ?? optimisticSendsRef.current.at(-1)?.newerShadow;
804
+ if (shadow) {
805
+ if (fetchedIsSendBasis) sendBasisRef.current = fetched.revision;
806
+ valueRef.current = shadow.text;
807
+ restoredResourcesRef.current = shadow.resources;
808
+ annotationsRef.current = shadow.annotations;
809
+ if (shadow.policy) {
810
+ policyRef.current = shadow.policy;
811
+ policyPickedRef.current = true;
812
+ setPolicyPicked(policyPickedRef.current);
813
+ } else if (!policyPickedRef.current) {
814
+ adoptFetchedPolicy();
815
+ }
816
+ localEditRevision.current ||= 1;
817
+ setValue(shadow.text);
818
+ setRestoredResources(shadow.resources);
819
+ setAnnotations(shadow.annotations);
820
+ if (shadow.policy) setPolicy(shadow.policy);
821
+ const fetchedContent = draftContentKey(draftPayload(fetched));
822
+ const fetchedKeepsSend = [
823
+ pendingOperationRef.current?.draftPayload,
824
+ ...optimisticSendsRef.current.map((operation) => operation.draftPayload)
825
+ ].some((payload) => payload && draftContentKey(payload) === fetchedContent);
826
+ if (!fetchedIsSendBasis || fetchedKeepsSend) keepNewerDraftAfterSend();
827
+ } else if (replaceLocal || !localWasDirtyAtStart && localAtStart === localEditRevision.current) {
828
+ sendBasisRef.current = fetched.revision;
829
+ valueRef.current = fetched.text;
830
+ restoredResourcesRef.current = fetched.resources;
831
+ annotationsRef.current = fetched.annotations ?? [];
832
+ policyRef.current = policyFromDraft(fetched);
833
+ policyPickedRef.current = !fetched.policyFollowsSession;
834
+ setPolicyPicked(policyPickedRef.current);
835
+ lastSavedSignature.current = draftSignature(draftPayload(fetched));
836
+ setValue(fetched.text);
837
+ setRestoredResources(fetched.resources);
838
+ setAnnotations(fetched.annotations ?? []);
839
+ setPolicy(policyRef.current);
840
+ } else {
841
+ if (fetchedIsSendBasis) sendBasisRef.current = fetched.revision;
842
+ lastSavedSignature.current = draftSignature(draftPayload(fetched));
843
+ if (!policyRef.current || !policyPickedRef.current) adoptFetchedPolicy();
844
+ if (!fetchedIsSendBasis) keepNewerDraftAfterSend();
845
+ }
846
+ } else if (fetched.revision === currentRevision && fetched.policyFollowsSession && !policyPickedRef.current && !samePolicy(policyRef.current, policyFromDraft(fetched))) {
847
+ draftRef.current = fetched;
848
+ setDraft(fetched);
849
+ adoptFetchedPolicy();
850
+ }
851
+ } catch (cause) {
852
+ if (!requestAbort.signal.aborted && generation === targetGeneration.current && targetKeyRef.current === targetKey && readTicket === draftReadGeneration.current) {
853
+ const problem = asError(cause);
854
+ const timedOut = problem.name === "TimeoutError";
855
+ setDraftReadError(
856
+ timedOut ? new ComposerStateError(t("hooks.useComposer.draftSyncTimedOutRetrying"), { cause }) : problem
857
+ );
858
+ if (timedOut || cause instanceof TypeError || cause && typeof cause === "object" && "retryable" in cause && cause.retryable === true) {
859
+ retry.failures += 1;
860
+ scheduleRetry();
861
+ if (draftRef.current === null) setDraftHydrationRetrying(true);
862
+ } else {
863
+ if (retry.timer !== null) clearTimeout(retry.timer);
864
+ retry.failures = 0;
865
+ retry.timer = null;
866
+ setDraftHydrationRetrying(false);
867
+ }
868
+ }
869
+ } finally {
870
+ if (generation === targetGeneration.current && targetKeyRef.current === targetKey && readTicket === draftReadGeneration.current) {
871
+ setDraftLoading(false);
872
+ }
873
+ if (draftReadInFlightRef.current === targetKey) {
874
+ draftReadInFlightRef.current = null;
875
+ }
876
+ if (draftReadAbortRef.current === requestAbort) {
877
+ draftReadAbortRef.current = null;
878
+ }
879
+ if (draftRereadPendingRef.current === targetKey) {
880
+ draftRereadPendingRef.current = null;
881
+ if (targetKeyRef.current === targetKey && draftReadInFlightRef.current === null && retry.timer === null) {
882
+ void loadDraft(false);
883
+ }
884
+ }
885
+ }
886
+ },
887
+ [client, durableDrafts, keepNewerDraftAfterSend, sessionId, targetKey, workspaceId, t]
888
+ );
889
+ useEffect(() => {
890
+ if (!sessionId || !durableDrafts) {
891
+ setDraftLoading(false);
892
+ return;
893
+ }
894
+ void loadDraft(false);
895
+ }, [durableDrafts, loadDraft, sessionId]);
896
+ useEffect(() => {
897
+ if (!sessionId || !durableDrafts || !workspaceDraftsEvent || workspaceDraftsEvent.workspaceId !== workspaceId || !workspaceDraftsEvent.sessionIds.includes(sessionId)) {
898
+ return;
899
+ }
900
+ void loadDraft(false);
901
+ }, [durableDrafts, loadDraft, sessionId, workspaceDraftsEvent, workspaceId]);
902
+ useEffect(() => {
903
+ if (!sessionId || !durableDrafts) return;
904
+ const onWake = () => {
905
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") return;
906
+ void loadDraft(false);
907
+ };
908
+ document.addEventListener("visibilitychange", onWake);
909
+ window.addEventListener("pageshow", onWake);
910
+ return () => {
911
+ document.removeEventListener("visibilitychange", onWake);
912
+ window.removeEventListener("pageshow", onWake);
913
+ };
914
+ }, [durableDrafts, loadDraft, sessionId]);
915
+ useEffect(() => {
916
+ if (!sessionId || !durableDrafts) return;
917
+ return registerSessionReconciler(sessionId, "composer", async () => await loadDraft(false));
918
+ }, [durableDrafts, loadDraft, registerSessionReconciler, sessionId]);
919
+ const reconcileSteering = useCallback(async () => {
920
+ if (!sessionId || !steeringRef.current) return;
921
+ const ownedTargetKey = targetKey;
922
+ let events;
923
+ try {
924
+ events = await client.listEvents(workspaceId, sessionId, {
925
+ includeTypes: [
926
+ "user.message",
927
+ "turn.started",
928
+ "turn.completed",
929
+ "turn.failed",
930
+ "turn.cancelled",
931
+ "turn.superseded"
932
+ ],
933
+ limit: 250,
934
+ payloadMode: "full"
935
+ });
936
+ } catch {
937
+ return;
938
+ }
939
+ if (targetKeyRef.current !== ownedTargetKey) return;
940
+ setSteering((current) => {
941
+ if (!current) return current;
942
+ if (steeringSettledByEvents(current, events)) {
943
+ steeringSettlementEventsRef.current = [];
944
+ return null;
945
+ }
946
+ const accepted = steeringAcceptedEvent(current, events);
947
+ if (!accepted || current.triggerEventId) return current;
948
+ return {
949
+ ...current,
950
+ phase: "accepted",
951
+ triggerEventId: accepted.id
952
+ };
953
+ });
954
+ }, [client, sessionId, targetKey, workspaceId]);
955
+ useSessionEventTrigger(
956
+ client,
957
+ workspaceId,
958
+ sessionId,
959
+ (event) => isComposerDraftEvent(event) || isSteeringSettlementEvent(event),
960
+ (event) => {
961
+ if (isComposerDraftEvent(event)) void loadDraft(false);
962
+ if (!isSteeringSettlementEvent(event)) return;
963
+ steeringSettlementEventsRef.current = [
964
+ ...steeringSettlementEventsRef.current.slice(-15),
965
+ event
966
+ ];
967
+ setSteering((current) => {
968
+ if (!current || !steeringSettledByEvents(current, [event])) return current;
969
+ steeringSettlementEventsRef.current = [];
970
+ return null;
971
+ });
972
+ },
973
+ {
974
+ enabled: Boolean(sessionId) && (durableDrafts || steering !== null),
975
+ ...options.events !== void 0 ? { events: options.events } : {}
976
+ },
977
+ reconcileSteering
978
+ );
979
+ useEffect(() => {
980
+ if (!steering) return;
981
+ const observed = [...options.events ?? [], ...steeringSettlementEventsRef.current];
982
+ if (!steeringSettledByEvents(steering, observed)) return;
983
+ steeringSettlementEventsRef.current = [];
984
+ setSteering(null);
985
+ }, [options.events, steering]);
986
+ useEffect(() => {
987
+ if (!acceptedControl) return;
988
+ const effectiveControl = options.effectiveControl;
989
+ if (!effectiveControl || effectiveControl.controlVersion < acceptedControl.controlVersion) {
990
+ return;
991
+ }
992
+ setAcceptedControl((current) => current === acceptedControl ? null : current);
993
+ }, [acceptedControl, options.effectiveControl]);
994
+ const pendingAcceptedControl = acceptedControl && (!options.effectiveControl || options.effectiveControl.controlVersion < acceptedControl.controlVersion) ? acceptedControl : null;
995
+ const currentDraftPayload = useCallback(() => {
996
+ if (!durableDrafts || targetKeyRef.current !== targetKey) return null;
997
+ const base = draftRef.current;
998
+ const currentPolicy = policyRef.current;
999
+ if (!base || !currentPolicy) return null;
1000
+ return composerDraftPayload(
1001
+ base,
1002
+ value,
1003
+ restoredResources,
1004
+ annotations,
1005
+ pickedPolicy(policyPickedRef, policyRef),
1006
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
1007
+ );
1008
+ }, [annotations, durableDrafts, restoredResources, targetKey, value]);
1009
+ const adoptDraftBase = useCallback(
1010
+ // `written` is false for a draft this page neither saved nor shows.
1011
+ (next, written = true) => {
1012
+ if (targetKeyRef.current !== targetKey) return;
1013
+ draftRef.current = next;
1014
+ if (written) sendBasisRef.current = next.revision;
1015
+ setDraft(next);
1016
+ const nextPolicy = policyFromDraft(next);
1017
+ if (next.policyFollowsSession) {
1018
+ if (samePolicy(policyRef.current, nextPolicy)) {
1019
+ policyPickedRef.current = false;
1020
+ setPolicyPicked(false);
1021
+ }
1022
+ if (!policyPickedRef.current && !samePolicy(policyRef.current, nextPolicy)) {
1023
+ policyRef.current = nextPolicy;
1024
+ setPolicy(nextPolicy);
1025
+ }
1026
+ }
1027
+ lastSavedSignature.current = draftSignature(draftPayload(next));
1028
+ setDraftConflict(null);
1029
+ setError(null);
1030
+ },
1031
+ [targetKey]
1032
+ );
1033
+ const followAcceptedDraft = useCallback(
1034
+ (next) => {
1035
+ adoptDraftBase(next, !composerDraftHasContent(next));
1036
+ if (!composerDraftHasContent(next)) return;
1037
+ setTimeout(() => {
1038
+ if (targetKeyRef.current !== targetKey || draftRef.current?.revision !== next.revision || valueRef.current !== "" || restoredResourcesRef.current.length > 0 || annotationsRef.current.length > 0) {
1039
+ return;
1040
+ }
1041
+ applyDraft(next);
1042
+ }, 0);
1043
+ },
1044
+ [adoptDraftBase, applyDraft, targetKey]
1045
+ );
1046
+ const acquireDraftSlot = useCallback(async () => {
1047
+ let release;
1048
+ const released = new Promise((resolve) => {
1049
+ release = resolve;
1050
+ });
1051
+ const previous = saveChain.current;
1052
+ saveChain.current = previous.then(
1053
+ () => released,
1054
+ () => released
1055
+ );
1056
+ await previous.catch(() => void 0);
1057
+ return release;
1058
+ }, []);
1059
+ const saveDraftInSlot = useCallback(
1060
+ async (payload, owner, onFailure, overNewer = true) => {
1061
+ const owned = () => targetKeyRef.current === owner.targetKey && targetGeneration.current === owner.generation;
1062
+ if (!sessionId || !durableDrafts || !owned()) return false;
1063
+ const current = draftRef.current;
1064
+ if (!current) return false;
1065
+ const unsaved = unsavedDraftRef.current;
1066
+ if (unsaved && draftContentKey(unsaved.payload) === draftContentKey(payload)) {
1067
+ unsavedDraftRef.current = null;
1068
+ }
1069
+ let request = { ...payload, expectedRevision: current.revision };
1070
+ if (draftSignature(request) === lastSavedSignature.current) return true;
1071
+ const writesKey = `${workspaceId}\0${sessionId}`;
1072
+ const fail = (problem) => {
1073
+ if (owned()) {
1074
+ if (isDraftConflictError(problem)) setDraftConflict(problem);
1075
+ else setError(problem);
1076
+ onFailure?.(problem);
1077
+ }
1078
+ return false;
1079
+ };
1080
+ setDraftSaving(true);
1081
+ try {
1082
+ for (let reread = 0; ; reread += 1) {
1083
+ let problem;
1084
+ try {
1085
+ rememberPageDraftWrite(writesKey, draftContentKey(request));
1086
+ const saved = await client.saveComposerDraft(workspaceId, sessionId, request);
1087
+ draftWriteUnconfirmedRef.current = false;
1088
+ settledWritesRef.current.set(writesKey, {
1089
+ revision: saved.revision,
1090
+ content: draftContentKey(request)
1091
+ });
1092
+ if (!owned()) return false;
1093
+ adoptDraftBase(saved);
1094
+ return true;
1095
+ } catch (cause) {
1096
+ problem = asError(cause);
1097
+ if (isOutcomeUnknownError(cause) || isTransientServiceFailure(cause)) {
1098
+ draftWriteUnconfirmedRef.current = true;
1099
+ }
1100
+ }
1101
+ if (!owned()) return false;
1102
+ if (!isDraftConflictError(problem) || reread >= DRAFT_CONFLICT_REREADS) {
1103
+ return fail(problem);
1104
+ }
1105
+ let remote;
1106
+ try {
1107
+ remote = await client.getComposerDraft(workspaceId, sessionId);
1108
+ } catch (cause) {
1109
+ return fail(asError(cause));
1110
+ }
1111
+ if (!owned()) return false;
1112
+ const remoteContent = draftContentKey(draftPayload(remote));
1113
+ if (remoteContent === draftContentKey(request)) {
1114
+ draftWriteUnconfirmedRef.current = false;
1115
+ adoptDraftBase(remote);
1116
+ return true;
1117
+ }
1118
+ if (!overNewer && !isPageDraftWrite(writesKey, remoteContent)) {
1119
+ draftRef.current = remote;
1120
+ setDraft(remote);
1121
+ return true;
1122
+ }
1123
+ draftRef.current = remote;
1124
+ setDraft(remote);
1125
+ request = { ...request, expectedRevision: remote.revision };
1126
+ }
1127
+ } finally {
1128
+ if (owned()) setDraftSaving(false);
1129
+ }
1130
+ },
1131
+ [adoptDraftBase, client, durableDrafts, sessionId, workspaceId]
1132
+ );
1133
+ const resolveSendDraftRevision = useCallback(
1134
+ async (payload, owner) => {
1135
+ let saved = false;
1136
+ if (payload && (draftFencedSendRef.current || draftWriteUnconfirmedRef.current || pickNotSaved(payload, draftRef.current)) && // A save base that is another device's draft this page never showed
1137
+ // is not saved over: the send goes ahead from the send basis.
1138
+ !sendDraftBasis(draftRef.current, sendBasisRef.current).behind) {
1139
+ let failure = null;
1140
+ saved = await saveDraftInSlot(
1141
+ payload,
1142
+ owner,
1143
+ (problem) => {
1144
+ failure = problem;
1145
+ },
1146
+ false
1147
+ );
1148
+ if (!saved && failure) {
1149
+ if (isTransientServiceFailure(failure)) {
1150
+ return { revision: void 0, saved, blocked: failure };
1151
+ }
1152
+ setError(null);
1153
+ setDraftConflict(null);
1154
+ }
1155
+ }
1156
+ const basis = sendDraftBasis(draftRef.current, sendBasisRef.current);
1157
+ if (basis.behind) keepNewerDraftAfterSend();
1158
+ return { revision: basis.revision, saved, blocked: null };
1159
+ },
1160
+ [keepNewerDraftAfterSend, saveDraftInSlot]
1161
+ );
1162
+ const keepUndeliveredSendInDraft = useCallback(
1163
+ async (payload, basis, owner) => {
1164
+ const owned = () => targetKeyRef.current === owner.targetKey && targetGeneration.current === owner.generation;
1165
+ unkeptSendRef.current = null;
1166
+ const current = draftRef.current;
1167
+ if (!sessionId || !durableDrafts || !payload || basis === void 0 || !owned() || !current) {
1168
+ return;
1169
+ }
1170
+ if (current.revision !== basis) {
1171
+ keepNewerDraftAfterSend();
1172
+ return;
1173
+ }
1174
+ const content = draftContentKey(payload);
1175
+ if (draftContentKey(draftPayload(current)) === content) {
1176
+ keepNewerDraftAfterSend();
1177
+ return;
1178
+ }
1179
+ const writesKey = `${workspaceId}\0${sessionId}`;
1180
+ try {
1181
+ rememberPageDraftWrite(writesKey, content);
1182
+ const saved = await client.saveComposerDraft(workspaceId, sessionId, {
1183
+ ...payload,
1184
+ expectedRevision: basis
1185
+ });
1186
+ settledWritesRef.current.set(writesKey, { revision: saved.revision, content });
1187
+ if (!owned()) return;
1188
+ adoptDraftBase(saved);
1189
+ keepNewerDraftAfterSend();
1190
+ } catch (cause) {
1191
+ if (isOutcomeUnknownError(cause) || isTransientServiceFailure(cause)) {
1192
+ draftWriteUnconfirmedRef.current = true;
1193
+ if (owned()) unkeptSendRef.current = { payload, basis, owner };
1194
+ }
1195
+ if (owned()) keepNewerDraftAfterSend();
1196
+ }
1197
+ },
1198
+ [adoptDraftBase, client, durableDrafts, keepNewerDraftAfterSend, sessionId, workspaceId]
1199
+ );
1200
+ const forgetRemovedSendDraft = useCallback(
1201
+ async (payload) => {
1202
+ if (!sessionId || !durableDrafts) return;
1203
+ const owner = { targetKey, generation: targetGeneration.current };
1204
+ const owned = () => targetKeyRef.current === owner.targetKey && targetGeneration.current === owner.generation;
1205
+ const unkept = unkeptSendRef.current;
1206
+ if (unkept && draftContentKey(unkept.payload) === draftContentKey(payload)) {
1207
+ unkeptSendRef.current = null;
1208
+ }
1209
+ const release = await acquireDraftSlot();
1210
+ try {
1211
+ const base = draftRef.current;
1212
+ if (!owned() || !base || !policyRef.current || valueRef.current !== "" || restoredResourcesRef.current.length > 0 || annotationsRef.current.length > 0 || draftContentKey(draftPayload(base)) !== draftContentKey(payload)) {
1213
+ return;
1214
+ }
1215
+ const cleared = composerDraftPayload(
1216
+ base,
1217
+ "",
1218
+ [],
1219
+ [],
1220
+ pickedPolicy(policyPickedRef, policyRef),
1221
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
1222
+ );
1223
+ const content = draftContentKey(cleared);
1224
+ const writesKey = `${workspaceId}\0${sessionId}`;
1225
+ rememberPageDraftWrite(writesKey, content);
1226
+ const saved = await client.saveComposerDraft(workspaceId, sessionId, {
1227
+ ...cleared,
1228
+ expectedRevision: base.revision
1229
+ });
1230
+ settledWritesRef.current.set(writesKey, { revision: saved.revision, content });
1231
+ if (owned()) adoptDraftBase(saved);
1232
+ } catch {
1233
+ } finally {
1234
+ release();
1235
+ }
1236
+ },
1237
+ [acquireDraftSlot, adoptDraftBase, client, durableDrafts, sessionId, targetKey, workspaceId]
1238
+ );
1239
+ useEffect(() => {
1240
+ if (!sessionId || !durableDrafts) return;
1241
+ const retry = () => {
1242
+ const unkept = unkeptSendRef.current;
1243
+ if (!unkept) return;
1244
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") return;
1245
+ void (async () => {
1246
+ const release = await acquireDraftSlot();
1247
+ try {
1248
+ if (unkeptSendRef.current === unkept) {
1249
+ await keepUndeliveredSendInDraft(unkept.payload, unkept.basis, unkept.owner);
1250
+ }
1251
+ } finally {
1252
+ release();
1253
+ }
1254
+ })();
1255
+ };
1256
+ window.addEventListener("online", retry);
1257
+ document.addEventListener("visibilitychange", retry);
1258
+ window.addEventListener("pageshow", retry);
1259
+ return () => {
1260
+ window.removeEventListener("online", retry);
1261
+ document.removeEventListener("visibilitychange", retry);
1262
+ window.removeEventListener("pageshow", retry);
1263
+ };
1264
+ }, [acquireDraftSlot, durableDrafts, keepUndeliveredSendInDraft, sessionId]);
1265
+ const submitDurableSend = useCallback(
1266
+ async (payload, owner, first, submit, onRevision) => {
1267
+ try {
1268
+ return await submit(first.revision);
1269
+ } catch (cause) {
1270
+ if (first.saved || !payload || !isDraftConflictError(asError(cause))) throw cause;
1271
+ draftFencedSendRef.current = true;
1272
+ const next = await resolveSendDraftRevision(payload, owner);
1273
+ if (next.blocked) throw next.blocked;
1274
+ if (!next.saved || next.revision === void 0) throw cause;
1275
+ onRevision(next.revision);
1276
+ return await submit(next.revision);
1277
+ }
1278
+ },
1279
+ [resolveSendDraftRevision]
1280
+ );
1281
+ const persistPayload = useCallback(
1282
+ async (payload, onFailure) => {
1283
+ const owner = { targetKey, generation: targetGeneration.current };
1284
+ if (!sessionId || !durableDrafts || targetKeyRef.current !== owner.targetKey) {
1285
+ return false;
1286
+ }
1287
+ const release = await acquireDraftSlot();
1288
+ try {
1289
+ return await saveDraftInSlot(payload, owner, onFailure);
1290
+ } finally {
1291
+ release();
1292
+ }
1293
+ },
1294
+ [acquireDraftSlot, durableDrafts, saveDraftInSlot, sessionId, targetKey]
1295
+ );
1296
+ const flushDraft = useCallback(async () => {
1297
+ if (draftLoading || sending || draftConflict) return;
1298
+ const payload = currentDraftPayload();
1299
+ if (!payload || draftSignature(payload) === lastSavedSignature.current) return;
1300
+ await persistPayload(payload);
1301
+ }, [currentDraftPayload, draftConflict, draftLoading, persistPayload, sending]);
1302
+ const replaceOptimisticSends = useCallback(
1303
+ (update) => {
1304
+ const next = update(optimisticSendsRef.current);
1305
+ optimisticSendsRef.current = next;
1306
+ rememberOptimisticSendOperations(pendingOperationKey, next);
1307
+ setOptimisticSends(next);
1308
+ return next;
1309
+ },
1310
+ [pendingOperationKey]
1311
+ );
1312
+ const markOptimisticAccepted = useCallback(
1313
+ (operation) => {
1314
+ if (!optimisticCallbackIdsRef.current.has(operation.clientEventId)) {
1315
+ optimisticCallbackIdsRef.current.add(operation.clientEventId);
1316
+ onSent?.(operation.input.text, operation.input);
1317
+ }
1318
+ replaceOptimisticSends(
1319
+ (current) => current.filter((candidate) => candidate.clientEventId !== operation.clientEventId)
1320
+ );
1321
+ },
1322
+ [onSent, replaceOptimisticSends]
1323
+ );
1324
+ useEffect(() => {
1325
+ const events = options.events ?? [];
1326
+ if (events.length === 0 || optimisticSendsRef.current.length === 0) return;
1327
+ const reconciled = optimisticSendsRef.current.map(
1328
+ (operation) => reconcileOptimisticSendFromEvents(operation, events)
1329
+ );
1330
+ const settledIds = new Set(
1331
+ reconciled.filter((item) => item.settled).map((item) => item.operation.clientEventId)
1332
+ );
1333
+ const changed = reconciled.some(
1334
+ (item, index) => item.operation !== optimisticSendsRef.current[index] && !settledIds.has(item.operation.clientEventId)
1335
+ );
1336
+ const newlyAdmitted = reconciled.some(
1337
+ (item, index) => item.admitted && item.operation !== optimisticSendsRef.current[index]
1338
+ );
1339
+ for (const item of reconciled) {
1340
+ if (item.admitted && !optimisticCallbackIdsRef.current.has(item.operation.clientEventId)) {
1341
+ optimisticCallbackIdsRef.current.add(item.operation.clientEventId);
1342
+ onSent?.(item.operation.input.text, item.operation.input);
1343
+ }
1344
+ if (item.settled) markOptimisticAccepted(item.operation);
1345
+ }
1346
+ if (changed) {
1347
+ replaceOptimisticSends(
1348
+ (current) => current.map(
1349
+ (operation) => reconciled.find((item) => item.operation.clientEventId === operation.clientEventId)?.operation ?? operation
1350
+ ).filter((operation) => !settledIds.has(operation.clientEventId))
1351
+ );
1352
+ }
1353
+ if (durableDrafts && newlyAdmitted) void loadDraft(false);
1354
+ }, [
1355
+ durableDrafts,
1356
+ loadDraft,
1357
+ markOptimisticAccepted,
1358
+ onSent,
1359
+ options.events,
1360
+ replaceOptimisticSends
1361
+ ]);
1362
+ const processOptimisticSends = useCallback(() => {
1363
+ if (!sessionId || optimisticProcessorBusyRef.current) return;
1364
+ const currentOperations = optimisticSendsRef.current;
1365
+ const operationIndex = currentOperations.findIndex(
1366
+ (candidate) => candidate.state === "sending"
1367
+ );
1368
+ const operation = operationIndex < 0 ? void 0 : currentOperations[operationIndex];
1369
+ if (!operation) return;
1370
+ const held = serviceWaitRef.current.get(operation.clientEventId);
1371
+ if (held && held.retryAt > Date.now()) {
1372
+ if (serviceRetryTimerRef.current === null) {
1373
+ serviceRetryTimerRef.current = setTimeout(
1374
+ () => {
1375
+ serviceRetryTimerRef.current = null;
1376
+ processOptimisticSendsRef.current();
1377
+ },
1378
+ Math.max(0, held.retryAt - Date.now())
1379
+ );
1380
+ }
1381
+ return;
1382
+ }
1383
+ const ownedTargetKey = targetKey;
1384
+ const ownedGeneration = targetGeneration.current;
1385
+ optimisticProcessorBusyRef.current = true;
1386
+ void (async () => {
1387
+ let mutationFailureObserved = false;
1388
+ let notSubmitted = false;
1389
+ let holding = false;
1390
+ let releaseDraftSlot = null;
1391
+ const holdForService = (cause, outcomeUnknown) => {
1392
+ if (outcomeUnknown && !operation.canRetry) return false;
1393
+ const now = Date.now();
1394
+ const previous = serviceWaitRef.current.get(operation.clientEventId);
1395
+ const since = isMaintenanceError(cause) ? now : previous?.since ?? now;
1396
+ if (!isCalmServiceFailure(cause, since, now)) return false;
1397
+ const attempts = (previous?.attempts ?? 0) + 1;
1398
+ const delayMs = Math.round(
1399
+ Math.min(SERVICE_SEND_RETRY_MAX_DELAY_MS, 1e3 * 2 ** (attempts - 1)) * (0.8 + Math.random() * 0.4)
1400
+ );
1401
+ serviceWaitRef.current.set(operation.clientEventId, {
1402
+ since,
1403
+ attempts,
1404
+ retryAt: now + delayMs
1405
+ });
1406
+ holding = true;
1407
+ setServiceWaiting(true);
1408
+ replaceOptimisticSends(
1409
+ (current) => current.map(
1410
+ (candidate) => candidate.clientEventId === operation.clientEventId ? { ...candidate, state: "sending", outcomeUnknown } : candidate
1411
+ )
1412
+ );
1413
+ return true;
1414
+ };
1415
+ const markFailed = (cause, outcomeUnknown) => {
1416
+ if (targetKeyRef.current !== ownedTargetKey || targetGeneration.current !== ownedGeneration) {
1417
+ return false;
1418
+ }
1419
+ if (holdForService(cause, outcomeUnknown)) return true;
1420
+ const problem = asError(cause);
1421
+ replaceOptimisticSends(
1422
+ (current) => current.map(
1423
+ (candidate) => candidate.clientEventId === operation.clientEventId ? {
1424
+ ...candidate,
1425
+ state: "failed",
1426
+ error: formatError(
1427
+ cause,
1428
+ outcomeUnknown && !isOutcomeUnknownError(problem) && !(problem instanceof ComposerReconciliationRequiredError) ? problem instanceof OpenGeniApiError && problem.correlationId ? t("hooks.useComposer.notConfirmedCheckStatusWithReference", {
1429
+ reference: problem.correlationId
1430
+ }) : t("hooks.useComposer.notConfirmedCheckStatus") : composerSubmissionErrorMessage(t, problem, canBuyCreditsRef.current)
1431
+ ),
1432
+ retryable: outcomeUnknown || composerSubmissionCanRetry(problem),
1433
+ outcomeUnknown,
1434
+ correlationId: problem instanceof OpenGeniApiError ? problem.correlationId : candidate.correlationId
1435
+ } : candidate
1436
+ )
1437
+ );
1438
+ return false;
1439
+ };
1440
+ try {
1441
+ if (operation.outcomeUnknown) {
1442
+ let events;
1443
+ try {
1444
+ events = await client.listEvents(workspaceId, sessionId, {
1445
+ includeTypes: [
1446
+ "user.message",
1447
+ "turn.queued",
1448
+ "turn.started",
1449
+ "turn.completed",
1450
+ "turn.failed",
1451
+ "turn.cancelled",
1452
+ "turn.superseded"
1453
+ ],
1454
+ limit: 250,
1455
+ payloadMode: "full"
1456
+ });
1457
+ } catch (cause) {
1458
+ const wasHeld = serviceWaitRef.current.has(operation.clientEventId);
1459
+ if (!markFailed(cause, true) && wasHeld) {
1460
+ notifyObserver(
1461
+ onDeliveryErrorRef.current,
1462
+ asError(cause),
1463
+ operation.input,
1464
+ "send"
1465
+ );
1466
+ }
1467
+ return;
1468
+ }
1469
+ const reconciled = reconcileOptimisticSendFromEvents(operation, events);
1470
+ if (reconciled.admitted) {
1471
+ if (durableDrafts) await loadDraft(false);
1472
+ if (reconciled.settled) {
1473
+ markOptimisticAccepted(reconciled.operation);
1474
+ } else {
1475
+ replaceOptimisticSends(
1476
+ (current) => current.map(
1477
+ (candidate) => candidate.clientEventId === operation.clientEventId ? reconciled.operation : candidate
1478
+ )
1479
+ );
1480
+ if (!optimisticCallbackIdsRef.current.has(operation.clientEventId)) {
1481
+ optimisticCallbackIdsRef.current.add(operation.clientEventId);
1482
+ onSent?.(reconciled.operation.input.text, reconciled.operation.input);
1483
+ }
1484
+ }
1485
+ return;
1486
+ }
1487
+ if (!operation.canRetry) {
1488
+ throw new ComposerReconciliationRequiredError();
1489
+ }
1490
+ }
1491
+ let expectedDraftRevision;
1492
+ let savedFirst = false;
1493
+ if (durableDrafts && operation.draftPayload) {
1494
+ releaseDraftSlot = await acquireDraftSlot();
1495
+ expectedDraftRevision = operation.expectedDraftRevision;
1496
+ if (expectedDraftRevision === void 0) {
1497
+ const resolved = await resolveSendDraftRevision(operation.draftPayload, {
1498
+ targetKey: ownedTargetKey,
1499
+ generation: ownedGeneration
1500
+ });
1501
+ if (resolved.blocked) {
1502
+ notSubmitted = true;
1503
+ throw resolved.blocked;
1504
+ }
1505
+ expectedDraftRevision = resolved.revision;
1506
+ savedFirst = resolved.saved;
1507
+ } else if (sendDraftBasis(draftRef.current, sendBasisRef.current).behind) {
1508
+ keepNewerDraftAfterSend();
1509
+ }
1510
+ if (expectedDraftRevision !== void 0 && operation.expectedDraftRevision !== expectedDraftRevision) {
1511
+ const firstBasis = expectedDraftRevision;
1512
+ replaceOptimisticSends(
1513
+ (current) => current.map(
1514
+ (candidate) => candidate.clientEventId === operation.clientEventId ? { ...candidate, expectedDraftRevision: firstBasis } : candidate
1515
+ )
1516
+ );
1517
+ }
1518
+ }
1519
+ if (targetKeyRef.current !== ownedTargetKey || targetGeneration.current !== ownedGeneration) {
1520
+ return;
1521
+ }
1522
+ let wireInput = {
1523
+ ...operation.input,
1524
+ ...expectedDraftRevision !== void 0 ? { expectedDraftRevision } : {}
1525
+ };
1526
+ let acceptedResult = null;
1527
+ let acceptedEvent = null;
1528
+ let steerOrSend = operation.steerOrSend === true;
1529
+ const submit = async () => {
1530
+ if (durableDrafts) {
1531
+ const sendPayload = operation.draftPayload;
1532
+ if (!sendPayload || expectedDraftRevision === void 0) {
1533
+ throw new ComposerStateError(t("hooks.useComposer.theDurableComposerDraftIs"));
1534
+ }
1535
+ const result = await submitDurableSend(
1536
+ sendPayload,
1537
+ { targetKey: ownedTargetKey, generation: ownedGeneration },
1538
+ { revision: expectedDraftRevision, saved: savedFirst },
1539
+ (revision) => client.submitComposerDraft(workspaceId, sessionId, {
1540
+ text: sendPayload.text,
1541
+ annotations: sendPayload.annotations,
1542
+ resources: sendPayload.resources,
1543
+ // Absent while the draft follows the chat's settings.
1544
+ ...sendPayload.model !== void 0 ? { model: sendPayload.model } : {},
1545
+ ...sendPayload.reasoningEffort !== void 0 ? { reasoningEffort: sendPayload.reasoningEffort } : {},
1546
+ ...sendPayload.latencyMode !== void 0 ? { latencyMode: sendPayload.latencyMode } : {},
1547
+ expectedDraftRevision: revision,
1548
+ clientEventId: operation.clientEventId,
1549
+ delivery: steerOrSend ? "steer_or_send" : "send",
1550
+ ...wireInput.controlEtag ? { controlEtag: wireInput.controlEtag } : {},
1551
+ ...wireInput.modelContext ? { modelContext: wireInput.modelContext } : {},
1552
+ ...wireInput.mcpCredentialUpdates ? { mcpCredentialUpdates: wireInput.mcpCredentialUpdates } : {},
1553
+ ...wireInput.connectionAccounts ? { connectionAccounts: wireInput.connectionAccounts } : {},
1554
+ ...wireInput.personalResourceAttachment ? { personalResourceAttachment: wireInput.personalResourceAttachment } : {}
1555
+ }).catch((cause) => {
1556
+ mutationFailureObserved = true;
1557
+ throw cause;
1558
+ }),
1559
+ (revision) => {
1560
+ expectedDraftRevision = revision;
1561
+ savedFirst = true;
1562
+ wireInput = { ...wireInput, expectedDraftRevision: revision };
1563
+ replaceOptimisticSends(
1564
+ (current) => current.map(
1565
+ (candidate) => candidate.clientEventId === operation.clientEventId ? { ...candidate, expectedDraftRevision: revision } : candidate
1566
+ )
1567
+ );
1568
+ }
1569
+ );
1570
+ acceptedResult = result;
1571
+ followAcceptedDraft(result.draft);
1572
+ releaseDraftSlot?.();
1573
+ } else if (steerOrSend) {
1574
+ acceptedResult = await client.steerMessage(workspaceId, sessionId, wireInput, { delivery: "steer_or_send" }).catch((cause) => {
1575
+ mutationFailureObserved = true;
1576
+ throw cause;
1577
+ });
1578
+ } else {
1579
+ acceptedEvent = await client.sendMessage(workspaceId, sessionId, wireInput).catch((cause) => {
1580
+ mutationFailureObserved = true;
1581
+ throw cause;
1582
+ });
1583
+ }
1584
+ };
1585
+ const submitOrFallBack = async () => {
1586
+ try {
1587
+ await submit();
1588
+ } catch (cause) {
1589
+ if (!steerOrSend || !rejectsSteerOrSend(cause)) throw cause;
1590
+ steerOrSendUnsupportedRef.current = true;
1591
+ steerOrSend = false;
1592
+ replaceOptimisticSends(
1593
+ (current) => current.map(
1594
+ (candidate) => candidate.clientEventId === operation.clientEventId ? { ...candidate, steerOrSend: false } : candidate
1595
+ )
1596
+ );
1597
+ await submit();
1598
+ }
1599
+ };
1600
+ try {
1601
+ await submitOrFallBack();
1602
+ } catch (cause) {
1603
+ const revise = reviseRefusedAccountsRef.current;
1604
+ if (!revise || isOutcomeUnknownError(cause)) throw cause;
1605
+ let accounts = null;
1606
+ try {
1607
+ accounts = await revise(asError(cause), wireInput);
1608
+ } catch {
1609
+ accounts = null;
1610
+ }
1611
+ if (!accounts || targetKeyRef.current !== ownedTargetKey || targetGeneration.current !== ownedGeneration) {
1612
+ throw cause;
1613
+ }
1614
+ wireInput = { ...wireInput, connectionAccounts: accounts };
1615
+ replaceOptimisticSends(
1616
+ (current) => current.map(
1617
+ (candidate) => candidate.clientEventId === operation.clientEventId ? { ...candidate, input: { ...candidate.input, connectionAccounts: accounts } } : candidate
1618
+ )
1619
+ );
1620
+ await submitOrFallBack();
1621
+ }
1622
+ if (targetKeyRef.current !== ownedTargetKey || targetGeneration.current !== ownedGeneration) {
1623
+ return;
1624
+ }
1625
+ const acceptedRouting = acceptedResult?.routing ?? promptRoutingFromAcceptedEvent(acceptedEvent);
1626
+ const acceptedDestination = acceptedRouting === "queued_for_execution" ? "queue" : acceptedRouting === "accepted_for_execution" || acceptedRouting === "accepted_for_steering" ? "chat" : operation.destination;
1627
+ if (options.events === void 0 && acceptedDestination === "chat") {
1628
+ markOptimisticAccepted({ ...operation, input: wireInput });
1629
+ } else {
1630
+ replaceOptimisticSends(
1631
+ (current) => current.map(
1632
+ (candidate) => candidate.clientEventId === operation.clientEventId ? {
1633
+ ...candidate,
1634
+ input: wireInput,
1635
+ destination: acceptedDestination,
1636
+ turnId: acceptedResult?.turn.id ?? candidate.turnId,
1637
+ triggerEventId: acceptedResult?.accepted.id ?? acceptedEvent?.id ?? candidate.triggerEventId,
1638
+ appliedQueueVersion: acceptedResult?.receipt?.appliedQueueVersion ?? candidate.appliedQueueVersion,
1639
+ state: "queued",
1640
+ error: void 0
1641
+ } : candidate
1642
+ )
1643
+ );
1644
+ }
1645
+ if (!optimisticCallbackIdsRef.current.has(operation.clientEventId)) {
1646
+ optimisticCallbackIdsRef.current.add(operation.clientEventId);
1647
+ onSent?.(wireInput.text, wireInput);
1648
+ }
1649
+ } catch (cause) {
1650
+ const current = optimisticSendsRef.current.find(
1651
+ (candidate) => candidate.clientEventId === operation.clientEventId
1652
+ );
1653
+ if (!current || current.state === "queued" && current.outcomeUnknown === false) {
1654
+ return;
1655
+ }
1656
+ const problem = asError(cause);
1657
+ const outcomeUnknown = operation.outcomeUnknown && !mutationFailureObserved ? true : !notSubmitted && isOutcomeUnknownError(cause);
1658
+ const heldForService = markFailed(cause, outcomeUnknown);
1659
+ if (!heldForService) {
1660
+ notifyObserver(onDeliveryErrorRef.current, problem, operation.input, "send");
1661
+ }
1662
+ if (releaseDraftSlot) {
1663
+ await keepUndeliveredSendInDraft(operation.draftPayload, current.expectedDraftRevision, {
1664
+ targetKey: ownedTargetKey,
1665
+ generation: ownedGeneration
1666
+ });
1667
+ }
1668
+ } finally {
1669
+ releaseDraftSlot?.();
1670
+ optimisticProcessorBusyRef.current = false;
1671
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
1672
+ if (!holding) serviceWaitRef.current.delete(operation.clientEventId);
1673
+ for (const id of serviceWaitRef.current.keys()) {
1674
+ if (!optimisticSendsRef.current.some(
1675
+ (candidate) => candidate.clientEventId === id && candidate.state === "sending"
1676
+ )) {
1677
+ serviceWaitRef.current.delete(id);
1678
+ }
1679
+ }
1680
+ setServiceWaiting(serviceWaitRef.current.size > 0);
1681
+ }
1682
+ if (targetKeyRef.current === ownedTargetKey) {
1683
+ setOptimisticSends([...optimisticSendsRef.current]);
1684
+ }
1685
+ }
1686
+ })();
1687
+ }, [
1688
+ acquireDraftSlot,
1689
+ followAcceptedDraft,
1690
+ keepNewerDraftAfterSend,
1691
+ keepUndeliveredSendInDraft,
1692
+ client,
1693
+ durableDrafts,
1694
+ formatError,
1695
+ markOptimisticAccepted,
1696
+ loadDraft,
1697
+ onSent,
1698
+ options.events,
1699
+ replaceOptimisticSends,
1700
+ resolveSendDraftRevision,
1701
+ sessionId,
1702
+ submitDurableSend,
1703
+ targetKey,
1704
+ workspaceId,
1705
+ t
1706
+ ]);
1707
+ processOptimisticSendsRef.current = processOptimisticSends;
1708
+ useEffect(() => {
1709
+ processOptimisticSends();
1710
+ }, [optimisticSends, processOptimisticSends]);
1711
+ useEffect(() => {
1712
+ for (const id of serviceWaitRef.current.keys()) {
1713
+ if (!optimisticSends.some(
1714
+ (candidate) => candidate.clientEventId === id && candidate.state === "sending"
1715
+ )) {
1716
+ serviceWaitRef.current.delete(id);
1717
+ }
1718
+ }
1719
+ setServiceWaiting(serviceWaitRef.current.size > 0);
1720
+ }, [optimisticSends]);
1721
+ useEffect(() => {
1722
+ const savePromptly = savePickPromptlyRef.current;
1723
+ savePickPromptlyRef.current = false;
1724
+ unsavedDraftRef.current = null;
1725
+ const pending = pendingOperationRef.current;
1726
+ if (pending) {
1727
+ const shadow = {
1728
+ text: valueRef.current,
1729
+ resources: mergeResources(
1730
+ restoredResourcesRef.current,
1731
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
1732
+ ),
1733
+ annotations: annotationsRef.current,
1734
+ ...pickedPolicy(policyPickedRef, policyRef) ? { policy: pickedPolicy(policyPickedRef, policyRef) } : {}
1735
+ };
1736
+ if (pending.newerShadow.text !== shadow.text || JSON.stringify(pending.newerShadow.resources) !== JSON.stringify(shadow.resources) || JSON.stringify(pending.newerShadow.annotations) !== JSON.stringify(shadow.annotations) || JSON.stringify(pending.newerShadow.policy) !== JSON.stringify(shadow.policy)) {
1737
+ pendingOperationRef.current = updatePendingComposerShadow(
1738
+ pendingOperationKey,
1739
+ pending,
1740
+ shadow
1741
+ );
1742
+ }
1743
+ return;
1744
+ }
1745
+ const optimistic = optimisticSendsRef.current.at(-1);
1746
+ if (optimistic) {
1747
+ const shadow = {
1748
+ text: valueRef.current,
1749
+ resources: mergeResources(
1750
+ restoredResourcesRef.current,
1751
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
1752
+ ),
1753
+ annotations: annotationsRef.current,
1754
+ ...pickedPolicy(policyPickedRef, policyRef) ? { policy: pickedPolicy(policyPickedRef, policyRef) } : {}
1755
+ };
1756
+ if (optimistic.newerShadow.text !== shadow.text || JSON.stringify(optimistic.newerShadow.resources) !== JSON.stringify(shadow.resources) || JSON.stringify(optimistic.newerShadow.annotations) !== JSON.stringify(shadow.annotations) || JSON.stringify(optimistic.newerShadow.policy) !== JSON.stringify(shadow.policy)) {
1757
+ setOptimisticDraftShadow(shadow);
1758
+ }
1759
+ }
1760
+ if (optimisticSendsRef.current.some((operation) => operation.state === "sending")) {
1761
+ return;
1762
+ }
1763
+ if (!durableDrafts || !sessionId || draftLoading || sending || !draftRef.current || draftConflict)
1764
+ return;
1765
+ const payload = currentDraftPayload();
1766
+ if (!payload || draftSignature(payload) === lastSavedSignature.current) return;
1767
+ unsavedDraftRef.current = { client, workspaceId, sessionId, payload };
1768
+ savePickPromptlyRef.current = savePromptly;
1769
+ const timer = window.setTimeout(
1770
+ () => {
1771
+ savePickPromptlyRef.current = false;
1772
+ void persistPayload(payload);
1773
+ },
1774
+ savePromptly ? 0 : 500
1775
+ );
1776
+ return () => window.clearTimeout(timer);
1777
+ }, [
1778
+ autosaveRetry,
1779
+ client,
1780
+ currentDraftPayload,
1781
+ durableDrafts,
1782
+ draftConflict,
1783
+ draftLoading,
1784
+ liveExtrasVersion,
1785
+ // A send settling lets an edit made while it ran be saved.
1786
+ optimisticSends,
1787
+ pendingOperationKey,
1788
+ persistPayload,
1789
+ // The pick is part of the draft like its text: a model, effort or speed
1790
+ // chosen without typing is saved too, so it survives opening another
1791
+ // chat or reloading before the next Send.
1792
+ policy,
1793
+ policyPicked,
1794
+ setOptimisticDraftShadow,
1795
+ sending,
1796
+ sessionId,
1797
+ workspaceId
1798
+ ]);
1799
+ useEffect(() => {
1800
+ if (!error || !sessionId || !isTransientServiceFailure(error) || isActionFailure(error)) {
1801
+ return;
1802
+ }
1803
+ const ownedTargetKey = targetKey;
1804
+ const ownedError = error;
1805
+ let cancelled = false;
1806
+ let inFlight = false;
1807
+ const timer = setInterval(() => {
1808
+ if (inFlight) return;
1809
+ inFlight = true;
1810
+ const probe = durableDrafts ? client.getComposerDraft(workspaceId, sessionId) : client.listEvents(workspaceId, sessionId, { limit: 1, payloadMode: "none" });
1811
+ probe.then(
1812
+ () => {
1813
+ inFlight = false;
1814
+ if (cancelled || targetKeyRef.current !== ownedTargetKey) return;
1815
+ setError((current) => current === ownedError ? null : current);
1816
+ setAutosaveRetry((nonce) => nonce + 1);
1817
+ },
1818
+ () => {
1819
+ inFlight = false;
1820
+ }
1821
+ );
1822
+ }, TRANSIENT_RECONNECT_INTERVAL_MS);
1823
+ return () => {
1824
+ cancelled = true;
1825
+ clearInterval(timer);
1826
+ };
1827
+ }, [client, durableDrafts, error, sessionId, targetKey, workspaceId]);
1828
+ const dispatch = useCallback(
1829
+ async (delivery, explicit, steerOrSend = false) => {
1830
+ const ownedTargetKey = targetKey;
1831
+ const ownedGeneration = targetGeneration.current;
1832
+ const owner = { targetKey: ownedTargetKey, generation: ownedGeneration };
1833
+ const operationKey = pendingComposerOperationKey(workspaceId, sessionId);
1834
+ const pending = pendingOperationRef.current ?? restorePendingComposerOperation(operationKey);
1835
+ if (pending && !pendingOperationRef.current) {
1836
+ pendingOperationRef.current = pending;
1837
+ pendingClientEventId.current = pending.input.clientEventId ?? null;
1838
+ }
1839
+ const draftAtSend = valueRef.current;
1840
+ const annotationsAtSend = cloneAnnotations(annotationsRef.current);
1841
+ const resourcesAtSend = [...restoredResourcesRef.current];
1842
+ const rawText = explicit ?? draftAtSend;
1843
+ const hasText = rawText.trim().length > 0;
1844
+ const hasAnnotations = annotationsAtSend.length > 0;
1845
+ const currentPolicy = policyRef.current;
1846
+ const annotationsComplete2 = annotationsAtSend.every(
1847
+ (annotation) => annotation.note.trim().length > 0
1848
+ );
1849
+ const extras = pending ? {} : resolveSendExtras(sendExtrasRef.current);
1850
+ const hasResources = resourcesAtSend.length > 0 || (extras.resources?.length ?? 0) > 0;
1851
+ if (!pending && (!annotationsComplete2 || !hasText && !hasResources && !hasAnnotations) || !sessionId || !currentPolicy || sending || sendBlockedRef.current?.() === true || targetKeyRef.current !== ownedTargetKey) {
1852
+ return false;
1853
+ }
1854
+ const clearPending = () => {
1855
+ pendingOperationRef.current = null;
1856
+ pendingClientEventId.current = null;
1857
+ forgetPendingComposerOperation(operationKey);
1858
+ };
1859
+ const owned = () => targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration;
1860
+ const updatePending = (operation, update) => {
1861
+ const current = pendingOperationRef.current;
1862
+ const kept = current !== null && owned() && current.input.clientEventId === operation.input.clientEventId;
1863
+ const next = update(kept ? current : operation);
1864
+ if (kept) pendingOperationRef.current = next;
1865
+ rememberPendingComposerOperation(operationKey, next);
1866
+ return next;
1867
+ };
1868
+ let keepSteering = pending?.delivery === "steer";
1869
+ let releaseDraftSlot = null;
1870
+ const settleAccepted = (operation) => {
1871
+ clearPending();
1872
+ if (!operation.emptiedAtSend) {
1873
+ const draftWasUnchanged = valueRef.current === operation.draftAtSend;
1874
+ const resourcesWereUnchanged = JSON.stringify(restoredResourcesRef.current) === JSON.stringify(operation.resourcesAtSend);
1875
+ const annotationsWereUnchanged = JSON.stringify(annotationsRef.current) === JSON.stringify(operation.annotationsAtSend);
1876
+ if (resourcesWereUnchanged) {
1877
+ restoredResourcesRef.current = [];
1878
+ setRestoredResources([]);
1879
+ }
1880
+ if (annotationsWereUnchanged) {
1881
+ annotationsRef.current = [];
1882
+ setAnnotations([]);
1883
+ setAnnotationReviewTargetId(null);
1884
+ }
1885
+ if (operation.clearDraftOnAccept && draftWasUnchanged) {
1886
+ valueRef.current = "";
1887
+ setValue("");
1888
+ }
1889
+ }
1890
+ onSent?.(operation.input.text, operation.input);
1891
+ };
1892
+ const giveBack = (operation, cause) => {
1893
+ const textTaken = operation.clearDraftOnAccept;
1894
+ const boxUntouched = (!textTaken || valueRef.current === "") && annotationsRef.current.length === 0 && restoredResourcesRef.current.length === 0 && (resolveSendExtras(sendExtrasRef.current).resources?.length ?? 0) === 0;
1895
+ if (owned() && boxUntouched) {
1896
+ localEditRevision.current += 1;
1897
+ if (textTaken) {
1898
+ valueRef.current = operation.draftAtSend;
1899
+ setValue(operation.draftAtSend);
1900
+ }
1901
+ restoredResourcesRef.current = [...operation.input.resources ?? []];
1902
+ annotationsRef.current = cloneAnnotations(operation.annotationsAtSend);
1903
+ setRestoredResources(restoredResourcesRef.current);
1904
+ setAnnotations(annotationsRef.current);
1905
+ return true;
1906
+ }
1907
+ const problem = asError(cause);
1908
+ const failed = {
1909
+ clientEventId: operation.input.clientEventId ?? generateClientEventId(),
1910
+ delivery: operation.delivery,
1911
+ // Retried, it still goes to the running turn when there is one.
1912
+ ...operation.steerOrSend || operation.delivery === "steer" && !steerOrSendUnsupportedRef.current ? { steerOrSend: true } : {},
1913
+ destination: "chat",
1914
+ text: operation.input.text,
1915
+ annotations: cloneAnnotations(operation.annotationsAtSend),
1916
+ resources: [...operation.input.resources ?? []],
1917
+ occurredAt: steeringOccurredAtRef.current,
1918
+ state: "failed",
1919
+ error: formatError(
1920
+ cause,
1921
+ composerSubmissionErrorMessage(t, problem, canBuyCreditsRef.current)
1922
+ ),
1923
+ retryable: composerSubmissionCanRetry(problem),
1924
+ outcomeUnknown: false,
1925
+ ...problem instanceof OpenGeniApiError && problem.correlationId ? { correlationId: problem.correlationId } : {},
1926
+ input: operation.input,
1927
+ draftPayload: operation.draftPayload ?? null,
1928
+ newerShadow: operation.newerShadow,
1929
+ canRetry: operation.canRetry
1930
+ };
1931
+ if (owned()) {
1932
+ replaceOptimisticSends((current) => [...current, failed]);
1933
+ } else {
1934
+ rememberOptimisticSendOperations(operationKey, [
1935
+ ...restoreOptimisticSendOperations(t, operationKey, canBuyCreditsRef.current),
1936
+ failed
1937
+ ]);
1938
+ }
1939
+ return false;
1940
+ };
1941
+ const resolveRevision = async (operation) => {
1942
+ releaseDraftSlot = await acquireDraftSlot();
1943
+ const resolved = await resolveSendDraftRevision(operation.draftPayload ?? null, owner);
1944
+ if (resolved.blocked || resolved.revision === void 0) {
1945
+ return { operation, saved: resolved.saved, blocked: resolved.blocked };
1946
+ }
1947
+ const revision = resolved.revision;
1948
+ return {
1949
+ operation: updatePending(operation, (current) => ({
1950
+ ...current,
1951
+ input: { ...current.input, expectedDraftRevision: revision }
1952
+ })),
1953
+ saved: resolved.saved,
1954
+ blocked: null
1955
+ };
1956
+ };
1957
+ const deliver = async (operation, savedFirst) => {
1958
+ const wireDelivery = operation.steerOrSend ? "steer_or_send" : operation.delivery;
1959
+ if (durableDrafts) {
1960
+ const input = operation.input;
1961
+ const clientEventId = input.clientEventId;
1962
+ if (input.expectedDraftRevision === void 0 || clientEventId === void 0) {
1963
+ throw new ComposerStateError(t("hooks.useComposer.theDurableComposerDraftIs"));
1964
+ }
1965
+ const result = await submitDurableSend(
1966
+ operation.draftPayload ?? null,
1967
+ owner,
1968
+ { revision: input.expectedDraftRevision, saved: savedFirst },
1969
+ async (revision) => await client.submitComposerDraft(workspaceId, sessionId, {
1970
+ text: input.text,
1971
+ annotations: input.annotations ?? [],
1972
+ resources: input.resources ?? [],
1973
+ // Absent while the draft follows the chat's settings.
1974
+ ...input.model ? { model: input.model } : {},
1975
+ ...input.reasoningEffort ? { reasoningEffort: input.reasoningEffort } : {},
1976
+ ...input.latencyMode ? { latencyMode: input.latencyMode } : {},
1977
+ expectedDraftRevision: revision,
1978
+ clientEventId,
1979
+ delivery: wireDelivery,
1980
+ ...input.controlEtag ? { controlEtag: input.controlEtag } : {},
1981
+ ...input.modelContext ? { modelContext: input.modelContext } : {},
1982
+ ...input.mcpCredentialUpdates ? { mcpCredentialUpdates: input.mcpCredentialUpdates } : {},
1983
+ ...input.connectionAccounts ? { connectionAccounts: input.connectionAccounts } : {},
1984
+ ...input.personalResourceAttachment ? { personalResourceAttachment: input.personalResourceAttachment } : {}
1985
+ }),
1986
+ (revision) => {
1987
+ updatePending(operation, (current) => ({
1988
+ ...current,
1989
+ input: { ...current.input, expectedDraftRevision: revision }
1990
+ }));
1991
+ }
1992
+ );
1993
+ followAcceptedDraft(result.draft);
1994
+ return result;
1995
+ }
1996
+ if (operation.delivery === "steer") {
1997
+ return await client.steerMessage(
1998
+ workspaceId,
1999
+ sessionId,
2000
+ operation.input,
2001
+ operation.steerOrSend ? { delivery: "steer_or_send" } : {}
2002
+ );
2003
+ }
2004
+ await client.sendMessage(workspaceId, sessionId, operation.input);
2005
+ return null;
2006
+ };
2007
+ const deliverOrFallBackOnce = async (operation, savedFirst = false) => {
2008
+ try {
2009
+ return await deliver(operation, savedFirst);
2010
+ } catch (cause) {
2011
+ if (!operation.steerOrSend || !rejectsSteerOrSend(cause)) throw cause;
2012
+ steerOrSendUnsupportedRef.current = true;
2013
+ const chosen = updatePending(operation, (current) => ({
2014
+ ...current,
2015
+ steerOrSend: false
2016
+ }));
2017
+ return await deliver(chosen, true);
2018
+ }
2019
+ };
2020
+ const deliverOrFallBack = async (operation, savedFirst = false) => {
2021
+ try {
2022
+ return await deliverOrFallBackOnce(operation, savedFirst);
2023
+ } catch (cause) {
2024
+ const revise = reviseRefusedAccountsRef.current;
2025
+ if (!revise || isOutcomeUnknownError(cause)) throw cause;
2026
+ const kept = pendingOperationRef.current;
2027
+ const latest = kept && kept.input.clientEventId === operation.input.clientEventId ? kept : operation;
2028
+ let accounts = null;
2029
+ try {
2030
+ accounts = await revise(asError(cause), latest.input);
2031
+ } catch {
2032
+ accounts = null;
2033
+ }
2034
+ if (!accounts || !owned()) throw cause;
2035
+ const revised = updatePending(latest, (current) => ({
2036
+ ...current,
2037
+ input: { ...current.input, connectionAccounts: accounts }
2038
+ }));
2039
+ return await deliverOrFallBackOnce(revised, true);
2040
+ }
2041
+ };
2042
+ const steered = (operation, result) => result !== null && (!operation.steerOrSend || result.routing === "accepted_for_steering");
2043
+ let fresh = null;
2044
+ if (!pending) {
2045
+ const sendText = hasText ? rawText : hasAnnotations ? "" : FILE_ONLY_MESSAGE_TEXT(t);
2046
+ pendingClientEventId.current ??= generateClientEventId();
2047
+ const effectiveControl = effectiveControlRef.current;
2048
+ const policyPick = pickedPolicy(policyPickedRef, policyRef);
2049
+ const input = composeSendInput(sendText, pendingClientEventId.current, extras, {
2050
+ ...policyPick,
2051
+ ...effectiveControl?.controlEtag ? { controlEtag: effectiveControl.controlEtag } : {},
2052
+ resources: mergeResources(resourcesAtSend, extras.resources ?? []),
2053
+ annotations: cloneAnnotations(annotationsAtSend)
2054
+ });
2055
+ const takesText = explicit === void 0;
2056
+ const draftBase = draftRef.current;
2057
+ fresh = {
2058
+ delivery,
2059
+ ...delivery === "steer" && steerOrSend && !steerOrSendUnsupportedRef.current ? { steerOrSend: true } : {},
2060
+ input,
2061
+ draftAtSend,
2062
+ resourcesAtSend,
2063
+ annotationsAtSend: cloneAnnotations(annotationsAtSend),
2064
+ // What stays in the box while this send runs.
2065
+ newerShadow: {
2066
+ text: takesText ? "" : draftAtSend,
2067
+ resources: [],
2068
+ annotations: [],
2069
+ ...policyPick ? { policy: policyPick } : {}
2070
+ },
2071
+ clearDraftOnAccept: takesText,
2072
+ emptiedAtSend: true,
2073
+ draftPayload: durableDrafts && draftBase && currentPolicy ? composerDraftPayload(
2074
+ draftBase,
2075
+ sendText,
2076
+ resourcesAtSend,
2077
+ annotationsAtSend,
2078
+ policyPick,
2079
+ extras.resources ?? []
2080
+ ) : null,
2081
+ canRetry: true
2082
+ };
2083
+ pendingOperationRef.current = fresh;
2084
+ rememberPendingComposerOperation(operationKey, fresh);
2085
+ localEditRevision.current += 1;
2086
+ if (takesText) {
2087
+ valueRef.current = "";
2088
+ setValue("");
2089
+ }
2090
+ annotationsRef.current = [];
2091
+ restoredResourcesRef.current = [];
2092
+ setAnnotations([]);
2093
+ setAnnotationReviewTargetId(null);
2094
+ setRestoredResources([]);
2095
+ }
2096
+ const shown = pending ?? fresh;
2097
+ if (delivery === "steer") {
2098
+ if (steeringRef.current?.clientEventId !== pending?.input.clientEventId) {
2099
+ steeringOccurredAtRef.current = (/* @__PURE__ */ new Date()).toISOString();
2100
+ }
2101
+ setSteering({
2102
+ phase: "submitting",
2103
+ text: shown?.input.text ?? rawText,
2104
+ clientEventId: shown?.input.clientEventId ?? pendingClientEventId.current,
2105
+ triggerEventId: null,
2106
+ turnId: null
2107
+ });
2108
+ }
2109
+ setSending(true);
2110
+ setError(null);
2111
+ if (fresh) onSubmitted?.(fresh.input.text, fresh.input);
2112
+ try {
2113
+ if (pending) {
2114
+ let acceptedEvent = null;
2115
+ try {
2116
+ const events = await client.listEvents(workspaceId, sessionId, {
2117
+ includeTypes: ["user.message"],
2118
+ limit: 100,
2119
+ payloadMode: "none"
2120
+ });
2121
+ acceptedEvent = events.find(
2122
+ (event) => event.type === "user.message" && event.clientEventId === pending.input.clientEventId
2123
+ ) ?? null;
2124
+ } catch (cause) {
2125
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2126
+ const problem = markActionFailure(asError(cause));
2127
+ setError(problem);
2128
+ if (pending.delivery === "steer") {
2129
+ keepSteering = true;
2130
+ setSteering({
2131
+ phase: "failed",
2132
+ text: pending.input.text,
2133
+ clientEventId: pending.input.clientEventId ?? null,
2134
+ triggerEventId: null,
2135
+ turnId: null,
2136
+ error: t("hooks.useComposer.notConfirmedRetry"),
2137
+ outcomeUnknown: true
2138
+ });
2139
+ }
2140
+ }
2141
+ return false;
2142
+ }
2143
+ if (targetKeyRef.current !== ownedTargetKey || targetGeneration.current !== ownedGeneration) {
2144
+ return false;
2145
+ }
2146
+ if (acceptedEvent) {
2147
+ if (durableDrafts) await loadDraft(false);
2148
+ if (pending.delivery === "steer") {
2149
+ keepSteering = true;
2150
+ setSteering({
2151
+ phase: "accepted",
2152
+ text: pending.input.text,
2153
+ clientEventId: pending.input.clientEventId ?? null,
2154
+ triggerEventId: acceptedEvent.id,
2155
+ turnId: null
2156
+ });
2157
+ }
2158
+ settleAccepted(pending);
2159
+ return true;
2160
+ }
2161
+ if (!pending.canRetry) {
2162
+ setError(new ComposerReconciliationRequiredError());
2163
+ return false;
2164
+ }
2165
+ let retried = pending;
2166
+ try {
2167
+ let savedFirst2 = false;
2168
+ if (durableDrafts && pending.input.expectedDraftRevision === void 0) {
2169
+ const resolved = await resolveRevision(pending);
2170
+ if (resolved.blocked) throw resolved.blocked;
2171
+ retried = resolved.operation;
2172
+ savedFirst2 = resolved.saved;
2173
+ } else if (durableDrafts) {
2174
+ releaseDraftSlot = await acquireDraftSlot();
2175
+ }
2176
+ const result = await deliverOrFallBack(retried, savedFirst2);
2177
+ if (pending.delivery === "steer" && steered(pending, result)) {
2178
+ keepSteering = true;
2179
+ setSteering({
2180
+ phase: "accepted",
2181
+ text: pending.input.text,
2182
+ clientEventId: pending.input.clientEventId ?? null,
2183
+ triggerEventId: result.accepted.id,
2184
+ turnId: result.turn.id,
2185
+ stoppingPreviousAttempt: result.replay !== true && (result.interruptionCount ?? 0) > 0
2186
+ });
2187
+ } else {
2188
+ keepSteering = false;
2189
+ }
2190
+ } catch (cause) {
2191
+ const problem = asError(cause);
2192
+ const outcomeUnknown = isOutcomeUnknownError(cause);
2193
+ notifyObserver(
2194
+ onDeliveryErrorRef.current,
2195
+ problem,
2196
+ pending.input,
2197
+ pending.delivery
2198
+ );
2199
+ if (!outcomeUnknown) {
2200
+ clearPending();
2201
+ keepSteering = false;
2202
+ if (retried.emptiedAtSend && !giveBack(retried, cause)) {
2203
+ return false;
2204
+ }
2205
+ } else {
2206
+ if (releaseDraftSlot && retried.emptiedAtSend) {
2207
+ await keepUndeliveredSendInDraft(
2208
+ retried.draftPayload,
2209
+ retried.input.expectedDraftRevision,
2210
+ owner
2211
+ );
2212
+ }
2213
+ if (pending.delivery === "steer") {
2214
+ keepSteering = true;
2215
+ setSteering({
2216
+ phase: "failed",
2217
+ text: pending.input.text,
2218
+ clientEventId: pending.input.clientEventId ?? null,
2219
+ triggerEventId: null,
2220
+ turnId: null,
2221
+ error: t("hooks.useComposer.notConfirmedRetry"),
2222
+ outcomeUnknown: true
2223
+ });
2224
+ }
2225
+ }
2226
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2227
+ setError(markActionFailure(problem));
2228
+ }
2229
+ return false;
2230
+ }
2231
+ if (targetKeyRef.current !== ownedTargetKey || targetGeneration.current !== ownedGeneration) {
2232
+ return false;
2233
+ }
2234
+ settleAccepted(pending);
2235
+ return true;
2236
+ }
2237
+ if (!fresh) return false;
2238
+ let operation = fresh;
2239
+ let savedFirst = false;
2240
+ if (durableDrafts) {
2241
+ const resolved = await resolveRevision(operation);
2242
+ if (resolved.blocked) {
2243
+ clearPending();
2244
+ giveBack(operation, resolved.blocked);
2245
+ return false;
2246
+ }
2247
+ operation = resolved.operation;
2248
+ savedFirst = resolved.saved;
2249
+ }
2250
+ if (!owned()) return false;
2251
+ try {
2252
+ const result = await deliverOrFallBack(operation, savedFirst);
2253
+ if (delivery === "steer" && steered(operation, result)) {
2254
+ keepSteering = true;
2255
+ setSteering({
2256
+ phase: "accepted",
2257
+ text: operation.input.text,
2258
+ clientEventId: operation.input.clientEventId ?? null,
2259
+ triggerEventId: result.accepted.id,
2260
+ turnId: result.turn.id,
2261
+ stoppingPreviousAttempt: result.replay !== true && (result.interruptionCount ?? 0) > 0
2262
+ });
2263
+ }
2264
+ } catch (cause) {
2265
+ notifyObserver(
2266
+ onDeliveryErrorRef.current,
2267
+ asError(cause),
2268
+ operation.input,
2269
+ operation.delivery
2270
+ );
2271
+ if (!isOutcomeUnknownError(cause)) {
2272
+ clearPending();
2273
+ if (!giveBack(operation, cause)) {
2274
+ return false;
2275
+ }
2276
+ } else {
2277
+ if (releaseDraftSlot && operation.emptiedAtSend) {
2278
+ await keepUndeliveredSendInDraft(
2279
+ operation.draftPayload,
2280
+ operation.input.expectedDraftRevision,
2281
+ owner
2282
+ );
2283
+ }
2284
+ if (delivery === "steer") {
2285
+ keepSteering = true;
2286
+ setSteering({
2287
+ phase: "failed",
2288
+ text: operation.input.text,
2289
+ clientEventId: operation.input.clientEventId ?? null,
2290
+ triggerEventId: null,
2291
+ turnId: null,
2292
+ error: t("hooks.useComposer.notConfirmedRetry"),
2293
+ outcomeUnknown: true
2294
+ });
2295
+ }
2296
+ }
2297
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2298
+ setError(markActionFailure(asError(cause)));
2299
+ }
2300
+ return false;
2301
+ }
2302
+ if (targetKeyRef.current !== ownedTargetKey || targetGeneration.current !== ownedGeneration) {
2303
+ return false;
2304
+ }
2305
+ settleAccepted(operation);
2306
+ return true;
2307
+ } finally {
2308
+ releaseDraftSlot?.();
2309
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2310
+ setSending(false);
2311
+ if (delivery === "steer" && !keepSteering) setSteering(null);
2312
+ }
2313
+ }
2314
+ },
2315
+ [
2316
+ acquireDraftSlot,
2317
+ client,
2318
+ durableDrafts,
2319
+ formatError,
2320
+ onSent,
2321
+ onSubmitted,
2322
+ followAcceptedDraft,
2323
+ keepUndeliveredSendInDraft,
2324
+ replaceOptimisticSends,
2325
+ resolveSendDraftRevision,
2326
+ sending,
2327
+ sessionId,
2328
+ submitDurableSend,
2329
+ targetKey,
2330
+ workspaceId,
2331
+ loadDraft,
2332
+ t
2333
+ ]
2334
+ );
2335
+ const sendToQueue = useCallback(
2336
+ async (explicit, steerOrSend = false) => {
2337
+ if (pendingOperationRef.current?.delivery === "send") {
2338
+ return await dispatch("send", explicit);
2339
+ }
2340
+ const rawText = explicit ?? valueRef.current;
2341
+ const annotationsAtSend = cloneAnnotations(annotationsRef.current);
2342
+ const currentPolicy = policyRef.current;
2343
+ const hasText = rawText.trim().length > 0;
2344
+ const hasAnnotations = annotationsAtSend.length > 0;
2345
+ const annotationsComplete2 = annotationsAtSend.every(
2346
+ (annotation) => annotation.note.trim().length > 0
2347
+ );
2348
+ const extras = resolveSendExtras(sendExtrasRef.current);
2349
+ const resources = mergeResources(restoredResourcesRef.current, extras.resources ?? []);
2350
+ if (!sessionId || !currentPolicy || sending || !annotationsComplete2 || !hasText && !hasAnnotations && resources.length === 0 || sendBlockedRef.current?.() === true || targetKeyRef.current !== targetKey) {
2351
+ return false;
2352
+ }
2353
+ const sendText = hasText ? rawText : hasAnnotations ? "" : FILE_ONLY_MESSAGE_TEXT(t);
2354
+ const clientEventId = generateClientEventId();
2355
+ const effectiveControl = effectiveControlRef.current;
2356
+ const input = composeSendInput(sendText, clientEventId, extras, {
2357
+ ...pickedPolicy(policyPickedRef, policyRef),
2358
+ ...effectiveControl?.controlEtag ? { controlEtag: effectiveControl.controlEtag } : {},
2359
+ resources,
2360
+ annotations: annotationsAtSend
2361
+ });
2362
+ const currentPayload = currentDraftPayload();
2363
+ const hasEarlierUnsettledSend = optimisticSendsRef.current.some(
2364
+ (candidate) => candidate.state !== "failed" || candidate.outcomeUnknown === true
2365
+ );
2366
+ const operation = {
2367
+ clientEventId,
2368
+ delivery: "send",
2369
+ ...steerOrSend && !steerOrSendUnsupportedRef.current ? { steerOrSend: true } : {},
2370
+ destination: effectiveControl?.state === "paused" || hasEarlierUnsettledSend ? "queue" : sendDestinationRef.current?.() ?? "chat",
2371
+ text: sendText,
2372
+ annotations: annotationsAtSend,
2373
+ resources,
2374
+ occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
2375
+ state: "sending",
2376
+ input,
2377
+ draftPayload: currentPayload ? { ...currentPayload, text: sendText } : null,
2378
+ newerShadow: {
2379
+ text: explicit === void 0 ? "" : valueRef.current,
2380
+ resources: explicit === void 0 ? [] : [...restoredResourcesRef.current],
2381
+ annotations: explicit === void 0 ? [] : cloneAnnotations(annotationsRef.current),
2382
+ policy: pickedPolicy(policyPickedRef, policyRef)
2383
+ },
2384
+ canRetry: true
2385
+ };
2386
+ if (explicit === void 0) {
2387
+ valueRef.current = "";
2388
+ annotationsRef.current = [];
2389
+ restoredResourcesRef.current = [];
2390
+ localEditRevision.current += 1;
2391
+ setValue("");
2392
+ setAnnotations([]);
2393
+ setAnnotationReviewTargetId(null);
2394
+ setRestoredResources([]);
2395
+ }
2396
+ replaceOptimisticSends((current) => [...current, operation]);
2397
+ queueMicrotask(processOptimisticSends);
2398
+ setError(null);
2399
+ onSubmitted?.(sendText, input);
2400
+ return true;
2401
+ },
2402
+ [
2403
+ currentDraftPayload,
2404
+ dispatch,
2405
+ onSubmitted,
2406
+ processOptimisticSends,
2407
+ replaceOptimisticSends,
2408
+ sending,
2409
+ sessionId,
2410
+ targetKey,
2411
+ t
2412
+ ]
2413
+ );
2414
+ const steer = useCallback(async (text) => await dispatch("steer", text), [dispatch]);
2415
+ const takesBusyPath = useCallback(
2416
+ () => effectiveControlRef.current?.state !== "paused" && sendDestinationRef.current?.() === "queue",
2417
+ []
2418
+ );
2419
+ const send = useCallback(
2420
+ async (explicit) => {
2421
+ if (busySendRef.current === "steer" && pendingOperationRef.current?.delivery !== "send" && takesBusyPath()) {
2422
+ return await dispatch("steer", explicit, true);
2423
+ }
2424
+ return await sendToQueue(explicit, busySendRef.current === "steer");
2425
+ },
2426
+ [dispatch, sendToQueue, takesBusyPath]
2427
+ );
2428
+ const sendAlternate = useCallback(
2429
+ async (explicit) => busySendRef.current === "steer" ? await sendToQueue(explicit) : await steer(explicit),
2430
+ [sendToQueue, steer]
2431
+ );
2432
+ const alternateSend = !singleSend && takesBusyPath() ? busySend === "steer" ? "queue" : "steer" : null;
2433
+ const retryOptimisticMessage = useCallback(
2434
+ (clientEventId) => {
2435
+ if (sendBlockedRef.current?.() === true) return;
2436
+ const currentSteering = steeringRef.current;
2437
+ if (currentSteering?.phase === "failed" && currentSteering.clientEventId === clientEventId) {
2438
+ void dispatch("steer");
2439
+ return;
2440
+ }
2441
+ replaceOptimisticSends(
2442
+ (current) => current.map((operation) => {
2443
+ if (operation.clientEventId !== clientEventId || operation.state !== "failed") {
2444
+ return operation;
2445
+ }
2446
+ if (operation.outcomeUnknown) {
2447
+ return { ...operation, state: "sending", error: void 0 };
2448
+ }
2449
+ if (operation.retryable === false) return operation;
2450
+ const nextClientEventId = generateClientEventId();
2451
+ const currentPersonalResourceAttachment = resolveSendExtras(
2452
+ sendExtrasRef.current
2453
+ ).personalResourceAttachment;
2454
+ const retryInput = composeSendInput(
2455
+ operation.text,
2456
+ nextClientEventId,
2457
+ {
2458
+ ...operation.input,
2459
+ ...currentPersonalResourceAttachment ? { personalResourceAttachment: currentPersonalResourceAttachment } : {}
2460
+ },
2461
+ {
2462
+ ...effectiveControlRef.current?.controlEtag ? { controlEtag: effectiveControlRef.current.controlEtag } : {},
2463
+ resources: operation.resources,
2464
+ annotations: operation.annotations
2465
+ }
2466
+ );
2467
+ return {
2468
+ ...operation,
2469
+ clientEventId: nextClientEventId,
2470
+ input: retryInput,
2471
+ draftPayload: operation.draftPayload,
2472
+ // A new key goes ahead from the draft as it is now.
2473
+ expectedDraftRevision: void 0,
2474
+ occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
2475
+ state: "sending",
2476
+ error: void 0,
2477
+ retryable: void 0,
2478
+ outcomeUnknown: false,
2479
+ canRetry: true
2480
+ };
2481
+ })
2482
+ );
2483
+ queueMicrotask(processOptimisticSends);
2484
+ },
2485
+ [dispatch, processOptimisticSends, replaceOptimisticSends]
2486
+ );
2487
+ const removeOptimisticMessage = useCallback(
2488
+ (clientEventId) => {
2489
+ if (steeringRef.current?.clientEventId === clientEventId) {
2490
+ pendingOperationRef.current = null;
2491
+ pendingClientEventId.current = null;
2492
+ forgetPendingComposerOperation(pendingComposerOperationKey(workspaceId, sessionId));
2493
+ setSteering(null);
2494
+ setError(null);
2495
+ return;
2496
+ }
2497
+ const removed = optimisticSendsRef.current.find(
2498
+ (operation) => operation.clientEventId === clientEventId
2499
+ );
2500
+ replaceOptimisticSends(
2501
+ (current) => current.filter((operation) => operation.clientEventId !== clientEventId)
2502
+ );
2503
+ if (removed?.state === "failed" && removed.draftPayload) {
2504
+ void forgetRemovedSendDraft(removed.draftPayload);
2505
+ }
2506
+ },
2507
+ [forgetRemovedSendDraft, replaceOptimisticSends, sessionId, workspaceId]
2508
+ );
2509
+ const hasReadyResources = restoredResources.length > 0 || (resolveSendExtras(sendExtrasRef.current).resources?.length ?? 0) > 0;
2510
+ const hasPendingOperation = pendingOperationRef.current !== null;
2511
+ const annotationsComplete = annotations.every((annotation) => annotation.note.trim().length > 0);
2512
+ const pause = useCallback(
2513
+ async (reason) => {
2514
+ const ownedTargetKey = targetKey;
2515
+ const ownedGeneration = targetGeneration.current;
2516
+ if (!sessionId || pausing || targetKeyRef.current !== ownedTargetKey) {
2517
+ return;
2518
+ }
2519
+ setPausing(true);
2520
+ setError(null);
2521
+ try {
2522
+ const clientEventId = generateClientEventId();
2523
+ const effectiveControl = effectiveControlRef.current;
2524
+ const result = await replayOutcomeUnknown(
2525
+ () => client.pauseSession(workspaceId, sessionId, {
2526
+ clientEventId,
2527
+ ...reason !== void 0 ? { reason } : {},
2528
+ ...effectiveControl?.controlEtag ? { expectedControlEtag: effectiveControl.controlEtag } : {}
2529
+ })
2530
+ );
2531
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2532
+ setAcceptedControl(result.effectiveControl);
2533
+ }
2534
+ } catch (cause) {
2535
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2536
+ setError(markActionFailure(normalizeError(cause)));
2537
+ }
2538
+ } finally {
2539
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2540
+ setPausing(false);
2541
+ }
2542
+ }
2543
+ },
2544
+ [client, workspaceId, sessionId, pausing, targetKey]
2545
+ );
2546
+ const resume = useCallback(
2547
+ async (reason) => {
2548
+ const ownedTargetKey = targetKey;
2549
+ const ownedGeneration = targetGeneration.current;
2550
+ if (!sessionId || resuming || targetKeyRef.current !== ownedTargetKey) return;
2551
+ setResuming(true);
2552
+ setError(null);
2553
+ try {
2554
+ const clientEventId = generateClientEventId();
2555
+ const effectiveControl = effectiveControlRef.current;
2556
+ const result = await replayOutcomeUnknown(
2557
+ () => client.resumeSession(workspaceId, sessionId, {
2558
+ clientEventId,
2559
+ ...reason !== void 0 ? { reason } : {},
2560
+ ...effectiveControl?.controlEtag ? { expectedControlEtag: effectiveControl.controlEtag } : {}
2561
+ })
2562
+ );
2563
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2564
+ setAcceptedControl(result.effectiveControl);
2565
+ }
2566
+ } catch (cause) {
2567
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2568
+ setError(markActionFailure(normalizeError(cause)));
2569
+ }
2570
+ } finally {
2571
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2572
+ setResuming(false);
2573
+ }
2574
+ }
2575
+ },
2576
+ [client, workspaceId, sessionId, resuming, targetKey]
2577
+ );
2578
+ const resumeScope = useCallback(
2579
+ async (option) => {
2580
+ const ownedTargetKey = targetKey;
2581
+ const ownedGeneration = targetGeneration.current;
2582
+ if (!sessionId || resuming || targetKeyRef.current !== ownedTargetKey) return;
2583
+ setResuming(true);
2584
+ setError(null);
2585
+ try {
2586
+ if (option.scope === "workspace") {
2587
+ const workspaceBlocker = effectiveControlRef.current?.blockers.find(
2588
+ (blocker) => blocker.kind === "workspace"
2589
+ );
2590
+ if (!client.setWorkspaceInferenceState) {
2591
+ throw new ComposerWorkspaceControlUnavailableError();
2592
+ }
2593
+ const clientEventId = generateClientEventId();
2594
+ await replayOutcomeUnknown(
2595
+ () => client.setWorkspaceInferenceState(workspaceId, {
2596
+ action: "resume",
2597
+ clientEventId,
2598
+ ...workspaceBlocker ? { expectedRevision: workspaceBlocker.revision } : {}
2599
+ })
2600
+ );
2601
+ } else if (option.scope === "session" && option.targetId) {
2602
+ const target = await client.getQueue(workspaceId, option.targetId);
2603
+ if (targetKeyRef.current !== ownedTargetKey || targetGeneration.current !== ownedGeneration) {
2604
+ return;
2605
+ }
2606
+ const clientEventId = generateClientEventId();
2607
+ await replayOutcomeUnknown(
2608
+ () => client.resumeSession(workspaceId, option.targetId, {
2609
+ clientEventId,
2610
+ expectedControlEtag: target.effectiveControl.controlEtag
2611
+ })
2612
+ );
2613
+ } else {
2614
+ const clientEventId = generateClientEventId();
2615
+ const effectiveControl = effectiveControlRef.current;
2616
+ const result = await replayOutcomeUnknown(
2617
+ () => client.resumeSession(workspaceId, sessionId, {
2618
+ clientEventId,
2619
+ ...effectiveControl?.controlEtag ? { expectedControlEtag: effectiveControl.controlEtag } : {}
2620
+ })
2621
+ );
2622
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2623
+ setAcceptedControl(result.effectiveControl);
2624
+ }
2625
+ }
2626
+ } catch (cause) {
2627
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2628
+ setError(markActionFailure(asError(cause)));
2629
+ }
2630
+ } finally {
2631
+ if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
2632
+ setResuming(false);
2633
+ }
2634
+ }
2635
+ },
2636
+ [client, resuming, sessionId, targetKey, workspaceId]
2637
+ );
2638
+ const updateValue = useCallback(
2639
+ (next) => {
2640
+ if (targetKeyRef.current !== targetKey) return;
2641
+ localEditRevision.current += 1;
2642
+ valueRef.current = next;
2643
+ pendingOperationRef.current = updatePendingComposerShadow(
2644
+ pendingOperationKey,
2645
+ pendingOperationRef.current,
2646
+ {
2647
+ text: next,
2648
+ resources: mergeResources(
2649
+ restoredResourcesRef.current,
2650
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
2651
+ ),
2652
+ annotations: annotationsRef.current,
2653
+ policy: pickedPolicy(policyPickedRef, policyRef)
2654
+ }
2655
+ );
2656
+ setOptimisticDraftShadow({
2657
+ text: next,
2658
+ resources: mergeResources(
2659
+ restoredResourcesRef.current,
2660
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
2661
+ ),
2662
+ annotations: annotationsRef.current,
2663
+ policy: pickedPolicy(policyPickedRef, policyRef)
2664
+ });
2665
+ setValue(next);
2666
+ },
2667
+ [pendingOperationKey, setOptimisticDraftShadow, targetKey]
2668
+ );
2669
+ const updateAnnotations = useCallback(
2670
+ (next, reviewTargetId = null) => {
2671
+ if (targetKeyRef.current !== targetKey) return;
2672
+ localEditRevision.current += 1;
2673
+ annotationsRef.current = next;
2674
+ pendingOperationRef.current = updatePendingComposerShadow(
2675
+ pendingOperationKey,
2676
+ pendingOperationRef.current,
2677
+ {
2678
+ text: valueRef.current,
2679
+ resources: mergeResources(
2680
+ restoredResourcesRef.current,
2681
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
2682
+ ),
2683
+ annotations: next,
2684
+ policy: pickedPolicy(policyPickedRef, policyRef)
2685
+ }
2686
+ );
2687
+ setOptimisticDraftShadow({
2688
+ text: valueRef.current,
2689
+ resources: mergeResources(
2690
+ restoredResourcesRef.current,
2691
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
2692
+ ),
2693
+ annotations: next,
2694
+ policy: pickedPolicy(policyPickedRef, policyRef)
2695
+ });
2696
+ setAnnotations(next);
2697
+ setAnnotationReviewTargetId(reviewTargetId);
2698
+ },
2699
+ [pendingOperationKey, setOptimisticDraftShadow, targetKey]
2700
+ );
2701
+ const addAnnotation = useCallback(
2702
+ (annotation) => {
2703
+ const next = [...annotationsRef.current, annotation];
2704
+ updateAnnotations(next, annotation.id);
2705
+ },
2706
+ [updateAnnotations]
2707
+ );
2708
+ const updateAnnotation = useCallback(
2709
+ (id, note) => {
2710
+ updateAnnotations(
2711
+ annotationsRef.current.map(
2712
+ (annotation) => annotation.id === id ? { ...annotation, note } : annotation
2713
+ )
2714
+ );
2715
+ },
2716
+ [updateAnnotations]
2717
+ );
2718
+ const removeAnnotation = useCallback(
2719
+ (id) => {
2720
+ updateAnnotations(annotationsRef.current.filter((annotation) => annotation.id !== id));
2721
+ },
2722
+ [updateAnnotations]
2723
+ );
2724
+ const clearAnnotationReviewTarget = useCallback(() => {
2725
+ setAnnotationReviewTargetId(null);
2726
+ }, []);
2727
+ const requestAnnotationReview = useCallback((id) => {
2728
+ const current = annotationsRef.current;
2729
+ if (current.length === 0) {
2730
+ setAnnotationReviewTargetId(null);
2731
+ return;
2732
+ }
2733
+ if (id && current.some((annotation) => annotation.id === id)) {
2734
+ setAnnotationReviewTargetId(id);
2735
+ return;
2736
+ }
2737
+ const incomplete = current.find((annotation) => annotation.note.trim().length === 0);
2738
+ setAnnotationReviewTargetId(incomplete?.id ?? current[0].id);
2739
+ }, []);
2740
+ const updatePolicy = useCallback(
2741
+ (next) => {
2742
+ if (targetKeyRef.current !== targetKey) return;
2743
+ localEditRevision.current += 1;
2744
+ policyRef.current = next;
2745
+ policyPickedRef.current = true;
2746
+ savePickPromptlyRef.current = true;
2747
+ setPolicyPicked(policyPickedRef.current);
2748
+ const shadow = {
2749
+ text: valueRef.current,
2750
+ resources: mergeResources(
2751
+ restoredResourcesRef.current,
2752
+ resolveSendExtras(sendExtrasRef.current).resources ?? []
2753
+ ),
2754
+ annotations: annotationsRef.current,
2755
+ policy: next
2756
+ };
2757
+ pendingOperationRef.current = updatePendingComposerShadow(
2758
+ pendingOperationKey,
2759
+ pendingOperationRef.current,
2760
+ shadow
2761
+ );
2762
+ setOptimisticDraftShadow(shadow);
2763
+ setPolicy(next);
2764
+ },
2765
+ [pendingOperationKey, setOptimisticDraftShadow, targetKey]
2766
+ );
2767
+ const updateModel = useCallback(
2768
+ (model) => {
2769
+ const current = policyRef.current;
2770
+ if (current) updatePolicy({ ...current, model });
2771
+ },
2772
+ [updatePolicy]
2773
+ );
2774
+ const updateReasoningEffort = useCallback(
2775
+ (reasoningEffort) => {
2776
+ const current = policyRef.current;
2777
+ if (current) updatePolicy({ ...current, reasoningEffort });
2778
+ },
2779
+ [updatePolicy]
2780
+ );
2781
+ const updateLatencyMode = useCallback(
2782
+ (latencyMode) => {
2783
+ const current = policyRef.current;
2784
+ if (current) updatePolicy({ ...current, latencyMode });
2785
+ },
2786
+ [updatePolicy]
2787
+ );
2788
+ const removeRestoredResource = useCallback(
2789
+ (index) => {
2790
+ if (targetKeyRef.current !== targetKey) return;
2791
+ localEditRevision.current += 1;
2792
+ const next = restoredResourcesRef.current.filter((_, candidate) => candidate !== index);
2793
+ restoredResourcesRef.current = next;
2794
+ pendingOperationRef.current = updatePendingComposerShadow(
2795
+ pendingOperationKey,
2796
+ pendingOperationRef.current,
2797
+ {
2798
+ text: valueRef.current,
2799
+ resources: mergeResources(next, resolveSendExtras(sendExtrasRef.current).resources ?? []),
2800
+ annotations: annotationsRef.current,
2801
+ policy: pickedPolicy(policyPickedRef, policyRef)
2802
+ }
2803
+ );
2804
+ setOptimisticDraftShadow({
2805
+ text: valueRef.current,
2806
+ resources: mergeResources(next, resolveSendExtras(sendExtrasRef.current).resources ?? []),
2807
+ annotations: annotationsRef.current,
2808
+ policy: pickedPolicy(policyPickedRef, policyRef)
2809
+ });
2810
+ setRestoredResources(next);
2811
+ },
2812
+ [pendingOperationKey, setOptimisticDraftShadow, targetKey]
2813
+ );
2814
+ const hasDraftContent = useCallback(() => {
2815
+ const current = draftRef.current;
2816
+ const extras = resolveSendExtras(sendExtrasRef.current);
2817
+ return valueRef.current.length > 0 || annotationsRef.current.length > 0 || restoredResourcesRef.current.length > 0 || (extras.resources?.length ?? 0) > 0 || current?.sourceTurnId !== null && current?.sourceTurnId !== void 0;
2818
+ }, []);
2819
+ const restoreOptimisticMessage = useCallback(
2820
+ (clientEventId) => {
2821
+ if (targetKeyRef.current !== targetKey || draftLoading || pendingOperationRef.current || hasDraftContent())
2822
+ return;
2823
+ const operation = optimisticSendsRef.current.find(
2824
+ (candidate) => candidate.clientEventId === clientEventId
2825
+ );
2826
+ if (!operation || operation.state !== "failed" || operation.outcomeUnknown) return;
2827
+ localEditRevision.current += 1;
2828
+ valueRef.current = operation.text;
2829
+ restoredResourcesRef.current = [...operation.resources];
2830
+ annotationsRef.current = cloneAnnotations(operation.annotations);
2831
+ setValue(operation.text);
2832
+ setRestoredResources(restoredResourcesRef.current);
2833
+ setAnnotations(annotationsRef.current);
2834
+ setError(null);
2835
+ setOptimisticDraftShadow({
2836
+ text: operation.text,
2837
+ resources: restoredResourcesRef.current,
2838
+ annotations: annotationsRef.current,
2839
+ policy: pickedPolicy(policyPickedRef, policyRef)
2840
+ });
2841
+ replaceOptimisticSends(
2842
+ (current) => current.filter((candidate) => candidate.clientEventId !== clientEventId)
2843
+ );
2844
+ },
2845
+ [draftLoading, hasDraftContent, replaceOptimisticSends, setOptimisticDraftShadow, targetKey]
2846
+ );
2847
+ const resolveDraftConflict = useCallback(
2848
+ async (choice) => {
2849
+ const ownedTargetKey = targetKey;
2850
+ const ownedGeneration = targetGeneration.current;
2851
+ if (!sessionId || !durableDrafts || targetKeyRef.current !== ownedTargetKey) return;
2852
+ const remote = await client.getComposerDraft(workspaceId, sessionId);
2853
+ if (targetKeyRef.current !== ownedTargetKey || targetGeneration.current !== ownedGeneration) {
2854
+ return;
2855
+ }
2856
+ if (choice === "use_remote") {
2857
+ applyDraft(remote);
2858
+ setError(null);
2859
+ return;
2860
+ }
2861
+ draftRef.current = remote;
2862
+ setDraft(remote);
2863
+ setDraftConflict(null);
2864
+ setError(null);
2865
+ const payload = currentDraftPayload();
2866
+ if (payload) {
2867
+ await persistPayload({ ...payload, expectedRevision: remote.revision }, void 0);
2868
+ }
2869
+ },
2870
+ [
2871
+ applyDraft,
2872
+ client,
2873
+ currentDraftPayload,
2874
+ durableDrafts,
2875
+ persistPayload,
2876
+ sessionId,
2877
+ targetKey,
2878
+ workspaceId
2879
+ ]
2880
+ );
2881
+ const identityMatches = stateTargetKey === targetKey;
2882
+ const visibleSteering = identityMatches ? steering : null;
2883
+ const visibleOptimisticMessages = identityMatches ? [
2884
+ ...optimisticSends.map(
2885
+ ({ input: _input, draftPayload: _payload, canRetry: _retry, ...item }) => item
2886
+ ),
2887
+ ...visibleSteering?.clientEventId ? [
2888
+ {
2889
+ clientEventId: visibleSteering.clientEventId,
2890
+ delivery: "steer",
2891
+ destination: "chat",
2892
+ text: visibleSteering.text,
2893
+ annotations: pendingOperationRef.current?.delivery === "steer" ? pendingOperationRef.current.annotationsAtSend : [],
2894
+ resources: pendingOperationRef.current?.delivery === "steer" ? pendingOperationRef.current.resourcesAtSend : [],
2895
+ occurredAt: steeringOccurredAtRef.current,
2896
+ state: visibleSteering.phase === "submitting" ? "sending" : visibleSteering.phase === "failed" ? "failed" : "queued",
2897
+ turnId: visibleSteering.turnId,
2898
+ triggerEventId: visibleSteering.triggerEventId,
2899
+ ...visibleSteering.error ? { error: visibleSteering.error } : {},
2900
+ ...visibleSteering.outcomeUnknown !== void 0 ? { outcomeUnknown: visibleSteering.outcomeUnknown } : {}
2901
+ }
2902
+ ] : []
2903
+ ] : [];
2904
+ const reloadDraft = useCallback(async () => await loadDraft(true), [loadDraft]);
2905
+ const clearError = useCallback(() => {
2906
+ if (targetKeyRef.current !== targetKey) return;
2907
+ setError(null);
2908
+ setDraftReadError(null);
2909
+ setDraftConflict(null);
2910
+ }, [targetKey]);
2911
+ const visibleValue = identityMatches ? valueRef.current : "";
2912
+ return {
2913
+ value: visibleValue,
2914
+ setValue: updateValue,
2915
+ annotations: identityMatches ? annotations : [],
2916
+ addAnnotation,
2917
+ updateAnnotation,
2918
+ removeAnnotation,
2919
+ annotationReviewTargetId: identityMatches ? annotationReviewTargetId : null,
2920
+ clearAnnotationReviewTarget,
2921
+ requestAnnotationReview,
2922
+ hasDraftContent,
2923
+ send,
2924
+ sendToQueue,
2925
+ busySend,
2926
+ singleSend,
2927
+ alternateSend: identityMatches ? alternateSend : null,
2928
+ working: identityMatches && takesBusyPath(),
2929
+ sendAlternate: singleSend ? void 0 : sendAlternate,
2930
+ optimisticMessages: visibleOptimisticMessages,
2931
+ retryOptimisticMessage,
2932
+ restoreOptimisticMessage: !draftLoading && !pendingOperationRef.current && !hasDraftContent() ? restoreOptimisticMessage : void 0,
2933
+ removeOptimisticMessage,
2934
+ steer,
2935
+ steering: visibleSteering,
2936
+ // Receipt-backed: an accepted Steer stops the previous attempt, and an
2937
+ // accepted Pause whose receipt still reports physical settlement stops the
2938
+ // current one. Once the authoritative control catches up, the queue
2939
+ // snapshot owns this projection.
2940
+ stoppingAttempt: identityMatches ? visibleSteering?.phase === "accepted" && visibleSteering.stoppingPreviousAttempt === true ? "previous" : pendingAcceptedControl?.state === "paused" && pendingAcceptedControl.settlement !== null ? "current" : null : null,
2941
+ sending: identityMatches ? sending : false,
2942
+ canSend: identityMatches && Boolean(sessionId) && !sending && !draftLoading && policy !== null && sendBlockedRef.current?.() !== true && annotationsComplete && (hasPendingOperation || visibleValue.trim().length > 0 || hasReadyResources || annotations.length > 0),
2943
+ // The saved draft is still loading, or its first read is being retried:
2944
+ // an early Send waits for it (the composer bounds how long).
2945
+ preparing: identityMatches ? Boolean(sessionId) && (draftLoading || draftHydrationRetrying) : Boolean(sessionId) && durableDrafts,
2946
+ pause,
2947
+ pausing: identityMatches ? pausing : false,
2948
+ resume,
2949
+ resumeScope,
2950
+ resuming: identityMatches ? resuming : false,
2951
+ effectiveControl: identityMatches ? effectiveControlRef.current : null,
2952
+ draft: identityMatches ? draft : null,
2953
+ draftRevision: identityMatches ? draft?.revision ?? 0 : 0,
2954
+ draftLoading: identityMatches ? draftLoading : Boolean(sessionId) && durableDrafts,
2955
+ draftSaving: identityMatches ? draftSaving : false,
2956
+ draftConflict: identityMatches ? draftConflict : null,
2957
+ flushDraft,
2958
+ policy: identityMatches ? policy : null,
2959
+ sendPolicy: identityMatches && policyPicked ? policy : null,
2960
+ setModel: updateModel,
2961
+ setReasoningEffort: updateReasoningEffort,
2962
+ setLatencyMode: updateLatencyMode,
2963
+ draftPersistence: durableDrafts ? "durable" : "disabled",
2964
+ applyDraft,
2965
+ reloadDraft,
2966
+ resolveDraftConflict,
2967
+ restoredResources: identityMatches ? restoredResources : [],
2968
+ removeRestoredResource,
2969
+ ...sessionId ? {
2970
+ fileSource: {
2971
+ // The SDK client reads files; a narrower session proxy without
2972
+ // those reads shows restored files as named chips.
2973
+ client,
2974
+ workspaceId,
2975
+ sessionId
2976
+ }
2977
+ } : {},
2978
+ error: identityMatches ? error ?? draftReadError : null,
2979
+ clearError,
2980
+ canBuyCredits: options.canBuyCredits ?? true,
2981
+ reconnecting: identityMatches ? serviceWaiting : false
2982
+ };
2983
+ }
2984
+ function isComposerDraftEvent(event) {
2985
+ return event.type === "user.message" || event.type === "session.queue.changed" || // A following draft shows the chat's settings, which this event changes.
2986
+ event.type === "session.model_settings.updated";
2987
+ }
2988
+ var FILE_ONLY_MESSAGE_TEXT = (t) => t("hooks.useComposer.seeAttachedContext");
2989
+ function resolveSendExtras(extras) {
2990
+ return (typeof extras === "function" ? extras() : extras) ?? {};
2991
+ }
2992
+ function composeSendInput(text, clientEventId, extras, bound = {}) {
2993
+ return { ...resolveSendExtras(extras), ...bound, text, clientEventId };
2994
+ }
2995
+ function shouldSubmitOnKey(event) {
2996
+ if (event.key !== "Enter" || event.shiftKey) {
2997
+ return false;
2998
+ }
2999
+ return event.nativeEvent?.isComposing !== true;
3000
+ }
3001
+ function shouldSteerOnKey(event) {
3002
+ return event.metaKey === true || event.ctrlKey === true;
3003
+ }
3004
+ function generateClientEventId() {
3005
+ return globalThis.crypto.randomUUID();
3006
+ }
3007
+ function isOutcomeUnknownError(cause) {
3008
+ return typeof cause === "object" && cause !== null && cause.outcomeUnknown === true;
3009
+ }
3010
+ async function replayOutcomeUnknown(command) {
3011
+ try {
3012
+ return await command();
3013
+ } catch (cause) {
3014
+ if (!isOutcomeUnknownError(cause)) throw cause;
3015
+ return await command();
3016
+ }
3017
+ }
3018
+ function asError(cause) {
3019
+ return normalizeError(cause);
3020
+ }
3021
+ function promptRoutingFromAcceptedEvent(event) {
3022
+ if (typeof event?.payload !== "object" || event.payload === null || Array.isArray(event.payload)) {
3023
+ return null;
3024
+ }
3025
+ const routing = event.payload.routing;
3026
+ return routing === "accepted_for_execution" || routing === "queued_for_execution" || routing === "accepted_for_steering" ? routing : null;
3027
+ }
3028
+ function isDraftConflictError(error) {
3029
+ const apiError = error;
3030
+ return apiError.status === 409 && apiError.outcomeUnknown !== true && apiError.code === "DRAFT_CHANGED";
3031
+ }
3032
+ function draftPayload(draft) {
3033
+ return {
3034
+ expectedRevision: draft.revision,
3035
+ text: draft.text,
3036
+ resources: draft.resources,
3037
+ annotations: draft.annotations ?? [],
3038
+ // A draft that follows the chat's settings is saved without them.
3039
+ ...draft.policyFollowsSession ? {} : {
3040
+ model: draft.model,
3041
+ reasoningEffort: draft.reasoningEffort,
3042
+ latencyMode: draft.latencyMode
3043
+ }
3044
+ };
3045
+ }
3046
+ function policyFromDraft(draft) {
3047
+ return {
3048
+ model: draft.model,
3049
+ reasoningEffort: draft.reasoningEffort,
3050
+ latencyMode: draft.latencyMode
3051
+ };
3052
+ }
3053
+ function pickedPolicy(picked, policy) {
3054
+ return picked.current ? policy.current ?? void 0 : void 0;
3055
+ }
3056
+ function samePolicy(a, b) {
3057
+ return a !== null && a.model === b.model && a.reasoningEffort === b.reasoningEffort && a.latencyMode === b.latencyMode;
3058
+ }
3059
+ function composerDraftPayload(base, text, restoredResources, annotations, policy, additionalResources) {
3060
+ return {
3061
+ expectedRevision: base.revision,
3062
+ text,
3063
+ resources: mergeResources(restoredResources, additionalResources),
3064
+ annotations,
3065
+ ...policy ? {
3066
+ model: policy.model,
3067
+ reasoningEffort: policy.reasoningEffort,
3068
+ latencyMode: policy.latencyMode
3069
+ } : {}
3070
+ };
3071
+ }
3072
+ function draftSignature(payload) {
3073
+ const { expectedRevision: _revision, ...content } = payload;
3074
+ return JSON.stringify(content);
3075
+ }
3076
+ function pickNotSaved(payload, saved) {
3077
+ if (payload.model === void 0) return false;
3078
+ return !saved || saved.policyFollowsSession || saved.model !== payload.model || saved.reasoningEffort !== payload.reasoningEffort || saved.latencyMode !== payload.latencyMode;
3079
+ }
3080
+ function composerDraftHasContent(draft) {
3081
+ return draft.text.length > 0 || (draft.annotations ?? []).length > 0 || draft.resources.length > 0 || draft.sourceTurnId !== null;
3082
+ }
3083
+ var DRAFT_CONFLICT_REREADS = 3;
3084
+ var leftDraftSaves = /* @__PURE__ */ new Map();
3085
+ var pageDraftWrites = /* @__PURE__ */ new Map();
3086
+ var PAGE_DRAFT_WRITES_PER_CHAT = 8;
3087
+ var PAGE_DRAFT_WRITE_CHATS = 64;
3088
+ function rememberPageDraftWrite(chatKey, content) {
3089
+ const writes = (pageDraftWrites.get(chatKey) ?? []).filter((write) => write !== content);
3090
+ writes.push(content);
3091
+ pageDraftWrites.delete(chatKey);
3092
+ pageDraftWrites.set(chatKey, writes.slice(-PAGE_DRAFT_WRITES_PER_CHAT));
3093
+ if (pageDraftWrites.size > PAGE_DRAFT_WRITE_CHATS) {
3094
+ const oldest = pageDraftWrites.keys().next().value;
3095
+ if (oldest !== void 0) pageDraftWrites.delete(oldest);
3096
+ }
3097
+ }
3098
+ function isPageDraftWrite(chatKey, content) {
3099
+ return pageDraftWrites.get(chatKey)?.includes(content) ?? false;
3100
+ }
3101
+ function sendDraftBasis(base, basis) {
3102
+ if (!base) return { revision: void 0, behind: false };
3103
+ if (basis !== null && basis < base.revision) return { revision: basis, behind: true };
3104
+ return { revision: base.revision, behind: false };
3105
+ }
3106
+ var LEFT_DRAFT_SAVE_WAIT_MS = 3e3;
3107
+ function delay(ms) {
3108
+ return new Promise((resolve) => setTimeout(resolve, ms));
3109
+ }
3110
+ function saveLeftDraft(unsaved, settledWrites, previousSaves) {
3111
+ const left = unsaved.current;
3112
+ unsaved.current = null;
3113
+ if (!left) return;
3114
+ const chatKey = `${left.workspaceId}\0${left.sessionId}`;
3115
+ const content = draftContentKey(left.payload);
3116
+ const save = previousSaves.catch(() => void 0).then(async () => {
3117
+ const settled = settledWrites.get(chatKey);
3118
+ const base = left.payload.expectedRevision;
3119
+ if (settled && settled.revision >= base && settled.content === content) return;
3120
+ const request = {
3121
+ ...left.payload,
3122
+ expectedRevision: Math.max(settled?.revision ?? base, base)
3123
+ };
3124
+ rememberPageDraftWrite(chatKey, content);
3125
+ const saved = await left.client.saveComposerDraft(left.workspaceId, left.sessionId, request);
3126
+ settledWrites.set(chatKey, { revision: saved.revision, content });
3127
+ }).catch(() => void 0).finally(() => {
3128
+ if (leftDraftSaves.get(chatKey) === save) leftDraftSaves.delete(chatKey);
3129
+ });
3130
+ leftDraftSaves.set(chatKey, save);
3131
+ }
3132
+ function draftContentKey(payload) {
3133
+ const { expectedRevision: _revision, resources, ...content } = payload;
3134
+ return JSON.stringify({ ...content, resources: resources.map(resourceIdentity) });
3135
+ }
3136
+ function resourceIdentity(resource) {
3137
+ return resource.kind === "file" ? `file:${resource.fileId}\0${resource.mountPath ?? `${DEFAULT_FILE_RESOURCE_MOUNT_ROOT}/${resource.fileId}`}` : JSON.stringify(resource);
3138
+ }
3139
+ function mergeResources(base, additions) {
3140
+ const seen = /* @__PURE__ */ new Set();
3141
+ return [...base, ...additions].filter((resource) => {
3142
+ const key = resourceIdentity(resource);
3143
+ if (seen.has(key)) return false;
3144
+ seen.add(key);
3145
+ return true;
3146
+ });
3147
+ }
3148
+
3149
+ export {
3150
+ notifyObserver,
3151
+ forgetAllComposerOperations,
3152
+ useComposer,
3153
+ FILE_ONLY_MESSAGE_TEXT,
3154
+ composeSendInput,
3155
+ shouldSubmitOnKey,
3156
+ shouldSteerOnKey
3157
+ };
3158
+ //# sourceMappingURL=chunk-TDW5CSO5.js.map