decocms 3.97.6 → 3.97.7

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 (212) hide show
  1. package/dist/client/assets/{AlertCircle-fJcOtdPg.js → AlertCircle-BbWDb4P3.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-CrqD-eAO.js → ArrowUpRight-Cpa1HdMK.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-MeJbRt1q.js → CheckCircle-B5Cs3cJn.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-pn1meT8d.js → ChevronDown-Bdmn9wxy.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-CK9mz_lA.js → ChevronLeft-E01n7Kl2.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-DkLBQXIZ.js → ChevronRight-BwHVl1Gx.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-D_sqWanb.js → ChevronUp-DTAXKGQ5.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-CFX5mHy_.js → DotsVertical-BX0mUqDP.js} +1 -1
  9. package/dist/client/assets/{Eye-DSxffwpX.js → Eye-DpOHfPKV.js} +1 -1
  10. package/dist/client/assets/{FilterLines-BfGXNoDf.js → FilterLines-DNJHlTjF.js} +1 -1
  11. package/dist/client/assets/{Globe01-BE6-Vhn-.js → Globe01-CzN1edxV.js} +1 -1
  12. package/dist/client/assets/{Globe04-ClAPc8QV.js → Globe04-CmTV4j_6.js} +1 -1
  13. package/dist/client/assets/{HardDrive-C_5bQN2s.js → HardDrive-CZQneyxc.js} +1 -1
  14. package/dist/client/assets/{Key01-BEdNDv5D.js → Key01-CBdkPJJY.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-xN92xt-k.js → LayoutLeft-BBIkUylk.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-DtMdLshW.js → LinkExternal01-BCUpwug1.js} +1 -1
  17. package/dist/client/assets/{Monitor01-BxZlH4vE.js → Monitor01-BukoJELB.js} +1 -1
  18. package/dist/client/assets/{Palette-tvgJAmq5.js → Palette-StdAZEDj.js} +1 -1
  19. package/dist/client/assets/{Play-QNolhpYo.js → Play-B9ziq0DG.js} +1 -1
  20. package/dist/client/assets/{Plus-BdYkovF2.js → Plus-CzEd_7C2.js} +1 -1
  21. package/dist/client/assets/{SearchMd-3nngg6Ks.js → SearchMd-B5oXD3je.js} +1 -1
  22. package/dist/client/assets/{Settings02-O2mlkc2j.js → Settings02-YfBGKTKi.js} +1 -1
  23. package/dist/client/assets/{Shield01-D0p_z1Rh.js → Shield01-D1SLus1-.js} +1 -1
  24. package/dist/client/assets/{Star01-CVDxujLg.js → Star01-Blw95h5T.js} +1 -1
  25. package/dist/client/assets/{Stars01-NhcGkHTz.js → Stars01-C8qwraWO.js} +1 -1
  26. package/dist/client/assets/{Stars02-D1Mwhwxh.js → Stars02-CBmeuYJq.js} +1 -1
  27. package/dist/client/assets/{Sun-BzZB8rLL.js → Sun-ffimMdFe.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-CmA6k3Gw.js → SwitchHorizontal01-CWvc9zWe.js} +1 -1
  29. package/dist/client/assets/{Tool01-Ck1tGOLa.js → Tool01-Co8bLuOG.js} +1 -1
  30. package/dist/client/assets/{Trash01-C1jDkITE.js → Trash01-BDZ5N1so.js} +1 -1
  31. package/dist/client/assets/{Upload01-aLxa_7qU.js → Upload01-BcQbyRUH.js} +1 -1
  32. package/dist/client/assets/{User01-l2zA0L_A.js → User01-BmjG1Rsr.js} +1 -1
  33. package/dist/client/assets/{Users01-CtlXU5tT.js → Users01-DaRZooOq.js} +1 -1
  34. package/dist/client/assets/{Users03-BsjGrVdp.js → Users03-BE5xe78Y.js} +1 -1
  35. package/dist/client/assets/{X-8uKw4TRo.js → X-DN8Tc-8X.js} +1 -1
  36. package/dist/client/assets/{XCircle-BmHlL-Zi.js → XCircle-CbLW5tD6.js} +1 -1
  37. package/dist/client/assets/{XClose-MzbQnLCs.js → XClose-CQmwzAVh.js} +1 -1
  38. package/dist/client/assets/{Zap-BTyMjGbn.js → Zap-Cf0CiCn8.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-3iu7JN55.js → ZapSquare-BJwoqAGp.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-CYXoJJk1.js → ZoomOut-BpayHaSz.js} +1 -1
  41. package/dist/client/assets/{access-gate-bI6nuQ5T.js → access-gate-7TuRzUIC.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-BIzdQ3Jk.js → add-section-modal-S5GAD2Yv.js} +1 -1
  43. package/dist/client/assets/{agent-icon-DFvaJiDY.js → agent-icon-CNuTyxJf.js} +1 -1
  44. package/dist/client/assets/{agents-list-C3qeGqX8.js → agents-list-Cw_hhlo7.js} +1 -1
  45. package/dist/client/assets/{ai-providers-BkFo9nQy.js → ai-providers-BEQEsSMi.js} +1 -1
  46. package/dist/client/assets/{alert-qtwSyUZJ.js → alert-DS064q_2.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-C6EVgeBX.js → alert-dialog-Bi8YxknI.js} +1 -1
  48. package/dist/client/assets/{app-editor-BEK4yQ_A.js → app-editor-D4EFBUDJ.js} +1 -1
  49. package/dist/client/assets/{auth-Cal4T12d.js → auth-DyAYzXhN.js} +1 -1
  50. package/dist/client/assets/{auth-catchall-FB-wZz9s.js → auth-catchall-DPS4cXaM.js} +1 -1
  51. package/dist/client/assets/{auth-entry-BdIkAdSG.js → auth-entry-CWk3k_C0.js} +1 -1
  52. package/dist/client/assets/{auth-split-layout-BsQ4TGuC.js → auth-split-layout-72PoTt3E.js} +1 -1
  53. package/dist/client/assets/{authenticate-and-persist-oauth-BZc7Ted8.js → authenticate-and-persist-oauth-3kYKrfE-.js} +1 -1
  54. package/dist/client/assets/{automation-list-row-DG7qfwQf.js → automation-list-row-W4J4D1Fl.js} +1 -1
  55. package/dist/client/assets/{automation-runs-DtNrxAp4.js → automation-runs-DrUx0_JN.js} +1 -1
  56. package/dist/client/assets/{automations-BNj6PofQ.js → automations-x4thNlJ4.js} +1 -1
  57. package/dist/client/assets/{avatar-CwOaN9pX.js → avatar-ZBal56C9.js} +1 -1
  58. package/dist/client/assets/{badge-DGKSOBGC.js → badge-D0AzPgAt.js} +1 -1
  59. package/dist/client/assets/{block-document-D3IORjt-.js → block-document-CjUb2Jhk.js} +1 -1
  60. package/dist/client/assets/{brand-context-gr2Kz8zt.js → brand-context-DSRz4la_.js} +1 -1
  61. package/dist/client/assets/{buckets-B2oo94iU.js → buckets-qiUs41xV.js} +1 -1
  62. package/dist/client/assets/{capability-load-error-D4a3b5Uc.js → capability-load-error-By_-eER2.js} +1 -1
  63. package/dist/client/assets/{card-BT_nUMTM.js → card-MXiCFjBP.js} +1 -1
  64. package/dist/client/assets/{category-editor-BxcuFYi3.js → category-editor-DYJwtrMA.js} +1 -1
  65. package/dist/client/assets/{chat-context-COWNKjf7.js → chat-context-DiBX9-Ov.js} +1 -1
  66. package/dist/client/assets/{checkbox-CHhzhSXJ.js → checkbox-CstNHCWX.js} +1 -1
  67. package/dist/client/assets/{cli-auth-success-54eeF86z.js → cli-auth-success-CbEuLxQe.js} +1 -1
  68. package/dist/client/assets/{collection-detail-CqMXAIhp.js → collection-detail-CngrY_hE.js} +1 -1
  69. package/dist/client/assets/{collection-display-button-wARffpUM.js → collection-display-button-Cw0Rs8aH.js} +1 -1
  70. package/dist/client/assets/{collection-search-BFQ4OhXe.js → collection-search-DSBtDMrO.js} +1 -1
  71. package/dist/client/assets/{collection-tabs-BAyt72oR.js → collection-tabs-HvCY1XOD.js} +1 -1
  72. package/dist/client/assets/{command-BR9F3g1G.js → command-CZ7zKXxJ.js} +1 -1
  73. package/dist/client/assets/{commerce-onboarding-BeqWQISd.js → commerce-onboarding-C_iLtzOc.js} +1 -1
  74. package/dist/client/assets/{connect-desktop-dialog-07IWkdaH.js → connect-desktop-dialog-CR3IauEw.js} +1 -1
  75. package/dist/client/assets/{connection-card-Dl--lNJe.js → connection-card-CTIqzaKu.js} +1 -1
  76. package/dist/client/assets/{connection-detail-AcwFFCQy.js → connection-detail-C_6J-SPE.js} +1 -1
  77. package/dist/client/assets/{connection-form-helpers-BjNvSNQg.js → connection-form-helpers-Bm9rH8r-.js} +1 -1
  78. package/dist/client/assets/{connections-DjDyltCI.js → connections-D5tqJTyw.js} +1 -1
  79. package/dist/client/assets/{context-menu-NIiceaiM.js → context-menu-D9umYpZZ.js} +1 -1
  80. package/dist/client/assets/{decopilot-hWRVkXzW.js → decopilot-DeMlzLYJ.js} +1 -1
  81. package/dist/client/assets/{decopilot-sse-pool-BkD5Vlqs.js → decopilot-sse-pool-BVQiWKqJ.js} +1 -1
  82. package/dist/client/assets/{dialog-Cyifv3G9.js → dialog-Cflfh_Tw.js} +1 -1
  83. package/dist/client/assets/{domain-settings-CkXzInCJ.js → domain-settings-DCa9Ocnq.js} +1 -1
  84. package/dist/client/assets/{drawer-JGISYavf.js → drawer-0UiugAj3.js} +1 -1
  85. package/dist/client/assets/{dropdown-menu-BJVltTV3.js → dropdown-menu-AY92Z-dd.js} +1 -1
  86. package/dist/client/assets/{empty-state-DnQZ-XhB.js → empty-state-Dx0oWv9I.js} +1 -1
  87. package/dist/client/assets/{extract-connection-data-Bq3lwCXC.js → extract-connection-data-OXojd7qP.js} +1 -1
  88. package/dist/client/assets/{file-explorer-jRMynDw8.js → file-explorer-DFB16XEX.js} +1 -1
  89. package/dist/client/assets/{file-type-icon-Dv84qEA9.js → file-type-icon-6zbFot2C.js} +1 -1
  90. package/dist/client/assets/{files-r5omO6Th.js → files-CV61ORwb.js} +1 -1
  91. package/dist/client/assets/{form-DWQLeODh.js → form-kI1-d2Ap.js} +1 -1
  92. package/dist/client/assets/{general-CSTYHVNl.js → general-1Be5WBPJ.js} +1 -1
  93. package/dist/client/assets/{github-repo-picker-H0oT363r.js → github-repo-picker-B6lDEWtg.js} +1 -1
  94. package/dist/client/assets/{hooks-DQcMNMU9.js → hooks-DSw61L3q.js} +1 -1
  95. package/dist/client/assets/{import-from-deco-dialog-Djhp-jTF.js → import-from-deco-dialog-DVF2YKW-.js} +1 -1
  96. package/dist/client/assets/{index-DJINNu9L.js → index-B5aMoJd5.js} +1 -1
  97. package/dist/client/assets/{index-IIHfSSHd.js → index-BeCmcioi.js} +1 -1
  98. package/dist/client/assets/{index-uucvgtdd.js → index-C3lBPlh5.js} +1 -1
  99. package/dist/client/assets/{index-Bs46DU41.js → index-C4RqHqQ-.js} +1 -1
  100. package/dist/client/assets/{index-ezx837e_.js → index-CbZvNsMe.js} +1 -1
  101. package/dist/client/assets/{index-EfvpxM9b.js → index-CeeMvg3X.js} +1 -1
  102. package/dist/client/assets/{index-Bjcx3nRG.js → index-DO84G1Ma.js} +1 -1
  103. package/dist/client/assets/{index-DN3DrlLQ.js → index-DQiUFldO.js} +1 -1
  104. package/dist/client/assets/{index-5WweUe2_.js → index-DRlZtDVf.js} +1 -1
  105. package/dist/client/assets/{index-CIxivSGi.js → index-DnVkFYRm.js} +1 -1
  106. package/dist/client/assets/{index-BMT2Fr2d.js → index-DodzLX-5.js} +1 -1
  107. package/dist/client/assets/{index-BkiBNOb3.js → index-DqDkObQs.js} +5 -5
  108. package/dist/client/assets/{index-DZvELjVm.js → index-GuH7_k30.js} +1 -1
  109. package/dist/client/assets/{index-redirect-CdRbbveI.js → index-redirect-CT2MUfLH.js} +1 -1
  110. package/dist/client/assets/{index-BHn6e0Se.js → index-smTHcnUA.js} +3 -3
  111. package/dist/client/assets/{input-B-Pb-iQx.js → input-3jBb-uLt.js} +1 -1
  112. package/dist/client/assets/{integration-icon-BYmEZGh5.js → integration-icon-Bn0wvmtz.js} +1 -1
  113. package/dist/client/assets/{label-Dc1p-WMs.js → label-DYbtyKk_.js} +1 -1
  114. package/dist/client/assets/{login-hIHZKaLN.js → login-Cs72_6kj.js} +1 -1
  115. package/dist/client/assets/{mcp-oauth-CQkaDVAB.js → mcp-oauth-BDYi7sDB.js} +1 -1
  116. package/dist/client/assets/{members-CwGKFfd8.js → members-DDUmE_tS.js} +1 -1
  117. package/dist/client/assets/{monaco-editor-HPIYbtKC.js → monaco-editor-uPlGLArC.js} +1 -1
  118. package/dist/client/assets/{monitoring-stats-row-Cp0dQQPp.js → monitoring-stats-row-Cx1pSXL3.js} +1 -1
  119. package/dist/client/assets/{oauth-callback-S9pNiita.js → oauth-callback-B1PoSivY.js} +1 -1
  120. package/dist/client/assets/{oauth-callback-ai-provider-Bn-jrGFP.js → oauth-callback-ai-provider-BHR_VU_e.js} +1 -1
  121. package/dist/client/assets/{onboarding-D-XkA1WF.js → onboarding-CuBcXom9.js} +1 -1
  122. package/dist/client/assets/{org-install-BlQqrlG1.js → org-install-Ce4Nl2nf.js} +1 -1
  123. package/dist/client/assets/{org-layout-DcKJCuet.js → org-layout-CywML7Tg.js} +1 -1
  124. package/dist/client/assets/{organization-choice-xM7kJrun.js → organization-choice-Dm4HbuQ0.js} +1 -1
  125. package/dist/client/assets/{page-seo-form-Co-ts-e9.js → page-seo-form-oeCi9CFa.js} +1 -1
  126. package/dist/client/assets/page-seo-sheet-REU1FYqG.js +1 -0
  127. package/dist/client/assets/{popover-4qhYIUWo.js → popover-DG4qK6ZG.js} +1 -1
  128. package/dist/client/assets/{post-editor-m_5Acqks.js → post-editor-BHqMx9wf.js} +1 -1
  129. package/dist/client/assets/{preview-dialog-Bz9c-xiV.js → preview-dialog-D5QAlFg9.js} +1 -1
  130. package/dist/client/assets/{primitives-Bb10pQJV.js → primitives-BjDrMu1e.js} +1 -1
  131. package/dist/client/assets/{profile-BBtrBCC8.js → profile-DPSRl9oD.js} +1 -1
  132. package/dist/client/assets/project-app-view-DIuhFpla.js +1 -0
  133. package/dist/client/assets/record-editor-DVsbJOpA.js +1 -0
  134. package/dist/client/assets/registry-BFYHD6vu.js +2 -0
  135. package/dist/client/assets/{registry-layout-DET4-b1_.js → registry-layout-B04NCkil.js} +1 -1
  136. package/dist/client/assets/{require-capability-_0uXwGU-.js → require-capability-BBor_4EA.js} +1 -1
  137. package/dist/client/assets/{required-auth-layout-Crj-Dp7t.js → required-auth-layout-CnBiGFWB.js} +1 -1
  138. package/dist/client/assets/{reset-password-BUGjtZUo.js → reset-password-DXYp8lVw.js} +1 -1
  139. package/dist/client/assets/{roles-BEf9Yg1v.js → roles-CoSM2yC_.js} +1 -1
  140. package/dist/client/assets/{save-status-DSRENc3i.js → save-status-ce87Zgi0.js} +1 -1
  141. package/dist/client/assets/{scroll-area-eBc0wf7v.js → scroll-area-B42MPIw3.js} +1 -1
  142. package/dist/client/assets/{search-input-DT_JKNy3.js → search-input-CC_aa0Gt.js} +1 -1
  143. package/dist/client/assets/{secrets-DGtylvlf.js → secrets-Bys8E3nN.js} +1 -1
  144. package/dist/client/assets/{sections-editor-D6yHRgfS.js → sections-editor-Ck_gejiB.js} +1 -1
  145. package/dist/client/assets/{select-BW0GS-sD.js → select-DieoiSYl.js} +1 -1
  146. package/dist/client/assets/{select-model-CB71JKeW.js → select-model-CV7D1CvA.js} +1 -1
  147. package/dist/client/assets/{seo-editor-C6M00UrO.js → seo-editor-aTRXaVxH.js} +1 -1
  148. package/dist/client/assets/{settings-layout-sk_Xs5v3.js → settings-layout-BcLFii5a.js} +1 -1
  149. package/dist/client/assets/{settings-section-prScMNzK.js → settings-section-VnNyBtnl.js} +1 -1
  150. package/dist/client/assets/{sheet-BeyyimwJ.js → sheet-Pqbb_nLq.js} +1 -1
  151. package/dist/client/assets/{shell-controls-Dl-Z1hcG.js → shell-controls-DKdbxI5l.js} +1 -1
  152. package/dist/client/assets/{shell-layout-DJkQm9ri.js → shell-layout-DQydNkht.js} +1 -1
  153. package/dist/client/assets/{shell-route-loading-CwMHFQUh.js → shell-route-loading-CMccwwVE.js} +1 -1
  154. package/dist/client/assets/{sidebar-Bs5hYMFZ.js → sidebar-BLOsSoN_.js} +1 -1
  155. package/dist/client/assets/{skeleton-DpFeLiG8.js → skeleton-CLfhTXx-.js} +1 -1
  156. package/dist/client/assets/{sortable.esm-D36A3isx.js → sortable.esm-Cc0x-CQz.js} +1 -1
  157. package/dist/client/assets/{sso-BpeT1mQP.js → sso--kjp7-8f.js} +1 -1
  158. package/dist/client/assets/{store-CaF9Mk93.js → store-BIZZek5w.js} +1 -1
  159. package/dist/client/assets/store-registry-BU7RcCrC.js +2 -0
  160. package/dist/client/assets/{studio-tools-By-RAUnB.js → studio-tools-FklJDanw.js} +1 -1
  161. package/dist/client/assets/{switch-CnAdsV_e.js → switch-CHco2opq.js} +1 -1
  162. package/dist/client/assets/{table-DFbId_dZ.js → table-BPRYh1TO.js} +1 -1
  163. package/dist/client/assets/{tabs-BXGI5o2r.js → tabs-Ca-c7EUe.js} +1 -1
  164. package/dist/client/assets/{task-status-ClBLjafq.js → task-status-Cekf3ZU9.js} +1 -1
  165. package/dist/client/assets/{textarea-C0xG5lgY.js → textarea-BAEhJXU5.js} +1 -1
  166. package/dist/client/assets/{toggle-group-DMtsh5NF.js → toggle-group-OTavjf1W.js} +1 -1
  167. package/dist/client/assets/{toolbar-Dz2F7jsm.js → toolbar-DDBdnwsl.js} +1 -1
  168. package/dist/client/assets/{tooltip-DbXsqmjo.js → tooltip-C8EAE8WH.js} +1 -1
  169. package/dist/client/assets/{types-CZk9_Z8c.js → types-BqGw3gnw.js} +1 -1
  170. package/dist/client/assets/{use-ai-providers-WiPZJScZ.js → use-ai-providers-BUofhQwM.js} +1 -1
  171. package/dist/client/assets/{use-automations-CyoUprKw.js → use-automations-E5-3gLDv.js} +1 -1
  172. package/dist/client/assets/{use-capability-DTqJ4XUv.js → use-capability-BbL91qJb.js} +1 -1
  173. package/dist/client/assets/{use-clock-tick-B2vJyztT.js → use-clock-tick-CytvSUpz.js} +1 -1
  174. package/dist/client/assets/{use-collections-ZFJu8_05.js → use-collections-Dh2p4suc.js} +1 -1
  175. package/dist/client/assets/{use-connection-BXbi3G-n.js → use-connection-h3hvIRkK.js} +1 -1
  176. package/dist/client/assets/{use-copy-BdLLJ_fi.js → use-copy-DFWhQKHC.js} +1 -1
  177. package/dist/client/assets/{use-create-virtual-mcp-BuUXsiAm.js → use-create-virtual-mcp-DXsZDQcc.js} +1 -1
  178. package/dist/client/assets/{use-debounced-autosave-HTy2hxZu.js → use-debounced-autosave-DbY-cSB7.js} +1 -1
  179. package/dist/client/assets/{use-delete-connection-CpC6odhp.js → use-delete-connection-BOJATnTh.js} +1 -1
  180. package/dist/client/assets/{use-file-configs-B39Wbm4e.js → use-file-configs-DG6KTQKj.js} +1 -1
  181. package/dist/client/assets/{use-infinite-scroll-By_ChSnA.js → use-infinite-scroll-zQ1y1b1L.js} +1 -1
  182. package/dist/client/assets/{use-join-requests-Clvetl3Y.js → use-join-requests-CFs0Vp2p.js} +1 -1
  183. package/dist/client/assets/{use-mcp-client-BbksZMyI.js → use-mcp-client-SQJoN-V8.js} +1 -1
  184. package/dist/client/assets/{use-mcp-prompts-Cw3K78_o.js → use-mcp-prompts-BsdifcZC.js} +1 -1
  185. package/dist/client/assets/{use-mcp-tools-DRPCqs25.js → use-mcp-tools-Cle5Kd84.js} +1 -1
  186. package/dist/client/assets/{use-members-CMfXyasv.js → use-members-Ch1XITTN.js} +1 -1
  187. package/dist/client/assets/{use-mobile-D4nRxsIe.js → use-mobile-CvCMlflA.js} +1 -1
  188. package/dist/client/assets/{use-navigate-to-agent-BTBF1w74.js → use-navigate-to-agent-DQghLhaf.js} +1 -1
  189. package/dist/client/assets/{use-org-auth-client-BtI7VkGK.js → use-org-auth-client-CVxnVAwj.js} +1 -1
  190. package/dist/client/assets/{use-org-sso-CAx_bgC5.js → use-org-sso-CWXefYPz.js} +1 -1
  191. package/dist/client/assets/{use-organization-roles-Db9bHG-3.js → use-organization-roles-DBbnxQm7.js} +1 -1
  192. package/dist/client/assets/{use-organization-settings-BwYobfuk.js → use-organization-settings-0OKnMPr2.js} +1 -1
  193. package/dist/client/assets/{use-registry-connections-BldJ2nwB.js → use-registry-connections-Bw564Fn1.js} +1 -1
  194. package/dist/client/assets/{use-secrets-CxKHovWg.js → use-secrets-Cox1bfg5.js} +1 -1
  195. package/dist/client/assets/{use-status-sounds-CKvsYwcO.js → use-status-sounds-Dxz86iWd.js} +1 -1
  196. package/dist/client/assets/{use-view-mode-BBopJmXj.js → use-view-mode-BTmAO-eH.js} +1 -1
  197. package/dist/client/assets/{use-virtual-mcp-RUDrgBDG.js → use-virtual-mcp-nCKsVOOs.js} +1 -1
  198. package/dist/client/assets/useInfiniteQuery-DaeGOmGx.js +1 -0
  199. package/dist/client/assets/useSuspenseInfiniteQuery-DOQWnPwU.js +1 -0
  200. package/dist/client/assets/{useSuspenseQueries-DKnOs7t9.js → useSuspenseQueries-CKsQYhMg.js} +1 -1
  201. package/dist/client/assets/{variant-calendar-B3GXjQEb.js → variant-calendar-D4xtrF_C.js} +1 -1
  202. package/dist/client/assets/{view-mode-toggle-5-CmRgcL.js → view-mode-toggle-qPa51MgO.js} +1 -1
  203. package/dist/client/index.html +1 -1
  204. package/dist/server/cli.js +1 -1
  205. package/package.json +1 -1
  206. package/dist/client/assets/page-seo-sheet-DzMEj-6t.js +0 -1
  207. package/dist/client/assets/project-app-view-R3dJtbKa.js +0 -1
  208. package/dist/client/assets/record-editor-B-hdKUxj.js +0 -1
  209. package/dist/client/assets/registry-B_a2vIE9.js +0 -2
  210. package/dist/client/assets/store-registry-q-E7flZt.js +0 -2
  211. package/dist/client/assets/useInfiniteQuery-D-zpdPgg.js +0 -1
  212. package/dist/client/assets/useSuspenseInfiniteQuery-CRSha7cG.js +0 -1
