decocms 4.245.4 → 4.246.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/dist/client/assets/{AlertCircle-DL1CP1hy.js → AlertCircle-CVPo0qEm.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CYhcBp2n.js → AreaChart-ChVNju8m.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-DK8zcE-P.js → ArrowLeft-CUw2oDuz.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-O7-j4Kzy.js → ArrowUp-Tf9X-9eZ.js} +1 -1
  5. package/dist/client/assets/{ArrowUpRight-BVdzIoIc.js → ArrowUpRight-CWFkobB4.js} +1 -1
  6. package/dist/client/assets/{Check-DExpXoeZ.js → Check-D_7f8Wel.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-JEKJY3AR.js → CheckCircle-CEGfcpsW.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-Dr72eRtC.js → ChevronDown-Bg-1Juk5.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-B9ZA_kXM.js → ChevronRight-CLyRbaUU.js} +1 -1
  10. package/dist/client/assets/{ChevronSelectorVertical-CPSw060y.js → ChevronSelectorVertical-Dz9WarkK.js} +1 -1
  11. package/dist/client/assets/{ChevronUp-CJuVoP_H.js → ChevronUp-BqRX9ZFE.js} +1 -1
  12. package/dist/client/assets/{Copy01-zCwt0G1u.js → Copy01-Bwkkomxj.js} +1 -1
  13. package/dist/client/assets/{CreditCard01-CPnF0kPW.js → CreditCard01-ygPw-EKC.js} +1 -1
  14. package/dist/client/assets/{DotsVertical-DWSyrznd.js → DotsVertical-CHA2avQZ.js} +1 -1
  15. package/dist/client/assets/{Download01-_kWGFF2R.js → Download01-CmXY93tt.js} +1 -1
  16. package/dist/client/assets/{Eye-EX4w3-JJ.js → Eye-CEo3fQQh.js} +1 -1
  17. package/dist/client/assets/{FilterLines-D7tmy7VI.js → FilterLines-BbuCX0gh.js} +1 -1
  18. package/dist/client/assets/{Globe01-D59ZIidh.js → Globe01-DDOmP6mo.js} +1 -1
  19. package/dist/client/assets/{Globe04-Bqbezsix.js → Globe04-Cfd8Rd9g.js} +1 -1
  20. package/dist/client/assets/{HardDrive-CrDFw6-C.js → HardDrive-DfEb0Y6k.js} +1 -1
  21. package/dist/client/assets/{Key01-i0P60pua.js → Key01-BW9ldI4y.js} +1 -1
  22. package/dist/client/assets/{LayoutLeft-yR2O4lcC.js → LayoutLeft-BmDj8huh.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-BoR9I2q2.js → LinkExternal01-i7PYdGoV.js} +1 -1
  24. package/dist/client/assets/{LockUnlocked01-JkxWJcVa.js → LockUnlocked01-BVZ6q8T0.js} +1 -1
  25. package/dist/client/assets/{LogOut01-BR5P77Eq.js → LogOut01-C7qNJNUJ.js} +1 -1
  26. package/dist/client/assets/{Monitor01-DQBHxIhU.js → Monitor01-CoRTt5aG.js} +1 -1
  27. package/dist/client/assets/{Palette-Ck8Zugmc.js → Palette-DfKiT9du.js} +1 -1
  28. package/dist/client/assets/{Play-B2JN4tOi.js → Play-DdLA8Y7E.js} +1 -1
  29. package/dist/client/assets/{Plus-DBIW8BmC.js → Plus-C_NskSm6.js} +1 -1
  30. package/dist/client/assets/{SearchLg-Cg_qg2uT.js → SearchLg-mKc3T504.js} +1 -1
  31. package/dist/client/assets/{SearchMd-CDtyRISc.js → SearchMd-CGhMwkV3.js} +1 -1
  32. package/dist/client/assets/{Settings02-CixZsBne.js → Settings02-BSpuV9Fn.js} +1 -1
  33. package/dist/client/assets/{Share07-sN97eq8b.js → Share07-TZt-qDi6.js} +1 -1
  34. package/dist/client/assets/{Shield01-DO0FlFWx.js → Shield01-D5T84I2m.js} +1 -1
  35. package/dist/client/assets/{Stars01-BEghjgKF.js → Stars01-BPtc2LR_.js} +1 -1
  36. package/dist/client/assets/{Stars02-Cf7pycCj.js → Stars02-C1dUyp2n.js} +1 -1
  37. package/dist/client/assets/{Sun-CGI6h2sV.js → Sun-F2AiKbgs.js} +1 -1
  38. package/dist/client/assets/{SwitchHorizontal01-CqLck4PK.js → SwitchHorizontal01-o0AhqUK3.js} +1 -1
  39. package/dist/client/assets/{Tool01-Q74WMKFI.js → Tool01-C7JK84AW.js} +1 -1
  40. package/dist/client/assets/{Tool02-COUcw3ab.js → Tool02-BD0oj0Z6.js} +1 -1
  41. package/dist/client/assets/{Trash01-fndrO3VF.js → Trash01-BDJfIYOv.js} +1 -1
  42. package/dist/client/assets/{TrendUp01-cGf0wL6U.js → TrendUp01-DE-6F3ol.js} +1 -1
  43. package/dist/client/assets/{Upload01-CoOUkNK-.js → Upload01-FJqJWa79.js} +1 -1
  44. package/dist/client/assets/{User01-z75QOIvz.js → User01-CuvMZdbR.js} +1 -1
  45. package/dist/client/assets/{Users01-D0pT6-I6.js → Users01-By8YR5pB.js} +1 -1
  46. package/dist/client/assets/{Users03-DEW0AZzB.js → Users03-nzSyOTiI.js} +1 -1
  47. package/dist/client/assets/{X-BnVnruz7.js → X-Bjbq04_M.js} +1 -1
  48. package/dist/client/assets/{XCircle-B-K-NMeg.js → XCircle-C74a-_sm.js} +1 -1
  49. package/dist/client/assets/{XClose-Ct6f5P2W.js → XClose-eOvoOXbJ.js} +1 -1
  50. package/dist/client/assets/{YAxis-D3lV6IEm.js → YAxis-BzEpT0hC.js} +1 -1
  51. package/dist/client/assets/{Zap-C1t0MYbg.js → Zap-CLxSKLFj.js} +1 -1
  52. package/dist/client/assets/{ZapSquare-D_Z9NIao.js → ZapSquare-BO2oEmgN.js} +1 -1
  53. package/dist/client/assets/{access-gate-DKSn70ns.js → access-gate-BN2QeuZr.js} +1 -1
  54. package/dist/client/assets/{agent-icon-N10iH1xS.js → agent-icon-BZ_a04S0.js} +1 -1
  55. package/dist/client/assets/{agents-list-p5vEs41c.js → agents-list-Cl403wj6.js} +1 -1
  56. package/dist/client/assets/{ai-providers-U2Bw9sUD.js → ai-providers-CzC61PdA.js} +1 -1
  57. package/dist/client/assets/{alert-DFJJIbfK.js → alert-BWXJ6k1b.js} +1 -1
  58. package/dist/client/assets/{alert-dialog-s_v9kj8r.js → alert-dialog-NtCURUS6.js} +1 -1
  59. package/dist/client/assets/{api-keys-DTFy4O0m.js → api-keys-DNmBaalA.js} +1 -1
  60. package/dist/client/assets/{app-editor-BXcIlIq8.js → app-editor-D73mAE8x.js} +1 -1
  61. package/dist/client/assets/{auth-PabUZ5MK.js → auth-Rsm-TwXB.js} +1 -1
  62. package/dist/client/assets/{auth-catchall-CZwfxQ42.js → auth-catchall-3pQg0Ts9.js} +1 -1
  63. package/dist/client/assets/{auth-entry-fOITLcMI.js → auth-entry-Bl0QmoRA.js} +1 -1
  64. package/dist/client/assets/{auth-split-layout-CRa7xrzM.js → auth-split-layout-DZehLX5A.js} +1 -1
  65. package/dist/client/assets/{authenticate-and-persist-oauth-Doz4qFK6.js → authenticate-and-persist-oauth-tLzP2M0J.js} +1 -1
  66. package/dist/client/assets/{automation-list-row-B5z_x4bg.js → automation-list-row-Bi3fiD0Q.js} +1 -1
  67. package/dist/client/assets/{automation-runs-DUy6uLsc.js → automation-runs-JBQJQge0.js} +1 -1
  68. package/dist/client/assets/{automations-o83bK5Kz.js → automations-BAck69ny.js} +1 -1
  69. package/dist/client/assets/{avatar-DqQxOcgj.js → avatar-CBzKZbE1.js} +1 -1
  70. package/dist/client/assets/{badge-Cm4fIZLs.js → badge-eekEIbP8.js} +1 -1
  71. package/dist/client/assets/{billing-DXg_SszM.js → billing-DZFzNlnB.js} +1 -1
  72. package/dist/client/assets/{block-document-CqFnlwFf.js → block-document-BFXGao31.js} +1 -1
  73. package/dist/client/assets/{buckets-BNGfwz8G.js → buckets-D_qEvbgt.js} +1 -1
  74. package/dist/client/assets/{bulk-category-panel-g7UYfJzn.js → bulk-category-panel-DjEaSMSL.js} +1 -1
  75. package/dist/client/assets/{capability-load-error-Cebv5SRI.js → capability-load-error-c_fIc3KM.js} +1 -1
  76. package/dist/client/assets/{card-BCXXDAzK.js → card-DQyD1SfG.js} +1 -1
  77. package/dist/client/assets/{cards-CncUl_R4.js → cards-DAc3Shxa.js} +1 -1
  78. package/dist/client/assets/{category-editor-DPWwASUN.js → category-editor-BMDR50Xz.js} +1 -1
  79. package/dist/client/assets/{chart-B9PWnrec.js → chart-P7oWZYVe.js} +1 -1
  80. package/dist/client/assets/{chat-context-DCjIuGpA.js → chat-context-BkjqmU0S.js} +1 -1
  81. package/dist/client/assets/{checkbox-Bsv7TekW.js → checkbox-4PZ-TCkO.js} +1 -1
  82. package/dist/client/assets/{choose-editor-BIabz5L_.js → choose-editor-C5SnqFDh.js} +1 -1
  83. package/dist/client/assets/{cli-auth-success-C13wqGlq.js → cli-auth-success-DEurxdbo.js} +1 -1
  84. package/dist/client/assets/{collection-detail-D9crSpy8.js → collection-detail-HSvlsHZw.js} +1 -1
  85. package/dist/client/assets/{collection-display-button-DNsBjQEc.js → collection-display-button-B0B_nbOq.js} +1 -1
  86. package/dist/client/assets/{collection-search-DldYUBMG.js → collection-search-C5P6fLDH.js} +1 -1
  87. package/dist/client/assets/{collection-table-wrapper-v7Cpj2Ih.js → collection-table-wrapper-CGXTAvhx.js} +1 -1
  88. package/dist/client/assets/{collection-tabs-Xbfqz75v.js → collection-tabs-CRuLBCvv.js} +1 -1
  89. package/dist/client/assets/{command-BPStBQvN.js → command-CDNa6JaM.js} +1 -1
  90. package/dist/client/assets/{commerce-onboarding-rmVoXbVb.js → commerce-onboarding-C4N9O1Dv.js} +1 -1
  91. package/dist/client/assets/{connect-D4HVuA9P.js → connect-MM-qRvgP.js} +1 -1
  92. package/dist/client/assets/{connection-Dh7zVSdj.js → connection-CFsgz5YS.js} +1 -1
  93. package/dist/client/assets/{connection-card-DGYEO2-M.js → connection-card-DK5N_2iN.js} +1 -1
  94. package/dist/client/assets/{connection-detail-CoswJmDR.js → connection-detail-BrpJJsqW.js} +1 -1
  95. package/dist/client/assets/{connection-form-helpers-Dc8S5-Kz.js → connection-form-helpers-DEnfprhg.js} +1 -1
  96. package/dist/client/assets/{connections-DVz9pqfH.js → connections-BmXTX8FM.js} +1 -1
  97. package/dist/client/assets/{decopilot-sse-pool-BTvCMc6r.js → decopilot-sse-pool-CKRo9fBY.js} +1 -1
  98. package/dist/client/assets/{dialog-BIaL_SY_.js → dialog-BpQAmXF3.js} +1 -1
  99. package/dist/client/assets/{domain-settings-DPkimT4p.js → domain-settings-COum_2MT.js} +1 -1
  100. package/dist/client/assets/{drawer-Dxws_Ny6.js → drawer-lxnvjOeP.js} +1 -1
  101. package/dist/client/assets/{dropdown-menu-BP8b0NH2.js → dropdown-menu-4KPedagu.js} +1 -1
  102. package/dist/client/assets/{empty-state-BU16D4QD.js → empty-state-Bl06p-6p.js} +1 -1
  103. package/dist/client/assets/{extract-connection-data-CWNc628w.js → extract-connection-data-CpKok1ru.js} +1 -1
  104. package/dist/client/assets/{file-explorer-ClSVQGJK.js → file-explorer-xfr61aqG.js} +1 -1
  105. package/dist/client/assets/{file-type-icon-B4k0AhCj.js → file-type-icon-BvMUNvfi.js} +1 -1
  106. package/dist/client/assets/{form-DPD7zwQl.js → form-BqKQOwQZ.js} +1 -1
  107. package/dist/client/assets/{general-CFeEG4pG.js → general-De86W_WJ.js} +1 -1
  108. package/dist/client/assets/{github-repo-picker-DqGlvjEZ.js → github-repo-picker-DAXFK2-S.js} +1 -1
  109. package/dist/client/assets/{hooks-yS334sJm.js → hooks-CDsDpsP1.js} +1 -1
  110. package/dist/client/assets/{index-B3kZ43lJ.css → index-B1fXHVYV.css} +1 -1
  111. package/dist/client/assets/{index-B1HFvCJ9.js → index-C76wd4Bx.js} +1 -1
  112. package/dist/client/assets/{index-DjXGFEmZ.js → index-CGAtXWmG.js} +1 -1
  113. package/dist/client/assets/{index-C8y7Xfpf.js → index-CQDQvza4.js} +1 -1
  114. package/dist/client/assets/{index-weXNg5bM.js → index-Cq_SuyL5.js} +1 -1
  115. package/dist/client/assets/{index-BliC7_CQ.js → index-DAcR43oY.js} +1 -1
  116. package/dist/client/assets/{index-CWw-7NR4.js → index-DUrRTWP1.js} +1 -1
  117. package/dist/client/assets/{index-B-zeJX6v.js → index-Df2M2pRd.js} +54 -54
  118. package/dist/client/assets/{index-BAFcPo8o.js → index-DpoaDjw6.js} +1 -1
  119. package/dist/client/assets/{index-DMAZRNWH.js → index-MlSj0cB6.js} +1 -1
  120. package/dist/client/assets/{index-U67qRk6V.js → index-TsnmB6QP.js} +5 -5
  121. package/dist/client/assets/{index-redirect-DOAZmIQO.js → index-redirect-QXFoC_U-.js} +1 -1
  122. package/dist/client/assets/{infra-billing-jkhiV8IG.js → infra-billing-ks0f65VN.js} +1 -1
  123. package/dist/client/assets/{input-D2mmmfwt.js → input-C54c2ZL2.js} +1 -1
  124. package/dist/client/assets/{integration-icon-B_IPko0A.js → integration-icon-CV_tk3iI.js} +1 -1
  125. package/dist/client/assets/{invite-member-dialog-D9dkqHbk.js → invite-member-dialog-DA6uSSMg.js} +1 -1
  126. package/dist/client/assets/{label-OimsuGS-.js → label-BMmJV9YF.js} +1 -1
  127. package/dist/client/assets/{layout-DoK9ll5n.js → layout-C4ziMUb6.js} +1 -1
  128. package/dist/client/assets/{login-BDbcKmBQ.js → login-C9kBUsUO.js} +1 -1
  129. package/dist/client/assets/{mcp-oauth-CsZvBfah.js → mcp-oauth-DpfKHKRB.js} +1 -1
  130. package/dist/client/assets/{members-I3Xm8CFT.js → members-CrVzYxuh.js} +1 -1
  131. package/dist/client/assets/{monaco-editor-DNS_Vdd4.js → monaco-editor-Bu_igJzL.js} +1 -1
  132. package/dist/client/assets/{monitoring-stats-row-DQFJNxbn.js → monitoring-stats-row-DU8Tf4TH.js} +1 -1
  133. package/dist/client/assets/{multi-select-BT9DV9ku.js → multi-select-BGDWGV9V.js} +1 -1
  134. package/dist/client/assets/{oauth-callback-CnJ_6R1F.js → oauth-callback-DMfy0ENp.js} +1 -1
  135. package/dist/client/assets/{oauth-callback-ai-provider-Bckmvaa1.js → oauth-callback-ai-provider-Bkv1oNjP.js} +1 -1
  136. package/dist/client/assets/{onboarding-GrbPSyRV.js → onboarding-CTV9hAv7.js} +1 -1
  137. package/dist/client/assets/{org-layout-DjgZp5he.js → org-layout-C4728LTk.js} +1 -1
  138. package/dist/client/assets/{organization-choice-BIvMS2qm.js → organization-choice-DuIoQUnJ.js} +1 -1
  139. package/dist/client/assets/{orgs-5o5TJAST.js → orgs-CHJxetYQ.js} +1 -1
  140. package/dist/client/assets/{page-seo-form-CVM_xa-E.js → page-seo-form-DT_QZW5v.js} +1 -1
  141. package/dist/client/assets/{popover-DMzNRhqM.js → popover-B_jNHg8G.js} +1 -1
  142. package/dist/client/assets/{post-editor-DpiQrdCr.js → post-editor-ipgEXPLv.js} +1 -1
  143. package/dist/client/assets/{primitives-2l80F2YB.js → primitives-CLriX7Ai.js} +1 -1
  144. package/dist/client/assets/{profile-DhGLwbyp.js → profile-CRLJkePJ.js} +1 -1
  145. package/dist/client/assets/{project-app-view-BaRTl1Cz.js → project-app-view-Cr5j5DRz.js} +1 -1
  146. package/dist/client/assets/record-editor-Bc0ue2LZ.js +1 -0
  147. package/dist/client/assets/{redirect-editor-BdR41_B5.js → redirect-editor-DSxkgPfs.js} +1 -1
  148. package/dist/client/assets/registry-WToWOiBH.js +2 -0
  149. package/dist/client/assets/{registry-layout-DZOZges2.js → registry-layout-B76GyWey.js} +1 -1
  150. package/dist/client/assets/{reports-C3C2DF83.js → reports-DINCKaIu.js} +1 -1
  151. package/dist/client/assets/{require-capability-BRtsujkT.js → require-capability-BVRUhwyU.js} +1 -1
  152. package/dist/client/assets/{required-auth-layout-B8c25OBU.js → required-auth-layout-Bg8Z1JJx.js} +1 -1
  153. package/dist/client/assets/{reset-password-B8h-YF17.js → reset-password-Bv4DFTBB.js} +1 -1
  154. package/dist/client/assets/{roles-DMWuQQO1.js → roles-Bj77hcwQ.js} +1 -1
  155. package/dist/client/assets/{search-input-CQCe6qRN.js → search-input-C1rZ446-.js} +1 -1
  156. package/dist/client/assets/{secrets-D3bNPg6K.js → secrets-Bl1XQ6Tj.js} +1 -1
  157. package/dist/client/assets/{sections-editor-CRkjnv5W.js → sections-editor-ByP5gmbj.js} +1 -1
  158. package/dist/client/assets/{select-DpMb9ZTj.js → select-C9bBNjME.js} +1 -1
  159. package/dist/client/assets/{select-model-ZuGG5hhj.js → select-model-Cgyob8ID.js} +1 -1
  160. package/dist/client/assets/{self-tool-result-DXZIo3By.js → self-tool-result-CY73_W-2.js} +1 -1
  161. package/dist/client/assets/{seo-editor-DlrCkYY0.js → seo-editor-CSppFx9X.js} +1 -1
  162. package/dist/client/assets/{settings-layout-C9i7m-Ii.js → settings-layout-VQ7lzoYv.js} +1 -1
  163. package/dist/client/assets/{settings-section-Ddtk2O_c.js → settings-section-ClwVHkEb.js} +1 -1
  164. package/dist/client/assets/{settings-subnav-HFkLhBsm.js → settings-subnav-CJOMrTUM.js} +1 -1
  165. package/dist/client/assets/{shell-controls-DKqnwO_R.js → shell-controls-CSuxo5Hc.js} +1 -1
  166. package/dist/client/assets/{shell-layout-C85zoiRI.js → shell-layout-DXGwRXd8.js} +1 -1
  167. package/dist/client/assets/{sidebar-DQXEDjXr.js → sidebar-BwZSToHx.js} +1 -1
  168. package/dist/client/assets/{skeleton-QkZG_rdP.js → skeleton-CeDoEV9h.js} +1 -1
  169. package/dist/client/assets/{spinner-BwtMyHrM.js → spinner-CagEqDnj.js} +1 -1
  170. package/dist/client/assets/{sso-DCS_mMGq.js → sso-Ul0tg10v.js} +1 -1
  171. package/dist/client/assets/{store-C-5_ToXa.js → store-BV0_Dtcj.js} +1 -1
  172. package/dist/client/assets/store-registry-COCK-STr.js +2 -0
  173. package/dist/client/assets/{studio-tools-tL3Oy5Ce.js → studio-tools-Cdfl8h-A.js} +1 -1
  174. package/dist/client/assets/{switch-DIvMa5N8.js → switch-CjB67xr2.js} +1 -1
  175. package/dist/client/assets/{synced-repos-CArgoX6q.js → synced-repos-CaiCjg-x.js} +1 -1
  176. package/dist/client/assets/{tab-id-BJoHfCjh.js → tab-id-Bf34pZkO.js} +1 -1
  177. package/dist/client/assets/{table-CgSwxqHr.js → table-BrovHZb-.js} +1 -1
  178. package/dist/client/assets/{tabs-BVipNI0S.js → tabs-CpDhoI6V.js} +1 -1
  179. package/dist/client/assets/{tasks-B5aMspo8.js → tasks-C1d-xg2J.js} +1 -1
  180. package/dist/client/assets/{textarea-AJ4M9M-f.js → textarea-xw3d2lSr.js} +1 -1
  181. package/dist/client/assets/{toggle-group-DqYw_S9m.js → toggle-group-C4dTrrkI.js} +1 -1
  182. package/dist/client/assets/{toolbar-lQOYKYWt.js → toolbar-Bl4ZCxj-.js} +1 -1
  183. package/dist/client/assets/{tooltip-slKJgNRK.js → tooltip-Dui8uwfb.js} +1 -1
  184. package/dist/client/assets/{track-DJdpTEZB.js → track-HMYqIDwl.js} +1 -1
  185. package/dist/client/assets/{types-DGC-6CNG.js → types-CDL_M1sd.js} +1 -1
  186. package/dist/client/assets/{use-ai-providers-DzpsC0v7.js → use-ai-providers-Cn9Wfner.js} +1 -1
  187. package/dist/client/assets/{use-api-keys-O8Xu3TjM.js → use-api-keys-Nv9isq14.js} +1 -1
  188. package/dist/client/assets/{use-automations-BKhUK6wp.js → use-automations-DUlBexKL.js} +1 -1
  189. package/dist/client/assets/{use-autosave-Co9fgVIk.js → use-autosave-BCy6OHmc.js} +1 -1
  190. package/dist/client/assets/{use-capability-BqxhmF3Q.js → use-capability-C8KDRmGN.js} +1 -1
  191. package/dist/client/assets/{use-clock-tick-DWZe92Du.js → use-clock-tick-TYNg8WMH.js} +1 -1
  192. package/dist/client/assets/{use-commerce-diagnostic-DgxqUY0S.js → use-commerce-diagnostic-A6-yljOP.js} +1 -1
  193. package/dist/client/assets/{use-connection-B4_vNo9P.js → use-connection-CVbtwrXg.js} +1 -1
  194. package/dist/client/assets/{use-copy-DfjL9Nuy.js → use-copy-BgkKwLZy.js} +1 -1
  195. package/dist/client/assets/{use-create-virtual-mcp-B29Z8OFj.js → use-create-virtual-mcp-Cxnf2a52.js} +1 -1
  196. package/dist/client/assets/{use-debounced-autosave-Ba1eGKaC.js → use-debounced-autosave-B3UdpOcR.js} +1 -1
  197. package/dist/client/assets/{use-debounced-value-DOumC7lb.js → use-debounced-value-CbFpjEHk.js} +1 -1
  198. package/dist/client/assets/{use-decopilot-events-DxS5MZxW.js → use-decopilot-events-DAdI8zSd.js} +1 -1
  199. package/dist/client/assets/{use-delete-connection-BH0Fumnp.js → use-delete-connection-CC5hxfgA.js} +1 -1
  200. package/dist/client/assets/{use-deployment-admin-tOkr0X50.js → use-deployment-admin-DVrnI08o.js} +1 -1
  201. package/dist/client/assets/{use-file-configs-DSKpZydu.js → use-file-configs-Igsyli8Z.js} +1 -1
  202. package/dist/client/assets/{use-infinite-scroll-Bas4p9Ru.js → use-infinite-scroll-Be_rrlkh.js} +1 -1
  203. package/dist/client/assets/{use-join-requests-cpv9dbFd.js → use-join-requests-DGwfr_VS.js} +1 -1
  204. package/dist/client/assets/{use-mcp-client-Cn14RanX.js → use-mcp-client-DrV_gANw.js} +1 -1
  205. package/dist/client/assets/{use-mcp-tools-D6_K_HHd.js → use-mcp-tools-D7FZY8v9.js} +1 -1
  206. package/dist/client/assets/{use-members-Dujh8JDk.js → use-members-DZrJpdEV.js} +1 -1
  207. package/dist/client/assets/{use-mobile-DDap3KQv.js → use-mobile-Dj4teMZ8.js} +1 -1
  208. package/dist/client/assets/{use-navigate-to-agent-DHUVQaXh.js → use-navigate-to-agent-DG8b56CY.js} +1 -1
  209. package/dist/client/assets/{use-open-billing-url-BDzukGTa.js → use-open-billing-url-QPGbYmh4.js} +1 -1
  210. package/dist/client/assets/{use-org-auth-client-CsMFy44j.js → use-org-auth-client-BlI-piJ2.js} +1 -1
  211. package/dist/client/assets/{use-org-repo-syncs-C1eNvV3n.js → use-org-repo-syncs-bPt48aZ_.js} +1 -1
  212. package/dist/client/assets/{use-org-sso-rFuRC6sh.js → use-org-sso-B_R0AVqH.js} +1 -1
  213. package/dist/client/assets/{use-organization-roles-DWrYaBVi.js → use-organization-roles-wqxD4fog.js} +1 -1
  214. package/dist/client/assets/{use-organization-settings-sEsfAiSY.js → use-organization-settings-DeTNeW2s.js} +1 -1
  215. package/dist/client/assets/{use-registry-connections-fdK2egLa.js → use-registry-connections-C2_YX7H9.js} +1 -1
  216. package/dist/client/assets/{use-secrets-CIW9QO-0.js → use-secrets-BpWEKdQc.js} +1 -1
  217. package/dist/client/assets/{use-section-preview-base-DoA3n9u_.js → use-section-preview-base-CPVX9_IU.js} +1 -1
  218. package/dist/client/assets/{use-settings-tabs-DtJvwnHa.js → use-settings-tabs-BTawDEOX.js} +1 -1
  219. package/dist/client/assets/{use-status-sounds-3baBowb9.js → use-status-sounds-BDTLgkqj.js} +1 -1
  220. package/dist/client/assets/{use-tags-B0dbx_vm.js → use-tags-U9E57C54.js} +1 -1
  221. package/dist/client/assets/{use-view-mode-Dn2DgXog.js → use-view-mode-C1C1HBxK.js} +1 -1
  222. package/dist/client/assets/{use-virtual-mcp-CUUpo6j1.js → use-virtual-mcp-CGjEzqre.js} +1 -1
  223. package/dist/client/assets/useInfiniteQuery-PYUi9uU7.js +1 -0
  224. package/dist/client/assets/{useRouterState-D_0JK-4N.js → useRouterState-B3vV-q96.js} +1 -1
  225. package/dist/client/assets/useSuspenseInfiniteQuery-EaQ6A3_m.js +1 -0
  226. package/dist/client/assets/{users-BbRLrsbU.js → users-CpL0wgr2.js} +1 -1
  227. package/dist/client/assets/{variant-calendar-WEhLMNNv.js → variant-calendar-DwD-5jZh.js} +1 -1
  228. package/dist/client/assets/{view-mode-toggle-CQgpOmAJ.js → view-mode-toggle-DFIslB1O.js} +1 -1
  229. package/dist/client/index.html +2 -2
  230. package/dist/server/cli.js +2 -2
  231. package/dist/server/server.js +2 -2
  232. package/package.json +1 -1
  233. package/dist/client/assets/record-editor-C6_SGMLa.js +0 -1
  234. package/dist/client/assets/registry-B11oMXLc.js +0 -2
  235. package/dist/client/assets/store-registry-DSkcJNdy.js +0 -2
  236. package/dist/client/assets/useInfiniteQuery-LOLzN0HS.js +0 -1
  237. package/dist/client/assets/useSuspenseInfiniteQuery-BEwAIzqn.js +0 -1
