decocms 4.243.2 → 4.243.4

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 (237) hide show
  1. package/dist/client/assets/{AlertCircle-DUlfht_8.js → AlertCircle-DUBmkcTn.js} +1 -1
  2. package/dist/client/assets/{AreaChart-Cb6V67gW.js → AreaChart-DPhrxn7m.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-xr5VbHB2.js → ArrowLeft-B1ZXy1Vl.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-CsCHH_fH.js → ArrowUp-BTbuLYl6.js} +1 -1
  5. package/dist/client/assets/{ArrowUpRight-M9WAVHfb.js → ArrowUpRight-zLI1BbVJ.js} +1 -1
  6. package/dist/client/assets/{Check-BXav60Vy.js → Check-DEgJSlE2.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-C2PmPe-o.js → CheckCircle-CIWpPZRg.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-CauLatdX.js → ChevronDown-CO7i0cx7.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-BGcGReEM.js → ChevronRight-BK2PHmsp.js} +1 -1
  10. package/dist/client/assets/{ChevronSelectorVertical-CvdZht1v.js → ChevronSelectorVertical-j23jIvFM.js} +1 -1
  11. package/dist/client/assets/{ChevronUp-D_tIdiJb.js → ChevronUp-0tjXjMP7.js} +1 -1
  12. package/dist/client/assets/{Copy01-CV1JugLX.js → Copy01-B-nWOhwf.js} +1 -1
  13. package/dist/client/assets/{CreditCard01-B_w5eexh.js → CreditCard01-48uYu1ep.js} +1 -1
  14. package/dist/client/assets/{DotsVertical-fn24sGZC.js → DotsVertical-fBRgpdPm.js} +1 -1
  15. package/dist/client/assets/{Download01-D3eJDAEO.js → Download01-Bes0AKhe.js} +1 -1
  16. package/dist/client/assets/{Eye-BhHZY2CZ.js → Eye-VWnpwRcV.js} +1 -1
  17. package/dist/client/assets/{FilterLines-BWjLIxVc.js → FilterLines-Cyoodfxg.js} +1 -1
  18. package/dist/client/assets/{Globe01-DdUoMsv3.js → Globe01-DQKO5Xqw.js} +1 -1
  19. package/dist/client/assets/{Globe04-B-w3WEq9.js → Globe04-WJ8Th4lv.js} +1 -1
  20. package/dist/client/assets/{HardDrive-BFP4nRun.js → HardDrive-m-1zupRx.js} +1 -1
  21. package/dist/client/assets/{Key01-Cfe0Tudx.js → Key01-BKtrzyWz.js} +1 -1
  22. package/dist/client/assets/{LayoutLeft-BEpfII_o.js → LayoutLeft-D9tAiX9t.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-D25gdGqj.js → LinkExternal01-QvH1DLR6.js} +1 -1
  24. package/dist/client/assets/{LockUnlocked01-P_wfDROK.js → LockUnlocked01-dVeh5Rv1.js} +1 -1
  25. package/dist/client/assets/{LogOut01-DBKmS50y.js → LogOut01-DB5yAk7w.js} +1 -1
  26. package/dist/client/assets/{Monitor01-BhLjoS2b.js → Monitor01-DPkOidxS.js} +1 -1
  27. package/dist/client/assets/{Palette-aeV8tQ28.js → Palette-ye-XRcsp.js} +1 -1
  28. package/dist/client/assets/{Play-BdOAMmIp.js → Play-BlaCOKw4.js} +1 -1
  29. package/dist/client/assets/{Plus-D1J2FK4h.js → Plus-6uKGazO5.js} +1 -1
  30. package/dist/client/assets/{SearchLg-BzCLzG8R.js → SearchLg-DBTFvGXw.js} +1 -1
  31. package/dist/client/assets/{SearchMd-xpLLk_pA.js → SearchMd-DyE04AD7.js} +1 -1
  32. package/dist/client/assets/{Settings02-DjFkLPe4.js → Settings02-CbfxvK5H.js} +1 -1
  33. package/dist/client/assets/{Share07-Caa0Im56.js → Share07-BDJWPWV6.js} +1 -1
  34. package/dist/client/assets/{Shield01-D5NbAsUv.js → Shield01-Do5e8KaJ.js} +1 -1
  35. package/dist/client/assets/{Stars01-CCBcRCds.js → Stars01-Ct271X3d.js} +1 -1
  36. package/dist/client/assets/{Stars02-DtoiSIcu.js → Stars02-BX41o4lF.js} +1 -1
  37. package/dist/client/assets/{Sun-Dpvmek-4.js → Sun-BiqNHHQh.js} +1 -1
  38. package/dist/client/assets/{SwitchHorizontal01-C5wQU73g.js → SwitchHorizontal01-DEXnQXzR.js} +1 -1
  39. package/dist/client/assets/{Tool01-XzYGP86W.js → Tool01-3JvBNXPX.js} +1 -1
  40. package/dist/client/assets/{Tool02-CE2ZdUr1.js → Tool02-DdyxyW8I.js} +1 -1
  41. package/dist/client/assets/{Trash01-BnQQflAa.js → Trash01-DqQZHRga.js} +1 -1
  42. package/dist/client/assets/{TrendUp01-BdIQtpYk.js → TrendUp01-zlnItYjr.js} +1 -1
  43. package/dist/client/assets/{Upload01-Bhqh3Tbq.js → Upload01-DX0s2OS3.js} +1 -1
  44. package/dist/client/assets/{User01-C1NHQ-ZR.js → User01-CufUL8A5.js} +1 -1
  45. package/dist/client/assets/{Users01-CMhcYnus.js → Users01-B5AnBtfJ.js} +1 -1
  46. package/dist/client/assets/{Users03-BNksnLQf.js → Users03-BW5F61-z.js} +1 -1
  47. package/dist/client/assets/{X-DY9FeXqi.js → X-DmMIdcRo.js} +1 -1
  48. package/dist/client/assets/{XCircle-_aQH9vJz.js → XCircle-DvQE9JBK.js} +1 -1
  49. package/dist/client/assets/{XClose-DdNRdfWH.js → XClose-DjWnLl9U.js} +1 -1
  50. package/dist/client/assets/{YAxis-DLOWdC_A.js → YAxis-D4eo55UO.js} +1 -1
  51. package/dist/client/assets/{Zap-DDihnv3P.js → Zap-BDSWIIjc.js} +1 -1
  52. package/dist/client/assets/{ZapSquare-Bv6t7Fg1.js → ZapSquare-D5yRPStx.js} +1 -1
  53. package/dist/client/assets/{access-gate-wLBW4P-Z.js → access-gate-CPA87ELR.js} +1 -1
  54. package/dist/client/assets/{agent-icon-5ZYno8Im.js → agent-icon-Djzn7Dlu.js} +1 -1
  55. package/dist/client/assets/{agents-list-7wqeXOXn.js → agents-list-D_v7XdBO.js} +1 -1
  56. package/dist/client/assets/{ai-providers-BJDhlXiK.js → ai-providers-MfMKk6br.js} +1 -1
  57. package/dist/client/assets/{alert-B6Fmol8n.js → alert-CwN_Z1At.js} +1 -1
  58. package/dist/client/assets/{alert-dialog-BOUVk-xM.js → alert-dialog-DH5dKDyw.js} +1 -1
  59. package/dist/client/assets/{api-keys-DGMyGe_V.js → api-keys-DnJXiJmZ.js} +1 -1
  60. package/dist/client/assets/{app-editor-BQTeUJlT.js → app-editor-BpBdKoFD.js} +1 -1
  61. package/dist/client/assets/{auth-Clf3KXjv.js → auth-BWuZ4vjg.js} +1 -1
  62. package/dist/client/assets/{auth-catchall-CPPqDGgA.js → auth-catchall-zmc0A-ET.js} +1 -1
  63. package/dist/client/assets/{auth-entry-PFcfNCN7.js → auth-entry-BBmqibNQ.js} +1 -1
  64. package/dist/client/assets/{auth-split-layout-5_o-m_dm.js → auth-split-layout-BnMOJkGX.js} +1 -1
  65. package/dist/client/assets/{authenticate-and-persist-oauth-BUQ1Xi6C.js → authenticate-and-persist-oauth-CoxR9yqD.js} +1 -1
  66. package/dist/client/assets/{automation-list-row-DRZedCha.js → automation-list-row-CdvBjlBR.js} +1 -1
  67. package/dist/client/assets/{automation-runs-DaNWyAAB.js → automation-runs-Dmg4YqUY.js} +1 -1
  68. package/dist/client/assets/{automations-BBd2nZBY.js → automations-wj2xpnAN.js} +1 -1
  69. package/dist/client/assets/{avatar-CsESGb5P.js → avatar-C2RydzNB.js} +1 -1
  70. package/dist/client/assets/{badge-BtBZ1HPJ.js → badge-B6i1PD2u.js} +1 -1
  71. package/dist/client/assets/{billing-Bgr3WIC0.js → billing-BZwF4mHD.js} +1 -1
  72. package/dist/client/assets/{block-document-BKnVO5ZG.js → block-document-CVILuItv.js} +1 -1
  73. package/dist/client/assets/{buckets-Cg0MlwAj.js → buckets-CHFpdelm.js} +1 -1
  74. package/dist/client/assets/{bulk-category-panel-BHhnBX-y.js → bulk-category-panel-CFaxUyNR.js} +1 -1
  75. package/dist/client/assets/{capability-load-error-BasK1UyG.js → capability-load-error-Dpo8RT1K.js} +1 -1
  76. package/dist/client/assets/{card-CKXxuGX6.js → card-B3ycKdg9.js} +1 -1
  77. package/dist/client/assets/{cards-BIJ-5lG1.js → cards-CilMyTUd.js} +1 -1
  78. package/dist/client/assets/{category-editor-BInGd-ra.js → category-editor-BrEtDZ3h.js} +1 -1
  79. package/dist/client/assets/{chart-CkOpSzxv.js → chart-BJHvok6V.js} +1 -1
  80. package/dist/client/assets/{chat-context-DAVuFXb-.js → chat-context-CQq4Nbbg.js} +1 -1
  81. package/dist/client/assets/{checkbox-BmMgY8o7.js → checkbox-BI2-YqJt.js} +1 -1
  82. package/dist/client/assets/{choose-editor-BGZ5cx6T.js → choose-editor-mRO5x0bZ.js} +1 -1
  83. package/dist/client/assets/{cli-auth-success-CRaZ-XOY.js → cli-auth-success-Dx-2Ijnv.js} +1 -1
  84. package/dist/client/assets/{collection-detail-CjMlAcj7.js → collection-detail-BZOodWpT.js} +1 -1
  85. package/dist/client/assets/{collection-display-button-C5Ypy8cN.js → collection-display-button-DvWRX-Cr.js} +1 -1
  86. package/dist/client/assets/{collection-search-Dc8oos2w.js → collection-search-CHBflIVD.js} +1 -1
  87. package/dist/client/assets/{collection-table-wrapper-BqCUWVdp.js → collection-table-wrapper-CXwp-Fd-.js} +1 -1
  88. package/dist/client/assets/{collection-tabs-DQs6Id7F.js → collection-tabs-DtFX7sCM.js} +1 -1
  89. package/dist/client/assets/{command-CckioSee.js → command-HLQrYO35.js} +1 -1
  90. package/dist/client/assets/{commerce-onboarding-D33mAwVV.js → commerce-onboarding-D5JVUhG9.js} +1 -1
  91. package/dist/client/assets/{connect-B2Kdp8ut.js → connect-C5iLg7Hu.js} +1 -1
  92. package/dist/client/assets/{connection-DawcOkII.js → connection-C8QHW1Lc.js} +1 -1
  93. package/dist/client/assets/{connection-card-JINQJoK5.js → connection-card-DrU4seG9.js} +1 -1
  94. package/dist/client/assets/{connection-detail-Db3nTX8u.js → connection-detail-DyxwUU5q.js} +1 -1
  95. package/dist/client/assets/{connection-form-helpers-Shqj1MAl.js → connection-form-helpers-BwZ8BJL8.js} +1 -1
  96. package/dist/client/assets/{connections-BcEtHf8S.js → connections-wI3ugQT5.js} +1 -1
  97. package/dist/client/assets/{decopilot-sse-pool-DLTV1od0.js → decopilot-sse-pool-CEbxuc8z.js} +1 -1
  98. package/dist/client/assets/{dialog-U03ZiuXk.js → dialog-CFGtWVd9.js} +1 -1
  99. package/dist/client/assets/{domain-settings-CDI7Fjmq.js → domain-settings-BXC5Kg4_.js} +1 -1
  100. package/dist/client/assets/{drawer-qjynKTFN.js → drawer-BympwX-t.js} +1 -1
  101. package/dist/client/assets/{dropdown-menu-BmoCpvnT.js → dropdown-menu-vfeArr6k.js} +1 -1
  102. package/dist/client/assets/{empty-state-PrJglZio.js → empty-state-DgQjwvxO.js} +1 -1
  103. package/dist/client/assets/{extract-connection-data-GB3welMi.js → extract-connection-data-CqWXjCro.js} +1 -1
  104. package/dist/client/assets/{file-explorer-BUj_Z3iJ.js → file-explorer-DY5ioXTM.js} +1 -1
  105. package/dist/client/assets/{file-type-icon-DNO6EG6W.js → file-type-icon-BgzapDab.js} +1 -1
  106. package/dist/client/assets/{form-BlkhuHf9.js → form-C8bh-vKe.js} +1 -1
  107. package/dist/client/assets/{general-BSW7_Voe.js → general-BHQPEtdp.js} +1 -1
  108. package/dist/client/assets/{github-repo-picker-D56QHlTy.js → github-repo-picker-CeW7qlZm.js} +1 -1
  109. package/dist/client/assets/{hooks-B2woSXLe.js → hooks-B7G91oa4.js} +1 -1
  110. package/dist/client/assets/{index-DlSq7kji.js → index-5KQjs_XJ.js} +1 -1
  111. package/dist/client/assets/{index-CToZ4kbL.js → index-ByBsUdWl.js} +1 -1
  112. package/dist/client/assets/{index-Djodm3GI.js → index-CDYGYJpQ.js} +1 -1
  113. package/dist/client/assets/{index-Chdg8Asw.js → index-CIGdbj1j.js} +1 -1
  114. package/dist/client/assets/{index-j097lZOT.js → index-CWn1bIid.js} +5 -5
  115. package/dist/client/assets/{index-DLyxjIYw.js → index-DKQb38ND.js} +3 -3
  116. package/dist/client/assets/{index-D5A_cbaj.js → index-Dcq1Q410.js} +1 -1
  117. package/dist/client/assets/{index-D-cW_7z2.js → index-DmJHgCkL.js} +1 -1
  118. package/dist/client/assets/{index-AXIuo6hf.js → index-DtSioMZm.js} +1 -1
  119. package/dist/client/assets/{index-CY3hVAON.js → index-kNGe44R0.js} +1 -1
  120. package/dist/client/assets/{index-redirect-C__5RhjR.js → index-redirect-Bv2aL76q.js} +1 -1
  121. package/dist/client/assets/{infra-billing-CI8pxTWO.js → infra-billing-CiXGkY7e.js} +1 -1
  122. package/dist/client/assets/{input-BH7zyD0i.js → input-CPKA65Nb.js} +1 -1
  123. package/dist/client/assets/{integration-icon-BolSFCMJ.js → integration-icon-D6tizLj_.js} +1 -1
  124. package/dist/client/assets/{invite-member-dialog-Cfb_Sthq.js → invite-member-dialog-rJ-mHSd7.js} +1 -1
  125. package/dist/client/assets/{label-Cwuc9phK.js → label-Bh5_-4i-.js} +1 -1
  126. package/dist/client/assets/{layout-BEPQVUxl.js → layout-BLP4KbBJ.js} +1 -1
  127. package/dist/client/assets/{login-C2AFfDb-.js → login-D9-tEqcC.js} +1 -1
  128. package/dist/client/assets/{mcp-oauth-BmzTS1ua.js → mcp-oauth-FIHL66Ck.js} +1 -1
  129. package/dist/client/assets/{members-D7MXmyE1.js → members-CQjrTs8T.js} +1 -1
  130. package/dist/client/assets/{monaco-editor-DBmhJ8Ys.js → monaco-editor-7oDJqnbM.js} +1 -1
  131. package/dist/client/assets/{monitoring-stats-row-DfEDCsLl.js → monitoring-stats-row-C-HS7vQ4.js} +1 -1
  132. package/dist/client/assets/{multi-select-C2Dia25c.js → multi-select-Bm6BjVIA.js} +1 -1
  133. package/dist/client/assets/{oauth-callback-D_WAqpRo.js → oauth-callback-CCHHT0xQ.js} +1 -1
  134. package/dist/client/assets/{oauth-callback-ai-provider-BhA1cp1j.js → oauth-callback-ai-provider-BFVoJRyh.js} +1 -1
  135. package/dist/client/assets/{onboarding-uuvWd04L.js → onboarding-BgqffVfJ.js} +1 -1
  136. package/dist/client/assets/{org-layout-D-9MtDux.js → org-layout-skiWlUUv.js} +1 -1
  137. package/dist/client/assets/{organization-choice-YKPoOAc0.js → organization-choice--fptw-Hb.js} +1 -1
  138. package/dist/client/assets/{orgs-DgzYCdTa.js → orgs-C-M3UQzZ.js} +1 -1
  139. package/dist/client/assets/{page-seo-form-GRyqYD3q.js → page-seo-form-C_PEHsFW.js} +1 -1
  140. package/dist/client/assets/{popover-9hL99Gs4.js → popover-DXZJXKJx.js} +1 -1
  141. package/dist/client/assets/{post-editor-B2P499Gv.js → post-editor-Ds2BkOjY.js} +1 -1
  142. package/dist/client/assets/{primitives-5VVvVXDP.js → primitives-BpIgqI2b.js} +1 -1
  143. package/dist/client/assets/{profile-CyKGXLmf.js → profile-C712En3H.js} +1 -1
  144. package/dist/client/assets/{project-app-view-kVyS_ky4.js → project-app-view-NTiilPYp.js} +1 -1
  145. package/dist/client/assets/record-editor-D8q1ZwcD.js +1 -0
  146. package/dist/client/assets/{redirect-editor-wh6KUQar.js → redirect-editor-DRE9KLUM.js} +1 -1
  147. package/dist/client/assets/registry-BZ_T09kM.js +2 -0
  148. package/dist/client/assets/{registry-layout-BqclQM58.js → registry-layout-DLfPKACL.js} +1 -1
  149. package/dist/client/assets/{reports-ezYEoj8-.js → reports-HZOprarm.js} +1 -1
  150. package/dist/client/assets/{require-capability-daZd2Avq.js → require-capability-dzeyKGJu.js} +1 -1
  151. package/dist/client/assets/{required-auth-layout-tPpYmfR1.js → required-auth-layout-I0DqhZGW.js} +1 -1
  152. package/dist/client/assets/{reset-password-B_cu2DBW.js → reset-password-_h9tbk_8.js} +1 -1
  153. package/dist/client/assets/{roles-CnMuEzXy.js → roles-BaWPJVPw.js} +1 -1
  154. package/dist/client/assets/{search-input-Dlrgn3SA.js → search-input-CIHpn6in.js} +1 -1
  155. package/dist/client/assets/{secrets-DHhUnvN3.js → secrets-C3fpWI0k.js} +1 -1
  156. package/dist/client/assets/{sections-editor-D2V-U5oa.js → sections-editor-DKNsV4dK.js} +1 -1
  157. package/dist/client/assets/{select-BhNhFGIm.js → select-DJSeowc-.js} +1 -1
  158. package/dist/client/assets/{select-model-BbkxZygk.js → select-model-Da2g8w5V.js} +1 -1
  159. package/dist/client/assets/{self-tool-result-Bjns9v-D.js → self-tool-result-UDGR2_h1.js} +1 -1
  160. package/dist/client/assets/{seo-editor-_sQ6ViyP.js → seo-editor-DjXvhHqG.js} +1 -1
  161. package/dist/client/assets/settings-layout-ozCCdWWm.js +1 -0
  162. package/dist/client/assets/{settings-section-BIT7uWjs.js → settings-section-BKvZ1DCj.js} +1 -1
  163. package/dist/client/assets/{settings-subnav-DobJGu7Z.js → settings-subnav-C7uhNmi6.js} +1 -1
  164. package/dist/client/assets/{shell-controls-BOR8V5VI.js → shell-controls-B3UyRSGT.js} +1 -1
  165. package/dist/client/assets/{shell-layout-Dpz4gldn.js → shell-layout-DfNJiCMr.js} +1 -1
  166. package/dist/client/assets/{sidebar-_myHCEzH.js → sidebar-Ce6VfGnp.js} +1 -1
  167. package/dist/client/assets/{skeleton-CfDgtd5M.js → skeleton-CwCJFiBB.js} +1 -1
  168. package/dist/client/assets/{spinner-CgvhsPnS.js → spinner-CNkZuMit.js} +1 -1
  169. package/dist/client/assets/{sso-CzK_Pk8F.js → sso-C6fwYdnH.js} +1 -1
  170. package/dist/client/assets/{store-Cu4INizs.js → store-T3n-0xgZ.js} +1 -1
  171. package/dist/client/assets/store-registry-Cplg60iu.js +2 -0
  172. package/dist/client/assets/{studio-tools-ThQ_rcsF.js → studio-tools-DwzanSLe.js} +1 -1
  173. package/dist/client/assets/{switch-BCRtcgA0.js → switch-CSlnzDMy.js} +1 -1
  174. package/dist/client/assets/{synced-repos-DkuvF9QR.js → synced-repos-BH8LbzyI.js} +1 -1
  175. package/dist/client/assets/{tab-id-DM8k_HA-.js → tab-id-PnjsjgAC.js} +1 -1
  176. package/dist/client/assets/{table-C5eCsrvC.js → table-BNFVIcV6.js} +1 -1
  177. package/dist/client/assets/{tabs-D-zNditx.js → tabs-CQUEL1aZ.js} +1 -1
  178. package/dist/client/assets/{tasks-CwCxAFhU.js → tasks-CnKl1y3t.js} +1 -1
  179. package/dist/client/assets/{textarea-BfUIS--d.js → textarea-DkvSUB8b.js} +1 -1
  180. package/dist/client/assets/{toggle-group-DvojD61A.js → toggle-group-BaxKDJcU.js} +1 -1
  181. package/dist/client/assets/{toolbar-C6N7bX1O.js → toolbar-DvROb_cf.js} +1 -1
  182. package/dist/client/assets/{tooltip-B-y9isox.js → tooltip-bTAcv8Zb.js} +1 -1
  183. package/dist/client/assets/{track-Bwp-FwAP.js → track-BaJGm2x8.js} +1 -1
  184. package/dist/client/assets/{types-D6tOWfuo.js → types-Bb3aQ7Lz.js} +1 -1
  185. package/dist/client/assets/{use-ai-providers-Bb772HOL.js → use-ai-providers-Chf5ojQH.js} +1 -1
  186. package/dist/client/assets/{use-api-keys-CX7vmPa_.js → use-api-keys-CDrbsuxu.js} +1 -1
  187. package/dist/client/assets/{use-automations-DyLBCDVI.js → use-automations-COc0gRkR.js} +1 -1
  188. package/dist/client/assets/{use-autosave-DnhwLkb4.js → use-autosave-Vv2HaV0r.js} +1 -1
  189. package/dist/client/assets/{use-capability-DxO7qy1z.js → use-capability-DKfvjREp.js} +1 -1
  190. package/dist/client/assets/{use-clock-tick-DS1Jl_N9.js → use-clock-tick-CJCI8HLu.js} +1 -1
  191. package/dist/client/assets/{use-commerce-diagnostic-DtF4_mte.js → use-commerce-diagnostic-DNJ9Ersg.js} +1 -1
  192. package/dist/client/assets/{use-connection-DmmNo1LM.js → use-connection-DSnIeCVM.js} +1 -1
  193. package/dist/client/assets/{use-copy-CSIcq8z_.js → use-copy-D6E9U0HJ.js} +1 -1
  194. package/dist/client/assets/{use-create-virtual-mcp-CR_IUdwo.js → use-create-virtual-mcp-5rh288HY.js} +1 -1
  195. package/dist/client/assets/{use-debounced-autosave-DjJh5yYH.js → use-debounced-autosave-Ccxsiqvr.js} +1 -1
  196. package/dist/client/assets/{use-debounced-value-19BtC7Bb.js → use-debounced-value-BxpxIpXm.js} +1 -1
  197. package/dist/client/assets/{use-decopilot-events-Bb_7qSC-.js → use-decopilot-events-DVNXI3QN.js} +1 -1
  198. package/dist/client/assets/{use-delete-connection-keAeE1I9.js → use-delete-connection-Dss9TzKe.js} +1 -1
  199. package/dist/client/assets/{use-deployment-admin-GvqoWv58.js → use-deployment-admin-BXnk3GK7.js} +1 -1
  200. package/dist/client/assets/{use-file-configs-IFt3zoqI.js → use-file-configs-hh7eYz7k.js} +1 -1
  201. package/dist/client/assets/{use-infinite-scroll-C1T3wjaO.js → use-infinite-scroll-BmfrzjSY.js} +1 -1
  202. package/dist/client/assets/{use-join-requests-BeMEoip1.js → use-join-requests-ovxsKp5z.js} +1 -1
  203. package/dist/client/assets/{use-mcp-client-_o9o88xf.js → use-mcp-client-D6jLYSoU.js} +1 -1
  204. package/dist/client/assets/{use-mcp-tools-CRMPw5o_.js → use-mcp-tools-XjKWAg7X.js} +1 -1
  205. package/dist/client/assets/{use-members-BeAeYksa.js → use-members-CHnkZ9Fz.js} +1 -1
  206. package/dist/client/assets/{use-mobile-H1cEPaVS.js → use-mobile-Cw6_1JtW.js} +1 -1
  207. package/dist/client/assets/{use-navigate-to-agent-BqMCqmam.js → use-navigate-to-agent-pCWyEbaN.js} +1 -1
  208. package/dist/client/assets/{use-open-billing-url-BWzY_VeB.js → use-open-billing-url-pTzUmrMv.js} +1 -1
  209. package/dist/client/assets/{use-org-auth-client-A_fhg4VK.js → use-org-auth-client-yOl8Gdkc.js} +1 -1
  210. package/dist/client/assets/{use-org-repo-syncs-DboNdEwi.js → use-org-repo-syncs-BC2hyWP9.js} +1 -1
  211. package/dist/client/assets/{use-org-sso-D-BEPABI.js → use-org-sso-B7KUjaKS.js} +1 -1
  212. package/dist/client/assets/{use-organization-roles-ABd_zIJY.js → use-organization-roles-DNsKh5GM.js} +1 -1
  213. package/dist/client/assets/{use-organization-settings-DPRJ0ATL.js → use-organization-settings-sNmM-o0b.js} +1 -1
  214. package/dist/client/assets/{use-registry-connections-Y17SLNHX.js → use-registry-connections-loNMNf7a.js} +1 -1
  215. package/dist/client/assets/{use-secrets-DH31aTTe.js → use-secrets-CiJ0Zaqs.js} +1 -1
  216. package/dist/client/assets/{use-section-preview-base-Csrv-VqV.js → use-section-preview-base-DnGXmD69.js} +1 -1
  217. package/dist/client/assets/{use-settings-tabs-CGwARRFk.js → use-settings-tabs-C0XpmAor.js} +1 -1
  218. package/dist/client/assets/{use-status-sounds-BeFWP6sc.js → use-status-sounds-rgQeZbJz.js} +1 -1
  219. package/dist/client/assets/{use-tags-BkefASeN.js → use-tags-Bgxyo4Hc.js} +1 -1
  220. package/dist/client/assets/{use-view-mode-BLj18CVK.js → use-view-mode-BVD3Itfp.js} +1 -1
  221. package/dist/client/assets/{use-virtual-mcp-B0LtGhD8.js → use-virtual-mcp-Cmq9hnwJ.js} +1 -1
  222. package/dist/client/assets/useInfiniteQuery-BDqtPFHv.js +1 -0
  223. package/dist/client/assets/{useRouterState-um8-mtPt.js → useRouterState-_A070XGO.js} +1 -1
  224. package/dist/client/assets/useSuspenseInfiniteQuery-t8wGjcWq.js +1 -0
  225. package/dist/client/assets/{users-CWvqMFcP.js → users-iyIOf_-j.js} +1 -1
  226. package/dist/client/assets/{variant-calendar-B1xj6WY-.js → variant-calendar-DhbPls6j.js} +1 -1
  227. package/dist/client/assets/{view-mode-toggle-B1CxI2v1.js → view-mode-toggle-DCg9QPTv.js} +1 -1
  228. package/dist/client/index.html +1 -1
  229. package/dist/server/cli.js +2 -2
  230. package/dist/server/server.js +2 -2
  231. package/package.json +1 -1
  232. package/dist/client/assets/record-editor-DHsX7f85.js +0 -1
  233. package/dist/client/assets/registry-BCU9YbQl.js +0 -2
  234. package/dist/client/assets/settings-layout-CihM6Z5f.js +0 -1
  235. package/dist/client/assets/store-registry-OC_7xuUK.js +0 -2
  236. package/dist/client/assets/useInfiniteQuery-BTBdPVyZ.js +0 -1
  237. package/dist/client/assets/useSuspenseInfiniteQuery-C3uzz_IX.js +0 -1
