@opengeni/react 6.36.1-canary.45090389523001 → 6.37.0

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 (1144) hide show
  1. package/dist/app/app-state.js +31 -31
  2. package/dist/app/components/Composer.js +44 -44
  3. package/dist/app/components/add-card-dialog.js +1 -1
  4. package/dist/app/components/add-card.js +2 -2
  5. package/dist/app/components/agent/agent-capability-picker.js +9 -9
  6. package/dist/app/components/agents/agent-can-use.js +47 -46
  7. package/dist/app/components/agents/agent-form-page.js +143 -139
  8. package/dist/app/components/agents/agent-form-page.js.map +1 -1
  9. package/dist/app/components/agents/agent-page.js +125 -121
  10. package/dist/app/components/agents/agent-setup-sections.js +77 -73
  11. package/dist/app/components/agents/agent-skills.js +13 -13
  12. package/dist/app/components/agents/agent-trigger-chat-field.js +6 -6
  13. package/dist/app/components/agents/agent-trigger-dialog.js +34 -31
  14. package/dist/app/components/agents/agent-trigger-model.d.ts +14 -0
  15. package/dist/app/components/agents/agent-trigger-picker.js +9 -8
  16. package/dist/app/components/agents/agent-trigger-repositories.d.ts +9 -0
  17. package/dist/app/components/agents/agent-trigger-repositories.js +31 -0
  18. package/dist/app/components/agents/agents-page.css +1905 -0
  19. package/dist/app/components/agents/agents-page.css.map +1 -0
  20. package/dist/app/components/agents/agents-page.js +160 -115
  21. package/dist/app/components/agents/agents-page.js.map +1 -1
  22. package/dist/app/components/agents/composer-agent-chip.js +60 -60
  23. package/dist/app/components/agents/session-agent-chip.js +55 -55
  24. package/dist/app/components/artifacts/app-package.js +11 -11
  25. package/dist/app/components/artifacts/artifact-browse-controls.js +3 -3
  26. package/dist/app/components/artifacts/artifact-library.css +1905 -0
  27. package/dist/app/components/artifacts/artifact-library.css.map +1 -0
  28. package/dist/app/components/artifacts/artifact-library.js +28 -28
  29. package/dist/app/components/artifacts/artifact-page-chrome.js +1 -1
  30. package/dist/app/components/artifacts/artifact-viewer.css +1905 -0
  31. package/dist/app/components/artifacts/artifact-viewer.css.map +1 -0
  32. package/dist/app/components/artifacts/artifact-viewer.js +65 -65
  33. package/dist/app/components/artifacts/chat-interactive-block.js +27 -27
  34. package/dist/app/components/artifacts/copy-artifact-link.js +1 -1
  35. package/dist/app/components/artifacts/file-reach-dialog.js +12 -12
  36. package/dist/app/components/artifacts/inline-chat-image.js +52 -52
  37. package/dist/app/components/artifacts/ready-made-apps.css +1905 -0
  38. package/dist/app/components/artifacts/ready-made-apps.css.map +1 -0
  39. package/dist/app/components/artifacts/ready-made-apps.d.ts +3 -0
  40. package/dist/app/components/artifacts/ready-made-apps.js +40 -0
  41. package/dist/app/components/artifacts/retained-file-preview.js +58 -58
  42. package/dist/app/components/artifacts/retained-text-preview.js +8 -8
  43. package/dist/app/components/artifacts/site-actions.js +12 -12
  44. package/dist/app/components/artifacts/site-audience.js +7 -7
  45. package/dist/app/components/artifacts/site-conversations.js +34 -34
  46. package/dist/app/components/artifacts/site-data.js +26 -26
  47. package/dist/app/components/artifacts/site-public-link.js +3 -3
  48. package/dist/app/components/artifacts/site-publishing-page.js +69 -69
  49. package/dist/app/components/artifacts/site-publishing.js +54 -54
  50. package/dist/app/components/artifacts/site-settings.js +68 -68
  51. package/dist/app/components/artifacts/site-version-menu.js +9 -9
  52. package/dist/app/components/billing-class-mark.js +7 -7
  53. package/dist/app/components/capabilities/capability-detail-sheet.js +17 -17
  54. package/dist/app/components/capabilities/capability-logo-source.js +29 -28
  55. package/dist/app/components/capabilities/capability-logo.js +1 -1
  56. package/dist/app/components/capabilities/connection-account-picker.js +2 -2
  57. package/dist/app/components/capabilities/connector-tool-permissions.js +8 -8
  58. package/dist/app/components/capabilities/native-connect-setup.js +32 -31
  59. package/dist/app/components/capabilities/own-logins-shared-heads-up.js +6 -6
  60. package/dist/app/components/capabilities/perform-capability-action.js +4 -4
  61. package/dist/app/components/capabilities/prepared-mcp-setup-card.js +32 -31
  62. package/dist/app/components/capabilities/session-capability-card.js +141 -140
  63. package/dist/app/components/capabilities/session-capability-card.js.map +1 -1
  64. package/dist/app/components/capabilities/session-chrome-card.js +48 -48
  65. package/dist/app/components/capabilities/session-connect-inputs-card.js +34 -33
  66. package/dist/app/components/capabilities/session-custom-mcp-card.js +39 -38
  67. package/dist/app/components/capabilities/session-github-card.js +44 -43
  68. package/dist/app/components/capabilities/session-machine-card.js +49 -49
  69. package/dist/app/components/capabilities/session-personal-github-card.js +33 -32
  70. package/dist/app/components/capabilities/session-plugin-card.js +21 -21
  71. package/dist/app/components/capabilities/use-capabilities-catalog.js +1 -1
  72. package/dist/app/components/capabilities/use-connection-accounts.js +3 -3
  73. package/dist/app/components/chat-payment-pages.js +2 -2
  74. package/dist/app/components/command-menu/chat-status.js +26 -26
  75. package/dist/app/components/command-menu/chat-switcher.js +86 -86
  76. package/dist/app/components/command-menu/command-menu.js +110 -110
  77. package/dist/app/components/command-menu/shortcut-sheet.js +24 -24
  78. package/dist/app/components/composer-capabilities-menu-body.js +7 -7
  79. package/dist/app/components/composer-mobile-plus-panel.js +29 -29
  80. package/dist/app/components/composer-mobile-plus.js +3 -3
  81. package/dist/app/components/credit-required-gate.js +6 -6
  82. package/dist/app/components/credit-required-prompt.js +20 -20
  83. package/dist/app/components/credits/checkout-credits-celebration.js +1 -1
  84. package/dist/app/components/credits/checkout-return.js +1 -1
  85. package/dist/app/components/credits/coupon-redeem.js +1 -1
  86. package/dist/app/components/credits/credit-refusal-notice.js +8 -8
  87. package/dist/app/components/credits/own-subscription-plan-notice.js +3 -3
  88. package/dist/app/components/desktop/app-shots.js +9 -9
  89. package/dist/app/components/desktop/app-update.js +3 -3
  90. package/dist/app/components/desktop/computer-use.js +3 -3
  91. package/dist/app/components/desktop/this-computer.js +6 -6
  92. package/dist/app/components/feedback.js +10 -10
  93. package/dist/app/components/follow-up-repository-menu-body.js +14 -14
  94. package/dist/app/components/follow-up-repository-picker.js +1 -1
  95. package/dist/app/components/github-app-connect-launcher.js +2 -2
  96. package/dist/app/components/in-app-help-link.js +3 -3
  97. package/dist/app/components/knowledge/agent-learning-settings.js +3 -3
  98. package/dist/app/components/machines/connect-machine-dialog.js +24 -24
  99. package/dist/app/components/manual-repository-editor.js +3 -3
  100. package/dist/app/components/markdown.js +16 -16
  101. package/dist/app/components/model-identity.js +3 -3
  102. package/dist/app/components/models/models-ui.js +17 -17
  103. package/dist/app/components/models/provider-mark.js +3 -3
  104. package/dist/app/components/models/subscription-usage.js +5 -5
  105. package/dist/app/components/my-things.js +15 -15
  106. package/dist/app/components/own-where-it-works.js +10 -10
  107. package/dist/app/components/personal-resource-attachment-surface.js +4 -4
  108. package/dist/app/components/pickers.js +12 -12
  109. package/dist/app/components/rail/channel-create-dialog.js +6 -6
  110. package/dist/app/components/rail/project-glyph.js +53 -53
  111. package/dist/app/components/rail/project-profile.js +74 -74
  112. package/dist/app/components/rail/rail-context.js +2 -2
  113. package/dist/app/components/rail/rail-sections.js +157 -157
  114. package/dist/app/components/rail/session-header.js +124 -124
  115. package/dist/app/components/rail/session-list.js +156 -156
  116. package/dist/app/components/rail/session-row-content.js +6 -6
  117. package/dist/app/components/rail/session-row-hover-details.js +37 -37
  118. package/dist/app/components/rail/session-shell.js +194 -194
  119. package/dist/app/components/rail/site-session-group-heading.js +36 -36
  120. package/dist/app/components/repository-picker.js +14 -14
  121. package/dist/app/components/secrets/session-secrets-panel.js +4 -4
  122. package/dist/app/components/session/agent-configuration-panel.js +48 -48
  123. package/dist/app/components/session/artifact-session-page.js +7 -7
  124. package/dist/app/components/session/banners.js +20 -20
  125. package/dist/app/components/session/chat-avatar.js +53 -53
  126. package/dist/app/components/session/console-new-conversation.js +111 -111
  127. package/dist/app/components/session/descendant-requests.js +109 -109
  128. package/dist/app/components/session/editable-artifacts-workspace.css +1905 -0
  129. package/dist/app/components/session/editable-artifacts-workspace.css.map +1 -0
  130. package/dist/app/components/session/editable-artifacts-workspace.js +59 -59
  131. package/dist/app/components/session/failed-session-banner.js +27 -27
  132. package/dist/app/components/session/failure-recovery-boundary.js +3 -3
  133. package/dist/app/components/session/human-input-delegation-record.js +3 -3
  134. package/dist/app/components/session/human-input.js +88 -88
  135. package/dist/app/components/session/inspector.js +146 -146
  136. package/dist/app/components/session/linked-panel.js +3 -3
  137. package/dist/app/components/session/message-actions.js +10 -10
  138. package/dist/app/components/session/model-recovery-notice.js +4 -4
  139. package/dist/app/components/session/new-session-settings-menu.js +29 -29
  140. package/dist/app/components/session/new-session-setup-strip.js +56 -56
  141. package/dist/app/components/session/pull-request-panel.js +25 -25
  142. package/dist/app/components/session/sandbox-recovery-actions.js +3 -3
  143. package/dist/app/components/session/sandbox-switcher.js +22 -22
  144. package/dist/app/components/session/sandbox-workspace.js +119 -119
  145. package/dist/app/components/session/search-markdown-highlight.js +17 -17
  146. package/dist/app/components/session/search-results-view.js +18 -18
  147. package/dist/app/components/session/session-admin-access.js +13 -13
  148. package/dist/app/components/session/session-admission-notice.js +11 -11
  149. package/dist/app/components/session/session-avatar-picker.js +60 -60
  150. package/dist/app/components/session/session-avatar.js +55 -55
  151. package/dist/app/components/session/session-machine-access-notice.js +11 -11
  152. package/dist/app/components/session/session-profile-dialog.js +71 -71
  153. package/dist/app/components/session/session-profile-editor.js +72 -72
  154. package/dist/app/components/session/session-retention.js +6 -6
  155. package/dist/app/components/session/session-search-dialog.js +20 -20
  156. package/dist/app/components/session/session-skill-reviews.js +5 -5
  157. package/dist/app/components/session/session-tenancy-control.js +26 -26
  158. package/dist/app/components/session/session-unattended-setting.js +1 -1
  159. package/dist/app/components/session/session-usage-limit-section.js +11 -11
  160. package/dist/app/components/session/share-chat-dialog.js +10 -10
  161. package/dist/app/components/session/subagents.js +23 -23
  162. package/dist/app/components/session/subscription-account-indicator.js +25 -25
  163. package/dist/app/components/session/subscription-account-menu.js +7 -7
  164. package/dist/app/components/session-connectors-menu-body.js +10 -10
  165. package/dist/app/components/settings/row-select.js +6 -6
  166. package/dist/app/components/toaster.js +2 -2
  167. package/dist/app/components/transcription-settings.js +10 -10
  168. package/dist/app/components/ui/destructive-confirm.js +10 -10
  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 +43 -42
  172. package/dist/app/components/workspace-reach.js +6 -6
  173. package/dist/app/embed/session-app.js +398 -397
  174. package/dist/app/lib/actions/actions-provider.js +18 -18
  175. package/dist/app/lib/agent-capabilities.js +4 -4
  176. package/dist/app/lib/app-connect-card.js +14 -14
  177. package/dist/app/lib/app-shared-key-dialog.js +8 -8
  178. package/dist/app/lib/app-surfaces.js +1 -1
  179. package/dist/app/lib/app-sync-opt-in.js +4 -4
  180. package/dist/app/lib/codex-usage-query.js +3 -3
  181. package/dist/app/lib/composer-agent.js +2 -2
  182. package/dist/app/lib/composer-connectors.js +33 -32
  183. package/dist/app/lib/composer-send-blocking.js +2 -2
  184. package/dist/app/lib/console-site.js +6 -6
  185. package/dist/app/lib/console-text.js +2 -2
  186. package/dist/app/lib/events.js +30 -30
  187. package/dist/app/lib/failed-session-copy.js +5 -5
  188. package/dist/app/lib/feedback-capture.js +2 -2
  189. package/dist/app/lib/model-access-onboarding.js +4 -4
  190. package/dist/app/lib/move-chat-to-machine.js +5 -5
  191. package/dist/app/lib/personal-resource-attachments.js +1 -1
  192. package/dist/app/lib/ready-made-apps.d.ts +14 -0
  193. package/dist/app/lib/ready-made-apps.js +8 -0
  194. package/dist/app/lib/session-branch-cache.js +19 -19
  195. package/dist/app/lib/session-create.js +5 -5
  196. package/dist/app/lib/session-group-pagination.js +19 -19
  197. package/dist/app/lib/session-hover-facts.js +26 -26
  198. package/dist/app/lib/session-list-dirty-scopes.js +20 -20
  199. package/dist/app/lib/session-model.js +2 -2
  200. package/dist/app/lib/session-rail.js +16 -16
  201. package/dist/app/lib/session-rename.js +3 -3
  202. package/dist/app/lib/sessions-group.js +23 -23
  203. package/dist/app/lib/site-tool-consent-dialog.js +23 -23
  204. package/dist/app/lib/site-tool-consent.js +1 -1
  205. package/dist/app/lib/turn-failure-analytics.js +7 -7
  206. package/dist/app/lib/use-artifact-catalog.js +2 -2
  207. package/dist/app/lib/use-duplicate-site.js +4 -4
  208. package/dist/app/lib/use-follow-up-repositories.js +5 -5
  209. package/dist/app/lib/use-personal-resource-attachment.js +2 -2
  210. package/dist/app/lib/use-workspace-machines.js +9 -9
  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 +17 -17
  216. package/dist/app/routes/app-page.js +2 -2
  217. package/dist/app/routes/artifacts.css +1905 -0
  218. package/dist/app/routes/artifacts.css.map +1 -0
  219. package/dist/app/routes/artifacts.js +188 -177
  220. package/dist/app/routes/artifacts.js.map +1 -1
  221. package/dist/app/routes/retained-artifact.js +109 -109
  222. package/dist/app/routes/session-unavailable.js +5 -5
  223. package/dist/app/routes/session.js +250 -249
  224. package/dist/app/routes/sessions-index-hydration.js +6 -6
  225. package/dist/app/routes/sessions-index.js +208 -207
  226. package/dist/app/routes/site-view.js +197 -197
  227. package/dist/artifacts-document.js +4 -4
  228. package/dist/artifacts-presentation.js +7 -7
  229. package/dist/artifacts-spreadsheet.js +4 -4
  230. package/dist/artifacts.js +50 -50
  231. package/dist/automation-model.js +6 -6
  232. package/dist/automations.d.ts +1 -0
  233. package/dist/automations.js +81 -74
  234. package/dist/automations.js.map +1 -1
  235. package/dist/browser-viewer-5JGSKIXX.js +23 -0
  236. package/dist/chat-interactive-block-NEDFTOGE.js +22 -0
  237. package/dist/chunk-22SXRKET.js +72 -0
  238. package/dist/chunk-2JR7LEST.js +357 -0
  239. package/dist/chunk-2L6B6766.js +5915 -0
  240. package/dist/chunk-2L6B6766.js.map +1 -0
  241. package/dist/chunk-2LBYEHBH.js +570 -0
  242. package/dist/chunk-2MHIIF4N.js +141 -0
  243. package/dist/chunk-2NABGWXC.js +391 -0
  244. package/dist/chunk-2PTBF6GM.js +92 -0
  245. package/dist/chunk-2PTBF6GM.js.map +1 -0
  246. package/dist/chunk-2VX42S4W.js +773 -0
  247. package/dist/chunk-2X7I6LXY.js +111 -0
  248. package/dist/chunk-34LWIEIZ.js +399 -0
  249. package/dist/chunk-3F45ELUO.js +1187 -0
  250. package/dist/chunk-3J6ENWZF.js +93 -0
  251. package/dist/chunk-3PTEMOSW.js +129 -0
  252. package/dist/chunk-3UA2SOK2.js +83 -0
  253. package/dist/chunk-3YKED2ZV.js +307 -0
  254. package/dist/chunk-44MYJQ72.js +129 -0
  255. package/dist/chunk-46UZ5ZYU.js +532 -0
  256. package/dist/chunk-4NXQWXQY.js +230 -0
  257. package/dist/chunk-4OGDD2EM.js +2434 -0
  258. package/dist/chunk-4PSB2CK7.js +412 -0
  259. package/dist/chunk-4R74CAIF.js +283 -0
  260. package/dist/chunk-4RGFBD4M.js +4565 -0
  261. package/dist/chunk-4SNYMZBC.js +389 -0
  262. package/dist/chunk-4ST37B5I.js +4957 -0
  263. package/dist/chunk-4ST37B5I.js.map +1 -0
  264. package/dist/chunk-4UAHTM3Q.js +107 -0
  265. package/dist/chunk-4YWHOAB4.js +201 -0
  266. package/dist/chunk-5AHIKB3O.js +449 -0
  267. package/dist/chunk-5AXIZJX4.js +84 -0
  268. package/dist/chunk-5CEQ356Z.js +353 -0
  269. package/dist/chunk-5ERDSF2C.js +79 -0
  270. package/dist/chunk-5G6UHUJZ.js +43 -0
  271. package/dist/chunk-5H3SJHDT.js +137 -0
  272. package/dist/chunk-5ZTVBNMS.js +162 -0
  273. package/dist/chunk-5ZUARMG2.js +211 -0
  274. package/dist/chunk-6AGNZI2W.js +437 -0
  275. package/dist/chunk-6F34IWSA.js +47 -0
  276. package/dist/chunk-6F34IWSA.js.map +1 -0
  277. package/dist/chunk-6IIJ4H4O.js +407 -0
  278. package/dist/chunk-6YCYPXDA.js +114 -0
  279. package/dist/chunk-6YTNMDFP.js +318 -0
  280. package/dist/chunk-6ZJU2B3Z.js +50 -0
  281. package/dist/chunk-73O7NO3F.js +50 -0
  282. package/dist/chunk-7456QZAA.js +340 -0
  283. package/dist/chunk-754NH7T2.js +383 -0
  284. package/dist/chunk-7GS2MGFU.js +27 -0
  285. package/dist/chunk-7IR7EOTR.js +3070 -0
  286. package/dist/chunk-7MH4TTVE.js +132 -0
  287. package/dist/chunk-7N35XBSC.js +386 -0
  288. package/dist/chunk-7ND2VMKV.js +270 -0
  289. package/dist/chunk-7RVJLO3N.js +154 -0
  290. package/dist/chunk-7X443ZTQ.js +246 -0
  291. package/dist/chunk-7XZO4W76.js +1152 -0
  292. package/dist/chunk-ABGHRGID.js +376 -0
  293. package/dist/chunk-ABGHRGID.js.map +1 -0
  294. package/dist/chunk-AEH34OOU.js +298 -0
  295. package/dist/chunk-AML5X74C.js +538 -0
  296. package/dist/chunk-AVIOWKKJ.js +246 -0
  297. package/dist/chunk-AY4XH73V.js +1333 -0
  298. package/dist/chunk-BGT43KDL.js +42 -0
  299. package/dist/chunk-BHS4KW4W.js +3851 -0
  300. package/dist/chunk-BKJXUACP.js +366 -0
  301. package/dist/chunk-BNWO72C2.js +851 -0
  302. package/dist/chunk-BT5EOSQF.js +65 -0
  303. package/dist/chunk-BVFOLLMQ.js +229 -0
  304. package/dist/chunk-CC2IVNVR.js +572 -0
  305. package/dist/chunk-CGVMECYX.js +131 -0
  306. package/dist/chunk-CLERWAEA.js +2317 -0
  307. package/dist/chunk-COCLT77F.js +818 -0
  308. package/dist/chunk-COIXX62I.js +723 -0
  309. package/dist/chunk-D32VVOBJ.js +738 -0
  310. package/dist/chunk-D32VVOBJ.js.map +1 -0
  311. package/dist/chunk-DHVA3T3K.js +271 -0
  312. package/dist/chunk-DKM3JBGJ.js +335 -0
  313. package/dist/chunk-DNRVXHUW.js +187 -0
  314. package/dist/chunk-DP4MGOBG.js +158 -0
  315. package/dist/chunk-DRVT6TRP.js +270 -0
  316. package/dist/chunk-DV3OECO6.js +333 -0
  317. package/dist/chunk-DYQRNIID.js +73 -0
  318. package/dist/chunk-DZZSFPMW.js +66 -0
  319. package/dist/chunk-DZZSFPMW.js.map +1 -0
  320. package/dist/chunk-E45JRR3J.js +138 -0
  321. package/dist/chunk-E5EICKKB.js +469 -0
  322. package/dist/chunk-E7FNLQXM.js +400 -0
  323. package/dist/chunk-EFBPHDPP.js +170 -0
  324. package/dist/chunk-EJ6IIEZX.js +554 -0
  325. package/dist/chunk-ENYULVQW.js +114 -0
  326. package/dist/chunk-EXBIL5BF.js +247 -0
  327. package/dist/chunk-F23TR625.js +283 -0
  328. package/dist/chunk-F45CPW3Y.js +3321 -0
  329. package/dist/chunk-F5C5T2PF.js +401 -0
  330. package/dist/chunk-F5C7DTVR.js +103 -0
  331. package/dist/chunk-F5RP42TL.js +598 -0
  332. package/dist/chunk-F5RP42TL.js.map +1 -0
  333. package/dist/chunk-F6D6X5ZU.js +378 -0
  334. package/dist/chunk-F6LVPEBK.js +188 -0
  335. package/dist/chunk-FARCOS2S.js +274 -0
  336. package/dist/chunk-FEQVCQMK.js +138 -0
  337. package/dist/chunk-FGHWU4LX.js +113 -0
  338. package/dist/chunk-FHNBUDXL.js +351 -0
  339. package/dist/chunk-FLDF2Z44.js +396 -0
  340. package/dist/chunk-FT3AUAXE.js +1309 -0
  341. package/dist/chunk-FWIV2FTX.js +26 -0
  342. package/dist/chunk-GGIPEZLL.js +849 -0
  343. package/dist/chunk-GGPZPBHS.js +215 -0
  344. package/dist/chunk-GHXIVKQH.js +67 -0
  345. package/dist/chunk-GIEGIEMT.js +311 -0
  346. package/dist/chunk-GLBILBET.js +166 -0
  347. package/dist/chunk-GMMB4NCN.js +250 -0
  348. package/dist/chunk-GP7MYBSX.js +56 -0
  349. package/dist/chunk-GYHL6IRO.js +404 -0
  350. package/dist/chunk-HGS5JWZR.js +126 -0
  351. package/dist/chunk-HRFAQYOA.js +124 -0
  352. package/dist/chunk-HUKGLWAY.js +174 -0
  353. package/dist/chunk-HUTQJY3F.js +23 -0
  354. package/dist/chunk-HWOYJOKK.js +266 -0
  355. package/dist/chunk-HYFNKXHR.js +251 -0
  356. package/dist/chunk-HYNTTDG6.js +1019 -0
  357. package/dist/chunk-HZ5DTSAG.js +57 -0
  358. package/dist/chunk-I2WTJMQF.js +3110 -0
  359. package/dist/chunk-I7HYF6MQ.js +1803 -0
  360. package/dist/chunk-I7HYF6MQ.js.map +1 -0
  361. package/dist/chunk-IBHUF5BN.js +278 -0
  362. package/dist/chunk-IH3J7VWW.js +85 -0
  363. package/dist/chunk-IHX5BADQ.js +200 -0
  364. package/dist/chunk-IL5ME4MQ.js +380 -0
  365. package/dist/chunk-IL5ME4MQ.js.map +1 -0
  366. package/dist/chunk-IL6PCX7K.js +91 -0
  367. package/dist/chunk-IOMZDY5D.js +199 -0
  368. package/dist/chunk-IPFSFSIK.js +428 -0
  369. package/dist/chunk-ISR6KXWT.js +898 -0
  370. package/dist/chunk-IYUZPNMU.js +79 -0
  371. package/dist/chunk-IYUZPNMU.js.map +1 -0
  372. package/dist/chunk-J2GIGAVJ.js +107 -0
  373. package/dist/chunk-J4OOKDRV.js +40 -0
  374. package/dist/chunk-J5D5OCQF.js +371 -0
  375. package/dist/chunk-JTSLGUVP.js +196 -0
  376. package/dist/chunk-JXIBVYRA.js +276 -0
  377. package/dist/chunk-JY2UEPJP.js +33 -0
  378. package/dist/chunk-KI2TGJVH.js +41 -0
  379. package/dist/chunk-KPTKQULD.js +287 -0
  380. package/dist/chunk-KYDLVMKA.js +99 -0
  381. package/dist/chunk-KZQDP2JM.js +155 -0
  382. package/dist/chunk-L2Q4HMVJ.js +202 -0
  383. package/dist/chunk-LCRYAD3X.js +259 -0
  384. package/dist/chunk-LFQI2C46.js +175 -0
  385. package/dist/chunk-M4ZYHLFU.js +292 -0
  386. package/dist/chunk-M5FX5KH5.js +629 -0
  387. package/dist/chunk-MAR5UYX4.js +191 -0
  388. package/dist/chunk-MATYGLUT.js +121 -0
  389. package/dist/chunk-MCXTYDFG.js +449 -0
  390. package/dist/chunk-MDI6SH7B.js +27 -0
  391. package/dist/chunk-MIMSPOV4.js +1356 -0
  392. package/dist/chunk-MM4NP5QA.js +98 -0
  393. package/dist/chunk-MQTYIBY6.js +263 -0
  394. package/dist/chunk-MSHWYGCH.js +175 -0
  395. package/dist/chunk-MSIQ42IY.js +794 -0
  396. package/dist/chunk-MXRCKJOQ.js +2553 -0
  397. package/dist/chunk-MXSZQ6DP.js +296 -0
  398. package/dist/chunk-N37BLJOI.js +2412 -0
  399. package/dist/chunk-N556VQMT.js +406 -0
  400. package/dist/chunk-NL7VJGFZ.js +1021 -0
  401. package/dist/chunk-NLJEDAKV.js +2984 -0
  402. package/dist/chunk-NUZNJSL5.js +285 -0
  403. package/dist/chunk-O3LOQDTI.js +176 -0
  404. package/dist/chunk-O4ZXJ52Z.js +772 -0
  405. package/dist/chunk-O5PZRVQR.js +214 -0
  406. package/dist/chunk-OEOLXODE.js +373 -0
  407. package/dist/chunk-OZGECHF5.js +52 -0
  408. package/dist/chunk-P4N7ZS6W.js +56 -0
  409. package/dist/chunk-P6LSLNSL.js +209 -0
  410. package/dist/chunk-PC2JAIAH.js +117 -0
  411. package/dist/chunk-PCSRHFRF.js +75 -0
  412. package/dist/chunk-PEAJRZU3.js +134 -0
  413. package/dist/chunk-PGMXITPB.js +85 -0
  414. package/dist/chunk-PJ42LTJE.js +249 -0
  415. package/dist/chunk-PJ66EIWE.js +82 -0
  416. package/dist/chunk-PKH6MYAK.js +311 -0
  417. package/dist/chunk-PMBZMVKE.js +33 -0
  418. package/dist/chunk-PTSRBKQC.js +118 -0
  419. package/dist/chunk-QD4J7AHU.js +1024 -0
  420. package/dist/chunk-QD6A4G7Y.js +158 -0
  421. package/dist/chunk-QEXHABRN.js +265 -0
  422. package/dist/chunk-QHYLEJP7.js +505 -0
  423. package/dist/chunk-QL4Q332Z.js +12 -0
  424. package/dist/chunk-QL5227KT.js +1184 -0
  425. package/dist/chunk-QMRHY45R.js +107 -0
  426. package/dist/chunk-QPA7ATJH.js +103 -0
  427. package/dist/chunk-QREYGVWO.js +297 -0
  428. package/dist/chunk-QREYGVWO.js.map +1 -0
  429. package/dist/chunk-QXPKUKOV.js +227 -0
  430. package/dist/chunk-R2T4IUNB.js +29 -0
  431. package/dist/chunk-R6CFPY3F.js +278 -0
  432. package/dist/chunk-R6OBJ7LF.js +131 -0
  433. package/dist/chunk-R6WQLIFX.js +73 -0
  434. package/dist/chunk-RA3NTKSW.js +1236 -0
  435. package/dist/chunk-RJWTAS4V.js +523 -0
  436. package/dist/chunk-RJZALNT5.js +391 -0
  437. package/dist/chunk-RMDLTRLI.js +372 -0
  438. package/dist/chunk-RVPH6BB7.js +218 -0
  439. package/dist/chunk-RVXLSVJH.js +931 -0
  440. package/dist/chunk-RWHDMGFG.js +214 -0
  441. package/dist/chunk-RYB3WBMZ.js +113 -0
  442. package/dist/chunk-S2525GSA.js +403 -0
  443. package/dist/chunk-S3BLYPOG.js +175 -0
  444. package/dist/chunk-S7J4HBPP.js +584 -0
  445. package/dist/chunk-SA3XI7FB.js +108 -0
  446. package/dist/chunk-SN2QZSJU.js +168 -0
  447. package/dist/chunk-SNACGK3Z.js +177 -0
  448. package/dist/chunk-SUXGKBCW.js +3690 -0
  449. package/dist/chunk-SWTPVMR4.js +251 -0
  450. package/dist/chunk-SXXWPTL7.js +269 -0
  451. package/dist/chunk-T2IFOASN.js +4480 -0
  452. package/dist/chunk-T2IFOASN.js.map +1 -0
  453. package/dist/chunk-T2N6JC5H.js +37 -0
  454. package/dist/chunk-TBUOHK6R.js +608 -0
  455. package/dist/chunk-TCUAGCAX.js +1628 -0
  456. package/dist/chunk-TGAKM3WX.js +187 -0
  457. package/dist/chunk-TGG3ODCS.js +99 -0
  458. package/dist/chunk-THWN4STY.js +850 -0
  459. package/dist/chunk-THWN4STY.js.map +1 -0
  460. package/dist/chunk-TMZ6RP3K.js +234 -0
  461. package/dist/chunk-TNE7ZYGN.js +2551 -0
  462. package/dist/chunk-TWSO5S3E.js +234 -0
  463. package/dist/chunk-U2TOOZIY.js +46 -0
  464. package/dist/chunk-UBM3IM6K.js +48 -0
  465. package/dist/chunk-UBR3CGJC.js +5089 -0
  466. package/dist/chunk-UFRXYZCJ.js +125 -0
  467. package/dist/chunk-UJNDUO7D.js +379 -0
  468. package/dist/chunk-UPRN4FBY.js +38 -0
  469. package/dist/chunk-UXGTI4HR.js +184 -0
  470. package/dist/chunk-UZKAHEQO.js +172 -0
  471. package/dist/chunk-V6ZJKHVS.js +1095 -0
  472. package/dist/chunk-VHYDZMGS.js +3176 -0
  473. package/dist/chunk-VIKXHP44.js +2580 -0
  474. package/dist/chunk-VJJKN675.js +10044 -0
  475. package/dist/chunk-VJJKN675.js.map +1 -0
  476. package/dist/chunk-VLDKWGHD.js +61 -0
  477. package/dist/chunk-VRS6VNHP.js +441 -0
  478. package/dist/chunk-VT5XHR5J.js +256 -0
  479. package/dist/chunk-VVLUVHF5.js +1177 -0
  480. package/dist/chunk-VVLUVHF5.js.map +1 -0
  481. package/dist/chunk-VVW2CBWK.js +21 -0
  482. package/dist/chunk-VVW2CBWK.js.map +1 -0
  483. package/dist/chunk-W7RKXZDV.js +112 -0
  484. package/dist/chunk-WBNSC6RJ.js +114 -0
  485. package/dist/chunk-WEPL76AR.js +110 -0
  486. package/dist/chunk-WJ2STMQD.js +236 -0
  487. package/dist/chunk-WSQ3TCOX.js +1263 -0
  488. package/dist/chunk-WT37FEG3.js +144 -0
  489. package/dist/chunk-WUKLEDKK.js +639 -0
  490. package/dist/chunk-X3T3N6W5.js +1022 -0
  491. package/dist/chunk-X7YUQ4WO.js +3996 -0
  492. package/dist/chunk-X7YUQ4WO.js.map +1 -0
  493. package/dist/chunk-XCEHQ3SO.js +316 -0
  494. package/dist/chunk-XCEHQ3SO.js.map +1 -0
  495. package/dist/chunk-XKJCFK2G.js +162 -0
  496. package/dist/chunk-XKLXYIIT.js +1185 -0
  497. package/dist/chunk-XMTBNLD2.js +650 -0
  498. package/dist/chunk-XZLNVFB4.js +515 -0
  499. package/dist/chunk-XZRMTHHW.js +15 -0
  500. package/dist/chunk-Y3ME7IF6.js +406 -0
  501. package/dist/chunk-Y6CNWBV3.js +264 -0
  502. package/dist/chunk-YJYKB6ZT.js +192 -0
  503. package/dist/chunk-YL2NFFXW.js +197 -0
  504. package/dist/chunk-YL2NFFXW.js.map +1 -0
  505. package/dist/chunk-YP4SNX4P.js +220 -0
  506. package/dist/chunk-YR7U2KDA.js +828 -0
  507. package/dist/chunk-YS6BQNHF.js +231 -0
  508. package/dist/chunk-Z7UBLC6V.js +133 -0
  509. package/dist/chunk-ZD67RM6G.js +60 -0
  510. package/dist/chunk-ZGBMDDFR.js +207 -0
  511. package/dist/chunk-ZGR7LNXC.js +432 -0
  512. package/dist/chunk-ZJICGGPI.js +48 -0
  513. package/dist/chunk-ZLKHNJCQ.js +178 -0
  514. package/dist/chunk-ZNA65Q6Y.js +20 -0
  515. package/dist/components/automations/pasted-webhook-steps.d.ts +29 -0
  516. package/dist/components/browser-viewer.d.ts +4 -1
  517. package/dist/components/human-input-form.d.ts +3 -4
  518. package/dist/components/use-fit-browser-viewport.d.ts +10 -0
  519. package/dist/composer.js +36 -36
  520. package/dist/computer-viewer-FHCBTSZH.js +21 -0
  521. package/dist/connect.js +33 -31
  522. package/dist/connection-step-up-JLORUM6D.js +146 -0
  523. package/dist/connection-step-up-JLORUM6D.js.map +1 -0
  524. package/dist/desktop-dictation.js +24 -24
  525. package/dist/desktop.js +2 -2
  526. package/dist/editor.js +2 -2
  527. package/dist/embedded-new-voice-BFTQZPJK.js +25 -0
  528. package/dist/embedded-voice-CQE2GO6Y.js +25 -0
  529. package/dist/fleet-decision-row-FJPAWNOQ.js +361 -0
  530. package/dist/in-chat-connect-model.js +5 -5
  531. package/dist/index.js +292 -292
  532. package/dist/interaction.js +9 -9
  533. package/dist/latest-question-F3VPDR7U.js +1 -1
  534. package/dist/machine-request-model.js +1 -1
  535. package/dist/machines.js +8 -8
  536. package/dist/meetings-recorder.js +1 -1
  537. package/dist/meetings.js +116 -116
  538. package/dist/messages/en.d.ts +1 -1
  539. package/dist/messages.js +1 -1
  540. package/dist/model-policy-picker-menu-PVBT2OZO.js +23 -0
  541. package/dist/payment-page-card-YPCRVFHE.js +226 -0
  542. package/dist/platform-activity-row-ZWACJPNQ.js +156 -0
  543. package/dist/queue-surface-implementation-C7ESPZW7.js +932 -0
  544. package/dist/realtime.js +17 -17
  545. package/dist/recorder-host-YPWPLMS6.js +80 -0
  546. package/dist/recordings.js +3 -3
  547. package/dist/sandbox-files-6L2GRNOG.js +28 -0
  548. package/dist/sandbox-files-6L2GRNOG.js.map +1 -0
  549. package/dist/session-app.js +398 -397
  550. package/dist/session-connect-cards-2TRJ5IWB.js +27 -0
  551. package/dist/session-connect-cards-2TRJ5IWB.js.map +1 -0
  552. package/dist/session-list-model.js +2 -2
  553. package/dist/session-realtime-AKDUKFY4.js +30 -0
  554. package/dist/session-realtime-AKDUKFY4.js.map +1 -0
  555. package/dist/session-realtime.js +2 -2
  556. package/dist/session-ui.js +95 -95
  557. package/dist/session.js +42 -42
  558. package/dist/sites.js +3 -3
  559. package/dist/terminal.js +2 -2
  560. package/dist/this-computer.js +3 -3
  561. package/dist/timeline-annotation-markers-7QSYK22C.js +157 -0
  562. package/dist/timeline-annotation-selection-XYNMESWL.js +208 -0
  563. package/dist/timeline-annotations-dialog-WSI6L2CP.js +283 -0
  564. package/dist/timeline-model.js +58 -58
  565. package/dist/ui/access-list.js +23 -23
  566. package/dist/ui/cadence-picker.js +7 -7
  567. package/dist/ui/choice-cards.js +3 -3
  568. package/dist/ui/confirm-dialog.js +2 -2
  569. package/dist/ui/copy-field.js +3 -3
  570. package/dist/ui/detail-page.js +5 -5
  571. package/dist/ui/detail-sheet.js +5 -5
  572. package/dist/ui/diff-view.js +3 -3
  573. package/dist/ui/disclosure.js +6 -6
  574. package/dist/ui/email-chips-input.js +3 -3
  575. package/dist/ui/field.js +2 -2
  576. package/dist/ui/flush-form-page.js +7 -7
  577. package/dist/ui/form-dialog.js +6 -6
  578. package/dist/ui/list-row.js +6 -6
  579. package/dist/ui/load-failure.js +3 -3
  580. package/dist/ui/relative-time.js +3 -3
  581. package/dist/ui/revision-history.js +13 -13
  582. package/dist/ui/role-select.js +11 -11
  583. package/dist/ui/select-menu.js +5 -5
  584. package/dist/ui/settings-nav.js +6 -6
  585. package/dist/ui/sheet.js +2 -2
  586. package/dist/ui/usage-meter.js +4 -4
  587. package/dist/usage.js +3 -3
  588. package/dist/workbench.js +11 -11
  589. package/package.json +5 -6
  590. package/src/app/components/agents/agent-skills.tsx +21 -18
  591. package/src/app/components/agents/agent-trigger-dialog.tsx +80 -119
  592. package/src/app/components/agents/agent-trigger-model.ts +47 -0
  593. package/src/app/components/agents/agent-trigger-repositories.tsx +88 -0
  594. package/src/app/components/agents/agents-page.tsx +118 -38
  595. package/src/app/components/artifacts/ready-made-apps.tsx +84 -0
  596. package/src/app/lib/ready-made-apps.tsx +42 -0
  597. package/src/app/routes/artifacts.tsx +11 -0
  598. package/src/automations.ts +8 -2
  599. package/src/components/automations/pasted-webhook-steps.tsx +89 -0
  600. package/src/components/browser-viewer.tsx +49 -7
  601. package/src/components/human-input-form.tsx +16 -5
  602. package/src/components/secret-question-field.tsx +42 -32
  603. package/src/components/use-fit-browser-viewport.ts +84 -0
  604. package/src/messages/en.ts +1 -1
  605. package/dist/browser-viewer-EIEMRVFF.js +0 -23
  606. package/dist/chat-interactive-block-FV37LWYZ.js +0 -22
  607. package/dist/chunk-2COBAJC7.js +0 -818
  608. package/dist/chunk-2HS3IUXE.js +0 -170
  609. package/dist/chunk-2IPAGZEO.js +0 -124
  610. package/dist/chunk-2JRHAEIT.js +0 -1095
  611. package/dist/chunk-2XGRHMRI.js +0 -250
  612. package/dist/chunk-34MODHMH.js +0 -56
  613. package/dist/chunk-34UXLCRX.js +0 -340
  614. package/dist/chunk-3HAEQMR4.js +0 -772
  615. package/dist/chunk-3SBKYPNM.js +0 -270
  616. package/dist/chunk-3Z7VA6ET.js +0 -114
  617. package/dist/chunk-46LZO4ZO.js +0 -188
  618. package/dist/chunk-46ZC5VNC.js +0 -38
  619. package/dist/chunk-4AH4EEHE.js +0 -298
  620. package/dist/chunk-4CJD7TMQ.js +0 -48
  621. package/dist/chunk-4D3YJNVN.js +0 -270
  622. package/dist/chunk-4EGWXBBZ.js +0 -403
  623. package/dist/chunk-4KASGJTF.js +0 -287
  624. package/dist/chunk-4MF2HU3S.js +0 -723
  625. package/dist/chunk-4QM2NMEB.js +0 -10036
  626. package/dist/chunk-4QM2NMEB.js.map +0 -1
  627. package/dist/chunk-4RUKLIOF.js +0 -1263
  628. package/dist/chunk-4RZBVDL5.js +0 -3996
  629. package/dist/chunk-4RZBVDL5.js.map +0 -1
  630. package/dist/chunk-54ZV4SUS.js +0 -134
  631. package/dist/chunk-5EJBPQI2.js +0 -41
  632. package/dist/chunk-5FZBRRFV.js +0 -335
  633. package/dist/chunk-5G4IGG7F.js +0 -209
  634. package/dist/chunk-5HV53SMN.js +0 -3070
  635. package/dist/chunk-5L66ERTV.js +0 -57
  636. package/dist/chunk-5OVRMKP5.js +0 -42
  637. package/dist/chunk-5QXEEW4T.js +0 -538
  638. package/dist/chunk-5SGTRULO.js +0 -1184
  639. package/dist/chunk-5SOL4INY.js +0 -572
  640. package/dist/chunk-5Y34P32B.js +0 -27
  641. package/dist/chunk-62HIKJ5F.js +0 -72
  642. package/dist/chunk-62T2ZPD5.js +0 -266
  643. package/dist/chunk-63VNZRLY.js +0 -386
  644. package/dist/chunk-67LBFBI3.js +0 -639
  645. package/dist/chunk-6CDBX3XG.js +0 -33
  646. package/dist/chunk-6D3D2JWY.js +0 -278
  647. package/dist/chunk-6DOIINY4.js +0 -201
  648. package/dist/chunk-6DQBUKGJ.js +0 -112
  649. package/dist/chunk-6SETNFNH.js +0 -1399
  650. package/dist/chunk-6SETNFNH.js.map +0 -1
  651. package/dist/chunk-6XYFMHNT.js +0 -56
  652. package/dist/chunk-6YPTBBVB.js +0 -129
  653. package/dist/chunk-6YU3WV2P.js +0 -33
  654. package/dist/chunk-72EOXOR7.js +0 -1185
  655. package/dist/chunk-72ND4ALI.js +0 -532
  656. package/dist/chunk-7AAUHFMA.js +0 -351
  657. package/dist/chunk-7E6P6MF4.js +0 -129
  658. package/dist/chunk-7G627O3U.js +0 -2553
  659. package/dist/chunk-7HHC5AAI.js +0 -110
  660. package/dist/chunk-7KP434J7.js +0 -137
  661. package/dist/chunk-7S2S4MXR.js +0 -138
  662. package/dist/chunk-7SYCHMXS.js +0 -200
  663. package/dist/chunk-7UDLRDHK.js +0 -214
  664. package/dist/chunk-7WJZWMZ4.js +0 -236
  665. package/dist/chunk-7YLQCMZP.js +0 -357
  666. package/dist/chunk-A5GX3CAE.js +0 -849
  667. package/dist/chunk-A67EXXQG.js +0 -192
  668. package/dist/chunk-A7EBV2EB.js +0 -318
  669. package/dist/chunk-AB5SPXUR.js +0 -114
  670. package/dist/chunk-AM7IK7DJ.js +0 -850
  671. package/dist/chunk-AM7IK7DJ.js.map +0 -1
  672. package/dist/chunk-AW5ZO2TH.js +0 -2412
  673. package/dist/chunk-AWK23Q32.js +0 -107
  674. package/dist/chunk-AYVWA6KD.js +0 -432
  675. package/dist/chunk-AYVWA6KD.js.map +0 -1
  676. package/dist/chunk-B45TB4HY.js +0 -931
  677. package/dist/chunk-B6AH43UQ.js +0 -2434
  678. package/dist/chunk-BA4WZGDW.js +0 -48
  679. package/dist/chunk-BIUJHNVR.js +0 -46
  680. package/dist/chunk-BJUOKUE5.js +0 -234
  681. package/dist/chunk-BNKEFQ4P.js +0 -4480
  682. package/dist/chunk-BNKEFQ4P.js.map +0 -1
  683. package/dist/chunk-BSHNNTJO.js +0 -114
  684. package/dist/chunk-BX7D2K7A.js +0 -1870
  685. package/dist/chunk-BX7D2K7A.js.map +0 -1
  686. package/dist/chunk-C6OM2SRG.js +0 -117
  687. package/dist/chunk-C7TVMFHV.js +0 -276
  688. package/dist/chunk-CBYDQWJ3.js +0 -246
  689. package/dist/chunk-CHSBOFAS.js +0 -131
  690. package/dist/chunk-CIRCUDKF.js +0 -1309
  691. package/dist/chunk-CPX6BHER.js +0 -554
  692. package/dist/chunk-CVC4RO7D.js +0 -155
  693. package/dist/chunk-D3YJAQGK.js +0 -103
  694. package/dist/chunk-DJWJMAUW.js +0 -383
  695. package/dist/chunk-DNAXAS5R.js +0 -406
  696. package/dist/chunk-DONBARLL.js +0 -154
  697. package/dist/chunk-DTLXQ3ZU.js +0 -373
  698. package/dist/chunk-DWBSK6LI.js +0 -505
  699. package/dist/chunk-E26LQV6X.js +0 -103
  700. package/dist/chunk-E7RH5F6S.js +0 -650
  701. package/dist/chunk-EDPH7AJH.js +0 -412
  702. package/dist/chunk-EILSPMVD.js +0 -133
  703. package/dist/chunk-EMWT6GOK.js +0 -437
  704. package/dist/chunk-EO22NST7.js +0 -259
  705. package/dist/chunk-ER5MYLIE.js +0 -256
  706. package/dist/chunk-ES5HKVQF.js +0 -234
  707. package/dist/chunk-F3LIUDXN.js +0 -738
  708. package/dist/chunk-F3LIUDXN.js.map +0 -1
  709. package/dist/chunk-F6QP4GSK.js +0 -515
  710. package/dist/chunk-F7JU2TYH.js +0 -1356
  711. package/dist/chunk-F7QEO7M2.js +0 -851
  712. package/dist/chunk-FJFGDLXB.js +0 -12
  713. package/dist/chunk-FKM2FLIG.js +0 -1024
  714. package/dist/chunk-FLLJ2WXW.js +0 -113
  715. package/dist/chunk-FPN4I4CG.js +0 -3690
  716. package/dist/chunk-FTZDP3CA.js +0 -1019
  717. package/dist/chunk-FU56FCAW.js +0 -789
  718. package/dist/chunk-FU56FCAW.js.map +0 -1
  719. package/dist/chunk-FXFOKD7A.js +0 -449
  720. package/dist/chunk-GBGCMHBB.js +0 -608
  721. package/dist/chunk-GIHE7U3Y.js +0 -174
  722. package/dist/chunk-GJ4GTYOD.js +0 -372
  723. package/dist/chunk-GLSDWNFV.js +0 -432
  724. package/dist/chunk-GM4UHGW6.js +0 -26
  725. package/dist/chunk-GMGAW3T6.js +0 -278
  726. package/dist/chunk-GNGI6XFN.js +0 -43
  727. package/dist/chunk-GO5VIAA7.js +0 -264
  728. package/dist/chunk-GP7BMUWR.js +0 -82
  729. package/dist/chunk-GSW4YHZE.js +0 -229
  730. package/dist/chunk-GUC6IWEY.js +0 -407
  731. package/dist/chunk-GWAY3SO5.js +0 -15
  732. package/dist/chunk-GXI3OMSR.js +0 -4565
  733. package/dist/chunk-GZZCVF76.js +0 -3851
  734. package/dist/chunk-H4VMHFOX.js +0 -214
  735. package/dist/chunk-HFROJDFQ.js +0 -118
  736. package/dist/chunk-HHFFPE67.js +0 -220
  737. package/dist/chunk-HKNMNL7B.js +0 -2984
  738. package/dist/chunk-I5FSUZVW.js +0 -584
  739. package/dist/chunk-IE6SSKKF.js +0 -2551
  740. package/dist/chunk-IGJR65GN.js +0 -1152
  741. package/dist/chunk-IGVQ2AI4.js +0 -307
  742. package/dist/chunk-IIXNEOK4.js +0 -1022
  743. package/dist/chunk-IM3WA5AL.js +0 -311
  744. package/dist/chunk-IX4P4OGR.js +0 -399
  745. package/dist/chunk-IXGZLCUP.js +0 -168
  746. package/dist/chunk-JB3TSUZO.js +0 -263
  747. package/dist/chunk-JCYP225Y.js +0 -111
  748. package/dist/chunk-JHSZSLVU.js +0 -67
  749. package/dist/chunk-JIC6RLUB.js +0 -27
  750. package/dist/chunk-JNJIZCTN.js +0 -172
  751. package/dist/chunk-JNV5ZPUV.js +0 -828
  752. package/dist/chunk-JPQFVR24.js +0 -50
  753. package/dist/chunk-JPZVMXDP.js +0 -1333
  754. package/dist/chunk-JVPF34MX.js +0 -215
  755. package/dist/chunk-K4JPMGB4.js +0 -166
  756. package/dist/chunk-K7IWU2T2.js +0 -202
  757. package/dist/chunk-KDO6ZW4U.js +0 -132
  758. package/dist/chunk-KED67KAF.js +0 -85
  759. package/dist/chunk-KJ72GMZ2.js +0 -378
  760. package/dist/chunk-KLUUDFTY.js +0 -158
  761. package/dist/chunk-KTGKGHEA.js +0 -75
  762. package/dist/chunk-KU77XHWB.js +0 -285
  763. package/dist/chunk-KVPQUADA.js +0 -5915
  764. package/dist/chunk-KVPQUADA.js.map +0 -1
  765. package/dist/chunk-KWGRRIUE.js +0 -371
  766. package/dist/chunk-KXBLLFOO.js +0 -249
  767. package/dist/chunk-L6WVCO6D.js +0 -61
  768. package/dist/chunk-LCSVFHIN.js +0 -230
  769. package/dist/chunk-LIOZ2MXJ.js +0 -380
  770. package/dist/chunk-LIOZ2MXJ.js.map +0 -1
  771. package/dist/chunk-LPEFULJY.js +0 -73
  772. package/dist/chunk-LR3LJ35V.js +0 -52
  773. package/dist/chunk-LRMGPO7E.js +0 -98
  774. package/dist/chunk-LVKTKORH.js +0 -121
  775. package/dist/chunk-M3DOLBNU.js +0 -283
  776. package/dist/chunk-MCPKUVMQ.js +0 -99
  777. package/dist/chunk-MFLU3466.js +0 -99
  778. package/dist/chunk-MHFCYU4K.js +0 -292
  779. package/dist/chunk-MIUJ3EH5.js +0 -60
  780. package/dist/chunk-MIUMNTIJ.js +0 -175
  781. package/dist/chunk-MO3XJQN2.js +0 -629
  782. package/dist/chunk-MQRHTOQ2.js +0 -218
  783. package/dist/chunk-MVYQDBE6.js +0 -79
  784. package/dist/chunk-NBUAHLMO.js +0 -1236
  785. package/dist/chunk-NEIBSGZP.js +0 -379
  786. package/dist/chunk-NFLBLJUA.js +0 -162
  787. package/dist/chunk-NUEFORM6.js +0 -2317
  788. package/dist/chunk-NZOFNQNC.js +0 -176
  789. package/dist/chunk-O664PL2U.js +0 -47
  790. package/dist/chunk-O664PL2U.js.map +0 -1
  791. package/dist/chunk-OKD2LBMK.js +0 -333
  792. package/dist/chunk-OMKCSTF6.js +0 -269
  793. package/dist/chunk-OXYAKUFU.js +0 -401
  794. package/dist/chunk-OYMSMU5O.js +0 -396
  795. package/dist/chunk-OZXEVHCS.js +0 -113
  796. package/dist/chunk-PCC3QUM6.js +0 -50
  797. package/dist/chunk-PGRKTQIW.js +0 -523
  798. package/dist/chunk-PJLHXFDD.js +0 -162
  799. package/dist/chunk-PPQJIVGM.js +0 -175
  800. package/dist/chunk-PYMQM65Y.js +0 -125
  801. package/dist/chunk-Q2QDZBNN.js +0 -175
  802. package/dist/chunk-QA5UNVHD.js +0 -85
  803. package/dist/chunk-QJMX27TG.js +0 -400
  804. package/dist/chunk-QMQF5U2D.js +0 -20
  805. package/dist/chunk-QNOWKKZ4.js +0 -40
  806. package/dist/chunk-QVOTPOXK.js +0 -29
  807. package/dist/chunk-QYZ5RVGM.js +0 -184
  808. package/dist/chunk-R7CVDKRN.js +0 -2580
  809. package/dist/chunk-R7CXWJAV.js +0 -107
  810. package/dist/chunk-RDZQFZOQ.js +0 -187
  811. package/dist/chunk-RIHKEGWS.js +0 -194
  812. package/dist/chunk-RIHKEGWS.js.map +0 -1
  813. package/dist/chunk-RPHXJHNX.js +0 -271
  814. package/dist/chunk-RVC3M66H.js +0 -191
  815. package/dist/chunk-RWCEUUEL.js +0 -187
  816. package/dist/chunk-S3OTJAAC.js +0 -283
  817. package/dist/chunk-S44LU4CK.js +0 -428
  818. package/dist/chunk-SERECSAR.js +0 -138
  819. package/dist/chunk-SRDHDIRQ.js +0 -177
  820. package/dist/chunk-SYA3WYG4.js +0 -1187
  821. package/dist/chunk-SYYFA7W7.js +0 -23
  822. package/dist/chunk-T4MHBXAU.js +0 -274
  823. package/dist/chunk-TFSCGFYV.js +0 -251
  824. package/dist/chunk-TGCKZOSX.js +0 -246
  825. package/dist/chunk-TMDL3CUH.js +0 -178
  826. package/dist/chunk-TSW2LQY3.js +0 -65
  827. package/dist/chunk-TSY6YZL2.js +0 -366
  828. package/dist/chunk-TW2RHTLH.js +0 -3321
  829. package/dist/chunk-TWA5G277.js +0 -141
  830. package/dist/chunk-TZZ2S4XI.js +0 -247
  831. package/dist/chunk-UFJDETKG.js +0 -108
  832. package/dist/chunk-UHCFYX4I.js +0 -570
  833. package/dist/chunk-UHTURYJO.js +0 -898
  834. package/dist/chunk-UPCZ7XB4.js +0 -441
  835. package/dist/chunk-UUE3OGXI.js +0 -84
  836. package/dist/chunk-UUNJ2E57.js +0 -391
  837. package/dist/chunk-UYQVWRAH.js +0 -199
  838. package/dist/chunk-UYWWUEL4.js +0 -126
  839. package/dist/chunk-V5HTJJVS.js +0 -93
  840. package/dist/chunk-V5Y74WII.js +0 -91
  841. package/dist/chunk-VAIOMRCN.js +0 -144
  842. package/dist/chunk-VB7YKA6B.js +0 -37
  843. package/dist/chunk-VGX636MB.js +0 -311
  844. package/dist/chunk-VGZLFQO2.js +0 -773
  845. package/dist/chunk-VM7XF2FB.js +0 -389
  846. package/dist/chunk-VPWKTIU5.js +0 -227
  847. package/dist/chunk-VXOLG6YB.js +0 -469
  848. package/dist/chunk-W2NAU5VB.js +0 -1628
  849. package/dist/chunk-W43S5UJT.js +0 -211
  850. package/dist/chunk-W5OHFSQJ.js +0 -5089
  851. package/dist/chunk-WGORKMR3.js +0 -353
  852. package/dist/chunk-WMIDELSJ.js +0 -391
  853. package/dist/chunk-WS5Y4FIR.js +0 -158
  854. package/dist/chunk-WZ74QHLE.js +0 -4863
  855. package/dist/chunk-WZ74QHLE.js.map +0 -1
  856. package/dist/chunk-XBE4YIIE.js +0 -296
  857. package/dist/chunk-XE4PHI74.js +0 -231
  858. package/dist/chunk-XHF2XNU5.js +0 -73
  859. package/dist/chunk-XHVWVXGQ.js +0 -207
  860. package/dist/chunk-XODQ2GPF.js +0 -3110
  861. package/dist/chunk-XQ5HTKX5.js +0 -1021
  862. package/dist/chunk-YAVW5OJ5.js +0 -131
  863. package/dist/chunk-YDQHFJM2.js +0 -83
  864. package/dist/chunk-YF2Y3AZ3.js +0 -196
  865. package/dist/chunk-YIDROGHS.js +0 -251
  866. package/dist/chunk-YIKPC2QP.js +0 -794
  867. package/dist/chunk-YQEOMDWF.js +0 -107
  868. package/dist/chunk-Z3VSTDON.js +0 -3176
  869. package/dist/chunk-ZB5YWWVH.js +0 -404
  870. package/dist/chunk-ZEQYHEWP.js +0 -406
  871. package/dist/chunk-ZRVUCTSI.js +0 -265
  872. package/dist/chunk-ZSI3ITRK.js +0 -449
  873. package/dist/computer-viewer-ZBY3BPYW.js +0 -21
  874. package/dist/connection-step-up-O7MGVS32.js +0 -145
  875. package/dist/connection-step-up-O7MGVS32.js.map +0 -1
  876. package/dist/embedded-new-voice-ZB5XLKLU.js +0 -25
  877. package/dist/embedded-voice-MZJISDCS.js +0 -25
  878. package/dist/fleet-decision-row-LG3SYVR3.js +0 -361
  879. package/dist/model-policy-picker-menu-5Y72PLNF.js +0 -23
  880. package/dist/payment-page-card-YPSXRHBA.js +0 -226
  881. package/dist/platform-activity-row-ZU4MEBNK.js +0 -156
  882. package/dist/queue-surface-implementation-6Q25RPH6.js +0 -932
  883. package/dist/recorder-host-JD4GWJ2Z.js +0 -80
  884. package/dist/sandbox-files-IJCQJFLH.js +0 -28
  885. package/dist/session-connect-cards-PQMGHXLJ.js +0 -27
  886. package/dist/session-realtime-IZOTTRH6.js +0 -30
  887. package/dist/timeline-annotation-markers-WWXNJOXI.js +0 -157
  888. package/dist/timeline-annotation-selection-ZKRIQFIQ.js +0 -208
  889. package/dist/timeline-annotations-dialog-4IMKTOXJ.js +0 -283
  890. /package/dist/{browser-viewer-EIEMRVFF.js.map → app/components/agents/agent-trigger-repositories.js.map} +0 -0
  891. /package/dist/{chat-interactive-block-FV37LWYZ.js.map → app/components/artifacts/ready-made-apps.js.map} +0 -0
  892. /package/dist/{computer-viewer-ZBY3BPYW.js.map → app/lib/ready-made-apps.js.map} +0 -0
  893. /package/dist/{embedded-new-voice-ZB5XLKLU.js.map → browser-viewer-5JGSKIXX.js.map} +0 -0
  894. /package/dist/{embedded-voice-MZJISDCS.js.map → chat-interactive-block-NEDFTOGE.js.map} +0 -0
  895. /package/dist/{chunk-62HIKJ5F.js.map → chunk-22SXRKET.js.map} +0 -0
  896. /package/dist/{chunk-7YLQCMZP.js.map → chunk-2JR7LEST.js.map} +0 -0
  897. /package/dist/{chunk-UHCFYX4I.js.map → chunk-2LBYEHBH.js.map} +0 -0
  898. /package/dist/{chunk-TWA5G277.js.map → chunk-2MHIIF4N.js.map} +0 -0
  899. /package/dist/{chunk-WMIDELSJ.js.map → chunk-2NABGWXC.js.map} +0 -0
  900. /package/dist/{chunk-VGZLFQO2.js.map → chunk-2VX42S4W.js.map} +0 -0
  901. /package/dist/{chunk-JCYP225Y.js.map → chunk-2X7I6LXY.js.map} +0 -0
  902. /package/dist/{chunk-IX4P4OGR.js.map → chunk-34LWIEIZ.js.map} +0 -0
  903. /package/dist/{chunk-SYA3WYG4.js.map → chunk-3F45ELUO.js.map} +0 -0
  904. /package/dist/{chunk-V5HTJJVS.js.map → chunk-3J6ENWZF.js.map} +0 -0
  905. /package/dist/{chunk-6YPTBBVB.js.map → chunk-3PTEMOSW.js.map} +0 -0
  906. /package/dist/{chunk-YDQHFJM2.js.map → chunk-3UA2SOK2.js.map} +0 -0
  907. /package/dist/{chunk-IGVQ2AI4.js.map → chunk-3YKED2ZV.js.map} +0 -0
  908. /package/dist/{chunk-7E6P6MF4.js.map → chunk-44MYJQ72.js.map} +0 -0
  909. /package/dist/{chunk-72ND4ALI.js.map → chunk-46UZ5ZYU.js.map} +0 -0
  910. /package/dist/{chunk-LCSVFHIN.js.map → chunk-4NXQWXQY.js.map} +0 -0
  911. /package/dist/{chunk-B6AH43UQ.js.map → chunk-4OGDD2EM.js.map} +0 -0
  912. /package/dist/{chunk-EDPH7AJH.js.map → chunk-4PSB2CK7.js.map} +0 -0
  913. /package/dist/{chunk-M3DOLBNU.js.map → chunk-4R74CAIF.js.map} +0 -0
  914. /package/dist/{chunk-GXI3OMSR.js.map → chunk-4RGFBD4M.js.map} +0 -0
  915. /package/dist/{chunk-VM7XF2FB.js.map → chunk-4SNYMZBC.js.map} +0 -0
  916. /package/dist/{chunk-YQEOMDWF.js.map → chunk-4UAHTM3Q.js.map} +0 -0
  917. /package/dist/{chunk-6DOIINY4.js.map → chunk-4YWHOAB4.js.map} +0 -0
  918. /package/dist/{chunk-FXFOKD7A.js.map → chunk-5AHIKB3O.js.map} +0 -0
  919. /package/dist/{chunk-UUE3OGXI.js.map → chunk-5AXIZJX4.js.map} +0 -0
  920. /package/dist/{chunk-WGORKMR3.js.map → chunk-5CEQ356Z.js.map} +0 -0
  921. /package/dist/{chunk-MVYQDBE6.js.map → chunk-5ERDSF2C.js.map} +0 -0
  922. /package/dist/{chunk-GNGI6XFN.js.map → chunk-5G6UHUJZ.js.map} +0 -0
  923. /package/dist/{chunk-7KP434J7.js.map → chunk-5H3SJHDT.js.map} +0 -0
  924. /package/dist/{chunk-NFLBLJUA.js.map → chunk-5ZTVBNMS.js.map} +0 -0
  925. /package/dist/{chunk-W43S5UJT.js.map → chunk-5ZUARMG2.js.map} +0 -0
  926. /package/dist/{chunk-EMWT6GOK.js.map → chunk-6AGNZI2W.js.map} +0 -0
  927. /package/dist/{chunk-GUC6IWEY.js.map → chunk-6IIJ4H4O.js.map} +0 -0
  928. /package/dist/{chunk-AB5SPXUR.js.map → chunk-6YCYPXDA.js.map} +0 -0
  929. /package/dist/{chunk-A7EBV2EB.js.map → chunk-6YTNMDFP.js.map} +0 -0
  930. /package/dist/{chunk-PCC3QUM6.js.map → chunk-6ZJU2B3Z.js.map} +0 -0
  931. /package/dist/{chunk-JPQFVR24.js.map → chunk-73O7NO3F.js.map} +0 -0
  932. /package/dist/{chunk-34UXLCRX.js.map → chunk-7456QZAA.js.map} +0 -0
  933. /package/dist/{chunk-DJWJMAUW.js.map → chunk-754NH7T2.js.map} +0 -0
  934. /package/dist/{chunk-JIC6RLUB.js.map → chunk-7GS2MGFU.js.map} +0 -0
  935. /package/dist/{chunk-5HV53SMN.js.map → chunk-7IR7EOTR.js.map} +0 -0
  936. /package/dist/{chunk-KDO6ZW4U.js.map → chunk-7MH4TTVE.js.map} +0 -0
  937. /package/dist/{chunk-63VNZRLY.js.map → chunk-7N35XBSC.js.map} +0 -0
  938. /package/dist/{chunk-3SBKYPNM.js.map → chunk-7ND2VMKV.js.map} +0 -0
  939. /package/dist/{chunk-DONBARLL.js.map → chunk-7RVJLO3N.js.map} +0 -0
  940. /package/dist/{chunk-CBYDQWJ3.js.map → chunk-7X443ZTQ.js.map} +0 -0
  941. /package/dist/{chunk-IGJR65GN.js.map → chunk-7XZO4W76.js.map} +0 -0
  942. /package/dist/{chunk-4AH4EEHE.js.map → chunk-AEH34OOU.js.map} +0 -0
  943. /package/dist/{chunk-5QXEEW4T.js.map → chunk-AML5X74C.js.map} +0 -0
  944. /package/dist/{chunk-TGCKZOSX.js.map → chunk-AVIOWKKJ.js.map} +0 -0
  945. /package/dist/{chunk-JPZVMXDP.js.map → chunk-AY4XH73V.js.map} +0 -0
  946. /package/dist/{chunk-5OVRMKP5.js.map → chunk-BGT43KDL.js.map} +0 -0
  947. /package/dist/{chunk-GZZCVF76.js.map → chunk-BHS4KW4W.js.map} +0 -0
  948. /package/dist/{chunk-TSY6YZL2.js.map → chunk-BKJXUACP.js.map} +0 -0
  949. /package/dist/{chunk-F7QEO7M2.js.map → chunk-BNWO72C2.js.map} +0 -0
  950. /package/dist/{chunk-TSW2LQY3.js.map → chunk-BT5EOSQF.js.map} +0 -0
  951. /package/dist/{chunk-GSW4YHZE.js.map → chunk-BVFOLLMQ.js.map} +0 -0
  952. /package/dist/{chunk-5SOL4INY.js.map → chunk-CC2IVNVR.js.map} +0 -0
  953. /package/dist/{chunk-CHSBOFAS.js.map → chunk-CGVMECYX.js.map} +0 -0
  954. /package/dist/{chunk-NUEFORM6.js.map → chunk-CLERWAEA.js.map} +0 -0
  955. /package/dist/{chunk-2COBAJC7.js.map → chunk-COCLT77F.js.map} +0 -0
  956. /package/dist/{chunk-4MF2HU3S.js.map → chunk-COIXX62I.js.map} +0 -0
  957. /package/dist/{chunk-RPHXJHNX.js.map → chunk-DHVA3T3K.js.map} +0 -0
  958. /package/dist/{chunk-5FZBRRFV.js.map → chunk-DKM3JBGJ.js.map} +0 -0
  959. /package/dist/{chunk-RDZQFZOQ.js.map → chunk-DNRVXHUW.js.map} +0 -0
  960. /package/dist/{chunk-WS5Y4FIR.js.map → chunk-DP4MGOBG.js.map} +0 -0
  961. /package/dist/{chunk-4D3YJNVN.js.map → chunk-DRVT6TRP.js.map} +0 -0
  962. /package/dist/{chunk-OKD2LBMK.js.map → chunk-DV3OECO6.js.map} +0 -0
  963. /package/dist/{chunk-LPEFULJY.js.map → chunk-DYQRNIID.js.map} +0 -0
  964. /package/dist/{chunk-SERECSAR.js.map → chunk-E45JRR3J.js.map} +0 -0
  965. /package/dist/{chunk-VXOLG6YB.js.map → chunk-E5EICKKB.js.map} +0 -0
  966. /package/dist/{chunk-QJMX27TG.js.map → chunk-E7FNLQXM.js.map} +0 -0
  967. /package/dist/{chunk-2HS3IUXE.js.map → chunk-EFBPHDPP.js.map} +0 -0
  968. /package/dist/{chunk-CPX6BHER.js.map → chunk-EJ6IIEZX.js.map} +0 -0
  969. /package/dist/{chunk-BSHNNTJO.js.map → chunk-ENYULVQW.js.map} +0 -0
  970. /package/dist/{chunk-TZZ2S4XI.js.map → chunk-EXBIL5BF.js.map} +0 -0
  971. /package/dist/{chunk-S3OTJAAC.js.map → chunk-F23TR625.js.map} +0 -0
  972. /package/dist/{chunk-TW2RHTLH.js.map → chunk-F45CPW3Y.js.map} +0 -0
  973. /package/dist/{chunk-OXYAKUFU.js.map → chunk-F5C5T2PF.js.map} +0 -0
  974. /package/dist/{chunk-D3YJAQGK.js.map → chunk-F5C7DTVR.js.map} +0 -0
  975. /package/dist/{chunk-KJ72GMZ2.js.map → chunk-F6D6X5ZU.js.map} +0 -0
  976. /package/dist/{chunk-46LZO4ZO.js.map → chunk-F6LVPEBK.js.map} +0 -0
  977. /package/dist/{chunk-T4MHBXAU.js.map → chunk-FARCOS2S.js.map} +0 -0
  978. /package/dist/{chunk-7S2S4MXR.js.map → chunk-FEQVCQMK.js.map} +0 -0
  979. /package/dist/{chunk-OZXEVHCS.js.map → chunk-FGHWU4LX.js.map} +0 -0
  980. /package/dist/{chunk-7AAUHFMA.js.map → chunk-FHNBUDXL.js.map} +0 -0
  981. /package/dist/{chunk-OYMSMU5O.js.map → chunk-FLDF2Z44.js.map} +0 -0
  982. /package/dist/{chunk-CIRCUDKF.js.map → chunk-FT3AUAXE.js.map} +0 -0
  983. /package/dist/{chunk-GM4UHGW6.js.map → chunk-FWIV2FTX.js.map} +0 -0
  984. /package/dist/{chunk-A5GX3CAE.js.map → chunk-GGIPEZLL.js.map} +0 -0
  985. /package/dist/{chunk-JVPF34MX.js.map → chunk-GGPZPBHS.js.map} +0 -0
  986. /package/dist/{chunk-JHSZSLVU.js.map → chunk-GHXIVKQH.js.map} +0 -0
  987. /package/dist/{chunk-IM3WA5AL.js.map → chunk-GIEGIEMT.js.map} +0 -0
  988. /package/dist/{chunk-K4JPMGB4.js.map → chunk-GLBILBET.js.map} +0 -0
  989. /package/dist/{chunk-2XGRHMRI.js.map → chunk-GMMB4NCN.js.map} +0 -0
  990. /package/dist/{chunk-34MODHMH.js.map → chunk-GP7MYBSX.js.map} +0 -0
  991. /package/dist/{chunk-ZB5YWWVH.js.map → chunk-GYHL6IRO.js.map} +0 -0
  992. /package/dist/{chunk-UYWWUEL4.js.map → chunk-HGS5JWZR.js.map} +0 -0
  993. /package/dist/{chunk-2IPAGZEO.js.map → chunk-HRFAQYOA.js.map} +0 -0
  994. /package/dist/{chunk-GIHE7U3Y.js.map → chunk-HUKGLWAY.js.map} +0 -0
  995. /package/dist/{chunk-SYYFA7W7.js.map → chunk-HUTQJY3F.js.map} +0 -0
  996. /package/dist/{chunk-62T2ZPD5.js.map → chunk-HWOYJOKK.js.map} +0 -0
  997. /package/dist/{chunk-YIDROGHS.js.map → chunk-HYFNKXHR.js.map} +0 -0
  998. /package/dist/{chunk-FTZDP3CA.js.map → chunk-HYNTTDG6.js.map} +0 -0
  999. /package/dist/{chunk-5L66ERTV.js.map → chunk-HZ5DTSAG.js.map} +0 -0
  1000. /package/dist/{chunk-XODQ2GPF.js.map → chunk-I2WTJMQF.js.map} +0 -0
  1001. /package/dist/{chunk-GMGAW3T6.js.map → chunk-IBHUF5BN.js.map} +0 -0
  1002. /package/dist/{chunk-KED67KAF.js.map → chunk-IH3J7VWW.js.map} +0 -0
  1003. /package/dist/{chunk-7SYCHMXS.js.map → chunk-IHX5BADQ.js.map} +0 -0
  1004. /package/dist/{chunk-V5Y74WII.js.map → chunk-IL6PCX7K.js.map} +0 -0
  1005. /package/dist/{chunk-UYQVWRAH.js.map → chunk-IOMZDY5D.js.map} +0 -0
  1006. /package/dist/{chunk-S44LU4CK.js.map → chunk-IPFSFSIK.js.map} +0 -0
  1007. /package/dist/{chunk-UHTURYJO.js.map → chunk-ISR6KXWT.js.map} +0 -0
  1008. /package/dist/{chunk-AWK23Q32.js.map → chunk-J2GIGAVJ.js.map} +0 -0
  1009. /package/dist/{chunk-QNOWKKZ4.js.map → chunk-J4OOKDRV.js.map} +0 -0
  1010. /package/dist/{chunk-KWGRRIUE.js.map → chunk-J5D5OCQF.js.map} +0 -0
  1011. /package/dist/{chunk-YF2Y3AZ3.js.map → chunk-JTSLGUVP.js.map} +0 -0
  1012. /package/dist/{chunk-C7TVMFHV.js.map → chunk-JXIBVYRA.js.map} +0 -0
  1013. /package/dist/{chunk-6YU3WV2P.js.map → chunk-JY2UEPJP.js.map} +0 -0
  1014. /package/dist/{chunk-5EJBPQI2.js.map → chunk-KI2TGJVH.js.map} +0 -0
  1015. /package/dist/{chunk-4KASGJTF.js.map → chunk-KPTKQULD.js.map} +0 -0
  1016. /package/dist/{chunk-MFLU3466.js.map → chunk-KYDLVMKA.js.map} +0 -0
  1017. /package/dist/{chunk-CVC4RO7D.js.map → chunk-KZQDP2JM.js.map} +0 -0
  1018. /package/dist/{chunk-K7IWU2T2.js.map → chunk-L2Q4HMVJ.js.map} +0 -0
  1019. /package/dist/{chunk-EO22NST7.js.map → chunk-LCRYAD3X.js.map} +0 -0
  1020. /package/dist/{chunk-PPQJIVGM.js.map → chunk-LFQI2C46.js.map} +0 -0
  1021. /package/dist/{chunk-MHFCYU4K.js.map → chunk-M4ZYHLFU.js.map} +0 -0
  1022. /package/dist/{chunk-MO3XJQN2.js.map → chunk-M5FX5KH5.js.map} +0 -0
  1023. /package/dist/{chunk-RVC3M66H.js.map → chunk-MAR5UYX4.js.map} +0 -0
  1024. /package/dist/{chunk-LVKTKORH.js.map → chunk-MATYGLUT.js.map} +0 -0
  1025. /package/dist/{chunk-ZSI3ITRK.js.map → chunk-MCXTYDFG.js.map} +0 -0
  1026. /package/dist/{chunk-5Y34P32B.js.map → chunk-MDI6SH7B.js.map} +0 -0
  1027. /package/dist/{chunk-F7JU2TYH.js.map → chunk-MIMSPOV4.js.map} +0 -0
  1028. /package/dist/{chunk-LRMGPO7E.js.map → chunk-MM4NP5QA.js.map} +0 -0
  1029. /package/dist/{chunk-JB3TSUZO.js.map → chunk-MQTYIBY6.js.map} +0 -0
  1030. /package/dist/{chunk-MIUMNTIJ.js.map → chunk-MSHWYGCH.js.map} +0 -0
  1031. /package/dist/{chunk-YIKPC2QP.js.map → chunk-MSIQ42IY.js.map} +0 -0
  1032. /package/dist/{chunk-7G627O3U.js.map → chunk-MXRCKJOQ.js.map} +0 -0
  1033. /package/dist/{chunk-XBE4YIIE.js.map → chunk-MXSZQ6DP.js.map} +0 -0
  1034. /package/dist/{chunk-AW5ZO2TH.js.map → chunk-N37BLJOI.js.map} +0 -0
  1035. /package/dist/{chunk-ZEQYHEWP.js.map → chunk-N556VQMT.js.map} +0 -0
  1036. /package/dist/{chunk-XQ5HTKX5.js.map → chunk-NL7VJGFZ.js.map} +0 -0
  1037. /package/dist/{chunk-HKNMNL7B.js.map → chunk-NLJEDAKV.js.map} +0 -0
  1038. /package/dist/{chunk-KU77XHWB.js.map → chunk-NUZNJSL5.js.map} +0 -0
  1039. /package/dist/{chunk-NZOFNQNC.js.map → chunk-O3LOQDTI.js.map} +0 -0
  1040. /package/dist/{chunk-3HAEQMR4.js.map → chunk-O4ZXJ52Z.js.map} +0 -0
  1041. /package/dist/{chunk-H4VMHFOX.js.map → chunk-O5PZRVQR.js.map} +0 -0
  1042. /package/dist/{chunk-DTLXQ3ZU.js.map → chunk-OEOLXODE.js.map} +0 -0
  1043. /package/dist/{chunk-LR3LJ35V.js.map → chunk-OZGECHF5.js.map} +0 -0
  1044. /package/dist/{chunk-6XYFMHNT.js.map → chunk-P4N7ZS6W.js.map} +0 -0
  1045. /package/dist/{chunk-5G4IGG7F.js.map → chunk-P6LSLNSL.js.map} +0 -0
  1046. /package/dist/{chunk-C6OM2SRG.js.map → chunk-PC2JAIAH.js.map} +0 -0
  1047. /package/dist/{chunk-KTGKGHEA.js.map → chunk-PCSRHFRF.js.map} +0 -0
  1048. /package/dist/{chunk-54ZV4SUS.js.map → chunk-PEAJRZU3.js.map} +0 -0
  1049. /package/dist/{chunk-QA5UNVHD.js.map → chunk-PGMXITPB.js.map} +0 -0
  1050. /package/dist/{chunk-KXBLLFOO.js.map → chunk-PJ42LTJE.js.map} +0 -0
  1051. /package/dist/{chunk-GP7BMUWR.js.map → chunk-PJ66EIWE.js.map} +0 -0
  1052. /package/dist/{chunk-VGX636MB.js.map → chunk-PKH6MYAK.js.map} +0 -0
  1053. /package/dist/{chunk-6CDBX3XG.js.map → chunk-PMBZMVKE.js.map} +0 -0
  1054. /package/dist/{chunk-HFROJDFQ.js.map → chunk-PTSRBKQC.js.map} +0 -0
  1055. /package/dist/{chunk-FKM2FLIG.js.map → chunk-QD4J7AHU.js.map} +0 -0
  1056. /package/dist/{chunk-KLUUDFTY.js.map → chunk-QD6A4G7Y.js.map} +0 -0
  1057. /package/dist/{chunk-ZRVUCTSI.js.map → chunk-QEXHABRN.js.map} +0 -0
  1058. /package/dist/{chunk-DWBSK6LI.js.map → chunk-QHYLEJP7.js.map} +0 -0
  1059. /package/dist/{chunk-FJFGDLXB.js.map → chunk-QL4Q332Z.js.map} +0 -0
  1060. /package/dist/{chunk-5SGTRULO.js.map → chunk-QL5227KT.js.map} +0 -0
  1061. /package/dist/{chunk-R7CXWJAV.js.map → chunk-QMRHY45R.js.map} +0 -0
  1062. /package/dist/{chunk-E26LQV6X.js.map → chunk-QPA7ATJH.js.map} +0 -0
  1063. /package/dist/{chunk-VPWKTIU5.js.map → chunk-QXPKUKOV.js.map} +0 -0
  1064. /package/dist/{chunk-QVOTPOXK.js.map → chunk-R2T4IUNB.js.map} +0 -0
  1065. /package/dist/{chunk-6D3D2JWY.js.map → chunk-R6CFPY3F.js.map} +0 -0
  1066. /package/dist/{chunk-YAVW5OJ5.js.map → chunk-R6OBJ7LF.js.map} +0 -0
  1067. /package/dist/{chunk-XHF2XNU5.js.map → chunk-R6WQLIFX.js.map} +0 -0
  1068. /package/dist/{chunk-NBUAHLMO.js.map → chunk-RA3NTKSW.js.map} +0 -0
  1069. /package/dist/{chunk-PGRKTQIW.js.map → chunk-RJWTAS4V.js.map} +0 -0
  1070. /package/dist/{chunk-UUNJ2E57.js.map → chunk-RJZALNT5.js.map} +0 -0
  1071. /package/dist/{chunk-GJ4GTYOD.js.map → chunk-RMDLTRLI.js.map} +0 -0
  1072. /package/dist/{chunk-MQRHTOQ2.js.map → chunk-RVPH6BB7.js.map} +0 -0
  1073. /package/dist/{chunk-B45TB4HY.js.map → chunk-RVXLSVJH.js.map} +0 -0
  1074. /package/dist/{chunk-7UDLRDHK.js.map → chunk-RWHDMGFG.js.map} +0 -0
  1075. /package/dist/{chunk-FLLJ2WXW.js.map → chunk-RYB3WBMZ.js.map} +0 -0
  1076. /package/dist/{chunk-4EGWXBBZ.js.map → chunk-S2525GSA.js.map} +0 -0
  1077. /package/dist/{chunk-Q2QDZBNN.js.map → chunk-S3BLYPOG.js.map} +0 -0
  1078. /package/dist/{chunk-I5FSUZVW.js.map → chunk-S7J4HBPP.js.map} +0 -0
  1079. /package/dist/{chunk-UFJDETKG.js.map → chunk-SA3XI7FB.js.map} +0 -0
  1080. /package/dist/{chunk-IXGZLCUP.js.map → chunk-SN2QZSJU.js.map} +0 -0
  1081. /package/dist/{chunk-SRDHDIRQ.js.map → chunk-SNACGK3Z.js.map} +0 -0
  1082. /package/dist/{chunk-FPN4I4CG.js.map → chunk-SUXGKBCW.js.map} +0 -0
  1083. /package/dist/{chunk-TFSCGFYV.js.map → chunk-SWTPVMR4.js.map} +0 -0
  1084. /package/dist/{chunk-OMKCSTF6.js.map → chunk-SXXWPTL7.js.map} +0 -0
  1085. /package/dist/{chunk-VB7YKA6B.js.map → chunk-T2N6JC5H.js.map} +0 -0
  1086. /package/dist/{chunk-GBGCMHBB.js.map → chunk-TBUOHK6R.js.map} +0 -0
  1087. /package/dist/{chunk-W2NAU5VB.js.map → chunk-TCUAGCAX.js.map} +0 -0
  1088. /package/dist/{chunk-RWCEUUEL.js.map → chunk-TGAKM3WX.js.map} +0 -0
  1089. /package/dist/{chunk-MCPKUVMQ.js.map → chunk-TGG3ODCS.js.map} +0 -0
  1090. /package/dist/{chunk-BJUOKUE5.js.map → chunk-TMZ6RP3K.js.map} +0 -0
  1091. /package/dist/{chunk-IE6SSKKF.js.map → chunk-TNE7ZYGN.js.map} +0 -0
  1092. /package/dist/{chunk-ES5HKVQF.js.map → chunk-TWSO5S3E.js.map} +0 -0
  1093. /package/dist/{chunk-BIUJHNVR.js.map → chunk-U2TOOZIY.js.map} +0 -0
  1094. /package/dist/{chunk-4CJD7TMQ.js.map → chunk-UBM3IM6K.js.map} +0 -0
  1095. /package/dist/{chunk-W5OHFSQJ.js.map → chunk-UBR3CGJC.js.map} +0 -0
  1096. /package/dist/{chunk-PYMQM65Y.js.map → chunk-UFRXYZCJ.js.map} +0 -0
  1097. /package/dist/{chunk-NEIBSGZP.js.map → chunk-UJNDUO7D.js.map} +0 -0
  1098. /package/dist/{chunk-46ZC5VNC.js.map → chunk-UPRN4FBY.js.map} +0 -0
  1099. /package/dist/{chunk-QYZ5RVGM.js.map → chunk-UXGTI4HR.js.map} +0 -0
  1100. /package/dist/{chunk-JNJIZCTN.js.map → chunk-UZKAHEQO.js.map} +0 -0
  1101. /package/dist/{chunk-2JRHAEIT.js.map → chunk-V6ZJKHVS.js.map} +0 -0
  1102. /package/dist/{chunk-Z3VSTDON.js.map → chunk-VHYDZMGS.js.map} +0 -0
  1103. /package/dist/{chunk-R7CVDKRN.js.map → chunk-VIKXHP44.js.map} +0 -0
  1104. /package/dist/{chunk-L6WVCO6D.js.map → chunk-VLDKWGHD.js.map} +0 -0
  1105. /package/dist/{chunk-UPCZ7XB4.js.map → chunk-VRS6VNHP.js.map} +0 -0
  1106. /package/dist/{chunk-ER5MYLIE.js.map → chunk-VT5XHR5J.js.map} +0 -0
  1107. /package/dist/{chunk-6DQBUKGJ.js.map → chunk-W7RKXZDV.js.map} +0 -0
  1108. /package/dist/{chunk-3Z7VA6ET.js.map → chunk-WBNSC6RJ.js.map} +0 -0
  1109. /package/dist/{chunk-7HHC5AAI.js.map → chunk-WEPL76AR.js.map} +0 -0
  1110. /package/dist/{chunk-7WJZWMZ4.js.map → chunk-WJ2STMQD.js.map} +0 -0
  1111. /package/dist/{chunk-4RUKLIOF.js.map → chunk-WSQ3TCOX.js.map} +0 -0
  1112. /package/dist/{chunk-VAIOMRCN.js.map → chunk-WT37FEG3.js.map} +0 -0
  1113. /package/dist/{chunk-67LBFBI3.js.map → chunk-WUKLEDKK.js.map} +0 -0
  1114. /package/dist/{chunk-IIXNEOK4.js.map → chunk-X3T3N6W5.js.map} +0 -0
  1115. /package/dist/{chunk-PJLHXFDD.js.map → chunk-XKJCFK2G.js.map} +0 -0
  1116. /package/dist/{chunk-72EOXOR7.js.map → chunk-XKLXYIIT.js.map} +0 -0
  1117. /package/dist/{chunk-E7RH5F6S.js.map → chunk-XMTBNLD2.js.map} +0 -0
  1118. /package/dist/{chunk-F6QP4GSK.js.map → chunk-XZLNVFB4.js.map} +0 -0
  1119. /package/dist/{chunk-GWAY3SO5.js.map → chunk-XZRMTHHW.js.map} +0 -0
  1120. /package/dist/{chunk-DNAXAS5R.js.map → chunk-Y3ME7IF6.js.map} +0 -0
  1121. /package/dist/{chunk-GO5VIAA7.js.map → chunk-Y6CNWBV3.js.map} +0 -0
  1122. /package/dist/{chunk-A67EXXQG.js.map → chunk-YJYKB6ZT.js.map} +0 -0
  1123. /package/dist/{chunk-HHFFPE67.js.map → chunk-YP4SNX4P.js.map} +0 -0
  1124. /package/dist/{chunk-JNV5ZPUV.js.map → chunk-YR7U2KDA.js.map} +0 -0
  1125. /package/dist/{chunk-XE4PHI74.js.map → chunk-YS6BQNHF.js.map} +0 -0
  1126. /package/dist/{chunk-EILSPMVD.js.map → chunk-Z7UBLC6V.js.map} +0 -0
  1127. /package/dist/{chunk-MIUJ3EH5.js.map → chunk-ZD67RM6G.js.map} +0 -0
  1128. /package/dist/{chunk-XHVWVXGQ.js.map → chunk-ZGBMDDFR.js.map} +0 -0
  1129. /package/dist/{chunk-GLSDWNFV.js.map → chunk-ZGR7LNXC.js.map} +0 -0
  1130. /package/dist/{chunk-BA4WZGDW.js.map → chunk-ZJICGGPI.js.map} +0 -0
  1131. /package/dist/{chunk-TMDL3CUH.js.map → chunk-ZLKHNJCQ.js.map} +0 -0
  1132. /package/dist/{chunk-QMQF5U2D.js.map → chunk-ZNA65Q6Y.js.map} +0 -0
  1133. /package/dist/{model-policy-picker-menu-5Y72PLNF.js.map → computer-viewer-FHCBTSZH.js.map} +0 -0
  1134. /package/dist/{sandbox-files-IJCQJFLH.js.map → embedded-new-voice-BFTQZPJK.js.map} +0 -0
  1135. /package/dist/{session-connect-cards-PQMGHXLJ.js.map → embedded-voice-CQE2GO6Y.js.map} +0 -0
  1136. /package/dist/{fleet-decision-row-LG3SYVR3.js.map → fleet-decision-row-FJPAWNOQ.js.map} +0 -0
  1137. /package/dist/{session-realtime-IZOTTRH6.js.map → model-policy-picker-menu-PVBT2OZO.js.map} +0 -0
  1138. /package/dist/{payment-page-card-YPSXRHBA.js.map → payment-page-card-YPCRVFHE.js.map} +0 -0
  1139. /package/dist/{platform-activity-row-ZU4MEBNK.js.map → platform-activity-row-ZWACJPNQ.js.map} +0 -0
  1140. /package/dist/{queue-surface-implementation-6Q25RPH6.js.map → queue-surface-implementation-C7ESPZW7.js.map} +0 -0
  1141. /package/dist/{recorder-host-JD4GWJ2Z.js.map → recorder-host-YPWPLMS6.js.map} +0 -0
  1142. /package/dist/{timeline-annotation-markers-WWXNJOXI.js.map → timeline-annotation-markers-7QSYK22C.js.map} +0 -0
  1143. /package/dist/{timeline-annotation-selection-ZKRIQFIQ.js.map → timeline-annotation-selection-XYNMESWL.js.map} +0 -0
  1144. /package/dist/{timeline-annotations-dialog-4IMKTOXJ.js.map → timeline-annotations-dialog-WSI6L2CP.js.map} +0 -0
