decocms 4.417.4 → 4.417.5

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 (348) hide show
  1. package/dist/client/assets/{AlertCircle-D-RDeHL_.js → AlertCircle-BTsuLwP6.js} +1 -1
  2. package/dist/client/assets/{AreaChart-Du9fIZyN.js → AreaChart-DKu8CubV.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-DVpME15-.js → ArrowLeft-DGzzr8x9.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-CSNzIA9B.js → ArrowRight-Dl2v_8d5.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-BzLrItni.js → ArrowUp-By3k3jWG.js} +1 -1
  6. package/dist/client/assets/{CartesianChart-CWzZG7vp.js → CartesianChart-v1kR2jmL.js} +1 -1
  7. package/dist/client/assets/{Check-w1vYw5Rn.js → Check-DwW1N07y.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-Do4HhdGQ.js → CheckCircle-qeiQ8-HP.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-BWOObG8Z.js → ChevronUp-DZpr5n7U.js} +1 -1
  10. package/dist/client/assets/{Copy01-uPL40TdR.js → Copy01-DKuB4N5P.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-DaYOLDOz.js → CreditCard01-DZYNdkIx.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-vTwE8lBm.js → DotsVertical-DOrvBGTZ.js} +1 -1
  13. package/dist/client/assets/{ErrorBarContext-DtWLLN0s.js → ErrorBarContext-DmHUMiF6.js} +1 -1
  14. package/dist/client/assets/{Image01-BObY5rn9.js → Image01-CGZJJhMz.js} +1 -1
  15. package/dist/client/assets/{Key01-nM1-kqhR.js → Key01-BuNIcjUo.js} +1 -1
  16. package/dist/client/assets/{Line-ByBYLmfl.js → Line-CwkjG7A0.js} +1 -1
  17. package/dist/client/assets/{Link01-BS-vCNzQ.js → Link01-DDXPWbHG.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-DNLGj9_-.js → LinkExternal01-DtufCa9V.js} +1 -1
  19. package/dist/client/assets/{Monitor01-Csp3CK4O.js → Monitor01-Cf4vDeJz.js} +1 -1
  20. package/dist/client/assets/{Palette-tJixmc7V.js → Palette-Dt408Bw-.js} +1 -1
  21. package/dist/client/assets/{Plus-BvjmhLnx.js → Plus-BAPqh8Dc.js} +1 -1
  22. package/dist/client/assets/{SearchMd-Btx9xhJc.js → SearchMd-BijYU8F2.js} +1 -1
  23. package/dist/client/assets/{Sector-BuEtMqWH.js → Sector-DDkKH3q_.js} +1 -1
  24. package/dist/client/assets/{ShoppingBag01-DQq21IAe.js → ShoppingBag01-BAfU_RaG.js} +1 -1
  25. package/dist/client/assets/{Sun-BxhQc-kG.js → Sun-eG60Nvt5.js} +1 -1
  26. package/dist/client/assets/{Tool01-Booc4u0n.js → Tool01-DHqyhqw3.js} +1 -1
  27. package/dist/client/assets/{Trash01-D0KW49wY.js → Trash01-CfZM8GOt.js} +1 -1
  28. package/dist/client/assets/{Upload01-B58Org46.js → Upload01-CPR4XZ0W.js} +1 -1
  29. package/dist/client/assets/{User01-BMX3cjtL.js → User01-CAgei7Hi.js} +1 -1
  30. package/dist/client/assets/{UserSquare-CaMR-kX2.js → UserSquare-CtS19G8a.js} +1 -1
  31. package/dist/client/assets/{Users01-Cpn2NFdA.js → Users01-3GyH14E9.js} +1 -1
  32. package/dist/client/assets/{X-GZ5ISsIL.js → X-oOeqmdV1.js} +1 -1
  33. package/dist/client/assets/{XAxis-ClV1N0er.js → XAxis-DpDm-1ur.js} +1 -1
  34. package/dist/client/assets/{XClose-uQDj2qbC.js → XClose-D3fWIqtG.js} +1 -1
  35. package/dist/client/assets/{ZoomOut-DRn8fB1h.js → ZoomOut-DJEgC7Sb.js} +1 -1
  36. package/dist/client/assets/{access-gate-BYsqfzIM.js → access-gate-BgL259Tv.js} +1 -1
  37. package/dist/client/assets/{add-connection-dialog-CRBSt35d.js → add-connection-dialog-BxLMwKcG.js} +1 -1
  38. package/dist/client/assets/{agent-analytics-DaefJyfz.js → agent-analytics-CMV2ynyC.js} +1 -1
  39. package/dist/client/assets/agent-app-nfSdY_OQ.js +1 -0
  40. package/dist/client/assets/{agent-assets-CueXx4F5.js → agent-assets-Ci6MVLf6.js} +1 -1
  41. package/dist/client/assets/{agent-automation-DkBdrrfU.js → agent-automation-BxBwe0K6.js} +1 -1
  42. package/dist/client/assets/{agent-automations-C6RRWwz6.js → agent-automations-CcFs_YNk.js} +1 -1
  43. package/dist/client/assets/{agent-connect-sources-DhDB3N4T.js → agent-connect-sources-D4V48rR7.js} +1 -1
  44. package/dist/client/assets/agent-deck-BN2gwtOC.js +1 -0
  45. package/dist/client/assets/{agent-e2e-Dp4u7w2g.js → agent-e2e-BxTZlOFK.js} +1 -1
  46. package/dist/client/assets/{agent-experiments-DRMTNA2U.js → agent-experiments-CGISH7ir.js} +1 -1
  47. package/dist/client/assets/{agent-file-CT66eS5w.js → agent-file-BYI3KS2Z.js} +1 -1
  48. package/dist/client/assets/{agent-git-nSsJj1u6.js → agent-git-D3s49It2.js} +1 -1
  49. package/dist/client/assets/{agent-hosting-B6fNoXpD.js → agent-hosting-CA4xxoI_.js} +1 -1
  50. package/dist/client/assets/{agent-icon-DEau6pQP.js → agent-icon-B4pV7MHc.js} +1 -1
  51. package/dist/client/assets/agent-library-Bt56lxIs.js +1 -0
  52. package/dist/client/assets/agent-library-file-BuqghMai.js +1 -0
  53. package/dist/client/assets/{agent-monitor-BDRaIywC.js → agent-monitor-BusUyNzq.js} +1 -1
  54. package/dist/client/assets/{agent-overview-DFVO6q9A.js → agent-overview-BPL08YgO.js} +1 -1
  55. package/dist/client/assets/agent-settings-B-YuL73d.js +1 -0
  56. package/dist/client/assets/{agent-site-editor-BMW5L6IV.js → agent-site-editor-CHGryZAT.js} +1 -1
  57. package/dist/client/assets/agent-site-editor-code-BqY7geaP.js +2 -0
  58. package/dist/client/assets/{agent-site-editor-content-CSCyfyeX.js → agent-site-editor-content-Do8tTZlI.js} +3 -3
  59. package/dist/client/assets/{agent-site-editor-preview-DKOg_i1D.js → agent-site-editor-preview-gbQPj7GB.js} +3 -3
  60. package/dist/client/assets/{agent-view-guard-BIe92p9j.js → agent-view-guard-CSQfcvP5.js} +1 -1
  61. package/dist/client/assets/agent-view-nMpkh94x.js +1 -0
  62. package/dist/client/assets/{agents-list-CSqqNnUO.js → agents-list-CwhTzPGo.js} +1 -1
  63. package/dist/client/assets/{ai-providers-BFQ1D-GY.js → ai-providers-CHDm09s4.js} +1 -1
  64. package/dist/client/assets/{alert-RMwgFEjl.js → alert-9YmMwHFW.js} +1 -1
  65. package/dist/client/assets/{alert-dialog-CfArYE_c.js → alert-dialog-DC9yPqHA.js} +1 -1
  66. package/dist/client/assets/{analytics-sections-D-1nlDAW.js → analytics-sections-C5H0hGFs.js} +1 -1
  67. package/dist/client/assets/api-keys-CLZdLIyR.js +1 -0
  68. package/dist/client/assets/{api-keys-Bhmt-cmg.js → api-keys-wPdoRhJ6.js} +1 -1
  69. package/dist/client/assets/app-editor-C0hkimvD.js +1 -0
  70. package/dist/client/assets/{asset-utils-Bqr4qIJe.js → asset-utils-CTWmQh42.js} +1 -1
  71. package/dist/client/assets/{auth-CQNA1z0f.js → auth-CLy55jd3.js} +1 -1
  72. package/dist/client/assets/{auth-catchall-BxFOppl4.js → auth-catchall-D4kuDrLS.js} +1 -1
  73. package/dist/client/assets/{auth-entry-Bbaisicp.js → auth-entry-BwrbPh7N.js} +1 -1
  74. package/dist/client/assets/{auth-split-layout-49oocHo-.js → auth-split-layout-BxQ_8jTZ.js} +1 -1
  75. package/dist/client/assets/{authenticate-and-persist-oauth-BJFQcd7o.js → authenticate-and-persist-oauth-B8pM2pEE.js} +1 -1
  76. package/dist/client/assets/{automation-list-row-C0famSR9.js → automation-list-row-BYD2EpM9.js} +1 -1
  77. package/dist/client/assets/{automation-runs-BPy4kIqD.js → automation-runs-CwWBLxCL.js} +1 -1
  78. package/dist/client/assets/{automations-BFP3Ke2a.js → automations-CD9ugEPb.js} +1 -1
  79. package/dist/client/assets/{autosend-CbvWggSc.js → autosend-BLsBopsH.js} +1 -1
  80. package/dist/client/assets/{avatar-Dc1WJG2B.js → avatar-1IZuZCaD.js} +1 -1
  81. package/dist/client/assets/{badge-BdVhPCHH.js → badge-CKV4vWrX.js} +1 -1
  82. package/dist/client/assets/{block-document-CVYCq_wv.js → block-document-COQPfnST.js} +1 -1
  83. package/dist/client/assets/{blocks-preview-workspace-context-DdWA6c6d.js → blocks-preview-workspace-context-CCVx88kg.js} +1 -1
  84. package/dist/client/assets/{buckets-OMAyuLV_.js → buckets-B_1By_p8.js} +1 -1
  85. package/dist/client/assets/{build-improve-prompt-doc-B8BBh3al.js → build-improve-prompt-doc-V_cSolPH.js} +1 -1
  86. package/dist/client/assets/{calendar-B8FWjklL.js → calendar-5S8bCZT8.js} +1 -1
  87. package/dist/client/assets/{capability-load-error-Cq6dc5Ct.js → capability-load-error-DBzLEHg7.js} +1 -1
  88. package/dist/client/assets/{category-editor-DxRePoxi.js → category-editor-Bcsi75M0.js} +1 -1
  89. package/dist/client/assets/{chart-BPvWMbLQ.js → chart-P82FG_tK.js} +1 -1
  90. package/dist/client/assets/{chat-context-C7aSqPqa.js → chat-context-DX4-BYaP.js} +1 -1
  91. package/dist/client/assets/{chat-draft-BVrhHV88.js → chat-draft-DvxHfIYU.js} +1 -1
  92. package/dist/client/assets/{checkbox-BO8tS4tV.js → checkbox-Dtla-PS2.js} +1 -1
  93. package/dist/client/assets/{choose-editor-lrXJ4SHf.js → choose-editor-C7T6qp6e.js} +1 -1
  94. package/dist/client/assets/{claim-phase-copy-BvrYBprI.js → claim-phase-copy-QDhSVHhM.js} +1 -1
  95. package/dist/client/assets/{cli-auth-success-D_cyN7MO.js → cli-auth-success-BLUjCgBX.js} +1 -1
  96. package/dist/client/assets/{client-icons-CAEha1kZ.js → client-icons-Dyah4pEW.js} +1 -1
  97. package/dist/client/assets/{collapsible-DwKDkmXC.js → collapsible-Ppoaesu6.js} +1 -1
  98. package/dist/client/assets/{collection-detail-DA3LzFXF.js → collection-detail-jZNrSgCK.js} +1 -1
  99. package/dist/client/assets/{collection-display-button-lO-CMmO5.js → collection-display-button-Dp6pPm4n.js} +1 -1
  100. package/dist/client/assets/{collection-search-GlDfWrQl.js → collection-search-BICxywQA.js} +1 -1
  101. package/dist/client/assets/{collection-table-wrapper-DusEosLO.js → collection-table-wrapper-CeEhde2o.js} +1 -1
  102. package/dist/client/assets/{collection-tabs-YP0c1ElX.js → collection-tabs-C3e-Li7r.js} +1 -1
  103. package/dist/client/assets/{combobox-BQ871r-h.js → combobox-CM6xLmGx.js} +1 -1
  104. package/dist/client/assets/{command-CyoopJ8K.js → command-ByVvi9_U.js} +1 -1
  105. package/dist/client/assets/{companion-mcps-section-C2Vb43e4.js → companion-mcps-section-DNZFTJ-a.js} +1 -1
  106. package/dist/client/assets/{config-DZCXJYIW.js → config-DH8oh3tW.js} +1 -1
  107. package/dist/client/assets/{connect-qnqLIzRh.js → connect-LFtxQi8s.js} +1 -1
  108. package/dist/client/assets/{connect-layout-B1jMPAeE.js → connect-layout-E2RBl6Ct.js} +1 -1
  109. package/dist/client/assets/{connection-Rri6yxlM.js → connection-DvLjK40C.js} +1 -1
  110. package/dist/client/assets/{connection-card-8TfEtWEH.js → connection-card-C_RVqxjx.js} +1 -1
  111. package/dist/client/assets/{connection-detail-DBirmZxK.js → connection-detail-B-nn-CJi.js} +1 -1
  112. package/dist/client/assets/{connection-form-helpers-CWZFrP0F.js → connection-form-helpers-Bv3pz0CA.js} +1 -1
  113. package/dist/client/assets/{connections-D3VDo8nr.js → connections-BinLzD-D.js} +1 -1
  114. package/dist/client/assets/{context-D3uLAblj.js → context-CiYF-rh5.js} +1 -1
  115. package/dist/client/assets/{create-organization-dialog-CndqvoVa.js → create-organization-dialog-D33xqgNm.js} +1 -1
  116. package/dist/client/assets/{decopilot-Ch9InHOw.js → decopilot-LjR6b7ga.js} +1 -1
  117. package/dist/client/assets/{dialog-xO6pvTgy.js → dialog-BvEJdfIw.js} +1 -1
  118. package/dist/client/assets/{discover-Cznqo0l3.js → discover-BtjRgKmJ.js} +1 -1
  119. package/dist/client/assets/{domain-settings-rqOBcY7I.js → domain-settings-hImDtcD5.js} +1 -1
  120. package/dist/client/assets/{download-app-dialog-CkAPyUJk.js → download-app-dialog-CtAQKMSW.js} +1 -1
  121. package/dist/client/assets/{drawer-COUS-RMw.js → drawer-BicTll8u.js} +1 -1
  122. package/dist/client/assets/{editor-BtyNln47.js → editor-CoFAqe2C.js} +1 -1
  123. package/dist/client/assets/{empty-state-Ya1bFNQl.js → empty-state-CA3ormiX.js} +1 -1
  124. package/dist/client/assets/{empty-state-DFwLZdoG.js → empty-state-DnhBp1h5.js} +1 -1
  125. package/dist/client/assets/{extract-connection-data-CIQbUcLs.js → extract-connection-data-axftnFrB.js} +1 -1
  126. package/dist/client/assets/{feature-gate-CqOYZzVW.js → feature-gate-BcKrbYNy.js} +1 -1
  127. package/dist/client/assets/{feature-paywall-BbGJmd8V.js → feature-paywall-CB0Qn2Bq.js} +1 -1
  128. package/dist/client/assets/{file-explorer-DhprT-fW.js → file-explorer-DBxwTTfj.js} +1 -1
  129. package/dist/client/assets/{file-preview-vkQ_3IRk.js → file-preview-QzRRG48G.js} +1 -1
  130. package/dist/client/assets/{file-share-button-KyN_ryLY.js → file-share-button-Bawt0Ksq.js} +1 -1
  131. package/dist/client/assets/{file-type-icon-DnOhlq0D.js → file-type-icon-C6mE9Yr0.js} +1 -1
  132. package/dist/client/assets/flat-project-smTVMgKV.js +1 -0
  133. package/dist/client/assets/{folder-icon-OrJJEPYu.js → folder-icon-CdLBcpMj.js} +1 -1
  134. package/dist/client/assets/{form-DQ9-jmhe.js → form-CaBIgIfp.js} +1 -1
  135. package/dist/client/assets/{gateway-client-BuRwuqbN.js → gateway-client-C-d1oKsS.js} +1 -1
  136. package/dist/client/assets/{general-CGXMPZVk.js → general-DO0vQiXx.js} +1 -1
  137. package/dist/client/assets/{home-D_MaaqNX.js → home-Bj2HgUlH.js} +1 -1
  138. package/dist/client/assets/{index-DoNiXMF0.js → index-BON9J-ej.js} +1 -1
  139. package/dist/client/assets/{index-BQaeRUfV.js → index-BZDS7h9V.js} +3 -3
  140. package/dist/client/assets/{index-B8nxEgaa.js → index-BxNmMjUb.js} +1 -1
  141. package/dist/client/assets/{index-DEVMcvUD.js → index-C9AmrlMW.js} +1 -1
  142. package/dist/client/assets/{index-D_S3Goue.js → index-ChCss-xS.js} +1 -1
  143. package/dist/client/assets/{index-DQP_XHzw.js → index-D25OB5tF.js} +1 -1
  144. package/dist/client/assets/{index-CM1GEUnU.js → index-D4Ad4oIf.js} +1 -1
  145. package/dist/client/assets/{index-CucpNGrt.js → index-DT-BgvEY.js} +1 -1
  146. package/dist/client/assets/{index-D-ZSPXmz.js → index-DTi_8EH9.js} +1 -1
  147. package/dist/client/assets/{index-CgypgZBb.js → index-DcN4jJDF.js} +1 -1
  148. package/dist/client/assets/{index-Dh9Stq8K.js → index-Wpbx0F_i.js} +1 -1
  149. package/dist/client/assets/{index-CkLwsc_p.js → index-XO_IS67E.js} +1 -1
  150. package/dist/client/assets/{index-Ct7m_fV2.js → index-fYHyhz79.js} +1 -1
  151. package/dist/client/assets/{index-D5o3MLAb.js → index-iqYZGUMi.js} +1 -1
  152. package/dist/client/assets/{index-redirect-Cm2cYJFl.js → index-redirect-BaQ1WBT0.js} +1 -1
  153. package/dist/client/assets/{index-Cif-NWVp.js → index-x77A9vPM.js} +2 -2
  154. package/dist/client/assets/{infiniteQueryObserver-D0QSVh54.js → infiniteQueryObserver-DBdA2RmG.js} +1 -1
  155. package/dist/client/assets/{infra-billing-Cb-HjBhK.js → infra-billing-AvwbRAYz.js} +1 -1
  156. package/dist/client/assets/{input-DbFNrmyy.js → input-D3qm0D_n.js} +1 -1
  157. package/dist/client/assets/{input-D4o2a2Ep.js → input-DEqxPc0K.js} +1 -1
  158. package/dist/client/assets/{input-yDOZz3Y8.js → input-DcgPjq_6.js} +1 -1
  159. package/dist/client/assets/{integration-icon--ugXTzBB.js → integration-icon-BKPFLZgl.js} +1 -1
  160. package/dist/client/assets/{label-BpW4-JRS.js → label-B-8WnseZ.js} +1 -1
  161. package/dist/client/assets/{last-preview-page-a8RsgdMb.js → last-preview-page-mwce4AH7.js} +1 -1
  162. package/dist/client/assets/{layout-DY7R9ACY.js → layout-CQ-8jddO.js} +1 -1
  163. package/dist/client/assets/{legacy-agents-deep-BclzkLc2.js → legacy-agents-deep-DjPRSINS.js} +1 -1
  164. package/dist/client/assets/{legacy-main-redirect-BNn-8HmE.js → legacy-main-redirect-DpzooUgh.js} +1 -1
  165. package/dist/client/assets/library-Cq_S7tKW.js +1 -0
  166. package/dist/client/assets/{library-tab-BzjBKwRW.js → library-tab-BjTazv7d.js} +1 -1
  167. package/dist/client/assets/{login-Cq-Mw7Ax.js → login-Grr59FS1.js} +1 -1
  168. package/dist/client/assets/{markdown-C6J9WB-u.js → markdown-B_dOnnkA.js} +1 -1
  169. package/dist/client/assets/{mcp-app-renderer-Cx5zXS7D.js → mcp-app-renderer-BfC10crg.js} +1 -1
  170. package/dist/client/assets/{mcp-oauth-Mdi9G_nm.js → mcp-oauth-BAFbjwj9.js} +1 -1
  171. package/dist/client/assets/{members-MhRU-q21.js → members-DQoUZtQl.js} +1 -1
  172. package/dist/client/assets/{message-templates-iONRjWU5.js → message-templates-DHxoiLGB.js} +1 -1
  173. package/dist/client/assets/{mini-report-page-C-96hM-o.js → mini-report-page-C-ikMRBv.js} +1 -1
  174. package/dist/client/assets/{mock-board-B5JSRgZV.js → mock-board-DU0skkWP.js} +1 -1
  175. package/dist/client/assets/{monaco-editor-BfRzXiyl.js → monaco-editor-5jOm7mia.js} +1 -1
  176. package/dist/client/assets/{monitoring-stats-row-DCNb-RE6.js → monitoring-stats-row-DWAJcr8G.js} +1 -1
  177. package/dist/client/assets/{multi-select-BV4-qb8I.js → multi-select-DoVrlO9t.js} +1 -1
  178. package/dist/client/assets/{mustache-B2_LszoY.js → mustache-wY1rBqKZ.js} +1 -1
  179. package/dist/client/assets/{new-project-dialog-aG1LmqNx.js → new-project-dialog-CQC_PuUa.js} +1 -1
  180. package/dist/client/assets/{oauth-callback-BZEF6Vem.js → oauth-callback-DXpZGyRf.js} +1 -1
  181. package/dist/client/assets/{oauth-callback-ai-provider-DlkslXGA.js → oauth-callback-ai-provider-CDafbBpJ.js} +1 -1
  182. package/dist/client/assets/{onboarding-yk8kTMoW.js → onboarding-CL3TUDFt.js} +1 -1
  183. package/dist/client/assets/{optimistic-project-sidebar-views-BMOYZ8tf.js → optimistic-project-sidebar-views-CvY-u7mS.js} +1 -1
  184. package/dist/client/assets/{org-file-open-context-Dl3qgap2.js → org-file-open-context-avzppIYC.js} +1 -1
  185. package/dist/client/assets/{organization-choice-COhn6ce6.js → organization-choice-DYU6pSwT.js} +1 -1
  186. package/dist/client/assets/{orgs-DeRm5jIN.js → orgs-BcrOPuyW.js} +1 -1
  187. package/dist/client/assets/{page-seo-form-DO9uunbk.js → page-seo-form-CCyKtY6t.js} +1 -1
  188. package/dist/client/assets/{pair-CdNhWiUR.js → pair-5p-OkkFv.js} +1 -1
  189. package/dist/client/assets/{plan-ladder-CuLZkgBu.js → plan-ladder-Z8Ov45_0.js} +1 -1
  190. package/dist/client/assets/{popover-Cj-r--VT.js → popover-CGuWZpgs.js} +1 -1
  191. package/dist/client/assets/{post-calendar-_LPiIrzc.js → post-calendar-CHHA_0eo.js} +1 -1
  192. package/dist/client/assets/{post-editor-c1Rw9FQt.js → post-editor-DUFFmnys.js} +1 -1
  193. package/dist/client/assets/{preview-content-kIsMY8Nc.js → preview-content-BeK-qygw.js} +1 -1
  194. package/dist/client/assets/{preview-dialog-BHY_2jiF.js → preview-dialog-YNRkiNuc.js} +1 -1
  195. package/dist/client/assets/{profile-CzLV9KrB.js → profile-BQ6MhN9n.js} +1 -1
  196. package/dist/client/assets/{project-app-view-NADLDtxK.js → project-app-view-KenTc7sj.js} +1 -1
  197. package/dist/client/assets/{project-feed-IoR6hXa8.js → project-feed-CG0I6Cwi.js} +1 -1
  198. package/dist/client/assets/{project-icon-Ch4KDtlO.js → project-icon-DuA5BqEx.js} +1 -1
  199. package/dist/client/assets/project-reports-NUURSteE.js +1 -0
  200. package/dist/client/assets/project-tasks-VDudazRs.js +1 -0
  201. package/dist/client/assets/{projects-DDu44jkE.js → projects-Cve5c8oC.js} +1 -1
  202. package/dist/client/assets/{projects-empty-state-0uyJsqSZ.js → projects-empty-state-CogOcMqy.js} +1 -1
  203. package/dist/client/assets/{prompts-B_03RJAd.js → prompts-BbxmjW0H.js} +1 -1
  204. package/dist/client/assets/record-editor-f5Q1rDVw.js +1 -0
  205. package/dist/client/assets/{redirect-editor-CS_TZTOh.js → redirect-editor-O5_d-RCH.js} +1 -1
  206. package/dist/client/assets/reports-CbB48IkQ.js +1 -0
  207. package/dist/client/assets/{reports-UV35Nnxa.js → reports-CisQhIiX.js} +1 -1
  208. package/dist/client/assets/{reports-onboarding-DaFczo_9.js → reports-onboarding-DoAtxIFD.js} +1 -1
  209. package/dist/client/assets/{reports-tab-yhT8u52F.js → reports-tab-CT2RhgZr.js} +2 -2
  210. package/dist/client/assets/{repositories-Xv0E_Jwm.js → repositories-BVx7UkCV.js} +1 -1
  211. package/dist/client/assets/{repository-binding-DSb755tD.js → repository-binding-DnF7DtPp.js} +1 -1
  212. package/dist/client/assets/{repository-import-picker-DWKmc173.js → repository-import-picker-DXoExdKi.js} +1 -1
  213. package/dist/client/assets/{repository-picker-DTSlP9FP.js → repository-picker-DCI5UEX5.js} +1 -1
  214. package/dist/client/assets/{require-capability-Ds_HoNQH.js → require-capability-DuWmfC8I.js} +1 -1
  215. package/dist/client/assets/{required-auth-layout-BvMcqF9O.js → required-auth-layout-12WCpi4w.js} +1 -1
  216. package/dist/client/assets/{reset-password-C6aAd7Al.js → reset-password-CWRu5W7f.js} +1 -1
  217. package/dist/client/assets/{resizable-DXDqTm9t.js → resizable-BNzmA9qp.js} +1 -1
  218. package/dist/client/assets/{resolve-tab-icon-DQSu_41c.js → resolve-tab-icon-Lv7PQxZ6.js} +1 -1
  219. package/dist/client/assets/{review-settings-DAqIZhW5.js → review-settings-CzwijcHm.js} +1 -1
  220. package/dist/client/assets/{rich-text-link-control-CP22_7Wf.js → rich-text-link-control-CkQ6p8Xx.js} +1 -1
  221. package/dist/client/assets/{roles-aPjfAf7m.js → roles-BysU3Rpe.js} +1 -1
  222. package/dist/client/assets/{route-CprvV6pD.js → route-B5oBemI_.js} +1 -1
  223. package/dist/client/assets/route-CdatK3Bm.js +1 -0
  224. package/dist/client/assets/{route-D2tFYskN.js → route-DyP5s7nQ.js} +1 -1
  225. package/dist/client/assets/{runnable-block-editor-D1k-NHHE.js → runnable-block-editor-DGahzIAb.js} +1 -1
  226. package/dist/client/assets/{sandbox-lifecycle-context-Dy4CSxxD.js → sandbox-lifecycle-context-Ccql7Uia.js} +1 -1
  227. package/dist/client/assets/{schema-Dlgkjiv1.js → schema-CpRKAM53.js} +1 -1
  228. package/dist/client/assets/{scroll-area-DKF0wIhg.js → scroll-area-B5-mMcCX.js} +1 -1
  229. package/dist/client/assets/{search-input-D_Dm2H8K.js → search-input-Cbs7g-xg.js} +1 -1
  230. package/dist/client/assets/{search-toggle-P_agAdHY.js → search-toggle-CzlUPD_G.js} +1 -1
  231. package/dist/client/assets/{secret-picker-DlRxgG2v.js → secret-picker-7Q6C4NXK.js} +1 -1
  232. package/dist/client/assets/{secrets-51Ea1npI.js → secrets-B-NAChbp.js} +1 -1
  233. package/dist/client/assets/{sections-editor-Du3vUpgs.js → sections-editor-BQG_5BK9.js} +1 -1
  234. package/dist/client/assets/{select-Do8VXC56.js → select-B4XOGZTU.js} +1 -1
  235. package/dist/client/assets/{select-model-bKw7YzNa.js → select-model-B8wefayg.js} +1 -1
  236. package/dist/client/assets/{seo-editor-BT4GPyca.js → seo-editor-CDYa0kQa.js} +1 -1
  237. package/dist/client/assets/{separator-CRZXlLTM.js → separator-BbjRubpq.js} +1 -1
  238. package/dist/client/assets/{settings-tab-HRB7SJ4_.js → settings-tab-DpKcMylL.js} +1 -1
  239. package/dist/client/assets/{sheet-Da9g_BHH.js → sheet-bZQ40SkF.js} +1 -1
  240. package/dist/client/assets/{shell-layout-2lFwLRyB.js → shell-layout-CSsr2uWP.js} +1 -1
  241. package/dist/client/assets/{skills-DwgxN1Xl.js → skills-Dr6P_rBo.js} +1 -1
  242. package/dist/client/assets/{sso-BWJiOC7W.js → sso-CDxPw_PA.js} +1 -1
  243. package/dist/client/assets/{suggestion-CAkZpnvu.js → suggestion-BX4B9avx.js} +1 -1
  244. package/dist/client/assets/{switch-eabuBncZ.js → switch-DBoTA-Ic.js} +1 -1
  245. package/dist/client/assets/{synced-repos-DzoT266W.js → synced-repos-BgDcqvEb.js} +1 -1
  246. package/dist/client/assets/{tab-icon-glyph-BVKulhrq.js → tab-icon-glyph-BCXvAgfR.js} +1 -1
  247. package/dist/client/assets/{table-Ci0flHqR.js → table-IOARZzKK.js} +1 -1
  248. package/dist/client/assets/{tabs-oRlU6S30.js → tabs-NLPkjDTl.js} +1 -1
  249. package/dist/client/assets/{task-board-DIALSeie.js → task-board-rAAXtV0T.js} +1 -1
  250. package/dist/client/assets/{task-route-CIBFVNSC.js → task-route-CevqfkEg.js} +1 -1
  251. package/dist/client/assets/{task-status-cZ16StYI.js → task-status-E7m1TXip.js} +1 -1
  252. package/dist/client/assets/{taskboard-analytics-LqYaRFlI.js → taskboard-analytics-DVDUMRcu.js} +1 -1
  253. package/dist/client/assets/{tasks-CphA3EYZ.js → tasks-M-rYk1ck.js} +1 -1
  254. package/dist/client/assets/tasks-dceQAQHn.js +1 -0
  255. package/dist/client/assets/{textarea--vnsHs3x.js → textarea-CkGodJWZ.js} +1 -1
  256. package/dist/client/assets/{thread-analytics-DKUlf3RY.js → thread-analytics-Kyno_Q5c.js} +1 -1
  257. package/dist/client/assets/{thread-button-CsxctT-G.js → thread-button-Br8DvRAA.js} +1 -1
  258. package/dist/client/assets/{thread-intent-kYQuJDvD.js → thread-intent-B0cvv_hd.js} +1 -1
  259. package/dist/client/assets/{thread-route-De8K_tz3.js → thread-route-DvqLYqdY.js} +1 -1
  260. package/dist/client/assets/{thread-route-B3GsxAze.js → thread-route-IczHzLeC.js} +1 -1
  261. package/dist/client/assets/{thread-sheet-body-C0FrNJ9T.js → thread-sheet-body-DePTnYB6.js} +1 -1
  262. package/dist/client/assets/{toggle-group-CvgNphfI.js → toggle-group-gpRQDxvg.js} +1 -1
  263. package/dist/client/assets/{toolbar-icon-button-EcMyctyQ.js → toolbar-icon-button-BGzee4fP.js} +1 -1
  264. package/dist/client/assets/{tooltip-CnfGv3UJ.js → tooltip-BDq0JxVo.js} +1 -1
  265. package/dist/client/assets/{track-RhLhrXxZ.js → track-BGk_1HvC.js} +1 -1
  266. package/dist/client/assets/{types-oO8sHi9E.js → types-G8qvfMRt.js} +1 -1
  267. package/dist/client/assets/{usage-stats-DErvibLB.js → usage-stats-C0Xu5aUP.js} +1 -1
  268. package/dist/client/assets/{use-ai-providers-DOIgUjwL.js → use-ai-providers-CSZ-2eIg.js} +1 -1
  269. package/dist/client/assets/{use-automations-uekcK0KY.js → use-automations-CjNevLVU.js} +1 -1
  270. package/dist/client/assets/{use-autosave-CbOez7Yq.js → use-autosave-P84w8UFM.js} +1 -1
  271. package/dist/client/assets/{use-chat-layout-state-yrmi1Gwb.js → use-chat-layout-state-C1IHbIkQ.js} +1 -1
  272. package/dist/client/assets/{use-connect-companion-C_uGVXYr.js → use-connect-companion-cbVbp1PC.js} +1 -1
  273. package/dist/client/assets/{use-connection-DU4h1ZQw.js → use-connection-CbCOl7kC.js} +1 -1
  274. package/dist/client/assets/{use-copy-C5kztOhC.js → use-copy-pQiYVNDx.js} +1 -1
  275. package/dist/client/assets/{use-create-virtual-mcp-Dkbt_aoq.js → use-create-virtual-mcp--prM7MSL.js} +1 -1
  276. package/dist/client/assets/{use-date-fns-locale-Hm__LN1k.js → use-date-fns-locale-BZJen5Qk.js} +1 -1
  277. package/dist/client/assets/{use-debounced-autosave-xpZ8auzw.js → use-debounced-autosave-f8aHkA4-.js} +1 -1
  278. package/dist/client/assets/{use-debounced-value-DLVRUtOm.js → use-debounced-value-BkjYlyjI.js} +1 -1
  279. package/dist/client/assets/{use-deco-credits-DgLSuY0L.js → use-deco-credits-Fz7zUsZI.js} +1 -1
  280. package/dist/client/assets/{use-decopilot-events-CxBOYWC8.js → use-decopilot-events-Cg3y7_Tw.js} +1 -1
  281. package/dist/client/assets/{use-delete-connection-Do3hyh3j.js → use-delete-connection-DL6YTlmG.js} +1 -1
  282. package/dist/client/assets/{use-deployment-admin-DbqZpA_r.js → use-deployment-admin-ChDBYioe.js} +1 -1
  283. package/dist/client/assets/{use-fast-preview-draft-url-CsVZwjau.js → use-fast-preview-draft-url-ChtqgHLa.js} +1 -1
  284. package/dist/client/assets/{use-file-configs-BRJeov5H.js → use-file-configs-C0anASKq.js} +1 -1
  285. package/dist/client/assets/{use-infinite-scroll-DGoD9GUl.js → use-infinite-scroll-DDtarZih.js} +1 -1
  286. package/dist/client/assets/{use-join-requests-C_jjKXlE.js → use-join-requests-CmRy96zy.js} +1 -1
  287. package/dist/client/assets/{use-main-panel-tabs-Bc3MZBCb.js → use-main-panel-tabs-DnGGxNlO.js} +1 -1
  288. package/dist/client/assets/{use-mcp-auth-status-CBn_Xzmb.js → use-mcp-auth-status-zOqKzja_.js} +1 -1
  289. package/dist/client/assets/{use-mcp-client-DOo0zS-A.js → use-mcp-client-DjprX9ll.js} +1 -1
  290. package/dist/client/assets/{use-mcp-prompts-DUcez8YA.js → use-mcp-prompts-zdF-r-gP.js} +1 -1
  291. package/dist/client/assets/{use-mcp-tools-CWcvYRA-.js → use-mcp-tools-BM5j4PPF.js} +1 -1
  292. package/dist/client/assets/{use-members-_nsnfGaz.js → use-members-FTp01BqN.js} +1 -1
  293. package/dist/client/assets/{use-mobile-DvZ73KtH.js → use-mobile-Dx9-2qYW.js} +1 -1
  294. package/dist/client/assets/{use-navigate-to-agent-0EY97I37.js → use-navigate-to-agent-DxqUwHWS.js} +1 -1
  295. package/dist/client/assets/use-new-blocks-editor-BYhDxY_l.js +1 -0
  296. package/dist/client/assets/{use-open-billing-url-pGoiHk39.js → use-open-billing-url-CSe3J6zh.js} +1 -1
  297. package/dist/client/assets/{use-org-auth-client-BlteiQR1.js → use-org-auth-client-Cec6PHzM.js} +1 -1
  298. package/dist/client/assets/{use-org-fs-BKiHrfqD.js → use-org-fs-BuUyyd61.js} +1 -1
  299. package/dist/client/assets/{use-org-repo-syncs-9Jptl7NX.js → use-org-repo-syncs-XLagWIxo.js} +1 -1
  300. package/dist/client/assets/{use-org-sso-JZsx5RfJ.js → use-org-sso-BEIAieBm.js} +1 -1
  301. package/dist/client/assets/{use-organization-roles-coC16fOX.js → use-organization-roles-DfvH22_z.js} +1 -1
  302. package/dist/client/assets/{use-organization-settings--iPsUcy7.js → use-organization-settings-BiHv3s79.js} +1 -1
  303. package/dist/client/assets/{use-panel-navigate-m1jpn2Q1.js → use-panel-navigate-CU0xHOEb.js} +1 -1
  304. package/dist/client/assets/{use-project-native-view-presence-Ggsme35p.js → use-project-native-view-presence-Cd8ENLua.js} +1 -1
  305. package/dist/client/assets/{use-project-scope-BB82FCa8.js → use-project-scope-C7h79vE7.js} +1 -1
  306. package/dist/client/assets/{use-releases-7cBYcQ4J.js → use-releases-CYpQQ1xE.js} +1 -1
  307. package/dist/client/assets/{use-reports-diagnostic-CtsjKgVP.js → use-reports-diagnostic-DCRfhPB6.js} +1 -1
  308. package/dist/client/assets/{use-secrets-CLR0Et3T.js → use-secrets-BnZHjO5J.js} +1 -1
  309. package/dist/client/assets/{use-section-preview-base-CBvq-UlV.js → use-section-preview-base-D0gjnGgo.js} +1 -1
  310. package/dist/client/assets/{use-session-runtime-6x58C-tT.js → use-session-runtime-C8OniTQv.js} +1 -1
  311. package/dist/client/assets/{use-tags-CDjPhJiP.js → use-tags-BeyBKO9N.js} +1 -1
  312. package/dist/client/assets/{use-task-board-analytics-BKbzkTQP.js → use-task-board-analytics-Dglaw6wU.js} +1 -1
  313. package/dist/client/assets/{use-task-metadata-CrJp6is8.js → use-task-metadata-GEFpS2Q_.js} +1 -1
  314. package/dist/client/assets/{use-thread-analytics-1m69hvFD.js → use-thread-analytics-DrCEifJa.js} +1 -1
  315. package/dist/client/assets/{use-thread-outputs-CTBrB0Pz.js → use-thread-outputs-Cv-5nrNe.js} +1 -1
  316. package/dist/client/assets/useInfiniteQuery-B5rLKm8X.js +1 -0
  317. package/dist/client/assets/{useQueries-B5hFaZ0x.js → useQueries-BERB02cW.js} +1 -1
  318. package/dist/client/assets/useSuspenseInfiniteQuery-BPFdAF6B.js +1 -0
  319. package/dist/client/assets/{users-DEkYKXng.js → users-tzAbEP65.js} +1 -1
  320. package/dist/client/assets/{utils-Bqsc15Zx.js → utils-3HfZ006b.js} +1 -1
  321. package/dist/client/assets/{variant-calendar-45aD1dj3.js → variant-calendar-C_WMoz2r.js} +1 -1
  322. package/dist/client/assets/{variant-matcher-override-CAjUtJno.js → variant-matcher-override-BdtYW5Ls.js} +1 -1
  323. package/dist/client/assets/{view-mode-toggle-DrC_ZP4l.js → view-mode-toggle-B4lwUKo-.js} +1 -1
  324. package/dist/client/assets/{virtual-mcp-BH-EbPmd.js → virtual-mcp-DcQbLAsE.js} +1 -1
  325. package/dist/client/index.html +1 -1
  326. package/dist/server/cli.js +2 -2
  327. package/dist/server/server.js +2 -2
  328. package/package.json +1 -1
  329. package/dist/client/assets/agent-app-B3k6lFW4.js +0 -1
  330. package/dist/client/assets/agent-deck-CJsgkjs4.js +0 -1
  331. package/dist/client/assets/agent-library-auzWKmtl.js +0 -1
  332. package/dist/client/assets/agent-library-file-C4Bz5yNQ.js +0 -1
  333. package/dist/client/assets/agent-settings-CFSoK3Dt.js +0 -1
  334. package/dist/client/assets/agent-site-editor-code-CvT5A6hL.js +0 -2
  335. package/dist/client/assets/agent-view-BVit-PUC.js +0 -1
  336. package/dist/client/assets/api-keys-DHQBKkcj.js +0 -1
  337. package/dist/client/assets/app-editor-DHGSsQUp.js +0 -1
  338. package/dist/client/assets/flat-project-BpJyiSII.js +0 -1
  339. package/dist/client/assets/library-B8Gbh-yN.js +0 -1
  340. package/dist/client/assets/project-reports-C4_AtKq5.js +0 -1
  341. package/dist/client/assets/project-tasks-sJ3gMJ8p.js +0 -1
  342. package/dist/client/assets/record-editor-DwYny4Hc.js +0 -1
  343. package/dist/client/assets/reports-Df5KS3eS.js +0 -1
  344. package/dist/client/assets/route-9tgTBitD.js +0 -1
  345. package/dist/client/assets/tasks-DPN3qyXp.js +0 -1
  346. package/dist/client/assets/use-new-blocks-editor-sTUO1Dvp.js +0 -1
  347. package/dist/client/assets/useInfiniteQuery-Bvl72KSW.js +0 -1
  348. package/dist/client/assets/useSuspenseInfiniteQuery-Cf-lJprJ.js +0 -1