@@ -1371,7 +1371,7 @@ Usage: deco services <up|down|status>`),process.exit(1)}}var Gi1=w(()=>{Lf()});f
1371
1371
  `.execute($);if(Number(W.rows[0]?.cnt)===0){console.warn(`Failed to migrate ${J}/${K}, keeping in old table`);continue}}await mb`
1372
1372
  DELETE FROM kysely_migration WHERE name = ${X}
1373
1373
  `.execute($)}}async function To1($){await Lp6($),await Dp6($);let Z=new Po1({db:$,provider:{getMigrations:()=>Promise.resolve(Pi0)}}),{error:X,results:Q}=await Z.migrateToLatest(),Y=0;if(Q?.forEach((G)=>{if(G.status==="Success")Y++;else if(G.status==="Error")console.error(`Failed to execute migration "${G.migrationName}"`)}),X)throw console.error("Failed to migrate"),console.error(X),X;return Y}async function Ep6($){let{keepOpen:Z=!1,database:X,skipBetterAuth:Q=!1}=$??{},Y="skipped";if(!Q&&!X)Y=await mc0();let G=X??F6(),J=async()=>{if(!Z&&!X)await hB(G).catch((K)=>{console.warn("Warning: Error closing database:",K)})};try{let K=await To1(G.db);return await J(),{betterAuth:Y,kysely:K}}catch(K){throw await J(),K}}async function jp6(){let $=F6(),Z=new Po1({db:$.db,provider:{getMigrations:()=>Promise.resolve(Pi0)}}),{error:X,results:Q}=await Z.migrateDown();if(Q?.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}"`)}),X)throw console.error("Failed to rollback migration"),console.error(X),X}var Io1=w(()=>{zo1();ic0();QX()});async function AZ0($){let Z={...process.env},X=B80($,Z);console.log(hw1(X.settings.encryptionKey));let Q=X.settings.betterAuthSecret||(X.settings.localMode?fn1(X.settings.dataDir):""),{ensureServices:Y}=await Promise.resolve().then(() => (S90(),k90)),{outputs:G,services:J}=await Y({home:X.settings.dataDir,externalDatabaseUrl:X.externalDatabaseUrl,externalNatsUrl:X.externalNatsUrl});if(!X.skipMigrations){let{migrateBetterAuth:W}=await Promise.resolve().then(() => (ic0(),yn1));await W(G.databaseUrl);let{createDatabase:H}=await Promise.resolve().then(() => (QX(),$n1)),{migrateToLatest:N}=await Promise.resolve().then(() => (Io1(),Ro1)),U=H(G.databaseUrl);await N({keepOpen:!0,database:U,skipBetterAuth:!0})}let K={...X.settings,betterAuthSecret:Q,databaseUrl:G.databaseUrl,natsUrls:G.natsUrls,...G.s3?{s3Endpoint:G.s3.endpoint,s3Bucket:G.s3.bucket,s3AccessKeyId:G.s3.accessKeyId,s3SecretAccessKey:G.s3.secretAccessKey,s3ForcePathStyle:G.s3.forcePathStyle}:{},...G.natsTunnel?{natsPublicUrl:G.natsTunnel.publicUrl,natsAccountJwt:G.natsTunnel.accountJwt,natsAccountSigningKey:G.natsTunnel.accountSigningKey,natsOperatorJwt:G.natsTunnel.operatorJwt,natsTunnelPublicEnabled:!0,natsCredsPath:G.natsTunnel.credsPath}:{}};return Ji1(K),{settings:K,services:J.map((W)=>({name:W.name==="PostgreSQL"?"Postgres":W.name,port:W.port})),managedServiceNames:J.filter((W)=>W.owner==="managed").map((W)=>W.name)}}var Ai0=w(()=>{Lf();bn1();C8()});var Vo1={};F0(Vo1,{updateService:()=>EE,subscribeCliState:()=>Ii0,setTuiConsoleIntercepted:()=>TZ0,setServerUrl:()=>Ci,setMigrationsDone:()=>Si,setDevMode:()=>Ap6,resetCliStateForTests:()=>zp6,isTuiConsoleIntercepted:()=>RZ0,getCliState:()=>Ri0,addLogEntry:()=>mB});function qo1(){return{services:[{name:"Postgres",status:"pending",port:0},{name:"NATS",status:"pending",port:0}],migrationsStatus:"pending",serverUrl:null,logs:[]}}function zp6(){cQ=qo1()}function Pp6(){return[{name:"Postgres",status:"pending",port:0},{name:"NATS",status:"pending",port:0}]}function ki(){for(let $ of Ti0)$()}function Ri0(){return cQ}function Ii0($){return Ti0.add($),()=>Ti0.delete($)}function EE($){cQ={...cQ,services:cQ.services.map((Z)=>Z.name===$.name?$:Z)},ki()}function Si(){cQ={...cQ,migrationsStatus:"done"},ki()}function Ci($){cQ={...cQ,serverUrl:$},ki()}function mB($){let Z=[...cQ.logs,$];cQ={...cQ,logs:Z.length>500?Z.slice(-500):Z},ki()}function Ap6(){cQ={...cQ,services:[...Pp6(),{name:"API",status:"pending",port:0},{name:"Vite",status:"pending",port:0}]},ki()}function TZ0($){Mo1=$}function RZ0(){return Mo1}var cQ,Ti0,Mo1=!1;var jE=w(()=>{cQ=qo1();Ti0=new Set});import{createServer as ko1}from"net";function Tp6($){return new Promise((Z)=>{let X=ko1();X.once("error",()=>Z(!1)),X.listen($,"0.0.0.0",()=>{X.close(()=>Z(!0))})})}async function _i($){if(await Tp6($))return $;let Z=await new Promise((X,Q)=>{let Y=ko1();Y.once("error",Q),Y.listen(0,"0.0.0.0",()=>{let G=Y.address(),J=typeof G==="object"&&G?G.port:0;Y.close(()=>X(J))})});return console.warn(`Port ${$} is in use, using port ${Z} instead.`),Z}var qi0=()=>{};function vi($){return $.replace(/\x1b\[[0-9;]*m/g,"")}var Mi0={};F0(Mi0,{startDevServer:()=>Ip6});import{join as Rp6}from"path";function So1($){let Z=$.getReader(),X=new TextDecoder,Q="";function Y(){let G=Q.split(`
1374
- `);Q=G.pop()??"";for(let J of G){let K=vi(J).replace(/^\[\d+\]\s*/,"").trim();if(!K)continue;mB({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:K})}}(async()=>{for(;;){let{done:G,value:J}=await Z.read();if(G)break;Q+=X.decode(J,{stream:!0}),Y()}if(Q.trim()){let G=vi(Q).replace(/^\[\d+\]\s*/,"").trim();if(G)mB({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:G})}})()}async function Ip6($){let{baseUrl:Z,noTui:X}=$,Q=process.env.HOST==="0.0.0.0"&&Boolean(process.env.PORT),Y=Q?process.env.PORT:$.vitePort,G=Z||`http://localhost:${Y}`,J=Q?await _i(Number(Y)+1):await _i(Number($.port)),{settings:K,services:W,managedServiceNames:H}=await AZ0({port:String(J),home:$.home,baseUrl:$.baseUrl,localMode:$.localMode,skipMigrations:$.skipMigrations,noTui:$.noTui,vitePort:$.vitePort});for(let L of W)EE({name:L.name,status:"ready",port:L.port});Si();let N=Rp6(import.meta.dir,"..","..","..","..",".."),U=X===!0,F=Bun.spawn(["bun","run","dev:servers"],{cwd:N,env:{...process.env,PORT:String(K.port),VITE_PORT:String(Y),DATABASE_URL:K.databaseUrl,NATS_URL:K.natsUrls.join(","),NODE_ENV:K.nodeEnv,BASE_URL:G,DECOCMS_LOCAL_MODE:String(K.localMode),DECOCMS_HOME:K.dataDir,DATA_DIR:K.dataDir,DECO_CLI:"1",...K.betterAuthSecret?{BETTER_AUTH_SECRET:K.betterAuthSecret}:{},...K.s3Endpoint?{S3_ENDPOINT:K.s3Endpoint,S3_BUCKET:K.s3Bucket??"",S3_ACCESS_KEY_ID:K.s3AccessKeyId??"",S3_SECRET_ACCESS_KEY:K.s3SecretAccessKey??"",S3_FORCE_PATH_STYLE:String(K.s3ForcePathStyle)}:{},...K.natsPublicUrl&&K.natsAccountJwt&&K.natsAccountSigningKey?{NATS_PUBLIC_URL:K.natsPublicUrl,NATS_ACCOUNT_JWT:K.natsAccountJwt,NATS_ACCOUNT_SIGNING_KEY:K.natsAccountSigningKey,NATS_OPERATOR_JWT:K.natsOperatorJwt??"",NATS_TUNNEL_PUBLIC_ENABLED:"true",...K.natsCredsPath?{NATS_CREDS:K.natsCredsPath}:{}}:{}},stdio:["inherit",U?"inherit":"pipe",U?"inherit":"pipe"]});if(!U)So1(F.stdout),So1(F.stderr);Ci(G),EE({name:"Vite",status:"ready",port:Number(Y)}),EE({name:"API",status:"ready",port:Number(K.port)});let O=async(L)=>{if(F.kill(L),await F.exited,H.length>0){let{stopServices:D}=await Promise.resolve().then(() => (S90(),k90));await D(K.dataDir)}};return process.on("SIGINT",()=>O("SIGINT")),process.on("SIGTERM",()=>O("SIGTERM")),{port:Number(Y),process:F}}var Vi0=w(()=>{Ai0();jE();qi0()});var IZ0;var ki0=w(()=>{IZ0={name:"decocms",version:"4.243.2",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":"^3.0.85","@ai-sdk/google":"^3.0.83","@ai-sdk/openai":"^3.0.73","@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":"^2.9.1","@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":"^3.0.10","@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","@nats-io/jwt":"0.0.10-5","@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:"^6.0.208","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 Mp6,Text as Co1}from"ink";import{jsx as Vp6,jsxs as _o1}from"react/jsx-runtime";function vo1({version:$}){return _o1(Mp6,{flexDirection:"column",marginTop:1,children:[e90.map((Z,X)=>Vp6(Co1,{color:$Z0[X],children:Z},X)),_o1(Co1,{dimColor:!0,children:[" v",$]})]})}var xo1=w(()=>{Ei()});import{Box as zE,Text as iB}from"ink";import{Spinner as kp6}from"@inkjs/ui";import{jsx as aY,jsxs as ib}from"react/jsx-runtime";function fo1({status:$}){if($==="pending")return aY(kp6,{label:""});return aY(iB,{color:"green",children:"\u2713"})}function Sp6($){return`${$.name}: ${$.port||"...."}`}function bo1({services:$,migrationsStatus:Z,home:X,serverUrl:Q}){return ib(zE,{flexDirection:"column",paddingBottom:1,children:[aY(vo1,{version:IZ0.version}),aY(zE,{marginBottom:1,children:aY(iB,{dimColor:!0,children:"\u2500".repeat(80)})}),aY(zE,{children:ib(iB,{dimColor:!0,children:["Home: ",X]})}),ib(zE,{gap:2,children:[$.map((Y)=>ib(zE,{gap:1,children:[aY(iB,{children:Sp6(Y)}),aY(fo1,{status:Y.status})]},Y.name)),ib(zE,{gap:1,children:[aY(iB,{children:"Migrations"}),aY(fo1,{status:Z})]})]}),aY(zE,{children:Q?ib(iB,{children:["Open in browser: ",aY(iB,{color:"cyan",children:Q})]}):aY(iB,{dimColor:!0,children:"Starting..."})})]})}var yo1=w(()=>{ki0();xo1()});import{Box as Cp6,Text as xi}from"ink";import{jsx as Si0,jsxs as Ci0}from"react/jsx-runtime";function _p6($){if($>=500)return"red";if($>=400)return"yellow";if($>=300)return"cyan";return"green"}function go1({logs:$}){return Si0(Cp6,{flexDirection:"column",children:$.map((Z,X)=>{if(Z.rawLine)return Si0(xi,{dimColor:!0,children:Z.rawLine},X);let Q=Z.duration<1000?`${Z.duration}ms`:`${(Z.duration/1000).toFixed(1)}s`;return Ci0(xi,{children:[Ci0(xi,{dimColor:!0,children:[Z.method.padEnd(6)," ",Z.path.padEnd(30)," "]}),Si0(xi,{color:_p6(Z.status),children:Z.status}),Ci0(xi,{dimColor:!0,children:[" ",Q.padStart(8)]})]},X)})})}var ho1=()=>{};var _i0={};F0(_i0,{App:()=>fp6});import{Box as vp6}from"ink";import{useSyncExternalStore as xp6}from"react";import{jsx as uo1,jsxs as bp6}from"react/jsx-runtime";function fp6({home:$}){let Z=xp6(Ii0,Ri0);return bp6(vp6,{flexDirection:"column",children:[uo1(bo1,{services:Z.services,migrationsStatus:Z.migrationsStatus,home:$,serverUrl:Z.serverUrl}),uo1(go1,{logs:Z.logs})]})}var vi0=w(()=>{yo1();ho1();jE()});var fJ="thread-gate",sN="decopilot-hosted-harness",eN="decopilot-hosted-harness-sandboxed",N3="automations",nB="background-tools",PE="task-board-github-reads",AE="jira-push";var co1="7";function lo1($){return{name:"decocms",systemDatabaseUrl:$.systemDatabaseUrl,systemDatabaseSchemaName:"dbos",systemDatabasePoolSize:$.poolSize,runAdminServer:!1,executorID:$.executorID,applicationVersion:co1,...$.listenQueues!==void 0?{listenQueues:$.listenQueues}:{}}}var do1=()=>{};function yp6(){let $=(process.env.BUN_OPTIONS??"").split(/\s+/).filter(Boolean);return[...process.argv.slice(1),...$]}function xi0($,Z){for(let X=0;X<$.length;X++){let Q=$[X];if(Q===void 0)continue;if(Q===Z)return $[X+1];if(Q.startsWith(`${Z}=`))return Q.slice(Z.length+1)}return}function mo1(){let $=yp6();if($.includes("--cpu-prof")){console.log(JSON.stringify({msg:"cpu-profiling-active",dir:xi0($,"--cpu-prof-dir")??process.cwd(),name:xi0($,"--cpu-prof-name"),markdown:$.includes("--cpu-prof-md"),intervalUs:Number(xi0($,"--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 io1(){if(process.env.HEAP_WATCH!=="1")return()=>{};let $=Number(process.env.HEAP_WATCH_INTERVAL_MS??60000),Z=async()=>{let X=OE();if(!X)return;let Q={};try{let{heapStats:Y}=await import("bun:jsc"),G=Y(),J=Object.entries(G.objectTypeCounts).sort((K,W)=>W[1]-K[1]).slice(0,20);Q={objectCount:G.objectCount,heapSize:G.heapSize,top:Object.fromEntries(J)}}catch{}console.log(JSON.stringify({msg:"heap-watch",ts:new Date().toISOString(),uptimeS:Math.round(process.uptime()),rss:X.rss,heapUsed:X.heapUsed,heapTotal:X.heapTotal,external:X.external,arrayBuffers:X.arrayBuffers,...Q}))};return Z().catch(()=>{}),qZ0=setInterval(()=>void Z().catch(()=>{}),$),qZ0.unref?.(),process.on("SIGUSR2",()=>{try{let X=Bun.generateHeapSnapshot("v8"),Q=typeof X==="string"?X:JSON.stringify(X),Y=`/tmp/heap-${process.pid}-${Date.now()}.heapsnapshot`;Bun.write(Y,Q),console.log(JSON.stringify({msg:"heap-snapshot-written",path:Y}))}catch(X){console.error("[heap-watch] snapshot failed:",X)}}),()=>{if(qZ0)clearInterval(qZ0)}}var qZ0;var no1=()=>{};import*as gp6 from"bun:jsc";function po1(){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{hp6()}catch(G){return console.error("[stall-watchdog] failed to start sampling profiler:",G),()=>{}}let X,Q=performance.now()+Z,Y=()=>{let G=performance.now(),J=G-Q;Q=G+Z;let K=[];try{K=up6()?.traces??[]}catch{}if(J>$&&K.length>0){let W=new Map;for(let N of K){let U=N.frames.find((O)=>O.sourceURL&&!/Unknown Executable/.test(O.category??""))??N.frames[0];if(!U)continue;let F=(U.sourceURL??"?").replace(/^.*\/node_modules\//,"node_modules/"),B=`${U.name??"?"} @ ${F}:${U.line??"?"}`;W.set(B,(W.get(B)??0)+1)}let H=[...W.entries()].sort((N,U)=>U[1]-N[1]).slice(0,8).map(([N,U])=>({frame:N,count:U}));console.warn(JSON.stringify({msg:"stall-stack",ts:new Date().toISOString(),lagMs:Math.round(J),samplesInWindow:K.length,top:H}))}X=setTimeout(Y,Z),X.unref?.()};return X=setTimeout(Y,Z),X.unref?.(),()=>{if(X)clearTimeout(X)}}var hp6,up6;var to1=w(()=>{({startSamplingProfiler:hp6,samplingProfilerStackTraces:up6}=gp6)});function oo1(){mo1();let $=[io1(),ni1(),po1()];return()=>{for(let Z of $)Z()}}var ro1=w(()=>{xc0();no1();to1()});var TE=_((ao1)=>{Object.defineProperty(ao1,"__esModule",{value:!0});ao1.RepublishHeaders=ao1.DirectMsgHeaders=ao1.JsHeaders=ao1.AdvisoryKind=void 0;ao1.isOrderedPushConsumerOptions=cp6;ao1.isPullConsumer=lp6;ao1.isPushConsumer=dp6;ao1.isBoundPushConsumerOptions=mp6;function cp6($){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 lp6($){return $.isPullConsumer()}function dp6($){return $.isPushConsumer()}function mp6($){if($&&typeof $==="object")return"deliver_subject"in $||"deliver_group"in $||"idle_heartbeat"in $;return!1}ao1.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"};ao1.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"};ao1.DirectMsgHeaders={Stream:"Nats-Stream",Sequence:"Nats-Sequence",TimeStamp:"Nats-Time-Stamp",Subject:"Nats-Subject",LastSequence:"Nats-Last-Sequence",NumPending:"Nats-Num-Pending"};ao1.RepublishHeaders={Stream:"Nats-Stream",Subject:"Nats-Subject",Sequence:"Nats-Sequence",LastSequence:"Nats-Last-Sequence",Size:"Nats-Msg-Size"}});var sY=_((eo1)=>{Object.defineProperty(eo1,"__esModule",{value:!0});eo1.TD=eo1.TE=eo1.Empty=void 0;eo1.encode=ep6;eo1.decode=$t6;eo1.Empty=new Uint8Array(0);eo1.TE=new TextEncoder;eo1.TD=new TextDecoder;function sp6(...$){let Z=0;for(let Y=0;Y<$.length;Y++)Z+=$[Y].length;let X=new Uint8Array(Z),Q=0;for(let Y=0;Y<$.length;Y++)X.set($[Y],Q),Q+=$[Y].length;return X}function ep6(...$){let Z=[];for(let X=0;X<$.length;X++)Z.push(eo1.TE.encode($[X]));if(Z.length===0)return eo1.Empty;if(Z.length===1)return Z[0];return sp6(...Z)}function $t6($){if(!$||$.length===0)return"";return eo1.TD.decode($)}});var eY=_((Xr1)=>{Object.defineProperty(Xr1,"__esModule",{value:!0});Xr1.errors=Xr1.PermissionViolationError=Xr1.NoRespondersError=Xr1.TimeoutError=Xr1.RequestError=Xr1.ProtocolError=Xr1.ConnectionError=Xr1.DrainingConnectionError=Xr1.ClosedConnectionError=Xr1.AuthorizationError=Xr1.UserAuthenticationExpiredError=Xr1.InvalidOperationError=Xr1.InvalidArgumentError=Xr1.InvalidSubjectError=void 0;class bi0 extends Error{constructor($,Z){super(`illegal subject: '${$}'`,Z);this.name="InvalidSubjectError"}}Xr1.InvalidSubjectError=bi0;class MZ0 extends Error{constructor($,Z){super($,Z);this.name="InvalidArgumentError"}static format($,Z,X){if(Array.isArray(Z)&&Z.length>1)Z=Z[0];if(Array.isArray($))$=$.map((Q)=>`'${Q}'`),$=$.join(",");else $=`'${$}'`;return new MZ0(`${$} ${Z}`,X)}}Xr1.InvalidArgumentError=MZ0;class yi0 extends Error{constructor($,Z){super($,Z);this.name="InvalidOperationError"}}Xr1.InvalidOperationError=yi0;class VZ0 extends Error{constructor($,Z){super($,Z);this.name="UserAuthenticationExpiredError"}static parse($){if($.toLowerCase().indexOf("user authentication expired")!==-1)return new VZ0($);return null}}Xr1.UserAuthenticationExpiredError=VZ0;class kZ0 extends Error{constructor($,Z){super($,Z);this.name="AuthorizationError"}static parse($){let Z=["authorization violation","account authentication expired","authentication timeout"],X=$.toLowerCase();for(let Q=0;Q<Z.length;Q++)if(X.indexOf(Z[Q])!==-1)return new kZ0($);return null}}Xr1.AuthorizationError=kZ0;class gi0 extends Error{constructor(){super("closed connection");this.name="ClosedConnectionError"}}Xr1.ClosedConnectionError=gi0;class hi0 extends Error{constructor(){super("connection draining");this.name="DrainingConnectionError"}}Xr1.DrainingConnectionError=hi0;class ui0 extends Error{constructor($,Z){super($,Z);this.name="ConnectionError"}}Xr1.ConnectionError=ui0;class ci0 extends Error{constructor($,Z){super($,Z);this.name="ProtocolError"}}Xr1.ProtocolError=ci0;class li0 extends Error{constructor($="",Z){super($,Z);this.name="RequestError"}isNoResponders(){return this.cause instanceof SZ0}}Xr1.RequestError=li0;class di0 extends Error{constructor($){super("timeout",$);this.name="TimeoutError"}}Xr1.TimeoutError=di0;class SZ0 extends Error{subject;constructor($,Z){super(`no responders: '${$}'`,Z);this.subject=$,this.name="NoResponders"}}Xr1.NoRespondersError=SZ0;class CZ0 extends Error{operation;subject;queue;constructor($,Z,X,Q,Y){super($,Y);this.name="PermissionViolationError",this.operation=Z,this.subject=X,this.queue=Q}static parse($){if(($?$.toLowerCase():"").indexOf("permissions violation")===-1)return null;let X="publish",Q="",Y=void 0,G=$.match(/(Publish|Subscription) to "(\S+)"/);if(G){if(X=G[1].toLowerCase(),Q=G[2],X==="subscription"){let J=$.match(/using queue "(\S+)"/);if(J)Y=J[1]}}return new CZ0($,X,Q,Y)}}Xr1.PermissionViolationError=CZ0;Xr1.errors={AuthorizationError:kZ0,ClosedConnectionError:gi0,ConnectionError:ui0,DrainingConnectionError:hi0,InvalidArgumentError:MZ0,InvalidOperationError:yi0,InvalidSubjectError:bi0,NoRespondersError:SZ0,PermissionViolationError:CZ0,ProtocolError:ci0,RequestError:li0,TimeoutError:di0,UserAuthenticationExpiredError:VZ0}});var bJ=_((Kr1)=>{Object.defineProperty(Kr1,"__esModule",{value:!0});Kr1.SimpleMutex=Kr1.Perf=void 0;Kr1.extend=Dt6;Kr1.render=Et6;Kr1.timeout=jt6;Kr1.delay=zt6;Kr1.deadline=Pt6;Kr1.deferred=ii0;Kr1.debugDeferred=At6;Kr1.shuffle=Tt6;Kr1.collect=Rt6;Kr1.jitter=Jr1;Kr1.backoff=It6;Kr1.nanos=qt6;Kr1.millis=Mt6;Kr1.randomToken=St6;var Lt6=sY(),mi0=eY();function Dt6($,...Z){for(let X=0;X<Z.length;X++){let Q=Z[X];Object.keys(Q).forEach(function(Y){$[Y]=Q[Y]})}return $}function Et6($){return Lt6.TD.decode($).replace(/\n/g,"\u240A").replace(/\r/g,"\u240D")}function jt6($,Z=!0){let X=Z?new mi0.TimeoutError:null,Q,Y,G=new Promise((J,K)=>{Q={cancel:()=>{if(Y)clearTimeout(Y)}},Y=setTimeout(()=>{if(X===null)K(new mi0.TimeoutError);else K(X)},$)});return Object.assign(G,Q)}function zt6($=0){let Z,X=new Promise((Q)=>{let Y=setTimeout(()=>{Q()},$);Z={cancel:()=>{if(Y)clearTimeout(Y),Q()}}});return Object.assign(X,Z)}async function Pt6($,Z=1000){let X=ii0(),Q=setTimeout(()=>{X.reject(new mi0.TimeoutError)},Z);try{return await Promise.race([$,X])}finally{clearTimeout(Q)}}function ii0(){let $={},Z=new Promise((X,Q)=>{$={resolve:X,reject:Q}});return Object.assign(Z,$)}function At6(){let $={},Z=new Promise((X,Q)=>{$={resolve:(Y)=>{console.trace("resolve",Y),X(Y)},reject:(Y)=>{console.trace("reject"),Q(Y)}}});return Object.assign(Z,$)}function Tt6($){for(let Z=$.length-1;Z>0;Z--){let X=Math.floor(Math.random()*(Z+1));[$[Z],$[X]]=[$[X],$[Z]]}return $}async function Rt6($){let Z=[];for await(let X of $)Z.push(X);return Z}class Yr1{timers;measures;constructor(){this.timers=new Map,this.measures=new Map}mark($){this.timers.set($,performance.now())}measure($,Z,X){let Q=this.timers.get(Z);if(Q===void 0)throw Error(`${Z} is not defined`);let Y=this.timers.get(X);if(Y===void 0)throw Error(`${X} is not defined`);this.measures.set($,Y-Q)}getEntries(){let $=[];return this.measures.forEach((Z,X)=>{$.push({name:X,duration:Z})}),$}}Kr1.Perf=Yr1;class Gr1{max;current;waiting;constructor($=1){this.max=$,this.current=0,this.waiting=[]}lock(){if(this.current++,this.current<=this.max)return Promise.resolve();let $=ii0();return this.waiting.push($),$}unlock(){this.current--,this.waiting.pop()?.resolve()}}Kr1.SimpleMutex=Gr1;function Jr1($){if($===0)return 0;return Math.floor($/2+Math.random()*$)}function It6($=[0,250,250,500,500,3000,5000]){if(!Array.isArray($))$=[0,250,250,500,500,3000,5000];let Z=$.length-1;return{backoff(X){return Jr1(X>Z?$[Z]:$[X])}}}function qt6($){return $*1e6}function Mt6($){return Math.floor($/1e6)}var Vt6="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",$U=new Uint8Array(62);for(let $=0;$<62;$++)$U[$]=Vt6.charCodeAt($);var kt6=218340105584896;function St6(){let $=Math.floor(Math.random()*kt6),Z=$%62,X=$U[Z];$=($-Z)/62,Z=$%62;let Q=$U[Z];$=($-Z)/62,Z=$%62;let Y=$U[Z];$=($-Z)/62,Z=$%62;let G=$U[Z];$=($-Z)/62,Z=$%62;let J=$U[Z];$=($-Z)/62,Z=$%62;let K=$U[Z];$=($-Z)/62,Z=$%62;let W=$U[Z];$=($-Z)/62;let H=$U[$];return String.fromCharCode(X,Q,Y,G,J,K,W,H)}});var wr1=_((Br1)=>{Object.defineProperty(Br1,"__esModule",{value:!0});Br1.nuid=Br1.NuidImpl=void 0;var nt6="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",pB=62,vZ0=12,Ur1=10,Hr1=33,pt6=333,Nr1=vZ0+Ur1,pi0=new Uint8Array(pB);for(let $=0;$<pB;$++)pi0[$]=nt6.charCodeAt($);var _Z0=4294967296,Fr1=BigInt(pB)**BigInt(Ur1),fi=Number(Fr1/(1n<<32n)),ni0=Number(Fr1%(1n<<32n));function tt6($){for(let Z=0;Z<$.length;Z++)$[Z]=Math.floor(Math.random()*256)}function ot6($){if(globalThis?.crypto?.getRandomValues)globalThis.crypto.getRandomValues($);else tt6($)}class ti0{buf;cbuf;seqHi;seqLo;inc;inited;constructor(){this.buf=new Uint8Array(Nr1),this.cbuf=new Uint8Array(vZ0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){let $=0;do this.seqHi=Math.floor(Math.random()*(fi+1)),this.seqLo=Math.floor(Math.random()*_Z0);while($++<8&&this.seqHi===fi&&this.seqLo>=ni0);if(this.seqHi===fi&&this.seqLo>=ni0)this.seqLo=0;this.inc=Math.random()*(pt6-Hr1)+Hr1|0}setPre(){ot6(this.cbuf);for(let $=0;$<vZ0;$++)this.buf[$]=pi0[this.cbuf[$]%pB]}fillSeq(){let $=this.seqHi,Z=this.seqLo;for(let X=Nr1-1;X>=vZ0;X--){let Q=Math.floor($/pB),G=($-Q*pB)*_Z0+Z,J=Math.floor(G/pB),K=G-J*pB;this.buf[X]=pi0[K],$=Q,Z=J}}next(){if(!this.inited)this.init();if(this.seqLo+=this.inc,this.seqLo>=_Z0)this.seqLo-=_Z0,this.seqHi+=1;if(this.seqHi>fi||this.seqHi===fi&&this.seqLo>=ni0)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()}}Br1.NuidImpl=ti0;Br1.nuid=new ti0});var jr1=_((Dr1)=>{Object.defineProperty(Dr1,"__esModule",{value:!0});Dr1.nuid=Dr1.Nuid=void 0;var Lr1=wr1();Dr1.Nuid=Lr1.NuidImpl;Dr1.nuid=Lr1.nuid});var fZ0=_((xZ0)=>{Object.defineProperty(xZ0,"__esModule",{value:!0});xZ0.nuid=xZ0.Nuid=void 0;var zr1=jr1();Object.defineProperty(xZ0,"Nuid",{enumerable:!0,get:function(){return zr1.Nuid}});Object.defineProperty(xZ0,"nuid",{enumerable:!0,get:function(){return zr1.nuid}})});var tB=_((Pr1)=>{Object.defineProperty(Pr1,"__esModule",{value:!0});Pr1.DEFAULT_HOST=Pr1.DEFAULT_PORT=Pr1.Match=void 0;Pr1.syncIterator=Zo6;Pr1.createInbox=Xo6;var et6=fZ0(),$o6=eY();Pr1.Match={Exact:"exact",CanonicalMIME:"canonical",IgnoreCase:"insensitive"};function Zo6($){let Z=$[Symbol.asyncIterator]();return{async next(){let X=await Z.next();if(X.done)return Promise.resolve(null);return Promise.resolve(X.value)}}}function Xo6($=""){if($=$||"_INBOX",typeof $!=="string")throw TypeError("prefix must be a string");return $.split(".").forEach((Z)=>{if(Z==="*"||Z===">")throw $o6.InvalidArgumentError.format("prefix",`cannot have wildcards ('${$}')`)}),`${$}.${et6.nuid.next()}`}Pr1.DEFAULT_PORT=4222;Pr1.DEFAULT_HOST="127.0.0.1"});var bi=_((Ir1)=>{Object.defineProperty(Ir1,"__esModule",{value:!0});Ir1.DataBuffer=void 0;var Tr1=sY();class Rr1{buffers;byteLength;constructor(){this.buffers=[],this.byteLength=0}static concat(...$){let Z=0;for(let Y=0;Y<$.length;Y++)Z+=$[Y].length;let X=new Uint8Array(Z),Q=0;for(let Y=0;Y<$.length;Y++)X.set($[Y],Q),Q+=$[Y].length;return X}static fromAscii($){if(!$)$="";return Tr1.TE.encode($)}static toAscii($){return Tr1.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 X=0;X<this.buffers.length;X++)$.set(this.buffers[X],Z),Z+=this.buffers[X].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 X=this.byteLength;if($===void 0||$>X)$=X;let Q=Z.subarray(0,$);if(X>$)this.buffers.push(Z.subarray($));return this.byteLength=X-$,Q}}return new Uint8Array(0)}fill($,...Z){if($)this.buffers.push($),this.byteLength+=$.length;for(let X=0;X<Z.length;X++)if(Z[X]&&Z[X].length)this.buffers.push(Z[X]),this.byteLength+=Z[X].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}}Ir1.DataBuffer=Rr1});var RE=_((Vr1)=>{Object.defineProperty(Vr1,"__esModule",{value:!0});Vr1.LF=Vr1.CR=Vr1.CRLF=Vr1.CR_LF_LEN=Vr1.CR_LF=void 0;Vr1.setTransportFactory=No6;Vr1.defaultPort=Uo6;Vr1.getUrlParseFn=Fo6;Vr1.newTransport=Bo6;Vr1.getResolveFn=Oo6;Vr1.protoLen=Mr1;Vr1.extractProtocolMessage=wo6;var Ko6=sY(),Wo6=tB(),Ho6=bi(),$G;function No6($){$G=$}function Uo6(){return $G!==void 0&&$G.defaultPort!==void 0?$G.defaultPort:Wo6.DEFAULT_PORT}function Fo6(){return $G!==void 0&&$G.urlParseFn?$G.urlParseFn:void 0}function Bo6(){if(!$G||typeof $G.factory!=="function")throw Error("transport fn is not set");return $G.factory()}function Oo6(){return $G!==void 0&&$G.dnsResolveFn?$G.dnsResolveFn:void 0}Vr1.CR_LF=`\r
1374
+ `);Q=G.pop()??"";for(let J of G){let K=vi(J).replace(/^\[\d+\]\s*/,"").trim();if(!K)continue;mB({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:K})}}(async()=>{for(;;){let{done:G,value:J}=await Z.read();if(G)break;Q+=X.decode(J,{stream:!0}),Y()}if(Q.trim()){let G=vi(Q).replace(/^\[\d+\]\s*/,"").trim();if(G)mB({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:G})}})()}async function Ip6($){let{baseUrl:Z,noTui:X}=$,Q=process.env.HOST==="0.0.0.0"&&Boolean(process.env.PORT),Y=Q?process.env.PORT:$.vitePort,G=Z||`http://localhost:${Y}`,J=Q?await _i(Number(Y)+1):await _i(Number($.port)),{settings:K,services:W,managedServiceNames:H}=await AZ0({port:String(J),home:$.home,baseUrl:$.baseUrl,localMode:$.localMode,skipMigrations:$.skipMigrations,noTui:$.noTui,vitePort:$.vitePort});for(let L of W)EE({name:L.name,status:"ready",port:L.port});Si();let N=Rp6(import.meta.dir,"..","..","..","..",".."),U=X===!0,F=Bun.spawn(["bun","run","dev:servers"],{cwd:N,env:{...process.env,PORT:String(K.port),VITE_PORT:String(Y),DATABASE_URL:K.databaseUrl,NATS_URL:K.natsUrls.join(","),NODE_ENV:K.nodeEnv,BASE_URL:G,DECOCMS_LOCAL_MODE:String(K.localMode),DECOCMS_HOME:K.dataDir,DATA_DIR:K.dataDir,DECO_CLI:"1",...K.betterAuthSecret?{BETTER_AUTH_SECRET:K.betterAuthSecret}:{},...K.s3Endpoint?{S3_ENDPOINT:K.s3Endpoint,S3_BUCKET:K.s3Bucket??"",S3_ACCESS_KEY_ID:K.s3AccessKeyId??"",S3_SECRET_ACCESS_KEY:K.s3SecretAccessKey??"",S3_FORCE_PATH_STYLE:String(K.s3ForcePathStyle)}:{},...K.natsPublicUrl&&K.natsAccountJwt&&K.natsAccountSigningKey?{NATS_PUBLIC_URL:K.natsPublicUrl,NATS_ACCOUNT_JWT:K.natsAccountJwt,NATS_ACCOUNT_SIGNING_KEY:K.natsAccountSigningKey,NATS_OPERATOR_JWT:K.natsOperatorJwt??"",NATS_TUNNEL_PUBLIC_ENABLED:"true",...K.natsCredsPath?{NATS_CREDS:K.natsCredsPath}:{}}:{}},stdio:["inherit",U?"inherit":"pipe",U?"inherit":"pipe"]});if(!U)So1(F.stdout),So1(F.stderr);Ci(G),EE({name:"Vite",status:"ready",port:Number(Y)}),EE({name:"API",status:"ready",port:Number(K.port)});let O=async(L)=>{if(F.kill(L),await F.exited,H.length>0){let{stopServices:D}=await Promise.resolve().then(() => (S90(),k90));await D(K.dataDir)}};return process.on("SIGINT",()=>O("SIGINT")),process.on("SIGTERM",()=>O("SIGTERM")),{port:Number(Y),process:F}}var Vi0=w(()=>{Ai0();jE();qi0()});var IZ0;var ki0=w(()=>{IZ0={name:"decocms",version:"4.243.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":"^3.0.85","@ai-sdk/google":"^3.0.83","@ai-sdk/openai":"^3.0.73","@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":"^2.9.1","@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":"^3.0.10","@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","@nats-io/jwt":"0.0.10-5","@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:"^6.0.208","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 Mp6,Text as Co1}from"ink";import{jsx as Vp6,jsxs as _o1}from"react/jsx-runtime";function vo1({version:$}){return _o1(Mp6,{flexDirection:"column",marginTop:1,children:[e90.map((Z,X)=>Vp6(Co1,{color:$Z0[X],children:Z},X)),_o1(Co1,{dimColor:!0,children:[" v",$]})]})}var xo1=w(()=>{Ei()});import{Box as zE,Text as iB}from"ink";import{Spinner as kp6}from"@inkjs/ui";import{jsx as aY,jsxs as ib}from"react/jsx-runtime";function fo1({status:$}){if($==="pending")return aY(kp6,{label:""});return aY(iB,{color:"green",children:"\u2713"})}function Sp6($){return`${$.name}: ${$.port||"...."}`}function bo1({services:$,migrationsStatus:Z,home:X,serverUrl:Q}){return ib(zE,{flexDirection:"column",paddingBottom:1,children:[aY(vo1,{version:IZ0.version}),aY(zE,{marginBottom:1,children:aY(iB,{dimColor:!0,children:"\u2500".repeat(80)})}),aY(zE,{children:ib(iB,{dimColor:!0,children:["Home: ",X]})}),ib(zE,{gap:2,children:[$.map((Y)=>ib(zE,{gap:1,children:[aY(iB,{children:Sp6(Y)}),aY(fo1,{status:Y.status})]},Y.name)),ib(zE,{gap:1,children:[aY(iB,{children:"Migrations"}),aY(fo1,{status:Z})]})]}),aY(zE,{children:Q?ib(iB,{children:["Open in browser: ",aY(iB,{color:"cyan",children:Q})]}):aY(iB,{dimColor:!0,children:"Starting..."})})]})}var yo1=w(()=>{ki0();xo1()});import{Box as Cp6,Text as xi}from"ink";import{jsx as Si0,jsxs as Ci0}from"react/jsx-runtime";function _p6($){if($>=500)return"red";if($>=400)return"yellow";if($>=300)return"cyan";return"green"}function go1({logs:$}){return Si0(Cp6,{flexDirection:"column",children:$.map((Z,X)=>{if(Z.rawLine)return Si0(xi,{dimColor:!0,children:Z.rawLine},X);let Q=Z.duration<1000?`${Z.duration}ms`:`${(Z.duration/1000).toFixed(1)}s`;return Ci0(xi,{children:[Ci0(xi,{dimColor:!0,children:[Z.method.padEnd(6)," ",Z.path.padEnd(30)," "]}),Si0(xi,{color:_p6(Z.status),children:Z.status}),Ci0(xi,{dimColor:!0,children:[" ",Q.padStart(8)]})]},X)})})}var ho1=()=>{};var _i0={};F0(_i0,{App:()=>fp6});import{Box as vp6}from"ink";import{useSyncExternalStore as xp6}from"react";import{jsx as uo1,jsxs as bp6}from"react/jsx-runtime";function fp6({home:$}){let Z=xp6(Ii0,Ri0);return bp6(vp6,{flexDirection:"column",children:[uo1(bo1,{services:Z.services,migrationsStatus:Z.migrationsStatus,home:$,serverUrl:Z.serverUrl}),uo1(go1,{logs:Z.logs})]})}var vi0=w(()=>{yo1();ho1();jE()});var fJ="thread-gate",sN="decopilot-hosted-harness",eN="decopilot-hosted-harness-sandboxed",N3="automations",nB="background-tools",PE="task-board-github-reads",AE="jira-push";var co1="7";function lo1($){return{name:"decocms",systemDatabaseUrl:$.systemDatabaseUrl,systemDatabaseSchemaName:"dbos",systemDatabasePoolSize:$.poolSize,runAdminServer:!1,executorID:$.executorID,applicationVersion:co1,...$.listenQueues!==void 0?{listenQueues:$.listenQueues}:{}}}var do1=()=>{};function yp6(){let $=(process.env.BUN_OPTIONS??"").split(/\s+/).filter(Boolean);return[...process.argv.slice(1),...$]}function xi0($,Z){for(let X=0;X<$.length;X++){let Q=$[X];if(Q===void 0)continue;if(Q===Z)return $[X+1];if(Q.startsWith(`${Z}=`))return Q.slice(Z.length+1)}return}function mo1(){let $=yp6();if($.includes("--cpu-prof")){console.log(JSON.stringify({msg:"cpu-profiling-active",dir:xi0($,"--cpu-prof-dir")??process.cwd(),name:xi0($,"--cpu-prof-name"),markdown:$.includes("--cpu-prof-md"),intervalUs:Number(xi0($,"--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 io1(){if(process.env.HEAP_WATCH!=="1")return()=>{};let $=Number(process.env.HEAP_WATCH_INTERVAL_MS??60000),Z=async()=>{let X=OE();if(!X)return;let Q={};try{let{heapStats:Y}=await import("bun:jsc"),G=Y(),J=Object.entries(G.objectTypeCounts).sort((K,W)=>W[1]-K[1]).slice(0,20);Q={objectCount:G.objectCount,heapSize:G.heapSize,top:Object.fromEntries(J)}}catch{}console.log(JSON.stringify({msg:"heap-watch",ts:new Date().toISOString(),uptimeS:Math.round(process.uptime()),rss:X.rss,heapUsed:X.heapUsed,heapTotal:X.heapTotal,external:X.external,arrayBuffers:X.arrayBuffers,...Q}))};return Z().catch(()=>{}),qZ0=setInterval(()=>void Z().catch(()=>{}),$),qZ0.unref?.(),process.on("SIGUSR2",()=>{try{let X=Bun.generateHeapSnapshot("v8"),Q=typeof X==="string"?X:JSON.stringify(X),Y=`/tmp/heap-${process.pid}-${Date.now()}.heapsnapshot`;Bun.write(Y,Q),console.log(JSON.stringify({msg:"heap-snapshot-written",path:Y}))}catch(X){console.error("[heap-watch] snapshot failed:",X)}}),()=>{if(qZ0)clearInterval(qZ0)}}var qZ0;var no1=()=>{};import*as gp6 from"bun:jsc";function po1(){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{hp6()}catch(G){return console.error("[stall-watchdog] failed to start sampling profiler:",G),()=>{}}let X,Q=performance.now()+Z,Y=()=>{let G=performance.now(),J=G-Q;Q=G+Z;let K=[];try{K=up6()?.traces??[]}catch{}if(J>$&&K.length>0){let W=new Map;for(let N of K){let U=N.frames.find((O)=>O.sourceURL&&!/Unknown Executable/.test(O.category??""))??N.frames[0];if(!U)continue;let F=(U.sourceURL??"?").replace(/^.*\/node_modules\//,"node_modules/"),B=`${U.name??"?"} @ ${F}:${U.line??"?"}`;W.set(B,(W.get(B)??0)+1)}let H=[...W.entries()].sort((N,U)=>U[1]-N[1]).slice(0,8).map(([N,U])=>({frame:N,count:U}));console.warn(JSON.stringify({msg:"stall-stack",ts:new Date().toISOString(),lagMs:Math.round(J),samplesInWindow:K.length,top:H}))}X=setTimeout(Y,Z),X.unref?.()};return X=setTimeout(Y,Z),X.unref?.(),()=>{if(X)clearTimeout(X)}}var hp6,up6;var to1=w(()=>{({startSamplingProfiler:hp6,samplingProfilerStackTraces:up6}=gp6)});function oo1(){mo1();let $=[io1(),ni1(),po1()];return()=>{for(let Z of $)Z()}}var ro1=w(()=>{xc0();no1();to1()});var TE=_((ao1)=>{Object.defineProperty(ao1,"__esModule",{value:!0});ao1.RepublishHeaders=ao1.DirectMsgHeaders=ao1.JsHeaders=ao1.AdvisoryKind=void 0;ao1.isOrderedPushConsumerOptions=cp6;ao1.isPullConsumer=lp6;ao1.isPushConsumer=dp6;ao1.isBoundPushConsumerOptions=mp6;function cp6($){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 lp6($){return $.isPullConsumer()}function dp6($){return $.isPushConsumer()}function mp6($){if($&&typeof $==="object")return"deliver_subject"in $||"deliver_group"in $||"idle_heartbeat"in $;return!1}ao1.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"};ao1.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"};ao1.DirectMsgHeaders={Stream:"Nats-Stream",Sequence:"Nats-Sequence",TimeStamp:"Nats-Time-Stamp",Subject:"Nats-Subject",LastSequence:"Nats-Last-Sequence",NumPending:"Nats-Num-Pending"};ao1.RepublishHeaders={Stream:"Nats-Stream",Subject:"Nats-Subject",Sequence:"Nats-Sequence",LastSequence:"Nats-Last-Sequence",Size:"Nats-Msg-Size"}});var sY=_((eo1)=>{Object.defineProperty(eo1,"__esModule",{value:!0});eo1.TD=eo1.TE=eo1.Empty=void 0;eo1.encode=ep6;eo1.decode=$t6;eo1.Empty=new Uint8Array(0);eo1.TE=new TextEncoder;eo1.TD=new TextDecoder;function sp6(...$){let Z=0;for(let Y=0;Y<$.length;Y++)Z+=$[Y].length;let X=new Uint8Array(Z),Q=0;for(let Y=0;Y<$.length;Y++)X.set($[Y],Q),Q+=$[Y].length;return X}function ep6(...$){let Z=[];for(let X=0;X<$.length;X++)Z.push(eo1.TE.encode($[X]));if(Z.length===0)return eo1.Empty;if(Z.length===1)return Z[0];return sp6(...Z)}function $t6($){if(!$||$.length===0)return"";return eo1.TD.decode($)}});var eY=_((Xr1)=>{Object.defineProperty(Xr1,"__esModule",{value:!0});Xr1.errors=Xr1.PermissionViolationError=Xr1.NoRespondersError=Xr1.TimeoutError=Xr1.RequestError=Xr1.ProtocolError=Xr1.ConnectionError=Xr1.DrainingConnectionError=Xr1.ClosedConnectionError=Xr1.AuthorizationError=Xr1.UserAuthenticationExpiredError=Xr1.InvalidOperationError=Xr1.InvalidArgumentError=Xr1.InvalidSubjectError=void 0;class bi0 extends Error{constructor($,Z){super(`illegal subject: '${$}'`,Z);this.name="InvalidSubjectError"}}Xr1.InvalidSubjectError=bi0;class MZ0 extends Error{constructor($,Z){super($,Z);this.name="InvalidArgumentError"}static format($,Z,X){if(Array.isArray(Z)&&Z.length>1)Z=Z[0];if(Array.isArray($))$=$.map((Q)=>`'${Q}'`),$=$.join(",");else $=`'${$}'`;return new MZ0(`${$} ${Z}`,X)}}Xr1.InvalidArgumentError=MZ0;class yi0 extends Error{constructor($,Z){super($,Z);this.name="InvalidOperationError"}}Xr1.InvalidOperationError=yi0;class VZ0 extends Error{constructor($,Z){super($,Z);this.name="UserAuthenticationExpiredError"}static parse($){if($.toLowerCase().indexOf("user authentication expired")!==-1)return new VZ0($);return null}}Xr1.UserAuthenticationExpiredError=VZ0;class kZ0 extends Error{constructor($,Z){super($,Z);this.name="AuthorizationError"}static parse($){let Z=["authorization violation","account authentication expired","authentication timeout"],X=$.toLowerCase();for(let Q=0;Q<Z.length;Q++)if(X.indexOf(Z[Q])!==-1)return new kZ0($);return null}}Xr1.AuthorizationError=kZ0;class gi0 extends Error{constructor(){super("closed connection");this.name="ClosedConnectionError"}}Xr1.ClosedConnectionError=gi0;class hi0 extends Error{constructor(){super("connection draining");this.name="DrainingConnectionError"}}Xr1.DrainingConnectionError=hi0;class ui0 extends Error{constructor($,Z){super($,Z);this.name="ConnectionError"}}Xr1.ConnectionError=ui0;class ci0 extends Error{constructor($,Z){super($,Z);this.name="ProtocolError"}}Xr1.ProtocolError=ci0;class li0 extends Error{constructor($="",Z){super($,Z);this.name="RequestError"}isNoResponders(){return this.cause instanceof SZ0}}Xr1.RequestError=li0;class di0 extends Error{constructor($){super("timeout",$);this.name="TimeoutError"}}Xr1.TimeoutError=di0;class SZ0 extends Error{subject;constructor($,Z){super(`no responders: '${$}'`,Z);this.subject=$,this.name="NoResponders"}}Xr1.NoRespondersError=SZ0;class CZ0 extends Error{operation;subject;queue;constructor($,Z,X,Q,Y){super($,Y);this.name="PermissionViolationError",this.operation=Z,this.subject=X,this.queue=Q}static parse($){if(($?$.toLowerCase():"").indexOf("permissions violation")===-1)return null;let X="publish",Q="",Y=void 0,G=$.match(/(Publish|Subscription) to "(\S+)"/);if(G){if(X=G[1].toLowerCase(),Q=G[2],X==="subscription"){let J=$.match(/using queue "(\S+)"/);if(J)Y=J[1]}}return new CZ0($,X,Q,Y)}}Xr1.PermissionViolationError=CZ0;Xr1.errors={AuthorizationError:kZ0,ClosedConnectionError:gi0,ConnectionError:ui0,DrainingConnectionError:hi0,InvalidArgumentError:MZ0,InvalidOperationError:yi0,InvalidSubjectError:bi0,NoRespondersError:SZ0,PermissionViolationError:CZ0,ProtocolError:ci0,RequestError:li0,TimeoutError:di0,UserAuthenticationExpiredError:VZ0}});var bJ=_((Kr1)=>{Object.defineProperty(Kr1,"__esModule",{value:!0});Kr1.SimpleMutex=Kr1.Perf=void 0;Kr1.extend=Dt6;Kr1.render=Et6;Kr1.timeout=jt6;Kr1.delay=zt6;Kr1.deadline=Pt6;Kr1.deferred=ii0;Kr1.debugDeferred=At6;Kr1.shuffle=Tt6;Kr1.collect=Rt6;Kr1.jitter=Jr1;Kr1.backoff=It6;Kr1.nanos=qt6;Kr1.millis=Mt6;Kr1.randomToken=St6;var Lt6=sY(),mi0=eY();function Dt6($,...Z){for(let X=0;X<Z.length;X++){let Q=Z[X];Object.keys(Q).forEach(function(Y){$[Y]=Q[Y]})}return $}function Et6($){return Lt6.TD.decode($).replace(/\n/g,"\u240A").replace(/\r/g,"\u240D")}function jt6($,Z=!0){let X=Z?new mi0.TimeoutError:null,Q,Y,G=new Promise((J,K)=>{Q={cancel:()=>{if(Y)clearTimeout(Y)}},Y=setTimeout(()=>{if(X===null)K(new mi0.TimeoutError);else K(X)},$)});return Object.assign(G,Q)}function zt6($=0){let Z,X=new Promise((Q)=>{let Y=setTimeout(()=>{Q()},$);Z={cancel:()=>{if(Y)clearTimeout(Y),Q()}}});return Object.assign(X,Z)}async function Pt6($,Z=1000){let X=ii0(),Q=setTimeout(()=>{X.reject(new mi0.TimeoutError)},Z);try{return await Promise.race([$,X])}finally{clearTimeout(Q)}}function ii0(){let $={},Z=new Promise((X,Q)=>{$={resolve:X,reject:Q}});return Object.assign(Z,$)}function At6(){let $={},Z=new Promise((X,Q)=>{$={resolve:(Y)=>{console.trace("resolve",Y),X(Y)},reject:(Y)=>{console.trace("reject"),Q(Y)}}});return Object.assign(Z,$)}function Tt6($){for(let Z=$.length-1;Z>0;Z--){let X=Math.floor(Math.random()*(Z+1));[$[Z],$[X]]=[$[X],$[Z]]}return $}async function Rt6($){let Z=[];for await(let X of $)Z.push(X);return Z}class Yr1{timers;measures;constructor(){this.timers=new Map,this.measures=new Map}mark($){this.timers.set($,performance.now())}measure($,Z,X){let Q=this.timers.get(Z);if(Q===void 0)throw Error(`${Z} is not defined`);let Y=this.timers.get(X);if(Y===void 0)throw Error(`${X} is not defined`);this.measures.set($,Y-Q)}getEntries(){let $=[];return this.measures.forEach((Z,X)=>{$.push({name:X,duration:Z})}),$}}Kr1.Perf=Yr1;class Gr1{max;current;waiting;constructor($=1){this.max=$,this.current=0,this.waiting=[]}lock(){if(this.current++,this.current<=this.max)return Promise.resolve();let $=ii0();return this.waiting.push($),$}unlock(){this.current--,this.waiting.pop()?.resolve()}}Kr1.SimpleMutex=Gr1;function Jr1($){if($===0)return 0;return Math.floor($/2+Math.random()*$)}function It6($=[0,250,250,500,500,3000,5000]){if(!Array.isArray($))$=[0,250,250,500,500,3000,5000];let Z=$.length-1;return{backoff(X){return Jr1(X>Z?$[Z]:$[X])}}}function qt6($){return $*1e6}function Mt6($){return Math.floor($/1e6)}var Vt6="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",$U=new Uint8Array(62);for(let $=0;$<62;$++)$U[$]=Vt6.charCodeAt($);var kt6=218340105584896;function St6(){let $=Math.floor(Math.random()*kt6),Z=$%62,X=$U[Z];$=($-Z)/62,Z=$%62;let Q=$U[Z];$=($-Z)/62,Z=$%62;let Y=$U[Z];$=($-Z)/62,Z=$%62;let G=$U[Z];$=($-Z)/62,Z=$%62;let J=$U[Z];$=($-Z)/62,Z=$%62;let K=$U[Z];$=($-Z)/62,Z=$%62;let W=$U[Z];$=($-Z)/62;let H=$U[$];return String.fromCharCode(X,Q,Y,G,J,K,W,H)}});var wr1=_((Br1)=>{Object.defineProperty(Br1,"__esModule",{value:!0});Br1.nuid=Br1.NuidImpl=void 0;var nt6="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",pB=62,vZ0=12,Ur1=10,Hr1=33,pt6=333,Nr1=vZ0+Ur1,pi0=new Uint8Array(pB);for(let $=0;$<pB;$++)pi0[$]=nt6.charCodeAt($);var _Z0=4294967296,Fr1=BigInt(pB)**BigInt(Ur1),fi=Number(Fr1/(1n<<32n)),ni0=Number(Fr1%(1n<<32n));function tt6($){for(let Z=0;Z<$.length;Z++)$[Z]=Math.floor(Math.random()*256)}function ot6($){if(globalThis?.crypto?.getRandomValues)globalThis.crypto.getRandomValues($);else tt6($)}class ti0{buf;cbuf;seqHi;seqLo;inc;inited;constructor(){this.buf=new Uint8Array(Nr1),this.cbuf=new Uint8Array(vZ0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){let $=0;do this.seqHi=Math.floor(Math.random()*(fi+1)),this.seqLo=Math.floor(Math.random()*_Z0);while($++<8&&this.seqHi===fi&&this.seqLo>=ni0);if(this.seqHi===fi&&this.seqLo>=ni0)this.seqLo=0;this.inc=Math.random()*(pt6-Hr1)+Hr1|0}setPre(){ot6(this.cbuf);for(let $=0;$<vZ0;$++)this.buf[$]=pi0[this.cbuf[$]%pB]}fillSeq(){let $=this.seqHi,Z=this.seqLo;for(let X=Nr1-1;X>=vZ0;X--){let Q=Math.floor($/pB),G=($-Q*pB)*_Z0+Z,J=Math.floor(G/pB),K=G-J*pB;this.buf[X]=pi0[K],$=Q,Z=J}}next(){if(!this.inited)this.init();if(this.seqLo+=this.inc,this.seqLo>=_Z0)this.seqLo-=_Z0,this.seqHi+=1;if(this.seqHi>fi||this.seqHi===fi&&this.seqLo>=ni0)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()}}Br1.NuidImpl=ti0;Br1.nuid=new ti0});var jr1=_((Dr1)=>{Object.defineProperty(Dr1,"__esModule",{value:!0});Dr1.nuid=Dr1.Nuid=void 0;var Lr1=wr1();Dr1.Nuid=Lr1.NuidImpl;Dr1.nuid=Lr1.nuid});var fZ0=_((xZ0)=>{Object.defineProperty(xZ0,"__esModule",{value:!0});xZ0.nuid=xZ0.Nuid=void 0;var zr1=jr1();Object.defineProperty(xZ0,"Nuid",{enumerable:!0,get:function(){return zr1.Nuid}});Object.defineProperty(xZ0,"nuid",{enumerable:!0,get:function(){return zr1.nuid}})});var tB=_((Pr1)=>{Object.defineProperty(Pr1,"__esModule",{value:!0});Pr1.DEFAULT_HOST=Pr1.DEFAULT_PORT=Pr1.Match=void 0;Pr1.syncIterator=Zo6;Pr1.createInbox=Xo6;var et6=fZ0(),$o6=eY();Pr1.Match={Exact:"exact",CanonicalMIME:"canonical",IgnoreCase:"insensitive"};function Zo6($){let Z=$[Symbol.asyncIterator]();return{async next(){let X=await Z.next();if(X.done)return Promise.resolve(null);return Promise.resolve(X.value)}}}function Xo6($=""){if($=$||"_INBOX",typeof $!=="string")throw TypeError("prefix must be a string");return $.split(".").forEach((Z)=>{if(Z==="*"||Z===">")throw $o6.InvalidArgumentError.format("prefix",`cannot have wildcards ('${$}')`)}),`${$}.${et6.nuid.next()}`}Pr1.DEFAULT_PORT=4222;Pr1.DEFAULT_HOST="127.0.0.1"});var bi=_((Ir1)=>{Object.defineProperty(Ir1,"__esModule",{value:!0});Ir1.DataBuffer=void 0;var Tr1=sY();class Rr1{buffers;byteLength;constructor(){this.buffers=[],this.byteLength=0}static concat(...$){let Z=0;for(let Y=0;Y<$.length;Y++)Z+=$[Y].length;let X=new Uint8Array(Z),Q=0;for(let Y=0;Y<$.length;Y++)X.set($[Y],Q),Q+=$[Y].length;return X}static fromAscii($){if(!$)$="";return Tr1.TE.encode($)}static toAscii($){return Tr1.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 X=0;X<this.buffers.length;X++)$.set(this.buffers[X],Z),Z+=this.buffers[X].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 X=this.byteLength;if($===void 0||$>X)$=X;let Q=Z.subarray(0,$);if(X>$)this.buffers.push(Z.subarray($));return this.byteLength=X-$,Q}}return new Uint8Array(0)}fill($,...Z){if($)this.buffers.push($),this.byteLength+=$.length;for(let X=0;X<Z.length;X++)if(Z[X]&&Z[X].length)this.buffers.push(Z[X]),this.byteLength+=Z[X].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}}Ir1.DataBuffer=Rr1});var RE=_((Vr1)=>{Object.defineProperty(Vr1,"__esModule",{value:!0});Vr1.LF=Vr1.CR=Vr1.CRLF=Vr1.CR_LF_LEN=Vr1.CR_LF=void 0;Vr1.setTransportFactory=No6;Vr1.defaultPort=Uo6;Vr1.getUrlParseFn=Fo6;Vr1.newTransport=Bo6;Vr1.getResolveFn=Oo6;Vr1.protoLen=Mr1;Vr1.extractProtocolMessage=wo6;var Ko6=sY(),Wo6=tB(),Ho6=bi(),$G;function No6($){$G=$}function Uo6(){return $G!==void 0&&$G.defaultPort!==void 0?$G.defaultPort:Wo6.DEFAULT_PORT}function Fo6(){return $G!==void 0&&$G.urlParseFn?$G.urlParseFn:void 0}function Bo6(){if(!$G||typeof $G.factory!=="function")throw Error("transport fn is not set");return $G.factory()}function Oo6(){return $G!==void 0&&$G.dnsResolveFn?$G.dnsResolveFn:void 0}Vr1.CR_LF=`\r
1375
1375
  `;Vr1.CR_LF_LEN=Vr1.CR_LF.length;Vr1.CRLF=Ho6.DataBuffer.fromAscii(Vr1.CR_LF);Vr1.CR=new Uint8Array(Vr1.CRLF)[0];Vr1.LF=new Uint8Array(Vr1.CRLF)[1];function Mr1($){for(let Z=0;Z<$.length;Z++){let X=Z+1;if($.byteLength>X&&$[Z]===Vr1.CR&&$[X]===Vr1.LF)return X+1}return 0}function wo6($){let Z=Mr1($);if(Z>0){let Q=new Uint8Array($).slice(0,Z);return Ko6.TD.decode(Q)}return""}});var ei0=_((br1)=>{Object.defineProperty(br1,"__esModule",{value:!0});br1.ipV4=vr1;br1.isIP=qo6;br1.parseIP=xr1;var yi=4,IE=16,bZ0=48,_r1=57,Sr1=65,Ro6=70,Cr1=97,Io6=102,si0=16777215;function vr1($,Z,X,Q){let Y=new Uint8Array(IE);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((J,K)=>{Y[K]=J}),Y[12]=$,Y[13]=Z,Y[14]=X,Y[15]=Q,Y}function qo6($){return xr1($)!==void 0}function xr1($){for(let Z=0;Z<$.length;Z++)switch($[Z]){case".":return fr1($);case":":return Mo6($)}return}function fr1($){let Z=new Uint8Array(yi);for(let X=0;X<yi;X++){if($.length===0)return;if(X>0){if($[0]!==".")return;$=$.substring(1)}let{n:Q,c:Y,ok:G}=Vo6($);if(!G||Q>255)return;$=$.substring(Y),Z[X]=Q}return vr1(Z[0],Z[1],Z[2],Z[3])}function Mo6($){let Z=new Uint8Array(IE),X=-1;if($.length>=2&&$[0]===":"&&$[1]===":"){if(X=0,$=$.substring(2),$.length===0)return Z}let Q=0;while(Q<IE){let{n:Y,c:G,ok:J}=ko6($);if(!J||Y>65535)return;if(G<$.length&&$[G]==="."){if(X<0&&Q!=IE-yi)return;if(Q+yi>IE)return;let K=fr1($);if(K===void 0)return;Z[Q]=K[12],Z[Q+1]=K[13],Z[Q+2]=K[14],Z[Q+3]=K[15],$="",Q+=yi;break}if(Z[Q]=Y>>8,Z[Q+1]=Y,Q+=2,$=$.substring(G),$.length===0)break;if($[0]!==":"||$.length==1)return;if($=$.substring(1),$[0]===":"){if(X>=0)return;if(X=Q,$=$.substring(1),$.length===0)break}}if($.length!==0)return;if(Q<IE){if(X<0)return;let Y=IE-Q;for(let G=Q-1;G>=X;G--)Z[G+Y]=Z[G];for(let G=X+Y-1;G>=X;G--)Z[G]=0}else if(X>=0)return;return Z}function Vo6($){let Z=0,X=0;for(Z=0;Z<$.length&&bZ0<=$.charCodeAt(Z)&&$.charCodeAt(Z)<=_r1;Z++)if(X=X*10+($.charCodeAt(Z)-bZ0),X>=si0)return{n:si0,c:Z,ok:!1};if(Z===0)return{n:0,c:0,ok:!1};return{n:X,c:Z,ok:!0}}function ko6($){let Z=0,X=0;for(X=0;X<$.length;X++){if(bZ0<=$.charCodeAt(X)&&$.charCodeAt(X)<=_r1)Z*=16,Z+=$.charCodeAt(X)-bZ0;else if(Cr1<=$.charCodeAt(X)&&$.charCodeAt(X)<=Io6)Z*=16,Z+=$.charCodeAt(X)-Cr1+10;else if(Sr1<=$.charCodeAt(X)&&$.charCodeAt(X)<=Ro6)Z*=16,Z+=$.charCodeAt(X)-Sr1+10;else break;if(Z>=si0)return{n:0,c:X,ok:!1}}if(X===0)return{n:0,c:X,ok:!1};return{n:Z,c:X,ok:!0}}});var Gn0=_((gr1)=>{Object.defineProperty(gr1,"__esModule",{value:!0});gr1.Servers=gr1.ServerImpl=void 0;gr1.isIPV4OrHostname=yr1;gr1.hostPort=Yn0;var $n0=RE(),Zn0=bJ(),Xn0=ei0(),vo6=tB(),xo6=eY();function yr1($){if($.indexOf("[")!==-1||$.indexOf("::")!==-1)return!1;if($.indexOf(".")!==-1)return!0;if($.split(":").length<=2)return!0;return!1}function Qn0($){return!yr1($)}function fo6($){let X=$.toUpperCase().indexOf("::FFFF:");if(X!==-1&&$.indexOf(".")!==-1){let Q=$.substring(X+7);return Q=Q.replace("[",""),Q.replace("]","")}return $}function Yn0($){if($=$.trim(),$.match(/^(.*:\/\/)(.*)/m))$=$.replace(/^(.*:\/\/)(.*)/gm,"$2");if($=fo6($),Qn0($)&&$.indexOf("[")===-1)$=`[${$}]`;let Z=Qn0($)?$.match(/(]:)(\d+)/):$.match(/(:)(\d+)/),X=Z&&Z.length===3&&Z[1]&&Z[2]?parseInt(Z[2]):vo6.DEFAULT_PORT,Y=new URL(`${X===80?"https":"http"}://${$}`);Y.port=`${X}`;let G=Y.hostname;if(G.charAt(0)==="[")G=G.substring(1,G.length-1);return{listen:Y.host,hostname:G,port:X}}class nb{src;listen;hostname;port;didConnect;reconnects;lastConnect;gossiped;tlsName;resolves;constructor($,Z=!1){this.src=$,this.tlsName="";let X=Yn0($);this.listen=X.listen,this.hostname=X.hostname,this.port=X.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,Xn0.isIP)(this.hostname))return[this];else{let X=await $.fn(this.hostname);if($.debug)console.log(`resolve ${this.hostname} = ${X.join(",")}`);for(let Q of X){let Y=this.port===80?"https":"http",G=new URL(`${Y}://${Qn0(Q)?"["+Q+"]":Q}`);G.port=`${this.port}`;let J=new nb(G.host,!1);J.tlsName=this.hostname,Z.push(J)}}if($.randomize)(0,Zn0.shuffle)(Z);return this.resolves=Z,Z}}gr1.ServerImpl=nb;class yZ0{firstSelect;servers;currentServer;tlsName;randomize;constructor($={}){this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=$.randomize||!1}setServers($){if(!Array.isArray($)||$.length===0)throw xo6.InvalidArgumentError.format("servers","cannot be empty");let Z=(0,$n0.getUrlParseFn)(),X=new Map;for(let Y of this.servers)X.set(Y.listen,Y);let Q=[];for(let Y of $){Y=Z?Z(Y):Y;let{listen:G}=Yn0(Y),J=X.get(G);if(J)J.gossiped=!1,Q.push(J);else Q.push(new nb(Y))}if(this.randomize)(0,Zn0.shuffle)(Q);if(this.servers=Q,this.currentServer===void 0||!Q.includes(this.currentServer))this.currentServer=Q[0],this.firstSelect=!0}clear(){this.servers.length=0}updateTLSName(){let $=this.getCurrentServer();if(!(0,Xn0.isIP)($.hostname))this.tlsName=$.hostname,this.servers.forEach((Z)=>{if(Z.gossiped)Z.tlsName=this.tlsName})}getCurrentServer(){return this.currentServer}addServer($,Z=!1){let X=(0,$n0.getUrlParseFn)();$=X?X($):$;let Q=new nb($,Z);if((0,Xn0.isIP)(Q.hostname))Q.tlsName=this.tlsName;this.servers.push(Q)}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 yZ0.freezeAll(this.servers)}snapshotForHandler(){let $=this.currentServer;if(!$)return this.snapshot();let Z=this.servers.indexOf($);if(Z<=0)return this.snapshot();return yZ0.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 X=[],Q=[],Y=(0,$n0.getUrlParseFn)(),G=new Map;if($.connect_urls&&$.connect_urls.length>0)$.connect_urls.forEach((K)=>{K=Y?Y(K,Z):K;let W=new nb(K,!0);G.set(K,W)});let J=[];if(this.servers.forEach((K,W)=>{let H=K.listen;if(K.gossiped&&this.currentServer.listen!==H&&G.get(H)===void 0)J.push(W);G.delete(H)}),J.reverse(),J.forEach((K)=>{let W=this.servers.splice(K,1);Q=Q.concat(W[0].listen)}),G.forEach((K,W)=>{this.servers.push(K),X.push(W)}),this.randomize&&X.length>0){let K=this.currentServer,W=this.servers.filter((H)=>H!==K);(0,Zn0.shuffle)(W),this.servers=K?[K,...W]:W}return{added:X,deleted:Q}}}gr1.Servers=yZ0});var gZ0=_((lr1)=>{Object.defineProperty(lr1,"__esModule",{value:!0});lr1.QueuedIteratorImpl=void 0;var Jn0=bJ(),ur1=eY();class cr1{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,Jn0.deferred)(),this.yields=[],this.iterClosed=(0,Jn0.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(X){}}return}if(typeof $==="function")this.pendingFiltered++;this.yields.push($),this.signal.resolve()}async*iterate(){if(this.noIterator)throw new ur1.InvalidOperationError("iterator cannot be used when a callback is registered");if(this.yielding)throw new ur1.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 Q=$[Z];try{Q()}catch(Y){throw Y}if(this.err)throw this.err;continue}this.processed++,this.inflight--;let X=this.profile?Date.now():0;yield $[Z],this.time=this.profile?Date.now()-X:0}if(this.done)break;else if(this.yields.length===0)$.length=0,this.yields=$,this.signal=(0,Jn0.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}}lr1.QueuedIteratorImpl=cr1});var Kn0=_((nr1)=>{Object.defineProperty(nr1,"__esModule",{value:!0});nr1.MuxSubscription=void 0;var ho6=tB(),mr1=eY();class ir1{baseInbox;reqs;constructor(){this.reqs=new Map}size(){return this.reqs.size}init($){return this.baseInbox=`${(0,ho6.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((X)=>{X.resolver(Z,{})}),!0;if(Z.operation==="publish"){let X=this.all().find((Q)=>{return Q.requestSubject===Z.subject});if(X)return X.resolver(Z,{}),!0}return!1}dispatcher(){return($,Z)=>{let X=this.getToken(Z);if(X){let Q=this.get(X);if(Q){if($===null)$=Z?.data?.length===0&&Z.headers?.code===503?new mr1.NoRespondersError(Q.requestSubject):null;Q.resolver($,Z)}}}}close(){let $=new mr1.RequestError("connection closed");this.reqs.forEach((Z)=>{Z.resolver($,{})})}}nr1.MuxSubscription=ir1});var Wn0=_((or1)=>{Object.defineProperty(or1,"__esModule",{value:!0});or1.Heartbeat=void 0;var uo6=bJ();class tr1{ph;interval;maxOut;timer;pendings;constructor($,Z,X){this.ph=$,this.interval=Z,this.maxOut=X,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,uo6.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})}}or1.Heartbeat=tr1});var Un0=_(($a1)=>{Object.defineProperty($a1,"__esModule",{value:!0});$a1.DenoBuffer=$a1.MAX_SIZE=$a1.AssertionError=void 0;$a1.assert=sr1;$a1.concat=er1;$a1.append=lo6;$a1.readAll=do6;$a1.writeAll=mo6;var co6=sY();class Hn0 extends Error{constructor($){super($);this.name="AssertionError"}}$a1.AssertionError=Hn0;function sr1($,Z="Assertion failed."){if(!$)throw new Hn0(Z)}var ar1=32768;$a1.MAX_SIZE=4294967294;function hZ0($,Z,X=0){let Q=Z.byteLength-X;if($.byteLength>Q)$=$.subarray(0,Q);return Z.set($,X),$.byteLength}function er1($,Z){if($===void 0&&Z===void 0)return new Uint8Array(0);if($===void 0)return Z;if(Z===void 0)return $;let X=new Uint8Array($.length+Z.length);return X.set($,0),X.set(Z,$.length),X}function lo6($,Z){return er1($,Uint8Array.of(Z))}class Nn0{_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($){sr1($<=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=hZ0(this._buf.subarray(this._off),$);return this._off+=Z,Z}writeByte($){return this.write(Uint8Array.of($))}writeString($){return this.write(co6.TE.encode($))}write($){let Z=this._grow($.byteLength);return hZ0($,this._buf,Z)}_grow($){let Z=this.length;if(Z===0&&this._off!==0)this.reset();let X=this._tryGrowByReslice($);if(X>=0)return X;let Q=this.capacity;if($<=Math.floor(Q/2)-Z)hZ0(this._buf.subarray(this._off),this._buf);else if(Q+$>$a1.MAX_SIZE)throw Error("The buffer cannot be grown beyond the maximum size.");else{let Y=new Uint8Array(Math.min(2*Q+$,$a1.MAX_SIZE));hZ0(this._buf.subarray(this._off),Y),this._buf=Y}return this._off=0,this._reslice(Math.min(Z+$,$a1.MAX_SIZE)),Z}grow($){if($<0)throw Error("Buffer._grow: negative count");let Z=this._grow($);this._reslice(Z)}readFrom($){let Z=0,X=new Uint8Array(ar1);while(!0){let Q=this.capacity-this.length<ar1,Y=Q?X:new Uint8Array(this._buf.buffer,this.length),G=$.read(Y);if(G===null)return Z;if(Q)this.write(Y.subarray(0,G));else this._reslice(this.length+G);Z+=G}}}$a1.DenoBuffer=Nn0;function do6($){let Z=new Nn0;return Z.readFrom($),Z.bytes()}function mo6($,Z){let X=0;while(X<Z.length)X+=$.write(Z.subarray(X))}});var On0=_((Ga1)=>{Object.defineProperty(Ga1,"__esModule",{value:!0});Ga1.cc=Ga1.State=Ga1.Parser=Ga1.Kind=void 0;Ga1.describe=ao6;var Fn0=Un0(),Bn0=sY();Ga1.Kind={OK:0,ERR:1,MSG:2,INFO:3,PING:4,PONG:5};function ao6($){let Z,X="";switch($.kind){case Ga1.Kind.MSG:Z="MSG";break;case Ga1.Kind.OK:Z="OK";break;case Ga1.Kind.ERR:Z="ERR",X=Bn0.TD.decode($.data);break;case Ga1.Kind.PING:Z="PING";break;case Ga1.Kind.PONG:Z="PONG";break;case Ga1.Kind.INFO:Z="INFO",X=Bn0.TD.decode($.data)}return`${Z}: ${X}`}function Xa1(){let $={};return $.sid=-1,$.hdr=-1,$.size=-1,$}var Qa1=48,so6=57,pb=67108864;class Ya1{dispatcher;state;as;drop;hdr;ma;argBuf;msgBuf;constructor($){this.dispatcher=$,this.state=Ga1.State.OP_START,this.as=0,this.drop=0,this.hdr=0}parse($){let Z;for(Z=0;Z<$.length;Z++){let X=$[Z];switch(this.state){case Ga1.State.OP_START:switch(X){case Ga1.cc.M:case Ga1.cc.m:this.state=Ga1.State.OP_M,this.hdr=-1,this.ma=Xa1();break;case Ga1.cc.H:case Ga1.cc.h:this.state=Ga1.State.OP_H,this.hdr=0,this.ma=Xa1();break;case Ga1.cc.P:case Ga1.cc.p:this.state=Ga1.State.OP_P;break;case Ga1.cc.PLUS:this.state=Ga1.State.OP_PLUS;break;case Ga1.cc.MINUS:this.state=Ga1.State.OP_MINUS;break;case Ga1.cc.I:case Ga1.cc.i:this.state=Ga1.State.OP_I;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_H:switch(X){case Ga1.cc.M:case Ga1.cc.m:this.state=Ga1.State.OP_M;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_M:switch(X){case Ga1.cc.S:case Ga1.cc.s:this.state=Ga1.State.OP_MS;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_MS:switch(X){case Ga1.cc.G:case Ga1.cc.g:this.state=Ga1.State.OP_MSG;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_MSG:switch(X){case Ga1.cc.SPACE:case Ga1.cc.TAB:this.state=Ga1.State.OP_MSG_SPC;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_MSG_SPC:switch(X){case Ga1.cc.SPACE:case Ga1.cc.TAB:continue;default:this.state=Ga1.State.MSG_ARG,this.as=Z}break;case Ga1.State.MSG_ARG:switch(X){case Ga1.cc.CR:this.drop=1;break;case Ga1.cc.NL:{let Q=this.argBuf?this.argBuf.bytes():$.subarray(this.as,Z-this.drop);this.processMsgArgs(Q),this.drop=0,this.as=Z+1,this.state=Ga1.State.MSG_PAYLOAD,Z=this.as+this.ma.size-1;break}default:if(this.argBuf)this.argBuf.writeByte(X)}break;case Ga1.State.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){let Q=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Ga1.Kind.MSG,msg:this.ma,data:Q}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ga1.State.MSG_END}else{let Q=this.ma.size-this.msgBuf.length,Y=$.length-Z;if(Y<Q)Q=Y;if(Q>0)this.msgBuf.write($.subarray(Z,Z+Q)),Z=Z+Q-1;else this.msgBuf.writeByte(X)}else if(Z-this.as>=this.ma.size)this.dispatcher.push({kind:Ga1.Kind.MSG,msg:this.ma,data:$.subarray(this.as,Z)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ga1.State.MSG_END;break;case Ga1.State.MSG_END:switch(X){case Ga1.cc.NL:this.drop=0,this.as=Z+1,this.state=Ga1.State.OP_START;break;default:continue}break;case Ga1.State.OP_PLUS:switch(X){case Ga1.cc.O:case Ga1.cc.o:this.state=Ga1.State.OP_PLUS_O;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_PLUS_O:switch(X){case Ga1.cc.K:case Ga1.cc.k:this.state=Ga1.State.OP_PLUS_OK;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_PLUS_OK:switch(X){case Ga1.cc.NL:this.dispatcher.push({kind:Ga1.Kind.OK}),this.drop=0,this.state=Ga1.State.OP_START;break}break;case Ga1.State.OP_MINUS:switch(X){case Ga1.cc.E:case Ga1.cc.e:this.state=Ga1.State.OP_MINUS_E;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_MINUS_E:switch(X){case Ga1.cc.R:case Ga1.cc.r:this.state=Ga1.State.OP_MINUS_ER;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_MINUS_ER:switch(X){case Ga1.cc.R:case Ga1.cc.r:this.state=Ga1.State.OP_MINUS_ERR;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_MINUS_ERR:switch(X){case Ga1.cc.SPACE:case Ga1.cc.TAB:this.state=Ga1.State.OP_MINUS_ERR_SPC;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_MINUS_ERR_SPC:switch(X){case Ga1.cc.SPACE:case Ga1.cc.TAB:continue;default:this.state=Ga1.State.MINUS_ERR_ARG,this.as=Z}break;case Ga1.State.MINUS_ERR_ARG:switch(X){case Ga1.cc.CR:this.drop=1;break;case Ga1.cc.NL:{let Q;if(this.argBuf)Q=this.argBuf.bytes(),this.argBuf=void 0;else Q=$.subarray(this.as,Z-this.drop);this.dispatcher.push({kind:Ga1.Kind.ERR,data:Q}),this.drop=0,this.as=Z+1,this.state=Ga1.State.OP_START;break}default:if(this.argBuf)this.argBuf.write(Uint8Array.of(X))}break;case Ga1.State.OP_P:switch(X){case Ga1.cc.I:case Ga1.cc.i:this.state=Ga1.State.OP_PI;break;case Ga1.cc.O:case Ga1.cc.o:this.state=Ga1.State.OP_PO;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_PO:switch(X){case Ga1.cc.N:case Ga1.cc.n:this.state=Ga1.State.OP_PON;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_PON:switch(X){case Ga1.cc.G:case Ga1.cc.g:this.state=Ga1.State.OP_PONG;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_PONG:switch(X){case Ga1.cc.NL:this.dispatcher.push({kind:Ga1.Kind.PONG}),this.drop=0,this.state=Ga1.State.OP_START;break}break;case Ga1.State.OP_PI:switch(X){case Ga1.cc.N:case Ga1.cc.n:this.state=Ga1.State.OP_PIN;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_PIN:switch(X){case Ga1.cc.G:case Ga1.cc.g:this.state=Ga1.State.OP_PING;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_PING:switch(X){case Ga1.cc.NL:this.dispatcher.push({kind:Ga1.Kind.PING}),this.drop=0,this.state=Ga1.State.OP_START;break}break;case Ga1.State.OP_I:switch(X){case Ga1.cc.N:case Ga1.cc.n:this.state=Ga1.State.OP_IN;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_IN:switch(X){case Ga1.cc.F:case Ga1.cc.f:this.state=Ga1.State.OP_INF;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_INF:switch(X){case Ga1.cc.O:case Ga1.cc.o:this.state=Ga1.State.OP_INFO;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_INFO:switch(X){case Ga1.cc.SPACE:case Ga1.cc.TAB:this.state=Ga1.State.OP_INFO_SPC;break;default:throw this.fail($.subarray(Z))}break;case Ga1.State.OP_INFO_SPC:switch(X){case Ga1.cc.SPACE:case Ga1.cc.TAB:continue;default:this.state=Ga1.State.INFO_ARG,this.as=Z}break;case Ga1.State.INFO_ARG:switch(X){case Ga1.cc.CR:this.drop=1;break;case Ga1.cc.NL:{let Q;if(this.argBuf)Q=this.argBuf.bytes(),this.argBuf=void 0;else Q=$.subarray(this.as,Z-this.drop);this.dispatcher.push({kind:Ga1.Kind.INFO,data:Q}),this.drop=0,this.as=Z+1,this.state=Ga1.State.OP_START;break}default:if(this.argBuf)this.argBuf.writeByte(X)}break;default:throw this.fail($.subarray(Z))}}if((this.state===Ga1.State.MSG_ARG||this.state===Ga1.State.MINUS_ERR_ARG||this.state===Ga1.State.INFO_ARG)&&!this.argBuf)this.argBuf=new Fn0.DenoBuffer($.subarray(this.as,Z-this.drop));if(this.state===Ga1.State.MSG_PAYLOAD&&!this.msgBuf){if(!this.argBuf)this.cloneMsgArg();this.msgBuf=new Fn0.DenoBuffer($.subarray(this.as))}}cloneMsgArg(){let $=this.ma.subject.length,Z=this.ma.reply?this.ma.reply.length:0,X=new Uint8Array($+Z);if(X.set(this.ma.subject),this.ma.reply)X.set(this.ma.reply,$);if(this.argBuf=new Fn0.DenoBuffer(X),this.ma.subject=X.subarray(0,$),this.ma.reply)this.ma.reply=X.subarray($)}processMsgArgs($){if(this.hdr>=0)return this.processHeaderMsgArgs($);let Z=[],X=-1;for(let Q=0;Q<$.length;Q++)switch($[Q]){case Ga1.cc.SPACE:case Ga1.cc.TAB:case Ga1.cc.CR:case Ga1.cc.NL:if(X>=0)Z.push($.subarray(X,Q)),X=-1;break;default:if(X<0)X=Q}if(X>=0)Z.push($.subarray(X));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],pb);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],pb);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}: ${Bn0.TD.decode($)}`)}processHeaderMsgArgs($){let Z=[],X=-1;for(let Q=0;Q<$.length;Q++)switch($[Q]){case Ga1.cc.SPACE:case Ga1.cc.TAB:case Ga1.cc.CR:case Ga1.cc.NL:if(X>=0)Z.push($.subarray(X,Q)),X=-1;break;default:if(X<0)X=Q}if(X>=0)Z.push($.subarray(X));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],pb),this.ma.size=this.protoParseInt(Z[3],pb);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],pb),this.ma.size=this.protoParseInt(Z[4],pb);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 X=0;for(let Q=0;Q<$.length;Q++){if($[Q]<Qa1||$[Q]>so6)return-1;X=X*10+($[Q]-Qa1)}return Z!==void 0&&X>Z?-1:X}}Ga1.Parser=Ya1;Ga1.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};Ga1.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 lZ0=_((Ka1)=>{Object.defineProperty(Ka1,"__esModule",{value:!0});Ka1.MsgHdrsImpl=void 0;Ka1.canonicalMIMEHeaderKey=Ln0;Ka1.headers=Zr6;var Ja1=sY(),yJ=tB(),cZ0=eY();function Ln0($){let N=!0,U=Array($.length);for(let F=0;F<$.length;F++){let B=$.charCodeAt(F);if(B===58||B<33||B>126)throw cZ0.InvalidArgumentError.format("header",`'${$[F]}' is not a valid character in a header name`);if(N&&97<=B&&B<=122)B-=32;else if(!N&&65<=B&&B<=90)B+=32;U[F]=B,N=B==45}return String.fromCharCode(...U)}function Zr6($=0,Z=""){if($===0&&Z!=="")throw cZ0.InvalidArgumentError.format("code","is required");else if($>0&&Z==="")throw cZ0.InvalidArgumentError.format("description","is required");return new tb($,Z)}var wn0="NATS/1.0";class tb{_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,X]of this.headers){let Q=$.values(Z);if(X.length!==Q.length)return!1;let Y=[...X].sort(),G=[...Q].sort();for(let J=0;J<Y.length;J++)if(Y[J]!==G[J])return!1}return!0}return!1}static decode($){let Z=new tb,Q=Ja1.TD.decode($).split(`\r
1376
1376
  `),Y=Q[0];if(Y!==wn0){let G=Y.replace(wn0,"").trim();if(G.length>0){if(Z._code=parseInt(G,10),isNaN(Z._code))Z._code=0;let J=Z._code.toString();G=G.replace(J,""),Z._description=G.trim()}}if(Q.length>=1)Q.slice(1).map((G)=>{if(G){let J=G.indexOf(":");if(J>-1){let K=G.slice(0,J),W=G.slice(J+1).trim();Z.append(K,W)}}});return Z}toString(){if(this.headers.size===0&&this._code===0)return"";let $=wn0;if(this._code>0&&this._description!=="")$+=` ${this._code} ${this._description}`;for(let[Z,X]of this.headers)for(let Q=0;Q<X.length;Q++)$=`${$}\r
1377
1377
  ${Z}: ${X[Q]}`;return`${$}\r
@@ -2862,7 +2862,7 @@ ${$.description}
2862
2862
  `):Z?.pr?[`This task already has an open pull request #${Z.pr.number} (${Z.pr.url}), and you are already on its branch.`,"Continue that work: commit and push to update the SAME pull request \u2014 do NOT open a new one or start a new branch. If you find it already does everything the task asks, say so and stop rather than changing it.",""].join(`
2863
2863
  `):"","How to work:","- First decide whether this task requires changing code in a repository. Some tasks (research, answering a question, planning) don't. If it doesn't, just do the work directly \u2014 don't load a repo or open a PR.",Z?.pr?"- If it DOES need code changes: use the `load_repo` tool to load the relevant repository, make the change, then commit and push to the pull request named above.":"- If it DOES need code changes: use the `load_repo` tool to load the relevant repository, then make the change, commit on a new branch, push, and open a pull request. Only then does a PR apply.","- Prefer the GitHub tool to open the PR. If it errors or targets the wrong repo, fall back to `git push` + the GitHub REST API (the auth token is embedded in the `origin` URL).","- If a dev server is running it hot-reloads your changes \u2014 don't restart it, hunt for its port, or run a full typecheck/build just to verify a small edit.","- Change only what the task needs. Don't trace the definition of a pre-existing symbol that's incidental to your change \u2014 note it in one line and move on. Prefer one or two broad searches over many narrow retries.","- Only if you hit a genuine blocker a human must clear (see above) may you call `user_ask` \u2014 otherwise keep going and finish the task.","",`(task id: ${$.id})`].join(`
2864
2864
  `)}async function Yr4($,Z,X){let Y=(await $.storage.taskBoard.listPrs(Z.id,Z.organizationId).catch(()=>[])).find((G)=>G.number===X);if(!Y)return null;return tv8($,Z.organizationId,Y).catch(()=>null)}async function Gr4($,Z){let X=await $.storage.taskBoard.listActivity(Z.id,Z.organizationId).catch(()=>[]);return $B8(X)}function Jr4($){return $!=="closed"}async function Kr4($,Z){let X=await $.storage.taskBoard.listPrs(Z.id,Z.organizationId).catch(()=>[]);for(let Q of X){let{state:Y}=await vu(Z.organizationId,Q);if(Jr4(Y))return{number:Q.number,url:Q.url}}return}async function NF($,Z,X){let Q=await YB8($,Z,X?.userInitiated?Rh():void 0),Y="decopilot";try{let G=o0().taskBoardRerunReusesPrBranch,J=X?.pr??(G?await Kr4($,Z):void 0),K=G&&J?await Yr4($,Z,J.number):null,W=!X?.feedback&&!X?.resolveConflict,H=J&&W?await Gr4($,Z):null,N=J&&J!==X?.pr||H?{...X,...J?{pr:J}:{},...H?{feedback:H}:{}}:X,U=await oA0($,Z.organizationId);if(U){Y="claude-code";let F="repo"in U?U.repo:null;await Va($,Z,{title:`Super Agent: ${Z.title}`,...X?.runClass?{runClass:X.runClass}:{},...K?{pinnedRef:K}:{},prompt:kv8(Z,F,{...N,..."choices"in U?{repoChoices:U.choices}:{}}),temperature:0.5,harnessId:"claude-code",...F?{repo:F}:{}})}else await Va($,Z,{title:`Super Agent: ${Z.title}`,...X?.runClass?{runClass:X.runClass}:{},prompt:Qr4(Z,N),temperature:0.5,...K?{pinnedRef:K}:{}})}catch(G){throw await GB8($.storage.organizationBilling,Z.organizationId,Z.id,Q),G}await $.storage.taskBoard.supersedeFailedThreads(Z.id,Z.organizationId).catch((G)=>console.error("[task-board] superseding failed threads failed",G)),UG({event:"task_run_enqueued",organizationId:Z.organizationId,properties:{task_id:Z.id,reports_task:JY(Z),claim:Q,harness:Y,...X?.runClass?{run_class:X.runClass}:{}}})}var JF=w(()=>{g9();DK();g9();h4();C8();J71();yH();Sa();K71()});import{z as UF}from"zod";var R71;var ov8=w(()=>{n0();CK();L51();JF();AY();R9();R71=m({name:"TASK_BOARD_ITEM_CREATE",description:"Create a new task board item for the organization.",annotations:{title:"Create Task Board Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},inputSchema:UF.object({title:UF.string().min(1),description:UF.string().nullable().optional(),status:SK.optional(),priority:o_.optional(),assigneeId:UF.string().nullable().optional(),repo:UF.string().nullable().optional(),dueDate:UF.string().datetime().nullable().optional(),tagIds:UF.array(UF.string()).optional()}),outputSchema:UF.object({item:Wu}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=Z.organization?.id;if(!X)throw Error("Organization ID required (no active organization in context)");if($.assigneeId)await FP0(Z,X,$.assigneeId);let Q=$.assigneeId===G4;if($.tagIds?.length){let G=await Z.storage.tags.listOrgTags(X),J=new Set(G.map((K)=>K.id));for(let K of $.tagIds)if(!J.has(K))throw Error(`Tag not found: ${K}`)}let Y=await Z.storage.taskBoard.create({organizationId:X,title:$.title,description:$.description??null,status:Q?"todo":$.status,priority:$.priority,assigneeId:$.assigneeId??null,assignedBy:$.assigneeId?D1(Z):null,repo:$.repo??null,dueDate:$.dueDate??null,by:D1(Z)});if($.tagIds?.length)await Z.storage.taskBoard.setItemTags(Y.id,$.tagIds,D1(Z)),Y=await Z.storage.taskBoard.getById(Y.id,X);return await w5(Z,{taskBoardItemId:Y.id,action:"created",actorId:D1(Z)}),C6(X,Y),await NL(Z,Y),{item:Y}}})});function Wr4($){if($.status==="completed")return"advance";if($.status==="failed"&&$.messageStorageVersion===2&&Q_8($))return"nudge";return"none"}function Hr4($){return["This task is still In Progress on the board and your last run ended without finishing it.","","Look at what you already did (`git log`, `git status`, and the messages above), then either:","- finish the remaining work (and open the PR, if it needed code changes),","- or, if it's actually done, say so in one line \u2014 the board moves the card for you,",$==="decopilot"?"- or, if you're blocked on something only a human knows, call the `user_ask` tool.":"- or, if you're blocked on something only a human knows, say what you need and stop.","","Don't start over and don't redo work you already committed or pushed. You are on the same branch as before \u2014 push to it and update your existing pull request rather than opening a second one."].join(`
2865
- `)}async function Nr4($,Z,X){let Q=Z.organizationId,Y=await RX($,"smart"),G=X.virtual_mcp_id??eE(Q),J={id:`stall-nudge-${Z.id}-${X.id}`,role:"user",parts:[{type:"text",text:Hr4(X.harness_id)}]};await new kX({storage:$.storage.threads.messageParts(),orgId:Q,threadId:X.id,runId:X.id}).emitRequestMessage(J),await KF({threadId:X.id,source:"background-tool",request:{messages:[J],models:{credentialId:Y.credentialId,thinking:{id:Y.modelId,title:Y.modelMeta.title}},agent:{id:G},temperature:0.5,toolApprovalLevel:"auto",mode:"default",organizationId:Q,userId:Z.assignedBy??Z.createdBy,harnessId:X.harness_id==="claude-code"?"claude-code":"decopilot",sandboxProviderKind:"agent-sandbox",...X.branch?{branch:X.branch}:{},taskId:X.id,runMetadata:BP0(Z)}},{workflowID:`stall-nudge:${Z.id}:${X.id}`})}async function Ur4($,Z){let X=await $.storage.threads.get(Z);if(!X)return{action:"none",thread:null};return{action:Wr4({status:X.status,messageStorageVersion:X.message_storage_version,harnessId:X.harness_id,sandboxProviderKind:X.sandbox_provider_kind}),thread:X}}function Fr4($,Z=Date.now()){if($.status!=="in_progress")return!1;if($.run_started_at)return!1;return Oa($,Z)}async function Br4($,Z){let X=[];for(let Q of Z.threads){if(Q.status!=="in_progress")continue;let Y=await $.storage.threads.get(Q.threadId);if(!Y||!Fr4(Y))continue;if(await $.storage.threads.markRunFailed(Q.threadId,I71,"abandoned"))X.push(Q.threadId),console.warn(`[task-board] failed never-started thread ${Q.threadId} on ${Z.id}`)}return X}async function rv8($,Z){let X=$.organization?.id;if(!X)return;for(let Q of Z){if(Q.status==="in_progress")try{if((await Br4($,Q)).length>0)continue}catch(J){console.error(`[task-board] reaping threads for ${Q.id} failed`,J)}let Y=Q.repo!=null&&(await $.storage.taskBoard.listPrs(Q.id,X)).length>0;if(!r91(Q,Y))continue;let G=Q.threads.find((J)=>J.hasMessages);if(!G)continue;try{let{action:J,thread:K}=await Ur4($,G.threadId);if(J==="none"||!K)continue;if(J==="advance")await Tu($.storage.taskBoard,G.threadId,X,$.storage.organizationBilling);else await Nr4($,Q,K)}catch(J){console.error(`[task-board] stall recovery failed for ${Q.id}`,J)}}}var I71="Run never started \u2014 no pod picked it up before the idle window elapsed";var q71=w(()=>{pr();UL();$L();WF();vH();A6();R9()});import{z as xa}from"zod";var M71;var av8=w(()=>{n0();ZY();CK();q71();M71=m({name:"TASK_BOARD_ITEM_LIST",description:"List all task board items for the organization, plus the `owner/name` repos this organization has imported (the valid values for a task's `repo` field).",annotations:{title:"List Task Board Items",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:xa.object({}),outputSchema:xa.object({items:xa.array(Wu),repos:xa.array(xa.string())}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=Z.organization?.id;if(!X)throw Error("Organization ID required (no active organization in context)");let Q=await Z.storage.taskBoard.list(X),{items:Y}=await Z.storage.connections.list(X,{slug:"mcp-github"}),G=JF8(Y);return rv8(Z,Q),{items:Q,repos:G}}})});import{z as p3}from"zod";function wr4($,Z){let X=[];for(let{field:G,action:J}of Or4){if(Z[G]===$[G])continue;X.push({action:J,data:{from:$[G],to:Z[G]}})}if(Z.description!==$.description)X.push({action:"description_changed"});let Q=new Set($.tags.map((G)=>G.id));if(Z.tags.length!==$.tags.length||Z.tags.some((G)=>!Q.has(G.id)))X.push({action:"tags_changed",data:{from:$.tags,to:Z.tags}});return X}function Lr4($,Z){if($!==G4)return!1;if(!Z)return!1;return Z.assigneeId!==G4?!0:Z.status==="todo"}function Dr4($,Z,X){return X&&$==="done"&&Z==="in_review"}var Or4,V71;var sv8=w(()=>{n0();CK();L51();JF();AY();Ku();R9();DK();Or4=[{field:"status",action:"status_changed"},{field:"assigneeId",action:"assignee_changed"},{field:"priority",action:"priority_changed"},{field:"dueDate",action:"due_date_changed"},{field:"title",action:"title_changed"}];V71=m({name:"TASK_BOARD_ITEM_UPDATE",description:"Update a task board item's fields (title, description, status, priority, assignee), and/or link a chat thread to it.",annotations:{title:"Update Task Board Item",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:p3.object({id:p3.string(),title:p3.string().min(1).optional(),description:p3.string().nullable().optional(),status:SK.optional(),priority:o_.optional(),assigneeId:p3.string().nullable().optional(),repo:p3.string().nullable().optional(),dueDate:p3.string().datetime().nullable().optional(),sortOrder:p3.number().optional(),tagIds:p3.array(p3.string()).optional(),linkThreadId:p3.string().optional()}),outputSchema:p3.object({item:Wu}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=Z.organization?.id;if(!X)throw Error("Organization ID required (no active organization in context)");if($.assigneeId)await FP0(Z,X,$.assigneeId);if($.linkThreadId){if(!await Z.storage.taskBoard.getById($.id,X))throw Error(`Task board item not found: ${$.id}`);if(!await Z.storage.threads.get($.linkThreadId))throw Error(`Thread not found: ${$.linkThreadId}`);await Z.storage.taskBoard.linkThread($.id,$.linkThreadId,X)}let Q=$.title!==void 0||$.description!==void 0||$.status!==void 0||$.priority!==void 0||$.assigneeId!==void 0||$.repo!==void 0||$.dueDate!==void 0||$.sortOrder!==void 0||$.tagIds!==void 0,Y=Q?await Z.storage.taskBoard.getById($.id,X):null;if(Q&&!Y)throw Error(`Task board item not found: ${$.id}`);let G=t_.getStore()!==void 0;if(Dr4($.status,Y?.status,G))throw Error("This task is In Review \u2014 a run can't move it to Done. Leave it in "+"in_review for the reviewer; only a person, or TASK_BOARD_REVIEW_DECISION on a reviewer's own run, completes a task under review.");let J=$.assigneeId!==void 0&&$.assigneeId!==(Y?.assigneeId??null),K=Lr4($.assigneeId,Y);if(Y&&JY(Y)){if($.title!==void 0||$.description!==void 0||$.priority!==void 0)throw Error("This task was generated from your report and can't be edited \u2014 create your own task instead.");if(K)await y30(Z,Y,Rh())}if($.tagIds!==void 0){let H=await Z.storage.tags.listOrgTags(X),N=new Set(H.map((U)=>U.id));for(let U of $.tagIds)if(!N.has(U))throw Error(`Tag not found: ${U}`);await Z.storage.taskBoard.setItemTags($.id,$.tagIds,D1(Z))}let W;if(Q)W=await Z.storage.taskBoard.update($.id,X,{title:$.title,description:$.description,status:K?"todo":$.status,priority:$.priority,assigneeId:$.assigneeId,assignedBy:J?$.assigneeId?D1(Z):null:void 0,repo:$.repo,dueDate:$.dueDate,sortOrder:$.sortOrder},D1(Z));else{let H=await Z.storage.taskBoard.getById($.id,X);if(!H)throw Error(`Task board item not found: ${$.id}`);W=H}if(Y){let H=D1(Z),N=wr4(Y,W);if(N.length>0)await JC8(Z,N.map((U)=>({taskBoardItemId:W.id,actorId:H,...U})))}if(Q||$.linkThreadId)C6(X,W);if(K)await NL(Z,W,{userInitiated:!0});return{item:W}}})});import{z as YT0}from"zod";var k71;var ev8=w(()=>{n0();R9();k71=m({name:"TASK_BOARD_ITEM_DELETE",description:"Delete a task board item. A reports-pushed task also dismisses its finding, so the next diagnostic import won't re-create the card.",annotations:{title:"Delete Task Board Item",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:YT0.object({id:YT0.string()}),outputSchema:YT0.object({success:YT0.boolean()}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=Z.organization?.id;if(!X)throw Error("Organization ID required (no active organization in context)");if(!await Z.storage.taskBoard.delete($.id,X,D1(Z)??"system"))throw Error(`Task board item not found: ${$.id}`);return LC8(X,$.id),{success:!0}}})});import{z as Av}from"zod";var S71;var $x8=w(()=>{n0();a91();R9();Ku();S71=m({name:"TASK_BOARD_ITEM_PR_LINK",description:"Link the pull request you just opened to this run's task board item. Call this right after `gh pr create` succeeds, with the PR URL it printed. Reviewers (QA, code review) are dispatched from the linked PR, so a task whose PR is not linked never gets reviewed.",annotations:{title:"Link Pull Request to Task",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:Av.object({url:Av.string().describe("The pull request URL, e.g. https://github.com/owner/repo/pull/123")}),outputSchema:Av.object({url:Av.string(),prNumber:Av.number(),taskBoardItemIds:Av.array(Av.string())}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=X0(Z).id,{threadId:Q}=UP0(),Y=HA0($.url);if(!Y)throw Error(`Not a GitHub pull request URL: ${$.url} (expected https://github.com/<owner>/<repo>/pull/<number>)`);let G=await EA0(Z,X,Q);for(let J of G)await Z.storage.taskBoard.linkPr({taskBoardItemId:J,organizationId:X,url:Y.url,prNumber:Y.number,repoOwner:Y.owner,repoName:Y.repo}),await Z.storage.taskBoard.clearSweepBudget(J,X);return{url:Y.url,prNumber:Y.number,taskBoardItemIds:G}}})});function Xx8($){Zx8=$}function GT0($){Zx8?.broadcast($)}var Zx8=null;import{DBOS as JT0}from"@dbos-inc/dbos-sdk";function Er4($,Z){let X=`thread-run:${Z}:`;if(!$.workflowID.startsWith(X))return null;let Q=$.input?.[0],Y=Q?.request;return{workflowId:$.workflowID,messageId:Y?.messageId??$.workflowID.slice(X.length),status:$.status==="PENDING"?"running":"queued",enqueuedAt:$.createdAt,...Q?.source!==void 0?{source:Q.source}:{}}}async function C71($){return(await JT0.listWorkflows({workflow_id_prefix:`thread-run:${$}:`,status:["PENDING","ENQUEUED"],loadInput:!0,loadOutput:!1})).map((X)=>Er4(X,$)).filter((X)=>X!==null).sort((X,Q)=>X.enqueuedAt-Q.enqueuedAt)}async function Qx8($,Z){if(!Z.startsWith(`thread-run:${$}:`))return!1;return await JT0.cancelWorkflows([Z]),!0}async function fu($){let Z=await JT0.listWorkflows({workflow_id_prefix:`thread-run:${$}:`,status:["PENDING"],loadInput:!1,loadOutput:!1});if(Z.length===0)return;await JT0.cancelWorkflows(Z.map((X)=>X.workflowID))}var KT0=()=>{};function Pr4($){return/\b405\b/.test($)&&/not allowed on this repository/i.test($)}function Tr4($,Z={}){if($==="failing")return!0;if($==="pending")return!Z.allowPendingChecks;return!1}async function Rr4($,Z,X,Q,Y){if(Ar4.has(Q))return;let J=(await $.storage.taskBoard.listActivity(X,Z).catch(()=>[])).at(-1);if(J?.action==="merge_failed"&&J.data?.reason===Q)return;await w5($,{taskBoardItemId:X,action:"merge_failed",actorId:null,data:{reason:Q,...Y?{detail:Y}:{}}})}function Ir4($){if(!$?.isError)return{kind:"merged"};let Z=JSON.stringify($?.content)??"";if(Pr4(Z))return{kind:"method_not_allowed",detail:Z};if(ZT0(Z))return{kind:"rate_limited",detail:Z};return{kind:"refused",detail:Z}}async function qr4($,Z,X){let Q=await $.callTool({name:"merge_pull_request",arguments:{owner:Z.repoOwner,repo:Z.repoName,pullNumber:Z.number,merge_method:X}},void 0,{timeout:jr4});return Ir4(Q)}async function fa($,Z,X,Q={}){let Y=async(U,F)=>{return await Rr4($,Z,X,U,F),{merged:!1,reason:U,...F?{detail:F}:{}}},G=await $.storage.taskBoard.listPrs(X,Z),J=await wL($,Z,G);if(!J)return console.warn(`[task-board] merge skipped \u2014 no linked PR on ${X}`),Y("no_pr");let K=await iv8($,Z,J);if(Tr4(K,Q))return console.warn(`[task-board] merge blocked \u2014 checks ${K} on PR #${J.number}`),Y(K==="failing"?"checks_failing":"checks_pending");let W=`${J.repoOwner}/${J.repoName}`,H=await Pv($,Z,J.connectionId,{owner:J.repoOwner,name:J.repoName});if(!H)return console.warn("[task-board] merge blocked \u2014 no active GitHub connection for "+`${W} (PR #${J.number})`),Y("no_connection",W);let N=await I5(H,$,!0);try{let U=null;for(let F of zr4){let B=await qr4(N,J,F);if(B.kind==="merged")return hv8(H.id),{merged:!0};if(B.kind==="rate_limited")return console.warn(`[task-board] merge rate-limited on PR #${J.number} \u2014 sweep retries`),Y("rate_limited",B.detail.slice(0,500));if(B.kind==="method_not_allowed"){console.warn(`[task-board] merge method '${F}' not allowed on ${W} \u2014 trying next`),U=B.detail;continue}return console.error(`[task-board] merge refused by GitHub on PR #${J.number}:`,B.detail),Y("refused",B.detail.slice(0,500))}return console.error(`[task-board] no merge method allowed on ${W} (PR #${J.number})`,U),Y("refused",U?.slice(0,500))}catch(U){let F=U instanceof Error?U.message:String(U);if(ZT0(U))return Y("rate_limited",F);return console.error("[task-board] merge PR failed",U),Y("error",F)}finally{await N.close().catch(()=>{})}}async function ba($,Z,X){let Q=await $.storage.organizationSettings.get(Z),Y=fU(Q?.flags),G=await $.storage.taskBoard.listActivity(X,Z);return Pw(G,Y,{verifiedOnly:!0})}async function Mr4($,Z){let X=await $.storage.organizationSettings.get(Z.organizationId),Q=fU(X?.flags),Y=await $.storage.taskBoard.listActivity(Z.id,Z.organizationId);if(!eF8(Y,Q))return;await fH($,Z,"every reviewer approved, but an approval could not be verified \u2014 "+"auto-merge is blocked and no reviewer can be re-dispatched this cycle")}function Yx8($){return!$.merged&&$.reason==="refused"}function _71($,Z){if($!==null)return $;if(Z===null||!Yx8(Z))return null;return(Z.detail??"").toLowerCase().includes("merge conflict")?!0:null}async function Vr4($,Z,X){if(!Yx8(X))return;let Q=Z.organizationId,Y=await $.storage.taskBoard.listPrs(Z.id,Q),G=await wL($,Q,Y);if(!G)return;await _u($,Q,Z,{pr:{number:G.number,url:G.url},conflict:_71(await xu($,Q,G),X)}).catch((J)=>{console.error("[task-board] sweep conflict auto-resolve failed",J)})}async function Gx8($,Z){let X=Z.organizationId;if(Z.status!=="in_review")return!1;if((await $.storage.organizationSettings.get(X))?.flags?.auto_merge!==!0)return!1;if(!await ba($,X,Z.id))return await Mr4($,Z),!1;let Y=await fa($,X,Z.id);if(!Y.merged)return await Vr4($,Z,Y),!1;let G=await $.storage.taskBoard.update(Z.id,X,{status:"done"},Z.updatedBy);return await w5($,{taskBoardItemId:Z.id,action:"status_changed",actorId:null,data:{from:Z.status,to:"done"}}),C6(X,G),!0}var jr4=15000,zr4,Ar4;var ya=w(()=>{VU();g9();AY();ka();yH();R9();zr4=["merge","squash","rebase"];Ar4=new Set(["checks_pending"])});import{z as bu}from"zod";function Sr4($){return $.threads.filter((Z)=>Z.status!==null&&!Ea.has(Z.status)).map((Z)=>Z.threadId)}async function Cr4($,Z,X){let Q=(G)=>(J)=>console.error("[task-board] rerun takeover step failed",{threadId:Z,step:G,err:J});await $.storage.threads.setCancelRequested(Z,X).catch(Q("cancel-flag")),await qu(Z).catch(Q("background-jobs")),await fu(Z).catch(Q("gate-head"));let Y=await $.storage.threads.getRunFence(Z).catch(()=>null);if(Y)await zv(Z,Y).catch(Q("hosted-harness"));GT0(Z)}function _r4($,Z){return $===!0&&O71(Z)}async function vr4($,Z,X){let Q=Z.organizationId,Y=await $.storage.taskBoard.listPrs(Z.id,Q).catch(()=>[]),G=await wL($,Q,Y).catch(()=>{return});if(!G)return!1;let J=await xu($,Q,G).catch(()=>null);return _r4(J,X)}function fr4($,Z){let X=bU($),Q=0;for(let Y of $){if(Y.action!=="review_approved")continue;let G=new Date(Y.occurredAt).getTime();if(G>=X)Q=Math.max(Q,G)}return Z-Q>=xr4}async function br4($,Z){if(Z.status!=="in_review")return;if((await $.storage.organizationSettings.get(Z.organizationId))?.flags?.auto_merge!==!0)return;if(!await ba($,Z.organizationId,Z.id))return;let Y=await $.storage.taskBoard.listActivity(Z.id,Z.organizationId).catch(()=>[]);if(fr4(Y,Date.now()))return;if(await vr4($,Z,Y))return;throw Error("Every reviewer approved this task and its merge is retrying \u2014 re-running "+"would throw that away and start a new review cycle. Wait for the merge, or use the ship button if the PR needs a nudge.")}var kr4="Superseded by a manual re-run of this task",xr4=900000,v71;var Jx8=w(()=>{n0();g9();vH();WF();KT0();Mu();AY();R9();JF();ya();yH();ka();DK();v71=m({name:"TASK_BOARD_ITEM_RERUN",description:"Re-run a task board item with the Super Agent, whatever lane it is in. Use this to retry a task that stalled, finished without doing the job, or is already assigned to the Super Agent (in which case re-assigning it does nothing). Fails any run still holding the task open, moves it to In Progress, and queues a fresh run.",annotations:{title:"Re-run Task",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0},inputSchema:bu.object({id:bu.string().describe("The task board item to re-run.")}),outputSchema:bu.object({status:bu.string().describe("The task's lane after the re-run was queued."),supersededThreadIds:bu.array(bu.string()).describe("Runs that were failed to make room for this one.")}),handler:async({id:$},Z)=>{G0(Z),await Z.access.check();let X=Z.organization?.id;if(!X)throw Error("Organization ID required (no active organization in context)");let Q=await Z.storage.taskBoard.getById($,X);if(!Q)throw Error(`Task board item not found: ${$}`);if(Q.assigneeId!==G4)throw Error("Only a task assigned to the Super Agent can be re-run. Assign it to "+"the Super Agent instead \u2014 that queues a run by itself.");await br4(Z,Q),await y30(Z,Q,Rh());let Y=[];for(let J of Sr4(Q)){if(!await Z.storage.threads.failIfNotTerminal(J,kr4,"superseded"))continue;Y.push(J),await Cr4(Z,J,X)}let G=await Z.storage.taskBoard.update($,X,{status:"in_progress"},D1(Z));return await w5(Z,{taskBoardItemId:$,action:"status_changed",actorId:D1(Z),data:{from:Q.status,to:"in_progress",reason:"rerun"}}),C6(X,G),await NF(Z,G,{userInitiated:!0}),{status:G.status,supersededThreadIds:Y}}})});import{z as LL}from"zod";function yr4($,Z,X){return $!==null&&$.reviewer===Z&&$.cycleAt.getTime()===X}function gr4($,Z){return z81($).get(Z)==="changes_requested"}var x71;var Kx8=w(()=>{n0();g9();CK();AY();R9();JF();ya();yH();H71();ka();DK();x71=m({name:"TASK_BOARD_REVIEW_DECISION",description:"Record a reviewer's decision for a task under review. `approve` marks the pull request approved by that reviewer (and, once EVERY enabled reviewer has approved, merges it when the org enabled auto-merge, advancing the task to Done); `request_changes` hands the task back to the Super Agent with your notes so it can fix the PR.",annotations:{title:"Review Decision",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0},inputSchema:LL.object({taskBoardItemId:LL.string(),reviewer:LL.enum(["qa","code_review"]).describe("Which reviewer you are: `qa` (QA Agent) or `code_review` (Code Reviewer)."),reviewToken:LL.string().optional().describe("The reviewToken from your prompt \u2014 proves you are this reviewer. "+"Pass it through exactly; an approval without a valid token is recorded but does NOT count toward an automatic merge."),decision:LL.enum(["approve","request_changes"]),notes:LL.string().min(1).describe("For approve: a short summary of what you verified. For request_changes: specific, actionable feedback the Super Agent must address.")}),outputSchema:LL.object({status:SK,merged:LL.boolean().describe("True when this approval completed the review and merged the PR.")}),handler:async({taskBoardItemId:$,reviewer:Z,reviewToken:X,decision:Q,notes:Y},G)=>{G0(G),await G.access.check();let J=G.organization?.id;if(!J)throw Error("Organization ID required (no active organization in context)");let K=await G.storage.taskBoard.getById($,J);if(!K)throw Error(`Task board item not found: ${$}`);let W=X?bU(await G.storage.taskBoard.listActivity($,J)):0,H=!!X&&(Sv8(X,$,Z,new Date(W))||yr4(await G.storage.taskBoard.resolveReviewClaimByToken($,X),Z,W));if(Q==="request_changes"){let j=await G.storage.taskBoard.listActivity($,J);if(gr4(j,Z))return{status:K.status,merged:!1};if(ZB8(j))return await w5(G,{taskBoardItemId:$,action:"review_changes_requested",actorId:null,data:{reviewer:Z,notes:Y,verified:H,bounceLimitReached:!0}}),await fH(G,K,`${P81} review bounces reached \u2014 the reviewer and the `+"Super Agent are not converging"),{status:(await G.storage.taskBoard.getById($,J)??K).status,merged:!1};let z=await G.storage.taskBoard.claimReviewChangesBounce($,J,K.updatedBy);if(await w5(G,{taskBoardItemId:$,action:"review_changes_requested",actorId:null,data:{reviewer:Z,notes:Y,verified:H}}),!z)return{status:(await G.storage.taskBoard.getById($,J)??K).status,merged:!1};C6(J,z);let P=await G.storage.taskBoard.listPrs($,J),A=await wL(G,J,P);return await NF(G,z,{feedback:`${Th[Z]}: ${Y}`,pr:A?{number:A.number,url:A.url}:void 0}).catch(async(I)=>{if(await zA0(G,z,I)){await G.storage.taskBoard.update(z.id,J,{status:"in_review"},"system").then((q)=>C6(J,q)).catch((q)=>console.error("[task-board] runs-exhausted status revert failed",q));return}if(I instanceof DX)throw I;console.error("[task-board] request_changes re-enqueue failed",I)}),{status:z.status,merged:!1}}if(await w5(G,{taskBoardItemId:$,action:"review_approved",actorId:null,data:{reviewer:Z,notes:Y,verified:H}}),!await ba(G,J,$)){let j=await G.storage.taskBoard.getById($,J)??K;return C6(J,j),{status:j.status,merged:!1}}let F=(await G.storage.organizationSettings.get(J))?.flags?.auto_merge===!0,B=await G.storage.taskBoard.hasHumanRejectedDone($,J),O=F&&!B,L=O?await fa(G,J,$):null;if(L?.merged===!0){let j=await G.storage.taskBoard.update($,J,{status:"done"},K.updatedBy);return await w5(G,{taskBoardItemId:$,action:"status_changed",actorId:null,data:{from:K.status,to:"done"}}),C6(J,j),{status:j.status,merged:!0}}let E=await G.storage.taskBoard.getById($,J)??K;if(O){let j=await G.storage.taskBoard.listPrs($,J),z=await wL(G,J,j);if(z?await _u(G,J,E,{pr:{number:z.number,url:z.url},conflict:_71(await xu(G,J,z),L)}).catch((A)=>{if(A instanceof DX)throw A;return console.error("[task-board] conflict auto-resolve failed",A),!1}):!1)return{status:(await G.storage.taskBoard.getById($,J)??E).status,merged:!1}}return C6(J,E),{status:E.status,merged:!1}}})});import{z as WT0}from"zod";function hr4($,Z,X){if($!=="in_review")return!1;return X.length===0||Pw(Z,X)}var f71;var Wx8=w(()=>{n0();g9();CK();AY();R9();ya();f71=m({name:"TASK_BOARD_PROMOTE_TO_PRODUCTION",description:"Ship a reviewed task: merge its open pull request and move the task to Done. Used by the board's 'Ship to production' button after the enabled reviewers approved, when auto-merge is off (a human does the final merge).",annotations:{title:"Ship to Production",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0},inputSchema:WT0.object({taskBoardItemId:WT0.string()}),outputSchema:WT0.object({status:SK,merged:WT0.boolean().describe("True when the PR was merged.")}),handler:async({taskBoardItemId:$},Z)=>{G0(Z),await Z.access.check();let X=Z.organization?.id;if(!X)throw Error("Organization ID required (no active organization in context)");let Q=await Z.storage.taskBoard.getById($,X);if(!Q)throw Error(`Task board item not found: ${$}`);let Y=await Z.storage.organizationSettings.get(X),G=fU(Y?.flags),J=await Z.storage.taskBoard.listActivity($,X);if(!hr4(Q.status,J,G))throw Error("Task is not ready to ship: it must be In Review with every enabled reviewer approved");if(!(await fa(Z,X,$,{allowPendingChecks:!0})).merged){let H=await Z.storage.taskBoard.getById($,X)??Q;return C6(X,H),{status:Q.status,merged:!1}}let W=await Z.storage.taskBoard.update($,X,{status:"done"},Q.updatedBy);if(Q.status!=="done")await w5(Z,{taskBoardItemId:$,action:"status_changed",actorId:null,data:{from:Q.status,to:"done"}});return C6(X,W),{status:W.status,merged:!0}}})});import{z as t3}from"zod";function Hx8($){if(!$)throw Error("Organization ID required (no active organization in context)");return $}var ur4,b71,y71;var Nx8=w(()=>{n0();ur4=t3.object({externalKey:t3.string(),dismissedBy:t3.string(),dismissedAt:t3.string()});b71=m({name:"TASK_BOARD_DISMISSED_LIST",description:"List the diagnostic findings this organization has dismissed by deleting their task board cards. The import skips these until they're restored.",annotations:{title:"List Dismissed Findings",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:t3.object({}),outputSchema:t3.object({findings:t3.array(ur4)}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=Hx8(Z.organization?.id);return{findings:await Z.storage.taskBoard.listDismissedFindings(X)}}}),y71=m({name:"TASK_BOARD_DISMISSED_RESTORE",description:"Un-dismiss diagnostic findings, returning their cards to the board. Omit externalKeys to restore every dismissed finding.",annotations:{title:"Restore Dismissed Findings",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:t3.object({externalKeys:t3.array(t3.string()).optional()}),outputSchema:t3.object({restored:t3.number()}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=Hx8(Z.organization?.id);return{restored:await Z.storage.taskBoard.restoreDismissedFindings(X,$.externalKeys)}}})});import{z as X5}from"zod";function HT0($){let Z=$.organization?.id;if(!Z)throw Error("Organization ID required (no active organization in context)");return Z}function lr4($,Z,X){return $.replace(cr4,(Q,Y,G,J)=>{let K=encodeURIComponent(`${Z}/${G}`);return`${Y}/api/${encodeURIComponent(X)}/fs/outputs/read?path=${K}${J}`})}var g71,h71,cr4,u71,c71,l71;var Ux8=w(()=>{n0();g9();LA0();Ku();g71=X5.object({id:X5.string(),taskBoardItemId:X5.string(),parentId:X5.string().nullable(),authorId:X5.string(),body:X5.string(),resolved:X5.boolean(),createdAt:X5.string(),updatedAt:X5.string()});h71=m({name:"TASK_BOARD_COMMENT_LIST",description:"List a task board item's comments (flat, oldest first; replies carry parentId).",annotations:{title:"List Task Comments",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:X5.object({taskBoardItemId:X5.string()}),outputSchema:X5.object({comments:X5.array(g71)}),handler:async($,Z)=>{return G0(Z),await Z.access.check(),{comments:await Z.storage.taskBoard.listComments($.taskBoardItemId,HT0(Z))}}}),cr4=/(!\[[^\]]*\]\()org\/output\/([^)\s]+)(\))/g;u71=m({name:"TASK_BOARD_COMMENT_CREATE",description:"Post a comment on a task board item, or a reply to one.",annotations:{title:"Create Task Comment",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},inputSchema:X5.object({taskBoardItemId:X5.string(),body:X5.string().trim().min(1),parentId:X5.string().nullish()}),outputSchema:X5.object({comment:g71}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=HT0(Z),Q=t_.getStore(),Y=Z.organization?.slug,G=Q?.threadId&&Y?lr4($.body,Q.threadId,Y):$.body,J=await Z.storage.taskBoard.createComment({taskBoardItemId:$.taskBoardItemId,organizationId:X,parentId:$.parentId??null,authorId:Q?G4:D1(Z),body:G});if(!J)throw Error("Task board item not found");return await WZ1(Z,{commentId:J.id,taskBoardItemId:J.taskBoardItemId,organizationId:X,authorLabel:Q?"Super Agent":Z.auth?.user?.name??Z.auth?.user?.email??"Studio",body:J.body}),{comment:J}}}),c71=m({name:"TASK_BOARD_COMMENT_UPDATE",description:"Edit your own comment's body, or resolve/unresolve a comment thread (root only, any org member may toggle it).",annotations:{title:"Update Task Comment",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:X5.object({id:X5.string(),body:X5.string().trim().min(1).optional(),resolved:X5.boolean().optional()}),outputSchema:X5.object({comment:g71}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=await Z.storage.taskBoard.updateComment({id:$.id,organizationId:HT0(Z),callerId:D1(Z),body:$.body,resolved:$.resolved});if(!X)throw Error("Comment not found, or you can only edit your own comments");return{comment:X}}}),l71=m({name:"TASK_BOARD_COMMENT_DELETE",description:"Delete your own comment. Deleting a thread root deletes its replies too.",annotations:{title:"Delete Task Comment",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:X5.object({id:X5.string()}),outputSchema:X5.object({success:X5.boolean()}),handler:async($,Z)=>{return G0(Z),await Z.access.check(),{success:await Z.storage.taskBoard.deleteComment($.id,HT0(Z),D1(Z))}}})});var Fx8=w(()=>{wq8();ov8();av8();sv8();ev8();yH();$x8();Jx8();Kx8();Wx8();AY();Nx8();Ux8()});import{z as FF}from"zod";var d71;var Bx8=w(()=>{n0();d71=m({name:"TAGS_LIST",description:"List all tags available in the organization.",annotations:{title:"List Tags",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:FF.object({}),outputSchema:FF.object({tags:FF.array(FF.object({id:FF.string(),organizationId:FF.string(),name:FF.string(),color:FF.string().nullable(),createdAt:FF.string().describe("ISO 8601 timestamp")}))}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=X0(Z);return{tags:(await Z.storage.tags.listOrgTags(X.id)).map((Y)=>({...Y,createdAt:Y.createdAt instanceof Date?Y.createdAt.toISOString():String(Y.createdAt)}))}}})});import{z as gH}from"zod";var m71;var Ox8=w(()=>{n0();m71=m({name:"TAGS_CREATE",description:"Create a new tag, usable on organization members and task board items.",annotations:{title:"Create Tag",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},inputSchema:gH.object({name:gH.string().min(1).max(50).describe("Tag name"),color:gH.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional().describe('Hex color the tag renders its dot with, e.g. "#3b82f6"')}),outputSchema:gH.object({tag:gH.object({id:gH.string(),organizationId:gH.string(),name:gH.string(),color:gH.string().nullable(),createdAt:gH.string().describe("ISO 8601 timestamp")})}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=X0(Z),Q=await Z.storage.tags.createTag(X.id,$.name,$.color);return{tag:{...Q,createdAt:Q.createdAt instanceof Date?Q.createdAt.toISOString():String(Q.createdAt)}}}})});import{z as NT0}from"zod";var i71;var wx8=w(()=>{n0();i71=m({name:"TAGS_DELETE",description:"Delete a tag and automatically remove it from all assigned members.",annotations:{title:"Delete Tag",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:NT0.object({tagId:NT0.string().describe("Tag ID to delete")}),outputSchema:NT0.object({success:NT0.boolean()}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=X0(Z),Q=await Z.storage.tags.getTag($.tagId);if(!Q)throw Error("Tag not found");if(Q.organizationId!==X.id)throw Error("Tag does not belong to this organization");return await Z.storage.tags.deleteTag($.tagId),{success:!0}}})});import{z as hH}from"zod";var n71;var Lx8=w(()=>{n0();n71=m({name:"MEMBER_TAGS_GET",description:"Get all tags currently assigned to a specific member.",annotations:{title:"Get Member Tags",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:hH.object({memberId:hH.string().describe("Member ID")}),outputSchema:hH.object({tags:hH.array(hH.object({id:hH.string(),organizationId:hH.string(),name:hH.string(),color:hH.string().nullable(),createdAt:hH.string().describe("ISO 8601 timestamp")}))}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=X0(Z);if(!await Z.storage.tags.verifyMemberOrg($.memberId,X.id))throw Error(`Member not found in this organization: ${$.memberId}`);return{tags:(await Z.storage.tags.getMemberTags($.memberId)).map((G)=>({...G,createdAt:G.createdAt instanceof Date?G.createdAt.toISOString():String(G.createdAt)}))}}})});import{z as o3}from"zod";var p71;var Dx8=w(()=>{n0();p71=m({name:"MEMBER_TAGS_SET",description:"Replace all tags on a member with the given set. Pass empty array to clear.",annotations:{title:"Set Member Tags",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:o3.object({memberId:o3.string().describe("Member ID"),tagIds:o3.array(o3.string()).describe("Array of tag IDs to assign")}),outputSchema:o3.object({success:o3.boolean(),tags:o3.array(o3.object({id:o3.string(),organizationId:o3.string(),name:o3.string(),createdAt:o3.string().describe("ISO 8601 timestamp")}))}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=X0(Z);if(!await Z.storage.tags.verifyMemberOrg($.memberId,X.id))throw Error(`Member not found in this organization: ${$.memberId}`);for(let G of $.tagIds){let J=await Z.storage.tags.getTag(G);if(!J)throw Error(`Tag not found: ${G}`);if(J.organizationId!==X.id)throw Error(`Tag does not belong to this organization: ${G}`)}return await Z.storage.tags.setMemberTags($.memberId,$.tagIds),{success:!0,tags:(await Z.storage.tags.getMemberTags($.memberId)).map((G)=>({...G,createdAt:G.createdAt instanceof Date?G.createdAt.toISOString():String(G.createdAt)}))}}})});var Ex8=w(()=>{Bx8();Ox8();wx8();Lx8();Dx8()});import{z as jx8}from"zod";function pr4($,Z){let X=$?.[Z];if(!X)return;return Object.entries(X).sort(([,Y],[,G])=>{let J=Math.max(0,...Object.values(Y).map((W)=>W.createdAt??0));return Math.max(0,...Object.values(G).map((W)=>W.createdAt??0))-J})[0]?.[0]}var ir4,nr4,t71;var zx8=w(()=>{h4();n0();Hv();GQ();ir4=jx8.object({data:SS8.describe("Data for the new thread (id is auto-generated if not provided)")}),nr4=jx8.object({item:CH.describe("The created thread entity")});t71=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:ir4,outputSchema:nr4,handler:async($,Z)=>{G0(Z);let X=X0(Z);await Z.access.check();let Q=D1(Z);if(!Q)throw Error("User ID required to create thread");let{data:Y}=$,G=Y.id??Q4("thrd"),K=(await $A0(Z.storage.virtualMcps,Y.virtual_mcp_id,X.id)).metadata,W=K?.githubRepo,H=null;if(W)H=Y.branch??pr4(K?.sandboxMap,Q)??GP0(YP0(Z.auth.user));let N=await Z.storage.threads.create({id:G,organization_id:X.id,title:Y.title,description:Y.description,virtual_mcp_id:Y.virtual_mcp_id,branch:H,created_by:Q,...Y.runtime?{metadata:{runtime:Y.runtime}}:{}});if(N.isNew)n1.capture({distinctId:Q,event:"chat_started",groups:{organization:X.id},properties:{organization_id:X.id,thread_id:G,has_title:!!$.data.title,created_via:"tool"}});return{item:m3(N)}}})});import{z as o71}from"zod";var tr4,or4,r71;var Px8=w(()=>{h4();n0();Hv();QA0();tr4=o71.object({id:o71.string().describe("ID of the thread to update"),data:CS8.describe("Partial thread data to update")}),or4=o71.object({item:CH.describe("The updated thread entity")}),r71=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:tr4,outputSchema:or4,handler:async($,Z)=>{G0(Z);let X=X0(Z);await Z.access.check();let Q=D1(Z);if(!Q)throw Error("User ID required to update thread");let{id:Y,data:G}=$,J=await Z.storage.threads.get(Y);if(!J)throw Error("Thread not found in organization");if(G.virtual_mcp_id!==void 0)await $A0(Z.storage.virtualMcps,G.virtual_mcp_id,X.id);if(G.branch===null&&J.virtual_mcp_id){if((await Z.storage.virtualMcps.findById(J.virtual_mcp_id,X.id))?.metadata?.githubRepo)throw Error("Cannot set branch=null on a github-linked thread (vMCP has githubRepo)")}let K={title:G.title,description:G.description,hidden:G.hidden,updated_by:Q};if(G.status)K.status=G.status;if(G.metadata!==void 0){let H=y91(J.metadata?.runtime);K.metadata=H?{...G.metadata,runtime:H}:G.metadata}if(G.branch!==void 0)K.branch=G.branch;if(G.virtual_mcp_id!==void 0)K.virtual_mcp_id=G.virtual_mcp_id;let W=await Z.storage.threads.update(Y,K);if(G.hidden!==void 0&&G.hidden!==J.hidden)n1.capture({distinctId:Q,event:G.hidden?"chat_archived":"chat_unarchived",groups:{organization:X.id},properties:{organization_id:X.id,thread_id:Y}});return{item:m3(W)}}})});var a71;var Ax8=w(()=>{V3();Hv();h4();n0();WF();KT0();Mu();a71=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:Do,outputSchema:Eo(CH),handler:async($,Z)=>{G0(Z);let X=X0(Z);await Z.access.check();let Q=await Z.storage.threads.get($.id);if(!Q)throw Error(`Thread not found: ${$.id}`);if(Q.status==="in_progress"){let G=(K)=>(W)=>console.error("[thread] delete-time run cancel step failed",{threadId:$.id,step:K,err:W});await qu($.id).catch(G("background-jobs")),await fu($.id).catch(G("gate-head"));let J=await Z.storage.threads.getRunFence($.id).catch(()=>null);if(J)await zv($.id,J).catch(G("hosted-harness"));GT0($.id)}await Z.storage.threads.delete($.id);let Y=D1(Z);if(Y)n1.capture({distinctId:Y,event:"chat_deleted",groups:{organization:X.id},properties:{organization_id:X.id,thread_id:$.id}});return{item:m3(Q)}}})});var Tx8=w(()=>{zx8();g91();h91();Px8();Ax8();u91()});function ar4($){return{type:"doc",content:[{type:"paragraph",content:[{type:"text",text:$}]}]}}function sr4($){return $.map((Z)=>{let X=Z.metadata;if(X?.tiptapDoc)return Z;let Q=Z.parts.find((Y)=>Y.type==="text"&&typeof Y.text==="string");if(!Q?.text||typeof Q.text!=="string")return Z;return{...Z,metadata:{...X,tiptapDoc:ar4(Q.text)}}})}function UT0($){let Z;if(typeof $==="string")try{let X=JSON.parse($);if(Array.isArray(X)&&X.length>0&&X[0]?.role&&Array.isArray(X[0]?.parts))Z=X;else Z=[{role:"user",parts:[{type:"text",text:$}]}]}catch{Z=[{role:"user",parts:[{type:"text",text:$}]}]}else Z=$;return sr4(Z)}import{z as Q5}from"zod";var s71;var Rx8=w(()=>{h4();n0();QY();s71=m({name:"AUTOMATION_CREATE",description:"Create an automation that runs an agent thread on trigger fire. Requires virtual_mcp_id + messages.",annotations:{title:"Create Automation",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},inputSchema:Q5.object({name:Q5.string().min(1).max(255),virtual_mcp_id:Q5.string(),messages:Q5.union([Q5.string(),Q5.array(Q5.looseObject({id:Q5.string().optional(),role:Q5.enum(["user","assistant","system"]),parts:Q5.array(Q5.record(Q5.string(),Q5.unknown())),metadata:Q5.unknown().optional()}))]),models:Q5.object({tier:Dw,modelId:Q5.string().optional(),credentialId:Q5.string().optional()}).loose().default({tier:"smart"}),tools:Q5.array(Q5.string()).nullable().optional(),maxAgentSteps:Q5.number().int().min(1).max(100).nullable().optional(),temperature:Q5.number().default(0.5),active:Q5.boolean().default(!0)}),outputSchema:Q5.object({id:Q5.string(),name:Q5.string(),active:Q5.boolean(),created_at:Q5.string()}),handler:async($,Z)=>{G0(Z);let X=X0(Z);await Z.access.check();let Q=D1(Z);if(!Q)throw Error("Unable to determine user identity");let Y=UT0($.messages),G=await Z.storage.automations.create({organization_id:X.id,created_by:Q,name:$.name,messages:JSON.stringify(Y),models:JSON.stringify($.models),tools:$.tools===void 0||$.tools===null?null:JSON.stringify($.tools),max_agent_steps:$.maxAgentSteps??null,temperature:$.temperature,active:$.active,virtual_mcp_id:$.virtual_mcp_id});return n1.capture({distinctId:Q,event:"automation_created",groups:{organization:X.id},properties:{organization_id:X.id,automation_id:G.id,virtual_mcp_id:$.virtual_mcp_id,active:G.active,tier:$.models.tier}}),{id:G.id,name:G.name,active:G.active,created_at:G.created_at}}})});import{z as i$}from"zod";var e71;var Ix8=w(()=>{n0();e71=m({name:"AUTOMATION_GET",description:"Get an automation's full configuration and triggers by ID.",annotations:{title:"Get Automation",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:i$.object({id:i$.string()}),outputSchema:i$.object({automation:i$.object({id:i$.string(),name:i$.string(),active:i$.boolean(),created_by:i$.string(),created_at:i$.string(),updated_at:i$.string(),virtual_mcp_id:i$.string(),messages:i$.unknown(),models:i$.unknown(),tools:i$.array(i$.string()).nullable(),maxAgentSteps:i$.number().nullable(),temperature:i$.number(),triggers:i$.array(i$.object({id:i$.string(),type:i$.enum(["cron","event","webhook"]),cron_expression:i$.string().nullable(),connection_id:i$.string().nullable(),event_type:i$.string().nullable(),params:i$.unknown().nullable(),last_run_at:i$.string().nullable(),api_key_id:i$.string().nullable(),created_at:i$.string()}))}).nullable()}),handler:async($,Z)=>{G0(Z);let X=X0(Z);await Z.access.check();let Q=await Z.storage.automations.findById($.id,X.id);if(!Q)return{automation:null};let Y=await Z.storage.automations.listTriggers(Q.id);return{automation:{id:Q.id,name:Q.name,active:Q.active,created_by:Q.created_by,created_at:Q.created_at,updated_at:Q.updated_at,virtual_mcp_id:Q.virtual_mcp_id,messages:JSON.parse(Q.messages),models:JSON.parse(Q.models),tools:Q.tools?JSON.parse(Q.tools):null,maxAgentSteps:Q.max_agent_steps,temperature:Q.temperature,triggers:Y.map((G)=>({id:G.id,type:G.type,cron_expression:G.cron_expression,connection_id:G.connection_id,event_type:G.event_type,params:G.params?JSON.parse(G.params):null,last_run_at:G.last_run_at,api_key_id:G.api_key_id,created_at:G.created_at}))}}}})});import{z as SG}from"zod";var $X1;var qx8=w(()=>{n0();$X1=m({name:"AUTOMATION_LIST",description:"List automations with their status, triggers, and configuration.",annotations:{title:"List Automations",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:SG.object({virtual_mcp_id:SG.string().optional().nullable()}),outputSchema:SG.object({automations:SG.array(SG.object({id:SG.string(),name:SG.string(),active:SG.boolean(),created_by:SG.string(),created_at:SG.string(),trigger_count:SG.number(),nearest_next_run_at:SG.string().nullable(),virtual_mcp_id:SG.string()}))}),handler:async($,Z)=>{G0(Z);let X=X0(Z);return await Z.access.check(),{automations:(await Z.storage.automations.listWithTriggerCounts(X.id,$.virtual_mcp_id)).map((G)=>({id:G.id,name:G.name,active:G.active,created_by:G.created_by,created_at:G.created_at,trigger_count:G.trigger_count,nearest_next_run_at:G.nearest_next_run_at,virtual_mcp_id:G.virtual_mcp_id}))}}})});function $a4($){if(!$)return null;try{let Z=JSON.parse($);if(Array.isArray(Z)&&Z.every((X)=>typeof X==="string"))return Z.length>0?Z:null}catch{}return null}function Mx8($){return`${$}:context`}function Vx8($,Z,X,Q,Y){let J=JSON.parse($.messages).map((H,N)=>({...H,id:`${X}:${N}`})),K=Z?{...Y,[OP0]:er4}:Y;return{messages:J,models:{credentialId:Q.credentialId,thinking:Q.thinking,...Q.image?{image:Q.image}:{},...Q.webSearch?{webSearch:Q.webSearch}:{},...Q.deepResearch?{deepResearch:Q.deepResearch}:{}},agent:{id:$.virtual_mcp_id},toolAllowlist:$a4($.tools),maxAgentSteps:$.max_agent_steps??void 0,temperature:$.temperature??0.5,toolApprovalLevel:"auto",mode:"default",organizationId:$.organization_id,userId:$.created_by,harnessId:"decopilot",sandboxProviderKind:"agent-sandbox",triggerId:Z??void 0,...K?{runMetadata:K}:{},taskId:X}}var er4="new_task";var kx8=w(()=>{tr()});function SX($,Z,X,Q,Y,G,J,K){return SX.fromTZ(SX.tp($,Z,X,Q,Y,G,J),K)}function ZX1($,Z=new Date){let X=Z.toLocaleString("en-US",{timeZone:$,timeZoneName:"shortOffset"}).split(" ").slice(-1)[0],Q=Z.toLocaleString("en-US").replace(/[\u202f]/," ");return Date.parse(`${Q} GMT`)-Date.parse(`${Q} ${X}`)}function Za4($,Z){let X=new Date(Date.parse($));if(isNaN(X))throw Error("minitz: Invalid ISO8601 passed to parser.");let Q=$.substring(9);return $.includes("Z")||Q.includes("-")||Q.includes("+")?SX.tp(X.getUTCFullYear(),X.getUTCMonth()+1,X.getUTCDate(),X.getUTCHours(),X.getUTCMinutes(),X.getUTCSeconds(),"Etc/UTC"):SX.tp(X.getFullYear(),X.getMonth()+1,X.getDate(),X.getHours(),X.getMinutes(),X.getSeconds(),Z)}function Xa4($){if($===void 0&&($={}),delete $.name,$.legacyMode=$.legacyMode===void 0?!0:$.legacyMode,$.paused=$.paused===void 0?!1:$.paused,$.maxRuns=$.maxRuns===void 0?1/0:$.maxRuns,$.catch=$.catch===void 0?!1:$.catch,$.interval=$.interval===void 0?0:parseInt($.interval.toString(),10),$.utcOffset=$.utcOffset===void 0?void 0:parseInt($.utcOffset.toString(),10),$.unref=$.unref===void 0?!1:$.unref,$.startAt&&($.startAt=new r3($.startAt,$.timezone)),$.stopAt&&($.stopAt=new r3($.stopAt,$.timezone)),$.interval!==null){if(isNaN($.interval))throw Error("CronOptions: Supplied value for interval is not a number");if($.interval<0)throw Error("CronOptions: Supplied value for interval can not be negative")}if($.utcOffset!==void 0){if(isNaN($.utcOffset))throw Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if($.utcOffset<-870||$.utcOffset>870)throw Error("CronOptions: utcOffset out of bounds.");if($.utcOffset!==void 0&&$.timezone)throw Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if($.unref!==!0&&$.unref!==!1)throw Error("CronOptions: Unref should be either true, false or undefined(false).");return $}function ga($){return Object.prototype.toString.call($)==="[object Function]"||typeof $=="function"||$ instanceof Function}function Qa4($){return ga($)}function Ya4($){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer($):$&&typeof $.unref<"u"&&$.unref()}var XX1=32,ha,vx8,Sx8=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor($,Z){this.pattern=$,this.timezone=Z,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern=="string"||this.pattern instanceof String))throw TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let $=this.pattern.replace(/\s+/g," ").split(" ");if($.length<5||$.length>6)throw TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five or six space separated parts are required.");if($.length===5&&$.unshift("0"),$[3].indexOf("L")>=0&&($[3]=$[3].replace("L",""),this.lastDayOfMonth=!0),$[3]=="*"&&(this.starDOM=!0),$[4].length>=3&&($[4]=this.replaceAlphaMonths($[4])),$[5].length>=3&&($[5]=this.replaceAlphaDays($[5])),$[5]=="*"&&(this.starDOW=!0),this.pattern.indexOf("?")>=0){let Z=new r3(new Date,this.timezone).getDate(!0);$[0]=$[0].replace("?",Z.getSeconds().toString()),$[1]=$[1].replace("?",Z.getMinutes().toString()),$[2]=$[2].replace("?",Z.getHours().toString()),this.starDOM||($[3]=$[3].replace("?",Z.getDate().toString())),$[4]=$[4].replace("?",(Z.getMonth()+1).toString()),this.starDOW||($[5]=$[5].replace("?",Z.getDay().toString()))}this.throwAtIllegalCharacters($),this.partToArray("second",$[0],0,1),this.partToArray("minute",$[1],0,1),this.partToArray("hour",$[2],0,1),this.partToArray("day",$[3],-1,1),this.partToArray("month",$[4],-1,1),this.partToArray("dayOfWeek",$[5],0,ha),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray($,Z,X,Q){let Y=this[$],G=$==="day"&&this.lastDayOfMonth;if(Z===""&&!G)throw TypeError("CronPattern: configuration entry "+$+" ("+Z+") is empty, check for trailing spaces.");if(Z==="*")return Y.fill(Q);let J=Z.split(",");if(J.length>1)for(let K=0;K<J.length;K++)this.partToArray($,J[K],X,Q);else Z.indexOf("-")!==-1&&Z.indexOf("/")!==-1?this.handleRangeWithStepping(Z,$,X,Q):Z.indexOf("-")!==-1?this.handleRange(Z,$,X,Q):Z.indexOf("/")!==-1?this.handleStepping(Z,$,X,Q):Z!==""&&this.handleNumber(Z,$,X,Q)}throwAtIllegalCharacters($){for(let Z=0;Z<$.length;Z++)if((Z===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test($[Z]))throw TypeError("CronPattern: configuration entry "+Z+" ("+$[Z]+") contains illegal characters.")}handleNumber($,Z,X,Q){let Y=this.extractNth($,Z),G=parseInt(Y[0],10)+X;if(isNaN(G))throw TypeError("CronPattern: "+Z+" is not a number: '"+$+"'");this.setPart(Z,G,Y[1]||Q)}setPart($,Z,X){if(!Object.prototype.hasOwnProperty.call(this,$))throw TypeError("CronPattern: Invalid part specified: "+$);if($==="dayOfWeek"){if(Z===7&&(Z=0),Z<0||Z>6)throw RangeError("CronPattern: Invalid value for dayOfWeek: "+Z);this.setNthWeekdayOfMonth(Z,X);return}if($==="second"||$==="minute"){if(Z<0||Z>=60)throw RangeError("CronPattern: Invalid value for "+$+": "+Z)}else if($==="hour"){if(Z<0||Z>=24)throw RangeError("CronPattern: Invalid value for "+$+": "+Z)}else if($==="day"){if(Z<0||Z>=31)throw RangeError("CronPattern: Invalid value for "+$+": "+Z)}else if($==="month"&&(Z<0||Z>=12))throw RangeError("CronPattern: Invalid value for "+$+": "+Z);this[$][Z]=X}handleRangeWithStepping($,Z,X,Q){let Y=this.extractNth($,Z),G=Y[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(G===null)throw TypeError("CronPattern: Syntax error, illegal range with stepping: '"+$+"'");let[,J,K,W]=G,H=parseInt(J,10)+X,N=parseInt(K,10)+X,U=parseInt(W,10);if(isNaN(H))throw TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(N))throw TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(isNaN(U))throw TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(U===0)throw TypeError("CronPattern: Syntax error, illegal stepping: 0");if(U>this[Z].length)throw TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[Z].length+")");if(H>N)throw TypeError("CronPattern: From value is larger than to value: '"+$+"'");for(let F=H;F<=N;F+=U)this.setPart(Z,F,Y[1]||Q)}extractNth($,Z){let X=$,Q;if(X.includes("#")){if(Z!=="dayOfWeek")throw Error("CronPattern: nth (#) only allowed in day-of-week field");Q=X.split("#")[1],X=X.split("#")[0]}return[X,Q]}handleRange($,Z,X,Q){let Y=this.extractNth($,Z),G=Y[0].split("-");if(G.length!==2)throw TypeError("CronPattern: Syntax error, illegal range: '"+$+"'");let J=parseInt(G[0],10)+X,K=parseInt(G[1],10)+X;if(isNaN(J))throw TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(K))throw TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(J>K)throw TypeError("CronPattern: From value is larger than to value: '"+$+"'");for(let W=J;W<=K;W++)this.setPart(Z,W,Y[1]||Q)}handleStepping($,Z,X,Q){let Y=this.extractNth($,Z),G=Y[0].split("/");if(G.length!==2)throw TypeError("CronPattern: Syntax error, illegal stepping: '"+$+"'");G[0]===""&&(G[0]="*");let J=0;G[0]!=="*"&&(J=parseInt(G[0],10)+X);let K=parseInt(G[1],10);if(isNaN(K))throw TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(K===0)throw TypeError("CronPattern: Syntax error, illegal stepping: 0");if(K>this[Z].length)throw TypeError("CronPattern: Syntax error, max steps for part is ("+this[Z].length+")");for(let W=J;W<this[Z].length;W+=K)this.setPart(Z,W,Y[1]||Q)}replaceAlphaDays($){return $.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaMonths($){return $.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames($){let Z=$.trim().toLowerCase();return Z==="@yearly"||Z==="@annually"?"0 0 1 1 *":Z==="@monthly"?"0 0 1 * *":Z==="@weekly"?"0 0 * * 0":Z==="@daily"?"0 0 * * *":Z==="@hourly"?"0 * * * *":$}setNthWeekdayOfMonth($,Z){if(typeof Z!="number"&&Z==="L")this.dayOfWeek[$]=this.dayOfWeek[$]|XX1;else if(Z===ha)this.dayOfWeek[$]=ha;else if(Z<6&&Z>0)this.dayOfWeek[$]=this.dayOfWeek[$]|vx8[Z-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${Z}, Type: ${typeof Z}`)}},Cx8,BF,r3=class ${tz;ms;second;minute;hour;day;month;year;constructor(Z,X){if(this.tz=X,Z&&Z instanceof Date)if(!isNaN(Z))this.fromDate(Z);else throw TypeError("CronDate: Invalid date passed to CronDate constructor");else if(Z===void 0)this.fromDate(new Date);else if(Z&&typeof Z=="string")this.fromString(Z);else if(Z instanceof $)this.fromCronDate(Z);else throw TypeError("CronDate: Invalid type ("+typeof Z+") passed to CronDate constructor")}isNthWeekdayOfMonth(Z,X,Q,Y){let G=new Date(Date.UTC(Z,X,Q)).getUTCDay(),J=0;for(let K=1;K<=Q;K++)new Date(Date.UTC(Z,X,K)).getUTCDay()===G&&J++;if(Y&ha&&vx8[J-1]&Y)return!0;if(Y&XX1){let K=new Date(Date.UTC(Z,X+1,0)).getUTCDate();for(let W=Q+1;W<=K;W++)if(new Date(Date.UTC(Z,X,W)).getUTCDay()===G)return!1;return!0}return!1}fromDate(Z){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=Z.getUTCMilliseconds(),this.second=Z.getUTCSeconds(),this.minute=Z.getUTCMinutes()+this.tz,this.hour=Z.getUTCHours(),this.day=Z.getUTCDate(),this.month=Z.getUTCMonth(),this.year=Z.getUTCFullYear(),this.apply();else{let X=SX.toTZ(Z,this.tz);this.ms=Z.getMilliseconds(),this.second=X.s,this.minute=X.i,this.hour=X.h,this.day=X.d,this.month=X.m-1,this.year=X.y}else this.ms=Z.getMilliseconds(),this.second=Z.getSeconds(),this.minute=Z.getMinutes(),this.hour=Z.getHours(),this.day=Z.getDate(),this.month=Z.getMonth(),this.year=Z.getFullYear()}fromCronDate(Z){this.tz=Z.tz,this.year=Z.year,this.month=Z.month,this.day=Z.day,this.hour=Z.hour,this.minute=Z.minute,this.second=Z.second,this.ms=Z.ms}apply(){if(this.month>11||this.day>Cx8[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let Z=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=Z.getUTCMilliseconds(),this.second=Z.getUTCSeconds(),this.minute=Z.getUTCMinutes(),this.hour=Z.getUTCHours(),this.day=Z.getUTCDate(),this.month=Z.getUTCMonth(),this.year=Z.getUTCFullYear(),!0}else return!1}fromString(Z){if(typeof this.tz=="number"){let X=SX.fromTZISO(Z);this.ms=X.getUTCMilliseconds(),this.second=X.getUTCSeconds(),this.minute=X.getUTCMinutes(),this.hour=X.getUTCHours(),this.day=X.getUTCDate(),this.month=X.getUTCMonth(),this.year=X.getUTCFullYear(),this.apply()}else return this.fromDate(SX.fromTZISO(Z,this.tz))}findNext(Z,X,Q,Y){let G=this[X],J;Q.lastDayOfMonth&&(this.month!==1?J=Cx8[this.month]:J=new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate());let K=!Q.starDOW&&X=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let W=this[X]+Y;W<Q[X].length;W++){let H=Q[X][W];if(X==="day"&&Q.lastDayOfMonth&&W-Y==J&&(H=1),X==="day"&&!Q.starDOW){let N=Q.dayOfWeek[(K+(W-Y-1))%7];if(N&&N&ha)N=this.isNthWeekdayOfMonth(this.year,this.month,W-Y,N)?1:0;else if(N)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${N}`);Z.legacyMode&&!Q.starDOM?H=H||N:H=H&&N}if(H)return this[X]=W-Y,G!==this[X]?2:1}return 3}recurse(Z,X,Q){let Y=this.findNext(X,BF[Q][0],Z,BF[Q][2]);if(Y>1){let G=Q+1;for(;G<BF.length;)this[BF[G][0]]=-BF[G][2],G++;if(Y===3)return this[BF[Q][1]]++,this[BF[Q][0]]=-BF[Q][2],this.apply(),this.recurse(Z,X,0);if(this.apply())return this.recurse(Z,X,Q-1)}return Q+=1,Q>=BF.length?this:this.year>=3000?null:this.recurse(Z,X,Q)}increment(Z,X,Q){return this.second+=X.interval!==void 0&&X.interval>1&&Q?X.interval:1,this.ms=0,this.apply(),this.recurse(Z,X,0)}getDate(Z){return Z||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):SX.fromTZ(SX.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}},_x8=30000,FT0,BT0=class{name;options;_states;fn;constructor($,Z,X){let Q,Y;if(ga(Z))Y=Z;else if(typeof Z=="object")Q=Z;else if(Z!==void 0)throw Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(ga(X))Y=X;else if(typeof X=="object")Q=X;else if(X!==void 0)throw Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=Q?.name,this.options=Xa4(Q),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:Q?Q.maxRuns:void 0,paused:Q?Q.paused:!1,pattern:new Sx8("* * * * *")},$&&($ instanceof Date||typeof $=="string"&&$.indexOf(":")>0)?this._states.once=new r3($,this.options.timezone||this.options.utcOffset):this._states.pattern=new Sx8($,this.options.timezone),this.name){if(FT0.find((G)=>G.name===this.name))throw Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");FT0.push(this)}return Y!==void 0&&Qa4(Y)&&(this.fn=Y,this.schedule()),this}nextRun($){let Z=this._next($);return Z?Z.getDate(!1):null}nextRuns($,Z){this._states.maxRuns!==void 0&&$>this._states.maxRuns&&($=this._states.maxRuns);let X=[],Q=Z||this._states.currentRun||void 0;for(;$--&&(Q=this.nextRun(Q));)X.push(Q);return X}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let $=this.nextRun(this._states.currentRun),Z=!this._states.paused,X=this.fn!==void 0,Q=!this._states.kill;return Z&&X&&Q&&$!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext($){let Z=this._next($);return Z?$ instanceof r3||$ instanceof Date?Z.getTime()-$.getTime():Z.getTime()-new r3($).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let $=FT0.indexOf(this);$>=0&&FT0.splice($,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule($){if($&&this.fn)throw Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");$&&(this.fn=$);let Z=this.msToNext(),X=this.nextRun(this._states.currentRun);return Z==null||isNaN(Z)||X===null?this:(Z>_x8&&(Z=_x8),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(X),Z),this._states.currentTimeout&&this.options.unref&&Ya4(this._states.currentTimeout),this)}async _trigger($){if(this._states.blocking=!0,this._states.currentRun=new r3(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(Z){ga(this.options.catch)&&this.options.catch(Z,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new r3($,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger($){let Z=new Date,X=!this._states.paused&&Z.getTime()>=$.getTime(),Q=this._states.blocking&&this.options.protect;X&&!Q?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):X&&Q&&ga(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next($){let Z=!!($||this._states.currentRun),X=!1;!$&&this.options.startAt&&this.options.interval&&([$,Z]=this._calculatePreviousRun($,Z),X=!$),$=new r3($,this.options.timezone||this.options.utcOffset),this.options.startAt&&$&&$.getTime()<this.options.startAt.getTime()&&($=this.options.startAt);let Q=this._states.once||new r3($,this.options.timezone||this.options.utcOffset);return!X&&Q!==this._states.once&&(Q=Q.increment(this._states.pattern,this.options,Z)),this._states.once&&this._states.once.getTime()<=$.getTime()||Q===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&Q.getTime()>=this.options.stopAt.getTime()?null:Q}_calculatePreviousRun($,Z){let X=new r3(void 0,this.options.timezone||this.options.utcOffset),Q=$;if(this.options.startAt.getTime()<=X.getTime()){Q=this.options.startAt;let Y=Q.getTime()+this.options.interval*1000;for(;Y<=X.getTime();)Q=new r3(Q,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),Y=Q.getTime()+this.options.interval*1000;Z=!0}return Q===null&&(Q=void 0),[Q,Z]}};var QX1=w(()=>{SX.fromTZISO=($,Z,X)=>SX.fromTZ(Za4($,Z),X);SX.fromTZ=function($,Z){let X=new Date(Date.UTC($.y,$.m-1,$.d,$.h,$.i,$.s)),Q=ZX1($.tz,X),Y=new Date(X.getTime()-Q),G=ZX1($.tz,Y);if(G-Q===0)return Y;{let J=new Date(X.getTime()-G),K=ZX1($.tz,J);if(K-G===0)return J;if(!Z&&K-G>0)return J;if(Z)throw Error("Invalid date passed to fromTZ()");return Y}};SX.toTZ=function($,Z){let X=$.toLocaleString("en-US",{timeZone:Z}).replace(/[\u202f]/," "),Q=new Date(X);return{y:Q.getFullYear(),m:Q.getMonth()+1,d:Q.getDate(),h:Q.getHours(),i:Q.getMinutes(),s:Q.getSeconds(),tz:Z}};SX.tp=($,Z,X,Q,Y,G,J)=>({y:$,m:Z,d:X,h:Q,i:Y,s:G,tz:J});SX.minitz=SX;ha=31|XX1,vx8=[1,2,4,8,16],Cx8=[31,28,31,30,31,30,31,31,30,31,30,31],BF=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]];FT0=[]});function OT0($,Z){try{return new BT0($,{timezone:"UTC"}).nextRun(Z)??null}catch{return null}}var YX1=w(()=>{QX1()});import{DBOS as _7,SchedulerMode as Ga4}from"@dbos-inc/dbos-sdk";async function HX1($){try{let{rows:Z}=await $.query(`SELECT q.name FROM dbos.queues q
2865
+ `)}async function Nr4($,Z,X){let Q=Z.organizationId,Y=await RX($,"smart"),G=X.virtual_mcp_id??eE(Q),J={id:`stall-nudge-${Z.id}-${X.id}`,role:"user",parts:[{type:"text",text:Hr4(X.harness_id)}]};await new kX({storage:$.storage.threads.messageParts(),orgId:Q,threadId:X.id,runId:X.id}).emitRequestMessage(J),await KF({threadId:X.id,source:"background-tool",request:{messages:[J],models:{credentialId:Y.credentialId,thinking:{id:Y.modelId,title:Y.modelMeta.title}},agent:{id:G},temperature:0.5,toolApprovalLevel:"auto",mode:"default",organizationId:Q,userId:Z.assignedBy??Z.createdBy,harnessId:X.harness_id==="claude-code"?"claude-code":"decopilot",sandboxProviderKind:"agent-sandbox",...X.branch?{branch:X.branch}:{},taskId:X.id,runMetadata:BP0(Z)}},{workflowID:`stall-nudge:${Z.id}:${X.id}`})}async function Ur4($,Z){let X=await $.storage.threads.get(Z);if(!X)return{action:"none",thread:null};return{action:Wr4({status:X.status,messageStorageVersion:X.message_storage_version,harnessId:X.harness_id,sandboxProviderKind:X.sandbox_provider_kind}),thread:X}}function Fr4($,Z=Date.now()){if($.status!=="in_progress")return!1;if($.run_started_at)return!1;return Oa($,Z)}async function Br4($,Z){let X=[];for(let Q of Z.threads){if(Q.status!=="in_progress")continue;let Y=await $.storage.threads.get(Q.threadId);if(!Y||!Fr4(Y))continue;if(await $.storage.threads.markRunFailed(Q.threadId,I71,"abandoned"))X.push(Q.threadId),console.warn(`[task-board] failed never-started thread ${Q.threadId} on ${Z.id}`)}return X}async function rv8($,Z){let X=$.organization?.id;if(!X)return;for(let Q of Z){if(Q.status==="in_progress")try{if((await Br4($,Q)).length>0)continue}catch(J){console.error(`[task-board] reaping threads for ${Q.id} failed`,J)}let Y=Q.repo!=null&&(await $.storage.taskBoard.listPrs(Q.id,X)).length>0;if(!r91(Q,Y))continue;let G=Q.threads.find((J)=>J.hasMessages);if(!G)continue;try{let{action:J,thread:K}=await Ur4($,G.threadId);if(J==="none"||!K)continue;if(J==="advance")await Tu($.storage.taskBoard,G.threadId,X,$.storage.organizationBilling);else await Nr4($,Q,K)}catch(J){console.error(`[task-board] stall recovery failed for ${Q.id}`,J)}}}var I71="Run never started \u2014 no pod picked it up before the idle window elapsed";var q71=w(()=>{pr();UL();$L();WF();vH();A6();R9()});import{z as xa}from"zod";var M71;var av8=w(()=>{n0();ZY();CK();q71();M71=m({name:"TASK_BOARD_ITEM_LIST",description:"List all task board items for the organization, plus the `owner/name` repos this organization has imported (the valid values for a task's `repo` field).",annotations:{title:"List Task Board Items",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:xa.object({}),outputSchema:xa.object({items:xa.array(Wu),repos:xa.array(xa.string())}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=Z.organization?.id;if(!X)throw Error("Organization ID required (no active organization in context)");let Q=await Z.storage.taskBoard.list(X),{items:Y}=await Z.storage.connections.list(X,{slug:"mcp-github"}),G=JF8(Y);return rv8(Z,Q),{items:Q,repos:G}}})});import{z as p3}from"zod";function wr4($,Z){let X=[];for(let{field:G,action:J}of Or4){if(Z[G]===$[G])continue;X.push({action:J,data:{from:$[G],to:Z[G]}})}if(Z.description!==$.description)X.push({action:"description_changed"});let Q=new Set($.tags.map((G)=>G.id));if(Z.tags.length!==$.tags.length||Z.tags.some((G)=>!Q.has(G.id)))X.push({action:"tags_changed",data:{from:$.tags,to:Z.tags}});return X}function Lr4($,Z){if($!==G4)return!1;if(!Z)return!1;return Z.assigneeId!==G4?!0:Z.status==="todo"}function Dr4($,Z,X){return X&&$==="done"&&Z==="in_review"}var Or4,V71;var sv8=w(()=>{n0();CK();L51();JF();AY();Ku();R9();DK();Or4=[{field:"status",action:"status_changed"},{field:"assigneeId",action:"assignee_changed"},{field:"priority",action:"priority_changed"},{field:"dueDate",action:"due_date_changed"},{field:"title",action:"title_changed"}];V71=m({name:"TASK_BOARD_ITEM_UPDATE",description:"Update a task board item's fields (title, description, status, priority, assignee), and/or link a chat thread to it.",annotations:{title:"Update Task Board Item",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:p3.object({id:p3.string(),title:p3.string().min(1).optional(),description:p3.string().nullable().optional(),status:SK.optional(),priority:o_.optional(),assigneeId:p3.string().nullable().optional(),repo:p3.string().nullable().optional(),dueDate:p3.string().datetime().nullable().optional(),sortOrder:p3.number().optional(),tagIds:p3.array(p3.string()).optional(),linkThreadId:p3.string().optional()}),outputSchema:p3.object({item:Wu}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=Z.organization?.id;if(!X)throw Error("Organization ID required (no active organization in context)");if($.assigneeId)await FP0(Z,X,$.assigneeId);if($.linkThreadId){if(!await Z.storage.taskBoard.getById($.id,X))throw Error(`Task board item not found: ${$.id}`);if(!await Z.storage.threads.get($.linkThreadId))throw Error(`Thread not found: ${$.linkThreadId}`);await Z.storage.taskBoard.linkThread($.id,$.linkThreadId,X)}let Q=$.title!==void 0||$.description!==void 0||$.status!==void 0||$.priority!==void 0||$.assigneeId!==void 0||$.repo!==void 0||$.dueDate!==void 0||$.sortOrder!==void 0||$.tagIds!==void 0,Y=Q?await Z.storage.taskBoard.getById($.id,X):null;if(Q&&!Y)throw Error(`Task board item not found: ${$.id}`);let G=t_.getStore()!==void 0;if(Dr4($.status,Y?.status,G))throw Error("This task is In Review \u2014 a run can't move it to Done. Leave it in "+"in_review for the reviewer; only a person, or TASK_BOARD_REVIEW_DECISION on a reviewer's own run, completes a task under review.");let J=$.assigneeId!==void 0&&$.assigneeId!==(Y?.assigneeId??null),K=Lr4($.assigneeId,Y);if(Y&&JY(Y)){if($.title!==void 0||$.description!==void 0||$.priority!==void 0)throw Error("This task was generated from your report and can't be edited \u2014 create your own task instead.");if(K)await y30(Z,Y,Rh())}if($.tagIds!==void 0){let H=await Z.storage.tags.listOrgTags(X),N=new Set(H.map((U)=>U.id));for(let U of $.tagIds)if(!N.has(U))throw Error(`Tag not found: ${U}`);await Z.storage.taskBoard.setItemTags($.id,$.tagIds,D1(Z))}let W;if(Q)W=await Z.storage.taskBoard.update($.id,X,{title:$.title,description:$.description,status:K?"todo":$.status,priority:$.priority,assigneeId:$.assigneeId,assignedBy:J?$.assigneeId?D1(Z):null:void 0,repo:$.repo,dueDate:$.dueDate,sortOrder:$.sortOrder},D1(Z));else{let H=await Z.storage.taskBoard.getById($.id,X);if(!H)throw Error(`Task board item not found: ${$.id}`);W=H}if(Y){let H=D1(Z),N=wr4(Y,W);if(N.length>0)await JC8(Z,N.map((U)=>({taskBoardItemId:W.id,actorId:H,...U})))}if(Q||$.linkThreadId)C6(X,W);if(K)await NL(Z,W,{userInitiated:!0});return{item:W}}})});import{z as YT0}from"zod";var k71;var ev8=w(()=>{n0();R9();k71=m({name:"TASK_BOARD_ITEM_DELETE",description:"Delete a task board item. A reports-pushed task also dismisses its finding, so the next diagnostic import won't re-create the card.",annotations:{title:"Delete Task Board Item",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:YT0.object({id:YT0.string()}),outputSchema:YT0.object({success:YT0.boolean()}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=Z.organization?.id;if(!X)throw Error("Organization ID required (no active organization in context)");if(!await Z.storage.taskBoard.delete($.id,X,D1(Z)??"system"))throw Error(`Task board item not found: ${$.id}`);return LC8(X,$.id),{success:!0}}})});import{z as Av}from"zod";var S71;var $x8=w(()=>{n0();a91();R9();Ku();S71=m({name:"TASK_BOARD_ITEM_PR_LINK",description:"Link the pull request you just opened to this run's task board item. Call this right after `gh pr create` succeeds, with the PR URL it printed. Reviewers (QA, code review) are dispatched from the linked PR, so a task whose PR is not linked never gets reviewed.",annotations:{title:"Link Pull Request to Task",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:Av.object({url:Av.string().describe("The pull request URL, e.g. https://github.com/owner/repo/pull/123")}),outputSchema:Av.object({url:Av.string(),prNumber:Av.number(),taskBoardItemIds:Av.array(Av.string())}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=X0(Z).id,{threadId:Q}=UP0(),Y=HA0($.url);if(!Y)throw Error(`Not a GitHub pull request URL: ${$.url} (expected https://github.com/<owner>/<repo>/pull/<number>)`);let G=await EA0(Z,X,Q);for(let J of G)await Z.storage.taskBoard.linkPr({taskBoardItemId:J,organizationId:X,url:Y.url,prNumber:Y.number,repoOwner:Y.owner,repoName:Y.repo}),await Z.storage.taskBoard.clearSweepBudget(J,X);return{url:Y.url,prNumber:Y.number,taskBoardItemIds:G}}})});function Xx8($){Zx8=$}function GT0($){Zx8?.broadcast($)}var Zx8=null;import{DBOS as JT0}from"@dbos-inc/dbos-sdk";function Er4($,Z){let X=`thread-run:${Z}:`;if(!$.workflowID.startsWith(X))return null;let Q=$.input?.[0],Y=Q?.request;return{workflowId:$.workflowID,messageId:Y?.messageId??$.workflowID.slice(X.length),status:$.status==="PENDING"?"running":"queued",enqueuedAt:$.createdAt,...Q?.source!==void 0?{source:Q.source}:{}}}async function C71($){return(await JT0.listWorkflows({workflow_id_prefix:`thread-run:${$}:`,status:["PENDING","ENQUEUED"],loadInput:!0,loadOutput:!1})).map((X)=>Er4(X,$)).filter((X)=>X!==null).sort((X,Q)=>X.enqueuedAt-Q.enqueuedAt)}async function Qx8($,Z){if(!Z.startsWith(`thread-run:${$}:`))return!1;return await JT0.cancelWorkflows([Z]),!0}async function fu($){let Z=await JT0.listWorkflows({workflow_id_prefix:`thread-run:${$}:`,status:["PENDING"],loadInput:!1,loadOutput:!1});if(Z.length===0)return;await JT0.cancelWorkflows(Z.map((X)=>X.workflowID))}var KT0=()=>{};function Pr4($){return/\b405\b/.test($)&&/not allowed on this repository/i.test($)}function Tr4($,Z={}){if($==="failing")return!0;if($==="pending")return!Z.allowPendingChecks;return!1}async function Rr4($,Z,X,Q,Y){if(Ar4.has(Q))return;let J=(await $.storage.taskBoard.listActivity(X,Z).catch(()=>[])).at(-1);if(J?.action==="merge_failed"&&J.data?.reason===Q)return;await w5($,{taskBoardItemId:X,action:"merge_failed",actorId:null,data:{reason:Q,...Y?{detail:Y}:{}}})}function Ir4($){if(!$?.isError)return{kind:"merged"};let Z=JSON.stringify($?.content)??"";if(Pr4(Z))return{kind:"method_not_allowed",detail:Z};if(ZT0(Z))return{kind:"rate_limited",detail:Z};return{kind:"refused",detail:Z}}async function qr4($,Z,X){let Q=await $.callTool({name:"merge_pull_request",arguments:{owner:Z.repoOwner,repo:Z.repoName,pullNumber:Z.number,merge_method:X}},void 0,{timeout:jr4});return Ir4(Q)}async function fa($,Z,X,Q={}){let Y=async(U,F)=>{return await Rr4($,Z,X,U,F),{merged:!1,reason:U,...F?{detail:F}:{}}},G=await $.storage.taskBoard.listPrs(X,Z),J=await wL($,Z,G);if(!J)return console.warn(`[task-board] merge skipped \u2014 no linked PR on ${X}`),Y("no_pr");let K=await iv8($,Z,J);if(Tr4(K,Q))return console.warn(`[task-board] merge blocked \u2014 checks ${K} on PR #${J.number}`),Y(K==="failing"?"checks_failing":"checks_pending");let W=`${J.repoOwner}/${J.repoName}`,H=await Pv($,Z,J.connectionId,{owner:J.repoOwner,name:J.repoName});if(!H)return console.warn("[task-board] merge blocked \u2014 no active GitHub connection for "+`${W} (PR #${J.number})`),Y("no_connection",W);let N=await I5(H,$,!0);try{let U=null;for(let F of zr4){let B=await qr4(N,J,F);if(B.kind==="merged")return hv8(H.id),{merged:!0};if(B.kind==="rate_limited")return console.warn(`[task-board] merge rate-limited on PR #${J.number} \u2014 sweep retries`),Y("rate_limited",B.detail.slice(0,500));if(B.kind==="method_not_allowed"){console.warn(`[task-board] merge method '${F}' not allowed on ${W} \u2014 trying next`),U=B.detail;continue}return console.error(`[task-board] merge refused by GitHub on PR #${J.number}:`,B.detail),Y("refused",B.detail.slice(0,500))}return console.error(`[task-board] no merge method allowed on ${W} (PR #${J.number})`,U),Y("refused",U?.slice(0,500))}catch(U){let F=U instanceof Error?U.message:String(U);if(ZT0(U))return Y("rate_limited",F);return console.error("[task-board] merge PR failed",U),Y("error",F)}finally{await N.close().catch(()=>{})}}async function ba($,Z,X){let Q=await $.storage.organizationSettings.get(Z),Y=fU(Q?.flags),G=await $.storage.taskBoard.listActivity(X,Z);return Pw(G,Y,{verifiedOnly:!0})}async function Mr4($,Z){let X=await $.storage.organizationSettings.get(Z.organizationId),Q=fU(X?.flags),Y=await $.storage.taskBoard.listActivity(Z.id,Z.organizationId);if(!eF8(Y,Q))return;await fH($,Z,"every reviewer approved, but an approval could not be verified \u2014 "+"auto-merge is blocked and no reviewer can be re-dispatched this cycle")}function Yx8($){return!$.merged&&$.reason==="refused"}function _71($,Z){if($!==null)return $;if(Z===null||!Yx8(Z))return null;return(Z.detail??"").toLowerCase().includes("merge conflict")?!0:null}async function Vr4($,Z,X){if(!Yx8(X))return;let Q=Z.organizationId,Y=await $.storage.taskBoard.listPrs(Z.id,Q),G=await wL($,Q,Y);if(!G)return;await _u($,Q,Z,{pr:{number:G.number,url:G.url},conflict:_71(await xu($,Q,G),X)}).catch((J)=>{console.error("[task-board] sweep conflict auto-resolve failed",J)})}async function Gx8($,Z){let X=Z.organizationId;if(Z.status!=="in_review")return!1;if((await $.storage.organizationSettings.get(X))?.flags?.auto_merge!==!0)return!1;if(await $.storage.taskBoard.hasHumanRejectedDone(Z.id,X))return!1;if(!await ba($,X,Z.id))return await Mr4($,Z),!1;let Y=await fa($,X,Z.id);if(!Y.merged)return await Vr4($,Z,Y),!1;let G=await $.storage.taskBoard.update(Z.id,X,{status:"done"},Z.updatedBy);return await w5($,{taskBoardItemId:Z.id,action:"status_changed",actorId:null,data:{from:Z.status,to:"done"}}),C6(X,G),!0}var jr4=15000,zr4,Ar4;var ya=w(()=>{VU();g9();AY();ka();yH();R9();zr4=["merge","squash","rebase"];Ar4=new Set(["checks_pending"])});import{z as bu}from"zod";function Sr4($){return $.threads.filter((Z)=>Z.status!==null&&!Ea.has(Z.status)).map((Z)=>Z.threadId)}async function Cr4($,Z,X){let Q=(G)=>(J)=>console.error("[task-board] rerun takeover step failed",{threadId:Z,step:G,err:J});await $.storage.threads.setCancelRequested(Z,X).catch(Q("cancel-flag")),await qu(Z).catch(Q("background-jobs")),await fu(Z).catch(Q("gate-head"));let Y=await $.storage.threads.getRunFence(Z).catch(()=>null);if(Y)await zv(Z,Y).catch(Q("hosted-harness"));GT0(Z)}function _r4($,Z){return $===!0&&O71(Z)}async function vr4($,Z,X){let Q=Z.organizationId,Y=await $.storage.taskBoard.listPrs(Z.id,Q).catch(()=>[]),G=await wL($,Q,Y).catch(()=>{return});if(!G)return!1;let J=await xu($,Q,G).catch(()=>null);return _r4(J,X)}function fr4($,Z){let X=bU($),Q=0;for(let Y of $){if(Y.action!=="review_approved")continue;let G=new Date(Y.occurredAt).getTime();if(G>=X)Q=Math.max(Q,G)}return Z-Q>=xr4}async function br4($,Z){if(Z.status!=="in_review")return;if((await $.storage.organizationSettings.get(Z.organizationId))?.flags?.auto_merge!==!0)return;if(!await ba($,Z.organizationId,Z.id))return;let Y=await $.storage.taskBoard.listActivity(Z.id,Z.organizationId).catch(()=>[]);if(fr4(Y,Date.now()))return;if(await vr4($,Z,Y))return;throw Error("Every reviewer approved this task and its merge is retrying \u2014 re-running "+"would throw that away and start a new review cycle. Wait for the merge, or use the ship button if the PR needs a nudge.")}var kr4="Superseded by a manual re-run of this task",xr4=900000,v71;var Jx8=w(()=>{n0();g9();vH();WF();KT0();Mu();AY();R9();JF();ya();yH();ka();DK();v71=m({name:"TASK_BOARD_ITEM_RERUN",description:"Re-run a task board item with the Super Agent, whatever lane it is in. Use this to retry a task that stalled, finished without doing the job, or is already assigned to the Super Agent (in which case re-assigning it does nothing). Fails any run still holding the task open, moves it to In Progress, and queues a fresh run.",annotations:{title:"Re-run Task",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0},inputSchema:bu.object({id:bu.string().describe("The task board item to re-run.")}),outputSchema:bu.object({status:bu.string().describe("The task's lane after the re-run was queued."),supersededThreadIds:bu.array(bu.string()).describe("Runs that were failed to make room for this one.")}),handler:async({id:$},Z)=>{G0(Z),await Z.access.check();let X=Z.organization?.id;if(!X)throw Error("Organization ID required (no active organization in context)");let Q=await Z.storage.taskBoard.getById($,X);if(!Q)throw Error(`Task board item not found: ${$}`);if(Q.assigneeId!==G4)throw Error("Only a task assigned to the Super Agent can be re-run. Assign it to "+"the Super Agent instead \u2014 that queues a run by itself.");await br4(Z,Q),await y30(Z,Q,Rh());let Y=[];for(let J of Sr4(Q)){if(!await Z.storage.threads.failIfNotTerminal(J,kr4,"superseded"))continue;Y.push(J),await Cr4(Z,J,X)}let G=await Z.storage.taskBoard.update($,X,{status:"in_progress"},D1(Z));return await w5(Z,{taskBoardItemId:$,action:"status_changed",actorId:D1(Z),data:{from:Q.status,to:"in_progress",reason:"rerun"}}),C6(X,G),await NF(Z,G,{userInitiated:!0}),{status:G.status,supersededThreadIds:Y}}})});import{z as LL}from"zod";function yr4($,Z,X){return $!==null&&$.reviewer===Z&&$.cycleAt.getTime()===X}function gr4($,Z){return z81($).get(Z)==="changes_requested"}var x71;var Kx8=w(()=>{n0();g9();CK();AY();R9();JF();ya();yH();H71();ka();DK();x71=m({name:"TASK_BOARD_REVIEW_DECISION",description:"Record a reviewer's decision for a task under review. `approve` marks the pull request approved by that reviewer (and, once EVERY enabled reviewer has approved, merges it when the org enabled auto-merge, advancing the task to Done); `request_changes` hands the task back to the Super Agent with your notes so it can fix the PR.",annotations:{title:"Review Decision",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0},inputSchema:LL.object({taskBoardItemId:LL.string(),reviewer:LL.enum(["qa","code_review"]).describe("Which reviewer you are: `qa` (QA Agent) or `code_review` (Code Reviewer)."),reviewToken:LL.string().optional().describe("The reviewToken from your prompt \u2014 proves you are this reviewer. "+"Pass it through exactly; an approval without a valid token is recorded but does NOT count toward an automatic merge."),decision:LL.enum(["approve","request_changes"]),notes:LL.string().min(1).describe("For approve: a short summary of what you verified. For request_changes: specific, actionable feedback the Super Agent must address.")}),outputSchema:LL.object({status:SK,merged:LL.boolean().describe("True when this approval completed the review and merged the PR.")}),handler:async({taskBoardItemId:$,reviewer:Z,reviewToken:X,decision:Q,notes:Y},G)=>{G0(G),await G.access.check();let J=G.organization?.id;if(!J)throw Error("Organization ID required (no active organization in context)");let K=await G.storage.taskBoard.getById($,J);if(!K)throw Error(`Task board item not found: ${$}`);let W=X?bU(await G.storage.taskBoard.listActivity($,J)):0,H=!!X&&(Sv8(X,$,Z,new Date(W))||yr4(await G.storage.taskBoard.resolveReviewClaimByToken($,X),Z,W));if(Q==="request_changes"){let j=await G.storage.taskBoard.listActivity($,J);if(gr4(j,Z))return{status:K.status,merged:!1};if(ZB8(j))return await w5(G,{taskBoardItemId:$,action:"review_changes_requested",actorId:null,data:{reviewer:Z,notes:Y,verified:H,bounceLimitReached:!0}}),await fH(G,K,`${P81} review bounces reached \u2014 the reviewer and the `+"Super Agent are not converging"),{status:(await G.storage.taskBoard.getById($,J)??K).status,merged:!1};let z=await G.storage.taskBoard.claimReviewChangesBounce($,J,K.updatedBy);if(await w5(G,{taskBoardItemId:$,action:"review_changes_requested",actorId:null,data:{reviewer:Z,notes:Y,verified:H}}),!z)return{status:(await G.storage.taskBoard.getById($,J)??K).status,merged:!1};C6(J,z);let P=await G.storage.taskBoard.listPrs($,J),A=await wL(G,J,P);return await NF(G,z,{feedback:`${Th[Z]}: ${Y}`,pr:A?{number:A.number,url:A.url}:void 0}).catch(async(I)=>{if(await zA0(G,z,I)){await G.storage.taskBoard.update(z.id,J,{status:"in_review"},"system").then((q)=>C6(J,q)).catch((q)=>console.error("[task-board] runs-exhausted status revert failed",q));return}if(I instanceof DX)throw I;console.error("[task-board] request_changes re-enqueue failed",I)}),{status:z.status,merged:!1}}if(await w5(G,{taskBoardItemId:$,action:"review_approved",actorId:null,data:{reviewer:Z,notes:Y,verified:H}}),!await ba(G,J,$)){let j=await G.storage.taskBoard.getById($,J)??K;return C6(J,j),{status:j.status,merged:!1}}let F=(await G.storage.organizationSettings.get(J))?.flags?.auto_merge===!0,B=await G.storage.taskBoard.hasHumanRejectedDone($,J),O=F&&!B,L=O?await fa(G,J,$):null;if(L?.merged===!0){let j=await G.storage.taskBoard.update($,J,{status:"done"},K.updatedBy);return await w5(G,{taskBoardItemId:$,action:"status_changed",actorId:null,data:{from:K.status,to:"done"}}),C6(J,j),{status:j.status,merged:!0}}let E=await G.storage.taskBoard.getById($,J)??K;if(O){let j=await G.storage.taskBoard.listPrs($,J),z=await wL(G,J,j);if(z?await _u(G,J,E,{pr:{number:z.number,url:z.url},conflict:_71(await xu(G,J,z),L)}).catch((A)=>{if(A instanceof DX)throw A;return console.error("[task-board] conflict auto-resolve failed",A),!1}):!1)return{status:(await G.storage.taskBoard.getById($,J)??E).status,merged:!1}}return C6(J,E),{status:E.status,merged:!1}}})});import{z as WT0}from"zod";function hr4($,Z,X){if($!=="in_review")return!1;return X.length===0||Pw(Z,X)}var f71;var Wx8=w(()=>{n0();g9();CK();AY();R9();ya();f71=m({name:"TASK_BOARD_PROMOTE_TO_PRODUCTION",description:"Ship a reviewed task: merge its open pull request and move the task to Done. Used by the board's 'Ship to production' button after the enabled reviewers approved, when auto-merge is off (a human does the final merge).",annotations:{title:"Ship to Production",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0},inputSchema:WT0.object({taskBoardItemId:WT0.string()}),outputSchema:WT0.object({status:SK,merged:WT0.boolean().describe("True when the PR was merged.")}),handler:async({taskBoardItemId:$},Z)=>{G0(Z),await Z.access.check();let X=Z.organization?.id;if(!X)throw Error("Organization ID required (no active organization in context)");let Q=await Z.storage.taskBoard.getById($,X);if(!Q)throw Error(`Task board item not found: ${$}`);let Y=await Z.storage.organizationSettings.get(X),G=fU(Y?.flags),J=await Z.storage.taskBoard.listActivity($,X);if(!hr4(Q.status,J,G))throw Error("Task is not ready to ship: it must be In Review with every enabled reviewer approved");if(!(await fa(Z,X,$,{allowPendingChecks:!0})).merged){let H=await Z.storage.taskBoard.getById($,X)??Q;return C6(X,H),{status:Q.status,merged:!1}}let W=await Z.storage.taskBoard.update($,X,{status:"done"},Q.updatedBy);if(Q.status!=="done")await w5(Z,{taskBoardItemId:$,action:"status_changed",actorId:null,data:{from:Q.status,to:"done"}});return C6(X,W),{status:W.status,merged:!0}}})});import{z as t3}from"zod";function Hx8($){if(!$)throw Error("Organization ID required (no active organization in context)");return $}var ur4,b71,y71;var Nx8=w(()=>{n0();ur4=t3.object({externalKey:t3.string(),dismissedBy:t3.string(),dismissedAt:t3.string()});b71=m({name:"TASK_BOARD_DISMISSED_LIST",description:"List the diagnostic findings this organization has dismissed by deleting their task board cards. The import skips these until they're restored.",annotations:{title:"List Dismissed Findings",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:t3.object({}),outputSchema:t3.object({findings:t3.array(ur4)}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=Hx8(Z.organization?.id);return{findings:await Z.storage.taskBoard.listDismissedFindings(X)}}}),y71=m({name:"TASK_BOARD_DISMISSED_RESTORE",description:"Un-dismiss diagnostic findings, returning their cards to the board. Omit externalKeys to restore every dismissed finding.",annotations:{title:"Restore Dismissed Findings",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:t3.object({externalKeys:t3.array(t3.string()).optional()}),outputSchema:t3.object({restored:t3.number()}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=Hx8(Z.organization?.id);return{restored:await Z.storage.taskBoard.restoreDismissedFindings(X,$.externalKeys)}}})});import{z as X5}from"zod";function HT0($){let Z=$.organization?.id;if(!Z)throw Error("Organization ID required (no active organization in context)");return Z}function lr4($,Z,X){return $.replace(cr4,(Q,Y,G,J)=>{let K=encodeURIComponent(`${Z}/${G}`);return`${Y}/api/${encodeURIComponent(X)}/fs/outputs/read?path=${K}${J}`})}var g71,h71,cr4,u71,c71,l71;var Ux8=w(()=>{n0();g9();LA0();Ku();g71=X5.object({id:X5.string(),taskBoardItemId:X5.string(),parentId:X5.string().nullable(),authorId:X5.string(),body:X5.string(),resolved:X5.boolean(),createdAt:X5.string(),updatedAt:X5.string()});h71=m({name:"TASK_BOARD_COMMENT_LIST",description:"List a task board item's comments (flat, oldest first; replies carry parentId).",annotations:{title:"List Task Comments",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:X5.object({taskBoardItemId:X5.string()}),outputSchema:X5.object({comments:X5.array(g71)}),handler:async($,Z)=>{return G0(Z),await Z.access.check(),{comments:await Z.storage.taskBoard.listComments($.taskBoardItemId,HT0(Z))}}}),cr4=/(!\[[^\]]*\]\()org\/output\/([^)\s]+)(\))/g;u71=m({name:"TASK_BOARD_COMMENT_CREATE",description:"Post a comment on a task board item, or a reply to one.",annotations:{title:"Create Task Comment",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},inputSchema:X5.object({taskBoardItemId:X5.string(),body:X5.string().trim().min(1),parentId:X5.string().nullish()}),outputSchema:X5.object({comment:g71}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=HT0(Z),Q=t_.getStore(),Y=Z.organization?.slug,G=Q?.threadId&&Y?lr4($.body,Q.threadId,Y):$.body,J=await Z.storage.taskBoard.createComment({taskBoardItemId:$.taskBoardItemId,organizationId:X,parentId:$.parentId??null,authorId:Q?G4:D1(Z),body:G});if(!J)throw Error("Task board item not found");return await WZ1(Z,{commentId:J.id,taskBoardItemId:J.taskBoardItemId,organizationId:X,authorLabel:Q?"Super Agent":Z.auth?.user?.name??Z.auth?.user?.email??"Studio",body:J.body}),{comment:J}}}),c71=m({name:"TASK_BOARD_COMMENT_UPDATE",description:"Edit your own comment's body, or resolve/unresolve a comment thread (root only, any org member may toggle it).",annotations:{title:"Update Task Comment",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:X5.object({id:X5.string(),body:X5.string().trim().min(1).optional(),resolved:X5.boolean().optional()}),outputSchema:X5.object({comment:g71}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=await Z.storage.taskBoard.updateComment({id:$.id,organizationId:HT0(Z),callerId:D1(Z),body:$.body,resolved:$.resolved});if(!X)throw Error("Comment not found, or you can only edit your own comments");return{comment:X}}}),l71=m({name:"TASK_BOARD_COMMENT_DELETE",description:"Delete your own comment. Deleting a thread root deletes its replies too.",annotations:{title:"Delete Task Comment",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:X5.object({id:X5.string()}),outputSchema:X5.object({success:X5.boolean()}),handler:async($,Z)=>{return G0(Z),await Z.access.check(),{success:await Z.storage.taskBoard.deleteComment($.id,HT0(Z),D1(Z))}}})});var Fx8=w(()=>{wq8();ov8();av8();sv8();ev8();yH();$x8();Jx8();Kx8();Wx8();AY();Nx8();Ux8()});import{z as FF}from"zod";var d71;var Bx8=w(()=>{n0();d71=m({name:"TAGS_LIST",description:"List all tags available in the organization.",annotations:{title:"List Tags",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:FF.object({}),outputSchema:FF.object({tags:FF.array(FF.object({id:FF.string(),organizationId:FF.string(),name:FF.string(),color:FF.string().nullable(),createdAt:FF.string().describe("ISO 8601 timestamp")}))}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=X0(Z);return{tags:(await Z.storage.tags.listOrgTags(X.id)).map((Y)=>({...Y,createdAt:Y.createdAt instanceof Date?Y.createdAt.toISOString():String(Y.createdAt)}))}}})});import{z as gH}from"zod";var m71;var Ox8=w(()=>{n0();m71=m({name:"TAGS_CREATE",description:"Create a new tag, usable on organization members and task board items.",annotations:{title:"Create Tag",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},inputSchema:gH.object({name:gH.string().min(1).max(50).describe("Tag name"),color:gH.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional().describe('Hex color the tag renders its dot with, e.g. "#3b82f6"')}),outputSchema:gH.object({tag:gH.object({id:gH.string(),organizationId:gH.string(),name:gH.string(),color:gH.string().nullable(),createdAt:gH.string().describe("ISO 8601 timestamp")})}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=X0(Z),Q=await Z.storage.tags.createTag(X.id,$.name,$.color);return{tag:{...Q,createdAt:Q.createdAt instanceof Date?Q.createdAt.toISOString():String(Q.createdAt)}}}})});import{z as NT0}from"zod";var i71;var wx8=w(()=>{n0();i71=m({name:"TAGS_DELETE",description:"Delete a tag and automatically remove it from all assigned members.",annotations:{title:"Delete Tag",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:NT0.object({tagId:NT0.string().describe("Tag ID to delete")}),outputSchema:NT0.object({success:NT0.boolean()}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=X0(Z),Q=await Z.storage.tags.getTag($.tagId);if(!Q)throw Error("Tag not found");if(Q.organizationId!==X.id)throw Error("Tag does not belong to this organization");return await Z.storage.tags.deleteTag($.tagId),{success:!0}}})});import{z as hH}from"zod";var n71;var Lx8=w(()=>{n0();n71=m({name:"MEMBER_TAGS_GET",description:"Get all tags currently assigned to a specific member.",annotations:{title:"Get Member Tags",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:hH.object({memberId:hH.string().describe("Member ID")}),outputSchema:hH.object({tags:hH.array(hH.object({id:hH.string(),organizationId:hH.string(),name:hH.string(),color:hH.string().nullable(),createdAt:hH.string().describe("ISO 8601 timestamp")}))}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=X0(Z);if(!await Z.storage.tags.verifyMemberOrg($.memberId,X.id))throw Error(`Member not found in this organization: ${$.memberId}`);return{tags:(await Z.storage.tags.getMemberTags($.memberId)).map((G)=>({...G,createdAt:G.createdAt instanceof Date?G.createdAt.toISOString():String(G.createdAt)}))}}})});import{z as o3}from"zod";var p71;var Dx8=w(()=>{n0();p71=m({name:"MEMBER_TAGS_SET",description:"Replace all tags on a member with the given set. Pass empty array to clear.",annotations:{title:"Set Member Tags",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!1},inputSchema:o3.object({memberId:o3.string().describe("Member ID"),tagIds:o3.array(o3.string()).describe("Array of tag IDs to assign")}),outputSchema:o3.object({success:o3.boolean(),tags:o3.array(o3.object({id:o3.string(),organizationId:o3.string(),name:o3.string(),createdAt:o3.string().describe("ISO 8601 timestamp")}))}),handler:async($,Z)=>{G0(Z),await Z.access.check();let X=X0(Z);if(!await Z.storage.tags.verifyMemberOrg($.memberId,X.id))throw Error(`Member not found in this organization: ${$.memberId}`);for(let G of $.tagIds){let J=await Z.storage.tags.getTag(G);if(!J)throw Error(`Tag not found: ${G}`);if(J.organizationId!==X.id)throw Error(`Tag does not belong to this organization: ${G}`)}return await Z.storage.tags.setMemberTags($.memberId,$.tagIds),{success:!0,tags:(await Z.storage.tags.getMemberTags($.memberId)).map((G)=>({...G,createdAt:G.createdAt instanceof Date?G.createdAt.toISOString():String(G.createdAt)}))}}})});var Ex8=w(()=>{Bx8();Ox8();wx8();Lx8();Dx8()});import{z as jx8}from"zod";function pr4($,Z){let X=$?.[Z];if(!X)return;return Object.entries(X).sort(([,Y],[,G])=>{let J=Math.max(0,...Object.values(Y).map((W)=>W.createdAt??0));return Math.max(0,...Object.values(G).map((W)=>W.createdAt??0))-J})[0]?.[0]}var ir4,nr4,t71;var zx8=w(()=>{h4();n0();Hv();GQ();ir4=jx8.object({data:SS8.describe("Data for the new thread (id is auto-generated if not provided)")}),nr4=jx8.object({item:CH.describe("The created thread entity")});t71=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:ir4,outputSchema:nr4,handler:async($,Z)=>{G0(Z);let X=X0(Z);await Z.access.check();let Q=D1(Z);if(!Q)throw Error("User ID required to create thread");let{data:Y}=$,G=Y.id??Q4("thrd"),K=(await $A0(Z.storage.virtualMcps,Y.virtual_mcp_id,X.id)).metadata,W=K?.githubRepo,H=null;if(W)H=Y.branch??pr4(K?.sandboxMap,Q)??GP0(YP0(Z.auth.user));let N=await Z.storage.threads.create({id:G,organization_id:X.id,title:Y.title,description:Y.description,virtual_mcp_id:Y.virtual_mcp_id,branch:H,created_by:Q,...Y.runtime?{metadata:{runtime:Y.runtime}}:{}});if(N.isNew)n1.capture({distinctId:Q,event:"chat_started",groups:{organization:X.id},properties:{organization_id:X.id,thread_id:G,has_title:!!$.data.title,created_via:"tool"}});return{item:m3(N)}}})});import{z as o71}from"zod";var tr4,or4,r71;var Px8=w(()=>{h4();n0();Hv();QA0();tr4=o71.object({id:o71.string().describe("ID of the thread to update"),data:CS8.describe("Partial thread data to update")}),or4=o71.object({item:CH.describe("The updated thread entity")}),r71=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:tr4,outputSchema:or4,handler:async($,Z)=>{G0(Z);let X=X0(Z);await Z.access.check();let Q=D1(Z);if(!Q)throw Error("User ID required to update thread");let{id:Y,data:G}=$,J=await Z.storage.threads.get(Y);if(!J)throw Error("Thread not found in organization");if(G.virtual_mcp_id!==void 0)await $A0(Z.storage.virtualMcps,G.virtual_mcp_id,X.id);if(G.branch===null&&J.virtual_mcp_id){if((await Z.storage.virtualMcps.findById(J.virtual_mcp_id,X.id))?.metadata?.githubRepo)throw Error("Cannot set branch=null on a github-linked thread (vMCP has githubRepo)")}let K={title:G.title,description:G.description,hidden:G.hidden,updated_by:Q};if(G.status)K.status=G.status;if(G.metadata!==void 0){let H=y91(J.metadata?.runtime);K.metadata=H?{...G.metadata,runtime:H}:G.metadata}if(G.branch!==void 0)K.branch=G.branch;if(G.virtual_mcp_id!==void 0)K.virtual_mcp_id=G.virtual_mcp_id;let W=await Z.storage.threads.update(Y,K);if(G.hidden!==void 0&&G.hidden!==J.hidden)n1.capture({distinctId:Q,event:G.hidden?"chat_archived":"chat_unarchived",groups:{organization:X.id},properties:{organization_id:X.id,thread_id:Y}});return{item:m3(W)}}})});var a71;var Ax8=w(()=>{V3();Hv();h4();n0();WF();KT0();Mu();a71=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:Do,outputSchema:Eo(CH),handler:async($,Z)=>{G0(Z);let X=X0(Z);await Z.access.check();let Q=await Z.storage.threads.get($.id);if(!Q)throw Error(`Thread not found: ${$.id}`);if(Q.status==="in_progress"){let G=(K)=>(W)=>console.error("[thread] delete-time run cancel step failed",{threadId:$.id,step:K,err:W});await qu($.id).catch(G("background-jobs")),await fu($.id).catch(G("gate-head"));let J=await Z.storage.threads.getRunFence($.id).catch(()=>null);if(J)await zv($.id,J).catch(G("hosted-harness"));GT0($.id)}await Z.storage.threads.delete($.id);let Y=D1(Z);if(Y)n1.capture({distinctId:Y,event:"chat_deleted",groups:{organization:X.id},properties:{organization_id:X.id,thread_id:$.id}});return{item:m3(Q)}}})});var Tx8=w(()=>{zx8();g91();h91();Px8();Ax8();u91()});function ar4($){return{type:"doc",content:[{type:"paragraph",content:[{type:"text",text:$}]}]}}function sr4($){return $.map((Z)=>{let X=Z.metadata;if(X?.tiptapDoc)return Z;let Q=Z.parts.find((Y)=>Y.type==="text"&&typeof Y.text==="string");if(!Q?.text||typeof Q.text!=="string")return Z;return{...Z,metadata:{...X,tiptapDoc:ar4(Q.text)}}})}function UT0($){let Z;if(typeof $==="string")try{let X=JSON.parse($);if(Array.isArray(X)&&X.length>0&&X[0]?.role&&Array.isArray(X[0]?.parts))Z=X;else Z=[{role:"user",parts:[{type:"text",text:$}]}]}catch{Z=[{role:"user",parts:[{type:"text",text:$}]}]}else Z=$;return sr4(Z)}import{z as Q5}from"zod";var s71;var Rx8=w(()=>{h4();n0();QY();s71=m({name:"AUTOMATION_CREATE",description:"Create an automation that runs an agent thread on trigger fire. Requires virtual_mcp_id + messages.",annotations:{title:"Create Automation",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},inputSchema:Q5.object({name:Q5.string().min(1).max(255),virtual_mcp_id:Q5.string(),messages:Q5.union([Q5.string(),Q5.array(Q5.looseObject({id:Q5.string().optional(),role:Q5.enum(["user","assistant","system"]),parts:Q5.array(Q5.record(Q5.string(),Q5.unknown())),metadata:Q5.unknown().optional()}))]),models:Q5.object({tier:Dw,modelId:Q5.string().optional(),credentialId:Q5.string().optional()}).loose().default({tier:"smart"}),tools:Q5.array(Q5.string()).nullable().optional(),maxAgentSteps:Q5.number().int().min(1).max(100).nullable().optional(),temperature:Q5.number().default(0.5),active:Q5.boolean().default(!0)}),outputSchema:Q5.object({id:Q5.string(),name:Q5.string(),active:Q5.boolean(),created_at:Q5.string()}),handler:async($,Z)=>{G0(Z);let X=X0(Z);await Z.access.check();let Q=D1(Z);if(!Q)throw Error("Unable to determine user identity");let Y=UT0($.messages),G=await Z.storage.automations.create({organization_id:X.id,created_by:Q,name:$.name,messages:JSON.stringify(Y),models:JSON.stringify($.models),tools:$.tools===void 0||$.tools===null?null:JSON.stringify($.tools),max_agent_steps:$.maxAgentSteps??null,temperature:$.temperature,active:$.active,virtual_mcp_id:$.virtual_mcp_id});return n1.capture({distinctId:Q,event:"automation_created",groups:{organization:X.id},properties:{organization_id:X.id,automation_id:G.id,virtual_mcp_id:$.virtual_mcp_id,active:G.active,tier:$.models.tier}}),{id:G.id,name:G.name,active:G.active,created_at:G.created_at}}})});import{z as i$}from"zod";var e71;var Ix8=w(()=>{n0();e71=m({name:"AUTOMATION_GET",description:"Get an automation's full configuration and triggers by ID.",annotations:{title:"Get Automation",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:i$.object({id:i$.string()}),outputSchema:i$.object({automation:i$.object({id:i$.string(),name:i$.string(),active:i$.boolean(),created_by:i$.string(),created_at:i$.string(),updated_at:i$.string(),virtual_mcp_id:i$.string(),messages:i$.unknown(),models:i$.unknown(),tools:i$.array(i$.string()).nullable(),maxAgentSteps:i$.number().nullable(),temperature:i$.number(),triggers:i$.array(i$.object({id:i$.string(),type:i$.enum(["cron","event","webhook"]),cron_expression:i$.string().nullable(),connection_id:i$.string().nullable(),event_type:i$.string().nullable(),params:i$.unknown().nullable(),last_run_at:i$.string().nullable(),api_key_id:i$.string().nullable(),created_at:i$.string()}))}).nullable()}),handler:async($,Z)=>{G0(Z);let X=X0(Z);await Z.access.check();let Q=await Z.storage.automations.findById($.id,X.id);if(!Q)return{automation:null};let Y=await Z.storage.automations.listTriggers(Q.id);return{automation:{id:Q.id,name:Q.name,active:Q.active,created_by:Q.created_by,created_at:Q.created_at,updated_at:Q.updated_at,virtual_mcp_id:Q.virtual_mcp_id,messages:JSON.parse(Q.messages),models:JSON.parse(Q.models),tools:Q.tools?JSON.parse(Q.tools):null,maxAgentSteps:Q.max_agent_steps,temperature:Q.temperature,triggers:Y.map((G)=>({id:G.id,type:G.type,cron_expression:G.cron_expression,connection_id:G.connection_id,event_type:G.event_type,params:G.params?JSON.parse(G.params):null,last_run_at:G.last_run_at,api_key_id:G.api_key_id,created_at:G.created_at}))}}}})});import{z as SG}from"zod";var $X1;var qx8=w(()=>{n0();$X1=m({name:"AUTOMATION_LIST",description:"List automations with their status, triggers, and configuration.",annotations:{title:"List Automations",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},inputSchema:SG.object({virtual_mcp_id:SG.string().optional().nullable()}),outputSchema:SG.object({automations:SG.array(SG.object({id:SG.string(),name:SG.string(),active:SG.boolean(),created_by:SG.string(),created_at:SG.string(),trigger_count:SG.number(),nearest_next_run_at:SG.string().nullable(),virtual_mcp_id:SG.string()}))}),handler:async($,Z)=>{G0(Z);let X=X0(Z);return await Z.access.check(),{automations:(await Z.storage.automations.listWithTriggerCounts(X.id,$.virtual_mcp_id)).map((G)=>({id:G.id,name:G.name,active:G.active,created_by:G.created_by,created_at:G.created_at,trigger_count:G.trigger_count,nearest_next_run_at:G.nearest_next_run_at,virtual_mcp_id:G.virtual_mcp_id}))}}})});function $a4($){if(!$)return null;try{let Z=JSON.parse($);if(Array.isArray(Z)&&Z.every((X)=>typeof X==="string"))return Z.length>0?Z:null}catch{}return null}function Mx8($){return`${$}:context`}function Vx8($,Z,X,Q,Y){let J=JSON.parse($.messages).map((H,N)=>({...H,id:`${X}:${N}`})),K=Z?{...Y,[OP0]:er4}:Y;return{messages:J,models:{credentialId:Q.credentialId,thinking:Q.thinking,...Q.image?{image:Q.image}:{},...Q.webSearch?{webSearch:Q.webSearch}:{},...Q.deepResearch?{deepResearch:Q.deepResearch}:{}},agent:{id:$.virtual_mcp_id},toolAllowlist:$a4($.tools),maxAgentSteps:$.max_agent_steps??void 0,temperature:$.temperature??0.5,toolApprovalLevel:"auto",mode:"default",organizationId:$.organization_id,userId:$.created_by,harnessId:"decopilot",sandboxProviderKind:"agent-sandbox",triggerId:Z??void 0,...K?{runMetadata:K}:{},taskId:X}}var er4="new_task";var kx8=w(()=>{tr()});function SX($,Z,X,Q,Y,G,J,K){return SX.fromTZ(SX.tp($,Z,X,Q,Y,G,J),K)}function ZX1($,Z=new Date){let X=Z.toLocaleString("en-US",{timeZone:$,timeZoneName:"shortOffset"}).split(" ").slice(-1)[0],Q=Z.toLocaleString("en-US").replace(/[\u202f]/," ");return Date.parse(`${Q} GMT`)-Date.parse(`${Q} ${X}`)}function Za4($,Z){let X=new Date(Date.parse($));if(isNaN(X))throw Error("minitz: Invalid ISO8601 passed to parser.");let Q=$.substring(9);return $.includes("Z")||Q.includes("-")||Q.includes("+")?SX.tp(X.getUTCFullYear(),X.getUTCMonth()+1,X.getUTCDate(),X.getUTCHours(),X.getUTCMinutes(),X.getUTCSeconds(),"Etc/UTC"):SX.tp(X.getFullYear(),X.getMonth()+1,X.getDate(),X.getHours(),X.getMinutes(),X.getSeconds(),Z)}function Xa4($){if($===void 0&&($={}),delete $.name,$.legacyMode=$.legacyMode===void 0?!0:$.legacyMode,$.paused=$.paused===void 0?!1:$.paused,$.maxRuns=$.maxRuns===void 0?1/0:$.maxRuns,$.catch=$.catch===void 0?!1:$.catch,$.interval=$.interval===void 0?0:parseInt($.interval.toString(),10),$.utcOffset=$.utcOffset===void 0?void 0:parseInt($.utcOffset.toString(),10),$.unref=$.unref===void 0?!1:$.unref,$.startAt&&($.startAt=new r3($.startAt,$.timezone)),$.stopAt&&($.stopAt=new r3($.stopAt,$.timezone)),$.interval!==null){if(isNaN($.interval))throw Error("CronOptions: Supplied value for interval is not a number");if($.interval<0)throw Error("CronOptions: Supplied value for interval can not be negative")}if($.utcOffset!==void 0){if(isNaN($.utcOffset))throw Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");if($.utcOffset<-870||$.utcOffset>870)throw Error("CronOptions: utcOffset out of bounds.");if($.utcOffset!==void 0&&$.timezone)throw Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.")}if($.unref!==!0&&$.unref!==!1)throw Error("CronOptions: Unref should be either true, false or undefined(false).");return $}function ga($){return Object.prototype.toString.call($)==="[object Function]"||typeof $=="function"||$ instanceof Function}function Qa4($){return ga($)}function Ya4($){typeof Deno<"u"&&typeof Deno.unrefTimer<"u"?Deno.unrefTimer($):$&&typeof $.unref<"u"&&$.unref()}var XX1=32,ha,vx8,Sx8=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor($,Z){this.pattern=$,this.timezone=Z,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern=="string"||this.pattern instanceof String))throw TypeError("CronPattern: Pattern has to be of type string.");this.pattern.indexOf("@")>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let $=this.pattern.replace(/\s+/g," ").split(" ");if($.length<5||$.length>6)throw TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exactly five or six space separated parts are required.");if($.length===5&&$.unshift("0"),$[3].indexOf("L")>=0&&($[3]=$[3].replace("L",""),this.lastDayOfMonth=!0),$[3]=="*"&&(this.starDOM=!0),$[4].length>=3&&($[4]=this.replaceAlphaMonths($[4])),$[5].length>=3&&($[5]=this.replaceAlphaDays($[5])),$[5]=="*"&&(this.starDOW=!0),this.pattern.indexOf("?")>=0){let Z=new r3(new Date,this.timezone).getDate(!0);$[0]=$[0].replace("?",Z.getSeconds().toString()),$[1]=$[1].replace("?",Z.getMinutes().toString()),$[2]=$[2].replace("?",Z.getHours().toString()),this.starDOM||($[3]=$[3].replace("?",Z.getDate().toString())),$[4]=$[4].replace("?",(Z.getMonth()+1).toString()),this.starDOW||($[5]=$[5].replace("?",Z.getDay().toString()))}this.throwAtIllegalCharacters($),this.partToArray("second",$[0],0,1),this.partToArray("minute",$[1],0,1),this.partToArray("hour",$[2],0,1),this.partToArray("day",$[3],-1,1),this.partToArray("month",$[4],-1,1),this.partToArray("dayOfWeek",$[5],0,ha),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray($,Z,X,Q){let Y=this[$],G=$==="day"&&this.lastDayOfMonth;if(Z===""&&!G)throw TypeError("CronPattern: configuration entry "+$+" ("+Z+") is empty, check for trailing spaces.");if(Z==="*")return Y.fill(Q);let J=Z.split(",");if(J.length>1)for(let K=0;K<J.length;K++)this.partToArray($,J[K],X,Q);else Z.indexOf("-")!==-1&&Z.indexOf("/")!==-1?this.handleRangeWithStepping(Z,$,X,Q):Z.indexOf("-")!==-1?this.handleRange(Z,$,X,Q):Z.indexOf("/")!==-1?this.handleStepping(Z,$,X,Q):Z!==""&&this.handleNumber(Z,$,X,Q)}throwAtIllegalCharacters($){for(let Z=0;Z<$.length;Z++)if((Z===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test($[Z]))throw TypeError("CronPattern: configuration entry "+Z+" ("+$[Z]+") contains illegal characters.")}handleNumber($,Z,X,Q){let Y=this.extractNth($,Z),G=parseInt(Y[0],10)+X;if(isNaN(G))throw TypeError("CronPattern: "+Z+" is not a number: '"+$+"'");this.setPart(Z,G,Y[1]||Q)}setPart($,Z,X){if(!Object.prototype.hasOwnProperty.call(this,$))throw TypeError("CronPattern: Invalid part specified: "+$);if($==="dayOfWeek"){if(Z===7&&(Z=0),Z<0||Z>6)throw RangeError("CronPattern: Invalid value for dayOfWeek: "+Z);this.setNthWeekdayOfMonth(Z,X);return}if($==="second"||$==="minute"){if(Z<0||Z>=60)throw RangeError("CronPattern: Invalid value for "+$+": "+Z)}else if($==="hour"){if(Z<0||Z>=24)throw RangeError("CronPattern: Invalid value for "+$+": "+Z)}else if($==="day"){if(Z<0||Z>=31)throw RangeError("CronPattern: Invalid value for "+$+": "+Z)}else if($==="month"&&(Z<0||Z>=12))throw RangeError("CronPattern: Invalid value for "+$+": "+Z);this[$][Z]=X}handleRangeWithStepping($,Z,X,Q){let Y=this.extractNth($,Z),G=Y[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(G===null)throw TypeError("CronPattern: Syntax error, illegal range with stepping: '"+$+"'");let[,J,K,W]=G,H=parseInt(J,10)+X,N=parseInt(K,10)+X,U=parseInt(W,10);if(isNaN(H))throw TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(N))throw TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(isNaN(U))throw TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(U===0)throw TypeError("CronPattern: Syntax error, illegal stepping: 0");if(U>this[Z].length)throw TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[Z].length+")");if(H>N)throw TypeError("CronPattern: From value is larger than to value: '"+$+"'");for(let F=H;F<=N;F+=U)this.setPart(Z,F,Y[1]||Q)}extractNth($,Z){let X=$,Q;if(X.includes("#")){if(Z!=="dayOfWeek")throw Error("CronPattern: nth (#) only allowed in day-of-week field");Q=X.split("#")[1],X=X.split("#")[0]}return[X,Q]}handleRange($,Z,X,Q){let Y=this.extractNth($,Z),G=Y[0].split("-");if(G.length!==2)throw TypeError("CronPattern: Syntax error, illegal range: '"+$+"'");let J=parseInt(G[0],10)+X,K=parseInt(G[1],10)+X;if(isNaN(J))throw TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(K))throw TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(J>K)throw TypeError("CronPattern: From value is larger than to value: '"+$+"'");for(let W=J;W<=K;W++)this.setPart(Z,W,Y[1]||Q)}handleStepping($,Z,X,Q){let Y=this.extractNth($,Z),G=Y[0].split("/");if(G.length!==2)throw TypeError("CronPattern: Syntax error, illegal stepping: '"+$+"'");G[0]===""&&(G[0]="*");let J=0;G[0]!=="*"&&(J=parseInt(G[0],10)+X);let K=parseInt(G[1],10);if(isNaN(K))throw TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(K===0)throw TypeError("CronPattern: Syntax error, illegal stepping: 0");if(K>this[Z].length)throw TypeError("CronPattern: Syntax error, max steps for part is ("+this[Z].length+")");for(let W=J;W<this[Z].length;W+=K)this.setPart(Z,W,Y[1]||Q)}replaceAlphaDays($){return $.replace(/-sun/gi,"-7").replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")}replaceAlphaMonths($){return $.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")}handleNicknames($){let Z=$.trim().toLowerCase();return Z==="@yearly"||Z==="@annually"?"0 0 1 1 *":Z==="@monthly"?"0 0 1 * *":Z==="@weekly"?"0 0 * * 0":Z==="@daily"?"0 0 * * *":Z==="@hourly"?"0 * * * *":$}setNthWeekdayOfMonth($,Z){if(typeof Z!="number"&&Z==="L")this.dayOfWeek[$]=this.dayOfWeek[$]|XX1;else if(Z===ha)this.dayOfWeek[$]=ha;else if(Z<6&&Z>0)this.dayOfWeek[$]=this.dayOfWeek[$]|vx8[Z-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${Z}, Type: ${typeof Z}`)}},Cx8,BF,r3=class ${tz;ms;second;minute;hour;day;month;year;constructor(Z,X){if(this.tz=X,Z&&Z instanceof Date)if(!isNaN(Z))this.fromDate(Z);else throw TypeError("CronDate: Invalid date passed to CronDate constructor");else if(Z===void 0)this.fromDate(new Date);else if(Z&&typeof Z=="string")this.fromString(Z);else if(Z instanceof $)this.fromCronDate(Z);else throw TypeError("CronDate: Invalid type ("+typeof Z+") passed to CronDate constructor")}isNthWeekdayOfMonth(Z,X,Q,Y){let G=new Date(Date.UTC(Z,X,Q)).getUTCDay(),J=0;for(let K=1;K<=Q;K++)new Date(Date.UTC(Z,X,K)).getUTCDay()===G&&J++;if(Y&ha&&vx8[J-1]&Y)return!0;if(Y&XX1){let K=new Date(Date.UTC(Z,X+1,0)).getUTCDate();for(let W=Q+1;W<=K;W++)if(new Date(Date.UTC(Z,X,W)).getUTCDay()===G)return!1;return!0}return!1}fromDate(Z){if(this.tz!==void 0)if(typeof this.tz=="number")this.ms=Z.getUTCMilliseconds(),this.second=Z.getUTCSeconds(),this.minute=Z.getUTCMinutes()+this.tz,this.hour=Z.getUTCHours(),this.day=Z.getUTCDate(),this.month=Z.getUTCMonth(),this.year=Z.getUTCFullYear(),this.apply();else{let X=SX.toTZ(Z,this.tz);this.ms=Z.getMilliseconds(),this.second=X.s,this.minute=X.i,this.hour=X.h,this.day=X.d,this.month=X.m-1,this.year=X.y}else this.ms=Z.getMilliseconds(),this.second=Z.getSeconds(),this.minute=Z.getMinutes(),this.hour=Z.getHours(),this.day=Z.getDate(),this.month=Z.getMonth(),this.year=Z.getFullYear()}fromCronDate(Z){this.tz=Z.tz,this.year=Z.year,this.month=Z.month,this.day=Z.day,this.hour=Z.hour,this.minute=Z.minute,this.second=Z.second,this.ms=Z.ms}apply(){if(this.month>11||this.day>Cx8[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let Z=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=Z.getUTCMilliseconds(),this.second=Z.getUTCSeconds(),this.minute=Z.getUTCMinutes(),this.hour=Z.getUTCHours(),this.day=Z.getUTCDate(),this.month=Z.getUTCMonth(),this.year=Z.getUTCFullYear(),!0}else return!1}fromString(Z){if(typeof this.tz=="number"){let X=SX.fromTZISO(Z);this.ms=X.getUTCMilliseconds(),this.second=X.getUTCSeconds(),this.minute=X.getUTCMinutes(),this.hour=X.getUTCHours(),this.day=X.getUTCDate(),this.month=X.getUTCMonth(),this.year=X.getUTCFullYear(),this.apply()}else return this.fromDate(SX.fromTZISO(Z,this.tz))}findNext(Z,X,Q,Y){let G=this[X],J;Q.lastDayOfMonth&&(this.month!==1?J=Cx8[this.month]:J=new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate());let K=!Q.starDOW&&X=="day"?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let W=this[X]+Y;W<Q[X].length;W++){let H=Q[X][W];if(X==="day"&&Q.lastDayOfMonth&&W-Y==J&&(H=1),X==="day"&&!Q.starDOW){let N=Q.dayOfWeek[(K+(W-Y-1))%7];if(N&&N&ha)N=this.isNthWeekdayOfMonth(this.year,this.month,W-Y,N)?1:0;else if(N)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${N}`);Z.legacyMode&&!Q.starDOM?H=H||N:H=H&&N}if(H)return this[X]=W-Y,G!==this[X]?2:1}return 3}recurse(Z,X,Q){let Y=this.findNext(X,BF[Q][0],Z,BF[Q][2]);if(Y>1){let G=Q+1;for(;G<BF.length;)this[BF[G][0]]=-BF[G][2],G++;if(Y===3)return this[BF[Q][1]]++,this[BF[Q][0]]=-BF[Q][2],this.apply(),this.recurse(Z,X,0);if(this.apply())return this.recurse(Z,X,Q-1)}return Q+=1,Q>=BF.length?this:this.year>=3000?null:this.recurse(Z,X,Q)}increment(Z,X,Q){return this.second+=X.interval!==void 0&&X.interval>1&&Q?X.interval:1,this.ms=0,this.apply(),this.recurse(Z,X,0)}getDate(Z){return Z||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz=="number"?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):SX.fromTZ(SX.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}},_x8=30000,FT0,BT0=class{name;options;_states;fn;constructor($,Z,X){let Q,Y;if(ga(Z))Y=Z;else if(typeof Z=="object")Q=Z;else if(Z!==void 0)throw Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");if(ga(X))Y=X;else if(typeof X=="object")Q=X;else if(X!==void 0)throw Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");if(this.name=Q?.name,this.options=Xa4(Q),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:Q?Q.maxRuns:void 0,paused:Q?Q.paused:!1,pattern:new Sx8("* * * * *")},$&&($ instanceof Date||typeof $=="string"&&$.indexOf(":")>0)?this._states.once=new r3($,this.options.timezone||this.options.utcOffset):this._states.pattern=new Sx8($,this.options.timezone),this.name){if(FT0.find((G)=>G.name===this.name))throw Error("Cron: Tried to initialize new named job '"+this.name+"', but name already taken.");FT0.push(this)}return Y!==void 0&&Qa4(Y)&&(this.fn=Y,this.schedule()),this}nextRun($){let Z=this._next($);return Z?Z.getDate(!1):null}nextRuns($,Z){this._states.maxRuns!==void 0&&$>this._states.maxRuns&&($=this._states.maxRuns);let X=[],Q=Z||this._states.currentRun||void 0;for(;$--&&(Q=this.nextRun(Q));)X.push(Q);return X}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let $=this.nextRun(this._states.currentRun),Z=!this._states.paused,X=this.fn!==void 0,Q=!this._states.kill;return Z&&X&&Q&&$!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext($){let Z=this._next($);return Z?$ instanceof r3||$ instanceof Date?Z.getTime()-$.getTime():Z.getTime()-new r3($).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let $=FT0.indexOf(this);$>=0&&FT0.splice($,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule($){if($&&this.fn)throw Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");$&&(this.fn=$);let Z=this.msToNext(),X=this.nextRun(this._states.currentRun);return Z==null||isNaN(Z)||X===null?this:(Z>_x8&&(Z=_x8),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(X),Z),this._states.currentTimeout&&this.options.unref&&Ya4(this._states.currentTimeout),this)}async _trigger($){if(this._states.blocking=!0,this._states.currentRun=new r3(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(Z){ga(this.options.catch)&&this.options.catch(Z,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new r3($,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger($){let Z=new Date,X=!this._states.paused&&Z.getTime()>=$.getTime(),Q=this._states.blocking&&this.options.protect;X&&!Q?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):X&&Q&&ga(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next($){let Z=!!($||this._states.currentRun),X=!1;!$&&this.options.startAt&&this.options.interval&&([$,Z]=this._calculatePreviousRun($,Z),X=!$),$=new r3($,this.options.timezone||this.options.utcOffset),this.options.startAt&&$&&$.getTime()<this.options.startAt.getTime()&&($=this.options.startAt);let Q=this._states.once||new r3($,this.options.timezone||this.options.utcOffset);return!X&&Q!==this._states.once&&(Q=Q.increment(this._states.pattern,this.options,Z)),this._states.once&&this._states.once.getTime()<=$.getTime()||Q===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&Q.getTime()>=this.options.stopAt.getTime()?null:Q}_calculatePreviousRun($,Z){let X=new r3(void 0,this.options.timezone||this.options.utcOffset),Q=$;if(this.options.startAt.getTime()<=X.getTime()){Q=this.options.startAt;let Y=Q.getTime()+this.options.interval*1000;for(;Y<=X.getTime();)Q=new r3(Q,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),Y=Q.getTime()+this.options.interval*1000;Z=!0}return Q===null&&(Q=void 0),[Q,Z]}};var QX1=w(()=>{SX.fromTZISO=($,Z,X)=>SX.fromTZ(Za4($,Z),X);SX.fromTZ=function($,Z){let X=new Date(Date.UTC($.y,$.m-1,$.d,$.h,$.i,$.s)),Q=ZX1($.tz,X),Y=new Date(X.getTime()-Q),G=ZX1($.tz,Y);if(G-Q===0)return Y;{let J=new Date(X.getTime()-G),K=ZX1($.tz,J);if(K-G===0)return J;if(!Z&&K-G>0)return J;if(Z)throw Error("Invalid date passed to fromTZ()");return Y}};SX.toTZ=function($,Z){let X=$.toLocaleString("en-US",{timeZone:Z}).replace(/[\u202f]/," "),Q=new Date(X);return{y:Q.getFullYear(),m:Q.getMonth()+1,d:Q.getDate(),h:Q.getHours(),i:Q.getMinutes(),s:Q.getSeconds(),tz:Z}};SX.tp=($,Z,X,Q,Y,G,J)=>({y:$,m:Z,d:X,h:Q,i:Y,s:G,tz:J});SX.minitz=SX;ha=31|XX1,vx8=[1,2,4,8,16],Cx8=[31,28,31,30,31,30,31,31,30,31,30,31],BF=[["month","year",0],["day","month",-1],["hour","day",0],["minute","hour",0],["second","minute",0]];FT0=[]});function OT0($,Z){try{return new BT0($,{timezone:"UTC"}).nextRun(Z)??null}catch{return null}}var YX1=w(()=>{QX1()});import{DBOS as _7,SchedulerMode as Ga4}from"@dbos-inc/dbos-sdk";async function HX1($){try{let{rows:Z}=await $.query(`SELECT q.name FROM dbos.queues q
2866
2866
  WHERE q.name LIKE $1
2867
2867
  AND NOT EXISTS (
2868
2868
  SELECT 1 FROM dbos.workflow_status w