@@ -1 +1 @@
1
- import{c as K,b as tt,r as et,j as s,m as ot,B as nt}from"./index-U67qRk6V.js";import{x as vt,a9 as dt,aM as yt}from"./agent-icon-N10iH1xS.js";import{i as Tt}from"./ChevronRight-B9ZA_kXM.js";import{L as jt}from"./label-OimsuGS-.js";import{B as pt}from"./automation-runs-DUy6uLsc.js";import{S as Nt}from"./switch-DIvMa5N8.js";import{T as wt,c as kt,a as Mt}from"./tooltip-slKJgNRK.js";import{V as _t}from"./view-mode-toggle-CQgpOmAJ.js";import"./AlertCircle-DL1CP1hy.js";import"./Tool01-Q74WMKFI.js";import"./ArrowUp-O7-j4Kzy.js";import"./ArrowLeft-DK8zcE-P.js";import"./Tool02-COUcw3ab.js";import"./XCircle-B-K-NMeg.js";import"./ArrowUpRight-BVdzIoIc.js";import"./TrendUp01-cGf0wL6U.js";import"./ZapSquare-D_Z9NIao.js";import"./Users03-DEW0AZzB.js";import"./CheckCircle-JEKJY3AR.js";import"./Check-DExpXoeZ.js";import"./ChevronDown-Dr72eRtC.js";import"./ChevronSelectorVertical-CPSw060y.js";import"./ChevronUp-CJuVoP_H.js";import"./DotsVertical-DWSyrznd.js";import"./Stars02-Cf7pycCj.js";import"./Copy01-zCwt0G1u.js";import"./CreditCard01-CPnF0kPW.js";import"./Download01-_kWGFF2R.js";import"./Settings02-CixZsBne.js";import"./Eye-EX4w3-JJ.js";import"./FilterLines-D7tmy7VI.js";import"./Share07-sN97eq8b.js";import"./Globe01-D59ZIidh.js";import"./Globe04-Bqbezsix.js";import"./SwitchHorizontal01-CqLck4PK.js";import"./HardDrive-CrDFw6-C.js";import"./Key01-i0P60pua.js";import"./LayoutLeft-yR2O4lcC.js";import"./LinkExternal01-BoR9I2q2.js";import"./LockUnlocked01-JkxWJcVa.js";import"./LogOut01-BR5P77Eq.js";import"./Monitor01-DQBHxIhU.js";import"./Sun-CGI6h2sV.js";import"./Palette-Ck8Zugmc.js";import"./Play-B2JN4tOi.js";import"./Plus-DBIW8BmC.js";import"./SearchLg-Cg_qg2uT.js";import"./SearchMd-CDtyRISc.js";import"./Shield01-DO0FlFWx.js";import"./Stars01-BEghjgKF.js";import"./Trash01-fndrO3VF.js";import"./Upload01-CoOUkNK-.js";import"./User01-z75QOIvz.js";import"./Users01-D0pT6-I6.js";import"./XClose-Ct6f5P2W.js";import"./X-BnVnruz7.js";import"./Zap-C1t0MYbg.js";import"./select-DpMb9ZTj.js";import"./useInfiniteQuery-LOLzN0HS.js";import"./use-infinite-scroll-Bas4p9Ru.js";import"./use-connection-B4_vNo9P.js";import"./use-mcp-client-Cn14RanX.js";import"./auth-PabUZ5MK.js";import"./use-virtual-mcp-CUUpo6j1.js";import"./card-BCXXDAzK.js";import"./sidebar-DQXEDjXr.js";import"./use-mobile-DDap3KQv.js";import"./table-CgSwxqHr.js";import"./empty-state-BU16D4QD.js";import"./use-members-Dujh8JDk.js";import"./use-org-auth-client-CsMFy44j.js";import"./use-clock-tick-DWZe92Du.js";import"./use-automations-BKhUK6wp.js";import"./studio-tools-tL3Oy5Ce.js";import"./useSuspenseInfiniteQuery-BEwAIzqn.js";import"./avatar-DqQxOcgj.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-DfjL9Nuy.js";import"./dialog-BIaL_SY_.js";import"./tab-id-BJoHfCjh.js";import"./hooks-yS334sJm.js";import"./decopilot-sse-pool-BTvCMc6r.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-DCjIuGpA.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-DzpsC0v7.js";import"./use-decopilot-events-DxS5MZxW.js";import"./use-organization-settings-sEsfAiSY.js";import"./monaco-editor-DNS_Vdd4.js";import"./spinner-BwtMyHrM.js";import"./types-DGC-6CNG.js";import"./shell-layout-C85zoiRI.js";import"./required-auth-layout-B8c25OBU.js";import"./use-org-sso-rFuRC6sh.js";import"./integration-icon-B_IPko0A.js";import"./use-navigate-to-agent-DHUVQaXh.js";import"./reusable-new-chat-CouMjkYR.js";import"./chart-B9PWnrec.js";import"./index-weXNg5bM.js";import"./form-DPD7zwQl.js";import"./input-D2mmmfwt.js";import"./file-type-icon-B4k0AhCj.js";const Et=new Set(["website/matchers/date.ts","$live/matchers/MatchDate.ts"]),St=new Set(["website/matchers/multi.ts","$live/matchers/MatchMulti.ts"]),Ct=new Date(-864e13),Dt=new Date(864e13),At=/\/flags\/multivariate(?:\/[^/]+)?\.ts$/,$t=/\/flags\/multivariate\.ts$/;function Lt(e){let t=e;t.startsWith("pages-")&&(t=t.slice(6).replace(/-\d+$/,""));try{t=decodeURIComponent(t)}catch{}return t}function Rt(e){if(!e||typeof e!="object")return null;const{start:t,end:n}=e,r=typeof t=="string",i=typeof n=="string";if(!r&&!i)return null;const o=r?new Date(t):Ct,a=i?new Date(n):Dt;return Number.isNaN(o.getTime())||Number.isNaN(a.getTime())||r&&i&&a.getTime()<=o.getTime()?null:{start:o,end:a,openStart:!r,openEnd:!i}}function ft(e,t){if(!e||typeof e!="object")return;const n=e.__resolveType;if(typeof n=="string"){if(Et.has(n)){const r=Rt(e);r&&t.push(r);return}if(St.has(n)){const r=e.matchers;if(Array.isArray(r))for(const i of r)ft(i,t)}}}function Ot(e){if(!e||typeof e!="object")return!1;const t=e.__resolveType;if(typeof t!="string"||!At.test(t))return!1;const n=e.variants;return Array.isArray(n)}function It(e){if(typeof e=="string"){const m=e.trim();if(m.length===0)return null;try{const c=new URL(m).pathname.split("/").filter(Boolean),d=c[c.length-1];if(d)return decodeURIComponent(d)}catch{}return m.length>80?`${m.slice(0,77)}…`:m}if(!e||typeof e!="object")return null;const t=e,n=t.config,i=t.desktop?.media,o=[t.title,t.name,t.label,t.alt,n?.title,n?.name,n?.typeAlert?.message,i?.alt,Array.isArray(t.matcher)?t.matcher[0]:void 0];for(const m of o)if(typeof m=="string"&&m.trim().length>0)return m.trim();const a=t.__resolveType;if(typeof a=="string"){const l=(a.split("/").pop()??a).replace(/\.(tsx?|jsx?)$/i,"");if(l.length>0)return l}return null}function Pt(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];typeof r=="number"?t.length>0?t[t.length-1]+=`[${r}]`:t.push(`[${r}]`):t.push(r)}return t.join(" · ")}function X(e,t,n,r,i){if(Ot(e)){const o=e.variants,a=e.__resolveType,m=$t.test(a)?"":Pt(r);o.forEach((l,c)=>{if(!l||typeof l!="object")return;const d=l,f=[];if(ft(d.rule,f),f.length===0)return;const x=It(d.value)??(m||n);for(const h of f)i.push({blockKey:t,blockLabel:n,innerPath:m,variantIndex:c,start:h.start,end:h.end,openStart:h.openStart,openEnd:h.openEnd,label:x,flagResolveType:a})});for(let l=0;l<o.length;l++){const c=o[l];c&&typeof c=="object"&&X(c.value,t,n,[...r,"variants",l,"value"],i)}return}if(Array.isArray(e)){for(let o=0;o<e.length;o++)X(e[o],t,n,[...r,o],i);return}if(e&&typeof e=="object")for(const[o,a]of Object.entries(e))o!=="__resolveType"&&X(a,t,n,[...r,o],i)}function Ft(e){if(!e)return[];const t=[];for(const[n,r]of Object.entries(e))X(r,n,Lt(n),[],t);return t.sort((n,r)=>n.start.getTime()-r.start.getTime())}function Vt(e){const t=[...new Set(e)].sort(),n=new Map;return t.forEach((r,i)=>{const o=i*137.508%360;n.set(r,{bg:`oklch(0.62 0.14 ${o})`,text:"white",border:`oklch(0.50 0.14 ${o})`})}),n}const Ht={bg:"oklch(0.62 0.14 0)",text:"white",border:"oklch(0.50 0.14 0)"};function ut(e,t){return e.get(t)??Ht}const Bt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ht=["January","February","March","April","May","June","July","August","September","October","November","December"],gt=1440*60*1e3;function B(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function xt(e){return new Date(e.getFullYear(),e.getMonth(),1)}function G(e,t){return new Date(e.getFullYear(),e.getMonth()+t,1)}function Z(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}function st(e,t){return Math.round((B(e).getTime()-B(t).getTime())/gt)}function Wt(e){const t=(e.getTime()-B(e).getTime())/gt;return Math.min(Math.max(t,0),1)}function it(e,t){return st(e,t)+Wt(e)}function zt(e){const t=Z(e,-e.getDay()),n=[];for(let r=0;r<6;r++){const i=[];for(let o=0;o<7;o++)i.push(Z(t,r*7+o));n.push(i)}for(;n.length>0&&n[n.length-1].every(r=>r.getMonth()!==e.getMonth());)n.pop();return n}function Ut(e,t){const n=B(e[0]),r=Z(n,7),i=n.getTime(),o=r.getTime(),a=[];for(const c of t){const d=B(c.start),f=B(c.end);if(f.getTime()<n.getTime()||d.getTime()>=r.getTime())continue;const u=d.getTime()<n.getTime()?n:d,x=f.getTime()>=r.getTime()?Z(r,-1):f,h=st(u,n),g=st(x,u)+1;if(g<=0)continue;const b=Math.max(c.start.getTime(),i),j=Math.min(c.end.getTime(),o),v=it(new Date(b),n),p=Math.max(it(new Date(j),n)-v,0);p<=0||a.push({variant:c,startCol:h,span:g,leftUnits:v,widthUnits:p})}a.sort((c,d)=>c.startCol-d.startCol||d.span-c.span||c.variant.blockKey.localeCompare(d.variant.blockKey));const m=[],l=[];for(const c of a){let d=m.findIndex(f=>f<=c.startCol);d===-1&&(d=m.length,m.push(0)),m[d]=c.startCol+c.span,l.push({...c,lane:d})}return l}const at=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function Yt(e,t){const n=e.openStart?t("sandbox.variantCalendar.always"):at.format(e.start),r=e.openEnd?t("sandbox.variantCalendar.ongoing"):at.format(e.end);return`${n} → ${r}`}function Gt(e){const t=K.c(18),{variant:n}=e,r=tt();let i;t[0]!==n.blockLabel?(i=s.jsx("div",{className:"font-semibold",children:n.blockLabel}),t[0]=n.blockLabel,t[1]=i):i=t[1];let o;t[2]!==n.innerPath?(o=n.innerPath&&s.jsx("div",{className:"text-muted-foreground",children:n.innerPath}),t[2]=n.innerPath,t[3]=o):o=t[3];let a;t[4]!==n.blockLabel||t[5]!==n.innerPath||t[6]!==n.label?(a=n.label!==n.blockLabel&&n.label!==n.innerPath&&s.jsx("div",{className:"text-muted-foreground",children:n.label}),t[4]=n.blockLabel,t[5]=n.innerPath,t[6]=n.label,t[7]=a):a=t[7];let m;t[8]!==r||t[9]!==n?(m=Yt(n,r),t[8]=r,t[9]=n,t[10]=m):m=t[10];let l;t[11]!==m?(l=s.jsx("div",{className:"mt-1",children:m}),t[11]=m,t[12]=l):l=t[12];let c;return t[13]!==i||t[14]!==o||t[15]!==a||t[16]!==l?(c=s.jsx(Mt,{children:s.jsxs("div",{className:"text-xs",children:[i,o,a,l]})}),t[13]=i,t[14]=o,t[15]=a,t[16]=l,t[17]=c):c=t[17],c}const lt=16;function Kt(e,t){const n=e?"transparent":"#000 0",r=t?"transparent":"#000 100%";if(!(!e&&!t))return`linear-gradient(to right, ${n}, #000 ${lt}px, #000 calc(100% - ${lt}px), ${r})`}function bt(e){const t=K.c(26),{variant:n,color:r,style:i,children:o,fadeStart:a,fadeEnd:m}=e,l=a===void 0?!1:a,c=m===void 0?!1:m;let d;t[0]!==c||t[1]!==l?(d=Kt(l,c),t[0]=c,t[1]=l,t[2]=d):d=t[2];const f=d;let u;t[3]!==l?(u=l&&{borderTopLeftRadius:0,borderBottomLeftRadius:0},t[3]=l,t[4]=u):u=t[4];let x;t[5]!==c?(x=c&&{borderTopRightRadius:0,borderBottomRightRadius:0},t[5]=c,t[6]=x):x=t[6];let h;t[7]!==f?(h=f&&{maskImage:f,WebkitMaskImage:f},t[7]=f,t[8]=h):h=t[8];let g;t[9]!==r.bg||t[10]!==r.text||t[11]!==i||t[12]!==u||t[13]!==x||t[14]!==h?(g={background:r.bg,color:r.text,borderRadius:4,...u,...x,...h,...i},t[9]=r.bg,t[10]=r.text,t[11]=i,t[12]=u,t[13]=x,t[14]=h,t[15]=g):g=t[15];let b;t[16]!==o?(b=s.jsx("span",{className:"truncate",children:o}),t[16]=o,t[17]=b):b=t[17];let j;t[18]!==g||t[19]!==b?(j=s.jsx(wt,{asChild:!0,children:s.jsx("div",{className:"absolute flex items-center px-2 text-[11px] font-medium truncate cursor-default",style:g,children:b})}),t[18]=g,t[19]=b,t[20]=j):j=t[20];let v;t[21]!==n?(v=s.jsx(Gt,{variant:n}),t[21]=n,t[22]=v):v=t[22];let p;return t[23]!==v||t[24]!==j?(p=s.jsxs(kt,{children:[j,v]}),t[23]=v,t[24]=j,t[25]=p):p=t[25],p}function ir(e){const t=K.c(72),{decofile:n}=e,r=tt(),[i,o]=et.useState("calendar"),[a,m]=et.useState(Xt),[l,c]=et.useState(!1);let d,f,u;if(t[0]!==n||t[1]!==l){const P=Ft(n);d=P.filter(Qt).length,u=l?P:P.filter(qt),f=Vt(u.map(Jt)),t[0]=n,t[1]=l,t[2]=d,t[3]=f,t[4]=u}else d=t[2],f=t[3],u=t[4];const x=f;let h;t[5]===Symbol.for("react.memo_cache_sentinel")?(h=()=>m(xt(new Date)),t[5]=h):h=t[5];const g=h;let b;t[6]!==i?(b=()=>m(P=>i==="calendar"?G(P,-1):G(P,-3)),t[6]=i,t[7]=b):b=t[7];const j=b;let v;t[8]!==i?(v=()=>m(P=>i==="calendar"?G(P,1):G(P,3)),t[8]=i,t[9]=v):v=t[9];const p=v;let y;t[10]!==r?(y=r("sandbox.variantCalendar.today"),t[10]=r,t[11]=y):y=t[11];let T;t[12]!==y?(T=s.jsx(nt,{variant:"outline",size:"sm",onClick:g,children:y}),t[12]=y,t[13]=T):T=t[13];let w;t[14]!==r?(w=r("sandbox.variantCalendar.previous"),t[14]=r,t[15]=w):w=t[15];let D;t[16]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(vt,{size:16}),t[16]=D):D=t[16];let k;t[17]!==j||t[18]!==w?(k=s.jsx(nt,{variant:"ghost",size:"icon",className:"size-8",onClick:j,"aria-label":w,children:D}),t[17]=j,t[18]=w,t[19]=k):k=t[19];let M;t[20]!==r?(M=r("sandbox.variantCalendar.next"),t[20]=r,t[21]=M):M=t[21];let S;t[22]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Tt,{size:16}),t[22]=S):S=t[22];let A;t[23]!==p||t[24]!==M?(A=s.jsx(nt,{variant:"ghost",size:"icon",className:"size-8",onClick:p,"aria-label":M,children:S}),t[23]=p,t[24]=M,t[25]=A):A=t[25];const $=ht[a.getMonth()];let C;t[26]!==a?(C=a.getFullYear(),t[26]=a,t[27]=C):C=t[27];let _;t[28]!==$||t[29]!==C?(_=s.jsxs("h2",{className:"ml-2 text-base font-semibold",children:[$," ",C]}),t[28]=$,t[29]=C,t[30]=_):_=t[30];let N;t[31]!==A||t[32]!==_||t[33]!==T||t[34]!==k?(N=s.jsxs("div",{className:"flex items-center gap-2",children:[T,k,A,_]}),t[31]=A,t[32]=_,t[33]=T,t[34]=k,t[35]=N):N=t[35];let L;t[36]!==d||t[37]!==l||t[38]!==r?(L=d>0&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nt,{id:"show-ongoing",checked:l,onCheckedChange:c}),s.jsx(jt,{htmlFor:"show-ongoing",className:"text-xs text-muted-foreground cursor-pointer",children:r("sandbox.variantCalendar.showOngoing",{count:d})})]}),t[36]=d,t[37]=l,t[38]=r,t[39]=L):L=t[39];let H;t[40]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx(dt,{}),t[40]=H):H=t[40];let F;t[41]!==r?(F=r("sandbox.variantCalendar.calendarMode"),t[41]=r,t[42]=F):F=t[42];let E;t[43]!==F?(E={value:"calendar",icon:H,label:F},t[43]=F,t[44]=E):E=t[44];let W;t[45]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(yt,{}),t[45]=W):W=t[45];let R;t[46]!==r?(R=r("sandbox.variantCalendar.timelineMode"),t[46]=r,t[47]=R):R=t[47];let O;t[48]!==R?(O={value:"timeline",icon:W,label:R},t[48]=R,t[49]=O):O=t[49];let I;t[50]!==E||t[51]!==O?(I=[E,O],t[50]=E,t[51]=O,t[52]=I):I=t[52];let V;t[53]!==I||t[54]!==i?(V=s.jsx(_t,{value:i,onValueChange:o,options:I}),t[53]=I,t[54]=i,t[55]=V):V=t[55];let z;t[56]!==L||t[57]!==V?(z=s.jsxs("div",{className:"flex items-center gap-4",children:[L,V]}),t[56]=L,t[57]=V,t[58]=z):z=t[58];let U;t[59]!==N||t[60]!==z?(U=s.jsxs("div",{className:"flex items-center justify-between px-4 h-12 border-b shrink-0",children:[N,z]}),t[59]=N,t[60]=z,t[61]=U):U=t[61];let Y;t[62]!==x||t[63]!==a||t[64]!==d||t[65]!==l||t[66]!==u||t[67]!==i?(Y=u.length===0?s.jsx(Zt,{hiddenOngoing:l?0:d}):i==="calendar"?s.jsx(ee,{monthStart:a,variants:u,colorMap:x}):s.jsx(oe,{monthStart:a,variants:u,colorMap:x}),t[62]=x,t[63]=a,t[64]=d,t[65]=l,t[66]=u,t[67]=i,t[68]=Y):Y=t[68];let q;return t[69]!==U||t[70]!==Y?(q=s.jsxs("div",{className:"flex h-full w-full flex-col",children:[U,Y]}),t[69]=U,t[70]=Y,t[71]=q):q=t[71],q}function Jt(e){return e.blockKey}function qt(e){return!e.openEnd}function Qt(e){return e.openEnd}function Xt(){return xt(new Date)}function Zt(e){const t=K.c(4),{hiddenOngoing:n}=e,r=n===void 0?0:n,i=tt();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(dt,{size:24,className:"text-muted-foreground/60"}),t[0]=o):o=t[0];let a;return t[1]!==r||t[2]!==i?(a=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[o,r>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{children:i("sandbox.variantCalendar.noDatedVariants")}),s.jsx("div",{className:"text-xs text-muted-foreground/80",children:i("sandbox.variantCalendar.hiddenOngoingVariants",{count:r})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{children:i("sandbox.variantCalendar.noScheduledVariants")}),s.jsx("div",{className:"text-xs text-muted-foreground/80",children:i("sandbox.variantCalendar.dateMatcherInfo")})]})]}),t[1]=r,t[2]=i,t[3]=a):a=t[3],a}const rt=20,ct=2,mt=28,te=6;function ee(e){const t=K.c(17),{monthStart:n,variants:r,colorMap:i}=e;let o,a,m,l,c;if(t[0]!==i||t[1]!==n||t[2]!==r){const u=zt(n),x=B(new Date);o=pt,c="flex-1 min-h-0",a="min-w-[840px]",t[8]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("div",{className:"grid grid-cols-7 border-b text-xs text-muted-foreground sticky top-0 bg-background z-10",children:Bt.map(re)}),t[8]=m):m=t[8],l=u.map((h,g)=>{const b=Ut(h,r),j=b.reduce(ne,0),v=mt+j*(rt+ct)+8;return s.jsxs("div",{className:"grid grid-cols-7 relative border-b",style:{height:v},children:[h.map((p,y)=>{const T=p.getMonth()===n.getMonth(),w=p.getTime()===x.getTime();return s.jsx("div",{className:ot("border-r last:border-r-0 px-2 pt-1.5 text-xs",T?"bg-background":"bg-muted/30 text-muted-foreground"),children:s.jsx("span",{className:ot("inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1",w&&"bg-primary text-primary-foreground font-semibold"),children:p.getDate()})},y)}),b.map((p,y)=>{const T=ut(i,p.variant.blockKey),w=mt+p.lane*(rt+ct),D=p.leftUnits/7*100,k=p.widthUnits/7*100,M=p.variant.openStart&&g===0,S=p.variant.openEnd&&g===u.length-1;return s.jsxs(bt,{variant:p.variant,color:T,fadeStart:M,fadeEnd:S,style:{top:w,left:`calc(${D}% + 2px)`,width:`calc(${k}% - 4px)`,minWidth:te,height:rt},children:[p.variant.blockLabel,p.variant.label!==p.variant.blockLabel&&s.jsxs("span",{className:"opacity-70",children:[" · ",p.variant.label]})]},`${g}-${y}`)})]},g)}),t[0]=i,t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=m,t[6]=l,t[7]=c}else o=t[3],a=t[4],m=t[5],l=t[6],c=t[7];let d;t[9]!==a||t[10]!==m||t[11]!==l?(d=s.jsxs("div",{className:a,children:[m,l]}),t[9]=a,t[10]=m,t[11]=l,t[12]=d):d=t[12];let f;return t[13]!==o||t[14]!==c||t[15]!==d?(f=s.jsx(o,{className:c,children:d}),t[13]=o,t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function ne(e,t){return Math.max(e,t.lane+1)}function re(e){return s.jsx("div",{className:"px-2 py-2 text-center uppercase tracking-wide",children:e},e)}const Q=4,se=32,J=240;function oe(e){const t=K.c(23),{monthStart:n,variants:r,colorMap:i}=e,o=n,a=G(n,Q),m=new Date,l=new Map;for(const _ of r){const N=l.get(_.blockKey)??[];N.push(_),l.set(_.blockKey,N)}const c=Array.from(l.entries()).sort(le),d=a.getTime()-o.getTime(),f=_=>(Math.max(o.getTime(),Math.min(a.getTime(),_.getTime()))-o.getTime())/d*100;let u;t[0]!==o?(u=(_,N)=>G(o,N),t[0]=o,t[1]=u):u=t[1];const x=Array.from({length:Q},u),h=m.getTime()>=o.getTime()&&m.getTime()<=a.getTime()?f(m):null,g=tt(),b=pt,j="flex-1 min-h-0",v="min-w-[900px] relative";let p;t[2]===Symbol.for("react.memo_cache_sentinel")?(p={width:J},t[2]=p):p=t[2];let y;t[3]!==g?(y=g("sandbox.variantCalendar.variantBlock"),t[3]=g,t[4]=y):y=t[4];let T;t[5]!==y?(T=s.jsx("div",{className:"shrink-0 px-3 py-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground border-r",style:p,children:y}),t[5]=y,t[6]=T):T=t[6];let w;t[7]===Symbol.for("react.memo_cache_sentinel")?(w={gridTemplateColumns:`repeat(${Q}, minmax(0, 1fr))`},t[7]=w):w=t[7];const D=x.map(ae);let k;t[8]!==D?(k=s.jsx("div",{className:"flex-1 grid",style:w,children:D}),t[8]=D,t[9]=k):k=t[9];let M;t[10]!==T||t[11]!==k?(M=s.jsxs("div",{className:"flex border-b sticky top-0 bg-background z-10",children:[T,k]}),t[10]=T,t[11]=k,t[12]=M):M=t[12];let S;t[13]!==g||t[14]!==h?(S=h!==null&&s.jsx("div",{className:"pointer-events-none absolute top-0 bottom-0 w-px bg-primary/70 z-[5]",style:{left:`calc(${J}px + (100% - ${J}px) * ${h} / 100)`},children:s.jsx("span",{className:"absolute -top-0.5 -translate-x-1/2 rounded-sm bg-primary px-1.5 py-px text-[10px] font-medium text-primary-foreground",children:g("sandbox.variantCalendar.todayLabel")})}),t[13]=g,t[14]=h,t[15]=S):S=t[15];const A=c.map(_=>{const[N,L]=_,H=ut(i,N),F=L[0]?.blockLabel??N;return s.jsxs("div",{children:[s.jsx("div",{className:"flex items-center bg-muted/40 border-b text-xs font-semibold uppercase tracking-wide text-muted-foreground",style:{height:28},children:s.jsx("div",{className:"px-3 truncate",style:{width:J},children:F})}),L.map((E,W)=>s.jsxs("div",{className:"flex border-b items-center",style:{height:se},children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 text-sm border-r shrink-0",style:{width:J},children:[s.jsx("span",{className:"inline-block h-2 w-2 rounded-full shrink-0",style:{background:H.bg}}),s.jsx("span",{className:"truncate text-foreground/80",children:E.label})]}),s.jsxs("div",{className:"relative flex-1 h-full",children:[s.jsx("div",{className:"absolute inset-0 grid",style:{gridTemplateColumns:`repeat(${Q}, minmax(0, 1fr))`},children:x.map(ie)}),(()=>{const R=Math.max(E.start.getTime(),o.getTime()),O=Math.min(E.end.getTime(),a.getTime());if(O<=R)return null;const I=f(new Date(R)),V=f(new Date(O))-I;return s.jsx(bt,{variant:E,color:H,fadeStart:E.openStart,fadeEnd:E.openEnd,style:{top:"50%",transform:"translateY(-50%)",left:`${I}%`,width:`calc(${V}% - 2px)`,height:22},children:E.label})})()]})]},W))]},N)});let $;t[16]!==M||t[17]!==S||t[18]!==A?($=s.jsxs("div",{className:v,children:[M,S,A]}),t[16]=M,t[17]=S,t[18]=A,t[19]=$):$=t[19];let C;return t[20]!==b||t[21]!==$?(C=s.jsx(b,{className:j,children:$}),t[20]=b,t[21]=$,t[22]=C):C=t[22],C}function ie(e,t){return s.jsx("div",{className:"border-r last:border-r-0 border-border/40"},t)}function ae(e,t){return s.jsxs("div",{className:"px-2 py-2 text-xs uppercase tracking-wide text-muted-foreground border-r last:border-r-0",children:[ht[e.getMonth()]?.slice(0,3)," ",e.getFullYear()]},t)}function le(e,t){return e[0].localeCompare(t[0])}export{ir as VariantCalendar};
1
+ import{c as K,b as tt,r as et,j as s,m as ot,B as nt}from"./index-TsnmB6QP.js";import{x as vt,a9 as dt,aM as yt}from"./agent-icon-BZ_a04S0.js";import{i as Tt}from"./ChevronRight-CLyRbaUU.js";import{L as jt}from"./label-BMmJV9YF.js";import{B as pt}from"./automation-runs-JBQJQge0.js";import{S as Nt}from"./switch-CjB67xr2.js";import{T as wt,c as kt,a as Mt}from"./tooltip-Dui8uwfb.js";import{V as _t}from"./view-mode-toggle-DFIslB1O.js";import"./AlertCircle-CVPo0qEm.js";import"./Tool01-C7JK84AW.js";import"./ArrowUp-Tf9X-9eZ.js";import"./ArrowLeft-CUw2oDuz.js";import"./Tool02-BD0oj0Z6.js";import"./XCircle-C74a-_sm.js";import"./ArrowUpRight-CWFkobB4.js";import"./TrendUp01-DE-6F3ol.js";import"./ZapSquare-BO2oEmgN.js";import"./Users03-nzSyOTiI.js";import"./CheckCircle-CEGfcpsW.js";import"./Check-D_7f8Wel.js";import"./ChevronDown-Bg-1Juk5.js";import"./ChevronSelectorVertical-Dz9WarkK.js";import"./ChevronUp-BqRX9ZFE.js";import"./DotsVertical-CHA2avQZ.js";import"./Stars02-C1dUyp2n.js";import"./Copy01-Bwkkomxj.js";import"./CreditCard01-ygPw-EKC.js";import"./Download01-CmXY93tt.js";import"./Settings02-BSpuV9Fn.js";import"./Eye-CEo3fQQh.js";import"./FilterLines-BbuCX0gh.js";import"./Share07-TZt-qDi6.js";import"./Globe01-DDOmP6mo.js";import"./Globe04-Cfd8Rd9g.js";import"./SwitchHorizontal01-o0AhqUK3.js";import"./HardDrive-DfEb0Y6k.js";import"./Key01-BW9ldI4y.js";import"./LayoutLeft-BmDj8huh.js";import"./LinkExternal01-i7PYdGoV.js";import"./LockUnlocked01-BVZ6q8T0.js";import"./LogOut01-C7qNJNUJ.js";import"./Monitor01-CoRTt5aG.js";import"./Sun-F2AiKbgs.js";import"./Palette-DfKiT9du.js";import"./Play-DdLA8Y7E.js";import"./Plus-C_NskSm6.js";import"./SearchLg-mKc3T504.js";import"./SearchMd-CGhMwkV3.js";import"./Shield01-D5T84I2m.js";import"./Stars01-BPtc2LR_.js";import"./Trash01-BDJfIYOv.js";import"./Upload01-FJqJWa79.js";import"./User01-CuvMZdbR.js";import"./Users01-By8YR5pB.js";import"./XClose-eOvoOXbJ.js";import"./X-Bjbq04_M.js";import"./Zap-CLxSKLFj.js";import"./select-C9bBNjME.js";import"./useInfiniteQuery-PYUi9uU7.js";import"./use-infinite-scroll-Be_rrlkh.js";import"./use-connection-CVbtwrXg.js";import"./use-mcp-client-DrV_gANw.js";import"./auth-Rsm-TwXB.js";import"./use-virtual-mcp-CGjEzqre.js";import"./card-DQyD1SfG.js";import"./sidebar-BwZSToHx.js";import"./use-mobile-Dj4teMZ8.js";import"./table-BrovHZb-.js";import"./empty-state-Bl06p-6p.js";import"./use-members-DZrJpdEV.js";import"./use-org-auth-client-BlI-piJ2.js";import"./use-clock-tick-TYNg8WMH.js";import"./use-automations-DUlBexKL.js";import"./studio-tools-Cdfl8h-A.js";import"./useSuspenseInfiniteQuery-EaQ6A3_m.js";import"./avatar-CBzKZbE1.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BgkKwLZy.js";import"./dialog-BpQAmXF3.js";import"./tab-id-Bf34pZkO.js";import"./hooks-CDsDpsP1.js";import"./decopilot-sse-pool-CKRo9fBY.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./chat-context-BkjqmU0S.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-Cn9Wfner.js";import"./use-decopilot-events-DAdI8zSd.js";import"./use-organization-settings-DeTNeW2s.js";import"./monaco-editor-Bu_igJzL.js";import"./spinner-CagEqDnj.js";import"./types-CDL_M1sd.js";import"./shell-layout-DXGwRXd8.js";import"./required-auth-layout-Bg8Z1JJx.js";import"./use-org-sso-B_R0AVqH.js";import"./integration-icon-CV_tk3iI.js";import"./use-navigate-to-agent-DG8b56CY.js";import"./reusable-new-chat-CouMjkYR.js";import"./chart-P7oWZYVe.js";import"./index-Cq_SuyL5.js";import"./form-BqKQOwQZ.js";import"./input-C54c2ZL2.js";import"./file-type-icon-BvMUNvfi.js";const Et=new Set(["website/matchers/date.ts","$live/matchers/MatchDate.ts"]),St=new Set(["website/matchers/multi.ts","$live/matchers/MatchMulti.ts"]),Ct=new Date(-864e13),Dt=new Date(864e13),At=/\/flags\/multivariate(?:\/[^/]+)?\.ts$/,$t=/\/flags\/multivariate\.ts$/;function Lt(e){let t=e;t.startsWith("pages-")&&(t=t.slice(6).replace(/-\d+$/,""));try{t=decodeURIComponent(t)}catch{}return t}function Rt(e){if(!e||typeof e!="object")return null;const{start:t,end:n}=e,r=typeof t=="string",i=typeof n=="string";if(!r&&!i)return null;const o=r?new Date(t):Ct,a=i?new Date(n):Dt;return Number.isNaN(o.getTime())||Number.isNaN(a.getTime())||r&&i&&a.getTime()<=o.getTime()?null:{start:o,end:a,openStart:!r,openEnd:!i}}function ft(e,t){if(!e||typeof e!="object")return;const n=e.__resolveType;if(typeof n=="string"){if(Et.has(n)){const r=Rt(e);r&&t.push(r);return}if(St.has(n)){const r=e.matchers;if(Array.isArray(r))for(const i of r)ft(i,t)}}}function Ot(e){if(!e||typeof e!="object")return!1;const t=e.__resolveType;if(typeof t!="string"||!At.test(t))return!1;const n=e.variants;return Array.isArray(n)}function It(e){if(typeof e=="string"){const m=e.trim();if(m.length===0)return null;try{const c=new URL(m).pathname.split("/").filter(Boolean),d=c[c.length-1];if(d)return decodeURIComponent(d)}catch{}return m.length>80?`${m.slice(0,77)}…`:m}if(!e||typeof e!="object")return null;const t=e,n=t.config,i=t.desktop?.media,o=[t.title,t.name,t.label,t.alt,n?.title,n?.name,n?.typeAlert?.message,i?.alt,Array.isArray(t.matcher)?t.matcher[0]:void 0];for(const m of o)if(typeof m=="string"&&m.trim().length>0)return m.trim();const a=t.__resolveType;if(typeof a=="string"){const l=(a.split("/").pop()??a).replace(/\.(tsx?|jsx?)$/i,"");if(l.length>0)return l}return null}function Pt(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];typeof r=="number"?t.length>0?t[t.length-1]+=`[${r}]`:t.push(`[${r}]`):t.push(r)}return t.join(" · ")}function X(e,t,n,r,i){if(Ot(e)){const o=e.variants,a=e.__resolveType,m=$t.test(a)?"":Pt(r);o.forEach((l,c)=>{if(!l||typeof l!="object")return;const d=l,f=[];if(ft(d.rule,f),f.length===0)return;const x=It(d.value)??(m||n);for(const h of f)i.push({blockKey:t,blockLabel:n,innerPath:m,variantIndex:c,start:h.start,end:h.end,openStart:h.openStart,openEnd:h.openEnd,label:x,flagResolveType:a})});for(let l=0;l<o.length;l++){const c=o[l];c&&typeof c=="object"&&X(c.value,t,n,[...r,"variants",l,"value"],i)}return}if(Array.isArray(e)){for(let o=0;o<e.length;o++)X(e[o],t,n,[...r,o],i);return}if(e&&typeof e=="object")for(const[o,a]of Object.entries(e))o!=="__resolveType"&&X(a,t,n,[...r,o],i)}function Ft(e){if(!e)return[];const t=[];for(const[n,r]of Object.entries(e))X(r,n,Lt(n),[],t);return t.sort((n,r)=>n.start.getTime()-r.start.getTime())}function Vt(e){const t=[...new Set(e)].sort(),n=new Map;return t.forEach((r,i)=>{const o=i*137.508%360;n.set(r,{bg:`oklch(0.62 0.14 ${o})`,text:"white",border:`oklch(0.50 0.14 ${o})`})}),n}const Ht={bg:"oklch(0.62 0.14 0)",text:"white",border:"oklch(0.50 0.14 0)"};function ut(e,t){return e.get(t)??Ht}const Bt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ht=["January","February","March","April","May","June","July","August","September","October","November","December"],gt=1440*60*1e3;function B(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function xt(e){return new Date(e.getFullYear(),e.getMonth(),1)}function G(e,t){return new Date(e.getFullYear(),e.getMonth()+t,1)}function Z(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}function st(e,t){return Math.round((B(e).getTime()-B(t).getTime())/gt)}function Wt(e){const t=(e.getTime()-B(e).getTime())/gt;return Math.min(Math.max(t,0),1)}function it(e,t){return st(e,t)+Wt(e)}function zt(e){const t=Z(e,-e.getDay()),n=[];for(let r=0;r<6;r++){const i=[];for(let o=0;o<7;o++)i.push(Z(t,r*7+o));n.push(i)}for(;n.length>0&&n[n.length-1].every(r=>r.getMonth()!==e.getMonth());)n.pop();return n}function Ut(e,t){const n=B(e[0]),r=Z(n,7),i=n.getTime(),o=r.getTime(),a=[];for(const c of t){const d=B(c.start),f=B(c.end);if(f.getTime()<n.getTime()||d.getTime()>=r.getTime())continue;const u=d.getTime()<n.getTime()?n:d,x=f.getTime()>=r.getTime()?Z(r,-1):f,h=st(u,n),g=st(x,u)+1;if(g<=0)continue;const b=Math.max(c.start.getTime(),i),j=Math.min(c.end.getTime(),o),v=it(new Date(b),n),p=Math.max(it(new Date(j),n)-v,0);p<=0||a.push({variant:c,startCol:h,span:g,leftUnits:v,widthUnits:p})}a.sort((c,d)=>c.startCol-d.startCol||d.span-c.span||c.variant.blockKey.localeCompare(d.variant.blockKey));const m=[],l=[];for(const c of a){let d=m.findIndex(f=>f<=c.startCol);d===-1&&(d=m.length,m.push(0)),m[d]=c.startCol+c.span,l.push({...c,lane:d})}return l}const at=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function Yt(e,t){const n=e.openStart?t("sandbox.variantCalendar.always"):at.format(e.start),r=e.openEnd?t("sandbox.variantCalendar.ongoing"):at.format(e.end);return`${n} → ${r}`}function Gt(e){const t=K.c(18),{variant:n}=e,r=tt();let i;t[0]!==n.blockLabel?(i=s.jsx("div",{className:"font-semibold",children:n.blockLabel}),t[0]=n.blockLabel,t[1]=i):i=t[1];let o;t[2]!==n.innerPath?(o=n.innerPath&&s.jsx("div",{className:"text-muted-foreground",children:n.innerPath}),t[2]=n.innerPath,t[3]=o):o=t[3];let a;t[4]!==n.blockLabel||t[5]!==n.innerPath||t[6]!==n.label?(a=n.label!==n.blockLabel&&n.label!==n.innerPath&&s.jsx("div",{className:"text-muted-foreground",children:n.label}),t[4]=n.blockLabel,t[5]=n.innerPath,t[6]=n.label,t[7]=a):a=t[7];let m;t[8]!==r||t[9]!==n?(m=Yt(n,r),t[8]=r,t[9]=n,t[10]=m):m=t[10];let l;t[11]!==m?(l=s.jsx("div",{className:"mt-1",children:m}),t[11]=m,t[12]=l):l=t[12];let c;return t[13]!==i||t[14]!==o||t[15]!==a||t[16]!==l?(c=s.jsx(Mt,{children:s.jsxs("div",{className:"text-xs",children:[i,o,a,l]})}),t[13]=i,t[14]=o,t[15]=a,t[16]=l,t[17]=c):c=t[17],c}const lt=16;function Kt(e,t){const n=e?"transparent":"#000 0",r=t?"transparent":"#000 100%";if(!(!e&&!t))return`linear-gradient(to right, ${n}, #000 ${lt}px, #000 calc(100% - ${lt}px), ${r})`}function bt(e){const t=K.c(26),{variant:n,color:r,style:i,children:o,fadeStart:a,fadeEnd:m}=e,l=a===void 0?!1:a,c=m===void 0?!1:m;let d;t[0]!==c||t[1]!==l?(d=Kt(l,c),t[0]=c,t[1]=l,t[2]=d):d=t[2];const f=d;let u;t[3]!==l?(u=l&&{borderTopLeftRadius:0,borderBottomLeftRadius:0},t[3]=l,t[4]=u):u=t[4];let x;t[5]!==c?(x=c&&{borderTopRightRadius:0,borderBottomRightRadius:0},t[5]=c,t[6]=x):x=t[6];let h;t[7]!==f?(h=f&&{maskImage:f,WebkitMaskImage:f},t[7]=f,t[8]=h):h=t[8];let g;t[9]!==r.bg||t[10]!==r.text||t[11]!==i||t[12]!==u||t[13]!==x||t[14]!==h?(g={background:r.bg,color:r.text,borderRadius:4,...u,...x,...h,...i},t[9]=r.bg,t[10]=r.text,t[11]=i,t[12]=u,t[13]=x,t[14]=h,t[15]=g):g=t[15];let b;t[16]!==o?(b=s.jsx("span",{className:"truncate",children:o}),t[16]=o,t[17]=b):b=t[17];let j;t[18]!==g||t[19]!==b?(j=s.jsx(wt,{asChild:!0,children:s.jsx("div",{className:"absolute flex items-center px-2 text-[11px] font-medium truncate cursor-default",style:g,children:b})}),t[18]=g,t[19]=b,t[20]=j):j=t[20];let v;t[21]!==n?(v=s.jsx(Gt,{variant:n}),t[21]=n,t[22]=v):v=t[22];let p;return t[23]!==v||t[24]!==j?(p=s.jsxs(kt,{children:[j,v]}),t[23]=v,t[24]=j,t[25]=p):p=t[25],p}function ir(e){const t=K.c(72),{decofile:n}=e,r=tt(),[i,o]=et.useState("calendar"),[a,m]=et.useState(Xt),[l,c]=et.useState(!1);let d,f,u;if(t[0]!==n||t[1]!==l){const P=Ft(n);d=P.filter(Qt).length,u=l?P:P.filter(qt),f=Vt(u.map(Jt)),t[0]=n,t[1]=l,t[2]=d,t[3]=f,t[4]=u}else d=t[2],f=t[3],u=t[4];const x=f;let h;t[5]===Symbol.for("react.memo_cache_sentinel")?(h=()=>m(xt(new Date)),t[5]=h):h=t[5];const g=h;let b;t[6]!==i?(b=()=>m(P=>i==="calendar"?G(P,-1):G(P,-3)),t[6]=i,t[7]=b):b=t[7];const j=b;let v;t[8]!==i?(v=()=>m(P=>i==="calendar"?G(P,1):G(P,3)),t[8]=i,t[9]=v):v=t[9];const p=v;let y;t[10]!==r?(y=r("sandbox.variantCalendar.today"),t[10]=r,t[11]=y):y=t[11];let T;t[12]!==y?(T=s.jsx(nt,{variant:"outline",size:"sm",onClick:g,children:y}),t[12]=y,t[13]=T):T=t[13];let w;t[14]!==r?(w=r("sandbox.variantCalendar.previous"),t[14]=r,t[15]=w):w=t[15];let D;t[16]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx(vt,{size:16}),t[16]=D):D=t[16];let k;t[17]!==j||t[18]!==w?(k=s.jsx(nt,{variant:"ghost",size:"icon",className:"size-8",onClick:j,"aria-label":w,children:D}),t[17]=j,t[18]=w,t[19]=k):k=t[19];let M;t[20]!==r?(M=r("sandbox.variantCalendar.next"),t[20]=r,t[21]=M):M=t[21];let S;t[22]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Tt,{size:16}),t[22]=S):S=t[22];let A;t[23]!==p||t[24]!==M?(A=s.jsx(nt,{variant:"ghost",size:"icon",className:"size-8",onClick:p,"aria-label":M,children:S}),t[23]=p,t[24]=M,t[25]=A):A=t[25];const $=ht[a.getMonth()];let C;t[26]!==a?(C=a.getFullYear(),t[26]=a,t[27]=C):C=t[27];let _;t[28]!==$||t[29]!==C?(_=s.jsxs("h2",{className:"ml-2 text-base font-semibold",children:[$," ",C]}),t[28]=$,t[29]=C,t[30]=_):_=t[30];let N;t[31]!==A||t[32]!==_||t[33]!==T||t[34]!==k?(N=s.jsxs("div",{className:"flex items-center gap-2",children:[T,k,A,_]}),t[31]=A,t[32]=_,t[33]=T,t[34]=k,t[35]=N):N=t[35];let L;t[36]!==d||t[37]!==l||t[38]!==r?(L=d>0&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nt,{id:"show-ongoing",checked:l,onCheckedChange:c}),s.jsx(jt,{htmlFor:"show-ongoing",className:"text-xs text-muted-foreground cursor-pointer",children:r("sandbox.variantCalendar.showOngoing",{count:d})})]}),t[36]=d,t[37]=l,t[38]=r,t[39]=L):L=t[39];let H;t[40]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx(dt,{}),t[40]=H):H=t[40];let F;t[41]!==r?(F=r("sandbox.variantCalendar.calendarMode"),t[41]=r,t[42]=F):F=t[42];let E;t[43]!==F?(E={value:"calendar",icon:H,label:F},t[43]=F,t[44]=E):E=t[44];let W;t[45]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(yt,{}),t[45]=W):W=t[45];let R;t[46]!==r?(R=r("sandbox.variantCalendar.timelineMode"),t[46]=r,t[47]=R):R=t[47];let O;t[48]!==R?(O={value:"timeline",icon:W,label:R},t[48]=R,t[49]=O):O=t[49];let I;t[50]!==E||t[51]!==O?(I=[E,O],t[50]=E,t[51]=O,t[52]=I):I=t[52];let V;t[53]!==I||t[54]!==i?(V=s.jsx(_t,{value:i,onValueChange:o,options:I}),t[53]=I,t[54]=i,t[55]=V):V=t[55];let z;t[56]!==L||t[57]!==V?(z=s.jsxs("div",{className:"flex items-center gap-4",children:[L,V]}),t[56]=L,t[57]=V,t[58]=z):z=t[58];let U;t[59]!==N||t[60]!==z?(U=s.jsxs("div",{className:"flex items-center justify-between px-4 h-12 border-b shrink-0",children:[N,z]}),t[59]=N,t[60]=z,t[61]=U):U=t[61];let Y;t[62]!==x||t[63]!==a||t[64]!==d||t[65]!==l||t[66]!==u||t[67]!==i?(Y=u.length===0?s.jsx(Zt,{hiddenOngoing:l?0:d}):i==="calendar"?s.jsx(ee,{monthStart:a,variants:u,colorMap:x}):s.jsx(oe,{monthStart:a,variants:u,colorMap:x}),t[62]=x,t[63]=a,t[64]=d,t[65]=l,t[66]=u,t[67]=i,t[68]=Y):Y=t[68];let q;return t[69]!==U||t[70]!==Y?(q=s.jsxs("div",{className:"flex h-full w-full flex-col",children:[U,Y]}),t[69]=U,t[70]=Y,t[71]=q):q=t[71],q}function Jt(e){return e.blockKey}function qt(e){return!e.openEnd}function Qt(e){return e.openEnd}function Xt(){return xt(new Date)}function Zt(e){const t=K.c(4),{hiddenOngoing:n}=e,r=n===void 0?0:n,i=tt();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(dt,{size:24,className:"text-muted-foreground/60"}),t[0]=o):o=t[0];let a;return t[1]!==r||t[2]!==i?(a=s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[o,r>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{children:i("sandbox.variantCalendar.noDatedVariants")}),s.jsx("div",{className:"text-xs text-muted-foreground/80",children:i("sandbox.variantCalendar.hiddenOngoingVariants",{count:r})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{children:i("sandbox.variantCalendar.noScheduledVariants")}),s.jsx("div",{className:"text-xs text-muted-foreground/80",children:i("sandbox.variantCalendar.dateMatcherInfo")})]})]}),t[1]=r,t[2]=i,t[3]=a):a=t[3],a}const rt=20,ct=2,mt=28,te=6;function ee(e){const t=K.c(17),{monthStart:n,variants:r,colorMap:i}=e;let o,a,m,l,c;if(t[0]!==i||t[1]!==n||t[2]!==r){const u=zt(n),x=B(new Date);o=pt,c="flex-1 min-h-0",a="min-w-[840px]",t[8]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("div",{className:"grid grid-cols-7 border-b text-xs text-muted-foreground sticky top-0 bg-background z-10",children:Bt.map(re)}),t[8]=m):m=t[8],l=u.map((h,g)=>{const b=Ut(h,r),j=b.reduce(ne,0),v=mt+j*(rt+ct)+8;return s.jsxs("div",{className:"grid grid-cols-7 relative border-b",style:{height:v},children:[h.map((p,y)=>{const T=p.getMonth()===n.getMonth(),w=p.getTime()===x.getTime();return s.jsx("div",{className:ot("border-r last:border-r-0 px-2 pt-1.5 text-xs",T?"bg-background":"bg-muted/30 text-muted-foreground"),children:s.jsx("span",{className:ot("inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1",w&&"bg-primary text-primary-foreground font-semibold"),children:p.getDate()})},y)}),b.map((p,y)=>{const T=ut(i,p.variant.blockKey),w=mt+p.lane*(rt+ct),D=p.leftUnits/7*100,k=p.widthUnits/7*100,M=p.variant.openStart&&g===0,S=p.variant.openEnd&&g===u.length-1;return s.jsxs(bt,{variant:p.variant,color:T,fadeStart:M,fadeEnd:S,style:{top:w,left:`calc(${D}% + 2px)`,width:`calc(${k}% - 4px)`,minWidth:te,height:rt},children:[p.variant.blockLabel,p.variant.label!==p.variant.blockLabel&&s.jsxs("span",{className:"opacity-70",children:[" · ",p.variant.label]})]},`${g}-${y}`)})]},g)}),t[0]=i,t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=m,t[6]=l,t[7]=c}else o=t[3],a=t[4],m=t[5],l=t[6],c=t[7];let d;t[9]!==a||t[10]!==m||t[11]!==l?(d=s.jsxs("div",{className:a,children:[m,l]}),t[9]=a,t[10]=m,t[11]=l,t[12]=d):d=t[12];let f;return t[13]!==o||t[14]!==c||t[15]!==d?(f=s.jsx(o,{className:c,children:d}),t[13]=o,t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function ne(e,t){return Math.max(e,t.lane+1)}function re(e){return s.jsx("div",{className:"px-2 py-2 text-center uppercase tracking-wide",children:e},e)}const Q=4,se=32,J=240;function oe(e){const t=K.c(23),{monthStart:n,variants:r,colorMap:i}=e,o=n,a=G(n,Q),m=new Date,l=new Map;for(const _ of r){const N=l.get(_.blockKey)??[];N.push(_),l.set(_.blockKey,N)}const c=Array.from(l.entries()).sort(le),d=a.getTime()-o.getTime(),f=_=>(Math.max(o.getTime(),Math.min(a.getTime(),_.getTime()))-o.getTime())/d*100;let u;t[0]!==o?(u=(_,N)=>G(o,N),t[0]=o,t[1]=u):u=t[1];const x=Array.from({length:Q},u),h=m.getTime()>=o.getTime()&&m.getTime()<=a.getTime()?f(m):null,g=tt(),b=pt,j="flex-1 min-h-0",v="min-w-[900px] relative";let p;t[2]===Symbol.for("react.memo_cache_sentinel")?(p={width:J},t[2]=p):p=t[2];let y;t[3]!==g?(y=g("sandbox.variantCalendar.variantBlock"),t[3]=g,t[4]=y):y=t[4];let T;t[5]!==y?(T=s.jsx("div",{className:"shrink-0 px-3 py-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground border-r",style:p,children:y}),t[5]=y,t[6]=T):T=t[6];let w;t[7]===Symbol.for("react.memo_cache_sentinel")?(w={gridTemplateColumns:`repeat(${Q}, minmax(0, 1fr))`},t[7]=w):w=t[7];const D=x.map(ae);let k;t[8]!==D?(k=s.jsx("div",{className:"flex-1 grid",style:w,children:D}),t[8]=D,t[9]=k):k=t[9];let M;t[10]!==T||t[11]!==k?(M=s.jsxs("div",{className:"flex border-b sticky top-0 bg-background z-10",children:[T,k]}),t[10]=T,t[11]=k,t[12]=M):M=t[12];let S;t[13]!==g||t[14]!==h?(S=h!==null&&s.jsx("div",{className:"pointer-events-none absolute top-0 bottom-0 w-px bg-primary/70 z-[5]",style:{left:`calc(${J}px + (100% - ${J}px) * ${h} / 100)`},children:s.jsx("span",{className:"absolute -top-0.5 -translate-x-1/2 rounded-sm bg-primary px-1.5 py-px text-[10px] font-medium text-primary-foreground",children:g("sandbox.variantCalendar.todayLabel")})}),t[13]=g,t[14]=h,t[15]=S):S=t[15];const A=c.map(_=>{const[N,L]=_,H=ut(i,N),F=L[0]?.blockLabel??N;return s.jsxs("div",{children:[s.jsx("div",{className:"flex items-center bg-muted/40 border-b text-xs font-semibold uppercase tracking-wide text-muted-foreground",style:{height:28},children:s.jsx("div",{className:"px-3 truncate",style:{width:J},children:F})}),L.map((E,W)=>s.jsxs("div",{className:"flex border-b items-center",style:{height:se},children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 text-sm border-r shrink-0",style:{width:J},children:[s.jsx("span",{className:"inline-block h-2 w-2 rounded-full shrink-0",style:{background:H.bg}}),s.jsx("span",{className:"truncate text-foreground/80",children:E.label})]}),s.jsxs("div",{className:"relative flex-1 h-full",children:[s.jsx("div",{className:"absolute inset-0 grid",style:{gridTemplateColumns:`repeat(${Q}, minmax(0, 1fr))`},children:x.map(ie)}),(()=>{const R=Math.max(E.start.getTime(),o.getTime()),O=Math.min(E.end.getTime(),a.getTime());if(O<=R)return null;const I=f(new Date(R)),V=f(new Date(O))-I;return s.jsx(bt,{variant:E,color:H,fadeStart:E.openStart,fadeEnd:E.openEnd,style:{top:"50%",transform:"translateY(-50%)",left:`${I}%`,width:`calc(${V}% - 2px)`,height:22},children:E.label})})()]})]},W))]},N)});let $;t[16]!==M||t[17]!==S||t[18]!==A?($=s.jsxs("div",{className:v,children:[M,S,A]}),t[16]=M,t[17]=S,t[18]=A,t[19]=$):$=t[19];let C;return t[20]!==b||t[21]!==$?(C=s.jsx(b,{className:j,children:$}),t[20]=b,t[21]=$,t[22]=C):C=t[22],C}function ie(e,t){return s.jsx("div",{className:"border-r last:border-r-0 border-border/40"},t)}function ae(e,t){return s.jsxs("div",{className:"px-2 py-2 text-xs uppercase tracking-wide text-muted-foreground border-r last:border-r-0",children:[ht[e.getMonth()]?.slice(0,3)," ",e.getFullYear()]},t)}function le(e,t){return e[0].localeCompare(t[0])}export{ir as VariantCalendar};
@@ -1 +1 @@
1
- import{c as $,r as T,m as f,j as i}from"./index-U67qRk6V.js";import{c as k,T as I,a as P}from"./tooltip-slKJgNRK.js";const M={sm:{button:"size-7",buttonWithLabel:"h-7",icon:"size-4"},md:{button:"size-9",buttonWithLabel:"h-9",icon:"size-5"},lg:{button:"size-12",buttonWithLabel:"h-12",icon:"size-6"}};function B(E){const t=$.c(27),{value:s,onValueChange:y,options:o,size:C,fullWidth:L,className:z}=E,_=C===void 0?"sm":C,b=L===void 0?!1:L;let h;t[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],t[0]=h):h=t[0];const R=T.useRef(h);let x;t[1]===Symbol.for("react.memo_cache_sentinel")?(x={left:0,width:0,opacity:0},t[1]=x):x=t[1];const[d,S]=T.useState(x);let g,p;t[2]!==o||t[3]!==s?(g=()=>{const e=o.findIndex(j=>j.value===s),m=R.current[e];m&&S({left:m.offsetLeft,width:m.offsetWidth,opacity:1})},p=[s,o],t[2]=o,t[3]=s,t[4]=g,t[5]=p):(g=t[4],p=t[5]),T.useEffect(g,p);const l=M[_];let n;t[6]!==z?(n=f("relative flex gap-0 bg-muted rounded-lg",z),t[6]=z,t[7]=n):n=t[7];let a;t[8]!==l||t[9]!==b||t[10]!==y||t[11]!==o||t[12]!==s?(a=o.map((e,m)=>{const j=i.jsxs("button",{ref:V=>{R.current[m]=V},type:"button",onClick:()=>y(e.value),"aria-label":e.label,className:f("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",b?"flex-1 h-12 px-4":e.label?f(l.buttonWithLabel,"px-3"):l.button),children:[i.jsx("span",{className:f("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",l.icon,s===e.value?"text-foreground":"text-muted-foreground"),children:e.icon}),e.label&&i.jsx("span",{className:f("text-xs transition-colors ease-out duration-200 whitespace-nowrap",s===e.value?"text-foreground":"text-muted-foreground"),children:e.label})]},e.value);return e.tooltip?i.jsxs(k,{children:[i.jsx(I,{asChild:!0,children:j}),i.jsx(P,{side:"bottom",children:e.tooltip})]},e.value):j}),t[8]=l,t[9]=b,t[10]=y,t[11]=o,t[12]=s,t[13]=a):a=t[13];const w=b?"h-12":l.button;let r;t[14]!==w?(r=f("absolute z-0 bg-background rounded-lg border-shadow transition-all [transition-timing-function:var(--ease-out-cubic)] duration-200",w),t[14]=w,t[15]=r):r=t[15];const W=`${d.left}px`,N=`${d.width}px`;let c;t[16]!==d.opacity||t[17]!==W||t[18]!==N?(c={left:W,width:N,opacity:d.opacity},t[16]=d.opacity,t[17]=W,t[18]=N,t[19]=c):c=t[19];let u;t[20]!==r||t[21]!==c?(u=i.jsx("div",{className:r,style:c}),t[20]=r,t[21]=c,t[22]=u):u=t[22];let v;return t[23]!==u||t[24]!==n||t[25]!==a?(v=i.jsxs("div",{className:n,children:[a,u]}),t[23]=u,t[24]=n,t[25]=a,t[26]=v):v=t[26],v}export{B as V};
1
+ import{c as $,r as T,m as f,j as i}from"./index-TsnmB6QP.js";import{c as k,T as I,a as P}from"./tooltip-Dui8uwfb.js";const M={sm:{button:"size-7",buttonWithLabel:"h-7",icon:"size-4"},md:{button:"size-9",buttonWithLabel:"h-9",icon:"size-5"},lg:{button:"size-12",buttonWithLabel:"h-12",icon:"size-6"}};function B(E){const t=$.c(27),{value:s,onValueChange:y,options:o,size:C,fullWidth:L,className:z}=E,_=C===void 0?"sm":C,b=L===void 0?!1:L;let h;t[0]===Symbol.for("react.memo_cache_sentinel")?(h=[],t[0]=h):h=t[0];const R=T.useRef(h);let x;t[1]===Symbol.for("react.memo_cache_sentinel")?(x={left:0,width:0,opacity:0},t[1]=x):x=t[1];const[d,S]=T.useState(x);let g,p;t[2]!==o||t[3]!==s?(g=()=>{const e=o.findIndex(j=>j.value===s),m=R.current[e];m&&S({left:m.offsetLeft,width:m.offsetWidth,opacity:1})},p=[s,o],t[2]=o,t[3]=s,t[4]=g,t[5]=p):(g=t[4],p=t[5]),T.useEffect(g,p);const l=M[_];let n;t[6]!==z?(n=f("relative flex gap-0 bg-muted rounded-lg",z),t[6]=z,t[7]=n):n=t[7];let a;t[8]!==l||t[9]!==b||t[10]!==y||t[11]!==o||t[12]!==s?(a=o.map((e,m)=>{const j=i.jsxs("button",{ref:V=>{R.current[m]=V},type:"button",onClick:()=>y(e.value),"aria-label":e.label,className:f("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",b?"flex-1 h-12 px-4":e.label?f(l.buttonWithLabel,"px-3"):l.button),children:[i.jsx("span",{className:f("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",l.icon,s===e.value?"text-foreground":"text-muted-foreground"),children:e.icon}),e.label&&i.jsx("span",{className:f("text-xs transition-colors ease-out duration-200 whitespace-nowrap",s===e.value?"text-foreground":"text-muted-foreground"),children:e.label})]},e.value);return e.tooltip?i.jsxs(k,{children:[i.jsx(I,{asChild:!0,children:j}),i.jsx(P,{side:"bottom",children:e.tooltip})]},e.value):j}),t[8]=l,t[9]=b,t[10]=y,t[11]=o,t[12]=s,t[13]=a):a=t[13];const w=b?"h-12":l.button;let r;t[14]!==w?(r=f("absolute z-0 bg-background rounded-lg border-shadow transition-all [transition-timing-function:var(--ease-out-cubic)] duration-200",w),t[14]=w,t[15]=r):r=t[15];const W=`${d.left}px`,N=`${d.width}px`;let c;t[16]!==d.opacity||t[17]!==W||t[18]!==N?(c={left:W,width:N,opacity:d.opacity},t[16]=d.opacity,t[17]=W,t[18]=N,t[19]=c):c=t[19];let u;t[20]!==r||t[21]!==c?(u=i.jsx("div",{className:r,style:c}),t[20]=r,t[21]=c,t[22]=u):u=t[22];let v;return t[23]!==u||t[24]!==n||t[25]!==a?(v=i.jsxs("div",{className:n,children:[a,u]}),t[23]=u,t[24]=n,t[25]=a,t[26]=v):v=t[26],v}export{B as V};
@@ -50,8 +50,8 @@
50
50
  <meta name="twitter:description" content="Hire specialized agents, give them access to your tools, and let them deliver real projects — with planning, verification, and observability built in." />
51
51
  <meta name="twitter:image" content="/og-image.png" />
52
52
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
53
- <script type="module" crossorigin src="/assets/index-U67qRk6V.js"></script>
54
- <link rel="stylesheet" crossorigin href="/assets/index-B3kZ43lJ.css">
53
+ <script type="module" crossorigin src="/assets/index-TsnmB6QP.js"></script>
54
+ <link rel="stylesheet" crossorigin href="/assets/index-B1fXHVYV.css">
55
55
  </head>
56
56
  <body>
57
57
  <div id="root"></div>
@@ -1371,7 +1371,7 @@ Usage: deco services <up|down|status>`),process.exit(1)}}var Hi1=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 Mo1($){await Mp6($),await Vp6($);let Z=new Io1({db:$,provider:{getMigrations:()=>Promise.resolve(Ri0)}}),{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 kp6($){let{keepOpen:Z=!1,database:X,skipBetterAuth:Q=!1}=$??{},Y="skipped";if(!Q&&!X)Y=await pc0();let G=X??U6(),J=async()=>{if(!Z&&!X)await hB(G).catch((K)=>{console.warn("Warning: Error closing database:",K)})};try{let K=await Mo1(G.db);return await J(),{betterAuth:Y,kysely:K}}catch(K){throw await J(),K}}async function Sp6(){let $=U6(),Z=new Io1({db:$.db,provider:{getMigrations:()=>Promise.resolve(Ri0)}}),{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 ko1=w(()=>{Ro1();tc0();QX()});async function qZ0($){let Z={...process.env},X=D80($,Z);console.log(dw1(X.settings.encryptionKey));let Q=X.settings.betterAuthSecret||(X.settings.localMode?hn1(X.settings.dataDir):""),{ensureServices:Y}=await Promise.resolve().then(() => (x90(),v90)),{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(() => (tc0(),cn1));await W(G.databaseUrl);let{createDatabase:H}=await Promise.resolve().then(() => (QX(),Yn1)),{migrateToLatest:N}=await Promise.resolve().then(() => (ko1(),Vo1)),F=H(G.databaseUrl);await N({keepOpen:!0,database:F,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 Ni1(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 Ii0=w(()=>{Lf();un1();C8()});var _o1={};U0(_o1,{updateService:()=>EE,subscribeCliState:()=>Vi0,setTuiConsoleIntercepted:()=>MZ0,setServerUrl:()=>vi,setMigrationsDone:()=>_i,setDevMode:()=>vp6,resetCliStateForTests:()=>Cp6,isTuiConsoleIntercepted:()=>VZ0,getCliState:()=>Mi0,addLogEntry:()=>mB});function So1(){return{services:[{name:"Postgres",status:"pending",port:0},{name:"NATS",status:"pending",port:0}],migrationsStatus:"pending",serverUrl:null,logs:[]}}function Cp6(){lQ=So1()}function _p6(){return[{name:"Postgres",status:"pending",port:0},{name:"NATS",status:"pending",port:0}]}function Ci(){for(let $ of qi0)$()}function Mi0(){return lQ}function Vi0($){return qi0.add($),()=>qi0.delete($)}function EE($){lQ={...lQ,services:lQ.services.map((Z)=>Z.name===$.name?$:Z)},Ci()}function _i(){lQ={...lQ,migrationsStatus:"done"},Ci()}function vi($){lQ={...lQ,serverUrl:$},Ci()}function mB($){let Z=[...lQ.logs,$];lQ={...lQ,logs:Z.length>500?Z.slice(-500):Z},Ci()}function vp6(){lQ={...lQ,services:[..._p6(),{name:"API",status:"pending",port:0},{name:"Vite",status:"pending",port:0}]},Ci()}function MZ0($){Co1=$}function VZ0(){return Co1}var lQ,qi0,Co1=!1;var jE=w(()=>{lQ=So1();qi0=new Set});import{createServer as vo1}from"net";function xp6($){return new Promise((Z)=>{let X=vo1();X.once("error",()=>Z(!1)),X.listen($,"0.0.0.0",()=>{X.close(()=>Z(!0))})})}async function xi($){if(await xp6($))return $;let Z=await new Promise((X,Q)=>{let Y=vo1();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 ki0=()=>{};function fi($){return $.replace(/\x1b\[[0-9;]*m/g,"")}var Si0={};U0(Si0,{startDevServer:()=>bp6});import{join as fp6}from"path";function xo1($){let Z=$.getReader(),X=new TextDecoder,Q="";function Y(){let G=Q.split(`
1374
- `);Q=G.pop()??"";for(let J of G){let K=fi(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=fi(Q).replace(/^\[\d+\]\s*/,"").trim();if(G)mB({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:G})}})()}async function bp6($){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 xi(Number(Y)+1):await xi(Number($.port)),{settings:K,services:W,managedServiceNames:H}=await qZ0({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});_i();let N=fp6(import.meta.dir,"..","..","..","..",".."),F=X===!0,U=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",F?"inherit":"pipe",F?"inherit":"pipe"]});if(!F)xo1(U.stdout),xo1(U.stderr);vi(G),EE({name:"Vite",status:"ready",port:Number(Y)}),EE({name:"API",status:"ready",port:Number(K.port)});let O=async(L)=>{if(U.kill(L),await U.exited,H.length>0){let{stopServices:D}=await Promise.resolve().then(() => (x90(),v90));await D(K.dataDir)}};return process.on("SIGINT",()=>O("SIGINT")),process.on("SIGTERM",()=>O("SIGTERM")),{port:Number(Y),process:U}}var Ci0=w(()=>{Ii0();jE();ki0()});var kZ0;var _i0=w(()=>{kZ0={name:"decocms",version:"4.245.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 gp6,Text as fo1}from"ink";import{jsx as hp6,jsxs as bo1}from"react/jsx-runtime";function yo1({version:$}){return bo1(gp6,{flexDirection:"column",marginTop:1,children:[QZ0.map((Z,X)=>hp6(fo1,{color:YZ0[X],children:Z},X)),bo1(fo1,{dimColor:!0,children:[" v",$]})]})}var go1=w(()=>{zi()});import{Box as zE,Text as iB}from"ink";import{Spinner as up6}from"@inkjs/ui";import{jsx as aY,jsxs as ib}from"react/jsx-runtime";function ho1({status:$}){if($==="pending")return aY(up6,{label:""});return aY(iB,{color:"green",children:"\u2713"})}function cp6($){return`${$.name}: ${$.port||"...."}`}function uo1({services:$,migrationsStatus:Z,home:X,serverUrl:Q}){return ib(zE,{flexDirection:"column",paddingBottom:1,children:[aY(yo1,{version:kZ0.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:cp6(Y)}),aY(ho1,{status:Y.status})]},Y.name)),ib(zE,{gap:1,children:[aY(iB,{children:"Migrations"}),aY(ho1,{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 co1=w(()=>{_i0();go1()});import{Box as lp6,Text as bi}from"ink";import{jsx as vi0,jsxs as xi0}from"react/jsx-runtime";function dp6($){if($>=500)return"red";if($>=400)return"yellow";if($>=300)return"cyan";return"green"}function lo1({logs:$}){return vi0(lp6,{flexDirection:"column",children:$.map((Z,X)=>{if(Z.rawLine)return vi0(bi,{dimColor:!0,children:Z.rawLine},X);let Q=Z.duration<1000?`${Z.duration}ms`:`${(Z.duration/1000).toFixed(1)}s`;return xi0(bi,{children:[xi0(bi,{dimColor:!0,children:[Z.method.padEnd(6)," ",Z.path.padEnd(30)," "]}),vi0(bi,{color:dp6(Z.status),children:Z.status}),xi0(bi,{dimColor:!0,children:[" ",Q.padStart(8)]})]},X)})})}var do1=()=>{};var fi0={};U0(fi0,{App:()=>np6});import{Box as mp6}from"ink";import{useSyncExternalStore as ip6}from"react";import{jsx as mo1,jsxs as pp6}from"react/jsx-runtime";function np6({home:$}){let Z=ip6(Vi0,Mi0);return pp6(mp6,{flexDirection:"column",children:[mo1(uo1,{services:Z.services,migrationsStatus:Z.migrationsStatus,home:$,serverUrl:Z.serverUrl}),mo1(lo1,{logs:Z.logs})]})}var bi0=w(()=>{co1();do1();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 io1="7";function no1($){return{name:"decocms",systemDatabaseUrl:$.systemDatabaseUrl,systemDatabaseSchemaName:"dbos",systemDatabasePoolSize:$.poolSize,runAdminServer:!1,executorID:$.executorID,applicationVersion:io1,...$.listenQueues!==void 0?{listenQueues:$.listenQueues}:{}}}var po1=()=>{};function tp6(){let $=(process.env.BUN_OPTIONS??"").split(/\s+/).filter(Boolean);return[...process.argv.slice(1),...$]}function yi0($,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 to1(){let $=tp6();if($.includes("--cpu-prof")){console.log(JSON.stringify({msg:"cpu-profiling-active",dir:yi0($,"--cpu-prof-dir")??process.cwd(),name:yi0($,"--cpu-prof-name"),markdown:$.includes("--cpu-prof-md"),intervalUs:Number(yi0($,"--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 oo1(){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(()=>{}),SZ0=setInterval(()=>void Z().catch(()=>{}),$),SZ0.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(SZ0)clearInterval(SZ0)}}var SZ0;var ro1=()=>{};import*as op6 from"bun:jsc";function ao1(){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{rp6()}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=ap6()?.traces??[]}catch{}if(J>$&&K.length>0){let W=new Map;for(let N of K){let F=N.frames.find((O)=>O.sourceURL&&!/Unknown Executable/.test(O.category??""))??N.frames[0];if(!F)continue;let U=(F.sourceURL??"?").replace(/^.*\/node_modules\//,"node_modules/"),B=`${F.name??"?"} @ ${U}:${F.line??"?"}`;W.set(B,(W.get(B)??0)+1)}let H=[...W.entries()].sort((N,F)=>F[1]-N[1]).slice(0,8).map(([N,F])=>({frame:N,count:F}));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 rp6,ap6;var so1=w(()=>{({startSamplingProfiler:rp6,samplingProfilerStackTraces:ap6}=op6)});function eo1(){to1();let $=[oo1(),ri1(),ao1()];return()=>{for(let Z of $)Z()}}var $r1=w(()=>{yc0();ro1();so1()});var TE=v((Zr1)=>{Object.defineProperty(Zr1,"__esModule",{value:!0});Zr1.RepublishHeaders=Zr1.DirectMsgHeaders=Zr1.JsHeaders=Zr1.AdvisoryKind=void 0;Zr1.isOrderedPushConsumerOptions=sp6;Zr1.isPullConsumer=ep6;Zr1.isPushConsumer=$t6;Zr1.isBoundPushConsumerOptions=Zt6;function sp6($){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 ep6($){return $.isPullConsumer()}function $t6($){return $.isPushConsumer()}function Zt6($){if($&&typeof $==="object")return"deliver_subject"in $||"deliver_group"in $||"idle_heartbeat"in $;return!1}Zr1.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"};Zr1.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"};Zr1.DirectMsgHeaders={Stream:"Nats-Stream",Sequence:"Nats-Sequence",TimeStamp:"Nats-Time-Stamp",Subject:"Nats-Subject",LastSequence:"Nats-Last-Sequence",NumPending:"Nats-Num-Pending"};Zr1.RepublishHeaders={Stream:"Nats-Stream",Subject:"Nats-Subject",Sequence:"Nats-Sequence",LastSequence:"Nats-Last-Sequence",Size:"Nats-Msg-Size"}});var sY=v((Qr1)=>{Object.defineProperty(Qr1,"__esModule",{value:!0});Qr1.TD=Qr1.TE=Qr1.Empty=void 0;Qr1.encode=Nt6;Qr1.decode=Ft6;Qr1.Empty=new Uint8Array(0);Qr1.TE=new TextEncoder;Qr1.TD=new TextDecoder;function Ht6(...$){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 Nt6(...$){let Z=[];for(let X=0;X<$.length;X++)Z.push(Qr1.TE.encode($[X]));if(Z.length===0)return Qr1.Empty;if(Z.length===1)return Z[0];return Ht6(...Z)}function Ft6($){if(!$||$.length===0)return"";return Qr1.TD.decode($)}});var eY=v((Jr1)=>{Object.defineProperty(Jr1,"__esModule",{value:!0});Jr1.errors=Jr1.PermissionViolationError=Jr1.NoRespondersError=Jr1.TimeoutError=Jr1.RequestError=Jr1.ProtocolError=Jr1.ConnectionError=Jr1.DrainingConnectionError=Jr1.ClosedConnectionError=Jr1.AuthorizationError=Jr1.UserAuthenticationExpiredError=Jr1.InvalidOperationError=Jr1.InvalidArgumentError=Jr1.InvalidSubjectError=void 0;class hi0 extends Error{constructor($,Z){super(`illegal subject: '${$}'`,Z);this.name="InvalidSubjectError"}}Jr1.InvalidSubjectError=hi0;class CZ0 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 CZ0(`${$} ${Z}`,X)}}Jr1.InvalidArgumentError=CZ0;class ui0 extends Error{constructor($,Z){super($,Z);this.name="InvalidOperationError"}}Jr1.InvalidOperationError=ui0;class _Z0 extends Error{constructor($,Z){super($,Z);this.name="UserAuthenticationExpiredError"}static parse($){if($.toLowerCase().indexOf("user authentication expired")!==-1)return new _Z0($);return null}}Jr1.UserAuthenticationExpiredError=_Z0;class vZ0 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 vZ0($);return null}}Jr1.AuthorizationError=vZ0;class ci0 extends Error{constructor(){super("closed connection");this.name="ClosedConnectionError"}}Jr1.ClosedConnectionError=ci0;class li0 extends Error{constructor(){super("connection draining");this.name="DrainingConnectionError"}}Jr1.DrainingConnectionError=li0;class di0 extends Error{constructor($,Z){super($,Z);this.name="ConnectionError"}}Jr1.ConnectionError=di0;class mi0 extends Error{constructor($,Z){super($,Z);this.name="ProtocolError"}}Jr1.ProtocolError=mi0;class ii0 extends Error{constructor($="",Z){super($,Z);this.name="RequestError"}isNoResponders(){return this.cause instanceof xZ0}}Jr1.RequestError=ii0;class ni0 extends Error{constructor($){super("timeout",$);this.name="TimeoutError"}}Jr1.TimeoutError=ni0;class xZ0 extends Error{subject;constructor($,Z){super(`no responders: '${$}'`,Z);this.subject=$,this.name="NoResponders"}}Jr1.NoRespondersError=xZ0;class fZ0 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 fZ0($,X,Q,Y)}}Jr1.PermissionViolationError=fZ0;Jr1.errors={AuthorizationError:vZ0,ClosedConnectionError:ci0,ConnectionError:di0,DrainingConnectionError:li0,InvalidArgumentError:CZ0,InvalidOperationError:ui0,InvalidSubjectError:hi0,NoRespondersError:xZ0,PermissionViolationError:fZ0,ProtocolError:mi0,RequestError:ii0,TimeoutError:ni0,UserAuthenticationExpiredError:_Z0}});var bJ=v((Fr1)=>{Object.defineProperty(Fr1,"__esModule",{value:!0});Fr1.SimpleMutex=Fr1.Perf=void 0;Fr1.extend=Vt6;Fr1.render=kt6;Fr1.timeout=St6;Fr1.delay=Ct6;Fr1.deadline=_t6;Fr1.deferred=ti0;Fr1.debugDeferred=vt6;Fr1.shuffle=xt6;Fr1.collect=ft6;Fr1.jitter=Nr1;Fr1.backoff=bt6;Fr1.nanos=yt6;Fr1.millis=gt6;Fr1.randomToken=ct6;var Mt6=sY(),pi0=eY();function Vt6($,...Z){for(let X=0;X<Z.length;X++){let Q=Z[X];Object.keys(Q).forEach(function(Y){$[Y]=Q[Y]})}return $}function kt6($){return Mt6.TD.decode($).replace(/\n/g,"\u240A").replace(/\r/g,"\u240D")}function St6($,Z=!0){let X=Z?new pi0.TimeoutError:null,Q,Y,G=new Promise((J,K)=>{Q={cancel:()=>{if(Y)clearTimeout(Y)}},Y=setTimeout(()=>{if(X===null)K(new pi0.TimeoutError);else K(X)},$)});return Object.assign(G,Q)}function Ct6($=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 _t6($,Z=1000){let X=ti0(),Q=setTimeout(()=>{X.reject(new pi0.TimeoutError)},Z);try{return await Promise.race([$,X])}finally{clearTimeout(Q)}}function ti0(){let $={},Z=new Promise((X,Q)=>{$={resolve:X,reject:Q}});return Object.assign(Z,$)}function vt6(){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 xt6($){for(let Z=$.length-1;Z>0;Z--){let X=Math.floor(Math.random()*(Z+1));[$[Z],$[X]]=[$[X],$[Z]]}return $}async function ft6($){let Z=[];for await(let X of $)Z.push(X);return Z}class Wr1{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})}),$}}Fr1.Perf=Wr1;class Hr1{max;current;waiting;constructor($=1){this.max=$,this.current=0,this.waiting=[]}lock(){if(this.current++,this.current<=this.max)return Promise.resolve();let $=ti0();return this.waiting.push($),$}unlock(){this.current--,this.waiting.pop()?.resolve()}}Fr1.SimpleMutex=Hr1;function Nr1($){if($===0)return 0;return Math.floor($/2+Math.random()*$)}function bt6($=[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 Nr1(X>Z?$[Z]:$[X])}}}function yt6($){return $*1e6}function gt6($){return Math.floor($/1e6)}var ht6="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",$F=new Uint8Array(62);for(let $=0;$<62;$++)$F[$]=ht6.charCodeAt($);var ut6=218340105584896;function ct6(){let $=Math.floor(Math.random()*ut6),Z=$%62,X=$F[Z];$=($-Z)/62,Z=$%62;let Q=$F[Z];$=($-Z)/62,Z=$%62;let Y=$F[Z];$=($-Z)/62,Z=$%62;let G=$F[Z];$=($-Z)/62,Z=$%62;let J=$F[Z];$=($-Z)/62,Z=$%62;let K=$F[Z];$=($-Z)/62,Z=$%62;let W=$F[Z];$=($-Z)/62;let H=$F[$];return String.fromCharCode(X,Q,Y,G,J,K,W,H)}});var jr1=v((Dr1)=>{Object.defineProperty(Dr1,"__esModule",{value:!0});Dr1.nuid=Dr1.NuidImpl=void 0;var Qo6="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",pB=62,yZ0=12,wr1=10,Br1=33,Yo6=333,Or1=yZ0+wr1,ri0=new Uint8Array(pB);for(let $=0;$<pB;$++)ri0[$]=Qo6.charCodeAt($);var bZ0=4294967296,Lr1=BigInt(pB)**BigInt(wr1),yi=Number(Lr1/(1n<<32n)),oi0=Number(Lr1%(1n<<32n));function Go6($){for(let Z=0;Z<$.length;Z++)$[Z]=Math.floor(Math.random()*256)}function Jo6($){if(globalThis?.crypto?.getRandomValues)globalThis.crypto.getRandomValues($);else Go6($)}class ai0{buf;cbuf;seqHi;seqLo;inc;inited;constructor(){this.buf=new Uint8Array(Or1),this.cbuf=new Uint8Array(yZ0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){let $=0;do this.seqHi=Math.floor(Math.random()*(yi+1)),this.seqLo=Math.floor(Math.random()*bZ0);while($++<8&&this.seqHi===yi&&this.seqLo>=oi0);if(this.seqHi===yi&&this.seqLo>=oi0)this.seqLo=0;this.inc=Math.random()*(Yo6-Br1)+Br1|0}setPre(){Jo6(this.cbuf);for(let $=0;$<yZ0;$++)this.buf[$]=ri0[this.cbuf[$]%pB]}fillSeq(){let $=this.seqHi,Z=this.seqLo;for(let X=Or1-1;X>=yZ0;X--){let Q=Math.floor($/pB),G=($-Q*pB)*bZ0+Z,J=Math.floor(G/pB),K=G-J*pB;this.buf[X]=ri0[K],$=Q,Z=J}}next(){if(!this.inited)this.init();if(this.seqLo+=this.inc,this.seqLo>=bZ0)this.seqLo-=bZ0,this.seqHi+=1;if(this.seqHi>yi||this.seqHi===yi&&this.seqLo>=oi0)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()}}Dr1.NuidImpl=ai0;Dr1.nuid=new ai0});var Tr1=v((Pr1)=>{Object.defineProperty(Pr1,"__esModule",{value:!0});Pr1.nuid=Pr1.Nuid=void 0;var zr1=jr1();Pr1.Nuid=zr1.NuidImpl;Pr1.nuid=zr1.nuid});var hZ0=v((gZ0)=>{Object.defineProperty(gZ0,"__esModule",{value:!0});gZ0.nuid=gZ0.Nuid=void 0;var Rr1=Tr1();Object.defineProperty(gZ0,"Nuid",{enumerable:!0,get:function(){return Rr1.Nuid}});Object.defineProperty(gZ0,"nuid",{enumerable:!0,get:function(){return Rr1.nuid}})});var tB=v((Ir1)=>{Object.defineProperty(Ir1,"__esModule",{value:!0});Ir1.DEFAULT_HOST=Ir1.DEFAULT_PORT=Ir1.Match=void 0;Ir1.syncIterator=Uo6;Ir1.createInbox=Bo6;var No6=hZ0(),Fo6=eY();Ir1.Match={Exact:"exact",CanonicalMIME:"canonical",IgnoreCase:"insensitive"};function Uo6($){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 Bo6($=""){if($=$||"_INBOX",typeof $!=="string")throw TypeError("prefix must be a string");return $.split(".").forEach((Z)=>{if(Z==="*"||Z===">")throw Fo6.InvalidArgumentError.format("prefix",`cannot have wildcards ('${$}')`)}),`${$}.${No6.nuid.next()}`}Ir1.DEFAULT_PORT=4222;Ir1.DEFAULT_HOST="127.0.0.1"});var gi=v((kr1)=>{Object.defineProperty(kr1,"__esModule",{value:!0});kr1.DataBuffer=void 0;var Mr1=sY();class Vr1{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 Mr1.TE.encode($)}static toAscii($){return Mr1.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}}kr1.DataBuffer=Vr1});var RE=v((_r1)=>{Object.defineProperty(_r1,"__esModule",{value:!0});_r1.LF=_r1.CR=_r1.CRLF=_r1.CR_LF_LEN=_r1.CR_LF=void 0;_r1.setTransportFactory=Po6;_r1.defaultPort=Ao6;_r1.getUrlParseFn=To6;_r1.newTransport=Ro6;_r1.getResolveFn=Io6;_r1.protoLen=Cr1;_r1.extractProtocolMessage=qo6;var Eo6=sY(),jo6=tB(),zo6=gi(),$G;function Po6($){$G=$}function Ao6(){return $G!==void 0&&$G.defaultPort!==void 0?$G.defaultPort:jo6.DEFAULT_PORT}function To6(){return $G!==void 0&&$G.urlParseFn?$G.urlParseFn:void 0}function Ro6(){if(!$G||typeof $G.factory!=="function")throw Error("transport fn is not set");return $G.factory()}function Io6(){return $G!==void 0&&$G.dnsResolveFn?$G.dnsResolveFn:void 0}_r1.CR_LF=`\r
1374
+ `);Q=G.pop()??"";for(let J of G){let K=fi(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=fi(Q).replace(/^\[\d+\]\s*/,"").trim();if(G)mB({method:"",path:"",status:0,duration:0,timestamp:new Date,rawLine:G})}})()}async function bp6($){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 xi(Number(Y)+1):await xi(Number($.port)),{settings:K,services:W,managedServiceNames:H}=await qZ0({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});_i();let N=fp6(import.meta.dir,"..","..","..","..",".."),F=X===!0,U=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",F?"inherit":"pipe",F?"inherit":"pipe"]});if(!F)xo1(U.stdout),xo1(U.stderr);vi(G),EE({name:"Vite",status:"ready",port:Number(Y)}),EE({name:"API",status:"ready",port:Number(K.port)});let O=async(L)=>{if(U.kill(L),await U.exited,H.length>0){let{stopServices:D}=await Promise.resolve().then(() => (x90(),v90));await D(K.dataDir)}};return process.on("SIGINT",()=>O("SIGINT")),process.on("SIGTERM",()=>O("SIGTERM")),{port:Number(Y),process:U}}var Ci0=w(()=>{Ii0();jE();ki0()});var kZ0;var _i0=w(()=>{kZ0={name:"decocms",version:"4.246.0",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 gp6,Text as fo1}from"ink";import{jsx as hp6,jsxs as bo1}from"react/jsx-runtime";function yo1({version:$}){return bo1(gp6,{flexDirection:"column",marginTop:1,children:[QZ0.map((Z,X)=>hp6(fo1,{color:YZ0[X],children:Z},X)),bo1(fo1,{dimColor:!0,children:[" v",$]})]})}var go1=w(()=>{zi()});import{Box as zE,Text as iB}from"ink";import{Spinner as up6}from"@inkjs/ui";import{jsx as aY,jsxs as ib}from"react/jsx-runtime";function ho1({status:$}){if($==="pending")return aY(up6,{label:""});return aY(iB,{color:"green",children:"\u2713"})}function cp6($){return`${$.name}: ${$.port||"...."}`}function uo1({services:$,migrationsStatus:Z,home:X,serverUrl:Q}){return ib(zE,{flexDirection:"column",paddingBottom:1,children:[aY(yo1,{version:kZ0.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:cp6(Y)}),aY(ho1,{status:Y.status})]},Y.name)),ib(zE,{gap:1,children:[aY(iB,{children:"Migrations"}),aY(ho1,{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 co1=w(()=>{_i0();go1()});import{Box as lp6,Text as bi}from"ink";import{jsx as vi0,jsxs as xi0}from"react/jsx-runtime";function dp6($){if($>=500)return"red";if($>=400)return"yellow";if($>=300)return"cyan";return"green"}function lo1({logs:$}){return vi0(lp6,{flexDirection:"column",children:$.map((Z,X)=>{if(Z.rawLine)return vi0(bi,{dimColor:!0,children:Z.rawLine},X);let Q=Z.duration<1000?`${Z.duration}ms`:`${(Z.duration/1000).toFixed(1)}s`;return xi0(bi,{children:[xi0(bi,{dimColor:!0,children:[Z.method.padEnd(6)," ",Z.path.padEnd(30)," "]}),vi0(bi,{color:dp6(Z.status),children:Z.status}),xi0(bi,{dimColor:!0,children:[" ",Q.padStart(8)]})]},X)})})}var do1=()=>{};var fi0={};U0(fi0,{App:()=>np6});import{Box as mp6}from"ink";import{useSyncExternalStore as ip6}from"react";import{jsx as mo1,jsxs as pp6}from"react/jsx-runtime";function np6({home:$}){let Z=ip6(Vi0,Mi0);return pp6(mp6,{flexDirection:"column",children:[mo1(uo1,{services:Z.services,migrationsStatus:Z.migrationsStatus,home:$,serverUrl:Z.serverUrl}),mo1(lo1,{logs:Z.logs})]})}var bi0=w(()=>{co1();do1();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 io1="7";function no1($){return{name:"decocms",systemDatabaseUrl:$.systemDatabaseUrl,systemDatabaseSchemaName:"dbos",systemDatabasePoolSize:$.poolSize,runAdminServer:!1,executorID:$.executorID,applicationVersion:io1,...$.listenQueues!==void 0?{listenQueues:$.listenQueues}:{}}}var po1=()=>{};function tp6(){let $=(process.env.BUN_OPTIONS??"").split(/\s+/).filter(Boolean);return[...process.argv.slice(1),...$]}function yi0($,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 to1(){let $=tp6();if($.includes("--cpu-prof")){console.log(JSON.stringify({msg:"cpu-profiling-active",dir:yi0($,"--cpu-prof-dir")??process.cwd(),name:yi0($,"--cpu-prof-name"),markdown:$.includes("--cpu-prof-md"),intervalUs:Number(yi0($,"--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 oo1(){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(()=>{}),SZ0=setInterval(()=>void Z().catch(()=>{}),$),SZ0.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(SZ0)clearInterval(SZ0)}}var SZ0;var ro1=()=>{};import*as op6 from"bun:jsc";function ao1(){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{rp6()}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=ap6()?.traces??[]}catch{}if(J>$&&K.length>0){let W=new Map;for(let N of K){let F=N.frames.find((O)=>O.sourceURL&&!/Unknown Executable/.test(O.category??""))??N.frames[0];if(!F)continue;let U=(F.sourceURL??"?").replace(/^.*\/node_modules\//,"node_modules/"),B=`${F.name??"?"} @ ${U}:${F.line??"?"}`;W.set(B,(W.get(B)??0)+1)}let H=[...W.entries()].sort((N,F)=>F[1]-N[1]).slice(0,8).map(([N,F])=>({frame:N,count:F}));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 rp6,ap6;var so1=w(()=>{({startSamplingProfiler:rp6,samplingProfilerStackTraces:ap6}=op6)});function eo1(){to1();let $=[oo1(),ri1(),ao1()];return()=>{for(let Z of $)Z()}}var $r1=w(()=>{yc0();ro1();so1()});var TE=v((Zr1)=>{Object.defineProperty(Zr1,"__esModule",{value:!0});Zr1.RepublishHeaders=Zr1.DirectMsgHeaders=Zr1.JsHeaders=Zr1.AdvisoryKind=void 0;Zr1.isOrderedPushConsumerOptions=sp6;Zr1.isPullConsumer=ep6;Zr1.isPushConsumer=$t6;Zr1.isBoundPushConsumerOptions=Zt6;function sp6($){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 ep6($){return $.isPullConsumer()}function $t6($){return $.isPushConsumer()}function Zt6($){if($&&typeof $==="object")return"deliver_subject"in $||"deliver_group"in $||"idle_heartbeat"in $;return!1}Zr1.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"};Zr1.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"};Zr1.DirectMsgHeaders={Stream:"Nats-Stream",Sequence:"Nats-Sequence",TimeStamp:"Nats-Time-Stamp",Subject:"Nats-Subject",LastSequence:"Nats-Last-Sequence",NumPending:"Nats-Num-Pending"};Zr1.RepublishHeaders={Stream:"Nats-Stream",Subject:"Nats-Subject",Sequence:"Nats-Sequence",LastSequence:"Nats-Last-Sequence",Size:"Nats-Msg-Size"}});var sY=v((Qr1)=>{Object.defineProperty(Qr1,"__esModule",{value:!0});Qr1.TD=Qr1.TE=Qr1.Empty=void 0;Qr1.encode=Nt6;Qr1.decode=Ft6;Qr1.Empty=new Uint8Array(0);Qr1.TE=new TextEncoder;Qr1.TD=new TextDecoder;function Ht6(...$){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 Nt6(...$){let Z=[];for(let X=0;X<$.length;X++)Z.push(Qr1.TE.encode($[X]));if(Z.length===0)return Qr1.Empty;if(Z.length===1)return Z[0];return Ht6(...Z)}function Ft6($){if(!$||$.length===0)return"";return Qr1.TD.decode($)}});var eY=v((Jr1)=>{Object.defineProperty(Jr1,"__esModule",{value:!0});Jr1.errors=Jr1.PermissionViolationError=Jr1.NoRespondersError=Jr1.TimeoutError=Jr1.RequestError=Jr1.ProtocolError=Jr1.ConnectionError=Jr1.DrainingConnectionError=Jr1.ClosedConnectionError=Jr1.AuthorizationError=Jr1.UserAuthenticationExpiredError=Jr1.InvalidOperationError=Jr1.InvalidArgumentError=Jr1.InvalidSubjectError=void 0;class hi0 extends Error{constructor($,Z){super(`illegal subject: '${$}'`,Z);this.name="InvalidSubjectError"}}Jr1.InvalidSubjectError=hi0;class CZ0 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 CZ0(`${$} ${Z}`,X)}}Jr1.InvalidArgumentError=CZ0;class ui0 extends Error{constructor($,Z){super($,Z);this.name="InvalidOperationError"}}Jr1.InvalidOperationError=ui0;class _Z0 extends Error{constructor($,Z){super($,Z);this.name="UserAuthenticationExpiredError"}static parse($){if($.toLowerCase().indexOf("user authentication expired")!==-1)return new _Z0($);return null}}Jr1.UserAuthenticationExpiredError=_Z0;class vZ0 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 vZ0($);return null}}Jr1.AuthorizationError=vZ0;class ci0 extends Error{constructor(){super("closed connection");this.name="ClosedConnectionError"}}Jr1.ClosedConnectionError=ci0;class li0 extends Error{constructor(){super("connection draining");this.name="DrainingConnectionError"}}Jr1.DrainingConnectionError=li0;class di0 extends Error{constructor($,Z){super($,Z);this.name="ConnectionError"}}Jr1.ConnectionError=di0;class mi0 extends Error{constructor($,Z){super($,Z);this.name="ProtocolError"}}Jr1.ProtocolError=mi0;class ii0 extends Error{constructor($="",Z){super($,Z);this.name="RequestError"}isNoResponders(){return this.cause instanceof xZ0}}Jr1.RequestError=ii0;class ni0 extends Error{constructor($){super("timeout",$);this.name="TimeoutError"}}Jr1.TimeoutError=ni0;class xZ0 extends Error{subject;constructor($,Z){super(`no responders: '${$}'`,Z);this.subject=$,this.name="NoResponders"}}Jr1.NoRespondersError=xZ0;class fZ0 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 fZ0($,X,Q,Y)}}Jr1.PermissionViolationError=fZ0;Jr1.errors={AuthorizationError:vZ0,ClosedConnectionError:ci0,ConnectionError:di0,DrainingConnectionError:li0,InvalidArgumentError:CZ0,InvalidOperationError:ui0,InvalidSubjectError:hi0,NoRespondersError:xZ0,PermissionViolationError:fZ0,ProtocolError:mi0,RequestError:ii0,TimeoutError:ni0,UserAuthenticationExpiredError:_Z0}});var bJ=v((Fr1)=>{Object.defineProperty(Fr1,"__esModule",{value:!0});Fr1.SimpleMutex=Fr1.Perf=void 0;Fr1.extend=Vt6;Fr1.render=kt6;Fr1.timeout=St6;Fr1.delay=Ct6;Fr1.deadline=_t6;Fr1.deferred=ti0;Fr1.debugDeferred=vt6;Fr1.shuffle=xt6;Fr1.collect=ft6;Fr1.jitter=Nr1;Fr1.backoff=bt6;Fr1.nanos=yt6;Fr1.millis=gt6;Fr1.randomToken=ct6;var Mt6=sY(),pi0=eY();function Vt6($,...Z){for(let X=0;X<Z.length;X++){let Q=Z[X];Object.keys(Q).forEach(function(Y){$[Y]=Q[Y]})}return $}function kt6($){return Mt6.TD.decode($).replace(/\n/g,"\u240A").replace(/\r/g,"\u240D")}function St6($,Z=!0){let X=Z?new pi0.TimeoutError:null,Q,Y,G=new Promise((J,K)=>{Q={cancel:()=>{if(Y)clearTimeout(Y)}},Y=setTimeout(()=>{if(X===null)K(new pi0.TimeoutError);else K(X)},$)});return Object.assign(G,Q)}function Ct6($=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 _t6($,Z=1000){let X=ti0(),Q=setTimeout(()=>{X.reject(new pi0.TimeoutError)},Z);try{return await Promise.race([$,X])}finally{clearTimeout(Q)}}function ti0(){let $={},Z=new Promise((X,Q)=>{$={resolve:X,reject:Q}});return Object.assign(Z,$)}function vt6(){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 xt6($){for(let Z=$.length-1;Z>0;Z--){let X=Math.floor(Math.random()*(Z+1));[$[Z],$[X]]=[$[X],$[Z]]}return $}async function ft6($){let Z=[];for await(let X of $)Z.push(X);return Z}class Wr1{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})}),$}}Fr1.Perf=Wr1;class Hr1{max;current;waiting;constructor($=1){this.max=$,this.current=0,this.waiting=[]}lock(){if(this.current++,this.current<=this.max)return Promise.resolve();let $=ti0();return this.waiting.push($),$}unlock(){this.current--,this.waiting.pop()?.resolve()}}Fr1.SimpleMutex=Hr1;function Nr1($){if($===0)return 0;return Math.floor($/2+Math.random()*$)}function bt6($=[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 Nr1(X>Z?$[Z]:$[X])}}}function yt6($){return $*1e6}function gt6($){return Math.floor($/1e6)}var ht6="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",$F=new Uint8Array(62);for(let $=0;$<62;$++)$F[$]=ht6.charCodeAt($);var ut6=218340105584896;function ct6(){let $=Math.floor(Math.random()*ut6),Z=$%62,X=$F[Z];$=($-Z)/62,Z=$%62;let Q=$F[Z];$=($-Z)/62,Z=$%62;let Y=$F[Z];$=($-Z)/62,Z=$%62;let G=$F[Z];$=($-Z)/62,Z=$%62;let J=$F[Z];$=($-Z)/62,Z=$%62;let K=$F[Z];$=($-Z)/62,Z=$%62;let W=$F[Z];$=($-Z)/62;let H=$F[$];return String.fromCharCode(X,Q,Y,G,J,K,W,H)}});var jr1=v((Dr1)=>{Object.defineProperty(Dr1,"__esModule",{value:!0});Dr1.nuid=Dr1.NuidImpl=void 0;var Qo6="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",pB=62,yZ0=12,wr1=10,Br1=33,Yo6=333,Or1=yZ0+wr1,ri0=new Uint8Array(pB);for(let $=0;$<pB;$++)ri0[$]=Qo6.charCodeAt($);var bZ0=4294967296,Lr1=BigInt(pB)**BigInt(wr1),yi=Number(Lr1/(1n<<32n)),oi0=Number(Lr1%(1n<<32n));function Go6($){for(let Z=0;Z<$.length;Z++)$[Z]=Math.floor(Math.random()*256)}function Jo6($){if(globalThis?.crypto?.getRandomValues)globalThis.crypto.getRandomValues($);else Go6($)}class ai0{buf;cbuf;seqHi;seqLo;inc;inited;constructor(){this.buf=new Uint8Array(Or1),this.cbuf=new Uint8Array(yZ0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){let $=0;do this.seqHi=Math.floor(Math.random()*(yi+1)),this.seqLo=Math.floor(Math.random()*bZ0);while($++<8&&this.seqHi===yi&&this.seqLo>=oi0);if(this.seqHi===yi&&this.seqLo>=oi0)this.seqLo=0;this.inc=Math.random()*(Yo6-Br1)+Br1|0}setPre(){Jo6(this.cbuf);for(let $=0;$<yZ0;$++)this.buf[$]=ri0[this.cbuf[$]%pB]}fillSeq(){let $=this.seqHi,Z=this.seqLo;for(let X=Or1-1;X>=yZ0;X--){let Q=Math.floor($/pB),G=($-Q*pB)*bZ0+Z,J=Math.floor(G/pB),K=G-J*pB;this.buf[X]=ri0[K],$=Q,Z=J}}next(){if(!this.inited)this.init();if(this.seqLo+=this.inc,this.seqLo>=bZ0)this.seqLo-=bZ0,this.seqHi+=1;if(this.seqHi>yi||this.seqHi===yi&&this.seqLo>=oi0)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()}}Dr1.NuidImpl=ai0;Dr1.nuid=new ai0});var Tr1=v((Pr1)=>{Object.defineProperty(Pr1,"__esModule",{value:!0});Pr1.nuid=Pr1.Nuid=void 0;var zr1=jr1();Pr1.Nuid=zr1.NuidImpl;Pr1.nuid=zr1.nuid});var hZ0=v((gZ0)=>{Object.defineProperty(gZ0,"__esModule",{value:!0});gZ0.nuid=gZ0.Nuid=void 0;var Rr1=Tr1();Object.defineProperty(gZ0,"Nuid",{enumerable:!0,get:function(){return Rr1.Nuid}});Object.defineProperty(gZ0,"nuid",{enumerable:!0,get:function(){return Rr1.nuid}})});var tB=v((Ir1)=>{Object.defineProperty(Ir1,"__esModule",{value:!0});Ir1.DEFAULT_HOST=Ir1.DEFAULT_PORT=Ir1.Match=void 0;Ir1.syncIterator=Uo6;Ir1.createInbox=Bo6;var No6=hZ0(),Fo6=eY();Ir1.Match={Exact:"exact",CanonicalMIME:"canonical",IgnoreCase:"insensitive"};function Uo6($){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 Bo6($=""){if($=$||"_INBOX",typeof $!=="string")throw TypeError("prefix must be a string");return $.split(".").forEach((Z)=>{if(Z==="*"||Z===">")throw Fo6.InvalidArgumentError.format("prefix",`cannot have wildcards ('${$}')`)}),`${$}.${No6.nuid.next()}`}Ir1.DEFAULT_PORT=4222;Ir1.DEFAULT_HOST="127.0.0.1"});var gi=v((kr1)=>{Object.defineProperty(kr1,"__esModule",{value:!0});kr1.DataBuffer=void 0;var Mr1=sY();class Vr1{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 Mr1.TE.encode($)}static toAscii($){return Mr1.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}}kr1.DataBuffer=Vr1});var RE=v((_r1)=>{Object.defineProperty(_r1,"__esModule",{value:!0});_r1.LF=_r1.CR=_r1.CRLF=_r1.CR_LF_LEN=_r1.CR_LF=void 0;_r1.setTransportFactory=Po6;_r1.defaultPort=Ao6;_r1.getUrlParseFn=To6;_r1.newTransport=Ro6;_r1.getResolveFn=Io6;_r1.protoLen=Cr1;_r1.extractProtocolMessage=qo6;var Eo6=sY(),jo6=tB(),zo6=gi(),$G;function Po6($){$G=$}function Ao6(){return $G!==void 0&&$G.defaultPort!==void 0?$G.defaultPort:jo6.DEFAULT_PORT}function To6(){return $G!==void 0&&$G.urlParseFn?$G.urlParseFn:void 0}function Ro6(){if(!$G||typeof $G.factory!=="function")throw Error("transport fn is not set");return $G.factory()}function Io6(){return $G!==void 0&&$G.dnsResolveFn?$G.dnsResolveFn:void 0}_r1.CR_LF=`\r
1375
1375
  `;_r1.CR_LF_LEN=_r1.CR_LF.length;_r1.CRLF=zo6.DataBuffer.fromAscii(_r1.CR_LF);_r1.CR=new Uint8Array(_r1.CRLF)[0];_r1.LF=new Uint8Array(_r1.CRLF)[1];function Cr1($){for(let Z=0;Z<$.length;Z++){let X=Z+1;if($.byteLength>X&&$[Z]===_r1.CR&&$[X]===_r1.LF)return X+1}return 0}function qo6($){let Z=Cr1($);if(Z>0){let Q=new Uint8Array($).slice(0,Z);return Eo6.TD.decode(Q)}return""}});var Xn0=v((ur1)=>{Object.defineProperty(ur1,"__esModule",{value:!0});ur1.ipV4=yr1;ur1.isIP=yo6;ur1.parseIP=gr1;var hi=4,IE=16,uZ0=48,br1=57,xr1=65,fo6=70,fr1=97,bo6=102,Zn0=16777215;function yr1($,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 yo6($){return gr1($)!==void 0}function gr1($){for(let Z=0;Z<$.length;Z++)switch($[Z]){case".":return hr1($);case":":return go6($)}return}function hr1($){let Z=new Uint8Array(hi);for(let X=0;X<hi;X++){if($.length===0)return;if(X>0){if($[0]!==".")return;$=$.substring(1)}let{n:Q,c:Y,ok:G}=ho6($);if(!G||Q>255)return;$=$.substring(Y),Z[X]=Q}return yr1(Z[0],Z[1],Z[2],Z[3])}function go6($){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}=uo6($);if(!J||Y>65535)return;if(G<$.length&&$[G]==="."){if(X<0&&Q!=IE-hi)return;if(Q+hi>IE)return;let K=hr1($);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+=hi;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 ho6($){let Z=0,X=0;for(Z=0;Z<$.length&&uZ0<=$.charCodeAt(Z)&&$.charCodeAt(Z)<=br1;Z++)if(X=X*10+($.charCodeAt(Z)-uZ0),X>=Zn0)return{n:Zn0,c:Z,ok:!1};if(Z===0)return{n:0,c:0,ok:!1};return{n:X,c:Z,ok:!0}}function uo6($){let Z=0,X=0;for(X=0;X<$.length;X++){if(uZ0<=$.charCodeAt(X)&&$.charCodeAt(X)<=br1)Z*=16,Z+=$.charCodeAt(X)-uZ0;else if(fr1<=$.charCodeAt(X)&&$.charCodeAt(X)<=bo6)Z*=16,Z+=$.charCodeAt(X)-fr1+10;else if(xr1<=$.charCodeAt(X)&&$.charCodeAt(X)<=fo6)Z*=16,Z+=$.charCodeAt(X)-xr1+10;else break;if(Z>=Zn0)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 Wn0=v((lr1)=>{Object.defineProperty(lr1,"__esModule",{value:!0});lr1.Servers=lr1.ServerImpl=void 0;lr1.isIPV4OrHostname=cr1;lr1.hostPort=Kn0;var Qn0=RE(),Yn0=bJ(),Gn0=Xn0(),mo6=tB(),io6=eY();function cr1($){if($.indexOf("[")!==-1||$.indexOf("::")!==-1)return!1;if($.indexOf(".")!==-1)return!0;if($.split(":").length<=2)return!0;return!1}function Jn0($){return!cr1($)}function no6($){let X=$.toUpperCase().indexOf("::FFFF:");if(X!==-1&&$.indexOf(".")!==-1){let Q=$.substring(X+7);return Q=Q.replace("[",""),Q.replace("]","")}return $}function Kn0($){if($=$.trim(),$.match(/^(.*:\/\/)(.*)/m))$=$.replace(/^(.*:\/\/)(.*)/gm,"$2");if($=no6($),Jn0($)&&$.indexOf("[")===-1)$=`[${$}]`;let Z=Jn0($)?$.match(/(]:)(\d+)/):$.match(/(:)(\d+)/),X=Z&&Z.length===3&&Z[1]&&Z[2]?parseInt(Z[2]):mo6.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=Kn0($);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,Gn0.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}://${Jn0(Q)?"["+Q+"]":Q}`);G.port=`${this.port}`;let J=new nb(G.host,!1);J.tlsName=this.hostname,Z.push(J)}}if($.randomize)(0,Yn0.shuffle)(Z);return this.resolves=Z,Z}}lr1.ServerImpl=nb;class cZ0{firstSelect;servers;currentServer;tlsName;randomize;constructor($={}){this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=$.randomize||!1}setServers($){if(!Array.isArray($)||$.length===0)throw io6.InvalidArgumentError.format("servers","cannot be empty");let Z=(0,Qn0.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}=Kn0(Y),J=X.get(G);if(J)J.gossiped=!1,Q.push(J);else Q.push(new nb(Y))}if(this.randomize)(0,Yn0.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,Gn0.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,Qn0.getUrlParseFn)();$=X?X($):$;let Q=new nb($,Z);if((0,Gn0.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 cZ0.freezeAll(this.servers)}snapshotForHandler(){let $=this.currentServer;if(!$)return this.snapshot();let Z=this.servers.indexOf($);if(Z<=0)return this.snapshot();return cZ0.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,Qn0.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,Yn0.shuffle)(W),this.servers=K?[K,...W]:W}return{added:X,deleted:Q}}}lr1.Servers=cZ0});var lZ0=v((nr1)=>{Object.defineProperty(nr1,"__esModule",{value:!0});nr1.QueuedIteratorImpl=void 0;var Hn0=bJ(),mr1=eY();class ir1{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,Hn0.deferred)(),this.yields=[],this.iterClosed=(0,Hn0.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 mr1.InvalidOperationError("iterator cannot be used when a callback is registered");if(this.yielding)throw new mr1.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,Hn0.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}}nr1.QueuedIteratorImpl=ir1});var Nn0=v((rr1)=>{Object.defineProperty(rr1,"__esModule",{value:!0});rr1.MuxSubscription=void 0;var ro6=tB(),tr1=eY();class or1{baseInbox;reqs;constructor(){this.reqs=new Map}size(){return this.reqs.size}init($){return this.baseInbox=`${(0,ro6.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 tr1.NoRespondersError(Q.requestSubject):null;Q.resolver($,Z)}}}}close(){let $=new tr1.RequestError("connection closed");this.reqs.forEach((Z)=>{Z.resolver($,{})})}}rr1.MuxSubscription=or1});var Fn0=v((er1)=>{Object.defineProperty(er1,"__esModule",{value:!0});er1.Heartbeat=void 0;var ao6=bJ();class sr1{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,ao6.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})}}er1.Heartbeat=sr1});var On0=v((Ya1)=>{Object.defineProperty(Ya1,"__esModule",{value:!0});Ya1.DenoBuffer=Ya1.MAX_SIZE=Ya1.AssertionError=void 0;Ya1.assert=Xa1;Ya1.concat=Qa1;Ya1.append=eo6;Ya1.readAll=$r6;Ya1.writeAll=Zr6;var so6=sY();class Un0 extends Error{constructor($){super($);this.name="AssertionError"}}Ya1.AssertionError=Un0;function Xa1($,Z="Assertion failed."){if(!$)throw new Un0(Z)}var Za1=32768;Ya1.MAX_SIZE=4294967294;function dZ0($,Z,X=0){let Q=Z.byteLength-X;if($.byteLength>Q)$=$.subarray(0,Q);return Z.set($,X),$.byteLength}function Qa1($,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 eo6($,Z){return Qa1($,Uint8Array.of(Z))}class Bn0{_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($){Xa1($<=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=dZ0(this._buf.subarray(this._off),$);return this._off+=Z,Z}writeByte($){return this.write(Uint8Array.of($))}writeString($){return this.write(so6.TE.encode($))}write($){let Z=this._grow($.byteLength);return dZ0($,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)dZ0(this._buf.subarray(this._off),this._buf);else if(Q+$>Ya1.MAX_SIZE)throw Error("The buffer cannot be grown beyond the maximum size.");else{let Y=new Uint8Array(Math.min(2*Q+$,Ya1.MAX_SIZE));dZ0(this._buf.subarray(this._off),Y),this._buf=Y}return this._off=0,this._reslice(Math.min(Z+$,Ya1.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(Za1);while(!0){let Q=this.capacity-this.length<Za1,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}}}Ya1.DenoBuffer=Bn0;function $r6($){let Z=new Bn0;return Z.readFrom($),Z.bytes()}function Zr6($,Z){let X=0;while(X<Z.length)X+=$.write(Z.subarray(X))}});var Dn0=v((Ha1)=>{Object.defineProperty(Ha1,"__esModule",{value:!0});Ha1.cc=Ha1.State=Ha1.Parser=Ha1.Kind=void 0;Ha1.describe=Wr6;var wn0=On0(),Ln0=sY();Ha1.Kind={OK:0,ERR:1,MSG:2,INFO:3,PING:4,PONG:5};function Wr6($){let Z,X="";switch($.kind){case Ha1.Kind.MSG:Z="MSG";break;case Ha1.Kind.OK:Z="OK";break;case Ha1.Kind.ERR:Z="ERR",X=Ln0.TD.decode($.data);break;case Ha1.Kind.PING:Z="PING";break;case Ha1.Kind.PONG:Z="PONG";break;case Ha1.Kind.INFO:Z="INFO",X=Ln0.TD.decode($.data)}return`${Z}: ${X}`}function Ja1(){let $={};return $.sid=-1,$.hdr=-1,$.size=-1,$}var Ka1=48,Hr6=57,pb=67108864;class Wa1{dispatcher;state;as;drop;hdr;ma;argBuf;msgBuf;constructor($){this.dispatcher=$,this.state=Ha1.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 Ha1.State.OP_START:switch(X){case Ha1.cc.M:case Ha1.cc.m:this.state=Ha1.State.OP_M,this.hdr=-1,this.ma=Ja1();break;case Ha1.cc.H:case Ha1.cc.h:this.state=Ha1.State.OP_H,this.hdr=0,this.ma=Ja1();break;case Ha1.cc.P:case Ha1.cc.p:this.state=Ha1.State.OP_P;break;case Ha1.cc.PLUS:this.state=Ha1.State.OP_PLUS;break;case Ha1.cc.MINUS:this.state=Ha1.State.OP_MINUS;break;case Ha1.cc.I:case Ha1.cc.i:this.state=Ha1.State.OP_I;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_H:switch(X){case Ha1.cc.M:case Ha1.cc.m:this.state=Ha1.State.OP_M;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_M:switch(X){case Ha1.cc.S:case Ha1.cc.s:this.state=Ha1.State.OP_MS;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_MS:switch(X){case Ha1.cc.G:case Ha1.cc.g:this.state=Ha1.State.OP_MSG;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_MSG:switch(X){case Ha1.cc.SPACE:case Ha1.cc.TAB:this.state=Ha1.State.OP_MSG_SPC;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_MSG_SPC:switch(X){case Ha1.cc.SPACE:case Ha1.cc.TAB:continue;default:this.state=Ha1.State.MSG_ARG,this.as=Z}break;case Ha1.State.MSG_ARG:switch(X){case Ha1.cc.CR:this.drop=1;break;case Ha1.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=Ha1.State.MSG_PAYLOAD,Z=this.as+this.ma.size-1;break}default:if(this.argBuf)this.argBuf.writeByte(X)}break;case Ha1.State.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){let Q=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Ha1.Kind.MSG,msg:this.ma,data:Q}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ha1.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:Ha1.Kind.MSG,msg:this.ma,data:$.subarray(this.as,Z)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ha1.State.MSG_END;break;case Ha1.State.MSG_END:switch(X){case Ha1.cc.NL:this.drop=0,this.as=Z+1,this.state=Ha1.State.OP_START;break;default:continue}break;case Ha1.State.OP_PLUS:switch(X){case Ha1.cc.O:case Ha1.cc.o:this.state=Ha1.State.OP_PLUS_O;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_PLUS_O:switch(X){case Ha1.cc.K:case Ha1.cc.k:this.state=Ha1.State.OP_PLUS_OK;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_PLUS_OK:switch(X){case Ha1.cc.NL:this.dispatcher.push({kind:Ha1.Kind.OK}),this.drop=0,this.state=Ha1.State.OP_START;break}break;case Ha1.State.OP_MINUS:switch(X){case Ha1.cc.E:case Ha1.cc.e:this.state=Ha1.State.OP_MINUS_E;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_MINUS_E:switch(X){case Ha1.cc.R:case Ha1.cc.r:this.state=Ha1.State.OP_MINUS_ER;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_MINUS_ER:switch(X){case Ha1.cc.R:case Ha1.cc.r:this.state=Ha1.State.OP_MINUS_ERR;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_MINUS_ERR:switch(X){case Ha1.cc.SPACE:case Ha1.cc.TAB:this.state=Ha1.State.OP_MINUS_ERR_SPC;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_MINUS_ERR_SPC:switch(X){case Ha1.cc.SPACE:case Ha1.cc.TAB:continue;default:this.state=Ha1.State.MINUS_ERR_ARG,this.as=Z}break;case Ha1.State.MINUS_ERR_ARG:switch(X){case Ha1.cc.CR:this.drop=1;break;case Ha1.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:Ha1.Kind.ERR,data:Q}),this.drop=0,this.as=Z+1,this.state=Ha1.State.OP_START;break}default:if(this.argBuf)this.argBuf.write(Uint8Array.of(X))}break;case Ha1.State.OP_P:switch(X){case Ha1.cc.I:case Ha1.cc.i:this.state=Ha1.State.OP_PI;break;case Ha1.cc.O:case Ha1.cc.o:this.state=Ha1.State.OP_PO;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_PO:switch(X){case Ha1.cc.N:case Ha1.cc.n:this.state=Ha1.State.OP_PON;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_PON:switch(X){case Ha1.cc.G:case Ha1.cc.g:this.state=Ha1.State.OP_PONG;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_PONG:switch(X){case Ha1.cc.NL:this.dispatcher.push({kind:Ha1.Kind.PONG}),this.drop=0,this.state=Ha1.State.OP_START;break}break;case Ha1.State.OP_PI:switch(X){case Ha1.cc.N:case Ha1.cc.n:this.state=Ha1.State.OP_PIN;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_PIN:switch(X){case Ha1.cc.G:case Ha1.cc.g:this.state=Ha1.State.OP_PING;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_PING:switch(X){case Ha1.cc.NL:this.dispatcher.push({kind:Ha1.Kind.PING}),this.drop=0,this.state=Ha1.State.OP_START;break}break;case Ha1.State.OP_I:switch(X){case Ha1.cc.N:case Ha1.cc.n:this.state=Ha1.State.OP_IN;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_IN:switch(X){case Ha1.cc.F:case Ha1.cc.f:this.state=Ha1.State.OP_INF;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_INF:switch(X){case Ha1.cc.O:case Ha1.cc.o:this.state=Ha1.State.OP_INFO;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_INFO:switch(X){case Ha1.cc.SPACE:case Ha1.cc.TAB:this.state=Ha1.State.OP_INFO_SPC;break;default:throw this.fail($.subarray(Z))}break;case Ha1.State.OP_INFO_SPC:switch(X){case Ha1.cc.SPACE:case Ha1.cc.TAB:continue;default:this.state=Ha1.State.INFO_ARG,this.as=Z}break;case Ha1.State.INFO_ARG:switch(X){case Ha1.cc.CR:this.drop=1;break;case Ha1.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:Ha1.Kind.INFO,data:Q}),this.drop=0,this.as=Z+1,this.state=Ha1.State.OP_START;break}default:if(this.argBuf)this.argBuf.writeByte(X)}break;default:throw this.fail($.subarray(Z))}}if((this.state===Ha1.State.MSG_ARG||this.state===Ha1.State.MINUS_ERR_ARG||this.state===Ha1.State.INFO_ARG)&&!this.argBuf)this.argBuf=new wn0.DenoBuffer($.subarray(this.as,Z-this.drop));if(this.state===Ha1.State.MSG_PAYLOAD&&!this.msgBuf){if(!this.argBuf)this.cloneMsgArg();this.msgBuf=new wn0.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 wn0.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 Ha1.cc.SPACE:case Ha1.cc.TAB:case Ha1.cc.CR:case Ha1.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}: ${Ln0.TD.decode($)}`)}processHeaderMsgArgs($){let Z=[],X=-1;for(let Q=0;Q<$.length;Q++)switch($[Q]){case Ha1.cc.SPACE:case Ha1.cc.TAB:case Ha1.cc.CR:case Ha1.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]<Ka1||$[Q]>Hr6)return-1;X=X*10+($[Q]-Ka1)}return Z!==void 0&&X>Z?-1:X}}Ha1.Parser=Wa1;Ha1.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};Ha1.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 nZ0=v((Fa1)=>{Object.defineProperty(Fa1,"__esModule",{value:!0});Fa1.MsgHdrsImpl=void 0;Fa1.canonicalMIMEHeaderKey=jn0;Fa1.headers=Ur6;var Na1=sY(),yJ=tB(),iZ0=eY();function jn0($){let N=!0,F=Array($.length);for(let U=0;U<$.length;U++){let B=$.charCodeAt(U);if(B===58||B<33||B>126)throw iZ0.InvalidArgumentError.format("header",`'${$[U]}' 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;F[U]=B,N=B==45}return String.fromCharCode(...F)}function Ur6($=0,Z=""){if($===0&&Z!=="")throw iZ0.InvalidArgumentError.format("code","is required");else if($>0&&Z==="")throw iZ0.InvalidArgumentError.format("description","is required");return new tb($,Z)}var En0="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=Na1.TD.decode($).split(`\r
1376
1376
  `),Y=Q[0];if(Y!==En0){let G=Y.replace(En0,"").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 $=En0;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
@@ -2844,7 +2844,7 @@ Use this to continue with the user's request \u2014 do NOT call subtask again fo
2844
2844
 
2845
2845
  `).trim();return{models:$.models,agent:$.agent,temperature:$.temperature,toolApprovalLevel:$.toolApprovalLevel,...$.toolAllowlist!==void 0?{toolAllowlist:$.toolAllowlist}:{},...$.maxAgentSteps!==void 0?{maxAgentSteps:$.maxAgentSteps}:{},...$.isSubagent!==void 0?{isSubagent:$.isSubagent}:{},...$.subtaskJobId!==void 0?{subtaskJobId:$.subtaskJobId}:{},...$.resumedFromBackground!==void 0?{resumedFromBackground:$.resumedFromBackground}:{},mode:$.mode,...$.windowSize!==void 0?{windowSize:$.windowSize}:{},...$.triggerId!==void 0?{triggerId:$.triggerId}:{},...$.runMetadata!==void 0?{runMetadata:$.runMetadata}:{},branch:Z.branch??$.branch??null,sandboxProviderKind:$.sandboxProviderKind,harnessId:$.harnessId,organizationId:$.organizationId,userId:$.userId,taskId:$.taskId,messageId:Z.messageId,...Z.runFenceToken!==void 0?{runFenceToken:Z.runFenceToken}:{},...$.isResume!==void 0?{isResume:$.isResume}:{},...X?{systemContext:X}:{}}}function bt4($,Z){let X=$.find((Q)=>Q.id===Z);if(!X)throw new IH("empty_request",`Persisted request message missing for messageId=${Z}`);if(X.role==="system")throw new IH("empty_request",`Persisted message ${Z} has role=system; expected non-system request message`);return X}function yt4($){let Z=$.models;return{"decopilot.agent.id":$.agent.id,"decopilot.model.id":Z.thinking.id,"decopilot.credential.id":Z.credentialId,"decopilot.organization.id":$.organizationId,"decopilot.user.id":$.userId,"decopilot.thread.id":$.taskId??""}}async function m_8($,Z,X){return li1("decopilot.dispatchRunAndWait",async(Q)=>{let{taskId:Y,uiStream:G,registrySignal:J}=await ut4($,Z,X,Q),K=X.streamBuffer,W=K?await K.createTailStream(Y,$.abortSignal,{deliverPolicy:"new",closeOnDone:!0}):null;if(K&&W){let H=K.pump(G,Y,J,$.organizationId);H.catch(()=>{});let N=W.getReader();try{while(!0){let{done:F}=await N.read();if(F)break}}finally{N.releaseLock()}await H}else{if(K)console.warn(JSON.stringify({msg:"decopilot-stream-diag",event:"producer-fallback-no-pump",taskId:Y,hasTail:!!W,note:"createTailStream returned null \u2014 draining producer stream directly; projector persistence depends on streamBuffer publish health"}));let H=G.getReader();try{while(!0){let{done:N}=await H.read();if(N)break}}finally{H.releaseLock()}}return{taskId:Y}},yt4($))}async function gt4($,Z,X,Q){let[Y,G,J]=await Promise.all([$.storage.threads.list(Q,{limit:9,agentId:X}).catch(()=>null),$.storage.interests.getForAgent(Z,X,Q).catch(()=>null),$.storage.virtualMcps.list(Z).catch(()=>null)]),K={};if(Y&&Y.total>0)K.recentThreads={total:Y.total,threads:Y.threads.map((W)=>({id:W.id,title:W.title,updated_at:W.updated_at}))};if(G&&G.interests.length>0)K.interests=G.interests.map((W)=>({title:W.title,summary:W.summary}));if(J)K.agents=J.map((W)=>({id:W.id,name:W.title,description:W.description,status:W.status}));return K}async function ht4({virtualMcp:$,agentId:Z,organizationId:X,ctx:Q}){return uG0({virtualMcp:$,agentId:Z,organizationId:X,ctx:Q})}async function ut4($,Z,X,Q){let{runRegistry:Y,streamBuffer:G}=X;mZ1($.harnessId);let J=$.harnessId;if(!l_8($))$={...$,messages:$.messages.map((H)=>H.id?H:{...H,id:Ka()})};let K=!1,W;try{let H=$.models;Q.setAttribute("decopilot.harnessId",J),Z.sandboxPreference="agent-sandbox",Q.setAttribute("decopilot.dispatchTarget.sandboxProviderKind","agent-sandbox");let N=gA0({harnessId:J,sandboxProviderKind:"agent-sandbox"}),F=y_8(H),U=await cK(Z.db,$.organizationId,Z.organization?.role??Z.auth.user?.role);if(!uK(U,F.thinking.credentialId,F.thinking.id))throw new IH("model_not_allowed","Model not allowed for your role");F=hA0(U,F);let B=$.windowSize??l3;if(!$.taskId)throw Error("dispatchRunAndWait: taskId is required");if(N)await hK(G,$.taskId,Ra[0]);let O=await Mq8(Z,$.organizationId,Z.metadata?.runMetadata),L=(r0)=>r0?ft4(Z,$.organizationId,r0.credentialId,r0.id,O):Promise.resolve(void 0),[D,E,j,z,P,A,I,q,M]=await Promise.all([Z.storage.virtualMcps.findById($.agent.id,$.organizationId),L(F.thinking),L(F.fast),L(F.smart),L(F.image),L(F.webSearch),L(F.deepResearch),bA0(Z.storage.threads,{organization_id:$.organizationId,thread_id:$.taskId,userId:$.userId,defaultWindowSize:B}),gt4(Z,$.organizationId,$.agent.id,$.userId)]);if(N)await hK(G,$.taskId,Ra[1]);let S=E?{thinking:E,...j?{fast:j}:{},...z?{smart:z}:{},...P?{image:P}:{},...A?{webSearch:A}:{},...I?{deepResearch:I}:{}}:void 0,d=E?MP0(E):null;if(W=q.thread.id,Z.metadata.threadId=q.thread.id,Q.setAttribute("decopilot.thread.id",q.thread.id),q.thread.created_by!==$.userId)throw new IH("not_thread_owner","You are not allowed to write to this thread because you are not the owner");if(d?.asyncResearch){let r0=[["thinking",F.thinking.id]];if(F.fast)r0.push(["fast",F.fast.id]);if(F.smart)r0.push(["smart",F.smart.id]);if(F.image)r0.push(["image",F.image.id]);for(let[a,m0]of r0)if(d.asyncResearch.canHandle(m0))throw Error(`Model "${m0}" can only be used as a Deep Research model. It is not usable as the ${a} model \u2014 set it in the Deep Research slot instead.`)}let y=q.thread.message_storage_version===2?new kX({storage:Z.storage.threads.messageParts(),orgId:$.organizationId,threadId:q.thread.id,runId:q.thread.id}):null;if(!D)throw new IH("agent_not_found","Agent not found");let o=await ht4({virtualMcp:D,agentId:$.agent.id,organizationId:$.organizationId,ctx:Z});if($.isResume)await Y.execute({type:"RESUME",taskId:q.thread.id,orgId:$.organizationId,userId:$.userId,abortController:new AbortController,podId:dZ1()});else await Y.execute({type:"START",taskId:q.thread.id,orgId:$.organizationId,userId:$.userId,abortController:new AbortController,podId:dZ1(),runConfig:{models:$.models,agent:$.agent,temperature:$.temperature,toolApprovalLevel:$.toolApprovalLevel,mode:$.mode,windowSize:$.windowSize,triggerId:$.triggerId},messageId:$.messageId});K=!0,await Z.storage.threads.clearCancelRequested(q.thread.id);let b;if($.runFenceToken)b=$.runFenceToken;else b=fA0(),await Z.storage.threads.setRunFence(q.thread.id,b);let r=Y.getAbortSignal(q.thread.id);if(!r)throw await Y.execute({type:"FINISH",taskId:q.thread.id,threadStatus:"failed"}),Error("Run was cancelled immediately after starting");if($.abortSignal){let r0=$.abortSignal;if(r0.aborted)await Y.execute({type:"CANCEL",taskId:q.thread.id});else r0.addEventListener("abort",()=>{Y.execute({type:"CANCEL",taskId:q.thread.id}).catch(()=>{})},{once:!0})}if(!$.isResume)G?.purge(q.thread.id);let B0=[],E0,Z0;if(l_8($)){if(Z0=await q.loadHistory(B),E0=bt4(Z0,$.messageId),$.systemContext)B0=[{id:`system-${$.messageId}`,role:"system",parts:[{type:"text",text:$.systemContext}]}]}else{B0=$.messages.filter((a)=>a.role==="system");let r0=$.messages.find((a)=>a.role!=="system");if(E0=r0?(await NA0([r0],Z,{threadId:q.thread.id})).find((a)=>a.role!=="system"):void 0,!$.isResume){if(!E0)throw new IH("empty_request","No user message found in input \u2014 expected at least one non-system message");if(y)await y.emitUserMessage(E0).catch((a)=>{console.error("[decopilot:stream] v2 user-message emit failed",a)})}}if(E0)await C_8(G,q.thread.id,E0);let e=[],A0=Z.organization,Y0=Date.now(),q0=E0?(await FA0([E0],Z))[0]:void 0;if(!q0||!E0)throw new IH("empty_request","No user message found in input \u2014 expected at least one non-system message");q_8($.models,[q0]);let t0=await R_8({ctx:Z,threadId:q.thread.id,userMessage:E0,windowSize:B,isSubagent:$.isSubagent===!0,systemMessages:B0}),s0={url:"",headers:{},expiresAt:0},H0=void 0,V0=void 0,S0={cwd:null},I0=$.agent.instructions??(typeof o.metadata?.instructions==="string"?o.metadata.instructions:void 0),Q0={taskId:$.taskId,isSubagent:$.isSubagent,subtaskJobId:$.subtaskJobId,resumedFromBackground:$.resumedFromBackground,virtualMcp:o,branch:$.branch,messages:t0,modelSources:S,mcpSource:H0,objectStorageSource:V0,userContext:M},N0={harnessId:J,threadId:q.thread.id,userMessage:q0,harness:{sessionId:void 0},workspace:S0,models:F,mcp:s0,mode:$.mode,temperature:$.temperature,toolApprovalLevel:$.toolApprovalLevel,toolAllowlist:$.toolAllowlist??null,maxAgentSteps:$.maxAgentSteps,user:{id:$.userId,email:Z.auth.user?.email??""},organizationId:$.organizationId,organizationSlug:A0.slug,agent:{id:$.agent.id,instructions:I0,...$.agent.disallowedTools?{disallowedTools:$.agent.disallowedTools}:{}},triggerId:$.triggerId,currentThreadTitle:q.thread.title,runFenceToken:b};if(N)await hK(G,$.taskId,Ra[2]);let g0=bH(J),O0=g0?await Z.storage.threads.getAckedSeq(q.thread.id):0;if(O0>0)console.log("[dispatch] resuming a sandbox-hosted turn",{runId:q.thread.id,fromSeq:O0});let P0=g0?await Z.storage.claudeSubscriptions.findLiveToken($.userId).catch((r0)=>{return console.warn("[dispatch] claude subscription lookup failed",r0),null}):null,S1=async function*(){let r0={...N0,signal:r};if(U91(r0,Q0),N)await hK(G,q.thread.id,Ra[3]);yield*(g0?new TZ1({ctx:Z,harnessId:J,virtualMcpId:o.id,...O0>0?{resume:{reason:"the Studio process driving the previous attempt stopped"}}:{},branch:await QP0(Z,{threadId:q.thread.id,agentRepo:o.metadata?.githubRepo,runBranch:$.branch}),credential:P0?{providerId:mV8,apiKey:P0}:E?{providerId:E.providerId,apiKey:E.apiKey,...E.baseUrl?{baseUrl:E.baseUrl}:{}}:null}):new L91({ctx:Z,harnessId:J})).dispatch(r0)},G1=vt4(()=>xt4({runId:q.thread.id,fenceToken:b,streamBuffer:G??{publishRawChunk:async()=>!1,publishDone:async()=>!1},chunks:v_8(S1()),...g0?{startSeq:O0,initialAckSeq:O0,onPublished:(r0)=>Z.storage.threads.bumpAckedSeq(q.thread.id,b,r0)}:{},errorMessageId:BL(q.thread.id,b),loadOriginalMessages:y?async()=>(await Z.storage.threads.messageParts().loadWindow(q.thread.id,{limit:1})).messages.map(yA0):void 0,title:{currentThreadTitle:q.thread.title,threadId:q.thread.id,persistTitle:async(r0,a)=>{await Z.storage.threads.update(r0,{title:a})}},hooks:{onStep:()=>{let r0=Y.dispatch({type:"STEP_DONE",taskId:q.thread.id});e.push(Y.react(r0).catch((a)=>{console.error("[decopilot:stream] onStepFinish reactor failed",a)}))},onFinish:async(r0,a)=>{let m0=e.length,B1=performance.now();if(await Promise.allSettled(e),h_8.record(performance.now()-B1,{phase:"settle"}),r.aborted)return;await j8(0);let k1=u_8?OE():null,u0=performance.now(),l1=uA0(a,r0?.parts);await Y.execute({type:"FINISH",taskId:q.thread.id,threadStatus:l1});let x8=performance.now()-u0;if(h_8.record(x8,{phase:"save"}),u_8&&k1){let o4=OE()??k1,x$=-1;try{x$=JSON.stringify(r0)?.length??-1}catch{}console.warn(JSON.stringify({msg:"decopilot-finish-trace",threadId:q.thread.id,pendingOps:m0,saveMs:Math.round(x8),parts:r0?.parts?.length??0,messageBytes:x$,rssDelta:o4.rss-k1.rss,heapUsedDelta:o4.heapUsed-k1.heapUsed,externalDelta:o4.external-k1.external}))}},onError:(r0)=>{if(r.aborted){n1.capture({distinctId:$.userId,event:"chat_message_aborted",groups:{organization:$.organizationId},properties:{organization_id:$.organizationId,thread_id:q.thread.id,agent_id:$.agent.id,model_id:F.thinking.id,mode:$.mode,duration_ms:Date.now()-Y0,is_resume:$.isResume??!1}});return}if(Pa(r0)){console.log(`[decopilot] attempt superseded by a newer dispatch; leaving the terminal to it thread=${q.thread.id}`);return}console.error("[decopilot] stream error:",bK(r0)),Y.execute({type:"FINISH",taskId:q.thread.id,threadStatus:"failed",errorText:bK(r0)}).catch((a)=>{console.error("[decopilot:stream] onError reactor failed",a)})}}}));return{taskId:q.thread.id,uiStream:G1,registrySignal:r}}catch(H){if(K&&W)Y.execute({type:"FINISH",taskId:W,threadStatus:"failed",errorText:bK(H)}).catch((N)=>{console.error("[decopilot:stream] catch-block reactor failed",N)});throw H}}var h_8,u_8,c_8;var cA0=w(()=>{or();R51();h4();dV8();vP0();Aa();kK();Fh();A_8();Bu();$91();JL();I_8();FL();cZ1();zu();M_8();Su();bZ1();x_8();Cu();r$();g_8();f4();h_8=g8.createHistogram("decopilot.finish.duration",{description:"Wall time of onFinish flush segments, tagged by phase",unit:"ms"}),u_8=process.env.DECOPILOT_FINISH_TRACE==="1";c_8=["decopilot","claude-code"]});function i_8($){return k_8($)||S_8($)}async function ct4($){let Z=$.getReader();try{while(!0){let{done:X}=await Z.read();if(X)break}}finally{Z.releaseLock()}}function lt4($,Z){let X=$.getReader(),Q=!1,Y=()=>{if(Q)return;Q=!0,X.releaseLock()};return new ReadableStream({async pull(G){try{let{done:J,value:K}=await X.read();if(J)Y(),G.close();else G.enqueue(K)}catch(J){Z(J),Y(),G.error(J)}},async cancel(G){await X.cancel(G),Y()}})}async function n_8($){if(!$.chunks&&!$.chunkStream)throw Error("projectChunks requires chunks or chunkStream");let Z=null,X=!1,Q=void 0,Y={inputTokens:0,outputTokens:0,totalTokens:0},G=[],J=null,K=(O)=>{if(J===null)J=O;throw O},W=$.chunks?async function*(){try{for await(let O of $.chunks){if(i_8(O))continue;yield O}}catch(O){throw Z=O,O}}():void 0,H=$.chunkStream?lt4($.chunkStream,(O)=>{Z=O}).pipeThrough(new TransformStream({transform(O,L){if(!i_8(O))L.enqueue(O)}})):void 0,N={emitStepParts:(O)=>$.persistence.emitStepParts(O).catch(K),emitFinal:(O)=>$.persistence.emitFinal(O).catch(K),emitError:(O,L)=>$.persistence.emitError(O,L).catch(K)},{uiStream:F,whenComplete:U}=SA0({chunks:W,chunkStream:H,originalMessages:$.originalMessages??[],title:$.title?{currentThreadTitle:$.title.currentThreadTitle,threadId:$.title.threadId,persistTitle:$.title.persistTitle}:{currentThreadTitle:void 0,threadId:"projector",persistTitle:async()=>{}},persistence:N,sanitizeErrorText:$.sanitizeErrorText,errorMessageId:$.errorMessageId,generateMessageId:$.generateMessageId,hooks:{onUsage:(O)=>{Y={inputTokens:O.inputTokens,outputTokens:O.outputTokens,totalTokens:O.totalTokens}},onError:()=>{X=!0},onFinish:(O,L)=>{Q=L,G=Array.isArray(O.parts)?O.parts.filter((D)=>D!=null&&typeof D==="object"&&("type"in D)):[]}}});if(await ct4(F).catch(()=>{}),await U,J!==null)throw J;if(Z!==null)throw Z;return{failed:X&&Q===void 0,finishReason:Q,usage:Y,finalParts:G}}var p_8=w(()=>{fZ1();Su()});var qa=786432;function mt4($){if(/[.*>\s]/.test($))throw Error("Invalid NATS subject token")}function OL($){return mt4($),`${lA0}.${$}`}function t_8($){let Z=`${$.runId}:${$.fenceToken}:${$.seq}`;return $.fragmentIndex===void 0?Z:`${Z}:frag:${$.fragmentIndex}`}function it4($){return`${$.runId}:${$.fenceToken}:done:${$.finalSeq}`}function o_8($){if(!$)return null;let Z=Number($);return Number.isInteger(Z)&&Z>0?Z:null}function nt4($){if(!$)return null;let Z=Number($);return Number.isInteger(Z)&&Z>=0?Z:null}function pt4($){if(!$)return null;let Z=$.split(":"),[X,Q,Y,G,J]=Z;if(!X||!Q||!Y)return null;if(Y==="done"){let W=o_8(G);return Z.length===4&&W!==null?{kind:"done",runId:X,fenceToken:Q,finalSeq:W}:null}if(Y==="ckpt")return null;let K=o_8(Y);if(K===null)return null;if(Z.length===3)return{kind:"chunk",runId:X,fenceToken:Q,seq:K,fragmentIndex:null};if(Z.length===5&&G==="frag"){let W=nt4(J);return W===null?null:{kind:"chunk",runId:X,fenceToken:Q,seq:K,fragmentIndex:W}}return null}function nZ1($,Z){let X=OL(Z.runId),Q=iZ1.encode(JSON.stringify({p:$}));if(Q.length>dt4)return[];if(Q.length<=qa)return[{subject:X,data:Q,msgId:Z.dedup?t_8({runId:Z.runId,...Z.dedup}):void 0}];let Y=Math.ceil(Q.length/qa),G=[];for(let J=0;J<Y;J++)G.push({subject:X,data:Q.slice(J*qa,(J+1)*qa),headers:{[r_8]:String(J),[a_8]:String(Y)},msgId:Z.dedup?t_8({runId:Z.runId,...Z.dedup,fragmentIndex:J}):void 0});return G}function s_8($){return{subject:OL($.runId),data:iZ1.encode(JSON.stringify({done:!0,finalSeq:$.finalSeq})),msgId:it4($)}}function e_8($){return{subject:OL($),data:iZ1.encode(JSON.stringify({done:!0}))}}function tt4($){let Z=$.reduce((Y,G)=>Y+(G?.length??0),0),X=new Uint8Array(Z),Q=0;for(let Y of $){if(!Y)continue;X.set(Y,Q),Q+=Y.length}return X}function dA0(){let $=null;return new TransformStream({transform(Z,X){let Q=Z.headers?.get(a_8);if(!Q){X.enqueue(Z);return}let Y=Number(Q),G=Number(Z.headers?.get(r_8)??"0");if(G===0)$={total:Y,received:0,parts:Array(Y)};else if(!$||$.total!==Y)return;if(!$.parts[G])$.received++;if($.parts[G]=Z.data,$.received<$.total)return;let J=tt4($.parts);$=null,X.enqueue({subject:Z.subject,data:J,headers:Z.headers})}})}function ot4($){return typeof $==="number"&&Number.isInteger($)&&$>0}function at4($){let Z=pt4($.headers?.get("Nats-Msg-Id")||void 0),X;try{X=JSON.parse(rt4.decode($.data))}catch{return null}if(!X||typeof X!=="object")return null;let Q=X;if(Q.done===!0)return{kind:"done",runId:Z?.kind==="done"?Z.runId:null,fenceToken:Z?.kind==="done"?Z.fenceToken:null,envelopeFinalSeq:ot4(Q.finalSeq)?Q.finalSeq:null,msgIdFinalSeq:Z?.kind==="done"?Z.finalSeq:null};if("p"in Q)return{kind:"chunk",seq:Z?.kind==="chunk"?Z.seq:null,runId:Z?.kind==="chunk"?Z.runId:null,fenceToken:Z?.kind==="chunk"?Z.fenceToken:null,chunk:Q.p};return null}function mA0(){return new TransformStream({transform($,Z){let X=at4($);if(X)Z.enqueue(X)}})}var lA0="decopilot.stream",r_8="Dp-Frag-Idx",a_8="Dp-Frag-Total",dt4=33554432,iZ1,rt4;var $v8=w(()=>{iZ1=new TextEncoder;rt4=new TextDecoder});var iA0=w(()=>{$v8()});var HU="DECOPILOT_STREAMS";var pZ1=w(()=>{iA0()});function Zv8($,Z){return new TransformStream({transform(X,Q){if(X.runId!==$||X.fenceToken!==Z)return;Q.enqueue(X)}})}function Xv8(){let $=1;return new TransformStream({transform(Z,X){if(Z.kind==="done"){X.enqueue(Z);return}if(Z.seq===null){X.error(Error("projector chunk missing seq"));return}if(Z.seq<$)return;if(Z.seq>$){X.error(new Ma($,Z.seq));return}$++,X.enqueue(Z)}})}function Qv8($){let Z=$.getReader(),X=!1,Q=0,Y=()=>{if(X)return;X=!0,Z.releaseLock()};return new ReadableStream({async pull(G){for(;;){let{done:J,value:K}=await Z.read();if(J){await Z.cancel(),Y(),G.error(Error("reader stopped before done"));return}let W=K;if(W.kind==="done"){if(!(W.envelopeFinalSeq!=null&&W.envelopeFinalSeq===W.msgIdFinalSeq))continue;if(W.envelopeFinalSeq!==Q){await Z.cancel(),Y(),G.error(new Ma(Q+1,null));return}await Z.cancel(),Y(),G.close();return}Q=W.seq??Q,G.enqueue(W.chunk);return}},async cancel(G){await Z.cancel(G),Y()}})}function st4($){if(Symbol.asyncIterator in $)return $[Symbol.asyncIterator]();let Z=$[Symbol.iterator]();return{next:async()=>Z.next(),return:async(X)=>Z.return?Z.return(X):{done:!0,value:X}}}function pA0($){let Z=st4($.messages),X=$.idleTimeoutMs,Q=!1,Y=(G)=>{if(Q)return;Q=!0,Z.return?.(G).catch(()=>{}),$.onCancel?.()};return new ReadableStream({async pull(G){if(X===void 0){let{done:N,value:F}=await Z.next();if(N){G.close();return}G.enqueue(F);return}let J=new AbortController,K=Z.next().then((N)=>{return J.abort(),N}),W=j8(X,{signal:J.signal}).then(()=>"idle").catch(()=>"cancelled"),H=await Promise.race([K,W]);if(H==="idle"){G.error(new nA0(X));return}if(H==="cancelled")return;if(H.done){G.close();return}G.enqueue(H.value)},async cancel(G){Y(G)}})}var nA0,Ma;var tA0=w(()=>{f4();nA0=class nA0 extends Error{idleTimeoutMs;constructor($){super("producer produced no output before timeout");this.idleTimeoutMs=$;this.name="StreamIdleTimeoutError"}};Ma=class Ma extends Error{expectedSeq;gotSeq;constructor($,Z){super(Z===null?`missing seq ${$} (stream ended at the fenced done)`:`missing seq ${$} (next delivered is ${Z})`);this.expectedSeq=$;this.gotSeq=Z;this.name="StreamGapError"}}});function et4($){let X=pA0({messages:$.messages,idleTimeoutMs:$.idleTimeoutMs,onCancel:$.onDone}).pipeThrough(dA0()).pipeThrough(mA0()).pipeThrough(Zv8($.runId,$.fenceToken)).pipeThrough(Xv8());return Qv8(X)}async function Gv8($){let X=await(await $.js.consumers.get(HU,{filter_subjects:OL($.runId),deliver_policy:Yv8.DeliverPolicy.All})).consume();async function*Q(){try{for await(let Y of X)yield{subject:Y.subject,data:Y.data,headers:Y.headers}}finally{X.stop()}}return et4({messages:Q(),runId:$.runId,fenceToken:$.fenceToken,idleTimeoutMs:$.idleTimeoutMs,onDone:()=>X.stop()})}var Yv8;var Jv8=w(()=>{pZ1();tA0();iA0();Yv8=k(xE(),1)});async function $o4($){let X=($.requestMessageId?await $.messageParts.maxCreatedAtMsForMessage($.runId,$.requestMessageId):null)??await $.messageParts.maxCreatedAtMsForRun($.runId);return new kX({storage:$.messageParts,orgId:$.orgId,threadId:$.runId,runId:$.runId,baseTimeMs:(X??Date.now())+1})}async function Kv8($){let Z=await $o4($),X=$.replaceFinal?(Q)=>Z.replaceFinal(Q):(Q)=>Z.emitFinal(Q);return{emitStepParts:(Q)=>Z.emitStepParts(Q),emitFinal:X,emitError:(Q,Y)=>Z.emitError(Q,Y)}}var Wv8=w(()=>{FL()});function oA0($,Z){Zo4.add(1,{"org.id":Z??"unknown"})}var Zo4;var Hv8=w(()=>{r$();Zo4=g8.createCounter("decopilot.projector.poison_runs",{description:"Number of decopilot runs that exhausted retries and were sent to the DLQ",unit:"{runs}"})});class tZ1{intervalMs;lastBumpMs=new Map;constructor($=3000){this.intervalMs=$}shouldBump($,Z=Date.now()){let X=this.lastBumpMs.get($);if(X!==void 0&&Z-X<this.intervalMs)return!1;return this.lastBumpMs.set($,Z),!0}clear($){this.lastBumpMs.delete($)}}function Nv8($,Z,X,Q){return $.pipeThrough(new TransformStream({transform(Y,G){if(X.shouldBump(Z))Q();G.enqueue(Y)},flush(){X.clear(Z)}}))}function Xo4($){return`liveness: no stream events for ${Math.round($/60000)}m`}function rZ1($){return $.runFenceToken!==null&&$.runFenceToken!==$.fenceToken}function Uv8($){oZ1=$}function Bv8(){if(!oZ1)throw Error("[projector-workflow] runtime not initialized \u2014 setProjectorWorkflowRuntime() must run before workflows fire");return oZ1}function Ov8(){return Bv8()}async function wv8($,Z,X){let Q=Bv8(),Y=Q.getJetStream();if(!Y)throw Error("JetStream unavailable");let G=(await Q.messageParts.loadWindow($.runId,{limit:500})).messages.map(yA0);return{chunkCount:0,attempts:1,outcome:await n_8({chunkStream:Nv8(await Gv8({js:Y,runId:$.runId,fenceToken:$.fenceToken,idleTimeoutMs:$.idleTimeoutMs}),$.runId,Qo4,()=>{Q.bumpProgress({runId:$.runId,orgId:Z}).catch(()=>{})}),persistence:await Kv8({messageParts:Q.messageParts,orgId:Z,runId:$.runId,requestMessageId:$.messageId,replaceFinal:!0}),originalMessages:G,errorMessageId:BL($.runId,$.fenceToken),title:{threadId:$.runId,currentThreadTitle:X,persistTitle:async(K,W)=>{await Q.persistTitle($.runId,Z,W),await Q.onTitleUpdated({runId:$.runId,orgId:Z,title:W})}}})}}async function Fv8($,Z,X){let Q=await $.resolveRun(Z).catch(()=>null);return Q!==null&&Q.runFenceToken===X&&["completed","failed","requires_action"].includes(Q.status)}async function Lv8($,Z,X){let Q=await Yo4($,Z);if("skip"in Q)return;let Y=Q.row.orgId,G=Q.row.createdBy??$.runId,J=Q.row.title;try{let{outcome:K}=await X($,Y,J),W=K?.failed?"failed":uA0(K?.finishReason,K?.finalParts);if(W==="failed"){let H=K?.finishReason?`harness reported an error: ${K.finishReason}`:"harness reported an error";if(oA0($.runId,Y),await Z.markRunFailed($.runId,Y,H,"harness"))await Z.recordFailed({runId:$.runId,orgId:Y,distinctId:G,reason:H,kind:"harness"})}else if(W==="requires_action")await Z.markRunRequiresAction($.runId,Y),await Z.clearSynthesizedError($.runId,$.fenceToken);else{if(await Z.completeRunIfNotCompleted($.runId,Y))await Z.recordCompleted({runId:$.runId,orgId:Y,distinctId:G,usage:K?.usage??{inputTokens:0,outputTokens:0,totalTokens:0}});await Z.clearSynthesizedError($.runId,$.fenceToken)}await Z.purgeRun($.runId,$.fenceToken)}catch(K){if(K instanceof Ma){if(await Fv8(Z,$.runId,$.fenceToken)){await Z.clearSynthesizedError($.runId,$.fenceToken),await Z.purgeRun($.runId,$.fenceToken);return}let U=`stream truncated before projection could replay it: ${K.message}`;if(oA0($.runId,Y),await Z.markRunFailed($.runId,Y,U,"projection"))await Z.recordFailed({runId:$.runId,orgId:Y,distinctId:G,reason:U,kind:"projection"});await Z.purgeRun($.runId,$.fenceToken);return}let W=K instanceof nA0;if(W&&await Fv8(Z,$.runId,$.fenceToken)){await Z.purgeRun($.runId,$.fenceToken);return}let H=W?Xo4(K.idleTimeoutMs):K instanceof Error?K.message:String(K),N=W?"liveness":"projection";if(oA0($.runId,Y),await Z.markRunFailed($.runId,Y,H,N))await Z.recordFailed({runId:$.runId,orgId:Y,distinctId:G,reason:H,kind:N});if(W)await Z.clearSynthesizedError($.runId,$.fenceToken);throw K}}async function Yo4($,Z){let X=await Z.resolveRun($.runId);if(!X)return{skip:"missing"};if(rZ1({status:X.status,runFenceToken:X.runFenceToken,fenceToken:$.fenceToken}))return{skip:"stale",row:X};if(X.version!==2)return{skip:"legacy-v1",row:X};return{row:X}}var oZ1=null,Qo4;var aZ1=w(()=>{p_8();Jv8();tA0();Wv8();Hv8();cZ1();Qo4=new tZ1});function Dv8($,Z){switch($.type){case"START":{let X={type:"RUN_STARTED",taskId:$.taskId,orgId:$.orgId,userId:$.userId,abortController:$.abortController,runConfig:$.runConfig,podId:$.podId,messageId:$.messageId};if(Z?.status.tag==="running")return[{type:"PREVIOUS_RUN_ABORTED",taskId:$.taskId,orgId:Z.orgId},X];return[X]}case"STEP_DONE":{if(Z?.status.tag!=="running")return[];return[{type:"STEP_COMPLETED",taskId:$.taskId,orgId:Z.orgId,stepCount:Z.status.stepCount+1}]}case"FINISH":{if(Z==null||Z.status.tag!=="running")return[];let{stepCount:X}=Z.status;if($.threadStatus==="completed")return[{type:"RUN_COMPLETED",taskId:$.taskId,orgId:Z.orgId,stepCount:X}];if($.threadStatus==="requires_action")return[{type:"RUN_REQUIRES_ACTION",taskId:$.taskId,orgId:Z.orgId,stepCount:X}];return[{type:"RUN_FAILED",taskId:$.taskId,orgId:Z.orgId,reason:"error",errorText:$.errorText??null}]}case"CANCEL":{if(Z?.status.tag!=="running")return[];return[{type:"RUN_FAILED",taskId:$.taskId,orgId:Z.orgId,reason:"cancelled"}]}case"RESUME":{if(Z?.status.tag==="running")return[];return[{type:"RUN_RESUMED",taskId:$.taskId,orgId:$.orgId,userId:$.userId,abortController:$.abortController,podId:$.podId}]}case"FORCE_FAIL":{if($.reason==="ghost")return[{type:"RUN_FAILED",taskId:$.taskId,orgId:Z?.orgId??$.orgId,reason:$.reason,expectedFenceToken:$.expectedFenceToken??null}];if(Z?.status.tag!=="running")return[];return[{type:"RUN_FAILED",taskId:$.taskId,orgId:Z.orgId,reason:$.reason}]}}}function Ev8($,Z,X=new Date){switch(Z.type){case"RUN_STARTED":return{taskId:Z.taskId,orgId:Z.orgId,userId:Z.userId,status:{tag:"running",abortController:Z.abortController,stepCount:0,startedAt:X}};case"RUN_RESUMED":return{taskId:Z.taskId,orgId:Z.orgId,userId:Z.userId,status:{tag:"running",abortController:Z.abortController,stepCount:0,startedAt:X}};case"STEP_COMPLETED":if($?.status.tag!=="running")return $;return{...$,status:{...$.status,stepCount:Z.stepCount}};case"RUN_COMPLETED":return;case"RUN_REQUIRES_ACTION":return;case"RUN_FAILED":return;case"PREVIOUS_RUN_ABORTED":return}}function jv8($){if(!$?.trim())return{...Va};for(let{kind:Z,reason:X,match:Q}of Go4)if(Q.test($))return{kind:Z,reason:X};return{...Va}}var Go4,Va;var zv8=w(()=>{Go4=[{kind:"credits",reason:"Run stopped: the organization is out of AI credits",match:/\[CREDITS\]|requires more credits|\b402\b/i},{kind:"sandbox_unreachable",reason:"Run stopped: its sandbox became unreachable mid-run",match:/\[SANDBOX_UNREACHABLE\]|sandbox stream broke/i},{kind:"cancelled",reason:"Run cancelled before it finished",match:/^\s*(error:\s*)?cancelled\b|run cancelled/i},{kind:"overloaded",reason:"Run stopped: the model provider was overloaded or rate-limited",match:/\boverloaded\b|\brate.?limit|\b429\b/i},{kind:"context_length",reason:"Run stopped: the conversation exceeded the model's context window",match:/context (length|window)|too many tokens|maximum context/i},{kind:"model_error",reason:"Run stopped: the model provider rejected the request",match:/\bAPI Error\b|\b5\d{2}\b.*provider|provider returned/i}],Va={kind:"error",reason:"Run ended with an error \u2014 see the run's messages"}});function Wo4($,Z){if($!=="error")return Ko4[$];let{kind:X,reason:Q}=jv8(Z);return{failure_reason:Q,failure_kind:X}}async function Pv8($,Z,X,Q){let{storage:Y,sseHub:G}=Q,J=await Y.get($,Z);G.emit(Z,yW($,X,{virtualMcpId:J?.virtual_mcp_id??void 0,createdBy:J?.created_by,triggerId:J?.trigger_id,title:J?.title,branch:J?.branch??null,harnessId:J?.harness_id??void 0,createdAt:J?.created_at,updatedAt:J?.updated_at})),G.emit(Z,r70($,X))}async function Ho4($,Z){let{storage:X,sseHub:Q}=Z;switch($.type){case"RUN_STARTED":{await X.update($.taskId,$.orgId,{status:"in_progress",run_config:$.runConfig??null,run_started_at:new Date().toISOString(),last_progress_at:null,failure_reason:null,failure_kind:null});let Y=await X.get($.taskId,$.orgId);Q.emit($.orgId,yW($.taskId,"in_progress",{virtualMcpId:Y?.virtual_mcp_id??void 0,createdBy:Y?.created_by,triggerId:Y?.trigger_id,title:Y?.title,branch:Y?.branch??null,harnessId:Y?.harness_id??void 0,createdAt:Y?.created_at,updatedAt:Y?.updated_at,messageId:$.messageId}));return}case"RUN_RESUMED":{await X.update($.taskId,$.orgId,{status:"in_progress",run_started_at:new Date().toISOString(),last_progress_at:null,failure_reason:null,failure_kind:null});let Y=await X.get($.taskId,$.orgId);Q.emit($.orgId,yW($.taskId,"in_progress",{virtualMcpId:Y?.virtual_mcp_id??void 0,createdBy:Y?.created_by,triggerId:Y?.trigger_id,title:Y?.title,branch:Y?.branch??null,harnessId:Y?.harness_id??void 0,createdAt:Y?.created_at,updatedAt:Y?.updated_at}));return}case"STEP_COMPLETED":Q.emit($.orgId,wt0($.taskId,$.stepCount));return;case"RUN_COMPLETED":await Pv8($.taskId,$.orgId,"completed",Z);return;case"RUN_REQUIRES_ACTION":await Pv8($.taskId,$.orgId,"requires_action",Z);return;case"RUN_FAILED":{if($.reason==="ghost"){if(!await X.forceFailIfInProgress($.taskId,$.orgId,$.expectedFenceToken))return;await X.update($.taskId,$.orgId,{run_config:null,run_started_at:null})}else{if(!await X.forceFailIfInProgress($.taskId,$.orgId))return;await X.update($.taskId,$.orgId,{run_config:null,run_started_at:null,...Wo4($.reason,$.errorText)})}let Y=await X.get($.taskId,$.orgId);Q.emit($.orgId,yW($.taskId,"failed",{virtualMcpId:Y?.virtual_mcp_id??void 0,createdBy:Y?.created_by,triggerId:Y?.trigger_id,title:Y?.title,branch:Y?.branch??null,harnessId:Y?.harness_id??void 0,createdAt:Y?.created_at,updatedAt:Y?.updated_at})),Q.emit($.orgId,r70($.taskId,"failed")),await Z.onThreadFinished?.($.taskId,$.orgId).catch((G)=>console.error("[run-reactor] thread-finish hook failed",G));return}case"PREVIOUS_RUN_ABORTED":return}}async function Av8($,Z){for(let{event:X}of $)await Ho4(X,Z)}var Jo4="Run stalled \u2014 no progress within the idle timeout window",Ko4;var Tv8=w(()=>{T6();zv8();Ko4={reaped:{failure_reason:Jo4,failure_kind:"stall"},cancelled:{failure_reason:"Run cancelled before it finished",failure_kind:"cancelled"},error:{failure_reason:Va.reason,failure_kind:Va.kind}}});function Rv8($){return $.now-$.lastProgressAt>$.idleTimeoutMs}function Iv8($){return Math.max($.persistedLastProgressAt??Number.NEGATIVE_INFINITY,$.currentRunStartedAt)}class eZ1{deps;clock;states=new Map;reaperTimer=null;constructor($,Z=()=>new Date){this.deps=$;this.clock=Z;this.reaperTimer=setInterval(()=>{this.reapStaleRuns().catch((X)=>{console.error("[RunRegistry] Reaper sweep failed",X)})},No4)}async execute($){let Z=this.dispatch($);return await this.react(Z),Z}dispatch($){let Z=this.states.get($.taskId),X=Dv8($,Z),Q=[];for(let Y of X){let G=this.states.get(Y.taskId);if(Y.type==="PREVIOUS_RUN_ABORTED"||Y.type==="RUN_FAILED"){if(G?.status.tag==="running")G.status.abortController.abort()}let J=Ev8(G,Y,this.clock());if(J===void 0)this.states.delete(Y.taskId);else this.states.set(Y.taskId,J);if(Q.push({event:Y,state:J}),Fo4.has(Y.type))qv8().add(1,{"org.id":Y.orgId});else if(Uo4.has(Y.type)&&G?.status.tag==="running")qv8().add(-1,{"org.id":Y.orgId})}return Q}react($){return Av8($,this.deps)}getAbortSignal($){let Z=this.states.get($);if(Z?.status.tag==="running")return Z.status.abortController.signal;return null}isRunning($){return this.states.get($)?.status.tag==="running"}async stopAll(){for(let[,$]of this.states)if($.status.tag==="running")$.status.abortController.abort();this.states.clear()}dispose(){if(this.reaperTimer)clearInterval(this.reaperTimer),this.reaperTimer=null}async reapStaleRuns(){let $=this.clock().getTime(),Z=[...this.states].filter(([,X])=>X.status.tag==="running");for(let[X,Q]of Z){if(this.states.get(X)?.status.tag!=="running")continue;let G;try{let K=await this.deps.storage.getProgress(X,Q.orgId);G=Iv8({persistedLastProgressAt:K?.lastProgressAt??null,currentRunStartedAt:Q.status.startedAt.getTime()})}catch(K){console.warn(`[RunRegistry] Reaper progress read failed for ${X}; skipping`,K);continue}if(!Rv8({lastProgressAt:G,now:$,idleTimeoutMs:rA0}))continue;let J=await this.deps.storage.get(X,Q.orgId).catch(()=>null);if(J&&J.status!=="in_progress"){let K=this.states.get(X);if(K?.status.tag==="running")K.status.abortController.abort();this.states.delete(X);continue}console.warn(`[RunRegistry] Reaping stuck run for thread ${X} (idle > ${rA0/60000}m) ...`),Bo4().add(1,{"org.id":Q.orgId,reason:"idle_timeout"}),await this.execute({type:"FORCE_FAIL",taskId:X,reason:"reaped"}).catch((K)=>{console.error("[RunRegistry] Reaper execute failed",K)})}}}var No4=300000,sZ1,rA0,Fo4,Uo4,Mv8=($)=>{let Z;return()=>Z??=$()},qv8,Bo4;var $71=w(()=>{Tv8();r$();sZ1=Number(process.env.RUN_IDLE_TIMEOUT_MS),rA0=Number.isFinite(sZ1)&&sZ1>0?sZ1:600000,Fo4=new Set(["RUN_STARTED","RUN_RESUMED"]),Uo4=new Set(["RUN_COMPLETED","RUN_FAILED","RUN_REQUIRES_ACTION","PREVIOUS_RUN_ABORTED"]),qv8=Mv8(()=>g8.createUpDownCounter("decopilot.stream.inflight",{description:"Number of in-flight decopilot stream requests",unit:"{requests}"})),Bo4=Mv8(()=>g8.createCounter("decopilot.run.reaped",{description:"Number of decopilot runs force-failed by the progress-based reaper",unit:"{runs}"}))});async function Vv8($){let{runId:Z}=$,X=Ov8(),Q=await X.resolveRun(Z),Y=$.fenceToken??Q?.runFenceToken;if(!Q||Q.version!==2||Y==null)return;if(rZ1({status:Q.status,runFenceToken:Q.runFenceToken,fenceToken:Y}))return;if(!X.getJetStream())throw Error("JetStream unavailable for consume step");await Lv8({runId:Z,fenceToken:Y,messageId:$.messageId,idleTimeoutMs:$.idleTimeoutMs??rA0},X,wv8)}var kv8=w(()=>{aZ1();$71()});import{DBOS as jv}from"@dbos-inc/dbos-sdk";function X71($){Z71=$}function Q71(){if(!Z71)throw Error("[hostedHarness] runtime not initialized \u2014 setHostedHarnessRuntime() must run before workflows fire");return Z71}async function Oo4($,Z){let X=Q71(),{request:Q}=$,Y=Z??await X.studioContextFactory(Q.organizationId,Q.userId);if(!Y)throw Error("user membership lost mid-dispatch");if(Q.runMetadata)Y.metadata.runMetadata=Q.runMetadata;let G=new AbortController;Sv8().add(1);try{if(Ru(Y,"in_progress",$.threadId),!Q.runMetadata?.taskBoardItemId)TC8(Y,$.threadId);await X.dispatchRunFn({...Q,abortSignal:G.signal},Y,X.deps)}finally{Sv8().add(-1)}}function Cv8($,Z){let X=Q71(),Q=Z?.isQueued??Do4,Y=new Ia({intervalMs:Z?.intervalMs,sleepFn:Z?.sleepFn,emit:async()=>{if(await Q($)){await Lo4(X,$);return}Y.stop()}});return Y.arm(),()=>Y.stop()}async function Do4($){try{return(await jv.getWorkflowStatus(Y71($.runId,$.fenceToken)))?.status==="ENQUEUED"}catch(Z){return console.error(`[hostedHarness] could not read child status for run=${$.runId} fence=${$.fenceToken}`,Z),!0}}function Eo4($,Z,X,Q=1){let Y=X instanceof Error?X.message:String(X);return{messageId:BL($,Z),errorChunk:{type:"error",errorText:Y},seq:Q,finalSeq:Q}}function jo4($){if(!($ instanceof Error))return;let Z=$.lastAckSeq;return typeof Z==="number"?Z+1:void 0}async function zo4($,Z){let X=Q71(),{streamBuffer:Q}=X.deps,{messageId:Y,errorChunk:G,seq:J,finalSeq:K}=Eo4($.runId,$.fenceToken,Z,jo4(Z));if(!Q){console.error(`[hostedHarness] no streamBuffer configured; dropping terminal error for run=${$.runId} fence=${$.fenceToken} messageId=${Y}`);return}if(!await Q.publishRawChunk($.runId,G,{fenceToken:$.fenceToken,seq:J})){console.error(`[hostedHarness] failed to publish terminal error chunk for run=${$.runId} fence=${$.fenceToken} messageId=${Y}`);return}await Q.publishDone($.runId,$.fenceToken,K)}async function Po4($){try{await jv.runStep(()=>Oo4($),{name:"runHostedHarness",retriesAllowed:!1})}catch(Z){if(Pa(Z)){console.log(`[hostedHarness] attempt superseded by a newer dispatch; leaving the terminal to it run=${$.runId} fence=${$.fenceToken}`);return}await jv.runStep(()=>zo4($,Z),{name:"publishHostedHarnessFailure",retriesAllowed:!0}).catch((X)=>{console.error(`[hostedHarness] could not publish terminal error for run=${$.runId} fence=${$.fenceToken}`,X)})}}function Y71($,Z){return`decopilot-hosted:${$}:${Z}`}async function _v8($){return{workflowID:(await jv.startWorkflow(Ao4,{workflowID:Y71($.runId,$.fenceToken),queueName:bH($.request.harnessId)?eN:sN,enqueueOptions:{priority:EP0($.request.runMetadata)}})($)).workflowID}}async function zv($,Z){await jv.cancelWorkflow(Y71($,Z))}var Z71=null,wo4,Sv8=()=>wo4??=g8.createUpDownCounter("hosted_runs.active",{description:"Hosted agent-loop runs executing on this pod",unit:"{runs}"}),Lo4=($,Z)=>hK($.deps.streamBuffer,Z.runId,"waiting-capacity"),Ao4;var G71=w(()=>{lZ1();Su();Aa();r$();rr();Z9();Ao4=jv.registerWorkflow(Po4,{name:"hostedHarnessWorkflow",maxRecoveryAttempts:1000})});import{DBOS as vu}from"@dbos-inc/dbos-sdk";function W71($){mZ1($)}function H71($){J71=$}function To4(){if(!J71)throw Error("[threadGate] runtime not initialized \u2014 setThreadGateRuntime() must run before workflows fire");return J71}function Ro4($,Z=fA0){let X=$.runFenceToken;if(X)return{runFenceToken:X,claimedRequest:$,shouldPersistFence:!1};let Q=Z();return{runFenceToken:Q,claimedRequest:{...$,runFenceToken:Q},shouldPersistFence:!0}}async function Io4($){let Z=To4(),{request:X}=$,Q=X.taskId??$.threadId;if(V_8({harnessId:X.harnessId}))await hK(Z.deps.streamBuffer,Q,"starting-run");let Y=await Z.studioContextFactory(X.organizationId,X.userId);if(!Y)throw Error("user membership lost mid-dispatch");W71(X.harnessId);let G=X.taskId??$.threadId,{runFenceToken:J,claimedRequest:K,shouldPersistFence:W}=Ro4(X);if(W)await Y.storage.threads.setRunFence(G,J);return{runFenceToken:J,hostedEnqueue:{runId:Q,fenceToken:J,threadId:$.threadId,request:K}}}async function qo4($){if($.source!=="user-message")return;let{request:Z}=$;n1.capture({distinctId:Z.userId,event:"chat_message_started",groups:{organization:Z.organizationId},properties:{organization_id:Z.organizationId,agent_id:Z.agent,mode:Z.mode,thread_id:Z.taskId??$.threadId,credential_id:Z.models.credentialId}})}async function Mo4($,Z){if($.source!=="user-message")return;let{request:X}=$;n1.capture({distinctId:X.userId,event:"chat_message_failed",groups:{organization:X.organizationId},properties:{organization_id:X.organizationId,thread_id:X.taskId??$.threadId,agent_id:X.agent,model_id:X.models.thinking.id,mode:X.mode,error_category:"setup",error_message:Z}})}async function aA0($){W71($.request.harnessId),await vu.runStep(()=>qo4($),{name:"trackMessageStarted"});let Z;try{Z=await vu.runStep(()=>Io4($),{name:"dispatchRunAndWait",retriesAllowed:!0}),await _v8(Z.hostedEnqueue)}catch(G){let J=G instanceof Error?G.message:String(G);throw await vu.runStep(()=>Mo4($,J),{name:"trackMessageFailed"}),G}let X=$.request.taskId??$.threadId,Q="messages"in $.request?void 0:$.request.messageId,Y=Cv8(Z.hostedEnqueue);try{await vu.runStep(()=>Vv8({runId:X,fenceToken:Z.runFenceToken,messageId:Q}),{name:"consumeRunProjection"})}finally{Y()}return{taskId:$.request.taskId??$.threadId}}async function Vo4($){return aA0($)}async function KU($,Z){return W71($.request.harnessId),{workflowID:(await vu.startWorkflow(ko4,{queueName:fJ,enqueueOptions:{queuePartitionKey:$.threadId,priority:EP0($.request.runMetadata)},workflowID:Z?.workflowID})($)).workflowID}}var K71=1,J71=null,ko4;var vv8=w(()=>{cA0();h4();Su();kv8();rr();G71();ko4=vu.registerWorkflow(Vo4,{name:"threadGateWorkflow",maxRecoveryAttempts:1000})});var WU=w(()=>{vv8();G71()});async function ka($,Z,X){let Q=Z.organizationId,Y=Z.assignedBy??Z.createdBy,G=X.harnessId??"decopilot",J=await RX($,"smart"),K=eE(Q),W=await $.storage.threads.create({...X.fence?{id:X.fence.threadId}:{},organization_id:Q,title:X.title,status:"in_progress",virtual_mcp_id:K,message_storage_version:2,harness_id:G,sandbox_provider_kind:"agent-sandbox",created_by:Y});if(!W.isNew)return{threadId:W.id,isNew:!1};let H={...W.metadata??{},...bH(G)?{read_only:!0}:{},...X.pinnedRef?{pinnedRef:X.pinnedRef}:{},...X.repo?{githubRepo:{url:X.repo.url,owner:X.repo.owner,name:X.repo.name,installationId:X.repo.installationId,connectionId:X.repo.connectionId}}:{}},N=X.pinnedRef?X.pinnedRef:X.repo?rF(W.id,X.repo.connectionId):bH(G)?rF(W.id):null;await $.storage.threads.update(W.id,{metadata:H,...N?{branch:N}:{},updated_by:Y}),await $.storage.taskBoard.linkThread(Z.id,W.id,Q);let F={id:crypto.randomUUID(),role:"user",parts:[{type:"text",text:X.prompt}]};return await new kX({storage:$.storage.threads.messageParts(),orgId:Q,threadId:W.id,runId:W.id}).emitRequestMessage(F),await KU({threadId:W.id,source:"background-tool",request:{messages:[F],models:{credentialId:J.credentialId,thinking:{id:J.modelId,title:J.modelMeta.title}},agent:{id:K,...X.agent??{}},temperature:X.temperature,toolApprovalLevel:"auto",mode:"default",organizationId:Q,userId:Y,harnessId:G,sandboxProviderKind:"agent-sandbox",...X.repo?{}:N?{branch:N}:{},taskId:W.id,runMetadata:{...LP0(Z),[DP0]:X.runClass??"new_task",...X.modelClass&&X.modelClass!=="default"?{[_P0]:X.modelClass}:{}}}},X.fence?{workflowID:X.fence.workflowID}:void 0),{threadId:W.id,isNew:!0}}var N71=w(()=>{or();rr();$L();WU();FL();T6();kK();Aa();vP0()});function So4($){let Z=new Map($.map((G)=>[G.id,G])),X=new Map;for(let G of Ku($)){let J=xv8(G.owner,G.repo);X.set(J,[...X.get(J)??[],G])}if(X.size!==1)return null;let Q=[...X.values()][0],Y=Q.find((G)=>{let J=Z.get(G.connectionId);return J?rj(J):!1})??Q[0];return{connectionId:Y.connectionId,owner:Y.owner,name:Y.repo,installationId:Y.installationId,url:`https://github.com/${Y.owner}/${Y.repo}`}}async function sA0($,Z){try{let{items:X}=await $.storage.connections.list(Z,{slug:"mcp-github"}),Q=So4(X);if(Q)return{repo:Q};let Y=new Map;for(let J of Ku(X)){let K=xv8(J.owner,J.repo);if(!Y.has(K))Y.set(K,{connectionId:J.connectionId,repo:`${J.owner}/${J.repo}`})}let G=Y;if(G.size===0)return console.warn(`[task-board] claude-code skipped for org ${Z}: `+"no importable repos \u2014 running Decopilot"),null;return console.warn(`[task-board] claude-code for org ${Z}: ${G.size} importable repos \u2014 the run picks one with TASK_ADD_REPO`),{choices:[...G.values()]}}catch(X){return console.warn("[task-board] repo lookup for claude-code failed",X),null}}function fv8($,Z,X){let Q=["You've been assigned this task. Complete it and finish with a pull request if it makes sense (like a coding task) or is explicitly requested.","","You are running AUTONOMOUSLY \u2014 no human is watching, so drive this to "+"completion yourself. Make reasonable decisions and move on; do not stop to ask for confirmation.","",`Title: ${$.title}`];if($.description)Q.push("","Description:",$.description);if(Q.push("",Z?`The repository ${Z.owner}/${Z.name} is already cloned at your working directory, on its own branch. \`git\` and \`gh\` are authenticated. ${go}`:["Your working directory is EMPTY: this organization has several repositories, so nothing has been cloned yet. FIRST call `mcp__studio__TASK_ADD_REPO` with the connectionId of the repository this task is about. It clones that repository into your working directory and waits for the checkout, so once it returns the repository is there on its own branch and `git` and `gh` are authenticated. Do not read files, run `git`, or run `gh` before it returns; there is nothing there yet.","","Repositories in this organization:",...(X?.repoChoices??[]).map((Y)=>`- ${Y.repo} (connectionId: ${Y.connectionId})`),X?.repoChoices?.length?"Pick the one the task is about. If the task doesn't say and the names don't settle it, take the first.":"Call `mcp__studio__TASK_ADD_REPO` with no arguments to list them."].join(`
2846
2846
  `),""),X?.resolveConflict&&X.pr)Q.push(`Pull request #${X.pr.number} (${X.pr.url}) is approved but has a MERGE CONFLICT with its base branch.`,`Check that branch out (\`gh pr checkout ${X.pr.number}\`), merge or rebase the base branch into it, resolve the conflicts, and push to update the SAME pull request \u2014 do NOT open a new one. Resolve by preserving BOTH sides' intent; never blindly discard either side, and change only what the conflict requires.`,"");else if(X?.feedback)Q.push(X.pr?`A reviewer requested changes on pull request #${X.pr.number} (${X.pr.url}):`:"A reviewer requested changes on your previous work:",X.feedback,X.pr?`Check that branch out (\`gh pr checkout ${X.pr.number}\`) before editing, address the feedback, then push to update the SAME pull request \u2014 do NOT open a new one.`:"Address this feedback.","The reviewer judged the DEPLOYED PREVIEW, not your diff. Reproduce their check there before you push again \u2014 a fix that only looks right in the code comes straight back.","");else if(X?.pr)Q.push(`This task already has an open pull request #${X.pr.number} (${X.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. If it already does everything the task asks, say so and stop rather than changing it.","");return Q.push("How to finish:","- Make the change, commit it, push the branch, and open a pull request"+(X?.pr?" \u2014 or push to the existing one, per the instruction above.":"."),"- Change only what the task needs. Don't refactor around it.","- The change must be REACHABLE from the surface the task names: edit the component that route actually renders, not one that merely looks like the right place. A change nothing imports is dead code, and it is the most common reason a task comes back rejected.","- Before handing over, VERIFY the task's outcome the way the reviewer will: get the PR's `previewUrl` from `mcp__studio__TASK_BOARD_ITEM_PRS_GET` (give the deploy a minute), open the affected route there, and confirm the behaviour actually happens. A green test suite is not the bar \u2014 the reviewer approves what it can see on the preview.","- As soon as `gh pr create` prints the URL, call `mcp__studio__TASK_BOARD_ITEM_PR_LINK` with that url. Do this even if you also mention the PR in a comment \u2014 the reviewers are dispatched from the linked PR, not from your message.",`- Then move this task to review on the board: call \`mcp__studio__TASK_BOARD_ITEM_UPDATE\` with id "${$.id}" and status "in_review". Pass ONLY the fields you are changing.`,'- If the task turns out to need no code change, do NOT open a PR: explain why in a comment on the task (`mcp__studio__TASK_BOARD_COMMENT_CREATE`) and move it to "done" instead of "in_review". There is nothing for a reviewer to review, so In Review would strand it.',`- Anything a reviewer should know (a decision you made, something you found and deliberately left alone, a question) goes on the task as a comment: \`mcp__studio__TASK_BOARD_COMMENT_CREATE\` with taskBoardItemId "${$.id}". Read what's already there first with \`mcp__studio__TASK_BOARD_COMMENT_LIST\` \u2014 a comment may be addressed to you.`,"",`(task id: ${$.id})`),Q.join(`
2847
- `)}var xv8=($,Z)=>`${$}/${Z}`.toLowerCase();var F71=w(()=>{BP0();XY();g9()});import{createHmac as Co4,randomBytes as _o4,timingSafeEqual as vo4}from"crypto";function xo4(){if(eA0)return eA0;let $;try{let Z=o0();$=Z.studioJwtSecret??Z.betterAuthSecret}catch{$=void 0}return eA0=$?Buffer.from($):_o4(32),eA0}function U71($,Z,X){return`rtok_${Co4("sha256",xo4()).update(`${$}:${Z}:${X.toISOString()}`).digest("base64url")}`}function bv8($,Z,X,Q){let Y=Buffer.from($),G=Buffer.from(U71(Z,X,Q));return Y.length===G.length&&vo4(Y,G)}var eA0=null;var B71=w(()=>{C8()});import{createHash as fo4}from"crypto";function O71($,Z){if($.status===null||yv8.has($.status))return!1;return!La({updated_at:$.lastActiveAt,last_progress_at:null},Z)}function ho4($,Z){return Z-$>=go4}async function $T0($,Z,X){let Q=await $.storage.organizationSettings.get(Z.organizationId),Y=fF(Q?.flags);if(Y.length===0)return;let G=C30(Q?.flags,"cheap_reviewer_model")?"reviewer":"default",J=await io4($,Z),K=new Date(J);await Promise.all(Y.map(async(W)=>{if(do4(Z,W,J)){await fH($,Z,`${Th[W]} failed ${w71} times on `+"this review \u2014 it will not be retried");return}if(W==="qa"&&X?.previewMatchesHead===!1){if(ho4(J,Date.now()))await fH($,Z,"the pull request's deploy preview is not showing its latest commit (its checks never went green), so QA cannot verify this change against what the PR actually does");return}if(mo4(Z,W,J))return;let H=uo4(Z,W,J);await to4($,Z,W,K,H,G).catch((N)=>console.error(`[task-board] ${W} reviewer enqueue failed`,N))}))}function uo4($,Z,X,Q=Date.now()){return $.threads.filter((Y)=>Rh(Y.title,Z)&&L71(Y,Q)&&new Date(Y.createdAt).getTime()>=X).length}function co4($,Z){if(!$||!Z||!("choices"in Z))return null;return Z.choices.find((X)=>X.repo===$)?.connectionId??null}function lo4($,Z,X){let Q=$.threads.filter((Y)=>Rh(Y.title,Z)&&new Date(Y.createdAt).getTime()<X).map((Y)=>new Date(Y.lastActiveAt).getTime()).filter((Y)=>Number.isFinite(Y));return Q.length===0?0:Math.max(...Q)}function L71($,Z){if($.status==="failed")return!0;return $.status!==null&&!yv8.has($.status)&&!O71($,Z)}function gv8($,Z,X,Q=Date.now()){return $.threads.filter((Y)=>{if(!Rh(Y.title,Z))return!1;return O71(Y,Q)||new Date(Y.createdAt).getTime()>=X})}function do4($,Z,X,Q=Date.now()){let Y=gv8($,Z,X,Q);return Y.length>0&&Y.every((G)=>L71(G,Q))&&Y.length>=w71}function mo4($,Z,X,Q=Date.now()){let Y=gv8($,Z,X,Q);if(Y.length===0)return!1;if(Y.some((J)=>O71(J,Q)))return!0;let G=Y.filter((J)=>L71(J,Q));if(G.length>=w71)return!0;return G.length!==Y.length}async function io4($,Z){let X=await $.storage.taskBoard.listActivity(Z.id,Z.organizationId);return bF(X)}function no4($,Z,X,Q){return`review:${$}:${Z}:${X.toISOString()}:${Q}`}function po4($){return`thrd_${fo4("sha256").update($).digest("hex").slice(0,32)}`}async function to4($,Z,X,Q,Y,G){let J=Z.organizationId,K=U71(Z.id,X,Q),W=await sA0($,J),H=W&&"repo"in W?W.repo:null,N=W!==null,F=lo4(Z,X,Q.getTime()),U=co4(Z.repo,W),B=N?"mcp__studio__TASK_BOARD_ITEM_PRS_GET":"TASK_BOARD_ITEM_PRS_GET",O=N?"mcp__studio__TASK_BOARD_REVIEW_DECISION":"TASK_BOARD_REVIEW_DECISION",L=N?"mcp__studio__TASK_BOARD_COMMENT_CREATE":"TASK_BOARD_COMMENT_CREATE",D=N?"mcp__studio__TASK_BOARD_COMMENT_LIST":"TASK_BOARD_COMMENT_LIST",E=[yo4[X],"","You are running AUTONOMOUSLY \u2014 no human is watching this run. Making the "+'approve / request-changes call IS your job; you are the decision-maker, not an assistant asking a human to decide. NEVER use `user_ask` to ask whether to approve, or to confirm an obvious call ("Approve the PR?"). Reserve `user_ask` for a genuine, unresolvable blocker only a human can clear (e.g. a missing credential, or a requirement so ambiguous you '+"truly cannot judge the outcome) \u2014 that should be rare. When in doubt "+"between asking and deciding, DECIDE.","","Do NOT push commits, merge, or change the code to fix what you find. You "+"are reviewing, not implementing \u2014 the tools that would let you rewrite "+"the checkout are removed from this run on purpose. Report what you find in your decision instead."].join(`
2847
+ `)}var xv8=($,Z)=>`${$}/${Z}`.toLowerCase();var F71=w(()=>{BP0();XY();g9()});import{createHmac as Co4,randomBytes as _o4,timingSafeEqual as vo4}from"crypto";function xo4(){if(eA0)return eA0;let $;try{let Z=o0();$=Z.studioJwtSecret??Z.betterAuthSecret}catch{$=void 0}return eA0=$?Buffer.from($):_o4(32),eA0}function U71($,Z,X){return`rtok_${Co4("sha256",xo4()).update(`${$}:${Z}:${X.toISOString()}`).digest("base64url")}`}function bv8($,Z,X,Q){let Y=Buffer.from($),G=Buffer.from(U71(Z,X,Q));return Y.length===G.length&&vo4(Y,G)}var eA0=null;var B71=w(()=>{C8()});import{createHash as fo4}from"crypto";function O71($,Z){if($.status===null||yv8.has($.status))return!1;return!La({updated_at:$.lastActiveAt,last_progress_at:null},Z)}function ho4($,Z){return Z-$>=go4}async function $T0($,Z,X){let Q=await $.storage.organizationSettings.get(Z.organizationId),Y=fF(Q?.flags);if(Y.length===0)return;let G=C30(Q?.flags,"cheap_reviewer_model")?"reviewer":"default",J=await io4($,Z),K=new Date(J);await Promise.all(Y.map(async(W)=>{if(do4(Z,W,J)){await fH($,Z,`${Th[W]} failed ${w71} times on `+"this review \u2014 it will not be retried");return}if(W==="qa"&&X?.previewMatchesHead===!1){if(ho4(J,Date.now()))await fH($,Z,"the pull request's deploy preview is not showing its latest commit (its checks never went green), so QA cannot verify this change against what the PR actually does");return}if(mo4(Z,W,J))return;let H=uo4(Z,W,J);await to4($,Z,W,K,H,G).catch((N)=>console.error(`[task-board] ${W} reviewer enqueue failed`,N))}))}function uo4($,Z,X,Q=Date.now()){return $.threads.filter((Y)=>Rh(Y.title,Z)&&L71(Y,Q)&&new Date(Y.createdAt).getTime()>=X).length}function co4($,Z){if(!$||!Z||!("choices"in Z))return null;return Z.choices.find((X)=>X.repo===$)?.connectionId??null}function lo4($,Z,X){let Q=$.threads.filter((Y)=>Rh(Y.title,Z)&&Y.status==="completed"&&new Date(Y.createdAt).getTime()<X).map((Y)=>new Date(Y.lastActiveAt).getTime()).filter((Y)=>Number.isFinite(Y));return Q.length===0?0:Math.max(...Q)}function L71($,Z){if($.status==="failed")return!0;return $.status!==null&&!yv8.has($.status)&&!O71($,Z)}function gv8($,Z,X,Q=Date.now()){return $.threads.filter((Y)=>{if(!Rh(Y.title,Z))return!1;return O71(Y,Q)||new Date(Y.createdAt).getTime()>=X})}function do4($,Z,X,Q=Date.now()){let Y=gv8($,Z,X,Q);return Y.length>0&&Y.every((G)=>L71(G,Q))&&Y.length>=w71}function mo4($,Z,X,Q=Date.now()){let Y=gv8($,Z,X,Q);if(Y.length===0)return!1;if(Y.some((J)=>O71(J,Q)))return!0;let G=Y.filter((J)=>L71(J,Q));if(G.length>=w71)return!0;return G.length!==Y.length}async function io4($,Z){let X=await $.storage.taskBoard.listActivity(Z.id,Z.organizationId);return bF(X)}function no4($,Z,X,Q){return`review:${$}:${Z}:${X.toISOString()}:${Q}`}function po4($){return`thrd_${fo4("sha256").update($).digest("hex").slice(0,32)}`}async function to4($,Z,X,Q,Y,G){let J=Z.organizationId,K=U71(Z.id,X,Q),W=await sA0($,J),H=W&&"repo"in W?W.repo:null,N=W!==null,F=lo4(Z,X,Q.getTime()),U=co4(Z.repo,W),B=N?"mcp__studio__TASK_BOARD_ITEM_PRS_GET":"TASK_BOARD_ITEM_PRS_GET",O=N?"mcp__studio__TASK_BOARD_REVIEW_DECISION":"TASK_BOARD_REVIEW_DECISION",L=N?"mcp__studio__TASK_BOARD_COMMENT_CREATE":"TASK_BOARD_COMMENT_CREATE",D=N?"mcp__studio__TASK_BOARD_COMMENT_LIST":"TASK_BOARD_COMMENT_LIST",E=[yo4[X],"","You are running AUTONOMOUSLY \u2014 no human is watching this run. Making the "+'approve / request-changes call IS your job; you are the decision-maker, not an assistant asking a human to decide. NEVER use `user_ask` to ask whether to approve, or to confirm an obvious call ("Approve the PR?"). Reserve `user_ask` for a genuine, unresolvable blocker only a human can clear (e.g. a missing credential, or a requirement so ambiguous you '+"truly cannot judge the outcome) \u2014 that should be rare. When in doubt "+"between asking and deciding, DECIDE.","","Do NOT push commits, merge, or change the code to fix what you find. You "+"are reviewing, not implementing \u2014 the tools that would let you rewrite "+"the checkout are removed from this run on purpose. Report what you find in your decision instead."].join(`
2848
2848
  `),j=[...N?[]:[E,""],`Task title: ${Z.title}`,Z.description?`
2849
2849
  Task description:
2850
2850
  ${Z.description}