@@ -2158,7 +2158,7 @@ Usage: deco services <up|down|status>`),process.exit(1)}}var B5$=L(()=>{ju()});f
2158
2158
  `.execute($);if(Number(W.rows[0]?.cnt)===0){console.warn(`Failed to migrate ${G}/${K}, keeping in old table`);continue}}await il`
2159
2159
  DELETE FROM kysely_migration WHERE name = ${Q}
2160
2160
  `.execute($)}}async function oX$($){await JN4($),await GN4($);let Z=new nX$({db:$,provider:{getMigrations:()=>Promise.resolve(g$1)}}),{error:Q,results:X}=await Z.migrateToLatest(),Y=0;if(X?.forEach((J)=>{if(J.status==="Success")Y++;else if(J.status==="Error")console.error(`Failed to execute migration "${J.migrationName}"`)}),Q)throw console.error("Failed to migrate"),console.error(Q),Q;return Y}async function KN4($){let{keepOpen:Z=!1,database:Q,skipBetterAuth:X=!1}=$??{},Y="skipped";if(!X&&!Q)Y=await mr0();let J=Q??Z8(),G=async()=>{if(!Z&&!Q)await jw(J).catch((K)=>{console.warn("Warning: Error closing database:",K)})};try{let K=await oX$(J.db);return await G(),{betterAuth:Y,kysely:K}}catch(K){throw await G(),K}}async function WN4(){let $=Z8(),Z=new nX$({db:$.db,provider:{getMigrations:()=>Promise.resolve(g$1)}}),{error:Q,results:X}=await Z.migrateDown();if(X?.forEach((Y)=>{if(Y.status==="Success")console.log(`\u2705 Migration "${Y.migrationName}" rolled back successfully`);else if(Y.status==="Error")console.error(`\u274C Failed to rollback migration "${Y.migrationName}"`)}),Q)throw console.error("Failed to rollback migration"),console.error(Q),Q}var rX$=L(()=>{pX$();dr0();kQ()});async function OK0($){let Z={...process.env},Q=JQ0($,Z);console.log(DS1(Q.settings.encryptionKey));let X=Q.settings.betterAuthSecret||(Q.settings.localMode?i9$(Q.settings.dataDir):""),{ensureServices:Y}=await Promise.resolve().then(() => (w30(),O30)),{outputs:J,services:G}=await Y({home:Q.settings.dataDir,externalDatabaseUrl:Q.externalDatabaseUrl,externalNatsUrl:Q.externalNatsUrl});if(!Q.skipMigrations){let{migrateBetterAuth:W}=await Promise.resolve().then(() => (dr0(),n9$));await W(J.databaseUrl);let{createDatabase:H}=await Promise.resolve().then(() => (kQ(),H9$)),{migrateToLatest:F}=await Promise.resolve().then(() => (rX$(),aX$)),U=H(J.databaseUrl);await F({keepOpen:!0,database:U,skipBetterAuth:!0})}let K={...Q.settings,betterAuthSecret:X,databaseUrl:J.databaseUrl,natsUrls:J.natsUrls,...J.s3?{s3Endpoint:J.s3.endpoint,s3Bucket:J.s3.bucket,s3AccessKeyId:J.s3.accessKeyId,s3SecretAccessKey:J.s3.secretAccessKey,s3ForcePathStyle:J.s3.forcePathStyle}:{}};return L5$(K),{settings:K,services:G.map((W)=>({name:W.name==="PostgreSQL"?"Postgres":W.name,port:W.port})),managedServiceNames:G.filter((W)=>W.owner==="managed").map((W)=>W.name)}}var h$1=L(()=>{ju();p9$();G$()});var ZY$={};G0(ZY$,{updateService:()=>hT,subscribeCliState:()=>c$1,setTuiConsoleIntercepted:()=>wK0,setServerUrl:()=>ur,setMigrationsDone:()=>hr,setDevMode:()=>FN4,resetCliStateForTests:()=>HN4,isTuiConsoleIntercepted:()=>jK0,getCliState:()=>l$1,addLogEntry:()=>Rw});function sX$(){return[{name:"Postgres",status:"pending",port:0},{name:"NATS",status:"pending",port:0}]}function eX$(){return{services:sX$(),migrationsStatus:"pending",serverUrl:null,logs:[]}}function HN4(){PJ=eX$()}function gr(){for(let $ of u$1)$()}function l$1(){return PJ}function c$1($){return u$1.add($),()=>u$1.delete($)}function hT($){PJ={...PJ,services:PJ.services.map((Z)=>Z.name===$.name?$:Z)},gr()}function hr(){PJ={...PJ,migrationsStatus:"done"},gr()}function ur($){PJ={...PJ,serverUrl:$},gr()}function Rw($){let Z=[...PJ.logs,$];PJ={...PJ,logs:Z.length>500?Z.slice(-500):Z},gr()}function FN4(){PJ={...PJ,services:[...sX$(),{name:"API",status:"pending",port:0},{name:"Vite",status:"pending",port:0}]},gr()}function wK0($){$Y$=$}function jK0(){return $Y$}var PJ,u$1,$Y$=!1;var uT=L(()=>{PJ=eX$();u$1=new Set});import{createServer as QY$}from"net";function UN4($){return new Promise((Z)=>{let Q=QY$();Q.once("error",()=>Z(!1)),Q.listen($,"0.0.0.0",()=>{Q.close(()=>Z(!0))})})}async function lr($){if(await UN4($))return $;let Z=await new Promise((Q,X)=>{let Y=QY$();Y.once("error",X),Y.listen(0,"0.0.0.0",()=>{let J=Y.address(),G=typeof J==="object"&&J?J.port:0;Y.close(()=>Q(G))})});return console.warn(`Port ${$} is in use, using port ${Z} instead.`),Z}var m$1=()=>{};var i$1={};G0(i$1,{startDevServer:()=>BN4,pipeToLogStore:()=>d$1});import{join as NN4}from"path";function d$1($){let Z=$.getReader(),Q=new TextDecoder,X="";function Y(){let J=X.split(`
2161
- `);X=J.pop()??"";for(let G of J){let K=Bun.stripANSI(G).replace(/^\[\d+\]\s*/,"").trim();if(!K)continue;Rw({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:K})}}(async()=>{try{for(;;){let{done:J,value:G}=await Z.read();if(J)break;X+=Q.decode(G,{stream:!0}),Y()}}catch{}if(X.trim()){let J=Bun.stripANSI(X).replace(/^\[\d+\]\s*/,"").trim();if(J)Rw({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:J})}})()}async function BN4($){let{baseUrl:Z,noTui:Q}=$,X=process.env.HOST==="0.0.0.0"&&Boolean(process.env.PORT),Y=X?process.env.PORT:$.vitePort,J=Z||`http://localhost:${Y}`,G=X?await lr(Number(Y)+1):await lr(Number($.port)),{settings:K,services:W,managedServiceNames:H}=await OK0({port:String(G),home:$.home,baseUrl:$.baseUrl,localMode:$.localMode,skipMigrations:$.skipMigrations,noTui:$.noTui,vitePort:$.vitePort});for(let O of W)hT({name:O.name,status:"ready",port:O.port});hr();let F=NN4(import.meta.dir,"..","..","..","..",".."),U=Q===!0,N=Bun.spawn(["bun","run","dev:servers"],{cwd:F,env:{...process.env,PORT:String(K.port),VITE_PORT:String(Y),DATABASE_URL:K.databaseUrl,NATS_URL:K.natsUrls.join(","),NODE_ENV:K.nodeEnv,BASE_URL:J,DECOCMS_LOCAL_MODE:String(K.localMode),DECOCMS_HOME:K.dataDir,DATA_DIR:K.dataDir,DECO_CLI:"1",...K.betterAuthSecret?{BETTER_AUTH_SECRET:K.betterAuthSecret}:{},...K.s3Endpoint?{S3_ENDPOINT:K.s3Endpoint,S3_BUCKET:K.s3Bucket??"",S3_ACCESS_KEY_ID:K.s3AccessKeyId??"",S3_SECRET_ACCESS_KEY:K.s3SecretAccessKey??"",S3_FORCE_PATH_STYLE:String(K.s3ForcePathStyle)}:{},...K.natsCredsPath?{NATS_CREDS:K.natsCredsPath}:{}},stdio:["inherit",U?"inherit":"pipe",U?"inherit":"pipe"]});if(!U)d$1(N.stdout),d$1(N.stderr);ur(J),hT({name:"Vite",status:"ready",port:Number(Y)}),hT({name:"API",status:"ready",port:Number(K.port)});let D=async(O)=>{if(N.kill(O),await N.exited,H.length>0){let{stopServices:w}=await Promise.resolve().then(() => (w30(),O30));await w(K.dataDir)}};return process.on("SIGINT",()=>D("SIGINT")),process.on("SIGTERM",()=>D("SIGTERM")),{port:Number(Y),process:N}}var p$1=L(()=>{h$1();uT();m$1()});var EK0;var n$1=L(()=>{EK0={name:"decocms",version:"4.417.4",description:"Deco CMS \u2014 Self-hostable MCP Gateway for managing AI connections and tools",author:"Deco team",repository:{type:"git",url:"git+https://github.com/decocms/studio.git",directory:"apps/api"},bugs:{url:"https://github.com/decocms/studio/issues"},type:"module",bin:{deco:"./dist/server/cli.js"},files:["dist/**/*"],scripts:{dev:"bun run migrate && bun run dev:server","dev:server":"bun run --cwd=../../packages/sandbox build && NODE_ENV=development bun --env-file=.env --hot run src/index.ts",build:"bun run build:server","build:server":"bun run scripts/bundle-server-script.ts --dist ./dist/server","generate:tool-contracts":"bun run scripts/generate-tool-contracts.ts","db:migrate":"bun run ./dist/server/migrate.js","db:migrate:dbos":"bun run ./dist/server/migrate-dbos.js",check:"tsc --noEmit",start:"bun run ./dist/server/server.js",migrate:"bun run src/database/migrate.ts","migrate:dbos":"bun run src/database/migrate-dbos.ts",test:"bun test src","better-auth:migrate":"bunx --bun @better-auth/cli migrate -y --config src/auth/index.ts",prepublishOnly:"bun run --cwd=../.. build:studio"},optionalDependencies:{"@duckdb/node-api":"^1.5.0-r.1"},dependencies:{"@ai-sdk/anthropic":"^4.0.58","@ai-sdk/google":"^4.0.76","@ai-sdk/openai":"^4.0.71","@anthropic-ai/sdk":"^0.105.0","@aws-sdk/client-s3":"^3.1013.0","@aws-sdk/client-sts":"^3.1013.0","@aws-sdk/lib-storage":"^3.1013.0","@aws-sdk/s3-request-presigner":"^3.1013.0","@clickhouse/client":"^1.8.1","@dbos-inc/dbos-sdk":"^4.21.6","@inkjs/ui":"^2.0.0","@nats-io/jetstream":"3.4.0","@nats-io/kv":"3.4.0","@nats-io/nats-core":"3.4.0","@nats-io/transport-node":"3.4.0","@openrouter/ai-sdk-provider":"^3.1.0","@opentelemetry/core":"^2.6.0","embedded-postgres":"^18.3.0-beta.16",ink:"^6.8.0",kysely:"^0.28.12","posthog-node":"^5.0.0",react:"^19.2.6","react-dom":"^19.2.6"},devDependencies:{"@ai-sdk/provider":"^4.0.17","@better-auth/sso":"1.4.1","@decocms/better-auth":"1.5.17","@decocms/bindings":"workspace:*","@decocms/mcp-utils":"workspace:*","@decocms/runtime":"workspace:*","@decocms/sandbox":"workspace:*","@decocms/shared":"workspace:*","@jitl/quickjs-wasmfile-release-sync":"0.31.0","@modelcontextprotocol/sdk":"1.29.0","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.211.0","@opentelemetry/exporter-logs-otlp-proto":"^0.211.0","@opentelemetry/exporter-prometheus":"^0.208.0","@opentelemetry/exporter-trace-otlp-proto":"^0.207.0","@opentelemetry/instrumentation-runtime-node":"^0.24.0","@opentelemetry/resources":"^2.6.0","@opentelemetry/sdk-logs":"^0.211.0","@opentelemetry/sdk-metrics":"^2.2.0","@opentelemetry/sdk-node":"^0.207.0","@opentelemetry/sdk-trace-base":"^2.5.0","@types/bun":"^1.3.1","@types/google.maps":"^3.65.2","@types/pg":"^8.15.6","@types/react-syntax-highlighter":"^15.5.13","@vercel/nft":"^1.1.1",ai:"^7.0.107","better-auth":"1.4.22",croner:"^9.1.0",degit:"^2.8.4",hono:"^4.10.7",jose:"^6.0.11",nanoid:"^5.1.6",pg:"^8.16.3",typescript:"^7.0.2",typescript5:"npm:typescript@^5.9.3",zod:"4.3.6"},homepage:"https://github.com/decocms/studio",keywords:["mcp","model-context-protocol","ai","gateway","self-hosted","tools"],license:"MIT",publishConfig:{access:"public"}}});import{Box as DN4,Text as XY$}from"ink";import{jsx as ON4,jsxs as YY$}from"react/jsx-runtime";function JY$({version:$}){return YY$(DN4,{flexDirection:"column",marginTop:1,children:[u30.map((Z,Q)=>ON4(XY$,{color:l30[Q],children:Z},Q)),YY$(XY$,{dimColor:!0,children:[" v",$]})]})}var GY$=L(()=>{Tr()});import{Box as lT,Text as qw}from"ink";import{Spinner as wN4}from"@inkjs/ui";import{jsx as cG,jsxs as pl}from"react/jsx-runtime";function KY$({status:$}){if($==="pending")return cG(wN4,{label:""});return cG(qw,{color:"green",children:"\u2713"})}function jN4($){return`${$.name}: ${$.port||"...."}`}function WY$({services:$,migrationsStatus:Z,home:Q,serverUrl:X}){return pl(lT,{flexDirection:"column",paddingBottom:1,children:[cG(JY$,{version:EK0.version}),cG(lT,{marginBottom:1,children:cG(qw,{dimColor:!0,children:"\u2500".repeat(80)})}),cG(lT,{children:pl(qw,{dimColor:!0,children:["Home: ",Q]})}),pl(lT,{gap:2,children:[$.map((Y)=>pl(lT,{gap:1,children:[cG(qw,{children:jN4(Y)}),cG(KY$,{status:Y.status})]},Y.name)),pl(lT,{gap:1,children:[cG(qw,{children:"Migrations"}),cG(KY$,{status:Z})]})]}),cG(lT,{children:X?pl(qw,{children:["Open in browser: ",cG(qw,{color:"cyan",children:X})]}):cG(qw,{dimColor:!0,children:"Starting..."})})]})}var HY$=L(()=>{n$1();GY$()});import{Box as EN4,Text as cr}from"ink";import{jsx as t$1,jsxs as o$1}from"react/jsx-runtime";function zN4($){if($>=500)return"red";if($>=400)return"yellow";if($>=300)return"cyan";return"green"}function FY$({logs:$}){return t$1(EN4,{flexDirection:"column",children:$.map((Z,Q)=>{if(Z.rawLine)return t$1(cr,{dimColor:!0,children:Z.rawLine},Q);let X=Z.duration<1000?`${Z.duration}ms`:`${(Z.duration/1000).toFixed(1)}s`;return o$1(cr,{children:[o$1(cr,{dimColor:!0,children:[Z.method.padEnd(6)," ",Z.path.padEnd(30)," "]}),t$1(cr,{color:zN4(Z.status),children:Z.status}),o$1(cr,{dimColor:!0,children:[" ",X.padStart(8)]})]},Q)})})}var UY$=()=>{};var a$1={};G0(a$1,{App:()=>AN4});import{Box as PN4}from"ink";import{useSyncExternalStore as TN4}from"react";import{jsx as NY$,jsxs as RN4}from"react/jsx-runtime";function AN4({home:$}){let Z=TN4(c$1,l$1);return RN4(PN4,{flexDirection:"column",children:[NY$(WY$,{services:Z.services,migrationsStatus:Z.migrationsStatus,home:$,serverUrl:Z.serverUrl}),NY$(FY$,{logs:Z.logs})]})}var r$1=L(()=>{HY$();UY$();uT()});var PK="thread-gate",$L="decopilot-hosted-harness",ZL="decopilot-hosted-harness-sandboxed",TK="automations",Mw="background-tools",cT="task-board-github-reads";var BY$="13";function LY$($){return{name:"decocms",systemDatabaseUrl:$.systemDatabaseUrl,systemDatabaseSchemaName:"dbos",systemDatabasePoolSize:$.poolSize,runAdminServer:!1,executorID:$.executorID,applicationVersion:BY$,...$.listenQueues!==void 0?{listenQueues:$.listenQueues}:{}}}var DY$=()=>{};import qN4 from"pg";async function wY$($,Z){let{databaseUrl:Q,lockTimeoutMs:X=MN4}=$,Y=$.log??((W)=>console.log(W)),J=new qN4.Client({connectionString:Q});await J.connect();let G=Date.now(),K=!1;try{while(!K){if(K=(await J.query("SELECT pg_try_advisory_lock($1) AS locked",[OY$.toString()])).rows[0]?.locked===!0,K)break;if(Date.now()-G>=X)throw Error(`Timed out after ${X}ms waiting for the DBOS migration lock. Another process is still migrating the dbos schema; this pod will restart and retry.`);await P$(IN4)}let W=Date.now()-G;if(W>1000)Y(`[dbos] waited ${W}ms for the migration lock; another process migrated first`);return await Z()}finally{if(K)try{await J.query("SELECT pg_advisory_unlock($1)",[OY$.toString()])}catch{}await J.end().catch(()=>{})}}var OY$=8314027461559302n,MN4=600000,IN4=500;var jY$=L(()=>{F8()});function VN4(){let $=(process.env.BUN_OPTIONS??"").split(/\s+/).filter(Boolean);return[...process.argv.slice(1),...$]}function s$1($,Z){for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X===void 0)continue;if(X===Z)return $[Q+1];if(X.startsWith(`${Z}=`))return X.slice(Z.length+1)}return}function EY$(){let $=VN4();if($.includes("--cpu-prof")){console.log(JSON.stringify({msg:"cpu-profiling-active",dir:s$1($,"--cpu-prof-dir")??process.cwd(),name:s$1($,"--cpu-prof-name"),markdown:$.includes("--cpu-prof-md"),intervalUs:Number(s$1($,"--cpu-prof-interval")??1000),note:"profile is written on process exit"}));return}if(process.env.CPU_PROFILE)console.warn(JSON.stringify({msg:"cpu-profiling-requested-but-inactive",hint:'CPU profiling is a Bun launch flag. Set BUN_OPTIONS="--cpu-prof --cpu-prof-md --cpu-prof-dir=/tmp" before starting the process.'}))}function zY$(){if(process.env.HEAP_WATCH!=="1")return()=>{};let $=Number(process.env.HEAP_WATCH_INTERVAL_MS??60000),Z=async()=>{let Q=fT();if(!Q)return;let X={};try{let{heapStats:Y}=await import("bun:jsc"),J=Y(),G=Object.entries(J.objectTypeCounts).sort((K,W)=>W[1]-K[1]).slice(0,20);X={objectCount:J.objectCount,heapSize:J.heapSize,top:Object.fromEntries(G)}}catch{}console.log(JSON.stringify({msg:"heap-watch",ts:new Date().toISOString(),uptimeS:Math.round(process.uptime()),rss:Q.rss,heapUsed:Q.heapUsed,heapTotal:Q.heapTotal,external:Q.external,arrayBuffers:Q.arrayBuffers,...X}))};return Z().catch(()=>{}),zK0=setInterval(()=>void Z().catch(()=>{}),$),zK0.unref?.(),process.on("SIGUSR2",()=>{try{let Q=Bun.generateHeapSnapshot("v8"),X=typeof Q==="string"?Q:JSON.stringify(Q),Y=`/tmp/heap-${process.pid}-${Date.now()}.heapsnapshot`;Bun.write(Y,X),console.log(JSON.stringify({msg:"heap-snapshot-written",path:Y}))}catch(Q){console.error("[heap-watch] snapshot failed:",Q)}}),()=>{if(zK0)clearInterval(zK0)}}var zK0;var PY$=()=>{};import*as kN4 from"bun:jsc";function TY$(){if(process.env.STALL_WATCHDOG!=="1")return()=>{};let $=Number(process.env.STALL_WATCHDOG_MS??100),Z=Number(process.env.STALL_WATCHDOG_TICK_MS??50);try{SN4()}catch(J){return console.error("[stall-watchdog] failed to start sampling profiler:",J),()=>{}}let Q,X=performance.now()+Z,Y=()=>{let J=performance.now(),G=J-X;X=J+Z;let K=[];try{K=CN4()?.traces??[]}catch{}if(G>$&&K.length>0){let W=new Map;for(let F of K){let U=F.frames.find((D)=>D.sourceURL&&!/Unknown Executable/.test(D.category??""))??F.frames[0];if(!U)continue;let N=(U.sourceURL??"?").replace(/^.*\/node_modules\//,"node_modules/"),B=`${U.name??"?"} @ ${N}:${U.line??"?"}`;W.set(B,(W.get(B)??0)+1)}let H=[...W.entries()].sort((F,U)=>U[1]-F[1]).slice(0,8).map(([F,U])=>({frame:F,count:U}));console.warn(JSON.stringify({msg:"stall-stack",ts:new Date().toISOString(),lagMs:Math.round(G),samplesInWindow:K.length,top:H}))}Q=setTimeout(Y,Z),Q.unref?.()};return Q=setTimeout(Y,Z),Q.unref?.(),()=>{if(Q)clearTimeout(Q)}}var SN4,CN4;var AY$=L(()=>{({startSamplingProfiler:SN4,samplingProfilerStackTraces:CN4}=kN4)});function RY$(){EY$();let $=[zY$(),Z9$(),TY$()];return()=>{for(let Z of $)Z()}}var qY$=L(()=>{fr0();PY$();AY$()});var mT=b((MY$)=>{Object.defineProperty(MY$,"__esModule",{value:!0});MY$.RepublishHeaders=MY$.DirectMsgHeaders=MY$.JsHeaders=MY$.AdvisoryKind=void 0;MY$.isOrderedPushConsumerOptions=_N4;MY$.isPullConsumer=vN4;MY$.isPushConsumer=xN4;MY$.isBoundPushConsumerOptions=fN4;function _N4($){if($&&typeof $==="object")return"name_prefix"in $||"deliver_subject_prefix"in $||"filter_subjects"in $||"filter_subject"in $||"deliver_policy"in $||"opt_start_seq"in $||"opt_start_time"in $||"replay_policy"in $||"inactive_threshold"in $||"headers_only"in $||"deliver_prefix"in $;return!1}function vN4($){return $.isPullConsumer()}function xN4($){return $.isPushConsumer()}function fN4($){if($&&typeof $==="object")return"deliver_subject"in $||"deliver_group"in $||"idle_heartbeat"in $;return!1}MY$.AdvisoryKind={API:"api_audit",StreamAction:"stream_action",ConsumerAction:"consumer_action",SnapshotCreate:"snapshot_create",SnapshotComplete:"snapshot_complete",RestoreCreate:"restore_create",RestoreComplete:"restore_complete",MaxDeliver:"max_deliver",Terminated:"terminated",Ack:"consumer_ack",StreamLeaderElected:"stream_leader_elected",StreamQuorumLost:"stream_quorum_lost",ConsumerLeaderElected:"consumer_leader_elected",ConsumerQuorumLost:"consumer_quorum_lost"};MY$.JsHeaders={StreamSourceHdr:"Nats-Stream-Source",LastConsumerSeqHdr:"Nats-Last-Consumer",LastStreamSeqHdr:"Nats-Last-Stream",ConsumerStalledHdr:"Nats-Consumer-Stalled",MessageSizeHdr:"Nats-Msg-Size",RollupHdr:"Nats-Rollup",RollupValueSubject:"sub",RollupValueAll:"all",PendingMessagesHdr:"Nats-Pending-Messages",PendingBytesHdr:"Nats-Pending-Bytes",RequiredApiLevel:"Nats-Required-Api-Level"};MY$.DirectMsgHeaders={Stream:"Nats-Stream",Sequence:"Nats-Sequence",TimeStamp:"Nats-Time-Stamp",Subject:"Nats-Subject",LastSequence:"Nats-Last-Sequence",NumPending:"Nats-Num-Pending"};MY$.RepublishHeaders={Stream:"Nats-Stream",Subject:"Nats-Subject",Sequence:"Nats-Sequence",LastSequence:"Nats-Last-Sequence",Size:"Nats-Msg-Size"}});var mG=b((VY$)=>{Object.defineProperty(VY$,"__esModule",{value:!0});VY$.TD=VY$.TE=VY$.Empty=void 0;VY$.encode=dN4;VY$.decode=iN4;VY$.Empty=new Uint8Array(0);VY$.TE=new TextEncoder;VY$.TD=new TextDecoder;function mN4(...$){let Z=0;for(let Y=0;Y<$.length;Y++)Z+=$[Y].length;let Q=new Uint8Array(Z),X=0;for(let Y=0;Y<$.length;Y++)Q.set($[Y],X),X+=$[Y].length;return Q}function dN4(...$){let Z=[];for(let Q=0;Q<$.length;Q++)Z.push(VY$.TE.encode($[Q]));if(Z.length===0)return VY$.Empty;if(Z.length===1)return Z[0];return mN4(...Z)}function iN4($){if(!$||$.length===0)return"";return VY$.TD.decode($)}});var dG=b((CY$)=>{Object.defineProperty(CY$,"__esModule",{value:!0});CY$.errors=CY$.PermissionViolationError=CY$.NoRespondersError=CY$.TimeoutError=CY$.RequestError=CY$.ProtocolError=CY$.ConnectionError=CY$.DrainingConnectionError=CY$.ClosedConnectionError=CY$.AuthorizationError=CY$.UserAuthenticationExpiredError=CY$.InvalidOperationError=CY$.InvalidArgumentError=CY$.InvalidSubjectError=void 0;class $81 extends Error{constructor($,Z){super(`illegal subject: '${$}'`,Z);this.name="InvalidSubjectError"}}CY$.InvalidSubjectError=$81;class PK0 extends Error{constructor($,Z){super($,Z);this.name="InvalidArgumentError"}static format($,Z,Q){if(Array.isArray(Z)&&Z.length>1)Z=Z[0];if(Array.isArray($))$=$.map((X)=>`'${X}'`),$=$.join(",");else $=`'${$}'`;return new PK0(`${$} ${Z}`,Q)}}CY$.InvalidArgumentError=PK0;class Z81 extends Error{constructor($,Z){super($,Z);this.name="InvalidOperationError"}}CY$.InvalidOperationError=Z81;class TK0 extends Error{constructor($,Z){super($,Z);this.name="UserAuthenticationExpiredError"}static parse($){if($.toLowerCase().indexOf("user authentication expired")!==-1)return new TK0($);return null}}CY$.UserAuthenticationExpiredError=TK0;class AK0 extends Error{constructor($,Z){super($,Z);this.name="AuthorizationError"}static parse($){let Z=["authorization violation","account authentication expired","authentication timeout"],Q=$.toLowerCase();for(let X=0;X<Z.length;X++)if(Q.indexOf(Z[X])!==-1)return new AK0($);return null}}CY$.AuthorizationError=AK0;class Q81 extends Error{constructor(){super("closed connection");this.name="ClosedConnectionError"}}CY$.ClosedConnectionError=Q81;class X81 extends Error{constructor(){super("connection draining");this.name="DrainingConnectionError"}}CY$.DrainingConnectionError=X81;class Y81 extends Error{constructor($,Z){super($,Z);this.name="ConnectionError"}}CY$.ConnectionError=Y81;class J81 extends Error{constructor($,Z){super($,Z);this.name="ProtocolError"}}CY$.ProtocolError=J81;class G81 extends Error{constructor($="",Z){super($,Z);this.name="RequestError"}isNoResponders(){return this.cause instanceof RK0}}CY$.RequestError=G81;class K81 extends Error{constructor($){super("timeout",$);this.name="TimeoutError"}}CY$.TimeoutError=K81;class RK0 extends Error{subject;constructor($,Z){super(`no responders: '${$}'`,Z);this.subject=$,this.name="NoResponders"}}CY$.NoRespondersError=RK0;class qK0 extends Error{operation;subject;queue;constructor($,Z,Q,X,Y){super($,Y);this.name="PermissionViolationError",this.operation=Z,this.subject=Q,this.queue=X}static parse($){if(($?$.toLowerCase():"").indexOf("permissions violation")===-1)return null;let Q="publish",X="",Y=void 0,J=$.match(/(Publish|Subscription) to "(\S+)"/);if(J){if(Q=J[1].toLowerCase(),X=J[2],Q==="subscription"){let G=$.match(/using queue "(\S+)"/);if(G)Y=G[1]}}return new qK0($,Q,X,Y)}}CY$.PermissionViolationError=qK0;CY$.errors={AuthorizationError:AK0,ClosedConnectionError:Q81,ConnectionError:Y81,DrainingConnectionError:X81,InvalidArgumentError:PK0,InvalidOperationError:Z81,InvalidSubjectError:$81,NoRespondersError:RK0,PermissionViolationError:qK0,ProtocolError:J81,RequestError:G81,TimeoutError:K81,UserAuthenticationExpiredError:TK0}});var JH=b((bY$)=>{Object.defineProperty(bY$,"__esModule",{value:!0});bY$.SimpleMutex=bY$.Perf=void 0;bY$.extend=WB4;bY$.render=HB4;bY$.timeout=FB4;bY$.delay=UB4;bY$.deadline=NB4;bY$.deferred=H81;bY$.debugDeferred=BB4;bY$.shuffle=LB4;bY$.collect=DB4;bY$.jitter=fY$;bY$.backoff=OB4;bY$.nanos=wB4;bY$.millis=jB4;bY$.randomToken=PB4;var KB4=mG(),W81=dG();function WB4($,...Z){for(let Q=0;Q<Z.length;Q++){let X=Z[Q];Object.keys(X).forEach(function(Y){$[Y]=X[Y]})}return $}function HB4($){return KB4.TD.decode($).replace(/\n/g,"\u240A").replace(/\r/g,"\u240D")}function FB4($,Z=!0){let Q=Z?new W81.TimeoutError:null,X,Y,J=new Promise((G,K)=>{X={cancel:()=>{if(Y)clearTimeout(Y)}},Y=setTimeout(()=>{if(Q===null)K(new W81.TimeoutError);else K(Q)},$)});return Object.assign(J,X)}function UB4($=0){let Z,Q=new Promise((X)=>{let Y=setTimeout(()=>{X()},$);Z={cancel:()=>{if(Y)clearTimeout(Y),X()}}});return Object.assign(Q,Z)}async function NB4($,Z=1000){let Q=H81(),X=setTimeout(()=>{Q.reject(new W81.TimeoutError)},Z);try{return await Promise.race([$,Q])}finally{clearTimeout(X)}}function H81(){let $={},Z=new Promise((Q,X)=>{$={resolve:Q,reject:X}});return Object.assign(Z,$)}function BB4(){let $={},Z=new Promise((Q,X)=>{$={resolve:(Y)=>{console.trace("resolve",Y),Q(Y)},reject:(Y)=>{console.trace("reject"),X(Y)}}});return Object.assign(Z,$)}function LB4($){for(let Z=$.length-1;Z>0;Z--){let Q=Math.floor(Math.random()*(Z+1));[$[Z],$[Q]]=[$[Q],$[Z]]}return $}async function DB4($){let Z=[];for await(let Q of $)Z.push(Q);return Z}class vY${timers;measures;constructor(){this.timers=new Map,this.measures=new Map}mark($){this.timers.set($,performance.now())}measure($,Z,Q){let X=this.timers.get(Z);if(X===void 0)throw Error(`${Z} is not defined`);let Y=this.timers.get(Q);if(Y===void 0)throw Error(`${Q} is not defined`);this.measures.set($,Y-X)}getEntries(){let $=[];return this.measures.forEach((Z,Q)=>{$.push({name:Q,duration:Z})}),$}}bY$.Perf=vY$;class xY${max;current;waiting;constructor($=1){this.max=$,this.current=0,this.waiting=[]}lock(){if(this.current++,this.current<=this.max)return Promise.resolve();let $=H81();return this.waiting.push($),$}unlock(){this.current--,this.waiting.pop()?.resolve()}}bY$.SimpleMutex=xY$;function fY$($){if($===0)return 0;return Math.floor($/2+Math.random()*$)}function OB4($=[0,250,250,500,500,3000,5000]){if(!Array.isArray($))$=[0,250,250,500,500,3000,5000];let Z=$.length-1;return{backoff(Q){return fY$(Q>Z?$[Z]:$[Q])}}}function wB4($){return $*1e6}function jB4($){return Math.floor($/1e6)}var EB4="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",QL=new Uint8Array(62);for(let $=0;$<62;$++)QL[$]=EB4.charCodeAt($);var zB4=218340105584896;function PB4(){let $=Math.floor(Math.random()*zB4),Z=$%62,Q=QL[Z];$=($-Z)/62,Z=$%62;let X=QL[Z];$=($-Z)/62,Z=$%62;let Y=QL[Z];$=($-Z)/62,Z=$%62;let J=QL[Z];$=($-Z)/62,Z=$%62;let G=QL[Z];$=($-Z)/62,Z=$%62;let K=QL[Z];$=($-Z)/62,Z=$%62;let W=QL[Z];$=($-Z)/62;let H=QL[$];return String.fromCharCode(Q,X,Y,J,G,K,W,H)}});var dY$=b((cY$)=>{Object.defineProperty(cY$,"__esModule",{value:!0});cY$.nuid=cY$.NuidImpl=void 0;var yB4="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Iw=62,IK0=12,uY$=10,gY$=33,gB4=333,hY$=IK0+uY$,U81=new Uint8Array(Iw);for(let $=0;$<Iw;$++)U81[$]=yB4.charCodeAt($);var MK0=4294967296,lY$=BigInt(Iw)**BigInt(uY$),mr=Number(lY$/(1n<<32n)),F81=Number(lY$%(1n<<32n));function hB4($){for(let Z=0;Z<$.length;Z++)$[Z]=Math.floor(Math.random()*256)}function uB4($){if(globalThis?.crypto?.getRandomValues)globalThis.crypto.getRandomValues($);else hB4($)}class N81{buf;cbuf;seqHi;seqLo;inc;inited;constructor(){this.buf=new Uint8Array(hY$),this.cbuf=new Uint8Array(IK0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){let $=0;do this.seqHi=Math.floor(Math.random()*(mr+1)),this.seqLo=Math.floor(Math.random()*MK0);while($++<8&&this.seqHi===mr&&this.seqLo>=F81);if(this.seqHi===mr&&this.seqLo>=F81)this.seqLo=0;this.inc=Math.random()*(gB4-gY$)+gY$|0}setPre(){uB4(this.cbuf);for(let $=0;$<IK0;$++)this.buf[$]=U81[this.cbuf[$]%Iw]}fillSeq(){let $=this.seqHi,Z=this.seqLo;for(let Q=hY$-1;Q>=IK0;Q--){let X=Math.floor($/Iw),J=($-X*Iw)*MK0+Z,G=Math.floor(J/Iw),K=J-G*Iw;this.buf[Q]=U81[K],$=X,Z=G}}next(){if(!this.inited)this.init();if(this.seqLo+=this.inc,this.seqLo>=MK0)this.seqLo-=MK0,this.seqHi+=1;if(this.seqHi>mr||this.seqHi===mr&&this.seqLo>=F81)this.setPre(),this.initSeqAndInc();this.fillSeq();let $=this.buf;return String.fromCharCode($[0],$[1],$[2],$[3],$[4],$[5],$[6],$[7],$[8],$[9],$[10],$[11],$[12],$[13],$[14],$[15],$[16],$[17],$[18],$[19],$[20],$[21])}reset(){this.init()}}cY$.NuidImpl=N81;cY$.nuid=new N81});var tY$=b((pY$)=>{Object.defineProperty(pY$,"__esModule",{value:!0});pY$.nuid=pY$.Nuid=void 0;var iY$=dY$();pY$.Nuid=iY$.NuidImpl;pY$.nuid=iY$.nuid});var kK0=b((VK0)=>{Object.defineProperty(VK0,"__esModule",{value:!0});VK0.nuid=VK0.Nuid=void 0;var oY$=tY$();Object.defineProperty(VK0,"Nuid",{enumerable:!0,get:function(){return oY$.Nuid}});Object.defineProperty(VK0,"nuid",{enumerable:!0,get:function(){return oY$.nuid}})});var Vw=b((aY$)=>{Object.defineProperty(aY$,"__esModule",{value:!0});aY$.DEFAULT_HOST=aY$.DEFAULT_PORT=aY$.Match=void 0;aY$.syncIterator=pB4;aY$.createInbox=nB4;var dB4=kK0(),iB4=dG();aY$.Match={Exact:"exact",CanonicalMIME:"canonical",IgnoreCase:"insensitive"};function pB4($){let Z=$[Symbol.asyncIterator]();return{async next(){let Q=await Z.next();if(Q.done)return Promise.resolve(null);return Promise.resolve(Q.value)}}}function nB4($=""){if($=$||"_INBOX",typeof $!=="string")throw TypeError("prefix must be a string");return $.split(".").forEach((Z)=>{if(Z==="*"||Z===">")throw iB4.InvalidArgumentError.format("prefix",`cannot have wildcards ('${$}')`)}),`${$}.${dB4.nuid.next()}`}aY$.DEFAULT_PORT=4222;aY$.DEFAULT_HOST="127.0.0.1"});var dr=b(($J$)=>{Object.defineProperty($J$,"__esModule",{value:!0});$J$.DataBuffer=void 0;var sY$=mG();class eY${buffers;byteLength;constructor(){this.buffers=[],this.byteLength=0}static concat(...$){let Z=0;for(let Y=0;Y<$.length;Y++)Z+=$[Y].length;let Q=new Uint8Array(Z),X=0;for(let Y=0;Y<$.length;Y++)Q.set($[Y],X),X+=$[Y].length;return Q}static fromAscii($){if(!$)$="";return sY$.TE.encode($)}static toAscii($){return sY$.TD.decode($)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){let $=new Uint8Array(this.byteLength),Z=0;for(let Q=0;Q<this.buffers.length;Q++)$.set(this.buffers[Q],Z),Z+=this.buffers[Q].length;this.buffers.length=0,this.buffers.push($)}}shift(){if(this.buffers.length){let $=this.buffers.shift();if($)return this.byteLength-=$.length,$}return new Uint8Array(0)}drain($){if(this.buffers.length){this.pack();let Z=this.buffers.pop();if(Z){let Q=this.byteLength;if($===void 0||$>Q)$=Q;let X=Z.subarray(0,$);if(Q>$)this.buffers.push(Z.subarray($));return this.byteLength=Q-$,X}}return new Uint8Array(0)}fill($,...Z){if($)this.buffers.push($),this.byteLength+=$.length;for(let Q=0;Q<Z.length;Q++)if(Z[Q]&&Z[Q].length)this.buffers.push(Z[Q]),this.byteLength+=Z[Q].length}peek(){if(this.buffers.length)return this.pack(),this.buffers[0];return new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}$J$.DataBuffer=eY$});var dT=b((XJ$)=>{Object.defineProperty(XJ$,"__esModule",{value:!0});XJ$.LF=XJ$.CR=XJ$.CRLF=XJ$.CR_LF_LEN=XJ$.CR_LF=void 0;XJ$.setTransportFactory=ZL4;XJ$.defaultPort=QL4;XJ$.getUrlParseFn=XL4;XJ$.newTransport=YL4;XJ$.getResolveFn=JL4;XJ$.protoLen=QJ$;XJ$.extractProtocolMessage=GL4;var sB4=mG(),eB4=Vw(),$L4=dr(),iG;function ZL4($){iG=$}function QL4(){return iG!==void 0&&iG.defaultPort!==void 0?iG.defaultPort:eB4.DEFAULT_PORT}function XL4(){return iG!==void 0&&iG.urlParseFn?iG.urlParseFn:void 0}function YL4(){if(!iG||typeof iG.factory!=="function")throw Error("transport fn is not set");return iG.factory()}function JL4(){return iG!==void 0&&iG.dnsResolveFn?iG.dnsResolveFn:void 0}XJ$.CR_LF=`\r
2161
+ `);X=J.pop()??"";for(let G of J){let K=Bun.stripANSI(G).replace(/^\[\d+\]\s*/,"").trim();if(!K)continue;Rw({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:K})}}(async()=>{try{for(;;){let{done:J,value:G}=await Z.read();if(J)break;X+=Q.decode(G,{stream:!0}),Y()}}catch{}if(X.trim()){let J=Bun.stripANSI(X).replace(/^\[\d+\]\s*/,"").trim();if(J)Rw({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:J})}})()}async function BN4($){let{baseUrl:Z,noTui:Q}=$,X=process.env.HOST==="0.0.0.0"&&Boolean(process.env.PORT),Y=X?process.env.PORT:$.vitePort,J=Z||`http://localhost:${Y}`,G=X?await lr(Number(Y)+1):await lr(Number($.port)),{settings:K,services:W,managedServiceNames:H}=await OK0({port:String(G),home:$.home,baseUrl:$.baseUrl,localMode:$.localMode,skipMigrations:$.skipMigrations,noTui:$.noTui,vitePort:$.vitePort});for(let O of W)hT({name:O.name,status:"ready",port:O.port});hr();let F=NN4(import.meta.dir,"..","..","..","..",".."),U=Q===!0,N=Bun.spawn(["bun","run","dev:servers"],{cwd:F,env:{...process.env,PORT:String(K.port),VITE_PORT:String(Y),DATABASE_URL:K.databaseUrl,NATS_URL:K.natsUrls.join(","),NODE_ENV:K.nodeEnv,BASE_URL:J,DECOCMS_LOCAL_MODE:String(K.localMode),DECOCMS_HOME:K.dataDir,DATA_DIR:K.dataDir,DECO_CLI:"1",...K.betterAuthSecret?{BETTER_AUTH_SECRET:K.betterAuthSecret}:{},...K.s3Endpoint?{S3_ENDPOINT:K.s3Endpoint,S3_BUCKET:K.s3Bucket??"",S3_ACCESS_KEY_ID:K.s3AccessKeyId??"",S3_SECRET_ACCESS_KEY:K.s3SecretAccessKey??"",S3_FORCE_PATH_STYLE:String(K.s3ForcePathStyle)}:{},...K.natsCredsPath?{NATS_CREDS:K.natsCredsPath}:{}},stdio:["inherit",U?"inherit":"pipe",U?"inherit":"pipe"]});if(!U)d$1(N.stdout),d$1(N.stderr);ur(J),hT({name:"Vite",status:"ready",port:Number(Y)}),hT({name:"API",status:"ready",port:Number(K.port)});let D=async(O)=>{if(N.kill(O),await N.exited,H.length>0){let{stopServices:w}=await Promise.resolve().then(() => (w30(),O30));await w(K.dataDir)}};return process.on("SIGINT",()=>D("SIGINT")),process.on("SIGTERM",()=>D("SIGTERM")),{port:Number(Y),process:N}}var p$1=L(()=>{h$1();uT();m$1()});var EK0;var n$1=L(()=>{EK0={name:"decocms",version:"4.417.5",description:"Deco CMS \u2014 Self-hostable MCP Gateway for managing AI connections and tools",author:"Deco team",repository:{type:"git",url:"git+https://github.com/decocms/studio.git",directory:"apps/api"},bugs:{url:"https://github.com/decocms/studio/issues"},type:"module",bin:{deco:"./dist/server/cli.js"},files:["dist/**/*"],scripts:{dev:"bun run migrate && bun run dev:server","dev:server":"bun run --cwd=../../packages/sandbox build && NODE_ENV=development bun --env-file=.env --hot run src/index.ts",build:"bun run build:server","build:server":"bun run scripts/bundle-server-script.ts --dist ./dist/server","generate:tool-contracts":"bun run scripts/generate-tool-contracts.ts","db:migrate":"bun run ./dist/server/migrate.js","db:migrate:dbos":"bun run ./dist/server/migrate-dbos.js",check:"tsc --noEmit",start:"bun run ./dist/server/server.js",migrate:"bun run src/database/migrate.ts","migrate:dbos":"bun run src/database/migrate-dbos.ts",test:"bun test src","better-auth:migrate":"bunx --bun @better-auth/cli migrate -y --config src/auth/index.ts",prepublishOnly:"bun run --cwd=../.. build:studio"},optionalDependencies:{"@duckdb/node-api":"^1.5.0-r.1"},dependencies:{"@ai-sdk/anthropic":"^4.0.58","@ai-sdk/google":"^4.0.76","@ai-sdk/openai":"^4.0.71","@anthropic-ai/sdk":"^0.105.0","@aws-sdk/client-s3":"^3.1013.0","@aws-sdk/client-sts":"^3.1013.0","@aws-sdk/lib-storage":"^3.1013.0","@aws-sdk/s3-request-presigner":"^3.1013.0","@clickhouse/client":"^1.8.1","@dbos-inc/dbos-sdk":"^4.21.6","@inkjs/ui":"^2.0.0","@nats-io/jetstream":"3.4.0","@nats-io/kv":"3.4.0","@nats-io/nats-core":"3.4.0","@nats-io/transport-node":"3.4.0","@openrouter/ai-sdk-provider":"^3.1.0","@opentelemetry/core":"^2.6.0","embedded-postgres":"^18.3.0-beta.16",ink:"^6.8.0",kysely:"^0.28.12","posthog-node":"^5.0.0",react:"^19.2.6","react-dom":"^19.2.6"},devDependencies:{"@ai-sdk/provider":"^4.0.17","@better-auth/sso":"1.4.1","@decocms/better-auth":"1.5.17","@decocms/bindings":"workspace:*","@decocms/mcp-utils":"workspace:*","@decocms/runtime":"workspace:*","@decocms/sandbox":"workspace:*","@decocms/shared":"workspace:*","@jitl/quickjs-wasmfile-release-sync":"0.31.0","@modelcontextprotocol/sdk":"1.29.0","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.211.0","@opentelemetry/exporter-logs-otlp-proto":"^0.211.0","@opentelemetry/exporter-prometheus":"^0.208.0","@opentelemetry/exporter-trace-otlp-proto":"^0.207.0","@opentelemetry/instrumentation-runtime-node":"^0.24.0","@opentelemetry/resources":"^2.6.0","@opentelemetry/sdk-logs":"^0.211.0","@opentelemetry/sdk-metrics":"^2.2.0","@opentelemetry/sdk-node":"^0.207.0","@opentelemetry/sdk-trace-base":"^2.5.0","@types/bun":"^1.3.1","@types/google.maps":"^3.65.2","@types/pg":"^8.15.6","@types/react-syntax-highlighter":"^15.5.13","@vercel/nft":"^1.1.1",ai:"^7.0.107","better-auth":"1.4.22",croner:"^9.1.0",degit:"^2.8.4",hono:"^4.10.7",jose:"^6.0.11",nanoid:"^5.1.6",pg:"^8.16.3",typescript:"^7.0.2",typescript5:"npm:typescript@^5.9.3",zod:"4.3.6"},homepage:"https://github.com/decocms/studio",keywords:["mcp","model-context-protocol","ai","gateway","self-hosted","tools"],license:"MIT",publishConfig:{access:"public"}}});import{Box as DN4,Text as XY$}from"ink";import{jsx as ON4,jsxs as YY$}from"react/jsx-runtime";function JY$({version:$}){return YY$(DN4,{flexDirection:"column",marginTop:1,children:[u30.map((Z,Q)=>ON4(XY$,{color:l30[Q],children:Z},Q)),YY$(XY$,{dimColor:!0,children:[" v",$]})]})}var GY$=L(()=>{Tr()});import{Box as lT,Text as qw}from"ink";import{Spinner as wN4}from"@inkjs/ui";import{jsx as cG,jsxs as pl}from"react/jsx-runtime";function KY$({status:$}){if($==="pending")return cG(wN4,{label:""});return cG(qw,{color:"green",children:"\u2713"})}function jN4($){return`${$.name}: ${$.port||"...."}`}function WY$({services:$,migrationsStatus:Z,home:Q,serverUrl:X}){return pl(lT,{flexDirection:"column",paddingBottom:1,children:[cG(JY$,{version:EK0.version}),cG(lT,{marginBottom:1,children:cG(qw,{dimColor:!0,children:"\u2500".repeat(80)})}),cG(lT,{children:pl(qw,{dimColor:!0,children:["Home: ",Q]})}),pl(lT,{gap:2,children:[$.map((Y)=>pl(lT,{gap:1,children:[cG(qw,{children:jN4(Y)}),cG(KY$,{status:Y.status})]},Y.name)),pl(lT,{gap:1,children:[cG(qw,{children:"Migrations"}),cG(KY$,{status:Z})]})]}),cG(lT,{children:X?pl(qw,{children:["Open in browser: ",cG(qw,{color:"cyan",children:X})]}):cG(qw,{dimColor:!0,children:"Starting..."})})]})}var HY$=L(()=>{n$1();GY$()});import{Box as EN4,Text as cr}from"ink";import{jsx as t$1,jsxs as o$1}from"react/jsx-runtime";function zN4($){if($>=500)return"red";if($>=400)return"yellow";if($>=300)return"cyan";return"green"}function FY$({logs:$}){return t$1(EN4,{flexDirection:"column",children:$.map((Z,Q)=>{if(Z.rawLine)return t$1(cr,{dimColor:!0,children:Z.rawLine},Q);let X=Z.duration<1000?`${Z.duration}ms`:`${(Z.duration/1000).toFixed(1)}s`;return o$1(cr,{children:[o$1(cr,{dimColor:!0,children:[Z.method.padEnd(6)," ",Z.path.padEnd(30)," "]}),t$1(cr,{color:zN4(Z.status),children:Z.status}),o$1(cr,{dimColor:!0,children:[" ",X.padStart(8)]})]},Q)})})}var UY$=()=>{};var a$1={};G0(a$1,{App:()=>AN4});import{Box as PN4}from"ink";import{useSyncExternalStore as TN4}from"react";import{jsx as NY$,jsxs as RN4}from"react/jsx-runtime";function AN4({home:$}){let Z=TN4(c$1,l$1);return RN4(PN4,{flexDirection:"column",children:[NY$(WY$,{services:Z.services,migrationsStatus:Z.migrationsStatus,home:$,serverUrl:Z.serverUrl}),NY$(FY$,{logs:Z.logs})]})}var r$1=L(()=>{HY$();UY$();uT()});var PK="thread-gate",$L="decopilot-hosted-harness",ZL="decopilot-hosted-harness-sandboxed",TK="automations",Mw="background-tools",cT="task-board-github-reads";var BY$="13";function LY$($){return{name:"decocms",systemDatabaseUrl:$.systemDatabaseUrl,systemDatabaseSchemaName:"dbos",systemDatabasePoolSize:$.poolSize,runAdminServer:!1,executorID:$.executorID,applicationVersion:BY$,...$.listenQueues!==void 0?{listenQueues:$.listenQueues}:{}}}var DY$=()=>{};import qN4 from"pg";async function wY$($,Z){let{databaseUrl:Q,lockTimeoutMs:X=MN4}=$,Y=$.log??((W)=>console.log(W)),J=new qN4.Client({connectionString:Q});await J.connect();let G=Date.now(),K=!1;try{while(!K){if(K=(await J.query("SELECT pg_try_advisory_lock($1) AS locked",[OY$.toString()])).rows[0]?.locked===!0,K)break;if(Date.now()-G>=X)throw Error(`Timed out after ${X}ms waiting for the DBOS migration lock. Another process is still migrating the dbos schema; this pod will restart and retry.`);await P$(IN4)}let W=Date.now()-G;if(W>1000)Y(`[dbos] waited ${W}ms for the migration lock; another process migrated first`);return await Z()}finally{if(K)try{await J.query("SELECT pg_advisory_unlock($1)",[OY$.toString()])}catch{}await J.end().catch(()=>{})}}var OY$=8314027461559302n,MN4=600000,IN4=500;var jY$=L(()=>{F8()});function VN4(){let $=(process.env.BUN_OPTIONS??"").split(/\s+/).filter(Boolean);return[...process.argv.slice(1),...$]}function s$1($,Z){for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X===void 0)continue;if(X===Z)return $[Q+1];if(X.startsWith(`${Z}=`))return X.slice(Z.length+1)}return}function EY$(){let $=VN4();if($.includes("--cpu-prof")){console.log(JSON.stringify({msg:"cpu-profiling-active",dir:s$1($,"--cpu-prof-dir")??process.cwd(),name:s$1($,"--cpu-prof-name"),markdown:$.includes("--cpu-prof-md"),intervalUs:Number(s$1($,"--cpu-prof-interval")??1000),note:"profile is written on process exit"}));return}if(process.env.CPU_PROFILE)console.warn(JSON.stringify({msg:"cpu-profiling-requested-but-inactive",hint:'CPU profiling is a Bun launch flag. Set BUN_OPTIONS="--cpu-prof --cpu-prof-md --cpu-prof-dir=/tmp" before starting the process.'}))}function zY$(){if(process.env.HEAP_WATCH!=="1")return()=>{};let $=Number(process.env.HEAP_WATCH_INTERVAL_MS??60000),Z=async()=>{let Q=fT();if(!Q)return;let X={};try{let{heapStats:Y}=await import("bun:jsc"),J=Y(),G=Object.entries(J.objectTypeCounts).sort((K,W)=>W[1]-K[1]).slice(0,20);X={objectCount:J.objectCount,heapSize:J.heapSize,top:Object.fromEntries(G)}}catch{}console.log(JSON.stringify({msg:"heap-watch",ts:new Date().toISOString(),uptimeS:Math.round(process.uptime()),rss:Q.rss,heapUsed:Q.heapUsed,heapTotal:Q.heapTotal,external:Q.external,arrayBuffers:Q.arrayBuffers,...X}))};return Z().catch(()=>{}),zK0=setInterval(()=>void Z().catch(()=>{}),$),zK0.unref?.(),process.on("SIGUSR2",()=>{try{let Q=Bun.generateHeapSnapshot("v8"),X=typeof Q==="string"?Q:JSON.stringify(Q),Y=`/tmp/heap-${process.pid}-${Date.now()}.heapsnapshot`;Bun.write(Y,X),console.log(JSON.stringify({msg:"heap-snapshot-written",path:Y}))}catch(Q){console.error("[heap-watch] snapshot failed:",Q)}}),()=>{if(zK0)clearInterval(zK0)}}var zK0;var PY$=()=>{};import*as kN4 from"bun:jsc";function TY$(){if(process.env.STALL_WATCHDOG!=="1")return()=>{};let $=Number(process.env.STALL_WATCHDOG_MS??100),Z=Number(process.env.STALL_WATCHDOG_TICK_MS??50);try{SN4()}catch(J){return console.error("[stall-watchdog] failed to start sampling profiler:",J),()=>{}}let Q,X=performance.now()+Z,Y=()=>{let J=performance.now(),G=J-X;X=J+Z;let K=[];try{K=CN4()?.traces??[]}catch{}if(G>$&&K.length>0){let W=new Map;for(let F of K){let U=F.frames.find((D)=>D.sourceURL&&!/Unknown Executable/.test(D.category??""))??F.frames[0];if(!U)continue;let N=(U.sourceURL??"?").replace(/^.*\/node_modules\//,"node_modules/"),B=`${U.name??"?"} @ ${N}:${U.line??"?"}`;W.set(B,(W.get(B)??0)+1)}let H=[...W.entries()].sort((F,U)=>U[1]-F[1]).slice(0,8).map(([F,U])=>({frame:F,count:U}));console.warn(JSON.stringify({msg:"stall-stack",ts:new Date().toISOString(),lagMs:Math.round(G),samplesInWindow:K.length,top:H}))}Q=setTimeout(Y,Z),Q.unref?.()};return Q=setTimeout(Y,Z),Q.unref?.(),()=>{if(Q)clearTimeout(Q)}}var SN4,CN4;var AY$=L(()=>{({startSamplingProfiler:SN4,samplingProfilerStackTraces:CN4}=kN4)});function RY$(){EY$();let $=[zY$(),Z9$(),TY$()];return()=>{for(let Z of $)Z()}}var qY$=L(()=>{fr0();PY$();AY$()});var mT=b((MY$)=>{Object.defineProperty(MY$,"__esModule",{value:!0});MY$.RepublishHeaders=MY$.DirectMsgHeaders=MY$.JsHeaders=MY$.AdvisoryKind=void 0;MY$.isOrderedPushConsumerOptions=_N4;MY$.isPullConsumer=vN4;MY$.isPushConsumer=xN4;MY$.isBoundPushConsumerOptions=fN4;function _N4($){if($&&typeof $==="object")return"name_prefix"in $||"deliver_subject_prefix"in $||"filter_subjects"in $||"filter_subject"in $||"deliver_policy"in $||"opt_start_seq"in $||"opt_start_time"in $||"replay_policy"in $||"inactive_threshold"in $||"headers_only"in $||"deliver_prefix"in $;return!1}function vN4($){return $.isPullConsumer()}function xN4($){return $.isPushConsumer()}function fN4($){if($&&typeof $==="object")return"deliver_subject"in $||"deliver_group"in $||"idle_heartbeat"in $;return!1}MY$.AdvisoryKind={API:"api_audit",StreamAction:"stream_action",ConsumerAction:"consumer_action",SnapshotCreate:"snapshot_create",SnapshotComplete:"snapshot_complete",RestoreCreate:"restore_create",RestoreComplete:"restore_complete",MaxDeliver:"max_deliver",Terminated:"terminated",Ack:"consumer_ack",StreamLeaderElected:"stream_leader_elected",StreamQuorumLost:"stream_quorum_lost",ConsumerLeaderElected:"consumer_leader_elected",ConsumerQuorumLost:"consumer_quorum_lost"};MY$.JsHeaders={StreamSourceHdr:"Nats-Stream-Source",LastConsumerSeqHdr:"Nats-Last-Consumer",LastStreamSeqHdr:"Nats-Last-Stream",ConsumerStalledHdr:"Nats-Consumer-Stalled",MessageSizeHdr:"Nats-Msg-Size",RollupHdr:"Nats-Rollup",RollupValueSubject:"sub",RollupValueAll:"all",PendingMessagesHdr:"Nats-Pending-Messages",PendingBytesHdr:"Nats-Pending-Bytes",RequiredApiLevel:"Nats-Required-Api-Level"};MY$.DirectMsgHeaders={Stream:"Nats-Stream",Sequence:"Nats-Sequence",TimeStamp:"Nats-Time-Stamp",Subject:"Nats-Subject",LastSequence:"Nats-Last-Sequence",NumPending:"Nats-Num-Pending"};MY$.RepublishHeaders={Stream:"Nats-Stream",Subject:"Nats-Subject",Sequence:"Nats-Sequence",LastSequence:"Nats-Last-Sequence",Size:"Nats-Msg-Size"}});var mG=b((VY$)=>{Object.defineProperty(VY$,"__esModule",{value:!0});VY$.TD=VY$.TE=VY$.Empty=void 0;VY$.encode=dN4;VY$.decode=iN4;VY$.Empty=new Uint8Array(0);VY$.TE=new TextEncoder;VY$.TD=new TextDecoder;function mN4(...$){let Z=0;for(let Y=0;Y<$.length;Y++)Z+=$[Y].length;let Q=new Uint8Array(Z),X=0;for(let Y=0;Y<$.length;Y++)Q.set($[Y],X),X+=$[Y].length;return Q}function dN4(...$){let Z=[];for(let Q=0;Q<$.length;Q++)Z.push(VY$.TE.encode($[Q]));if(Z.length===0)return VY$.Empty;if(Z.length===1)return Z[0];return mN4(...Z)}function iN4($){if(!$||$.length===0)return"";return VY$.TD.decode($)}});var dG=b((CY$)=>{Object.defineProperty(CY$,"__esModule",{value:!0});CY$.errors=CY$.PermissionViolationError=CY$.NoRespondersError=CY$.TimeoutError=CY$.RequestError=CY$.ProtocolError=CY$.ConnectionError=CY$.DrainingConnectionError=CY$.ClosedConnectionError=CY$.AuthorizationError=CY$.UserAuthenticationExpiredError=CY$.InvalidOperationError=CY$.InvalidArgumentError=CY$.InvalidSubjectError=void 0;class $81 extends Error{constructor($,Z){super(`illegal subject: '${$}'`,Z);this.name="InvalidSubjectError"}}CY$.InvalidSubjectError=$81;class PK0 extends Error{constructor($,Z){super($,Z);this.name="InvalidArgumentError"}static format($,Z,Q){if(Array.isArray(Z)&&Z.length>1)Z=Z[0];if(Array.isArray($))$=$.map((X)=>`'${X}'`),$=$.join(",");else $=`'${$}'`;return new PK0(`${$} ${Z}`,Q)}}CY$.InvalidArgumentError=PK0;class Z81 extends Error{constructor($,Z){super($,Z);this.name="InvalidOperationError"}}CY$.InvalidOperationError=Z81;class TK0 extends Error{constructor($,Z){super($,Z);this.name="UserAuthenticationExpiredError"}static parse($){if($.toLowerCase().indexOf("user authentication expired")!==-1)return new TK0($);return null}}CY$.UserAuthenticationExpiredError=TK0;class AK0 extends Error{constructor($,Z){super($,Z);this.name="AuthorizationError"}static parse($){let Z=["authorization violation","account authentication expired","authentication timeout"],Q=$.toLowerCase();for(let X=0;X<Z.length;X++)if(Q.indexOf(Z[X])!==-1)return new AK0($);return null}}CY$.AuthorizationError=AK0;class Q81 extends Error{constructor(){super("closed connection");this.name="ClosedConnectionError"}}CY$.ClosedConnectionError=Q81;class X81 extends Error{constructor(){super("connection draining");this.name="DrainingConnectionError"}}CY$.DrainingConnectionError=X81;class Y81 extends Error{constructor($,Z){super($,Z);this.name="ConnectionError"}}CY$.ConnectionError=Y81;class J81 extends Error{constructor($,Z){super($,Z);this.name="ProtocolError"}}CY$.ProtocolError=J81;class G81 extends Error{constructor($="",Z){super($,Z);this.name="RequestError"}isNoResponders(){return this.cause instanceof RK0}}CY$.RequestError=G81;class K81 extends Error{constructor($){super("timeout",$);this.name="TimeoutError"}}CY$.TimeoutError=K81;class RK0 extends Error{subject;constructor($,Z){super(`no responders: '${$}'`,Z);this.subject=$,this.name="NoResponders"}}CY$.NoRespondersError=RK0;class qK0 extends Error{operation;subject;queue;constructor($,Z,Q,X,Y){super($,Y);this.name="PermissionViolationError",this.operation=Z,this.subject=Q,this.queue=X}static parse($){if(($?$.toLowerCase():"").indexOf("permissions violation")===-1)return null;let Q="publish",X="",Y=void 0,J=$.match(/(Publish|Subscription) to "(\S+)"/);if(J){if(Q=J[1].toLowerCase(),X=J[2],Q==="subscription"){let G=$.match(/using queue "(\S+)"/);if(G)Y=G[1]}}return new qK0($,Q,X,Y)}}CY$.PermissionViolationError=qK0;CY$.errors={AuthorizationError:AK0,ClosedConnectionError:Q81,ConnectionError:Y81,DrainingConnectionError:X81,InvalidArgumentError:PK0,InvalidOperationError:Z81,InvalidSubjectError:$81,NoRespondersError:RK0,PermissionViolationError:qK0,ProtocolError:J81,RequestError:G81,TimeoutError:K81,UserAuthenticationExpiredError:TK0}});var JH=b((bY$)=>{Object.defineProperty(bY$,"__esModule",{value:!0});bY$.SimpleMutex=bY$.Perf=void 0;bY$.extend=WB4;bY$.render=HB4;bY$.timeout=FB4;bY$.delay=UB4;bY$.deadline=NB4;bY$.deferred=H81;bY$.debugDeferred=BB4;bY$.shuffle=LB4;bY$.collect=DB4;bY$.jitter=fY$;bY$.backoff=OB4;bY$.nanos=wB4;bY$.millis=jB4;bY$.randomToken=PB4;var KB4=mG(),W81=dG();function WB4($,...Z){for(let Q=0;Q<Z.length;Q++){let X=Z[Q];Object.keys(X).forEach(function(Y){$[Y]=X[Y]})}return $}function HB4($){return KB4.TD.decode($).replace(/\n/g,"\u240A").replace(/\r/g,"\u240D")}function FB4($,Z=!0){let Q=Z?new W81.TimeoutError:null,X,Y,J=new Promise((G,K)=>{X={cancel:()=>{if(Y)clearTimeout(Y)}},Y=setTimeout(()=>{if(Q===null)K(new W81.TimeoutError);else K(Q)},$)});return Object.assign(J,X)}function UB4($=0){let Z,Q=new Promise((X)=>{let Y=setTimeout(()=>{X()},$);Z={cancel:()=>{if(Y)clearTimeout(Y),X()}}});return Object.assign(Q,Z)}async function NB4($,Z=1000){let Q=H81(),X=setTimeout(()=>{Q.reject(new W81.TimeoutError)},Z);try{return await Promise.race([$,Q])}finally{clearTimeout(X)}}function H81(){let $={},Z=new Promise((Q,X)=>{$={resolve:Q,reject:X}});return Object.assign(Z,$)}function BB4(){let $={},Z=new Promise((Q,X)=>{$={resolve:(Y)=>{console.trace("resolve",Y),Q(Y)},reject:(Y)=>{console.trace("reject"),X(Y)}}});return Object.assign(Z,$)}function LB4($){for(let Z=$.length-1;Z>0;Z--){let Q=Math.floor(Math.random()*(Z+1));[$[Z],$[Q]]=[$[Q],$[Z]]}return $}async function DB4($){let Z=[];for await(let Q of $)Z.push(Q);return Z}class vY${timers;measures;constructor(){this.timers=new Map,this.measures=new Map}mark($){this.timers.set($,performance.now())}measure($,Z,Q){let X=this.timers.get(Z);if(X===void 0)throw Error(`${Z} is not defined`);let Y=this.timers.get(Q);if(Y===void 0)throw Error(`${Q} is not defined`);this.measures.set($,Y-X)}getEntries(){let $=[];return this.measures.forEach((Z,Q)=>{$.push({name:Q,duration:Z})}),$}}bY$.Perf=vY$;class xY${max;current;waiting;constructor($=1){this.max=$,this.current=0,this.waiting=[]}lock(){if(this.current++,this.current<=this.max)return Promise.resolve();let $=H81();return this.waiting.push($),$}unlock(){this.current--,this.waiting.pop()?.resolve()}}bY$.SimpleMutex=xY$;function fY$($){if($===0)return 0;return Math.floor($/2+Math.random()*$)}function OB4($=[0,250,250,500,500,3000,5000]){if(!Array.isArray($))$=[0,250,250,500,500,3000,5000];let Z=$.length-1;return{backoff(Q){return fY$(Q>Z?$[Z]:$[Q])}}}function wB4($){return $*1e6}function jB4($){return Math.floor($/1e6)}var EB4="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",QL=new Uint8Array(62);for(let $=0;$<62;$++)QL[$]=EB4.charCodeAt($);var zB4=218340105584896;function PB4(){let $=Math.floor(Math.random()*zB4),Z=$%62,Q=QL[Z];$=($-Z)/62,Z=$%62;let X=QL[Z];$=($-Z)/62,Z=$%62;let Y=QL[Z];$=($-Z)/62,Z=$%62;let J=QL[Z];$=($-Z)/62,Z=$%62;let G=QL[Z];$=($-Z)/62,Z=$%62;let K=QL[Z];$=($-Z)/62,Z=$%62;let W=QL[Z];$=($-Z)/62;let H=QL[$];return String.fromCharCode(Q,X,Y,J,G,K,W,H)}});var dY$=b((cY$)=>{Object.defineProperty(cY$,"__esModule",{value:!0});cY$.nuid=cY$.NuidImpl=void 0;var yB4="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Iw=62,IK0=12,uY$=10,gY$=33,gB4=333,hY$=IK0+uY$,U81=new Uint8Array(Iw);for(let $=0;$<Iw;$++)U81[$]=yB4.charCodeAt($);var MK0=4294967296,lY$=BigInt(Iw)**BigInt(uY$),mr=Number(lY$/(1n<<32n)),F81=Number(lY$%(1n<<32n));function hB4($){for(let Z=0;Z<$.length;Z++)$[Z]=Math.floor(Math.random()*256)}function uB4($){if(globalThis?.crypto?.getRandomValues)globalThis.crypto.getRandomValues($);else hB4($)}class N81{buf;cbuf;seqHi;seqLo;inc;inited;constructor(){this.buf=new Uint8Array(hY$),this.cbuf=new Uint8Array(IK0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){let $=0;do this.seqHi=Math.floor(Math.random()*(mr+1)),this.seqLo=Math.floor(Math.random()*MK0);while($++<8&&this.seqHi===mr&&this.seqLo>=F81);if(this.seqHi===mr&&this.seqLo>=F81)this.seqLo=0;this.inc=Math.random()*(gB4-gY$)+gY$|0}setPre(){uB4(this.cbuf);for(let $=0;$<IK0;$++)this.buf[$]=U81[this.cbuf[$]%Iw]}fillSeq(){let $=this.seqHi,Z=this.seqLo;for(let Q=hY$-1;Q>=IK0;Q--){let X=Math.floor($/Iw),J=($-X*Iw)*MK0+Z,G=Math.floor(J/Iw),K=J-G*Iw;this.buf[Q]=U81[K],$=X,Z=G}}next(){if(!this.inited)this.init();if(this.seqLo+=this.inc,this.seqLo>=MK0)this.seqLo-=MK0,this.seqHi+=1;if(this.seqHi>mr||this.seqHi===mr&&this.seqLo>=F81)this.setPre(),this.initSeqAndInc();this.fillSeq();let $=this.buf;return String.fromCharCode($[0],$[1],$[2],$[3],$[4],$[5],$[6],$[7],$[8],$[9],$[10],$[11],$[12],$[13],$[14],$[15],$[16],$[17],$[18],$[19],$[20],$[21])}reset(){this.init()}}cY$.NuidImpl=N81;cY$.nuid=new N81});var tY$=b((pY$)=>{Object.defineProperty(pY$,"__esModule",{value:!0});pY$.nuid=pY$.Nuid=void 0;var iY$=dY$();pY$.Nuid=iY$.NuidImpl;pY$.nuid=iY$.nuid});var kK0=b((VK0)=>{Object.defineProperty(VK0,"__esModule",{value:!0});VK0.nuid=VK0.Nuid=void 0;var oY$=tY$();Object.defineProperty(VK0,"Nuid",{enumerable:!0,get:function(){return oY$.Nuid}});Object.defineProperty(VK0,"nuid",{enumerable:!0,get:function(){return oY$.nuid}})});var Vw=b((aY$)=>{Object.defineProperty(aY$,"__esModule",{value:!0});aY$.DEFAULT_HOST=aY$.DEFAULT_PORT=aY$.Match=void 0;aY$.syncIterator=pB4;aY$.createInbox=nB4;var dB4=kK0(),iB4=dG();aY$.Match={Exact:"exact",CanonicalMIME:"canonical",IgnoreCase:"insensitive"};function pB4($){let Z=$[Symbol.asyncIterator]();return{async next(){let Q=await Z.next();if(Q.done)return Promise.resolve(null);return Promise.resolve(Q.value)}}}function nB4($=""){if($=$||"_INBOX",typeof $!=="string")throw TypeError("prefix must be a string");return $.split(".").forEach((Z)=>{if(Z==="*"||Z===">")throw iB4.InvalidArgumentError.format("prefix",`cannot have wildcards ('${$}')`)}),`${$}.${dB4.nuid.next()}`}aY$.DEFAULT_PORT=4222;aY$.DEFAULT_HOST="127.0.0.1"});var dr=b(($J$)=>{Object.defineProperty($J$,"__esModule",{value:!0});$J$.DataBuffer=void 0;var sY$=mG();class eY${buffers;byteLength;constructor(){this.buffers=[],this.byteLength=0}static concat(...$){let Z=0;for(let Y=0;Y<$.length;Y++)Z+=$[Y].length;let Q=new Uint8Array(Z),X=0;for(let Y=0;Y<$.length;Y++)Q.set($[Y],X),X+=$[Y].length;return Q}static fromAscii($){if(!$)$="";return sY$.TE.encode($)}static toAscii($){return sY$.TD.decode($)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){let $=new Uint8Array(this.byteLength),Z=0;for(let Q=0;Q<this.buffers.length;Q++)$.set(this.buffers[Q],Z),Z+=this.buffers[Q].length;this.buffers.length=0,this.buffers.push($)}}shift(){if(this.buffers.length){let $=this.buffers.shift();if($)return this.byteLength-=$.length,$}return new Uint8Array(0)}drain($){if(this.buffers.length){this.pack();let Z=this.buffers.pop();if(Z){let Q=this.byteLength;if($===void 0||$>Q)$=Q;let X=Z.subarray(0,$);if(Q>$)this.buffers.push(Z.subarray($));return this.byteLength=Q-$,X}}return new Uint8Array(0)}fill($,...Z){if($)this.buffers.push($),this.byteLength+=$.length;for(let Q=0;Q<Z.length;Q++)if(Z[Q]&&Z[Q].length)this.buffers.push(Z[Q]),this.byteLength+=Z[Q].length}peek(){if(this.buffers.length)return this.pack(),this.buffers[0];return new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}$J$.DataBuffer=eY$});var dT=b((XJ$)=>{Object.defineProperty(XJ$,"__esModule",{value:!0});XJ$.LF=XJ$.CR=XJ$.CRLF=XJ$.CR_LF_LEN=XJ$.CR_LF=void 0;XJ$.setTransportFactory=ZL4;XJ$.defaultPort=QL4;XJ$.getUrlParseFn=XL4;XJ$.newTransport=YL4;XJ$.getResolveFn=JL4;XJ$.protoLen=QJ$;XJ$.extractProtocolMessage=GL4;var sB4=mG(),eB4=Vw(),$L4=dr(),iG;function ZL4($){iG=$}function QL4(){return iG!==void 0&&iG.defaultPort!==void 0?iG.defaultPort:eB4.DEFAULT_PORT}function XL4(){return iG!==void 0&&iG.urlParseFn?iG.urlParseFn:void 0}function YL4(){if(!iG||typeof iG.factory!=="function")throw Error("transport fn is not set");return iG.factory()}function JL4(){return iG!==void 0&&iG.dnsResolveFn?iG.dnsResolveFn:void 0}XJ$.CR_LF=`\r
2162
2162
  `;XJ$.CR_LF_LEN=XJ$.CR_LF.length;XJ$.CRLF=$L4.DataBuffer.fromAscii(XJ$.CR_LF);XJ$.CR=new Uint8Array(XJ$.CRLF)[0];XJ$.LF=new Uint8Array(XJ$.CRLF)[1];function QJ$($){for(let Z=0;Z<$.length;Z++){let Q=Z+1;if($.byteLength>Q&&$[Z]===XJ$.CR&&$[Q]===XJ$.LF)return Q+1}return 0}function GL4($){let Z=QJ$($);if(Z>0){let X=new Uint8Array($).slice(0,Z);return sB4.TD.decode(X)}return""}});var w81=b((UJ$)=>{Object.defineProperty(UJ$,"__esModule",{value:!0});UJ$.ipV4=WJ$;UJ$.isIP=wL4;UJ$.parseIP=HJ$;var ir=4,iT=16,SK0=48,KJ$=57,JJ$=65,DL4=70,GJ$=97,OL4=102,O81=16777215;function WJ$($,Z,Q,X){let Y=new Uint8Array(iT);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((G,K)=>{Y[K]=G}),Y[12]=$,Y[13]=Z,Y[14]=Q,Y[15]=X,Y}function wL4($){return HJ$($)!==void 0}function HJ$($){for(let Z=0;Z<$.length;Z++)switch($[Z]){case".":return FJ$($);case":":return jL4($)}return}function FJ$($){let Z=new Uint8Array(ir);for(let Q=0;Q<ir;Q++){if($.length===0)return;if(Q>0){if($[0]!==".")return;$=$.substring(1)}let{n:X,c:Y,ok:J}=EL4($);if(!J||X>255)return;$=$.substring(Y),Z[Q]=X}return WJ$(Z[0],Z[1],Z[2],Z[3])}function jL4($){let Z=new Uint8Array(iT),Q=-1;if($.length>=2&&$[0]===":"&&$[1]===":"){if(Q=0,$=$.substring(2),$.length===0)return Z}let X=0;while(X<iT){let{n:Y,c:J,ok:G}=zL4($);if(!G||Y>65535)return;if(J<$.length&&$[J]==="."){if(Q<0&&X!=iT-ir)return;if(X+ir>iT)return;let K=FJ$($);if(K===void 0)return;Z[X]=K[12],Z[X+1]=K[13],Z[X+2]=K[14],Z[X+3]=K[15],$="",X+=ir;break}if(Z[X]=Y>>8,Z[X+1]=Y,X+=2,$=$.substring(J),$.length===0)break;if($[0]!==":"||$.length==1)return;if($=$.substring(1),$[0]===":"){if(Q>=0)return;if(Q=X,$=$.substring(1),$.length===0)break}}if($.length!==0)return;if(X<iT){if(Q<0)return;let Y=iT-X;for(let J=X-1;J>=Q;J--)Z[J+Y]=Z[J];for(let J=Q+Y-1;J>=Q;J--)Z[J]=0}else if(Q>=0)return;return Z}function EL4($){let Z=0,Q=0;for(Z=0;Z<$.length&&SK0<=$.charCodeAt(Z)&&$.charCodeAt(Z)<=KJ$;Z++)if(Q=Q*10+($.charCodeAt(Z)-SK0),Q>=O81)return{n:O81,c:Z,ok:!1};if(Z===0)return{n:0,c:0,ok:!1};return{n:Q,c:Z,ok:!0}}function zL4($){let Z=0,Q=0;for(Q=0;Q<$.length;Q++){if(SK0<=$.charCodeAt(Q)&&$.charCodeAt(Q)<=KJ$)Z*=16,Z+=$.charCodeAt(Q)-SK0;else if(GJ$<=$.charCodeAt(Q)&&$.charCodeAt(Q)<=OL4)Z*=16,Z+=$.charCodeAt(Q)-GJ$+10;else if(JJ$<=$.charCodeAt(Q)&&$.charCodeAt(Q)<=DL4)Z*=16,Z+=$.charCodeAt(Q)-JJ$+10;else break;if(Z>=O81)return{n:0,c:Q,ok:!1}}if(Q===0)return{n:0,c:Q,ok:!1};return{n:Z,c:Q,ok:!0}}});var A81=b((BJ$)=>{Object.defineProperty(BJ$,"__esModule",{value:!0});BJ$.Servers=BJ$.ServerImpl=void 0;BJ$.isIPV4OrHostname=NJ$;BJ$.hostPort=T81;var j81=dT(),E81=JH(),z81=w81(),RL4=Vw(),qL4=dG();function NJ$($){if($.indexOf("[")!==-1||$.indexOf("::")!==-1)return!1;if($.indexOf(".")!==-1)return!0;if($.split(":").length<=2)return!0;return!1}function P81($){return!NJ$($)}function ML4($){let Q=$.toUpperCase().indexOf("::FFFF:");if(Q!==-1&&$.indexOf(".")!==-1){let X=$.substring(Q+7);return X=X.replace("[",""),X.replace("]","")}return $}function T81($){if($=$.trim(),$.match(/^(.*:\/\/)(.*)/m))$=$.replace(/^(.*:\/\/)(.*)/gm,"$2");if($=ML4($),P81($)&&$.indexOf("[")===-1)$=`[${$}]`;let Z=P81($)?$.match(/(]:)(\d+)/):$.match(/(:)(\d+)/),Q=Z&&Z.length===3&&Z[1]&&Z[2]?parseInt(Z[2]):RL4.DEFAULT_PORT,Y=new URL(`${Q===80?"https":"http"}://${$}`);Y.port=`${Q}`;let J=Y.hostname;if(J.charAt(0)==="[")J=J.substring(1,J.length-1);return{listen:Y.host,hostname:J,port:Q}}class nl{src;listen;hostname;port;didConnect;reconnects;lastConnect;gossiped;tlsName;resolves;constructor($,Z=!1){this.src=$,this.tlsName="";let Q=T81($);this.listen=Q.listen,this.hostname=Q.hostname,this.port=Q.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=Z}toString(){return this.listen}async resolve($){if(!$.fn||$.resolve===!1)return[this];let Z=[];if((0,z81.isIP)(this.hostname))return[this];else{let Q=await $.fn(this.hostname);if($.debug)console.log(`resolve ${this.hostname} = ${Q.join(",")}`);for(let X of Q){let Y=this.port===80?"https":"http",J=new URL(`${Y}://${P81(X)?"["+X+"]":X}`);J.port=`${this.port}`;let G=new nl(J.host,!1);G.tlsName=this.hostname,Z.push(G)}}if($.randomize)(0,E81.shuffle)(Z);return this.resolves=Z,Z}}BJ$.ServerImpl=nl;class CK0{firstSelect;servers;currentServer;tlsName;randomize;constructor($={}){this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=$.randomize||!1}setServers($){if(!Array.isArray($)||$.length===0)throw qL4.InvalidArgumentError.format("servers","cannot be empty");let Z=(0,j81.getUrlParseFn)(),Q=new Map;for(let Y of this.servers)Q.set(Y.listen,Y);let X=[];for(let Y of $){Y=Z?Z(Y):Y;let{listen:J}=T81(Y),G=Q.get(J);if(G)G.gossiped=!1,X.push(G);else X.push(new nl(Y))}if(this.randomize)(0,E81.shuffle)(X);if(this.servers=X,this.currentServer===void 0||!X.includes(this.currentServer))this.currentServer=X[0],this.firstSelect=!0}clear(){this.servers.length=0}updateTLSName(){let $=this.getCurrentServer();if(!(0,z81.isIP)($.hostname))this.tlsName=$.hostname,this.servers.forEach((Z)=>{if(Z.gossiped)Z.tlsName=this.tlsName})}getCurrentServer(){return this.currentServer}addServer($,Z=!1){let Q=(0,j81.getUrlParseFn)();$=Q?Q($):$;let X=new nl($,Z);if((0,z81.isIP)(X.hostname))X.tlsName=this.tlsName;this.servers.push(X)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;let $=this.servers.shift();if($)this.servers.push($),this.currentServer=$;return $}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer($){if($){let Z=this.servers.indexOf($);this.servers.splice(Z,1)}}snapshot(){return CK0.freezeAll(this.servers)}snapshotForHandler(){let $=this.currentServer;if(!$)return this.snapshot();let Z=this.servers.indexOf($);if(Z<=0)return this.snapshot();return CK0.freezeAll([$,...this.servers.slice(0,Z),...this.servers.slice(Z+1)])}static freezeAll($){return $.map((Z)=>Object.freeze({hostname:Z.hostname,port:Z.port,listen:Z.listen,src:Z.src,tlsName:Z.tlsName,reconnects:Z.reconnects,lastConnect:Z.lastConnect,gossiped:Z.gossiped,didConnect:Z.didConnect}))}find($){return this.servers.find((Z)=>Z.listen===$.listen)}setCurrent($){this.currentServer=$}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update($,Z){let Q=[],X=[],Y=(0,j81.getUrlParseFn)(),J=new Map;if($.connect_urls&&$.connect_urls.length>0)$.connect_urls.forEach((K)=>{K=Y?Y(K,Z):K;let W=new nl(K,!0);J.set(K,W)});let G=[];if(this.servers.forEach((K,W)=>{let H=K.listen;if(K.gossiped&&this.currentServer.listen!==H&&J.get(H)===void 0)G.push(W);J.delete(H)}),G.reverse(),G.forEach((K)=>{let W=this.servers.splice(K,1);X=X.concat(W[0].listen)}),J.forEach((K,W)=>{this.servers.push(K),Q.push(W)}),this.randomize&&Q.length>0){let K=this.currentServer,W=this.servers.filter((H)=>H!==K);(0,E81.shuffle)(W),this.servers=K?[K,...W]:W}return{added:Q,deleted:X}}}BJ$.Servers=CK0});var _K0=b((wJ$)=>{Object.defineProperty(wJ$,"__esModule",{value:!0});wJ$.QueuedIteratorImpl=void 0;var R81=JH(),DJ$=dG();class OJ${inflight;processed;received;noIterator;iterClosed;done;signal;yields;filtered;pendingFiltered;ctx;_data;err;time;profile;yielding;didBreak;constructor(){this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=(0,R81.deferred)(),this.yields=[],this.iterClosed=(0,R81.deferred)(),this.time=0,this.yielding=!1,this.didBreak=!1,this.profile=!1}[Symbol.asyncIterator](){return this.iterate()}push($){if(this.done)return;if(this.didBreak){if(typeof $==="function"){let Z=$;try{Z()}catch(Q){}}return}if(typeof $==="function")this.pendingFiltered++;this.yields.push($),this.signal.resolve()}async*iterate(){if(this.noIterator)throw new DJ$.InvalidOperationError("iterator cannot be used when a callback is registered");if(this.yielding)throw new DJ$.InvalidOperationError("iterator is already yielding");this.yielding=!0;try{while(!0){if(this.yields.length===0)await this.signal;if(this.err)throw this.err;let $=this.yields;this.inflight=$.length,this.yields=[];for(let Z=0;Z<$.length;Z++){if(typeof $[Z]==="function"){this.pendingFiltered--;let X=$[Z];try{X()}catch(Y){throw Y}if(this.err)throw this.err;continue}this.processed++,this.inflight--;let Q=this.profile?Date.now():0;yield $[Z],this.time=this.profile?Date.now()-Q:0}if(this.done)break;else if(this.yields.length===0)$.length=0,this.yields=$,this.signal=(0,R81.deferred)()}}finally{this.didBreak=!0,this.stop()}}stop($){if(this.done)return;this.err=$,this.done=!0,this.signal.resolve(),this.iterClosed.resolve($)}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}wJ$.QueuedIteratorImpl=OJ$});var q81=b((PJ$)=>{Object.defineProperty(PJ$,"__esModule",{value:!0});PJ$.MuxSubscription=void 0;var SL4=Vw(),EJ$=dG();class zJ${baseInbox;reqs;constructor(){this.reqs=new Map}size(){return this.reqs.size}init($){return this.baseInbox=`${(0,SL4.createInbox)($)}.`,this.baseInbox}add($){if(!isNaN($.received))$.received=0;this.reqs.set($.token,$)}get($){return this.reqs.get($)}cancel($){this.reqs.delete($.token)}getToken($){let Z=$.subject||"";if(Z.indexOf(this.baseInbox)===0)return Z.substring(this.baseInbox.length);return null}all(){return Array.from(this.reqs.values())}handleError($,Z){if($)return this.all().forEach((Q)=>{Q.resolver(Z,{})}),!0;if(Z.operation==="publish"){let Q=this.all().find((X)=>{return X.requestSubject===Z.subject});if(Q)return Q.resolver(Z,{}),!0}return!1}dispatcher(){return($,Z)=>{let Q=this.getToken(Z);if(Q){let X=this.get(Q);if(X){if($===null)$=Z?.data?.length===0&&Z.headers?.code===503?new EJ$.NoRespondersError(X.requestSubject):null;X.resolver($,Z)}}}}close(){let $=new EJ$.RequestError("connection closed");this.reqs.forEach((Z)=>{Z.resolver($,{})})}}PJ$.MuxSubscription=zJ$});var M81=b((RJ$)=>{Object.defineProperty(RJ$,"__esModule",{value:!0});RJ$.Heartbeat=void 0;var CL4=JH();class AJ${ph;interval;maxOut;timer;pendings;constructor($,Z,Q){this.ph=$,this.interval=Z,this.maxOut=Q,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel($){if(this.timer)clearTimeout(this.timer),this.timer=void 0;if(this._reset(),$)this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:"ping",pendingPings:this.pendings.length+1}),this.pendings.length===this.maxOut){this.cancel(!0);return}let $=(0,CL4.deferred)();this.ph.flush($).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push($),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(($)=>{return $.resolve(),!1})}}RJ$.Heartbeat=AJ$});var k81=b((kJ$)=>{Object.defineProperty(kJ$,"__esModule",{value:!0});kJ$.DenoBuffer=kJ$.MAX_SIZE=kJ$.AssertionError=void 0;kJ$.assert=IJ$;kJ$.concat=VJ$;kJ$.append=vL4;kJ$.readAll=xL4;kJ$.writeAll=fL4;var _L4=mG();class I81 extends Error{constructor($){super($);this.name="AssertionError"}}kJ$.AssertionError=I81;function IJ$($,Z="Assertion failed."){if(!$)throw new I81(Z)}var MJ$=32768;kJ$.MAX_SIZE=4294967294;function vK0($,Z,Q=0){let X=Z.byteLength-Q;if($.byteLength>X)$=$.subarray(0,X);return Z.set($,Q),$.byteLength}function VJ$($,Z){if($===void 0&&Z===void 0)return new Uint8Array(0);if($===void 0)return Z;if(Z===void 0)return $;let Q=new Uint8Array($.length+Z.length);return Q.set($,0),Q.set(Z,$.length),Q}function vL4($,Z){return VJ$($,Uint8Array.of(Z))}class V81{_buf;_off;constructor($){if(this._off=0,$==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array($)}bytes($={copy:!0}){if($.copy===!1)return this._buf.subarray(this._off);return this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate($){if($===0){this.reset();return}if($<0||$>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+$)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice($){let Z=this._buf.byteLength;if($<=this.capacity-Z)return this._reslice(Z+$),Z;return-1}_reslice($){IJ$($<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,$)}readByte(){let $=new Uint8Array(1);if(this.read($))return $[0];return null}read($){if(this.empty()){if(this.reset(),$.byteLength===0)return 0;return null}let Z=vK0(this._buf.subarray(this._off),$);return this._off+=Z,Z}writeByte($){return this.write(Uint8Array.of($))}writeString($){return this.write(_L4.TE.encode($))}write($){let Z=this._grow($.byteLength);return vK0($,this._buf,Z)}_grow($){let Z=this.length;if(Z===0&&this._off!==0)this.reset();let Q=this._tryGrowByReslice($);if(Q>=0)return Q;let X=this.capacity;if($<=Math.floor(X/2)-Z)vK0(this._buf.subarray(this._off),this._buf);else if(X+$>kJ$.MAX_SIZE)throw Error("The buffer cannot be grown beyond the maximum size.");else{let Y=new Uint8Array(Math.min(2*X+$,kJ$.MAX_SIZE));vK0(this._buf.subarray(this._off),Y),this._buf=Y}return this._off=0,this._reslice(Math.min(Z+$,kJ$.MAX_SIZE)),Z}grow($){if($<0)throw Error("Buffer._grow: negative count");let Z=this._grow($);this._reslice(Z)}readFrom($){let Z=0,Q=new Uint8Array(MJ$);while(!0){let X=this.capacity-this.length<MJ$,Y=X?Q:new Uint8Array(this._buf.buffer,this.length),J=$.read(Y);if(J===null)return Z;if(X)this.write(Y.subarray(0,J));else this._reslice(this.length+J);Z+=J}}}kJ$.DenoBuffer=V81;function xL4($){let Z=new V81;return Z.readFrom($),Z.bytes()}function fL4($,Z){let Q=0;while(Q<Z.length)Q+=$.write(Z.subarray(Q))}});var _81=b((xJ$)=>{Object.defineProperty(xJ$,"__esModule",{value:!0});xJ$.cc=xJ$.State=xJ$.Parser=xJ$.Kind=void 0;xJ$.describe=cL4;var S81=k81(),C81=mG();xJ$.Kind={OK:0,ERR:1,MSG:2,INFO:3,PING:4,PONG:5};function cL4($){let Z,Q="";switch($.kind){case xJ$.Kind.MSG:Z="MSG";break;case xJ$.Kind.OK:Z="OK";break;case xJ$.Kind.ERR:Z="ERR",Q=C81.TD.decode($.data);break;case xJ$.Kind.PING:Z="PING";break;case xJ$.Kind.PONG:Z="PONG";break;case xJ$.Kind.INFO:Z="INFO",Q=C81.TD.decode($.data)}return`${Z}: ${Q}`}function CJ$(){let $={};return $.sid=-1,$.hdr=-1,$.size=-1,$}var _J$=48,mL4=57,tl=67108864;class vJ${dispatcher;state;as;drop;hdr;ma;argBuf;msgBuf;constructor($){this.dispatcher=$,this.state=xJ$.State.OP_START,this.as=0,this.drop=0,this.hdr=0}parse($){let Z;for(Z=0;Z<$.length;Z++){let Q=$[Z];switch(this.state){case xJ$.State.OP_START:switch(Q){case xJ$.cc.M:case xJ$.cc.m:this.state=xJ$.State.OP_M,this.hdr=-1,this.ma=CJ$();break;case xJ$.cc.H:case xJ$.cc.h:this.state=xJ$.State.OP_H,this.hdr=0,this.ma=CJ$();break;case xJ$.cc.P:case xJ$.cc.p:this.state=xJ$.State.OP_P;break;case xJ$.cc.PLUS:this.state=xJ$.State.OP_PLUS;break;case xJ$.cc.MINUS:this.state=xJ$.State.OP_MINUS;break;case xJ$.cc.I:case xJ$.cc.i:this.state=xJ$.State.OP_I;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_H:switch(Q){case xJ$.cc.M:case xJ$.cc.m:this.state=xJ$.State.OP_M;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_M:switch(Q){case xJ$.cc.S:case xJ$.cc.s:this.state=xJ$.State.OP_MS;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_MS:switch(Q){case xJ$.cc.G:case xJ$.cc.g:this.state=xJ$.State.OP_MSG;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_MSG:switch(Q){case xJ$.cc.SPACE:case xJ$.cc.TAB:this.state=xJ$.State.OP_MSG_SPC;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_MSG_SPC:switch(Q){case xJ$.cc.SPACE:case xJ$.cc.TAB:continue;default:this.state=xJ$.State.MSG_ARG,this.as=Z}break;case xJ$.State.MSG_ARG:switch(Q){case xJ$.cc.CR:this.drop=1;break;case xJ$.cc.NL:{let X=this.argBuf?this.argBuf.bytes():$.subarray(this.as,Z-this.drop);this.processMsgArgs(X),this.drop=0,this.as=Z+1,this.state=xJ$.State.MSG_PAYLOAD,Z=this.as+this.ma.size-1;break}default:if(this.argBuf)this.argBuf.writeByte(Q)}break;case xJ$.State.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){let X=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:xJ$.Kind.MSG,msg:this.ma,data:X}),this.argBuf=void 0,this.msgBuf=void 0,this.state=xJ$.State.MSG_END}else{let X=this.ma.size-this.msgBuf.length,Y=$.length-Z;if(Y<X)X=Y;if(X>0)this.msgBuf.write($.subarray(Z,Z+X)),Z=Z+X-1;else this.msgBuf.writeByte(Q)}else if(Z-this.as>=this.ma.size)this.dispatcher.push({kind:xJ$.Kind.MSG,msg:this.ma,data:$.subarray(this.as,Z)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=xJ$.State.MSG_END;break;case xJ$.State.MSG_END:switch(Q){case xJ$.cc.NL:this.drop=0,this.as=Z+1,this.state=xJ$.State.OP_START;break;default:continue}break;case xJ$.State.OP_PLUS:switch(Q){case xJ$.cc.O:case xJ$.cc.o:this.state=xJ$.State.OP_PLUS_O;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_PLUS_O:switch(Q){case xJ$.cc.K:case xJ$.cc.k:this.state=xJ$.State.OP_PLUS_OK;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_PLUS_OK:switch(Q){case xJ$.cc.NL:this.dispatcher.push({kind:xJ$.Kind.OK}),this.drop=0,this.state=xJ$.State.OP_START;break}break;case xJ$.State.OP_MINUS:switch(Q){case xJ$.cc.E:case xJ$.cc.e:this.state=xJ$.State.OP_MINUS_E;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_MINUS_E:switch(Q){case xJ$.cc.R:case xJ$.cc.r:this.state=xJ$.State.OP_MINUS_ER;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_MINUS_ER:switch(Q){case xJ$.cc.R:case xJ$.cc.r:this.state=xJ$.State.OP_MINUS_ERR;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_MINUS_ERR:switch(Q){case xJ$.cc.SPACE:case xJ$.cc.TAB:this.state=xJ$.State.OP_MINUS_ERR_SPC;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_MINUS_ERR_SPC:switch(Q){case xJ$.cc.SPACE:case xJ$.cc.TAB:continue;default:this.state=xJ$.State.MINUS_ERR_ARG,this.as=Z}break;case xJ$.State.MINUS_ERR_ARG:switch(Q){case xJ$.cc.CR:this.drop=1;break;case xJ$.cc.NL:{let X;if(this.argBuf)X=this.argBuf.bytes(),this.argBuf=void 0;else X=$.subarray(this.as,Z-this.drop);this.dispatcher.push({kind:xJ$.Kind.ERR,data:X}),this.drop=0,this.as=Z+1,this.state=xJ$.State.OP_START;break}default:if(this.argBuf)this.argBuf.write(Uint8Array.of(Q))}break;case xJ$.State.OP_P:switch(Q){case xJ$.cc.I:case xJ$.cc.i:this.state=xJ$.State.OP_PI;break;case xJ$.cc.O:case xJ$.cc.o:this.state=xJ$.State.OP_PO;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_PO:switch(Q){case xJ$.cc.N:case xJ$.cc.n:this.state=xJ$.State.OP_PON;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_PON:switch(Q){case xJ$.cc.G:case xJ$.cc.g:this.state=xJ$.State.OP_PONG;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_PONG:switch(Q){case xJ$.cc.NL:this.dispatcher.push({kind:xJ$.Kind.PONG}),this.drop=0,this.state=xJ$.State.OP_START;break}break;case xJ$.State.OP_PI:switch(Q){case xJ$.cc.N:case xJ$.cc.n:this.state=xJ$.State.OP_PIN;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_PIN:switch(Q){case xJ$.cc.G:case xJ$.cc.g:this.state=xJ$.State.OP_PING;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_PING:switch(Q){case xJ$.cc.NL:this.dispatcher.push({kind:xJ$.Kind.PING}),this.drop=0,this.state=xJ$.State.OP_START;break}break;case xJ$.State.OP_I:switch(Q){case xJ$.cc.N:case xJ$.cc.n:this.state=xJ$.State.OP_IN;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_IN:switch(Q){case xJ$.cc.F:case xJ$.cc.f:this.state=xJ$.State.OP_INF;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_INF:switch(Q){case xJ$.cc.O:case xJ$.cc.o:this.state=xJ$.State.OP_INFO;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_INFO:switch(Q){case xJ$.cc.SPACE:case xJ$.cc.TAB:this.state=xJ$.State.OP_INFO_SPC;break;default:throw this.fail($.subarray(Z))}break;case xJ$.State.OP_INFO_SPC:switch(Q){case xJ$.cc.SPACE:case xJ$.cc.TAB:continue;default:this.state=xJ$.State.INFO_ARG,this.as=Z}break;case xJ$.State.INFO_ARG:switch(Q){case xJ$.cc.CR:this.drop=1;break;case xJ$.cc.NL:{let X;if(this.argBuf)X=this.argBuf.bytes(),this.argBuf=void 0;else X=$.subarray(this.as,Z-this.drop);this.dispatcher.push({kind:xJ$.Kind.INFO,data:X}),this.drop=0,this.as=Z+1,this.state=xJ$.State.OP_START;break}default:if(this.argBuf)this.argBuf.writeByte(Q)}break;default:throw this.fail($.subarray(Z))}}if((this.state===xJ$.State.MSG_ARG||this.state===xJ$.State.MINUS_ERR_ARG||this.state===xJ$.State.INFO_ARG)&&!this.argBuf)this.argBuf=new S81.DenoBuffer($.subarray(this.as,Z-this.drop));if(this.state===xJ$.State.MSG_PAYLOAD&&!this.msgBuf){if(!this.argBuf)this.cloneMsgArg();this.msgBuf=new S81.DenoBuffer($.subarray(this.as))}}cloneMsgArg(){let $=this.ma.subject.length,Z=this.ma.reply?this.ma.reply.length:0,Q=new Uint8Array($+Z);if(Q.set(this.ma.subject),this.ma.reply)Q.set(this.ma.reply,$);if(this.argBuf=new S81.DenoBuffer(Q),this.ma.subject=Q.subarray(0,$),this.ma.reply)this.ma.reply=Q.subarray($)}processMsgArgs($){if(this.hdr>=0)return this.processHeaderMsgArgs($);let Z=[],Q=-1;for(let X=0;X<$.length;X++)switch($[X]){case xJ$.cc.SPACE:case xJ$.cc.TAB:case xJ$.cc.CR:case xJ$.cc.NL:if(Q>=0)Z.push($.subarray(Q,X)),Q=-1;break;default:if(Q<0)Q=X}if(Q>=0)Z.push($.subarray(Q));switch(Z.length){case 3:this.ma.subject=Z[0],this.ma.sid=this.protoParseInt(Z[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(Z[2],tl);break;case 4:this.ma.subject=Z[0],this.ma.sid=this.protoParseInt(Z[1]),this.ma.reply=Z[2],this.ma.size=this.protoParseInt(Z[3],tl);break;default:throw this.fail($,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail($,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail($,"processMsgArgs Bad or Missing Size Error")}fail($,Z=""){if(!Z)Z=`parse error [${this.state}]`;else Z=`${Z} [${this.state}]`;return Error(`${Z}: ${C81.TD.decode($)}`)}processHeaderMsgArgs($){let Z=[],Q=-1;for(let X=0;X<$.length;X++)switch($[X]){case xJ$.cc.SPACE:case xJ$.cc.TAB:case xJ$.cc.CR:case xJ$.cc.NL:if(Q>=0)Z.push($.subarray(Q,X)),Q=-1;break;default:if(Q<0)Q=X}if(Q>=0)Z.push($.subarray(Q));switch(Z.length){case 4:this.ma.subject=Z[0],this.ma.sid=this.protoParseInt(Z[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(Z[2],tl),this.ma.size=this.protoParseInt(Z[3],tl);break;case 5:this.ma.subject=Z[0],this.ma.sid=this.protoParseInt(Z[1]),this.ma.reply=Z[2],this.ma.hdr=this.protoParseInt(Z[3],tl),this.ma.size=this.protoParseInt(Z[4],tl);break;default:throw this.fail($,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail($,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail($,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail($,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt($,Z){if($.length===0||$.length>15)return-1;let Q=0;for(let X=0;X<$.length;X++){if($[X]<_J$||$[X]>mL4)return-1;Q=Q*10+($[X]-_J$)}return Z!==void 0&&Q>Z?-1:Q}}xJ$.Parser=vJ$;xJ$.State={OP_START:0,OP_PLUS:1,OP_PLUS_O:2,OP_PLUS_OK:3,OP_MINUS:4,OP_MINUS_E:5,OP_MINUS_ER:6,OP_MINUS_ERR:7,OP_MINUS_ERR_SPC:8,MINUS_ERR_ARG:9,OP_M:10,OP_MS:11,OP_MSG:12,OP_MSG_SPC:13,MSG_ARG:14,MSG_PAYLOAD:15,MSG_END:16,OP_H:17,OP_P:18,OP_PI:19,OP_PIN:20,OP_PING:21,OP_PO:22,OP_PON:23,OP_PONG:24,OP_I:25,OP_IN:26,OP_INF:27,OP_INFO:28,OP_INFO_SPC:29,INFO_ARG:30};xJ$.cc={CR:13,E:69,e:101,F:70,f:102,G:71,g:103,H:72,h:104,I:73,i:105,K:75,k:107,M:77,m:109,MINUS:45,N:78,n:110,NL:10,O:79,o:111,P:80,p:112,PLUS:43,R:82,r:114,S:83,s:115,SPACE:32,TAB:9}});var bK0=b((bJ$)=>{Object.defineProperty(bJ$,"__esModule",{value:!0});bJ$.MsgHdrsImpl=void 0;bJ$.canonicalMIMEHeaderKey=x81;bJ$.headers=pL4;var fJ$=mG(),GH=Vw(),fK0=dG();function x81($){let F=!0,U=Array($.length);for(let N=0;N<$.length;N++){let B=$.charCodeAt(N);if(B===58||B<33||B>126)throw fK0.InvalidArgumentError.format("header",`'${$[N]}' is not a valid character in a header name`);if(F&&97<=B&&B<=122)B-=32;else if(!F&&65<=B&&B<=90)B+=32;U[N]=B,F=B==45}return String.fromCharCode(...U)}function pL4($=0,Z=""){if($===0&&Z!=="")throw fK0.InvalidArgumentError.format("code","is required");else if($>0&&Z==="")throw fK0.InvalidArgumentError.format("description","is required");return new ol($,Z)}var v81="NATS/1.0";class ol{_code;headers;_description;constructor($=0,Z=""){this._code=$,this._description=Z,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals($){if($&&this.headers.size===$.headers.size&&this._code===$._code){for(let[Z,Q]of this.headers){let X=$.values(Z);if(Q.length!==X.length)return!1;let Y=[...Q].sort(),J=[...X].sort();for(let G=0;G<Y.length;G++)if(Y[G]!==J[G])return!1}return!0}return!1}static decode($){let Z=new ol,X=fJ$.TD.decode($).split(`\r
2163
2163
  `),Y=X[0];if(Y!==v81){let J=Y.replace(v81,"").trim();if(J.length>0){if(Z._code=parseInt(J,10),isNaN(Z._code))Z._code=0;let G=Z._code.toString();J=J.replace(G,""),Z._description=J.trim()}}if(X.length>=1)X.slice(1).map((J)=>{if(J){let G=J.indexOf(":");if(G>-1){let K=J.slice(0,G),W=J.slice(G+1).trim();Z.append(K,W)}}});return Z}toString(){if(this.headers.size===0&&this._code===0)return"";let $=v81;if(this._code>0&&this._description!=="")$+=` ${this._code} ${this._description}`;for(let[Z,Q]of this.headers)for(let X=0;X<Q.length;X++)$=`${$}\r
2164
2164
  ${Z}: ${Q[X]}`;return`${$}\r
@@ -5398,7 +5398,7 @@ These do not communicate intent or scope.
5398
5398
  - Virtual tools can trigger consequential actions through underlying tools.
5399
5399
  - Keep logic constrained and predictable.
5400
5400
  - If the code performs destructive operations, the parent agent instructions should require confirmation.
5401
- `}]});function Jb0(){return[...TB8,...CB8,...bB8,...VB8,...qB8,...iB8,...hB8,...mB8]}function tB8(){return[...xB8,...AB8,..._B8,...yB8,...kB8,...MB8,...pB8]}var B21=L(()=>{RB8();IB8();SB8();vB8();fB8();gB8();uB8();dB8();nB8()});import{AsyncLocalStorage as a75}from"async_hooks";import{z as r75}from"zod";function s75($){let Z=$.inputSchema&&typeof $.inputSchema==="object"&&"shape"in $.inputSchema?$.inputSchema:r75.object({}),Q=$.outputSchema&&typeof $.outputSchema==="object"&&"shape"in $.outputSchema?$.outputSchema:void 0;return{config:{description:$.description??"",inputSchema:Z,outputSchema:Q,annotations:$.annotations,_meta:$._meta},handler:async(X)=>{let Y=mD.getStore();if(!Y)throw Error(`[managementMCP] tool ${$.name} invoked outside a request context`);Y.access.setToolName($.name);try{let J=await $.execute(X,Y);return{content:[{type:"text",text:$.modelSummary?$.modelSummary(J):JSON.stringify(J)}],structuredContent:J}}catch(J){return{content:[{type:"text",text:`Error: ${J.message}`}],isError:!0}}}}}function m90($){let Z=oB8.get($);if(!Z)Z=s75($),oB8.set($,Z);return Z}var mD,oB8;var Gb0=L(()=>{mD=new a75;oB8=new Map});function CW($){if(!$.objectStorage)throw Error("Object storage is not configured. Ensure S3 credentials are set.");return $.objectStorage}function sD($,Z){let Q=typeof $==="number"&&Number.isFinite($)?$:Z;return Math.min(Math.max(Q,e75),$Q5)}function Kt($){return iA.find((Z)=>Z.name===$)}var e75=60,$Q5=604800,aB8,rB8,sB8,eB8,$L8,ZL8,QL8,XL8,YL8,JL8,GL8,KL8,WL8,HL8,FL8,UL8,NL8,BL8;var eD=L(()=>{K80();aB8=Kt("LIST_OBJECTS"),rB8=aB8.inputSchema,sB8=aB8.outputSchema,eB8=Kt("GET_OBJECT_METADATA"),$L8=eB8.inputSchema,ZL8=eB8.outputSchema,QL8=Kt("GET_PRESIGNED_URL"),XL8=QL8.inputSchema,YL8=QL8.outputSchema,JL8=Kt("PUT_PRESIGNED_URL"),GL8=JL8.inputSchema,KL8=JL8.outputSchema,WL8=Kt("DELETE_OBJECT"),HL8=WL8.inputSchema,FL8=WL8.outputSchema,UL8=Kt("DELETE_OBJECTS"),NL8=UL8.inputSchema,BL8=UL8.outputSchema});var L21;var LL8=L(()=>{v0();eD();L21=t({name:"LIST_OBJECTS",description:"List objects in the organization's object storage with pagination and prefix filtering support.",annotations:{title:"List Objects",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:rB8,outputSchema:sB8,handler:async($,Z)=>{r(Z),W0(Z),await Z.access.check();let X=await CW(Z).list({prefix:$.prefix,maxKeys:$.maxKeys,continuationToken:$.continuationToken,delimiter:$.delimiter});return{objects:X.objects.map((Y)=>({key:Y.key,size:Y.size,lastModified:Y.lastModified?.toISOString?.()??(typeof Y.lastModified==="string"?Y.lastModified:new Date().toISOString()),etag:Y.etag??""})),isTruncated:X.isTruncated,nextContinuationToken:X.nextContinuationToken,commonPrefixes:X.commonPrefixes}}})});var D21;var DL8=L(()=>{v0();eD();D21=t({name:"GET_OBJECT_METADATA",description:"Get metadata for an object in the organization's storage.",annotations:{title:"Get Object Metadata",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:$L8,outputSchema:ZL8,handler:async($,Z)=>{r(Z),W0(Z),await Z.access.check();let X=await CW(Z).head($.key);return{contentType:X.contentType,contentLength:X.size,lastModified:X.lastModified?.toISOString?.()??(typeof X.lastModified==="string"?X.lastModified:new Date().toISOString()),etag:X.etag??"",metadata:X.metadata}}})});var ZQ5=3600,O21;var OL8=L(()=>{v0();eD();O21=t({name:"GET_PRESIGNED_URL",description:"Generate a presigned URL for downloading an object from the organization's storage.",annotations:{title:"Get Presigned Download URL",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:XL8,outputSchema:YL8,handler:async($,Z)=>{r(Z),W0(Z),await Z.access.check();let Q=CW(Z),X=sD($.expiresIn,ZQ5);return{url:await Q.presignedGetUrl($.key,X),expiresIn:X}}})});var QQ5=3600,w21;var wL8=L(()=>{v0();eD();w21=t({name:"PUT_PRESIGNED_URL",description:"Generate a presigned URL for uploading an object to the organization's storage.",annotations:{title:"Get Presigned Upload URL",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:GL8,outputSchema:KL8,handler:async($,Z)=>{r(Z),W0(Z),await Z.access.check();let Q=CW(Z),X=sD($.expiresIn,QQ5);return{url:await Q.presignedPutUrl($.key,X,$.contentType),expiresIn:X}}})});var j21;var jL8=L(()=>{v0();eD();j21=t({name:"DELETE_OBJECT",description:"Delete a single object from the organization's storage.",annotations:{title:"Delete Object",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:HL8,outputSchema:FL8,handler:async($,Z)=>{r(Z),W0(Z),await Z.access.check();let Q=CW(Z);try{return await Q.delete($.key),{success:!0,key:$.key}}catch{return{success:!1,key:$.key}}}})});var E21;var EL8=L(()=>{v0();eD();E21=t({name:"DELETE_OBJECTS",description:"Delete multiple objects from the organization's storage in batch.",annotations:{title:"Delete Objects",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:NL8,outputSchema:BL8,handler:async($,Z)=>{r(Z),W0(Z),await Z.access.check();let Q=CW(Z),X=[],Y=[];return await Promise.all($.keys.map(async(J)=>{try{await Q.delete(J),X.push(J)}catch(G){Y.push({key:J,message:G instanceof Error?G.message:"Unknown error"})}})),{deleted:X,errors:Y}}})});var zL8=L(()=>{LL8();DL8();OL8();wL8();jL8();EL8()});import{z as L1}from"zod";var YQ5,JQ5,PL8,GQ5,Wt,TL8,AL8,Kb0,RL8,qL8,ML8,KQ5,IL8;var wh=L(()=>{aJ();YQ5=L1.object({name:L1.string(),title:L1.string().optional(),description:L1.string().optional(),version:L1.string().optional(),websiteUrl:L1.string().optional(),icons:L1.array(L1.object({src:L1.string()}).catchall(L1.unknown())).optional(),remotes:L1.array(L1.object({type:L1.string().optional(),url:L1.string().optional(),name:L1.string().optional(),title:L1.string().optional(),description:L1.string().optional()}).catchall(L1.unknown())).optional(),packages:L1.array(L1.object({identifier:L1.string(),version:L1.string().optional()}).catchall(L1.unknown())).optional(),repository:L1.object({url:L1.string().optional(),source:L1.string().optional(),subfolder:L1.string().optional()}).catchall(L1.unknown()).optional()}).catchall(L1.unknown()),JQ5=L1.object({name:L1.string(),description:L1.string().nullable().optional()}).catchall(L1.unknown()),PL8=L1.object({verified:L1.boolean().optional(),official:L1.boolean().optional(),tags:L1.array(L1.string()).optional(),categories:L1.array(L1.string()).optional(),friendly_name:L1.string().nullable().optional(),short_description:L1.string().max(160).nullable().optional(),owner:L1.string().nullable().optional(),readme:L1.string().max(50000).nullable().optional(),readme_url:L1.string().nullable().optional(),has_remote:L1.boolean().optional(),has_oauth:L1.boolean().optional(),tools:L1.array(JQ5).optional()}).catchall(L1.unknown()),GQ5=L1.object({"mcp.studio":PL8.optional(),"mcp.mesh":PL8.optional()}).catchall(L1.unknown()),Wt=L1.object({id:L1.string(),name:L1.string().optional(),title:L1.string(),description:L1.string().nullable().optional(),_meta:GQ5.optional(),server:YQ5,is_public:L1.boolean().optional(),is_unlisted:L1.boolean().optional(),created_at:L1.string().optional(),updated_at:L1.string().optional(),created_by:L1.string().optional()}).catchall(L1.unknown()),TL8=aH.extend({tags:L1.array(L1.string()).optional().describe("Filter by tags (AND semantics)"),categories:L1.array(L1.string()).optional().describe("Filter by categories (AND semantics)"),cursor:L1.string().optional().describe("Pagination cursor")}).describe("List registry items with optional filtering and pagination."),AL8=L1.object({items:L1.array(Wt),totalCount:L1.number(),hasMore:L1.boolean().optional(),nextCursor:L1.string().optional()}),Kb0=L1.object({id:L1.string().optional().describe("Registry item ID"),name:L1.string().optional().describe("Registry item name (alias for id)")}).refine(($)=>$.id||$.name,{message:"At least one of 'id' or 'name' is required"}).describe("Get a registry item by ID or name."),RL8=L1.object({item:Wt.nullable()}),qL8=L1.object({tags:L1.array(L1.object({value:L1.string(),count:L1.number()})),categories:L1.array(L1.object({value:L1.string(),count:L1.number()}))}),ML8=L1.object({query:L1.string().optional().describe("Free-text search across id, title, description, server name"),tags:L1.array(L1.string()).optional().describe("Filter by tags (AND)"),categories:L1.array(L1.string()).optional().describe("Filter by categories (AND)"),limit:L1.number().int().min(1).max(100).optional().describe("Max results (default 20)"),cursor:L1.string().optional().describe("Pagination cursor")}).describe("Lightweight search returning minimal fields (id, title, tags, categories, is_public)."),KQ5=L1.object({id:L1.string(),title:L1.string(),tags:L1.array(L1.string()),categories:L1.array(L1.string()),is_public:L1.boolean(),is_unlisted:L1.boolean()}),IL8=L1.object({items:L1.array(KQ5),totalCount:L1.number(),hasMore:L1.boolean().optional(),nextCursor:L1.string().optional()})});import{z as WQ5}from"zod";function NQ5($){return UQ5.parse($).map((Z)=>({...Z,name:Z.name??Z.server.name}))}async function BQ5(){try{let $=await fetch(HQ5,{headers:GJ?.etag?{"If-None-Match":GJ.etag}:{},signal:AbortSignal.timeout(1e4)});if($.status===304&&GJ)return GJ.fetchedAt=Date.now(),GJ.retryAt=Date.now()+z21,GJ.items;if(!$.ok)throw Error(`Deco registry unavailable (${$.status})`);if(!$.body)throw Error("Deco registry returned an empty response");let Z=$.body.getReader(),Q=[],X=0;try{while(!0){let{done:K,value:W}=await Z.read();if(K)break;if(X+=W.byteLength,X>FQ5)throw Error("Deco registry exceeds size limit");Q.push(W)}}finally{await Z.cancel()}let Y=new Uint8Array(X),J=0;for(let K of Q)Y.set(K,J),J+=K.byteLength;let G=NQ5(JSON.parse(new TextDecoder().decode(Y)));return GJ={items:G,fetchedAt:Date.now(),retryAt:Date.now()+z21,etag:$.headers.get("etag")},G}catch($){if(GJ&&Date.now()-GJ.fetchedAt<VL8)return GJ.retryAt=Date.now()+z21,GJ.items;throw $}}async function YB(){if(GJ&&Date.now()<GJ.retryAt&&Date.now()-GJ.fetchedAt<VL8)return GJ.items;return P21??=BQ5().finally(()=>{P21=void 0}),P21}function T21($,Z){let Q=$;for(let X of Z){if(Q===null||typeof Q!=="object"||!Object.hasOwn(Q,X))return;Q=Q[X]}return Q}function A21($,Z){if("conditions"in Z){if(Z.operator==="or")return Z.conditions.some((J)=>A21($,J));let Y=Z.conditions.every((J)=>A21($,J));return Z.operator==="not"?!Y:Y}let Q=T21($,Z.field),X=Z.value;if(Q===void 0)return!1;switch(Z.operator){case"eq":return Q===X;case"in":return Array.isArray(X)&&X.includes(Q);case"contains":return typeof Q==="string"&&typeof X==="string"&&Q.toLowerCase().includes(X.toLowerCase());case"like":return typeof Q==="string"&&typeof X==="string"&&Oi(X).test(Q);default:{if(!(typeof Q==="number"&&typeof X==="number"||typeof Q==="string"&&typeof X==="string"))return!1;if(Z.operator==="gt")return Q>X;if(Z.operator==="gte")return Q>=X;if(Z.operator==="lt")return Q<X;return Q<=X}}}function Wb0($,Z){let Q=$.filter((K)=>{let W=zU(K._meta);return(!Z.where||A21(K,Z.where))&&(Z.tags??[]).every((H)=>W?.tags?.includes(H))&&(Z.categories??[]).every((H)=>W?.categories?.includes(H))});Q.sort((K,W)=>{for(let H of Z.orderBy??[]){let F=T21(K,H.field),U=T21(W,H.field);if(F==null||U==null){if(F==null&&U==null)continue;let B=H.nulls==="first";return F==null?B?-1:1:B?1:-1}let N=typeof F==="number"&&typeof U==="number"?F-U:String(F).localeCompare(String(U));if(N)return H.direction==="desc"?-N:N}return K.id.localeCompare(W.id)});let X=Z.cursor===void 0?Z.offset??0:Number(Z.cursor);if(!Number.isSafeInteger(X)||X<0||Z.cursor!==void 0&&!/^\d+$/.test(Z.cursor))throw Error("Invalid registry cursor");let Y=Z.limit??24,J=Q.slice(X,X+Y),G=X+J.length<Q.length;return{items:J,totalCount:Q.length,hasMore:G,nextCursor:G?String(X+J.length):void 0}}function Hb0($){let Z=$.id??$.name;if(!Z)throw Error("Either 'id' or 'name' is required");return Z}function Fb0($,Z){return $.find((Q)=>Q.id===Z)??$.find((Q)=>Q.name===Z||Q.server.name===Z)??null}function kL8($){let Z=new Map,Q=new Map;for(let Y of $){let J=zU(Y._meta);for(let G of new Set(J?.tags??[]))Z.set(G,(Z.get(G)??0)+1);for(let G of new Set(J?.categories??[]))Q.set(G,(Q.get(G)??0)+1)}let X=(Y)=>[...Y].map(([J,G])=>({value:J,count:G})).sort((J,G)=>J.value.localeCompare(G.value));return{tags:X(Z),categories:X(Q)}}var HQ5="https://raw.githubusercontent.com/decocms/mcps/main/registry.json",z21=300000,VL8=3600000,FQ5=10485760,UQ5,GJ,P21;var Ht=L(()=>{aJ();wh();UQ5=WQ5.array(Wt).max(1e4).superRefine(($,Z)=>{let Q=new Set;for(let X of $){if(Q.has(X.id))Z.addIssue({code:"custom",message:`Duplicate registry id: ${X.id}`});Q.add(X.id)}})});import{z as LQ5}from"zod";var Ub0;var R21=L(()=>{Ht();v0();wh();Ub0=t({name:"REGISTRY_ITEM_FILTERS",description:"List available tag/category filters for Deco registry items",inputSchema:LQ5.object({}),outputSchema:qL8,handler:async($,Z)=>{return W0(Z),await Z.access.check(),kL8(await YB())}})});var Nb0;var q21=L(()=>{Ht();v0();wh();Nb0=t({name:"REGISTRY_ITEM_GET",description:"Get a Deco registry item by ID or name",inputSchema:Kb0,outputSchema:RL8,handler:async($,Z)=>{W0(Z),await Z.access.check();let Q=Hb0($);return{item:Fb0(await YB(),Q)}}})});var Bb0;var M21=L(()=>{Ht();v0();wh();Bb0=t({name:"REGISTRY_ITEM_LIST",description:"List Deco registry items for the current organization",inputSchema:TL8,outputSchema:AL8,handler:async($,Z)=>{return W0(Z),await Z.access.check(),Wb0(await YB(),$)}})});var SL8;var CL8=L(()=>{Ht();v0();wh();SL8=t({name:"REGISTRY_ITEM_SEARCH",description:"Search registry items returning minimal data (id, title, tags, categories, is_public, is_unlisted). Use this instead of LIST when you need to find items efficiently without loading full details. Supports free-text search across id, title, description, and server name, plus filtering by tags and categories.",inputSchema:ML8,outputSchema:IL8,handler:async($,Z)=>{W0(Z),await Z.access.check();let Q=$.query?.trim().split(/\s+/).filter(Boolean)??[],X=Wb0(await YB(),{...$,where:Q.length?{operator:"or",conditions:Q.flatMap((Y)=>["id","title","description"].map((J)=>({field:[J],operator:"contains",value:Y})).concat([{field:["server","name"],operator:"contains",value:Y}]))}:void 0});return{...X,items:X.items.map((Y)=>({id:Y.id,title:Y.title,tags:zU(Y._meta)?.tags??[],categories:zU(Y._meta)?.categories??[],is_public:!0,is_unlisted:!1}))}}})});import{z as _L8}from"zod";var Lb0;var I21=L(()=>{Ht();v0();wh();Lb0=t({name:"REGISTRY_ITEM_VERSIONS",description:"Get available versions of a registry item",inputSchema:Kb0,outputSchema:_L8.object({versions:_L8.array(Wt)}),handler:async($,Z)=>{W0(Z),await Z.access.check();let Q=Hb0($),X=Fb0(await YB(),Q);return{versions:X?[X]:[]}}})});var vL8,xL8,fL8,bL8;var yL8=L(()=>{v0();M21();q21();I21();R21();vL8=t({...Bb0,name:"COLLECTION_REGISTRY_APP_LIST"}),xL8=t({...Nb0,name:"COLLECTION_REGISTRY_APP_GET"}),fL8=t({...Lb0,name:"COLLECTION_REGISTRY_APP_VERSIONS"}),bL8=t({...Ub0,name:"COLLECTION_REGISTRY_APP_FILTERS"})});var gL8;var hL8=L(()=>{R21();q21();M21();CL8();I21();yL8();gL8=[vL8,xL8,fL8,bL8,Bb0,SL8,Nb0,Lb0,Ub0]});import{z as Ft}from"zod";var V21;var uL8=L(()=>{v0();NW();A60();GG();V21=t({name:"SANDBOX_DELETE",description:"Delete a sandbox.",annotations:{title:"Delete VM Preview",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:Ft.object({virtualMcpId:Ft.string().describe("Virtual MCP ID that owns this VM"),branch:Ft.string().min(1).describe("Branch whose vm should be deleted (sandboxMap[userId][branch])"),removeWorktree:Ft.boolean().optional().default(!1).describe("Also reclaim the sandbox's workspace (local worktree + disk). Ignored by hosted teardown, whose filesystem is already destroyed.")}),outputSchema:Ft.object({success:Ft.boolean()}),handler:async($,Z)=>{let Q;try{Q=await Q08($,Z)}catch(K){if(K instanceof Error&&K.message==="Virtual MCP not found")return{success:!0};throw K}let{entry:X,userId:Y,sandboxUserId:J}=Q;if(!X)return{success:!0};let G=await rU1(Z);return await jz(Z.storage.virtualMcps,$.virtualMcpId,Y,J,$.branch),await G.delete(X.sandboxHandle).catch((K)=>console.error(`[SANDBOX_DELETE] ${sQ} ${X.sandboxHandle}: ${K instanceof Error?K.message:String(K)}`)),{success:!0}}})});var lL8=L(()=>{M60();uL8()});import{z as $O}from"zod";function EQ5($){try{return JSON.parse($)}catch(Z){throw Error(`GitHub /user/installations returned invalid JSON: ${$.slice(0,300)}`,{cause:Z})}}var wQ5="https://api.github.com",jQ5=15000,k21;var cL8=L(()=>{v0();XW();rJ();rH();g80();_i();k21=t({name:"GITHUB_LIST_USER_ORGS",description:"List GitHub App installations (orgs/accounts) accessible to the authenticated user.",annotations:{title:"List GitHub User Orgs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:$O.object({connectionId:$O.string().describe("ID of the mcp-github connection to use")}),outputSchema:$O.object({installations:$O.array($O.object({installationId:$O.number(),login:$O.string(),avatarUrl:$O.string(),type:$O.string()}))}),handler:async($,Z)=>{await Z.access.check();let Q=Z.organization?.id;if(!Q)throw Error("Organization context required");let X=await Z.storage.connections.findById($.connectionId,Q);if(!X)throw Error("Connection not found");if(e9(X))throw Error("Repo-scoped connections cannot list installations \u2014 use an org-level mcp-github connection");let Y=new T9(Z.db,Z.vault),J=await Y.get($.connectionId);if(!J)throw Error("No GitHub token found. Ensure the mcp-github connection is authenticated.");let G=J.accessToken;if(Zz(J)&&Y.isExpired(J,$40)){let U=await Db0(J,Y);if(!U)throw Error(f7);G=U,J=await Y.get($.connectionId)??J}let K=[],W=1,H=100,F=async(U)=>fetch(`${wQ5}/user/installations?per_page=${H}&page=${W}`,{headers:{Authorization:`Bearer ${U}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},signal:AbortSignal.timeout(jQ5)});while(!0){let U=await F(G);if(U.status===401){let B=await Y.get($.connectionId);if(!B||!Zz(B))throw Error(f7);let D=await Db0(B,Y);if(!D)throw Error(f7);if(G=D,U=await F(G),U.status===401)throw Error(f7)}if(oE(U.headers,{lane:"rest",operation:"list_user_installations",installation:CW1}),nE(U)){await U.body?.cancel().catch(()=>{});let B=U.headers.get("retry-after")!==null?"secondary":"primary";aE({lane:"rest",operation:"list_user_installations",installation:CW1,kind:B});let D=tE(U.headers);throw Error(`GitHub ${B} rate limit reached${D===null?"":`; retry in ${Math.ceil(D/1000)}s`}`)}if(!U.ok)throw await U.body?.cancel().catch(()=>{}),Error(`GitHub /user/installations failed: ${U.status}`);let N=EQ5(await U.text());for(let B of N.installations)K.push({installationId:B.id,login:B.account.login,avatarUrl:B.account.avatar_url,type:B.account.type});if(N.installations.length<H)break;W++}return{installations:K}}})});var mL8=L(()=>{cL8()});var S21="deco-sites";import{z as dL8}from"zod";function pL8($){let Z=PQ5.find((Q)=>Q.id===$);if(!Z)throw Error(`Unknown site template: ${$}`);return Z}var PQ5,iL8,nL8;var tL8=L(()=>{PQ5=[{id:"storefront",repo:{owner:S21,name:"storefront-tanstack"}},{id:"blog",repo:{owner:S21,name:"blog-tanstack"}}],iL8=dL8.enum(["storefront","blog"]);nL8=dL8.string().trim().min(1).max(100).regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/,"Use lower-case letters, numbers and hyphens, starting and ending with a letter or number")});import{z as C21}from"zod";function Ob0($){let Z=null;if($.repoUrl){if(Z=cX($.repoUrl),!Z)throw Error(`Could not recognise the repository URL: ${$.repoUrl}`)}return{repositoryId:$.repositoryId,ref:Z,connectionId:$.connectionId}}var ZO,oL8="No credential for this repository \u2014 link it in Settings \u2192 Repositories";var _21=L(()=>{t4();ZO={repositoryId:C21.string().optional().describe("Connected repository (REPOSITORY_LINK) to act on"),repoUrl:C21.string().optional().describe("Any URL of the repository \u2014 its provider and host are read from it"),connectionId:C21.string().optional().describe("Legacy: a repo-scoped mcp-github connection in this org")}});import{z as IF}from"zod";var v21;var aL8=L(()=>{v0();K7();_21();v21=t({name:"REPOSITORY_SEARCH_BRANCHES",description:"Search a repository's branches by a case-insensitive substring of the branch name, filtered server-side by the provider.",annotations:{title:"Search Repository Branches",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:IF.object({...ZO,query:IF.string().describe("Substring to match against branch names. Empty returns the first branches alphabetically."),limit:IF.number().int().min(1).max(100).default(30),cursor:IF.string().nullish().describe("Opaque cursor from a previous call's `nextCursor`, to read the next window")}),outputSchema:IF.object({branches:IF.array(IF.object({name:IF.string(),author:IF.string().nullable()})),totalCount:IF.number(),nextCursor:IF.string().nullable()}),handler:async($,Z)=>{await Z.access.check();let Q=Z.organization?.id;if(!Q)throw Error("Organization context required");return(await LH1(Z,Q,Ob0($))).searchBranches({query:$.query,limit:$.limit,cursor:$.cursor})}})});import{z as k$}from"zod";function sL8($){let{credentialConnectionId:Z,installationAuthorizedBy:Q,installationRepositoryIds:X,...Y}=$,J=nW1($);return{...Y,servable:J===null,accessIssue:J}}function d90($){let{legacyConnectionId:Z,...Q}=$;return Q}async function x21($,Z,Q){let X=await $.storage.gitProviderAccounts.get(Q,Z);if(!X)throw Error("Git account not found");return X}var TQ5,rL8,eL8,$D8,ZD8,QD8,XD8,YD8,JD8,GD8,KD8,WD8;var HD8=L(()=>{X40();t4();tL8();v0();K7();aL8();TQ5=k$.object({ref:iv$,externalId:k$.string(),defaultBranch:k$.string().nullable(),webUrl:k$.string(),visibility:k$.enum(["public","private","internal"]),description:k$.string().nullable(),updatedAt:k$.string().nullable()}),rL8=pv$.extend({servable:k$.boolean(),accessIssue:k$.enum(["revoked","provider_unavailable","installation_missing","authorization_required","no_repositories"]).nullable(),connectedBy:k$.object({name:k$.string()}).nullable()});eL8=t({name:"GIT_PROVIDER_CAPABILITIES",description:"Which git providers this deployment can connect through Studio-owned credentials, and the URLs that start each connect flow.",annotations:{title:"Git provider capabilities",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({}),outputSchema:k$.object({github:k$.object({configured:k$.boolean(),cliConnectPath:k$.string().nullable(),connectPath:k$.string().nullable(),installPath:k$.string().nullable()}),gitlab:k$.object({oauthHosts:k$.array(k$.string()),connectPath:k$.string().nullable()}),bitbucket:k$.object({oauthHosts:k$.array(k$.string()),connectPath:k$.string().nullable()})}),handler:async($,Z)=>{r(Z);let Q=W0(Z),X=`/api/${Q.slug??Q.id}/git-providers`,Y=tD0(),J=Y.github.configured,G=Y.github.cli;return{github:{configured:J||G,cliConnectPath:G?`${X}/github/cli/connect`:null,connectPath:J?`${X}/github/connect`:null,installPath:J?`${X}/github/install`:null},gitlab:{oauthHosts:Y.gitlab.hosts,connectPath:Y.gitlab.configured?`${X}/gitlab/connect`:null},bitbucket:{oauthHosts:Y.bitbucket.hosts,connectPath:Y.bitbucket.configured?`${X}/bitbucket/connect`:null}}}}),$D8=t({name:"GIT_ACCOUNT_LIST",description:"List the git provider accounts connected to this organization.",annotations:{title:"List git accounts",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({}),outputSchema:k$.object({accounts:k$.array(rL8)}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z);return{accounts:(await Z.storage.gitProviderAccounts.listByOrg(Q.id)).map(sL8)}}}),ZD8=t({name:"GIT_ACCOUNT_CONNECT_TOKEN",description:"Connect a git provider account with an access token: a GitLab personal, project or group token, or a Bitbucket Cloud repository, project or workspace access token. Bitbucket also needs the workspace slug, because an access token cannot name itself. Validates the token against the provider before storing it encrypted. Prefer this over OAuth when the account should only reach a subset of repositories: a scoped token is narrowed by the provider, an OAuth grant reaches everything its user can.",annotations:{title:"Connect git account with a token",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({type:p$0.describe("Provider; gitlab and bitbucket accept tokens (GitHub connects through the App)"),host:k$.string().min(1).describe("Provider host, e.g. gitlab.com, gitlab.acme.com or bitbucket.org"),token:k$.string().min(1).describe("Access token with api scope"),workspace:k$.string().min(1).optional().describe("Bitbucket workspace slug the token belongs to. Required for Bitbucket: an access token cannot name itself, and the workspace is what Studio verifies it against.")}),outputSchema:k$.object({account:rL8}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z),X=$.host.trim().toLowerCase();if(!/^[a-z0-9.-]+(:[0-9]+)?$/.test(X))throw Error("host must be a bare hostname, optionally with a port");let Y=$.workspace?.trim().toLowerCase();if($.type==="bitbucket"&&!Y)throw Error("Connecting Bitbucket with a token needs the workspace slug the token belongs to");let J=await gg$($.type,X,$.token,Y),G=await Z.storage.gitProviderAccounts.upsert({organizationId:Q.id,type:$.type,host:X,authKind:"token",externalAccountId:J.externalAccountId,login:J.login,avatarUrl:J.avatarUrl,createdBy:n0(Z)??null});return await Z.storage.gitProviderAccountCredentials.upsert({connectionId:G.id,accessToken:$.token,refreshToken:null,scope:null,expiresAt:null,clientId:null,clientSecret:null,tokenEndpoint:null}),{account:sL8(G)}}}),QD8=t({name:"GIT_ACCOUNT_DELETE",description:"Disconnect a git provider account. Its repositories stay linked but lose credentials (they become anonymous clones) until linked to another account.",annotations:{title:"Disconnect git account",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({id:k$.string()}),outputSchema:k$.object({deleted:k$.boolean()}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z);return{deleted:await Z.storage.gitProviderAccounts.delete($.id,Q.id)}}}),XD8=t({name:"REPOSITORY_LIST",description:"List the repositories linked to this organization.",annotations:{title:"List repositories",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({accountId:k$.string().optional().describe("Only repositories of this account")}),outputSchema:k$.object({repositories:k$.array(n$0.extend({usable:k$.boolean()}))}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z),X=await Z.storage.repositories.listByOrg(Q.id,{accountId:$.accountId}),Y=await Xz(Z,Q.id),J=new Set(Y.map((G)=>G.webUrl.toLowerCase()));return{repositories:X.map((G)=>({...d90(G),usable:J.has(G.webUrl.toLowerCase())}))}}}),YD8=t({name:"REPOSITORY_SEARCH",description:"Search the repositories an account can reach on its provider (not yet linked). Feeds the repository picker.",annotations:{title:"Search provider repositories",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({accountId:k$.string(),query:k$.string().optional(),page:k$.number().int().min(1).optional(),perPage:k$.number().int().min(1).max(100).optional()}),outputSchema:k$.object({repositories:k$.array(TQ5),hasMore:k$.boolean()}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z),X=await x21(Z,Q.id,$.accountId);return wN({db:Z.db,vault:Z.vault},X).listRepos({query:$.query,page:$.page,perPage:$.perPage})}}),JD8=t({name:"REPOSITORY_LINK",description:"Link a repository to the organization. With an account, the repository is verified against the provider and its facts (id, default branch, visibility) recorded; without one it is linked as an anonymous public clone.",annotations:{title:"Link repository",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({url:k$.string().min(1).describe("Repository URL (https or ssh), or a bare path like owner/name when accountId is given"),accountId:k$.string().optional().describe("Account whose credentials access the repository")}),outputSchema:k$.object({repository:n$0}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z),X=n0(Z)??null;if(!$.accountId){let H=cX($.url);if(!H)throw Error("Could not recognise the repository URL. Use a full https URL from GitHub, GitLab or Bitbucket.");let F=await Z.storage.repositories.upsert({organizationId:Q.id,ref:H,createdBy:X});return{repository:d90(F)}}let Y=await x21(Z,Q.id,$.accountId),J=cX($.url,{provider:Y.type,host:Y.host});if(!J)throw Error("Could not recognise the repository URL or path");if(J.host!==Y.host)throw Error(`Repository is on ${J.host} but the account is on ${Y.host}`);let K=await wN({db:Z.db,vault:Z.vault},Y).getRepo(J);if(!K)throw Error(`${J.path} was not found on ${J.host} or the account cannot access it`);let W=await Z.storage.repositories.upsert({organizationId:Q.id,ref:K.ref,accountId:Y.id,externalId:K.externalId,defaultBranch:K.defaultBranch,visibility:K.visibility,createdBy:X});return{repository:d90(W)}}}),GD8=t({name:"REPOSITORY_CREATE_FROM_TEMPLATE",description:"Create a new private GitHub repository for a site from one of the site templates, owned by the account's user or organization, and link it to the organization.",annotations:{title:"Create repository from template",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({accountId:k$.string().describe("GitHub account whose user or organization owns the repository"),name:nL8.describe("Name of the new repository"),template:iL8}),outputSchema:k$.object({repository:n$0}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z),X=await x21(Z,Q.id,$.accountId),Y=wN({db:Z.db,vault:Z.vault},X);if(!Y.createRepoFromTemplate)throw Error("Sites can only be created in a GitHub account");let J=await Y.createRepoFromTemplate({template:pL8($.template).repo,owner:X.login,name:$.name,private:!0});if(X.installationRepositoryIds)await Z.storage.gitProviderAccounts.grantRepository(X.id,Q.id,Number(J.externalId));let G=await Z.storage.repositories.upsert({organizationId:Q.id,ref:J.ref,accountId:X.id,externalId:J.externalId,defaultBranch:J.defaultBranch,visibility:J.visibility,createdBy:n0(Z)??null});return{repository:d90(G)}}}),KD8=t({name:"REPOSITORY_UPDATE",description:"Change a linked repository's settings. Currently the sandbox image its sandboxes boot from: `default`, or the name of a variant the cluster renders (e.g. `android`, for mobile apps an agent should run on an Android emulator). A variant the cluster lacks degrades to `default`.",annotations:{title:"Update repository",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({id:k$.string(),sandboxImage:YN}),outputSchema:k$.object({repository:n$0}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z),X=await Z.storage.repositories.setSandboxImage($.id,Q.id,$.sandboxImage);if(!X)throw Error("Repository not found");return{repository:d90(X)}}}),WD8=t({name:"REPOSITORY_DELETE",description:"Unlink a repository from the organization. Agents, tasks and syncs that referenced it keep working off their legacy metadata until relinked.",annotations:{title:"Unlink repository",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({id:k$.string()}),outputSchema:k$.object({deleted:k$.boolean()}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z);return{deleted:await Z.storage.repositories.delete($.id,Q.id)}}})});import{z as S$}from"zod";async function Ut($,Z){let Q=$.organization?.id;if(!Q)throw Error("Organization context required");let X=await Q40($,Q,Ob0(Z));if(!X)throw Error(oL8);return X}var RQ5,qQ5,wb0,MQ5,FD8,UD8,ND8,BD8,LD8,DD8;var OD8=L(()=>{v0();K7();_21();RQ5=S$.object({id:S$.string().nullable(),name:S$.string(),state:S$.enum(["queued","running","completed"]),conclusion:S$.enum(["success","failure","neutral","cancelled","skipped","timed_out","action_required"]).nullable(),url:S$.string().nullable(),durationMs:S$.number().nullable(),summary:S$.string().nullable()}),qQ5=S$.object({id:S$.string(),author:S$.string(),body:S$.string(),createdAt:S$.string(),updatedAt:S$.string(),url:S$.string()}),wb0=S$.object({number:S$.number(),url:S$.string(),title:S$.string(),body:S$.string(),state:S$.enum(["open","closed","merged"]),draft:S$.boolean(),mergedAt:S$.string().nullable(),base:S$.string(),head:S$.string(),headSha:S$.string(),headRepoPath:S$.string().nullable(),author:S$.string(),conflicting:S$.boolean().nullable(),checks:S$.enum(["pending","passing","failing"]).nullable(),changedFiles:S$.number().nullable()}),MQ5=wb0.extend({checkRuns:S$.array(RQ5),comments:S$.array(qQ5),unresolvedConversations:S$.number(),reviewBlocked:S$.boolean()}),FD8=t({name:"CHANGE_REQUEST_STATE",description:"Read a branch's change request with its CI runs, review state and comments.",annotations:{title:"Read Change Request State",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:S$.object({...ZO,branch:S$.string().describe("Head branch of the change request to read")}),outputSchema:S$.object({changeRequest:MQ5.nullable()}),handler:async($,Z)=>{return await Z.access.check(),{changeRequest:await(await Ut(Z,$)).readDetailed({branch:$.branch})}}}),UD8=t({name:"CHANGE_REQUEST_LAST_MERGED",description:"Read the most recently merged change request into a base branch \u2014 in Fast Preview, the last publish.",annotations:{title:"Read Last Merged Change Request",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:S$.object({...ZO,base:S$.string().describe("Branch it was merged into")}),outputSchema:S$.object({changeRequest:wb0.nullable()}),handler:async($,Z)=>{return await Z.access.check(),{changeRequest:await(await Ut(Z,$)).lastMergedInto($.base)}}}),ND8=t({name:"CHANGE_REQUEST_LIST_OPEN",description:"List a repository's open change requests, most recently updated first.",annotations:{title:"List Open Change Requests",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:S$.object({...ZO,limit:S$.number().int().min(1).max(100).default(50)}),outputSchema:S$.object({changeRequests:S$.array(wb0)}),handler:async($,Z)=>{return await Z.access.check(),{changeRequests:await(await Ut(Z,$)).listOpen($.limit)}}}),BD8=t({name:"CHANGE_REQUEST_CHECK_LOG",description:"Read one CI run's report \u2014 a GitHub check run's output markdown, or the tail of a GitLab job's trace. Bitbucket commit statuses carry no report, so this answers nothing there.",annotations:{title:"Read CI Run Report",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:S$.object({...ZO,checkId:S$.string().describe("Provider id of the run, from its listing")}),outputSchema:S$.object({report:S$.string().nullable()}),handler:async($,Z)=>{return await Z.access.check(),{report:await(await Ut(Z,$)).readCheckLog($.checkId)}}}),LD8=t({name:"CHANGE_REQUEST_OPEN",description:"Propose a branch onto another. Returns the branch's existing change request instead of failing when it already has one.",annotations:{title:"Open Change Request",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:S$.object({...ZO,head:S$.string().describe("Branch being proposed"),base:S$.string().describe("Branch it should land on"),title:S$.string(),body:S$.string().optional()}),outputSchema:S$.object({changeRequest:wb0,existed:S$.boolean()}),handler:async($,Z)=>{await Z.access.check();let Q=await Ut(Z,$),X=await Q.readForBranch($.head);if(X&&X.state==="open"){if($.body&&$.body!==X.body)await Q.describe(X.number,$.body);return{changeRequest:$.body?{...X,body:$.body}:X,existed:!0}}return{changeRequest:await Q.open({head:$.head,base:$.base,title:$.title,body:$.body}),existed:!1}}}),DD8=t({name:"CHANGE_REQUEST_MERGE",description:"Land a change request. Reports why it could not merge rather than throwing.",annotations:{title:"Merge Change Request",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:S$.object({...ZO,number:S$.number().int().positive(),strategy:S$.enum(["any","squash"]).default("any").describe("`squash` when the result must be one commit; `any` uses whatever the repository allows"),commitTitle:S$.string().optional(),commitMessage:S$.string().optional()}),outputSchema:S$.object({merged:S$.boolean(),reason:S$.enum(["conflict","blocked","rate_limited","not_found","error"]).optional(),detail:S$.string().optional()}),handler:async($,Z)=>{await Z.access.check();let X=await(await Ut(Z,$)).merge($.number,{strategy:$.strategy,commitTitle:$.commitTitle,commitMessage:$.commitMessage});return X.merged?{merged:!0}:{merged:!1,reason:X.reason,detail:X.detail}}})});import{z as L6}from"zod";function jb0($){if(!$)return"";return typeof $==="string"?$:$.toISOString()}function f21($){let Z=$.trim();return Z.length>0?Z:void 0}function b21($,Z){return $===void 0||$.includes(Z)}var VQ5,kQ5,SQ5,CQ5,_Q5,vQ5,xQ5,y21;var wD8=L(()=>{v0();AC0();VQ5=["thread","task","connection"],kQ5=L6.object({type:L6.literal("thread"),id:L6.string(),title:L6.string(),created_at:L6.string(),updated_at:L6.string(),virtual_mcp_id:L6.string().nullable(),run_config:L6.record(L6.string(),L6.unknown()).nullable(),status:L6.string().nullable()}),SQ5=L6.object({type:L6.literal("task"),id:L6.string(),title:L6.string(),created_at:L6.string(),updated_at:L6.string(),key:L6.string().nullable(),status:L6.string().nullable(),repo:L6.string().nullable()}),CQ5=L6.object({type:L6.literal("connection"),id:L6.string(),title:L6.string(),icon:L6.string().nullable(),slug:L6.string().nullable()}),_Q5=L6.discriminatedUnion("type",[kQ5,SQ5,CQ5]),vQ5=L6.object({query:L6.string().max(256).describe("Free-text search query. Empty string returns the most recently updated resources."),limit:L6.number().int().min(1).max(50).optional().describe("Maximum results per resource type (default: 20)."),types:L6.array(L6.enum(VQ5)).optional().describe("Restrict the search to specific resource types. Omit to search across all available types.")}),xQ5=L6.object({items:L6.array(_Q5),totalCount:L6.number()});y21=t({name:"GLOBAL_SEARCH",description:"Search across organization resources by free-text query. Returns a typed union of matches (currently: threads, task-board cards and MCP connections). New resource types may be added over time without changes to the call shape.",annotations:{title:"Global Search",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:vQ5,outputSchema:xQ5,handler:async($,Z)=>{await Z.access.check();let Q=W0(Z),X=$.limit??20,Y=b21($.types,"thread"),J=b21($.types,"task"),G=b21($.types,"connection"),K=[],W=0,[H,F,U]=await Promise.all([Y?Z.storage.threads.list(void 0,{limit:X,offset:0,search:f21($.query),includeArchived:!1}):null,J?Z.storage.taskBoard.searchByTitle(Q.id,f21($.query)??"",X):null,G?Z.storage.connections.searchByTitle(Q.id,f21($.query)??"",X):null]);if(H){W+=H.total;for(let N of H.threads)K.push({type:"thread",id:N.id,title:N.title??"",created_at:jb0(N.created_at),updated_at:jb0(N.updated_at),virtual_mcp_id:N.virtual_mcp_id??null,run_config:N.run_config??null,status:OW(N).status})}if(F){W+=F.length;for(let N of F)K.push({type:"task",id:N.id,title:N.title??"",created_at:jb0(N.createdAt),updated_at:jb0(N.updatedAt),key:Q.slug?up(Q.slug,N.keySeq):null,status:N.status??null,repo:N.repo??null})}if(U){W+=U.length;for(let N of U)K.push({type:"connection",id:N.id,title:N.title,icon:N.icon??null,slug:N.slug??null})}return{items:K,totalCount:W}}})});var jD8=L(()=>{wD8()});var ED8=60;function o3($){return I8(async()=>{let{object:Z}=await qz($);return{object:Z}},{maxAttempts:3,minTimeout:300,isRetriable:(Z)=>$Y.isInstance(Z)})}var jh=L(()=>{u4();F8()});import{z as KJ}from"zod";var Nt,VF;var Bt=L(()=>{Nt=KJ.object({name:KJ.string().describe("Short phrase naming the rule \u2014 what it is about, not the rule"),value:KJ.string().describe("The rule itself, as markdown. One or two paragraphs; use a bullet list only when there are genuinely several cases. No heading \u2014 the name is the heading.")}),VF=KJ.object({companyName:KJ.string().describe("The store or brand name. Look for the name that recurs across page titles, block `name` props, and post bodies \u2014 not a product or category name."),description:KJ.string().describe("What the company sells and who it sells to, 1-3 sentences. Look at the home and institutional pages."),language:KJ.string().describe("BCP-47 tag of the language the prose itself is written in, e.g. pt-BR. Read the post bodies, not any locale config."),tone:KJ.string().describe("Tone of voice, described so another writer could reproduce it: how the reader is addressed (which pronoun, which person), sentence length, humor, jargon level, formality, and casing conventions. Read the longest run of real prose you can find \u2014 post bodies if they exist, otherwise page copy and meta descriptions."),targetAudience:KJ.string().describe("Who reads this brand's content and what they came looking for. Infer from who the copy addresses and what it assumes the reader already cares about. Say so plainly rather than reaching for marketing personas."),values:KJ.array(Nt).describe("Brand values the content should carry, as the brand itself states them. `name` is the value ('Biodiversidade brasileira'), `value` explains what the copy actually claims and the evidence for it \u2014 stated numbers, sourcing commitments. Prefer a value the copy argues for over a generic virtue like 'quality' or 'innovation'."),dos:KJ.array(Nt).describe("Instructions a blogpost writer must follow for this brand, derived from patterns the copy consistently follows. `name` names the rule ('Abertura do post'), `value` is the imperative instruction \u2014 instructions, not adjectives: 'Open with the customer's problem, never with the company' beats 'customer-focused'. Any brand-specific word for an ordinary thing gets its own rule, quoted in the brand's language \u2014 for a Portuguese site, \"chame a sacola de 'mochila', nunca de 'carrinho'\"."),avoid:KJ.array(Nt).describe("Things a blogpost writer must not do \u2014 banned words, claims, formats, topics. `name` names the guardrail, `value` states the prohibition and why the copy suggests it. Derive them from what the copy consistently never does and from claims the brand is visibly careful about. Do not restate a `dos` entry inverted."),categories:KJ.array(KJ.string()).describe("Content categories that fit this brand's blog, as plain names \u2014 this is a taxonomy, not a rule, so no body. Take existing category blocks first; with no blog, derive them from the themes the site's own pages keep returning to. Editorial subjects, not the product taxonomy."),competitors:KJ.array(Nt).describe("Competitors named explicitly in the content. A brand rarely names them in its own copy \u2014 return an empty array unless a name is actually there, and never guess from the market segment. When one is named, `name` is the competitor and `value` is what the content says about it.")})});import{z as JB}from"zod";async function uQ5($,Z,Q){if(!Q.companyName.trim())return[];let X=await rX($,"web_search");if(!X)return[];try{let Y=await $.aiProviders.activate(X.credentialId,Z),{text:J}=await CN({model:Y.aiSdk.languageModel(X.modelId),prompt:`Who are the main competitors of ${Q.companyName}? Context on the company: ${Q.description}
5401
+ `}]});function Jb0(){return[...TB8,...CB8,...bB8,...VB8,...qB8,...iB8,...hB8,...mB8]}function tB8(){return[...xB8,...AB8,..._B8,...yB8,...kB8,...MB8,...pB8]}var B21=L(()=>{RB8();IB8();SB8();vB8();fB8();gB8();uB8();dB8();nB8()});import{AsyncLocalStorage as a75}from"async_hooks";import{z as r75}from"zod";function s75($){let Z=$.inputSchema&&typeof $.inputSchema==="object"&&"shape"in $.inputSchema?$.inputSchema:r75.object({}),Q=$.outputSchema&&typeof $.outputSchema==="object"&&"shape"in $.outputSchema?$.outputSchema:void 0;return{config:{description:$.description??"",inputSchema:Z,outputSchema:Q,annotations:$.annotations,_meta:$._meta},handler:async(X)=>{let Y=mD.getStore();if(!Y)throw Error(`[managementMCP] tool ${$.name} invoked outside a request context`);Y.access.setToolName($.name);try{let J=await $.execute(X,Y);return{content:[{type:"text",text:$.modelSummary?$.modelSummary(J):JSON.stringify(J)}],structuredContent:J}}catch(J){return{content:[{type:"text",text:`Error: ${J.message}`}],isError:!0}}}}}function m90($){let Z=oB8.get($);if(!Z)Z=s75($),oB8.set($,Z);return Z}var mD,oB8;var Gb0=L(()=>{mD=new a75;oB8=new Map});function CW($){if(!$.objectStorage)throw Error("Object storage is not configured. Ensure S3 credentials are set.");return $.objectStorage}function sD($,Z){let Q=typeof $==="number"&&Number.isFinite($)?$:Z;return Math.min(Math.max(Q,e75),$Q5)}function Kt($){return iA.find((Z)=>Z.name===$)}var e75=60,$Q5=604800,aB8,rB8,sB8,eB8,$L8,ZL8,QL8,XL8,YL8,JL8,GL8,KL8,WL8,HL8,FL8,UL8,NL8,BL8;var eD=L(()=>{K80();aB8=Kt("LIST_OBJECTS"),rB8=aB8.inputSchema,sB8=aB8.outputSchema,eB8=Kt("GET_OBJECT_METADATA"),$L8=eB8.inputSchema,ZL8=eB8.outputSchema,QL8=Kt("GET_PRESIGNED_URL"),XL8=QL8.inputSchema,YL8=QL8.outputSchema,JL8=Kt("PUT_PRESIGNED_URL"),GL8=JL8.inputSchema,KL8=JL8.outputSchema,WL8=Kt("DELETE_OBJECT"),HL8=WL8.inputSchema,FL8=WL8.outputSchema,UL8=Kt("DELETE_OBJECTS"),NL8=UL8.inputSchema,BL8=UL8.outputSchema});var L21;var LL8=L(()=>{v0();eD();L21=t({name:"LIST_OBJECTS",description:"List objects in the organization's object storage with pagination and prefix filtering support.",annotations:{title:"List Objects",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:rB8,outputSchema:sB8,handler:async($,Z)=>{r(Z),W0(Z),await Z.access.check();let X=await CW(Z).list({prefix:$.prefix,maxKeys:$.maxKeys,continuationToken:$.continuationToken,delimiter:$.delimiter});return{objects:X.objects.map((Y)=>({key:Y.key,size:Y.size,lastModified:Y.lastModified?.toISOString?.()??(typeof Y.lastModified==="string"?Y.lastModified:new Date().toISOString()),etag:Y.etag??""})),isTruncated:X.isTruncated,nextContinuationToken:X.nextContinuationToken,commonPrefixes:X.commonPrefixes}}})});var D21;var DL8=L(()=>{v0();eD();D21=t({name:"GET_OBJECT_METADATA",description:"Get metadata for an object in the organization's storage.",annotations:{title:"Get Object Metadata",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:$L8,outputSchema:ZL8,handler:async($,Z)=>{r(Z),W0(Z),await Z.access.check();let X=await CW(Z).head($.key);return{contentType:X.contentType,contentLength:X.size,lastModified:X.lastModified?.toISOString?.()??(typeof X.lastModified==="string"?X.lastModified:new Date().toISOString()),etag:X.etag??"",metadata:X.metadata}}})});var ZQ5=3600,O21;var OL8=L(()=>{v0();eD();O21=t({name:"GET_PRESIGNED_URL",description:"Generate a presigned URL for downloading an object from the organization's storage.",annotations:{title:"Get Presigned Download URL",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:XL8,outputSchema:YL8,handler:async($,Z)=>{r(Z),W0(Z),await Z.access.check();let Q=CW(Z),X=sD($.expiresIn,ZQ5);return{url:await Q.presignedGetUrl($.key,X),expiresIn:X}}})});var QQ5=3600,w21;var wL8=L(()=>{v0();eD();w21=t({name:"PUT_PRESIGNED_URL",description:"Generate a presigned URL for uploading an object to the organization's storage.",annotations:{title:"Get Presigned Upload URL",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:GL8,outputSchema:KL8,handler:async($,Z)=>{r(Z),W0(Z),await Z.access.check();let Q=CW(Z),X=sD($.expiresIn,QQ5);return{url:await Q.presignedPutUrl($.key,X,$.contentType),expiresIn:X}}})});var j21;var jL8=L(()=>{v0();eD();j21=t({name:"DELETE_OBJECT",description:"Delete a single object from the organization's storage.",annotations:{title:"Delete Object",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:HL8,outputSchema:FL8,handler:async($,Z)=>{r(Z),W0(Z),await Z.access.check();let Q=CW(Z);try{return await Q.delete($.key),{success:!0,key:$.key}}catch{return{success:!1,key:$.key}}}})});var E21;var EL8=L(()=>{v0();eD();E21=t({name:"DELETE_OBJECTS",description:"Delete multiple objects from the organization's storage in batch.",annotations:{title:"Delete Objects",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:NL8,outputSchema:BL8,handler:async($,Z)=>{r(Z),W0(Z),await Z.access.check();let Q=CW(Z),X=[],Y=[];return await Promise.all($.keys.map(async(J)=>{try{await Q.delete(J),X.push(J)}catch(G){Y.push({key:J,message:G instanceof Error?G.message:"Unknown error"})}})),{deleted:X,errors:Y}}})});var zL8=L(()=>{LL8();DL8();OL8();wL8();jL8();EL8()});import{z as L1}from"zod";var YQ5,JQ5,PL8,GQ5,Wt,TL8,AL8,Kb0,RL8,qL8,ML8,KQ5,IL8;var wh=L(()=>{aJ();YQ5=L1.object({name:L1.string(),title:L1.string().optional(),description:L1.string().optional(),version:L1.string().optional(),websiteUrl:L1.string().optional(),icons:L1.array(L1.object({src:L1.string()}).catchall(L1.unknown())).optional(),remotes:L1.array(L1.object({type:L1.string().optional(),url:L1.string().optional(),name:L1.string().optional(),title:L1.string().optional(),description:L1.string().optional()}).catchall(L1.unknown())).optional(),packages:L1.array(L1.object({identifier:L1.string(),version:L1.string().optional()}).catchall(L1.unknown())).optional(),repository:L1.object({url:L1.string().optional(),source:L1.string().optional(),subfolder:L1.string().optional()}).catchall(L1.unknown()).optional()}).catchall(L1.unknown()),JQ5=L1.object({name:L1.string(),description:L1.string().nullable().optional()}).catchall(L1.unknown()),PL8=L1.object({verified:L1.boolean().optional(),official:L1.boolean().optional(),tags:L1.array(L1.string()).optional(),categories:L1.array(L1.string()).optional(),friendly_name:L1.string().nullable().optional(),short_description:L1.string().max(160).nullable().optional(),owner:L1.string().nullable().optional(),readme:L1.string().max(50000).nullable().optional(),readme_url:L1.string().nullable().optional(),has_remote:L1.boolean().optional(),has_oauth:L1.boolean().optional(),tools:L1.array(JQ5).optional()}).catchall(L1.unknown()),GQ5=L1.object({"mcp.studio":PL8.optional(),"mcp.mesh":PL8.optional()}).catchall(L1.unknown()),Wt=L1.object({id:L1.string(),name:L1.string().optional(),title:L1.string(),description:L1.string().nullable().optional(),_meta:GQ5.optional(),server:YQ5,is_public:L1.boolean().optional(),is_unlisted:L1.boolean().optional(),created_at:L1.string().optional(),updated_at:L1.string().optional(),created_by:L1.string().optional()}).catchall(L1.unknown()),TL8=aH.extend({tags:L1.array(L1.string()).optional().describe("Filter by tags (AND semantics)"),categories:L1.array(L1.string()).optional().describe("Filter by categories (AND semantics)"),cursor:L1.string().optional().describe("Pagination cursor")}).describe("List registry items with optional filtering and pagination."),AL8=L1.object({items:L1.array(Wt),totalCount:L1.number(),hasMore:L1.boolean().optional(),nextCursor:L1.string().optional()}),Kb0=L1.object({id:L1.string().optional().describe("Registry item ID"),name:L1.string().optional().describe("Registry item name (alias for id)")}).refine(($)=>$.id||$.name,{message:"At least one of 'id' or 'name' is required"}).describe("Get a registry item by ID or name."),RL8=L1.object({item:Wt.nullable()}),qL8=L1.object({tags:L1.array(L1.object({value:L1.string(),count:L1.number()})),categories:L1.array(L1.object({value:L1.string(),count:L1.number()}))}),ML8=L1.object({query:L1.string().optional().describe("Free-text search across id, title, description, server name"),tags:L1.array(L1.string()).optional().describe("Filter by tags (AND)"),categories:L1.array(L1.string()).optional().describe("Filter by categories (AND)"),limit:L1.number().int().min(1).max(100).optional().describe("Max results (default 20)"),cursor:L1.string().optional().describe("Pagination cursor")}).describe("Lightweight search returning minimal fields (id, title, tags, categories, is_public)."),KQ5=L1.object({id:L1.string(),title:L1.string(),tags:L1.array(L1.string()),categories:L1.array(L1.string()),is_public:L1.boolean(),is_unlisted:L1.boolean()}),IL8=L1.object({items:L1.array(KQ5),totalCount:L1.number(),hasMore:L1.boolean().optional(),nextCursor:L1.string().optional()})});import{z as WQ5}from"zod";function NQ5($){return UQ5.parse($).map((Z)=>({...Z,name:Z.name??Z.server.name}))}async function BQ5(){try{let $=await fetch(HQ5,{headers:GJ?.etag?{"If-None-Match":GJ.etag}:{},signal:AbortSignal.timeout(1e4)});if($.status===304&&GJ)return GJ.fetchedAt=Date.now(),GJ.retryAt=Date.now()+z21,GJ.items;if(!$.ok)throw Error(`Deco registry unavailable (${$.status})`);if(!$.body)throw Error("Deco registry returned an empty response");let Z=$.body.getReader(),Q=[],X=0;try{while(!0){let{done:K,value:W}=await Z.read();if(K)break;if(X+=W.byteLength,X>FQ5)throw Error("Deco registry exceeds size limit");Q.push(W)}}finally{await Z.cancel()}let Y=new Uint8Array(X),J=0;for(let K of Q)Y.set(K,J),J+=K.byteLength;let G=NQ5(JSON.parse(new TextDecoder().decode(Y)));return GJ={items:G,fetchedAt:Date.now(),retryAt:Date.now()+z21,etag:$.headers.get("etag")},G}catch($){if(GJ&&Date.now()-GJ.fetchedAt<VL8)return GJ.retryAt=Date.now()+z21,GJ.items;throw $}}async function YB(){if(GJ&&Date.now()<GJ.retryAt&&Date.now()-GJ.fetchedAt<VL8)return GJ.items;return P21??=BQ5().finally(()=>{P21=void 0}),P21}function T21($,Z){let Q=$;for(let X of Z){if(Q===null||typeof Q!=="object"||!Object.hasOwn(Q,X))return;Q=Q[X]}return Q}function A21($,Z){if("conditions"in Z){if(Z.operator==="or")return Z.conditions.some((J)=>A21($,J));let Y=Z.conditions.every((J)=>A21($,J));return Z.operator==="not"?!Y:Y}let Q=T21($,Z.field),X=Z.value;if(Q===void 0)return!1;switch(Z.operator){case"eq":return Q===X;case"in":return Array.isArray(X)&&X.includes(Q);case"contains":return typeof Q==="string"&&typeof X==="string"&&Q.toLowerCase().includes(X.toLowerCase());case"like":return typeof Q==="string"&&typeof X==="string"&&Oi(X).test(Q);default:{if(!(typeof Q==="number"&&typeof X==="number"||typeof Q==="string"&&typeof X==="string"))return!1;if(Z.operator==="gt")return Q>X;if(Z.operator==="gte")return Q>=X;if(Z.operator==="lt")return Q<X;return Q<=X}}}function Wb0($,Z){let Q=$.filter((K)=>{let W=zU(K._meta);return(!Z.where||A21(K,Z.where))&&(Z.tags??[]).every((H)=>W?.tags?.includes(H))&&(Z.categories??[]).every((H)=>W?.categories?.includes(H))});Q.sort((K,W)=>{for(let H of Z.orderBy??[]){let F=T21(K,H.field),U=T21(W,H.field);if(F==null||U==null){if(F==null&&U==null)continue;let B=H.nulls==="first";return F==null?B?-1:1:B?1:-1}let N=typeof F==="number"&&typeof U==="number"?F-U:String(F).localeCompare(String(U));if(N)return H.direction==="desc"?-N:N}return K.id.localeCompare(W.id)});let X=Z.cursor===void 0?Z.offset??0:Number(Z.cursor);if(!Number.isSafeInteger(X)||X<0||Z.cursor!==void 0&&!/^\d+$/.test(Z.cursor))throw Error("Invalid registry cursor");let Y=Z.limit??24,J=Q.slice(X,X+Y),G=X+J.length<Q.length;return{items:J,totalCount:Q.length,hasMore:G,nextCursor:G?String(X+J.length):void 0}}function Hb0($){let Z=$.id??$.name;if(!Z)throw Error("Either 'id' or 'name' is required");return Z}function Fb0($,Z){return $.find((Q)=>Q.id===Z)??$.find((Q)=>Q.name===Z||Q.server.name===Z)??null}function kL8($){let Z=new Map,Q=new Map;for(let Y of $){let J=zU(Y._meta);for(let G of new Set(J?.tags??[]))Z.set(G,(Z.get(G)??0)+1);for(let G of new Set(J?.categories??[]))Q.set(G,(Q.get(G)??0)+1)}let X=(Y)=>[...Y].map(([J,G])=>({value:J,count:G})).sort((J,G)=>J.value.localeCompare(G.value));return{tags:X(Z),categories:X(Q)}}var HQ5="https://raw.githubusercontent.com/decocms/mcps/main/registry.json",z21=300000,VL8=3600000,FQ5=10485760,UQ5,GJ,P21;var Ht=L(()=>{aJ();wh();UQ5=WQ5.array(Wt).max(1e4).superRefine(($,Z)=>{let Q=new Set;for(let X of $){if(Q.has(X.id))Z.addIssue({code:"custom",message:`Duplicate registry id: ${X.id}`});Q.add(X.id)}})});import{z as LQ5}from"zod";var Ub0;var R21=L(()=>{Ht();v0();wh();Ub0=t({name:"REGISTRY_ITEM_FILTERS",description:"List available tag/category filters for Deco registry items",inputSchema:LQ5.object({}),outputSchema:qL8,handler:async($,Z)=>{return W0(Z),await Z.access.check(),kL8(await YB())}})});var Nb0;var q21=L(()=>{Ht();v0();wh();Nb0=t({name:"REGISTRY_ITEM_GET",description:"Get a Deco registry item by ID or name",inputSchema:Kb0,outputSchema:RL8,handler:async($,Z)=>{W0(Z),await Z.access.check();let Q=Hb0($);return{item:Fb0(await YB(),Q)}}})});var Bb0;var M21=L(()=>{Ht();v0();wh();Bb0=t({name:"REGISTRY_ITEM_LIST",description:"List Deco registry items for the current organization",inputSchema:TL8,outputSchema:AL8,handler:async($,Z)=>{return W0(Z),await Z.access.check(),Wb0(await YB(),$)}})});var SL8;var CL8=L(()=>{Ht();v0();wh();SL8=t({name:"REGISTRY_ITEM_SEARCH",description:"Search registry items returning minimal data (id, title, tags, categories, is_public, is_unlisted). Use this instead of LIST when you need to find items efficiently without loading full details. Supports free-text search across id, title, description, and server name, plus filtering by tags and categories.",inputSchema:ML8,outputSchema:IL8,handler:async($,Z)=>{W0(Z),await Z.access.check();let Q=$.query?.trim().split(/\s+/).filter(Boolean)??[],X=Wb0(await YB(),{...$,where:Q.length?{operator:"or",conditions:Q.flatMap((Y)=>["id","title","description"].map((J)=>({field:[J],operator:"contains",value:Y})).concat([{field:["server","name"],operator:"contains",value:Y}]))}:void 0});return{...X,items:X.items.map((Y)=>({id:Y.id,title:Y.title,tags:zU(Y._meta)?.tags??[],categories:zU(Y._meta)?.categories??[],is_public:!0,is_unlisted:!1}))}}})});import{z as _L8}from"zod";var Lb0;var I21=L(()=>{Ht();v0();wh();Lb0=t({name:"REGISTRY_ITEM_VERSIONS",description:"Get available versions of a registry item",inputSchema:Kb0,outputSchema:_L8.object({versions:_L8.array(Wt)}),handler:async($,Z)=>{W0(Z),await Z.access.check();let Q=Hb0($),X=Fb0(await YB(),Q);return{versions:X?[X]:[]}}})});var vL8,xL8,fL8,bL8;var yL8=L(()=>{v0();M21();q21();I21();R21();vL8=t({...Bb0,name:"COLLECTION_REGISTRY_APP_LIST"}),xL8=t({...Nb0,name:"COLLECTION_REGISTRY_APP_GET"}),fL8=t({...Lb0,name:"COLLECTION_REGISTRY_APP_VERSIONS"}),bL8=t({...Ub0,name:"COLLECTION_REGISTRY_APP_FILTERS"})});var gL8;var hL8=L(()=>{R21();q21();M21();CL8();I21();yL8();gL8=[vL8,xL8,fL8,bL8,Bb0,SL8,Nb0,Lb0,Ub0]});import{z as Ft}from"zod";var V21;var uL8=L(()=>{v0();NW();A60();GG();V21=t({name:"SANDBOX_DELETE",description:"Delete a sandbox.",annotations:{title:"Delete VM Preview",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:Ft.object({virtualMcpId:Ft.string().describe("Virtual MCP ID that owns this VM"),branch:Ft.string().min(1).describe("Branch whose vm should be deleted (sandboxMap[userId][branch])"),removeWorktree:Ft.boolean().optional().default(!1).describe("Also reclaim the sandbox's workspace (local worktree + disk). Ignored by hosted teardown, whose filesystem is already destroyed.")}),outputSchema:Ft.object({success:Ft.boolean()}),handler:async($,Z)=>{let Q;try{Q=await Q08($,Z)}catch(K){if(K instanceof Error&&K.message==="Virtual MCP not found")return{success:!0};throw K}let{entry:X,userId:Y,sandboxUserId:J}=Q;if(!X)return{success:!0};let G=await rU1(Z);return await jz(Z.storage.virtualMcps,$.virtualMcpId,Y,J,$.branch),await G.delete(X.sandboxHandle).catch((K)=>console.error(`[SANDBOX_DELETE] ${sQ} ${X.sandboxHandle}: ${K instanceof Error?K.message:String(K)}`)),{success:!0}}})});var lL8=L(()=>{M60();uL8()});import{z as $O}from"zod";function EQ5($){try{return JSON.parse($)}catch(Z){throw Error(`GitHub /user/installations returned invalid JSON: ${$.slice(0,300)}`,{cause:Z})}}var wQ5="https://api.github.com",jQ5=15000,k21;var cL8=L(()=>{v0();XW();rJ();rH();g80();_i();k21=t({name:"GITHUB_LIST_USER_ORGS",description:"List GitHub App installations (orgs/accounts) accessible to the authenticated user.",annotations:{title:"List GitHub User Orgs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:$O.object({connectionId:$O.string().describe("ID of the mcp-github connection to use")}),outputSchema:$O.object({installations:$O.array($O.object({installationId:$O.number(),login:$O.string(),avatarUrl:$O.string(),type:$O.string()}))}),handler:async($,Z)=>{await Z.access.check();let Q=Z.organization?.id;if(!Q)throw Error("Organization context required");let X=await Z.storage.connections.findById($.connectionId,Q);if(!X)throw Error("Connection not found");if(e9(X))throw Error("Repo-scoped connections cannot list installations \u2014 use an org-level mcp-github connection");let Y=new T9(Z.db,Z.vault),J=await Y.get($.connectionId);if(!J)throw Error("No GitHub token found. Ensure the mcp-github connection is authenticated.");let G=J.accessToken;if(Zz(J)&&Y.isExpired(J,$40)){let U=await Db0(J,Y);if(!U)throw Error(f7);G=U,J=await Y.get($.connectionId)??J}let K=[],W=1,H=100,F=async(U)=>fetch(`${wQ5}/user/installations?per_page=${H}&page=${W}`,{headers:{Authorization:`Bearer ${U}`,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},signal:AbortSignal.timeout(jQ5)});while(!0){let U=await F(G);if(U.status===401){let B=await Y.get($.connectionId);if(!B||!Zz(B))throw Error(f7);let D=await Db0(B,Y);if(!D)throw Error(f7);if(G=D,U=await F(G),U.status===401)throw Error(f7)}if(oE(U.headers,{lane:"rest",operation:"list_user_installations",installation:CW1}),nE(U)){await U.body?.cancel().catch(()=>{});let B=U.headers.get("retry-after")!==null?"secondary":"primary";aE({lane:"rest",operation:"list_user_installations",installation:CW1,kind:B});let D=tE(U.headers);throw Error(`GitHub ${B} rate limit reached${D===null?"":`; retry in ${Math.ceil(D/1000)}s`}`)}if(!U.ok)throw await U.body?.cancel().catch(()=>{}),Error(`GitHub /user/installations failed: ${U.status}`);let N=EQ5(await U.text());for(let B of N.installations)K.push({installationId:B.id,login:B.account.login,avatarUrl:B.account.avatar_url,type:B.account.type});if(N.installations.length<H)break;W++}return{installations:K}}})});var mL8=L(()=>{cL8()});var S21="deco-sites";import{z as dL8}from"zod";function pL8($){let Z=PQ5.find((Q)=>Q.id===$);if(!Z)throw Error(`Unknown site template: ${$}`);return Z}var PQ5,iL8,nL8;var tL8=L(()=>{PQ5=[{id:"storefront",repo:{owner:S21,name:"storefront-tanstack"}},{id:"blog",repo:{owner:S21,name:"blog-tanstack"}}],iL8=dL8.enum(["storefront","blog"]);nL8=dL8.string().trim().min(1).max(100).regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/,"Use lower-case letters, numbers and hyphens, starting and ending with a letter or number")});import{z as C21}from"zod";function Ob0($){let Z=$.repoUrl?cX($.repoUrl):null;if($.repoUrl&&!Z&&!$.repositoryId)throw Error(`Could not recognise the repository URL: ${$.repoUrl}`);return{repositoryId:$.repositoryId,ref:Z,connectionId:$.connectionId}}var ZO,oL8="No credential for this repository \u2014 link it in Settings \u2192 Repositories";var _21=L(()=>{t4();ZO={repositoryId:C21.string().optional().describe("Connected repository (REPOSITORY_LINK) to act on"),repoUrl:C21.string().optional().describe("Any URL of the repository \u2014 its provider and host are read from it"),connectionId:C21.string().optional().describe("Legacy: a repo-scoped mcp-github connection in this org")}});import{z as IF}from"zod";var v21;var aL8=L(()=>{v0();K7();_21();v21=t({name:"REPOSITORY_SEARCH_BRANCHES",description:"Search a repository's branches by a case-insensitive substring of the branch name, filtered server-side by the provider.",annotations:{title:"Search Repository Branches",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:IF.object({...ZO,query:IF.string().describe("Substring to match against branch names. Empty returns the first branches alphabetically."),limit:IF.number().int().min(1).max(100).default(30),cursor:IF.string().nullish().describe("Opaque cursor from a previous call's `nextCursor`, to read the next window")}),outputSchema:IF.object({branches:IF.array(IF.object({name:IF.string(),author:IF.string().nullable()})),totalCount:IF.number(),nextCursor:IF.string().nullable()}),handler:async($,Z)=>{await Z.access.check();let Q=Z.organization?.id;if(!Q)throw Error("Organization context required");return(await LH1(Z,Q,Ob0($))).searchBranches({query:$.query,limit:$.limit,cursor:$.cursor})}})});import{z as k$}from"zod";function sL8($){let{credentialConnectionId:Z,installationAuthorizedBy:Q,installationRepositoryIds:X,...Y}=$,J=nW1($);return{...Y,servable:J===null,accessIssue:J}}function d90($){let{legacyConnectionId:Z,...Q}=$;return Q}async function x21($,Z,Q){let X=await $.storage.gitProviderAccounts.get(Q,Z);if(!X)throw Error("Git account not found");return X}var TQ5,rL8,eL8,$D8,ZD8,QD8,XD8,YD8,JD8,GD8,KD8,WD8;var HD8=L(()=>{X40();t4();tL8();v0();K7();aL8();TQ5=k$.object({ref:iv$,externalId:k$.string(),defaultBranch:k$.string().nullable(),webUrl:k$.string(),visibility:k$.enum(["public","private","internal"]),description:k$.string().nullable(),updatedAt:k$.string().nullable()}),rL8=pv$.extend({servable:k$.boolean(),accessIssue:k$.enum(["revoked","provider_unavailable","installation_missing","authorization_required","no_repositories"]).nullable(),connectedBy:k$.object({name:k$.string()}).nullable()});eL8=t({name:"GIT_PROVIDER_CAPABILITIES",description:"Which git providers this deployment can connect through Studio-owned credentials, and the URLs that start each connect flow.",annotations:{title:"Git provider capabilities",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({}),outputSchema:k$.object({github:k$.object({configured:k$.boolean(),cliConnectPath:k$.string().nullable(),connectPath:k$.string().nullable(),installPath:k$.string().nullable()}),gitlab:k$.object({oauthHosts:k$.array(k$.string()),connectPath:k$.string().nullable()}),bitbucket:k$.object({oauthHosts:k$.array(k$.string()),connectPath:k$.string().nullable()})}),handler:async($,Z)=>{r(Z);let Q=W0(Z),X=`/api/${Q.slug??Q.id}/git-providers`,Y=tD0(),J=Y.github.configured,G=Y.github.cli;return{github:{configured:J||G,cliConnectPath:G?`${X}/github/cli/connect`:null,connectPath:J?`${X}/github/connect`:null,installPath:J?`${X}/github/install`:null},gitlab:{oauthHosts:Y.gitlab.hosts,connectPath:Y.gitlab.configured?`${X}/gitlab/connect`:null},bitbucket:{oauthHosts:Y.bitbucket.hosts,connectPath:Y.bitbucket.configured?`${X}/bitbucket/connect`:null}}}}),$D8=t({name:"GIT_ACCOUNT_LIST",description:"List the git provider accounts connected to this organization.",annotations:{title:"List git accounts",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({}),outputSchema:k$.object({accounts:k$.array(rL8)}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z);return{accounts:(await Z.storage.gitProviderAccounts.listByOrg(Q.id)).map(sL8)}}}),ZD8=t({name:"GIT_ACCOUNT_CONNECT_TOKEN",description:"Connect a git provider account with an access token: a GitLab personal, project or group token, or a Bitbucket Cloud repository, project or workspace access token. Bitbucket also needs the workspace slug, because an access token cannot name itself. Validates the token against the provider before storing it encrypted. Prefer this over OAuth when the account should only reach a subset of repositories: a scoped token is narrowed by the provider, an OAuth grant reaches everything its user can.",annotations:{title:"Connect git account with a token",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({type:p$0.describe("Provider; gitlab and bitbucket accept tokens (GitHub connects through the App)"),host:k$.string().min(1).describe("Provider host, e.g. gitlab.com, gitlab.acme.com or bitbucket.org"),token:k$.string().min(1).describe("Access token with api scope"),workspace:k$.string().min(1).optional().describe("Bitbucket workspace slug the token belongs to. Required for Bitbucket: an access token cannot name itself, and the workspace is what Studio verifies it against.")}),outputSchema:k$.object({account:rL8}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z),X=$.host.trim().toLowerCase();if(!/^[a-z0-9.-]+(:[0-9]+)?$/.test(X))throw Error("host must be a bare hostname, optionally with a port");let Y=$.workspace?.trim().toLowerCase();if($.type==="bitbucket"&&!Y)throw Error("Connecting Bitbucket with a token needs the workspace slug the token belongs to");let J=await gg$($.type,X,$.token,Y),G=await Z.storage.gitProviderAccounts.upsert({organizationId:Q.id,type:$.type,host:X,authKind:"token",externalAccountId:J.externalAccountId,login:J.login,avatarUrl:J.avatarUrl,createdBy:n0(Z)??null});return await Z.storage.gitProviderAccountCredentials.upsert({connectionId:G.id,accessToken:$.token,refreshToken:null,scope:null,expiresAt:null,clientId:null,clientSecret:null,tokenEndpoint:null}),{account:sL8(G)}}}),QD8=t({name:"GIT_ACCOUNT_DELETE",description:"Disconnect a git provider account. Its repositories stay linked but lose credentials (they become anonymous clones) until linked to another account.",annotations:{title:"Disconnect git account",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({id:k$.string()}),outputSchema:k$.object({deleted:k$.boolean()}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z);return{deleted:await Z.storage.gitProviderAccounts.delete($.id,Q.id)}}}),XD8=t({name:"REPOSITORY_LIST",description:"List the repositories linked to this organization.",annotations:{title:"List repositories",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({accountId:k$.string().optional().describe("Only repositories of this account")}),outputSchema:k$.object({repositories:k$.array(n$0.extend({usable:k$.boolean()}))}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z),X=await Z.storage.repositories.listByOrg(Q.id,{accountId:$.accountId}),Y=await Xz(Z,Q.id),J=new Set(Y.map((G)=>G.webUrl.toLowerCase()));return{repositories:X.map((G)=>({...d90(G),usable:J.has(G.webUrl.toLowerCase())}))}}}),YD8=t({name:"REPOSITORY_SEARCH",description:"Search the repositories an account can reach on its provider (not yet linked). Feeds the repository picker.",annotations:{title:"Search provider repositories",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({accountId:k$.string(),query:k$.string().optional(),page:k$.number().int().min(1).optional(),perPage:k$.number().int().min(1).max(100).optional()}),outputSchema:k$.object({repositories:k$.array(TQ5),hasMore:k$.boolean()}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z),X=await x21(Z,Q.id,$.accountId);return wN({db:Z.db,vault:Z.vault},X).listRepos({query:$.query,page:$.page,perPage:$.perPage})}}),JD8=t({name:"REPOSITORY_LINK",description:"Link a repository to the organization. With an account, the repository is verified against the provider and its facts (id, default branch, visibility) recorded; without one it is linked as an anonymous public clone.",annotations:{title:"Link repository",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({url:k$.string().min(1).describe("Repository URL (https or ssh), or a bare path like owner/name when accountId is given"),accountId:k$.string().optional().describe("Account whose credentials access the repository")}),outputSchema:k$.object({repository:n$0}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z),X=n0(Z)??null;if(!$.accountId){let H=cX($.url);if(!H)throw Error("Could not recognise the repository URL. Use a full https URL from GitHub, GitLab or Bitbucket.");let F=await Z.storage.repositories.upsert({organizationId:Q.id,ref:H,createdBy:X});return{repository:d90(F)}}let Y=await x21(Z,Q.id,$.accountId),J=cX($.url,{provider:Y.type,host:Y.host});if(!J)throw Error("Could not recognise the repository URL or path");if(J.host!==Y.host)throw Error(`Repository is on ${J.host} but the account is on ${Y.host}`);let K=await wN({db:Z.db,vault:Z.vault},Y).getRepo(J);if(!K)throw Error(`${J.path} was not found on ${J.host} or the account cannot access it`);let W=await Z.storage.repositories.upsert({organizationId:Q.id,ref:K.ref,accountId:Y.id,externalId:K.externalId,defaultBranch:K.defaultBranch,visibility:K.visibility,createdBy:X});return{repository:d90(W)}}}),GD8=t({name:"REPOSITORY_CREATE_FROM_TEMPLATE",description:"Create a new private GitHub repository for a site from one of the site templates, owned by the account's user or organization, and link it to the organization.",annotations:{title:"Create repository from template",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({accountId:k$.string().describe("GitHub account whose user or organization owns the repository"),name:nL8.describe("Name of the new repository"),template:iL8}),outputSchema:k$.object({repository:n$0}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z),X=await x21(Z,Q.id,$.accountId),Y=wN({db:Z.db,vault:Z.vault},X);if(!Y.createRepoFromTemplate)throw Error("Sites can only be created in a GitHub account");let J=await Y.createRepoFromTemplate({template:pL8($.template).repo,owner:X.login,name:$.name,private:!0});if(X.installationRepositoryIds)await Z.storage.gitProviderAccounts.grantRepository(X.id,Q.id,Number(J.externalId));let G=await Z.storage.repositories.upsert({organizationId:Q.id,ref:J.ref,accountId:X.id,externalId:J.externalId,defaultBranch:J.defaultBranch,visibility:J.visibility,createdBy:n0(Z)??null});return{repository:d90(G)}}}),KD8=t({name:"REPOSITORY_UPDATE",description:"Change a linked repository's settings. Currently the sandbox image its sandboxes boot from: `default`, or the name of a variant the cluster renders (e.g. `android`, for mobile apps an agent should run on an Android emulator). A variant the cluster lacks degrades to `default`.",annotations:{title:"Update repository",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({id:k$.string(),sandboxImage:YN}),outputSchema:k$.object({repository:n$0}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z),X=await Z.storage.repositories.setSandboxImage($.id,Q.id,$.sandboxImage);if(!X)throw Error("Repository not found");return{repository:d90(X)}}}),WD8=t({name:"REPOSITORY_DELETE",description:"Unlink a repository from the organization. Agents, tasks and syncs that referenced it keep working off their legacy metadata until relinked.",annotations:{title:"Unlink repository",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:"app"}},inputSchema:k$.object({id:k$.string()}),outputSchema:k$.object({deleted:k$.boolean()}),handler:async($,Z)=>{r(Z),await Z.access.check();let Q=W0(Z);return{deleted:await Z.storage.repositories.delete($.id,Q.id)}}})});import{z as S$}from"zod";async function Ut($,Z){let Q=$.organization?.id;if(!Q)throw Error("Organization context required");let X=await Q40($,Q,Ob0(Z));if(!X)throw Error(oL8);return X}var RQ5,qQ5,wb0,MQ5,FD8,UD8,ND8,BD8,LD8,DD8;var OD8=L(()=>{v0();K7();_21();RQ5=S$.object({id:S$.string().nullable(),name:S$.string(),state:S$.enum(["queued","running","completed"]),conclusion:S$.enum(["success","failure","neutral","cancelled","skipped","timed_out","action_required"]).nullable(),url:S$.string().nullable(),durationMs:S$.number().nullable(),summary:S$.string().nullable()}),qQ5=S$.object({id:S$.string(),author:S$.string(),body:S$.string(),createdAt:S$.string(),updatedAt:S$.string(),url:S$.string()}),wb0=S$.object({number:S$.number(),url:S$.string(),title:S$.string(),body:S$.string(),state:S$.enum(["open","closed","merged"]),draft:S$.boolean(),mergedAt:S$.string().nullable(),base:S$.string(),head:S$.string(),headSha:S$.string(),headRepoPath:S$.string().nullable(),author:S$.string(),conflicting:S$.boolean().nullable(),checks:S$.enum(["pending","passing","failing"]).nullable(),changedFiles:S$.number().nullable()}),MQ5=wb0.extend({checkRuns:S$.array(RQ5),comments:S$.array(qQ5),unresolvedConversations:S$.number(),reviewBlocked:S$.boolean()}),FD8=t({name:"CHANGE_REQUEST_STATE",description:"Read a branch's change request with its CI runs, review state and comments.",annotations:{title:"Read Change Request State",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:S$.object({...ZO,branch:S$.string().describe("Head branch of the change request to read")}),outputSchema:S$.object({changeRequest:MQ5.nullable()}),handler:async($,Z)=>{return await Z.access.check(),{changeRequest:await(await Ut(Z,$)).readDetailed({branch:$.branch})}}}),UD8=t({name:"CHANGE_REQUEST_LAST_MERGED",description:"Read the most recently merged change request into a base branch \u2014 in Fast Preview, the last publish.",annotations:{title:"Read Last Merged Change Request",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:S$.object({...ZO,base:S$.string().describe("Branch it was merged into")}),outputSchema:S$.object({changeRequest:wb0.nullable()}),handler:async($,Z)=>{return await Z.access.check(),{changeRequest:await(await Ut(Z,$)).lastMergedInto($.base)}}}),ND8=t({name:"CHANGE_REQUEST_LIST_OPEN",description:"List a repository's open change requests, most recently updated first.",annotations:{title:"List Open Change Requests",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:S$.object({...ZO,limit:S$.number().int().min(1).max(100).default(50)}),outputSchema:S$.object({changeRequests:S$.array(wb0)}),handler:async($,Z)=>{return await Z.access.check(),{changeRequests:await(await Ut(Z,$)).listOpen($.limit)}}}),BD8=t({name:"CHANGE_REQUEST_CHECK_LOG",description:"Read one CI run's report \u2014 a GitHub check run's output markdown, or the tail of a GitLab job's trace. Bitbucket commit statuses carry no report, so this answers nothing there.",annotations:{title:"Read CI Run Report",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:S$.object({...ZO,checkId:S$.string().describe("Provider id of the run, from its listing")}),outputSchema:S$.object({report:S$.string().nullable()}),handler:async($,Z)=>{return await Z.access.check(),{report:await(await Ut(Z,$)).readCheckLog($.checkId)}}}),LD8=t({name:"CHANGE_REQUEST_OPEN",description:"Propose a branch onto another. Returns the branch's existing change request instead of failing when it already has one.",annotations:{title:"Open Change Request",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:S$.object({...ZO,head:S$.string().describe("Branch being proposed"),base:S$.string().describe("Branch it should land on"),title:S$.string(),body:S$.string().optional()}),outputSchema:S$.object({changeRequest:wb0,existed:S$.boolean()}),handler:async($,Z)=>{await Z.access.check();let Q=await Ut(Z,$),X=await Q.readForBranch($.head);if(X&&X.state==="open"){if($.body&&$.body!==X.body)await Q.describe(X.number,$.body);return{changeRequest:$.body?{...X,body:$.body}:X,existed:!0}}return{changeRequest:await Q.open({head:$.head,base:$.base,title:$.title,body:$.body}),existed:!1}}}),DD8=t({name:"CHANGE_REQUEST_MERGE",description:"Land a change request. Reports why it could not merge rather than throwing.",annotations:{title:"Merge Change Request",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},_meta:{ui:{visibility:"app"}},inputSchema:S$.object({...ZO,number:S$.number().int().positive(),strategy:S$.enum(["any","squash"]).default("any").describe("`squash` when the result must be one commit; `any` uses whatever the repository allows"),commitTitle:S$.string().optional(),commitMessage:S$.string().optional()}),outputSchema:S$.object({merged:S$.boolean(),reason:S$.enum(["conflict","blocked","rate_limited","not_found","error"]).optional(),detail:S$.string().optional()}),handler:async($,Z)=>{await Z.access.check();let X=await(await Ut(Z,$)).merge($.number,{strategy:$.strategy,commitTitle:$.commitTitle,commitMessage:$.commitMessage});return X.merged?{merged:!0}:{merged:!1,reason:X.reason,detail:X.detail}}})});import{z as L6}from"zod";function jb0($){if(!$)return"";return typeof $==="string"?$:$.toISOString()}function f21($){let Z=$.trim();return Z.length>0?Z:void 0}function b21($,Z){return $===void 0||$.includes(Z)}var VQ5,kQ5,SQ5,CQ5,_Q5,vQ5,xQ5,y21;var wD8=L(()=>{v0();AC0();VQ5=["thread","task","connection"],kQ5=L6.object({type:L6.literal("thread"),id:L6.string(),title:L6.string(),created_at:L6.string(),updated_at:L6.string(),virtual_mcp_id:L6.string().nullable(),run_config:L6.record(L6.string(),L6.unknown()).nullable(),status:L6.string().nullable()}),SQ5=L6.object({type:L6.literal("task"),id:L6.string(),title:L6.string(),created_at:L6.string(),updated_at:L6.string(),key:L6.string().nullable(),status:L6.string().nullable(),repo:L6.string().nullable()}),CQ5=L6.object({type:L6.literal("connection"),id:L6.string(),title:L6.string(),icon:L6.string().nullable(),slug:L6.string().nullable()}),_Q5=L6.discriminatedUnion("type",[kQ5,SQ5,CQ5]),vQ5=L6.object({query:L6.string().max(256).describe("Free-text search query. Empty string returns the most recently updated resources."),limit:L6.number().int().min(1).max(50).optional().describe("Maximum results per resource type (default: 20)."),types:L6.array(L6.enum(VQ5)).optional().describe("Restrict the search to specific resource types. Omit to search across all available types.")}),xQ5=L6.object({items:L6.array(_Q5),totalCount:L6.number()});y21=t({name:"GLOBAL_SEARCH",description:"Search across organization resources by free-text query. Returns a typed union of matches (currently: threads, task-board cards and MCP connections). New resource types may be added over time without changes to the call shape.",annotations:{title:"Global Search",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:vQ5,outputSchema:xQ5,handler:async($,Z)=>{await Z.access.check();let Q=W0(Z),X=$.limit??20,Y=b21($.types,"thread"),J=b21($.types,"task"),G=b21($.types,"connection"),K=[],W=0,[H,F,U]=await Promise.all([Y?Z.storage.threads.list(void 0,{limit:X,offset:0,search:f21($.query),includeArchived:!1}):null,J?Z.storage.taskBoard.searchByTitle(Q.id,f21($.query)??"",X):null,G?Z.storage.connections.searchByTitle(Q.id,f21($.query)??"",X):null]);if(H){W+=H.total;for(let N of H.threads)K.push({type:"thread",id:N.id,title:N.title??"",created_at:jb0(N.created_at),updated_at:jb0(N.updated_at),virtual_mcp_id:N.virtual_mcp_id??null,run_config:N.run_config??null,status:OW(N).status})}if(F){W+=F.length;for(let N of F)K.push({type:"task",id:N.id,title:N.title??"",created_at:jb0(N.createdAt),updated_at:jb0(N.updatedAt),key:Q.slug?up(Q.slug,N.keySeq):null,status:N.status??null,repo:N.repo??null})}if(U){W+=U.length;for(let N of U)K.push({type:"connection",id:N.id,title:N.title,icon:N.icon??null,slug:N.slug??null})}return{items:K,totalCount:W}}})});var jD8=L(()=>{wD8()});var ED8=60;function o3($){return I8(async()=>{let{object:Z}=await qz($);return{object:Z}},{maxAttempts:3,minTimeout:300,isRetriable:(Z)=>$Y.isInstance(Z)})}var jh=L(()=>{u4();F8()});import{z as KJ}from"zod";var Nt,VF;var Bt=L(()=>{Nt=KJ.object({name:KJ.string().describe("Short phrase naming the rule \u2014 what it is about, not the rule"),value:KJ.string().describe("The rule itself, as markdown. One or two paragraphs; use a bullet list only when there are genuinely several cases. No heading \u2014 the name is the heading.")}),VF=KJ.object({companyName:KJ.string().describe("The store or brand name. Look for the name that recurs across page titles, block `name` props, and post bodies \u2014 not a product or category name."),description:KJ.string().describe("What the company sells and who it sells to, 1-3 sentences. Look at the home and institutional pages."),language:KJ.string().describe("BCP-47 tag of the language the prose itself is written in, e.g. pt-BR. Read the post bodies, not any locale config."),tone:KJ.string().describe("Tone of voice, described so another writer could reproduce it: how the reader is addressed (which pronoun, which person), sentence length, humor, jargon level, formality, and casing conventions. Read the longest run of real prose you can find \u2014 post bodies if they exist, otherwise page copy and meta descriptions."),targetAudience:KJ.string().describe("Who reads this brand's content and what they came looking for. Infer from who the copy addresses and what it assumes the reader already cares about. Say so plainly rather than reaching for marketing personas."),values:KJ.array(Nt).describe("Brand values the content should carry, as the brand itself states them. `name` is the value ('Biodiversidade brasileira'), `value` explains what the copy actually claims and the evidence for it \u2014 stated numbers, sourcing commitments. Prefer a value the copy argues for over a generic virtue like 'quality' or 'innovation'."),dos:KJ.array(Nt).describe("Instructions a blogpost writer must follow for this brand, derived from patterns the copy consistently follows. `name` names the rule ('Abertura do post'), `value` is the imperative instruction \u2014 instructions, not adjectives: 'Open with the customer's problem, never with the company' beats 'customer-focused'. Any brand-specific word for an ordinary thing gets its own rule, quoted in the brand's language \u2014 for a Portuguese site, \"chame a sacola de 'mochila', nunca de 'carrinho'\"."),avoid:KJ.array(Nt).describe("Things a blogpost writer must not do \u2014 banned words, claims, formats, topics. `name` names the guardrail, `value` states the prohibition and why the copy suggests it. Derive them from what the copy consistently never does and from claims the brand is visibly careful about. Do not restate a `dos` entry inverted."),categories:KJ.array(KJ.string()).describe("Content categories that fit this brand's blog, as plain names \u2014 this is a taxonomy, not a rule, so no body. Take existing category blocks first; with no blog, derive them from the themes the site's own pages keep returning to. Editorial subjects, not the product taxonomy."),competitors:KJ.array(Nt).describe("Competitors named explicitly in the content. A brand rarely names them in its own copy \u2014 return an empty array unless a name is actually there, and never guess from the market segment. When one is named, `name` is the competitor and `value` is what the content says about it.")})});import{z as JB}from"zod";async function uQ5($,Z,Q){if(!Q.companyName.trim())return[];let X=await rX($,"web_search");if(!X)return[];try{let Y=await $.aiProviders.activate(X.credentialId,Z),{text:J}=await CN({model:Y.aiSdk.languageModel(X.modelId),prompt:`Who are the main competitors of ${Q.companyName}? Context on the company: ${Q.description}
5402
5402
 
5403
5403
  For each competitor, say how it positions itself and how it differs from ${Q.companyName}. Name only companies you can actually source. Search in the brand's own market and language (${Q.language||"unknown"}) \u2014 local competitors matter more than global ones.`});if(!J.trim())return[];let G=await S6($,"smart"),K=await $.aiProviders.activate(G.credentialId,Z),{object:W}=await o3({model:K.aiSdk.languageModel(G.modelId),schema:hQ5,system:gQ5,prompt:`Brand: ${Q.companyName}
5404
5404
  Write the values in: ${Q.language||"the brand's own language"}