@@ -1 +1 @@
1
- import{c as D,D as U,K as T,k as I,m as x,d as y,t as m}from"./index-BHn6e0Se.js";import{S as z,u as J}from"./use-mcp-client-BbksZMyI.js";import{u as k}from"./studio-tools-By-RAUnB.js";function V(t){if(t.paramsSchema&&typeof t.paramsSchema=="object")return t;const e={};if(Array.isArray(t.params))for(const s of t.params)e[s.name]={type:s.type,description:s.description,enum:s.enum};else t.params&&typeof t.params=="object"&&Object.assign(e,t.params);return{type:t.type,description:t.description,paramsSchema:e}}function st(t){const e=D.c(12),{org:s}=U(),l=t??z;let a;e[0]!==s.id||e[1]!==s.slug||e[2]!==l?(a={connectionId:l,orgId:s.id,orgSlug:s.slug},e[0]=s.id,e[1]=s.slug,e[2]=l,e[3]=a):a=e[3];const i=J(a);let n;e[4]!==t?(n=T.toolCall(t??"","TRIGGER_LIST",""),e[4]=t,e[5]=n):n=e[5];let o;e[6]!==i?(o=async()=>{const d=await i.callTool({name:"TRIGGER_LIST",arguments:{}});return(d.structuredContent??d).triggers.map(V)},e[6]=i,e[7]=o):o=e[7];const c=!!t;let r;return e[8]!==n||e[9]!==o||e[10]!==c?(r={queryKey:n,queryFn:o,enabled:c,staleTime:3e4},e[8]=n,e[9]=o,e[10]=c,e[11]=r):r=e[11],I(r)}function it(t){const e=D.c(9),{org:s}=U(),l=k();let a;e[0]!==s.id||e[1]!==t?(a=T.automations(s.id,t),e[0]=s.id,e[1]=t,e[2]=a):a=e[2];let i;e[3]!==l||e[4]!==t?(i=async()=>(await l.call("AUTOMATION_LIST",t!=null?{virtual_mcp_id:t}:{})).automations,e[3]=l,e[4]=t,e[5]=i):i=e[5];let n;return e[6]!==a||e[7]!==i?(n={queryKey:a,queryFn:i,staleTime:1e4},e[6]=a,e[7]=i,e[8]=n):n=e[8],I(n)}function ot(t){const e=D.c(10),{org:s}=U(),l=k();let a;e[0]!==t||e[1]!==s.id?(a=T.automation(s.id,t),e[0]=t,e[1]=s.id,e[2]=a):a=e[2];let i;e[3]!==t||e[4]!==l?(i=async()=>(await l.call("AUTOMATION_GET",{id:t})).automation,e[3]=t,e[4]=l,e[5]=i):i=e[5];const n=!!t;let o;return e[6]!==a||e[7]!==i||e[8]!==n?(o={queryKey:a,queryFn:i,enabled:n,staleTime:1e4},e[6]=a,e[7]=i,e[8]=n,e[9]=o):o=e[9],I(o)}function at(t,e){const s=D.c(12),{org:l}=U(),a=k();let i;s[0]!==t||s[1]!==l.id||s[2]!==e?(i=T.automationRunStats(l.id,t,JSON.stringify(e??{})),s[0]=t,s[1]=l.id,s[2]=e,s[3]=i):i=s[3];let n;s[4]!==t||s[5]!==e||s[6]!==a?(n=async()=>await a.call("AUTOMATION_RUN_STATS",{automation_id:t,...e?.startDate?{startDate:e.startDate}:{},...e?.endDate?{endDate:e.endDate}:{}}),s[4]=t,s[5]=e,s[6]=a,s[7]=n):n=s[7];const o=!!t;let c;return s[8]!==i||s[9]!==n||s[10]!==o?(c={queryKey:i,queryFn:n,enabled:o,staleTime:3e4},s[8]=i,s[9]=n,s[10]=o,s[11]=c):c=s[11],I(c)}function nt(t){return{name:"New Automation",messages:[],models:{tier:"smart"},temperature:.5,active:!0,virtual_mcp_id:t}}function lt(){const t=D.c(64),{org:e}=U(),s=k(),l=x();let a;t[0]!==e||t[1]!==l?(a=()=>l.invalidateQueries({queryKey:T.automationsAll(e.id)}),t[0]=e,t[1]=l,t[2]=a):a=t[2];const i=a;let n;t[3]!==e||t[4]!==l?(n=u=>l.invalidateQueries({queryKey:T.automation(e.id,u)}),t[3]=e,t[4]=l,t[5]=n):n=t[5];const o=n;let c;t[6]!==s?(c=async u=>await s.call("AUTOMATION_CREATE",u),t[6]=s,t[7]=c):c=t[7];let r;t[8]!==i?(r=()=>{i(),m.success("Automation created successfully")},t[8]=i,t[9]=r):r=t[9];let d;t[10]!==c||t[11]!==r?(d={mutationFn:c,onSuccess:r,onError:X},t[10]=c,t[11]=r,t[12]=d):d=t[12];const q=y(d);let A;t[13]!==s?(A=async u=>await s.call("AUTOMATION_UPDATE",u),t[13]=s,t[14]=A):A=t[14];let p;t[15]!==i||t[16]!==o?(p=(u,f)=>{i(),typeof f.id=="string"&&o(f.id),m.success("Automation updated successfully")},t[15]=i,t[16]=o,t[17]=p):p=t[17];let G;t[18]!==A||t[19]!==p?(G={mutationFn:A,onSuccess:p,onError:W},t[18]=A,t[19]=p,t[20]=G):G=t[20];const Q=y(G);let g;t[21]!==s?(g=async u=>await s.call("AUTOMATION_DELETE",{id:u}),t[21]=s,t[22]=g):g=t[22];let _;t[23]!==i||t[24]!==e||t[25]!==l?(_=(u,f)=>{l.removeQueries({queryKey:T.automation(e.id,f)}),i(),m.success("Automation deleted successfully")},t[23]=i,t[24]=e,t[25]=l,t[26]=_):_=t[26];let $;t[27]!==g||t[28]!==_?($={mutationFn:g,onSuccess:_,onError:H},t[27]=g,t[28]=_,t[29]=$):$=t[29];const j=y($);let S;t[30]!==s?(S=async u=>await s.call("AUTOMATION_TRIGGER_ADD",u),t[30]=s,t[31]=S):S=t[31];let E;t[32]!==i||t[33]!==o?(E=u=>{i(),o(u.automation_id)},t[32]=i,t[33]=o,t[34]=E):E=t[34];let K;t[35]!==S||t[36]!==E?(K={mutationFn:S,onSuccess:E},t[35]=S,t[36]=E,t[37]=K):K=t[37];const P=y(K);let O;t[38]!==s?(O=async u=>await s.call("AUTOMATION_TRIGGER_ROTATE_TOKEN",{trigger_id:u.trigger_id}),t[38]=s,t[39]=O):O=t[39];let R;t[40]!==i||t[41]!==o?(R=(u,f)=>{i(),o(f.automation_id)},t[40]=i,t[41]=o,t[42]=R):R=t[42];let C;t[43]!==O||t[44]!==R?(C={mutationFn:O,onSuccess:R},t[43]=O,t[44]=R,t[45]=C):C=t[45];const h=y(C);let F;t[46]!==s?(F=async u=>await s.call("AUTOMATION_TRIGGER_REMOVE",{trigger_id:u.trigger_id}),t[46]=s,t[47]=F):F=t[47];let N;t[48]!==i||t[49]!==o?(N=(u,f)=>{i(),o(f.automation_id)},t[48]=i,t[49]=o,t[50]=N):N=t[50];let b;t[51]!==F||t[52]!==N?(b={mutationFn:F,onSuccess:N},t[51]=F,t[52]=N,t[53]=b):b=t[53];const v=y(b);let L;t[54]!==s?(L={mutationFn:async u=>await s.call("AUTOMATION_RUN",{id:u}),onSuccess:B,onError:Y},t[54]=s,t[55]=L):L=t[55];const w=y(L);let M;return t[56]!==q||t[57]!==j||t[58]!==w||t[59]!==P||t[60]!==v||t[61]!==h||t[62]!==Q?(M={create:q,update:Q,remove:j,triggerAdd:P,triggerRemove:v,triggerRotateToken:h,run:w},t[56]=q,t[57]=j,t[58]=w,t[59]=P,t[60]=v,t[61]=h,t[62]=Q,t[63]=M):M=t[63],M}function Y(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to run automation: ${e}`)}function B(t){t.skipped?m.info(`Automation skipped: ${t.skipped}`):t.error?m.error(`Automation failed: ${t.error}`):m.success("Automation triggered")}function H(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to delete automation: ${e}`)}function W(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to update automation: ${e}`)}function X(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to create automation: ${e}`)}export{st as a,ot as b,it as c,nt as d,at as e,lt as u};
1
+ import{c as D,D as U,K as T,k as I,m as x,d as y,t as m}from"./index-smTHcnUA.js";import{S as z,u as J}from"./use-mcp-client-SQJoN-V8.js";import{u as k}from"./studio-tools-FklJDanw.js";function V(t){if(t.paramsSchema&&typeof t.paramsSchema=="object")return t;const e={};if(Array.isArray(t.params))for(const s of t.params)e[s.name]={type:s.type,description:s.description,enum:s.enum};else t.params&&typeof t.params=="object"&&Object.assign(e,t.params);return{type:t.type,description:t.description,paramsSchema:e}}function st(t){const e=D.c(12),{org:s}=U(),l=t??z;let a;e[0]!==s.id||e[1]!==s.slug||e[2]!==l?(a={connectionId:l,orgId:s.id,orgSlug:s.slug},e[0]=s.id,e[1]=s.slug,e[2]=l,e[3]=a):a=e[3];const i=J(a);let n;e[4]!==t?(n=T.toolCall(t??"","TRIGGER_LIST",""),e[4]=t,e[5]=n):n=e[5];let o;e[6]!==i?(o=async()=>{const d=await i.callTool({name:"TRIGGER_LIST",arguments:{}});return(d.structuredContent??d).triggers.map(V)},e[6]=i,e[7]=o):o=e[7];const c=!!t;let r;return e[8]!==n||e[9]!==o||e[10]!==c?(r={queryKey:n,queryFn:o,enabled:c,staleTime:3e4},e[8]=n,e[9]=o,e[10]=c,e[11]=r):r=e[11],I(r)}function it(t){const e=D.c(9),{org:s}=U(),l=k();let a;e[0]!==s.id||e[1]!==t?(a=T.automations(s.id,t),e[0]=s.id,e[1]=t,e[2]=a):a=e[2];let i;e[3]!==l||e[4]!==t?(i=async()=>(await l.call("AUTOMATION_LIST",t!=null?{virtual_mcp_id:t}:{})).automations,e[3]=l,e[4]=t,e[5]=i):i=e[5];let n;return e[6]!==a||e[7]!==i?(n={queryKey:a,queryFn:i,staleTime:1e4},e[6]=a,e[7]=i,e[8]=n):n=e[8],I(n)}function ot(t){const e=D.c(10),{org:s}=U(),l=k();let a;e[0]!==t||e[1]!==s.id?(a=T.automation(s.id,t),e[0]=t,e[1]=s.id,e[2]=a):a=e[2];let i;e[3]!==t||e[4]!==l?(i=async()=>(await l.call("AUTOMATION_GET",{id:t})).automation,e[3]=t,e[4]=l,e[5]=i):i=e[5];const n=!!t;let o;return e[6]!==a||e[7]!==i||e[8]!==n?(o={queryKey:a,queryFn:i,enabled:n,staleTime:1e4},e[6]=a,e[7]=i,e[8]=n,e[9]=o):o=e[9],I(o)}function at(t,e){const s=D.c(12),{org:l}=U(),a=k();let i;s[0]!==t||s[1]!==l.id||s[2]!==e?(i=T.automationRunStats(l.id,t,JSON.stringify(e??{})),s[0]=t,s[1]=l.id,s[2]=e,s[3]=i):i=s[3];let n;s[4]!==t||s[5]!==e||s[6]!==a?(n=async()=>await a.call("AUTOMATION_RUN_STATS",{automation_id:t,...e?.startDate?{startDate:e.startDate}:{},...e?.endDate?{endDate:e.endDate}:{}}),s[4]=t,s[5]=e,s[6]=a,s[7]=n):n=s[7];const o=!!t;let c;return s[8]!==i||s[9]!==n||s[10]!==o?(c={queryKey:i,queryFn:n,enabled:o,staleTime:3e4},s[8]=i,s[9]=n,s[10]=o,s[11]=c):c=s[11],I(c)}function nt(t){return{name:"New Automation",messages:[],models:{tier:"smart"},temperature:.5,active:!0,virtual_mcp_id:t}}function lt(){const t=D.c(64),{org:e}=U(),s=k(),l=x();let a;t[0]!==e||t[1]!==l?(a=()=>l.invalidateQueries({queryKey:T.automationsAll(e.id)}),t[0]=e,t[1]=l,t[2]=a):a=t[2];const i=a;let n;t[3]!==e||t[4]!==l?(n=u=>l.invalidateQueries({queryKey:T.automation(e.id,u)}),t[3]=e,t[4]=l,t[5]=n):n=t[5];const o=n;let c;t[6]!==s?(c=async u=>await s.call("AUTOMATION_CREATE",u),t[6]=s,t[7]=c):c=t[7];let r;t[8]!==i?(r=()=>{i(),m.success("Automation created successfully")},t[8]=i,t[9]=r):r=t[9];let d;t[10]!==c||t[11]!==r?(d={mutationFn:c,onSuccess:r,onError:X},t[10]=c,t[11]=r,t[12]=d):d=t[12];const q=y(d);let A;t[13]!==s?(A=async u=>await s.call("AUTOMATION_UPDATE",u),t[13]=s,t[14]=A):A=t[14];let p;t[15]!==i||t[16]!==o?(p=(u,f)=>{i(),typeof f.id=="string"&&o(f.id),m.success("Automation updated successfully")},t[15]=i,t[16]=o,t[17]=p):p=t[17];let G;t[18]!==A||t[19]!==p?(G={mutationFn:A,onSuccess:p,onError:W},t[18]=A,t[19]=p,t[20]=G):G=t[20];const Q=y(G);let g;t[21]!==s?(g=async u=>await s.call("AUTOMATION_DELETE",{id:u}),t[21]=s,t[22]=g):g=t[22];let _;t[23]!==i||t[24]!==e||t[25]!==l?(_=(u,f)=>{l.removeQueries({queryKey:T.automation(e.id,f)}),i(),m.success("Automation deleted successfully")},t[23]=i,t[24]=e,t[25]=l,t[26]=_):_=t[26];let $;t[27]!==g||t[28]!==_?($={mutationFn:g,onSuccess:_,onError:H},t[27]=g,t[28]=_,t[29]=$):$=t[29];const j=y($);let S;t[30]!==s?(S=async u=>await s.call("AUTOMATION_TRIGGER_ADD",u),t[30]=s,t[31]=S):S=t[31];let E;t[32]!==i||t[33]!==o?(E=u=>{i(),o(u.automation_id)},t[32]=i,t[33]=o,t[34]=E):E=t[34];let K;t[35]!==S||t[36]!==E?(K={mutationFn:S,onSuccess:E},t[35]=S,t[36]=E,t[37]=K):K=t[37];const P=y(K);let O;t[38]!==s?(O=async u=>await s.call("AUTOMATION_TRIGGER_ROTATE_TOKEN",{trigger_id:u.trigger_id}),t[38]=s,t[39]=O):O=t[39];let R;t[40]!==i||t[41]!==o?(R=(u,f)=>{i(),o(f.automation_id)},t[40]=i,t[41]=o,t[42]=R):R=t[42];let C;t[43]!==O||t[44]!==R?(C={mutationFn:O,onSuccess:R},t[43]=O,t[44]=R,t[45]=C):C=t[45];const h=y(C);let F;t[46]!==s?(F=async u=>await s.call("AUTOMATION_TRIGGER_REMOVE",{trigger_id:u.trigger_id}),t[46]=s,t[47]=F):F=t[47];let N;t[48]!==i||t[49]!==o?(N=(u,f)=>{i(),o(f.automation_id)},t[48]=i,t[49]=o,t[50]=N):N=t[50];let b;t[51]!==F||t[52]!==N?(b={mutationFn:F,onSuccess:N},t[51]=F,t[52]=N,t[53]=b):b=t[53];const v=y(b);let L;t[54]!==s?(L={mutationFn:async u=>await s.call("AUTOMATION_RUN",{id:u}),onSuccess:B,onError:Y},t[54]=s,t[55]=L):L=t[55];const w=y(L);let M;return t[56]!==q||t[57]!==j||t[58]!==w||t[59]!==P||t[60]!==v||t[61]!==h||t[62]!==Q?(M={create:q,update:Q,remove:j,triggerAdd:P,triggerRemove:v,triggerRotateToken:h,run:w},t[56]=q,t[57]=j,t[58]=w,t[59]=P,t[60]=v,t[61]=h,t[62]=Q,t[63]=M):M=t[63],M}function Y(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to run automation: ${e}`)}function B(t){t.skipped?m.info(`Automation skipped: ${t.skipped}`):t.error?m.error(`Automation failed: ${t.error}`):m.success("Automation triggered")}function H(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to delete automation: ${e}`)}function W(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to update automation: ${e}`)}function X(t){const e=t instanceof Error?t.message:String(t);m.error(`Failed to create automation: ${e}`)}export{st as a,ot as b,it as c,nt as d,at as e,lt as u};
@@ -1 +1 @@
1
- import{c as u,D as m,k as g,K as p}from"./index-BHn6e0Se.js";const b=new Set(["owner","admin"]);function d(){const e=u.c(11),{org:r,locator:c}=m();let o;e[0]!==c?(o=p.myCapabilities(c),e[0]=c,e[1]=o):o=e[1];let a;e[2]!==r?(a=async()=>{const f=await fetch(`/api/auth/custom/my-capabilities/${encodeURIComponent(r.slug)}`,{credentials:"include"});if(!f.ok)throw new Error(`my-capabilities request failed: ${f.status}`);return await f.json()},e[2]=r,e[3]=a):a=e[3];let i;e[4]!==o||e[5]!==a?(i={queryKey:o,queryFn:a,staleTime:3e4,retry:2},e[4]=o,e[5]=a,e[6]=i):i=e[6];const{data:s,isLoading:l,isError:n}=g(i);let t;return e[7]!==s||e[8]!==n||e[9]!==l?(t={data:s,loading:l,error:n},e[7]=s,e[8]=n,e[9]=l,e[10]=t):t=e[10],t}function _(e){const r=u.c(8),{data:c,loading:o,error:a}=d();if(o){let t;return r[0]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!0,error:!1,reason:"loading"},r[0]=t):t=r[0],t}if(a){let t;return r[1]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!1,error:!0,reason:"error"},r[1]=t):t=r[1],t}const i=c?.role??null;if(!i){let t;return r[2]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!1,error:!1,reason:"denied"},r[2]=t):t=r[2],t}if(i==="owner"){let t;return r[3]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!0,loading:!1,error:!1,reason:"owner"},r[3]=t):t=r[3],t}if(i==="admin"){let t;return r[4]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!0,loading:!1,error:!1,reason:"admin"},r[4]=t):t=r[4],t}const s=c?.capabilities?.[e]===!0,l=s?"role":"denied";let n;return r[5]!==s||r[6]!==l?(n={granted:s,loading:!1,error:!1,reason:l},r[5]=s,r[6]=l,r[7]=n):n=r[7],n}function S(){const e=u.c(10),{data:r,loading:c,error:o}=d(),a=r?.role??void 0;let i;e[0]!==a?(i=a?b.has(a):!1,e[0]=a,e[1]=i):i=e[1];const s=i;let l;e[2]!==r?.capabilities?(l=r?.capabilities??{},e[2]=r?.capabilities,e[3]=l):l=e[3];const n=l;let t;return e[4]!==o||e[5]!==s||e[6]!==c||e[7]!==a||e[8]!==n?(t={capabilities:n,loading:c,error:o,isPrivileged:s,roleSlug:a},e[4]=o,e[5]=s,e[6]=c,e[7]=a,e[8]=n,e[9]=t):t=e[9],t}export{S as a,_ as u};
1
+ import{c as u,D as m,k as g,K as p}from"./index-smTHcnUA.js";const b=new Set(["owner","admin"]);function d(){const e=u.c(11),{org:r,locator:c}=m();let o;e[0]!==c?(o=p.myCapabilities(c),e[0]=c,e[1]=o):o=e[1];let a;e[2]!==r?(a=async()=>{const f=await fetch(`/api/auth/custom/my-capabilities/${encodeURIComponent(r.slug)}`,{credentials:"include"});if(!f.ok)throw new Error(`my-capabilities request failed: ${f.status}`);return await f.json()},e[2]=r,e[3]=a):a=e[3];let i;e[4]!==o||e[5]!==a?(i={queryKey:o,queryFn:a,staleTime:3e4,retry:2},e[4]=o,e[5]=a,e[6]=i):i=e[6];const{data:s,isLoading:l,isError:n}=g(i);let t;return e[7]!==s||e[8]!==n||e[9]!==l?(t={data:s,loading:l,error:n},e[7]=s,e[8]=n,e[9]=l,e[10]=t):t=e[10],t}function _(e){const r=u.c(8),{data:c,loading:o,error:a}=d();if(o){let t;return r[0]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!0,error:!1,reason:"loading"},r[0]=t):t=r[0],t}if(a){let t;return r[1]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!1,error:!0,reason:"error"},r[1]=t):t=r[1],t}const i=c?.role??null;if(!i){let t;return r[2]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!1,error:!1,reason:"denied"},r[2]=t):t=r[2],t}if(i==="owner"){let t;return r[3]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!0,loading:!1,error:!1,reason:"owner"},r[3]=t):t=r[3],t}if(i==="admin"){let t;return r[4]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!0,loading:!1,error:!1,reason:"admin"},r[4]=t):t=r[4],t}const s=c?.capabilities?.[e]===!0,l=s?"role":"denied";let n;return r[5]!==s||r[6]!==l?(n={granted:s,loading:!1,error:!1,reason:l},r[5]=s,r[6]=l,r[7]=n):n=r[7],n}function S(){const e=u.c(10),{data:r,loading:c,error:o}=d(),a=r?.role??void 0;let i;e[0]!==a?(i=a?b.has(a):!1,e[0]=a,e[1]=i):i=e[1];const s=i;let l;e[2]!==r?.capabilities?(l=r?.capabilities??{},e[2]=r?.capabilities,e[3]=l):l=e[3];const n=l;let t;return e[4]!==o||e[5]!==s||e[6]!==c||e[7]!==a||e[8]!==n?(t={capabilities:n,loading:c,error:o,isPrivileged:s,roleSlug:a},e[4]=o,e[5]=s,e[6]=c,e[7]=a,e[8]=n,e[9]=t):t=e[9],t}export{S as a,_ as u};
@@ -1 +1 @@
1
- import{d as a}from"./differenceInSeconds-NQ4PDo0z.js";import{c as u,r as f}from"./index-BHn6e0Se.js";function p(r){const t=a(new Date,r);return t<60?"<1m":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:t<604800?`${Math.floor(t/86400)}d ago`:t<2592e3?`${Math.floor(t/604800)}w ago`:t<31536e3?`${Math.floor(t/2592e3)}mo ago`:`${Math.floor(t/31536e3)}y ago`}function g(r){if(r==null||r==="")return null;const t=r instanceof Date?r.getTime():Date.parse(r);return Number.isFinite(t)?t:null}function h(r,t){const e=t-r;return e>0?e:0}function M(r){if(r<60)return`${r.toFixed(1)}s`;const t=Math.round(r%60*10)/10,e=t>=60?1:0;return`${Math.floor(r/60)+e}m ${(e?0:t).toFixed(1)}s`}const s=new Map;function i(r){let t=s.get(r);return t||(t={tick:0,subscribers:new Set,intervalId:null},s.set(r,t)),t}function l(r,t){const e=i(r);return e.subscribers.add(t),e.intervalId===null&&(e.intervalId=setInterval(()=>{e.tick+=1;for(const n of e.subscribers)n()},r)),()=>{e.subscribers.delete(t),e.subscribers.size===0&&e.intervalId!==null&&(clearInterval(e.intervalId),e.intervalId=null)}}function $(r){const t=u.c(3),e=r===void 0?6e4:r;let n,o;return t[0]!==e?(n=c=>l(e,c),o=()=>i(e).tick,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),f.useSyncExternalStore(n,o,m)}function m(){return 0}export{M as a,h as c,p as f,g as t,$ as u};
1
+ import{d as a}from"./differenceInSeconds-NQ4PDo0z.js";import{c as u,r as f}from"./index-smTHcnUA.js";function p(r){const t=a(new Date,r);return t<60?"<1m":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:t<604800?`${Math.floor(t/86400)}d ago`:t<2592e3?`${Math.floor(t/604800)}w ago`:t<31536e3?`${Math.floor(t/2592e3)}mo ago`:`${Math.floor(t/31536e3)}y ago`}function g(r){if(r==null||r==="")return null;const t=r instanceof Date?r.getTime():Date.parse(r);return Number.isFinite(t)?t:null}function h(r,t){const e=t-r;return e>0?e:0}function M(r){if(r<60)return`${r.toFixed(1)}s`;const t=Math.round(r%60*10)/10,e=t>=60?1:0;return`${Math.floor(r/60)+e}m ${(e?0:t).toFixed(1)}s`}const s=new Map;function i(r){let t=s.get(r);return t||(t={tick:0,subscribers:new Set,intervalId:null},s.set(r,t)),t}function l(r,t){const e=i(r);return e.subscribers.add(t),e.intervalId===null&&(e.intervalId=setInterval(()=>{e.tick+=1;for(const n of e.subscribers)n()},r)),()=>{e.subscribers.delete(t),e.subscribers.size===0&&e.intervalId!==null&&(clearInterval(e.intervalId),e.intervalId=null)}}function $(r){const t=u.c(3),e=r===void 0?6e4:r;let n,o;return t[0]!==e?(n=c=>l(e,c),o=()=>i(e).tick,t[0]=e,t[1]=n,t[2]=o):(n=t[1],o=t[2]),f.useSyncExternalStore(n,o,m)}function m(){return 0}export{M as a,h as c,p as f,g as t,$ as u};
@@ -1 +1 @@
1
- import{q,c as v,m as b,d as F,aK as x,t as _}from"./index-BHn6e0Se.js";function K(e,s,o){const t=[];if(e?.trim()){const n=e.trim(),r=o.map(a=>({field:[String(a)],operator:"contains",value:n}));r.length===1&&r[0]?t.push(r[0]):r.length>1&&t.push({operator:"or",conditions:r})}if(s&&s.length>0)for(const n of s)t.push({field:[n.column],operator:"eq",value:n.value});if(t.length!==0)return t.length===1?t[0]:{operator:"and",conditions:t}}function Q(e,s,o){const t=e??o,n=s??"desc";return[{field:[String(t)],direction:n}]}function O(e){if(!e||typeof e!="object")throw new Error("Invalid result");if("isError"in e&&e.isError)throw new Error("content"in e&&Array.isArray(e.content)&&e.content[0]?.type==="text"?e.content[0].text:"Unknown error");if("structuredContent"in e)return e.structuredContent;throw new Error("No structured content found")}function k(e,s,o,t){const n=s.toUpperCase(),r=`COLLECTION_${n}_GET`;return{queryKey:x.collectionItem(t,e,"",n,o??""),queryFn:async()=>{if(!o)return{item:null};const a=await t.callTool({name:r,arguments:{id:o}});return O(a)},staleTime:6e4}}function j(e,s,o,t){const n=v.c(5);let r;n[0]!==t||n[1]!==s||n[2]!==o||n[3]!==e?(r=k(e,s,o,t),n[0]=t,n[1]=s,n[2]=o,n[3]=e,n[4]=r):r=n[4];const{data:a}=q(r);return a?.item??null}const D={structuredContent:{items:[]},isError:!1};function z(e,s,o,t={}){const{searchTerm:n,filters:r,sortKey:a,sortDirection:L,searchFields:S=["title","description"],defaultSortKey:h="updated_at",pageSize:g=100,additionalToolArgs:c}=t,l=s.toUpperCase(),f=`COLLECTION_${l}_LIST`,p=K(n,r,S),T=Q(a,L,h),u={...p&&{where:p},...T&&{orderBy:T},limit:g,offset:0,...c},m=JSON.stringify(u),C=x.collectionList(o,e,"",l,m),{data:w}=q({queryKey:C,queryFn:async()=>o?await o.callTool({name:f,arguments:u}):D,staleTime:3e4,retry:!1,select:d=>O(d??{})?.items??[]});return w}function G(e,s,o){const t=v.c(34),n=b();let r;t[0]!==s?(r=s.toUpperCase(),t[0]=s,t[1]=r):r=t[1];const a=r,L=`COLLECTION_${a}_CREATE`,S=`COLLECTION_${a}_UPDATE`,h=`COLLECTION_${a}_DELETE`;let g;t[2]!==n||t[3]!==e||t[4]!==a?(g=()=>{n.invalidateQueries({predicate:E=>{const i=E.queryKey;return i[1]===e&&i[3]==="collection"&&i[4]===a}})},t[2]=n,t[3]=e,t[4]=a,t[5]=g):g=t[5];const c=g;let l;t[6]!==o||t[7]!==L?(l=async E=>{const i=await o.callTool({name:L,arguments:{data:E}});if(i.isError)throw new Error(Array.isArray(i.content)?i.content[0]?.text:String(i.content));return O(i).item},t[6]=o,t[7]=L,t[8]=l):l=t[8];let f;t[9]!==c?(f=()=>{c(),_.success("Item created successfully")},t[9]=c,t[10]=f):f=t[10];let p;t[11]!==l||t[12]!==f?(p={mutationFn:l,onSuccess:f,onError:B},t[11]=l,t[12]=f,t[13]=p):p=t[13];const T=F(p);let u;t[14]!==o||t[15]!==S?(u=async E=>{const{id:i,data:A}=E,U=await o.callTool({name:S,arguments:{id:i,data:A}});return O(U).item},t[14]=o,t[15]=S,t[16]=u):u=t[16];let m;t[17]!==c?(m=()=>{c(),_.success("Item updated successfully")},t[17]=c,t[18]=m):m=t[18];let C;t[19]!==u||t[20]!==m?(C={mutationFn:u,onSuccess:m,onError:R},t[19]=u,t[20]=m,t[21]=C):C=t[21];const w=F(C);let d;t[22]!==o||t[23]!==h?(d=async E=>{const i=await o.callTool({name:h,arguments:{id:E}});return O(i).item.id},t[22]=o,t[23]=h,t[24]=d):d=t[24];let y;t[25]!==c?(y=()=>{c(),_.success("Item deleted successfully")},t[25]=c,t[26]=y):y=t[26];let N;t[27]!==d||t[28]!==y?(N={mutationFn:d,onSuccess:y,onError:P},t[27]=d,t[28]=y,t[29]=N):N=t[29];const $=F(N);let I;return t[30]!==T||t[31]!==$||t[32]!==w?(I={create:T,update:w,delete:$},t[30]=T,t[31]=$,t[32]=w,t[33]=I):I=t[33],I}function P(e){const s=e instanceof Error?e.message:String(e);_.error(`Failed to delete item: ${s}`)}function R(e){const s=e instanceof Error?e.message:String(e);_.error(`Failed to update item: ${s}`)}function B(e){const s=e instanceof Error?e.message:String(e);_.error(`Failed to create item: ${s}`)}export{G as a,z as b,k as c,j as u};
1
+ import{q,c as v,m as b,d as F,aK as x,t as _}from"./index-smTHcnUA.js";function K(e,s,o){const t=[];if(e?.trim()){const n=e.trim(),r=o.map(a=>({field:[String(a)],operator:"contains",value:n}));r.length===1&&r[0]?t.push(r[0]):r.length>1&&t.push({operator:"or",conditions:r})}if(s&&s.length>0)for(const n of s)t.push({field:[n.column],operator:"eq",value:n.value});if(t.length!==0)return t.length===1?t[0]:{operator:"and",conditions:t}}function Q(e,s,o){const t=e??o,n=s??"desc";return[{field:[String(t)],direction:n}]}function O(e){if(!e||typeof e!="object")throw new Error("Invalid result");if("isError"in e&&e.isError)throw new Error("content"in e&&Array.isArray(e.content)&&e.content[0]?.type==="text"?e.content[0].text:"Unknown error");if("structuredContent"in e)return e.structuredContent;throw new Error("No structured content found")}function k(e,s,o,t){const n=s.toUpperCase(),r=`COLLECTION_${n}_GET`;return{queryKey:x.collectionItem(t,e,"",n,o??""),queryFn:async()=>{if(!o)return{item:null};const a=await t.callTool({name:r,arguments:{id:o}});return O(a)},staleTime:6e4}}function j(e,s,o,t){const n=v.c(5);let r;n[0]!==t||n[1]!==s||n[2]!==o||n[3]!==e?(r=k(e,s,o,t),n[0]=t,n[1]=s,n[2]=o,n[3]=e,n[4]=r):r=n[4];const{data:a}=q(r);return a?.item??null}const D={structuredContent:{items:[]},isError:!1};function z(e,s,o,t={}){const{searchTerm:n,filters:r,sortKey:a,sortDirection:L,searchFields:S=["title","description"],defaultSortKey:h="updated_at",pageSize:g=100,additionalToolArgs:c}=t,l=s.toUpperCase(),f=`COLLECTION_${l}_LIST`,p=K(n,r,S),T=Q(a,L,h),u={...p&&{where:p},...T&&{orderBy:T},limit:g,offset:0,...c},m=JSON.stringify(u),C=x.collectionList(o,e,"",l,m),{data:w}=q({queryKey:C,queryFn:async()=>o?await o.callTool({name:f,arguments:u}):D,staleTime:3e4,retry:!1,select:d=>O(d??{})?.items??[]});return w}function G(e,s,o){const t=v.c(34),n=b();let r;t[0]!==s?(r=s.toUpperCase(),t[0]=s,t[1]=r):r=t[1];const a=r,L=`COLLECTION_${a}_CREATE`,S=`COLLECTION_${a}_UPDATE`,h=`COLLECTION_${a}_DELETE`;let g;t[2]!==n||t[3]!==e||t[4]!==a?(g=()=>{n.invalidateQueries({predicate:E=>{const i=E.queryKey;return i[1]===e&&i[3]==="collection"&&i[4]===a}})},t[2]=n,t[3]=e,t[4]=a,t[5]=g):g=t[5];const c=g;let l;t[6]!==o||t[7]!==L?(l=async E=>{const i=await o.callTool({name:L,arguments:{data:E}});if(i.isError)throw new Error(Array.isArray(i.content)?i.content[0]?.text:String(i.content));return O(i).item},t[6]=o,t[7]=L,t[8]=l):l=t[8];let f;t[9]!==c?(f=()=>{c(),_.success("Item created successfully")},t[9]=c,t[10]=f):f=t[10];let p;t[11]!==l||t[12]!==f?(p={mutationFn:l,onSuccess:f,onError:B},t[11]=l,t[12]=f,t[13]=p):p=t[13];const T=F(p);let u;t[14]!==o||t[15]!==S?(u=async E=>{const{id:i,data:A}=E,U=await o.callTool({name:S,arguments:{id:i,data:A}});return O(U).item},t[14]=o,t[15]=S,t[16]=u):u=t[16];let m;t[17]!==c?(m=()=>{c(),_.success("Item updated successfully")},t[17]=c,t[18]=m):m=t[18];let C;t[19]!==u||t[20]!==m?(C={mutationFn:u,onSuccess:m,onError:R},t[19]=u,t[20]=m,t[21]=C):C=t[21];const w=F(C);let d;t[22]!==o||t[23]!==h?(d=async E=>{const i=await o.callTool({name:h,arguments:{id:E}});return O(i).item.id},t[22]=o,t[23]=h,t[24]=d):d=t[24];let y;t[25]!==c?(y=()=>{c(),_.success("Item deleted successfully")},t[25]=c,t[26]=y):y=t[26];let N;t[27]!==d||t[28]!==y?(N={mutationFn:d,onSuccess:y,onError:P},t[27]=d,t[28]=y,t[29]=N):N=t[29];const $=F(N);let I;return t[30]!==T||t[31]!==$||t[32]!==w?(I={create:T,update:w,delete:$},t[30]=T,t[31]=$,t[32]=w,t[33]=I):I=t[33],I}function P(e){const s=e instanceof Error?e.message:String(e);_.error(`Failed to delete item: ${s}`)}function R(e){const s=e instanceof Error?e.message:String(e);_.error(`Failed to update item: ${s}`)}function B(e){const s=e instanceof Error?e.message:String(e);_.error(`Failed to create item: ${s}`)}export{G as a,z as b,k as c,j as u};
@@ -1 +1 @@
1
- import{c as f,D as C}from"./index-BHn6e0Se.js";import{a as N,b as O,u as S}from"./use-collections-ZFJu8_05.js";import{S as I,u as m}from"./use-mcp-client-BbksZMyI.js";function E(t){const o=f.c(20);let i;o[0]!==t?(i=t===void 0?{}:t,o[0]=t,o[1]=i):i=o[1];const n=i;let l,s,c,d;o[2]!==n?({binding:l,includeVirtual:c,slug:d,...s}=n,o[2]=n,o[3]=l,o[4]=s,o[5]=c,o[6]=d):(l=o[3],s=o[4],c=o[5],d=o[6]);let e;o[7]!==l||o[8]!==s.additionalToolArgs||o[9]!==c||o[10]!==d?(e={...s.additionalToolArgs},l!==void 0&&(e.binding=l),c!==void 0&&(e.include_virtual=c),d!==void 0&&(e.slug=d),o[7]=l,o[8]=s.additionalToolArgs,o[9]=c,o[10]=d,o[11]=e):e=o[11];let r;o[12]!==e?(r=Object.keys(e).length>0?e:void 0,o[12]=e,o[13]=r):r=o[13];let g;o[14]!==s||o[15]!==r?(g={...s,additionalToolArgs:r},o[14]=s,o[15]=r,o[16]=g):g=o[16];const p=g,{org:u}=C();let a;o[17]!==u.id||o[18]!==u.slug?(a={connectionId:I,orgId:u.id,orgSlug:u.slug},o[17]=u.id,o[18]=u.slug,o[19]=a):a=o[19];const A=m(a);return O(u.id,"CONNECTIONS",A,p)}function _(t){const o=f.c(3),{org:i}=C();let n;o[0]!==i.id||o[1]!==i.slug?(n={connectionId:I,orgId:i.id,orgSlug:i.slug},o[0]=i.id,o[1]=i.slug,o[2]=n):n=o[2];const l=m(n);return S(i.id,"CONNECTIONS",t,l)}function x(){const t=f.c(3),{org:o}=C();let i;t[0]!==o.id||t[1]!==o.slug?(i={connectionId:I,orgId:o.id,orgSlug:o.slug},t[0]=o.id,t[1]=o.slug,t[2]=i):i=t[2];const n=m(i);return N(o.id,"CONNECTIONS",n)}export{_ as a,x as b,E as u};
1
+ import{c as f,D as C}from"./index-smTHcnUA.js";import{a as N,b as O,u as S}from"./use-collections-Dh2p4suc.js";import{S as I,u as m}from"./use-mcp-client-SQJoN-V8.js";function E(t){const o=f.c(20);let i;o[0]!==t?(i=t===void 0?{}:t,o[0]=t,o[1]=i):i=o[1];const n=i;let l,s,c,d;o[2]!==n?({binding:l,includeVirtual:c,slug:d,...s}=n,o[2]=n,o[3]=l,o[4]=s,o[5]=c,o[6]=d):(l=o[3],s=o[4],c=o[5],d=o[6]);let e;o[7]!==l||o[8]!==s.additionalToolArgs||o[9]!==c||o[10]!==d?(e={...s.additionalToolArgs},l!==void 0&&(e.binding=l),c!==void 0&&(e.include_virtual=c),d!==void 0&&(e.slug=d),o[7]=l,o[8]=s.additionalToolArgs,o[9]=c,o[10]=d,o[11]=e):e=o[11];let r;o[12]!==e?(r=Object.keys(e).length>0?e:void 0,o[12]=e,o[13]=r):r=o[13];let g;o[14]!==s||o[15]!==r?(g={...s,additionalToolArgs:r},o[14]=s,o[15]=r,o[16]=g):g=o[16];const p=g,{org:u}=C();let a;o[17]!==u.id||o[18]!==u.slug?(a={connectionId:I,orgId:u.id,orgSlug:u.slug},o[17]=u.id,o[18]=u.slug,o[19]=a):a=o[19];const A=m(a);return O(u.id,"CONNECTIONS",A,p)}function _(t){const o=f.c(3),{org:i}=C();let n;o[0]!==i.id||o[1]!==i.slug?(n={connectionId:I,orgId:i.id,orgSlug:i.slug},o[0]=i.id,o[1]=i.slug,o[2]=n):n=o[2];const l=m(n);return S(i.id,"CONNECTIONS",t,l)}function x(){const t=f.c(3),{org:o}=C();let i;t[0]!==o.id||t[1]!==o.slug?(i={connectionId:I,orgId:o.id,orgSlug:o.slug},t[0]=o.id,t[1]=o.slug,t[2]=i):i=t[2];const n=m(i);return N(o.id,"CONNECTIONS",n)}export{_ as a,x as b,E as u};
@@ -1 +1 @@
1
- import{c as i,r as n}from"./index-BHn6e0Se.js";function p(){const e=i.c(3),[s,a]=n.useState(!1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async c=>{await navigator.clipboard.writeText(c),a(!0),setTimeout(()=>a(!1),2e3)},e[0]=t):t=e[0];const r=t;let o;return e[1]!==s?(o={handleCopy:r,copied:s},e[1]=s,e[2]=o):o=e[2],o}export{p as u};
1
+ import{c as i,r as n}from"./index-smTHcnUA.js";function p(){const e=i.c(3),[s,a]=n.useState(!1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async c=>{await navigator.clipboard.writeText(c),a(!0),setTimeout(()=>a(!1),2e3)},e[0]=t):t=e[0];const r=t;let o;return e[1]!==s?(o={handleCopy:r,copied:s},e[1]=s,e[2]=o):o=e[2],o}export{p as u};
@@ -1 +1 @@
1
- import{c as g}from"./index-BHn6e0Se.js";import{b as f}from"./use-virtual-mcp-RUDrgBDG.js";import{m}from"./use-navigate-to-agent-BTBF1w74.js";function A(i){const e=g.c(9);let n;e[0]!==i?(n=i===void 0?{}:i,e[0]=i,e[1]=n):n=e[1];const d=n,{navigateOnCreate:u}=d,c=u===void 0?!1:u,t=f(),r=m();let s;e[2]!==t.create||e[3]!==c||e[4]!==r?(s=async()=>{const l=await t.create.mutateAsync({title:"New Agent",description:"AI-driven assistant designed to handle specific tasks",status:"active",connections:[],pinned:!1});return c&&r(l.id,{search:{main:"instructions"}}),{id:l.id,virtualMcp:l}},e[2]=t.create,e[3]=c,e[4]=r,e[5]=s):s=e[5];const o=s;let a;return e[6]!==t.create.isPending||e[7]!==o?(a={createVirtualMCP:o,isCreating:t.create.isPending},e[6]=t.create.isPending,e[7]=o,e[8]=a):a=e[8],a}export{A as u};
1
+ import{c as g}from"./index-smTHcnUA.js";import{b as f}from"./use-virtual-mcp-nCKsVOOs.js";import{m}from"./use-navigate-to-agent-DQghLhaf.js";function A(i){const e=g.c(9);let n;e[0]!==i?(n=i===void 0?{}:i,e[0]=i,e[1]=n):n=e[1];const d=n,{navigateOnCreate:u}=d,c=u===void 0?!1:u,t=f(),r=m();let s;e[2]!==t.create||e[3]!==c||e[4]!==r?(s=async()=>{const l=await t.create.mutateAsync({title:"New Agent",description:"AI-driven assistant designed to handle specific tasks",status:"active",connections:[],pinned:!1});return c&&r(l.id,{search:{main:"instructions"}}),{id:l.id,virtualMcp:l}},e[2]=t.create,e[3]=c,e[4]=r,e[5]=s):s=e[5];const o=s;let a;return e[6]!==t.create.isPending||e[7]!==o?(a={createVirtualMCP:o,isCreating:t.create.isPending},e[6]=t.create.isPending,e[7]=o,e[8]=a):a=e[8],a}export{A as u};
@@ -1 +1 @@
1
- import{r as u}from"./index-BHn6e0Se.js";function l({save:t,delayMs:n=1e3}){const e=u.useRef(t);e.current=t;const r=u.useRef(null),c=()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,e.current()},n)},o=()=>(r.current&&(clearTimeout(r.current),r.current=null),e.current());return u.useEffect(()=>()=>{r.current&&(clearTimeout(r.current),r.current=null,e.current())},[]),{schedule:c,flush:o}}export{l as u};
1
+ import{r as u}from"./index-smTHcnUA.js";function l({save:t,delayMs:n=1e3}){const e=u.useRef(t);e.current=t;const r=u.useRef(null),c=()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,e.current()},n)},o=()=>(r.current&&(clearTimeout(r.current),r.current=null),e.current());return u.useEffect(()=>()=>{r.current&&(clearTimeout(r.current),r.current=null,e.current())},[]),{schedule:c,flush:o}}export{l as u};
@@ -1 +1 @@
1
- import{c as H,j as t,D as Q,m as J,r as M,t as F,be as P,bf as Y}from"./index-BHn6e0Se.js";import{c as I,b as L,d as R,A as q,e as U,g as k,a as K,f as $}from"./alert-dialog-C6EVgeBX.js";import{u as z}from"./studio-tools-By-RAUnB.js";function W(T){const e=H.c(41),{deleteState:s,cancelDelete:c,confirmDelete:i,confirmForceDelete:l}=T,N=s.mode==="deleting";let r;e[0]!==c?(r=w=>{w||c()},e[0]=c,e[1]=r):r=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(I,{children:"Delete Connection?"}),e[2]=f):f=e[2];const S=s.mode==="deleting"&&s.connection.title;let u;e[3]!==S?(u=t.jsxs(L,{children:[f,t.jsxs(R,{children:["This action cannot be undone. This will permanently delete"," ",t.jsx("span",{className:"font-medium text-foreground",children:S}),"."]})]}),e[3]=S,e[4]=u):u=e[4];let E;e[5]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(q,{children:"Cancel"}),e[5]=E):E=e[5];let h;e[6]!==i?(h=t.jsxs(U,{children:[E,t.jsx(k,{onClick:i,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[6]=i,e[7]=h):h=e[7];let n;e[8]!==u||e[9]!==h?(n=t.jsxs(K,{children:[u,h]}),e[8]=u,e[9]=h,e[10]=n):n=e[10];let o;e[11]!==N||e[12]!==r||e[13]!==n?(o=t.jsx($,{open:N,onOpenChange:r,children:n}),e[11]=N,e[12]=r,e[13]=n,e[14]=o):o=e[14];const a=s.mode==="force-deleting";let d;e[15]!==c?(d=w=>{w||c()},e[15]=c,e[16]=d):d=e[16];let m;e[17]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(I,{children:"Connection Used by Agents"}),e[17]=m):m=e[17];const _=s.mode==="force-deleting"&&s.connection.title;let g;e[18]!==_?(g=t.jsx("span",{className:"font-medium text-foreground",children:_}),e[18]=_,e[19]=g):g=e[19];const A=s.mode==="force-deleting"&&s.agentNames;let x;e[20]!==A?(x=t.jsx("span",{className:"font-medium text-foreground",children:A}),e[20]=A,e[21]=x):x=e[21];let C;e[22]!==g||e[23]!==x?(C=t.jsxs("p",{children:["The connection"," ",g," ","is currently used by the following agent(s):"," ",x,"."]}),e[22]=g,e[23]=x,e[24]=C):C=e[24];let O;e[25]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx("p",{className:"mt-2",children:"Deleting this connection will remove it from those agents, which may impact existing workflows that depend on them."}),e[25]=O):O=e[25];let D;e[26]!==C?(D=t.jsxs(L,{children:[m,t.jsx(R,{asChild:!0,children:t.jsxs("div",{children:[C,O]})})]}),e[26]=C,e[27]=D):D=e[27];let b;e[28]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(q,{children:"Cancel"}),e[28]=b):b=e[28];let j;e[29]!==l?(j=t.jsxs(U,{children:[b,t.jsx(k,{onClick:l,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Anyway"})]}),e[29]=l,e[30]=j):j=e[30];let p;e[31]!==D||e[32]!==j?(p=t.jsxs(K,{children:[D,j]}),e[31]=D,e[32]=j,e[33]=p):p=e[33];let y;e[34]!==a||e[35]!==d||e[36]!==p?(y=t.jsx($,{open:a,onOpenChange:d,children:p}),e[34]=a,e[35]=d,e[36]=p,e[37]=y):y=e[37];let v;return e[38]!==y||e[39]!==o?(v=t.jsxs(t.Fragment,{children:[o,y]}),e[38]=y,e[39]=o,e[40]=v):v=e[40],v}function X({onSuccess:T}={}){const{org:e}=Q(),s=J(),c=z(),[i,l]=M.useState({mode:"idle"}),N=()=>{s.invalidateQueries({predicate:n=>{const o=n.queryKey;return o[1]===e.id&&o[3]==="collection"&&o[4]==="CONNECTIONS"}})},r=n=>{P(n),s.invalidateQueries({predicate:o=>o.queryKey[1]===Y&&o.queryKey[3]===n})},f=n=>{N(),r(n),F.success("Connection deleted successfully"),l({mode:"idle"}),T?.()};return{deleteState:i,requestDelete:n=>{l({mode:"deleting",connection:n})},cancelDelete:()=>{l({mode:"idle"})},confirmDelete:async()=>{if(i.mode!=="deleting")return;const n=i.connection;l({mode:"idle"});try{await c.call("COLLECTION_CONNECTIONS_DELETE",{id:n.id}),f(n.id)}catch(o){const a=o instanceof Error?o.message:String(o),d=a.replace(/^Error:\s*/,"");try{const m=JSON.parse(d);if(m.code==="CONNECTION_IN_USE"&&m.agentNames){l({mode:"force-deleting",connection:n,agentNames:m.agentNames.map(_=>`"${_}"`).join(", ")});return}}catch{}F.error(`Failed to delete connection: ${a}`)}},confirmForceDelete:async()=>{if(i.mode!=="force-deleting")return;const n=i.connection.id;l({mode:"idle"});try{await c.call("COLLECTION_CONNECTIONS_DELETE",{id:n,force:!0}),f(n)}catch(o){const a=o instanceof Error?o.message:String(o);F.error(`Failed to delete connection: ${a}`)}}}}export{W as D,X as u};
1
+ import{c as H,j as t,D as Q,m as J,r as M,t as F,be as P,bf as Y}from"./index-smTHcnUA.js";import{c as I,b as L,d as R,A as q,e as U,g as k,a as K,f as $}from"./alert-dialog-Bi8YxknI.js";import{u as z}from"./studio-tools-FklJDanw.js";function W(T){const e=H.c(41),{deleteState:s,cancelDelete:c,confirmDelete:i,confirmForceDelete:l}=T,N=s.mode==="deleting";let r;e[0]!==c?(r=w=>{w||c()},e[0]=c,e[1]=r):r=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(I,{children:"Delete Connection?"}),e[2]=f):f=e[2];const S=s.mode==="deleting"&&s.connection.title;let u;e[3]!==S?(u=t.jsxs(L,{children:[f,t.jsxs(R,{children:["This action cannot be undone. This will permanently delete"," ",t.jsx("span",{className:"font-medium text-foreground",children:S}),"."]})]}),e[3]=S,e[4]=u):u=e[4];let E;e[5]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(q,{children:"Cancel"}),e[5]=E):E=e[5];let h;e[6]!==i?(h=t.jsxs(U,{children:[E,t.jsx(k,{onClick:i,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[6]=i,e[7]=h):h=e[7];let n;e[8]!==u||e[9]!==h?(n=t.jsxs(K,{children:[u,h]}),e[8]=u,e[9]=h,e[10]=n):n=e[10];let o;e[11]!==N||e[12]!==r||e[13]!==n?(o=t.jsx($,{open:N,onOpenChange:r,children:n}),e[11]=N,e[12]=r,e[13]=n,e[14]=o):o=e[14];const a=s.mode==="force-deleting";let d;e[15]!==c?(d=w=>{w||c()},e[15]=c,e[16]=d):d=e[16];let m;e[17]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(I,{children:"Connection Used by Agents"}),e[17]=m):m=e[17];const _=s.mode==="force-deleting"&&s.connection.title;let g;e[18]!==_?(g=t.jsx("span",{className:"font-medium text-foreground",children:_}),e[18]=_,e[19]=g):g=e[19];const A=s.mode==="force-deleting"&&s.agentNames;let x;e[20]!==A?(x=t.jsx("span",{className:"font-medium text-foreground",children:A}),e[20]=A,e[21]=x):x=e[21];let C;e[22]!==g||e[23]!==x?(C=t.jsxs("p",{children:["The connection"," ",g," ","is currently used by the following agent(s):"," ",x,"."]}),e[22]=g,e[23]=x,e[24]=C):C=e[24];let O;e[25]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx("p",{className:"mt-2",children:"Deleting this connection will remove it from those agents, which may impact existing workflows that depend on them."}),e[25]=O):O=e[25];let D;e[26]!==C?(D=t.jsxs(L,{children:[m,t.jsx(R,{asChild:!0,children:t.jsxs("div",{children:[C,O]})})]}),e[26]=C,e[27]=D):D=e[27];let b;e[28]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(q,{children:"Cancel"}),e[28]=b):b=e[28];let j;e[29]!==l?(j=t.jsxs(U,{children:[b,t.jsx(k,{onClick:l,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Anyway"})]}),e[29]=l,e[30]=j):j=e[30];let p;e[31]!==D||e[32]!==j?(p=t.jsxs(K,{children:[D,j]}),e[31]=D,e[32]=j,e[33]=p):p=e[33];let y;e[34]!==a||e[35]!==d||e[36]!==p?(y=t.jsx($,{open:a,onOpenChange:d,children:p}),e[34]=a,e[35]=d,e[36]=p,e[37]=y):y=e[37];let v;return e[38]!==y||e[39]!==o?(v=t.jsxs(t.Fragment,{children:[o,y]}),e[38]=y,e[39]=o,e[40]=v):v=e[40],v}function X({onSuccess:T}={}){const{org:e}=Q(),s=J(),c=z(),[i,l]=M.useState({mode:"idle"}),N=()=>{s.invalidateQueries({predicate:n=>{const o=n.queryKey;return o[1]===e.id&&o[3]==="collection"&&o[4]==="CONNECTIONS"}})},r=n=>{P(n),s.invalidateQueries({predicate:o=>o.queryKey[1]===Y&&o.queryKey[3]===n})},f=n=>{N(),r(n),F.success("Connection deleted successfully"),l({mode:"idle"}),T?.()};return{deleteState:i,requestDelete:n=>{l({mode:"deleting",connection:n})},cancelDelete:()=>{l({mode:"idle"})},confirmDelete:async()=>{if(i.mode!=="deleting")return;const n=i.connection;l({mode:"idle"});try{await c.call("COLLECTION_CONNECTIONS_DELETE",{id:n.id}),f(n.id)}catch(o){const a=o instanceof Error?o.message:String(o),d=a.replace(/^Error:\s*/,"");try{const m=JSON.parse(d);if(m.code==="CONNECTION_IN_USE"&&m.agentNames){l({mode:"force-deleting",connection:n,agentNames:m.agentNames.map(_=>`"${_}"`).join(", ")});return}}catch{}F.error(`Failed to delete connection: ${a}`)}},confirmForceDelete:async()=>{if(i.mode!=="force-deleting")return;const n=i.connection.id;l({mode:"idle"});try{await c.call("COLLECTION_CONNECTIONS_DELETE",{id:n,force:!0}),f(n)}catch(o){const a=o instanceof Error?o.message:String(o);F.error(`Failed to delete connection: ${a}`)}}}}export{W as D,X as u};
@@ -1 +1 @@
1
- import{c as u,D as c,K as r,q as y,m as C,d,k as F}from"./index-BHn6e0Se.js";import{u as f}from"./studio-tools-By-RAUnB.js";function E(){const e=u.c(7),{org:n}=c(),o=f();let i;e[0]!==n.id?(i=r.fileConfigs(n.id),e[0]=n.id,e[1]=i):i=e[1];let t;e[2]!==o?(t=()=>o.call("FILE_CONFIG_LIST",{}),e[2]=o,e[3]=t):t=e[3];let s;e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6];const{data:l}=y(s);return l.configs}function I(){const e=u.c(7),{org:n}=c(),o=f();let i;e[0]!==n.id?(i=r.fileConfigs(n.id),e[0]=n.id,e[1]=i):i=e[1];let t;e[2]!==o?(t=()=>o.call("FILE_CONFIG_LIST",{}),e[2]=o,e[3]=t):t=e[3];let s;return e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6],F(s)}function q(){const e=u.c(8),{org:n}=c(),o=f(),i=C();let t;e[0]!==o?(t=a=>o.call("FILE_CONFIG_CREATE",{...a}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:r.fileConfigs(n.id)})},e[2]=n,e[3]=i,e[4]=s):s=e[4];let l;return e[5]!==t||e[6]!==s?(l={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=l):l=e[7],d(l)}function _(){const e=u.c(8),{org:n}=c(),o=f(),i=C();let t;e[0]!==o?(t=a=>o.call("FILE_CONFIG_DELETE",{id:a}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:r.fileConfigs(n.id)})},e[2]=n,e[3]=i,e[4]=s):s=e[4];let l;return e[5]!==t||e[6]!==s?(l={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=l):l=e[7],d(l)}export{I as a,q as b,_ as c,E as u};
1
+ import{c as u,D as c,K as r,q as y,m as C,d,k as F}from"./index-smTHcnUA.js";import{u as f}from"./studio-tools-FklJDanw.js";function E(){const e=u.c(7),{org:n}=c(),o=f();let i;e[0]!==n.id?(i=r.fileConfigs(n.id),e[0]=n.id,e[1]=i):i=e[1];let t;e[2]!==o?(t=()=>o.call("FILE_CONFIG_LIST",{}),e[2]=o,e[3]=t):t=e[3];let s;e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6];const{data:l}=y(s);return l.configs}function I(){const e=u.c(7),{org:n}=c(),o=f();let i;e[0]!==n.id?(i=r.fileConfigs(n.id),e[0]=n.id,e[1]=i):i=e[1];let t;e[2]!==o?(t=()=>o.call("FILE_CONFIG_LIST",{}),e[2]=o,e[3]=t):t=e[3];let s;return e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6],F(s)}function q(){const e=u.c(8),{org:n}=c(),o=f(),i=C();let t;e[0]!==o?(t=a=>o.call("FILE_CONFIG_CREATE",{...a}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:r.fileConfigs(n.id)})},e[2]=n,e[3]=i,e[4]=s):s=e[4];let l;return e[5]!==t||e[6]!==s?(l={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=l):l=e[7],d(l)}function _(){const e=u.c(8),{org:n}=c(),o=f(),i=C();let t;e[0]!==o?(t=a=>o.call("FILE_CONFIG_DELETE",{id:a}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:r.fileConfigs(n.id)})},e[2]=n,e[3]=i,e[4]=s):s=e[4];let l;return e[5]!==t||e[6]!==s?(l={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=l):l=e[7],d(l)}export{I as a,q as b,_ as c,E as u};
@@ -1 +1 @@
1
- import{as as d,dE as l,dF as v,r as i}from"./index-BHn6e0Se.js";var p=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,u=super.createResult(e,t),{isFetching:r,isRefetching:h,isError:a,isRefetchError:g}=u,s=n.fetchMeta?.fetchMore?.direction,o=a&&s==="forward",P=r&&s==="forward",c=a&&s==="backward",f=r&&s==="backward";return{...u,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:v(t,n.data),hasPreviousPage:l(t,n.data),isFetchNextPageError:o,isFetchingNextPage:P,isFetchPreviousPageError:c,isFetchingPreviousPage:f,isRefetchError:g&&!o&&!c,isRefetching:h&&!P&&!f}}};function b(e,t,n=!1,u){const r=i.useRef(null),h=i.useRef(null),a=i.useRef(e),g=i.useRef(t),s=i.useRef(n),o=i.useRef(u);a.current=e,g.current=t,s.current=n,o.current=u;const[P]=i.useState(()=>c=>{h.current=c,r.current&&(r.current.disconnect(),r.current=null),c&&queueMicrotask(()=>{if(h.current!==c)return;const f=new IntersectionObserver(R=>{R[0]?.isIntersecting&&g.current&&!s.current&&a.current()},{root:o.current?.current??null,rootMargin:"0px 0px 200px 0px"});f.observe(c),r.current=f})});return P}export{p as I,b as u};
1
+ import{as as d,dE as l,dF as v,r as i}from"./index-smTHcnUA.js";var p=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,u=super.createResult(e,t),{isFetching:r,isRefetching:h,isError:a,isRefetchError:g}=u,s=n.fetchMeta?.fetchMore?.direction,o=a&&s==="forward",P=r&&s==="forward",c=a&&s==="backward",f=r&&s==="backward";return{...u,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:v(t,n.data),hasPreviousPage:l(t,n.data),isFetchNextPageError:o,isFetchingNextPage:P,isFetchPreviousPageError:c,isFetchingPreviousPage:f,isRefetchError:g&&!o&&!c,isRefetching:h&&!P&&!f}}};function b(e,t,n=!1,u){const r=i.useRef(null),h=i.useRef(null),a=i.useRef(e),g=i.useRef(t),s=i.useRef(n),o=i.useRef(u);a.current=e,g.current=t,s.current=n,o.current=u;const[P]=i.useState(()=>c=>{h.current=c,r.current&&(r.current.disconnect(),r.current=null),c&&queueMicrotask(()=>{if(h.current!==c)return;const f=new IntersectionObserver(R=>{R[0]?.isIntersecting&&g.current&&!s.current&&a.current()},{root:o.current?.current??null,rootMargin:"0px 0px 200px 0px"});f.observe(c),r.current=f})});return P}export{p as I,b as u};
@@ -1 +1 @@
1
- import{c as g,D as N,K as y,k as _,m as A,d as I,t as q}from"./index-BHn6e0Se.js";import{a as S}from"./use-capability-DTqJ4XUv.js";import{u as O}from"./studio-tools-By-RAUnB.js";function F(){const e=g.c(10),{org:r}=N(),u=O(),{capabilities:a,isPrivileged:c}=S(),d=c||!!a["members:manage"];let t;e[0]!==r.id?(t=y.organizationJoinRequests(r.id),e[0]=r.id,e[1]=t):t=e[1];let s;e[2]!==u?(s=()=>u.call("ORGANIZATION_JOIN_REQUEST_LIST",{}),e[2]=u,e[3]=s):s=e[3];const i=!!r.id&&d;let n;e[4]!==t||e[5]!==s||e[6]!==i?(n={queryKey:t,queryFn:s,enabled:i},e[4]=t,e[5]=s,e[6]=i,e[7]=n):n=e[7];const{data:l}=_(n);let o;return e[8]!==l?.requests?(o=l?.requests??[],e[8]=l?.requests,e[9]=o):o=e[9],o}function K(){const e=g.c(21),{org:r,locator:u}=N(),a=O(),c=A();let d;e[0]!==u||e[1]!==r||e[2]!==c?(d=()=>{c.invalidateQueries({queryKey:y.organizationJoinRequests(r.id)}),c.invalidateQueries({queryKey:y.members(u)})},e[0]=u,e[1]=r,e[2]=c,e[3]=d):d=e[3];const t=d;let s;e[4]!==a?(s=R=>a.call("ORGANIZATION_JOIN_REQUEST_APPROVE",{requestId:R}),e[4]=a,e[5]=s):s=e[5];let i;e[6]!==t?(i=()=>{t(),q.success("Request approved")},e[6]=t,e[7]=i):i=e[7];let n;e[8]!==s||e[9]!==i?(n={mutationFn:s,onSuccess:i,onError:v},e[8]=s,e[9]=i,e[10]=n):n=e[10];const l=I(n);let o;e[11]!==a?(o=R=>a.call("ORGANIZATION_JOIN_REQUEST_DENY",{requestId:R}),e[11]=a,e[12]=o):o=e[12];let f;e[13]!==t?(f=()=>{t(),q.success("Request denied")},e[13]=t,e[14]=f):f=e[14];let m;e[15]!==o||e[16]!==f?(m={mutationFn:o,onSuccess:f,onError:T},e[15]=o,e[16]=f,e[17]=m):m=e[17];const E=I(m);let p;return e[18]!==l||e[19]!==E?(p={approve:l,deny:E},e[18]=l,e[19]=E,e[20]=p):p=e[20],p}function T(e){return q.error(e instanceof Error?e.message:"Failed to deny")}function v(e){return q.error(e instanceof Error?e.message:"Failed to approve")}export{F as a,K as u};
1
+ import{c as g,D as N,K as y,k as _,m as A,d as I,t as q}from"./index-smTHcnUA.js";import{a as S}from"./use-capability-BbL91qJb.js";import{u as O}from"./studio-tools-FklJDanw.js";function F(){const e=g.c(10),{org:r}=N(),u=O(),{capabilities:a,isPrivileged:c}=S(),d=c||!!a["members:manage"];let t;e[0]!==r.id?(t=y.organizationJoinRequests(r.id),e[0]=r.id,e[1]=t):t=e[1];let s;e[2]!==u?(s=()=>u.call("ORGANIZATION_JOIN_REQUEST_LIST",{}),e[2]=u,e[3]=s):s=e[3];const i=!!r.id&&d;let n;e[4]!==t||e[5]!==s||e[6]!==i?(n={queryKey:t,queryFn:s,enabled:i},e[4]=t,e[5]=s,e[6]=i,e[7]=n):n=e[7];const{data:l}=_(n);let o;return e[8]!==l?.requests?(o=l?.requests??[],e[8]=l?.requests,e[9]=o):o=e[9],o}function K(){const e=g.c(21),{org:r,locator:u}=N(),a=O(),c=A();let d;e[0]!==u||e[1]!==r||e[2]!==c?(d=()=>{c.invalidateQueries({queryKey:y.organizationJoinRequests(r.id)}),c.invalidateQueries({queryKey:y.members(u)})},e[0]=u,e[1]=r,e[2]=c,e[3]=d):d=e[3];const t=d;let s;e[4]!==a?(s=R=>a.call("ORGANIZATION_JOIN_REQUEST_APPROVE",{requestId:R}),e[4]=a,e[5]=s):s=e[5];let i;e[6]!==t?(i=()=>{t(),q.success("Request approved")},e[6]=t,e[7]=i):i=e[7];let n;e[8]!==s||e[9]!==i?(n={mutationFn:s,onSuccess:i,onError:v},e[8]=s,e[9]=i,e[10]=n):n=e[10];const l=I(n);let o;e[11]!==a?(o=R=>a.call("ORGANIZATION_JOIN_REQUEST_DENY",{requestId:R}),e[11]=a,e[12]=o):o=e[12];let f;e[13]!==t?(f=()=>{t(),q.success("Request denied")},e[13]=t,e[14]=f):f=e[14];let m;e[15]!==o||e[16]!==f?(m={mutationFn:o,onSuccess:f,onError:T},e[15]=o,e[16]=f,e[17]=m):m=e[17];const E=I(m);let p;return e[18]!==l||e[19]!==E?(p={approve:l,deny:E},e[18]=l,e[19]=E,e[20]=p):p=e[20],p}function T(e){return q.error(e instanceof Error?e.message:"Failed to deny")}function v(e){return q.error(e instanceof Error?e.message:"Failed to approve")}export{F as a,K as u};
@@ -1,4 +1,4 @@
1
- import{cZ as de,c_ as he,c$ as fe,ce as pe,d0 as me,bV as m,bW as w,d1 as _e,d2 as ge,d3 as we,d4 as $,d5 as Te,d6 as j,d7 as ye,d8 as q,d9 as ve,da as F,db as ke,dc as Se,dd as Ce,de as Q,bA as Re,bC as be,bh as Ie,c9 as te,cl as Ee,cr as qe,cp as Pe,cN as Ae,df as $e,dg as Me,dh as M,di as Oe,dj as He,cq as Ne,cm as xe,cn as De,co as Ue,bx as je,dk as Fe,dl as Le,dm as Ve,cg as We,dn as ze,dp as Qe,dq as Ge,bw as x,c as se,q as re,aK as V}from"./index-BHn6e0Se.js";import{U as P,a as O,e as G}from"./auth-Cal4T12d.js";function N(o){return!!o._zod}function R(o,e){return N(o)?de(o,e):o.safeParse(e)}function oe(o){if(!o)return;let e;if(N(o)?e=o._zod?.def?.shape:e=o.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Je(o){if(N(o)){const a=o._zod?.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}const t=o._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}const s=o.value;if(s!==void 0)return s}function b(o){return o==="completed"||o==="failed"||o==="cancelled"}function J(o){const t=oe(o)?.method;if(!t)throw new Error("Schema is missing a method literal");const s=Je(t);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function K(o,e){const t=R(o,e);if(!t.success)throw t.error;return t.data}const Ke=6e4;class Ye{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(he,t=>{this._oncancel(t)}),this.setNotificationHandler(fe,t=>{this._onprogress(t)}),this.setRequestHandler(pe,t=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(me,async(t,s)=>{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new m(w.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(_e,async(t,s)=>{const r=async()=>{const a=t.params.taskId;if(this._taskMessageQueue){let i;for(;i=await this._taskMessageQueue.dequeue(a,s.sessionId);){if(i.type==="response"||i.type==="error"){const u=i.message,p=u.id,l=this._requestResolvers.get(p);if(l)if(this._requestResolvers.delete(p),i.type==="response")l(u);else{const h=u,f=new m(h.error.code,h.error.message,h.error.data);l(f)}else{const h=i.type==="response"?"Response":"Error";this._onerror(new Error(`${h} handler missing for request ${p}`))}continue}await this._transport?.send(i.message,{relatedRequestId:s.requestId})}}const n=await this._taskStore.getTask(a,s.sessionId);if(!n)throw new m(w.InvalidParams,`Task not found: ${a}`);if(!b(n.status))return await this._waitForTaskUpdate(a,s.signal),await r();if(b(n.status)){const i=await this._taskStore.getTaskResult(a,s.sessionId);return this._clearTaskQueue(a),{...i,_meta:{...i._meta,[q]:{taskId:a}}}}return await r()};return await r()}),this.setRequestHandler(ge,async(t,s)=>{try{const{tasks:r,nextCursor:a}=await this._taskStore.listTasks(t.params?.cursor,s.sessionId);return{tasks:r,nextCursor:a,_meta:{}}}catch(r){throw new m(w.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(we,async(t,s)=>{try{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new m(w.InvalidParams,`Task not found: ${t.params.taskId}`);if(b(r.status))throw new m(w.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",s.sessionId),this._clearTaskQueue(t.params.taskId);const a=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!a)throw new m(w.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...a}}catch(r){throw r instanceof m?r:new m(w.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,s,r,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:a,onTimeout:r})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),m.fromError(w.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};const s=this.transport?.onerror;this._transport.onerror=a=>{s?.(a),this._onerror(a)};const r=this._transport?.onmessage;this._transport.onmessage=(a,n)=>{r?.(a,n),$(a)||Te(a)?this._onresponse(a):j(a)?this._onrequest(a,n):ye(a)?this._onnotification(a):this._onerror(new Error(`Unknown message type: ${JSON.stringify(a)}`))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const s of this._timeoutInfo.values())clearTimeout(s.timeoutId);this._timeoutInfo.clear();for(const s of this._requestHandlerAbortControllers.values())s.abort();this._requestHandlerAbortControllers.clear();const t=m.fromError(w.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const s of e.values())s(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){const t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,t){const s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,a=e.params?._meta?.[q]?.taskId;if(s===void 0){const l={jsonrpc:"2.0",id:e.id,error:{code:w.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:l,timestamp:Date.now()},r?.sessionId).catch(h=>this._onerror(new Error(`Failed to enqueue error response: ${h}`))):r?.send(l).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)));return}const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);const i=ve(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,p={signal:n.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(n.signal.aborted)return;const h={relatedRequestId:e.id};a&&(h.relatedTask={taskId:a}),await this.notification(l,h)},sendRequest:async(l,h,f)=>{if(n.signal.aborted)throw new m(w.ConnectionClosed,"Request was cancelled");const g={...f,relatedRequestId:e.id};a&&!g.relatedTask&&(g.relatedTask={taskId:a});const y=g.relatedTask?.taskId??a;return y&&u&&await u.updateTaskStatus(y,"input_required"),await this.request(l,h,g)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:a,taskStore:u,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{i&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,p)).then(async l=>{if(n.signal.aborted)return;const h={result:l,jsonrpc:"2.0",id:e.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)},async l=>{if(n.signal.aborted)return;const h={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:w.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===n&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...s}=e.params,r=Number(t),a=this._progressHandlers.get(r);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const n=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&n&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),n(u);return}a(s)}_onresponse(e){const t=Number(e.id),s=this._requestResolvers.get(t);if(s){if(this._requestResolvers.delete(t),$(e))s(e);else{const n=new m(e.error.code,e.error.message,e.error.data);s(n)}return}const r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let a=!1;if($(e)&&e.result&&typeof e.result=="object"){const n=e.result;if(n.task&&typeof n.task=="object"){const i=n.task;typeof i.taskId=="string"&&(a=!0,this._taskProgressTokens.set(i.taskId,t))}}if(a||this._progressHandlers.delete(t),$(e))r(e);else{const n=m.fromError(e.error.code,e.error.message,e.error.data);r(n)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,s){const{task:r}=s??{};if(!r){try{yield{type:"result",result:await this.request(e,t,s)}}catch(n){yield{type:"error",error:n instanceof m?n:new m(w.InternalError,String(n))}}return}let a;try{const n=await this.request(e,F,s);if(n.task)a=n.task.taskId,yield{type:"taskCreated",task:n.task};else throw new m(w.InternalError,"Task creation did not return a task");for(;;){const i=await this.getTask({taskId:a},s);if(yield{type:"taskStatus",task:i},b(i.status)){i.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},t,s)}:i.status==="failed"?yield{type:"error",error:new m(w.InternalError,`Task ${a} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new m(w.InternalError,`Task ${a} was cancelled`)});return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:a},t,s)};return}const u=i.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(p=>setTimeout(p,u)),s?.signal?.throwIfAborted()}}catch(n){yield{type:"error",error:n instanceof m?n:new m(w.InternalError,String(n))}}}request(e,t,s){const{relatedRequestId:r,resumptionToken:a,onresumptiontoken:n,task:i,relatedTask:u}=s??{};return new Promise((p,l)=>{const h=c=>{l(c)};if(!this._transport){h(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(c){h(c);return}s?.signal?.throwIfAborted();const f=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:f};s?.onprogress&&(this._progressHandlers.set(f,s.onprogress),g.params={...e.params,_meta:{...e.params?._meta||{},progressToken:f}}),i&&(g.params={...g.params,task:i}),u&&(g.params={...g.params,_meta:{...g.params?._meta||{},[q]:u}});const y=c=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(c)}},{relatedRequestId:r,resumptionToken:a,onresumptiontoken:n}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));const _=c instanceof m?c:new m(w.RequestTimeout,String(c));l(_)};this._responseHandlers.set(f,c=>{if(!s?.signal?.aborted){if(c instanceof Error)return l(c);try{const _=R(t,c.result);_.success?p(_.data):l(_.error)}catch(_){l(_)}}}),s?.signal?.addEventListener("abort",()=>{y(s?.signal?.reason)});const T=s?.timeout??Ke,v=()=>y(m.fromError(w.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(f,T,s?.maxTotalTimeout,v,s?.resetTimeoutOnProgress??!1);const d=u?.taskId;if(d){const c=_=>{const k=this._responseHandlers.get(f);k?k(_):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,c),this._enqueueTaskMessage(d,{type:"request",message:g,timestamp:Date.now()}).catch(_=>{this._cleanupTimeout(f),l(_)})}else this._transport.send(g,{relatedRequestId:r,resumptionToken:a,onresumptiontoken:n}).catch(c=>{this._cleanupTimeout(f),l(c)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},ke,t)}async getTaskResult(e,t,s){return this.request({method:"tasks/result",params:e},t,s)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Se,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Ce,t)}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const s=t?.relatedTask?.taskId;if(s){const i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[q]:t.relatedTask}}};await this._enqueueTaskMessage(s,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};t?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[q]:t.relatedTask}}}),this._transport?.send(i,t).catch(u=>this._onerror(u))});return}let n={...e,jsonrpc:"2.0"};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[q]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const s=J(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,a)=>{const n=K(e,r);return Promise.resolve(t(n,a))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const s=J(e);this._notificationHandlers.set(s,r=>{const a=K(e,r);return Promise.resolve(t(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,s){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,s,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const s=await this._taskMessageQueue.dequeueAll(e,t);for(const r of s)if(r.type==="request"&&j(r.message)){const a=r.message.id,n=this._requestResolvers.get(a);n?(n(new m(w.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let s=this._options?.defaultTaskPollInterval??1e3;try{const r=await this._taskStore?.getTask(e);r?.pollInterval&&(s=r.pollInterval)}catch{}return new Promise((r,a)=>{if(t.aborted){a(new m(w.InvalidRequest,"Request cancelled"));return}const n=setTimeout(r,s);t.addEventListener("abort",()=>{clearTimeout(n),a(new m(w.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const s=this._taskStore;if(!s)throw new Error("No task store configured");return{createTask:async r=>{if(!e)throw new Error("No request provided");return await s.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async r=>{const a=await s.getTask(r,t);if(!a)throw new m(w.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(r,a,n)=>{await s.storeTaskResult(r,a,n,t);const i=await s.getTask(r,t);if(i){const u=Q.parse({method:"notifications/tasks/status",params:i});await this.notification(u),b(i.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>s.getTaskResult(r,t),updateTaskStatus:async(r,a,n)=>{const i=await s.getTask(r,t);if(!i)throw new m(w.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(b(i.status))throw new m(w.InvalidParams,`Cannot update task "${r}" from terminal status "${i.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await s.updateTaskStatus(r,a,n,t);const u=await s.getTask(r,t);if(u){const p=Q.parse({method:"notifications/tasks/status",params:u});await this.notification(p),b(u.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>s.listTasks(r,t)}}}function Y(o){return o!==null&&typeof o=="object"&&!Array.isArray(o)}function Be(o,e){const t={...o};for(const s in e){const r=s,a=e[r];if(a===void 0)continue;const n=t[r];Y(n)&&Y(a)?t[r]={...n,...a}:t[r]=a}return t}var Ze=be();const Xe=Re(Ze);function et(){const o=new Xe({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ie(o),o}class tt{constructor(e){this._ajv=e??et()}getValidator(e){const t="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return s=>t(s)?{valid:!0,data:s,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class st{constructor(e){this._client=e}async*callToolStream(e,t=te,s){const r=this._client,a={...s,task:s?.task??(r.isToolTask(e.name)?{}:void 0)},n=r.requestStream({method:"tools/call",params:e},t,a),i=r.getToolOutputValidator(e.name);for await(const u of n){if(u.type==="result"&&i){const p=u.result;if(!p.structuredContent&&!p.isError){yield{type:"error",error:new m(w.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(p.structuredContent)try{const l=i(p.structuredContent);if(!l.valid){yield{type:"error",error:new m(w.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof m){yield{type:"error",error:l};return}yield{type:"error",error:new m(w.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield u}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,s){return this._client.getTaskResult({taskId:e},t,s)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,s){return this._client.requestStream(e,t,s)}}function rt(o,e,t){if(!o)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!o.tools?.call)throw new Error(`${t} does not support task creation for tools/call (required for ${e})`);break}}function ot(o,e,t){if(!o)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!o.sampling?.createMessage)throw new Error(`${t} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!o.elicitation?.create)throw new Error(`${t} does not support task creation for elicitation/create (required for ${e})`);break}}function H(o,e){if(!(!o||e===null||typeof e!="object")){if(o.type==="object"&&o.properties&&typeof o.properties=="object"){const t=e,s=o.properties;for(const r of Object.keys(s)){const a=s[r];t[r]===void 0&&Object.prototype.hasOwnProperty.call(a,"default")&&(t[r]=a.default),t[r]!==void 0&&H(a,t[r])}}if(Array.isArray(o.anyOf))for(const t of o.anyOf)typeof t!="boolean"&&H(t,e);if(Array.isArray(o.oneOf))for(const t of o.oneOf)typeof t!="boolean"&&H(t,e)}}function at(o){if(!o)return{supportsFormMode:!1,supportsUrlMode:!1};const e=o.form!==void 0,t=o.url!==void 0;return{supportsFormMode:e||!e&&!t,supportsUrlMode:t}}let nt=class extends Ye{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new tt,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Ee,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",qe,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Pe,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new st(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Be(this._capabilities,e)}setRequestHandler(e,t){const r=oe(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let a;if(N(r)){const i=r;a=i._zod?.def?.value??i.value}else{const i=r;a=i._def?.value??i.value}if(typeof a!="string")throw new Error("Schema method literal must be a string");const n=a;if(n==="elicitation/create"){const i=async(u,p)=>{const l=R(Le,u);if(!l.success){const c=l.error instanceof Error?l.error.message:String(l.error);throw new m(w.InvalidParams,`Invalid elicitation request: ${c}`)}const{params:h}=l.data;h.mode=h.mode??"form";const{supportsFormMode:f,supportsUrlMode:g}=at(this._capabilities.elicitation);if(h.mode==="form"&&!f)throw new m(w.InvalidParams,"Client does not support form-mode elicitation requests");if(h.mode==="url"&&!g)throw new m(w.InvalidParams,"Client does not support URL-mode elicitation requests");const y=await Promise.resolve(t(u,p));if(h.task){const c=R(F,y);if(!c.success){const _=c.error instanceof Error?c.error.message:String(c.error);throw new m(w.InvalidParams,`Invalid task creation result: ${_}`)}return c.data}const T=R(Ve,y);if(!T.success){const c=T.error instanceof Error?T.error.message:String(T.error);throw new m(w.InvalidParams,`Invalid elicitation result: ${c}`)}const v=T.data,d=h.mode==="form"?h.requestedSchema:void 0;if(h.mode==="form"&&v.action==="accept"&&v.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{H(d,v.content)}catch{}return v};return super.setRequestHandler(e,i)}if(n==="sampling/createMessage"){const i=async(u,p)=>{const l=R(We,u);if(!l.success){const v=l.error instanceof Error?l.error.message:String(l.error);throw new m(w.InvalidParams,`Invalid sampling request: ${v}`)}const{params:h}=l.data,f=await Promise.resolve(t(u,p));if(h.task){const v=R(F,f);if(!v.success){const d=v.error instanceof Error?v.error.message:String(v.error);throw new m(w.InvalidParams,`Invalid task creation result: ${d}`)}return v.data}const y=h.tools||h.toolChoice?ze:Qe,T=R(y,f);if(!T.success){const v=T.error instanceof Error?T.error.message:String(T.error);throw new m(w.InvalidParams,`Invalid sampling result: ${v}`)}return T.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{const s=await this.request({method:"initialize",params:{protocolVersion:Ae,capabilities:this._capabilities,clientInfo:this._clientInfo}},$e,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Me.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break}}assertTaskCapability(e){rt(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&ot(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},M,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Oe,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},M,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},He,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Ne,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},xe,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},De,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Ue,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},M,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},M,t)}async callTool(e,t=te,s){if(this.isToolTaskRequired(e.name))throw new m(w.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const r=await this.request({method:"tools/call",params:e},t,s),a=this.getToolOutputValidator(e.name);if(a){if(!r.structuredContent&&!r.isError)throw new m(w.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{const n=a(r.structuredContent);if(!n.valid)throw new m(w.InvalidParams,`Structured content does not match the tool's output schema: ${n.errorMessage}`)}catch(n){throw n instanceof m?n:new m(w.InvalidParams,`Failed to validate structured content: ${n instanceof Error?n.message:String(n)}`)}}return r}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const t of e){if(t.outputSchema){const r=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,r)}const s=t.execution?.taskSupport;(s==="required"||s==="optional")&&this._cachedKnownTaskTools.add(t.name),s==="required"&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){const s=await this.request({method:"tools/list",params:e},je,t);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,t,s,r){const a=Fe.safeParse(s);if(!a.success)throw new Error(`Invalid ${e} listChanged options: ${a.error.message}`);if(typeof s.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);const{autoRefresh:n,debounceMs:i}=a.data,{onChanged:u}=s,p=async()=>{if(!n){u(null,null);return}try{const h=await r();u(null,h)}catch(h){const f=h instanceof Error?h:new Error(String(h));u(f,null)}},l=()=>{if(i){const h=this._listChangedDebounceTimers.get(e);h&&clearTimeout(h);const f=setTimeout(p,i);this._listChangedDebounceTimers.set(e,f)}else p()};this.setNotificationHandler(t,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};const bt={SELF:o=>`${o}_self`,REGISTRY:o=>`${o}_registry`,COMMUNITY_REGISTRY:o=>`${o}_community-registry`,DEV_ASSETS:o=>`${o}_dev-assets`,SITE_DIAGNOSTICS:o=>`site-diagnostics_${o}`,COMMERCE_DISCOVERY:o=>`${o}_commerce-discovery`},It="get_my_diagnostic",it="self";function W(o){return{is(e){return!e||!e.startsWith(o)?null:e.slice(o.length)||null},get(e){return`${o}${e}`}}}function ct(o){return{id:o.id,organization_id:o.organizationId,title:o.title,description:o.description,icon:o.icon,status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,metadata:{instructions:o.instructions??null},pinned:!1,connections:[]}}const ae=W("decopilot_"),Et=ae.is,lt=ae.get,ne=W("dev_"),qt=ne.get,Pt=ne.is;function At(o){return ct({id:lt(o),organizationId:o,title:"Decopilot",description:"Default agent that aggregates all organization connections",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png"})}const ut=W("commerce-discovery_"),$t=ut.get,Mt={AGENT_MANAGER:o=>`studio-agent-manager_${o}`,AUTOMATION_MANAGER:o=>`studio-automation-manager_${o}`,CONNECTION_MANAGER:o=>`studio-connection-manager_${o}`,STORE_MANAGER:o=>`studio-store-manager_${o}`,BRAND_MANAGER:o=>`studio-brand-manager_${o}`,USAGE_MANAGER:o=>`studio-usage-manager_${o}`};function Ot(o){return o?o.startsWith("studio-agent-manager_")||o.startsWith("studio-automation-manager_")||o.startsWith("studio-connection-manager_")||o.startsWith("studio-store-manager_")||o.startsWith("studio-brand-manager_")||o.startsWith("studio-usage-manager_"):!1}const D=o=>[{type:"text",text:o}];function dt(o){const e=o.meshUrl??(typeof window<"u"?window.location.origin:void 0);if(!e)throw new Error("RestSelfClient requires either meshUrl or a browser environment.");const t={"Content-Type":"application/json",Accept:"application/json",...o.token?{Authorization:`Bearer ${o.token}`}:{}},s=u=>new URL(`/api/${encodeURIComponent(o.orgSlug)}${u}`,e).href,r=async u=>{let p;try{p=await fetch(s(`/tools/${encodeURIComponent(u.name)}`),{method:"POST",headers:t,credentials:"include",body:JSON.stringify(u.arguments??{})})}catch(h){const f=h instanceof Error?h.message:"Network error";return{content:D(f),isError:!0}}if(!p.ok){let h=`${u.name} failed (${p.status})`;try{const f=await p.json();f?.error&&(h=f.error)}catch{}return{content:D(h),isError:!0}}const l=await p.json().catch(()=>({}));return{content:D(typeof l=="string"?l:JSON.stringify(l)),structuredContent:l}},a=async()=>{const u=await fetch(s("/tools"),{method:"GET",headers:t,credentials:"include"});return u.ok?await u.json():{tools:[]}},n=u=>()=>Promise.reject(new Error(`RestSelfClient: ${u} is not supported over REST for the self connection`));return{callTool:r,listTools:a,listPrompts:n("listPrompts"),getPrompt:n("getPrompt"),listResources:n("listResources"),readResource:n("readResource"),listResourceTemplates:n("listResourceTemplates"),close:()=>Promise.resolve(),toJSON:()=>o.toJSONString}}function L(o){return o?o instanceof Headers?Object.fromEntries(o.entries()):Array.isArray(o)?Object.fromEntries(o):{...o}:{}}function ht(o=fetch,e){return e?async(t,s)=>{const r={...e,...s,headers:s?.headers?{...L(e.headers),...L(s.headers)}:e.headers};return o(t,r)}:o}class B extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}const Z=10,ft=13,I=32;function U(o){}function pt(o){if(typeof o=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=U,onError:t=U,onRetry:s=U,onComment:r}=o,a=[];let n=!0,i,u="",p=0,l;function h(d){if(n&&(n=!1,d.charCodeAt(0)===239&&d.charCodeAt(1)===187&&d.charCodeAt(2)===191&&(d=d.slice(3))),a.length===0){const k=f(d);k!==""&&a.push(k);return}if(d.indexOf(`
1
+ import{cZ as de,c_ as he,c$ as fe,ce as pe,d0 as me,bV as m,bW as w,d1 as _e,d2 as ge,d3 as we,d4 as $,d5 as Te,d6 as j,d7 as ye,d8 as q,d9 as ve,da as F,db as ke,dc as Se,dd as Ce,de as Q,bA as Re,bC as be,bh as Ie,c9 as te,cl as Ee,cr as qe,cp as Pe,cN as Ae,df as $e,dg as Me,dh as M,di as Oe,dj as He,cq as Ne,cm as xe,cn as De,co as Ue,bx as je,dk as Fe,dl as Le,dm as Ve,cg as We,dn as ze,dp as Qe,dq as Ge,bw as x,c as se,q as re,aK as V}from"./index-smTHcnUA.js";import{U as P,a as O,e as G}from"./auth-DyAYzXhN.js";function N(o){return!!o._zod}function R(o,e){return N(o)?de(o,e):o.safeParse(e)}function oe(o){if(!o)return;let e;if(N(o)?e=o._zod?.def?.shape:e=o.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Je(o){if(N(o)){const a=o._zod?.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}const t=o._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}const s=o.value;if(s!==void 0)return s}function b(o){return o==="completed"||o==="failed"||o==="cancelled"}function J(o){const t=oe(o)?.method;if(!t)throw new Error("Schema is missing a method literal");const s=Je(t);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function K(o,e){const t=R(o,e);if(!t.success)throw t.error;return t.data}const Ke=6e4;class Ye{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(he,t=>{this._oncancel(t)}),this.setNotificationHandler(fe,t=>{this._onprogress(t)}),this.setRequestHandler(pe,t=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(me,async(t,s)=>{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new m(w.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(_e,async(t,s)=>{const r=async()=>{const a=t.params.taskId;if(this._taskMessageQueue){let i;for(;i=await this._taskMessageQueue.dequeue(a,s.sessionId);){if(i.type==="response"||i.type==="error"){const u=i.message,p=u.id,l=this._requestResolvers.get(p);if(l)if(this._requestResolvers.delete(p),i.type==="response")l(u);else{const h=u,f=new m(h.error.code,h.error.message,h.error.data);l(f)}else{const h=i.type==="response"?"Response":"Error";this._onerror(new Error(`${h} handler missing for request ${p}`))}continue}await this._transport?.send(i.message,{relatedRequestId:s.requestId})}}const n=await this._taskStore.getTask(a,s.sessionId);if(!n)throw new m(w.InvalidParams,`Task not found: ${a}`);if(!b(n.status))return await this._waitForTaskUpdate(a,s.signal),await r();if(b(n.status)){const i=await this._taskStore.getTaskResult(a,s.sessionId);return this._clearTaskQueue(a),{...i,_meta:{...i._meta,[q]:{taskId:a}}}}return await r()};return await r()}),this.setRequestHandler(ge,async(t,s)=>{try{const{tasks:r,nextCursor:a}=await this._taskStore.listTasks(t.params?.cursor,s.sessionId);return{tasks:r,nextCursor:a,_meta:{}}}catch(r){throw new m(w.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(we,async(t,s)=>{try{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new m(w.InvalidParams,`Task not found: ${t.params.taskId}`);if(b(r.status))throw new m(w.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",s.sessionId),this._clearTaskQueue(t.params.taskId);const a=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!a)throw new m(w.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...a}}catch(r){throw r instanceof m?r:new m(w.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,s,r,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:a,onTimeout:r})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),m.fromError(w.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};const s=this.transport?.onerror;this._transport.onerror=a=>{s?.(a),this._onerror(a)};const r=this._transport?.onmessage;this._transport.onmessage=(a,n)=>{r?.(a,n),$(a)||Te(a)?this._onresponse(a):j(a)?this._onrequest(a,n):ye(a)?this._onnotification(a):this._onerror(new Error(`Unknown message type: ${JSON.stringify(a)}`))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const s of this._timeoutInfo.values())clearTimeout(s.timeoutId);this._timeoutInfo.clear();for(const s of this._requestHandlerAbortControllers.values())s.abort();this._requestHandlerAbortControllers.clear();const t=m.fromError(w.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const s of e.values())s(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){const t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,t){const s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,a=e.params?._meta?.[q]?.taskId;if(s===void 0){const l={jsonrpc:"2.0",id:e.id,error:{code:w.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:l,timestamp:Date.now()},r?.sessionId).catch(h=>this._onerror(new Error(`Failed to enqueue error response: ${h}`))):r?.send(l).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)));return}const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);const i=ve(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,p={signal:n.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(n.signal.aborted)return;const h={relatedRequestId:e.id};a&&(h.relatedTask={taskId:a}),await this.notification(l,h)},sendRequest:async(l,h,f)=>{if(n.signal.aborted)throw new m(w.ConnectionClosed,"Request was cancelled");const g={...f,relatedRequestId:e.id};a&&!g.relatedTask&&(g.relatedTask={taskId:a});const y=g.relatedTask?.taskId??a;return y&&u&&await u.updateTaskStatus(y,"input_required"),await this.request(l,h,g)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:a,taskStore:u,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{i&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,p)).then(async l=>{if(n.signal.aborted)return;const h={result:l,jsonrpc:"2.0",id:e.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)},async l=>{if(n.signal.aborted)return;const h={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:w.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===n&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...s}=e.params,r=Number(t),a=this._progressHandlers.get(r);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const n=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&n&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),n(u);return}a(s)}_onresponse(e){const t=Number(e.id),s=this._requestResolvers.get(t);if(s){if(this._requestResolvers.delete(t),$(e))s(e);else{const n=new m(e.error.code,e.error.message,e.error.data);s(n)}return}const r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let a=!1;if($(e)&&e.result&&typeof e.result=="object"){const n=e.result;if(n.task&&typeof n.task=="object"){const i=n.task;typeof i.taskId=="string"&&(a=!0,this._taskProgressTokens.set(i.taskId,t))}}if(a||this._progressHandlers.delete(t),$(e))r(e);else{const n=m.fromError(e.error.code,e.error.message,e.error.data);r(n)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,s){const{task:r}=s??{};if(!r){try{yield{type:"result",result:await this.request(e,t,s)}}catch(n){yield{type:"error",error:n instanceof m?n:new m(w.InternalError,String(n))}}return}let a;try{const n=await this.request(e,F,s);if(n.task)a=n.task.taskId,yield{type:"taskCreated",task:n.task};else throw new m(w.InternalError,"Task creation did not return a task");for(;;){const i=await this.getTask({taskId:a},s);if(yield{type:"taskStatus",task:i},b(i.status)){i.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},t,s)}:i.status==="failed"?yield{type:"error",error:new m(w.InternalError,`Task ${a} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new m(w.InternalError,`Task ${a} was cancelled`)});return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:a},t,s)};return}const u=i.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(p=>setTimeout(p,u)),s?.signal?.throwIfAborted()}}catch(n){yield{type:"error",error:n instanceof m?n:new m(w.InternalError,String(n))}}}request(e,t,s){const{relatedRequestId:r,resumptionToken:a,onresumptiontoken:n,task:i,relatedTask:u}=s??{};return new Promise((p,l)=>{const h=c=>{l(c)};if(!this._transport){h(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(c){h(c);return}s?.signal?.throwIfAborted();const f=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:f};s?.onprogress&&(this._progressHandlers.set(f,s.onprogress),g.params={...e.params,_meta:{...e.params?._meta||{},progressToken:f}}),i&&(g.params={...g.params,task:i}),u&&(g.params={...g.params,_meta:{...g.params?._meta||{},[q]:u}});const y=c=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(c)}},{relatedRequestId:r,resumptionToken:a,onresumptiontoken:n}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));const _=c instanceof m?c:new m(w.RequestTimeout,String(c));l(_)};this._responseHandlers.set(f,c=>{if(!s?.signal?.aborted){if(c instanceof Error)return l(c);try{const _=R(t,c.result);_.success?p(_.data):l(_.error)}catch(_){l(_)}}}),s?.signal?.addEventListener("abort",()=>{y(s?.signal?.reason)});const T=s?.timeout??Ke,v=()=>y(m.fromError(w.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(f,T,s?.maxTotalTimeout,v,s?.resetTimeoutOnProgress??!1);const d=u?.taskId;if(d){const c=_=>{const k=this._responseHandlers.get(f);k?k(_):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,c),this._enqueueTaskMessage(d,{type:"request",message:g,timestamp:Date.now()}).catch(_=>{this._cleanupTimeout(f),l(_)})}else this._transport.send(g,{relatedRequestId:r,resumptionToken:a,onresumptiontoken:n}).catch(c=>{this._cleanupTimeout(f),l(c)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},ke,t)}async getTaskResult(e,t,s){return this.request({method:"tasks/result",params:e},t,s)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Se,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Ce,t)}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const s=t?.relatedTask?.taskId;if(s){const i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[q]:t.relatedTask}}};await this._enqueueTaskMessage(s,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};t?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[q]:t.relatedTask}}}),this._transport?.send(i,t).catch(u=>this._onerror(u))});return}let n={...e,jsonrpc:"2.0"};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[q]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const s=J(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,a)=>{const n=K(e,r);return Promise.resolve(t(n,a))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const s=J(e);this._notificationHandlers.set(s,r=>{const a=K(e,r);return Promise.resolve(t(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,s){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,s,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const s=await this._taskMessageQueue.dequeueAll(e,t);for(const r of s)if(r.type==="request"&&j(r.message)){const a=r.message.id,n=this._requestResolvers.get(a);n?(n(new m(w.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let s=this._options?.defaultTaskPollInterval??1e3;try{const r=await this._taskStore?.getTask(e);r?.pollInterval&&(s=r.pollInterval)}catch{}return new Promise((r,a)=>{if(t.aborted){a(new m(w.InvalidRequest,"Request cancelled"));return}const n=setTimeout(r,s);t.addEventListener("abort",()=>{clearTimeout(n),a(new m(w.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const s=this._taskStore;if(!s)throw new Error("No task store configured");return{createTask:async r=>{if(!e)throw new Error("No request provided");return await s.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async r=>{const a=await s.getTask(r,t);if(!a)throw new m(w.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(r,a,n)=>{await s.storeTaskResult(r,a,n,t);const i=await s.getTask(r,t);if(i){const u=Q.parse({method:"notifications/tasks/status",params:i});await this.notification(u),b(i.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>s.getTaskResult(r,t),updateTaskStatus:async(r,a,n)=>{const i=await s.getTask(r,t);if(!i)throw new m(w.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(b(i.status))throw new m(w.InvalidParams,`Cannot update task "${r}" from terminal status "${i.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await s.updateTaskStatus(r,a,n,t);const u=await s.getTask(r,t);if(u){const p=Q.parse({method:"notifications/tasks/status",params:u});await this.notification(p),b(u.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>s.listTasks(r,t)}}}function Y(o){return o!==null&&typeof o=="object"&&!Array.isArray(o)}function Be(o,e){const t={...o};for(const s in e){const r=s,a=e[r];if(a===void 0)continue;const n=t[r];Y(n)&&Y(a)?t[r]={...n,...a}:t[r]=a}return t}var Ze=be();const Xe=Re(Ze);function et(){const o=new Xe({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ie(o),o}class tt{constructor(e){this._ajv=e??et()}getValidator(e){const t="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return s=>t(s)?{valid:!0,data:s,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class st{constructor(e){this._client=e}async*callToolStream(e,t=te,s){const r=this._client,a={...s,task:s?.task??(r.isToolTask(e.name)?{}:void 0)},n=r.requestStream({method:"tools/call",params:e},t,a),i=r.getToolOutputValidator(e.name);for await(const u of n){if(u.type==="result"&&i){const p=u.result;if(!p.structuredContent&&!p.isError){yield{type:"error",error:new m(w.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(p.structuredContent)try{const l=i(p.structuredContent);if(!l.valid){yield{type:"error",error:new m(w.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof m){yield{type:"error",error:l};return}yield{type:"error",error:new m(w.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield u}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,s){return this._client.getTaskResult({taskId:e},t,s)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,s){return this._client.requestStream(e,t,s)}}function rt(o,e,t){if(!o)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!o.tools?.call)throw new Error(`${t} does not support task creation for tools/call (required for ${e})`);break}}function ot(o,e,t){if(!o)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!o.sampling?.createMessage)throw new Error(`${t} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!o.elicitation?.create)throw new Error(`${t} does not support task creation for elicitation/create (required for ${e})`);break}}function H(o,e){if(!(!o||e===null||typeof e!="object")){if(o.type==="object"&&o.properties&&typeof o.properties=="object"){const t=e,s=o.properties;for(const r of Object.keys(s)){const a=s[r];t[r]===void 0&&Object.prototype.hasOwnProperty.call(a,"default")&&(t[r]=a.default),t[r]!==void 0&&H(a,t[r])}}if(Array.isArray(o.anyOf))for(const t of o.anyOf)typeof t!="boolean"&&H(t,e);if(Array.isArray(o.oneOf))for(const t of o.oneOf)typeof t!="boolean"&&H(t,e)}}function at(o){if(!o)return{supportsFormMode:!1,supportsUrlMode:!1};const e=o.form!==void 0,t=o.url!==void 0;return{supportsFormMode:e||!e&&!t,supportsUrlMode:t}}let nt=class extends Ye{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new tt,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Ee,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",qe,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Pe,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new st(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Be(this._capabilities,e)}setRequestHandler(e,t){const r=oe(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let a;if(N(r)){const i=r;a=i._zod?.def?.value??i.value}else{const i=r;a=i._def?.value??i.value}if(typeof a!="string")throw new Error("Schema method literal must be a string");const n=a;if(n==="elicitation/create"){const i=async(u,p)=>{const l=R(Le,u);if(!l.success){const c=l.error instanceof Error?l.error.message:String(l.error);throw new m(w.InvalidParams,`Invalid elicitation request: ${c}`)}const{params:h}=l.data;h.mode=h.mode??"form";const{supportsFormMode:f,supportsUrlMode:g}=at(this._capabilities.elicitation);if(h.mode==="form"&&!f)throw new m(w.InvalidParams,"Client does not support form-mode elicitation requests");if(h.mode==="url"&&!g)throw new m(w.InvalidParams,"Client does not support URL-mode elicitation requests");const y=await Promise.resolve(t(u,p));if(h.task){const c=R(F,y);if(!c.success){const _=c.error instanceof Error?c.error.message:String(c.error);throw new m(w.InvalidParams,`Invalid task creation result: ${_}`)}return c.data}const T=R(Ve,y);if(!T.success){const c=T.error instanceof Error?T.error.message:String(T.error);throw new m(w.InvalidParams,`Invalid elicitation result: ${c}`)}const v=T.data,d=h.mode==="form"?h.requestedSchema:void 0;if(h.mode==="form"&&v.action==="accept"&&v.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{H(d,v.content)}catch{}return v};return super.setRequestHandler(e,i)}if(n==="sampling/createMessage"){const i=async(u,p)=>{const l=R(We,u);if(!l.success){const v=l.error instanceof Error?l.error.message:String(l.error);throw new m(w.InvalidParams,`Invalid sampling request: ${v}`)}const{params:h}=l.data,f=await Promise.resolve(t(u,p));if(h.task){const v=R(F,f);if(!v.success){const d=v.error instanceof Error?v.error.message:String(v.error);throw new m(w.InvalidParams,`Invalid task creation result: ${d}`)}return v.data}const y=h.tools||h.toolChoice?ze:Qe,T=R(y,f);if(!T.success){const v=T.error instanceof Error?T.error.message:String(T.error);throw new m(w.InvalidParams,`Invalid sampling result: ${v}`)}return T.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{const s=await this.request({method:"initialize",params:{protocolVersion:Ae,capabilities:this._capabilities,clientInfo:this._clientInfo}},$e,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Me.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break}}assertTaskCapability(e){rt(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&ot(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},M,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Oe,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},M,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},He,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Ne,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},xe,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},De,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Ue,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},M,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},M,t)}async callTool(e,t=te,s){if(this.isToolTaskRequired(e.name))throw new m(w.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const r=await this.request({method:"tools/call",params:e},t,s),a=this.getToolOutputValidator(e.name);if(a){if(!r.structuredContent&&!r.isError)throw new m(w.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{const n=a(r.structuredContent);if(!n.valid)throw new m(w.InvalidParams,`Structured content does not match the tool's output schema: ${n.errorMessage}`)}catch(n){throw n instanceof m?n:new m(w.InvalidParams,`Failed to validate structured content: ${n instanceof Error?n.message:String(n)}`)}}return r}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const t of e){if(t.outputSchema){const r=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,r)}const s=t.execution?.taskSupport;(s==="required"||s==="optional")&&this._cachedKnownTaskTools.add(t.name),s==="required"&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){const s=await this.request({method:"tools/list",params:e},je,t);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,t,s,r){const a=Fe.safeParse(s);if(!a.success)throw new Error(`Invalid ${e} listChanged options: ${a.error.message}`);if(typeof s.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);const{autoRefresh:n,debounceMs:i}=a.data,{onChanged:u}=s,p=async()=>{if(!n){u(null,null);return}try{const h=await r();u(null,h)}catch(h){const f=h instanceof Error?h:new Error(String(h));u(f,null)}},l=()=>{if(i){const h=this._listChangedDebounceTimers.get(e);h&&clearTimeout(h);const f=setTimeout(p,i);this._listChangedDebounceTimers.set(e,f)}else p()};this.setNotificationHandler(t,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};const bt={SELF:o=>`${o}_self`,REGISTRY:o=>`${o}_registry`,COMMUNITY_REGISTRY:o=>`${o}_community-registry`,DEV_ASSETS:o=>`${o}_dev-assets`,SITE_DIAGNOSTICS:o=>`site-diagnostics_${o}`,COMMERCE_DISCOVERY:o=>`${o}_commerce-discovery`},It="get_my_diagnostic",it="self";function W(o){return{is(e){return!e||!e.startsWith(o)?null:e.slice(o.length)||null},get(e){return`${o}${e}`}}}function ct(o){return{id:o.id,organization_id:o.organizationId,title:o.title,description:o.description,icon:o.icon,status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,metadata:{instructions:o.instructions??null},pinned:!1,connections:[]}}const ae=W("decopilot_"),Et=ae.is,lt=ae.get,ne=W("dev_"),qt=ne.get,Pt=ne.is;function At(o){return ct({id:lt(o),organizationId:o,title:"Decopilot",description:"Default agent that aggregates all organization connections",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png"})}const ut=W("commerce-discovery_"),$t=ut.get,Mt={AGENT_MANAGER:o=>`studio-agent-manager_${o}`,AUTOMATION_MANAGER:o=>`studio-automation-manager_${o}`,CONNECTION_MANAGER:o=>`studio-connection-manager_${o}`,STORE_MANAGER:o=>`studio-store-manager_${o}`,BRAND_MANAGER:o=>`studio-brand-manager_${o}`,USAGE_MANAGER:o=>`studio-usage-manager_${o}`};function Ot(o){return o?o.startsWith("studio-agent-manager_")||o.startsWith("studio-automation-manager_")||o.startsWith("studio-connection-manager_")||o.startsWith("studio-store-manager_")||o.startsWith("studio-brand-manager_")||o.startsWith("studio-usage-manager_"):!1}const D=o=>[{type:"text",text:o}];function dt(o){const e=o.meshUrl??(typeof window<"u"?window.location.origin:void 0);if(!e)throw new Error("RestSelfClient requires either meshUrl or a browser environment.");const t={"Content-Type":"application/json",Accept:"application/json",...o.token?{Authorization:`Bearer ${o.token}`}:{}},s=u=>new URL(`/api/${encodeURIComponent(o.orgSlug)}${u}`,e).href,r=async u=>{let p;try{p=await fetch(s(`/tools/${encodeURIComponent(u.name)}`),{method:"POST",headers:t,credentials:"include",body:JSON.stringify(u.arguments??{})})}catch(h){const f=h instanceof Error?h.message:"Network error";return{content:D(f),isError:!0}}if(!p.ok){let h=`${u.name} failed (${p.status})`;try{const f=await p.json();f?.error&&(h=f.error)}catch{}return{content:D(h),isError:!0}}const l=await p.json().catch(()=>({}));return{content:D(typeof l=="string"?l:JSON.stringify(l)),structuredContent:l}},a=async()=>{const u=await fetch(s("/tools"),{method:"GET",headers:t,credentials:"include"});return u.ok?await u.json():{tools:[]}},n=u=>()=>Promise.reject(new Error(`RestSelfClient: ${u} is not supported over REST for the self connection`));return{callTool:r,listTools:a,listPrompts:n("listPrompts"),getPrompt:n("getPrompt"),listResources:n("listResources"),readResource:n("readResource"),listResourceTemplates:n("listResourceTemplates"),close:()=>Promise.resolve(),toJSON:()=>o.toJSONString}}function L(o){return o?o instanceof Headers?Object.fromEntries(o.entries()):Array.isArray(o)?Object.fromEntries(o):{...o}:{}}function ht(o=fetch,e){return e?async(t,s)=>{const r={...e,...s,headers:s?.headers?{...L(e.headers),...L(s.headers)}:e.headers};return o(t,r)}:o}class B extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}const Z=10,ft=13,I=32;function U(o){}function pt(o){if(typeof o=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=U,onError:t=U,onRetry:s=U,onComment:r}=o,a=[];let n=!0,i,u="",p=0,l;function h(d){if(n&&(n=!1,d.charCodeAt(0)===239&&d.charCodeAt(1)===187&&d.charCodeAt(2)===191&&(d=d.slice(3))),a.length===0){const k=f(d);k!==""&&a.push(k);return}if(d.indexOf(`
2
2
  `)===-1&&d.indexOf("\r")===-1){a.push(d);return}a.push(d);const c=a.join("");a.length=0;const _=f(c);_!==""&&a.push(_)}function f(d){let c=0;if(d.indexOf("\r")===-1){let _=d.indexOf(`
3
3
  `,c);for(;_!==-1;){if(c===_){p>0&&e({id:i,event:l,data:u}),i=void 0,u="",p=0,l=void 0,c=_+1,_=d.indexOf(`
4
4
  `,c);continue}const k=d.charCodeAt(c);if(X(d,c,k)){const S=d.charCodeAt(c+5)===I?c+6:c+5,C=d.slice(S,_);if(p===0&&d.charCodeAt(_+1)===Z){e({id:i,event:l,data:C}),i=void 0,u="",l=void 0,c=_+2,_=d.indexOf(`
@@ -1 +1 @@
1
- import{c as l,k as c,bV as m,bW as f,q as y,aK as n}from"./index-BHn6e0Se.js";async function u(r){if(!r.getServerCapabilities()?.prompts)return{prompts:[]};try{return await r.listPrompts()}catch(t){if(t instanceof m&&t.code===f.MethodNotFound)return{prompts:[]};throw t}}async function b(r,e,t){if(!r.getServerCapabilities()?.prompts)throw new Error("Prompts capability not supported");return await r.getPrompt({name:e,arguments:t??{}})}function q(r){const e=l.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let i;e[3]!==t?(i=n.mcpPromptsList(t),e[3]=t,e[4]=i):i=e[4];let o;e[5]!==t?(o=()=>u(t),e[5]=t,e[6]=o):o=e[6];const p=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==i||e[9]!==o||e[10]!==p?(a={...s,queryKey:i,queryFn:o,staleTime:p,retry:!1},e[7]=s,e[8]=i,e[9]=o,e[10]=p,e[11]=a):a=e[11],y(a)}function g(r){const e=l.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let i;e[3]!==t?(i=n.mcpPromptsList(t),e[3]=t,e[4]=i):i=e[4];let o;e[5]!==t?(o=()=>u(t),e[5]=t,e[6]=o):o=e[6];const p=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==i||e[9]!==o||e[10]!==p?(a={...s,queryKey:i,queryFn:o,staleTime:p,retry:!1},e[7]=s,e[8]=i,e[9]=o,e[10]=p,e[11]=a):a=e[11],c(a)}export{g as a,b as g,u as l,q as u};
1
+ import{c as l,k as c,bV as m,bW as f,q as y,aK as n}from"./index-smTHcnUA.js";async function u(r){if(!r.getServerCapabilities()?.prompts)return{prompts:[]};try{return await r.listPrompts()}catch(t){if(t instanceof m&&t.code===f.MethodNotFound)return{prompts:[]};throw t}}async function b(r,e,t){if(!r.getServerCapabilities()?.prompts)throw new Error("Prompts capability not supported");return await r.getPrompt({name:e,arguments:t??{}})}function q(r){const e=l.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let i;e[3]!==t?(i=n.mcpPromptsList(t),e[3]=t,e[4]=i):i=e[4];let o;e[5]!==t?(o=()=>u(t),e[5]=t,e[6]=o):o=e[6];const p=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==i||e[9]!==o||e[10]!==p?(a={...s,queryKey:i,queryFn:o,staleTime:p,retry:!1},e[7]=s,e[8]=i,e[9]=o,e[10]=p,e[11]=a):a=e[11],y(a)}function g(r){const e=l.c(12);let t,s;e[0]!==r?({client:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let i;e[3]!==t?(i=n.mcpPromptsList(t),e[3]=t,e[4]=i):i=e[4];let o;e[5]!==t?(o=()=>u(t),e[5]=t,e[6]=o):o=e[6];const p=s.staleTime??3e4;let a;return e[7]!==s||e[8]!==i||e[9]!==o||e[10]!==p?(a={...s,queryKey:i,queryFn:o,staleTime:p,retry:!1},e[7]=s,e[8]=i,e[9]=o,e[10]=p,e[11]=a):a=e[11],c(a)}export{g as a,b as g,u as l,q as u};
@@ -1 +1 @@
1
- import{c as m,k as p,q,aK as T}from"./index-BHn6e0Se.js";function C(n){const e=m.c(12);let t,o;e[0]!==n?({client:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let s;e[5]!==t?(s=async()=>await t.listTools(),e[5]=t,e[6]=s):s=e[6];const r=o.staleTime??3e4;let i;return e[7]!==o||e[8]!==l||e[9]!==s||e[10]!==r?(i={...o,queryKey:l,queryFn:s,staleTime:r,retry:!1},e[7]=o,e[8]=l,e[9]=s,e[10]=r,e[11]=i):i=e[11],q(i)}function K(n){const e=m.c(12);let t,o;e[0]!==n?({client:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let s;e[5]!==t?(s=async()=>await t.listTools(),e[5]=t,e[6]=s):s=e[6];const r=o.staleTime??3e4;let i;return e[7]!==o||e[8]!==l||e[9]!==s||e[10]!==r?(i={...o,queryKey:l,queryFn:s,staleTime:r,retry:!1},e[7]=o,e[8]=l,e[9]=s,e[10]=r,e[11]=i):i=e[11],p(i)}function O(n){const e=m.c(21);let t,o,l,s;e[0]!==n?({client:t,toolName:s,toolArguments:l,...o}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=l,e[4]=s):(t=e[1],o=e[2],l=e[3],s=e[4]);let r,i,u;if(e[5]!==t||e[6]!==o||e[7]!==l||e[8]!==s){const f=JSON.stringify(l??{});u=q,r=o,i=T.mcpToolCall(t,s,f),e[5]=t,e[6]=o,e[7]=l,e[8]=s,e[9]=r,e[10]=i,e[11]=u}else r=e[9],i=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==s?(a=async()=>await t.callTool({name:s,arguments:l}),e[12]=t,e[13]=l,e[14]=s,e[15]=a):a=e[15];const y=o.staleTime??3e4;let c;return e[16]!==r||e[17]!==i||e[18]!==a||e[19]!==y?(c={...r,queryKey:i,queryFn:a,staleTime:y,retry:!1},e[16]=r,e[17]=i,e[18]=a,e[19]=y,e[20]=c):c=e[20],u(c)}function w(n){const e=m.c(21);let t,o,l,s;e[0]!==n?({client:t,toolName:s,toolArguments:l,...o}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=l,e[4]=s):(t=e[1],o=e[2],l=e[3],s=e[4]);let r,i,u;if(e[5]!==t||e[6]!==o||e[7]!==l||e[8]!==s){const f=JSON.stringify(l??{});u=p,r=o,i=T.mcpToolCall(t,s,f),e[5]=t,e[6]=o,e[7]=l,e[8]=s,e[9]=r,e[10]=i,e[11]=u}else r=e[9],i=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==s?(a=async()=>await t.callTool({name:s,arguments:l}),e[12]=t,e[13]=l,e[14]=s,e[15]=a):a=e[15];const y=o.staleTime??3e4;let c;return e[16]!==r||e[17]!==i||e[18]!==a||e[19]!==y?(c={...r,queryKey:i,queryFn:a,staleTime:y,retry:!1},e[16]=r,e[17]=i,e[18]=a,e[19]=y,e[20]=c):c=e[20],u(c)}export{K as a,C as b,O as c,w as u};
1
+ import{c as m,k as p,q,aK as T}from"./index-smTHcnUA.js";function C(n){const e=m.c(12);let t,o;e[0]!==n?({client:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let s;e[5]!==t?(s=async()=>await t.listTools(),e[5]=t,e[6]=s):s=e[6];const r=o.staleTime??3e4;let i;return e[7]!==o||e[8]!==l||e[9]!==s||e[10]!==r?(i={...o,queryKey:l,queryFn:s,staleTime:r,retry:!1},e[7]=o,e[8]=l,e[9]=s,e[10]=r,e[11]=i):i=e[11],q(i)}function K(n){const e=m.c(12);let t,o;e[0]!==n?({client:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let s;e[5]!==t?(s=async()=>await t.listTools(),e[5]=t,e[6]=s):s=e[6];const r=o.staleTime??3e4;let i;return e[7]!==o||e[8]!==l||e[9]!==s||e[10]!==r?(i={...o,queryKey:l,queryFn:s,staleTime:r,retry:!1},e[7]=o,e[8]=l,e[9]=s,e[10]=r,e[11]=i):i=e[11],p(i)}function O(n){const e=m.c(21);let t,o,l,s;e[0]!==n?({client:t,toolName:s,toolArguments:l,...o}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=l,e[4]=s):(t=e[1],o=e[2],l=e[3],s=e[4]);let r,i,u;if(e[5]!==t||e[6]!==o||e[7]!==l||e[8]!==s){const f=JSON.stringify(l??{});u=q,r=o,i=T.mcpToolCall(t,s,f),e[5]=t,e[6]=o,e[7]=l,e[8]=s,e[9]=r,e[10]=i,e[11]=u}else r=e[9],i=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==s?(a=async()=>await t.callTool({name:s,arguments:l}),e[12]=t,e[13]=l,e[14]=s,e[15]=a):a=e[15];const y=o.staleTime??3e4;let c;return e[16]!==r||e[17]!==i||e[18]!==a||e[19]!==y?(c={...r,queryKey:i,queryFn:a,staleTime:y,retry:!1},e[16]=r,e[17]=i,e[18]=a,e[19]=y,e[20]=c):c=e[20],u(c)}function w(n){const e=m.c(21);let t,o,l,s;e[0]!==n?({client:t,toolName:s,toolArguments:l,...o}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=l,e[4]=s):(t=e[1],o=e[2],l=e[3],s=e[4]);let r,i,u;if(e[5]!==t||e[6]!==o||e[7]!==l||e[8]!==s){const f=JSON.stringify(l??{});u=p,r=o,i=T.mcpToolCall(t,s,f),e[5]=t,e[6]=o,e[7]=l,e[8]=s,e[9]=r,e[10]=i,e[11]=u}else r=e[9],i=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==s?(a=async()=>await t.callTool({name:s,arguments:l}),e[12]=t,e[13]=l,e[14]=s,e[15]=a):a=e[15];const y=o.staleTime??3e4;let c;return e[16]!==r||e[17]!==i||e[18]!==a||e[19]!==y?(c={...r,queryKey:i,queryFn:a,staleTime:y,retry:!1},e[16]=r,e[17]=i,e[18]=a,e[19]=y,e[20]=c):c=e[20],u(c)}export{K as a,C as b,O as c,w as u};
@@ -1 +1 @@
1
- import{c as n,D as i,q as l,K as m}from"./index-BHn6e0Se.js";import{u as a}from"./use-org-auth-client-BtI7VkGK.js";function p(){const e=n.c(7),{locator:o}=i(),u=a();let t;e[0]!==o?(t=m.members(o),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==u?(s=()=>u.organization.listMembers(),e[2]=u,e[3]=s):s=e[3];let r;return e[4]!==t||e[5]!==s?(r={queryKey:t,queryFn:s},e[4]=t,e[5]=s,e[6]=r):r=e[6],l(r)}export{p as u};
1
+ import{c as n,D as i,q as l,K as m}from"./index-smTHcnUA.js";import{u as a}from"./use-org-auth-client-CVxnVAwj.js";function p(){const e=n.c(7),{locator:o}=i(),u=a();let t;e[0]!==o?(t=m.members(o),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==u?(s=()=>u.organization.listMembers(),e[2]=u,e[3]=s):s=e[3];let r;return e[4]!==t||e[5]!==s?(r={queryKey:t,queryFn:s},e[4]=t,e[5]=s,e[6]=r):r=e[6],l(r)}export{p as u};
@@ -1 +1 @@
1
- import{c as m,r}from"./index-BHn6e0Se.js";const a=768,o=()=>globalThis.innerWidth<a;function u(){const e=m.c(2),[l,n]=r.useState(o);let t,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{const i=()=>n(o),c=globalThis.matchMedia(`(max-width: ${a-1}px)`);return c.addEventListener("change",i),n(o),()=>c.removeEventListener("change",i)},s=[],e[0]=t,e[1]=s):(t=e[0],s=e[1]),r.useEffect(t,s),l}export{u};
1
+ import{c as m,r}from"./index-smTHcnUA.js";const a=768,o=()=>globalThis.innerWidth<a;function u(){const e=m.c(2),[l,n]=r.useState(o);let t,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{const i=()=>n(o),c=globalThis.matchMedia(`(max-width: ${a-1}px)`);return c.addEventListener("change",i),n(o),()=>c.removeEventListener("change",i)},s=[],e[0]=t,e[1]=s):(t=e[0],s=e[1]),r.useEffect(t,s),l}export{u};
@@ -1 +1 @@
1
- import{L as v,r as f,c as C,j as K,b as j,D as M,a as N}from"./index-BHn6e0Se.js";import{u as F}from"./use-virtual-mcp-RUDrgBDG.js";const h="__tool_call_runs__",R=["requires_action","in_progress","failed","expired","completed"];function tt(t){const e=new Map(R.map(r=>[r,[]]));for(const r of t){const n=r.status??"completed";(e.get(n)??e.get("completed")).push(r)}return R.map(r=>({status:r,threads:e.get(r)}))}function et(t,e){const r=new Map;for(const a of t){if(a.id.startsWith("thrd_welcome_"))continue;const u=a.virtual_mcp_id??h,d=r.get(u);d?(d.threads.push(a),(a.updated_at??"")>d.latestUpdatedAt&&(d.latestUpdatedAt=a.updated_at??"")):r.set(u,{virtualMcpId:u,threads:[a],latestUpdatedAt:a.updated_at??""})}const n=e!==null?r.get(e):void 0;n&&e&&r.delete(e);const s=r.get(h);s&&r.delete(h);const o=[...r.values()].sort((a,u)=>u.latestUpdatedAt.localeCompare(a.latestUpdatedAt)),i=[];return e&&i.push(n??{virtualMcpId:e,threads:[],latestUpdatedAt:""}),i.push(...o),s&&s.threads.length>0&&i.push(s),i}function rt(t,e){if(e.size===0)return t;const r=[],n=new Map;for(const s of t){const o=e.get(s.virtualMcpId);if(o){const a=n.get(o);if(a)a.threads=[...a.threads,...s.threads],s.latestUpdatedAt>a.latestUpdatedAt&&(a.latestUpdatedAt=s.latestUpdatedAt);else{const u={virtualMcpId:o,threads:[...s.threads],latestUpdatedAt:s.latestUpdatedAt};n.set(o,u),r.push(u)}continue}const i=n.get(s.virtualMcpId);if(i)i.threads=[...s.threads,...i.threads],s.latestUpdatedAt>i.latestUpdatedAt&&(i.latestUpdatedAt=s.latestUpdatedAt);else{const a={...s,threads:[...s.threads]};n.set(s.virtualMcpId,a),r.push(a)}}return r}const x=new Map,I=new Map;function P(t){return`${t.orgId}:${t.userId}`}function E(t){return`sidebar.group-order.${t}`}function O(t){try{const e=localStorage.getItem(t),r=e?JSON.parse(e):[];return Array.isArray(r)?r.filter(n=>typeof n=="string"):[]}catch{return[]}}function T(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function L(t){const e=P(t),r=x.get(e);if(r)return r;const n=v.sidebarGroupOrder(t.orgId,t.userId);let s=!1;try{s=localStorage.getItem(n)!==null}catch{}let o=O(n);if(!s&&o.length===0&&t.userId!=="anon"){const i=O(E(t.orgId));i.length>0&&(o=i)}return x.set(e,o),o}function p(t,e){const r=new Set(e);return L(t).filter(n=>!r.has(n))}function g(t,e){x.set(P(t),e),T(v.sidebarGroupOrder(t.orgId,t.userId),e)}function m(t){const e=I.get(t);if(e)return e;const r=O(v.sidebarOrgPinnedOrder(t));return I.set(t,r),r}function S(t,e){I.set(t,e),T(v.sidebarOrgPinnedOrder(t),e)}function nt(t,e){g(t,e)}function st(t,e){S(t,e)}function k(t,e){return t===e||t===h}function w(t,e){return e.includes(t)}function q(t,e){return t.map(r=>r.virtualMcpId).filter(r=>!k(r,e))}function ot(t,e,r,n){const s=new Set(n);return q(t,r).filter(o=>e==="org"?s.has(o):!s.has(o))}function B(t,e){const r=new Set(t),n=e.filter(s=>!r.has(s));return n.length===0?t:[...t,...n]}function at(t,e,r){const n=new Set(r),s=[],o=[];let i,a;for(const u of t){const d=u.virtualMcpId;if(e&&d===e){i=u;continue}if(d===h){a=u;continue}if(n.has(d)){s.push(u);continue}o.push(u)}return{decopilot:i,orgPinned:s,user:o,toolCallRuns:a}}function $(t,e,r,n=[],s=[]){const o=r?t.find(c=>c.virtualMcpId===r):void 0,i=t.find(c=>c.virtualMcpId===h),a=new Set(n),u=n.filter(c=>!k(c,r)),d=B(s,u),l=e.filter(c=>!a.has(c)),b=new Map(t.map(c=>[c.virtualMcpId,c])),A=c=>{const G=b.get(c);return G||{virtualMcpId:c,threads:[],latestUpdatedAt:""}},_=d.filter(c=>a.has(c)).map(A),D=l.map(A),U=[];return o&&U.push(o),U.push(..._,...D),i&&U.push(i),{groups:U,userOrder:l,orgOrder:_.map(c=>c.virtualMcpId)}}function J(t,e){const r=new Set(e);m(t.orgId).length===0&&e.length>0&&S(t.orgId,[...e]);const s=v.sidebarGroupOrder(t.orgId,t.userId);if(O(s).length>0)return;const o=O(E(t.orgId));if(o.length===0)return;const i=o.filter(a=>!r.has(a));g(t,i)}function Y(t,e){const r=new Set(e),n=L(t),s=n.filter(o=>!r.has(o));s.length!==n.length&&g(t,s)}function it(t,e,r,n=[]){J(t,n),Y(t,n);const s=p(t,n),o=m(t.orgId),{userOrder:i,orgOrder:a}=$(e,s,r,n,o);(i.length!==s.length||i.some((u,d)=>u!==s[d]))&&g(t,i),(a.length!==o.length||a.some((u,d)=>u!==o[d]))&&S(t.orgId,a)}function ut(t,e,r,n=[]){const s=p(t,n),o=m(t.orgId);return $(e,s,r,n,o).groups}function dt(t,e,r){if(r){const o=p(t,[e]).filter(a=>a!==e);g(t,o);const i=m(t.orgId);i.includes(e)||S(t.orgId,[...i,e]);return}const n=m(t.orgId).filter(o=>o!==e);S(t.orgId,n);const s=p(t,[]);s.includes(e)||g(t,[...s,e])}function z(t,e,r=[]){if(r.includes(e))return;const n=p(t,r);n.includes(e)||g(t,[e,...n])}function ct(t,e,r=[]){const n=p(t,r),s=n.filter(o=>o!==e);s.length!==n.length&&g(t,s)}function lt(t,e,r){const n=t.indexOf(e),s=t.indexOf(r);if(n===-1||s===-1||n===s)return t;const o=[...t],[i]=o.splice(n,1);return i===void 0?t:(o.splice(s,0,i),o)}function ft(t,e,r,n){if(t==="org")return n;const s=p(e,r),o=new Set(n),i=s.filter(a=>!o.has(a));return[...n,...i]}function gt(t,e,r){const n=w(t,r),s=w(e,r);return n===s}const y=f.createContext(null);function pt(t){const e=C.c(7),{children:r}=t,[n,s]=f.useState(!1),[o,i]=f.useState(0);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>i(W),e[0]=a):a=e[0];const u=a;let d;e[1]!==n||e[2]!==o?(d={empty:n,setEmpty:s,orderRevision:o,bumpOrderRevision:u},e[1]=n,e[2]=o,e[3]=d):d=e[3];let l;return e[4]!==r||e[5]!==d?(l=K.jsx(y.Provider,{value:d,children:r}),e[4]=r,e[5]=d,e[6]=l):l=e[6],l}function W(t){return t+1}function ht(){return f.useContext(y)?.empty??!1}function Ot(){return f.useContext(y)?.orderRevision??0}function H(){return f.useContext(y)?.bumpOrderRevision??Q}function Q(){}function mt(t){const{value:e}=t,r=f.useContext(y),[n,s]=f.useState(null);return r&&n!==e&&(r.setEmpty(e),s(e)),null}function X(t){return(t??[]).filter(e=>!!e.pinned).map(e=>e.id)}function St(){const t=C.c(9),e=j(),{org:r}=M(),n=F(),{data:s}=N.useSession(),o=s?.user?.id??"anon";let i;t[0]!==n?(i=X(n),t[0]=n,t[1]=i):i=t[1];const a=i,u=H();let d;return t[2]!==u||t[3]!==e||t[4]!==r.id||t[5]!==r.slug||t[6]!==a||t[7]!==o?(d=(l,b)=>{z({orgId:r.id,userId:o},l,a),u();const A=crypto.randomUUID();e({to:"/$org/$taskId",params:{org:r.slug,taskId:A},search:{...b?.search??{},virtualmcpid:l}})},t[2]=u,t[3]=e,t[4]=r.id,t[5]=r.slug,t[6]=a,t[7]=o,t[8]=d):d=t[8],d}export{mt as S,h as T,H as a,z as b,gt as c,ft as d,st as e,nt as f,X as g,it as h,ut as i,Ot as j,rt as k,et as l,St as m,tt as n,ct as o,at as p,dt as q,lt as r,ot as s,pt as t,ht as u};
1
+ import{L as v,r as f,c as C,j as K,b as j,D as M,a as N}from"./index-smTHcnUA.js";import{u as F}from"./use-virtual-mcp-nCKsVOOs.js";const h="__tool_call_runs__",R=["requires_action","in_progress","failed","expired","completed"];function tt(t){const e=new Map(R.map(r=>[r,[]]));for(const r of t){const n=r.status??"completed";(e.get(n)??e.get("completed")).push(r)}return R.map(r=>({status:r,threads:e.get(r)}))}function et(t,e){const r=new Map;for(const a of t){if(a.id.startsWith("thrd_welcome_"))continue;const u=a.virtual_mcp_id??h,d=r.get(u);d?(d.threads.push(a),(a.updated_at??"")>d.latestUpdatedAt&&(d.latestUpdatedAt=a.updated_at??"")):r.set(u,{virtualMcpId:u,threads:[a],latestUpdatedAt:a.updated_at??""})}const n=e!==null?r.get(e):void 0;n&&e&&r.delete(e);const s=r.get(h);s&&r.delete(h);const o=[...r.values()].sort((a,u)=>u.latestUpdatedAt.localeCompare(a.latestUpdatedAt)),i=[];return e&&i.push(n??{virtualMcpId:e,threads:[],latestUpdatedAt:""}),i.push(...o),s&&s.threads.length>0&&i.push(s),i}function rt(t,e){if(e.size===0)return t;const r=[],n=new Map;for(const s of t){const o=e.get(s.virtualMcpId);if(o){const a=n.get(o);if(a)a.threads=[...a.threads,...s.threads],s.latestUpdatedAt>a.latestUpdatedAt&&(a.latestUpdatedAt=s.latestUpdatedAt);else{const u={virtualMcpId:o,threads:[...s.threads],latestUpdatedAt:s.latestUpdatedAt};n.set(o,u),r.push(u)}continue}const i=n.get(s.virtualMcpId);if(i)i.threads=[...s.threads,...i.threads],s.latestUpdatedAt>i.latestUpdatedAt&&(i.latestUpdatedAt=s.latestUpdatedAt);else{const a={...s,threads:[...s.threads]};n.set(s.virtualMcpId,a),r.push(a)}}return r}const x=new Map,I=new Map;function P(t){return`${t.orgId}:${t.userId}`}function E(t){return`sidebar.group-order.${t}`}function O(t){try{const e=localStorage.getItem(t),r=e?JSON.parse(e):[];return Array.isArray(r)?r.filter(n=>typeof n=="string"):[]}catch{return[]}}function T(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function L(t){const e=P(t),r=x.get(e);if(r)return r;const n=v.sidebarGroupOrder(t.orgId,t.userId);let s=!1;try{s=localStorage.getItem(n)!==null}catch{}let o=O(n);if(!s&&o.length===0&&t.userId!=="anon"){const i=O(E(t.orgId));i.length>0&&(o=i)}return x.set(e,o),o}function p(t,e){const r=new Set(e);return L(t).filter(n=>!r.has(n))}function g(t,e){x.set(P(t),e),T(v.sidebarGroupOrder(t.orgId,t.userId),e)}function m(t){const e=I.get(t);if(e)return e;const r=O(v.sidebarOrgPinnedOrder(t));return I.set(t,r),r}function S(t,e){I.set(t,e),T(v.sidebarOrgPinnedOrder(t),e)}function nt(t,e){g(t,e)}function st(t,e){S(t,e)}function k(t,e){return t===e||t===h}function w(t,e){return e.includes(t)}function q(t,e){return t.map(r=>r.virtualMcpId).filter(r=>!k(r,e))}function ot(t,e,r,n){const s=new Set(n);return q(t,r).filter(o=>e==="org"?s.has(o):!s.has(o))}function B(t,e){const r=new Set(t),n=e.filter(s=>!r.has(s));return n.length===0?t:[...t,...n]}function at(t,e,r){const n=new Set(r),s=[],o=[];let i,a;for(const u of t){const d=u.virtualMcpId;if(e&&d===e){i=u;continue}if(d===h){a=u;continue}if(n.has(d)){s.push(u);continue}o.push(u)}return{decopilot:i,orgPinned:s,user:o,toolCallRuns:a}}function $(t,e,r,n=[],s=[]){const o=r?t.find(c=>c.virtualMcpId===r):void 0,i=t.find(c=>c.virtualMcpId===h),a=new Set(n),u=n.filter(c=>!k(c,r)),d=B(s,u),l=e.filter(c=>!a.has(c)),b=new Map(t.map(c=>[c.virtualMcpId,c])),A=c=>{const G=b.get(c);return G||{virtualMcpId:c,threads:[],latestUpdatedAt:""}},_=d.filter(c=>a.has(c)).map(A),D=l.map(A),U=[];return o&&U.push(o),U.push(..._,...D),i&&U.push(i),{groups:U,userOrder:l,orgOrder:_.map(c=>c.virtualMcpId)}}function J(t,e){const r=new Set(e);m(t.orgId).length===0&&e.length>0&&S(t.orgId,[...e]);const s=v.sidebarGroupOrder(t.orgId,t.userId);if(O(s).length>0)return;const o=O(E(t.orgId));if(o.length===0)return;const i=o.filter(a=>!r.has(a));g(t,i)}function Y(t,e){const r=new Set(e),n=L(t),s=n.filter(o=>!r.has(o));s.length!==n.length&&g(t,s)}function it(t,e,r,n=[]){J(t,n),Y(t,n);const s=p(t,n),o=m(t.orgId),{userOrder:i,orgOrder:a}=$(e,s,r,n,o);(i.length!==s.length||i.some((u,d)=>u!==s[d]))&&g(t,i),(a.length!==o.length||a.some((u,d)=>u!==o[d]))&&S(t.orgId,a)}function ut(t,e,r,n=[]){const s=p(t,n),o=m(t.orgId);return $(e,s,r,n,o).groups}function dt(t,e,r){if(r){const o=p(t,[e]).filter(a=>a!==e);g(t,o);const i=m(t.orgId);i.includes(e)||S(t.orgId,[...i,e]);return}const n=m(t.orgId).filter(o=>o!==e);S(t.orgId,n);const s=p(t,[]);s.includes(e)||g(t,[...s,e])}function z(t,e,r=[]){if(r.includes(e))return;const n=p(t,r);n.includes(e)||g(t,[e,...n])}function ct(t,e,r=[]){const n=p(t,r),s=n.filter(o=>o!==e);s.length!==n.length&&g(t,s)}function lt(t,e,r){const n=t.indexOf(e),s=t.indexOf(r);if(n===-1||s===-1||n===s)return t;const o=[...t],[i]=o.splice(n,1);return i===void 0?t:(o.splice(s,0,i),o)}function ft(t,e,r,n){if(t==="org")return n;const s=p(e,r),o=new Set(n),i=s.filter(a=>!o.has(a));return[...n,...i]}function gt(t,e,r){const n=w(t,r),s=w(e,r);return n===s}const y=f.createContext(null);function pt(t){const e=C.c(7),{children:r}=t,[n,s]=f.useState(!1),[o,i]=f.useState(0);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>i(W),e[0]=a):a=e[0];const u=a;let d;e[1]!==n||e[2]!==o?(d={empty:n,setEmpty:s,orderRevision:o,bumpOrderRevision:u},e[1]=n,e[2]=o,e[3]=d):d=e[3];let l;return e[4]!==r||e[5]!==d?(l=K.jsx(y.Provider,{value:d,children:r}),e[4]=r,e[5]=d,e[6]=l):l=e[6],l}function W(t){return t+1}function ht(){return f.useContext(y)?.empty??!1}function Ot(){return f.useContext(y)?.orderRevision??0}function H(){return f.useContext(y)?.bumpOrderRevision??Q}function Q(){}function mt(t){const{value:e}=t,r=f.useContext(y),[n,s]=f.useState(null);return r&&n!==e&&(r.setEmpty(e),s(e)),null}function X(t){return(t??[]).filter(e=>!!e.pinned).map(e=>e.id)}function St(){const t=C.c(9),e=j(),{org:r}=M(),n=F(),{data:s}=N.useSession(),o=s?.user?.id??"anon";let i;t[0]!==n?(i=X(n),t[0]=n,t[1]=i):i=t[1];const a=i,u=H();let d;return t[2]!==u||t[3]!==e||t[4]!==r.id||t[5]!==r.slug||t[6]!==a||t[7]!==o?(d=(l,b)=>{z({orgId:r.id,userId:o},l,a),u();const A=crypto.randomUUID();e({to:"/$org/$taskId",params:{org:r.slug,taskId:A},search:{...b?.search??{},virtualmcpid:l}})},t[2]=u,t[3]=e,t[4]=r.id,t[5]=r.slug,t[6]=a,t[7]=o,t[8]=d):d=t[8],d}export{mt as S,h as T,H as a,z as b,gt as c,ft as d,st as e,nt as f,X as g,it as h,ut as i,Ot as j,rt as k,et as l,St as m,tt as n,ct as o,at as p,dt as q,lt as r,ot as s,pt as t,ht as u};
@@ -1 +1 @@
1
- import{c as x,D as j,a as i}from"./index-BHn6e0Se.js";function A(){const e=x.c(32),{org:O}=j(),o=O.id;let z;e[0]!==o?(z=R=>(f=>i.organization[R]({...f??{},organizationId:o})),e[0]=o,e[1]=z):z=e[1];const t=z;let M;e[2]!==o?(M=R=>(f=>{const y={...f??{}},h=y.query??{};return y.query={...h,organizationId:o},i.organization[R](y)}),e[2]=o,e[3]=M):M=e[3];const n=M;let a,r;e[4]!==n?(a=n("listMembers"),r=n("listRoles"),e[4]=n,e[5]=a,e[6]=r):(a=e[5],r=e[6]);let l,s,c,g,u,m,d,v,b;e[7]!==t?(g=t("inviteMember"),u=t("removeMember"),m=t("updateMemberRole"),d=t("addMember"),v=t("createRole"),b=t("updateRole"),l=t("deleteRole"),s=t("cancelInvitation"),c=t("update"),e[7]=t,e[8]=l,e[9]=s,e[10]=c,e[11]=g,e[12]=u,e[13]=m,e[14]=d,e[15]=v,e[16]=b):(l=e[8],s=e[9],c=e[10],g=e[11],u=e[12],m=e[13],d=e[14],v=e[15],b=e[16]);let p;e[17]!==n?(p=n("getActiveMember"),e[17]=n,e[18]=p):p=e[18];let I;return e[19]!==l||e[20]!==s||e[21]!==c||e[22]!==p||e[23]!==a||e[24]!==r||e[25]!==g||e[26]!==u||e[27]!==m||e[28]!==d||e[29]!==v||e[30]!==b?(I={organization:{listMembers:a,listRoles:r,inviteMember:g,removeMember:u,updateMemberRole:m,addMember:d,createRole:v,updateRole:b,deleteRole:l,cancelInvitation:s,update:c,getActiveMember:p,acceptInvitation:i.organization.acceptInvitation,rejectInvitation:i.organization.rejectInvitation,getInvitation:i.organization.getInvitation,list:i.organization.list,create:i.organization.create,getFullOrganization:i.organization.getFullOrganization}},e[19]=l,e[20]=s,e[21]=c,e[22]=p,e[23]=a,e[24]=r,e[25]=g,e[26]=u,e[27]=m,e[28]=d,e[29]=v,e[30]=b,e[31]=I):I=e[31],I}export{A as u};
1
+ import{c as x,D as j,a as i}from"./index-smTHcnUA.js";function A(){const e=x.c(32),{org:O}=j(),o=O.id;let z;e[0]!==o?(z=R=>(f=>i.organization[R]({...f??{},organizationId:o})),e[0]=o,e[1]=z):z=e[1];const t=z;let M;e[2]!==o?(M=R=>(f=>{const y={...f??{}},h=y.query??{};return y.query={...h,organizationId:o},i.organization[R](y)}),e[2]=o,e[3]=M):M=e[3];const n=M;let a,r;e[4]!==n?(a=n("listMembers"),r=n("listRoles"),e[4]=n,e[5]=a,e[6]=r):(a=e[5],r=e[6]);let l,s,c,g,u,m,d,v,b;e[7]!==t?(g=t("inviteMember"),u=t("removeMember"),m=t("updateMemberRole"),d=t("addMember"),v=t("createRole"),b=t("updateRole"),l=t("deleteRole"),s=t("cancelInvitation"),c=t("update"),e[7]=t,e[8]=l,e[9]=s,e[10]=c,e[11]=g,e[12]=u,e[13]=m,e[14]=d,e[15]=v,e[16]=b):(l=e[8],s=e[9],c=e[10],g=e[11],u=e[12],m=e[13],d=e[14],v=e[15],b=e[16]);let p;e[17]!==n?(p=n("getActiveMember"),e[17]=n,e[18]=p):p=e[18];let I;return e[19]!==l||e[20]!==s||e[21]!==c||e[22]!==p||e[23]!==a||e[24]!==r||e[25]!==g||e[26]!==u||e[27]!==m||e[28]!==d||e[29]!==v||e[30]!==b?(I={organization:{listMembers:a,listRoles:r,inviteMember:g,removeMember:u,updateMemberRole:m,addMember:d,createRole:v,updateRole:b,deleteRole:l,cancelInvitation:s,update:c,getActiveMember:p,acceptInvitation:i.organization.acceptInvitation,rejectInvitation:i.organization.rejectInvitation,getInvitation:i.organization.getInvitation,list:i.organization.list,create:i.organization.create,getFullOrganization:i.organization.getFullOrganization}},e[19]=l,e[20]=s,e[21]=c,e[22]=p,e[23]=a,e[24]=r,e[25]=g,e[26]=u,e[27]=m,e[28]=d,e[29]=v,e[30]=b,e[31]=I):I=e[31],I}export{A as u};
@@ -1 +1 @@
1
- import{c as u,k as S,m as l,d as y,K as c}from"./index-BHn6e0Se.js";function w(o,a){const e=u.c(8);let s;e[0]!==o?(s=c.orgSsoStatus(o??""),e[0]=o,e[1]=s):s=e[1];let t;e[2]!==a?(t=async()=>{const r=await fetch(`/api/${a}/sso/status`);if(!r.ok)throw new Error("Failed to check SSO status");return r.json()},e[2]=a,e[3]=t):t=e[3];const n=!!o&&!!a;let i;return e[4]!==s||e[5]!==t||e[6]!==n?(i={queryKey:s,queryFn:t,enabled:n},e[4]=s,e[5]=t,e[6]=n,e[7]=i):i=e[7],S(i)}function m(o,a){const e=u.c(8);let s;e[0]!==o?(s=c.orgSsoConfig(o??""),e[0]=o,e[1]=s):s=e[1];let t;e[2]!==a?(t=async()=>{const r=await fetch(`/api/${a}/sso/config`);if(!r.ok)throw new Error("Failed to fetch SSO config");return r.json()},e[2]=a,e[3]=t):t=e[3];const n=!!o&&!!a;let i;return e[4]!==s||e[5]!==t||e[6]!==n?(i={queryKey:s,queryFn:t,enabled:n},e[4]=s,e[5]=t,e[6]=n,e[7]=i):i=e[7],S(i)}function q(o,a){const e=u.c(8),s=l();let t;e[0]!==a?(t=async r=>{const f=await fetch(`/api/${a}/sso/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!f.ok){const p=await f.json();throw new Error(p.error||"Failed to save SSO config")}return f.json()},e[0]=a,e[1]=t):t=e[1];let n;e[2]!==o||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(o)}),s.invalidateQueries({queryKey:c.orgSsoStatus(o)})},e[2]=o,e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==t||e[6]!==n?(i={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=i):i=e[7],y(i)}function C(o,a){const e=u.c(8),s=l();let t;e[0]!==a?(t=async()=>{const r=await fetch(`/api/${a}/sso/config`,{method:"DELETE"});if(!r.ok)throw new Error("Failed to delete SSO config");return r.json()},e[0]=a,e[1]=t):t=e[1];let n;e[2]!==o||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(o)}),s.invalidateQueries({queryKey:c.orgSsoStatus(o)})},e[2]=o,e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==t||e[6]!==n?(i={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=i):i=e[7],y(i)}function O(o,a){const e=u.c(8),s=l();let t;e[0]!==a?(t=async r=>{const f=await fetch(`/api/${a}/sso/config/enforce`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enforced:r})});if(!f.ok)throw new Error("Failed to toggle SSO enforcement");return f.json()},e[0]=a,e[1]=t):t=e[1];let n;e[2]!==o||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(o)}),s.invalidateQueries({queryKey:c.orgSsoStatus(o)})},e[2]=o,e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==t||e[6]!==n?(i={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=i):i=e[7],y(i)}export{m as a,q as b,C as c,O as d,w as u};
1
+ import{c as u,k as S,m as l,d as y,K as c}from"./index-smTHcnUA.js";function w(o,a){const e=u.c(8);let s;e[0]!==o?(s=c.orgSsoStatus(o??""),e[0]=o,e[1]=s):s=e[1];let t;e[2]!==a?(t=async()=>{const r=await fetch(`/api/${a}/sso/status`);if(!r.ok)throw new Error("Failed to check SSO status");return r.json()},e[2]=a,e[3]=t):t=e[3];const n=!!o&&!!a;let i;return e[4]!==s||e[5]!==t||e[6]!==n?(i={queryKey:s,queryFn:t,enabled:n},e[4]=s,e[5]=t,e[6]=n,e[7]=i):i=e[7],S(i)}function m(o,a){const e=u.c(8);let s;e[0]!==o?(s=c.orgSsoConfig(o??""),e[0]=o,e[1]=s):s=e[1];let t;e[2]!==a?(t=async()=>{const r=await fetch(`/api/${a}/sso/config`);if(!r.ok)throw new Error("Failed to fetch SSO config");return r.json()},e[2]=a,e[3]=t):t=e[3];const n=!!o&&!!a;let i;return e[4]!==s||e[5]!==t||e[6]!==n?(i={queryKey:s,queryFn:t,enabled:n},e[4]=s,e[5]=t,e[6]=n,e[7]=i):i=e[7],S(i)}function q(o,a){const e=u.c(8),s=l();let t;e[0]!==a?(t=async r=>{const f=await fetch(`/api/${a}/sso/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!f.ok){const p=await f.json();throw new Error(p.error||"Failed to save SSO config")}return f.json()},e[0]=a,e[1]=t):t=e[1];let n;e[2]!==o||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(o)}),s.invalidateQueries({queryKey:c.orgSsoStatus(o)})},e[2]=o,e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==t||e[6]!==n?(i={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=i):i=e[7],y(i)}function C(o,a){const e=u.c(8),s=l();let t;e[0]!==a?(t=async()=>{const r=await fetch(`/api/${a}/sso/config`,{method:"DELETE"});if(!r.ok)throw new Error("Failed to delete SSO config");return r.json()},e[0]=a,e[1]=t):t=e[1];let n;e[2]!==o||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(o)}),s.invalidateQueries({queryKey:c.orgSsoStatus(o)})},e[2]=o,e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==t||e[6]!==n?(i={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=i):i=e[7],y(i)}function O(o,a){const e=u.c(8),s=l();let t;e[0]!==a?(t=async r=>{const f=await fetch(`/api/${a}/sso/config/enforce`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enforced:r})});if(!f.ok)throw new Error("Failed to toggle SSO enforcement");return f.json()},e[0]=a,e[1]=t):t=e[1];let n;e[2]!==o||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(o)}),s.invalidateQueries({queryKey:c.orgSsoStatus(o)})},e[2]=o,e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==t||e[6]!==n?(i={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=i):i=e[7],y(i)}export{m as a,q as b,C as c,O as d,w as u};
@@ -1 +1 @@
1
- import{c as S,j as n,l as v,D as T,k as B,K as P}from"./index-BHn6e0Se.js";import{e as k,d as I,a as A,T as L,b as z,c as O}from"./table-DFbId_dZ.js";import{a as K,n as D}from"./SwitchHorizontal01-CmA6k3Gw.js";import{u as E}from"./use-org-auth-client-BtI7VkGK.js";function H(h){const e=S.c(29),{columns:t,data:m,sortKey:p,sortDirection:d,onSort:o,onRowClick:a,rowClassName:s}=h;let l;e[0]!==d?(l=function(r,N){return n.jsx("div",{className:"w-4 flex items-center justify-center",children:N&&d&&(d==="asc"?n.jsx(K,{size:16,className:"text-muted-foreground transition-colors"}):n.jsx(D,{size:16,className:"text-muted-foreground transition-colors"}))})},e[0]=d,e[1]=l):l=e[1];const i=l;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=function(r,N){let y="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider";return r===N-1&&(y="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider w-8"),y},e[2]=c):c=e[2];const u=c;let f;if(e[3]!==t||e[4]!==o||e[5]!==i||e[6]!==p){let x;e[8]!==t.length||e[9]!==o||e[10]!==i||e[11]!==p?(x=(r,N)=>{const y=p===r.id;return n.jsx(k,{className:v(u(N,t.length),"group transition-colors select-none",r.sortable&&"hover:bg-accent cursor-pointer",r.rowClassName,r.cellClassName),onClick:r.sortable&&o?()=>o(r.id):void 0,children:n.jsxs("span",{className:"flex items-center gap-1",children:[r.header,r.sortable&&i(r.id,y)]})},r.id)},e[8]=t.length,e[9]=o,e[10]=i,e[11]=p,e[12]=x):x=e[12],f=t.map(x),e[3]=t,e[4]=o,e[5]=i,e[6]=p,e[7]=f}else f=e[7];let w;e[13]!==f?(w=n.jsx(I,{className:"border-b-0",children:n.jsx(A,{className:"h-9 hover:bg-transparent border-b border-border",children:f})}),e[13]=f,e[14]=w):w=e[14];let g;if(e[15]!==t||e[16]!==m||e[17]!==a||e[18]!==s){let x;e[20]!==t||e[21]!==a||e[22]!==s?(x=(r,N)=>{const y=s?.(r);return n.jsx(A,{"data-row-index":N,className:v("group/data-row transition-colors border-b-0 hover:bg-accent/50",a?"cursor-pointer":"",y),onClick:a?()=>a(r):void 0,children:t.map(b=>n.jsx(L,{className:v("px-5 py-4 h-16 align-middle text-sm text-foreground",b.cellClassName,b.wrap?"whitespace-normal wrap-break-word":""),children:n.jsx("div",{className:v(b.wrap?"w-full":"min-w-0 w-full",!b.wrap&&"truncate overflow-hidden whitespace-nowrap"),children:b.render?b.render(r):b.accessor?b.accessor(r):null})},b.id))},N)},e[20]=t,e[21]=a,e[22]=s,e[23]=x):x=e[23],g=m.map(x),e[15]=t,e[16]=m,e[17]=a,e[18]=s,e[19]=g}else g=e[19];let C;e[24]!==g?(C=n.jsx(z,{children:g}),e[24]=g,e[25]=C):C=e[25];let j;return e[26]!==w||e[27]!==C?(j=n.jsxs(O,{className:"w-full border-collapse",children:[w,C]}),e[26]=w,e[27]=C,e[28]=j):j=e[28],j}function W(h){const e=S.c(12),{columns:t,data:m,isLoading:p,sortKey:d,sortDirection:o,onSort:a,onRowClick:s,emptyState:l}=h;if(p===void 0?!1:p){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"text-muted-foreground",children:"Loading..."})}),e[0]=u):u=e[0],u}if(m.length===0){let u;e[1]!==l?(u=l||n.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No items found"}),e[1]=l,e[2]=u):u=e[2];let f;return e[3]!==u?(f=n.jsx("div",{className:"flex items-center justify-center h-full",children:u}),e[3]=u,e[4]=f):f=e[4],f}let c;return e[5]!==t||e[6]!==m||e[7]!==s||e[8]!==a||e[9]!==o||e[10]!==d?(c=n.jsx("div",{className:"flex-1",children:n.jsx(H,{columns:t,data:m,sortKey:d,sortDirection:o,onSort:a,onRowClick:s})}),e[5]=t,e[6]=m,e[7]=s,e[8]=a,e[9]=o,e[10]=d,e[11]=c):c=e[11],c}const R=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function M(h){return h.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function U(h){if(!h)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1,modelCount:0,allowsAllModels:!1};const e=[];let t=!1;const m=[];let p=!1;const d=new Set;let o=!1,a=0,s=!1;for(const[l,i]of Object.entries(h)){if(l==="self"){i.includes("*")?t=!0:e.push(...i);continue}if(l==="models"){i.includes("*:*")?s=!0:a=i.length;continue}if(l==="*"){if(p=!0,i.includes("*"))o=!0;else for(const c of i)d.add(c);continue}if(m.push(l),i.includes("*"))o=!0;else for(const c of i)d.add(c)}return{staticPermissions:e,allowsAllStaticPermissions:t,connectionIds:m,allowsAllConnections:p,toolNames:Array.from(d),allowsAllTools:o,modelCount:a,allowsAllModels:s}}function Y(){const{locator:h}=T(),e=E(),{data:t,isLoading:m,error:p,refetch:d}=B({queryKey:P.organizationRoles(h),queryFn:async()=>{try{const s=await e.organization.listRoles();return s?.error?(console.error("[useOrganizationRoles] API error:",s.error),[]):s?.data??[]}catch(s){return console.error("[useOrganizationRoles] Fetch error:",s),[]}},staleTime:3e4}),o=R.map(s=>({role:s.value,label:s.label,isBuiltin:s.isBuiltin}));if(t&&Array.isArray(t))for(const s of t){const l=s.role;if(!l||R.some(x=>x.value===l))continue;const{staticPermissions:i,allowsAllStaticPermissions:c,connectionIds:u,allowsAllConnections:f,toolNames:w,allowsAllTools:g,modelCount:C,allowsAllModels:j}=U(s.permission);o.push({id:s.id,role:l,label:M(l),isBuiltin:!1,permission:s.permission??void 0,staticPermissionCount:c?-1:i.length,allowsAllStaticPermissions:c,connectionCount:f?-1:u.length,allowsAllConnections:f,toolCount:g?-1:w.length,allowsAllTools:g,modelCount:j?-1:C,allowsAllModels:j})}const a=o.filter(s=>!s.isBuiltin);return{roles:o,customRoles:a,builtinRoles:o.filter(s=>s.isBuiltin),isLoading:m,error:p,refetch:d}}export{W as C,Y as u};
1
+ import{c as S,j as n,l as v,D as T,k as B,K as P}from"./index-smTHcnUA.js";import{e as k,d as I,a as A,T as L,b as z,c as O}from"./table-BPRYh1TO.js";import{a as K,n as D}from"./SwitchHorizontal01-CWvc9zWe.js";import{u as E}from"./use-org-auth-client-CVxnVAwj.js";function H(h){const e=S.c(29),{columns:t,data:m,sortKey:p,sortDirection:d,onSort:o,onRowClick:a,rowClassName:s}=h;let l;e[0]!==d?(l=function(r,N){return n.jsx("div",{className:"w-4 flex items-center justify-center",children:N&&d&&(d==="asc"?n.jsx(K,{size:16,className:"text-muted-foreground transition-colors"}):n.jsx(D,{size:16,className:"text-muted-foreground transition-colors"}))})},e[0]=d,e[1]=l):l=e[1];const i=l;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=function(r,N){let y="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider";return r===N-1&&(y="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider w-8"),y},e[2]=c):c=e[2];const u=c;let f;if(e[3]!==t||e[4]!==o||e[5]!==i||e[6]!==p){let x;e[8]!==t.length||e[9]!==o||e[10]!==i||e[11]!==p?(x=(r,N)=>{const y=p===r.id;return n.jsx(k,{className:v(u(N,t.length),"group transition-colors select-none",r.sortable&&"hover:bg-accent cursor-pointer",r.rowClassName,r.cellClassName),onClick:r.sortable&&o?()=>o(r.id):void 0,children:n.jsxs("span",{className:"flex items-center gap-1",children:[r.header,r.sortable&&i(r.id,y)]})},r.id)},e[8]=t.length,e[9]=o,e[10]=i,e[11]=p,e[12]=x):x=e[12],f=t.map(x),e[3]=t,e[4]=o,e[5]=i,e[6]=p,e[7]=f}else f=e[7];let w;e[13]!==f?(w=n.jsx(I,{className:"border-b-0",children:n.jsx(A,{className:"h-9 hover:bg-transparent border-b border-border",children:f})}),e[13]=f,e[14]=w):w=e[14];let g;if(e[15]!==t||e[16]!==m||e[17]!==a||e[18]!==s){let x;e[20]!==t||e[21]!==a||e[22]!==s?(x=(r,N)=>{const y=s?.(r);return n.jsx(A,{"data-row-index":N,className:v("group/data-row transition-colors border-b-0 hover:bg-accent/50",a?"cursor-pointer":"",y),onClick:a?()=>a(r):void 0,children:t.map(b=>n.jsx(L,{className:v("px-5 py-4 h-16 align-middle text-sm text-foreground",b.cellClassName,b.wrap?"whitespace-normal wrap-break-word":""),children:n.jsx("div",{className:v(b.wrap?"w-full":"min-w-0 w-full",!b.wrap&&"truncate overflow-hidden whitespace-nowrap"),children:b.render?b.render(r):b.accessor?b.accessor(r):null})},b.id))},N)},e[20]=t,e[21]=a,e[22]=s,e[23]=x):x=e[23],g=m.map(x),e[15]=t,e[16]=m,e[17]=a,e[18]=s,e[19]=g}else g=e[19];let C;e[24]!==g?(C=n.jsx(z,{children:g}),e[24]=g,e[25]=C):C=e[25];let j;return e[26]!==w||e[27]!==C?(j=n.jsxs(O,{className:"w-full border-collapse",children:[w,C]}),e[26]=w,e[27]=C,e[28]=j):j=e[28],j}function W(h){const e=S.c(12),{columns:t,data:m,isLoading:p,sortKey:d,sortDirection:o,onSort:a,onRowClick:s,emptyState:l}=h;if(p===void 0?!1:p){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"text-muted-foreground",children:"Loading..."})}),e[0]=u):u=e[0],u}if(m.length===0){let u;e[1]!==l?(u=l||n.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No items found"}),e[1]=l,e[2]=u):u=e[2];let f;return e[3]!==u?(f=n.jsx("div",{className:"flex items-center justify-center h-full",children:u}),e[3]=u,e[4]=f):f=e[4],f}let c;return e[5]!==t||e[6]!==m||e[7]!==s||e[8]!==a||e[9]!==o||e[10]!==d?(c=n.jsx("div",{className:"flex-1",children:n.jsx(H,{columns:t,data:m,sortKey:d,sortDirection:o,onSort:a,onRowClick:s})}),e[5]=t,e[6]=m,e[7]=s,e[8]=a,e[9]=o,e[10]=d,e[11]=c):c=e[11],c}const R=[{value:"owner",label:"Owner",isBuiltin:!0},{value:"admin",label:"Admin",isBuiltin:!0},{value:"user",label:"User",isBuiltin:!0}];function M(h){return h.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function U(h){if(!h)return{staticPermissions:[],allowsAllStaticPermissions:!1,connectionIds:[],allowsAllConnections:!1,toolNames:[],allowsAllTools:!1,modelCount:0,allowsAllModels:!1};const e=[];let t=!1;const m=[];let p=!1;const d=new Set;let o=!1,a=0,s=!1;for(const[l,i]of Object.entries(h)){if(l==="self"){i.includes("*")?t=!0:e.push(...i);continue}if(l==="models"){i.includes("*:*")?s=!0:a=i.length;continue}if(l==="*"){if(p=!0,i.includes("*"))o=!0;else for(const c of i)d.add(c);continue}if(m.push(l),i.includes("*"))o=!0;else for(const c of i)d.add(c)}return{staticPermissions:e,allowsAllStaticPermissions:t,connectionIds:m,allowsAllConnections:p,toolNames:Array.from(d),allowsAllTools:o,modelCount:a,allowsAllModels:s}}function Y(){const{locator:h}=T(),e=E(),{data:t,isLoading:m,error:p,refetch:d}=B({queryKey:P.organizationRoles(h),queryFn:async()=>{try{const s=await e.organization.listRoles();return s?.error?(console.error("[useOrganizationRoles] API error:",s.error),[]):s?.data??[]}catch(s){return console.error("[useOrganizationRoles] Fetch error:",s),[]}},staleTime:3e4}),o=R.map(s=>({role:s.value,label:s.label,isBuiltin:s.isBuiltin}));if(t&&Array.isArray(t))for(const s of t){const l=s.role;if(!l||R.some(x=>x.value===l))continue;const{staticPermissions:i,allowsAllStaticPermissions:c,connectionIds:u,allowsAllConnections:f,toolNames:w,allowsAllTools:g,modelCount:C,allowsAllModels:j}=U(s.permission);o.push({id:s.id,role:l,label:M(l),isBuiltin:!1,permission:s.permission??void 0,staticPermissionCount:c?-1:i.length,allowsAllStaticPermissions:c,connectionCount:f?-1:u.length,allowsAllConnections:f,toolCount:g?-1:w.length,allowsAllTools:g,modelCount:j?-1:C,allowsAllModels:j})}const a=o.filter(s=>!s.isBuiltin);return{roles:o,customRoles:a,builtinRoles:o.filter(s=>s.isBuiltin),isLoading:m,error:p,refetch:d}}export{W as C,Y as u};
@@ -1 +1 @@
1
- import{K as d,c as l,D as g,k as E,m as I,d as R,r as b}from"./index-BHn6e0Se.js";import{W as G}from"./use-mcp-client-BbksZMyI.js";import{c as M,u as Q}from"./studio-tools-By-RAUnB.js";const N={organizationId:"",sidebar_items:null,enabled_plugins:null,registry_config:null,simple_mode:null,default_home_agents:null},O={tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}};function w(t,e){return{queryKey:d.organizationSettings(e),queryFn:async()=>{try{return await M(t,"ORGANIZATION_SETTINGS_GET",{})}catch{return{...N,organizationId:e}}},staleTime:6e4}}function h(t){const e=l.c(6),{org:s}=g();let n;e[0]!==s.id||e[1]!==s.slug?(n=w(s.slug,s.id),e[0]=s.id,e[1]=s.slug,e[2]=n):n=e[2];const i=t;let r;return e[3]!==n||e[4]!==i?(r={...n,select:i},e[3]=n,e[4]=i,e[5]=r):r=e[5],E(r)}function W(t,e){const s=l.c(3);let n;s[0]!==t||s[1]!==e?(n=w(e,t),s[0]=t,s[1]=e,s[2]=n):n=s[2];const{data:i}=E(n);return i??null}function S(){const t=l.c(9),{org:e}=g(),s=Q(),n=I();let i;t[0]!==e||t[1]!==s?(i=async u=>{const o=await s.call("ORGANIZATION_SETTINGS_UPDATE",{organizationId:e.id,...u});if(!o)throw new Error("ORGANIZATION_SETTINGS_UPDATE returned no payload");return o},t[0]=e,t[1]=s,t[2]=i):i=t[2];let r;t[3]!==e||t[4]!==n?(r=u=>{n.setQueryData(d.organizationSettings(e.id),o=>({...o??N,...u}))},t[3]=e,t[4]=n,t[5]=r):r=t[5];let a;return t[6]!==i||t[7]!==r?(a={mutationFn:i,onSuccess:r},t[6]=i,t[7]=r,t[8]=a):a=t[8],R(a)}function C(t){return t?.tiers?{tiers:{fast:t.tiers.fast??null,smart:t.tiers.smart??null,thinking:t.tiers.thinking??null,image:t.tiers.image??null,web_search:t.tiers.web_search??null,deep_research:t.tiers.deep_research??null}}:O}function Z(){const{data:t}=h(P);return t??O}function P(t){return C(t.simple_mode)}function F(){const t=l.c(7),e=S();let s,n;t[0]!==e?(s=(r,a)=>e.mutate({simple_mode:r},a),n=(r,a)=>e.mutateAsync({simple_mode:r},a),t[0]=e,t[1]=s,t[2]=n):(s=t[1],n=t[2]);let i;return t[3]!==e||t[4]!==s||t[5]!==n?(i={...e,mutate:s,mutateAsync:n},t[3]=e,t[4]=s,t[5]=n,t[6]=i):i=t[6],i}function $(){const{data:t}=h(k);return t??null}function k(t){return t.registry_config}function j(){const t=l.c(7),e=S();let s,n;t[0]!==e?(s=(r,a)=>e.mutate({registry_config:r},a),n=(r,a)=>e.mutateAsync({registry_config:r},a),t[0]=e,t[1]=s,t[2]=n):(s=t[1],n=t[2]);let i;return t[3]!==e||t[4]!==s||t[5]!==n?(i={...e,mutate:s,mutateAsync:n},t[3]=e,t[4]=s,t[5]=n,t[6]=i):i=t[6],i}function B(){const{data:t}=h(x);return t??null}function x(t){return t.default_home_agents}function U(){const t=l.c(7),e=S();let s,n;t[0]!==e?(s=(r,a)=>e.mutate({default_home_agents:r},a),n=(r,a)=>e.mutateAsync({default_home_agents:r},a),t[0]=e,t[1]=s,t[2]=n):(s=t[1],n=t[2]);let i;return t[3]!==e||t[4]!==s||t[5]!==n?(i={...e,mutate:s,mutateAsync:n},t[3]=e,t[4]=s,t[5]=n,t[6]=i):i=t[6],i}function L(){const t=l.c(14),{org:e}=g(),s=U(),n=I();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=Promise.resolve(),t[0]=i):i=t[0];const r=b.useRef(i);let a;t[1]!==e.id?(a=d.organizationSettings(e.id),t[1]=e.id,t[2]=a):a=t[2];const u=a;let o;t[3]!==u||t[4]!==n?(o=()=>n.getQueryData(u)?.default_home_agents?.ids??[],t[3]=u,t[4]=n,t[5]=o):o=t[5];const _=o;let m;t[6]!==u||t[7]!==e.slug||t[8]!==n||t[9]!==s?(m=z=>{const T=r.current.then(async()=>{const A=n.getQueryData(u),p=z(A?.default_home_agents?.ids??[]);if(p!==null){n.setQueryData(u,c=>c&&{...c,default_home_agents:{ids:p}});try{await s.mutateAsync({ids:p}),await n.refetchQueries({queryKey:d.homeNextActions(e.slug),type:"active"})}catch(c){const D=c;throw n.setQueryData(u,A),D}}});return r.current=T.catch(q),T},t[6]=u,t[7]=e.slug,t[8]=n,t[9]=s,t[10]=m):m=t[10];const y=m;let f;return t[11]!==y||t[12]!==_?(f={currentIds:_,apply:y},t[11]=y,t[12]=_,t[13]=f):f=t[13],f}function q(){}function v(){const t=l.c(5),{org:e}=g(),s=$();let n;t[0]!==e.id?(n=G.REGISTRY(e.id),t[0]=e.id,t[1]=n):n=t[1];const i=n;let r;return t[2]!==i||t[3]!==s?(r=a=>{if(!s)return a===i;const u=s.registries[a];return u?u.enabled:a===i},t[2]=i,t[3]=s,t[4]=r):r=t[4],r}export{L as a,v as b,W as c,Z as d,F as e,$ as f,j as g,w as o,B as u};
1
+ import{K as d,c as l,D as g,k as E,m as I,d as R,r as b}from"./index-smTHcnUA.js";import{W as G}from"./use-mcp-client-SQJoN-V8.js";import{c as M,u as Q}from"./studio-tools-FklJDanw.js";const N={organizationId:"",sidebar_items:null,enabled_plugins:null,registry_config:null,simple_mode:null,default_home_agents:null},O={tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}};function w(t,e){return{queryKey:d.organizationSettings(e),queryFn:async()=>{try{return await M(t,"ORGANIZATION_SETTINGS_GET",{})}catch{return{...N,organizationId:e}}},staleTime:6e4}}function h(t){const e=l.c(6),{org:s}=g();let n;e[0]!==s.id||e[1]!==s.slug?(n=w(s.slug,s.id),e[0]=s.id,e[1]=s.slug,e[2]=n):n=e[2];const i=t;let r;return e[3]!==n||e[4]!==i?(r={...n,select:i},e[3]=n,e[4]=i,e[5]=r):r=e[5],E(r)}function W(t,e){const s=l.c(3);let n;s[0]!==t||s[1]!==e?(n=w(e,t),s[0]=t,s[1]=e,s[2]=n):n=s[2];const{data:i}=E(n);return i??null}function S(){const t=l.c(9),{org:e}=g(),s=Q(),n=I();let i;t[0]!==e||t[1]!==s?(i=async u=>{const o=await s.call("ORGANIZATION_SETTINGS_UPDATE",{organizationId:e.id,...u});if(!o)throw new Error("ORGANIZATION_SETTINGS_UPDATE returned no payload");return o},t[0]=e,t[1]=s,t[2]=i):i=t[2];let r;t[3]!==e||t[4]!==n?(r=u=>{n.setQueryData(d.organizationSettings(e.id),o=>({...o??N,...u}))},t[3]=e,t[4]=n,t[5]=r):r=t[5];let a;return t[6]!==i||t[7]!==r?(a={mutationFn:i,onSuccess:r},t[6]=i,t[7]=r,t[8]=a):a=t[8],R(a)}function C(t){return t?.tiers?{tiers:{fast:t.tiers.fast??null,smart:t.tiers.smart??null,thinking:t.tiers.thinking??null,image:t.tiers.image??null,web_search:t.tiers.web_search??null,deep_research:t.tiers.deep_research??null}}:O}function Z(){const{data:t}=h(P);return t??O}function P(t){return C(t.simple_mode)}function F(){const t=l.c(7),e=S();let s,n;t[0]!==e?(s=(r,a)=>e.mutate({simple_mode:r},a),n=(r,a)=>e.mutateAsync({simple_mode:r},a),t[0]=e,t[1]=s,t[2]=n):(s=t[1],n=t[2]);let i;return t[3]!==e||t[4]!==s||t[5]!==n?(i={...e,mutate:s,mutateAsync:n},t[3]=e,t[4]=s,t[5]=n,t[6]=i):i=t[6],i}function $(){const{data:t}=h(k);return t??null}function k(t){return t.registry_config}function j(){const t=l.c(7),e=S();let s,n;t[0]!==e?(s=(r,a)=>e.mutate({registry_config:r},a),n=(r,a)=>e.mutateAsync({registry_config:r},a),t[0]=e,t[1]=s,t[2]=n):(s=t[1],n=t[2]);let i;return t[3]!==e||t[4]!==s||t[5]!==n?(i={...e,mutate:s,mutateAsync:n},t[3]=e,t[4]=s,t[5]=n,t[6]=i):i=t[6],i}function B(){const{data:t}=h(x);return t??null}function x(t){return t.default_home_agents}function U(){const t=l.c(7),e=S();let s,n;t[0]!==e?(s=(r,a)=>e.mutate({default_home_agents:r},a),n=(r,a)=>e.mutateAsync({default_home_agents:r},a),t[0]=e,t[1]=s,t[2]=n):(s=t[1],n=t[2]);let i;return t[3]!==e||t[4]!==s||t[5]!==n?(i={...e,mutate:s,mutateAsync:n},t[3]=e,t[4]=s,t[5]=n,t[6]=i):i=t[6],i}function L(){const t=l.c(14),{org:e}=g(),s=U(),n=I();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=Promise.resolve(),t[0]=i):i=t[0];const r=b.useRef(i);let a;t[1]!==e.id?(a=d.organizationSettings(e.id),t[1]=e.id,t[2]=a):a=t[2];const u=a;let o;t[3]!==u||t[4]!==n?(o=()=>n.getQueryData(u)?.default_home_agents?.ids??[],t[3]=u,t[4]=n,t[5]=o):o=t[5];const _=o;let m;t[6]!==u||t[7]!==e.slug||t[8]!==n||t[9]!==s?(m=z=>{const T=r.current.then(async()=>{const A=n.getQueryData(u),p=z(A?.default_home_agents?.ids??[]);if(p!==null){n.setQueryData(u,c=>c&&{...c,default_home_agents:{ids:p}});try{await s.mutateAsync({ids:p}),await n.refetchQueries({queryKey:d.homeNextActions(e.slug),type:"active"})}catch(c){const D=c;throw n.setQueryData(u,A),D}}});return r.current=T.catch(q),T},t[6]=u,t[7]=e.slug,t[8]=n,t[9]=s,t[10]=m):m=t[10];const y=m;let f;return t[11]!==y||t[12]!==_?(f={currentIds:_,apply:y},t[11]=y,t[12]=_,t[13]=f):f=t[13],f}function q(){}function v(){const t=l.c(5),{org:e}=g(),s=$();let n;t[0]!==e.id?(n=G.REGISTRY(e.id),t[0]=e.id,t[1]=n):n=t[1];const i=n;let r;return t[2]!==i||t[3]!==s?(r=a=>{if(!s)return a===i;const u=s.registries[a];return u?u.enabled:a===i},t[2]=i,t[3]=s,t[4]=r):r=t[4],r}export{L as a,v as b,W as c,Z as d,F as e,$ as f,j as g,w as o,B as u};
@@ -1 +1 @@
1
- import{c as C,D as R}from"./index-BHn6e0Se.js";import{u as p}from"./use-connection-BXbi3G-n.js";import{W as a}from"./use-mcp-client-BbksZMyI.js";import{f as y}from"./use-organization-settings-BwYobfuk.js";function M(){const e=C.c(19),{org:i}=R(),o=y();let l;e[0]!==i.id?(l=a.REGISTRY(i.id),e[0]=i.id,e[1]=l):l=e[1];const d=l;let f;e[2]!==i.id?(f=a.COMMUNITY_REGISTRY(i.id),e[2]=i.id,e[3]=f):f=e[3];const g=f;let r;e[4]!==g||e[5]!==d?(r=[d,g],e[4]=g,e[5]=d,e[6]=r):r=e[6];let t;if(e[7]!==o||e[8]!==r){if(t=new Set(r),o?.registries){let s;e[10]!==o.registries?(s=Object.keys(o.registries),e[10]=o.registries,e[11]=s):s=e[11];for(const u of s)t.add(u)}e[7]=o,e[8]=r,e[9]=t}else t=e[9];const m=p();let n;e[12]!==m?(n=m??[],e[12]=m,e[13]=n):n=e[13];let c;if(e[14]!==t||e[15]!==n){let s;e[17]!==t?(s=u=>t.has(u.id),e[17]=t,e[18]=s):s=e[18],c=n.filter(s),e[14]=t,e[15]=n,e[16]=c}else c=e[16];return c}export{M as u};
1
+ import{c as C,D as R}from"./index-smTHcnUA.js";import{u as p}from"./use-connection-h3hvIRkK.js";import{W as a}from"./use-mcp-client-SQJoN-V8.js";import{f as y}from"./use-organization-settings-0OKnMPr2.js";function M(){const e=C.c(19),{org:i}=R(),o=y();let l;e[0]!==i.id?(l=a.REGISTRY(i.id),e[0]=i.id,e[1]=l):l=e[1];const d=l;let f;e[2]!==i.id?(f=a.COMMUNITY_REGISTRY(i.id),e[2]=i.id,e[3]=f):f=e[3];const g=f;let r;e[4]!==g||e[5]!==d?(r=[d,g],e[4]=g,e[5]=d,e[6]=r):r=e[6];let t;if(e[7]!==o||e[8]!==r){if(t=new Set(r),o?.registries){let s;e[10]!==o.registries?(s=Object.keys(o.registries),e[10]=o.registries,e[11]=s):s=e[11];for(const u of s)t.add(u)}e[7]=o,e[8]=r,e[9]=t}else t=e[9];const m=p();let n;e[12]!==m?(n=m??[],e[12]=m,e[13]=n):n=e[13];let c;if(e[14]!==t||e[15]!==n){let s;e[17]!==t?(s=u=>t.has(u.id),e[17]=t,e[18]=s):s=e[18],c=n.filter(s),e[14]=t,e[15]=n,e[16]=c}else c=e[16];return c}export{M as u};
@@ -1 +1 @@
1
- import{c as r,D as a,K as c,q as f,m as y,d as m}from"./index-BHn6e0Se.js";import{u as l}from"./studio-tools-By-RAUnB.js";function C(){const e=r.c(7),{org:o}=a(),u=l();let i;e[0]!==o.id?(i=c.secrets(o.id),e[0]=o.id,e[1]=i):i=e[1];let t;e[2]!==u?(t=async()=>await u.call("SECRET_LIST",{}),e[2]=u,e[3]=t):t=e[3];let s;e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6];const{data:n}=f(s);return n.secrets}function p(){const e=r.c(8),{org:o}=a(),u=l(),i=y();let t;e[0]!==u?(t=async d=>await u.call("SECRET_CREATE",{...d}),e[0]=u,e[1]=t):t=e[1];let s;e[2]!==o||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:c.secrets(o.id)})},e[2]=o,e[3]=i,e[4]=s):s=e[4];let n;return e[5]!==t||e[6]!==s?(n={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=n):n=e[7],m(n)}export{p as a,C as u};
1
+ import{c as r,D as a,K as c,q as f,m as y,d as m}from"./index-smTHcnUA.js";import{u as l}from"./studio-tools-FklJDanw.js";function C(){const e=r.c(7),{org:o}=a(),u=l();let i;e[0]!==o.id?(i=c.secrets(o.id),e[0]=o.id,e[1]=i):i=e[1];let t;e[2]!==u?(t=async()=>await u.call("SECRET_LIST",{}),e[2]=u,e[3]=t):t=e[3];let s;e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6];const{data:n}=f(s);return n.secrets}function p(){const e=r.c(8),{org:o}=a(),u=l(),i=y();let t;e[0]!==u?(t=async d=>await u.call("SECRET_CREATE",{...d}),e[0]=u,e[1]=t):t=e[1];let s;e[2]!==o||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:c.secrets(o.id)})},e[2]=o,e[3]=i,e[4]=s):s=e[4];let n;return e[5]!==t||e[6]!==s?(n={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=n):n=e[7],m(n)}export{p as a,C as u};
@@ -1 +1 @@
1
- import{r as o,c as m,J as h}from"./index-BHn6e0Se.js";import{p as R,q as I}from"./question-004-sINsf4GQ.js";import{d as y,D as S}from"./decopilot-sse-pool-BkD5Vlqs.js";const b=()=>0;function D(s){const{orgSlug:e,taskId:r,enabled:t=!0,onStep:n,onFinish:u,onTaskStatus:f}=s,l=o.useRef({taskId:r,onStep:n,onFinish:u,onTaskStatus:f});l.current={taskId:r,onStep:n,onFinish:u,onTaskStatus:f};const i=o.useRef(null),p=o.useRef(t),d=o.useRef(e);(!i.current||p.current!==t||d.current!==e)&&(p.current=t,d.current=e,i.current=E=>{if(!t||!e)return()=>{};const k=T=>{let a;try{a=JSON.parse(T.data)}catch{return}const c=l.current;if(!(c.taskId&&a.subject!==c.taskId)){switch(a.type){case S.STEP:c.onStep?.(a);break;case S.FINISH:c.onFinish?.(a);break;case S.THREAD_STATUS:c.onTaskStatus?.(a);break}E()}};return y.subscribe(e,k)}),o.useSyncExternalStore(i.current,b,b)}const O=new Set(["completed","failed","requires_action"]);function U(s){const e=m.c(5),[r]=h();let t;e[0]!==r?(t=u=>{r.enableSounds&&O.has(u.data.status)&&R(I.dataUri).catch(_)},e[0]=r,e[1]=t):t=e[1];let n;e[2]!==s||e[3]!==t?(n={orgSlug:s,onTaskStatus:t},e[2]=s,e[3]=t,e[4]=n):n=e[4],D(n)}function _(s){console.warn("[status-sounds] playback failed:",s)}export{U as u};
1
+ import{r as o,c as m,J as h}from"./index-smTHcnUA.js";import{p as R,q as I}from"./question-004-sINsf4GQ.js";import{d as y,D as S}from"./decopilot-sse-pool-BVQiWKqJ.js";const b=()=>0;function D(s){const{orgSlug:e,taskId:r,enabled:t=!0,onStep:n,onFinish:u,onTaskStatus:f}=s,l=o.useRef({taskId:r,onStep:n,onFinish:u,onTaskStatus:f});l.current={taskId:r,onStep:n,onFinish:u,onTaskStatus:f};const i=o.useRef(null),p=o.useRef(t),d=o.useRef(e);(!i.current||p.current!==t||d.current!==e)&&(p.current=t,d.current=e,i.current=E=>{if(!t||!e)return()=>{};const k=T=>{let a;try{a=JSON.parse(T.data)}catch{return}const c=l.current;if(!(c.taskId&&a.subject!==c.taskId)){switch(a.type){case S.STEP:c.onStep?.(a);break;case S.FINISH:c.onFinish?.(a);break;case S.THREAD_STATUS:c.onTaskStatus?.(a);break}E()}};return y.subscribe(e,k)}),o.useSyncExternalStore(i.current,b,b)}const O=new Set(["completed","failed","requires_action"]);function U(s){const e=m.c(5),[r]=h();let t;e[0]!==r?(t=u=>{r.enableSounds&&O.has(u.data.status)&&R(I.dataUri).catch(_)},e[0]=r,e[1]=t):t=e[1];let n;e[2]!==s||e[3]!==t?(n={orgSlug:s,onTaskStatus:t},e[2]=s,e[3]=t,e[4]=n):n=e[4],D(n)}function _(s){console.warn("[status-sounds] playback failed:",s)}export{U as u};
@@ -1 +1 @@
1
- import{c as p,r as f}from"./index-BHn6e0Se.js";import{u as w}from"./use-mobile-D4nRxsIe.js";function S(m,M){const e=p.c(12),u=M===void 0?"cards":M,o=w(),b=f.useRef(o),s=m?`deco-view-mode-${m}`:"deco-view-mode";let i;e[0]!==u||e[1]!==s?(i=()=>{const r=globalThis.localStorage?.getItem(s);return r==="cards"||r==="table"?r:u},e[0]=u,e[1]=s,e[2]=i):i=e[2];const[t,g]=f.useState(i);let l;e[3]!==s?(l=r=>{g(r),globalThis.localStorage?.setItem(s,r)},e[3]=s,e[4]=l):l=e[4];const d=l;let c,a;e[5]!==o||e[6]!==t?(c=()=>{!b.current&&o&&t==="table"&&g("cards"),b.current=o},a=[o,t],e[5]=o,e[6]=t,e[7]=c,e[8]=a):(c=e[7],a=e[8]),f.useEffect(c,a);let n;return e[9]!==d||e[10]!==t?(n=[t,d],e[9]=d,e[10]=t,e[11]=n):n=e[11],n}export{S as u};
1
+ import{c as p,r as f}from"./index-smTHcnUA.js";import{u as w}from"./use-mobile-CvCMlflA.js";function S(m,M){const e=p.c(12),u=M===void 0?"cards":M,o=w(),b=f.useRef(o),s=m?`deco-view-mode-${m}`:"deco-view-mode";let i;e[0]!==u||e[1]!==s?(i=()=>{const r=globalThis.localStorage?.getItem(s);return r==="cards"||r==="table"?r:u},e[0]=u,e[1]=s,e[2]=i):i=e[2];const[t,g]=f.useState(i);let l;e[3]!==s?(l=r=>{g(r),globalThis.localStorage?.setItem(s,r)},e[3]=s,e[4]=l):l=e[4];const d=l;let c,a;e[5]!==o||e[6]!==t?(c=()=>{!b.current&&o&&t==="table"&&g("cards"),b.current=o},a=[o,t],e[5]=o,e[6]=t,e[7]=c,e[8]=a):(c=e[7],a=e[8]),f.useEffect(c,a);let n;return e[9]!==d||e[10]!==t?(n=[t,d],e[9]=d,e[10]=t,e[11]=n):n=e[11],n}export{S as u};
@@ -1 +1 @@
1
- import{c as a,D as d,aK as p,k as P}from"./index-BHn6e0Se.js";import{b as L,a as S,u as V,c as _}from"./use-collections-ZFJu8_05.js";import{S as g,u as I}from"./use-mcp-client-BbksZMyI.js";function v(s){const t=a.c(5);let e;t[0]!==s?(e=s===void 0?{}:s,t[0]=s,t[1]=e):e=t[1];const n=e,{org:i}=d();let o;t[2]!==i.id||t[3]!==i.slug?(o={connectionId:g,orgId:i.id,orgSlug:i.slug},t[2]=i.id,t[3]=i.slug,t[4]=o):o=t[4];const l=I(o);return L(i.id,"VIRTUAL_MCP",l,n)}function R(s,t,e){return _(s,"VIRTUAL_MCP",t??void 0,e)}function b(s){const t=a.c(3),{org:e}=d();let n;t[0]!==e.id||t[1]!==e.slug?(n={connectionId:g,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=n):n=t[2];const i=I(n);return V(e.id,"VIRTUAL_MCP",s??void 0,i)}function E(s){const t=a.c(15),{org:e}=d();let n;t[0]!==e.id||t[1]!==e.slug?(n={connectionId:g,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=n):n=t[2];const i=I(n);let o,l,c;t[3]!==s||t[4]!==e.id?(o=[...s].sort(),c=P,l=p.virtualMcpLastUsed(e.id,o),t[3]=s,t[4]=e.id,t[5]=o,t[6]=l,t[7]=c):(o=t[5],l=t[6],c=t[7]);const C=o.length>0;let u;t[8]!==i||t[9]!==o?(u=async()=>{const M=(await i.callTool({name:"VIRTUAL_MCP_LAST_USED_LIST",arguments:{ids:o}})).structuredContent??{items:[]},f=new Map;for(const m of M.items)f.set(m.id,m);return f},t[8]=i,t[9]=o,t[10]=u):u=t[10];let r;return t[11]!==l||t[12]!==C||t[13]!==u?(r={queryKey:l,enabled:C,staleTime:3e4,queryFn:u},t[11]=l,t[12]=C,t[13]=u,t[14]=r):r=t[14],c(r)}function $(){const s=a.c(3),{org:t}=d();let e;s[0]!==t.id||s[1]!==t.slug?(e={connectionId:g,orgId:t.id,orgSlug:t.slug},s[0]=t.id,s[1]=t.slug,s[2]=e):e=s[2];const n=I(e);return S(t.id,"VIRTUAL_MCP",n)}export{b as a,$ as b,E as c,v as u,R as v};
1
+ import{c as a,D as d,aK as p,k as P}from"./index-smTHcnUA.js";import{b as L,a as S,u as V,c as _}from"./use-collections-Dh2p4suc.js";import{S as g,u as I}from"./use-mcp-client-SQJoN-V8.js";function v(s){const t=a.c(5);let e;t[0]!==s?(e=s===void 0?{}:s,t[0]=s,t[1]=e):e=t[1];const n=e,{org:i}=d();let o;t[2]!==i.id||t[3]!==i.slug?(o={connectionId:g,orgId:i.id,orgSlug:i.slug},t[2]=i.id,t[3]=i.slug,t[4]=o):o=t[4];const l=I(o);return L(i.id,"VIRTUAL_MCP",l,n)}function R(s,t,e){return _(s,"VIRTUAL_MCP",t??void 0,e)}function b(s){const t=a.c(3),{org:e}=d();let n;t[0]!==e.id||t[1]!==e.slug?(n={connectionId:g,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=n):n=t[2];const i=I(n);return V(e.id,"VIRTUAL_MCP",s??void 0,i)}function E(s){const t=a.c(15),{org:e}=d();let n;t[0]!==e.id||t[1]!==e.slug?(n={connectionId:g,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=n):n=t[2];const i=I(n);let o,l,c;t[3]!==s||t[4]!==e.id?(o=[...s].sort(),c=P,l=p.virtualMcpLastUsed(e.id,o),t[3]=s,t[4]=e.id,t[5]=o,t[6]=l,t[7]=c):(o=t[5],l=t[6],c=t[7]);const C=o.length>0;let u;t[8]!==i||t[9]!==o?(u=async()=>{const M=(await i.callTool({name:"VIRTUAL_MCP_LAST_USED_LIST",arguments:{ids:o}})).structuredContent??{items:[]},f=new Map;for(const m of M.items)f.set(m.id,m);return f},t[8]=i,t[9]=o,t[10]=u):u=t[10];let r;return t[11]!==l||t[12]!==C||t[13]!==u?(r={queryKey:l,enabled:C,staleTime:3e4,queryFn:u},t[11]=l,t[12]=C,t[13]=u,t[14]=r):r=t[14],c(r)}function $(){const s=a.c(3),{org:t}=d();let e;s[0]!==t.id||s[1]!==t.slug?(e={connectionId:g,orgId:t.id,orgSlug:t.slug},s[0]=t.id,s[1]=t.slug,s[2]=e):e=s[2];const n=I(e);return S(t.id,"VIRTUAL_MCP",n)}export{b as a,$ as b,E as c,v as u,R as v};
@@ -0,0 +1 @@
1
+ import{I as u}from"./use-infinite-scroll-zQ1y1b1L.js";import{cJ as i}from"./index-smTHcnUA.js";function t(e,r){return i(e,u,r)}export{t as u};
@@ -0,0 +1 @@
1
+ import{I as s}from"./use-infinite-scroll-zQ1y1b1L.js";import{cJ as u,aC as n}from"./index-smTHcnUA.js";function a(r,e){return u({...r,enabled:!0,suspense:!0,throwOnError:n},s,e)}export{a as u};