@@ -0,0 +1,3070 @@
1
+ "use client";
2
+ import {
3
+ useSandboxFiles
4
+ } from "./chunk-VHYDZMGS.js";
5
+ import {
6
+ WorkbenchChanges,
7
+ WorkbenchChangesViewMenu,
8
+ useMachineChip
9
+ } from "./chunk-WSQ3TCOX.js";
10
+ import {
11
+ WorkspaceDock
12
+ } from "./chunk-QL5227KT.js";
13
+ import {
14
+ SessionStatus
15
+ } from "./chunk-FEQVCQMK.js";
16
+ import {
17
+ PierreDiff
18
+ } from "./chunk-RVPH6BB7.js";
19
+ import {
20
+ SessionMcpCapabilityCard
21
+ } from "./chunk-VRS6VNHP.js";
22
+ import {
23
+ useTurnlessOutputGap
24
+ } from "./chunk-T2IFOASN.js";
25
+ import {
26
+ invalidateSharedQueries,
27
+ useSharedQuery
28
+ } from "./chunk-DSQNSLQW.js";
29
+ import {
30
+ sessionAdmissionBlocked,
31
+ sessionDisplayStatus
32
+ } from "./chunk-DG5DQFS4.js";
33
+ import {
34
+ SandboxTerminal,
35
+ terminalCanAcquirePty,
36
+ xtermThemeFromTokens
37
+ } from "./chunk-XKLXYIIT.js";
38
+ import {
39
+ sandboxAcceptsLiveIo
40
+ } from "./chunk-QV3DJVRZ.js";
41
+ import {
42
+ MACHINES_SESSION_POLL_MS,
43
+ useMachines
44
+ } from "./chunk-RJZALNT5.js";
45
+ import {
46
+ formatRelativeTime
47
+ } from "./chunk-UIK52VL4.js";
48
+ import {
49
+ useMutationRunner,
50
+ usePageLiveActivity,
51
+ usePolledValue
52
+ } from "./chunk-SW4S6I5E.js";
53
+ import {
54
+ normalizeError
55
+ } from "./chunk-CM7LVUKC.js";
56
+ import {
57
+ useOpenGeni,
58
+ useOpenGeniClient
59
+ } from "./chunk-BVUAHAQX.js";
60
+ import {
61
+ cn
62
+ } from "./chunk-TXS65BB2.js";
63
+ import {
64
+ useOpenGeniText
65
+ } from "./chunk-2L6B6766.js";
66
+
67
+ // src/session-auth-recommendation.ts
68
+ function sessionAuthRecommendation(t, item, catalog) {
69
+ if (item.authoritySource === "host" || item.reason === "unsupported_auth" || item.reason === "resource_scope_unavailable" || item.reason === "account_scope_fixed")
70
+ return void 0;
71
+ if (item.capability) return item;
72
+ if (item.reason === "insufficient_scope" && item.connectionId) return void 0;
73
+ const recoveryServerId = item.canonicalServerId ?? item.serverId;
74
+ const matches = catalog.filter(
75
+ (candidate) => recoveryServerId !== null && candidate.runtime.mcpServerId === recoveryServerId && recoveryServerId !== "opengeni" || item.connectionId !== null && candidate.connectionRef?.connectionId === item.connectionId
76
+ );
77
+ if (matches.length !== 1) return void 0;
78
+ const entry = matches[0];
79
+ const personalAccess = item.reason === "personal_authority_unavailable";
80
+ if (personalAccess && ((item.connectionSubjectScope ?? entry.connectionRef?.subjectScope) !== "subject" || entry.connectionRef?.authoritySource === "host"))
81
+ return void 0;
82
+ return {
83
+ ...item,
84
+ capability: {
85
+ id: entry.id,
86
+ name: entry.name,
87
+ kind: entry.kind,
88
+ source: entry.source,
89
+ action: "connect",
90
+ rationale: personalAccess ? t("sessionAuthRecommendation.reviewPermissionToUseYour") : t("sessionAuthRecommendation.reconnectThisIntegrationToUse"),
91
+ requiredVariables: []
92
+ }
93
+ };
94
+ }
95
+
96
+ // src/components/session-connection-request.tsx
97
+ import { useEffect, useRef, useState } from "react";
98
+ import { jsx, jsxs } from "react/jsx-runtime";
99
+ function SessionConnectionRequest(props) {
100
+ const [client, setClient] = useState(props.client);
101
+ const [generation, setGeneration] = useState(0);
102
+ if (client !== props.client) {
103
+ setClient(props.client);
104
+ setGeneration(generation + 1);
105
+ }
106
+ return /* @__PURE__ */ jsx(
107
+ ScopedRequest,
108
+ {
109
+ ...props
110
+ },
111
+ `${generation}:${props.workspaceId}:${props.sessionId}:${props.request.id}`
112
+ );
113
+ }
114
+ function ScopedRequest({ request, ...props }) {
115
+ const t = useOpenGeniText();
116
+ const [resolved, setResolved] = useState(null);
117
+ const [error, setError] = useState(null);
118
+ const [retry, setRetry] = useState(0);
119
+ const requestRef = useRef(request);
120
+ requestRef.current = request;
121
+ useEffect(() => {
122
+ let current = true;
123
+ const event = requestRef.current;
124
+ setResolved(null);
125
+ setError(null);
126
+ void props.client.listCapabilities(props.workspaceId).then((catalog) => {
127
+ if (!current) return;
128
+ const recommendation = sessionAuthRecommendation(t, event, catalog.items);
129
+ const candidate = catalog.items.find(
130
+ (entry) => entry.id === recommendation?.capability?.id
131
+ );
132
+ if (!recommendation || candidate?.kind !== "mcp" || candidate.authKind !== "oauth2") {
133
+ setError(t("sessionConnectionRequest.thisRequestCouldNotBe"));
134
+ return;
135
+ }
136
+ setResolved(recommendation);
137
+ }).catch(() => {
138
+ if (current) setError(t("sessionConnectionRequest.couldnTLoadConnectionDetails"));
139
+ });
140
+ return () => {
141
+ current = false;
142
+ };
143
+ }, [
144
+ props.client,
145
+ props.workspaceId,
146
+ request.id,
147
+ request.serverId,
148
+ request.connectionId,
149
+ request.authoritySource,
150
+ request.reason,
151
+ request.capability?.id,
152
+ retry,
153
+ t
154
+ ]);
155
+ if (!resolved?.capability)
156
+ return /* @__PURE__ */ jsxs("div", { className: "og-session-capability-setup", children: [
157
+ /* @__PURE__ */ jsx("p", { role: error ? "alert" : "status", children: error ?? t("sessionConnectionRequest.loadingConnectionDetails") }),
158
+ error ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setRetry((value) => value + 1), children: t("sessionConnectionRequest.retry") }) : null
159
+ ] });
160
+ return /* @__PURE__ */ jsx(
161
+ SessionMcpCapabilityCard,
162
+ {
163
+ ...props,
164
+ capabilityId: resolved.capability.id,
165
+ name: resolved.capability.name,
166
+ rationale: resolved.capability.rationale
167
+ }
168
+ );
169
+ }
170
+
171
+ // src/hooks/use-video-artifact-playback.ts
172
+ import { useMemo } from "react";
173
+ function useVideoArtifactPlaybackLoader(options = {}) {
174
+ const { client, workspaceId } = useOpenGeni(options);
175
+ return useMemo(
176
+ () => async (artifactId, signal) => {
177
+ if (typeof client.createVideoArtifactPlaybackSource !== "function") {
178
+ throw new Error("This Opengeni host does not expose retained-video playback.");
179
+ }
180
+ return await client.createVideoArtifactPlaybackSource(
181
+ workspaceId,
182
+ artifactId,
183
+ signal ? { signal } : {}
184
+ );
185
+ },
186
+ [client, workspaceId]
187
+ );
188
+ }
189
+
190
+ // src/hooks/use-scheduled-tasks.ts
191
+ import { useCallback } from "react";
192
+ function useScheduledTasks(options = {}) {
193
+ const { client, workspaceId } = useOpenGeni(options);
194
+ const limit = options.limit;
195
+ const load = useCallback(
196
+ async () => await client.listScheduledTasks(workspaceId, limit !== void 0 ? { limit } : {}),
197
+ [client, workspaceId, limit]
198
+ );
199
+ const state = usePolledValue(load, {
200
+ pollIntervalMs: options.pollIntervalMs,
201
+ enabled: options.enabled
202
+ });
203
+ return {
204
+ tasks: state.data ?? [],
205
+ loading: state.loading,
206
+ error: state.error,
207
+ refresh: state.refresh
208
+ };
209
+ }
210
+
211
+ // src/hooks/use-workspace-background-commands.ts
212
+ import { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
213
+ function useWorkspaceBackgroundCommands(options = {}) {
214
+ const { client, workspaceId } = useOpenGeni(options);
215
+ const [pages, setPages] = useState2(1);
216
+ const enabled = options.enabled ?? true;
217
+ useEffect2(() => setPages(1), [client, workspaceId]);
218
+ const load = useCallback2(
219
+ async (signal) => {
220
+ if (!client.listWorkspaceBackgroundCommands)
221
+ throw new Error("The configured client does not support workspace commands");
222
+ const commands = /* @__PURE__ */ new Map();
223
+ let cursor;
224
+ for (let page = 0; page < pages; page += 1) {
225
+ signal?.throwIfAborted();
226
+ const result = await client.listWorkspaceBackgroundCommands(workspaceId, {
227
+ ...cursor ? { cursor } : {},
228
+ ...signal ? { signal } : {}
229
+ });
230
+ for (const command of result.commands) commands.set(command.id, command);
231
+ cursor = result.nextCursor ?? void 0;
232
+ if (!cursor) break;
233
+ }
234
+ return { commands: [...commands.values()], hasMore: Boolean(cursor) };
235
+ },
236
+ [client, workspaceId, pages]
237
+ );
238
+ const state = usePolledValue(load, { enabled, pollIntervalMs: options.pollIntervalMs ?? 5e3 });
239
+ const { data, refresh } = state;
240
+ const generation = useRef2(0);
241
+ useEffect2(() => {
242
+ generation.current += 1;
243
+ return () => {
244
+ generation.current += 1;
245
+ };
246
+ }, [client, workspaceId, enabled]);
247
+ const cancel = useCallback2(
248
+ async (commandId) => {
249
+ const command = data?.commands.find((item) => item.id === commandId);
250
+ if (!command || !enabled) return;
251
+ if (!client.cancelSessionBackgroundCommand)
252
+ throw new Error("The configured client does not support stopping commands");
253
+ const ticket = generation.current;
254
+ await client.cancelSessionBackgroundCommand(workspaceId, command.sessionId, commandId);
255
+ if (ticket === generation.current) await refresh();
256
+ },
257
+ [client, workspaceId, enabled, data, refresh]
258
+ );
259
+ return {
260
+ commands: enabled && !state.error ? state.data?.commands ?? [] : [],
261
+ loading: enabled && state.loading,
262
+ error: enabled ? state.error : null,
263
+ refresh: state.refresh,
264
+ cancel,
265
+ hasMore: enabled && !state.error && (state.data?.hasMore ?? false),
266
+ loadMore: () => setPages((value) => value + 1)
267
+ };
268
+ }
269
+
270
+ // src/index.ts
271
+ import { asVaultClient, vaultsApi, vaultErrorCode, vaultErrorDetail } from "@opengeni/sdk";
272
+
273
+ // src/hooks/use-workspaces.ts
274
+ import { useCallback as useCallback3 } from "react";
275
+ function useWorkspaces(options = {}) {
276
+ const client = useOpenGeniClient(options);
277
+ const load = useCallback3(async () => await client.listWorkspaces(), [client]);
278
+ const { data, loading, error, refresh } = usePolledValue(load, {
279
+ pollIntervalMs: options.pollIntervalMs,
280
+ enabled: options.enabled
281
+ });
282
+ const { run, mutating, mutationError, clearMutationError } = useMutationRunner();
283
+ const create = useCallback3(
284
+ async (request) => {
285
+ const result = await run(() => client.createWorkspace(request));
286
+ if (result) {
287
+ await refresh();
288
+ }
289
+ return result;
290
+ },
291
+ [client, run, refresh]
292
+ );
293
+ const update = useCallback3(
294
+ async (workspaceId, request) => {
295
+ const result = await run(() => client.updateWorkspace(workspaceId, request));
296
+ if (result) {
297
+ await refresh();
298
+ }
299
+ return result;
300
+ },
301
+ [client, run, refresh]
302
+ );
303
+ return {
304
+ workspaces: data ?? [],
305
+ loading,
306
+ error,
307
+ refresh,
308
+ create,
309
+ update,
310
+ mutating,
311
+ mutationError,
312
+ clearMutationError
313
+ };
314
+ }
315
+
316
+ // src/hooks/use-billing-usage.ts
317
+ import { useCallback as useCallback4 } from "react";
318
+ function useBillingUsage(options = {}) {
319
+ const client = useOpenGeniClient(options);
320
+ const accountId = options.accountId;
321
+ const workspaceId = options.workspaceId;
322
+ const load = useCallback4(
323
+ async () => await client.getBillingUsage({
324
+ ...accountId !== void 0 ? { accountId } : {},
325
+ ...workspaceId !== void 0 ? { workspaceId } : {}
326
+ }),
327
+ [client, accountId, workspaceId]
328
+ );
329
+ const state = usePolledValue(load, {
330
+ pollIntervalMs: options.pollIntervalMs,
331
+ enabled: options.enabled
332
+ });
333
+ return {
334
+ balance: state.data?.balance ?? null,
335
+ usage: state.data?.usage ?? [],
336
+ loading: state.loading,
337
+ error: state.error,
338
+ refresh: state.refresh
339
+ };
340
+ }
341
+
342
+ // src/hooks/use-session-capabilities.ts
343
+ import {
344
+ OpenGeniApiError,
345
+ applyUrlRotation
346
+ } from "@opengeni/sdk";
347
+ import { useCallback as useCallback5, useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
348
+ function desktopAttachable(cell) {
349
+ if (cell.transport !== null) return true;
350
+ return cell.reason === "lease_cold" || cell.reason === "not_provisioned" || cell.reason === null;
351
+ }
352
+ var VIEWER_INTERACTION_EVENTS = [
353
+ "pointerdown",
354
+ "pointermove",
355
+ "keydown",
356
+ "wheel",
357
+ "touchstart"
358
+ ];
359
+ function useViewerInteractionClock(onInteraction) {
360
+ const lastInteractionRef = useRef3(Date.now());
361
+ const onInteractionRef = useRef3(onInteraction);
362
+ onInteractionRef.current = onInteraction;
363
+ useEffect3(() => {
364
+ if (typeof window === "undefined") return;
365
+ const record = () => {
366
+ lastInteractionRef.current = Date.now();
367
+ onInteractionRef.current();
368
+ };
369
+ const onVisibility = () => {
370
+ if (typeof document !== "undefined" && document.visibilityState === "visible") record();
371
+ };
372
+ const listenerOptions = { capture: true, passive: true };
373
+ for (const type of VIEWER_INTERACTION_EVENTS) {
374
+ window.addEventListener(type, record, listenerOptions);
375
+ }
376
+ window.addEventListener("focus", record, listenerOptions);
377
+ if (typeof document !== "undefined") {
378
+ document.addEventListener("visibilitychange", onVisibility);
379
+ }
380
+ return () => {
381
+ for (const type of VIEWER_INTERACTION_EVENTS) {
382
+ window.removeEventListener(type, record, listenerOptions);
383
+ }
384
+ window.removeEventListener("focus", record, listenerOptions);
385
+ if (typeof document !== "undefined") {
386
+ document.removeEventListener("visibilitychange", onVisibility);
387
+ }
388
+ };
389
+ }, []);
390
+ return lastInteractionRef;
391
+ }
392
+ function rotationsFrom(events) {
393
+ const out = [];
394
+ for (const event of events) {
395
+ if (event.type === "stream.url.rotated" && event.payload && typeof event.payload === "object") {
396
+ out.push(event.payload);
397
+ }
398
+ }
399
+ return out;
400
+ }
401
+ function useSessionCapabilities(sessionId, options = {}) {
402
+ const { client, workspaceId } = useOpenGeni(options);
403
+ const enabled = (options.enabled ?? true) && Boolean(sessionId);
404
+ const pageLive = usePageLiveActivity();
405
+ const lifecycleEnabled = enabled && pageLive;
406
+ const attachDesktop = options.attachDesktop ?? false;
407
+ const attachTerminal = options.attachTerminal ?? false;
408
+ const attachFiles = options.attachFiles ?? false;
409
+ const warmingPollMs = options.warmingPollMs ?? 1500;
410
+ const warmingDeadlineMs = options.warmingDeadlineMs ?? 3e4;
411
+ const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${enabled}`;
412
+ const [capabilities, setCapabilities] = useState3(null);
413
+ const [state, setState] = useState3("idle");
414
+ const [error, setError] = useState3(null);
415
+ const [acknowledgmentRequired, setAcknowledgmentRequired] = useState3(null);
416
+ const [viewerCapReached, setViewerCapReached] = useState3(false);
417
+ const [viewerCapReason, setViewerCapReason] = useState3(null);
418
+ const [viewerId, setViewerId] = useState3(null);
419
+ const [stateIdentity, setStateIdentity] = useState3(identityKey);
420
+ const [nonce, setNonce] = useState3(0);
421
+ const epochRef = useRef3(0);
422
+ const viewerIdRef = useRef3(null);
423
+ const previousIdentityRef = useRef3(identityKey);
424
+ const renegotiate = useCallback5(() => {
425
+ setNonce((n) => n + 1);
426
+ }, []);
427
+ const cardRefusedRef = useRef3(false);
428
+ useEffect3(() => {
429
+ if (typeof window === "undefined") return;
430
+ const onCardVerified = () => {
431
+ if (!cardRefusedRef.current) return;
432
+ cardRefusedRef.current = false;
433
+ setViewerCapReached(false);
434
+ setViewerCapReason(null);
435
+ setNonce((n) => n + 1);
436
+ };
437
+ window.addEventListener("opengeni:card-verified", onCardVerified);
438
+ return () => window.removeEventListener("opengeni:card-verified", onCardVerified);
439
+ }, []);
440
+ const resumeOnInteractionRef = useRef3(false);
441
+ const lastInteractionRef = useViewerInteractionClock(() => {
442
+ if (!resumeOnInteractionRef.current) return;
443
+ resumeOnInteractionRef.current = false;
444
+ setNonce((n) => n + 1);
445
+ });
446
+ useEffect3(() => {
447
+ const identityChanged = previousIdentityRef.current !== identityKey;
448
+ previousIdentityRef.current = identityKey;
449
+ if (identityChanged) {
450
+ setStateIdentity(identityKey);
451
+ setCapabilities(null);
452
+ setState("idle");
453
+ setError(null);
454
+ setAcknowledgmentRequired(null);
455
+ setViewerCapReached(false);
456
+ setViewerCapReason(null);
457
+ setViewerId(null);
458
+ epochRef.current = 0;
459
+ viewerIdRef.current = null;
460
+ resumeOnInteractionRef.current = false;
461
+ }
462
+ if (!lifecycleEnabled || !sessionId) {
463
+ setState("idle");
464
+ setCapabilities(null);
465
+ viewerIdRef.current = null;
466
+ setViewerId(null);
467
+ return;
468
+ }
469
+ viewerIdRef.current = null;
470
+ setViewerId(null);
471
+ const awaitingInteraction = resumeOnInteractionRef.current;
472
+ let cancelled = false;
473
+ let idleDrainMs = null;
474
+ let pollTimer = null;
475
+ let heartbeatTimer = null;
476
+ let localViewerId = null;
477
+ const requestAbort = new AbortController();
478
+ const startedAt = Date.now();
479
+ const clearTimers = () => {
480
+ if (pollTimer !== null) clearTimeout(pollTimer);
481
+ if (heartbeatTimer !== null) clearTimeout(heartbeatTimer);
482
+ pollTimer = null;
483
+ heartbeatTimer = null;
484
+ };
485
+ const settle = (caps) => {
486
+ if (cancelled) return;
487
+ epochRef.current = caps.leaseEpoch;
488
+ setCapabilities(caps);
489
+ setError(null);
490
+ };
491
+ const reacquire = () => {
492
+ if (cancelled) return;
493
+ if (idleDrainMs !== null && Date.now() - lastInteractionRef.current >= idleDrainMs) {
494
+ localViewerId = null;
495
+ viewerIdRef.current = null;
496
+ setViewerId(null);
497
+ setState("on-demand");
498
+ resumeOnInteractionRef.current = true;
499
+ return;
500
+ }
501
+ renegotiate();
502
+ };
503
+ const startHeartbeat = (caps) => {
504
+ if (!localViewerId || heartbeatTimer !== null) return;
505
+ const intervalMs = caps.viewerHeartbeatIntervalMs > 0 ? caps.viewerHeartbeatIntervalMs : 3e4;
506
+ const schedule = () => {
507
+ if (cancelled || !localViewerId) return;
508
+ heartbeatTimer = setTimeout(() => {
509
+ heartbeatTimer = null;
510
+ if (cancelled || !localViewerId) return;
511
+ void client.heartbeatViewer(workspaceId, sessionId, localViewerId, {
512
+ leaseEpoch: epochRef.current,
513
+ lastInteractionAgeMs: Math.max(0, Date.now() - lastInteractionRef.current)
514
+ }).then((res) => {
515
+ if (!res.alive && !cancelled) {
516
+ reacquire();
517
+ }
518
+ }).catch((cause) => {
519
+ if (cancelled) return;
520
+ if (cause instanceof OpenGeniApiError && (cause.status === 409 || cause.status === 410)) {
521
+ reacquire();
522
+ }
523
+ }).finally(schedule);
524
+ }, intervalMs);
525
+ };
526
+ schedule();
527
+ };
528
+ const pollUntilWarm = () => {
529
+ pollTimer = setTimeout(() => {
530
+ if (cancelled) return;
531
+ void client.getStreamCapabilities(workspaceId, sessionId, { signal: requestAbort.signal }).then((caps) => {
532
+ if (cancelled) return;
533
+ settle(caps);
534
+ if (sandboxAcceptsLiveIo(caps.liveness)) {
535
+ setState("ready");
536
+ return;
537
+ }
538
+ if (warmingDeadlineMs > 0 && Date.now() - startedAt > warmingDeadlineMs) {
539
+ setState("error");
540
+ setError(new Error("sandbox did not warm in time \u2014 retry to re-negotiate"));
541
+ return;
542
+ }
543
+ pollUntilWarm();
544
+ }).catch((cause) => {
545
+ if (!cancelled) {
546
+ if (isSandboxOwnershipDisabledError(cause)) {
547
+ setState("on-demand");
548
+ setError(null);
549
+ return;
550
+ }
551
+ setState("error");
552
+ setError(normalizeError(cause));
553
+ }
554
+ });
555
+ }, warmingPollMs);
556
+ };
557
+ void (async () => {
558
+ setState("negotiating");
559
+ setAcknowledgmentRequired(null);
560
+ setViewerCapReached(false);
561
+ setViewerCapReason(null);
562
+ try {
563
+ const caps = await client.getStreamCapabilities(workspaceId, sessionId, {
564
+ signal: requestAbort.signal
565
+ });
566
+ if (cancelled) return;
567
+ settle(caps);
568
+ const wantDesktopAttach = attachDesktop && desktopAttachable(caps.DesktopStream);
569
+ const wantTerminalAttach = attachTerminal && terminalCanAcquirePty(caps.Terminal);
570
+ const wantFilesAttach = attachFiles && caps.FileSystem.available;
571
+ let attachRefused = false;
572
+ if (!awaitingInteraction && (wantDesktopAttach || wantTerminalAttach || wantFilesAttach)) {
573
+ try {
574
+ const holder = await client.attachViewer(workspaceId, sessionId, {
575
+ desktop: wantDesktopAttach,
576
+ terminal: wantTerminalAttach,
577
+ files: wantFilesAttach,
578
+ lastInteractionAgeMs: Math.max(0, Date.now() - lastInteractionRef.current)
579
+ });
580
+ if (cancelled) {
581
+ void client.detachViewer(workspaceId, sessionId, holder.viewerId).catch(() => {
582
+ });
583
+ return;
584
+ }
585
+ if (wantDesktopAttach && (!holder.dataPlaneUrl || !holder.transport || !holder.client) || wantTerminalAttach && (!holder.terminalUrl || !holder.terminalTransport)) {
586
+ await client.detachViewer(workspaceId, sessionId, holder.viewerId).catch(() => {
587
+ });
588
+ throw new Error("live plane unavailable");
589
+ }
590
+ localViewerId = holder.viewerId;
591
+ viewerIdRef.current = holder.viewerId;
592
+ idleDrainMs = typeof holder.viewerIdleDrainMs === "number" && holder.viewerIdleDrainMs > 0 ? holder.viewerIdleDrainMs : null;
593
+ setViewerId(holder.viewerId);
594
+ epochRef.current = holder.leaseEpoch;
595
+ setCapabilities(
596
+ (prev) => prev ? {
597
+ ...prev,
598
+ liveness: holder.liveness,
599
+ leaseEpoch: holder.leaseEpoch,
600
+ viewerHeartbeatIntervalMs: holder.viewerHeartbeatIntervalMs,
601
+ DesktopStream: wantDesktopAttach ? {
602
+ ...prev.DesktopStream,
603
+ transport: holder.transport ?? prev.DesktopStream.transport,
604
+ client: holder.client ?? prev.DesktopStream.client,
605
+ url: holder.dataPlaneUrl,
606
+ token: holder.streamToken,
607
+ expiresAt: holder.streamExpiresAt,
608
+ resolution: holder.resolution ?? prev.DesktopStream.resolution
609
+ } : prev.DesktopStream,
610
+ Terminal: wantTerminalAttach ? {
611
+ ...prev.Terminal,
612
+ transport: holder.terminalTransport ?? prev.Terminal.transport,
613
+ url: holder.terminalUrl,
614
+ token: holder.terminalToken,
615
+ expiresAt: holder.terminalExpiresAt,
616
+ // A live pty-ws means the box is pty-capable for real.
617
+ ptyCapable: holder.terminalTransport ? true : prev.Terminal.ptyCapable,
618
+ reason: holder.terminalTransport ? null : prev.Terminal.reason
619
+ } : prev.Terminal
620
+ } : prev
621
+ );
622
+ } catch (cause) {
623
+ if (cancelled) return;
624
+ if (cause instanceof OpenGeniApiError) {
625
+ if (cause.status === 409) {
626
+ if (wantDesktopAttach) {
627
+ setAcknowledgmentRequired(
628
+ cause.message.includes("shared_acknowledgment") ? "shared" : "unredacted"
629
+ );
630
+ }
631
+ } else if (cause.status === 429) {
632
+ const refusal = typeof cause.details?.viewerRefusal === "string" ? cause.details.viewerRefusal : cause.message.includes("went unused") ? "viewer_idle" : cause.message.includes("computers") ? "computer_limit" : null;
633
+ const cardRequired = cause.details?.code === "sandbox_card_required";
634
+ if (cardRequired && typeof window !== "undefined") {
635
+ window.dispatchEvent(
636
+ new CustomEvent("opengeni:card-required", {
637
+ detail: { workspaceId, accountId: null }
638
+ })
639
+ );
640
+ }
641
+ if (cardRequired) {
642
+ cardRefusedRef.current = true;
643
+ attachRefused = true;
644
+ setViewerCapReached(true);
645
+ setViewerCapReason("computers");
646
+ } else if (refusal === "viewer_idle") {
647
+ attachRefused = true;
648
+ resumeOnInteractionRef.current = true;
649
+ } else {
650
+ setViewerCapReached(true);
651
+ const computers = refusal === "computer_limit";
652
+ setViewerCapReason(computers ? "computers" : "viewers");
653
+ if (computers) attachRefused = true;
654
+ }
655
+ } else if (cause.status === 403) {
656
+ setState("error");
657
+ setError(cause);
658
+ return;
659
+ } else {
660
+ throw cause;
661
+ }
662
+ } else {
663
+ throw cause;
664
+ }
665
+ }
666
+ }
667
+ const warmUpRequested = !awaitingInteraction && !attachRefused && (wantDesktopAttach || wantTerminalAttach || wantFilesAttach);
668
+ if (sandboxAcceptsLiveIo(caps.liveness) || localViewerId) {
669
+ setState("ready");
670
+ startHeartbeat(caps);
671
+ } else if (warmUpRequested) {
672
+ setState("cold");
673
+ pollUntilWarm();
674
+ } else {
675
+ setState("on-demand");
676
+ }
677
+ } catch (cause) {
678
+ if (cancelled) return;
679
+ if (isSandboxOwnershipDisabledError(cause)) {
680
+ setState("on-demand");
681
+ setError(null);
682
+ return;
683
+ }
684
+ if (cause instanceof OpenGeniApiError && cause.status === 403) {
685
+ setState("error");
686
+ setError(new Error("not permitted to view this session's sandbox"));
687
+ return;
688
+ }
689
+ setState("error");
690
+ setError(normalizeError(cause));
691
+ }
692
+ })();
693
+ return () => {
694
+ cancelled = true;
695
+ requestAbort.abort();
696
+ clearTimers();
697
+ const releaseId = localViewerId ?? viewerIdRef.current;
698
+ if (releaseId) {
699
+ void client.detachViewer(workspaceId, sessionId, releaseId).catch(() => {
700
+ });
701
+ }
702
+ };
703
+ }, [
704
+ client,
705
+ workspaceId,
706
+ sessionId,
707
+ lifecycleEnabled,
708
+ attachDesktop,
709
+ attachTerminal,
710
+ attachFiles,
711
+ warmingPollMs,
712
+ warmingDeadlineMs,
713
+ nonce,
714
+ identityKey
715
+ ]);
716
+ const events = options.events;
717
+ useEffect3(() => {
718
+ if (!events || events.length === 0) return;
719
+ setCapabilities((prev) => {
720
+ if (!prev || !prev.DesktopStream.url) return prev;
721
+ let next = prev.DesktopStream;
722
+ let changed = false;
723
+ for (const rotation of rotationsFrom(events)) {
724
+ if (rotation.viewerId && viewerIdRef.current && rotation.viewerId !== viewerIdRef.current) {
725
+ continue;
726
+ }
727
+ const applied = applyUrlRotation(next, rotation, epochRef.current);
728
+ if (applied) {
729
+ next = { ...next, url: applied.url, token: applied.token, expiresAt: applied.expiresAt };
730
+ epochRef.current = Math.max(epochRef.current, rotation.leaseEpoch);
731
+ changed = true;
732
+ }
733
+ }
734
+ return changed ? { ...prev, DesktopStream: next, leaseEpoch: epochRef.current } : prev;
735
+ });
736
+ }, [events]);
737
+ const identityMatches = enabled && stateIdentity === identityKey;
738
+ return {
739
+ capabilities: identityMatches ? capabilities : null,
740
+ state: identityMatches ? state : "idle",
741
+ error: identityMatches ? error : null,
742
+ acknowledgmentRequired: identityMatches ? acknowledgmentRequired : null,
743
+ viewerCapReached: identityMatches && viewerCapReached,
744
+ viewerCapReason: identityMatches && viewerCapReached ? viewerCapReason : null,
745
+ viewerId: identityMatches ? viewerId : null,
746
+ renegotiate
747
+ };
748
+ }
749
+ function isSandboxOwnershipDisabledError(error) {
750
+ return error instanceof OpenGeniApiError && error.status === 404 && error.message.includes("sandbox ownership is not enabled");
751
+ }
752
+
753
+ // src/hooks/use-sandbox-terminal.ts
754
+ import { OpenGeniApiError as OpenGeniApiError2 } from "@opengeni/sdk";
755
+ import { useCallback as useCallback6, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef4, useState as useState4 } from "react";
756
+ var SANDBOX_TERMINAL_HISTORY_ROWS = 1e3;
757
+ var SANDBOX_TERMINAL_MAX_ROWS = 4e3;
758
+ function useSandboxTerminal(sessionId, options) {
759
+ const { client, workspaceId } = useOpenGeni(options);
760
+ const includeAgentFirehose = options.includeAgentFirehose ?? true;
761
+ const interactive = options.interactive ?? false;
762
+ const ptyFilter = options.ptyId;
763
+ const liveness = options.liveness;
764
+ const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${interactive}\0${ptyFilter ?? ""}`;
765
+ const [openedPtyId, setOpenedPtyId] = useState4(null);
766
+ const [openError, setOpenError] = useState4(null);
767
+ const [stateIdentity, setStateIdentity] = useState4(identityKey);
768
+ const [reopenNonce, setReopenNonce] = useState4(0);
769
+ const currentIdentityRef = useRef4(identityKey);
770
+ currentIdentityRef.current = identityKey;
771
+ useEffect4(() => {
772
+ setStateIdentity(identityKey);
773
+ setOpenedPtyId(null);
774
+ setOpenError(null);
775
+ }, [identityKey]);
776
+ const openInFlight = useRef4(false);
777
+ const boxWarm = liveness === void 0 || sandboxAcceptsLiveIo(liveness);
778
+ useEffect4(() => {
779
+ if (!interactive || !sessionId || ptyFilter || !boxWarm) {
780
+ setOpenError(null);
781
+ return;
782
+ }
783
+ let cancelled = false;
784
+ setOpenError(null);
785
+ openInFlight.current = true;
786
+ let openedId = null;
787
+ void client.terminalPtyOpen(workspaceId, sessionId, {}).then((res) => {
788
+ if (cancelled) {
789
+ void client.terminalPtyClose(workspaceId, sessionId, { ptyId: res.ptyId }).catch(() => {
790
+ });
791
+ return;
792
+ }
793
+ openedId = res.ptyId;
794
+ setOpenedPtyId(res.ptyId);
795
+ }).catch((cause) => {
796
+ if (!cancelled) setOpenError(cause instanceof Error ? cause : new Error(String(cause)));
797
+ }).finally(() => {
798
+ openInFlight.current = false;
799
+ });
800
+ return () => {
801
+ cancelled = true;
802
+ setOpenedPtyId(null);
803
+ const id = openedId;
804
+ if (id) void client.terminalPtyClose(workspaceId, sessionId, { ptyId: id }).catch(() => {
805
+ });
806
+ };
807
+ }, [interactive, client, workspaceId, sessionId, ptyFilter, boxWarm, reopenNonce]);
808
+ const outputTypes = useMemo2(
809
+ () => includeAgentFirehose && !ptyFilter ? ["terminal.pty.output.delta", "sandbox.command.output.delta"] : ["terminal.pty.output.delta"],
810
+ [includeAgentFirehose, ptyFilter]
811
+ );
812
+ const historyKey = `${workspaceId}\0${sessionId ?? ""}\0${outputTypes.join(",")}`;
813
+ const historyEnabled = (options.history ?? true) && Boolean(sessionId);
814
+ const gapGeneration = useTurnlessOutputGap(workspaceId, sessionId);
815
+ const [history, setHistory] = useState4(null);
816
+ const [historyTick, setHistoryTick] = useState4(0);
817
+ const readRef = useRef4(historyReadState(historyKey));
818
+ const mountedRef = useRef4(false);
819
+ useEffect4(() => {
820
+ mountedRef.current = true;
821
+ return () => {
822
+ mountedRef.current = false;
823
+ const state = readRef.current;
824
+ if (state.timer) clearTimeout(state.timer);
825
+ state.timer = null;
826
+ };
827
+ }, []);
828
+ useEffect4(() => {
829
+ let state = readRef.current;
830
+ if (state.key !== historyKey) {
831
+ if (state.timer) clearTimeout(state.timer);
832
+ state = historyReadState(historyKey);
833
+ readRef.current = state;
834
+ setHistory(null);
835
+ }
836
+ if (!historyEnabled || !sessionId || state.inFlight || state.timer) return;
837
+ if (!state.failed && state.generation === gapGeneration) return;
838
+ const now = Date.now();
839
+ const wait = state.failed ? terminalHistoryRetryDelay(state.failures) - (now - state.startedAt) : state.generation === null ? 0 : SANDBOX_TERMINAL_REREAD_MIN_MS - (now - state.startedAt);
840
+ if (wait > 0) {
841
+ state.timer = setTimeout(() => {
842
+ state.timer = null;
843
+ if (mountedRef.current) setHistoryTick((tick) => tick + 1);
844
+ }, wait);
845
+ return;
846
+ }
847
+ const generation = gapGeneration;
848
+ state.inFlight = true;
849
+ state.startedAt = now;
850
+ const current = () => mountedRef.current && readRef.current === state;
851
+ void readTerminalHistory(client, workspaceId, sessionId, outputTypes).then(
852
+ (page) => {
853
+ state.inFlight = false;
854
+ if (!current()) return;
855
+ state.failed = false;
856
+ state.failures = 0;
857
+ state.generation = generation;
858
+ setHistory({ key: state.key, events: page.events, complete: page.complete });
859
+ setHistoryTick((tick) => tick + 1);
860
+ },
861
+ (cause) => {
862
+ state.inFlight = false;
863
+ if (!current()) return;
864
+ if (cause instanceof OpenGeniApiError2 && cause.status >= 400 && cause.status < 500 && cause.status !== 408 && cause.status !== 429) {
865
+ state.failed = false;
866
+ state.failures = 0;
867
+ state.generation = generation;
868
+ return;
869
+ }
870
+ state.failed = true;
871
+ state.failures += 1;
872
+ setHistoryTick((tick) => tick + 1);
873
+ }
874
+ );
875
+ }, [
876
+ historyEnabled,
877
+ historyKey,
878
+ gapGeneration,
879
+ historyTick,
880
+ outputTypes,
881
+ client,
882
+ workspaceId,
883
+ sessionId
884
+ ]);
885
+ const liveRef = useRef4({ key: historyKey, rows: /* @__PURE__ */ new Map(), below: 0 });
886
+ const { chunks, openPty, supportsInput } = useMemo2(() => {
887
+ const open = /* @__PURE__ */ new Map();
888
+ let lastOpened = null;
889
+ let lastSupportsInput = false;
890
+ if (liveRef.current.key !== historyKey) {
891
+ liveRef.current = { key: historyKey, rows: /* @__PURE__ */ new Map(), below: 0 };
892
+ }
893
+ const liveRows = liveRef.current;
894
+ const live = liveRows.rows;
895
+ const types = new Set(outputTypes);
896
+ for (const event of options.events) {
897
+ if (event.workspaceId !== workspaceId || event.sessionId !== sessionId) continue;
898
+ if (event.type === "terminal.pty.started") {
899
+ const payload = event.payload;
900
+ if (payload?.ptyId) {
901
+ open.set(payload.ptyId, { supportsInput: true });
902
+ lastOpened = payload.ptyId;
903
+ }
904
+ continue;
905
+ }
906
+ if (event.type === "terminal.pty.exited") {
907
+ const payload = event.payload;
908
+ if (payload?.ptyId) {
909
+ open.delete(payload.ptyId);
910
+ if (lastOpened === payload.ptyId) lastOpened = null;
911
+ }
912
+ continue;
913
+ }
914
+ if (types.has(event.type) && event.sequence >= liveRows.below && !live.has(event.id)) {
915
+ live.set(event.id, event);
916
+ }
917
+ }
918
+ trimLiveRows(liveRows);
919
+ const loaded = history?.key === historyKey ? history : null;
920
+ const floor = loaded && !loaded.complete ? loaded.events[0]?.sequence ?? 0 : 0;
921
+ const seen = /* @__PURE__ */ new Set();
922
+ const out = [];
923
+ const add = (event) => {
924
+ if (seen.has(event.id) || event.sequence < floor) return;
925
+ seen.add(event.id);
926
+ const chunk = terminalChunk(event, ptyFilter);
927
+ if (chunk) out.push(chunk);
928
+ };
929
+ loaded?.events.forEach(add);
930
+ live.forEach(add);
931
+ out.sort((a, b) => a.seq - b.seq);
932
+ const activePty = ptyFilter && open.has(ptyFilter) ? ptyFilter : lastOpened;
933
+ lastSupportsInput = activePty ? open.get(activePty)?.supportsInput ?? false : false;
934
+ return {
935
+ chunks: out.length > SANDBOX_TERMINAL_MAX_ROWS ? out.slice(-SANDBOX_TERMINAL_MAX_ROWS) : out,
936
+ openPty: activePty,
937
+ supportsInput: lastSupportsInput
938
+ };
939
+ }, [options.events, history, historyKey, outputTypes, ptyFilter, workspaceId, sessionId]);
940
+ const identityMatches = stateIdentity === identityKey;
941
+ const activePtyId = identityMatches ? openedPtyId ?? openPty : null;
942
+ const canWrite = openedPtyId !== null || supportsInput;
943
+ const write = useMemo2(() => {
944
+ if (!activePtyId || !canWrite || !sessionId) return null;
945
+ const writeIdentity = identityKey;
946
+ return (data) => {
947
+ void client.terminalPtyWrite(workspaceId, sessionId, { ptyId: activePtyId, data }).catch((cause) => {
948
+ if (cause instanceof OpenGeniApiError2 && (cause.status === 409 || cause.status === 404) && activePtyId === openedPtyId && currentIdentityRef.current === writeIdentity) {
949
+ setOpenedPtyId(null);
950
+ setReopenNonce((n) => n + 1);
951
+ }
952
+ });
953
+ };
954
+ }, [client, workspaceId, sessionId, activePtyId, canWrite, openedPtyId, identityKey]);
955
+ const close = useCallback6(() => {
956
+ if (!activePtyId || !sessionId) return;
957
+ void client.terminalPtyClose(workspaceId, sessionId, { ptyId: activePtyId }).catch(() => {
958
+ });
959
+ }, [client, workspaceId, sessionId, activePtyId]);
960
+ const error = identityMatches ? openError : null;
961
+ return useMemo2(
962
+ () => ({ chunks, running: activePtyId !== null, write, activePtyId, close, error }),
963
+ [chunks, activePtyId, write, close, error]
964
+ );
965
+ }
966
+ function trimLiveRows(live) {
967
+ const { rows } = live;
968
+ if (rows.size <= SANDBOX_TERMINAL_MAX_ROWS + SANDBOX_TERMINAL_MAX_ROWS / 4) return;
969
+ const sorted = [...rows.values()].sort((left, right) => left.sequence - right.sequence);
970
+ const drop = sorted.length - SANDBOX_TERMINAL_MAX_ROWS;
971
+ for (const event of sorted.slice(0, drop)) rows.delete(event.id);
972
+ live.below = Math.max(live.below, sorted[drop].sequence);
973
+ }
974
+ function historyReadState(key) {
975
+ return {
976
+ key,
977
+ generation: null,
978
+ inFlight: false,
979
+ failed: false,
980
+ failures: 0,
981
+ startedAt: 0,
982
+ timer: null
983
+ };
984
+ }
985
+ var SANDBOX_TERMINAL_REREAD_MIN_MS = 1e3;
986
+ function terminalHistoryRetryDelay(failures) {
987
+ return Math.min(3e4, 1e3 * 2 ** Math.max(0, failures - 1));
988
+ }
989
+ function terminalChunk(event, ptyFilter) {
990
+ if (event.type === "terminal.pty.output.delta") {
991
+ const payload = event.payload;
992
+ if (!payload || typeof payload.chunk !== "string") return null;
993
+ if (ptyFilter && payload.ptyId !== ptyFilter) return null;
994
+ return {
995
+ id: event.id,
996
+ text: payload.chunk,
997
+ stream: payload.stream === "stderr" ? "stderr" : "stdout",
998
+ seq: event.sequence
999
+ };
1000
+ }
1001
+ if (event.type === "sandbox.command.output.delta" && !ptyFilter) {
1002
+ const payload = event.payload;
1003
+ if (!payload?.chunk) return null;
1004
+ return {
1005
+ id: event.id,
1006
+ text: payload.chunk,
1007
+ stream: payload.stream === "stderr" ? "stderr" : "stdout",
1008
+ seq: event.sequence
1009
+ };
1010
+ }
1011
+ return null;
1012
+ }
1013
+ async function readTerminalHistory(client, workspaceId, sessionId, includeTypes) {
1014
+ const options = {
1015
+ includeTypes,
1016
+ direction: "before",
1017
+ // Explicit: a cursorless read otherwise defaults to the monitoring tail,
1018
+ // which drops raw output deltas.
1019
+ mode: "forensic",
1020
+ payloadMode: "full",
1021
+ limit: SANDBOX_TERMINAL_HISTORY_ROWS
1022
+ };
1023
+ const pageClient = client;
1024
+ const page = typeof pageClient.listEventPage === "function" ? await pageClient.listEventPage(workspaceId, sessionId, options) : null;
1025
+ const events = page ? page.events : await client.listEvents(workspaceId, sessionId, options);
1026
+ const sorted = [...events].sort((left, right) => left.sequence - right.sequence);
1027
+ return {
1028
+ events: sorted,
1029
+ // Without a continuation fact, only an empty read is known complete: the
1030
+ // server's byte bound can cut a page short of the row limit.
1031
+ complete: page ? !page.hasMore : sorted.length === 0
1032
+ };
1033
+ }
1034
+
1035
+ // src/hooks/use-sandbox-git.ts
1036
+ import { useCallback as useCallback7, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef5, useState as useState5 } from "react";
1037
+ function normalizeRoot(root) {
1038
+ const normalized = root.replaceAll("\\", "/").replace(/^\.\/+/, "").replace(/\/+$/, "");
1039
+ return normalized === "." ? "" : normalized;
1040
+ }
1041
+ function qualifyPath(repoRoot, path) {
1042
+ const root = normalizeRoot(repoRoot);
1043
+ return root ? `${root}/${path}` : path;
1044
+ }
1045
+ function qualifyDiff(repoRoot, file) {
1046
+ const root = normalizeRoot(repoRoot);
1047
+ return {
1048
+ ...file,
1049
+ path: qualifyPath(root, file.path),
1050
+ oldPath: file.oldPath === null ? null : qualifyPath(root, file.oldPath),
1051
+ repoRoot: root
1052
+ };
1053
+ }
1054
+ function uniqueRoots(roots) {
1055
+ return [...new Set(roots.map(normalizeRoot))].sort((a, b) => a.localeCompare(b));
1056
+ }
1057
+ var GIT_READ_BATCH_REQUEST_LIMIT = 32;
1058
+ function repoForPath(manifest, repoPath) {
1059
+ const want = normalizeRoot(repoPath);
1060
+ const exact = manifest.repos.find((r) => normalizeRoot(r.root) === want);
1061
+ if (exact) return exact;
1062
+ if (want === "" && manifest.repos.length === 1) return manifest.repos[0] ?? null;
1063
+ return null;
1064
+ }
1065
+ function sameFileDiff(a, b) {
1066
+ if (a.path !== b.path || a.oldPath !== b.oldPath || a.repoRoot !== b.repoRoot || a.status !== b.status || a.isBinary !== b.isBinary || a.isImage !== b.isImage || a.additions !== b.additions || a.deletions !== b.deletions || a.truncated !== b.truncated || a.hunks.length !== b.hunks.length)
1067
+ return false;
1068
+ return a.hunks.every((hunk, hunkIndex) => {
1069
+ const other = b.hunks[hunkIndex];
1070
+ if (!other || hunk.oldStart !== other.oldStart || hunk.oldLines !== other.oldLines || hunk.newStart !== other.newStart || hunk.newLines !== other.newLines || hunk.header !== other.header || hunk.lines.length !== other.lines.length)
1071
+ return false;
1072
+ return hunk.lines.every((line, lineIndex) => {
1073
+ const otherLine = other.lines[lineIndex];
1074
+ return otherLine !== void 0 && line.type === otherLine.type && line.oldNo === otherLine.oldNo && line.newNo === otherLine.newNo && line.text === otherLine.text;
1075
+ });
1076
+ });
1077
+ }
1078
+ function mergeDiffs(current, next) {
1079
+ if (current.length === 0) return next;
1080
+ const byPath = new Map(current.map((d) => [d.path, d]));
1081
+ let changed = current.length !== next.length;
1082
+ const merged = next.map((file, index) => {
1083
+ const existing = byPath.get(file.path);
1084
+ if (existing && sameFileDiff(existing, file)) {
1085
+ if (current[index] !== existing) changed = true;
1086
+ return existing;
1087
+ }
1088
+ changed = true;
1089
+ return file;
1090
+ });
1091
+ return changed ? merged : current;
1092
+ }
1093
+ function useSandboxGit(sessionId, options = {}) {
1094
+ const { client, workspaceId } = useOpenGeni(options);
1095
+ const enabled = (options.enabled ?? true) && Boolean(sessionId);
1096
+ const active = options.active ?? true;
1097
+ const repoPath = options.repoPath ?? "";
1098
+ const workspaceWide = options.repoPaths !== void 0;
1099
+ const repoPathsKey = uniqueRoots(
1100
+ options.repoPaths && options.repoPaths.length > 0 ? options.repoPaths : [repoPath]
1101
+ ).join("\0");
1102
+ const repoPaths = useMemo3(() => repoPathsKey.split("\0"), [repoPathsKey]);
1103
+ const comparison = options.comparison ?? (options.staged ? "staged" : "working");
1104
+ const hasAdvertisedRepoPaths = (options.repoPaths?.length ?? 0) > 0;
1105
+ const capture = comparison === "staged" ? null : options.capture ?? null;
1106
+ const isLive2 = sandboxAcceptsLiveIo(options.liveness);
1107
+ const acceptsEventReads = options.liveness === void 0 || isLive2;
1108
+ const acceptsEventReadsRef = useRef5(acceptsEventReads);
1109
+ acceptsEventReadsRef.current = acceptsEventReads;
1110
+ const hasLiveIoFence = options.liveness !== void 0;
1111
+ const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${repoPathsKey}\0${workspaceWide}\0${comparison}`;
1112
+ const [diff, setDiff] = useState5([]);
1113
+ const [branch, setBranch] = useState5(null);
1114
+ const [isRepo, setIsRepo] = useState5(false);
1115
+ const [ahead, setAhead] = useState5(0);
1116
+ const [behind, setBehind] = useState5(0);
1117
+ const [repoRoots, setRepoRoots] = useState5([]);
1118
+ const [source, setSource] = useState5(null);
1119
+ const sourceRef = useRef5(null);
1120
+ const [loading, setLoading] = useState5(false);
1121
+ const [error, setError] = useState5(null);
1122
+ const [stateIdentity, setStateIdentity] = useState5(identityKey);
1123
+ const refreshGenerationRef = useRef5(0);
1124
+ const refreshAbortRef = useRef5(null);
1125
+ const refreshInFlightRef = useRef5(null);
1126
+ const refreshPendingRef = useRef5(false);
1127
+ const refreshWorkerEpochRef = useRef5(0);
1128
+ const lastChangeRef = useRef5(0);
1129
+ const eventRefreshTimerRef = useRef5(null);
1130
+ const performRefresh = useCallback7(async () => {
1131
+ if (!sessionId) return;
1132
+ const refreshAbort = new AbortController();
1133
+ refreshAbortRef.current = refreshAbort;
1134
+ const generation = refreshGenerationRef.current += 1;
1135
+ setLoading(true);
1136
+ setError(null);
1137
+ try {
1138
+ const diffRequest = (root) => client.gitDiff(
1139
+ workspaceId,
1140
+ sessionId,
1141
+ {
1142
+ path: root,
1143
+ ...comparison === "branch" ? { fromRef: "origin/HEAD", mergeBase: true, includeUntracked: true } : comparison === "working" ? { fromRef: "HEAD", includeUntracked: true } : { staged: true, includeUntracked: false }
1144
+ },
1145
+ { signal: refreshAbort.signal }
1146
+ );
1147
+ const prefetched = hasAdvertisedRepoPaths ? await (async () => {
1148
+ const prefetchedRepos = [];
1149
+ for (let offset = 0; offset < repoPaths.length; offset += GIT_READ_BATCH_REQUEST_LIMIT) {
1150
+ const roots2 = repoPaths.slice(offset, offset + GIT_READ_BATCH_REQUEST_LIMIT);
1151
+ const batch = await client.gitReadBatch(
1152
+ workspaceId,
1153
+ sessionId,
1154
+ {
1155
+ requests: roots2.map((root) => ({
1156
+ status: { path: root },
1157
+ diff: {
1158
+ path: root,
1159
+ ...comparison === "branch" ? { fromRef: "origin/HEAD", mergeBase: true, includeUntracked: true } : comparison === "working" ? { fromRef: "HEAD", includeUntracked: true } : { staged: true, includeUntracked: false }
1160
+ }
1161
+ }))
1162
+ },
1163
+ { signal: refreshAbort.signal }
1164
+ );
1165
+ if (batch.results.length !== roots2.length) {
1166
+ throw new Error(
1167
+ `Workspace Git batch returned ${batch.results.length} results for ${roots2.length} repositories.`
1168
+ );
1169
+ }
1170
+ batch.results.forEach((item, index) => {
1171
+ prefetchedRepos.push({
1172
+ root: roots2[index],
1173
+ status: item.status,
1174
+ result: item.diff ?? {
1175
+ files: [],
1176
+ revision: item.status.revision
1177
+ }
1178
+ });
1179
+ });
1180
+ }
1181
+ return prefetchedRepos;
1182
+ })() : null;
1183
+ const statuses = prefetched ?? await Promise.all(
1184
+ repoPaths.map(async (root) => ({
1185
+ root,
1186
+ status: await client.gitStatus(
1187
+ workspaceId,
1188
+ sessionId,
1189
+ { path: root },
1190
+ { signal: refreshAbort.signal }
1191
+ )
1192
+ }))
1193
+ );
1194
+ if (refreshGenerationRef.current !== generation) return;
1195
+ const repositories = statuses.filter(({ status }) => status.isRepo);
1196
+ const roots = repositories.map(({ root }) => root);
1197
+ setRepoRoots((previous) => sameStrings(previous, roots) ? previous : roots);
1198
+ setIsRepo(repositories.length > 0);
1199
+ setBranch(repositories.length === 1 ? repositories[0]?.status.head ?? null : null);
1200
+ setAhead(repositories.reduce((sum, { status }) => sum + status.ahead, 0));
1201
+ setBehind(repositories.reduce((sum, { status }) => sum + status.behind, 0));
1202
+ if (repositories.length === 0) {
1203
+ setDiff([]);
1204
+ sourceRef.current = "live";
1205
+ setSource("live");
1206
+ return;
1207
+ }
1208
+ const prefetchedByRoot = new Map(prefetched?.map(({ root, result }) => [root, result]));
1209
+ const results = await Promise.all(
1210
+ repositories.map(async ({ root }) => ({
1211
+ root,
1212
+ result: prefetchedByRoot.get(root) ?? await diffRequest(root)
1213
+ }))
1214
+ );
1215
+ if (refreshGenerationRef.current !== generation) return;
1216
+ setDiff(
1217
+ (prev) => mergeDiffs(
1218
+ prev,
1219
+ results.flatMap(
1220
+ ({ root, result }) => workspaceWide ? result.files.map((file) => qualifyDiff(root, file)) : result.files
1221
+ )
1222
+ )
1223
+ );
1224
+ sourceRef.current = "live";
1225
+ setSource("live");
1226
+ } catch (cause) {
1227
+ if (refreshGenerationRef.current !== generation) return;
1228
+ setError(cause instanceof Error ? cause : new Error(String(cause)));
1229
+ } finally {
1230
+ if (refreshGenerationRef.current === generation) setLoading(false);
1231
+ if (refreshAbortRef.current === refreshAbort) refreshAbortRef.current = null;
1232
+ }
1233
+ }, [
1234
+ client,
1235
+ workspaceId,
1236
+ sessionId,
1237
+ repoPaths,
1238
+ hasAdvertisedRepoPaths,
1239
+ workspaceWide,
1240
+ comparison
1241
+ ]);
1242
+ const performRefreshRef = useRef5(performRefresh);
1243
+ performRefreshRef.current = performRefresh;
1244
+ const refresh = useCallback7(async () => {
1245
+ refreshPendingRef.current = true;
1246
+ const existing = refreshInFlightRef.current;
1247
+ if (existing) return await existing;
1248
+ const workerEpoch = refreshWorkerEpochRef.current;
1249
+ const run = (async () => {
1250
+ while (refreshPendingRef.current && refreshWorkerEpochRef.current === workerEpoch) {
1251
+ refreshPendingRef.current = false;
1252
+ await performRefreshRef.current();
1253
+ }
1254
+ })();
1255
+ refreshInFlightRef.current = run;
1256
+ try {
1257
+ await run;
1258
+ } finally {
1259
+ if (refreshInFlightRef.current === run) refreshInFlightRef.current = null;
1260
+ }
1261
+ }, []);
1262
+ const seedFromCapture = useCallback7(
1263
+ (manifest) => {
1264
+ const repositories = workspaceWide ? manifest.repos : [repoForPath(manifest, repoPath)].filter(Boolean);
1265
+ if (comparison === "branch" && repositories.some((repo) => repo.branchDiff === void 0)) {
1266
+ return;
1267
+ }
1268
+ if (repositories.length === 0) {
1269
+ setIsRepo(false);
1270
+ setBranch(null);
1271
+ setAhead(0);
1272
+ setBehind(0);
1273
+ setRepoRoots([]);
1274
+ setDiff((prev) => prev.length === 0 ? prev : []);
1275
+ sourceRef.current = "capture";
1276
+ setSource("capture");
1277
+ return;
1278
+ }
1279
+ setIsRepo(true);
1280
+ setBranch(repositories.length === 1 ? repositories[0]?.head ?? null : null);
1281
+ setAhead(repositories.reduce((sum, repo) => sum + repo.ahead, 0));
1282
+ setBehind(repositories.reduce((sum, repo) => sum + repo.behind, 0));
1283
+ const capturedRoots = repositories.map((repo) => normalizeRoot(repo.root));
1284
+ setRepoRoots((previous) => sameStrings(previous, capturedRoots) ? previous : capturedRoots);
1285
+ setDiff(
1286
+ (prev) => mergeDiffs(
1287
+ prev,
1288
+ repositories.flatMap((repo) => {
1289
+ const capturedDiff = comparison === "branch" ? repo.branchDiff ?? [] : repo.diff;
1290
+ return workspaceWide ? capturedDiff.map((file) => qualifyDiff(repo.root, file)) : capturedDiff;
1291
+ })
1292
+ )
1293
+ );
1294
+ sourceRef.current = "capture";
1295
+ setSource("capture");
1296
+ setError(null);
1297
+ },
1298
+ [comparison, repoPath, workspaceWide]
1299
+ );
1300
+ const captureRef = useRef5(capture);
1301
+ captureRef.current = capture;
1302
+ const captureRevision = capture?.revision ?? null;
1303
+ const previousIdentityRef = useRef5(identityKey);
1304
+ useEffect5(() => {
1305
+ refreshAbortRef.current?.abort();
1306
+ refreshAbortRef.current = null;
1307
+ refreshPendingRef.current = false;
1308
+ refreshGenerationRef.current += 1;
1309
+ const identityChanged = previousIdentityRef.current !== identityKey;
1310
+ previousIdentityRef.current = identityKey;
1311
+ if (identityChanged) {
1312
+ refreshWorkerEpochRef.current += 1;
1313
+ refreshInFlightRef.current = null;
1314
+ }
1315
+ if (identityChanged || !enabled) {
1316
+ lastChangeRef.current = 0;
1317
+ setDiff([]);
1318
+ setStateIdentity(identityKey);
1319
+ setIsRepo(false);
1320
+ setBranch(null);
1321
+ setAhead(0);
1322
+ setBehind(0);
1323
+ setRepoRoots([]);
1324
+ sourceRef.current = null;
1325
+ setSource(null);
1326
+ setLoading(false);
1327
+ setError(null);
1328
+ }
1329
+ if (!enabled) {
1330
+ return;
1331
+ }
1332
+ const currentCapture = captureRevision !== null ? captureRef.current : null;
1333
+ if (currentCapture && (identityChanged || !isLive2 || sourceRef.current !== "live")) {
1334
+ seedFromCapture(currentCapture);
1335
+ }
1336
+ if (!active) {
1337
+ if (!active) setLoading(false);
1338
+ return;
1339
+ }
1340
+ if (isLive2 || !hasLiveIoFence && !currentCapture) {
1341
+ void refresh();
1342
+ }
1343
+ return () => {
1344
+ refreshAbortRef.current?.abort();
1345
+ refreshAbortRef.current = null;
1346
+ refreshPendingRef.current = false;
1347
+ refreshGenerationRef.current += 1;
1348
+ };
1349
+ }, [
1350
+ enabled,
1351
+ active,
1352
+ isLive2,
1353
+ hasLiveIoFence,
1354
+ captureRevision,
1355
+ identityKey,
1356
+ refresh,
1357
+ seedFromCapture
1358
+ ]);
1359
+ const events = options.events;
1360
+ useEffect5(() => {
1361
+ if (!enabled || !events) {
1362
+ if (eventRefreshTimerRef.current) {
1363
+ clearTimeout(eventRefreshTimerRef.current);
1364
+ eventRefreshTimerRef.current = null;
1365
+ }
1366
+ return;
1367
+ }
1368
+ if (!active || !acceptsEventReads) {
1369
+ for (const event of events) {
1370
+ if (event.sequence > lastChangeRef.current) lastChangeRef.current = event.sequence;
1371
+ }
1372
+ if (eventRefreshTimerRef.current) {
1373
+ clearTimeout(eventRefreshTimerRef.current);
1374
+ eventRefreshTimerRef.current = null;
1375
+ }
1376
+ return;
1377
+ }
1378
+ let latest = lastChangeRef.current;
1379
+ let changed = false;
1380
+ for (const event of events) {
1381
+ if (event.sequence <= latest) continue;
1382
+ if (event.type === "git.changed") {
1383
+ latest = event.sequence;
1384
+ changed = true;
1385
+ }
1386
+ }
1387
+ if (latest > lastChangeRef.current) {
1388
+ lastChangeRef.current = latest;
1389
+ if (!changed) return;
1390
+ if (eventRefreshTimerRef.current) clearTimeout(eventRefreshTimerRef.current);
1391
+ eventRefreshTimerRef.current = setTimeout(() => {
1392
+ eventRefreshTimerRef.current = null;
1393
+ if (acceptsEventReadsRef.current) void refresh();
1394
+ }, 150);
1395
+ }
1396
+ }, [enabled, active, acceptsEventReads, events, refresh]);
1397
+ useEffect5(
1398
+ () => () => {
1399
+ if (eventRefreshTimerRef.current) clearTimeout(eventRefreshTimerRef.current);
1400
+ },
1401
+ []
1402
+ );
1403
+ const identityMatches = enabled && stateIdentity === identityKey;
1404
+ const capturedAt = identityMatches && source === "capture" ? capture?.capturedAt ?? null : null;
1405
+ return useMemo3(() => {
1406
+ const visibleRepoRoots = identityMatches ? repoRoots : NO_ROOTS;
1407
+ return {
1408
+ diff: identityMatches ? diff : NO_DIFF,
1409
+ branch: identityMatches ? branch : null,
1410
+ isRepo: identityMatches && isRepo,
1411
+ ahead: identityMatches ? ahead : 0,
1412
+ behind: identityMatches ? behind : 0,
1413
+ repoCount: visibleRepoRoots.length,
1414
+ repoRoots: visibleRepoRoots,
1415
+ refresh,
1416
+ source: identityMatches ? source : null,
1417
+ capturedAt,
1418
+ loading: identityMatches && loading,
1419
+ error: identityMatches ? error : null
1420
+ };
1421
+ }, [
1422
+ identityMatches,
1423
+ repoRoots,
1424
+ diff,
1425
+ branch,
1426
+ isRepo,
1427
+ ahead,
1428
+ behind,
1429
+ refresh,
1430
+ source,
1431
+ capturedAt,
1432
+ loading,
1433
+ error
1434
+ ]);
1435
+ }
1436
+ var NO_DIFF = Object.freeze([]);
1437
+ function sameStrings(a, b) {
1438
+ return a.length === b.length && a.every((value, index) => value === b[index]);
1439
+ }
1440
+ var NO_ROOTS = Object.freeze([]);
1441
+
1442
+ // src/hooks/use-workspace-capture.ts
1443
+ import { useCallback as useCallback8, useEffect as useEffect6, useRef as useRef6, useState as useState6 } from "react";
1444
+ import { isRecord } from "@opengeni/contracts/values";
1445
+ var REVISION_CAPTURED = "workspace.revision.captured";
1446
+ var REVISION_DEGRADED = "workspace.revision.degraded";
1447
+ var MANIFEST_FETCH_TIMEOUT_MS = 15e3;
1448
+ var CAPTURE_STATS_NUMBER_FIELDS = [
1449
+ "repoCount",
1450
+ "fileCount",
1451
+ "additions",
1452
+ "deletions",
1453
+ "totalBytes",
1454
+ "tooLargeCount",
1455
+ "binaryCount",
1456
+ "treeEntryCount",
1457
+ "durationMs"
1458
+ ];
1459
+ function captureManifestForResponse(value, response) {
1460
+ if (!isRecord(value) || value.version !== 1 || !Number.isSafeInteger(value.revision) || typeof value.capturedAt !== "string" || !(value.turnId === null || typeof value.turnId === "string") || !Number.isSafeInteger(value.leaseEpoch) || !isRecord(value.treeIndex) || typeof value.treeTruncated !== "boolean" || !Array.isArray(value.repos) || !Array.isArray(value.files) || !isRecord(value.stats)) {
1461
+ throw new Error("Workspace capture manifest failed validation.");
1462
+ }
1463
+ if (value.revision !== response.revision || value.capturedAt !== response.capturedAt || value.turnId !== response.turnId || value.leaseEpoch !== response.leaseEpoch) {
1464
+ throw new Error("Workspace capture manifest identity did not match its response.");
1465
+ }
1466
+ for (const field of CAPTURE_STATS_NUMBER_FIELDS) {
1467
+ if (!Number.isSafeInteger(value.stats[field]) || value.stats[field] !== response.stats[field]) {
1468
+ throw new Error("Workspace capture manifest statistics did not match its response.");
1469
+ }
1470
+ }
1471
+ if (typeof value.stats.treeTruncated !== "boolean" || value.stats.treeTruncated !== response.stats.treeTruncated || (value.stats.fingerprint ?? null) !== (response.stats.fingerprint ?? null) || value.repos.length !== response.stats.repoCount || value.files.length !== response.stats.fileCount || value.treeTruncated !== response.stats.treeTruncated) {
1472
+ throw new Error("Workspace capture manifest statistics did not match its response.");
1473
+ }
1474
+ return value;
1475
+ }
1476
+ function useWorkspaceCapture(sessionId, options = {}) {
1477
+ const { client, workspaceId } = useOpenGeni(options);
1478
+ const enabled = (options.enabled ?? true) && Boolean(sessionId);
1479
+ const identityKey = `${workspaceId}\0${sessionId ?? ""}`;
1480
+ const [capture, setCapture] = useState6(null);
1481
+ const [available, setAvailable] = useState6(false);
1482
+ const [degradedReason, setDegradedReason] = useState6(null);
1483
+ const [fileCount, setFileCount] = useState6(null);
1484
+ const [loading, setLoading] = useState6(false);
1485
+ const [error, setError] = useState6(null);
1486
+ const [announcedRevision, setAnnouncedRevision] = useState6(null);
1487
+ const [stateIdentity, setStateIdentity] = useState6(identityKey);
1488
+ const generationRef = useRef6(0);
1489
+ const requestAbortRef = useRef6(null);
1490
+ const lastSeqRef = useRef6(0);
1491
+ const refresh = useCallback8(async () => {
1492
+ if (!sessionId) return;
1493
+ requestAbortRef.current?.abort();
1494
+ const requestAbort = new AbortController();
1495
+ requestAbortRef.current = requestAbort;
1496
+ const generation = generationRef.current += 1;
1497
+ setStateIdentity(identityKey);
1498
+ setLoading(true);
1499
+ setError(null);
1500
+ try {
1501
+ for (let attempt = 0; attempt < 2; attempt += 1) {
1502
+ const res = await client.getWorkspaceCapture(
1503
+ workspaceId,
1504
+ sessionId,
1505
+ { signal: requestAbort.signal }
1506
+ );
1507
+ if (generationRef.current !== generation) return;
1508
+ if (!res.available) {
1509
+ setCapture(null);
1510
+ setAvailable(false);
1511
+ setFileCount(0);
1512
+ setDegradedReason(res.degradedReason ?? null);
1513
+ return;
1514
+ }
1515
+ setDegradedReason(null);
1516
+ setFileCount(res.stats.fileCount);
1517
+ let manifestValue = res.manifest;
1518
+ if (!manifestValue && res.manifestUrl) {
1519
+ const response = await fetch(res.manifestUrl.url, {
1520
+ signal: AbortSignal.any([
1521
+ requestAbort.signal,
1522
+ AbortSignal.timeout(MANIFEST_FETCH_TIMEOUT_MS)
1523
+ ]),
1524
+ credentials: "omit",
1525
+ cache: "no-store",
1526
+ referrerPolicy: "no-referrer"
1527
+ }).catch(() => null);
1528
+ if (generationRef.current !== generation) return;
1529
+ if (!response?.ok) {
1530
+ if (attempt === 0 && (response === null || response.status === 401 || response.status === 403)) {
1531
+ continue;
1532
+ }
1533
+ throw new Error(
1534
+ `Workspace capture manifest download failed${response ? ` (${response.status})` : ""}.`
1535
+ );
1536
+ }
1537
+ try {
1538
+ manifestValue = await response.json();
1539
+ } catch {
1540
+ throw new Error("Workspace capture manifest was not valid JSON.");
1541
+ }
1542
+ if (generationRef.current !== generation) return;
1543
+ }
1544
+ if (!manifestValue) {
1545
+ throw new Error("Workspace capture response did not include a manifest.");
1546
+ }
1547
+ const manifest = captureManifestForResponse(manifestValue, res);
1548
+ setCapture(manifest);
1549
+ setAvailable(true);
1550
+ setAnnouncedRevision(
1551
+ (prev) => prev === null || manifest.revision > prev ? manifest.revision : prev
1552
+ );
1553
+ return;
1554
+ }
1555
+ throw new Error("Workspace capture manifest download failed after refreshing its URL.");
1556
+ } catch (cause) {
1557
+ if (generationRef.current !== generation) return;
1558
+ setError(cause instanceof Error ? cause : new Error(String(cause)));
1559
+ } finally {
1560
+ if (generationRef.current === generation) setLoading(false);
1561
+ if (requestAbortRef.current === requestAbort) requestAbortRef.current = null;
1562
+ }
1563
+ }, [client, workspaceId, sessionId, identityKey]);
1564
+ useEffect6(() => {
1565
+ requestAbortRef.current?.abort();
1566
+ requestAbortRef.current = null;
1567
+ generationRef.current += 1;
1568
+ lastSeqRef.current = 0;
1569
+ setCapture(null);
1570
+ setAvailable(false);
1571
+ setDegradedReason(null);
1572
+ setFileCount(null);
1573
+ setAnnouncedRevision(null);
1574
+ setError(null);
1575
+ if (!enabled) {
1576
+ setLoading(false);
1577
+ return;
1578
+ }
1579
+ void refresh();
1580
+ return () => {
1581
+ requestAbortRef.current?.abort();
1582
+ requestAbortRef.current = null;
1583
+ generationRef.current += 1;
1584
+ };
1585
+ }, [enabled, refresh]);
1586
+ const events = options.events;
1587
+ useEffect6(() => {
1588
+ if (!enabled || !events) return;
1589
+ let newest = null;
1590
+ for (const event of events) {
1591
+ if (event.sequence <= lastSeqRef.current) continue;
1592
+ if (event.type === REVISION_CAPTURED) {
1593
+ const payload = event.payload;
1594
+ if (payload && typeof payload === "object" && typeof payload.revision === "number") {
1595
+ newest = newest === null ? payload.revision : Math.max(newest, payload.revision);
1596
+ }
1597
+ } else if (event.type === REVISION_DEGRADED) {
1598
+ const payload = event.payload;
1599
+ if (payload && typeof payload === "object" && typeof payload.revision === "number") {
1600
+ newest = newest === null ? payload.revision : Math.max(newest, payload.revision);
1601
+ }
1602
+ }
1603
+ }
1604
+ for (const event of events)
1605
+ if (event.sequence > lastSeqRef.current) lastSeqRef.current = event.sequence;
1606
+ if (newest === null) return;
1607
+ setAnnouncedRevision((prev) => prev === null || newest > prev ? newest : prev);
1608
+ }, [enabled, events]);
1609
+ const identityMatches = enabled && stateIdentity === identityKey;
1610
+ const visibleCapture = identityMatches ? capture : null;
1611
+ const visibleAnnouncedRevision = identityMatches ? announcedRevision : null;
1612
+ const loadedRevision = visibleCapture?.revision ?? null;
1613
+ useEffect6(() => {
1614
+ if (!enabled) return;
1615
+ if (visibleAnnouncedRevision === null) return;
1616
+ if (loadedRevision !== null && visibleAnnouncedRevision <= loadedRevision) return;
1617
+ if (requestAbortRef.current) return;
1618
+ void refresh();
1619
+ }, [enabled, visibleAnnouncedRevision, loadedRevision, refresh]);
1620
+ const isStale = loadedRevision !== null && visibleAnnouncedRevision !== null && visibleAnnouncedRevision > loadedRevision;
1621
+ return {
1622
+ capture: visibleCapture,
1623
+ revision: loadedRevision,
1624
+ capturedAt: visibleCapture?.capturedAt ?? null,
1625
+ available: identityMatches && available,
1626
+ degradedReason: identityMatches ? degradedReason : null,
1627
+ fileCount: identityMatches ? fileCount : null,
1628
+ isStale,
1629
+ loading: identityMatches && loading,
1630
+ error: identityMatches ? error : null,
1631
+ refresh
1632
+ };
1633
+ }
1634
+
1635
+ // src/hooks/use-workspace-edit.ts
1636
+ import { useCallback as useCallback9, useEffect as useEffect7, useMemo as useMemo4, useRef as useRef7, useState as useState7 } from "react";
1637
+ function isLive(liveness) {
1638
+ return sandboxAcceptsLiveIo(liveness);
1639
+ }
1640
+ function useWorkspaceEdit(sessionId, options = {}) {
1641
+ const { client, workspaceId } = useOpenGeni(options);
1642
+ const path = options.path ?? null;
1643
+ const baseContent = options.baseContent ?? null;
1644
+ const routeEpoch = options.route?.epoch;
1645
+ const routeRoot = options.route?.root;
1646
+ const route = useMemo4(
1647
+ () => routeEpoch !== void 0 && routeRoot !== void 0 ? { epoch: routeEpoch, root: routeRoot } : void 0,
1648
+ [routeEpoch, routeRoot]
1649
+ );
1650
+ const live = isLive(options.liveness);
1651
+ const offline = options.offline === true;
1652
+ const identityKey = `${workspaceId}\0${sessionId ?? ""}\0${path ?? ""}\0${routeEpoch ?? ""}\0${routeRoot ?? ""}`;
1653
+ const [buffer, setBuffer] = useState7(null);
1654
+ const [wantsWarm, setWantsWarm] = useState7(false);
1655
+ const [flush, setFlush] = useState7("idle");
1656
+ const [conflict, setConflict] = useState7(null);
1657
+ const [error, setError] = useState7(null);
1658
+ const [stateIdentity, setStateIdentity] = useState7(identityKey);
1659
+ const onWarmRequested = options.onWarmRequested;
1660
+ const bufferRef = useRef7(null);
1661
+ bufferRef.current = buffer;
1662
+ const flushingRef = useRef7(false);
1663
+ const identityGenerationRef = useRef7(0);
1664
+ const flushAttemptRef = useRef7(0);
1665
+ const readAbortRef = useRef7(null);
1666
+ useEffect7(() => {
1667
+ identityGenerationRef.current += 1;
1668
+ flushAttemptRef.current += 1;
1669
+ readAbortRef.current?.abort();
1670
+ readAbortRef.current = null;
1671
+ setStateIdentity(identityKey);
1672
+ setBuffer(null);
1673
+ setWantsWarm(false);
1674
+ setFlush("idle");
1675
+ setConflict(null);
1676
+ setError(null);
1677
+ flushingRef.current = false;
1678
+ return () => {
1679
+ identityGenerationRef.current += 1;
1680
+ flushAttemptRef.current += 1;
1681
+ readAbortRef.current?.abort();
1682
+ readAbortRef.current = null;
1683
+ };
1684
+ }, [identityKey]);
1685
+ const edit = useCallback9(
1686
+ (content) => {
1687
+ if (stateIdentity !== identityKey) return;
1688
+ if (offline) return;
1689
+ setBuffer((prev) => prev === content ? prev : content);
1690
+ setFlush((prev) => prev === "flushing" ? prev : "idle");
1691
+ setConflict(null);
1692
+ if (!live) {
1693
+ setWantsWarm((prev) => {
1694
+ if (!prev) onWarmRequested?.();
1695
+ return true;
1696
+ });
1697
+ }
1698
+ },
1699
+ [offline, live, onWarmRequested, stateIdentity, identityKey]
1700
+ );
1701
+ const doFlush = useCallback9(
1702
+ async (force) => {
1703
+ if (stateIdentity !== identityKey) return;
1704
+ if (!sessionId || !path) return;
1705
+ const content = bufferRef.current;
1706
+ if (content === null) return;
1707
+ if (flushingRef.current) return;
1708
+ const identityGeneration = identityGenerationRef.current;
1709
+ const flushAttempt = flushAttemptRef.current += 1;
1710
+ flushingRef.current = true;
1711
+ setFlush("flushing");
1712
+ setError(null);
1713
+ try {
1714
+ if (!force) {
1715
+ const readAbort = new AbortController();
1716
+ readAbortRef.current?.abort();
1717
+ readAbortRef.current = readAbort;
1718
+ const liveRead = await client.fsRead(
1719
+ workspaceId,
1720
+ sessionId,
1721
+ { path, ...route ? { route } : {} },
1722
+ { signal: readAbort.signal }
1723
+ );
1724
+ if (readAbortRef.current === readAbort) readAbortRef.current = null;
1725
+ if (identityGenerationRef.current !== identityGeneration) return;
1726
+ const liveContent = liveRead.content;
1727
+ if (baseContent !== null && liveContent !== baseContent) {
1728
+ setConflict({ path, base: baseContent, live: liveContent });
1729
+ setFlush("conflict");
1730
+ return;
1731
+ }
1732
+ }
1733
+ await client.fsWrite(workspaceId, sessionId, {
1734
+ path,
1735
+ content,
1736
+ overwrite: true,
1737
+ ...route ? { route } : {}
1738
+ });
1739
+ if (identityGenerationRef.current !== identityGeneration) return;
1740
+ setConflict(null);
1741
+ setFlush("flushed");
1742
+ setWantsWarm(false);
1743
+ } catch (cause) {
1744
+ if (identityGenerationRef.current !== identityGeneration) return;
1745
+ setError(cause instanceof Error ? cause : new Error(String(cause)));
1746
+ setFlush("idle");
1747
+ } finally {
1748
+ if (flushAttemptRef.current === flushAttempt) {
1749
+ flushingRef.current = false;
1750
+ readAbortRef.current = null;
1751
+ }
1752
+ }
1753
+ },
1754
+ [client, workspaceId, sessionId, path, baseContent, route, stateIdentity, identityKey]
1755
+ );
1756
+ useEffect7(() => {
1757
+ if (offline) return;
1758
+ if (!live) return;
1759
+ if (buffer === null) return;
1760
+ if (flush === "flushed" || flush === "conflict" || flush === "flushing") return;
1761
+ void doFlush(false);
1762
+ }, [offline, live, buffer, flush, doFlush]);
1763
+ const overwrite = useCallback9(async () => {
1764
+ await doFlush(true);
1765
+ }, [doFlush]);
1766
+ const discard = useCallback9(() => {
1767
+ setBuffer(null);
1768
+ setWantsWarm(false);
1769
+ setFlush("idle");
1770
+ setConflict(null);
1771
+ setError(null);
1772
+ }, []);
1773
+ let state;
1774
+ if (offline) {
1775
+ state = "readonly-offline";
1776
+ } else if (flush === "flushing") {
1777
+ state = "flushing";
1778
+ } else if (flush === "flushed") {
1779
+ state = "flushed";
1780
+ } else if (flush === "conflict") {
1781
+ state = "conflict";
1782
+ } else if (buffer === null) {
1783
+ state = "viewing-cold";
1784
+ } else if (live) {
1785
+ state = "flushing";
1786
+ } else if (options.warming === true) {
1787
+ state = "warming";
1788
+ } else {
1789
+ state = "buffering";
1790
+ }
1791
+ const identityMatches = stateIdentity === identityKey;
1792
+ return {
1793
+ state: identityMatches ? state : offline ? "readonly-offline" : "viewing-cold",
1794
+ readOnly: offline,
1795
+ buffer: identityMatches ? buffer : null,
1796
+ wantsWarm: identityMatches && wantsWarm,
1797
+ edit,
1798
+ conflict: identityMatches ? conflict : null,
1799
+ overwrite,
1800
+ discard,
1801
+ error: identityMatches ? error : null
1802
+ };
1803
+ }
1804
+
1805
+ // src/index.ts
1806
+ import {
1807
+ humanizeModelSlug,
1808
+ isRawModelLabel,
1809
+ modelDisplayName as modelDisplayName2,
1810
+ modelSlug,
1811
+ modelVendor
1812
+ } from "@opengeni/sdk/model-display";
1813
+ import { parseOpenGeniLink } from "@opengeni/sdk";
1814
+
1815
+ // src/components/fleet-tile.tsx
1816
+ import { deriveSessionDisplayTitle } from "@opengeni/sdk";
1817
+ import { modelDisplayName } from "@opengeni/sdk/model-display";
1818
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
1819
+ var SESSION_METADATA_TITLE_KEYS = ["title", "name"];
1820
+ function sessionDisplayTitle(session) {
1821
+ return deriveSessionDisplayTitle(session, { metadataKeys: SESSION_METADATA_TITLE_KEYS });
1822
+ }
1823
+ function FleetTile({ session, title, subtitle, onOpen, className }) {
1824
+ const msg = useOpenGeniText();
1825
+ const running = session.status === "running" || session.status === "queued";
1826
+ const needsYou = session.status === "requires_action" && !sessionAdmissionBlocked(session);
1827
+ return /* @__PURE__ */ jsxs2(
1828
+ "button",
1829
+ {
1830
+ type: "button",
1831
+ "data-status": session.status,
1832
+ onClick: onOpen ? () => onOpen(session) : void 0,
1833
+ disabled: !onOpen,
1834
+ className: cn(
1835
+ "og-root group relative flex w-full flex-col gap-2.5 overflow-hidden rounded-og-lg border border-og-border",
1836
+ "bg-og-surface-1 p-4 text-left shadow-og-sm",
1837
+ "transition-[border-color,background-color,box-shadow,transform] duration-200 ease-og-out",
1838
+ onOpen && "hover:-translate-y-px hover:border-og-border-strong hover:bg-og-surface-2 hover:shadow-og-md",
1839
+ "disabled:cursor-default",
1840
+ className
1841
+ ),
1842
+ children: [
1843
+ /* @__PURE__ */ jsx2(
1844
+ "span",
1845
+ {
1846
+ "aria-hidden": true,
1847
+ className: cn(
1848
+ "absolute inset-y-0 left-0 w-0.5 transition-opacity duration-300",
1849
+ running ? "bg-og-accent opacity-100" : needsYou ? "bg-og-status-waiting opacity-100" : "opacity-0"
1850
+ )
1851
+ }
1852
+ ),
1853
+ /* @__PURE__ */ jsxs2("span", { className: "flex w-full items-start justify-between gap-3", children: [
1854
+ /* @__PURE__ */ jsx2("span", { className: "line-clamp-2 min-w-0 text-og-base font-medium leading-snug text-og-fg", children: title ?? sessionDisplayTitle(session) }),
1855
+ /* @__PURE__ */ jsx2(SessionStatus, { status: sessionDisplayStatus(session), size: "sm", className: "mt-px" })
1856
+ ] }),
1857
+ subtitle ? /* @__PURE__ */ jsx2("span", { className: "line-clamp-1 text-og-sm text-og-fg-muted", children: subtitle }) : null,
1858
+ /* @__PURE__ */ jsxs2("span", { className: "mt-auto flex w-full items-center gap-2 text-og-xs text-og-fg-subtle", children: [
1859
+ /* @__PURE__ */ jsx2("span", { className: "font-og-mono", children: session.id.slice(0, 8) }),
1860
+ /* @__PURE__ */ jsx2("span", { "aria-hidden": true, children: "\xB7" }),
1861
+ /* @__PURE__ */ jsx2("span", { className: "truncate", children: modelDisplayName(session.model) }),
1862
+ /* @__PURE__ */ jsx2("span", { className: "ml-auto shrink-0", title: session.updatedAt, children: formatRelativeTime(msg, session.updatedAt) })
1863
+ ] })
1864
+ ]
1865
+ }
1866
+ );
1867
+ }
1868
+
1869
+ // src/components/diff-view.tsx
1870
+ import { jsx as jsx3 } from "react/jsx-runtime";
1871
+ function DiffView({
1872
+ diff,
1873
+ fallback,
1874
+ layout = "unified",
1875
+ themeType,
1876
+ isRepo = true,
1877
+ emptyState,
1878
+ className
1879
+ }) {
1880
+ const t = useOpenGeniText();
1881
+ if (diff.length === 0) {
1882
+ return /* @__PURE__ */ jsx3("div", { className: cn("p-3 text-og-sm text-og-fg-subtle", className), children: emptyState ?? (isRepo ? t("diffView.noChanges") : t("diffView.noRepositoryMounted")) });
1883
+ }
1884
+ return /* @__PURE__ */ jsx3(
1885
+ PierreDiff,
1886
+ {
1887
+ diff,
1888
+ layout,
1889
+ themeType,
1890
+ ...fallback !== void 0 ? { fallback } : {},
1891
+ className
1892
+ }
1893
+ );
1894
+ }
1895
+
1896
+ // src/components/sandbox-workspace.tsx
1897
+ import {
1898
+ lazy,
1899
+ memo,
1900
+ Suspense,
1901
+ useCallback as useCallback10,
1902
+ useEffect as useEffect8,
1903
+ useMemo as useMemo5,
1904
+ useRef as useRef8,
1905
+ useState as useState8
1906
+ } from "react";
1907
+ import {
1908
+ CircleCheckIcon,
1909
+ CpuIcon,
1910
+ FileCode2Icon,
1911
+ GitCompareArrowsIcon,
1912
+ Globe2Icon,
1913
+ LoaderCircleIcon,
1914
+ MonitorIcon,
1915
+ RefreshCwIcon,
1916
+ SquareTerminalIcon,
1917
+ TriangleAlertIcon
1918
+ } from "lucide-react";
1919
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1920
+ var LazySandboxFiles = lazy(
1921
+ () => import("./sandbox-files-6L2GRNOG.js").then(({ SandboxFiles: SandboxFiles2 }) => ({ default: SandboxFiles2 })).catch(() => ({ default: FilesLoadFailed }))
1922
+ );
1923
+ function FilesLoadFailed() {
1924
+ const t = useOpenGeniText();
1925
+ return /* @__PURE__ */ jsxs3(CenteredState, { tone: "danger", icon: /* @__PURE__ */ jsx4(TriangleAlertIcon, { className: "size-5", "aria-hidden": true }), children: [
1926
+ /* @__PURE__ */ jsx4("p", { className: "text-og-sm font-medium text-og-fg", children: t("sandboxWorkspace.filesCouldNotBeLoaded") }),
1927
+ /* @__PURE__ */ jsxs3(DockActionButton, { onClick: () => window.location.reload(), children: [
1928
+ /* @__PURE__ */ jsx4(RefreshCwIcon, { className: "size-3", "aria-hidden": true }),
1929
+ t("sandboxWorkspace.reload")
1930
+ ] })
1931
+ ] });
1932
+ }
1933
+ function FilesTabBody(props) {
1934
+ return /* @__PURE__ */ jsx4(Suspense, { fallback: /* @__PURE__ */ jsx4(WorkbenchSurfaceLoading, { name: "Files" }), children: /* @__PURE__ */ jsx4(LazySandboxFiles, { ...props }) });
1935
+ }
1936
+ var LazyBrowserViewer = lazy(async () => {
1937
+ const { BrowserViewer } = await import("./browser-viewer-5JGSKIXX.js");
1938
+ return { default: BrowserViewer };
1939
+ });
1940
+ var LazyComputerViewer = lazy(async () => {
1941
+ const { ComputerViewer } = await import("./computer-viewer-FHCBTSZH.js");
1942
+ return { default: ComputerViewer };
1943
+ });
1944
+ var WORKBENCH_TAB_CHANGES = "changes";
1945
+ var WORKBENCH_TAB_FILES = "files";
1946
+ var WORKBENCH_TAB_TERMINAL = "terminal";
1947
+ var WORKBENCH_TAB_BROWSER = "browser";
1948
+ var WORKBENCH_TAB_DESKTOP = "desktop";
1949
+ var WORKBENCH_SURFACES = [
1950
+ WORKBENCH_TAB_CHANGES,
1951
+ WORKBENCH_TAB_FILES,
1952
+ WORKBENCH_TAB_TERMINAL,
1953
+ WORKBENCH_TAB_BROWSER,
1954
+ WORKBENCH_TAB_DESKTOP
1955
+ ];
1956
+ function isWorkbenchSurface(value) {
1957
+ return WORKBENCH_SURFACES.includes(value);
1958
+ }
1959
+ function isCanonicalAbsoluteSandboxPath(value) {
1960
+ if (!value) return false;
1961
+ const portable = value.replaceAll("\\", "/");
1962
+ return portable.startsWith("/") || /^[A-Za-z]:\//u.test(portable);
1963
+ }
1964
+ function sourceDrivenDefaultTab(hasChanges, changesEnabled, filesEnabled) {
1965
+ if (hasChanges && changesEnabled) return WORKBENCH_TAB_CHANGES;
1966
+ if (filesEnabled) return WORKBENCH_TAB_FILES;
1967
+ if (changesEnabled) return WORKBENCH_TAB_CHANGES;
1968
+ return null;
1969
+ }
1970
+ function WorkbenchSurfaceLoading({ name }) {
1971
+ const t = useOpenGeniText();
1972
+ return /* @__PURE__ */ jsx4(
1973
+ CenteredState,
1974
+ {
1975
+ icon: /* @__PURE__ */ jsx4(LoaderCircleIcon, { className: "size-5 animate-spin motion-reduce:animate-none", "aria-hidden": true }),
1976
+ children: /* @__PURE__ */ jsx4("p", { className: "text-og-sm font-medium text-og-fg", children: t("sandboxWorkspace.openingName", { name }) })
1977
+ }
1978
+ );
1979
+ }
1980
+ function initialWorkspaceTab(events, override) {
1981
+ if (override) return override;
1982
+ let bestSeq = -1;
1983
+ let bestFileCount = 0;
1984
+ for (const event of events ?? []) {
1985
+ if (event.type !== "workspace.revision.captured") continue;
1986
+ if (event.sequence <= bestSeq) continue;
1987
+ const stats = event.payload?.stats;
1988
+ bestSeq = event.sequence;
1989
+ bestFileCount = typeof stats?.fileCount === "number" ? stats.fileCount : 0;
1990
+ }
1991
+ if (bestFileCount > 0) return WORKBENCH_TAB_CHANGES;
1992
+ let latestGitSeq = -1;
1993
+ let committedOnly = false;
1994
+ for (const event of events ?? []) {
1995
+ if (event.type !== "git.changed" || event.sequence > bestSeq) continue;
1996
+ if (event.sequence <= latestGitSeq) continue;
1997
+ const payload = event.payload;
1998
+ latestGitSeq = event.sequence;
1999
+ committedOnly = typeof payload?.ahead === "number" && payload.ahead > 0 || payload?.reason === "commit";
2000
+ }
2001
+ return committedOnly ? WORKBENCH_TAB_CHANGES : WORKBENCH_TAB_FILES;
2002
+ }
2003
+ function sandboxProvisionInFlight(events) {
2004
+ let inFlight = false;
2005
+ for (const event of events) {
2006
+ if (event.type !== "sandbox.operation.started" && event.type !== "sandbox.operation.completed" && event.type !== "sandbox.operation.failed") {
2007
+ continue;
2008
+ }
2009
+ const payload = event.payload;
2010
+ const name = payload && typeof payload === "object" && !Array.isArray(payload) ? payload.name : null;
2011
+ if (name !== "sandbox.provision") continue;
2012
+ if (event.type === "sandbox.operation.started") {
2013
+ inFlight = true;
2014
+ } else {
2015
+ inFlight = false;
2016
+ }
2017
+ }
2018
+ return inFlight;
2019
+ }
2020
+ function workspaceTurnInFlight(events) {
2021
+ const activeTurnIds = /* @__PURE__ */ new Set();
2022
+ let anonymousTurnInFlight = false;
2023
+ let sessionOwnsWorkspace = false;
2024
+ for (const event of events) {
2025
+ if (event.type === "session.status.changed") {
2026
+ const status = event.payload && typeof event.payload === "object" && !Array.isArray(event.payload) ? event.payload.status : null;
2027
+ sessionOwnsWorkspace = status === "running" || status === "recovering";
2028
+ continue;
2029
+ }
2030
+ if (event.type === "turn.started") {
2031
+ if (event.turnId) activeTurnIds.add(event.turnId);
2032
+ else anonymousTurnInFlight = true;
2033
+ continue;
2034
+ }
2035
+ if (event.type !== "turn.completed" && event.type !== "turn.failed" && event.type !== "turn.cancelled" && event.type !== "turn.superseded") {
2036
+ continue;
2037
+ }
2038
+ if (event.turnId) activeTurnIds.delete(event.turnId);
2039
+ else anonymousTurnInFlight = false;
2040
+ }
2041
+ return sessionOwnsWorkspace || anonymousTurnInFlight || activeTurnIds.size > 0;
2042
+ }
2043
+ function emptyWarmIntents(sessionId) {
2044
+ return {
2045
+ sessionId,
2046
+ warmTerminal: false,
2047
+ warmFiles: false
2048
+ };
2049
+ }
2050
+ function useSandboxWorkspaceTabs(options) {
2051
+ const t = useOpenGeniText();
2052
+ const { client, workspaceId, workspaceInteractionEvent } = useOpenGeni(options);
2053
+ const {
2054
+ sessionId,
2055
+ events,
2056
+ onNotify,
2057
+ browserWebSocketFactory,
2058
+ computerWebSocketFactory,
2059
+ browserExtensionSetupUrl,
2060
+ requestedFilePath,
2061
+ requestedFileRequestId,
2062
+ requestedFileLine,
2063
+ onOpenFile,
2064
+ pullRequest,
2065
+ onOpenPullRequest,
2066
+ initialFilePath,
2067
+ onFilePathChange,
2068
+ isFileNodeVisible,
2069
+ hideToolFolders,
2070
+ initialBrowserSessionId,
2071
+ onBrowserSessionIdChange,
2072
+ initialComputerSessionId,
2073
+ onComputerSessionIdChange,
2074
+ onOpenComputerSession,
2075
+ requestedComputerSessionId,
2076
+ requestedComputerRequestId
2077
+ } = options;
2078
+ const initialTab = options.initialTab ?? null;
2079
+ const relevantOnly = options.tabVisibility === "relevant";
2080
+ const activeTab = options.activeTab ?? initialTab;
2081
+ const workspaceVisible = options.workspaceVisible ?? true;
2082
+ const machinesEnabled = options.machinesEnabled ?? true;
2083
+ const requestedSurfaces = options.surfaces ?? WORKBENCH_SURFACES;
2084
+ const surfaceSet = new Set(requestedSurfaces);
2085
+ const changesEnabled = surfaceSet.has(WORKBENCH_TAB_CHANGES);
2086
+ const filesEnabled = surfaceSet.has(WORKBENCH_TAB_FILES);
2087
+ const terminalEnabled = surfaceSet.has(WORKBENCH_TAB_TERMINAL);
2088
+ const browserEnabled = surfaceSet.has(WORKBENCH_TAB_BROWSER);
2089
+ const desktopEnabled = surfaceSet.has(WORKBENCH_TAB_DESKTOP);
2090
+ const createLinkedComputer = useCallback10(
2091
+ async (name, placement) => {
2092
+ const response = await client.createComputerSession(workspaceId, {
2093
+ operationId: crypto.randomUUID(),
2094
+ sessionId,
2095
+ name,
2096
+ ...placement ? { placement } : {}
2097
+ });
2098
+ if (response.operation.state !== "completed" || response.session.lifecycle !== "active") {
2099
+ throw new Error(
2100
+ response.operation.error?.message ?? t("sandboxWorkspace.theDesktopCouldNotBe")
2101
+ );
2102
+ }
2103
+ return {
2104
+ id: response.session.id,
2105
+ placement: response.session.placement
2106
+ };
2107
+ },
2108
+ [client, sessionId, workspaceId, t]
2109
+ );
2110
+ const workspaceDataEnabled = changesEnabled || filesEnabled;
2111
+ const machineSurfaceEnabled = workspaceDataEnabled || terminalEnabled || desktopEnabled;
2112
+ const resolvedActiveTab = activeTab ?? initialTab;
2113
+ const changesActive = resolvedActiveTab === WORKBENCH_TAB_CHANGES;
2114
+ const filesActive = resolvedActiveTab === WORKBENCH_TAB_FILES;
2115
+ const browserActive = resolvedActiveTab === WORKBENCH_TAB_BROWSER;
2116
+ const turnInFlight = workspaceTurnInFlight(events);
2117
+ const surfaceIdentity = WORKBENCH_SURFACES.filter((surface) => surfaceSet.has(surface)).join(",");
2118
+ const [storedWarmIntents, setStoredWarmIntents] = useState8(
2119
+ () => emptyWarmIntents(sessionId)
2120
+ );
2121
+ const warmIntents = storedWarmIntents.sessionId === sessionId ? storedWarmIntents : emptyWarmIntents(sessionId);
2122
+ const { warmTerminal, warmFiles } = warmIntents;
2123
+ const filesWarmRequested = warmFiles || Boolean(requestedFilePath);
2124
+ const requestWarmIntent = useCallback10(
2125
+ (intent) => {
2126
+ setStoredWarmIntents((previous) => {
2127
+ const current = previous.sessionId === sessionId ? previous : emptyWarmIntents(sessionId);
2128
+ return current[intent] ? current : { ...current, [intent]: true };
2129
+ });
2130
+ },
2131
+ [sessionId]
2132
+ );
2133
+ const machines = useMachines({
2134
+ workspaceId,
2135
+ sessionId,
2136
+ pollIntervalMs: MACHINES_SESSION_POLL_MS,
2137
+ enabled: machineSurfaceEnabled && machinesEnabled
2138
+ });
2139
+ const activeMachine = machines.machines.find((m) => m.sandboxId === machines.activeSandboxId) ?? machines.machines.find((m) => m.active) ?? null;
2140
+ const caps = useSessionCapabilities(sessionId, {
2141
+ events,
2142
+ enabled: machineSurfaceEnabled,
2143
+ attachDesktop: false,
2144
+ attachTerminal: terminalEnabled && warmTerminal,
2145
+ // Explicit live-file intent only — NOT "the Files tab is open". A cold edit
2146
+ // or guarded-file open wakes the box; a glance at the tree/diff does not.
2147
+ attachFiles: workspaceDataEnabled && filesWarmRequested
2148
+ });
2149
+ const capabilities = caps.capabilities;
2150
+ const liveness = capabilities?.liveness;
2151
+ const liveIoLiveness = liveness ?? null;
2152
+ const fileSystemOn = capabilities?.FileSystem.available ?? false;
2153
+ const fileSystemRoute = capabilities ? { epoch: capabilities.leaseEpoch, root: capabilities.FileSystem.root } : void 0;
2154
+ const fsReadOnly = capabilities?.FileSystem.readOnly ?? false;
2155
+ const filesEditable = fileSystemOn && !fsReadOnly && sandboxAcceptsLiveIo(liveness);
2156
+ const gitOn = capabilities?.Git.available ?? false;
2157
+ const terminalOn = terminalEnabled && (capabilities?.Terminal.transport ?? null) !== null;
2158
+ const ptyCapable = warmTerminal && (capabilities?.Terminal.ptyCapable ?? false) && capabilities?.Terminal.transport === "sse-events" && capabilities?.Terminal.reason === null;
2159
+ const terminalShown = terminalOn && workspaceVisible && resolvedActiveTab === WORKBENCH_TAB_TERMINAL;
2160
+ const [terminalOpenedSession, setTerminalOpenedSession] = useState8(null);
2161
+ useEffect8(() => {
2162
+ if (terminalShown) setTerminalOpenedSession(sessionId);
2163
+ }, [terminalShown, sessionId]);
2164
+ const terminal = useSandboxTerminal(sessionId, {
2165
+ events: terminalEnabled ? events : [],
2166
+ interactive: terminalEnabled && ptyCapable,
2167
+ liveness,
2168
+ history: terminalShown || terminalOpenedSession === sessionId
2169
+ });
2170
+ const provisioning = sandboxProvisionInFlight(events);
2171
+ const renegotiate = caps.renegotiate;
2172
+ const provisioningRef = useRef8({ sessionId, provisioning });
2173
+ useEffect8(() => {
2174
+ const previous = provisioningRef.current;
2175
+ if (previous.sessionId === sessionId && previous.provisioning && !provisioning) {
2176
+ renegotiate();
2177
+ }
2178
+ provisioningRef.current = { sessionId, provisioning };
2179
+ }, [sessionId, provisioning, renegotiate]);
2180
+ useEffect8(() => {
2181
+ if (workspaceInteractionEvent?.workspaceId !== workspaceId) return;
2182
+ renegotiate();
2183
+ }, [workspaceId, workspaceInteractionEvent, renegotiate]);
2184
+ const captureState = useWorkspaceCapture(sessionId, {
2185
+ events,
2186
+ enabled: workspaceDataEnabled
2187
+ });
2188
+ const captureAvailable = captureState.available;
2189
+ const liveWorkspaceExpected = sandboxAcceptsLiveIo(liveness);
2190
+ const capturePending = !liveWorkspaceExpected && (captureState.fileCount === null || captureState.loading);
2191
+ const repoPaths = useMemo5(() => {
2192
+ const advertised = capabilities?.Git.repos ?? [];
2193
+ if (advertised.length > 0) return advertised;
2194
+ return captureState.capture?.repos.map((repo) => repo.root) ?? [];
2195
+ }, [capabilities?.Git.repos, captureState.capture]);
2196
+ const files = useSandboxFiles(sessionId, {
2197
+ events,
2198
+ // No passive Channel-A reads while cold, even after a conclusive capture
2199
+ // miss. A missing capture gets an explicit "Open live workspace" gate.
2200
+ enabled: filesEnabled && (captureAvailable || fileSystemOn && liveWorkspaceExpected),
2201
+ // A cold sandbox can become warm while the first agent command still owns
2202
+ // startup. Do not race that command with an automatic Files read. Keeping
2203
+ // this fence at turn scope also avoids unsafe millisecond gaps between
2204
+ // sequential tool calls; rendered state and explicit user actions remain.
2205
+ active: filesActive && !turnInFlight,
2206
+ // A deliberate canonical absolute-path open browses in the selected target's
2207
+ // advertised namespace, so the authoritative tree and link share exact paths.
2208
+ ...isCanonicalAbsoluteSandboxPath(requestedFilePath) && capabilities?.FileSystem.root ? { rootPath: capabilities.FileSystem.root } : {},
2209
+ ...fileSystemRoute ? { route: fileSystemRoute } : {},
2210
+ repoPaths,
2211
+ liveness: liveIoLiveness,
2212
+ capture: captureState.capture,
2213
+ // A reverted optimistic mutation (e.g. a 409 rename collision) surfaces as a
2214
+ // host notification — the tree silently rolls back, the user sees why.
2215
+ onMutationError: (error, op) => onNotify?.({
2216
+ kind: "error",
2217
+ message: t("sandboxWorkspace.couldNotOpMessage", { op, message: error.message })
2218
+ })
2219
+ });
2220
+ const [storedChangesComparison, setStoredChangesComparison] = useState8(null);
2221
+ const captureSupportsBranch = captureState.capture !== null && captureState.capture.repos.length > 0 && captureState.capture.repos.every((repo) => repo.branchDiff !== void 0);
2222
+ const changesComparison = storedChangesComparison?.sessionId === sessionId ? storedChangesComparison.value : liveWorkspaceExpected || captureSupportsBranch ? "branch" : "working";
2223
+ const setChangesComparison = useCallback10(
2224
+ (value) => setStoredChangesComparison({ sessionId, value, picked: true }),
2225
+ [sessionId]
2226
+ );
2227
+ const git = useSandboxGit(sessionId, {
2228
+ events,
2229
+ enabled: changesComparison === "working" ? workspaceDataEnabled && (captureAvailable || gitOn && liveWorkspaceExpected) : changesComparison === "branch" ? workspaceDataEnabled && (captureSupportsBranch || gitOn && liveWorkspaceExpected) : workspaceDataEnabled && gitOn && liveWorkspaceExpected,
2230
+ // Live Git belongs to the visible Changes surface. In particular, do not
2231
+ // turn an unresolved/default tab into a hidden provider read: that races the
2232
+ // agent's own sandbox commands and used to refresh after every tool output
2233
+ // even while Files was visibly selected.
2234
+ active: changesActive && !turnInFlight,
2235
+ repoPaths,
2236
+ liveness: liveIoLiveness,
2237
+ comparison: changesComparison,
2238
+ capture: changesComparison === "staged" ? null : captureState.capture
2239
+ });
2240
+ useEffect8(() => {
2241
+ if (changesComparison === "branch" && git.error && storedChangesComparison?.sessionId !== sessionId) {
2242
+ setStoredChangesComparison({ sessionId, value: "working", picked: false });
2243
+ }
2244
+ }, [changesComparison, git.error, sessionId, storedChangesComparison?.sessionId]);
2245
+ const [xtermTheme, setXtermTheme] = useState8(void 0);
2246
+ useEffect8(() => {
2247
+ if (!terminalEnabled || typeof document === "undefined") return;
2248
+ const derive = () => setXtermTheme(xtermThemeFromTokens());
2249
+ derive();
2250
+ const observer = new MutationObserver(derive);
2251
+ observer.observe(document.documentElement, {
2252
+ attributes: true,
2253
+ attributeFilter: ["data-og-theme", "class"]
2254
+ });
2255
+ return () => observer.disconnect();
2256
+ }, [terminalEnabled]);
2257
+ const dirtyCount = git.diff.length;
2258
+ const eventsShowChanges = useMemo5(
2259
+ () => relevantOnly && initialWorkspaceTab(events) === WORKBENCH_TAB_CHANGES,
2260
+ [events, relevantOnly]
2261
+ );
2262
+ const chip = useMachineChip({
2263
+ liveness,
2264
+ capabilitiesState: caps.state,
2265
+ activeMachineState: activeMachine?.state ?? null,
2266
+ activeIsSelfhosted: activeMachine?.kind === "selfhosted",
2267
+ wantsWarm: terminalEnabled && warmTerminal || workspaceDataEnabled && filesWarmRequested,
2268
+ capturedAt: captureState.capturedAt
2269
+ });
2270
+ const workspaceWaking = chip.state === "waking";
2271
+ const defaultIdentity = `${sessionId}\0${surfaceIdentity}`;
2272
+ const defaultTabRef = useRef8({
2273
+ identity: defaultIdentity,
2274
+ value: null
2275
+ });
2276
+ if (defaultTabRef.current.identity !== defaultIdentity) {
2277
+ defaultTabRef.current = { identity: defaultIdentity, value: null };
2278
+ }
2279
+ const captureHasChanges = (captureState.fileCount ?? 0) > 0 || (captureState.capture?.repos.some((repo) => (repo.branchDiff?.length ?? 0) > 0) ?? false);
2280
+ const captureUnavailable = !captureState.loading && (captureState.fileCount === 0 && !captureHasChanges || captureState.error !== null);
2281
+ if (defaultTabRef.current.value === null) {
2282
+ if (initialTab && (!isWorkbenchSurface(initialTab) || surfaceSet.has(initialTab))) {
2283
+ defaultTabRef.current.value = initialTab;
2284
+ } else if (captureState.fileCount !== null && captureState.available) {
2285
+ defaultTabRef.current.value = sourceDrivenDefaultTab(
2286
+ captureHasChanges,
2287
+ changesEnabled,
2288
+ filesEnabled
2289
+ );
2290
+ } else if (captureUnavailable && initialWorkspaceTab(events) === WORKBENCH_TAB_CHANGES) {
2291
+ defaultTabRef.current.value = sourceDrivenDefaultTab(true, changesEnabled, filesEnabled);
2292
+ } else if (!captureState.loading && (captureState.fileCount !== null || captureState.error !== null)) {
2293
+ defaultTabRef.current.value = sourceDrivenDefaultTab(false, changesEnabled, filesEnabled);
2294
+ }
2295
+ }
2296
+ const defaultTab = defaultTabRef.current.value;
2297
+ const pullRequestUrl = pullRequest?.url;
2298
+ const pullRequestNumber = pullRequest?.number;
2299
+ const stablePullRequest = useMemo5(
2300
+ () => pullRequestUrl ? {
2301
+ url: pullRequestUrl,
2302
+ ...pullRequestNumber !== void 0 ? { number: pullRequestNumber } : {}
2303
+ } : null,
2304
+ [pullRequestUrl, pullRequestNumber]
2305
+ );
2306
+ const wakeFiles = useCallback10(() => requestWarmIntent("warmFiles"), [requestWarmIntent]);
2307
+ const openGuardedFile = useCallback10(
2308
+ (path) => {
2309
+ requestWarmIntent("warmFiles");
2310
+ onOpenFile?.(path);
2311
+ },
2312
+ [requestWarmIntent, onOpenFile]
2313
+ );
2314
+ const tabs = useMemo5(() => {
2315
+ const list = [];
2316
+ if (changesEnabled)
2317
+ list.push({
2318
+ id: WORKBENCH_TAB_CHANGES,
2319
+ label: t("sandboxWorkspace.changes"),
2320
+ icon: /* @__PURE__ */ jsx4(GitCompareArrowsIcon, {}),
2321
+ badge: dirtyCount > 0 && !relevantOnly ? /* @__PURE__ */ jsx4(DirtyBadge, { count: dirtyCount }) : void 0,
2322
+ // A comparison the person picked keeps Changes on the strip, even
2323
+ // when that comparison happens to be empty.
2324
+ ...relevantOnly && dirtyCount === 0 && !captureHasChanges && !eventsShowChanges && !(storedChangesComparison?.sessionId === sessionId && storedChangesComparison.picked) ? { optional: true, inMenu: true } : {},
2325
+ content: /* @__PURE__ */ jsx4(
2326
+ ChangesTabBody,
2327
+ {
2328
+ git,
2329
+ comparison: changesComparison,
2330
+ onComparisonChange: setChangesComparison,
2331
+ captureAvailable,
2332
+ captureDegraded: captureState.degradedReason !== null,
2333
+ captureRevision: captureState.revision,
2334
+ capturePending,
2335
+ liveWorkspaceExpected,
2336
+ workspaceWaking,
2337
+ capabilitiesState: caps.state,
2338
+ capabilitiesError: caps.error,
2339
+ onRetry: caps.renegotiate,
2340
+ onWake: wakeFiles,
2341
+ ...filesEnabled && onOpenFile ? { onOpenFile: openGuardedFile } : {},
2342
+ pullRequest: stablePullRequest,
2343
+ ...onOpenPullRequest ? { onOpenPullRequest } : {},
2344
+ navigation: relevantOnly ? "tree" : "rail"
2345
+ }
2346
+ )
2347
+ });
2348
+ if (filesEnabled)
2349
+ list.push({
2350
+ id: WORKBENCH_TAB_FILES,
2351
+ label: t("sandboxWorkspace.files"),
2352
+ icon: /* @__PURE__ */ jsx4(FileCode2Icon, {}),
2353
+ ...relevantOnly ? { optional: true } : {},
2354
+ content: /* @__PURE__ */ jsx4(
2355
+ FilesTabBody,
2356
+ {
2357
+ files,
2358
+ git,
2359
+ isNodeVisible: isFileNodeVisible,
2360
+ hideToolFolders,
2361
+ fileSystemAvailable: fileSystemOn || captureAvailable,
2362
+ editable: filesEditable && files.source === "live" && files.error === null && !files.loading,
2363
+ workspaceResting: !liveWorkspaceExpected && liveness !== void 0 && !capturePending && !captureAvailable && !workspaceWaking,
2364
+ workspaceWaking: !liveWorkspaceExpected && !captureAvailable && workspaceWaking,
2365
+ liveWorkspaceReady: liveWorkspaceExpected,
2366
+ workspaceError: caps.error ?? (caps.viewerCapReached ? new Error(
2367
+ caps.viewerCapReason === "computers" ? t("sandboxWorkspace.tooManyComputersRunningWithoutTask") : t("sandboxWorkspace.theLiveWorkspaceViewerLimit")
2368
+ ) : filesWarmRequested && caps.state === "on-demand" && !fileSystemOn ? new Error(t("sandboxWorkspace.thisMachineDoesNotCurrently")) : null),
2369
+ onWakeWorkspace: () => {
2370
+ if (filesWarmRequested) caps.renegotiate();
2371
+ else requestWarmIntent("warmFiles");
2372
+ },
2373
+ ...requestedFilePath ? {
2374
+ requestedPath: requestedFilePath,
2375
+ ...requestedFileRequestId !== null && requestedFileRequestId !== void 0 ? { requestedPathRequestId: requestedFileRequestId } : {},
2376
+ requestedPathReady: sandboxAcceptsLiveIo(liveness),
2377
+ ...requestedFileLine != null && requestedFileLine > 0 ? { requestedLine: requestedFileLine } : {}
2378
+ } : {},
2379
+ onEditIntent: () => requestWarmIntent("warmFiles"),
2380
+ initialSelectedPath: initialFilePath,
2381
+ onSelectedPathChange: onFilePathChange,
2382
+ className: "h-full"
2383
+ },
2384
+ sessionId
2385
+ )
2386
+ });
2387
+ if (terminalOn) {
2388
+ list.push({
2389
+ id: WORKBENCH_TAB_TERMINAL,
2390
+ label: t("sandboxWorkspace.terminal"),
2391
+ icon: /* @__PURE__ */ jsx4(SquareTerminalIcon, {}),
2392
+ ...relevantOnly ? { optional: true } : {},
2393
+ content: /* @__PURE__ */ jsx4("div", { className: "h-full bg-og-bg p-1", children: /* @__PURE__ */ jsx4(
2394
+ SandboxTerminal,
2395
+ {
2396
+ result: terminal,
2397
+ terminalCapability: capabilities?.Terminal ?? null,
2398
+ onActivate: () => requestWarmIntent("warmTerminal"),
2399
+ onReconnectNeeded: caps.renegotiate,
2400
+ showHeader: true,
2401
+ shell: capabilities?.Terminal.shell ?? void 0,
2402
+ liveness,
2403
+ ...xtermTheme ? { theme: xtermTheme } : {}
2404
+ },
2405
+ sessionId
2406
+ ) })
2407
+ });
2408
+ }
2409
+ if (browserEnabled) {
2410
+ list.push({
2411
+ id: WORKBENCH_TAB_BROWSER,
2412
+ label: t("sandboxWorkspace.browser"),
2413
+ icon: /* @__PURE__ */ jsx4(Globe2Icon, {}),
2414
+ ...relevantOnly ? { optional: true } : {},
2415
+ content: /* @__PURE__ */ jsx4(Suspense, { fallback: /* @__PURE__ */ jsx4(WorkbenchSurfaceLoading, { name: "Browser" }), children: /* @__PURE__ */ jsx4(
2416
+ LazyBrowserViewer,
2417
+ {
2418
+ client,
2419
+ workspaceId,
2420
+ sessionId,
2421
+ enabled: workspaceVisible,
2422
+ active: browserActive,
2423
+ onNotify,
2424
+ initialBrowserSessionId,
2425
+ onBrowserSessionIdChange,
2426
+ ...desktopEnabled ? { createLinkedComputer } : {},
2427
+ ...onOpenComputerSession ? { onOpenComputer: onOpenComputerSession } : {},
2428
+ ...browserWebSocketFactory ? { webSocketFactory: browserWebSocketFactory } : {},
2429
+ ...browserExtensionSetupUrl ? { browserExtensionSetupUrl } : {},
2430
+ className: "h-full"
2431
+ },
2432
+ sessionId
2433
+ ) })
2434
+ });
2435
+ }
2436
+ if (desktopEnabled) {
2437
+ list.push({
2438
+ id: WORKBENCH_TAB_DESKTOP,
2439
+ label: t("sandboxWorkspace.desktop"),
2440
+ icon: /* @__PURE__ */ jsx4(MonitorIcon, {}),
2441
+ ...relevantOnly ? { optional: true } : {},
2442
+ content: /* @__PURE__ */ jsx4(Suspense, { fallback: /* @__PURE__ */ jsx4(WorkbenchSurfaceLoading, { name: "Desktop" }), children: /* @__PURE__ */ jsx4(
2443
+ LazyComputerViewer,
2444
+ {
2445
+ client,
2446
+ workspaceId,
2447
+ sessionId,
2448
+ enabled: workspaceVisible,
2449
+ onNotify,
2450
+ initialComputerSessionId,
2451
+ onComputerSessionIdChange,
2452
+ requestedComputerSessionId,
2453
+ requestedComputerRequestId,
2454
+ ...computerWebSocketFactory ? { webSocketFactory: computerWebSocketFactory } : {},
2455
+ className: "h-full"
2456
+ },
2457
+ sessionId
2458
+ ) })
2459
+ });
2460
+ }
2461
+ return list;
2462
+ }, [
2463
+ fileSystemOn,
2464
+ changesEnabled,
2465
+ filesEnabled,
2466
+ terminalOn,
2467
+ browserEnabled,
2468
+ desktopEnabled,
2469
+ captureAvailable,
2470
+ captureState.degradedReason,
2471
+ dirtyCount,
2472
+ captureHasChanges,
2473
+ eventsShowChanges,
2474
+ storedChangesComparison,
2475
+ relevantOnly,
2476
+ warmTerminal,
2477
+ requestedFilePath,
2478
+ requestedFileRequestId,
2479
+ requestedFileLine,
2480
+ onOpenFile,
2481
+ stablePullRequest,
2482
+ onOpenPullRequest,
2483
+ initialFilePath,
2484
+ onFilePathChange,
2485
+ isFileNodeVisible,
2486
+ hideToolFolders,
2487
+ initialBrowserSessionId,
2488
+ onBrowserSessionIdChange,
2489
+ initialComputerSessionId,
2490
+ onComputerSessionIdChange,
2491
+ onOpenComputerSession,
2492
+ requestedComputerSessionId,
2493
+ requestedComputerRequestId,
2494
+ onNotify,
2495
+ browserWebSocketFactory,
2496
+ computerWebSocketFactory,
2497
+ workspaceVisible,
2498
+ // Only Browser reads which tab is active: switching between the other
2499
+ // tabs must not rebuild (and re-render) every panel.
2500
+ browserActive,
2501
+ client,
2502
+ workspaceId,
2503
+ liveness,
2504
+ sessionId,
2505
+ files,
2506
+ git,
2507
+ changesComparison,
2508
+ terminal,
2509
+ xtermTheme,
2510
+ capabilities,
2511
+ workspaceWaking,
2512
+ caps.state,
2513
+ caps.error,
2514
+ caps.viewerCapReached,
2515
+ caps.viewerCapReason,
2516
+ caps.renegotiate,
2517
+ filesWarmRequested,
2518
+ requestWarmIntent,
2519
+ wakeFiles,
2520
+ openGuardedFile,
2521
+ createLinkedComputer,
2522
+ t
2523
+ ]);
2524
+ return {
2525
+ tabs,
2526
+ defaultTab,
2527
+ machine: {
2528
+ enabled: machineSurfaceEnabled,
2529
+ chip,
2530
+ activeMachine,
2531
+ loading: machines.loading,
2532
+ error: machines.error,
2533
+ refresh: machines.refresh
2534
+ }
2535
+ };
2536
+ }
2537
+ function SandboxWorkspace(props) {
2538
+ const {
2539
+ sessionId,
2540
+ events,
2541
+ primary,
2542
+ surfaces,
2543
+ machinesEnabled,
2544
+ leadingTabs,
2545
+ trailingTabs,
2546
+ initialTab,
2547
+ tabVisibility,
2548
+ onActiveTabChange,
2549
+ onStripEmptied,
2550
+ openTabRequest,
2551
+ initialFilePath,
2552
+ onFilePathChange,
2553
+ isFileNodeVisible,
2554
+ hideToolFolders,
2555
+ openFileRequest,
2556
+ initialBrowserSessionId,
2557
+ onBrowserSessionIdChange,
2558
+ initialComputerSessionId,
2559
+ onComputerSessionIdChange,
2560
+ onNotify,
2561
+ browserWebSocketFactory,
2562
+ computerWebSocketFactory,
2563
+ browserExtensionSetupUrl,
2564
+ pullRequest,
2565
+ onOpenPullRequest,
2566
+ collapsed,
2567
+ onCollapsedChange,
2568
+ showCollapseControl,
2569
+ mobileLeadingControl,
2570
+ autoSaveId,
2571
+ defaultSize,
2572
+ minSize,
2573
+ maxSize,
2574
+ className
2575
+ } = props;
2576
+ const [storedSelection, setStoredSelection] = useState8(null);
2577
+ const [requestedFile, setRequestedFile] = useState8(null);
2578
+ const [requestedComputer, setRequestedComputer] = useState8(null);
2579
+ const nextFileRequestId = useRef8(0);
2580
+ const nextComputerRequestId = useRef8(0);
2581
+ const selectedTab = storedSelection?.sessionId === sessionId ? storedSelection.tab : null;
2582
+ const [shownTab, setShownTab] = useState8(null);
2583
+ const handledTabRequest = useRef8(null);
2584
+ useEffect8(() => {
2585
+ if (!openTabRequest || handledTabRequest.current?.sessionId === sessionId && handledTabRequest.current.requestId === openTabRequest.requestId)
2586
+ return;
2587
+ const available = [...leadingTabs ?? [], ...trailingTabs ?? []].some(
2588
+ (tab) => tab.id === openTabRequest.tab
2589
+ ) || (surfaces ?? WORKBENCH_SURFACES).some((tab) => tab === openTabRequest.tab);
2590
+ if (!available) return;
2591
+ handledTabRequest.current = { sessionId, requestId: openTabRequest.requestId };
2592
+ setStoredSelection({ sessionId, tab: openTabRequest.tab, picked: true });
2593
+ onActiveTabChange?.(openTabRequest.tab);
2594
+ if (openTabRequest.expand !== false) onCollapsedChange?.(false);
2595
+ }, [
2596
+ openTabRequest,
2597
+ sessionId,
2598
+ leadingTabs,
2599
+ trailingTabs,
2600
+ surfaces,
2601
+ onActiveTabChange,
2602
+ onCollapsedChange
2603
+ ]);
2604
+ const activeTabHint = selectedTab ?? initialTab ?? leadingTabs?.[0]?.id ?? null;
2605
+ const openFile = useCallback10(
2606
+ (path, line) => {
2607
+ setRequestedFile({
2608
+ sessionId,
2609
+ path,
2610
+ line: line != null && line > 0 ? line : null,
2611
+ requestId: ++nextFileRequestId.current
2612
+ });
2613
+ setStoredSelection({ sessionId, tab: WORKBENCH_TAB_FILES, picked: true });
2614
+ onActiveTabChange?.(WORKBENCH_TAB_FILES);
2615
+ onFilePathChange?.(path);
2616
+ onCollapsedChange?.(false);
2617
+ },
2618
+ [onActiveTabChange, onCollapsedChange, onFilePathChange, sessionId]
2619
+ );
2620
+ const handledOpenFileRequestId = useRef8(null);
2621
+ useEffect8(() => {
2622
+ if (!openFileRequest) return;
2623
+ if (handledOpenFileRequestId.current === openFileRequest.requestId) return;
2624
+ handledOpenFileRequestId.current = openFileRequest.requestId;
2625
+ openFile(openFileRequest.path, openFileRequest.line);
2626
+ }, [openFile, openFileRequest]);
2627
+ const openComputer = useCallback10(
2628
+ (computerSessionId) => {
2629
+ nextComputerRequestId.current += 1;
2630
+ setRequestedComputer({
2631
+ sessionId,
2632
+ computerSessionId,
2633
+ requestId: nextComputerRequestId.current
2634
+ });
2635
+ setStoredSelection({ sessionId, tab: WORKBENCH_TAB_DESKTOP, picked: true });
2636
+ onActiveTabChange?.(WORKBENCH_TAB_DESKTOP);
2637
+ onComputerSessionIdChange?.(computerSessionId);
2638
+ },
2639
+ [onActiveTabChange, onComputerSessionIdChange, sessionId]
2640
+ );
2641
+ const {
2642
+ tabs: workbenchTabs,
2643
+ machine,
2644
+ defaultTab
2645
+ } = useSandboxWorkspaceTabs({
2646
+ ...props.client ? { client: props.client } : {},
2647
+ ...props.workspaceId ? { workspaceId: props.workspaceId } : {},
2648
+ sessionId,
2649
+ events,
2650
+ ...surfaces ? { surfaces } : {},
2651
+ ...machinesEnabled !== void 0 ? { machinesEnabled } : {},
2652
+ ...initialTab ? { initialTab } : {},
2653
+ ...tabVisibility ? { tabVisibility } : {},
2654
+ activeTab: shownTab?.sessionId === sessionId ? shownTab.tab : activeTabHint,
2655
+ workspaceVisible: collapsed !== true,
2656
+ ...onNotify ? { onNotify } : {},
2657
+ ...browserWebSocketFactory ? { browserWebSocketFactory } : {},
2658
+ ...computerWebSocketFactory ? { computerWebSocketFactory } : {},
2659
+ ...browserExtensionSetupUrl ? { browserExtensionSetupUrl } : {},
2660
+ ...pullRequest ? { pullRequest } : {},
2661
+ ...onOpenPullRequest ? { onOpenPullRequest } : {},
2662
+ initialFilePath,
2663
+ onFilePathChange,
2664
+ isFileNodeVisible,
2665
+ hideToolFolders,
2666
+ initialBrowserSessionId,
2667
+ onBrowserSessionIdChange,
2668
+ initialComputerSessionId,
2669
+ onComputerSessionIdChange,
2670
+ requestedFilePath: requestedFile?.sessionId === sessionId ? requestedFile.path : null,
2671
+ requestedFileRequestId: requestedFile?.sessionId === sessionId ? requestedFile.requestId : null,
2672
+ requestedFileLine: requestedFile?.sessionId === sessionId ? requestedFile.line : null,
2673
+ onOpenFile: openFile,
2674
+ onOpenComputerSession: openComputer,
2675
+ requestedComputerSessionId: requestedComputer?.sessionId === sessionId ? requestedComputer.computerSessionId : null,
2676
+ requestedComputerRequestId: requestedComputer?.sessionId === sessionId ? requestedComputer.requestId : null
2677
+ });
2678
+ const tabs = [...leadingTabs ?? [], ...workbenchTabs, ...trailingTabs ?? []];
2679
+ const preferredTab = selectedTab ?? defaultTab;
2680
+ const preferredOptional = tabVisibility === "relevant" && !(storedSelection?.sessionId === sessionId && storedSelection.picked === true) && tabs.some((tab) => tab.id === preferredTab && tab.optional);
2681
+ const firstWithContent = preferredOptional ? tabs.find((tab) => !tab.optional) : void 0;
2682
+ const activeTab = firstWithContent ? firstWithContent.id : preferredTab && tabs.some((tab) => tab.id === preferredTab) ? preferredTab : tabs[0]?.id;
2683
+ const selectTab = useCallback10(
2684
+ (tab) => {
2685
+ setStoredSelection({ sessionId, tab, picked: true });
2686
+ onActiveTabChange?.(tab);
2687
+ },
2688
+ [onActiveTabChange, sessionId]
2689
+ );
2690
+ useEffect8(() => {
2691
+ if (selectedTab !== null || defaultTab === null) return;
2692
+ setStoredSelection({ sessionId, tab: defaultTab, picked: Boolean(initialTab) });
2693
+ }, [defaultTab, initialTab, selectedTab, sessionId]);
2694
+ const picked = storedSelection?.sessionId === sessionId && storedSelection.picked === true;
2695
+ const landingShown = tabVisibility === "relevant" && !picked && tabs.length > 0 && tabs.every((tab) => tab.optional);
2696
+ const shownNow = landingShown ? "" : activeTab ?? null;
2697
+ useEffect8(() => {
2698
+ if (shownNow === null) return;
2699
+ setShownTab(
2700
+ (previous) => previous?.sessionId === sessionId && previous.tab === shownNow ? previous : { sessionId, tab: shownNow }
2701
+ );
2702
+ }, [sessionId, shownNow]);
2703
+ const backToLanding = useCallback10(() => {
2704
+ setStoredSelection(
2705
+ (previous) => previous?.sessionId === sessionId ? { ...previous, picked: false } : previous
2706
+ );
2707
+ onStripEmptied?.();
2708
+ }, [onStripEmptied, sessionId]);
2709
+ return /* @__PURE__ */ jsx4(
2710
+ WorkspaceDock,
2711
+ {
2712
+ primary,
2713
+ tabs,
2714
+ ...activeTab !== void 0 ? { activeTab } : {},
2715
+ onActiveTabChange: selectTab,
2716
+ essentials: tabVisibility === "relevant",
2717
+ ...tabVisibility === "relevant" ? { landing: !picked, onStripEmptied: backToLanding } : {},
2718
+ ...sessionId ? { tabScope: sessionId } : {},
2719
+ ...machine.enabled && activeTab !== WORKBENCH_TAB_BROWSER && activeTab !== WORKBENCH_TAB_DESKTOP ? {
2720
+ headerAccessory: /* @__PURE__ */ jsx4(MachineStateChip, { chip: machine.chip }),
2721
+ // Waking or an unreachable machine is worth seeing without opening
2722
+ // the menu; a sleeping box is ordinary.
2723
+ headerAccessoryPinned: machine.chip.state === "waking" || machine.chip.unreachable === true
2724
+ } : {},
2725
+ ...mobileLeadingControl !== void 0 ? { mobileLeadingControl } : {},
2726
+ ...collapsed !== void 0 ? { collapsed } : {},
2727
+ ...onCollapsedChange ? { onCollapsedChange } : {},
2728
+ ...showCollapseControl !== void 0 ? { showCollapseControl } : {},
2729
+ ...autoSaveId !== void 0 ? { autoSaveId } : {},
2730
+ ...defaultSize !== void 0 ? { defaultSize } : {},
2731
+ ...minSize !== void 0 ? { minSize } : {},
2732
+ ...maxSize !== void 0 ? { maxSize } : {},
2733
+ ...className !== void 0 ? { className } : {}
2734
+ }
2735
+ );
2736
+ }
2737
+ function DirtyBadge({ count }) {
2738
+ return /* @__PURE__ */ jsx4("span", { className: "rounded-og-xs bg-og-accent-soft px-1 text-og-xs text-og-fg-muted", children: count });
2739
+ }
2740
+ function chipDotClass(state) {
2741
+ if (state === "live") return "bg-og-status-running";
2742
+ if (state === "waking") return "bg-og-status-idle animate-pulse motion-reduce:animate-none";
2743
+ return "bg-og-fg-subtle";
2744
+ }
2745
+ function MachineStateChip({ chip }) {
2746
+ const t = useOpenGeniText();
2747
+ return /* @__PURE__ */ jsxs3(
2748
+ "div",
2749
+ {
2750
+ role: "status",
2751
+ "aria-label": t("sandboxWorkspace.machineLabel", { label: chip.label }),
2752
+ title: chip.label,
2753
+ className: "inline-flex min-h-7 min-w-0 max-w-full items-center gap-1.5 px-2 py-1 text-og-xs font-medium text-og-fg-muted max-[1023px]:min-h-11 pointer-coarse:min-h-11",
2754
+ children: [
2755
+ /* @__PURE__ */ jsx4(
2756
+ "span",
2757
+ {
2758
+ className: cn("size-1.5 shrink-0 rounded-full", chipDotClass(chip.state)),
2759
+ "aria-hidden": true
2760
+ }
2761
+ ),
2762
+ /* @__PURE__ */ jsx4("span", { "data-contrast-audited": true, className: "min-w-0 max-w-[11rem] truncate", children: chip.label })
2763
+ ]
2764
+ }
2765
+ );
2766
+ }
2767
+ function DockActionButton({ onClick, children }) {
2768
+ return /* @__PURE__ */ jsx4(
2769
+ "button",
2770
+ {
2771
+ type: "button",
2772
+ onClick,
2773
+ className: "inline-flex items-center gap-1.5 rounded-og-sm border border-og-border px-2 py-1 text-og-xs font-medium text-og-fg-muted transition-colors hover:border-og-border-strong hover:text-og-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent max-[1023px]:min-h-11 pointer-coarse:min-h-11",
2774
+ children
2775
+ }
2776
+ );
2777
+ }
2778
+ var ChangesTabBody = memo(function ChangesTabBody2({
2779
+ comparison,
2780
+ onComparisonChange,
2781
+ ...props
2782
+ }) {
2783
+ const t = useOpenGeniText();
2784
+ const picker = useMemo5(
2785
+ () => ({
2786
+ value: comparison,
2787
+ options: [
2788
+ { value: "branch", label: t("sandboxWorkspace.branch") },
2789
+ { value: "working", label: t("sandboxWorkspace.uncommitted") },
2790
+ { value: "staged", label: t("sandboxWorkspace.staged") }
2791
+ ],
2792
+ onChange: (value) => onComparisonChange(value)
2793
+ }),
2794
+ [comparison, onComparisonChange, t]
2795
+ );
2796
+ if (props.git.diff.length > 0) {
2797
+ return /* @__PURE__ */ jsx4("div", { className: "h-full min-h-0", children: /* @__PURE__ */ jsx4(ChangesTabContent, { comparison, picker, ...props }) });
2798
+ }
2799
+ return /* @__PURE__ */ jsxs3("div", { className: "flex h-full min-h-0 flex-col", children: [
2800
+ /* @__PURE__ */ jsx4("div", { className: "flex min-h-9 shrink-0 items-center border-b border-og-border px-2 py-1", children: /* @__PURE__ */ jsx4(WorkbenchChangesViewMenu, { comparison: picker }) }),
2801
+ /* @__PURE__ */ jsx4("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx4(ChangesTabContent, { comparison, picker, ...props }) })
2802
+ ] });
2803
+ });
2804
+ function ChangesTabContent({
2805
+ git,
2806
+ comparison,
2807
+ picker,
2808
+ captureAvailable,
2809
+ captureDegraded,
2810
+ captureRevision,
2811
+ capturePending,
2812
+ liveWorkspaceExpected,
2813
+ workspaceWaking,
2814
+ capabilitiesState,
2815
+ capabilitiesError,
2816
+ onRetry,
2817
+ onWake,
2818
+ onOpenFile,
2819
+ pullRequest,
2820
+ onOpenPullRequest,
2821
+ navigation
2822
+ }) {
2823
+ const t = useOpenGeniText();
2824
+ const diff = git.diff;
2825
+ if (diff.length > 0) {
2826
+ return /* @__PURE__ */ jsxs3("div", { className: "flex h-full min-h-0 flex-col", children: [
2827
+ git.error ? /* @__PURE__ */ jsxs3(
2828
+ "div",
2829
+ {
2830
+ role: "status",
2831
+ "aria-live": "polite",
2832
+ "data-opengeni-changes-degraded": true,
2833
+ className: "flex shrink-0 items-center gap-2 border-b border-og-status-running/30 bg-og-status-running/10 px-2 py-1.5 text-og-xs text-og-fg-muted",
2834
+ children: [
2835
+ /* @__PURE__ */ jsx4(TriangleAlertIcon, { className: "size-3.5 shrink-0 text-og-status-running", "aria-hidden": true }),
2836
+ /* @__PURE__ */ jsx4("span", { className: "min-w-0 flex-1", children: git.source === "capture" ? t("sandboxWorkspace.liveChangesAreTemporarilyUnavailable") : t("sandboxWorkspace.liveRefreshFailedShowingThe") }),
2837
+ /* @__PURE__ */ jsxs3(
2838
+ "button",
2839
+ {
2840
+ type: "button",
2841
+ onClick: () => void git.refresh(),
2842
+ disabled: git.loading,
2843
+ className: "inline-flex min-h-7 shrink-0 items-center gap-1 rounded-og-sm border border-og-border bg-og-surface-1 px-2 font-medium text-og-fg transition-colors hover:border-og-border-strong focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11",
2844
+ children: [
2845
+ /* @__PURE__ */ jsx4(
2846
+ RefreshCwIcon,
2847
+ {
2848
+ className: cn("size-3", git.loading && "animate-spin motion-reduce:animate-none"),
2849
+ "aria-hidden": true
2850
+ }
2851
+ ),
2852
+ t("sandboxWorkspace.retry")
2853
+ ]
2854
+ }
2855
+ )
2856
+ ]
2857
+ }
2858
+ ) : null,
2859
+ /* @__PURE__ */ jsx4("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx4(
2860
+ WorkbenchChanges,
2861
+ {
2862
+ diff,
2863
+ source: git.source,
2864
+ capturedAt: git.capturedAt,
2865
+ captureRevision,
2866
+ ...onOpenFile ? { onOpenFile } : {},
2867
+ pullRequest: pullRequest ?? null,
2868
+ ...onOpenPullRequest ? { onOpenPullRequest } : {},
2869
+ comparison: picker,
2870
+ ...navigation ? { navigation } : {}
2871
+ }
2872
+ ) })
2873
+ ] });
2874
+ }
2875
+ if (capabilitiesError && !captureAvailable) {
2876
+ return /* @__PURE__ */ jsxs3(CenteredState, { icon: /* @__PURE__ */ jsx4(TriangleAlertIcon, { className: "size-5", "aria-hidden": true }), tone: "danger", children: [
2877
+ /* @__PURE__ */ jsx4("p", { className: "text-og-sm font-medium text-og-fg", children: t("sandboxWorkspace.sandboxUnavailable") }),
2878
+ /* @__PURE__ */ jsx4("p", { "data-contrast-audited": true, className: "text-og-sm leading-5 text-og-fg-muted", children: capabilitiesError.message || t("sandboxWorkspace.couldnTReachTheSandbox") }),
2879
+ /* @__PURE__ */ jsxs3(DockActionButton, { onClick: onRetry, children: [
2880
+ /* @__PURE__ */ jsx4(RefreshCwIcon, { className: "size-3" }),
2881
+ t("sandboxWorkspace.retry")
2882
+ ] })
2883
+ ] });
2884
+ }
2885
+ if ((capturePending || capabilitiesState === "negotiating") && !captureAvailable && !workspaceWaking) {
2886
+ return /* @__PURE__ */ jsxs3(
2887
+ CenteredState,
2888
+ {
2889
+ icon: /* @__PURE__ */ jsx4(
2890
+ LoaderCircleIcon,
2891
+ {
2892
+ className: "size-5 animate-spin motion-reduce:animate-none",
2893
+ "aria-hidden": true
2894
+ }
2895
+ ),
2896
+ children: [
2897
+ /* @__PURE__ */ jsx4("p", { className: "text-og-sm font-medium text-og-fg", children: t("sandboxWorkspace.connectingWorkspace") }),
2898
+ /* @__PURE__ */ jsx4("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: t("sandboxWorkspace.lookingForTheLatestFiles") })
2899
+ ]
2900
+ }
2901
+ );
2902
+ }
2903
+ if (!liveWorkspaceExpected && (comparison !== "working" || !captureAvailable)) {
2904
+ const previewUnavailable = captureDegraded && !captureAvailable && comparison !== "staged";
2905
+ return /* @__PURE__ */ jsxs3(
2906
+ CenteredState,
2907
+ {
2908
+ icon: workspaceWaking ? /* @__PURE__ */ jsx4(
2909
+ LoaderCircleIcon,
2910
+ {
2911
+ className: "size-5 animate-spin motion-reduce:animate-none",
2912
+ "aria-hidden": true
2913
+ }
2914
+ ) : previewUnavailable ? /* @__PURE__ */ jsx4(TriangleAlertIcon, { className: "size-5", "aria-hidden": true }) : /* @__PURE__ */ jsx4(CpuIcon, { className: "size-5", "aria-hidden": true }),
2915
+ children: [
2916
+ /* @__PURE__ */ jsx4("p", { className: "text-og-sm font-medium text-og-fg", children: workspaceWaking ? t("sandboxWorkspace.wakingWorkspace") : previewUnavailable ? t("sandboxWorkspace.savedChangesPreviewIsUnavailable") : t("sandboxWorkspace.workspaceIsResting") }),
2917
+ /* @__PURE__ */ jsx4("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: workspaceWaking ? t("sandboxWorkspace.connectingToTheLiveWorking") : previewUnavailable ? t("sandboxWorkspace.openTheLiveWorkspaceTo") : comparison === "branch" ? t("sandboxWorkspace.wakeTheSandboxToCompare") : comparison === "staged" ? t("sandboxWorkspace.wakeTheSandboxToInspect") : t("sandboxWorkspace.noCapturedRevisionIsAvailable") }),
2918
+ !workspaceWaking ? /* @__PURE__ */ jsxs3(DockActionButton, { onClick: onWake, children: [
2919
+ /* @__PURE__ */ jsx4(CpuIcon, { className: "size-3" }),
2920
+ t("sandboxWorkspace.openLiveWorkspace")
2921
+ ] }) : null
2922
+ ]
2923
+ }
2924
+ );
2925
+ }
2926
+ if (git.loading && git.source === null) {
2927
+ return /* @__PURE__ */ jsxs3(
2928
+ CenteredState,
2929
+ {
2930
+ icon: /* @__PURE__ */ jsx4(
2931
+ LoaderCircleIcon,
2932
+ {
2933
+ className: "size-5 animate-spin motion-reduce:animate-none",
2934
+ "aria-hidden": true
2935
+ }
2936
+ ),
2937
+ children: [
2938
+ /* @__PURE__ */ jsx4("p", { className: "text-og-sm font-medium text-og-fg", children: t("sandboxWorkspace.loadingWorkspace") }),
2939
+ /* @__PURE__ */ jsx4("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: t("sandboxWorkspace.readingTheCurrentWorkingTree") })
2940
+ ]
2941
+ }
2942
+ );
2943
+ }
2944
+ return /* @__PURE__ */ jsxs3(CenteredState, { icon: /* @__PURE__ */ jsx4(CircleCheckIcon, { className: "size-5", "aria-hidden": true }), tone: "success", children: [
2945
+ /* @__PURE__ */ jsx4("p", { className: "text-og-sm font-medium text-og-fg", children: comparison === "branch" ? t("sandboxWorkspace.noBranchChanges") : comparison === "staged" ? t("sandboxWorkspace.noStagedChanges") : t("sandboxWorkspace.noUncommittedChanges") }),
2946
+ /* @__PURE__ */ jsx4("p", { className: "text-og-sm leading-5 text-og-fg-subtle", children: comparison === "branch" ? t("sandboxWorkspace.thisBranchMatchesTheRemote") : comparison === "staged" ? t("sandboxWorkspace.stageFilesToReviewThe") : t("sandboxWorkspace.localEditsNotYetCommitted") })
2947
+ ] });
2948
+ }
2949
+ function CenteredState({
2950
+ children,
2951
+ icon,
2952
+ tone = "neutral"
2953
+ }) {
2954
+ return /* @__PURE__ */ jsx4(
2955
+ "div",
2956
+ {
2957
+ role: tone === "danger" ? "alert" : "status",
2958
+ "aria-atomic": "true",
2959
+ "aria-live": tone === "danger" ? "assertive" : "polite",
2960
+ className: "grid h-full place-items-center p-6 text-center",
2961
+ children: /* @__PURE__ */ jsxs3("div", { className: "flex max-w-sm flex-col items-center gap-2.5", children: [
2962
+ icon ? /* @__PURE__ */ jsx4(
2963
+ "span",
2964
+ {
2965
+ className: cn(
2966
+ "grid size-10 place-items-center rounded-og-lg border bg-og-surface-1 shadow-sm",
2967
+ tone === "success" && "border-og-status-idle/30 text-og-status-idle",
2968
+ tone === "danger" && "border-og-status-failed/30 text-og-status-failed",
2969
+ tone === "neutral" && "border-og-border text-og-fg-muted"
2970
+ ),
2971
+ children: icon
2972
+ }
2973
+ ) : null,
2974
+ children
2975
+ ] })
2976
+ }
2977
+ );
2978
+ }
2979
+
2980
+ // src/hooks/use-supergrok-accounts.ts
2981
+ import { useCallback as useCallback11 } from "react";
2982
+ var superGrokAccountsQueryKey = (workspaceId) => ["supergrok-accounts", workspaceId];
2983
+ var EMPTY = {
2984
+ accounts: [],
2985
+ activeAccountId: null,
2986
+ settings: {
2987
+ rotationEnabled: false,
2988
+ rotationStrategy: "sharded",
2989
+ activeCredentialId: null
2990
+ }
2991
+ };
2992
+ function useSuperGrokAccounts(options = {}) {
2993
+ const { client, workspaceId } = useOpenGeni(options);
2994
+ const supergrokClient = options.supergrokClient ?? client;
2995
+ const load = useCallback11(
2996
+ async () => await supergrokClient.listSuperGrokAccounts(workspaceId),
2997
+ [supergrokClient, workspaceId]
2998
+ );
2999
+ const { data, loading, refresh } = useSharedQuery(
3000
+ supergrokClient,
3001
+ superGrokAccountsQueryKey(workspaceId),
3002
+ load,
3003
+ { enabled: options.enabled, pollIntervalMs: options.pollIntervalMs }
3004
+ );
3005
+ const { run, mutating: activating, mutationError } = useMutationRunner();
3006
+ const activate = useCallback11(
3007
+ async (accountId) => {
3008
+ if (!supergrokClient.activateSuperGrokAccount) return false;
3009
+ const invalidated = { current: null };
3010
+ const result = await run(async () => {
3011
+ await supergrokClient.activateSuperGrokAccount(workspaceId, accountId);
3012
+ invalidated.current = invalidateSharedQueries(supergrokClient, ["supergrok-accounts"]);
3013
+ return true;
3014
+ });
3015
+ if (result) await invalidated.current;
3016
+ return result === true;
3017
+ },
3018
+ [run, supergrokClient, workspaceId]
3019
+ );
3020
+ const state = data ?? EMPTY;
3021
+ return {
3022
+ accounts: state.accounts,
3023
+ activeAccountId: state.activeAccountId,
3024
+ settings: state.settings,
3025
+ loading,
3026
+ refresh,
3027
+ activate,
3028
+ activating,
3029
+ mutationError
3030
+ };
3031
+ }
3032
+
3033
+ export {
3034
+ sessionAuthRecommendation,
3035
+ useSessionCapabilities,
3036
+ useSandboxGit,
3037
+ useSandboxTerminal,
3038
+ useWorkspaceCapture,
3039
+ WORKBENCH_TAB_CHANGES,
3040
+ WORKBENCH_TAB_FILES,
3041
+ WORKBENCH_TAB_TERMINAL,
3042
+ WORKBENCH_TAB_BROWSER,
3043
+ WORKBENCH_TAB_DESKTOP,
3044
+ WORKBENCH_SURFACES,
3045
+ initialWorkspaceTab,
3046
+ useSandboxWorkspaceTabs,
3047
+ SandboxWorkspace,
3048
+ SessionConnectionRequest,
3049
+ useVideoArtifactPlaybackLoader,
3050
+ useScheduledTasks,
3051
+ useWorkspaceBackgroundCommands,
3052
+ useWorkspaces,
3053
+ useBillingUsage,
3054
+ useWorkspaceEdit,
3055
+ sessionDisplayTitle,
3056
+ FleetTile,
3057
+ DiffView,
3058
+ useSuperGrokAccounts,
3059
+ asVaultClient,
3060
+ vaultsApi,
3061
+ vaultErrorCode,
3062
+ vaultErrorDetail,
3063
+ humanizeModelSlug,
3064
+ isRawModelLabel,
3065
+ modelDisplayName2 as modelDisplayName,
3066
+ modelSlug,
3067
+ modelVendor,
3068
+ parseOpenGeniLink
3069
+ };
3070
+ //# sourceMappingURL=chunk-7IR7EOTR.js.map