decocms 4.429.4 → 4.429.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 (352) hide show
  1. package/dist/client/assets/{AlertCircle-CsnluVGx.js → AlertCircle-CXwWyjWL.js} +1 -1
  2. package/dist/client/assets/{AreaChart-C5NeH00U.js → AreaChart-CWnwFPGD.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-C0DFEkSG.js → ArrowLeft-DYnQbYxF.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-Cg3T6c8U.js → ArrowRight-C4e8QGnK.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-BrWIe8FE.js → ArrowUp-BiYv-XbK.js} +1 -1
  6. package/dist/client/assets/{CartesianChart-CxpQ2jZl.js → CartesianChart-BGE8uJq6.js} +1 -1
  7. package/dist/client/assets/{Check-Bt1XL9OZ.js → Check-C8M8v3vI.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-Bj2BODXk.js → CheckCircle-jESFBkr7.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-Bi1dRl0F.js → ChevronUp-Q2TBgNib.js} +1 -1
  10. package/dist/client/assets/{Copy01-lLzDCXmN.js → Copy01-CaF9W1F_.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-C_LphuIk.js → CreditCard01-Czi8bh9o.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-CaPsIQcQ.js → DotsVertical-DyDeVQCx.js} +1 -1
  13. package/dist/client/assets/{ErrorBarContext-CFw85c1d.js → ErrorBarContext-D4BkOvp5.js} +1 -1
  14. package/dist/client/assets/{Image01-FUpltNPw.js → Image01-CsDdVFAJ.js} +1 -1
  15. package/dist/client/assets/{Key01-CslrU_s2.js → Key01-D2FR3CbZ.js} +1 -1
  16. package/dist/client/assets/{Line-BphA32Yd.js → Line-BfgHJMc3.js} +1 -1
  17. package/dist/client/assets/{Link01-CKWZapoo.js → Link01-NjQr5iwv.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-3O41jdXy.js → LinkExternal01-CR1925bA.js} +1 -1
  19. package/dist/client/assets/{Monitor01-CB2SD1gN.js → Monitor01-50nhII2F.js} +1 -1
  20. package/dist/client/assets/{Palette-BVtHs2vU.js → Palette-AyH3xXYO.js} +1 -1
  21. package/dist/client/assets/{Plus-DJ-W3_cM.js → Plus-DP7AHtKt.js} +1 -1
  22. package/dist/client/assets/{SearchMd-B27FMXMV.js → SearchMd-D_KPqWqZ.js} +1 -1
  23. package/dist/client/assets/{Sector-CwkxI8qP.js → Sector-BR7_Ijx1.js} +1 -1
  24. package/dist/client/assets/{ShoppingBag01-BTl-krF7.js → ShoppingBag01-Dq4UD5Hm.js} +1 -1
  25. package/dist/client/assets/{Sun-CUnE0uf1.js → Sun-oSoDHq1v.js} +1 -1
  26. package/dist/client/assets/{Tool01-EwUUkOdA.js → Tool01-D2y7RTX1.js} +1 -1
  27. package/dist/client/assets/{Trash01-CvSUykct.js → Trash01-64yehlfB.js} +1 -1
  28. package/dist/client/assets/{Upload01-DWr4g8OT.js → Upload01-BvgQ3r-o.js} +1 -1
  29. package/dist/client/assets/{User01-DsrGZ98W.js → User01-CU3qbr5s.js} +1 -1
  30. package/dist/client/assets/{UserSquare-B8RPwEBF.js → UserSquare-nGw6lX43.js} +1 -1
  31. package/dist/client/assets/{Users01-65_1ZPG4.js → Users01-Lf2fvOej.js} +1 -1
  32. package/dist/client/assets/{X-Ccy7mqMZ.js → X-NPE_cXRR.js} +1 -1
  33. package/dist/client/assets/{XAxis-DP41Cjj9.js → XAxis-Drv4sXya.js} +1 -1
  34. package/dist/client/assets/{XClose-CTgT8nLL.js → XClose-CMTvfCel.js} +1 -1
  35. package/dist/client/assets/{ZoomOut-DKLrc0AX.js → ZoomOut-xQj4oorm.js} +1 -1
  36. package/dist/client/assets/{access-gate-CLQyj1tq.js → access-gate-DRBSlBtJ.js} +1 -1
  37. package/dist/client/assets/add-connection-dialog-DHl4H43e.js +1 -0
  38. package/dist/client/assets/{agent-analytics-C9Wxe5WJ.js → agent-analytics-RDv7d0ta.js} +1 -1
  39. package/dist/client/assets/agent-app-BMOs_YKU.js +1 -0
  40. package/dist/client/assets/{agent-assets-B0EEKaMD.js → agent-assets-QMTortLS.js} +1 -1
  41. package/dist/client/assets/{agent-automation-DMF4y0Om.js → agent-automation-kP7qIZSD.js} +1 -1
  42. package/dist/client/assets/{agent-automations-CvyiOCkB.js → agent-automations-D5AIE6G6.js} +1 -1
  43. package/dist/client/assets/{agent-connect-sources-BImgc7Bd.js → agent-connect-sources-1UnRN6mW.js} +1 -1
  44. package/dist/client/assets/agent-deck-9_2F3EG2.js +1 -0
  45. package/dist/client/assets/{agent-e2e-3f9yGWUZ.js → agent-e2e-DEc1NtfK.js} +1 -1
  46. package/dist/client/assets/{agent-experiments-D1O6cKwR.js → agent-experiments-D33dFCpI.js} +1 -1
  47. package/dist/client/assets/{agent-file-CSjOLC2Q.js → agent-file-DxlwynYZ.js} +1 -1
  48. package/dist/client/assets/{agent-git-Cv3j2qtb.js → agent-git-DVn4DsKt.js} +1 -1
  49. package/dist/client/assets/{agent-hosting-DHLBLYo5.js → agent-hosting-CgiR8Ql4.js} +1 -1
  50. package/dist/client/assets/{agent-icon-B9NBzFRl.js → agent-icon-TQUkqPJj.js} +1 -1
  51. package/dist/client/assets/agent-library-BoJuDeBh.js +1 -0
  52. package/dist/client/assets/agent-library-file-Dyz9u3bt.js +1 -0
  53. package/dist/client/assets/{agent-monitor-B1BSWqcD.js → agent-monitor-DgcF05B9.js} +1 -1
  54. package/dist/client/assets/{agent-overview-DMjDaFOx.js → agent-overview-dLl0w1eM.js} +1 -1
  55. package/dist/client/assets/agent-settings-MQLrMTV8.js +1 -0
  56. package/dist/client/assets/{agent-site-editor-CtaOvGD3.js → agent-site-editor-ITnkleU1.js} +1 -1
  57. package/dist/client/assets/agent-site-editor-code-D4dXTr1f.js +2 -0
  58. package/dist/client/assets/{agent-site-editor-content-C95AguXy.js → agent-site-editor-content-CNFJoRJD.js} +3 -3
  59. package/dist/client/assets/{agent-site-editor-preview-BCmkz7Ty.js → agent-site-editor-preview-CNLkTYYB.js} +3 -3
  60. package/dist/client/assets/agent-view-CfCVRWZl.js +1 -0
  61. package/dist/client/assets/{agent-view-guard-3xukNQiu.js → agent-view-guard-BbHyaShN.js} +1 -1
  62. package/dist/client/assets/{agents-list-DAaf4Mi5.js → agents-list-D9hihWFU.js} +1 -1
  63. package/dist/client/assets/{ai-providers-B5J9hlgx.js → ai-providers-oyOl9W3y.js} +1 -1
  64. package/dist/client/assets/{alert-CeGoXJox.js → alert-CokNymqA.js} +1 -1
  65. package/dist/client/assets/{alert-dialog-nydIJdPH.js → alert-dialog-DeJgSFRZ.js} +1 -1
  66. package/dist/client/assets/{analytics-sections-DciswvIy.js → analytics-sections-DDWh8YnS.js} +1 -1
  67. package/dist/client/assets/{api-keys-BAiXWtmH.js → api-keys-Ch7q_sOP.js} +1 -1
  68. package/dist/client/assets/api-keys-DLiRLY55.js +1 -0
  69. package/dist/client/assets/{app-editor-DP2IqOM6.js → app-editor-BhWLpri1.js} +1 -1
  70. package/dist/client/assets/{asset-utils-DHzPaDW1.js → asset-utils-BRk3fUR7.js} +1 -1
  71. package/dist/client/assets/{auth-DA7glj38.js → auth-BNR-bSJO.js} +1 -1
  72. package/dist/client/assets/{auth-catchall-ByYjTbWh.js → auth-catchall-CJ0eRklU.js} +1 -1
  73. package/dist/client/assets/{auth-entry-CYA5MXOV.js → auth-entry-XcfUUozZ.js} +1 -1
  74. package/dist/client/assets/{auth-split-layout-Jnq9j5HW.js → auth-split-layout-mYNIGFvp.js} +1 -1
  75. package/dist/client/assets/{authenticate-and-persist-oauth-CDhCKuA8.js → authenticate-and-persist-oauth-CZrI0wkU.js} +1 -1
  76. package/dist/client/assets/{automation-list-row-DB8v2PyO.js → automation-list-row-DfLOPauj.js} +1 -1
  77. package/dist/client/assets/{automation-runs-BPgX-uCi.js → automation-runs-RuvSYlk2.js} +1 -1
  78. package/dist/client/assets/{automations-siBOu-F5.js → automations-CQh_fULy.js} +1 -1
  79. package/dist/client/assets/{autosend-CPHdbo-0.js → autosend-h1h21hnM.js} +1 -1
  80. package/dist/client/assets/{avatar-CqsfnSHy.js → avatar-UFbMnkmr.js} +1 -1
  81. package/dist/client/assets/{badge-DAgPG-f0.js → badge-DzTxW-Ts.js} +1 -1
  82. package/dist/client/assets/{block-document-CjBjHCND.js → block-document-hxIwEIoN.js} +1 -1
  83. package/dist/client/assets/{blocks-preview-workspace-context-C31YGOfs.js → blocks-preview-workspace-context-DRl7lMaq.js} +1 -1
  84. package/dist/client/assets/{buckets-C3My6XtJ.js → buckets-B-CYwdgC.js} +1 -1
  85. package/dist/client/assets/{build-improve-prompt-doc-Do4e762u.js → build-improve-prompt-doc-DNmtsTJk.js} +1 -1
  86. package/dist/client/assets/{calendar-B7qg5owI.js → calendar-Bx26MiuJ.js} +1 -1
  87. package/dist/client/assets/{capability-load-error-1FL5H8Lu.js → capability-load-error-BWTOxRLG.js} +1 -1
  88. package/dist/client/assets/{category-editor-B57aQ27B.js → category-editor-DjdC64aL.js} +1 -1
  89. package/dist/client/assets/{chart-2dmUQZnn.js → chart-BxpZzVsr.js} +1 -1
  90. package/dist/client/assets/{chat-context-DlsYLkGJ.js → chat-context-DppIIhzA.js} +1 -1
  91. package/dist/client/assets/{chat-draft-BRjVow7g.js → chat-draft-DiJpqitX.js} +1 -1
  92. package/dist/client/assets/{checkbox-BTUE4SPp.js → checkbox-BGfnFNv1.js} +1 -1
  93. package/dist/client/assets/{choose-editor-CL5ENJjq.js → choose-editor-DHwWSJiW.js} +1 -1
  94. package/dist/client/assets/{claim-phase-copy-Bafau5vI.js → claim-phase-copy-BRgB3yX1.js} +1 -1
  95. package/dist/client/assets/{cli-auth-success--cIEBBck.js → cli-auth-success-BX3DQOO5.js} +1 -1
  96. package/dist/client/assets/{client-icons-Cq_yGfeD.js → client-icons-CYZ83j__.js} +1 -1
  97. package/dist/client/assets/{collapsible-B14ZTqF0.js → collapsible-C2j127TD.js} +1 -1
  98. package/dist/client/assets/{collection-detail-CjDKm-Ja.js → collection-detail-ehNX3PLY.js} +1 -1
  99. package/dist/client/assets/{collection-display-button-czskr6KY.js → collection-display-button-CwIm419d.js} +1 -1
  100. package/dist/client/assets/{collection-search-CfrCGB2I.js → collection-search-D_azi8Gq.js} +1 -1
  101. package/dist/client/assets/{collection-table-wrapper-BDBioyTK.js → collection-table-wrapper-DMU9yWMT.js} +1 -1
  102. package/dist/client/assets/{collection-tabs-DCEsfKpk.js → collection-tabs-C6N84gCC.js} +1 -1
  103. package/dist/client/assets/{combobox-CSMKu-4J.js → combobox--XWfS5lw.js} +1 -1
  104. package/dist/client/assets/{command-1GDLg60A.js → command-D1RoIxg2.js} +1 -1
  105. package/dist/client/assets/{companion-mcps-section-C_twJCDq.js → companion-mcps-section-Cs-LBxQr.js} +1 -1
  106. package/dist/client/assets/{config-9vd9dHPj.js → config-CMMAnMUF.js} +1 -1
  107. package/dist/client/assets/{connect-D4lU18ry.js → connect-DVE1Hnuy.js} +1 -1
  108. package/dist/client/assets/{connect-layout-SPr19DgY.js → connect-layout--NwWaqYw.js} +1 -1
  109. package/dist/client/assets/{connection-CO5JzyBf.js → connection-Ds6vwkGM.js} +1 -1
  110. package/dist/client/assets/{connection-card-BgD62s7i.js → connection-card-BPKFHpho.js} +1 -1
  111. package/dist/client/assets/{connection-detail-DnXBnw2I.js → connection-detail-BroJMnyc.js} +1 -1
  112. package/dist/client/assets/{connection-form-helpers-Ddtw1f6y.js → connection-form-helpers-C4OB4j_3.js} +1 -1
  113. package/dist/client/assets/{connections-BqkP75Y7.js → connections-DG2GlCvy.js} +1 -1
  114. package/dist/client/assets/{context-C4yaZPbY.js → context-BL1LKuLQ.js} +1 -1
  115. package/dist/client/assets/{context-menu-Cse8aI2i.js → context-menu-CBJP1RfU.js} +1 -1
  116. package/dist/client/assets/{create-organization-dialog-BR0Vxj8W.js → create-organization-dialog-BQ0I0t_j.js} +1 -1
  117. package/dist/client/assets/{daily-pulse-FhqnjDwB.js → daily-pulse-Dpp9pCbq.js} +1 -1
  118. package/dist/client/assets/{decopilot-D_xEyFfg.js → decopilot-BRlhj2Gw.js} +1 -1
  119. package/dist/client/assets/{dialog-Bvq22AZH.js → dialog-Mg_Z3ES1.js} +1 -1
  120. package/dist/client/assets/{discover-ax70JDSI.js → discover-DCHf1gBE.js} +1 -1
  121. package/dist/client/assets/{domain-settings-BcZo-0Ge.js → domain-settings-CmoTC2Mj.js} +1 -1
  122. package/dist/client/assets/{download-app-dialog-dA0AkV4L.js → download-app-dialog-B7zcmkcH.js} +1 -1
  123. package/dist/client/assets/{drawer-XX6hq0xe.js → drawer-BIoKJwCW.js} +1 -1
  124. package/dist/client/assets/{editor-CeAQ3Rze.js → editor-JpZ1gWwV.js} +1 -1
  125. package/dist/client/assets/{empty-state-CdGiHDyj.js → empty-state-BayRP7H4.js} +1 -1
  126. package/dist/client/assets/{empty-state-CKjPjErp.js → empty-state-BmztM-Bo.js} +1 -1
  127. package/dist/client/assets/{extract-connection-data-C5i3LFcd.js → extract-connection-data-D5wjQBt3.js} +1 -1
  128. package/dist/client/assets/{feature-gate-Bz53dyQH.js → feature-gate-DvQXfI5S.js} +1 -1
  129. package/dist/client/assets/{feature-paywall-DXOmuGN9.js → feature-paywall-sc2LtOXc.js} +1 -1
  130. package/dist/client/assets/{file-explorer-CiHpmQeg.js → file-explorer-CqjD-skS.js} +1 -1
  131. package/dist/client/assets/{file-preview-D5cDixM_.js → file-preview-VfWoS2gk.js} +1 -1
  132. package/dist/client/assets/{file-share-button-BkuqjC-p.js → file-share-button-BGOzbmtb.js} +1 -1
  133. package/dist/client/assets/{file-type-icon-DKJoVWit.js → file-type-icon-BhiPdwxi.js} +1 -1
  134. package/dist/client/assets/flat-project-wkNYEFlO.js +1 -0
  135. package/dist/client/assets/{folder-icon-DeJ_4vBF.js → folder-icon-DBIJdeY7.js} +1 -1
  136. package/dist/client/assets/{form-DeiW8V1T.js → form-BgAERq-t.js} +1 -1
  137. package/dist/client/assets/{gateway-client-uRieKdKv.js → gateway-client-CIbTMjGx.js} +1 -1
  138. package/dist/client/assets/{general-CU8ONF_3.js → general-BBuB4XlH.js} +1 -1
  139. package/dist/client/assets/{home-DzDH2rsn.js → home-C96-FMPc.js} +1 -1
  140. package/dist/client/assets/{icon-button-DB3NNAY8.js → icon-button-CWL5E4Ua.js} +1 -1
  141. package/dist/client/assets/{index-DaRlcMLg.js → index-2-Z1VD2F.js} +1 -1
  142. package/dist/client/assets/{index-v7dN0kvl.js → index-B0WfPFpv.js} +1 -1
  143. package/dist/client/assets/{index-C95CzY3C.js → index-B9dD9jj0.js} +4 -4
  144. package/dist/client/assets/{index-DnaVeM3s.js → index-BZOsa8jC.js} +1 -1
  145. package/dist/client/assets/{index-Bf-cXXgi.js → index-Bv71AEH5.js} +1 -1
  146. package/dist/client/assets/{index-_cYAL9g5.js → index-CORXJXSN.js} +1 -1
  147. package/dist/client/assets/{index-DHp7ZGYh.js → index-CpszPQp_.js} +1 -1
  148. package/dist/client/assets/{index-BV8ofAzV.js → index-DL-sDqTO.js} +1 -1
  149. package/dist/client/assets/{index-0Q1deNIS.js → index-DR9ob9os.js} +1 -1
  150. package/dist/client/assets/{index-D5dEpLnc.js → index-DWe-6mCD.js} +1 -1
  151. package/dist/client/assets/{index-BAMmb9m3.js → index-ROw_u5-U.js} +1 -1
  152. package/dist/client/assets/{index-C9xjia7y.js → index-RYaP6qX3.js} +3 -3
  153. package/dist/client/assets/{index-Drb30CpZ.js → index-r8TBLtcZ.js} +1 -1
  154. package/dist/client/assets/{index-redirect-DclOFuEc.js → index-redirect-DN5m0MeF.js} +1 -1
  155. package/dist/client/assets/{index-BpIX5zJy.js → index-v5QvptSB.js} +1 -1
  156. package/dist/client/assets/{index-CBzFtxdS.js → index-vYawqXRD.js} +1 -1
  157. package/dist/client/assets/{infiniteQueryObserver-Cqc8H9Zl.js → infiniteQueryObserver-Ex2lNjjr.js} +1 -1
  158. package/dist/client/assets/{infra-billing-1OBJjuQ-.js → infra-billing-BvYXN3Z1.js} +1 -1
  159. package/dist/client/assets/{input-D0VdvVQu.js → input-BZloVZ72.js} +3 -3
  160. package/dist/client/assets/{input-CzYAG_im.js → input-BmzPGvUi.js} +1 -1
  161. package/dist/client/assets/{input-BfBrXJza.js → input-Cndqm_5O.js} +1 -1
  162. package/dist/client/assets/{integration-icon-w9_wzNNP.js → integration-icon-C5NBXdpz.js} +1 -1
  163. package/dist/client/assets/{label-DZ5OXqqj.js → label-DpahMcEo.js} +1 -1
  164. package/dist/client/assets/{last-preview-page-CWajJMK8.js → last-preview-page-Dfux_ulA.js} +1 -1
  165. package/dist/client/assets/{layout-9_q6a5YB.js → layout-C6k3EFd1.js} +1 -1
  166. package/dist/client/assets/{legacy-agents-deep-CLPL3Mpg.js → legacy-agents-deep-B_DiKZ0c.js} +1 -1
  167. package/dist/client/assets/{legacy-main-redirect-TVPN8oSv.js → legacy-main-redirect-BgIGaynA.js} +1 -1
  168. package/dist/client/assets/library-D6flTj5t.js +1 -0
  169. package/dist/client/assets/{library-tab-DJf8qPe0.js → library-tab-Bso2C2NG.js} +1 -1
  170. package/dist/client/assets/{login-ubx4IGz6.js → login-CXuSqosI.js} +1 -1
  171. package/dist/client/assets/{markdown-GDF3SJOy.js → markdown-D8U5yexH.js} +1 -1
  172. package/dist/client/assets/{mcp-app-renderer-BtXqphZ9.js → mcp-app-renderer-CWOIFfi6.js} +1 -1
  173. package/dist/client/assets/{mcp-oauth-Cb0VYgbB.js → mcp-oauth-DCDrWVc0.js} +1 -1
  174. package/dist/client/assets/{members-Bge8MTFI.js → members-BfRC0ceX.js} +1 -1
  175. package/dist/client/assets/{message-templates-qwkqPfKZ.js → message-templates-DgOMle6a.js} +1 -1
  176. package/dist/client/assets/{mini-report-page-Dp6XKOO1.js → mini-report-page-BIktJNbh.js} +1 -1
  177. package/dist/client/assets/{mock-board-eEbVN77o.js → mock-board-DjQ6xrU_.js} +1 -1
  178. package/dist/client/assets/{monaco-editor-DXiGiHeM.js → monaco-editor-BRUSLTLk.js} +1 -1
  179. package/dist/client/assets/{monitoring-stats-row-Bf7tQNvd.js → monitoring-stats-row-C4bB2YFf.js} +1 -1
  180. package/dist/client/assets/{multi-select-DYCju49A.js → multi-select-6bm7qEEn.js} +1 -1
  181. package/dist/client/assets/{mustache-CsZqlbfC.js → mustache-CAmcva4T.js} +1 -1
  182. package/dist/client/assets/{new-project-dialog-BVqw_nCp.js → new-project-dialog-BejzbVG2.js} +1 -1
  183. package/dist/client/assets/{oauth-callback-DztIcMBf.js → oauth-callback-0bxicPCo.js} +1 -1
  184. package/dist/client/assets/{oauth-callback-ai-provider-AHTcJ0zb.js → oauth-callback-ai-provider-D4kx59om.js} +1 -1
  185. package/dist/client/assets/{onboarding-CZE7_cx0.js → onboarding-C7mIZXvc.js} +1 -1
  186. package/dist/client/assets/{openai-conversation-wUKP0KI1.js → openai-conversation-DYPzWsQc.js} +1 -1
  187. package/dist/client/assets/{optimistic-project-sidebar-views-DoS1B88-.js → optimistic-project-sidebar-views-DHo7EiTm.js} +1 -1
  188. package/dist/client/assets/{org-file-open-context-wUzs-3_m.js → org-file-open-context-CSDcMwBD.js} +1 -1
  189. package/dist/client/assets/{organization-choice-C1O1ljWb.js → organization-choice-BZ-4C5a6.js} +1 -1
  190. package/dist/client/assets/{orgs-D_--9-SG.js → orgs-DnEd_o3Y.js} +1 -1
  191. package/dist/client/assets/{page-seo-form-B2EYpR7K.js → page-seo-form-BjAunJ7T.js} +1 -1
  192. package/dist/client/assets/{pair-BlA_exbo.js → pair-o8Pcow3m.js} +1 -1
  193. package/dist/client/assets/{plan-ladder-k9eV0Dld.js → plan-ladder-COYrpP9N.js} +1 -1
  194. package/dist/client/assets/{popover-Dxmyu-b_.js → popover-D5s3M61L.js} +1 -1
  195. package/dist/client/assets/{post-calendar-BORBN9Sn.js → post-calendar-Cl-vAwk3.js} +1 -1
  196. package/dist/client/assets/{post-editor-BF1SoTKx.js → post-editor-D2HU9kfD.js} +1 -1
  197. package/dist/client/assets/{preview-content-BETQ4GLk.js → preview-content-B9bgsNRh.js} +1 -1
  198. package/dist/client/assets/{preview-dialog-sAmHyR0a.js → preview-dialog-CwQ43Y6v.js} +1 -1
  199. package/dist/client/assets/{profile-D5UUKV90.js → profile-BB1G47uY.js} +1 -1
  200. package/dist/client/assets/{project-app-view-CisH6g4D.js → project-app-view-DS-jWTJh.js} +1 -1
  201. package/dist/client/assets/{project-feed-CDpUTVHU.js → project-feed-Ceha3l-R.js} +1 -1
  202. package/dist/client/assets/{project-icon-Bo-jeNxy.js → project-icon-CmV-Y1UZ.js} +1 -1
  203. package/dist/client/assets/project-reports-M4OcQRnq.js +1 -0
  204. package/dist/client/assets/project-tasks-D2UK5JuX.js +1 -0
  205. package/dist/client/assets/{projects-C1D-1AdZ.js → projects-Cv5osXsD.js} +1 -1
  206. package/dist/client/assets/{projects-empty-state-CPkdHRjG.js → projects-empty-state-CaTjevnb.js} +1 -1
  207. package/dist/client/assets/{prompts-DRogfwCM.js → prompts-BgUtk3zC.js} +1 -1
  208. package/dist/client/assets/record-editor-C0G9mTGj.js +1 -0
  209. package/dist/client/assets/{redirect-editor-C4k0wpB3.js → redirect-editor-BpclUTIj.js} +1 -1
  210. package/dist/client/assets/{reports-ClKG3e_O.js → reports-CLznlgS5.js} +1 -1
  211. package/dist/client/assets/reports-cbjIbfxK.js +1 -0
  212. package/dist/client/assets/{reports-onboarding-Dq9y_yRB.js → reports-onboarding-BHCXUocU.js} +1 -1
  213. package/dist/client/assets/{reports-tab-B9xl5ktg.js → reports-tab-CoZHZlVb.js} +2 -2
  214. package/dist/client/assets/{repositories-BImrR5du.js → repositories-DoauYKeu.js} +1 -1
  215. package/dist/client/assets/{repository-binding-Czcp88Ek.js → repository-binding-DzrKIMc8.js} +1 -1
  216. package/dist/client/assets/{repository-import-picker-CULajLJp.js → repository-import-picker-CVP1mN_O.js} +1 -1
  217. package/dist/client/assets/{repository-picker-B-UdqnSa.js → repository-picker-BIkrH86Z.js} +1 -1
  218. package/dist/client/assets/{require-capability-CqMIdAS-.js → require-capability-CEGMzsiO.js} +1 -1
  219. package/dist/client/assets/{required-auth-layout-CbXz4N5t.js → required-auth-layout-BPzqc-yZ.js} +1 -1
  220. package/dist/client/assets/{reset-password-B1LiYTbr.js → reset-password-CC9lxhEO.js} +1 -1
  221. package/dist/client/assets/{resizable-7gm_IBrS.js → resizable-Ck9CN4S9.js} +1 -1
  222. package/dist/client/assets/{resolve-tab-icon-DTC7b4Bc.js → resolve-tab-icon-CgOUF0YA.js} +1 -1
  223. package/dist/client/assets/{review-settings-C5wsuE4d.js → review-settings-cCLUF68J.js} +1 -1
  224. package/dist/client/assets/{rich-text-link-control-CoTPcMfG.js → rich-text-link-control-RS2mJIfp.js} +1 -1
  225. package/dist/client/assets/{roles-CMFMpqfB.js → roles-DWD7cz1d.js} +1 -1
  226. package/dist/client/assets/{route-BuPz_ueu.js → route-CjKIfVgB.js} +1 -1
  227. package/dist/client/assets/{route-BusV7X7j.js → route-DI4K2hiz.js} +1 -1
  228. package/dist/client/assets/route-n8gaWLVb.js +1 -0
  229. package/dist/client/assets/{runnable-block-editor-Bou39s6j.js → runnable-block-editor-h-xGxUBS.js} +1 -1
  230. package/dist/client/assets/{sandbox-lifecycle-context-BJgEd1XY.js → sandbox-lifecycle-context-OPdARg4I.js} +1 -1
  231. package/dist/client/assets/{schema-ClJOB7M6.js → schema-BejaMrNT.js} +1 -1
  232. package/dist/client/assets/{scroll-area-xr5K9HEx.js → scroll-area-DjfgE2jb.js} +1 -1
  233. package/dist/client/assets/{search-input-DQYXD4BL.js → search-input-DviARBm2.js} +1 -1
  234. package/dist/client/assets/{search-toggle-gcLaltAJ.js → search-toggle-DvOTtKmA.js} +1 -1
  235. package/dist/client/assets/{secret-picker-BNTi35Xa.js → secret-picker-CuEw2DSI.js} +1 -1
  236. package/dist/client/assets/{secrets-CVSqY8p4.js → secrets-CoVAIKwE.js} +1 -1
  237. package/dist/client/assets/{sections-editor-DEZ5WUCt.js → sections-editor-CsNiIfgn.js} +1 -1
  238. package/dist/client/assets/{select-pVe0_Bqt.js → select-Cd1ykg-h.js} +1 -1
  239. package/dist/client/assets/{select-model-DwrumK80.js → select-model-a344Xqu_.js} +1 -1
  240. package/dist/client/assets/{seo-editor-BmdnbOsw.js → seo-editor-D4_b59uB.js} +1 -1
  241. package/dist/client/assets/{separator-BPAhL_Ij.js → separator-Ch977YA1.js} +1 -1
  242. package/dist/client/assets/{settings-tab-BIOZHtto.js → settings-tab-sWmscvB1.js} +1 -1
  243. package/dist/client/assets/{sheet-DD4zrgIp.js → sheet-lggFYx6M.js} +1 -1
  244. package/dist/client/assets/shell-layout-Bl8of89A.js +1 -0
  245. package/dist/client/assets/{skills-BXrtiv9s.js → skills-CzJ783Zp.js} +1 -1
  246. package/dist/client/assets/{sso-ua1OcLrx.js → sso-DKlO8_Lq.js} +1 -1
  247. package/dist/client/assets/{suggestion-DKqlkt9S.js → suggestion-K--t6EP5.js} +1 -1
  248. package/dist/client/assets/{switch-fa5Y0oMN.js → switch-BLWgY1pz.js} +1 -1
  249. package/dist/client/assets/{synced-repos-Cl-5WTlE.js → synced-repos-BnWEHPVF.js} +1 -1
  250. package/dist/client/assets/{tab-icon-glyph-CpVLHF8O.js → tab-icon-glyph-C_bZ6WrZ.js} +1 -1
  251. package/dist/client/assets/{table-BrephWG_.js → table-CufJwyXQ.js} +1 -1
  252. package/dist/client/assets/{tabs-DvOBS__-.js → tabs-C1zPDoUI.js} +1 -1
  253. package/dist/client/assets/{task-board-DC2or4R3.js → task-board-DlEJAtdm.js} +1 -1
  254. package/dist/client/assets/{task-route-BErEZvY5.js → task-route-z_uMrYh2.js} +1 -1
  255. package/dist/client/assets/{task-status-DlLNPIjB.js → task-status-DrVr4O9O.js} +1 -1
  256. package/dist/client/assets/{taskboard-analytics-BsaDZQbf.js → taskboard-analytics-BEIixlIh.js} +1 -1
  257. package/dist/client/assets/{tasks-CrNGIxtX.js → tasks-CpEABx-G.js} +1 -1
  258. package/dist/client/assets/tasks-l5i1Y6YC.js +1 -0
  259. package/dist/client/assets/{textarea-CAQNCfpp.js → textarea-r66bOcCD.js} +1 -1
  260. package/dist/client/assets/{thread-analytics-YipT0TYV.js → thread-analytics-BmowQF8I.js} +1 -1
  261. package/dist/client/assets/{thread-intent-C_0JzN_O.js → thread-intent-UQGFcX_y.js} +1 -1
  262. package/dist/client/assets/{thread-route-O3hSghFZ.js → thread-route-CVz2UKe8.js} +1 -1
  263. package/dist/client/assets/{thread-route-D30ezW1U.js → thread-route-CowkfwAl.js} +1 -1
  264. package/dist/client/assets/{thread-sheet-body-DD7ZVtVM.js → thread-sheet-body-CxW1uZ8Z.js} +1 -1
  265. package/dist/client/assets/{toggle-group-tCcvTcRv.js → toggle-group-BQtHqwCK.js} +1 -1
  266. package/dist/client/assets/{toolbar-icon-button-9n2J-wcp.js → toolbar-icon-button-B4QTn-IO.js} +1 -1
  267. package/dist/client/assets/{tooltip-DdjGQobT.js → tooltip-CM3YyNDC.js} +1 -1
  268. package/dist/client/assets/{track-HoeQbmP5.js → track-BqJ0I7ao.js} +1 -1
  269. package/dist/client/assets/{types-Ckn1MlKU.js → types-DyM6In73.js} +1 -1
  270. package/dist/client/assets/{usage-stats-rrSlTrKo.js → usage-stats-5Vc6zWOp.js} +1 -1
  271. package/dist/client/assets/{use-ai-providers-CKzmzfvw.js → use-ai-providers-C98JaJAU.js} +1 -1
  272. package/dist/client/assets/{use-automations-Djzogwmx.js → use-automations-CqbCGltu.js} +1 -1
  273. package/dist/client/assets/{use-autosave-BTs_Zvgi.js → use-autosave-tzZy_E8d.js} +1 -1
  274. package/dist/client/assets/{use-chat-layout-state-B6s2JkCt.js → use-chat-layout-state-BfZJHnkW.js} +1 -1
  275. package/dist/client/assets/{use-connect-companion-CoFLerH1.js → use-connect-companion-DfiphJ3V.js} +1 -1
  276. package/dist/client/assets/{use-connection-C-kBQ3D-.js → use-connection-BdSGHKJK.js} +1 -1
  277. package/dist/client/assets/{use-copy-Qg7bi8zx.js → use-copy-CiP5Vy7i.js} +1 -1
  278. package/dist/client/assets/{use-create-virtual-mcp-DEvwRMMK.js → use-create-virtual-mcp-CoU2LYN8.js} +1 -1
  279. package/dist/client/assets/{use-date-fns-locale-KEOSZSCW.js → use-date-fns-locale-BQIR67dY.js} +1 -1
  280. package/dist/client/assets/{use-debounced-autosave-M6eg3Y4O.js → use-debounced-autosave-6IETzqNZ.js} +1 -1
  281. package/dist/client/assets/{use-debounced-value-f1u1JXjY.js → use-debounced-value-DCYhoWzs.js} +1 -1
  282. package/dist/client/assets/{use-deco-credits-zES9MtHY.js → use-deco-credits-x58AfrXU.js} +1 -1
  283. package/dist/client/assets/{use-decopilot-events-CT-KDwdn.js → use-decopilot-events-BZQXzmAo.js} +1 -1
  284. package/dist/client/assets/{use-delete-connection-DZ7crG9-.js → use-delete-connection-CzvLG4mr.js} +1 -1
  285. package/dist/client/assets/{use-deployment-admin-BeTjWkAK.js → use-deployment-admin-BmH0eskZ.js} +1 -1
  286. package/dist/client/assets/{use-fast-preview-draft-url-COMCpHrX.js → use-fast-preview-draft-url-DFL8djh0.js} +1 -1
  287. package/dist/client/assets/{use-file-configs-pdZuotlv.js → use-file-configs-DRP3Y7X_.js} +1 -1
  288. package/dist/client/assets/{use-infinite-scroll-DnGD1R8b.js → use-infinite-scroll-BjVQV3DR.js} +1 -1
  289. package/dist/client/assets/{use-join-requests-BEGCihjr.js → use-join-requests-B6dqmlCQ.js} +1 -1
  290. package/dist/client/assets/{use-main-panel-tabs-Bpkxmz8h.js → use-main-panel-tabs-sy9nYCqA.js} +1 -1
  291. package/dist/client/assets/{use-mcp-auth-status-DLCr3Kqf.js → use-mcp-auth-status-Cjd2QrWU.js} +1 -1
  292. package/dist/client/assets/{use-mcp-client-BBZSxs6C.js → use-mcp-client-CqsHeShn.js} +1 -1
  293. package/dist/client/assets/{use-mcp-prompts-H_Vokl6u.js → use-mcp-prompts-D2YpCb1K.js} +1 -1
  294. package/dist/client/assets/{use-mcp-tools-Cg0wIfyk.js → use-mcp-tools-CHvaFbLg.js} +1 -1
  295. package/dist/client/assets/{use-members-DKCQ0oPO.js → use-members-BIhBY7mT.js} +1 -1
  296. package/dist/client/assets/{use-mobile-DbgNrrqI.js → use-mobile-3MM_rw4D.js} +1 -1
  297. package/dist/client/assets/{use-navigate-to-agent-Dun0QU31.js → use-navigate-to-agent-PjEm7mol.js} +1 -1
  298. package/dist/client/assets/use-new-blocks-editor-BAZ5qlTk.js +1 -0
  299. package/dist/client/assets/{use-open-billing-url-BmquHyqj.js → use-open-billing-url-CVEaCqtR.js} +1 -1
  300. package/dist/client/assets/{use-org-auth-client-6HmmNabp.js → use-org-auth-client-DM3Q5_fm.js} +1 -1
  301. package/dist/client/assets/{use-org-fs-CxttG7Pt.js → use-org-fs-DazA0BMP.js} +1 -1
  302. package/dist/client/assets/{use-org-repo-syncs-D5HIk-ZZ.js → use-org-repo-syncs-DGjVBBAK.js} +1 -1
  303. package/dist/client/assets/{use-org-sso-BX4qCh7f.js → use-org-sso-DGy0uwEN.js} +1 -1
  304. package/dist/client/assets/{use-organization-roles-DU2y95r1.js → use-organization-roles-Bjw-G0xx.js} +1 -1
  305. package/dist/client/assets/{use-organization-settings-xVkX8dA1.js → use-organization-settings-DbPbYeMx.js} +1 -1
  306. package/dist/client/assets/{use-panel-navigate-CApSLLZU.js → use-panel-navigate-DH6_TAsx.js} +1 -1
  307. package/dist/client/assets/{use-project-scope-Dyp4qS88.js → use-project-scope-Bgnjdhs7.js} +1 -1
  308. package/dist/client/assets/{use-releases-DEoc2p-o.js → use-releases-DQGDjOy5.js} +1 -1
  309. package/dist/client/assets/{use-reports-diagnostic-8Wf5_klp.js → use-reports-diagnostic-BASyyQU9.js} +1 -1
  310. package/dist/client/assets/{use-secrets-CUhYMZ9x.js → use-secrets-B41nk4LH.js} +1 -1
  311. package/dist/client/assets/{use-section-preview-base-yqXj5fei.js → use-section-preview-base-DKahorN-.js} +1 -1
  312. package/dist/client/assets/{use-session-runtime-CLgEdkpj.js → use-session-runtime-CsLaMszW.js} +1 -1
  313. package/dist/client/assets/{use-tags-CKb_jCnx.js → use-tags-BQ9peM4A.js} +1 -1
  314. package/dist/client/assets/{use-task-board-analytics-ColxOhDZ.js → use-task-board-analytics-Co6FjpoI.js} +1 -1
  315. package/dist/client/assets/{use-task-board-events-CbvOWdwS.js → use-task-board-events-BsviWCWn.js} +1 -1
  316. package/dist/client/assets/{use-task-metadata-BPDOVDpN.js → use-task-metadata-DvgRil5z.js} +1 -1
  317. package/dist/client/assets/{use-thread-analytics-BZ_Fi9zH.js → use-thread-analytics-Bf4bUeLT.js} +1 -1
  318. package/dist/client/assets/{use-thread-outputs-Dhes5ji5.js → use-thread-outputs-CvWfZHjR.js} +1 -1
  319. package/dist/client/assets/useInfiniteQuery-TQWsreUe.js +1 -0
  320. package/dist/client/assets/{useQueries-Dod3Msoc.js → useQueries-CIVnwtOu.js} +1 -1
  321. package/dist/client/assets/useSuspenseInfiniteQuery-DMyZCSsI.js +1 -0
  322. package/dist/client/assets/{users-D6Guq03K.js → users-2Adoo8D9.js} +1 -1
  323. package/dist/client/assets/{utils-p81_LpHp.js → utils-BeoNvR__.js} +1 -1
  324. package/dist/client/assets/{variant-calendar-Bl3Gfrjw.js → variant-calendar-C6HvphcB.js} +1 -1
  325. package/dist/client/assets/{variant-matcher-override-N87qA3jA.js → variant-matcher-override-De1zsqbc.js} +1 -1
  326. package/dist/client/assets/{view-mode-toggle-YzkFzhAw.js → view-mode-toggle-DtqPFP6s.js} +1 -1
  327. package/dist/client/assets/{virtual-mcp-C_6-jZH0.js → virtual-mcp-Cr9A-Wo0.js} +1 -1
  328. package/dist/client/index.html +1 -1
  329. package/dist/server/cli.js +3 -3
  330. package/dist/server/server.js +3 -3
  331. package/package.json +1 -1
  332. package/dist/client/assets/add-connection-dialog-BDmVVdAH.js +0 -1
  333. package/dist/client/assets/agent-app-Bz1gHurO.js +0 -1
  334. package/dist/client/assets/agent-deck-TlnGkppx.js +0 -1
  335. package/dist/client/assets/agent-library-DK5SHk03.js +0 -1
  336. package/dist/client/assets/agent-library-file-n_1fTyDg.js +0 -1
  337. package/dist/client/assets/agent-settings-ftLczm87.js +0 -1
  338. package/dist/client/assets/agent-site-editor-code-CGv8jkJ-.js +0 -2
  339. package/dist/client/assets/agent-view-DXgW378L.js +0 -1
  340. package/dist/client/assets/api-keys-B_z5NdV5.js +0 -1
  341. package/dist/client/assets/flat-project-fHTyql_b.js +0 -1
  342. package/dist/client/assets/library-Bfu2cwxp.js +0 -1
  343. package/dist/client/assets/project-reports-foqi6O3G.js +0 -1
  344. package/dist/client/assets/project-tasks-BxEPOlxu.js +0 -1
  345. package/dist/client/assets/record-editor-CICwwkmm.js +0 -1
  346. package/dist/client/assets/reports-BCTdFJMv.js +0 -1
  347. package/dist/client/assets/route-CZeuStCH.js +0 -1
  348. package/dist/client/assets/shell-layout-Cwzef2Ue.js +0 -1
  349. package/dist/client/assets/tasks-dS4cuBwI.js +0 -1
  350. package/dist/client/assets/use-new-blocks-editor-CLe9Kg_9.js +0 -1
  351. package/dist/client/assets/useInfiniteQuery-LLjBr47W.js +0 -1
  352. package/dist/client/assets/useSuspenseInfiniteQuery-ePGI4U5j.js +0 -1
@@ -1 +1 @@
1
- import{au as t,av as e,aK as l,bM as a,bK as s,bL as o,cU as c,bN as d,e9 as I,cW as A,bO as v}from"./index-C95CzY3C.js";const g=t({connection_id:e().describe("Connection ID"),selected_tools:a(e()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:a(e()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:a(e()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),u=500,w=200,R=200,k=20,_=50,U=100,E=20,P=100,C=50,T=100,N=8192,y=g.extend({selected_tools:a(e()).max(u).nullable().optional().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:a(e()).max(u).nullable().optional().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:a(e()).max(u).nullable().optional().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),V=t({connectionId:e(),toolName:e(),label:e(),icon:e().nullable().optional()}),O=t({id:e().describe("Stable id; used as React key and ?tab= value"),title:e().describe("Tab label"),icon:e().optional().describe("Optional lucide icon name"),view:t({type:c("ext-app"),appId:e(),args:d(e(),v()).optional()})}),S=o(["overview","reports","board","site-editor","assets","hosting","e2e","analytics","cdn","automations","experiments"]),oe=o(["on","off"]),D=new Map([["manual","on"],["auto","on"]]),L=o(["on","off","manual","auto"]);function X(n){if(!n)return null;const i=D.get(n);return i||(n==="on"||n==="off"?n:null)}const F=t({defaultMainView:t({type:e(),id:e().optional(),toolName:e().optional()}).nullable().optional(),chatDefaultOpen:s().nullable().optional(),cmsDefaultOpen:s().nullable().optional(),cms:L.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),sidebarViews:a(S).max(10).nullable().optional().describe("Deprecated layout-scoped sidebar selections. Read only as a fallback when metadata.sidebarViews is absent."),tabs:a(O).max(E).optional()});function se(n){return X(n?.cms)??"on"}function le(n,i){const r=i==="off"&&n?.defaultMainView?.type==="content";return{...n,cms:i,cmsDefaultOpen:null,...r?{defaultMainView:{type:"site-editor"}}:{}}}const h=t({tileId:e().optional(),connectionId:e().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:e().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:e().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:d(e(),v()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:l().int().positive().optional(),maxHeight:l().int().positive().optional()}),B=t({banner:e().nullable().optional(),bannerColor:e().nullable().optional(),icon:e().nullable().optional(),themeColor:e().nullable().optional(),pinnedViews:a(V).max(U).nullable().optional(),layout:F.nullable().optional(),homeTile:h.nullable().optional(),homeTiles:a(h).max(k).nullable().optional(),homePrompts:a(e()).max(_).nullable().optional()}),H=/^[A-Za-z_][A-Za-z0-9_]*$/,f=e().min(1).regex(H,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),K=A("kind",[t({key:f,kind:c("literal"),value:e().max(N)}),t({key:f,kind:c("secret"),secretId:e().min(1)})]),j=t({selected:e().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:e().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:e().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:a(K).max(T).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config.")}),z=t({url:e().describe("Repository URL, including its provider host"),owner:e().describe("Repository owner"),name:e().describe("Repository name"),installationId:l().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:e().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials."),repositoryId:e().optional().describe("First-class repository (REPOSITORY_LINK) backing this binding. When set, credentials come from the repository's git provider account rather than connectionId.")}),q=o(["agent-sandbox","local-api"]),G={sandboxHandle:e().describe("Provider-specific handle"),previewUrl:e().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:e().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:l().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:t({packageManager:e().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:e().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:e().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},M=t(G);function re(n){if(!n||typeof n!="object"||Array.isArray(n))return{};const i=n,r={};for(const[p,b]of Object.entries(i))if(!(!b||typeof b!="object")&&!(p!=="agent-sandbox"&&p!=="local-api"))try{r[p]=M.parse(b)}catch{}return r}const W=d(e().describe("userId"),d(e().describe("branch"),I(q,M))),Y=t({id:e().describe("Stable identifier for this knowledge file"),name:e().describe("File name shown in the UI"),kind:o(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:e().describe("Org filesystem (Library) volume the file lives in"),path:e().describe("Path within the volume"),url:e().describe("Same-origin URL to read the file (display/download)"),contentType:e().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:l().nullable().optional().describe("File size in bytes"),addedAt:e().describe("ISO timestamp when the file was attached")}),Z=a(Y).max(P).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),$=o(["smart","code-review","open"]),J=$.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),Q=s().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),ee=s().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),te=e().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),ae=t({branch:e().describe("Git branch backing this release"),name:e().describe('User-facing name, e.g. "Black Friday 2026"'),color:e().describe("Dot color token shown in the version switcher"),createdBy:e().optional().describe("User ID who created the release"),createdAt:e().optional().describe("ISO 8601 creation timestamp")}),ne=a(ae).max(C).nullable().optional().describe("Curated list of named, branch-backed releases shown in the version switcher. The base branch ('No ar') is derived, not stored here."),m={instructions:e().nullable().optional().describe("Instructions also used as system prompt"),subAgents:a(e()).max(R).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:e().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:B.nullable().optional().describe("UI customization settings"),sidebarViews:a(S).max(10).nullable().optional().describe("Project views selected for the sidebar. Interpret as an exact list when sidebarViewsVersion is 1; unversioned values use legacy native-only semantics. Runtime presence gates still apply."),sidebarViewsVersion:c(1).optional().describe("Version 1 marks metadata.sidebarViews as an exact list that can disable legacy default rows."),repository:z.nullable().optional().describe("Linked repository"),runtime:j.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:Z,siteSlug:e().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:J,previewServerUrl:te,productionUrl:e().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:s().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:Q,releases:ne,fastPreviewInPlace:ee},ce=t({id:e().describe("Unique identifier"),title:e().describe("Human-readable name"),description:e().nullable().describe("Description"),icon:e().nullable().describe("Icon URL"),created_at:e().describe("Creation timestamp"),updated_at:e().describe("Last update timestamp"),created_by:e().describe("User ID who created this item"),updated_by:e().optional().describe("User ID who last updated this item"),organization_id:e().describe("Organization ID this item belongs to"),status:o(["active","inactive"]).describe("Current status"),pinned:s().describe("Whether this space is pinned to the sidebar"),metadata:t(m).extend({instructions:e().nullable().describe("Instructions also used as system prompt"),sandboxMap:W.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:a(g).describe("Connections with their selected tools, resources, and prompts")}),x=t({title:e().min(1).max(120).describe("Short label shown on the chip"),description:e().max(280).optional().describe("One-line subtitle shown under the title"),text:e().min(1).max(4e3).describe("The message sent to the agent when the prompt is clicked")});t({title:e().min(1).max(255).describe("Name for the virtual MCP"),description:e().max(500).nullable().optional().describe("Optional description"),icon:e().nullish().describe("Optional icon URL"),status:o(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:s().optional().default(!1).describe("Pin to sidebar"),metadata:t(m).loose().superRefine((n,i)=>{"sandboxMap"in n&&i.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:a(y).max(w).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:a(x).max(20).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});t({title:e().min(1).max(255).optional().describe("New name"),description:e().max(500).nullable().optional().describe("New description (null to clear)"),icon:e().nullish().describe("New icon URL"),status:o(["active","inactive"]).optional().describe("New status"),pinned:s().optional().describe("Pin/unpin from sidebar"),metadata:t(m).loose().superRefine((n,i)=>{"sandboxMap"in n&&i.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:a(y).max(w).optional().describe("New connections (replaces existing)"),prompts:a(x).max(20).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});export{oe as C,H as E,C as R,ce as V,re as p,se as r,le as w};
1
+ import{au as t,av as e,aK as l,bM as a,bK as s,bL as o,cU as c,bN as d,e9 as I,cW as A,bO as v}from"./index-B9dD9jj0.js";const g=t({connection_id:e().describe("Connection ID"),selected_tools:a(e()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:a(e()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:a(e()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),u=500,w=200,R=200,k=20,_=50,U=100,E=20,P=100,C=50,T=100,N=8192,y=g.extend({selected_tools:a(e()).max(u).nullable().optional().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:a(e()).max(u).nullable().optional().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:a(e()).max(u).nullable().optional().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),V=t({connectionId:e(),toolName:e(),label:e(),icon:e().nullable().optional()}),O=t({id:e().describe("Stable id; used as React key and ?tab= value"),title:e().describe("Tab label"),icon:e().optional().describe("Optional lucide icon name"),view:t({type:c("ext-app"),appId:e(),args:d(e(),v()).optional()})}),S=o(["overview","reports","board","site-editor","assets","hosting","e2e","analytics","cdn","automations","experiments"]),oe=o(["on","off"]),D=new Map([["manual","on"],["auto","on"]]),L=o(["on","off","manual","auto"]);function X(n){if(!n)return null;const i=D.get(n);return i||(n==="on"||n==="off"?n:null)}const F=t({defaultMainView:t({type:e(),id:e().optional(),toolName:e().optional()}).nullable().optional(),chatDefaultOpen:s().nullable().optional(),cmsDefaultOpen:s().nullable().optional(),cms:L.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),sidebarViews:a(S).max(10).nullable().optional().describe("Deprecated layout-scoped sidebar selections. Read only as a fallback when metadata.sidebarViews is absent."),tabs:a(O).max(E).optional()});function se(n){return X(n?.cms)??"on"}function le(n,i){const r=i==="off"&&n?.defaultMainView?.type==="content";return{...n,cms:i,cmsDefaultOpen:null,...r?{defaultMainView:{type:"site-editor"}}:{}}}const h=t({tileId:e().optional(),connectionId:e().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:e().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:e().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:d(e(),v()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:l().int().positive().optional(),maxHeight:l().int().positive().optional()}),B=t({banner:e().nullable().optional(),bannerColor:e().nullable().optional(),icon:e().nullable().optional(),themeColor:e().nullable().optional(),pinnedViews:a(V).max(U).nullable().optional(),layout:F.nullable().optional(),homeTile:h.nullable().optional(),homeTiles:a(h).max(k).nullable().optional(),homePrompts:a(e()).max(_).nullable().optional()}),H=/^[A-Za-z_][A-Za-z0-9_]*$/,f=e().min(1).regex(H,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),K=A("kind",[t({key:f,kind:c("literal"),value:e().max(N)}),t({key:f,kind:c("secret"),secretId:e().min(1)})]),j=t({selected:e().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:e().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:e().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:a(K).max(T).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config.")}),z=t({url:e().describe("Repository URL, including its provider host"),owner:e().describe("Repository owner"),name:e().describe("Repository name"),installationId:l().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:e().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials."),repositoryId:e().optional().describe("First-class repository (REPOSITORY_LINK) backing this binding. When set, credentials come from the repository's git provider account rather than connectionId.")}),q=o(["agent-sandbox","local-api"]),G={sandboxHandle:e().describe("Provider-specific handle"),previewUrl:e().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:e().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:l().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:t({packageManager:e().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:e().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:e().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},M=t(G);function re(n){if(!n||typeof n!="object"||Array.isArray(n))return{};const i=n,r={};for(const[p,b]of Object.entries(i))if(!(!b||typeof b!="object")&&!(p!=="agent-sandbox"&&p!=="local-api"))try{r[p]=M.parse(b)}catch{}return r}const W=d(e().describe("userId"),d(e().describe("branch"),I(q,M))),Y=t({id:e().describe("Stable identifier for this knowledge file"),name:e().describe("File name shown in the UI"),kind:o(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:e().describe("Org filesystem (Library) volume the file lives in"),path:e().describe("Path within the volume"),url:e().describe("Same-origin URL to read the file (display/download)"),contentType:e().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:l().nullable().optional().describe("File size in bytes"),addedAt:e().describe("ISO timestamp when the file was attached")}),Z=a(Y).max(P).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),$=o(["smart","code-review","open"]),J=$.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),Q=s().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),ee=s().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),te=e().nullable().optional().describe("Preview server URL — the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),ae=t({branch:e().describe("Git branch backing this release"),name:e().describe('User-facing name, e.g. "Black Friday 2026"'),color:e().describe("Dot color token shown in the version switcher"),createdBy:e().optional().describe("User ID who created the release"),createdAt:e().optional().describe("ISO 8601 creation timestamp")}),ne=a(ae).max(C).nullable().optional().describe("Curated list of named, branch-backed releases shown in the version switcher. The base branch ('No ar') is derived, not stored here."),m={instructions:e().nullable().optional().describe("Instructions also used as system prompt"),subAgents:a(e()).max(R).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:e().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:B.nullable().optional().describe("UI customization settings"),sidebarViews:a(S).max(10).nullable().optional().describe("Project views selected for the sidebar. Interpret as an exact list when sidebarViewsVersion is 1; unversioned values use legacy native-only semantics. Runtime presence gates still apply."),sidebarViewsVersion:c(1).optional().describe("Version 1 marks metadata.sidebarViews as an exact list that can disable legacy default rows."),repository:z.nullable().optional().describe("Linked repository"),runtime:j.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:Z,siteSlug:e().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:J,previewServerUrl:te,productionUrl:e().nullable().optional().describe("Legacy key for previewServerUrl — still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:s().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:Q,releases:ne,fastPreviewInPlace:ee},ce=t({id:e().describe("Unique identifier"),title:e().describe("Human-readable name"),description:e().nullable().describe("Description"),icon:e().nullable().describe("Icon URL"),created_at:e().describe("Creation timestamp"),updated_at:e().describe("Last update timestamp"),created_by:e().describe("User ID who created this item"),updated_by:e().optional().describe("User ID who last updated this item"),organization_id:e().describe("Organization ID this item belongs to"),status:o(["active","inactive"]).describe("Current status"),pinned:s().describe("Whether this space is pinned to the sidebar"),metadata:t(m).extend({instructions:e().nullable().describe("Instructions also used as system prompt"),sandboxMap:W.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:a(g).describe("Connections with their selected tools, resources, and prompts")}),x=t({title:e().min(1).max(120).describe("Short label shown on the chip"),description:e().max(280).optional().describe("One-line subtitle shown under the title"),text:e().min(1).max(4e3).describe("The message sent to the agent when the prompt is clicked")});t({title:e().min(1).max(255).describe("Name for the virtual MCP"),description:e().max(500).nullable().optional().describe("Optional description"),icon:e().nullish().describe("Optional icon URL"),status:o(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:s().optional().default(!1).describe("Pin to sidebar"),metadata:t(m).loose().superRefine((n,i)=>{"sandboxMap"in n&&i.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:a(y).max(w).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:a(x).max(20).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});t({title:e().min(1).max(255).optional().describe("New name"),description:e().max(500).nullable().optional().describe("New description (null to clear)"),icon:e().nullish().describe("New icon URL"),status:o(["active","inactive"]).optional().describe("New status"),pinned:s().optional().describe("Pin/unpin from sidebar"),metadata:t(m).loose().superRefine((n,i)=>{"sandboxMap"in n&&i.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:a(y).max(w).optional().describe("New connections (replaces existing)"),prompts:a(x).max(20).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});export{oe as C,H as E,C as R,ce as V,re as p,se as r,le as w};
@@ -50,7 +50,7 @@
50
50
  <meta name="twitter:description" content="Hire specialized agents, give them access to your tools, and let them deliver real projects — with planning, verification, and observability built in." />
51
51
  <meta name="twitter:image" content="/og-image.png" />
52
52
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
53
- <script type="module" crossorigin src="/assets/index-C95CzY3C.js"></script>
53
+ <script type="module" crossorigin src="/assets/index-B9dD9jj0.js"></script>
54
54
  <link rel="stylesheet" crossorigin href="/assets/index-3gIKLZj9.css">
55
55
  </head>
56
56
  <body>
@@ -2178,7 +2178,7 @@ Usage: deco services <up|down|status>`),process.exit(1)}}var PZ$=L(()=>{uu()});f
2178
2178
  `.execute($);if(Number(K.rows[0]?.cnt)===0){console.warn(`Failed to migrate ${G}/${W}, keeping in old table`);continue}}await Bc`
2179
2179
  DELETE FROM kysely_migration WHERE name = ${Q}
2180
2180
  `.execute($)}}async function KG$($){await HO4($),await FO4($);let Z=new GG$({db:$,provider:{getMigrations:()=>Promise.resolve(i81)}}),{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 UO4($){let{keepOpen:Z=!1,database:Q,skipBetterAuth:X=!1}=$??{},Y="skipped";if(!X&&!Q)Y=await ns0();let J=Q??Z8(),G=async()=>{if(!Z&&!Q)await xj(J).catch((W)=>{console.warn("Warning: Error closing database:",W)})};try{let W=await KG$(J.db);return await G(),{betterAuth:Y,kysely:W}}catch(W){throw await G(),W}}async function NO4(){let $=Z8(),Z=new GG$({db:$.db,provider:{getMigrations:()=>Promise.resolve(i81)}}),{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 FG$=L(()=>{JG$();ts0();bQ()});async function KK0($){let Z={...process.env},Q=aQ0($,Z);console.log(A_1(Q.settings.encryptionKey));let X=Q.settings.betterAuthSecret||(Q.settings.localMode?e7$(Q.settings.dataDir):""),{ensureServices:Y}=await Promise.resolve().then(() => (KW0(),WW0)),{outputs:J,services:G}=await Y({home:Q.settings.dataDir,externalDatabaseUrl:Q.externalDatabaseUrl,externalNatsUrl:Q.externalNatsUrl});if(!Q.skipMigrations){let{migrateBetterAuth:K}=await Promise.resolve().then(() => (ts0(),ZQ$));await K(J.databaseUrl);let{createDatabase:H}=await Promise.resolve().then(() => (bQ(),j7$)),{migrateToLatest:F}=await Promise.resolve().then(() => (FG$(),HG$)),U=H(J.databaseUrl);await F({keepOpen:!0,database:U,skipBetterAuth:!0})}let W={...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 TZ$(W),{settings:W,services:G.map((K)=>({name:K.name==="PostgreSQL"?"Postgres":K.name,port:K.port})),managedServiceNames:G.filter((K)=>K.owner==="managed").map((K)=>K.name)}}var p81=L(()=>{uu();$Q$();X$()});var LG$={};J0(LG$,{updateService:()=>YT,subscribeCliState:()=>o81,setTuiConsoleIntercepted:()=>HK0,setServerUrl:()=>Rs,setMigrationsDone:()=>As,setDevMode:()=>LO4,resetCliStateForTests:()=>BO4,isTuiConsoleIntercepted:()=>FK0,getCliState:()=>t81,addLogEntry:()=>uj});function UG$(){return[{name:"Postgres",status:"pending",port:0},{name:"NATS",status:"pending",port:0}]}function NG$(){return{services:UG$(),migrationsStatus:"pending",serverUrl:null,logs:[]}}function BO4(){CJ=NG$()}function Ts(){for(let $ of n81)$()}function t81(){return CJ}function o81($){return n81.add($),()=>n81.delete($)}function YT($){CJ={...CJ,services:CJ.services.map((Z)=>Z.name===$.name?$:Z)},Ts()}function As(){CJ={...CJ,migrationsStatus:"done"},Ts()}function Rs($){CJ={...CJ,serverUrl:$},Ts()}function uj($){let Z=[...CJ.logs,$];CJ={...CJ,logs:Z.length>500?Z.slice(-500):Z},Ts()}function LO4(){CJ={...CJ,services:[...UG$(),{name:"API",status:"pending",port:0},{name:"Vite",status:"pending",port:0}]},Ts()}function HK0($){BG$=$}function FK0(){return BG$}var CJ,n81,BG$=!1;var JT=L(()=>{CJ=NG$();n81=new Set});import{createServer as DG$}from"net";function DO4($){return new Promise((Z)=>{let Q=DG$();Q.once("error",()=>Z(!1)),Q.listen($,"0.0.0.0",()=>{Q.close(()=>Z(!0))})})}async function qs($){if(await DO4($))return $;let Z=await new Promise((Q,X)=>{let Y=DG$();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 a81=()=>{};var s81={};J0(s81,{startDevServer:()=>jO4,pipeToLogStore:()=>r81});import{join as OO4}from"path";function r81($){let Z=$.getReader(),Q=new TextDecoder,X="";function Y(){let J=X.split(`
2181
- `);X=J.pop()??"";for(let G of J){let W=Bun.stripANSI(G).replace(/^\[\d+\]\s*/,"").trim();if(!W)continue;uj({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:W})}}(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)uj({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:J})}})()}async function jO4($){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 qs(Number(Y)+1):await qs(Number($.port)),{settings:W,services:K,managedServiceNames:H}=await KK0({port:String(G),home:$.home,baseUrl:$.baseUrl,localMode:$.localMode,skipMigrations:$.skipMigrations,noTui:$.noTui,vitePort:$.vitePort});for(let O of K)YT({name:O.name,status:"ready",port:O.port});As();let F=OO4(import.meta.dir,"..","..","..","..",".."),U=Q===!0,N=Bun.spawn(["bun","run","dev:servers"],{cwd:F,env:{...process.env,PORT:String(W.port),VITE_PORT:String(Y),DATABASE_URL:W.databaseUrl,NATS_URL:W.natsUrls.join(","),NODE_ENV:W.nodeEnv,BASE_URL:J,DECOCMS_LOCAL_MODE:String(W.localMode),DECOCMS_HOME:W.dataDir,DATA_DIR:W.dataDir,DECO_CLI:"1",...W.betterAuthSecret?{BETTER_AUTH_SECRET:W.betterAuthSecret}:{},...W.s3Endpoint?{S3_ENDPOINT:W.s3Endpoint,S3_BUCKET:W.s3Bucket??"",S3_ACCESS_KEY_ID:W.s3AccessKeyId??"",S3_SECRET_ACCESS_KEY:W.s3SecretAccessKey??"",S3_FORCE_PATH_STYLE:String(W.s3ForcePathStyle)}:{},...W.natsCredsPath?{NATS_CREDS:W.natsCredsPath}:{}},stdio:["inherit",U?"inherit":"pipe",U?"inherit":"pipe"]});if(!U)r81(N.stdout),r81(N.stderr);Rs(J),YT({name:"Vite",status:"ready",port:Number(Y)}),YT({name:"API",status:"ready",port:Number(W.port)});let D=async(O)=>{if(N.kill(O),await N.exited,H.length>0){let{stopServices:j}=await Promise.resolve().then(() => (KW0(),WW0));await j(W.dataDir)}};return process.on("SIGINT",()=>D("SIGINT")),process.on("SIGTERM",()=>D("SIGTERM")),{port:Number(Y),process:N}}var e81=L(()=>{p81();JT();a81()});var UK0;var $41=L(()=>{UK0={name:"decocms",version:"4.429.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 EO4,Text as OG$}from"ink";import{jsx as zO4,jsxs as jG$}from"react/jsx-runtime";function wG$({version:$}){return jG$(EO4,{flexDirection:"column",marginTop:1,children:[SW0.map((Z,Q)=>zO4(OG$,{color:_W0[Q],children:Z},Q)),jG$(OG$,{dimColor:!0,children:[" v",$]})]})}var EG$=L(()=>{Gs()});import{Box as GT,Text as lj}from"ink";import{Spinner as PO4}from"@inkjs/ui";import{jsx as rG,jsxs as Lc}from"react/jsx-runtime";function zG$({status:$}){if($==="pending")return rG(PO4,{label:""});return rG(lj,{color:"green",children:"\u2713"})}function TO4($){return`${$.name}: ${$.port||"...."}`}function PG$({services:$,migrationsStatus:Z,home:Q,serverUrl:X}){return Lc(GT,{flexDirection:"column",paddingBottom:1,children:[rG(wG$,{version:UK0.version}),rG(GT,{marginBottom:1,children:rG(lj,{dimColor:!0,children:"\u2500".repeat(80)})}),rG(GT,{children:Lc(lj,{dimColor:!0,children:["Home: ",Q]})}),Lc(GT,{gap:2,children:[$.map((Y)=>Lc(GT,{gap:1,children:[rG(lj,{children:TO4(Y)}),rG(zG$,{status:Y.status})]},Y.name)),Lc(GT,{gap:1,children:[rG(lj,{children:"Migrations"}),rG(zG$,{status:Z})]})]}),rG(GT,{children:X?Lc(lj,{children:["Open in browser: ",rG(lj,{color:"cyan",children:X})]}):rG(lj,{dimColor:!0,children:"Starting..."})})]})}var TG$=L(()=>{$41();EG$()});import{Box as AO4,Text as Ms}from"ink";import{jsx as Z41,jsxs as Q41}from"react/jsx-runtime";function RO4($){if($>=500)return"red";if($>=400)return"yellow";if($>=300)return"cyan";return"green"}function AG$({logs:$}){return Z41(AO4,{flexDirection:"column",children:$.map((Z,Q)=>{if(Z.rawLine)return Z41(Ms,{dimColor:!0,children:Z.rawLine},Q);let X=Z.duration<1000?`${Z.duration}ms`:`${(Z.duration/1000).toFixed(1)}s`;return Q41(Ms,{children:[Q41(Ms,{dimColor:!0,children:[Z.method.padEnd(6)," ",Z.path.padEnd(30)," "]}),Z41(Ms,{color:RO4(Z.status),children:Z.status}),Q41(Ms,{dimColor:!0,children:[" ",X.padStart(8)]})]},Q)})})}var RG$=()=>{};var X41={};J0(X41,{App:()=>IO4});import{Box as qO4}from"ink";import{useSyncExternalStore as MO4}from"react";import{jsx as qG$,jsxs as VO4}from"react/jsx-runtime";function IO4({home:$}){let Z=MO4(o81,t81);return VO4(qO4,{flexDirection:"column",children:[qG$(PG$,{services:Z.services,migrationsStatus:Z.migrationsStatus,home:$,serverUrl:Z.serverUrl}),qG$(AG$,{logs:Z.logs})]})}var Y41=L(()=>{TG$();RG$();JT()});var CW="thread-gate",DL="decopilot-hosted-harness",OL="decopilot-hosted-harness-sandboxed",SW="automations",cj="background-tools",WT="task-board-github-reads";var MG$="13";function IG$($){return{name:"decocms",systemDatabaseUrl:$.systemDatabaseUrl,systemDatabaseSchemaName:"dbos",systemDatabasePoolSize:$.poolSize,runAdminServer:!1,executorID:$.executorID,applicationVersion:MG$,...$.listenQueues!==void 0?{listenQueues:$.listenQueues}:{}}}var VG$=()=>{};import kO4 from"pg";async function CG$($,Z){let{databaseUrl:Q,lockTimeoutMs:X=CO4}=$,Y=$.log??((K)=>console.log(K)),J=new kO4.Client({connectionString:Q});await J.connect();let G=Date.now(),W=!1;try{while(!W){if(W=(await J.query("SELECT pg_try_advisory_lock($1) AS locked",[kG$.toString()])).rows[0]?.locked===!0,W)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 $$(SO4)}let K=Date.now()-G;if(K>1000)Y(`[dbos] waited ${K}ms for the migration lock; another process migrated first`);return await Z()}finally{if(W)try{await J.query("SELECT pg_advisory_unlock($1)",[kG$.toString()])}catch{}await J.end().catch(()=>{})}}var kG$=8314027461559302n,CO4=600000,SO4=500;var SG$=L(()=>{$8()});function _O4(){let $=(process.env.BUN_OPTIONS??"").split(/\s+/).filter(Boolean);return[...process.argv.slice(1),...$]}function J41($,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 _G$(){let $=_O4();if($.includes("--cpu-prof")){console.log(JSON.stringify({msg:"cpu-profiling-active",dir:J41($,"--cpu-prof-dir")??process.cwd(),name:J41($,"--cpu-prof-name"),markdown:$.includes("--cpu-prof-md"),intervalUs:Number(J41($,"--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 vG$(){if(process.env.HEAP_WATCH!=="1")return()=>{};let $=Number(process.env.HEAP_WATCH_INTERVAL_MS??60000),Z=async()=>{let Q=$T();if(!Q)return;let X={};try{let{heapStats:Y}=await import("bun:jsc"),J=Y(),G=Object.entries(J.objectTypeCounts).sort((W,K)=>K[1]-W[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(()=>{}),NK0=setInterval(()=>void Z().catch(()=>{}),$),NK0.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(NK0)clearInterval(NK0)}}var NK0;var xG$=()=>{};import*as vO4 from"bun:jsc";function fG$(){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{xO4()}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 W=[];try{W=fO4()?.traces??[]}catch{}if(G>$&&W.length>0){let K=new Map;for(let F of W){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??"?"}`;K.set(B,(K.get(B)??0)+1)}let H=[...K.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:W.length,top:H}))}Q=setTimeout(Y,Z),Q.unref?.()};return Q=setTimeout(Y,Z),Q.unref?.(),()=>{if(Q)clearTimeout(Q)}}var xO4,fO4;var bG$=L(()=>{({startSamplingProfiler:xO4,samplingProfilerStackTraces:fO4}=vO4)});function yG$(){_G$();let $=[vG$(),H7$(),fG$()];return()=>{for(let Z of $)Z()}}var gG$=L(()=>{hs0();xG$();bG$()});var KT=b((hG$)=>{Object.defineProperty(hG$,"__esModule",{value:!0});hG$.RepublishHeaders=hG$.DirectMsgHeaders=hG$.JsHeaders=hG$.AdvisoryKind=void 0;hG$.isOrderedPushConsumerOptions=bO4;hG$.isPullConsumer=yO4;hG$.isPushConsumer=gO4;hG$.isBoundPushConsumerOptions=hO4;function bO4($){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 yO4($){return $.isPullConsumer()}function gO4($){return $.isPushConsumer()}function hO4($){if($&&typeof $==="object")return"deliver_subject"in $||"deliver_group"in $||"idle_heartbeat"in $;return!1}hG$.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"};hG$.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"};hG$.DirectMsgHeaders={Stream:"Nats-Stream",Sequence:"Nats-Sequence",TimeStamp:"Nats-Time-Stamp",Subject:"Nats-Subject",LastSequence:"Nats-Last-Sequence",NumPending:"Nats-Num-Pending"};hG$.RepublishHeaders={Stream:"Nats-Stream",Subject:"Nats-Subject",Sequence:"Nats-Sequence",LastSequence:"Nats-Last-Sequence",Size:"Nats-Msg-Size"}});var sG=b((lG$)=>{Object.defineProperty(lG$,"__esModule",{value:!0});lG$.TD=lG$.TE=lG$.Empty=void 0;lG$.encode=tO4;lG$.decode=oO4;lG$.Empty=new Uint8Array(0);lG$.TE=new TextEncoder;lG$.TD=new TextDecoder;function nO4(...$){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 tO4(...$){let Z=[];for(let Q=0;Q<$.length;Q++)Z.push(lG$.TE.encode($[Q]));if(Z.length===0)return lG$.Empty;if(Z.length===1)return Z[0];return nO4(...Z)}function oO4($){if(!$||$.length===0)return"";return lG$.TD.decode($)}});var eG=b((dG$)=>{Object.defineProperty(dG$,"__esModule",{value:!0});dG$.errors=dG$.PermissionViolationError=dG$.NoRespondersError=dG$.TimeoutError=dG$.RequestError=dG$.ProtocolError=dG$.ConnectionError=dG$.DrainingConnectionError=dG$.ClosedConnectionError=dG$.AuthorizationError=dG$.UserAuthenticationExpiredError=dG$.InvalidOperationError=dG$.InvalidArgumentError=dG$.InvalidSubjectError=void 0;class W41 extends Error{constructor($,Z){super(`illegal subject: '${$}'`,Z);this.name="InvalidSubjectError"}}dG$.InvalidSubjectError=W41;class BK0 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 BK0(`${$} ${Z}`,Q)}}dG$.InvalidArgumentError=BK0;class K41 extends Error{constructor($,Z){super($,Z);this.name="InvalidOperationError"}}dG$.InvalidOperationError=K41;class LK0 extends Error{constructor($,Z){super($,Z);this.name="UserAuthenticationExpiredError"}static parse($){if($.toLowerCase().indexOf("user authentication expired")!==-1)return new LK0($);return null}}dG$.UserAuthenticationExpiredError=LK0;class DK0 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 DK0($);return null}}dG$.AuthorizationError=DK0;class H41 extends Error{constructor(){super("closed connection");this.name="ClosedConnectionError"}}dG$.ClosedConnectionError=H41;class F41 extends Error{constructor(){super("connection draining");this.name="DrainingConnectionError"}}dG$.DrainingConnectionError=F41;class U41 extends Error{constructor($,Z){super($,Z);this.name="ConnectionError"}}dG$.ConnectionError=U41;class N41 extends Error{constructor($,Z){super($,Z);this.name="ProtocolError"}}dG$.ProtocolError=N41;class B41 extends Error{constructor($="",Z){super($,Z);this.name="RequestError"}isNoResponders(){return this.cause instanceof OK0}}dG$.RequestError=B41;class L41 extends Error{constructor($){super("timeout",$);this.name="TimeoutError"}}dG$.TimeoutError=L41;class OK0 extends Error{subject;constructor($,Z){super(`no responders: '${$}'`,Z);this.subject=$,this.name="NoResponders"}}dG$.NoRespondersError=OK0;class jK0 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 jK0($,Q,X,Y)}}dG$.PermissionViolationError=jK0;dG$.errors={AuthorizationError:DK0,ClosedConnectionError:H41,ConnectionError:U41,DrainingConnectionError:F41,InvalidArgumentError:BK0,InvalidOperationError:K41,InvalidSubjectError:W41,NoRespondersError:OK0,PermissionViolationError:jK0,ProtocolError:N41,RequestError:B41,TimeoutError:L41,UserAuthenticationExpiredError:LK0}});var DH=b((oG$)=>{Object.defineProperty(oG$,"__esModule",{value:!0});oG$.SimpleMutex=oG$.Perf=void 0;oG$.extend=Nj4;oG$.render=Bj4;oG$.timeout=Lj4;oG$.delay=Dj4;oG$.deadline=Oj4;oG$.deferred=O41;oG$.debugDeferred=jj4;oG$.shuffle=wj4;oG$.collect=Ej4;oG$.jitter=tG$;oG$.backoff=zj4;oG$.nanos=Pj4;oG$.millis=Tj4;oG$.randomToken=qj4;var Uj4=sG(),D41=eG();function Nj4($,...Z){for(let Q=0;Q<Z.length;Q++){let X=Z[Q];Object.keys(X).forEach(function(Y){$[Y]=X[Y]})}return $}function Bj4($){return Uj4.TD.decode($).replace(/\n/g,"\u240A").replace(/\r/g,"\u240D")}function Lj4($,Z=!0){let Q=Z?new D41.TimeoutError:null,X,Y,J=new Promise((G,W)=>{X={cancel:()=>{if(Y)clearTimeout(Y)}},Y=setTimeout(()=>{if(Q===null)W(new D41.TimeoutError);else W(Q)},$)});return Object.assign(J,X)}function Dj4($=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 Oj4($,Z=1000){let Q=O41(),X=setTimeout(()=>{Q.reject(new D41.TimeoutError)},Z);try{return await Promise.race([$,Q])}finally{clearTimeout(X)}}function O41(){let $={},Z=new Promise((Q,X)=>{$={resolve:Q,reject:X}});return Object.assign(Z,$)}function jj4(){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 wj4($){for(let Z=$.length-1;Z>0;Z--){let Q=Math.floor(Math.random()*(Z+1));[$[Z],$[Q]]=[$[Q],$[Z]]}return $}async function Ej4($){let Z=[];for await(let Q of $)Z.push(Q);return Z}class pG${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})}),$}}oG$.Perf=pG$;class nG${max;current;waiting;constructor($=1){this.max=$,this.current=0,this.waiting=[]}lock(){if(this.current++,this.current<=this.max)return Promise.resolve();let $=O41();return this.waiting.push($),$}unlock(){this.current--,this.waiting.pop()?.resolve()}}oG$.SimpleMutex=nG$;function tG$($){if($===0)return 0;return Math.floor($/2+Math.random()*$)}function zj4($=[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 tG$(Q>Z?$[Z]:$[Q])}}}function Pj4($){return $*1e6}function Tj4($){return Math.floor($/1e6)}var Aj4="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",jL=new Uint8Array(62);for(let $=0;$<62;$++)jL[$]=Aj4.charCodeAt($);var Rj4=218340105584896;function qj4(){let $=Math.floor(Math.random()*Rj4),Z=$%62,Q=jL[Z];$=($-Z)/62,Z=$%62;let X=jL[Z];$=($-Z)/62,Z=$%62;let Y=jL[Z];$=($-Z)/62,Z=$%62;let J=jL[Z];$=($-Z)/62,Z=$%62;let G=jL[Z];$=($-Z)/62,Z=$%62;let W=jL[Z];$=($-Z)/62,Z=$%62;let K=jL[Z];$=($-Z)/62;let H=jL[$];return String.fromCharCode(Q,X,Y,J,G,W,K,H)}});var X3$=b((Z3$)=>{Object.defineProperty(Z3$,"__esModule",{value:!0});Z3$.nuid=Z3$.NuidImpl=void 0;var lj4="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",mj=62,EK0=12,eG$=10,rG$=33,cj4=333,sG$=EK0+eG$,w41=new Uint8Array(mj);for(let $=0;$<mj;$++)w41[$]=lj4.charCodeAt($);var wK0=4294967296,$3$=BigInt(mj)**BigInt(eG$),Is=Number($3$/(1n<<32n)),j41=Number($3$%(1n<<32n));function mj4($){for(let Z=0;Z<$.length;Z++)$[Z]=Math.floor(Math.random()*256)}function dj4($){if(globalThis?.crypto?.getRandomValues)globalThis.crypto.getRandomValues($);else mj4($)}class E41{buf;cbuf;seqHi;seqLo;inc;inited;constructor(){this.buf=new Uint8Array(sG$),this.cbuf=new Uint8Array(EK0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){let $=0;do this.seqHi=Math.floor(Math.random()*(Is+1)),this.seqLo=Math.floor(Math.random()*wK0);while($++<8&&this.seqHi===Is&&this.seqLo>=j41);if(this.seqHi===Is&&this.seqLo>=j41)this.seqLo=0;this.inc=Math.random()*(cj4-rG$)+rG$|0}setPre(){dj4(this.cbuf);for(let $=0;$<EK0;$++)this.buf[$]=w41[this.cbuf[$]%mj]}fillSeq(){let $=this.seqHi,Z=this.seqLo;for(let Q=sG$-1;Q>=EK0;Q--){let X=Math.floor($/mj),J=($-X*mj)*wK0+Z,G=Math.floor(J/mj),W=J-G*mj;this.buf[Q]=w41[W],$=X,Z=G}}next(){if(!this.inited)this.init();if(this.seqLo+=this.inc,this.seqLo>=wK0)this.seqLo-=wK0,this.seqHi+=1;if(this.seqHi>Is||this.seqHi===Is&&this.seqLo>=j41)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()}}Z3$.NuidImpl=E41;Z3$.nuid=new E41});var W3$=b((J3$)=>{Object.defineProperty(J3$,"__esModule",{value:!0});J3$.nuid=J3$.Nuid=void 0;var Y3$=X3$();J3$.Nuid=Y3$.NuidImpl;J3$.nuid=Y3$.nuid});var PK0=b((zK0)=>{Object.defineProperty(zK0,"__esModule",{value:!0});zK0.nuid=zK0.Nuid=void 0;var K3$=W3$();Object.defineProperty(zK0,"Nuid",{enumerable:!0,get:function(){return K3$.Nuid}});Object.defineProperty(zK0,"nuid",{enumerable:!0,get:function(){return K3$.nuid}})});var dj=b((H3$)=>{Object.defineProperty(H3$,"__esModule",{value:!0});H3$.DEFAULT_HOST=H3$.DEFAULT_PORT=H3$.Match=void 0;H3$.syncIterator=aj4;H3$.createInbox=rj4;var tj4=PK0(),oj4=eG();H3$.Match={Exact:"exact",CanonicalMIME:"canonical",IgnoreCase:"insensitive"};function aj4($){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 rj4($=""){if($=$||"_INBOX",typeof $!=="string")throw TypeError("prefix must be a string");return $.split(".").forEach((Z)=>{if(Z==="*"||Z===">")throw oj4.InvalidArgumentError.format("prefix",`cannot have wildcards ('${$}')`)}),`${$}.${tj4.nuid.next()}`}H3$.DEFAULT_PORT=4222;H3$.DEFAULT_HOST="127.0.0.1"});var Vs=b((B3$)=>{Object.defineProperty(B3$,"__esModule",{value:!0});B3$.DataBuffer=void 0;var U3$=sG();class N3${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 U3$.TE.encode($)}static toAscii($){return U3$.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}}B3$.DataBuffer=N3$});var HT=b((O3$)=>{Object.defineProperty(O3$,"__esModule",{value:!0});O3$.LF=O3$.CR=O3$.CRLF=O3$.CR_LF_LEN=O3$.CR_LF=void 0;O3$.setTransportFactory=Jw4;O3$.defaultPort=Gw4;O3$.getUrlParseFn=Ww4;O3$.newTransport=Kw4;O3$.getResolveFn=Hw4;O3$.protoLen=D3$;O3$.extractProtocolMessage=Fw4;var Qw4=sG(),Xw4=dj(),Yw4=Vs(),$3;function Jw4($){$3=$}function Gw4(){return $3!==void 0&&$3.defaultPort!==void 0?$3.defaultPort:Xw4.DEFAULT_PORT}function Ww4(){return $3!==void 0&&$3.urlParseFn?$3.urlParseFn:void 0}function Kw4(){if(!$3||typeof $3.factory!=="function")throw Error("transport fn is not set");return $3.factory()}function Hw4(){return $3!==void 0&&$3.dnsResolveFn?$3.dnsResolveFn:void 0}O3$.CR_LF=`\r
2181
+ `);X=J.pop()??"";for(let G of J){let W=Bun.stripANSI(G).replace(/^\[\d+\]\s*/,"").trim();if(!W)continue;uj({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:W})}}(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)uj({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:J})}})()}async function jO4($){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 qs(Number(Y)+1):await qs(Number($.port)),{settings:W,services:K,managedServiceNames:H}=await KK0({port:String(G),home:$.home,baseUrl:$.baseUrl,localMode:$.localMode,skipMigrations:$.skipMigrations,noTui:$.noTui,vitePort:$.vitePort});for(let O of K)YT({name:O.name,status:"ready",port:O.port});As();let F=OO4(import.meta.dir,"..","..","..","..",".."),U=Q===!0,N=Bun.spawn(["bun","run","dev:servers"],{cwd:F,env:{...process.env,PORT:String(W.port),VITE_PORT:String(Y),DATABASE_URL:W.databaseUrl,NATS_URL:W.natsUrls.join(","),NODE_ENV:W.nodeEnv,BASE_URL:J,DECOCMS_LOCAL_MODE:String(W.localMode),DECOCMS_HOME:W.dataDir,DATA_DIR:W.dataDir,DECO_CLI:"1",...W.betterAuthSecret?{BETTER_AUTH_SECRET:W.betterAuthSecret}:{},...W.s3Endpoint?{S3_ENDPOINT:W.s3Endpoint,S3_BUCKET:W.s3Bucket??"",S3_ACCESS_KEY_ID:W.s3AccessKeyId??"",S3_SECRET_ACCESS_KEY:W.s3SecretAccessKey??"",S3_FORCE_PATH_STYLE:String(W.s3ForcePathStyle)}:{},...W.natsCredsPath?{NATS_CREDS:W.natsCredsPath}:{}},stdio:["inherit",U?"inherit":"pipe",U?"inherit":"pipe"]});if(!U)r81(N.stdout),r81(N.stderr);Rs(J),YT({name:"Vite",status:"ready",port:Number(Y)}),YT({name:"API",status:"ready",port:Number(W.port)});let D=async(O)=>{if(N.kill(O),await N.exited,H.length>0){let{stopServices:j}=await Promise.resolve().then(() => (KW0(),WW0));await j(W.dataDir)}};return process.on("SIGINT",()=>D("SIGINT")),process.on("SIGTERM",()=>D("SIGTERM")),{port:Number(Y),process:N}}var e81=L(()=>{p81();JT();a81()});var UK0;var $41=L(()=>{UK0={name:"decocms",version:"4.429.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 EO4,Text as OG$}from"ink";import{jsx as zO4,jsxs as jG$}from"react/jsx-runtime";function wG$({version:$}){return jG$(EO4,{flexDirection:"column",marginTop:1,children:[SW0.map((Z,Q)=>zO4(OG$,{color:_W0[Q],children:Z},Q)),jG$(OG$,{dimColor:!0,children:[" v",$]})]})}var EG$=L(()=>{Gs()});import{Box as GT,Text as lj}from"ink";import{Spinner as PO4}from"@inkjs/ui";import{jsx as rG,jsxs as Lc}from"react/jsx-runtime";function zG$({status:$}){if($==="pending")return rG(PO4,{label:""});return rG(lj,{color:"green",children:"\u2713"})}function TO4($){return`${$.name}: ${$.port||"...."}`}function PG$({services:$,migrationsStatus:Z,home:Q,serverUrl:X}){return Lc(GT,{flexDirection:"column",paddingBottom:1,children:[rG(wG$,{version:UK0.version}),rG(GT,{marginBottom:1,children:rG(lj,{dimColor:!0,children:"\u2500".repeat(80)})}),rG(GT,{children:Lc(lj,{dimColor:!0,children:["Home: ",Q]})}),Lc(GT,{gap:2,children:[$.map((Y)=>Lc(GT,{gap:1,children:[rG(lj,{children:TO4(Y)}),rG(zG$,{status:Y.status})]},Y.name)),Lc(GT,{gap:1,children:[rG(lj,{children:"Migrations"}),rG(zG$,{status:Z})]})]}),rG(GT,{children:X?Lc(lj,{children:["Open in browser: ",rG(lj,{color:"cyan",children:X})]}):rG(lj,{dimColor:!0,children:"Starting..."})})]})}var TG$=L(()=>{$41();EG$()});import{Box as AO4,Text as Ms}from"ink";import{jsx as Z41,jsxs as Q41}from"react/jsx-runtime";function RO4($){if($>=500)return"red";if($>=400)return"yellow";if($>=300)return"cyan";return"green"}function AG$({logs:$}){return Z41(AO4,{flexDirection:"column",children:$.map((Z,Q)=>{if(Z.rawLine)return Z41(Ms,{dimColor:!0,children:Z.rawLine},Q);let X=Z.duration<1000?`${Z.duration}ms`:`${(Z.duration/1000).toFixed(1)}s`;return Q41(Ms,{children:[Q41(Ms,{dimColor:!0,children:[Z.method.padEnd(6)," ",Z.path.padEnd(30)," "]}),Z41(Ms,{color:RO4(Z.status),children:Z.status}),Q41(Ms,{dimColor:!0,children:[" ",X.padStart(8)]})]},Q)})})}var RG$=()=>{};var X41={};J0(X41,{App:()=>IO4});import{Box as qO4}from"ink";import{useSyncExternalStore as MO4}from"react";import{jsx as qG$,jsxs as VO4}from"react/jsx-runtime";function IO4({home:$}){let Z=MO4(o81,t81);return VO4(qO4,{flexDirection:"column",children:[qG$(PG$,{services:Z.services,migrationsStatus:Z.migrationsStatus,home:$,serverUrl:Z.serverUrl}),qG$(AG$,{logs:Z.logs})]})}var Y41=L(()=>{TG$();RG$();JT()});var CW="thread-gate",DL="decopilot-hosted-harness",OL="decopilot-hosted-harness-sandboxed",SW="automations",cj="background-tools",WT="task-board-github-reads";var MG$="13";function IG$($){return{name:"decocms",systemDatabaseUrl:$.systemDatabaseUrl,systemDatabaseSchemaName:"dbos",systemDatabasePoolSize:$.poolSize,runAdminServer:!1,executorID:$.executorID,applicationVersion:MG$,...$.listenQueues!==void 0?{listenQueues:$.listenQueues}:{}}}var VG$=()=>{};import kO4 from"pg";async function CG$($,Z){let{databaseUrl:Q,lockTimeoutMs:X=CO4}=$,Y=$.log??((K)=>console.log(K)),J=new kO4.Client({connectionString:Q});await J.connect();let G=Date.now(),W=!1;try{while(!W){if(W=(await J.query("SELECT pg_try_advisory_lock($1) AS locked",[kG$.toString()])).rows[0]?.locked===!0,W)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 $$(SO4)}let K=Date.now()-G;if(K>1000)Y(`[dbos] waited ${K}ms for the migration lock; another process migrated first`);return await Z()}finally{if(W)try{await J.query("SELECT pg_advisory_unlock($1)",[kG$.toString()])}catch{}await J.end().catch(()=>{})}}var kG$=8314027461559302n,CO4=600000,SO4=500;var SG$=L(()=>{$8()});function _O4(){let $=(process.env.BUN_OPTIONS??"").split(/\s+/).filter(Boolean);return[...process.argv.slice(1),...$]}function J41($,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 _G$(){let $=_O4();if($.includes("--cpu-prof")){console.log(JSON.stringify({msg:"cpu-profiling-active",dir:J41($,"--cpu-prof-dir")??process.cwd(),name:J41($,"--cpu-prof-name"),markdown:$.includes("--cpu-prof-md"),intervalUs:Number(J41($,"--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 vG$(){if(process.env.HEAP_WATCH!=="1")return()=>{};let $=Number(process.env.HEAP_WATCH_INTERVAL_MS??60000),Z=async()=>{let Q=$T();if(!Q)return;let X={};try{let{heapStats:Y}=await import("bun:jsc"),J=Y(),G=Object.entries(J.objectTypeCounts).sort((W,K)=>K[1]-W[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(()=>{}),NK0=setInterval(()=>void Z().catch(()=>{}),$),NK0.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(NK0)clearInterval(NK0)}}var NK0;var xG$=()=>{};import*as vO4 from"bun:jsc";function fG$(){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{xO4()}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 W=[];try{W=fO4()?.traces??[]}catch{}if(G>$&&W.length>0){let K=new Map;for(let F of W){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??"?"}`;K.set(B,(K.get(B)??0)+1)}let H=[...K.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:W.length,top:H}))}Q=setTimeout(Y,Z),Q.unref?.()};return Q=setTimeout(Y,Z),Q.unref?.(),()=>{if(Q)clearTimeout(Q)}}var xO4,fO4;var bG$=L(()=>{({startSamplingProfiler:xO4,samplingProfilerStackTraces:fO4}=vO4)});function yG$(){_G$();let $=[vG$(),H7$(),fG$()];return()=>{for(let Z of $)Z()}}var gG$=L(()=>{hs0();xG$();bG$()});var KT=b((hG$)=>{Object.defineProperty(hG$,"__esModule",{value:!0});hG$.RepublishHeaders=hG$.DirectMsgHeaders=hG$.JsHeaders=hG$.AdvisoryKind=void 0;hG$.isOrderedPushConsumerOptions=bO4;hG$.isPullConsumer=yO4;hG$.isPushConsumer=gO4;hG$.isBoundPushConsumerOptions=hO4;function bO4($){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 yO4($){return $.isPullConsumer()}function gO4($){return $.isPushConsumer()}function hO4($){if($&&typeof $==="object")return"deliver_subject"in $||"deliver_group"in $||"idle_heartbeat"in $;return!1}hG$.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"};hG$.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"};hG$.DirectMsgHeaders={Stream:"Nats-Stream",Sequence:"Nats-Sequence",TimeStamp:"Nats-Time-Stamp",Subject:"Nats-Subject",LastSequence:"Nats-Last-Sequence",NumPending:"Nats-Num-Pending"};hG$.RepublishHeaders={Stream:"Nats-Stream",Subject:"Nats-Subject",Sequence:"Nats-Sequence",LastSequence:"Nats-Last-Sequence",Size:"Nats-Msg-Size"}});var sG=b((lG$)=>{Object.defineProperty(lG$,"__esModule",{value:!0});lG$.TD=lG$.TE=lG$.Empty=void 0;lG$.encode=tO4;lG$.decode=oO4;lG$.Empty=new Uint8Array(0);lG$.TE=new TextEncoder;lG$.TD=new TextDecoder;function nO4(...$){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 tO4(...$){let Z=[];for(let Q=0;Q<$.length;Q++)Z.push(lG$.TE.encode($[Q]));if(Z.length===0)return lG$.Empty;if(Z.length===1)return Z[0];return nO4(...Z)}function oO4($){if(!$||$.length===0)return"";return lG$.TD.decode($)}});var eG=b((dG$)=>{Object.defineProperty(dG$,"__esModule",{value:!0});dG$.errors=dG$.PermissionViolationError=dG$.NoRespondersError=dG$.TimeoutError=dG$.RequestError=dG$.ProtocolError=dG$.ConnectionError=dG$.DrainingConnectionError=dG$.ClosedConnectionError=dG$.AuthorizationError=dG$.UserAuthenticationExpiredError=dG$.InvalidOperationError=dG$.InvalidArgumentError=dG$.InvalidSubjectError=void 0;class W41 extends Error{constructor($,Z){super(`illegal subject: '${$}'`,Z);this.name="InvalidSubjectError"}}dG$.InvalidSubjectError=W41;class BK0 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 BK0(`${$} ${Z}`,Q)}}dG$.InvalidArgumentError=BK0;class K41 extends Error{constructor($,Z){super($,Z);this.name="InvalidOperationError"}}dG$.InvalidOperationError=K41;class LK0 extends Error{constructor($,Z){super($,Z);this.name="UserAuthenticationExpiredError"}static parse($){if($.toLowerCase().indexOf("user authentication expired")!==-1)return new LK0($);return null}}dG$.UserAuthenticationExpiredError=LK0;class DK0 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 DK0($);return null}}dG$.AuthorizationError=DK0;class H41 extends Error{constructor(){super("closed connection");this.name="ClosedConnectionError"}}dG$.ClosedConnectionError=H41;class F41 extends Error{constructor(){super("connection draining");this.name="DrainingConnectionError"}}dG$.DrainingConnectionError=F41;class U41 extends Error{constructor($,Z){super($,Z);this.name="ConnectionError"}}dG$.ConnectionError=U41;class N41 extends Error{constructor($,Z){super($,Z);this.name="ProtocolError"}}dG$.ProtocolError=N41;class B41 extends Error{constructor($="",Z){super($,Z);this.name="RequestError"}isNoResponders(){return this.cause instanceof OK0}}dG$.RequestError=B41;class L41 extends Error{constructor($){super("timeout",$);this.name="TimeoutError"}}dG$.TimeoutError=L41;class OK0 extends Error{subject;constructor($,Z){super(`no responders: '${$}'`,Z);this.subject=$,this.name="NoResponders"}}dG$.NoRespondersError=OK0;class jK0 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 jK0($,Q,X,Y)}}dG$.PermissionViolationError=jK0;dG$.errors={AuthorizationError:DK0,ClosedConnectionError:H41,ConnectionError:U41,DrainingConnectionError:F41,InvalidArgumentError:BK0,InvalidOperationError:K41,InvalidSubjectError:W41,NoRespondersError:OK0,PermissionViolationError:jK0,ProtocolError:N41,RequestError:B41,TimeoutError:L41,UserAuthenticationExpiredError:LK0}});var DH=b((oG$)=>{Object.defineProperty(oG$,"__esModule",{value:!0});oG$.SimpleMutex=oG$.Perf=void 0;oG$.extend=Nj4;oG$.render=Bj4;oG$.timeout=Lj4;oG$.delay=Dj4;oG$.deadline=Oj4;oG$.deferred=O41;oG$.debugDeferred=jj4;oG$.shuffle=wj4;oG$.collect=Ej4;oG$.jitter=tG$;oG$.backoff=zj4;oG$.nanos=Pj4;oG$.millis=Tj4;oG$.randomToken=qj4;var Uj4=sG(),D41=eG();function Nj4($,...Z){for(let Q=0;Q<Z.length;Q++){let X=Z[Q];Object.keys(X).forEach(function(Y){$[Y]=X[Y]})}return $}function Bj4($){return Uj4.TD.decode($).replace(/\n/g,"\u240A").replace(/\r/g,"\u240D")}function Lj4($,Z=!0){let Q=Z?new D41.TimeoutError:null,X,Y,J=new Promise((G,W)=>{X={cancel:()=>{if(Y)clearTimeout(Y)}},Y=setTimeout(()=>{if(Q===null)W(new D41.TimeoutError);else W(Q)},$)});return Object.assign(J,X)}function Dj4($=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 Oj4($,Z=1000){let Q=O41(),X=setTimeout(()=>{Q.reject(new D41.TimeoutError)},Z);try{return await Promise.race([$,Q])}finally{clearTimeout(X)}}function O41(){let $={},Z=new Promise((Q,X)=>{$={resolve:Q,reject:X}});return Object.assign(Z,$)}function jj4(){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 wj4($){for(let Z=$.length-1;Z>0;Z--){let Q=Math.floor(Math.random()*(Z+1));[$[Z],$[Q]]=[$[Q],$[Z]]}return $}async function Ej4($){let Z=[];for await(let Q of $)Z.push(Q);return Z}class pG${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})}),$}}oG$.Perf=pG$;class nG${max;current;waiting;constructor($=1){this.max=$,this.current=0,this.waiting=[]}lock(){if(this.current++,this.current<=this.max)return Promise.resolve();let $=O41();return this.waiting.push($),$}unlock(){this.current--,this.waiting.pop()?.resolve()}}oG$.SimpleMutex=nG$;function tG$($){if($===0)return 0;return Math.floor($/2+Math.random()*$)}function zj4($=[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 tG$(Q>Z?$[Z]:$[Q])}}}function Pj4($){return $*1e6}function Tj4($){return Math.floor($/1e6)}var Aj4="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",jL=new Uint8Array(62);for(let $=0;$<62;$++)jL[$]=Aj4.charCodeAt($);var Rj4=218340105584896;function qj4(){let $=Math.floor(Math.random()*Rj4),Z=$%62,Q=jL[Z];$=($-Z)/62,Z=$%62;let X=jL[Z];$=($-Z)/62,Z=$%62;let Y=jL[Z];$=($-Z)/62,Z=$%62;let J=jL[Z];$=($-Z)/62,Z=$%62;let G=jL[Z];$=($-Z)/62,Z=$%62;let W=jL[Z];$=($-Z)/62,Z=$%62;let K=jL[Z];$=($-Z)/62;let H=jL[$];return String.fromCharCode(Q,X,Y,J,G,W,K,H)}});var X3$=b((Z3$)=>{Object.defineProperty(Z3$,"__esModule",{value:!0});Z3$.nuid=Z3$.NuidImpl=void 0;var lj4="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",mj=62,EK0=12,eG$=10,rG$=33,cj4=333,sG$=EK0+eG$,w41=new Uint8Array(mj);for(let $=0;$<mj;$++)w41[$]=lj4.charCodeAt($);var wK0=4294967296,$3$=BigInt(mj)**BigInt(eG$),Is=Number($3$/(1n<<32n)),j41=Number($3$%(1n<<32n));function mj4($){for(let Z=0;Z<$.length;Z++)$[Z]=Math.floor(Math.random()*256)}function dj4($){if(globalThis?.crypto?.getRandomValues)globalThis.crypto.getRandomValues($);else mj4($)}class E41{buf;cbuf;seqHi;seqLo;inc;inited;constructor(){this.buf=new Uint8Array(sG$),this.cbuf=new Uint8Array(EK0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){let $=0;do this.seqHi=Math.floor(Math.random()*(Is+1)),this.seqLo=Math.floor(Math.random()*wK0);while($++<8&&this.seqHi===Is&&this.seqLo>=j41);if(this.seqHi===Is&&this.seqLo>=j41)this.seqLo=0;this.inc=Math.random()*(cj4-rG$)+rG$|0}setPre(){dj4(this.cbuf);for(let $=0;$<EK0;$++)this.buf[$]=w41[this.cbuf[$]%mj]}fillSeq(){let $=this.seqHi,Z=this.seqLo;for(let Q=sG$-1;Q>=EK0;Q--){let X=Math.floor($/mj),J=($-X*mj)*wK0+Z,G=Math.floor(J/mj),W=J-G*mj;this.buf[Q]=w41[W],$=X,Z=G}}next(){if(!this.inited)this.init();if(this.seqLo+=this.inc,this.seqLo>=wK0)this.seqLo-=wK0,this.seqHi+=1;if(this.seqHi>Is||this.seqHi===Is&&this.seqLo>=j41)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()}}Z3$.NuidImpl=E41;Z3$.nuid=new E41});var W3$=b((J3$)=>{Object.defineProperty(J3$,"__esModule",{value:!0});J3$.nuid=J3$.Nuid=void 0;var Y3$=X3$();J3$.Nuid=Y3$.NuidImpl;J3$.nuid=Y3$.nuid});var PK0=b((zK0)=>{Object.defineProperty(zK0,"__esModule",{value:!0});zK0.nuid=zK0.Nuid=void 0;var K3$=W3$();Object.defineProperty(zK0,"Nuid",{enumerable:!0,get:function(){return K3$.Nuid}});Object.defineProperty(zK0,"nuid",{enumerable:!0,get:function(){return K3$.nuid}})});var dj=b((H3$)=>{Object.defineProperty(H3$,"__esModule",{value:!0});H3$.DEFAULT_HOST=H3$.DEFAULT_PORT=H3$.Match=void 0;H3$.syncIterator=aj4;H3$.createInbox=rj4;var tj4=PK0(),oj4=eG();H3$.Match={Exact:"exact",CanonicalMIME:"canonical",IgnoreCase:"insensitive"};function aj4($){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 rj4($=""){if($=$||"_INBOX",typeof $!=="string")throw TypeError("prefix must be a string");return $.split(".").forEach((Z)=>{if(Z==="*"||Z===">")throw oj4.InvalidArgumentError.format("prefix",`cannot have wildcards ('${$}')`)}),`${$}.${tj4.nuid.next()}`}H3$.DEFAULT_PORT=4222;H3$.DEFAULT_HOST="127.0.0.1"});var Vs=b((B3$)=>{Object.defineProperty(B3$,"__esModule",{value:!0});B3$.DataBuffer=void 0;var U3$=sG();class N3${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 U3$.TE.encode($)}static toAscii($){return U3$.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}}B3$.DataBuffer=N3$});var HT=b((O3$)=>{Object.defineProperty(O3$,"__esModule",{value:!0});O3$.LF=O3$.CR=O3$.CRLF=O3$.CR_LF_LEN=O3$.CR_LF=void 0;O3$.setTransportFactory=Jw4;O3$.defaultPort=Gw4;O3$.getUrlParseFn=Ww4;O3$.newTransport=Kw4;O3$.getResolveFn=Hw4;O3$.protoLen=D3$;O3$.extractProtocolMessage=Fw4;var Qw4=sG(),Xw4=dj(),Yw4=Vs(),$3;function Jw4($){$3=$}function Gw4(){return $3!==void 0&&$3.defaultPort!==void 0?$3.defaultPort:Xw4.DEFAULT_PORT}function Ww4(){return $3!==void 0&&$3.urlParseFn?$3.urlParseFn:void 0}function Kw4(){if(!$3||typeof $3.factory!=="function")throw Error("transport fn is not set");return $3.factory()}function Hw4(){return $3!==void 0&&$3.dnsResolveFn?$3.dnsResolveFn:void 0}O3$.CR_LF=`\r
2182
2182
  `;O3$.CR_LF_LEN=O3$.CR_LF.length;O3$.CRLF=Yw4.DataBuffer.fromAscii(O3$.CR_LF);O3$.CR=new Uint8Array(O3$.CRLF)[0];O3$.LF=new Uint8Array(O3$.CRLF)[1];function D3$($){for(let Z=0;Z<$.length;Z++){let Q=Z+1;if($.byteLength>Q&&$[Z]===O3$.CR&&$[Q]===O3$.LF)return Q+1}return 0}function Fw4($){let Z=D3$($);if(Z>0){let X=new Uint8Array($).slice(0,Z);return Qw4.TD.decode(X)}return""}});var R41=b((R3$)=>{Object.defineProperty(R3$,"__esModule",{value:!0});R3$.ipV4=P3$;R3$.isIP=Pw4;R3$.parseIP=T3$;var ks=4,FT=16,TK0=48,z3$=57,w3$=65,Ew4=70,E3$=97,zw4=102,A41=16777215;function P3$($,Z,Q,X){let Y=new Uint8Array(FT);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((G,W)=>{Y[W]=G}),Y[12]=$,Y[13]=Z,Y[14]=Q,Y[15]=X,Y}function Pw4($){return T3$($)!==void 0}function T3$($){for(let Z=0;Z<$.length;Z++)switch($[Z]){case".":return A3$($);case":":return Tw4($)}return}function A3$($){let Z=new Uint8Array(ks);for(let Q=0;Q<ks;Q++){if($.length===0)return;if(Q>0){if($[0]!==".")return;$=$.substring(1)}let{n:X,c:Y,ok:J}=Aw4($);if(!J||X>255)return;$=$.substring(Y),Z[Q]=X}return P3$(Z[0],Z[1],Z[2],Z[3])}function Tw4($){let Z=new Uint8Array(FT),Q=-1;if($.length>=2&&$[0]===":"&&$[1]===":"){if(Q=0,$=$.substring(2),$.length===0)return Z}let X=0;while(X<FT){let{n:Y,c:J,ok:G}=Rw4($);if(!G||Y>65535)return;if(J<$.length&&$[J]==="."){if(Q<0&&X!=FT-ks)return;if(X+ks>FT)return;let W=A3$($);if(W===void 0)return;Z[X]=W[12],Z[X+1]=W[13],Z[X+2]=W[14],Z[X+3]=W[15],$="",X+=ks;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<FT){if(Q<0)return;let Y=FT-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 Aw4($){let Z=0,Q=0;for(Z=0;Z<$.length&&TK0<=$.charCodeAt(Z)&&$.charCodeAt(Z)<=z3$;Z++)if(Q=Q*10+($.charCodeAt(Z)-TK0),Q>=A41)return{n:A41,c:Z,ok:!1};if(Z===0)return{n:0,c:0,ok:!1};return{n:Q,c:Z,ok:!0}}function Rw4($){let Z=0,Q=0;for(Q=0;Q<$.length;Q++){if(TK0<=$.charCodeAt(Q)&&$.charCodeAt(Q)<=z3$)Z*=16,Z+=$.charCodeAt(Q)-TK0;else if(E3$<=$.charCodeAt(Q)&&$.charCodeAt(Q)<=zw4)Z*=16,Z+=$.charCodeAt(Q)-E3$+10;else if(w3$<=$.charCodeAt(Q)&&$.charCodeAt(Q)<=Ew4)Z*=16,Z+=$.charCodeAt(Q)-w3$+10;else break;if(Z>=A41)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 C41=b((M3$)=>{Object.defineProperty(M3$,"__esModule",{value:!0});M3$.Servers=M3$.ServerImpl=void 0;M3$.isIPV4OrHostname=q3$;M3$.hostPort=k41;var q41=HT(),M41=DH(),I41=R41(),Vw4=dj(),kw4=eG();function q3$($){if($.indexOf("[")!==-1||$.indexOf("::")!==-1)return!1;if($.indexOf(".")!==-1)return!0;if($.split(":").length<=2)return!0;return!1}function V41($){return!q3$($)}function Cw4($){let Q=$.toUpperCase().indexOf("::FFFF:");if(Q!==-1&&$.indexOf(".")!==-1){let X=$.substring(Q+7);return X=X.replace("[",""),X.replace("]","")}return $}function k41($){if($=$.trim(),$.match(/^(.*:\/\/)(.*)/m))$=$.replace(/^(.*:\/\/)(.*)/gm,"$2");if($=Cw4($),V41($)&&$.indexOf("[")===-1)$=`[${$}]`;let Z=V41($)?$.match(/(]:)(\d+)/):$.match(/(:)(\d+)/),Q=Z&&Z.length===3&&Z[1]&&Z[2]?parseInt(Z[2]):Vw4.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 Dc{src;listen;hostname;port;didConnect;reconnects;lastConnect;gossiped;tlsName;resolves;constructor($,Z=!1){this.src=$,this.tlsName="";let Q=k41($);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,I41.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}://${V41(X)?"["+X+"]":X}`);J.port=`${this.port}`;let G=new Dc(J.host,!1);G.tlsName=this.hostname,Z.push(G)}}if($.randomize)(0,M41.shuffle)(Z);return this.resolves=Z,Z}}M3$.ServerImpl=Dc;class AK0{firstSelect;servers;currentServer;tlsName;randomize;constructor($={}){this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=$.randomize||!1}setServers($){if(!Array.isArray($)||$.length===0)throw kw4.InvalidArgumentError.format("servers","cannot be empty");let Z=(0,q41.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}=k41(Y),G=Q.get(J);if(G)G.gossiped=!1,X.push(G);else X.push(new Dc(Y))}if(this.randomize)(0,M41.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,I41.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,q41.getUrlParseFn)();$=Q?Q($):$;let X=new Dc($,Z);if((0,I41.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 AK0.freezeAll(this.servers)}snapshotForHandler(){let $=this.currentServer;if(!$)return this.snapshot();let Z=this.servers.indexOf($);if(Z<=0)return this.snapshot();return AK0.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,q41.getUrlParseFn)(),J=new Map;if($.connect_urls&&$.connect_urls.length>0)$.connect_urls.forEach((W)=>{W=Y?Y(W,Z):W;let K=new Dc(W,!0);J.set(W,K)});let G=[];if(this.servers.forEach((W,K)=>{let H=W.listen;if(W.gossiped&&this.currentServer.listen!==H&&J.get(H)===void 0)G.push(K);J.delete(H)}),G.reverse(),G.forEach((W)=>{let K=this.servers.splice(W,1);X=X.concat(K[0].listen)}),J.forEach((W,K)=>{this.servers.push(W),Q.push(K)}),this.randomize&&Q.length>0){let W=this.currentServer,K=this.servers.filter((H)=>H!==W);(0,M41.shuffle)(K),this.servers=W?[W,...K]:K}return{added:Q,deleted:X}}}M3$.Servers=AK0});var RK0=b((C3$)=>{Object.defineProperty(C3$,"__esModule",{value:!0});C3$.QueuedIteratorImpl=void 0;var S41=DH(),V3$=eG();class k3${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,S41.deferred)(),this.yields=[],this.iterClosed=(0,S41.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 V3$.InvalidOperationError("iterator cannot be used when a callback is registered");if(this.yielding)throw new V3$.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,S41.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}}C3$.QueuedIteratorImpl=k3$});var _41=b((x3$)=>{Object.defineProperty(x3$,"__esModule",{value:!0});x3$.MuxSubscription=void 0;var xw4=dj(),_3$=eG();class v3${baseInbox;reqs;constructor(){this.reqs=new Map}size(){return this.reqs.size}init($){return this.baseInbox=`${(0,xw4.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 _3$.NoRespondersError(X.requestSubject):null;X.resolver($,Z)}}}}close(){let $=new _3$.RequestError("connection closed");this.reqs.forEach((Z)=>{Z.resolver($,{})})}}x3$.MuxSubscription=v3$});var v41=b((y3$)=>{Object.defineProperty(y3$,"__esModule",{value:!0});y3$.Heartbeat=void 0;var fw4=DH();class b3${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,fw4.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})}}y3$.Heartbeat=b3$});var b41=b((c3$)=>{Object.defineProperty(c3$,"__esModule",{value:!0});c3$.DenoBuffer=c3$.MAX_SIZE=c3$.AssertionError=void 0;c3$.assert=u3$;c3$.concat=l3$;c3$.append=yw4;c3$.readAll=gw4;c3$.writeAll=hw4;var bw4=sG();class x41 extends Error{constructor($){super($);this.name="AssertionError"}}c3$.AssertionError=x41;function u3$($,Z="Assertion failed."){if(!$)throw new x41(Z)}var h3$=32768;c3$.MAX_SIZE=4294967294;function qK0($,Z,Q=0){let X=Z.byteLength-Q;if($.byteLength>X)$=$.subarray(0,X);return Z.set($,Q),$.byteLength}function l3$($,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 yw4($,Z){return l3$($,Uint8Array.of(Z))}class f41{_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($){u3$($<=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=qK0(this._buf.subarray(this._off),$);return this._off+=Z,Z}writeByte($){return this.write(Uint8Array.of($))}writeString($){return this.write(bw4.TE.encode($))}write($){let Z=this._grow($.byteLength);return qK0($,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)qK0(this._buf.subarray(this._off),this._buf);else if(X+$>c3$.MAX_SIZE)throw Error("The buffer cannot be grown beyond the maximum size.");else{let Y=new Uint8Array(Math.min(2*X+$,c3$.MAX_SIZE));qK0(this._buf.subarray(this._off),Y),this._buf=Y}return this._off=0,this._reslice(Math.min(Z+$,c3$.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(h3$);while(!0){let X=this.capacity-this.length<h3$,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}}}c3$.DenoBuffer=f41;function gw4($){let Z=new f41;return Z.readFrom($),Z.bytes()}function hw4($,Z){let Q=0;while(Q<Z.length)Q+=$.write(Z.subarray(Q))}});var h41=b((n3$)=>{Object.defineProperty(n3$,"__esModule",{value:!0});n3$.cc=n3$.State=n3$.Parser=n3$.Kind=void 0;n3$.describe=pw4;var y41=b41(),g41=sG();n3$.Kind={OK:0,ERR:1,MSG:2,INFO:3,PING:4,PONG:5};function pw4($){let Z,Q="";switch($.kind){case n3$.Kind.MSG:Z="MSG";break;case n3$.Kind.OK:Z="OK";break;case n3$.Kind.ERR:Z="ERR",Q=g41.TD.decode($.data);break;case n3$.Kind.PING:Z="PING";break;case n3$.Kind.PONG:Z="PONG";break;case n3$.Kind.INFO:Z="INFO",Q=g41.TD.decode($.data)}return`${Z}: ${Q}`}function d3$(){let $={};return $.sid=-1,$.hdr=-1,$.size=-1,$}var i3$=48,nw4=57,Oc=67108864;class p3${dispatcher;state;as;drop;hdr;ma;argBuf;msgBuf;constructor($){this.dispatcher=$,this.state=n3$.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 n3$.State.OP_START:switch(Q){case n3$.cc.M:case n3$.cc.m:this.state=n3$.State.OP_M,this.hdr=-1,this.ma=d3$();break;case n3$.cc.H:case n3$.cc.h:this.state=n3$.State.OP_H,this.hdr=0,this.ma=d3$();break;case n3$.cc.P:case n3$.cc.p:this.state=n3$.State.OP_P;break;case n3$.cc.PLUS:this.state=n3$.State.OP_PLUS;break;case n3$.cc.MINUS:this.state=n3$.State.OP_MINUS;break;case n3$.cc.I:case n3$.cc.i:this.state=n3$.State.OP_I;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_H:switch(Q){case n3$.cc.M:case n3$.cc.m:this.state=n3$.State.OP_M;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_M:switch(Q){case n3$.cc.S:case n3$.cc.s:this.state=n3$.State.OP_MS;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_MS:switch(Q){case n3$.cc.G:case n3$.cc.g:this.state=n3$.State.OP_MSG;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_MSG:switch(Q){case n3$.cc.SPACE:case n3$.cc.TAB:this.state=n3$.State.OP_MSG_SPC;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_MSG_SPC:switch(Q){case n3$.cc.SPACE:case n3$.cc.TAB:continue;default:this.state=n3$.State.MSG_ARG,this.as=Z}break;case n3$.State.MSG_ARG:switch(Q){case n3$.cc.CR:this.drop=1;break;case n3$.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=n3$.State.MSG_PAYLOAD,Z=this.as+this.ma.size-1;break}default:if(this.argBuf)this.argBuf.writeByte(Q)}break;case n3$.State.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){let X=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:n3$.Kind.MSG,msg:this.ma,data:X}),this.argBuf=void 0,this.msgBuf=void 0,this.state=n3$.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:n3$.Kind.MSG,msg:this.ma,data:$.subarray(this.as,Z)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=n3$.State.MSG_END;break;case n3$.State.MSG_END:switch(Q){case n3$.cc.NL:this.drop=0,this.as=Z+1,this.state=n3$.State.OP_START;break;default:continue}break;case n3$.State.OP_PLUS:switch(Q){case n3$.cc.O:case n3$.cc.o:this.state=n3$.State.OP_PLUS_O;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_PLUS_O:switch(Q){case n3$.cc.K:case n3$.cc.k:this.state=n3$.State.OP_PLUS_OK;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_PLUS_OK:switch(Q){case n3$.cc.NL:this.dispatcher.push({kind:n3$.Kind.OK}),this.drop=0,this.state=n3$.State.OP_START;break}break;case n3$.State.OP_MINUS:switch(Q){case n3$.cc.E:case n3$.cc.e:this.state=n3$.State.OP_MINUS_E;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_MINUS_E:switch(Q){case n3$.cc.R:case n3$.cc.r:this.state=n3$.State.OP_MINUS_ER;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_MINUS_ER:switch(Q){case n3$.cc.R:case n3$.cc.r:this.state=n3$.State.OP_MINUS_ERR;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_MINUS_ERR:switch(Q){case n3$.cc.SPACE:case n3$.cc.TAB:this.state=n3$.State.OP_MINUS_ERR_SPC;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_MINUS_ERR_SPC:switch(Q){case n3$.cc.SPACE:case n3$.cc.TAB:continue;default:this.state=n3$.State.MINUS_ERR_ARG,this.as=Z}break;case n3$.State.MINUS_ERR_ARG:switch(Q){case n3$.cc.CR:this.drop=1;break;case n3$.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:n3$.Kind.ERR,data:X}),this.drop=0,this.as=Z+1,this.state=n3$.State.OP_START;break}default:if(this.argBuf)this.argBuf.write(Uint8Array.of(Q))}break;case n3$.State.OP_P:switch(Q){case n3$.cc.I:case n3$.cc.i:this.state=n3$.State.OP_PI;break;case n3$.cc.O:case n3$.cc.o:this.state=n3$.State.OP_PO;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_PO:switch(Q){case n3$.cc.N:case n3$.cc.n:this.state=n3$.State.OP_PON;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_PON:switch(Q){case n3$.cc.G:case n3$.cc.g:this.state=n3$.State.OP_PONG;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_PONG:switch(Q){case n3$.cc.NL:this.dispatcher.push({kind:n3$.Kind.PONG}),this.drop=0,this.state=n3$.State.OP_START;break}break;case n3$.State.OP_PI:switch(Q){case n3$.cc.N:case n3$.cc.n:this.state=n3$.State.OP_PIN;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_PIN:switch(Q){case n3$.cc.G:case n3$.cc.g:this.state=n3$.State.OP_PING;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_PING:switch(Q){case n3$.cc.NL:this.dispatcher.push({kind:n3$.Kind.PING}),this.drop=0,this.state=n3$.State.OP_START;break}break;case n3$.State.OP_I:switch(Q){case n3$.cc.N:case n3$.cc.n:this.state=n3$.State.OP_IN;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_IN:switch(Q){case n3$.cc.F:case n3$.cc.f:this.state=n3$.State.OP_INF;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_INF:switch(Q){case n3$.cc.O:case n3$.cc.o:this.state=n3$.State.OP_INFO;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_INFO:switch(Q){case n3$.cc.SPACE:case n3$.cc.TAB:this.state=n3$.State.OP_INFO_SPC;break;default:throw this.fail($.subarray(Z))}break;case n3$.State.OP_INFO_SPC:switch(Q){case n3$.cc.SPACE:case n3$.cc.TAB:continue;default:this.state=n3$.State.INFO_ARG,this.as=Z}break;case n3$.State.INFO_ARG:switch(Q){case n3$.cc.CR:this.drop=1;break;case n3$.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:n3$.Kind.INFO,data:X}),this.drop=0,this.as=Z+1,this.state=n3$.State.OP_START;break}default:if(this.argBuf)this.argBuf.writeByte(Q)}break;default:throw this.fail($.subarray(Z))}}if((this.state===n3$.State.MSG_ARG||this.state===n3$.State.MINUS_ERR_ARG||this.state===n3$.State.INFO_ARG)&&!this.argBuf)this.argBuf=new y41.DenoBuffer($.subarray(this.as,Z-this.drop));if(this.state===n3$.State.MSG_PAYLOAD&&!this.msgBuf){if(!this.argBuf)this.cloneMsgArg();this.msgBuf=new y41.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 y41.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 n3$.cc.SPACE:case n3$.cc.TAB:case n3$.cc.CR:case n3$.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],Oc);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],Oc);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}: ${g41.TD.decode($)}`)}processHeaderMsgArgs($){let Z=[],Q=-1;for(let X=0;X<$.length;X++)switch($[X]){case n3$.cc.SPACE:case n3$.cc.TAB:case n3$.cc.CR:case n3$.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],Oc),this.ma.size=this.protoParseInt(Z[3],Oc);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],Oc),this.ma.size=this.protoParseInt(Z[4],Oc);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]<i3$||$[X]>nw4)return-1;Q=Q*10+($[X]-i3$)}return Z!==void 0&&Q>Z?-1:Q}}n3$.Parser=p3$;n3$.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};n3$.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 VK0=b((o3$)=>{Object.defineProperty(o3$,"__esModule",{value:!0});o3$.MsgHdrsImpl=void 0;o3$.canonicalMIMEHeaderKey=l41;o3$.headers=aw4;var t3$=sG(),OH=dj(),IK0=eG();function l41($){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 IK0.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 aw4($=0,Z=""){if($===0&&Z!=="")throw IK0.InvalidArgumentError.format("code","is required");else if($>0&&Z==="")throw IK0.InvalidArgumentError.format("description","is required");return new jc($,Z)}var u41="NATS/1.0";class jc{_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 jc,X=t3$.TD.decode($).split(`\r
2183
2183
  `),Y=X[0];if(Y!==u41){let J=Y.replace(u41,"").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 W=J.slice(0,G),K=J.slice(G+1).trim();Z.append(W,K)}}});return Z}toString(){if(this.headers.size===0&&this._code===0)return"";let $=u41;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
2184
2184
  ${Z}: ${Q[X]}`;return`${$}\r
@@ -3085,7 +3085,7 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
3085
3085
 
3086
3086
  new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
3087
3087
  `);this.baseURL=J.baseURL,this._baseURLIsExplicit=Y.__baseURLIsExplicit??!!$,this.timeout=J.timeout??x31.DEFAULT_TIMEOUT,this.logger=J.logger??console,this.logLevel=z$0,this.logLevel=NL0(J.logLevel,"ClientOptions.logLevel",P6(this))??NL0(h4("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",P6(this))??z$0,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??$S$(),G1(this,rL0,QS$,"f"),this.middleware=[...J.middleware??[]];let G=h4("ANTHROPIC_CUSTOM_HEADERS");if(G){let K={};for(let H of G.split(`
3088
- `)){let F=H.indexOf(":");if(F>=0)K[H.substring(0,F).trim()]=H.substring(F+1).trim()}J.defaultHeaders={...K,...J.defaultHeaders}}let W=Y.__auth;if(delete J.__auth,delete J.__baseURLIsExplicit,this._options=J,this.apiKey=typeof Z==="string"?Z:null,this.authToken=Q,this.webhookKey=X,W){if(this._authState=W,!this._baseURLIsExplicit&&W.baseURL)this.baseURL=W.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let K=J.credentials??null;if(K)this._authState.provider=K,this._authState.tokenCache=this._makeTokenCache(K);else if(J.config!=null){let H=YG1(J.config,this._credentialResolverOptions());this._authState.provider=H.provider,this._authState.tokenCache=this._makeTokenCache(H.provider),this._authState.extraHeaders=H.extraHeaders,this._applyCredentialBaseURL(H.baseURL)}else if(J.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(J.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL($){if(!$)return;let Z=$.replace(/\/+$/,"");if(this._authState.baseURL=Z,!this._baseURLIsExplicit)this.baseURL=Z}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this._credentialsFetch(),userAgent:this.getUserAgent(),onCacheWriteError:($)=>{P6(this).debug("credential cache write failed (best-effort)",$)},onSafetyWarning:($)=>{P6(this).warn($)}}}_credentialsFetch(){return WG1(this.fetch,this.middleware,void 0,this)}_makeTokenCache($){return new aJ1($,(Z)=>{P6(this).debug("advisory token refresh failed; serving cached token",Z)})}withOptions($){let Z="credentials"in $||"config"in $||"profile"in $,Q="apiKey"in $||"authToken"in $||Z,X={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,middleware:this.middleware,apiKey:this.apiKey,authToken:this.authToken,webhookKey:this.webhookKey,credentials:this.credentials,...Z?{credentials:void 0,config:void 0,profile:void 0}:{},...$,__auth:Q?void 0:this._authState,__baseURLIsExplicit:"baseURL"in $?!0:this._baseURLIsExplicit};return new this.constructor(X)}async _resolveDefaultCredentials($){try{let Z=await gS$(this._credentialResolverOptions(),$);if(Z)this._authState.provider=Z.provider,this._authState.tokenCache=this._makeTokenCache(Z.provider),this._authState.extraHeaders=Z.extraHeaders,this._applyCredentialBaseURL(Z.baseURL);else if($!=null)throw new A1(`Profile "${$}" could not be resolved (no <config_dir>/configs/${$}.json found).`)}catch(Z){this._authState.error=Z}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}_authFlags($){let Z=this._requestAuthFlags.get($);if(!Z)Z={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set($,Z);return Z}async authHeaders($){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let Z=await this._authState.tokenCache.getToken();return this._authFlags($).usedTokenCache=!0,y0([{Authorization:`Bearer ${Z}`}])}return y0([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return y0([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return y0([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return BS$($)}getUserAgent(){return`${this.constructor.name}/JS ${ZK}`}defaultIdempotencyKey(){return`stainless-node-retry-${sd()}`}makeStatusError($,Z,Q,X){return qZ.generate($,Z,Q,X)}buildURL($,Z,Q){let X=!$0(this,v31,"m",jv$).call(this)&&Q||this.baseURL,Y=nC$($)?new URL($):new URL(X+(X.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),G=Object.fromEntries(Y.searchParams);if(!hJ1(J)||!hJ1(G))Z={...G,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))Y.search=this.stringifyQuery(Z);return Y.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new A1("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:Q}){if(this._authState.tokenCache&&this.apiKey==null){let X=$.headers instanceof Headers?$.headers:new Headers($.headers);for(let[J,G]of Object.entries(this._authState.extraHeaders))if(!X.has(J))X.set(J,G);if(!X.get("anthropic-beta")?.split(",").map((J)=>J.trim())?.includes(bA))X.append("anthropic-beta",bA);$.headers=X}}backendMiddleware(){return[]}get($,Z){return this.methodRequest("get",$,Z)}post($,Z){return this.methodRequest("post",$,Z)}patch($,Z){return this.methodRequest("patch",$,Z)}put($,Z){return this.methodRequest("put",$,Z)}delete($,Z){return this.methodRequest("delete",$,Z)}methodRequest($,Z,Q){return this.request(Promise.resolve(Q).then((X)=>{return{method:$,path:Z,...X}}))}request($,Z=null){return new yA(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,Q){let X=await $,Y=X.maxRetries??this.maxRetries;if(Z==null)Z=Y,this._requestAuthFlags.delete(X);await this.prepareOptions(X);let{req:J,url:G,timeout:W}=await this.buildRequest(X,{retryCount:Y-Z}),K="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),H=Q===void 0?"":`, retryOf: ${Q}`,F=Date.now();if(X.signal?.aborted)throw new cX;let U=new AbortController,N=await this.fetchWithTimeout(G,J,W,U,X,{requestLogID:K,retryOfRequestLogID:Q}).catch(fA),B=Date.now();if(N instanceof globalThis.Error){let j=`retrying, ${Z} attempts remaining`;if(X.signal?.aborted)throw new cX;let w=$K(N)||/timed? ?out/i.test(String(N)+("cause"in N?String(N.cause):"")),E=this.middleware.length>0||!!X.middleware?.length||this.backendMiddleware().length>0;if(E&&!w&&!iS$(N))throw P6(this).info(`[${K}] middleware error (not retryable)`),P6(this).debug(`[${K}] middleware error (not retryable)`,GN({retryOfRequestLogID:Q,url:G,durationMs:B-F,message:N.message})),N;if(Z)return P6(this).info(`[${K}] connection ${w?"timed out":"failed"} - ${j}`),P6(this).debug(`[${K}] connection ${w?"timed out":"failed"} (${j})`,GN({retryOfRequestLogID:Q,url:G,durationMs:B-F,message:N.message})),this.retryRequest(X,Z,Q??K);if(P6(this).info(`[${K}] connection ${w?"timed out":"failed"} - error; no more retries left`),P6(this).debug(`[${K}] connection ${w?"timed out":"failed"} (error; no more retries left)`,GN({retryOfRequestLogID:Q,url:G,durationMs:B-F,message:N.message})),w)throw new W$0;if(E&&!GG1(N))throw N;throw new eL({cause:N})}let D=[...N.headers.entries()].filter(([j])=>j==="request-id").map(([j,w])=>", "+j+": "+JSON.stringify(w)).join(""),O=`[${K}${H}${D}] ${J.method} ${G} ${N.ok?"succeeded":"failed"} with status ${N.status} in ${B-F}ms`;if(!N.ok){let j=await this.shouldRetry(N,X);if(Z&&j){let T=`retrying, ${Z} attempts remaining`;return await ZS$(N.body),P6(this).info(`${O} - ${T}`),P6(this).debug(`[${K}] response error (${T})`,GN({retryOfRequestLogID:Q,url:N.url,status:N.status,headers:N.headers,durationMs:B-F})),this.retryRequest(X,Z,Q??K,N.headers)}let w=j?"error; no more retries left":"error; not retryable";P6(this).info(`${O} - ${w}`);let E=await N.text().catch((T)=>fA(T).message),z=O$0(E),A=z?void 0:E;throw P6(this).debug(`[${K}] response error (${w})`,GN({retryOfRequestLogID:Q,url:N.url,status:N.status,headers:N.headers,message:A,durationMs:Date.now()-F})),this.makeStatusError(N.status,z,A,N.headers)}return P6(this).info(O),P6(this).debug(`[${K}] response start`,GN({retryOfRequestLogID:Q,url:N.url,status:N.status,headers:N.headers,durationMs:B-F})),{response:N,options:X,controller:U,requestLogID:K,retryOfRequestLogID:Q,startTime:F}}getAPIList($,Z,Q){return this.requestAPIList(Z,Q&&"then"in Q?Q.then((X)=>({method:"get",path:$,...X})):{method:"get",path:$,...Q})}requestAPIList($,Z){let Q=this.makeRequest(Z,null,void 0);return new wL0(this,Q,$)}async fetchWithTimeout($,Z,Q,X,Y,J){let{signal:G,method:W,...K}=Z||{},H=this._makeAbort(X);if(G)G.addEventListener("abort",H,{once:!0});let F=globalThis.ReadableStream&&K.body instanceof globalThis.ReadableStream||typeof K.body==="object"&&K.body!==null&&Symbol.asyncIterator in K.body,U={signal:X.signal,...F?{duplex:"half"}:{},method:"GET",...K};if(W)U.method=W.toUpperCase();let N=this.fetch,B=async(E,z)=>{let A=setTimeout(H,Q);try{return await N.call(void 0,E,z)}finally{clearTimeout(A)}},D=Y===void 0?B:async(E,z={})=>{let A=typeof E==="string"?E:E instanceof URL?E.href:E.url;if(z.headers=z.headers instanceof Headers?z.headers:new Headers(z.headers),await this.prepareRequest(z,{url:A,options:Y}),J)P6(this).debug(`[${J.requestLogID}] sending request`,GN({retryOfRequestLogID:J.retryOfRequestLogID,method:z.method,url:A,options:Y,headers:z.headers}));return B(E,z)},O=Y?.middleware,j=this.backendMiddleware(),w=O?.length||j.length?[...this.middleware,...O??[],...j]:this.middleware;return await WG1(D,w,Y,this)($,U)}async shouldRetry($,Z){let Q=this._authFlags(Z);if($.status===401&&this._authState.tokenCache&&Q.usedTokenCache&&!Q.didRefreshFor401)return Q.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let X=$.headers.get("x-should-retry");if(X==="true")return!0;if(X==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,Z,Q,X){let Y,J=X?.get("retry-after-ms");if(J){let W=parseFloat(J);if(!Number.isNaN(W))Y=W}let G=X?.get("retry-after");if(G&&!Y){let W=parseFloat(G);if(!Number.isNaN(W))Y=W*1000;else Y=Date.parse(G)-Date.now()}if(Y===void 0){let W=$.maxRetries??this.maxRetries;Y=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await $F(Y),this.makeRequest($,Z-1,Q)}calculateDefaultRetryTimeoutMillis($,Z){let Y=Z-$,J=Math.min(0.5*Math.pow(2,Y),8),G=1-Math.random()*0.25;return J*G*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new A1("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let Q={...$},{method:X,path:Y,query:J,defaultBaseURL:G}=Q;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let W=this.buildURL(Y,J,G);if("timeout"in Q)oC$("timeout",Q.timeout);Q.timeout=Q.timeout??this.timeout;let{bodyHeaders:K,body:H}=this.buildBody({options:Q}),F=await this.buildHeaders({options:$,method:X,bodyHeaders:K,retryCount:Z});return{req:{method:X,headers:F,...Q.signal&&{signal:Q.signal},...globalThis.ReadableStream&&H instanceof globalThis.ReadableStream&&{duplex:"half"},...H&&{body:H},...this.fetchOptions??{},...Q.fetchOptions??{}},url:W,timeout:Q.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:Q,retryCount:X}){let Y={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();Y[this.idempotencyHeader]=$.idempotencyKey}let J=y0([Y,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(X),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...j$0(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,Q,$.headers]);return this.validateHeaders(J),J.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let Q=y0([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&Q.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:XL0($)};else if(typeof $==="object"&&Q.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return $0(this,rL0,"f").call(this,{body:$,headers:Q})}}var v31,x31,rL0,jv$,wv$="\\n\\nHuman:",Ev$="\\n\\nAssistant:",QD;var f31=L(()=>{oJ();eH();QL0();tJ1();M9();$i();zS$();hS$();pS$();$9();BG1();Ov$();OL0();z31();_31();E31();S31();QL0();T6();WN();eH();x31=MZ,rL0=new WeakMap,v31=new WeakSet,jv$=function(){return this.baseURL!=="https://api.anthropic.com"};MZ.Anthropic=x31;MZ.HUMAN_PROMPT=wv$;MZ.AI_PROMPT=Ev$;MZ.DEFAULT_TIMEOUT=600000;MZ.AnthropicError=A1;MZ.APIError=qZ;MZ.APIConnectionError=eL;MZ.APIConnectionTimeoutError=W$0;MZ.APIUserAbortError=cX;MZ.NotFoundError=U$0;MZ.ConflictError=N$0;MZ.RateLimitError=L$0;MZ.BadRequestError=K$0;MZ.AuthenticationError=H$0;MZ.InternalServerError=D$0;MZ.PermissionDeniedError=F$0;MZ.UnprocessableEntityError=B$0;MZ.toFile=EL0;QD=class QD extends MZ{constructor(){super(...arguments);this.completions=new Ai(this),this.messages=new rA(this),this.models=new qi(this),this.beta=new g7(this)}};QD.Completions=Ai;QD.Messages=rA;QD.Models=qi;QD.Beta=g7});var zv$=L(()=>{M9();T$0();eH()});var SG1=L(()=>{f31();BG1();OL0();zv$();f31();$9();M9()});var Pv$;var Tv$=L(()=>{yJ1();SG1();Pv$={info:{id:"anthropic",name:"Anthropic",description:"Anthropic's Claude family of models",logo:"https://assets.decocache.com/decocms/51a209ae-14bc-4b6f-8216-8eb670695bd7/Anthropic-Icon--Streamline-Svg-Logos.svg"},supportedMethods:["api-key"],create($){let Z=G$0({apiKey:$}),Q=new QD({apiKey:$});return{info:this.info,aiSdk:Z,async listModels(){return(await Q.models.list()).data.map((Y)=>({modelId:Y.id,providerId:"anthropic",title:Y.display_name,description:null,logo:null,capabilities:[],limits:null,costs:null}))},async countTokens({messages:X,modelId:Y}){return{count:(await Q.messages.countTokens({messages:X,model:Y})).input_tokens}}}}}});import{z as WD}from"zod/v4";import{z as sA}from"zod/v4";import{z as nX}from"zod/v4";import{z as I8}from"zod/v4";import{z as d0}from"zod/v4";import{z as N6}from"zod/v4";import{z as m86}from"zod/v4";import{z as GD}from"zod/v4";import{z as Mi}from"zod/v4";import{z as vv$}from"zod/v4";import{z as eA}from"zod/v4";import{z as xv$}from"zod/v4";import{z as fv$}from"zod/v4";import{z as bv$}from"zod/v4";import{z as aY}from"zod/v4";import{z as A3}from"zod/v4";import{z as XD}from"zod/v4";import{z as YD}from"zod/v4";import{z as SE}from"zod/v4";import{z as D0}from"zod/v4";import{z as s1}from"zod/v4";import{z as h7}from"zod/v4";import{z as CE}from"zod/v4";import{z as iv$}from"zod/v4";function Vi($){return $.includes("/")?$:`models/${$}`}function Av$($){var Z,Q,X,Y,J;if($==null)return aU();let G=(Z=$.promptTokenCount)!=null?Z:0,W=(Q=$.candidatesTokenCount)!=null?Q:0,K=(X=$.toolUsePromptTokenCount)!=null?X:0,H=(Y=$.cachedContentTokenCount)!=null?Y:0,F=(J=$.thoughtsTokenCount)!=null?J:0,U=G+K;return{inputTokens:{total:U,noCache:U-H,cacheRead:H,cacheWrite:void 0},outputTokens:{total:W+F,text:W,reasoning:F},raw:$}}function O86($){let Z=D86.exec($);if(Z==null)return;return{mediaType:Z[1],data:Z[2]}}function j86($){let Z=O86($);if(Z==null)return;return{inlineData:{mimeType:Z.mediaType,data:Z.data}}}function w86($,Z,Q,X,Y=!0){let J=[],G=[];for(let W of Q)switch(W.type){case"text":{G.push(W.text);break}case"file":{if(W.data.type==="data")J.push({inlineData:{mimeType:r9({part:W}),data:B4(W.data.data)}});else if(W.data.type==="url"){let K=j86(W.data.url.toString());if(K!=null)J.push(K);else G.push(JSON.stringify(W))}else G.push(JSON.stringify(W));break}default:{G.push(JSON.stringify(W));break}}$.push({functionResponse:{...Y&&X!=null?{id:X}:{},name:Z,response:{name:Z,content:G.length>0?G.join(`
3088
+ `)){let F=H.indexOf(":");if(F>=0)K[H.substring(0,F).trim()]=H.substring(F+1).trim()}J.defaultHeaders={...K,...J.defaultHeaders}}let W=Y.__auth;if(delete J.__auth,delete J.__baseURLIsExplicit,this._options=J,this.apiKey=typeof Z==="string"?Z:null,this.authToken=Q,this.webhookKey=X,W){if(this._authState=W,!this._baseURLIsExplicit&&W.baseURL)this.baseURL=W.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let K=J.credentials??null;if(K)this._authState.provider=K,this._authState.tokenCache=this._makeTokenCache(K);else if(J.config!=null){let H=YG1(J.config,this._credentialResolverOptions());this._authState.provider=H.provider,this._authState.tokenCache=this._makeTokenCache(H.provider),this._authState.extraHeaders=H.extraHeaders,this._applyCredentialBaseURL(H.baseURL)}else if(J.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(J.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL($){if(!$)return;let Z=$.replace(/\/+$/,"");if(this._authState.baseURL=Z,!this._baseURLIsExplicit)this.baseURL=Z}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this._credentialsFetch(),userAgent:this.getUserAgent(),onCacheWriteError:($)=>{P6(this).debug("credential cache write failed (best-effort)",$)},onSafetyWarning:($)=>{P6(this).warn($)}}}_credentialsFetch(){return WG1(this.fetch,this.middleware,void 0,this)}_makeTokenCache($){return new aJ1($,(Z)=>{P6(this).debug("advisory token refresh failed; serving cached token",Z)})}withOptions($){let Z="credentials"in $||"config"in $||"profile"in $,Q="apiKey"in $||"authToken"in $||Z,X={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,middleware:this.middleware,apiKey:this.apiKey,authToken:this.authToken,webhookKey:this.webhookKey,credentials:this.credentials,...Z?{credentials:void 0,config:void 0,profile:void 0}:{},...$,__auth:Q?void 0:this._authState,__baseURLIsExplicit:"baseURL"in $?!0:this._baseURLIsExplicit};return new this.constructor(X)}async _resolveDefaultCredentials($){try{let Z=await gS$(this._credentialResolverOptions(),$);if(Z)this._authState.provider=Z.provider,this._authState.tokenCache=this._makeTokenCache(Z.provider),this._authState.extraHeaders=Z.extraHeaders,this._applyCredentialBaseURL(Z.baseURL);else if($!=null)throw new A1(`Profile "${$}" could not be resolved (no <config_dir>/configs/${$}.json found).`)}catch(Z){this._authState.error=Z}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}_authFlags($){let Z=this._requestAuthFlags.get($);if(!Z)Z={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set($,Z);return Z}async authHeaders($){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let Z=await this._authState.tokenCache.getToken();return this._authFlags($).usedTokenCache=!0,y0([{Authorization:`Bearer ${Z}`}])}return y0([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return y0([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return y0([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return BS$($)}getUserAgent(){return`${this.constructor.name}/JS ${ZK}`}defaultIdempotencyKey(){return`stainless-node-retry-${sd()}`}makeStatusError($,Z,Q,X){return qZ.generate($,Z,Q,X)}buildURL($,Z,Q){let X=!$0(this,v31,"m",jv$).call(this)&&Q||this.baseURL,Y=nC$($)?new URL($):new URL(X+(X.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),G=Object.fromEntries(Y.searchParams);if(!hJ1(J)||!hJ1(G))Z={...G,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))Y.search=this.stringifyQuery(Z);return Y.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new A1("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:Q}){if(this._authState.tokenCache&&this.apiKey==null){let X=$.headers instanceof Headers?$.headers:new Headers($.headers);for(let[J,G]of Object.entries(this._authState.extraHeaders))if(!X.has(J))X.set(J,G);if(!X.get("anthropic-beta")?.split(",").map((J)=>J.trim())?.includes(bA))X.append("anthropic-beta",bA);$.headers=X}}backendMiddleware(){return[]}get($,Z){return this.methodRequest("get",$,Z)}post($,Z){return this.methodRequest("post",$,Z)}patch($,Z){return this.methodRequest("patch",$,Z)}put($,Z){return this.methodRequest("put",$,Z)}delete($,Z){return this.methodRequest("delete",$,Z)}methodRequest($,Z,Q){return this.request(Promise.resolve(Q).then((X)=>{return{method:$,path:Z,...X}}))}request($,Z=null){return new yA(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,Q){let X=await $,Y=X.maxRetries??this.maxRetries;if(Z==null)Z=Y,this._requestAuthFlags.delete(X);await this.prepareOptions(X);let{req:J,url:G,timeout:W}=await this.buildRequest(X,{retryCount:Y-Z}),K="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),H=Q===void 0?"":`, retryOf: ${Q}`,F=Date.now();if(X.signal?.aborted)throw new cX;let U=new AbortController,N=await this.fetchWithTimeout(G,J,W,U,X,{requestLogID:K,retryOfRequestLogID:Q}).catch(fA),B=Date.now();if(N instanceof globalThis.Error){let j=`retrying, ${Z} attempts remaining`;if(X.signal?.aborted)throw new cX;let w=$K(N)||/timed? ?out/i.test(String(N)+("cause"in N?String(N.cause):"")),E=this.middleware.length>0||!!X.middleware?.length||this.backendMiddleware().length>0;if(E&&!w&&!iS$(N))throw P6(this).info(`[${K}] middleware error (not retryable)`),P6(this).debug(`[${K}] middleware error (not retryable)`,GN({retryOfRequestLogID:Q,url:G,durationMs:B-F,message:N.message})),N;if(Z)return P6(this).info(`[${K}] connection ${w?"timed out":"failed"} - ${j}`),P6(this).debug(`[${K}] connection ${w?"timed out":"failed"} (${j})`,GN({retryOfRequestLogID:Q,url:G,durationMs:B-F,message:N.message})),this.retryRequest(X,Z,Q??K);if(P6(this).info(`[${K}] connection ${w?"timed out":"failed"} - error; no more retries left`),P6(this).debug(`[${K}] connection ${w?"timed out":"failed"} (error; no more retries left)`,GN({retryOfRequestLogID:Q,url:G,durationMs:B-F,message:N.message})),w)throw new W$0;if(E&&!GG1(N))throw N;throw new eL({cause:N})}let D=[...N.headers.entries()].filter(([j])=>j==="request-id").map(([j,w])=>", "+j+": "+JSON.stringify(w)).join(""),O=`[${K}${H}${D}] ${J.method} ${G} ${N.ok?"succeeded":"failed"} with status ${N.status} in ${B-F}ms`;if(!N.ok){let j=await this.shouldRetry(N,X);if(Z&&j){let T=`retrying, ${Z} attempts remaining`;return await ZS$(N.body),P6(this).info(`${O} - ${T}`),P6(this).debug(`[${K}] response error (${T})`,GN({retryOfRequestLogID:Q,url:N.url,status:N.status,headers:N.headers,durationMs:B-F})),this.retryRequest(X,Z,Q??K,N.headers)}let w=j?"error; no more retries left":"error; not retryable";P6(this).info(`${O} - ${w}`);let E=await N.text().catch((T)=>fA(T).message),z=O$0(E),A=z?void 0:E;throw P6(this).debug(`[${K}] response error (${w})`,GN({retryOfRequestLogID:Q,url:N.url,status:N.status,headers:N.headers,message:A,durationMs:Date.now()-F})),this.makeStatusError(N.status,z,A,N.headers)}return P6(this).info(O),P6(this).debug(`[${K}] response start`,GN({retryOfRequestLogID:Q,url:N.url,status:N.status,headers:N.headers,durationMs:B-F})),{response:N,options:X,controller:U,requestLogID:K,retryOfRequestLogID:Q,startTime:F}}getAPIList($,Z,Q){return this.requestAPIList(Z,Q&&"then"in Q?Q.then((X)=>({method:"get",path:$,...X})):{method:"get",path:$,...Q})}requestAPIList($,Z){let Q=this.makeRequest(Z,null,void 0);return new wL0(this,Q,$)}async fetchWithTimeout($,Z,Q,X,Y,J){let{signal:G,method:W,...K}=Z||{},H=this._makeAbort(X);if(G)G.addEventListener("abort",H,{once:!0});let F=globalThis.ReadableStream&&K.body instanceof globalThis.ReadableStream||typeof K.body==="object"&&K.body!==null&&Symbol.asyncIterator in K.body,U={signal:X.signal,...F?{duplex:"half"}:{},method:"GET",...K};if(W)U.method=W.toUpperCase();let N=this.fetch,B=async(E,z)=>{let A=setTimeout(H,Q);try{return await N.call(void 0,E,z)}finally{clearTimeout(A)}},D=Y===void 0?B:async(E,z={})=>{let A=typeof E==="string"?E:E instanceof URL?E.href:E.url;if(z.headers=z.headers instanceof Headers?z.headers:new Headers(z.headers),await this.prepareRequest(z,{url:A,options:Y}),J)P6(this).debug(`[${J.requestLogID}] sending request`,GN({retryOfRequestLogID:J.retryOfRequestLogID,method:z.method,url:A,options:Y,headers:z.headers}));return B(E,z)},O=Y?.middleware,j=this.backendMiddleware(),w=O?.length||j.length?[...this.middleware,...O??[],...j]:this.middleware;return await WG1(D,w,Y,this)($,U)}async shouldRetry($,Z){let Q=this._authFlags(Z);if($.status===401&&this._authState.tokenCache&&Q.usedTokenCache&&!Q.didRefreshFor401)return Q.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let X=$.headers.get("x-should-retry");if(X==="true")return!0;if(X==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,Z,Q,X){let Y,J=X?.get("retry-after-ms");if(J){let W=parseFloat(J);if(!Number.isNaN(W))Y=W}let G=X?.get("retry-after");if(G&&!Y){let W=parseFloat(G);if(!Number.isNaN(W))Y=W*1000;else Y=Date.parse(G)-Date.now()}if(Y===void 0){let W=$.maxRetries??this.maxRetries;Y=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await $F(Y),this.makeRequest($,Z-1,Q)}calculateDefaultRetryTimeoutMillis($,Z){let Y=Z-$,J=Math.min(0.5*Math.pow(2,Y),8),G=1-Math.random()*0.25;return J*G*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new A1("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let Q={...$},{method:X,path:Y,query:J,defaultBaseURL:G}=Q;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let W=this.buildURL(Y,J,G);if("timeout"in Q)oC$("timeout",Q.timeout);Q.timeout=Q.timeout??this.timeout;let{bodyHeaders:K,body:H}=this.buildBody({options:Q}),F=await this.buildHeaders({options:$,method:X,bodyHeaders:K,retryCount:Z});return{req:{method:X,headers:F,...Q.signal&&{signal:Q.signal},...globalThis.ReadableStream&&H instanceof globalThis.ReadableStream&&{duplex:"half"},...H&&{body:H},...this.fetchOptions??{},...Q.fetchOptions??{}},url:W,timeout:Q.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:Q,retryCount:X}){let Y={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();Y[this.idempotencyHeader]=$.idempotencyKey}let J=y0([Y,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(X),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...j$0(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,Q,$.headers]);return this.validateHeaders(J),J.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let Q=y0([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&Q.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:XL0($)};else if(typeof $==="object"&&Q.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return $0(this,rL0,"f").call(this,{body:$,headers:Q})}}var v31,x31,rL0,jv$,wv$="\\n\\nHuman:",Ev$="\\n\\nAssistant:",QD;var f31=L(()=>{oJ();eH();QL0();tJ1();M9();$i();zS$();hS$();pS$();$9();BG1();Ov$();OL0();z31();_31();E31();S31();QL0();T6();WN();eH();x31=MZ,rL0=new WeakMap,v31=new WeakSet,jv$=function(){return this.baseURL!=="https://api.anthropic.com"};MZ.Anthropic=x31;MZ.HUMAN_PROMPT=wv$;MZ.AI_PROMPT=Ev$;MZ.DEFAULT_TIMEOUT=600000;MZ.AnthropicError=A1;MZ.APIError=qZ;MZ.APIConnectionError=eL;MZ.APIConnectionTimeoutError=W$0;MZ.APIUserAbortError=cX;MZ.NotFoundError=U$0;MZ.ConflictError=N$0;MZ.RateLimitError=L$0;MZ.BadRequestError=K$0;MZ.AuthenticationError=H$0;MZ.InternalServerError=D$0;MZ.PermissionDeniedError=F$0;MZ.UnprocessableEntityError=B$0;MZ.toFile=EL0;QD=class QD extends MZ{constructor(){super(...arguments);this.completions=new Ai(this),this.messages=new rA(this),this.models=new qi(this),this.beta=new g7(this)}};QD.Completions=Ai;QD.Messages=rA;QD.Models=qi;QD.Beta=g7});var zv$=L(()=>{M9();T$0();eH()});var SG1=L(()=>{f31();BG1();OL0();zv$();f31();$9();M9()});var Pv$;var Tv$=L(()=>{yJ1();SG1();Pv$={info:{id:"anthropic",name:"Anthropic",description:"Anthropic's Claude family of models",logo:"https://assets.decocache.com/decocms/51a209ae-14bc-4b6f-8216-8eb670695bd7/Anthropic-Icon--Streamline-Svg-Logos.svg"},supportedMethods:["api-key"],create($){let Z=G$0({apiKey:$}),Q=new QD({apiKey:$});return{info:this.info,aiSdk:Z,async listModels(){let X=[];for await(let Y of Q.models.list())X.push({modelId:Y.id,providerId:"anthropic",title:Y.display_name,description:null,logo:null,capabilities:[],limits:null,costs:null});return X},async countTokens({messages:X,modelId:Y}){return{count:(await Q.messages.countTokens({messages:X,model:Y})).input_tokens}}}}}});import{z as WD}from"zod/v4";import{z as sA}from"zod/v4";import{z as nX}from"zod/v4";import{z as I8}from"zod/v4";import{z as d0}from"zod/v4";import{z as N6}from"zod/v4";import{z as m86}from"zod/v4";import{z as GD}from"zod/v4";import{z as Mi}from"zod/v4";import{z as vv$}from"zod/v4";import{z as eA}from"zod/v4";import{z as xv$}from"zod/v4";import{z as fv$}from"zod/v4";import{z as bv$}from"zod/v4";import{z as aY}from"zod/v4";import{z as A3}from"zod/v4";import{z as XD}from"zod/v4";import{z as YD}from"zod/v4";import{z as SE}from"zod/v4";import{z as D0}from"zod/v4";import{z as s1}from"zod/v4";import{z as h7}from"zod/v4";import{z as CE}from"zod/v4";import{z as iv$}from"zod/v4";function Vi($){return $.includes("/")?$:`models/${$}`}function Av$($){var Z,Q,X,Y,J;if($==null)return aU();let G=(Z=$.promptTokenCount)!=null?Z:0,W=(Q=$.candidatesTokenCount)!=null?Q:0,K=(X=$.toolUsePromptTokenCount)!=null?X:0,H=(Y=$.cachedContentTokenCount)!=null?Y:0,F=(J=$.thoughtsTokenCount)!=null?J:0,U=G+K;return{inputTokens:{total:U,noCache:U-H,cacheRead:H,cacheWrite:void 0},outputTokens:{total:W+F,text:W,reasoning:F},raw:$}}function O86($){let Z=D86.exec($);if(Z==null)return;return{mediaType:Z[1],data:Z[2]}}function j86($){let Z=O86($);if(Z==null)return;return{inlineData:{mimeType:Z.mediaType,data:Z.data}}}function w86($,Z,Q,X,Y=!0){let J=[],G=[];for(let W of Q)switch(W.type){case"text":{G.push(W.text);break}case"file":{if(W.data.type==="data")J.push({inlineData:{mimeType:r9({part:W}),data:B4(W.data.data)}});else if(W.data.type==="url"){let K=j86(W.data.url.toString());if(K!=null)J.push(K);else G.push(JSON.stringify(W))}else G.push(JSON.stringify(W));break}default:{G.push(JSON.stringify(W));break}}$.push({functionResponse:{...Y&&X!=null?{id:X}:{},name:Z,response:{name:Z,content:G.length>0?G.join(`
3089
3089
  `):"Tool executed successfully."},...J.length>0?{parts:J}:{}}})}function E86($,Z,Q,X,Y=!0){for(let J of Q)switch(J.type){case"text":$.push({functionResponse:{...Y&&X!=null?{id:X}:{},name:Z,response:{name:Z,content:J.text}}});break;case"file":{if(J.data.type==="data"){let G=aQ(J.mediaType);$.push({inlineData:{mimeType:r9({part:J}),data:B4(J.data.data)}},{text:`Tool executed successfully and returned this ${G==="image"?"image":"file"} as a response`})}else $.push({text:JSON.stringify(J)});break}default:$.push({text:JSON.stringify(J)});break}}function z86($,Z){var Q,X,Y,J,G,W;let K=[],H=[],F=!0,U=(Q=Z==null?void 0:Z.isGemmaModel)!=null?Q:!1,N=(X=Z==null?void 0:Z.isGemini3Model)!=null?X:!1,B=Z==null?void 0:Z.onWarning,D=(Y=Z==null?void 0:Z.providerOptionsNames)!=null?Y:["google"],O=!D.includes("google"),j=(J=Z==null?void 0:Z.supportsFunctionResponseParts)!=null?J:!0,w=(G=Z==null?void 0:Z.includeFunctionCallIds)!=null?G:!0,E=!1,z=[],A=(T)=>{return z.push(T),E=!0,L86},P=(T)=>{var q,f,S,V,u;for(let g of D){let l=(q=T.providerOptions)==null?void 0:q[g];if(l!=null)return l}if(O)return(f=T.providerOptions)==null?void 0:f.google;return(u=(S=T.providerOptions)==null?void 0:S.googleVertex)!=null?u:(V=T.providerOptions)==null?void 0:V.vertex};for(let{role:T,content:q}of $)switch(T){case"system":{if(!F)throw new Z$({functionality:"system messages are only supported at the beginning of the conversation"});K.push({text:q});break}case"user":{F=!1;let f=[];for(let S of q)switch(S.type){case"text":{f.push({text:S.text});break}case"file":{switch(S.data.type){case"url":{f.push({fileData:{mimeType:r9({part:S}),fileUri:S.data.url.toString()}});break}case"reference":{if(O)throw new Z$({functionality:"file parts with provider references"});f.push({fileData:{mimeType:r9({part:S}),fileUri:rQ({reference:S.data.reference,provider:"google"})}});break}case"text":{f.push({inlineData:{mimeType:nJ(S.mediaType)?S.mediaType:"text/plain",data:B4(new TextEncoder().encode(S.data.text))}});break}case"data":{f.push({inlineData:{mimeType:r9({part:S}),data:B4(S.data.data)}});break}}break}}H.push({role:"user",parts:f});break}case"assistant":{F=!1;let f=!1;H.push({role:"model",parts:q.map((S)=>{let V=P(S),u=(V==null?void 0:V.thoughtSignature)!=null?String(V.thoughtSignature):void 0;switch(S.type){case"text":return S.text.length===0?void 0:{text:S.text,thoughtSignature:u};case"reasoning":return S.text.length===0?void 0:{text:S.text,thought:!0,thoughtSignature:u};case"reasoning-file":{switch(S.data.type){case"url":throw new Z$({functionality:"File data URLs in assistant messages are not supported"});case"data":return{inlineData:{mimeType:S.mediaType,data:B4(S.data.data)},thought:!0,thoughtSignature:u}}break}case"file":{switch(S.data.type){case"url":throw new Z$({functionality:"File data URLs in assistant messages are not supported"});case"reference":{if(O)throw new Z$({functionality:"file parts with provider references"});return{fileData:{mimeType:S.mediaType,fileUri:rQ({reference:S.data.reference,provider:"google"})},...(V==null?void 0:V.thought)===!0?{thought:!0}:{},thoughtSignature:u}}case"text":return{inlineData:{mimeType:nJ(S.mediaType)?S.mediaType:"text/plain",data:B4(new TextEncoder().encode(S.data.text))},...(V==null?void 0:V.thought)===!0?{thought:!0}:{},thoughtSignature:u};case"data":return{inlineData:{mimeType:S.mediaType,data:B4(S.data.data)},...(V==null?void 0:V.thought)===!0?{thought:!0}:{},thoughtSignature:u}}break}case"tool-call":{let g=(V==null?void 0:V.serverToolCallId)!=null?String(V.serverToolCallId):void 0,l=(V==null?void 0:V.serverToolType)!=null?String(V.serverToolType):void 0,h=g!=null&&l!=null,i=!h&&u==null&&f,H0=u!=null?u:N&&!i?A(S.toolName):void 0;if(!h&&u!=null)f=!0;if(h)return{toolCall:{toolType:l,args:typeof S.input==="string"?tJ(S.input):S.input,id:g},thoughtSignature:H0};return{functionCall:{...w&&S.toolCallId!=null?{id:S.toolCallId}:{},name:S.toolName,args:S.input},thoughtSignature:H0}}case"tool-result":{let g=(V==null?void 0:V.serverToolCallId)!=null?String(V.serverToolCallId):void 0,l=(V==null?void 0:V.serverToolType)!=null?String(V.serverToolType):void 0;if(g&&l)return{toolResponse:{toolType:l,response:S.output.type==="json"?S.output.value:{},id:g},thoughtSignature:u};return}}}).filter((S)=>S!==void 0)});break}case"tool":{F=!1;let f=[];for(let S of q){if(S.type==="tool-approval-response")continue;let V=P(S),u=(V==null?void 0:V.serverToolCallId)!=null?String(V.serverToolCallId):void 0,g=(V==null?void 0:V.serverToolType)!=null?String(V.serverToolType):void 0;if(u&&g){let h=(V==null?void 0:V.thoughtSignature)!=null?String(V.thoughtSignature):void 0;if(H.length>0){let i=H[H.length-1];if(i.role==="model"){i.parts.push({toolResponse:{toolType:g,response:S.output.type==="json"?S.output.value:{},id:u},thoughtSignature:h});continue}}}let l=S.output;if(l.type==="content")if(j)w86(f,S.toolName,l.value,S.toolCallId,w);else E86(f,S.toolName,l.value,S.toolCallId,w);else f.push({functionResponse:{...w&&S.toolCallId!=null?{id:S.toolCallId}:{},name:S.toolName,response:{name:S.toolName,content:l.type==="execution-denied"?(W=l.reason)!=null?W:"Tool call execution denied.":l.value}}})}H.push({role:"user",parts:f});break}}if(U&&K.length>0&&H.length>0&&H[0].role==="user"){let T=K.map((q)=>q.text).join(`
3090
3090
 
3091
3091
  `);H[0].parts.unshift({text:T+`
@@ -3869,7 +3869,7 @@ ${Q.trim()}`}function hb6($){return[`Your ${qN[$]} comment carries no screenshot
3869
3869
  AND date >= {since:Date} AND date <= {until:Date}
3870
3870
  GROUP BY host
3871
3871
  ORDER BY sum(requests) DESC
3872
- LIMIT 25`,{slug:$,since:Z,until:Q});return[...new Set(X.map((Y)=>mn(Y.host)).filter(Boolean))]}async function CX8($){let Z=P0().oneDollarStatsApiKey;if(!Z||!XO())return{status:"not_configured"};let{slug:Q,testName:X,since:Y,until:J,goalOnDash:G}=$,W=await Gy6(Q,Y,J);if(W.length===0)return{status:"no_site_data"};let K=`event:props:${X}`,H=[Y,J],F=Array.from(new Set([nv0,...$.goals])),U=async(g,l,h)=>{let i=[];for(let H0=0;H0<W.length;H0+=kX8){let R0=await Promise.all(W.slice(H0,H0+kX8).map(async(Y0)=>{let N0=await fetch(Xy6,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":Z,Accept:"application/json"},body:JSON.stringify({site_id:Y0,metrics:g,date_range:H,...l.length?{dimensions:l}:{},...h.length?{filters:h}:{},pagination:{limit:1e4,offset:0}}),signal:AbortSignal.timeout(Yy6)}).catch(()=>null);if(!N0||!N0.ok)return[];return(await N0.json().catch(()=>null))?.results??[]}));for(let Y0 of R0)i.push(...Y0)}return i},N=async(g,l)=>{let h=g===nv0;return(await U(["visitors"],[K,...h?[]:["event:goal"]],[["is",K,[l]],...h?[]:[["is","event:goal",[g]]]])).reduce((H0,R0)=>H0+(R0.metrics?.[0]??0),0)},B=async(g)=>{let l=G===nv0;return U(["visitors"],["time:day",K,...l?[]:["event:goal"]],[["is",K,[g]],...l?[]:[["is","event:goal",[G]]]])},[D,O,j]=await Promise.all([Promise.all(F.map(async(g)=>{let[l,h]=await Promise.all([N(g,"true"),N(g,"false")]);return{goal:g,variant:l,default:h}})),B("false"),B("true")]),w=D.find((g)=>g.goal===nv0),E={default:w?.default??0,variant:w?.variant??0},z=new Map;for(let g of O){let l=g.dimensions?.[0]?.split(" ")[0]??"";if(!l)continue;let h=z.get(l)??{default:0,variant:0};h.default+=g.metrics?.[0]??0,z.set(l,h)}for(let g of j){let l=g.dimensions?.[0]?.split(" ")[0]??"";if(!l)continue;let h=z.get(l)??{default:0,variant:0};h.variant+=g.metrics?.[0]??0,z.set(l,h)}let A=Array.from(z.entries()).map(([g,l])=>({date:g,...l})).sort((g,l)=>g.date.localeCompare(l.date)),P=O.reduce((g,l)=>g+(l.metrics?.[0]??0),0),T=j.reduce((g,l)=>g+(l.metrics?.[0]??0),0),q={successes:P,total:E.default},f={successes:T,total:E.variant},S=VX8(q,f),V=S==null||Number.isNaN(S)?1000:S,u=IX8(q,f);return{status:"ok",results:{visitors:E,goals:D,timeseries:A,stats:{totalParticipants:E.default+E.variant,sampleSize:V,probabilityVariantBest:u,probabilityDefaultBest:1-u}}}}var Xy6="https://deco.lilstts.com/plausible",Yy6=12000,kX8=6,nv0="visitors",Jy6="site_id IN (SELECT id FROM default.dim_sites WHERE name = {slug:String})";var SX8=L(()=>{X$();iv0();pv0()});import{z as n6}from"zod";function vX8($){return $.toISOString().slice(0,10)}function Wy6(){let $=new Date,Z=new Date($);return Z.setUTCDate(Z.getUTCDate()-29),{since:vX8(Z),until:vX8($)}}var _X8,HE1;var xX8=L(()=>{C3();_0();SX8();Qh();_X8=/^\d{4}-\d{2}-\d{2}$/;HE1=m({name:"EXPERIMENT_RESULTS",description:"A/B results for one experiment: per-goal visitor conversions for each variant, a daily timeseries for the selected goal, and the computed statistics (participants, target sample size, probability each variant is best).",annotations:{title:"Experiment Results",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},inputSchema:n6.object({site:n6.string().min(1).max(60).refine(kZ).describe("Site slug the experiment belongs to."),key:n6.string().min(1).describe("Analytics prop key the variants split on: `event:props:<key>` = 'true'/'false'. In the deco runtime this is the sticky segment matcher block's id (not the multivariate section name), so `key` must equal that matcher id for results to populate."),since:n6.string().regex(_X8).optional().describe("Window start (YYYY-MM-DD)."),until:n6.string().regex(_X8).optional().describe("Window end (YYYY-MM-DD)."),goals:n6.array(n6.string().min(1).max(200)).max(20).default([]).describe("Custom goals to aggregate conversions for."),goalOnDash:n6.string().default("visitors").describe("Goal plotted in the timeseries / used for the statistics.")}),outputSchema:n6.object({available:n6.boolean(),reason:n6.enum(["not_configured","no_site_data"]).nullable(),analyticsSite:n6.string(),results:n6.object({visitors:n6.object({default:n6.number(),variant:n6.number()}),goals:n6.array(n6.object({goal:n6.string(),default:n6.number(),variant:n6.number()})),timeseries:n6.array(n6.object({date:n6.string(),default:n6.number(),variant:n6.number()})),stats:n6.object({totalParticipants:n6.number(),sampleSize:n6.number(),probabilityVariantBest:n6.number(),probabilityDefaultBest:n6.number()})}).nullable()}),handler:async($,Z)=>{o(Z),await Z.access.check();let Q=W0(Z),X=await wX8(Z,Q.id,$.site),Y=$.since&&$.until?{since:$.since,until:$.until}:Wy6(),J=await CX8({slug:X,testName:$.key,since:Y.since,until:Y.until,goals:$.goals,goalOnDash:$.goalOnDash});return J.status==="ok"?{available:!0,reason:null,analyticsSite:X,results:J.results}:{available:!1,reason:J.status,analyticsSite:X,results:null}}})});var fX8=L(()=>{EX8();zX8();PX8();TX8();AX8();xX8()});import{z as bX8}from"zod";function Uy6($,Z){let Q=$?.[Z];if(!Q)return;return Object.entries(Q).filter(([,Y])=>(YX in Y)).sort(([,Y],[,J])=>(J[YX]?.createdAt??0)-(Y[YX]?.createdAt??0))[0]?.[0]}var Hy6,Fy6,FE1;var yX8=L(()=>{F6();_0();Sg();Kn();SX();OG();Hy6=bX8.object({data:H68.describe("Data for the new thread (id is auto-generated if not provided)")}),Fy6=bX8.object({item:tN.describe("The created thread entity")});FE1=m({name:"COLLECTION_THREADS_CREATE",description:"Create a new thread for organizing messages and conversations.",annotations:{title:"Create Thread",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:Hy6,outputSchema:Fy6,handler:async($,Z)=>{o(Z);let Q=W0(Z);await Z.access.check();let X=t0(Z);if(!X)throw Error("User ID required to create thread");let{data:Y}=$,J=Y.id??a8("thrd"),W=(await G_0(Z.storage.virtualMcps,Y.virtual_mcp_id,Q.id)).metadata,K=W?.repository,H=null;if(K)H=Y.branch??Uy6(W?.sandboxMap,X)??tS0(nS0(Z.auth.user));let F=await Z.storage.threads.create({id:J,organization_id:Q.id,title:Y.title,description:Y.description,virtual_mcp_id:Y.virtual_mcp_id,branch:H,created_by:X,metadata:{runtime:Y.runtime??aS0(W)}});if(F.isNew)h1.capture({distinctId:X,event:"chat_started",groups:{organization:Q.id},properties:{organization_id:Q.id,thread_id:J,has_title:!!$.data.title,created_via:"tool"}});return{item:MK(F)}}})});import{z as UE1}from"zod";var Ny6,By6,NE1;var gX8=L(()=>{F6();_0();Sg();Kn();Ny6=UE1.object({id:UE1.string().describe("ID of the thread to update"),data:F68.describe("Partial thread data to update")}),By6=UE1.object({item:tN.describe("The updated thread entity")}),NE1=m({name:"COLLECTION_THREADS_UPDATE",description:"Update a thread's title, description, or visibility.",annotations:{title:"Update Thread",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:Ny6,outputSchema:By6,handler:async($,Z)=>{o(Z);let Q=W0(Z);await Z.access.check();let X=t0(Z);if(!X)throw Error("User ID required to update thread");let{id:Y,data:J}=$,G=await Z.storage.threads.get(Y);if(!G)throw Error("Thread not found in organization");let W;if(J.virtual_mcp_id!==void 0)W=await G_0(Z.storage.virtualMcps,J.virtual_mcp_id,Q.id);let K=J.virtual_mcp_id!==void 0?J.virtual_mcp_id:G.virtual_mcp_id;if(J.branch===null&&K){if((W??await Z.storage.virtualMcps.findById(K,Q.id))?.metadata?.repository)throw Error("Cannot set branch=null on a repository-linked thread (vMCP has repository)")}let H={title:J.title,description:J.description,hidden:J.hidden,updated_by:X};if(J.status)H.status=J.status;if(J.metadata!==void 0){let U=ni(J.metadata)??{},N=kg(G.metadata?.runtime),B=kg(U.runtime);if(N&&B&&B!==N)throw Error(`Cannot change a thread's runtime (${N} \u2192 ${B}); it is stamped once at creation. Start a new chat instead.`);let D=G.metadata?.sandboxMap;H.metadata={...U,...N?{runtime:N}:{},...D!==void 0?{sandboxMap:D}:{}}}if(J.branch!==void 0)H.branch=J.branch;if(J.virtual_mcp_id!==void 0)H.virtual_mcp_id=J.virtual_mcp_id;let F=await Z.storage.threads.update(Y,H);if(J.hidden!==void 0&&J.hidden!==G.hidden)h1.capture({distinctId:X,event:J.hidden?"chat_archived":"chat_unarchived",groups:{organization:Q.id},properties:{organization_id:Q.id,thread_id:Y}});return{item:MK(F)}}})});var BE1;var hX8=L(()=>{GG();Sg();F6();_0();aD();fv0();gn();BE1=m({name:"COLLECTION_THREADS_DELETE",description:"Permanently delete a thread and all its messages.",annotations:{title:"Delete Thread",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:o80,outputSchema:a80(tN),handler:async($,Z)=>{o(Z);let Q=W0(Z);await Z.access.check();let X=await Z.storage.threads.get($.id);if(!X)throw Error(`Thread not found: ${$.id}`);if(X.status==="in_progress"){let J=(W)=>(K)=>console.error("[thread] delete-time run cancel step failed",{threadId:$.id,step:W,err:K});await yn($.id).catch(J("background-jobs")),await ln($.id).catch(J("gate-head"));let G=await Z.storage.threads.getRunFence($.id).catch(()=>null);if(G)await $h($.id,G).catch(J("hosted-harness"));vv0($.id)}await Z.storage.threads.delete($.id);let Y=t0(Z);if(Y)h1.capture({distinctId:Y,event:"chat_deleted",groups:{organization:Q.id},properties:{organization_id:Q.id,thread_id:$.id}});return{item:MK(X)}}})});import{sql as m4}from"kysely";class LE1{db;constructor($){this.db=$}async rows($){return(await $.execute(this.db)).rows}async delivery($){let Z=tv0($.orgIds),[Q]=await this.rows(m4`
3872
+ LIMIT 25`,{slug:$,since:Z,until:Q});return[...new Set(X.map((Y)=>mn(Y.host)).filter(Boolean))]}async function CX8($){let Z=P0().oneDollarStatsApiKey;if(!Z||!XO())return{status:"not_configured"};let{slug:Q,testName:X,since:Y,until:J,goalOnDash:G}=$,W=await Gy6(Q,Y,J);if(W.length===0)return{status:"no_site_data"};let K=`event:props:${X}`,H=[Y,J],F=Array.from(new Set([nv0,...$.goals])),U=async(g,l,h)=>{let i=[];for(let H0=0;H0<W.length;H0+=kX8){let R0=await Promise.all(W.slice(H0,H0+kX8).map(async(Y0)=>{let N0=await fetch(Xy6,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":Z,Accept:"application/json"},body:JSON.stringify({site_id:Y0,metrics:g,date_range:H,...l.length?{dimensions:l}:{},...h.length?{filters:h}:{},pagination:{limit:1e4,offset:0}}),signal:AbortSignal.timeout(Yy6)}).catch(()=>null);if(!N0||!N0.ok)return[];return(await N0.json().catch(()=>null))?.results??[]}));for(let Y0 of R0)i.push(...Y0)}return i},N=async(g,l)=>{let h=g===nv0;return(await U(["visitors"],[K,...h?[]:["event:goal"]],[["is",K,[l]],...h?[]:[["is","event:goal",[g]]]])).reduce((H0,R0)=>H0+(R0.metrics?.[0]??0),0)},B=async(g)=>{let l=G===nv0;return U(["visitors"],["time:day",K,...l?[]:["event:goal"]],[["is",K,[g]],...l?[]:[["is","event:goal",[G]]]])},[D,O,j]=await Promise.all([Promise.all(F.map(async(g)=>{let[l,h]=await Promise.all([N(g,"true"),N(g,"false")]);return{goal:g,variant:l,default:h}})),B("false"),B("true")]),w=D.find((g)=>g.goal===nv0),E={default:w?.default??0,variant:w?.variant??0},z=new Map;for(let g of O){let l=g.dimensions?.[0]?.split(" ")[0]??"";if(!l)continue;let h=z.get(l)??{default:0,variant:0};h.default+=g.metrics?.[0]??0,z.set(l,h)}for(let g of j){let l=g.dimensions?.[0]?.split(" ")[0]??"";if(!l)continue;let h=z.get(l)??{default:0,variant:0};h.variant+=g.metrics?.[0]??0,z.set(l,h)}let A=Array.from(z.entries()).map(([g,l])=>({date:g,...l})).sort((g,l)=>g.date.localeCompare(l.date)),P=O.reduce((g,l)=>g+(l.metrics?.[0]??0),0),T=j.reduce((g,l)=>g+(l.metrics?.[0]??0),0),q={successes:P,total:E.default},f={successes:T,total:E.variant},S=VX8(q,f),V=S==null||Number.isNaN(S)?1000:S,u=IX8(q,f);return{status:"ok",results:{visitors:E,goals:D,timeseries:A,stats:{totalParticipants:E.default+E.variant,sampleSize:V,probabilityVariantBest:u,probabilityDefaultBest:1-u}}}}var Xy6="https://deco.lilstts.com/plausible",Yy6=12000,kX8=6,nv0="visitors",Jy6="site_id IN (SELECT id FROM default.dim_sites WHERE name = {slug:String})";var SX8=L(()=>{X$();iv0();pv0()});import{z as n6}from"zod";function vX8($){return $.toISOString().slice(0,10)}function Wy6(){let $=new Date,Z=new Date($);return Z.setUTCDate(Z.getUTCDate()-29),{since:vX8(Z),until:vX8($)}}var _X8,HE1;var xX8=L(()=>{C3();_0();SX8();Qh();_X8=/^\d{4}-\d{2}-\d{2}$/;HE1=m({name:"EXPERIMENT_RESULTS",description:"A/B results for one experiment: per-goal visitor conversions for each variant, a daily timeseries for the selected goal, and the computed statistics (participants, target sample size, probability each variant is best).",annotations:{title:"Experiment Results",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},inputSchema:n6.object({site:n6.string().min(1).max(60).refine(kZ).describe("Site slug the experiment belongs to."),key:n6.string().min(1).describe("Analytics prop key the variants split on: `event:props:<key>` = 'true'/'false'. In the deco runtime this is the sticky segment matcher block's id (not the multivariate section name), so `key` must equal that matcher id for results to populate."),since:n6.string().regex(_X8).optional().describe("Window start (YYYY-MM-DD)."),until:n6.string().regex(_X8).optional().describe("Window end (YYYY-MM-DD)."),goals:n6.array(n6.string().min(1).max(200)).max(20).default([]).describe("Custom goals to aggregate conversions for."),goalOnDash:n6.string().default("visitors").describe("Goal plotted in the timeseries / used for the statistics.")}).refine(($)=>!$.since||!$.until||$.since<=$.until,{message:"`since` must not be after `until`",path:["since"]}),outputSchema:n6.object({available:n6.boolean(),reason:n6.enum(["not_configured","no_site_data"]).nullable(),analyticsSite:n6.string(),results:n6.object({visitors:n6.object({default:n6.number(),variant:n6.number()}),goals:n6.array(n6.object({goal:n6.string(),default:n6.number(),variant:n6.number()})),timeseries:n6.array(n6.object({date:n6.string(),default:n6.number(),variant:n6.number()})),stats:n6.object({totalParticipants:n6.number(),sampleSize:n6.number(),probabilityVariantBest:n6.number(),probabilityDefaultBest:n6.number()})}).nullable()}),handler:async($,Z)=>{o(Z),await Z.access.check();let Q=W0(Z),X=await wX8(Z,Q.id,$.site),Y=$.since&&$.until?{since:$.since,until:$.until}:Wy6(),J=await CX8({slug:X,testName:$.key,since:Y.since,until:Y.until,goals:$.goals,goalOnDash:$.goalOnDash});return J.status==="ok"?{available:!0,reason:null,analyticsSite:X,results:J.results}:{available:!1,reason:J.status,analyticsSite:X,results:null}}})});var fX8=L(()=>{EX8();zX8();PX8();TX8();AX8();xX8()});import{z as bX8}from"zod";function Uy6($,Z){let Q=$?.[Z];if(!Q)return;return Object.entries(Q).filter(([,Y])=>(YX in Y)).sort(([,Y],[,J])=>(J[YX]?.createdAt??0)-(Y[YX]?.createdAt??0))[0]?.[0]}var Hy6,Fy6,FE1;var yX8=L(()=>{F6();_0();Sg();Kn();SX();OG();Hy6=bX8.object({data:H68.describe("Data for the new thread (id is auto-generated if not provided)")}),Fy6=bX8.object({item:tN.describe("The created thread entity")});FE1=m({name:"COLLECTION_THREADS_CREATE",description:"Create a new thread for organizing messages and conversations.",annotations:{title:"Create Thread",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:Hy6,outputSchema:Fy6,handler:async($,Z)=>{o(Z);let Q=W0(Z);await Z.access.check();let X=t0(Z);if(!X)throw Error("User ID required to create thread");let{data:Y}=$,J=Y.id??a8("thrd"),W=(await G_0(Z.storage.virtualMcps,Y.virtual_mcp_id,Q.id)).metadata,K=W?.repository,H=null;if(K)H=Y.branch??Uy6(W?.sandboxMap,X)??tS0(nS0(Z.auth.user));let F=await Z.storage.threads.create({id:J,organization_id:Q.id,title:Y.title,description:Y.description,virtual_mcp_id:Y.virtual_mcp_id,branch:H,created_by:X,metadata:{runtime:Y.runtime??aS0(W)}});if(F.isNew)h1.capture({distinctId:X,event:"chat_started",groups:{organization:Q.id},properties:{organization_id:Q.id,thread_id:J,has_title:!!$.data.title,created_via:"tool"}});return{item:MK(F)}}})});import{z as UE1}from"zod";var Ny6,By6,NE1;var gX8=L(()=>{F6();_0();Sg();Kn();Ny6=UE1.object({id:UE1.string().describe("ID of the thread to update"),data:F68.describe("Partial thread data to update")}),By6=UE1.object({item:tN.describe("The updated thread entity")}),NE1=m({name:"COLLECTION_THREADS_UPDATE",description:"Update a thread's title, description, or visibility.",annotations:{title:"Update Thread",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:Ny6,outputSchema:By6,handler:async($,Z)=>{o(Z);let Q=W0(Z);await Z.access.check();let X=t0(Z);if(!X)throw Error("User ID required to update thread");let{id:Y,data:J}=$,G=await Z.storage.threads.get(Y);if(!G)throw Error("Thread not found in organization");let W;if(J.virtual_mcp_id!==void 0)W=await G_0(Z.storage.virtualMcps,J.virtual_mcp_id,Q.id);let K=J.virtual_mcp_id!==void 0?J.virtual_mcp_id:G.virtual_mcp_id;if(J.branch===null&&K){if((W??await Z.storage.virtualMcps.findById(K,Q.id))?.metadata?.repository)throw Error("Cannot set branch=null on a repository-linked thread (vMCP has repository)")}let H={title:J.title,description:J.description,hidden:J.hidden,updated_by:X};if(J.status)H.status=J.status;if(J.metadata!==void 0){let U=ni(J.metadata)??{},N=kg(G.metadata?.runtime),B=kg(U.runtime);if(N&&B&&B!==N)throw Error(`Cannot change a thread's runtime (${N} \u2192 ${B}); it is stamped once at creation. Start a new chat instead.`);let D=G.metadata?.sandboxMap;H.metadata={...U,...N?{runtime:N}:{},...D!==void 0?{sandboxMap:D}:{}}}if(J.branch!==void 0)H.branch=J.branch;if(J.virtual_mcp_id!==void 0)H.virtual_mcp_id=J.virtual_mcp_id;let F=await Z.storage.threads.update(Y,H);if(J.hidden!==void 0&&J.hidden!==G.hidden)h1.capture({distinctId:X,event:J.hidden?"chat_archived":"chat_unarchived",groups:{organization:Q.id},properties:{organization_id:Q.id,thread_id:Y}});return{item:MK(F)}}})});var BE1;var hX8=L(()=>{GG();Sg();F6();_0();aD();fv0();gn();BE1=m({name:"COLLECTION_THREADS_DELETE",description:"Permanently delete a thread and all its messages.",annotations:{title:"Delete Thread",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:o80,outputSchema:a80(tN),handler:async($,Z)=>{o(Z);let Q=W0(Z);await Z.access.check();let X=await Z.storage.threads.get($.id);if(!X)throw Error(`Thread not found: ${$.id}`);if(X.status==="in_progress"){let J=(W)=>(K)=>console.error("[thread] delete-time run cancel step failed",{threadId:$.id,step:W,err:K});await yn($.id).catch(J("background-jobs")),await ln($.id).catch(J("gate-head"));let G=await Z.storage.threads.getRunFence($.id).catch(()=>null);if(G)await $h($.id,G).catch(J("hosted-harness"));vv0($.id)}await Z.storage.threads.delete($.id);let Y=t0(Z);if(Y)h1.capture({distinctId:Y,event:"chat_deleted",groups:{organization:Q.id},properties:{organization_id:Q.id,thread_id:$.id}});return{item:MK(X)}}})});import{sql as m4}from"kysely";class LE1{db;constructor($){this.db=$}async rows($){return(await $.execute(this.db)).rows}async delivery($){let Z=tv0($.orgIds),[Q]=await this.rows(m4`
3873
3873
  with moves as (${Z})
3874
3874
  select count(distinct item_id) as completed,
3875
3875
  count(distinct item_id) filter (