decocms 4.20.1 → 4.22.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.
- package/dist/client/assets/{AlertCircle-DMGExMxY.js → AlertCircle-BAqebLND.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-BYUnq8gY.js → ArrowUpRight-BejkutVa.js} +1 -1
- package/dist/client/assets/Check-CC3ah2EP.js +1 -0
- package/dist/client/assets/{CheckCircle-C5ITwmFz.js → CheckCircle-C_Aedf-I.js} +1 -1
- package/dist/client/assets/{ChevronDown-BDi4pzpg.js → ChevronDown-ChsImHZJ.js} +1 -1
- package/dist/client/assets/{ChevronRight-CkirMRmz.js → ChevronRight-DKpM0qdo.js} +1 -1
- package/dist/client/assets/ChevronUp-CJ6cOnxb.js +1 -0
- package/dist/client/assets/Circle-Blw66dbf.js +1 -0
- package/dist/client/assets/Copy01-B9fTK-Gv.js +1 -0
- package/dist/client/assets/DotsVertical-CmhOyP1I.js +1 -0
- package/dist/client/assets/Eye-CFP70kHf.js +1 -0
- package/dist/client/assets/{FilterLines-DCrHo_W-.js → FilterLines-BCJIlwsH.js} +1 -1
- package/dist/client/assets/{Globe01-CHueNlXT.js → Globe01-CdKa67VI.js} +1 -1
- package/dist/client/assets/{Globe04-D1Ia72FD.js → Globe04-BwB-L-v7.js} +1 -1
- package/dist/client/assets/{HardDrive-C5pxB0xX.js → HardDrive-Cvln_XgB.js} +1 -1
- package/dist/client/assets/{Key01-D_Aswhqq.js → Key01-Dq3fyqt5.js} +1 -1
- package/dist/client/assets/{LayoutLeft-BIAH0kog.js → LayoutLeft-D7T3E-u6.js} +1 -1
- package/dist/client/assets/{LinkExternal01-vG76nXPe.js → LinkExternal01-Cohlmmy1.js} +1 -1
- package/dist/client/assets/List-BX1Dxe3c.js +1 -0
- package/dist/client/assets/Loading02-DutOxXF8.js +1 -0
- package/dist/client/assets/{Monitor01-BEHd5v9A.js → Monitor01-Do0cCBdt.js} +1 -1
- package/dist/client/assets/{Palette-CUxSqgEM.js → Palette-BmgCpHFj.js} +1 -1
- package/dist/client/assets/{Play-B6SMfN5e.js → Play-BBHolMYa.js} +1 -1
- package/dist/client/assets/{Plus-B3W-zU0m.js → Plus-Cpa6DE3F.js} +1 -1
- package/dist/client/assets/{SearchLg-CwA3o7Kq.js → SearchLg-D1sKIH4t.js} +1 -1
- package/dist/client/assets/{SearchMd-CG-ZdWyV.js → SearchMd-CafLz5-k.js} +1 -1
- package/dist/client/assets/{Settings02-BXQlyl72.js → Settings02-Qe5DtIFk.js} +1 -1
- package/dist/client/assets/{Shield01-C5cTYwHG.js → Shield01-CmqQX7z4.js} +1 -1
- package/dist/client/assets/{Star01-CaO0nMo9.js → Star01-Dx3yxBV5.js} +1 -1
- package/dist/client/assets/{Stars01-DjfTA0U2.js → Stars01-Cjj351UH.js} +1 -1
- package/dist/client/assets/{Stars02-oR68jXM_.js → Stars02-DVjaFNiu.js} +1 -1
- package/dist/client/assets/{Sun-gt9ujltE.js → Sun-9KvJTXMD.js} +1 -1
- package/dist/client/assets/SwitchHorizontal01-C2AiHI6d.js +1 -0
- package/dist/client/assets/{Tool01-CPfgYpSb.js → Tool01-CMdJij71.js} +1 -1
- package/dist/client/assets/{Trash01-De9U-JcA.js → Trash01-Bk68wFhO.js} +1 -1
- package/dist/client/assets/{Upload01-XVwkIKd6.js → Upload01-DfieuDNH.js} +1 -1
- package/dist/client/assets/{User01--wnyNy2g.js → User01-BiwKrQu6.js} +1 -1
- package/dist/client/assets/{Users01-DQSxkCun.js → Users01-rcBZnIdC.js} +1 -1
- package/dist/client/assets/{Users03-DEShSeP4.js → Users03-C2FdBaet.js} +1 -1
- package/dist/client/assets/{X-DchRughI.js → X-Dfoip5yB.js} +1 -1
- package/dist/client/assets/{XCircle-BMPeQmo7.js → XCircle-C9R5bCeP.js} +1 -1
- package/dist/client/assets/{XClose-BlQxiRFv.js → XClose-CPqc0UtD.js} +1 -1
- package/dist/client/assets/{Zap-gCfOy-ns.js → Zap-CRPirG1P.js} +1 -1
- package/dist/client/assets/{ZapSquare-DRmIxSdp.js → ZapSquare-CGsw7HnP.js} +1 -1
- package/dist/client/assets/{ZoomOut-VZDZQqnX.js → ZoomOut-Cq_jwvnh.js} +1 -1
- package/dist/client/assets/{access-gate-Cqrbc3BU.js → access-gate-7q5PI6kF.js} +1 -1
- package/dist/client/assets/{add-section-modal-DgQQFrd8.js → add-section-modal-BVhFBSux.js} +1 -1
- package/dist/client/assets/agent-capabilities-BGx_yFvg.js +1 -0
- package/dist/client/assets/agent-icon-DAuEpvjN.js +1 -0
- package/dist/client/assets/agents-list-DEbqbve9.js +1 -0
- package/dist/client/assets/ai-providers-jW9pV5wT.js +1 -0
- package/dist/client/assets/{alert-CWiQ4BOG.js → alert-Chi9L6Lo.js} +1 -1
- package/dist/client/assets/{alert-dialog-Buxux4Jv.js → alert-dialog-DNV8OhbX.js} +1 -1
- package/dist/client/assets/app-editor-B90O76NW.js +1 -0
- package/dist/client/assets/{auth-catchall-BM5rYO-b.js → auth-catchall-BeENOKgo.js} +1 -1
- package/dist/client/assets/{auth-entry-Cvl9qiXx.js → auth-entry-Banhr0Dj.js} +1 -1
- package/dist/client/assets/{auth-BZgEN2RD.js → auth-k2I4x92r.js} +1 -1
- package/dist/client/assets/{auth-split-layout-Dfe6g0QY.js → auth-split-layout-BpIandE_.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-cJNik8J_.js → authenticate-and-persist-oauth-DiKNvlD_.js} +1 -1
- package/dist/client/assets/{automation-list-row-BUhdfpZz.js → automation-list-row-pGg9Lluh.js} +1 -1
- package/dist/client/assets/automation-runs-8IQ_r9WW.js +1 -0
- package/dist/client/assets/automations-DYcjcF3S.js +1 -0
- package/dist/client/assets/{avatar-B8STW9mD.js → avatar-BD1bv4j8.js} +1 -1
- package/dist/client/assets/{badge-D5WiG5D4.js → badge-Dz2OFDxQ.js} +1 -1
- package/dist/client/assets/{block-document-CyegCur0.js → block-document-MEJKfSm3.js} +1 -1
- package/dist/client/assets/{brand-context-BclDTNfv.js → brand-context-C-0cx-zk.js} +1 -1
- package/dist/client/assets/{breadcrumb-CrhSDATC.js → breadcrumb-DDrlJm3F.js} +1 -1
- package/dist/client/assets/buckets-K1kG3QiU.js +1 -0
- package/dist/client/assets/bulk-category-panel-Cpe8cv7-.js +1 -0
- package/dist/client/assets/{capability-load-error-DB0r6fSo.js → capability-load-error-CV7OdywL.js} +1 -1
- package/dist/client/assets/{card-BWrHlXPo.js → card-DT6z8UIy.js} +1 -1
- package/dist/client/assets/category-editor-97EZw1QP.js +1 -0
- package/dist/client/assets/{chat-context-D6mGbi6m.js → chat-context-CcZXAHlF.js} +5 -5
- package/dist/client/assets/checkbox-CGiCIR_t.js +1 -0
- package/dist/client/assets/{cli-auth-success-DYZ43GUt.js → cli-auth-success-C0sOgmEb.js} +1 -1
- package/dist/client/assets/collection-detail-Clwh-BUk.js +1 -0
- package/dist/client/assets/collection-display-button-S0ZgQk6P.js +1 -0
- package/dist/client/assets/{collection-search-C_fvYmsw.js → collection-search-eFRNtpdt.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-Cv1VGTD3.js → collection-table-wrapper-DQSn1GJT.js} +1 -1
- package/dist/client/assets/{collection-tabs-Bj8UeBuP.js → collection-tabs-CYD2CpTe.js} +1 -1
- package/dist/client/assets/{command-DeIgAPPz.js → command-DWilEO1e.js} +1 -1
- package/dist/client/assets/commerce-onboarding-Dmxkngyz.js +1 -0
- package/dist/client/assets/connect-desktop-dialog-C8fqunJ_.js +1 -0
- package/dist/client/assets/connection-card-De6SHWCH.js +1 -0
- package/dist/client/assets/connection-detail-BUV19nAJ.js +1 -0
- package/dist/client/assets/{connection-form-helpers-DYr5JaDw.js → connection-form-helpers-DsTip61C.js} +1 -1
- package/dist/client/assets/connections-DHz382Nc.js +1 -0
- package/dist/client/assets/constants-C8_Swa4x.js +1 -0
- package/dist/client/assets/{decopilot-BEN2dFqJ.js → decopilot-DA6E6MgD.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-D-yGYu6w.js → decopilot-sse-pool-B-Li8vIf.js} +1 -1
- package/dist/client/assets/{dialog-Bw0pp5yj.js → dialog-Bx9_D2-i.js} +1 -1
- package/dist/client/assets/{domain-settings-ClPu3y3V.js → domain-settings-CmBMcneA.js} +1 -1
- package/dist/client/assets/{drawer-Bqwp_rDk.js → drawer-DUrVpGtt.js} +1 -1
- package/dist/client/assets/dropdown-menu-BXlOZYEj.js +1 -0
- package/dist/client/assets/{empty-state-DEvtcbTs.js → empty-state-DrOUH3OQ.js} +1 -1
- package/dist/client/assets/extract-connection-data-AeQK1qls.js +1 -0
- package/dist/client/assets/file-explorer-cazCHuV9.js +2 -0
- package/dist/client/assets/{file-type-icon-CeDR5FDE.js → file-type-icon-DHWkW0ug.js} +1 -1
- package/dist/client/assets/{files-BhVyoXap.js → files-CHpi2r2q.js} +1 -1
- package/dist/client/assets/{form-BvyPfbLQ.js → form-C6xzxaKT.js} +1 -1
- package/dist/client/assets/format-time-Cy7tTmZp.js +1 -0
- package/dist/client/assets/general-CBqmiHQR.js +1 -0
- package/dist/client/assets/github-repo-picker-BFPwF92l.js +1 -0
- package/dist/client/assets/{hooks-BPEh0QmD.js → hooks-DPy92pzv.js} +4 -4
- package/dist/client/assets/{index-BLK_ychv.js → index-C8i8F2aZ.js} +12 -12
- package/dist/client/assets/index-CARq6YCN.js +1 -0
- package/dist/client/assets/{index-DSmc84cq.js → index-CO9SnRbg.js} +4 -4
- package/dist/client/assets/{index-DBQeQBu7.js → index-CYLzTU3h.js} +6 -6
- package/dist/client/assets/{index-Bi8gy8BM.js → index-ChSXukaC.js} +1 -1
- package/dist/client/assets/index-CveMeMql.css +1 -0
- package/dist/client/assets/{index-C0UjMZmb.js → index-DD6weYxO.js} +1 -1
- package/dist/client/assets/{index-CuLYHmz6.js → index-DU_SD-rb.js} +1 -1
- package/dist/client/assets/{index-C4E5A5_g.js → index-DWzm9A1x.js} +1 -1
- package/dist/client/assets/{index-WiwoxaKL.js → index-Dx-JuX8X.js} +2 -2
- package/dist/client/assets/{index-BAAVzGGp.js → index-LGROg_hz.js} +1 -1
- package/dist/client/assets/index-Mlqi33Qh.js +1 -0
- package/dist/client/assets/{index-OF548fxc.js → index-S0Q7YlOD.js} +25 -25
- package/dist/client/assets/index-r-ZTThxt.js +1 -0
- package/dist/client/assets/{index-redirect-Ckad27gh.js → index-redirect-BDcT3T7b.js} +1 -1
- package/dist/client/assets/{index-C3UHIWhR.js → index-zDHcoqw4.js} +1 -1
- package/dist/client/assets/{input-C6fESize.js → input-Dmp_t77f.js} +1 -1
- package/dist/client/assets/{integration-icon-B3836mZm.js → integration-icon-D1vivc8T.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-BuboFMvI.js → invite-member-dialog-B52NxzkC.js} +2 -2
- package/dist/client/assets/{label-Cpj2tcAv.js → label-D3ajqQqF.js} +1 -1
- package/dist/client/assets/{library-tab-BBjWEEvH.js → library-tab-D0-rbhqe.js} +3 -3
- package/dist/client/assets/{login-BGIn53vR.js → login-B5g56FG8.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DXbhYp2n.js → mcp-oauth-jAFObzAH.js} +1 -1
- package/dist/client/assets/members-C3EfSHkY.js +1 -0
- package/dist/client/assets/{monaco-editor-Dg_OXRF1.js → monaco-editor-DMzl3sdg.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-ty05snCg.js → monitoring-stats-row-Cn7CUK3V.js} +1 -1
- package/dist/client/assets/{oauth-callback-DmDYtprU.js → oauth-callback-Bs1-J2uC.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-nV9ol-kz.js → oauth-callback-ai-provider-1jknSd8R.js} +1 -1
- package/dist/client/assets/{onboarding-DFxThqB8.js → onboarding-DvEuy0D_.js} +1 -1
- package/dist/client/assets/{org-install-C6-_thTM.js → org-install-CJ7F5mZU.js} +1 -1
- package/dist/client/assets/{org-layout-rq33k6_9.js → org-layout-CQsIu6xu.js} +1 -1
- package/dist/client/assets/{organization-choice-LqtmycnE.js → organization-choice-UHSo9CAk.js} +1 -1
- package/dist/client/assets/{page-seo-form-SfmOLumQ.js → page-seo-form-BY-XtFIF.js} +1 -1
- package/dist/client/assets/page-seo-sheet-C-o48EMg.js +1 -0
- package/dist/client/assets/{popover-CPAEPhwT.js → popover-DbclufIS.js} +1 -1
- package/dist/client/assets/post-editor-o5fS997b.js +1 -0
- package/dist/client/assets/{primitives-TAuh4FGx.js → primitives-PoyK9-WR.js} +1 -1
- package/dist/client/assets/profile-DXLRzqRR.js +1 -0
- package/dist/client/assets/project-app-view-sebr-y53.js +1 -0
- package/dist/client/assets/record-editor-BGPyrMO7.js +1 -0
- package/dist/client/assets/registry-GJh_dUyE.js +2 -0
- package/dist/client/assets/{registry-layout-D8trut1f.js → registry-layout-DaPQiP8-.js} +4 -4
- package/dist/client/assets/{require-capability-Dh5JJLWW.js → require-capability-D_bY_XS6.js} +1 -1
- package/dist/client/assets/{required-auth-layout-BFKAd6mb.js → required-auth-layout-CUJtlw7e.js} +1 -1
- package/dist/client/assets/{reset-password-BVwK480T.js → reset-password-Boo6v3a2.js} +1 -1
- package/dist/client/assets/roles-CP5n6DBo.js +1 -0
- package/dist/client/assets/{scroll-area-DVylVd8s.js → scroll-area-C9lD0DG9.js} +11 -11
- package/dist/client/assets/{search-input-DsIBo_sc.js → search-input-CDcgzOxB.js} +1 -1
- package/dist/client/assets/secrets-BXbhAnGl.js +1 -0
- package/dist/client/assets/{sections-editor-BexUuo8y.js → sections-editor-DHI42whV.js} +2 -2
- package/dist/client/assets/select-CsaBdTgI.js +1 -0
- package/dist/client/assets/{select-model-BEsDOV7S.js → select-model-DflkFrTV.js} +1 -1
- package/dist/client/assets/seo-editor-CaMUQOw8.js +1 -0
- package/dist/client/assets/{settings-layout-CP6mrAe7.js → settings-layout-B_-ExZeb.js} +1 -1
- package/dist/client/assets/{settings-section-Cd3zmde3.js → settings-section-URYHyOYi.js} +1 -1
- package/dist/client/assets/{sheet-S1l6W00L.js → sheet-BGhHsN5F.js} +1 -1
- package/dist/client/assets/{shell-controls-CgJrLQ34.js → shell-controls-6cosW1pP.js} +1 -1
- package/dist/client/assets/shell-layout-DdBCXSg-.js +1 -0
- package/dist/client/assets/{sidebar-DKxDx7lC.js → sidebar-BAsFQ-MT.js} +1 -1
- package/dist/client/assets/{skeleton-wLHgTqVy.js → skeleton-BUBk-3xi.js} +1 -1
- package/dist/client/assets/sso-D_2b6Fc8.js +1 -0
- package/dist/client/assets/store-ievF1htD.js +1 -0
- package/dist/client/assets/store-registry-B3gzmTlr.js +2 -0
- package/dist/client/assets/{studio-tools-DkATXRgK.js → studio-tools-DgAshZ-_.js} +1 -1
- package/dist/client/assets/{switch-C4FKiTgP.js → switch-BonZrdli.js} +1 -1
- package/dist/client/assets/{table-BV3Hd7cI.js → table-DEH4uiQe.js} +1 -1
- package/dist/client/assets/{tabs-B9iGaa-Z.js → tabs-CRj6AkcW.js} +1 -1
- package/dist/client/assets/task-row-ChWV-nAj.js +1 -0
- package/dist/client/assets/task-status-Dh1x9gPU.js +1 -0
- package/dist/client/assets/{textarea-CiUwXw-w.js → textarea-BNlJNx-b.js} +1 -1
- package/dist/client/assets/{toggle-group-CN_l4byE.js → toggle-group-QkV1Q0_i.js} +1 -1
- package/dist/client/assets/{toolbar-ekp7NSbq.js → toolbar-CCAeF5A-.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-CBlJ6I0o.js → toolbar-icon-button-D7VY-9VN.js} +1 -1
- package/dist/client/assets/{tools-list-D_VeN0IP.js → tools-list-M23BH1hq.js} +1 -1
- package/dist/client/assets/{tooltip-CKk6MyBG.js → tooltip-FlCInimM.js} +1 -1
- package/dist/client/assets/{types-CeLnpp7L.js → types-kWY4145T.js} +1 -1
- package/dist/client/assets/{use-ai-providers-DhQCSBc1.js → use-ai-providers-Bc5pT284.js} +1 -1
- package/dist/client/assets/use-automations-CF2YS293.js +1 -0
- package/dist/client/assets/{use-capability-HK8_0h49.js → use-capability-BY1ZsP4P.js} +1 -1
- package/dist/client/assets/use-clock-tick-DiVstnVw.js +1 -0
- package/dist/client/assets/{use-collections-CdbL-rX2.js → use-collections-BwIgjkkY.js} +1 -1
- package/dist/client/assets/use-connection-BuLrAfYP.js +1 -0
- package/dist/client/assets/{use-copy-Ba_RrSds.js → use-copy-ue2G1-hn.js} +1 -1
- package/dist/client/assets/use-create-virtual-mcp-CwTiuOpk.js +1 -0
- package/dist/client/assets/{use-debounced-autosave-B6gDjRvo.js → use-debounced-autosave-DPoL6EyR.js} +1 -1
- package/dist/client/assets/{use-debounced-value-CyOmB5fJ.js → use-debounced-value-BaMggBf4.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-DwY1rJO2.js → use-decopilot-events-CqBKeCC-.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CPWy2xmw.js → use-delete-connection-Dz7PGuLT.js} +1 -1
- package/dist/client/assets/{use-file-configs-SlXV4SMn.js → use-file-configs-DG9Mhiyd.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-DHUYU_kG.js → use-infinite-scroll-3Uj2RNwo.js} +1 -1
- package/dist/client/assets/{use-join-requests-f9qAAjhC.js → use-join-requests-S43CfCdf.js} +1 -1
- package/dist/client/assets/use-mcp-client-CnRSGieI.js +10 -0
- package/dist/client/assets/{use-mcp-prompts-UzvitU_e.js → use-mcp-prompts-BHkYncis.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-zFZxfr6-.js → use-mcp-tools-CDyeZmTp.js} +1 -1
- package/dist/client/assets/{use-members-DTTAqnQj.js → use-members-DSSi_h3c.js} +1 -1
- package/dist/client/assets/{use-mobile-71FrMeIQ.js → use-mobile-FUxUqTQv.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-DIwK9fdW.js → use-navigate-to-agent-DqOg0uVZ.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CfqWFlO5.js → use-org-auth-client-DOD7ccpR.js} +1 -1
- package/dist/client/assets/{use-org-sso-DnPy8IJo.js → use-org-sso-DU73DmAG.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DLiC1YgM.js → use-organization-roles-Dcz2MjMd.js} +1 -1
- package/dist/client/assets/use-organization-settings-C8EmnI93.js +1 -0
- package/dist/client/assets/use-registry-connections-Ctaa0JQV.js +1 -0
- package/dist/client/assets/{use-secrets-CJb3Q-KQ.js → use-secrets-B5E8bF7h.js} +1 -1
- package/dist/client/assets/{use-status-sounds-C23loojF.js → use-status-sounds-BH3nLka8.js} +1 -1
- package/dist/client/assets/{use-view-mode-DtQqfjJM.js → use-view-mode-DHvPeuX3.js} +1 -1
- package/dist/client/assets/use-virtual-mcp-iU8WqU_q.js +1 -0
- package/dist/client/assets/useInfiniteQuery-MSYpmccr.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-Wt188HkA.js +1 -0
- package/dist/client/assets/{useSuspenseQueries-f54Kg_lq.js → useSuspenseQueries-Cy-j8ofE.js} +1 -1
- package/dist/client/assets/variant-calendar-BWM8PQLC.js +1 -0
- package/dist/client/assets/{view-mode-toggle-xMIlyXz_.js → view-mode-toggle-td--5Ihh.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +521 -507
- package/dist/server/migrate.js +83 -83
- package/dist/server/server.js +314 -314
- package/package.json +1 -1
- package/dist/client/assets/ChevronUp-BgfgTfJo.js +0 -1
- package/dist/client/assets/DotsVertical-wFUaTKIr.js +0 -1
- package/dist/client/assets/Eye-BPtPfNj_.js +0 -1
- package/dist/client/assets/SwitchHorizontal01-DKfBMAMt.js +0 -1
- package/dist/client/assets/agent-capabilities-Bxs0ILD3.js +0 -1
- package/dist/client/assets/agent-icon-Bw-pYaqu.js +0 -1
- package/dist/client/assets/agents-list-BaYiXH15.js +0 -1
- package/dist/client/assets/ai-providers-C4e06NrJ.js +0 -1
- package/dist/client/assets/app-editor-DtV9KQKR.js +0 -1
- package/dist/client/assets/automation-runs-D52rO4m5.js +0 -1
- package/dist/client/assets/automations-Cc50qZvh.js +0 -1
- package/dist/client/assets/buckets--3cPd2W_.js +0 -1
- package/dist/client/assets/bulk-category-panel-DsOXc5WN.js +0 -1
- package/dist/client/assets/category-editor-EHZdd7WQ.js +0 -1
- package/dist/client/assets/checkbox-B0iPK-Vx.js +0 -1
- package/dist/client/assets/collection-detail-pr_0VNQT.js +0 -1
- package/dist/client/assets/collection-display-button-BdyEgFyg.js +0 -1
- package/dist/client/assets/commerce-onboarding-CHMkWtbP.js +0 -1
- package/dist/client/assets/connect-desktop-dialog-DU7oJbU_.js +0 -1
- package/dist/client/assets/connection-card-CIIT6a-B.js +0 -1
- package/dist/client/assets/connection-detail-DW7R20rk.js +0 -1
- package/dist/client/assets/connections-BXo316Yj.js +0 -1
- package/dist/client/assets/dropdown-menu-DBdT-R6w.js +0 -1
- package/dist/client/assets/extract-connection-data-DB2mp1s-.js +0 -1
- package/dist/client/assets/file-explorer-CCDyOatC.js +0 -2
- package/dist/client/assets/general-Cppvys0u.js +0 -1
- package/dist/client/assets/github-repo-picker-D7QB7NBL.js +0 -1
- package/dist/client/assets/index-B1I1Oi0g.css +0 -1
- package/dist/client/assets/index-BASamdWA.js +0 -1
- package/dist/client/assets/index-CgS6ZFaA.js +0 -1
- package/dist/client/assets/members-BJuT40Uf.js +0 -1
- package/dist/client/assets/page-seo-sheet-rEaKbGL4.js +0 -1
- package/dist/client/assets/post-editor-DNSrY2g5.js +0 -1
- package/dist/client/assets/profile-BJUc-WPJ.js +0 -1
- package/dist/client/assets/project-app-view-vdCIDY4V.js +0 -1
- package/dist/client/assets/record-editor-ChG8xfNH.js +0 -1
- package/dist/client/assets/registry-BDvYq0sF.js +0 -2
- package/dist/client/assets/roles-BVmBg8nQ.js +0 -1
- package/dist/client/assets/secrets-okf3dR05.js +0 -1
- package/dist/client/assets/select-CYLZmEqL.js +0 -1
- package/dist/client/assets/seo-editor-lx2p6Zbz.js +0 -1
- package/dist/client/assets/shell-layout-D3aCzUD1.js +0 -1
- package/dist/client/assets/sso-CsR0QPxD.js +0 -1
- package/dist/client/assets/store-Dmf6IFoE.js +0 -1
- package/dist/client/assets/store-registry-Ci8hLaqa.js +0 -2
- package/dist/client/assets/task-row-Dq6a6p3f.js +0 -1
- package/dist/client/assets/task-status-vCNfacyn.js +0 -1
- package/dist/client/assets/use-automations-DH-tTWJO.js +0 -1
- package/dist/client/assets/use-clock-tick-7xgXM9p8.js +0 -1
- package/dist/client/assets/use-connection-BoEeMU65.js +0 -1
- package/dist/client/assets/use-create-virtual-mcp-DCJ_9oKR.js +0 -1
- package/dist/client/assets/use-mcp-client-PdP6F3TE.js +0 -10
- package/dist/client/assets/use-organization-settings-BZHnFHzb.js +0 -1
- package/dist/client/assets/use-registry-connections-BItKY-Xq.js +0 -1
- package/dist/client/assets/use-virtual-mcp-D3Xj1Zyr.js +0 -1
- package/dist/client/assets/useInfiniteQuery-CdROm-U7.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DtKEQU_S.js +0 -1
- package/dist/client/assets/variant-calendar-BSvOsjHM.js +0 -1
package/dist/server/migrate.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null,e)}var i=(t,e)=>{for(var n in e)Mi(t,n,{get:e[n],enumerable:!0,configurable:!0,set:Oi.bind(e,n)})};import{Migrator as Fi,sql as F}from"kysely";var ct={};i(ct,{up:()=>Zi,down:()=>Hi});import{sql as h}from"kysely";async function Zi(t){await t.schema.createTable("connections").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organizationId","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("createdById","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("name","text",(e)=>e.notNull()).addColumn("description","text").addColumn("icon","text").addColumn("appName","text").addColumn("appId","text").addColumn("connectionType","text",(e)=>e.notNull()).addColumn("connectionUrl","text",(e)=>e.notNull()).addColumn("connectionToken","text").addColumn("connectionHeaders","text").addColumn("oauthConfig","text").addColumn("metadata","text").addColumn("tools","text").addColumn("bindings","text").addColumn("status","text",(e)=>e.notNull().defaultTo("active")).addColumn("createdAt","text",(e)=>e.notNull().defaultTo(h`CURRENT_TIMESTAMP`)).addColumn("updatedAt","text",(e)=>e.notNull().defaultTo(h`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("api_keys").addColumn("id","text",(e)=>e.primaryKey()).addColumn("userId","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("name","text",(e)=>e.notNull()).addColumn("hashedKey","text",(e)=>e.notNull().unique()).addColumn("permissions","text",(e)=>e.notNull()).addColumn("expiresAt","text").addColumn("remaining","integer").addColumn("metadata","text").addColumn("createdAt","text",(e)=>e.notNull().defaultTo(h`CURRENT_TIMESTAMP`)).addColumn("updatedAt","text",(e)=>e.notNull().defaultTo(h`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("audit_logs").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organizationId","text").addColumn("userId","text",(e)=>e.references("user.id").onDelete("set null")).addColumn("connectionId","text",(e)=>e.references("connections.id").onDelete("set null")).addColumn("toolName","text",(e)=>e.notNull()).addColumn("allowed","integer",(e)=>e.notNull()).addColumn("duration","integer").addColumn("timestamp","text",(e)=>e.notNull().defaultTo(h`CURRENT_TIMESTAMP`)).addColumn("requestMetadata","text").execute(),await t.schema.createTable("oauth_clients").addColumn("id","text",(e)=>e.primaryKey()).addColumn("clientId","text",(e)=>e.notNull().unique()).addColumn("clientSecret","text").addColumn("clientName","text",(e)=>e.notNull()).addColumn("redirectUris","text",(e)=>e.notNull()).addColumn("grantTypes","text",(e)=>e.notNull()).addColumn("scope","text").addColumn("clientUri","text").addColumn("logoUri","text").addColumn("createdAt","text",(e)=>e.notNull().defaultTo(h`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("oauth_authorization_codes").addColumn("code","text",(e)=>e.primaryKey()).addColumn("clientId","text",(e)=>e.notNull().references("oauth_clients.clientId").onDelete("cascade")).addColumn("userId","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("redirectUri","text",(e)=>e.notNull()).addColumn("scope","text").addColumn("codeChallenge","text").addColumn("codeChallengeMethod","text").addColumn("expiresAt","text",(e)=>e.notNull()).addColumn("createdAt","text",(e)=>e.notNull().defaultTo(h`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("oauth_refresh_tokens").addColumn("token","text",(e)=>e.primaryKey()).addColumn("clientId","text",(e)=>e.notNull().references("oauth_clients.clientId").onDelete("cascade")).addColumn("userId","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("scope","text").addColumn("expiresAt","text").addColumn("createdAt","text",(e)=>e.notNull().defaultTo(h`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("downstream_tokens").addColumn("id","text",(e)=>e.primaryKey()).addColumn("connectionId","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("userId","text",(e)=>e.references("user.id").onDelete("cascade")).addColumn("accessToken","text",(e)=>e.notNull()).addColumn("refreshToken","text").addColumn("scope","text").addColumn("expiresAt","text").addColumn("createdAt","text",(e)=>e.notNull().defaultTo(h`CURRENT_TIMESTAMP`)).addColumn("updatedAt","text",(e)=>e.notNull().defaultTo(h`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_connections_organizationId").on("connections").column("organizationId").execute(),await t.schema.createIndex("idx_audit_logs_organizationId").on("audit_logs").column("organizationId").execute(),await t.schema.createIndex("idx_audit_logs_userId").on("audit_logs").column("userId").execute(),await t.schema.createIndex("idx_audit_logs_timestamp").on("audit_logs").column("timestamp").execute()}async function Hi(t){await t.schema.dropTable("downstream_tokens").execute(),await t.schema.dropTable("oauth_refresh_tokens").execute(),await t.schema.dropTable("oauth_authorization_codes").execute(),await t.schema.dropTable("oauth_clients").execute(),await t.schema.dropTable("audit_logs").execute(),await t.schema.dropTable("api_keys").execute(),await t.schema.dropTable("connections").execute()}var yt={};i(yt,{up:()=>Yi,down:()=>Ii});import{sql as vn}from"kysely";async function Yi(t){await t.schema.createTable("organization_settings").addColumn("organizationId","text",(e)=>e.primaryKey().references("organization.id").onDelete("cascade")).addColumn("modelsBindingConnectionId","text",(e)=>e.references("connections.id").onDelete("set null")).addColumn("createdAt","text",(e)=>e.notNull().defaultTo(vn`CURRENT_TIMESTAMP`)).addColumn("updatedAt","text",(e)=>e.notNull().defaultTo(vn`CURRENT_TIMESTAMP`)).execute()}async function Ii(t){await t.schema.dropTable("organization_settings").execute()}var st={};i(st,{up:()=>Bi,down:()=>Gi});async function Bi(t){await t.schema.alterTable("connections").renameColumn("name","title").execute(),await t.schema.alterTable("connections").renameColumn("createdById","created_by").execute(),await t.schema.alterTable("connections").renameColumn("createdAt","created_at").execute(),await t.schema.alterTable("connections").renameColumn("updatedAt","updated_at").execute(),await t.schema.alterTable("connections").renameColumn("organizationId","organization_id").execute(),await t.schema.alterTable("connections").renameColumn("connectionType","connection_type").execute(),await t.schema.alterTable("connections").renameColumn("connectionUrl","connection_url").execute(),await t.schema.alterTable("connections").renameColumn("connectionToken","connection_token").execute(),await t.schema.alterTable("connections").renameColumn("connectionHeaders","connection_headers").execute(),await t.schema.alterTable("connections").renameColumn("oauthConfig","oauth_config").execute(),await t.schema.alterTable("connections").renameColumn("appName","app_name").execute(),await t.schema.alterTable("connections").renameColumn("appId","app_id").execute()}async function Gi(t){await t.schema.alterTable("connections").renameColumn("title","name").execute(),await t.schema.alterTable("connections").renameColumn("created_by","createdById").execute(),await t.schema.alterTable("connections").renameColumn("created_at","createdAt").execute(),await t.schema.alterTable("connections").renameColumn("updated_at","updatedAt").execute(),await t.schema.alterTable("connections").renameColumn("organization_id","organizationId").execute(),await t.schema.alterTable("connections").renameColumn("connection_type","connectionType").execute(),await t.schema.alterTable("connections").renameColumn("connection_url","connectionUrl").execute(),await t.schema.alterTable("connections").renameColumn("connection_token","connectionToken").execute(),await t.schema.alterTable("connections").renameColumn("connection_headers","connectionHeaders").execute(),await t.schema.alterTable("connections").renameColumn("oauth_config","oauthConfig").execute(),await t.schema.alterTable("connections").renameColumn("app_name","appName").execute(),await t.schema.alterTable("connections").renameColumn("app_id","appId").execute()}var ft={};i(ft,{up:()=>vi,down:()=>Vi});async function vi(t){await t.schema.createTable("organization_settings_new").addColumn("organizationId","text",(e)=>e.primaryKey().references("organization.id").onDelete("cascade")).addColumn("createdAt","text",(e)=>e.notNull()).addColumn("updatedAt","text",(e)=>e.notNull()).execute(),await t.insertInto("organization_settings_new").columns(["organizationId","createdAt","updatedAt"]).expression((e)=>e.selectFrom("organization_settings").select(["organizationId","createdAt","updatedAt"])).execute(),await t.schema.dropTable("organization_settings").execute(),await t.schema.alterTable("organization_settings_new").renameTo("organization_settings").execute()}async function Vi(t){await t.schema.createTable("organization_settings_new").addColumn("organizationId","text",(e)=>e.primaryKey().references("organization.id").onDelete("cascade")).addColumn("modelsBindingConnectionId","text",(e)=>e.references("connections.id").onDelete("set null")).addColumn("createdAt","text",(e)=>e.notNull()).addColumn("updatedAt","text",(e)=>e.notNull()).execute(),await t.insertInto("organization_settings_new").columns(["organizationId","modelsBindingConnectionId","createdAt","updatedAt"]).expression((e)=>e.selectFrom("organization_settings").select(["organizationId",e.val(null).as("modelsBindingConnectionId"),"createdAt","updatedAt"])).execute(),await t.schema.dropTable("organization_settings").execute(),await t.schema.alterTable("organization_settings_new").renameTo("organization_settings").execute()}var Tt={};i(Tt,{up:()=>qi,down:()=>li});async function qi(t){await t.schema.alterTable("connections").addColumn("configuration_state","text").execute(),await t.schema.alterTable("connections").addColumn("configuration_scopes","text").execute()}async function li(t){await t.schema.alterTable("connections").dropColumn("configuration_state").execute(),await t.schema.alterTable("connections").dropColumn("configuration_scopes").execute()}var pt={};i(pt,{up:()=>bi,down:()=>ta});import{sql as di}from"kysely";async function bi(t){await t.schema.alterTable("organization_settings").addColumn("sidebar_items",di`text`).execute()}async function ta(t){await t.schema.alterTable("organization_settings").dropColumn("sidebar_items").execute()}var wt={};i(wt,{up:()=>ea,down:()=>na});async function ea(t){await t.schema.createTable("monitoring_logs").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("connection_title","text",(e)=>e.notNull()).addColumn("tool_name","text",(e)=>e.notNull()).addColumn("input","text",(e)=>e.notNull()).addColumn("output","text",(e)=>e.notNull()).addColumn("is_error","integer",(e)=>e.notNull()).addColumn("error_message","text").addColumn("duration_ms","integer",(e)=>e.notNull()).addColumn("timestamp","text",(e)=>e.notNull()).addColumn("user_id","text").addColumn("request_id","text",(e)=>e.notNull()).execute(),await t.schema.createIndex("monitoring_logs_org_timestamp").on("monitoring_logs").columns(["organization_id","timestamp"]).execute(),await t.schema.createIndex("monitoring_logs_connection_timestamp").on("monitoring_logs").columns(["connection_id","timestamp"]).execute(),await t.schema.createIndex("monitoring_logs_is_error").on("monitoring_logs").columns(["organization_id","is_error","timestamp"]).execute()}async function na(t){await t.schema.dropIndex("monitoring_logs_is_error").execute(),await t.schema.dropIndex("monitoring_logs_connection_timestamp").execute(),await t.schema.dropIndex("monitoring_logs_org_timestamp").execute(),await t.schema.dropTable("monitoring_logs").execute()}var Ct={};i(Ct,{up:()=>ia,down:()=>aa});import{sql as S}from"kysely";async function ia(t){await t.schema.createTable("events").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("type","text",(e)=>e.notNull()).addColumn("source","text",(e)=>e.notNull()).addColumn("specversion","text",(e)=>e.notNull().defaultTo("1.0")).addColumn("subject","text").addColumn("time","text",(e)=>e.notNull()).addColumn("datacontenttype","text",(e)=>e.notNull().defaultTo("application/json")).addColumn("dataschema","text").addColumn("data","text").addColumn("cron","varchar(255)").addColumn("status","text",(e)=>e.notNull().defaultTo("pending")).addColumn("attempts","integer",(e)=>e.notNull().defaultTo(0)).addColumn("last_error","text").addColumn("next_retry_at","text").addColumn("created_at","text",(e)=>e.notNull().defaultTo(S`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(S`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("event_subscriptions").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("publisher","text").addColumn("event_type","text",(e)=>e.notNull()).addColumn("filter","text").addColumn("enabled","integer",(e)=>e.notNull().defaultTo(1)).addColumn("created_at","text",(e)=>e.notNull().defaultTo(S`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(S`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("event_deliveries").addColumn("id","text",(e)=>e.primaryKey()).addColumn("event_id","text",(e)=>e.notNull()).addColumn("subscription_id","text",(e)=>e.notNull().references("event_subscriptions.id").onDelete("cascade")).addColumn("status","text",(e)=>e.notNull().defaultTo("pending")).addColumn("attempts","integer",(e)=>e.notNull().defaultTo(0)).addColumn("last_error","text").addColumn("delivered_at","text").addColumn("next_retry_at","text").addColumn("created_at","text",(e)=>e.notNull().defaultTo(S`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_events_org_status").on("events").columns(["organization_id","status"]).execute(),await t.schema.createIndex("idx_events_source").on("events").columns(["source"]).execute(),await t.schema.createIndex("idx_events_type").on("events").columns(["type"]).execute(),await t.schema.createIndex("idx_events_retry").on("events").columns(["status","next_retry_at"]).execute(),await t.schema.createIndex("idx_subscriptions_connection").on("event_subscriptions").columns(["connection_id"]).execute(),await t.schema.createIndex("idx_subscriptions_type").on("event_subscriptions").columns(["event_type"]).execute(),await t.schema.createIndex("idx_subscriptions_org_enabled").on("event_subscriptions").columns(["organization_id","enabled"]).execute(),await t.schema.createIndex("idx_subscriptions_unique").on("event_subscriptions").columns(["connection_id","event_type","publisher","filter"]).unique().execute(),await t.schema.createIndex("idx_deliveries_event").on("event_deliveries").columns(["event_id"]).execute(),await t.schema.createIndex("idx_deliveries_subscription_status").on("event_deliveries").columns(["subscription_id","status"]).execute(),await t.schema.createIndex("idx_deliveries_retry").on("event_deliveries").columns(["status","next_retry_at"]).execute()}async function aa(t){await t.schema.dropIndex("idx_deliveries_retry").execute(),await t.schema.dropIndex("idx_deliveries_subscription_status").execute(),await t.schema.dropIndex("idx_deliveries_event").execute(),await t.schema.dropIndex("idx_subscriptions_unique").execute(),await t.schema.dropIndex("idx_subscriptions_org_enabled").execute(),await t.schema.dropIndex("idx_subscriptions_type").execute(),await t.schema.dropIndex("idx_subscriptions_connection").execute(),await t.schema.dropIndex("idx_events_retry").execute(),await t.schema.dropIndex("idx_events_type").execute(),await t.schema.dropIndex("idx_events_source").execute(),await t.schema.dropIndex("idx_events_org_status").execute(),await t.schema.dropTable("event_deliveries").execute(),await t.schema.dropTable("event_subscriptions").execute(),await t.schema.dropTable("events").execute()}var Nt={};i(Nt,{up:()=>oa,down:()=>_a});import{sql as ua}from"kysely";async function oa(t){await t.schema.dropTable("audit_logs").ifExists().execute()}async function _a(t){await t.schema.createTable("audit_logs").ifNotExists().addColumn("id","text",(e)=>e.primaryKey()).addColumn("organizationId","text").addColumn("userId","text",(e)=>e.references("user.id").onDelete("set null")).addColumn("connectionId","text",(e)=>e.references("connections.id").onDelete("set null")).addColumn("toolName","text",(e)=>e.notNull()).addColumn("allowed","integer",(e)=>e.notNull()).addColumn("duration","integer").addColumn("timestamp","text",(e)=>e.notNull().defaultTo(ua`CURRENT_TIMESTAMP`)).addColumn("requestMetadata","text").execute(),await t.schema.createIndex("idx_audit_logs_organizationId").on("audit_logs").column("organizationId").execute(),await t.schema.createIndex("idx_audit_logs_userId").on("audit_logs").column("userId").execute(),await t.schema.createIndex("idx_audit_logs_timestamp").on("audit_logs").column("timestamp").execute()}var ht={};i(ht,{up:()=>ma,down:()=>xa});import{sql as v}from"kysely";async function ma(t){await t.schema.createTable("gateways").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(e)=>e.notNull()).addColumn("description","text").addColumn("tool_selection_strategy","text").addColumn("status","text",(e)=>e.notNull().defaultTo("active")).addColumn("is_default","integer",(e)=>e.notNull().defaultTo(0)).addColumn("created_at","text",(e)=>e.notNull().defaultTo(v`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(v`CURRENT_TIMESTAMP`)).addColumn("created_by","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("updated_by","text").execute(),await t.schema.createTable("gateway_connections").addColumn("id","text",(e)=>e.primaryKey()).addColumn("gateway_id","text",(e)=>e.notNull().references("gateways.id").onDelete("cascade")).addColumn("connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("selected_tools","text").addColumn("created_at","text",(e)=>e.notNull().defaultTo(v`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_gateways_org").on("gateways").columns(["organization_id"]).execute(),await t.schema.createIndex("idx_gateways_org_status").on("gateways").columns(["organization_id","status"]).execute(),await v`CREATE UNIQUE INDEX idx_gateways_default_per_org ON gateways (organization_id) WHERE is_default = 1`.execute(t),await t.schema.createIndex("idx_gateway_connections_gateway").on("gateway_connections").columns(["gateway_id"]).execute(),await t.schema.createIndex("idx_gateway_connections_connection").on("gateway_connections").columns(["connection_id"]).execute(),await t.schema.createIndex("idx_gateway_connections_unique").on("gateway_connections").columns(["gateway_id","connection_id"]).unique().execute()}async function xa(t){await t.schema.dropIndex("idx_gateway_connections_unique").execute(),await t.schema.dropIndex("idx_gateway_connections_connection").execute(),await t.schema.dropIndex("idx_gateway_connections_gateway").execute(),await t.schema.dropIndex("idx_gateways_default_per_org").execute(),await t.schema.dropIndex("idx_gateways_org_status").execute(),await t.schema.dropIndex("idx_gateways_org").execute(),await t.schema.dropTable("gateway_connections").execute(),await t.schema.dropTable("gateways").execute()}var Et={};i(Et,{up:()=>ra,down:()=>ca});async function ra(t){await t.schema.alterTable("gateways").addColumn("icon","text").execute()}async function ca(t){await t.schema.alterTable("gateways").dropColumn("icon").execute()}var Kt={};i(Kt,{up:()=>ya,down:()=>sa});import{sql as V}from"kysely";async function ya(t){await t.schema.alterTable("gateways").addColumn("tool_selection_mode","text",(e)=>e.notNull().defaultTo("inclusion")).execute(),await V`
|
|
2
|
+
var Oi=Object.defineProperty;var Zi=(t)=>t;function Hi(t,e){this[t]=Zi.bind(null,e)}var i=(t,e)=>{for(var n in e)Oi(t,n,{get:e[n],enumerable:!0,configurable:!0,set:Hi.bind(e,n)})};import{Migrator as Mi,sql as S}from"kysely";var yt={};i(yt,{up:()=>Yi,down:()=>Bi});import{sql as E}from"kysely";async function Yi(t){await t.schema.createTable("connections").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organizationId","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("createdById","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("name","text",(e)=>e.notNull()).addColumn("description","text").addColumn("icon","text").addColumn("appName","text").addColumn("appId","text").addColumn("connectionType","text",(e)=>e.notNull()).addColumn("connectionUrl","text",(e)=>e.notNull()).addColumn("connectionToken","text").addColumn("connectionHeaders","text").addColumn("oauthConfig","text").addColumn("metadata","text").addColumn("tools","text").addColumn("bindings","text").addColumn("status","text",(e)=>e.notNull().defaultTo("active")).addColumn("createdAt","text",(e)=>e.notNull().defaultTo(E`CURRENT_TIMESTAMP`)).addColumn("updatedAt","text",(e)=>e.notNull().defaultTo(E`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("api_keys").addColumn("id","text",(e)=>e.primaryKey()).addColumn("userId","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("name","text",(e)=>e.notNull()).addColumn("hashedKey","text",(e)=>e.notNull().unique()).addColumn("permissions","text",(e)=>e.notNull()).addColumn("expiresAt","text").addColumn("remaining","integer").addColumn("metadata","text").addColumn("createdAt","text",(e)=>e.notNull().defaultTo(E`CURRENT_TIMESTAMP`)).addColumn("updatedAt","text",(e)=>e.notNull().defaultTo(E`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("audit_logs").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organizationId","text").addColumn("userId","text",(e)=>e.references("user.id").onDelete("set null")).addColumn("connectionId","text",(e)=>e.references("connections.id").onDelete("set null")).addColumn("toolName","text",(e)=>e.notNull()).addColumn("allowed","integer",(e)=>e.notNull()).addColumn("duration","integer").addColumn("timestamp","text",(e)=>e.notNull().defaultTo(E`CURRENT_TIMESTAMP`)).addColumn("requestMetadata","text").execute(),await t.schema.createTable("oauth_clients").addColumn("id","text",(e)=>e.primaryKey()).addColumn("clientId","text",(e)=>e.notNull().unique()).addColumn("clientSecret","text").addColumn("clientName","text",(e)=>e.notNull()).addColumn("redirectUris","text",(e)=>e.notNull()).addColumn("grantTypes","text",(e)=>e.notNull()).addColumn("scope","text").addColumn("clientUri","text").addColumn("logoUri","text").addColumn("createdAt","text",(e)=>e.notNull().defaultTo(E`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("oauth_authorization_codes").addColumn("code","text",(e)=>e.primaryKey()).addColumn("clientId","text",(e)=>e.notNull().references("oauth_clients.clientId").onDelete("cascade")).addColumn("userId","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("redirectUri","text",(e)=>e.notNull()).addColumn("scope","text").addColumn("codeChallenge","text").addColumn("codeChallengeMethod","text").addColumn("expiresAt","text",(e)=>e.notNull()).addColumn("createdAt","text",(e)=>e.notNull().defaultTo(E`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("oauth_refresh_tokens").addColumn("token","text",(e)=>e.primaryKey()).addColumn("clientId","text",(e)=>e.notNull().references("oauth_clients.clientId").onDelete("cascade")).addColumn("userId","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("scope","text").addColumn("expiresAt","text").addColumn("createdAt","text",(e)=>e.notNull().defaultTo(E`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("downstream_tokens").addColumn("id","text",(e)=>e.primaryKey()).addColumn("connectionId","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("userId","text",(e)=>e.references("user.id").onDelete("cascade")).addColumn("accessToken","text",(e)=>e.notNull()).addColumn("refreshToken","text").addColumn("scope","text").addColumn("expiresAt","text").addColumn("createdAt","text",(e)=>e.notNull().defaultTo(E`CURRENT_TIMESTAMP`)).addColumn("updatedAt","text",(e)=>e.notNull().defaultTo(E`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_connections_organizationId").on("connections").column("organizationId").execute(),await t.schema.createIndex("idx_audit_logs_organizationId").on("audit_logs").column("organizationId").execute(),await t.schema.createIndex("idx_audit_logs_userId").on("audit_logs").column("userId").execute(),await t.schema.createIndex("idx_audit_logs_timestamp").on("audit_logs").column("timestamp").execute()}async function Bi(t){await t.schema.dropTable("downstream_tokens").execute(),await t.schema.dropTable("oauth_refresh_tokens").execute(),await t.schema.dropTable("oauth_authorization_codes").execute(),await t.schema.dropTable("oauth_clients").execute(),await t.schema.dropTable("audit_logs").execute(),await t.schema.dropTable("api_keys").execute(),await t.schema.dropTable("connections").execute()}var ct={};i(ct,{up:()=>Ii,down:()=>Gi});import{sql as qn}from"kysely";async function Ii(t){await t.schema.createTable("organization_settings").addColumn("organizationId","text",(e)=>e.primaryKey().references("organization.id").onDelete("cascade")).addColumn("modelsBindingConnectionId","text",(e)=>e.references("connections.id").onDelete("set null")).addColumn("createdAt","text",(e)=>e.notNull().defaultTo(qn`CURRENT_TIMESTAMP`)).addColumn("updatedAt","text",(e)=>e.notNull().defaultTo(qn`CURRENT_TIMESTAMP`)).execute()}async function Gi(t){await t.schema.dropTable("organization_settings").execute()}var ft={};i(ft,{up:()=>vi,down:()=>Vi});async function vi(t){await t.schema.alterTable("connections").renameColumn("name","title").execute(),await t.schema.alterTable("connections").renameColumn("createdById","created_by").execute(),await t.schema.alterTable("connections").renameColumn("createdAt","created_at").execute(),await t.schema.alterTable("connections").renameColumn("updatedAt","updated_at").execute(),await t.schema.alterTable("connections").renameColumn("organizationId","organization_id").execute(),await t.schema.alterTable("connections").renameColumn("connectionType","connection_type").execute(),await t.schema.alterTable("connections").renameColumn("connectionUrl","connection_url").execute(),await t.schema.alterTable("connections").renameColumn("connectionToken","connection_token").execute(),await t.schema.alterTable("connections").renameColumn("connectionHeaders","connection_headers").execute(),await t.schema.alterTable("connections").renameColumn("oauthConfig","oauth_config").execute(),await t.schema.alterTable("connections").renameColumn("appName","app_name").execute(),await t.schema.alterTable("connections").renameColumn("appId","app_id").execute()}async function Vi(t){await t.schema.alterTable("connections").renameColumn("title","name").execute(),await t.schema.alterTable("connections").renameColumn("created_by","createdById").execute(),await t.schema.alterTable("connections").renameColumn("created_at","createdAt").execute(),await t.schema.alterTable("connections").renameColumn("updated_at","updatedAt").execute(),await t.schema.alterTable("connections").renameColumn("organization_id","organizationId").execute(),await t.schema.alterTable("connections").renameColumn("connection_type","connectionType").execute(),await t.schema.alterTable("connections").renameColumn("connection_url","connectionUrl").execute(),await t.schema.alterTable("connections").renameColumn("connection_token","connectionToken").execute(),await t.schema.alterTable("connections").renameColumn("connection_headers","connectionHeaders").execute(),await t.schema.alterTable("connections").renameColumn("oauth_config","oauthConfig").execute(),await t.schema.alterTable("connections").renameColumn("app_name","appName").execute(),await t.schema.alterTable("connections").renameColumn("app_id","appId").execute()}var Tt={};i(Tt,{up:()=>qi,down:()=>li});async function qi(t){await t.schema.createTable("organization_settings_new").addColumn("organizationId","text",(e)=>e.primaryKey().references("organization.id").onDelete("cascade")).addColumn("createdAt","text",(e)=>e.notNull()).addColumn("updatedAt","text",(e)=>e.notNull()).execute(),await t.insertInto("organization_settings_new").columns(["organizationId","createdAt","updatedAt"]).expression((e)=>e.selectFrom("organization_settings").select(["organizationId","createdAt","updatedAt"])).execute(),await t.schema.dropTable("organization_settings").execute(),await t.schema.alterTable("organization_settings_new").renameTo("organization_settings").execute()}async function li(t){await t.schema.createTable("organization_settings_new").addColumn("organizationId","text",(e)=>e.primaryKey().references("organization.id").onDelete("cascade")).addColumn("modelsBindingConnectionId","text",(e)=>e.references("connections.id").onDelete("set null")).addColumn("createdAt","text",(e)=>e.notNull()).addColumn("updatedAt","text",(e)=>e.notNull()).execute(),await t.insertInto("organization_settings_new").columns(["organizationId","modelsBindingConnectionId","createdAt","updatedAt"]).expression((e)=>e.selectFrom("organization_settings").select(["organizationId",e.val(null).as("modelsBindingConnectionId"),"createdAt","updatedAt"])).execute(),await t.schema.dropTable("organization_settings").execute(),await t.schema.alterTable("organization_settings_new").renameTo("organization_settings").execute()}var pt={};i(pt,{up:()=>di,down:()=>bi});async function di(t){await t.schema.alterTable("connections").addColumn("configuration_state","text").execute(),await t.schema.alterTable("connections").addColumn("configuration_scopes","text").execute()}async function bi(t){await t.schema.alterTable("connections").dropColumn("configuration_state").execute(),await t.schema.alterTable("connections").dropColumn("configuration_scopes").execute()}var st={};i(st,{up:()=>ea,down:()=>na});import{sql as ta}from"kysely";async function ea(t){await t.schema.alterTable("organization_settings").addColumn("sidebar_items",ta`text`).execute()}async function na(t){await t.schema.alterTable("organization_settings").dropColumn("sidebar_items").execute()}var wt={};i(wt,{up:()=>ia,down:()=>aa});async function ia(t){await t.schema.createTable("monitoring_logs").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("connection_title","text",(e)=>e.notNull()).addColumn("tool_name","text",(e)=>e.notNull()).addColumn("input","text",(e)=>e.notNull()).addColumn("output","text",(e)=>e.notNull()).addColumn("is_error","integer",(e)=>e.notNull()).addColumn("error_message","text").addColumn("duration_ms","integer",(e)=>e.notNull()).addColumn("timestamp","text",(e)=>e.notNull()).addColumn("user_id","text").addColumn("request_id","text",(e)=>e.notNull()).execute(),await t.schema.createIndex("monitoring_logs_org_timestamp").on("monitoring_logs").columns(["organization_id","timestamp"]).execute(),await t.schema.createIndex("monitoring_logs_connection_timestamp").on("monitoring_logs").columns(["connection_id","timestamp"]).execute(),await t.schema.createIndex("monitoring_logs_is_error").on("monitoring_logs").columns(["organization_id","is_error","timestamp"]).execute()}async function aa(t){await t.schema.dropIndex("monitoring_logs_is_error").execute(),await t.schema.dropIndex("monitoring_logs_connection_timestamp").execute(),await t.schema.dropIndex("monitoring_logs_org_timestamp").execute(),await t.schema.dropTable("monitoring_logs").execute()}var Ct={};i(Ct,{up:()=>ua,down:()=>oa});import{sql as F}from"kysely";async function ua(t){await t.schema.createTable("events").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("type","text",(e)=>e.notNull()).addColumn("source","text",(e)=>e.notNull()).addColumn("specversion","text",(e)=>e.notNull().defaultTo("1.0")).addColumn("subject","text").addColumn("time","text",(e)=>e.notNull()).addColumn("datacontenttype","text",(e)=>e.notNull().defaultTo("application/json")).addColumn("dataschema","text").addColumn("data","text").addColumn("cron","varchar(255)").addColumn("status","text",(e)=>e.notNull().defaultTo("pending")).addColumn("attempts","integer",(e)=>e.notNull().defaultTo(0)).addColumn("last_error","text").addColumn("next_retry_at","text").addColumn("created_at","text",(e)=>e.notNull().defaultTo(F`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(F`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("event_subscriptions").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("publisher","text").addColumn("event_type","text",(e)=>e.notNull()).addColumn("filter","text").addColumn("enabled","integer",(e)=>e.notNull().defaultTo(1)).addColumn("created_at","text",(e)=>e.notNull().defaultTo(F`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(F`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("event_deliveries").addColumn("id","text",(e)=>e.primaryKey()).addColumn("event_id","text",(e)=>e.notNull()).addColumn("subscription_id","text",(e)=>e.notNull().references("event_subscriptions.id").onDelete("cascade")).addColumn("status","text",(e)=>e.notNull().defaultTo("pending")).addColumn("attempts","integer",(e)=>e.notNull().defaultTo(0)).addColumn("last_error","text").addColumn("delivered_at","text").addColumn("next_retry_at","text").addColumn("created_at","text",(e)=>e.notNull().defaultTo(F`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_events_org_status").on("events").columns(["organization_id","status"]).execute(),await t.schema.createIndex("idx_events_source").on("events").columns(["source"]).execute(),await t.schema.createIndex("idx_events_type").on("events").columns(["type"]).execute(),await t.schema.createIndex("idx_events_retry").on("events").columns(["status","next_retry_at"]).execute(),await t.schema.createIndex("idx_subscriptions_connection").on("event_subscriptions").columns(["connection_id"]).execute(),await t.schema.createIndex("idx_subscriptions_type").on("event_subscriptions").columns(["event_type"]).execute(),await t.schema.createIndex("idx_subscriptions_org_enabled").on("event_subscriptions").columns(["organization_id","enabled"]).execute(),await t.schema.createIndex("idx_subscriptions_unique").on("event_subscriptions").columns(["connection_id","event_type","publisher","filter"]).unique().execute(),await t.schema.createIndex("idx_deliveries_event").on("event_deliveries").columns(["event_id"]).execute(),await t.schema.createIndex("idx_deliveries_subscription_status").on("event_deliveries").columns(["subscription_id","status"]).execute(),await t.schema.createIndex("idx_deliveries_retry").on("event_deliveries").columns(["status","next_retry_at"]).execute()}async function oa(t){await t.schema.dropIndex("idx_deliveries_retry").execute(),await t.schema.dropIndex("idx_deliveries_subscription_status").execute(),await t.schema.dropIndex("idx_deliveries_event").execute(),await t.schema.dropIndex("idx_subscriptions_unique").execute(),await t.schema.dropIndex("idx_subscriptions_org_enabled").execute(),await t.schema.dropIndex("idx_subscriptions_type").execute(),await t.schema.dropIndex("idx_subscriptions_connection").execute(),await t.schema.dropIndex("idx_events_retry").execute(),await t.schema.dropIndex("idx_events_type").execute(),await t.schema.dropIndex("idx_events_source").execute(),await t.schema.dropIndex("idx_events_org_status").execute(),await t.schema.dropTable("event_deliveries").execute(),await t.schema.dropTable("event_subscriptions").execute(),await t.schema.dropTable("events").execute()}var Nt={};i(Nt,{up:()=>ma,down:()=>xa});import{sql as _a}from"kysely";async function ma(t){await t.schema.dropTable("audit_logs").ifExists().execute()}async function xa(t){await t.schema.createTable("audit_logs").ifNotExists().addColumn("id","text",(e)=>e.primaryKey()).addColumn("organizationId","text").addColumn("userId","text",(e)=>e.references("user.id").onDelete("set null")).addColumn("connectionId","text",(e)=>e.references("connections.id").onDelete("set null")).addColumn("toolName","text",(e)=>e.notNull()).addColumn("allowed","integer",(e)=>e.notNull()).addColumn("duration","integer").addColumn("timestamp","text",(e)=>e.notNull().defaultTo(_a`CURRENT_TIMESTAMP`)).addColumn("requestMetadata","text").execute(),await t.schema.createIndex("idx_audit_logs_organizationId").on("audit_logs").column("organizationId").execute(),await t.schema.createIndex("idx_audit_logs_userId").on("audit_logs").column("userId").execute(),await t.schema.createIndex("idx_audit_logs_timestamp").on("audit_logs").column("timestamp").execute()}var Et={};i(Et,{up:()=>ra,down:()=>ya});import{sql as v}from"kysely";async function ra(t){await t.schema.createTable("gateways").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(e)=>e.notNull()).addColumn("description","text").addColumn("tool_selection_strategy","text").addColumn("status","text",(e)=>e.notNull().defaultTo("active")).addColumn("is_default","integer",(e)=>e.notNull().defaultTo(0)).addColumn("created_at","text",(e)=>e.notNull().defaultTo(v`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(v`CURRENT_TIMESTAMP`)).addColumn("created_by","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("updated_by","text").execute(),await t.schema.createTable("gateway_connections").addColumn("id","text",(e)=>e.primaryKey()).addColumn("gateway_id","text",(e)=>e.notNull().references("gateways.id").onDelete("cascade")).addColumn("connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("selected_tools","text").addColumn("created_at","text",(e)=>e.notNull().defaultTo(v`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_gateways_org").on("gateways").columns(["organization_id"]).execute(),await t.schema.createIndex("idx_gateways_org_status").on("gateways").columns(["organization_id","status"]).execute(),await v`CREATE UNIQUE INDEX idx_gateways_default_per_org ON gateways (organization_id) WHERE is_default = 1`.execute(t),await t.schema.createIndex("idx_gateway_connections_gateway").on("gateway_connections").columns(["gateway_id"]).execute(),await t.schema.createIndex("idx_gateway_connections_connection").on("gateway_connections").columns(["connection_id"]).execute(),await t.schema.createIndex("idx_gateway_connections_unique").on("gateway_connections").columns(["gateway_id","connection_id"]).unique().execute()}async function ya(t){await t.schema.dropIndex("idx_gateway_connections_unique").execute(),await t.schema.dropIndex("idx_gateway_connections_connection").execute(),await t.schema.dropIndex("idx_gateway_connections_gateway").execute(),await t.schema.dropIndex("idx_gateways_default_per_org").execute(),await t.schema.dropIndex("idx_gateways_org_status").execute(),await t.schema.dropIndex("idx_gateways_org").execute(),await t.schema.dropTable("gateway_connections").execute(),await t.schema.dropTable("gateways").execute()}var ht={};i(ht,{up:()=>ca,down:()=>fa});async function ca(t){await t.schema.alterTable("gateways").addColumn("icon","text").execute()}async function fa(t){await t.schema.alterTable("gateways").dropColumn("icon").execute()}var Kt={};i(Kt,{up:()=>Ta,down:()=>pa});import{sql as V}from"kysely";async function Ta(t){await t.schema.alterTable("gateways").addColumn("tool_selection_mode","text",(e)=>e.notNull().defaultTo("inclusion")).execute(),await V`
|
|
3
3
|
UPDATE gateways
|
|
4
4
|
SET tool_selection_mode = CASE
|
|
5
5
|
WHEN tool_selection_strategy = 'exclusion' THEN 'exclusion'
|
|
6
6
|
ELSE 'inclusion'
|
|
7
7
|
END
|
|
8
|
-
`.execute(t),await V`ALTER TABLE gateways RENAME COLUMN tool_selection_strategy TO _old_tool_selection_strategy`.execute(t),await t.schema.alterTable("gateways").addColumn("tool_selection_strategy","text",(e)=>e.notNull().defaultTo("passthrough")).execute(),await t.schema.alterTable("gateways").dropColumn("_old_tool_selection_strategy").execute()}async function
|
|
8
|
+
`.execute(t),await V`ALTER TABLE gateways RENAME COLUMN tool_selection_strategy TO _old_tool_selection_strategy`.execute(t),await t.schema.alterTable("gateways").addColumn("tool_selection_strategy","text",(e)=>e.notNull().defaultTo("passthrough")).execute(),await t.schema.alterTable("gateways").dropColumn("_old_tool_selection_strategy").execute()}async function pa(t){await V`ALTER TABLE gateways RENAME COLUMN tool_selection_strategy TO _new_tool_selection_strategy`.execute(t),await t.schema.alterTable("gateways").addColumn("tool_selection_strategy","text").execute(),await V`
|
|
9
9
|
UPDATE gateways
|
|
10
10
|
SET tool_selection_strategy = CASE
|
|
11
11
|
WHEN tool_selection_mode = 'exclusion' THEN 'exclusion'
|
|
12
12
|
ELSE NULL
|
|
13
13
|
END
|
|
14
|
-
`.execute(t),await t.schema.alterTable("gateways").dropColumn("_new_tool_selection_strategy").execute(),await t.schema.alterTable("gateways").dropColumn("tool_selection_mode").execute()}var kt={};i(kt,{up:()=>
|
|
14
|
+
`.execute(t),await t.schema.alterTable("gateways").dropColumn("_new_tool_selection_strategy").execute(),await t.schema.alterTable("gateways").dropColumn("tool_selection_mode").execute()}var kt={};i(kt,{up:()=>sa,down:()=>wa});async function sa(t){await t.schema.alterTable("monitoring_logs").addColumn("user_agent","text").execute(),await t.schema.alterTable("monitoring_logs").addColumn("gateway_id","text").execute(),await t.schema.createIndex("monitoring_logs_gateway_timestamp").on("monitoring_logs").columns(["gateway_id","timestamp"]).execute()}async function wa(t){await t.schema.dropIndex("monitoring_logs_gateway_timestamp").execute(),await t.schema.alterTable("monitoring_logs").dropColumn("gateway_id").execute(),await t.schema.alterTable("monitoring_logs").dropColumn("user_agent").execute()}var Pt={};i(Pt,{up:()=>Ca,down:()=>Na});async function Ca(t){await t.schema.alterTable("gateway_connections").addColumn("selected_resources","text").execute(),await t.schema.alterTable("gateway_connections").addColumn("selected_prompts","text").execute()}async function Na(t){await t.schema.alterTable("gateway_connections").dropColumn("selected_resources").execute(),await t.schema.alterTable("gateway_connections").dropColumn("selected_prompts").execute()}var zt={};i(zt,{up:()=>Ea,down:()=>ha});async function Ea(t){await t.schema.alterTable("monitoring_logs").addColumn("properties","text").execute()}async function ha(t){await t.schema.alterTable("monitoring_logs").dropColumn("properties").execute()}var Ut={};i(Ut,{up:()=>Ka,down:()=>ka});async function Ka(t){await t.schema.alterTable("downstream_tokens").addColumn("clientId","text").execute(),await t.schema.alterTable("downstream_tokens").addColumn("clientSecret","text").execute(),await t.schema.alterTable("downstream_tokens").addColumn("tokenEndpoint","text").execute(),await t.schema.createIndex("idx_downstream_tokens_connection_user").on("downstream_tokens").columns(["connectionId","userId"]).execute()}async function ka(t){await t.schema.dropIndex("idx_downstream_tokens_connection_user").execute(),await t.schema.alterTable("downstream_tokens").dropColumn("tokenEndpoint").execute(),await t.schema.alterTable("downstream_tokens").dropColumn("clientSecret").execute(),await t.schema.alterTable("downstream_tokens").dropColumn("clientId").execute()}var Dt={};i(Dt,{up:()=>za,down:()=>Ua});import{sql as Pa}from"kysely";async function za(t){await Pa`
|
|
15
15
|
DELETE FROM downstream_tokens
|
|
16
16
|
WHERE id NOT IN (
|
|
17
17
|
SELECT id FROM (
|
|
@@ -21,7 +21,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
21
21
|
) ranked
|
|
22
22
|
WHERE rn = 1
|
|
23
23
|
)
|
|
24
|
-
`.execute(t),await t.schema.dropIndex("idx_downstream_tokens_connection_user").execute(),await t.schema.alterTable("downstream_tokens").dropColumn("userId").execute(),await t.schema.createIndex("idx_downstream_tokens_connection").on("downstream_tokens").column("connectionId").unique().execute()}async function
|
|
24
|
+
`.execute(t),await t.schema.dropIndex("idx_downstream_tokens_connection_user").execute(),await t.schema.alterTable("downstream_tokens").dropColumn("userId").execute(),await t.schema.createIndex("idx_downstream_tokens_connection").on("downstream_tokens").column("connectionId").unique().execute()}async function Ua(t){await t.schema.dropIndex("idx_downstream_tokens_connection").execute(),await t.schema.alterTable("downstream_tokens").addColumn("userId","text").execute(),await t.schema.createIndex("idx_downstream_tokens_connection_user").on("downstream_tokens").columns(["connectionId","userId"]).execute()}var Lt={};i(Lt,{up:()=>Da,down:()=>La});async function Da(t){await t.schema.alterTable("gateways").dropColumn("tool_selection_strategy").execute()}async function La(t){await t.schema.alterTable("gateways").addColumn("tool_selection_strategy","text",(e)=>e.notNull().defaultTo("passthrough")).execute()}var jt={};i(jt,{up:()=>ja,down:()=>Ra});import{sql as ln}from"kysely";async function ja(t){await ln`DROP INDEX IF EXISTS idx_gateways_default_per_org`.execute(t),await t.schema.alterTable("gateways").dropColumn("is_default").execute()}async function Ra(t){await t.schema.alterTable("gateways").addColumn("is_default","integer",(e)=>e.notNull().defaultTo(0)).execute(),await ln`CREATE UNIQUE INDEX idx_gateways_default_per_org ON gateways (organization_id) WHERE is_default = 1`.execute(t)}var Rt={};i(Rt,{up:()=>ga,down:()=>Ja});async function ga(t){await t.schema.alterTable("organization_settings").addColumn("enabled_plugins","text").execute()}async function Ja(t){await t.schema.alterTable("organization_settings").dropColumn("enabled_plugins").execute()}var gt={};i(gt,{up:()=>Aa,down:()=>Wa});import{sql as q}from"kysely";async function Aa(t){await t.schema.createTable("threads").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(e)=>e.notNull()).addColumn("description","text").addColumn("hidden","boolean",(e)=>e.notNull().defaultTo(!1)).addColumn("created_at","text",(e)=>e.notNull().defaultTo(q`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(q`CURRENT_TIMESTAMP`)).addColumn("created_by","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("updated_by","text").execute(),await t.schema.createTable("thread_messages").addColumn("id","text",(e)=>e.primaryKey()).addColumn("thread_id","text",(e)=>e.notNull().references("threads.id").onDelete("cascade")).addColumn("metadata","text").addColumn("parts","text",(e)=>e.notNull()).addColumn("role","text",(e)=>e.notNull()).addColumn("created_at","text",(e)=>e.notNull().defaultTo(q`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(q`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_threads_org").on("threads").columns(["organization_id"]).execute(),await t.schema.createIndex("idx_threads_created_by").on("threads").columns(["created_by"]).execute(),await t.schema.createIndex("idx_threads_org_updated").on("threads").columns(["organization_id","updated_at"]).execute(),await t.schema.createIndex("idx_thread_messages_thread").on("thread_messages").columns(["thread_id"]).execute(),await t.schema.createIndex("idx_thread_messages_thread_created").on("thread_messages").columns(["thread_id","created_at"]).execute()}async function Wa(t){await t.schema.dropIndex("idx_thread_messages_thread_created").execute(),await t.schema.dropIndex("idx_thread_messages_thread").execute(),await t.schema.dropIndex("idx_threads_org_updated").execute(),await t.schema.dropIndex("idx_threads_created_by").execute(),await t.schema.dropIndex("idx_threads_org").execute(),await t.schema.dropTable("thread_messages").execute(),await t.schema.dropTable("threads").execute()}var Jt={};i(Jt,{up:()=>$a,down:()=>Xa});async function $a(t){await t.schema.dropIndex("idx_gateway_connections_unique").execute(),await t.schema.dropIndex("idx_gateway_connections_connection").execute(),await t.schema.dropIndex("idx_gateway_connections_gateway").execute(),await t.schema.dropIndex("idx_gateways_org_status").execute(),await t.schema.dropIndex("idx_gateways_org").execute(),await t.schema.dropIndex("monitoring_logs_gateway_timestamp").execute(),await t.schema.alterTable("gateways").renameTo("virtual_mcps").execute(),await t.schema.alterTable("gateway_connections").renameTo("virtual_mcp_connections").execute(),await t.schema.alterTable("virtual_mcp_connections").renameColumn("gateway_id","virtual_mcp_id").execute(),await t.schema.alterTable("monitoring_logs").renameColumn("gateway_id","virtual_mcp_id").execute(),await t.schema.createIndex("idx_virtual_mcps_org").on("virtual_mcps").columns(["organization_id"]).execute(),await t.schema.createIndex("idx_virtual_mcps_org_status").on("virtual_mcps").columns(["organization_id","status"]).execute(),await t.schema.createIndex("idx_virtual_mcp_connections_virtual_mcp").on("virtual_mcp_connections").columns(["virtual_mcp_id"]).execute(),await t.schema.createIndex("idx_virtual_mcp_connections_connection").on("virtual_mcp_connections").columns(["connection_id"]).execute(),await t.schema.createIndex("idx_virtual_mcp_connections_unique").on("virtual_mcp_connections").columns(["virtual_mcp_id","connection_id"]).unique().execute(),await t.schema.createIndex("monitoring_logs_virtual_mcp_timestamp").on("monitoring_logs").columns(["virtual_mcp_id","timestamp"]).execute()}async function Xa(t){await t.schema.dropIndex("monitoring_logs_virtual_mcp_timestamp").execute(),await t.schema.dropIndex("idx_virtual_mcp_connections_unique").execute(),await t.schema.dropIndex("idx_virtual_mcp_connections_connection").execute(),await t.schema.dropIndex("idx_virtual_mcp_connections_virtual_mcp").execute(),await t.schema.dropIndex("idx_virtual_mcps_org_status").execute(),await t.schema.dropIndex("idx_virtual_mcps_org").execute(),await t.schema.alterTable("monitoring_logs").renameColumn("virtual_mcp_id","gateway_id").execute(),await t.schema.alterTable("virtual_mcp_connections").renameColumn("virtual_mcp_id","gateway_id").execute(),await t.schema.alterTable("virtual_mcp_connections").renameTo("gateway_connections").execute(),await t.schema.alterTable("virtual_mcps").renameTo("gateways").execute(),await t.schema.createIndex("idx_gateways_org").on("gateways").columns(["organization_id"]).execute(),await t.schema.createIndex("idx_gateways_org_status").on("gateways").columns(["organization_id","status"]).execute(),await t.schema.createIndex("idx_gateway_connections_gateway").on("gateway_connections").columns(["gateway_id"]).execute(),await t.schema.createIndex("idx_gateway_connections_connection").on("gateway_connections").columns(["connection_id"]).execute(),await t.schema.createIndex("idx_gateway_connections_unique").on("gateway_connections").columns(["gateway_id","connection_id"]).unique().execute(),await t.schema.createIndex("monitoring_logs_gateway_timestamp").on("monitoring_logs").columns(["gateway_id","timestamp"]).execute()}var At={};i(At,{up:()=>Sa,down:()=>Fa});async function Sa(t){await t.schema.dropIndex("idx_threads_org").execute(),await t.schema.dropIndex("idx_thread_messages_thread").execute(),await t.schema.dropIndex("idx_threads_org_updated").execute(),await t.schema.dropIndex("idx_threads_created_by").execute(),await t.schema.dropIndex("idx_thread_messages_thread_created").execute(),await t.schema.createIndex("idx_threads_org_hidden_updated").on("threads").columns(["organization_id","hidden","updated_at"]).execute(),await t.schema.createIndex("idx_threads_created_by_updated").on("threads").columns(["created_by","updated_at"]).execute(),await t.schema.createIndex("idx_thread_messages_thread_created_id").on("thread_messages").columns(["thread_id","created_at","id"]).execute()}async function Fa(t){await t.schema.dropIndex("idx_thread_messages_thread_created_id").execute(),await t.schema.dropIndex("idx_threads_created_by_updated").execute(),await t.schema.dropIndex("idx_threads_org_hidden_updated").execute(),await t.schema.createIndex("idx_threads_org").on("threads").columns(["organization_id"]).execute(),await t.schema.createIndex("idx_threads_created_by").on("threads").columns(["created_by"]).execute(),await t.schema.createIndex("idx_threads_org_updated").on("threads").columns(["organization_id","updated_at"]).execute(),await t.schema.createIndex("idx_thread_messages_thread").on("thread_messages").columns(["thread_id"]).execute(),await t.schema.createIndex("idx_thread_messages_thread_created").on("thread_messages").columns(["thread_id","created_at"]).execute()}var Wt={};i(Wt,{up:()=>Ma,down:()=>Qa});import{sql as T}from"kysely";async function Ma(t){await T`
|
|
25
25
|
INSERT INTO connections (
|
|
26
26
|
id,
|
|
27
27
|
organization_id,
|
|
@@ -68,7 +68,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
68
68
|
created_at,
|
|
69
69
|
updated_at
|
|
70
70
|
FROM virtual_mcps
|
|
71
|
-
`.execute(t),await t.schema.dropIndex("idx_virtual_mcp_connections_unique").execute(),await t.schema.dropIndex("idx_virtual_mcp_connections_connection").execute(),await t.schema.dropIndex("idx_virtual_mcp_connections_virtual_mcp").execute();let e=await
|
|
71
|
+
`.execute(t),await t.schema.dropIndex("idx_virtual_mcp_connections_unique").execute(),await t.schema.dropIndex("idx_virtual_mcp_connections_connection").execute(),await t.schema.dropIndex("idx_virtual_mcp_connections_virtual_mcp").execute();let e=await T`SELECT current_database()`.execute(t).then(()=>!0).catch(()=>!1);if(e)await T`ALTER TABLE virtual_mcp_connections DROP CONSTRAINT IF EXISTS gateway_connections_gateway_id_fkey`.execute(t),await T`ALTER TABLE virtual_mcp_connections DROP CONSTRAINT IF EXISTS gateway_connections_connection_id_fkey`.execute(t),await T`ALTER TABLE virtual_mcp_connections DROP CONSTRAINT IF EXISTS virtual_mcp_connections_virtual_mcp_id_fkey`.execute(t),await T`ALTER TABLE virtual_mcp_connections DROP CONSTRAINT IF EXISTS virtual_mcp_connections_connection_id_fkey`.execute(t);if(await t.schema.alterTable("virtual_mcp_connections").renameTo("connection_aggregations").execute(),await t.schema.alterTable("connection_aggregations").renameColumn("virtual_mcp_id","parent_connection_id").execute(),await t.schema.alterTable("connection_aggregations").renameColumn("connection_id","child_connection_id").execute(),e)await T`ALTER TABLE connection_aggregations ADD CONSTRAINT conn_agg_parent_fk FOREIGN KEY (parent_connection_id) REFERENCES connections(id) ON DELETE CASCADE`.execute(t),await T`ALTER TABLE connection_aggregations ADD CONSTRAINT conn_agg_child_fk FOREIGN KEY (child_connection_id) REFERENCES connections(id) ON DELETE CASCADE`.execute(t);await t.schema.dropIndex("monitoring_logs_virtual_mcp_timestamp").execute(),await t.schema.alterTable("monitoring_logs").dropColumn("virtual_mcp_id").execute(),await t.schema.dropIndex("idx_virtual_mcps_org_status").execute(),await t.schema.dropIndex("idx_virtual_mcps_org").execute(),await t.schema.dropTable("virtual_mcps").execute(),await t.schema.createIndex("idx_conn_agg_parent").on("connection_aggregations").columns(["parent_connection_id"]).execute(),await t.schema.createIndex("idx_conn_agg_child").on("connection_aggregations").columns(["child_connection_id"]).execute(),await t.schema.createIndex("idx_conn_agg_unique").on("connection_aggregations").columns(["parent_connection_id","child_connection_id"]).unique().execute()}async function Qa(t){await t.schema.createTable("virtual_mcps").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(e)=>e.notNull()).addColumn("description","text").addColumn("tool_selection_mode","text",(e)=>e.notNull().defaultTo("inclusion")).addColumn("icon","text").addColumn("status","text",(e)=>e.notNull().defaultTo("active")).addColumn("created_at","text",(e)=>e.notNull().defaultTo(T`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(T`CURRENT_TIMESTAMP`)).addColumn("created_by","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("updated_by","text").execute(),await T`
|
|
72
72
|
INSERT INTO virtual_mcps (
|
|
73
73
|
id, organization_id, title, description, icon, status,
|
|
74
74
|
created_at, updated_at, created_by, updated_by, tool_selection_mode
|
|
@@ -78,7 +78,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
78
78
|
created_at, updated_at, created_by, NULL, 'inclusion'
|
|
79
79
|
FROM connections
|
|
80
80
|
WHERE connection_type = 'VIRTUAL'
|
|
81
|
-
`.execute(t),await t.schema.dropIndex("idx_conn_agg_unique").execute(),await t.schema.dropIndex("idx_conn_agg_child").execute(),await t.schema.dropIndex("idx_conn_agg_parent").execute(),await t.schema.alterTable("monitoring_logs").addColumn("virtual_mcp_id","text").execute(),await t.schema.alterTable("connection_aggregations").renameColumn("child_connection_id","connection_id").execute(),await t.schema.alterTable("connection_aggregations").renameColumn("parent_connection_id","virtual_mcp_id").execute(),await t.schema.alterTable("connection_aggregations").renameTo("virtual_mcp_connections").execute(),await
|
|
81
|
+
`.execute(t),await t.schema.dropIndex("idx_conn_agg_unique").execute(),await t.schema.dropIndex("idx_conn_agg_child").execute(),await t.schema.dropIndex("idx_conn_agg_parent").execute(),await t.schema.alterTable("monitoring_logs").addColumn("virtual_mcp_id","text").execute(),await t.schema.alterTable("connection_aggregations").renameColumn("child_connection_id","connection_id").execute(),await t.schema.alterTable("connection_aggregations").renameColumn("parent_connection_id","virtual_mcp_id").execute(),await t.schema.alterTable("connection_aggregations").renameTo("virtual_mcp_connections").execute(),await T`DELETE FROM connections WHERE connection_type = 'VIRTUAL'`.execute(t),await t.schema.createIndex("idx_virtual_mcps_org").on("virtual_mcps").columns(["organization_id"]).execute(),await t.schema.createIndex("idx_virtual_mcps_org_status").on("virtual_mcps").columns(["organization_id","status"]).execute(),await t.schema.createIndex("idx_virtual_mcp_connections_virtual_mcp").on("virtual_mcp_connections").columns(["virtual_mcp_id"]).execute(),await t.schema.createIndex("idx_virtual_mcp_connections_connection").on("virtual_mcp_connections").columns(["connection_id"]).execute(),await t.schema.createIndex("idx_virtual_mcp_connections_unique").on("virtual_mcp_connections").columns(["virtual_mcp_id","connection_id"]).unique().execute(),await t.schema.createIndex("monitoring_logs_virtual_mcp_timestamp").on("monitoring_logs").columns(["virtual_mcp_id","timestamp"]).execute()}var $t={};i($t,{up:()=>Oa,down:()=>Za});async function Oa(t){await t.schema.alterTable("monitoring_logs").addColumn("virtual_mcp_id","text").execute(),await t.schema.createIndex("monitoring_logs_virtual_mcp_id").on("monitoring_logs").columns(["virtual_mcp_id"]).execute(),await t.schema.createIndex("monitoring_logs_virtual_mcp_timestamp").on("monitoring_logs").columns(["virtual_mcp_id","timestamp"]).execute()}async function Za(t){await t.schema.dropIndex("monitoring_logs_virtual_mcp_timestamp").execute(),await t.schema.dropIndex("monitoring_logs_virtual_mcp_id").execute(),await t.schema.alterTable("monitoring_logs").dropColumn("virtual_mcp_id").execute()}var Xt={};i(Xt,{up:()=>Ha,down:()=>Ya});import{sql as h}from"kysely";async function Ha(t){if(await t.schema.dropIndex("idx_conn_agg_unique").execute(),await t.schema.dropIndex("idx_conn_agg_child").execute(),await t.schema.dropIndex("idx_conn_agg_parent").execute(),await t.schema.createTable("connection_aggregations_new").addColumn("id","text",(n)=>n.primaryKey()).addColumn("parent_connection_id","text",(n)=>n.notNull().references("connections.id").onDelete("cascade")).addColumn("child_connection_id","text",(n)=>n.notNull().references("connections.id").onDelete("restrict")).addColumn("selected_tools","text").addColumn("selected_resources","text").addColumn("selected_prompts","text").addColumn("created_at","text",(n)=>n.notNull().defaultTo(h`CURRENT_TIMESTAMP`)).execute(),await h`
|
|
82
82
|
INSERT INTO connection_aggregations_new (
|
|
83
83
|
id, parent_connection_id, child_connection_id,
|
|
84
84
|
selected_tools, selected_resources, selected_prompts, created_at
|
|
@@ -87,7 +87,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
87
87
|
id, parent_connection_id, child_connection_id,
|
|
88
88
|
selected_tools, selected_resources, selected_prompts, created_at
|
|
89
89
|
FROM connection_aggregations
|
|
90
|
-
`.execute(t),await t.schema.dropTable("connection_aggregations").execute(),await t.schema.alterTable("connection_aggregations_new").renameTo("connection_aggregations").execute(),await
|
|
90
|
+
`.execute(t),await t.schema.dropTable("connection_aggregations").execute(),await t.schema.alterTable("connection_aggregations_new").renameTo("connection_aggregations").execute(),await h`SELECT current_database()`.execute(t).then(()=>!0).catch(()=>!1))await h`ALTER TABLE connection_aggregations RENAME CONSTRAINT connection_aggregations_new_parent_connection_id_fkey TO conn_agg_parent_fk`.execute(t),await h`ALTER TABLE connection_aggregations RENAME CONSTRAINT connection_aggregations_new_child_connection_id_fkey TO conn_agg_child_fk`.execute(t);await t.schema.createIndex("idx_conn_agg_parent").on("connection_aggregations").columns(["parent_connection_id"]).execute(),await t.schema.createIndex("idx_conn_agg_child").on("connection_aggregations").columns(["child_connection_id"]).execute(),await t.schema.createIndex("idx_conn_agg_unique").on("connection_aggregations").columns(["parent_connection_id","child_connection_id"]).unique().execute()}async function Ya(t){if(await t.schema.dropIndex("idx_conn_agg_unique").execute(),await t.schema.dropIndex("idx_conn_agg_child").execute(),await t.schema.dropIndex("idx_conn_agg_parent").execute(),await t.schema.createTable("connection_aggregations_new").addColumn("id","text",(n)=>n.primaryKey()).addColumn("parent_connection_id","text",(n)=>n.notNull().references("connections.id").onDelete("cascade")).addColumn("child_connection_id","text",(n)=>n.notNull().references("connections.id").onDelete("cascade")).addColumn("selected_tools","text").addColumn("selected_resources","text").addColumn("selected_prompts","text").addColumn("created_at","text",(n)=>n.notNull().defaultTo(h`CURRENT_TIMESTAMP`)).execute(),await h`
|
|
91
91
|
INSERT INTO connection_aggregations_new (
|
|
92
92
|
id, parent_connection_id, child_connection_id,
|
|
93
93
|
selected_tools, selected_resources, selected_prompts, created_at
|
|
@@ -96,7 +96,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
96
96
|
id, parent_connection_id, child_connection_id,
|
|
97
97
|
selected_tools, selected_resources, selected_prompts, created_at
|
|
98
98
|
FROM connection_aggregations
|
|
99
|
-
`.execute(t),await t.schema.dropTable("connection_aggregations").execute(),await t.schema.alterTable("connection_aggregations_new").renameTo("connection_aggregations").execute(),await
|
|
99
|
+
`.execute(t),await t.schema.dropTable("connection_aggregations").execute(),await t.schema.alterTable("connection_aggregations_new").renameTo("connection_aggregations").execute(),await h`SELECT current_database()`.execute(t).then(()=>!0).catch(()=>!1))await h`ALTER TABLE connection_aggregations RENAME CONSTRAINT connection_aggregations_new_parent_connection_id_fkey TO conn_agg_parent_fk`.execute(t),await h`ALTER TABLE connection_aggregations RENAME CONSTRAINT connection_aggregations_new_child_connection_id_fkey TO conn_agg_child_fk`.execute(t);await t.schema.createIndex("idx_conn_agg_parent").on("connection_aggregations").columns(["parent_connection_id"]).execute(),await t.schema.createIndex("idx_conn_agg_child").on("connection_aggregations").columns(["child_connection_id"]).execute(),await t.schema.createIndex("idx_conn_agg_unique").on("connection_aggregations").columns(["parent_connection_id","child_connection_id"]).unique().execute()}var Ft={};i(Ft,{up:()=>Ba,down:()=>Ia});import{sql as St}from"kysely";async function Ba(t){await St`
|
|
100
100
|
UPDATE connections
|
|
101
101
|
SET connection_url = connection_url || '/management',
|
|
102
102
|
tools = NULL,
|
|
@@ -104,19 +104,19 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
104
104
|
WHERE connection_url LIKE '%/mcp'
|
|
105
105
|
AND connection_url NOT LIKE '%/mcp/management'
|
|
106
106
|
AND app_name = '@deco/management-mcp'
|
|
107
|
-
`.execute(t),await
|
|
107
|
+
`.execute(t),await St`
|
|
108
108
|
UPDATE connections
|
|
109
109
|
SET tools = NULL,
|
|
110
110
|
updated_at = CURRENT_TIMESTAMP
|
|
111
111
|
WHERE app_name = '@deco/management-mcp'
|
|
112
112
|
AND tools IS NOT NULL
|
|
113
|
-
`.execute(t)}async function
|
|
113
|
+
`.execute(t)}async function Ia(t){await St`
|
|
114
114
|
UPDATE connections
|
|
115
115
|
SET connection_url = SUBSTR(connection_url, 1, LENGTH(connection_url) - LENGTH('/management')),
|
|
116
116
|
updated_at = CURRENT_TIMESTAMP
|
|
117
117
|
WHERE connection_url LIKE '%/mcp/management'
|
|
118
118
|
AND app_name = '@deco/management-mcp'
|
|
119
|
-
`.execute(t)}var Qt={};i(Qt,{up:()=>
|
|
119
|
+
`.execute(t)}var Qt={};i(Qt,{up:()=>Ga,down:()=>va});import{sql as Mt}from"kysely";async function Ga(t){await Mt`
|
|
120
120
|
UPDATE connections
|
|
121
121
|
SET connection_url = REPLACE(connection_url, '/mcp/management', '/mcp/self'),
|
|
122
122
|
tools = NULL,
|
|
@@ -130,16 +130,16 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
130
130
|
WHERE connection_url LIKE '%/mcp/self'
|
|
131
131
|
AND app_name = '@deco/management-mcp'
|
|
132
132
|
AND tools IS NOT NULL
|
|
133
|
-
`.execute(t)}async function
|
|
133
|
+
`.execute(t)}async function va(t){await Mt`
|
|
134
134
|
UPDATE connections
|
|
135
135
|
SET connection_url = REPLACE(connection_url, '/mcp/self', '/mcp/management'),
|
|
136
136
|
updated_at = CURRENT_TIMESTAMP
|
|
137
137
|
WHERE connection_url LIKE '%/mcp/self'
|
|
138
138
|
AND app_name = '@deco/management-mcp'
|
|
139
|
-
`.execute(t)}var Ot={};i(Ot,{up:()=>
|
|
139
|
+
`.execute(t)}var Ot={};i(Ot,{up:()=>Va,down:()=>qa});async function Va(t){await t.schema.alterTable("connections").addColumn("updated_by","text").execute()}async function qa(t){await t.schema.alterTable("connections").dropColumn("updated_by").execute()}var Zt={};i(Zt,{up:()=>la,down:()=>da});import{sql as dn}from"kysely";async function la(t){await t.schema.createTable("organization_tags").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("name","text",(e)=>e.notNull()).addColumn("created_at","text",(e)=>e.notNull().defaultTo(dn`CURRENT_TIMESTAMP`)).execute(),await t.schema.createTable("member_tags").addColumn("id","text",(e)=>e.primaryKey()).addColumn("member_id","text",(e)=>e.notNull().references("member.id").onDelete("cascade")).addColumn("tag_id","text",(e)=>e.notNull().references("organization_tags.id").onDelete("cascade")).addColumn("created_at","text",(e)=>e.notNull().defaultTo(dn`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_organization_tags_org").on("organization_tags").columns(["organization_id"]).execute(),await t.schema.createIndex("idx_organization_tags_unique_name").on("organization_tags").columns(["organization_id","name"]).unique().execute(),await t.schema.createIndex("idx_member_tags_member").on("member_tags").columns(["member_id"]).execute(),await t.schema.createIndex("idx_member_tags_tag").on("member_tags").columns(["tag_id"]).execute(),await t.schema.createIndex("idx_member_tags_unique").on("member_tags").columns(["member_id","tag_id"]).unique().execute()}async function da(t){await t.schema.dropIndex("idx_member_tags_unique").execute(),await t.schema.dropIndex("idx_member_tags_tag").execute(),await t.schema.dropIndex("idx_member_tags_member").execute(),await t.schema.dropIndex("idx_organization_tags_unique_name").execute(),await t.schema.dropIndex("idx_organization_tags_org").execute(),await t.schema.dropTable("member_tags").execute(),await t.schema.dropTable("organization_tags").execute()}var Ht={};i(Ht,{up:()=>ba,down:()=>tu});import{sql as M}from"kysely";async function ba(t){await M`
|
|
140
140
|
ALTER TABLE connection_aggregations
|
|
141
141
|
ADD COLUMN dependency_mode TEXT NOT NULL DEFAULT 'direct'
|
|
142
|
-
`.execute(t),await t.schema.createIndex("idx_conn_agg_dependency_mode").on("connection_aggregations").columns(["parent_connection_id","dependency_mode"]).execute()}async function
|
|
142
|
+
`.execute(t),await t.schema.createIndex("idx_conn_agg_dependency_mode").on("connection_aggregations").columns(["parent_connection_id","dependency_mode"]).execute()}async function tu(t){if(await t.schema.dropIndex("idx_conn_agg_dependency_mode").execute(),await M`SELECT current_database()`.execute(t).then(()=>!0).catch(()=>!1))await M`ALTER TABLE connection_aggregations DROP COLUMN dependency_mode`.execute(t);else await t.schema.dropIndex("idx_conn_agg_unique").execute(),await t.schema.dropIndex("idx_conn_agg_child").execute(),await t.schema.dropIndex("idx_conn_agg_parent").execute(),await t.schema.createTable("connection_aggregations_new").addColumn("id","text",(n)=>n.primaryKey()).addColumn("parent_connection_id","text",(n)=>n.notNull().references("connections.id").onDelete("cascade")).addColumn("child_connection_id","text",(n)=>n.notNull().references("connections.id").onDelete("restrict")).addColumn("selected_tools","text").addColumn("selected_resources","text").addColumn("selected_prompts","text").addColumn("created_at","text",(n)=>n.notNull().defaultTo(M`CURRENT_TIMESTAMP`)).execute(),await M`
|
|
143
143
|
INSERT INTO connection_aggregations_new (
|
|
144
144
|
id, parent_connection_id, child_connection_id,
|
|
145
145
|
selected_tools, selected_resources, selected_prompts, created_at
|
|
@@ -148,42 +148,42 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
148
148
|
id, parent_connection_id, child_connection_id,
|
|
149
149
|
selected_tools, selected_resources, selected_prompts, created_at
|
|
150
150
|
FROM connection_aggregations
|
|
151
|
-
`.execute(t),await t.schema.dropTable("connection_aggregations").execute(),await t.schema.alterTable("connection_aggregations_new").renameTo("connection_aggregations").execute(),await t.schema.createIndex("idx_conn_agg_parent").on("connection_aggregations").columns(["parent_connection_id"]).execute(),await t.schema.createIndex("idx_conn_agg_child").on("connection_aggregations").columns(["child_connection_id"]).execute(),await t.schema.createIndex("idx_conn_agg_unique").on("connection_aggregations").columns(["parent_connection_id","child_connection_id"]).unique().execute()}var Yt={};i(Yt,{up:()=>
|
|
151
|
+
`.execute(t),await t.schema.dropTable("connection_aggregations").execute(),await t.schema.alterTable("connection_aggregations_new").renameTo("connection_aggregations").execute(),await t.schema.createIndex("idx_conn_agg_parent").on("connection_aggregations").columns(["parent_connection_id"]).execute(),await t.schema.createIndex("idx_conn_agg_child").on("connection_aggregations").columns(["child_connection_id"]).execute(),await t.schema.createIndex("idx_conn_agg_unique").on("connection_aggregations").columns(["parent_connection_id","child_connection_id"]).unique().execute()}var Yt={};i(Yt,{up:()=>uu,down:()=>ou});import{webcrypto as ti}from"crypto";var bn="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var eu=128,D,j;function nu(t){if(!D||D.length<t)D=Buffer.allocUnsafe(t*eu),ti.getRandomValues(D),j=0;else if(j+t>D.length)ti.getRandomValues(D),j=0;j+=t}function R(t=21){nu(t|=0);let e="";for(let n=j-t;n<j;n++)e+=bn[D[n]&63];return e}var iu="org-admin",au="Organization Admin";async function uu(t){await t.schema.createTable("projects").addColumn("id","text",(n)=>n.primaryKey()).addColumn("organization_id","text",(n)=>n.notNull().references("organization.id").onDelete("cascade")).addColumn("slug","text",(n)=>n.notNull()).addColumn("name","text",(n)=>n.notNull()).addColumn("description","text").addColumn("enabled_plugins","text").addColumn("ui","text").addColumn("created_at","text",(n)=>n.notNull()).addColumn("updated_at","text",(n)=>n.notNull()).execute(),await t.schema.createIndex("projects_org_slug_unique").on("projects").columns(["organization_id","slug"]).unique().execute(),await t.schema.createIndex("projects_organization_id_idx").on("projects").column("organization_id").execute(),await t.schema.createTable("project_plugin_configs").addColumn("id","text",(n)=>n.primaryKey()).addColumn("project_id","text",(n)=>n.notNull().references("projects.id").onDelete("cascade")).addColumn("plugin_id","text",(n)=>n.notNull()).addColumn("connection_id","text",(n)=>n.references("connections.id").onDelete("set null")).addColumn("settings","text").addColumn("created_at","text",(n)=>n.notNull()).addColumn("updated_at","text",(n)=>n.notNull()).execute(),await t.schema.createIndex("project_plugin_configs_project_plugin_unique").on("project_plugin_configs").columns(["project_id","plugin_id"]).unique().execute();let e=await t.selectFrom("organization").select(["id"]).execute();for(let n of e){let u=new Date().toISOString(),a=`proj_${R()}`,o=await t.selectFrom("organization_settings").select(["enabled_plugins"]).where("organizationId","=",n.id).executeTakeFirst();await t.insertInto("projects").values({id:a,organization_id:n.id,slug:iu,name:au,description:null,enabled_plugins:o?.enabled_plugins??null,ui:null,created_at:u,updated_at:u}).execute()}}async function ou(t){await t.schema.dropTable("project_plugin_configs").execute(),await t.schema.dropTable("projects").execute()}var Bt={};i(Bt,{up:()=>_u,down:()=>mu});async function _u(t){await t.schema.alterTable("threads").addColumn("status","text",(e)=>e.notNull().defaultTo("completed")).execute()}async function mu(t){await t.schema.alterTable("threads").dropColumn("status").execute()}var It={};i(It,{up:()=>xu,down:()=>ru});async function xu(t){}async function ru(t){}var Gt={};i(Gt,{up:()=>yu,down:()=>cu});async function yu(t){await t.schema.createTable("project_connections").addColumn("id","text",(e)=>e.primaryKey()).addColumn("project_id","text",(e)=>e.notNull().references("projects.id").onDelete("cascade")).addColumn("connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("created_at","text",(e)=>e.notNull()).execute(),await t.schema.createIndex("project_connections_project_conn_unique").on("project_connections").columns(["project_id","connection_id"]).unique().execute(),await t.schema.createIndex("project_connections_project_id_idx").on("project_connections").columns(["project_id"]).execute()}async function cu(t){await t.schema.dropIndex("project_connections_project_id_idx").execute(),await t.schema.dropIndex("project_connections_project_conn_unique").execute(),await t.schema.dropTable("project_connections").execute()}var vt={};i(vt,{up:()=>fu,down:()=>Tu});import{sql as ei}from"kysely";async function fu(t){await ei`
|
|
152
152
|
UPDATE connections
|
|
153
153
|
SET connection_url = 'https://studio.decocms.com/org/deco/registry/mcp',
|
|
154
154
|
tools = NULL,
|
|
155
155
|
updated_at = CURRENT_TIMESTAMP
|
|
156
156
|
WHERE connection_url = 'https://api.decocms.com/mcp/registry'
|
|
157
157
|
AND app_name = 'deco-registry'
|
|
158
|
-
`.execute(t)}async function
|
|
158
|
+
`.execute(t)}async function Tu(t){await ei`
|
|
159
159
|
UPDATE connections
|
|
160
160
|
SET connection_url = 'https://api.decocms.com/mcp/registry',
|
|
161
161
|
updated_at = CURRENT_TIMESTAMP
|
|
162
162
|
WHERE connection_url = 'https://studio.decocms.com/org/deco/registry/mcp'
|
|
163
163
|
AND app_name = 'deco-registry'
|
|
164
|
-
`.execute(t)}var Vt={};i(Vt,{up:()=>
|
|
164
|
+
`.execute(t)}var Vt={};i(Vt,{up:()=>su,down:()=>wu});import{sql as pu}from"kysely";async function su(t){await t.schema.createTable("ai_provider_keys").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("provider_id","text",(e)=>e.notNull()).addColumn("label","text",(e)=>e.notNull()).addColumn("encrypted_api_key","text",(e)=>e.notNull()).addColumn("created_by","text",(e)=>e.notNull()).addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(pu`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_ai_provider_keys_org").on("ai_provider_keys").column("organization_id").execute(),await t.schema.createIndex("idx_ai_provider_keys_org_provider").on("ai_provider_keys").columns(["organization_id","provider_id"]).execute()}async function wu(t){await t.schema.dropTable("ai_provider_keys").execute()}var qt={};i(qt,{up:()=>Nu,down:()=>Eu});import{sql as Cu}from"kysely";async function Nu(t){await t.schema.createTable("oauth_pkce_states").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull()).addColumn("user_id","text",(e)=>e.notNull()).addColumn("code_verifier","text",(e)=>e.notNull()).addColumn("expires_at","timestamptz",(e)=>e.notNull()).addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(Cu`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_oauth_pkce_states_expires_at").on("oauth_pkce_states").column("expires_at").execute()}async function Eu(t){await t.schema.dropTable("oauth_pkce_states").execute()}var lt={};i(lt,{up:()=>hu,down:()=>Ku});import{sql as z}from"kysely";async function hu(t){await t.schema.createTable("automations").addColumn("id","text",(e)=>e.primaryKey().defaultTo(z`gen_random_uuid()`)).addColumn("organization_id","text",(e)=>e.notNull()).addColumn("name","text",(e)=>e.notNull()).addColumn("active","boolean",(e)=>e.notNull().defaultTo(!0)).addColumn("created_by","text",(e)=>e.notNull()).addColumn("agent","text",(e)=>e.notNull()).addColumn("messages","text",(e)=>e.notNull()).addColumn("models","text",(e)=>e.notNull()).addColumn("temperature","real",(e)=>e.notNull().defaultTo(0.5)).addColumn("created_at","text",(e)=>e.notNull().defaultTo(z`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(z`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_automations_org").on("automations").columns(["organization_id"]).execute(),await t.schema.createIndex("idx_automations_active").on("automations").columns(["organization_id","active"]).execute(),await t.schema.createTable("automation_triggers").addColumn("id","text",(e)=>e.primaryKey().defaultTo(z`gen_random_uuid()`)).addColumn("automation_id","text",(e)=>e.notNull().references("automations.id").onDelete("cascade")).addColumn("type","text",(e)=>e.notNull()).addColumn("cron_expression","text").addColumn("connection_id","text").addColumn("event_type","text").addColumn("params","text").addColumn("next_run_at","text").addColumn("created_at","text",(e)=>e.notNull().defaultTo(z`CURRENT_TIMESTAMP`)).execute(),await z`ALTER TABLE automation_triggers ADD CONSTRAINT chk_trigger_type CHECK (type IN ('cron', 'event'))`.execute(t),await z`ALTER TABLE automation_triggers ADD CONSTRAINT chk_cron_trigger CHECK (type != 'cron' OR cron_expression IS NOT NULL)`.execute(t),await z`ALTER TABLE automation_triggers ADD CONSTRAINT chk_event_trigger CHECK (type != 'event' OR (connection_id IS NOT NULL AND event_type IS NOT NULL))`.execute(t),await t.schema.createIndex("idx_automation_triggers_automation").on("automation_triggers").columns(["automation_id"]).execute(),await t.schema.createIndex("idx_automation_triggers_event").on("automation_triggers").columns(["connection_id","event_type"]).execute(),await t.schema.createIndex("idx_automation_triggers_cron").on("automation_triggers").columns(["next_run_at"]).execute(),await t.schema.alterTable("threads").addColumn("trigger_id","text",(e)=>e.references("automation_triggers.id").onDelete("set null")).execute(),await t.schema.createIndex("idx_threads_trigger_status").on("threads").columns(["trigger_id","status"]).execute()}async function Ku(t){await t.schema.dropIndex("idx_threads_trigger_status").execute(),await t.schema.alterTable("threads").dropColumn("trigger_id").execute(),await t.schema.dropIndex("idx_automation_triggers_cron").execute(),await t.schema.dropIndex("idx_automation_triggers_event").execute(),await t.schema.dropIndex("idx_automation_triggers_automation").execute(),await t.schema.dropTable("automation_triggers").execute(),await t.schema.dropIndex("idx_automations_active").execute(),await t.schema.dropIndex("idx_automations_org").execute(),await t.schema.dropTable("automations").execute()}var dt={};i(dt,{up:()=>ku,down:()=>Pu});async function ku(t){await t.schema.dropIndex("idx_automation_triggers_cron").execute(),await t.schema.alterTable("automation_triggers").dropColumn("next_run_at").execute(),await t.schema.alterTable("automation_triggers").addColumn("last_run_at","text").execute()}async function Pu(t){await t.schema.alterTable("automation_triggers").dropColumn("last_run_at").execute(),await t.schema.alterTable("automation_triggers").addColumn("next_run_at","text").execute(),await t.schema.createIndex("idx_automation_triggers_cron").on("automation_triggers").columns(["next_run_at"]).execute()}var bt={};i(bt,{up:()=>zu,down:()=>Uu});async function zu(t){await t.schema.alterTable("ai_provider_keys").addColumn("key_hash","text").execute(),await t.schema.createIndex("idx_ai_provider_keys_unique_hash").unique().on("ai_provider_keys").columns(["organization_id","provider_id","key_hash"]).execute()}async function Uu(t){await t.schema.dropIndex("idx_ai_provider_keys_unique_hash").execute(),await t.schema.alterTable("ai_provider_keys").dropColumn("key_hash").execute()}var te={};i(te,{up:()=>Du,down:()=>Lu});import{sql as ni}from"kysely";async function Du(t){await ni`
|
|
165
165
|
UPDATE connections
|
|
166
166
|
SET title = 'CMS MCP',
|
|
167
167
|
tools = NULL,
|
|
168
168
|
updated_at = CURRENT_TIMESTAMP
|
|
169
169
|
WHERE app_name = '@deco/management-mcp'
|
|
170
|
-
`.execute(t)}async function
|
|
170
|
+
`.execute(t)}async function Lu(t){await ni`
|
|
171
171
|
UPDATE connections
|
|
172
172
|
SET title = 'Mesh MCP',
|
|
173
173
|
updated_at = CURRENT_TIMESTAMP
|
|
174
174
|
WHERE app_name = '@deco/management-mcp'
|
|
175
|
-
`.execute(t)}var ee={};i(ee,{up:()=>
|
|
175
|
+
`.execute(t)}var ee={};i(ee,{up:()=>ju,down:()=>Ru});import{sql as ii}from"kysely";async function ju(t){await ii`
|
|
176
176
|
UPDATE connections
|
|
177
177
|
SET title = 'Deco CMS',
|
|
178
178
|
tools = NULL,
|
|
179
179
|
updated_at = CURRENT_TIMESTAMP
|
|
180
180
|
WHERE app_name = '@deco/management-mcp'
|
|
181
|
-
`.execute(t)}async function
|
|
181
|
+
`.execute(t)}async function Ru(t){await ii`
|
|
182
182
|
UPDATE connections
|
|
183
183
|
SET title = 'CMS MCP',
|
|
184
184
|
updated_at = CURRENT_TIMESTAMP
|
|
185
185
|
WHERE app_name = '@deco/management-mcp'
|
|
186
|
-
`.execute(t)}var ne={};i(ne,{up:()=>gu,down:()=>
|
|
186
|
+
`.execute(t)}var ne={};i(ne,{up:()=>gu,down:()=>Ju});async function gu(t){await t.schema.alterTable("connections").dropColumn("tools").execute()}async function Ju(t){await t.schema.alterTable("connections").addColumn("tools","text").execute()}var ie={};i(ie,{up:()=>Au,down:()=>Wu});async function Au(t){await t.schema.alterTable("threads").addColumn("context_start_message_id","text").execute()}async function Wu(t){await t.schema.alterTable("threads").dropColumn("context_start_message_id").execute()}var ue={};i(ue,{up:()=>$u,down:()=>Xu});import{sql as ae}from"kysely";async function $u(t){await ae`
|
|
187
187
|
UPDATE organization_settings
|
|
188
188
|
SET enabled_plugins = (
|
|
189
189
|
SELECT COALESCE(json_agg(elem), '[]'::json)::text
|
|
@@ -204,7 +204,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
204
204
|
`.execute(t),await ae`
|
|
205
205
|
DELETE FROM project_plugin_configs
|
|
206
206
|
WHERE plugin_id = 'object-storage'
|
|
207
|
-
`.execute(t)}async function
|
|
207
|
+
`.execute(t)}async function Xu(t){}var oe={};i(oe,{up:()=>Su,down:()=>Fu});import{sql as ai}from"kysely";async function Su(t){await t.schema.alterTable("automation_triggers").addColumn("next_run_at","text").execute(),await ai`CREATE INDEX idx_automation_triggers_next_run ON automation_triggers (next_run_at) WHERE type = 'cron'`.execute(t)}async function Fu(t){await ai`DROP INDEX IF EXISTS idx_automation_triggers_next_run`.execute(t),await t.schema.alterTable("automation_triggers").dropColumn("next_run_at").execute()}var me={};i(me,{up:()=>Mu,down:()=>Qu});import{sql as _e}from"kysely";async function Mu(t){await t.schema.alterTable("connections").addColumn("subtype","text").execute(),await _e`
|
|
208
208
|
ALTER TABLE connections
|
|
209
209
|
ADD CONSTRAINT chk_connections_subtype
|
|
210
210
|
CHECK (subtype IN ('agent', 'project') OR subtype IS NULL)
|
|
@@ -212,17 +212,17 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
212
212
|
UPDATE connections
|
|
213
213
|
SET subtype = 'agent'
|
|
214
214
|
WHERE connection_type = 'VIRTUAL'
|
|
215
|
-
`.execute(t),await t.schema.createTable("virtual_mcp_plugin_configs").addColumn("id","text",(_)=>_.primaryKey()).addColumn("virtual_mcp_id","text",(_)=>_.notNull().references("connections.id").onDelete("cascade")).addColumn("plugin_id","text",(_)=>_.notNull()).addColumn("connection_id","text",(_)=>_.references("connections.id").onDelete("set null")).addColumn("settings","text").addColumn("created_at","text",(_)=>_.notNull()).addColumn("updated_at","text",(_)=>_.notNull()).execute(),await t.schema.createIndex("idx_vmpc_unique").on("virtual_mcp_plugin_configs").columns(["virtual_mcp_id","plugin_id"]).unique().execute(),await t.schema.createIndex("idx_vmpc_virtual_mcp_id").on("virtual_mcp_plugin_configs").columns(["virtual_mcp_id"]).execute();let e=await t.selectFrom("projects").select(["id","organization_id","slug","name","description","enabled_plugins","ui","created_at","updated_at"]).execute(),n=await t.selectFrom("member").select(["organizationId","userId"]).where("role","=","owner").execute(),u=new Map;for(let _ of n)u.set(_.organizationId,_.userId);let a=new Map;for(let _ of e){let x=`vir_${
|
|
215
|
+
`.execute(t),await t.schema.createTable("virtual_mcp_plugin_configs").addColumn("id","text",(_)=>_.primaryKey()).addColumn("virtual_mcp_id","text",(_)=>_.notNull().references("connections.id").onDelete("cascade")).addColumn("plugin_id","text",(_)=>_.notNull()).addColumn("connection_id","text",(_)=>_.references("connections.id").onDelete("set null")).addColumn("settings","text").addColumn("created_at","text",(_)=>_.notNull()).addColumn("updated_at","text",(_)=>_.notNull()).execute(),await t.schema.createIndex("idx_vmpc_unique").on("virtual_mcp_plugin_configs").columns(["virtual_mcp_id","plugin_id"]).unique().execute(),await t.schema.createIndex("idx_vmpc_virtual_mcp_id").on("virtual_mcp_plugin_configs").columns(["virtual_mcp_id"]).execute();let e=await t.selectFrom("projects").select(["id","organization_id","slug","name","description","enabled_plugins","ui","created_at","updated_at"]).execute(),n=await t.selectFrom("member").select(["organizationId","userId"]).where("role","=","owner").execute(),u=new Map;for(let _ of n)u.set(_.organizationId,_.userId);let a=new Map;for(let _ of e){let x=`vir_${R()}`;a.set(_.id,x);let r=_.ui?JSON.parse(_.ui):null,y=JSON.stringify({enabled_plugins:_.enabled_plugins?JSON.parse(_.enabled_plugins):null,ui:r,migrated_from_project:_.id,migrated_project_slug:_.slug}),f=u.get(_.organization_id);if(!f)continue;await t.insertInto("connections").values({id:x,organization_id:_.organization_id,created_by:f,updated_by:null,title:_.name,description:_.description,icon:r?.icon??null,app_name:null,app_id:null,connection_type:"VIRTUAL",connection_url:`virtual://${x}`,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:y,bindings:null,status:"active",subtype:"project",created_at:_.created_at,updated_at:_.updated_at}).execute()}let o=await t.selectFrom("project_connections").select(["project_id","connection_id","created_at"]).execute();for(let _ of o){let x=a.get(_.project_id);if(!x)continue;await t.insertInto("connection_aggregations").values({id:`agg_${R()}`,parent_connection_id:x,child_connection_id:_.connection_id,selected_tools:null,selected_resources:null,selected_prompts:null,dependency_mode:"direct",created_at:_.created_at}).onConflict((r)=>r.doNothing()).execute()}let m=await t.selectFrom("project_plugin_configs").select(["id","project_id","plugin_id","connection_id","settings","created_at","updated_at"]).execute();for(let _ of m){let x=a.get(_.project_id);if(!x)continue;await t.insertInto("virtual_mcp_plugin_configs").values({id:`vpc_${R()}`,virtual_mcp_id:x,plugin_id:_.plugin_id,connection_id:_.connection_id,settings:_.settings,created_at:_.created_at,updated_at:_.updated_at}).execute()}await t.schema.dropTable("project_plugin_configs").execute(),await t.schema.dropTable("project_connections").execute(),await t.schema.dropTable("projects").execute()}async function Qu(t){await t.schema.dropTable("virtual_mcp_plugin_configs").ifExists().execute(),await t.schema.dropIndex("idx_connections_org_type_subtype").ifExists().execute(),await _e`
|
|
216
216
|
ALTER TABLE connections
|
|
217
217
|
DROP CONSTRAINT IF EXISTS chk_connections_subtype
|
|
218
|
-
`.execute(t),await t.schema.alterTable("connections").dropColumn("subtype").execute()}var xe={};i(xe,{up:()=>
|
|
218
|
+
`.execute(t),await t.schema.alterTable("connections").dropColumn("subtype").execute()}var xe={};i(xe,{up:()=>Zu,down:()=>Hu});import{sql as Ou}from"kysely";async function Zu(t){await Ou`
|
|
219
219
|
DELETE FROM connections
|
|
220
220
|
WHERE connection_type = 'VIRTUAL'
|
|
221
221
|
AND subtype = 'project'
|
|
222
222
|
AND metadata::json->>'migrated_project_slug' = 'org-admin'
|
|
223
|
-
`.execute(t)}async function
|
|
223
|
+
`.execute(t)}async function Hu(t){}var re={};i(re,{up:()=>Bu,down:()=>Iu});import{sql as Yu}from"kysely";async function Bu(t){await t.schema.alterTable("threads").addColumn("run_owner_pod","text").addColumn("run_config","jsonb").addColumn("run_started_at","timestamptz").execute(),await Yu`CREATE INDEX idx_threads_run_owner ON threads (status, run_owner_pod) WHERE status = 'in_progress'`.execute(t)}async function Iu(t){await t.schema.dropIndex("idx_threads_run_owner").ifExists().execute(),await t.schema.alterTable("threads").dropColumn("run_owner_pod").dropColumn("run_config").dropColumn("run_started_at").execute()}var ce={};i(ce,{up:()=>Gu,down:()=>vu});import{sql as ye}from"kysely";async function Gu(t){await t.schema.createTable("org_sso_config").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("issuer","text",(e)=>e.notNull()).addColumn("client_id","text",(e)=>e.notNull()).addColumn("client_secret","text",(e)=>e.notNull()).addColumn("discovery_endpoint","text").addColumn("scopes","text",(e)=>e.notNull().defaultTo('["openid","email","profile"]')).addColumn("domain","text",(e)=>e.notNull()).addColumn("enforced","integer",(e)=>e.notNull().defaultTo(0)).addColumn("created_at","text",(e)=>e.notNull().defaultTo(ye`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(ye`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_org_sso_config_org_id").unique().on("org_sso_config").column("organization_id").execute(),await t.schema.createIndex("idx_org_sso_config_domain").on("org_sso_config").column("domain").execute(),await t.schema.createTable("org_sso_sessions").addColumn("id","text",(e)=>e.primaryKey()).addColumn("user_id","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("authenticated_at","text",(e)=>e.notNull()).addColumn("expires_at","text",(e)=>e.notNull()).addColumn("created_at","text",(e)=>e.notNull().defaultTo(ye`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_org_sso_sessions_user_org").unique().on("org_sso_sessions").columns(["user_id","organization_id"]).execute()}async function vu(t){await t.schema.dropTable("org_sso_sessions").execute(),await t.schema.dropTable("org_sso_config").execute()}var fe={};i(fe,{up:()=>Vu,down:()=>qu});async function Vu(t){await t.schema.alterTable("threads").addColumn("agent_ids","text",(e)=>e.defaultTo("[]")).execute()}async function qu(t){await t.schema.alterTable("threads").dropColumn("agent_ids").execute()}var Te={};i(Te,{up:()=>lu,down:()=>du});async function lu(t){await t.schema.alterTable("organization_settings").addColumn("registry_config","text").execute()}async function du(t){await t.schema.alterTable("organization_settings").dropColumn("registry_config").execute()}var se={};i(se,{up:()=>to,down:()=>eo});import{sql as ui}from"kysely";function pe(t){return t.toLowerCase().trim().replace(/\//g,"-").replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function bu(t){if(t.app_name)return t.app_name;if(t.connection_url)try{let e=new URL(t.connection_url),u=((e.port?`${e.hostname}-${e.port}`:e.hostname)+e.pathname).replace(/\/+$/,"");return pe(u)}catch{return pe(t.connection_url)}if(t.title)return pe(t.title);return t.id}async function to(t){await t.schema.alterTable("connections").addColumn("slug","text").execute();let e=await ui`
|
|
224
224
|
SELECT id, app_name, connection_url, title FROM connections
|
|
225
|
-
`.execute(t);for(let n of e.rows){let u=
|
|
225
|
+
`.execute(t);for(let n of e.rows){let u=bu(n);await ui`UPDATE connections SET slug = ${u} WHERE id = ${n.id}`.execute(t)}await t.schema.createIndex("idx_connections_org_slug").on("connections").columns(["organization_id","slug"]).execute()}async function eo(t){await t.schema.dropIndex("idx_connections_org_slug").execute(),await t.schema.alterTable("connections").dropColumn("slug").execute()}var we={};i(we,{up:()=>no,down:()=>io});import{sql as Q}from"kysely";async function no(t){await t.schema.alterTable("connections").addColumn("pinned","boolean",(e)=>e.notNull().defaultTo(!1)).execute(),await Q`UPDATE connections SET pinned = true WHERE subtype = 'project' AND connection_type = 'VIRTUAL'`.execute(t),await t.schema.dropIndex("idx_connections_org_type_subtype").ifExists().execute(),await Q`ALTER TABLE connections DROP CONSTRAINT IF EXISTS chk_connections_subtype`.execute(t),await t.schema.alterTable("connections").dropColumn("subtype").execute(),await t.schema.createIndex("idx_connections_org_type_pinned").on("connections").columns(["organization_id","connection_type","pinned"]).execute()}async function io(t){await t.schema.dropIndex("idx_connections_org_type_pinned").ifExists().execute(),await t.schema.alterTable("connections").addColumn("subtype","text").execute(),await Q`UPDATE connections SET subtype = 'project' WHERE pinned = true AND connection_type = 'VIRTUAL'`.execute(t),await Q`UPDATE connections SET subtype = 'agent' WHERE pinned = false AND connection_type = 'VIRTUAL'`.execute(t),await Q`ALTER TABLE connections ADD CONSTRAINT chk_connections_subtype CHECK (subtype IN ('agent', 'project') OR subtype IS NULL)`.execute(t),await t.schema.createIndex("idx_connections_org_type_subtype").on("connections").columns(["organization_id","connection_type","subtype"]).execute(),await t.schema.alterTable("connections").dropColumn("pinned").execute()}var Ce={};i(Ce,{up:()=>ao,down:()=>uo});async function ao(t){await t.schema.alterTable("automations").addColumn("virtual_mcp_id","text").execute(),await t.schema.createIndex("idx_automations_virtual_mcp").on("automations").columns(["virtual_mcp_id"]).execute()}async function uo(t){await t.schema.dropIndex("idx_automations_virtual_mcp").execute(),await t.schema.alterTable("automations").dropColumn("virtual_mcp_id").execute()}var Ne={};i(Ne,{up:()=>oo,down:()=>_o});import{sql as l}from"kysely";async function oo(t){await t.schema.alterTable("threads").addColumn("virtual_mcp_id","text",(e)=>e.notNull().defaultTo("")).execute(),await l`
|
|
226
226
|
UPDATE threads
|
|
227
227
|
SET virtual_mcp_id = (agent_ids::jsonb ->> 0)
|
|
228
228
|
WHERE agent_ids IS NOT NULL
|
|
@@ -232,34 +232,34 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
232
232
|
`.execute(t),await l`
|
|
233
233
|
CREATE INDEX idx_threads_virtual_mcp_id
|
|
234
234
|
ON threads (organization_id, virtual_mcp_id, hidden, updated_at DESC)
|
|
235
|
-
`.execute(t),await t.schema.alterTable("threads").dropColumn("agent_ids").execute()}async function
|
|
235
|
+
`.execute(t),await t.schema.alterTable("threads").dropColumn("agent_ids").execute()}async function _o(t){await t.schema.alterTable("threads").addColumn("agent_ids","text",(e)=>e.defaultTo("[]")).execute(),await l`
|
|
236
236
|
UPDATE threads
|
|
237
237
|
SET agent_ids = CASE
|
|
238
238
|
WHEN virtual_mcp_id IS NOT NULL AND virtual_mcp_id != ''
|
|
239
239
|
THEN jsonb_build_array(virtual_mcp_id)::text
|
|
240
240
|
ELSE '[]'
|
|
241
241
|
END
|
|
242
|
-
`.execute(t),await l`DROP INDEX IF EXISTS idx_threads_virtual_mcp_id`.execute(t),await t.schema.alterTable("threads").dropColumn("virtual_mcp_id").execute()}var
|
|
242
|
+
`.execute(t),await l`DROP INDEX IF EXISTS idx_threads_virtual_mcp_id`.execute(t),await t.schema.alterTable("threads").dropColumn("virtual_mcp_id").execute()}var Ee={};i(Ee,{up:()=>mo,down:()=>xo});async function mo(t){await t.schema.createTable("trigger_callback_tokens").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull()).addColumn("connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("token_hash","text",(e)=>e.notNull().unique()).addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo("now()")).execute(),await t.schema.createIndex("idx_trigger_callback_tokens_connection_org").on("trigger_callback_tokens").columns(["connection_id","organization_id"]).unique().execute()}async function xo(t){await t.schema.dropTable("trigger_callback_tokens").execute()}var he={};i(he,{up:()=>ro,down:()=>yo});async function ro(t){await t.schema.createTable("kv").addColumn("organization_id","text",(e)=>e.notNull()).addColumn("key","text",(e)=>e.notNull()).addColumn("value","jsonb",(e)=>e.notNull()).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo("now()")).addPrimaryKeyConstraint("kv_pkey",["organization_id","key"]).execute()}async function yo(t){await t.schema.dropTable("kv").execute()}var Ke={};i(Ke,{up:()=>co,down:()=>fo});async function co(t){await t.schema.createIndex("idx_member_user_org").ifNotExists().on("member").columns(["userId","organizationId"]).execute()}async function fo(t){await t.schema.dropIndex("idx_member_user_org").execute()}var ke={};i(ke,{up:()=>To,down:()=>po});async function To(t){await t.schema.createIndex("idx_downstream_tokens_connectionId").ifNotExists().on("downstream_tokens").column("connectionId").unique().execute()}async function po(t){await t.schema.dropIndex("idx_downstream_tokens_connectionId").ifExists().execute()}var Pe={};i(Pe,{up:()=>so,down:()=>wo});import{sql as s}from"kysely";async function so(t){await t.schema.createTable("private_registry_item").ifNotExists().addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(e)=>e.notNull()).addColumn("description","text").addColumn("server_json","text",(e)=>e.notNull()).addColumn("meta_json","text").addColumn("tags","text").addColumn("categories","text").addColumn("is_public","integer",(e)=>e.notNull().defaultTo(0)).addColumn("created_at","text",(e)=>e.notNull().defaultTo(s`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(s`CURRENT_TIMESTAMP`)).addColumn("created_by","text",(e)=>e.references("user.id").onDelete("set null")).execute(),await t.schema.createIndex("idx_private_registry_item_org").ifNotExists().on("private_registry_item").column("organization_id").execute(),await t.schema.createIndex("idx_private_registry_item_org_public").ifNotExists().on("private_registry_item").columns(["organization_id","is_public"]).execute(),await s`ALTER TABLE private_registry_item ADD COLUMN IF NOT EXISTS is_unlisted integer NOT NULL DEFAULT 0`.execute(t),await t.schema.createTable("private_registry_publish_request").ifNotExists().addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("status","text",(e)=>e.notNull().defaultTo("pending")).addColumn("title","text",(e)=>e.notNull()).addColumn("description","text").addColumn("server_json","text",(e)=>e.notNull()).addColumn("meta_json","text").addColumn("requester_name","text").addColumn("requester_email","text").addColumn("reviewer_notes","text").addColumn("created_at","text",(e)=>e.notNull().defaultTo(s`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(s`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_private_registry_publish_request_org_status").ifNotExists().on("private_registry_publish_request").columns(["organization_id","status"]).execute(),await s`ALTER TABLE private_registry_publish_request ADD COLUMN IF NOT EXISTS requested_id text`.execute(t),await t.schema.createTable("private_registry_publish_api_key").ifNotExists().addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("name","text",(e)=>e.notNull()).addColumn("key_hash","text",(e)=>e.notNull()).addColumn("prefix","text",(e)=>e.notNull()).addColumn("created_at","text",(e)=>e.notNull().defaultTo(s`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_private_registry_publish_api_key_org").ifNotExists().on("private_registry_publish_api_key").columns(["organization_id"]).execute(),await t.schema.createTable("private_registry_monitor_run").ifNotExists().addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("status","text",(e)=>e.notNull().defaultTo("pending")).addColumn("config_snapshot","text").addColumn("total_items","integer",(e)=>e.notNull().defaultTo(0)).addColumn("tested_items","integer",(e)=>e.notNull().defaultTo(0)).addColumn("passed_items","integer",(e)=>e.notNull().defaultTo(0)).addColumn("failed_items","integer",(e)=>e.notNull().defaultTo(0)).addColumn("skipped_items","integer",(e)=>e.notNull().defaultTo(0)).addColumn("current_item_id","text").addColumn("started_at","text").addColumn("finished_at","text").addColumn("created_at","text",(e)=>e.notNull().defaultTo(s`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_private_registry_monitor_run_org_created").ifNotExists().on("private_registry_monitor_run").columns(["organization_id","created_at"]).execute(),await t.schema.createTable("private_registry_monitor_result").ifNotExists().addColumn("id","text",(e)=>e.primaryKey()).addColumn("run_id","text",(e)=>e.notNull().references("private_registry_monitor_run.id").onDelete("cascade")).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("item_id","text",(e)=>e.notNull()).addColumn("item_title","text",(e)=>e.notNull()).addColumn("status","text",(e)=>e.notNull()).addColumn("error_message","text").addColumn("connection_ok","integer",(e)=>e.notNull().defaultTo(0)).addColumn("tools_listed","integer",(e)=>e.notNull().defaultTo(0)).addColumn("tool_results","text").addColumn("agent_summary","text").addColumn("duration_ms","integer",(e)=>e.notNull().defaultTo(0)).addColumn("action_taken","text",(e)=>e.notNull().defaultTo("none")).addColumn("tested_at","text",(e)=>e.notNull().defaultTo(s`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_private_registry_monitor_result_run").ifNotExists().on("private_registry_monitor_result").columns(["run_id","tested_at"]).execute(),await t.schema.createIndex("idx_private_registry_monitor_result_run_status").ifNotExists().on("private_registry_monitor_result").columns(["run_id","status"]).execute(),await t.schema.createTable("private_registry_monitor_connection").ifNotExists().addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("item_id","text",(e)=>e.notNull()).addColumn("connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("auth_status","text",(e)=>e.notNull().defaultTo("none")).addColumn("created_at","text",(e)=>e.notNull().defaultTo(s`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(e)=>e.notNull().defaultTo(s`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_private_registry_monitor_connection_org_item").ifNotExists().on("private_registry_monitor_connection").columns(["organization_id","item_id"]).unique().execute()}async function wo(t){await t.schema.dropIndex("idx_private_registry_monitor_connection_org_item").ifExists().execute(),await t.schema.dropTable("private_registry_monitor_connection").ifExists().execute(),await t.schema.dropIndex("idx_private_registry_monitor_result_run_status").ifExists().execute(),await t.schema.dropIndex("idx_private_registry_monitor_result_run").ifExists().execute(),await t.schema.dropTable("private_registry_monitor_result").ifExists().execute(),await t.schema.dropIndex("idx_private_registry_monitor_run_org_created").ifExists().execute(),await t.schema.dropTable("private_registry_monitor_run").ifExists().execute(),await t.schema.dropIndex("idx_private_registry_publish_api_key_org").ifExists().execute(),await t.schema.dropTable("private_registry_publish_api_key").ifExists().execute(),await t.schema.dropIndex("idx_private_registry_publish_request_org_status").ifExists().execute(),await t.schema.dropTable("private_registry_publish_request").ifExists().execute(),await t.schema.dropIndex("idx_private_registry_item_org_public").ifExists().execute(),await t.schema.dropIndex("idx_private_registry_item_org").ifExists().execute(),await t.schema.dropTable("private_registry_item").ifExists().execute()}var ze={};i(ze,{up:()=>Co,down:()=>No});import{sql as g}from"kysely";async function Co(t){await g`
|
|
243
243
|
ALTER TABLE event_subscriptions
|
|
244
244
|
ALTER COLUMN enabled DROP DEFAULT
|
|
245
|
-
`.execute(t),await
|
|
245
|
+
`.execute(t),await g`
|
|
246
246
|
ALTER TABLE event_subscriptions
|
|
247
247
|
ALTER COLUMN enabled TYPE boolean
|
|
248
248
|
USING enabled::boolean
|
|
249
|
-
`.execute(t),await
|
|
249
|
+
`.execute(t),await g`
|
|
250
250
|
ALTER TABLE event_subscriptions
|
|
251
251
|
ALTER COLUMN enabled SET DEFAULT true
|
|
252
|
-
`.execute(t)}async function
|
|
252
|
+
`.execute(t)}async function No(t){await g`
|
|
253
253
|
ALTER TABLE event_subscriptions
|
|
254
254
|
ALTER COLUMN enabled DROP DEFAULT
|
|
255
|
-
`.execute(t),await
|
|
255
|
+
`.execute(t),await g`
|
|
256
256
|
ALTER TABLE event_subscriptions
|
|
257
257
|
ALTER COLUMN enabled TYPE integer
|
|
258
258
|
USING enabled::integer
|
|
259
|
-
`.execute(t),await
|
|
259
|
+
`.execute(t),await g`
|
|
260
260
|
ALTER TABLE event_subscriptions
|
|
261
261
|
ALTER COLUMN enabled SET DEFAULT 1
|
|
262
|
-
`.execute(t)}var Ue={};i(Ue,{up:()=>
|
|
262
|
+
`.execute(t)}var Ue={};i(Ue,{up:()=>Eo,down:()=>ho});import{sql as oi}from"kysely";async function Eo(t){await t.schema.createTable("brand_context").addColumn("id","text",(e)=>e.primaryKey().notNull()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("name","text",(e)=>e.notNull()).addColumn("domain","text",(e)=>e.notNull()).addColumn("overview","text",(e)=>e.notNull()).addColumn("logo","text").addColumn("favicon","text").addColumn("og_image","text").addColumn("fonts","text").addColumn("colors","text").addColumn("images","text").addColumn("metadata","text").addColumn("archived_at","timestamptz").addColumn("is_default","boolean",(e)=>e.notNull().defaultTo(!1)).addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(oi`now()`)).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo(oi`now()`)).execute(),await t.schema.createIndex("brand_context_organization_id_idx").on("brand_context").column("organization_id").execute()}async function ho(t){await t.schema.dropTable("brand_context").execute()}var De={};i(De,{up:()=>Ko,down:()=>ko});import{sql as _i}from"kysely";async function Ko(t){await t.schema.createTable("organization_domains").addColumn("organization_id","text",(e)=>e.primaryKey().notNull().references("organization.id").onDelete("cascade")).addColumn("domain","text",(e)=>e.notNull().unique()).addColumn("auto_join_enabled","boolean",(e)=>e.notNull().defaultTo(!1)).addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(_i`now()`)).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo(_i`now()`)).execute()}async function ko(t){await t.schema.dropTable("organization_domains").execute()}var Le={};i(Le,{up:()=>Do,down:()=>Lo});import{sql as mi}from"kysely";var d=new Set(["primary","secondary","accent","background","foreground"]),Po={heading:"heading",headings:"heading",head:"heading",title:"heading",body:"body",primary:"body",text:"body",code:"code",monospace:"code",mono:"code"};function zo(t){let e={};if(!t)return{structured:null,extra:e};if(!Array.isArray(t)&&typeof t==="object"){let n=t;if(Object.keys(n).some((a)=>d.has(a))){let a={};for(let[o,m]of Object.entries(n)){if(typeof m!=="string")continue;if(d.has(o))a[o]=m;else e[o]=m}return{structured:Object.keys(a).length>0?JSON.stringify(a):null,extra:e}}let u={};for(let[a,o]of Object.entries(n)){if(typeof o!=="string")continue;if(d.has(a.toLowerCase()))u[a.toLowerCase()]=o;else e[a]=o}return{structured:Object.keys(u).length>0?JSON.stringify(u):null,extra:e}}if(Array.isArray(t)){let n={};for(let u of t){let a=u,o=a.label?.toLowerCase?.(),m=a.value;if(!o||!m)continue;if(d.has(o))n[o]=m;else e[o]=m}return{structured:Object.keys(n).length>0?JSON.stringify(n):null,extra:e}}return{structured:null,extra:e}}function Uo(t){if(!t)return null;if(!Array.isArray(t)&&typeof t==="object"){let e=t;if(typeof e.heading==="string"||typeof e.body==="string"||typeof e.code==="string")return JSON.stringify(e);return null}if(Array.isArray(t)){let e={},n=[];for(let u of t){let a=u,o=a.name??a.family??void 0,m=a.role?.toLowerCase?.()??"";if(!o)continue;let _=Po[m];if(_&&!e[_])e[_]=o;else n.push(o)}if(!e.body&&n[0])e.body=n[0];return Object.keys(e).length>0?JSON.stringify(e):null}return null}async function Do(t){let e=await mi`SELECT id, colors, fonts, metadata FROM brand_context`.execute(t);for(let n of e.rows){let u=!1,a=!1,o=!1,m=n.colors,_=n.fonts,x={};try{x=n.metadata?JSON.parse(n.metadata):{}}catch{}if(n.colors)try{let r=JSON.parse(n.colors);if(Array.isArray(r)){let y=zo(r);if(m=y.structured,u=!0,Object.keys(y.extra).length>0)x.extraColors=y.extra,o=!0}}catch{}if(n.fonts)try{let r=JSON.parse(n.fonts);if(Array.isArray(r))_=Uo(r),a=!0}catch{}if(u||a||o){let r=o?JSON.stringify(x):n.metadata;await mi`
|
|
263
263
|
UPDATE brand_context
|
|
264
264
|
SET
|
|
265
265
|
colors = ${m},
|
|
@@ -267,20 +267,20 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
267
267
|
metadata = ${r},
|
|
268
268
|
updated_at = NOW()
|
|
269
269
|
WHERE id = ${n.id}
|
|
270
|
-
`.execute(t)}}}async function
|
|
270
|
+
`.execute(t)}}}async function Lo(t){}var je={};i(je,{up:()=>Ro,down:()=>go});import{sql as jo}from"kysely";async function Ro(t){await t.schema.alterTable("threads").addColumn("metadata","jsonb",(e)=>e.notNull().defaultTo(jo`'{}'::jsonb`)).execute()}async function go(t){await t.schema.alterTable("threads").dropColumn("metadata").execute()}var Re={};i(Re,{up:()=>Jo,down:()=>Ao});async function Jo(t){await t.schema.alterTable("threads").addColumn("branch","text").execute()}async function Ao(t){await t.schema.alterTable("threads").dropColumn("branch").execute()}var ge={};i(ge,{up:()=>Wo,down:()=>$o});async function Wo(t){await t.schema.createTable("sandbox_runner_state").addColumn("user_id","text",(e)=>e.notNull()).addColumn("project_ref","text",(e)=>e.notNull()).addColumn("runner_kind","text",(e)=>e.notNull()).addColumn("handle","text",(e)=>e.notNull()).addColumn("state","jsonb",(e)=>e.notNull()).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo("now()")).addPrimaryKeyConstraint("sandbox_runner_state_pkey",["user_id","project_ref","runner_kind"]).execute(),await t.schema.createIndex("sandbox_runner_state_handle_idx").on("sandbox_runner_state").column("handle").unique().execute()}async function $o(t){await t.schema.dropTable("sandbox_runner_state").execute()}var Je={};i(Je,{up:()=>Xo,down:()=>So});async function Xo(t){await t.schema.alterTable("organization_settings").addColumn("simple_mode","text").execute()}async function So(t){await t.schema.alterTable("organization_settings").dropColumn("simple_mode").execute()}var Ae={};i(Ae,{up:()=>Fo,down:()=>Mo});async function Fo(t){await t.schema.alterTable("organization_settings").addColumn("default_home_agents","text").execute()}async function Mo(t){await t.schema.alterTable("organization_settings").dropColumn("default_home_agents").execute()}var We={};i(We,{up:()=>Qo,down:()=>Oo});async function Qo(t){await t.schema.alterTable("ai_provider_keys").addColumn("preset_id","text").execute()}async function Oo(t){await t.schema.alterTable("ai_provider_keys").dropColumn("preset_id").execute()}var $e={};i($e,{up:()=>Ho,down:()=>Yo});import{sql as xi}from"kysely";var Zo=["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","AUTOMATION_GET","AUTOMATION_LIST","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","VM_START","VM_DELETE"];async function Ho(t){let e=await xi`
|
|
271
271
|
SELECT id, permission FROM "organizationRole"
|
|
272
|
-
`.execute(t);for(let n of e.rows){if(!n.permission)continue;let u;try{u=JSON.parse(n.permission)}catch{continue}let a=u.self;if(!Array.isArray(a))continue;if(a.length===1&&a[0]==="*")continue;let o=a,m=Array.from(new Set([...o,...
|
|
272
|
+
`.execute(t);for(let n of e.rows){if(!n.permission)continue;let u;try{u=JSON.parse(n.permission)}catch{continue}let a=u.self;if(!Array.isArray(a))continue;if(a.length===1&&a[0]==="*")continue;let o=a,m=Array.from(new Set([...o,...Zo]));if(m.length===o.length)continue;u.self=m;let _=JSON.stringify(u);await xi`
|
|
273
273
|
UPDATE "organizationRole"
|
|
274
274
|
SET permission = ${_}
|
|
275
275
|
WHERE id = ${n.id}
|
|
276
|
-
`.execute(t)}}async function
|
|
276
|
+
`.execute(t)}}async function Yo(t){}var Xe={};i(Xe,{up:()=>Bo,down:()=>Io});async function Bo(t){await t.schema.dropIndex("sandbox_runner_state_handle_idx").execute(),await t.schema.createIndex("sandbox_runner_state_handle_idx").on("sandbox_runner_state").column("handle").execute()}async function Io(t){await t.schema.dropIndex("sandbox_runner_state_handle_idx").execute(),await t.schema.createIndex("sandbox_runner_state_handle_idx").on("sandbox_runner_state").column("handle").unique().execute()}var Se={};i(Se,{up:()=>Go,down:()=>vo});async function Go(t){await t.schema.alterTable("threads").addColumn("inflight_async_jobs","jsonb").execute()}async function vo(t){await t.schema.alterTable("threads").dropColumn("inflight_async_jobs").execute()}var Fe={};i(Fe,{up:()=>Vo,down:()=>qo});import{sql as O}from"kysely";async function Vo(t){await O`
|
|
277
277
|
UPDATE automations
|
|
278
278
|
SET virtual_mcp_id = (agent::json ->> 'id')
|
|
279
279
|
WHERE virtual_mcp_id IS NULL
|
|
280
280
|
`.execute(t),await O`
|
|
281
281
|
ALTER TABLE automations
|
|
282
282
|
ALTER COLUMN virtual_mcp_id SET NOT NULL
|
|
283
|
-
`.execute(t),await t.schema.alterTable("automations").dropColumn("agent").execute()}async function
|
|
283
|
+
`.execute(t),await t.schema.alterTable("automations").dropColumn("agent").execute()}async function qo(t){await t.schema.alterTable("automations").addColumn("agent","text").execute(),await O`
|
|
284
284
|
UPDATE automations
|
|
285
285
|
SET agent = json_build_object('id', virtual_mcp_id)::text
|
|
286
286
|
`.execute(t),await O`
|
|
@@ -289,7 +289,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
289
289
|
`.execute(t),await O`
|
|
290
290
|
ALTER TABLE automations
|
|
291
291
|
ALTER COLUMN virtual_mcp_id DROP NOT NULL
|
|
292
|
-
`.execute(t)}var Qe={};i(Qe,{up:()=>
|
|
292
|
+
`.execute(t)}var Qe={};i(Qe,{up:()=>e_,reshapeSimpleMode:()=>ri,inferAutomationTier:()=>yi,down:()=>n_,__testing:()=>t_});var lo={tiers:{fast:null,smart:null,thinking:null,image:null,web_research:null}},bo=["fast","smart","thinking","image","web_research"];function Me(t){if(!t||typeof t!=="object")return!1;let e=t;if(!("tiers"in e))return!1;let n=e.tiers;if(!n||typeof n!=="object")return!1;return bo.some((u)=>(u in n))}function ri(t){if(Me(t))return t;let e=t,n=e?.enabled===!0,u=(a)=>a&&a.keyId&&a.modelId?{keyId:a.keyId,modelId:a.modelId,title:a.title}:null;if(!n)return lo;return{tiers:{fast:u(e?.chat?.fast),smart:u(e?.chat?.smart),thinking:u(e?.chat?.thinking),image:u(e?.image),web_research:u(e?.webResearch)}}}function yi(t){if(t.tier==="fast"||t.tier==="smart"||t.tier==="thinking")return t.tier;if(t.thinking?.capabilities?.reasoning===!0)return"thinking";return"smart"}function ci(t){if(!(t.tier==="fast"||t.tier==="smart"||t.tier==="thinking"))return!1;return["credentialId","thinking","coding","fast","smart"].every((u)=>t[u]===void 0)}var t_={isAlreadyReshapedSimpleMode:Me,isAlreadyReshapedAutomationModels:ci};async function e_(t){let e=await t.selectFrom("organization_settings").select(["organizationId","simple_mode"]).execute();for(let u of e){let a=u.simple_mode?typeof u.simple_mode==="string"?JSON.parse(u.simple_mode):u.simple_mode:null;if(Me(a))continue;let o=ri(a);await t.updateTable("organization_settings").set({simple_mode:JSON.stringify(o)}).where("organizationId","=",u.organizationId).execute()}let n=await t.selectFrom("automations").select(["id","organization_id","models"]).execute();for(let u of n){let a;try{a=typeof u.models==="string"?JSON.parse(u.models):u.models}catch{a={}}if(ci(a))continue;let o=yi(a);if(await t.updateTable("automations").set({models:JSON.stringify({tier:o})}).where("id","=",u.id).execute(),a.thinking?.capabilities?.image)console.log(`[migration 077] automation ${u.id} previously used an image-only model; mapped to "${o}"`)}}async function n_(t){throw Error("077-tier-only-model-selection is not reversible. Restore from snapshot.")}var Oe={};i(Oe,{up:()=>i_,down:()=>a_});import{sql as k}from"kysely";async function i_(t){await t.schema.alterTable("automations").addColumn("kind","text",(e)=>e.notNull().defaultTo("agent")).addColumn("connection_id","text").addColumn("tool_name","text").addColumn("tool_input","text").execute(),await k`
|
|
293
293
|
ALTER TABLE automations
|
|
294
294
|
ALTER COLUMN virtual_mcp_id DROP NOT NULL
|
|
295
295
|
`.execute(t),await k`
|
|
@@ -311,19 +311,19 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
311
311
|
AND tool_input IS NOT NULL
|
|
312
312
|
)
|
|
313
313
|
)
|
|
314
|
-
`.execute(t)}async function
|
|
314
|
+
`.execute(t)}async function a_(t){await k`ALTER TABLE automations DROP CONSTRAINT chk_automation_tool_call_fields`.execute(t),await k`ALTER TABLE automations DROP CONSTRAINT chk_automation_agent_fields`.execute(t),await k`ALTER TABLE automations DROP CONSTRAINT chk_automation_kind`.execute(t),await k`DELETE FROM automations WHERE kind = 'tool_call'`.execute(t),await k`
|
|
315
315
|
ALTER TABLE automations
|
|
316
316
|
ALTER COLUMN virtual_mcp_id SET NOT NULL
|
|
317
|
-
`.execute(t),await t.schema.alterTable("automations").dropColumn("tool_input").dropColumn("tool_name").dropColumn("connection_id").dropColumn("kind").execute()}var Ze={};i(Ze,{up:()=>
|
|
317
|
+
`.execute(t),await t.schema.alterTable("automations").dropColumn("tool_input").dropColumn("tool_name").dropColumn("connection_id").dropColumn("kind").execute()}var Ze={};i(Ze,{up:()=>o_,down:()=>__});import{sql as fi}from"kysely";var u_=new Set(["host","docker","agent-sandbox"]);async function o_(t){let e=await fi`
|
|
318
318
|
SELECT id, metadata FROM "connections"
|
|
319
319
|
WHERE connection_type = 'VIRTUAL'
|
|
320
320
|
AND metadata IS NOT NULL
|
|
321
321
|
AND metadata LIKE '%vmMap%'
|
|
322
|
-
`.execute(t);for(let n of e.rows){if(!n.metadata)continue;let u;try{u=JSON.parse(n.metadata)}catch{continue}let a=u.vmMap;if(!a||typeof a!=="object")continue;let o=!1,m={};for(let[x,r]of Object.entries(a)){if(!r||typeof r!=="object"){o=!0;continue}let
|
|
322
|
+
`.execute(t);for(let n of e.rows){if(!n.metadata)continue;let u;try{u=JSON.parse(n.metadata)}catch{continue}let a=u.vmMap;if(!a||typeof a!=="object")continue;let o=!1,m={};for(let[x,r]of Object.entries(a)){if(!r||typeof r!=="object"){o=!0;continue}let y={};for(let[f,c]of Object.entries(r)){if(!c||typeof c!=="object"){o=!0;continue}let N=c.runnerKind;if(N!==void 0&&!u_.has(N)){o=!0;continue}y[f]=c}if(Object.keys(y).length>0)m[x]=y;else o=!0}if(!o)continue;u.vmMap=m;let _=JSON.stringify(u);await fi`
|
|
323
323
|
UPDATE "connections"
|
|
324
324
|
SET metadata = ${_}
|
|
325
325
|
WHERE id = ${n.id}
|
|
326
|
-
`.execute(t)}}async function
|
|
326
|
+
`.execute(t)}}async function __(t){}var He={};i(He,{up:()=>m_,down:()=>x_});import{sql as Z}from"kysely";async function m_(t){await t.schema.createTable("async_research_jobs").addColumn("id","uuid",(e)=>e.primaryKey().defaultTo(Z`gen_random_uuid()`)).addColumn("interaction_id","text").addColumn("tool_call_id","text",(e)=>e.notNull()).addColumn("organization_id","text",(e)=>e.notNull()).addColumn("thread_id","text",(e)=>e.notNull()).addColumn("message_id","text").addColumn("provider","text",(e)=>e.notNull()).addColumn("model_id","text",(e)=>e.notNull()).addColumn("query","text",(e)=>e.notNull()).addColumn("status","text",(e)=>e.notNull()).addColumn("attempts","integer",(e)=>e.notNull().defaultTo(0)).addColumn("last_polled_at","timestamptz").addColumn("last_error","text").addColumn("input_tokens","integer").addColumn("output_tokens","integer").addColumn("citations","jsonb").addColumn("result_uri","text").addColumn("result_preview","text").addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(Z`now()`)).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo(Z`now()`)).addColumn("completed_at","timestamptz").execute(),await t.schema.createIndex("async_research_jobs_org_tool_call_unique").on("async_research_jobs").columns(["organization_id","tool_call_id"]).unique().execute(),await t.schema.createIndex("async_research_jobs_thread_created_idx").on("async_research_jobs").columns(["thread_id","created_at desc"]).execute(),await Z`
|
|
327
327
|
CREATE INDEX async_research_jobs_active_idx
|
|
328
328
|
ON async_research_jobs (status, last_polled_at)
|
|
329
329
|
WHERE status IN ('pending', 'polling')
|
|
@@ -331,7 +331,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
331
331
|
ALTER TABLE async_research_jobs
|
|
332
332
|
ADD CONSTRAINT chk_async_research_jobs_status
|
|
333
333
|
CHECK (status IN ('pending','polling','completed','failed','cancelled','abandoned'))
|
|
334
|
-
`.execute(t)}async function
|
|
334
|
+
`.execute(t)}async function x_(t){await t.schema.dropTable("async_research_jobs").ifExists().execute()}var Ye={};i(Ye,{up:()=>r_,down:()=>y_});async function r_(t){await t.schema.alterTable("async_research_jobs").addColumn("result_content","text").execute()}async function y_(t){await t.schema.alterTable("async_research_jobs").dropColumn("result_content").execute()}var Be={};i(Be,{up:()=>c_,down:()=>f_});import{sql as J}from"kysely";async function c_(t){await t.schema.createTable("secrets").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("scope","text",(e)=>e.notNull()).addColumn("user_id","text",(e)=>e.references("user.id").onDelete("cascade")).addColumn("name","text",(e)=>e.notNull()).addColumn("encrypted_value","text",(e)=>e.notNull()).addColumn("description","text").addColumn("created_by","text",(e)=>e.notNull()).addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(J`CURRENT_TIMESTAMP`)).addColumn("updated_by","text",(e)=>e.notNull()).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo(J`CURRENT_TIMESTAMP`)).execute(),await J`
|
|
335
335
|
ALTER TABLE secrets
|
|
336
336
|
ADD CONSTRAINT chk_secrets_scope CHECK (scope IN ('user', 'organization'))
|
|
337
337
|
`.execute(t),await J`
|
|
@@ -348,7 +348,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
348
348
|
CREATE UNIQUE INDEX idx_secrets_org_name
|
|
349
349
|
ON secrets (organization_id, lower(name))
|
|
350
350
|
WHERE scope = 'organization'
|
|
351
|
-
`.execute(t)}async function
|
|
351
|
+
`.execute(t)}async function f_(t){await t.schema.dropTable("secrets").execute()}var Ie={};i(Ie,{up:()=>T_,down:()=>p_});async function T_(t){await t.schema.alterTable("threads").addColumn("run_locally","boolean",(e)=>e.notNull().defaultTo(!1)).execute()}async function p_(t){await t.schema.alterTable("threads").dropColumn("run_locally").execute()}var Ge={};i(Ge,{up:()=>w_,down:()=>C_});import{sql as s_}from"kysely";async function w_(t){await s_`delete from sandbox_runner_state where runner_kind = 'host'`.execute(t)}async function C_(t){}var ve={};i(ve,{up:()=>N_,down:()=>E_});import{sql as b}from"kysely";async function N_(t){await b`
|
|
352
352
|
ALTER TABLE sandbox_runner_state
|
|
353
353
|
RENAME COLUMN runner_kind TO sandbox_provider_kind
|
|
354
354
|
`.execute(t),await b`
|
|
@@ -386,7 +386,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
386
386
|
EXCEPTION WHEN undefined_table THEN
|
|
387
387
|
NULL;
|
|
388
388
|
END; $$
|
|
389
|
-
`.execute(t),await t.schema.alterTable("threads").dropColumn("run_locally").execute()}async function
|
|
389
|
+
`.execute(t),await t.schema.alterTable("threads").dropColumn("run_locally").execute()}async function E_(t){await t.schema.alterTable("threads").addColumn("run_locally","boolean",(e)=>e.notNull().defaultTo(!1)).execute(),await b`
|
|
390
390
|
ALTER TABLE sandbox_runner_state
|
|
391
391
|
RENAME COLUMN sandbox_provider_kind TO runner_kind
|
|
392
392
|
`.execute(t),await b`
|
|
@@ -424,7 +424,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
424
424
|
EXCEPTION WHEN undefined_table THEN
|
|
425
425
|
NULL;
|
|
426
426
|
END; $$
|
|
427
|
-
`.execute(t)}var Ve={};i(Ve,{up:()=>
|
|
427
|
+
`.execute(t)}var Ve={};i(Ve,{up:()=>h_,down:()=>K_});import{sql as Ti}from"kysely";async function h_(t){await t.schema.alterTable("threads").addColumn("sandbox_provider_kind","text").execute(),await t.schema.alterTable("threads").addColumn("harness_id","text").execute(),await Ti`
|
|
428
428
|
DO $$ BEGIN
|
|
429
429
|
UPDATE virtualmcps v
|
|
430
430
|
SET metadata = jsonb_set(
|
|
@@ -463,7 +463,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
463
463
|
-- PGlite migration order: virtualmcps not yet created. Safe no-op.
|
|
464
464
|
NULL;
|
|
465
465
|
END; $$
|
|
466
|
-
`.execute(t)}async function
|
|
466
|
+
`.execute(t)}async function K_(t){await t.schema.alterTable("threads").dropColumn("harness_id").execute(),await t.schema.alterTable("threads").dropColumn("sandbox_provider_kind").execute(),await Ti`
|
|
467
467
|
DO $$ BEGIN
|
|
468
468
|
UPDATE virtualmcps v
|
|
469
469
|
SET metadata = jsonb_set(
|
|
@@ -496,7 +496,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
496
496
|
EXCEPTION WHEN undefined_table THEN
|
|
497
497
|
NULL;
|
|
498
498
|
END; $$
|
|
499
|
-
`.execute(t)}var qe={};i(qe,{up:()=>
|
|
499
|
+
`.execute(t)}var qe={};i(qe,{up:()=>k_,down:()=>P_});import{sql as pi}from"kysely";async function k_(t){await pi`
|
|
500
500
|
UPDATE connections c
|
|
501
501
|
SET metadata = (
|
|
502
502
|
jsonb_set(
|
|
@@ -540,7 +540,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
540
540
|
JOIN jsonb_each(user_map) AS branches(branch_key, entry) ON true
|
|
541
541
|
WHERE entry ? 'vmId'
|
|
542
542
|
);
|
|
543
|
-
`.execute(t),await
|
|
543
|
+
`.execute(t),await pi`
|
|
544
544
|
UPDATE connections c
|
|
545
545
|
SET metadata = (
|
|
546
546
|
jsonb_set(
|
|
@@ -594,10 +594,10 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
594
594
|
JOIN jsonb_each(branch_entry) AS kinds(kind_key, inner_entry) ON true
|
|
595
595
|
WHERE inner_entry ? 'runnerKind'
|
|
596
596
|
);
|
|
597
|
-
`.execute(t)}async function
|
|
597
|
+
`.execute(t)}async function P_(t){}var le={};i(le,{up:()=>U_,down:()=>D_});import{sql as z_}from"kysely";async function U_(t){await z_`
|
|
598
598
|
DELETE FROM ai_provider_keys
|
|
599
599
|
WHERE provider_id IN ('claude-code', 'codex')
|
|
600
|
-
`.execute(t)}async function
|
|
600
|
+
`.execute(t)}async function D_(t){}var de={};i(de,{up:()=>L_,down:()=>j_});import{sql as tt}from"kysely";async function L_(t){await tt`
|
|
601
601
|
UPDATE sandbox_runner_state
|
|
602
602
|
SET sandbox_provider_kind = 'desktop'
|
|
603
603
|
WHERE sandbox_provider_kind = 'remote-user'
|
|
@@ -695,13 +695,13 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
695
695
|
UPDATE threads
|
|
696
696
|
SET sandbox_provider_kind = 'desktop'
|
|
697
697
|
WHERE sandbox_provider_kind = 'remote-user'
|
|
698
|
-
`.execute(t)}async function
|
|
698
|
+
`.execute(t)}async function j_(t){}var be={};i(be,{up:()=>R_,down:()=>g_});import{sql as H}from"kysely";async function R_(t){await H`ALTER TABLE automation_triggers DROP CONSTRAINT chk_trigger_type`.execute(t),await H`ALTER TABLE automation_triggers ADD CONSTRAINT chk_trigger_type CHECK (type IN ('cron', 'event', 'webhook'))`.execute(t),await t.schema.alterTable("automation_triggers").addColumn("api_key_id","text").execute()}async function g_(t){await t.schema.alterTable("automation_triggers").dropColumn("api_key_id").execute(),await H`DELETE FROM automation_triggers WHERE type = 'webhook'`.execute(t),await H`ALTER TABLE automation_triggers DROP CONSTRAINT chk_trigger_type`.execute(t),await H`ALTER TABLE automation_triggers ADD CONSTRAINT chk_trigger_type CHECK (type IN ('cron', 'event'))`.execute(t)}var tn={};i(tn,{up:()=>J_,down:()=>A_});import{sql as si}from"kysely";async function J_(t){await si`
|
|
699
699
|
ALTER TABLE organization_domains
|
|
700
700
|
DROP CONSTRAINT IF EXISTS organization_domains_domain_key
|
|
701
|
-
`.execute(t),await t.schema.createIndex("organization_domains_domain_idx").ifNotExists().on("organization_domains").column("domain").execute()}async function
|
|
701
|
+
`.execute(t),await t.schema.createIndex("organization_domains_domain_idx").ifNotExists().on("organization_domains").column("domain").execute()}async function A_(t){await t.schema.dropIndex("organization_domains_domain_idx").ifExists().execute(),await si`
|
|
702
702
|
ALTER TABLE organization_domains
|
|
703
703
|
ADD CONSTRAINT organization_domains_domain_key UNIQUE (domain)
|
|
704
|
-
`.execute(t)}var en={};i(en,{up:()=>
|
|
704
|
+
`.execute(t)}var en={};i(en,{up:()=>W_,down:()=>$_});import{sql as et}from"kysely";async function W_(t){await et`
|
|
705
705
|
UPDATE sandbox_runner_state
|
|
706
706
|
SET sandbox_provider_kind = CASE sandbox_provider_kind
|
|
707
707
|
WHEN 'docker' THEN 'local-docker'
|
|
@@ -790,19 +790,19 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
790
790
|
WHERE c.connection_type = 'VIRTUAL'
|
|
791
791
|
AND c.metadata IS NOT NULL
|
|
792
792
|
AND (c.metadata LIKE '%"VM_START"%' OR c.metadata LIKE '%"VM_DELETE"%')
|
|
793
|
-
`.execute(t)}async function
|
|
793
|
+
`.execute(t)}async function $_(t){}var nn={};i(nn,{up:()=>S_,down:()=>F_});import{sql as wi}from"kysely";var X_=["GLOBAL_SEARCH"];async function S_(t){let e=await wi`
|
|
794
794
|
SELECT id, permission FROM "organizationRole"
|
|
795
|
-
`.execute(t);for(let n of e.rows){if(!n.permission)continue;let u;try{u=JSON.parse(n.permission)}catch{continue}let a=u.self;if(!Array.isArray(a))continue;if(a.length===1&&a[0]==="*")continue;let o=a,m=Array.from(new Set([...o,...
|
|
795
|
+
`.execute(t);for(let n of e.rows){if(!n.permission)continue;let u;try{u=JSON.parse(n.permission)}catch{continue}let a=u.self;if(!Array.isArray(a))continue;if(a.length===1&&a[0]==="*")continue;let o=a,m=Array.from(new Set([...o,...X_]));if(m.length===o.length)continue;u.self=m;let _=JSON.stringify(u);await wi`
|
|
796
796
|
UPDATE "organizationRole"
|
|
797
797
|
SET permission = ${_}
|
|
798
798
|
WHERE id = ${n.id}
|
|
799
|
-
`.execute(t)}}async function
|
|
799
|
+
`.execute(t)}}async function F_(t){}var un={};i(un,{up:()=>M_,down:()=>Q_});import{sql as an}from"kysely";async function M_(t){await t.schema.createTable("org_file_configs").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("name","text",(e)=>e.notNull()).addColumn("description","text").addColumn("bucket","text",(e)=>e.notNull()).addColumn("region","text",(e)=>e.notNull()).addColumn("endpoint","text").addColumn("force_path_style","boolean",(e)=>e.notNull().defaultTo(!1)).addColumn("prefix","text").addColumn("encrypted_credentials","text",(e)=>e.notNull()).addColumn("created_by","text",(e)=>e.notNull()).addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(an`CURRENT_TIMESTAMP`)).addColumn("updated_by","text",(e)=>e.notNull()).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo(an`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_org_file_configs_org").on("org_file_configs").column("organization_id").execute(),await an`
|
|
800
800
|
CREATE UNIQUE INDEX idx_org_file_configs_org_name
|
|
801
801
|
ON org_file_configs (organization_id, lower(name))
|
|
802
|
-
`.execute(t)}async function
|
|
802
|
+
`.execute(t)}async function Q_(t){await t.schema.dropTable("org_file_configs").execute()}var on={};i(on,{up:()=>O_,down:()=>Z_});import{sql as P}from"kysely";async function O_(t){await P`ALTER TABLE automations DROP CONSTRAINT chk_automation_tool_call_fields`.execute(t),await P`ALTER TABLE automations DROP CONSTRAINT chk_automation_agent_fields`.execute(t),await P`ALTER TABLE automations DROP CONSTRAINT chk_automation_kind`.execute(t),await P`DELETE FROM automations WHERE kind = 'tool_call'`.execute(t),await P`
|
|
803
803
|
ALTER TABLE automations
|
|
804
804
|
ALTER COLUMN virtual_mcp_id SET NOT NULL
|
|
805
|
-
`.execute(t),await t.schema.alterTable("automations").dropColumn("tool_input").dropColumn("tool_name").dropColumn("connection_id").dropColumn("kind").execute()}async function
|
|
805
|
+
`.execute(t),await t.schema.alterTable("automations").dropColumn("tool_input").dropColumn("tool_name").dropColumn("connection_id").dropColumn("kind").execute()}async function Z_(t){await t.schema.alterTable("automations").addColumn("kind","text",(e)=>e.notNull().defaultTo("agent")).addColumn("connection_id","text").addColumn("tool_name","text").addColumn("tool_input","text").execute(),await P`
|
|
806
806
|
ALTER TABLE automations
|
|
807
807
|
ALTER COLUMN virtual_mcp_id DROP NOT NULL
|
|
808
808
|
`.execute(t),await P`
|
|
@@ -824,25 +824,25 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
824
824
|
AND tool_input IS NOT NULL
|
|
825
825
|
)
|
|
826
826
|
)
|
|
827
|
-
`.execute(t)}var _n={};i(_n,{up:()=>
|
|
827
|
+
`.execute(t)}var _n={};i(_n,{up:()=>H_,down:()=>Y_});async function H_(t){await t.schema.alterTable("org_file_configs").addColumn("public_url_base","text").execute()}async function Y_(t){await t.schema.alterTable("org_file_configs").dropColumn("public_url_base").execute()}var xn={};i(xn,{up:()=>B_,down:()=>I_});import{sql as mn}from"kysely";var nt="local-docker";async function B_(t){await mn`delete from sandbox_runner_state where sandbox_provider_kind = ${nt}`.execute(t);let e=await mn`
|
|
828
828
|
SELECT id, metadata FROM "connections"
|
|
829
829
|
WHERE connection_type = 'VIRTUAL'
|
|
830
830
|
AND metadata IS NOT NULL
|
|
831
831
|
AND metadata LIKE ${"%"+nt+"%"}
|
|
832
|
-
`.execute(t);for(let n of e.rows){if(!n.metadata)continue;let u;try{u=JSON.parse(n.metadata)}catch{continue}let a=u.sandboxMap;if(!a||typeof a!=="object")continue;let o=!1,m={};for(let[x,r]of Object.entries(a)){if(!r||typeof r!=="object"){o=!0;continue}let
|
|
832
|
+
`.execute(t);for(let n of e.rows){if(!n.metadata)continue;let u;try{u=JSON.parse(n.metadata)}catch{continue}let a=u.sandboxMap;if(!a||typeof a!=="object")continue;let o=!1,m={};for(let[x,r]of Object.entries(a)){if(!r||typeof r!=="object"){o=!0;continue}let y={};for(let[f,c]of Object.entries(r)){if(!c||typeof c!=="object"){o=!0;continue}if(nt in c){o=!0;let N={...c};if(delete N[nt],Object.keys(N).length>0)y[f]=N}else y[f]=c}if(Object.keys(y).length>0)m[x]=y;else o=!0}if(!o)continue;u.sandboxMap=m;let _=JSON.stringify(u);await mn`
|
|
833
833
|
UPDATE "connections"
|
|
834
834
|
SET metadata = ${_}
|
|
835
835
|
WHERE id = ${n.id}
|
|
836
|
-
`.execute(t)}}async function
|
|
836
|
+
`.execute(t)}}async function I_(t){}var rn={};i(rn,{up:()=>G_,down:()=>v_});import{sql as it}from"kysely";async function G_(t){await t.schema.createTable("thread_message_parts").addColumn("id","text",(e)=>e.primaryKey()).addColumn("seq","integer",(e)=>e.notNull()).addColumn("org_id","text",(e)=>e.notNull()).addColumn("thread_id","text",(e)=>e.notNull().references("threads.id").onDelete("cascade")).addColumn("run_id","text",(e)=>e.notNull()).addColumn("message_id","text",(e)=>e.notNull()).addColumn("role","text",(e)=>e.notNull()).addColumn("kind","text",(e)=>e.notNull()).addColumn("payload","jsonb",(e)=>e.notNull()).addColumn("payload_ref","text").addColumn("metadata","jsonb").addColumn("created_at","text",(e)=>e.notNull()).execute(),await it`CREATE UNIQUE INDEX idx_tmp_run_seq ON thread_message_parts (run_id, seq)`.execute(t),await it`CREATE INDEX idx_tmp_thread_created_id ON thread_message_parts (thread_id, created_at, id)`.execute(t),await it`CREATE INDEX idx_tmp_finish_anchor ON thread_message_parts (thread_id, created_at DESC, id DESC) WHERE kind = 'finish'`.execute(t),await it`CREATE INDEX idx_tmp_message ON thread_message_parts (thread_id, message_id)`.execute(t),await t.schema.alterTable("threads").addColumn("message_storage_version","integer",(e)=>e.notNull().defaultTo(1)).addColumn("last_progress_at","timestamptz").execute()}async function v_(t){await t.schema.alterTable("threads").dropColumn("message_storage_version").dropColumn("last_progress_at").execute(),await t.schema.dropTable("thread_message_parts").ifExists().execute()}var yn={};i(yn,{up:()=>V_,down:()=>q_});async function V_(t){await t.schema.alterTable("threads").addColumn("run_fence_token","text").execute()}async function q_(t){await t.schema.alterTable("threads").dropColumn("run_fence_token").execute()}var cn={};i(cn,{up:()=>l_,down:()=>d_});async function l_(t){await t.schema.alterTable("threads").addColumn("link_transport","text").execute()}async function d_(t){await t.schema.alterTable("threads").dropColumn("link_transport").execute()}var fn={};i(fn,{up:()=>b_,down:()=>tm});async function b_(t){await t.schema.alterTable("threads").addColumn("cancel_requested_at","timestamptz").execute()}async function tm(t){await t.schema.alterTable("threads").dropColumn("cancel_requested_at").execute()}var Tn={};i(Tn,{up:()=>em,down:()=>nm});async function em(t){await t.schema.alterTable("organization_settings").addColumn("observational_config","text").execute(),await t.schema.alterTable("threads").addColumn("is_observation","boolean",(e)=>e.notNull().defaultTo(!1)).execute(),await t.schema.createTable("thread_observations").addColumn("thread_id","text",(e)=>e.notNull().references("threads.id").onDelete("cascade")).addColumn("observer_id","text",(e)=>e.notNull()).addColumn("last_observed_at","text",(e)=>e.notNull()).addPrimaryKeyConstraint("thread_observations_pkey",["thread_id","observer_id"]).execute()}async function nm(t){await t.schema.dropTable("thread_observations").execute(),await t.schema.alterTable("threads").dropColumn("is_observation").execute(),await t.schema.alterTable("organization_settings").dropColumn("observational_config").execute()}var pn={};i(pn,{up:()=>im,down:()=>am});async function im(t){await t.schema.dropTable("thread_observations").ifExists().execute(),await t.schema.alterTable("threads").dropColumn("is_observation").execute(),await t.schema.alterTable("organization_settings").dropColumn("observational_config").execute()}async function am(t){await t.schema.alterTable("organization_settings").addColumn("observational_config","text").execute(),await t.schema.alterTable("threads").addColumn("is_observation","boolean",(e)=>e.notNull().defaultTo(!1)).execute(),await t.schema.createTable("thread_observations").addColumn("thread_id","text",(e)=>e.notNull().references("threads.id").onDelete("cascade")).addColumn("observer_id","text",(e)=>e.notNull()).addColumn("last_observed_at","text",(e)=>e.notNull()).addPrimaryKeyConstraint("thread_observations_pkey",["thread_id","observer_id"]).execute()}var wn={};i(wn,{up:()=>om,down:()=>_m});import{sql as K}from"kysely";var w="cluster",C="agent-sandbox";function A(t){return t!==null&&typeof t==="object"&&!Array.isArray(t)}function sn(t,e,n){if(!A(t))return t;if(t.sandboxProviderKind!==e)return t;return{...t,sandboxProviderKind:n}}function at(t){if(!A(t))return!1;if(typeof t.sandboxHandle!=="string")return!1;if(t.previewUrl!==null&&typeof t.previewUrl!=="string")return!1;if(t.sandboxApiUrl!==void 0&&t.sandboxApiUrl!==null&&typeof t.sandboxApiUrl!=="string")return!1;if(t.sandboxProviderKind!==void 0&&t.sandboxProviderKind!==w&&t.sandboxProviderKind!==C&&t.sandboxProviderKind!=="user-desktop")return!1;if(t.createdAt!==void 0&&typeof t.createdAt!=="number")return!1;if(t.startedWith!==void 0){if(!A(t.startedWith))return!1;for(let e of["packageManager","port","path"]){let n=t.startedWith[e];if(n!==void 0&&n!==null&&typeof n!=="string")return!1}}return!0}function um(t,e,n){if(!A(t))return null;let u=!1,a={};for(let[o,m]of Object.entries(t)){if(!A(m)){a[o]=m;continue}let _={};for(let[x,r]of Object.entries(m)){if(!A(r)){_[x]=r;continue}let y={};for(let[f,c]of Object.entries(r)){if(f===e){if(u=!0,!(n in r))y[n]=sn(c,e,n);else if(!at(r[n])&&at(c))y[n]=sn(c,e,n);continue}let N=sn(c,e,n);if(N!==c)u=!0;if(f===n&&f in y&&at(y[f])&&!at(N))continue;y[f]=N}_[x]=y}a[o]=_}return{sandboxMap:a,changed:u}}async function Ci(t,e,n){let u=await K`
|
|
837
837
|
SELECT id, metadata FROM connections
|
|
838
838
|
WHERE connection_type = 'VIRTUAL'
|
|
839
839
|
AND metadata IS NOT NULL
|
|
840
840
|
AND metadata LIKE ${"%"+e+"%"}
|
|
841
|
-
`.execute(t);for(let a of u.rows){if(!a.metadata)continue;let o;try{o=JSON.parse(a.metadata)}catch{continue}let m=
|
|
841
|
+
`.execute(t);for(let a of u.rows){if(!a.metadata)continue;let o;try{o=JSON.parse(a.metadata)}catch{continue}let m=um(o.sandboxMap,e,n);if(!m?.changed)continue;o.sandboxMap=m.sandboxMap,await K`
|
|
842
842
|
UPDATE connections
|
|
843
843
|
SET metadata = ${JSON.stringify(o)}
|
|
844
844
|
WHERE id = ${a.id}
|
|
845
|
-
`.execute(t)}}async function
|
|
845
|
+
`.execute(t)}}async function om(t){await K`
|
|
846
846
|
UPDATE threads
|
|
847
847
|
SET sandbox_provider_kind = ${C}
|
|
848
848
|
WHERE sandbox_provider_kind = ${w}
|
|
@@ -871,7 +871,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
871
871
|
UPDATE sandbox_runner_state
|
|
872
872
|
SET sandbox_provider_kind = ${C}
|
|
873
873
|
WHERE sandbox_provider_kind = ${w}
|
|
874
|
-
`.execute(t),await
|
|
874
|
+
`.execute(t),await Ci(t,w,C)}async function _m(t){await K`
|
|
875
875
|
UPDATE threads
|
|
876
876
|
SET sandbox_provider_kind = ${w}
|
|
877
877
|
WHERE sandbox_provider_kind = ${C}
|
|
@@ -900,7 +900,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
900
900
|
UPDATE sandbox_runner_state
|
|
901
901
|
SET sandbox_provider_kind = ${w}
|
|
902
902
|
WHERE sandbox_provider_kind = ${C}
|
|
903
|
-
`.execute(t),await
|
|
903
|
+
`.execute(t),await Ci(t,C,w)}var Cn={};i(Cn,{up:()=>mm,down:()=>xm});import{sql as U}from"kysely";async function mm(t){await U`CREATE SEQUENCE IF NOT EXISTS org_fs_entry_seq`.execute(t),await t.schema.createTable("org_fs_entry").addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("volume","text",(e)=>e.notNull()).addColumn("path","text",(e)=>e.notNull()).addColumn("parent","text",(e)=>e.notNull()).addColumn("kind","text",(e)=>e.notNull().check(U`kind in ('file', 'dir')`)).addColumn("content_hash","text").addColumn("size","bigint",(e)=>e.notNull().defaultTo(0)).addColumn("seq","bigint",(e)=>e.notNull().defaultTo(U`nextval('org_fs_entry_seq')`)).addColumn("deleted_at","timestamptz").addColumn("created_by","text",(e)=>e.notNull()).addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(U`CURRENT_TIMESTAMP`)).addColumn("updated_by","text",(e)=>e.notNull()).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo(U`CURRENT_TIMESTAMP`)).addPrimaryKeyConstraint("org_fs_entry_pk",["organization_id","volume","path"]).execute(),await t.schema.createIndex("idx_org_fs_entry_changes").on("org_fs_entry").columns(["organization_id","volume","seq"]).execute(),await U`
|
|
904
904
|
CREATE INDEX idx_org_fs_entry_parent
|
|
905
905
|
ON org_fs_entry (organization_id, volume, parent)
|
|
906
906
|
WHERE deleted_at IS NULL
|
|
@@ -908,7 +908,7 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
908
908
|
CREATE INDEX idx_org_fs_entry_usage
|
|
909
909
|
ON org_fs_entry (organization_id, volume, size)
|
|
910
910
|
WHERE kind = 'file' AND deleted_at IS NULL
|
|
911
|
-
`.execute(t)}async function
|
|
911
|
+
`.execute(t)}async function xm(t){await t.schema.dropTable("org_fs_entry").execute(),await U`DROP SEQUENCE IF EXISTS org_fs_entry_seq`.execute(t)}var Nn={};i(Nn,{up:()=>rm,down:()=>ym});async function rm(t){await t.schema.alterTable("automations").addColumn("tools","text").execute()}async function ym(t){await t.schema.alterTable("automations").dropColumn("tools").execute()}var En={};i(En,{up:()=>cm,down:()=>fm});import{sql as Ni}from"kysely";async function cm(t){await Ni`
|
|
912
912
|
INSERT INTO "organization" (id, name, slug, "createdAt")
|
|
913
913
|
SELECT
|
|
914
914
|
'org_orgfs_public_skills',
|
|
@@ -922,13 +922,13 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
922
922
|
END,
|
|
923
923
|
now()
|
|
924
924
|
ON CONFLICT (id) DO NOTHING
|
|
925
|
-
`.execute(t)}async function
|
|
925
|
+
`.execute(t)}async function fm(t){await Ni`
|
|
926
926
|
DELETE FROM "organization" WHERE id = 'org_orgfs_public_skills'
|
|
927
|
-
`.execute(t)}var
|
|
927
|
+
`.execute(t)}var hn={};i(hn,{up:()=>Tm,down:()=>pm});async function Tm(t){await t.schema.alterTable("automations").addColumn("max_agent_steps","integer").execute()}async function pm(t){await t.schema.alterTable("automations").dropColumn("max_agent_steps").execute()}var Kn={};i(Kn,{up:()=>sm,down:()=>wm});import{sql as Ei}from"kysely";async function sm(t){await Ei`DROP INDEX IF EXISTS idx_tmp_run_seq`.execute(t)}async function wm(t){await Ei`CREATE UNIQUE INDEX IF NOT EXISTS idx_tmp_run_seq ON thread_message_parts (run_id, seq)`.execute(t)}var kn={};i(kn,{up:()=>Nm,down:()=>Em});import{sql as Cm}from"kysely";async function Nm(t){await Cm`
|
|
928
928
|
UPDATE downstream_tokens
|
|
929
929
|
SET "expiresAt" = "createdAt"::timestamptz + INTERVAL '55 minutes'
|
|
930
930
|
WHERE "expiresAt" IS NULL
|
|
931
|
-
`.execute(t)}async function
|
|
931
|
+
`.execute(t)}async function Em(t){}var Pn={};i(Pn,{up:()=>hm,down:()=>Km});async function hm(t){await t.schema.alterTable("org_fs_entry").addColumn("thread_id","text").execute()}async function Km(t){await t.schema.alterTable("org_fs_entry").dropColumn("thread_id").execute()}var zn={};i(zn,{up:()=>km,down:()=>Pm});async function km(t){await t.schema.alterTable("org_file_configs").addColumn("credential_type","text",(e)=>e.notNull().defaultTo("static")).addColumn("refresh_url","text").execute()}async function Pm(t){await t.schema.alterTable("org_file_configs").dropColumn("credential_type").dropColumn("refresh_url").execute()}var Un={};i(Un,{up:()=>zm,down:()=>Um});async function zm(t){await t.schema.alterTable("threads").addColumn("failure_reason","text").execute(),await t.schema.alterTable("threads").addColumn("failure_kind","text").execute()}async function Um(t){await t.schema.alterTable("threads").dropColumn("failure_kind").execute(),await t.schema.alterTable("threads").dropColumn("failure_reason").execute()}var Dn={};i(Dn,{up:()=>Dm,down:()=>Lm});async function Dm(t){await t.schema.alterTable("threads").addColumn("run_acked_seq","integer").execute()}async function Lm(t){await t.schema.alterTable("threads").dropColumn("run_acked_seq").execute()}var Ln={};i(Ln,{up:()=>jm,down:()=>Rm});async function jm(t){await t.schema.alterTable("threads").addColumn("projected_seq","integer",(e)=>e.notNull().defaultTo(0)).execute()}async function Rm(t){await t.schema.alterTable("threads").dropColumn("projected_seq").execute()}var jn={};i(jn,{up:()=>gm,down:()=>Jm});import{sql as hi}from"kysely";async function gm(t){await t.schema.createTable("org_sites").addColumn("slug","text",(e)=>e.primaryKey().notNull()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("source","text",(e)=>e.notNull().defaultTo("deco-import")).addColumn("created_by","text",(e)=>e.notNull()).addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(hi`now()`)).addColumn("updated_by","text",(e)=>e.notNull()).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo(hi`now()`)).execute(),await t.schema.createIndex("idx_org_sites_org").on("org_sites").column("organization_id").execute()}async function Jm(t){await t.schema.dropTable("org_sites").execute()}var Rn={};i(Rn,{up:()=>Am,down:()=>Wm});async function Am(t){await t.schema.alterTable("org_file_configs").addColumn("site_slug","text").execute()}async function Wm(t){await t.schema.alterTable("org_file_configs").dropColumn("site_slug").execute()}var gn={};i(gn,{up:()=>$m,down:()=>Xm});import{sql as p}from"kysely";async function $m(t){await t.schema.alterTable("organization_domains").addColumn("id","text").addColumn("join_mode","text").addColumn("verification_status","text").addColumn("verification_method","text").addColumn("verification_token","text").addColumn("verified_at","timestamptz").execute(),await p`
|
|
932
932
|
UPDATE organization_domains
|
|
933
933
|
SET
|
|
934
934
|
id = gen_random_uuid()::text,
|
|
@@ -937,18 +937,18 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
937
937
|
verification_method = 'email',
|
|
938
938
|
verified_at = created_at
|
|
939
939
|
WHERE id IS NULL
|
|
940
|
-
`.execute(t),await
|
|
940
|
+
`.execute(t),await p`ALTER TABLE organization_domains DROP CONSTRAINT organization_domains_pkey`.execute(t),await p`ALTER TABLE organization_domains ALTER COLUMN id SET NOT NULL`.execute(t),await p`ALTER TABLE organization_domains ALTER COLUMN id SET DEFAULT gen_random_uuid()::text`.execute(t),await p`ALTER TABLE organization_domains ADD PRIMARY KEY (id)`.execute(t),await p`ALTER TABLE organization_domains ALTER COLUMN join_mode SET NOT NULL`.execute(t),await p`ALTER TABLE organization_domains ALTER COLUMN join_mode SET DEFAULT 'off'`.execute(t),await p`ALTER TABLE organization_domains ALTER COLUMN verification_status SET NOT NULL`.execute(t),await p`ALTER TABLE organization_domains ALTER COLUMN verification_status SET DEFAULT 'pending'`.execute(t),await t.schema.alterTable("organization_domains").dropColumn("auto_join_enabled").execute(),await t.schema.createIndex("organization_domains_org_domain_idx").unique().ifNotExists().on("organization_domains").columns(["organization_id","domain"]).execute()}async function Xm(t){await t.schema.dropIndex("organization_domains_org_domain_idx").ifExists().execute(),await t.schema.alterTable("organization_domains").addColumn("auto_join_enabled","boolean",(e)=>e.notNull().defaultTo(!1)).execute(),await p`
|
|
941
941
|
UPDATE organization_domains
|
|
942
942
|
SET auto_join_enabled = (join_mode = 'auto')
|
|
943
|
-
`.execute(t),await
|
|
943
|
+
`.execute(t),await p`ALTER TABLE organization_domains DROP CONSTRAINT organization_domains_pkey`.execute(t),await p`ALTER TABLE organization_domains ADD PRIMARY KEY (organization_id)`.execute(t),await t.schema.alterTable("organization_domains").dropColumn("id").dropColumn("join_mode").dropColumn("verification_status").dropColumn("verification_method").dropColumn("verification_token").dropColumn("verified_at").execute()}var Jn={};i(Jn,{up:()=>Sm,down:()=>Fm});import{sql as ut}from"kysely";async function Sm(t){await t.schema.createTable("organization_join_requests").addColumn("id","text",(e)=>e.primaryKey().defaultTo(ut`gen_random_uuid()::text`)).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("user_id","text",(e)=>e.notNull().references("user.id").onDelete("cascade")).addColumn("status","text",(e)=>e.notNull().defaultTo("pending")).addColumn("decided_by","text",(e)=>e.references("user.id").onDelete("set null")).addColumn("decided_at","timestamptz").addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(ut`now()`)).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo(ut`now()`)).execute(),await ut`
|
|
944
944
|
CREATE UNIQUE INDEX organization_join_requests_pending_unique
|
|
945
945
|
ON organization_join_requests (organization_id, user_id)
|
|
946
946
|
WHERE status = 'pending'
|
|
947
|
-
`.execute(t),await t.schema.createIndex("organization_join_requests_org_status_idx").on("organization_join_requests").columns(["organization_id","status"]).execute()}async function
|
|
947
|
+
`.execute(t),await t.schema.createIndex("organization_join_requests_org_status_idx").on("organization_join_requests").columns(["organization_id","status"]).execute()}async function Fm(t){await t.schema.dropTable("organization_join_requests").execute()}var An={};i(An,{up:()=>Mm,down:()=>Qm});async function Mm(t){await t.schema.alterTable("org_fs_entry").addColumn("read_public","boolean",(e)=>e.notNull().defaultTo(!1)).execute()}async function Qm(t){await t.schema.alterTable("org_fs_entry").dropColumn("read_public").execute()}var Wn={};i(Wn,{up:()=>Om,down:()=>Zm});async function Om(t){await t.schema.alterTable("org_fs_entry").addColumn("share_password_hash","text").addColumn("share_secret","text").execute()}async function Zm(t){await t.schema.alterTable("org_fs_entry").dropColumn("share_password_hash").dropColumn("share_secret").execute()}var Sn={};i(Sn,{up:()=>Bm,splitWebResearchTier:()=>Xn,down:()=>Im,__testing:()=>Ym});function Hm(t){return t.toLowerCase().replace(/[^a-z0-9]/g,"").includes("deepresearch")}function $n(t){if(!t||typeof t!=="object")return!1;let e=t.tiers;if(!e||typeof e!=="object")return!1;return"web_search"in e||"deep_research"in e}function Xn(t){if(!t||$n(t))return t;let e=t.tiers??{},n=e.web_research??null,{web_research:u,...a}=e,o=null,m=null;if(n)if(Hm(n.modelId))m=n;else o=n;return{...t,tiers:{...a,web_search:o,deep_research:m}}}var Ym={splitWebResearchTier:Xn,isAlreadySplit:$n};async function Bm(t){let e=await t.selectFrom("organization_settings").select(["organizationId","simple_mode"]).execute();for(let n of e){if(!n.simple_mode)continue;let u=typeof n.simple_mode==="string"?JSON.parse(n.simple_mode):n.simple_mode;if($n(u))continue;let a=Xn(u);await t.updateTable("organization_settings").set({simple_mode:JSON.stringify(a)}).where("organizationId","=",n.organizationId).execute()}}async function Im(t){throw Error("122-split-web-research-tier is not reversible. Restore from snapshot.")}var Fn={};i(Fn,{up:()=>Gm,down:()=>vm});import{sql as Y}from"kysely";async function Gm(t){await t.schema.createTable("connection_workload_tokens").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("subject_connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("token_hash","text",(e)=>e.notNull().unique()).addColumn("token_prefix","text",(e)=>e.notNull()).addColumn("name","text",(e)=>e.notNull().defaultTo("default")).addColumn("revoked_at","timestamptz").addColumn("last_used_at","timestamptz").addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(Y`CURRENT_TIMESTAMP`)).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo(Y`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_connection_workload_tokens_subject").on("connection_workload_tokens").columns(["organization_id","subject_connection_id"]).execute(),await Y`
|
|
948
948
|
CREATE UNIQUE INDEX idx_connection_workload_tokens_active_unique
|
|
949
949
|
ON connection_workload_tokens (organization_id, subject_connection_id, name)
|
|
950
950
|
WHERE revoked_at IS NULL
|
|
951
|
-
`.execute(t),await t.schema.createTable("connection_credential_grants").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("subject_connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("target_connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("scope","text",(e)=>e.notNull()).addColumn("created_by","text",(e)=>e.notNull()).addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(Y`CURRENT_TIMESTAMP`)).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo(Y`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_connection_credential_grants_subject").on("connection_credential_grants").columns(["organization_id","subject_connection_id"]).execute(),await t.schema.createIndex("idx_connection_credential_grants_target").on("connection_credential_grants").columns(["organization_id","target_connection_id"]).execute(),await t.schema.createIndex("idx_connection_credential_grants_unique").on("connection_credential_grants").columns(["organization_id","subject_connection_id","target_connection_id","scope"]).unique().execute()}async function
|
|
951
|
+
`.execute(t),await t.schema.createTable("connection_credential_grants").addColumn("id","text",(e)=>e.primaryKey()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("subject_connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("target_connection_id","text",(e)=>e.notNull().references("connections.id").onDelete("cascade")).addColumn("scope","text",(e)=>e.notNull()).addColumn("created_by","text",(e)=>e.notNull()).addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(Y`CURRENT_TIMESTAMP`)).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo(Y`CURRENT_TIMESTAMP`)).execute(),await t.schema.createIndex("idx_connection_credential_grants_subject").on("connection_credential_grants").columns(["organization_id","subject_connection_id"]).execute(),await t.schema.createIndex("idx_connection_credential_grants_target").on("connection_credential_grants").columns(["organization_id","target_connection_id"]).execute(),await t.schema.createIndex("idx_connection_credential_grants_unique").on("connection_credential_grants").columns(["organization_id","subject_connection_id","target_connection_id","scope"]).unique().execute()}async function vm(t){await t.schema.dropTable("connection_credential_grants").ifExists().execute(),await t.schema.dropTable("connection_workload_tokens").ifExists().execute()}var Mn={};i(Mn,{up:()=>Vm,down:()=>qm});async function Vm(t){await t.schema.alterTable("threads").dropColumn("projected_seq").execute()}async function qm(t){await t.schema.alterTable("threads").addColumn("projected_seq","integer",(e)=>e.notNull().defaultTo(0)).execute()}var Qn={};i(Qn,{up:()=>lm,down:()=>dm});import{sql as L}from"kysely";async function lm(t){await L`
|
|
952
952
|
CREATE OR REPLACE FUNCTION try_parse_jsonb(t text)
|
|
953
953
|
RETURNS jsonb AS $fn$
|
|
954
954
|
BEGIN
|
|
@@ -1007,27 +1007,27 @@ var Mi=Object.defineProperty;var Qi=(t)=>t;function Oi(t,e){this[t]=Qi.bind(null
|
|
|
1007
1007
|
BEFORE INSERT ON connection_aggregations
|
|
1008
1008
|
FOR EACH ROW
|
|
1009
1009
|
EXECUTE FUNCTION enforce_repo_github_child_single_parent();
|
|
1010
|
-
`.execute(t)}async function qm(t){await L`DROP TRIGGER IF EXISTS trg_repo_github_child_single_parent ON connection_aggregations;`.execute(t),await L`DROP FUNCTION IF EXISTS enforce_repo_github_child_single_parent();`.execute(t),await L`DROP FUNCTION IF EXISTS try_parse_jsonb(text);`.execute(t)}var lm={"001-initial-schema":ct,"002-organization-settings":yt,"003-connection-schema-align":st,"004-remove-models-binding":ft,"005-connection-configuration":Tt,"006-add-views-to-settings":pt,"007-monitoring-logs":wt,"008-event-bus":Ct,"009-drop-audit-logs":Nt,"010-gateways":ht,"011-gateway-icon":Et,"012-gateway-tool-selection-mode":Kt,"013-monitoring-user-agent-gateway":kt,"014-gateway-resources-prompts":Pt,"015-monitoring-properties":zt,"016-downstream-token-client-info":Ut,"017-downstream-token-remove-userid":Dt,"018-drop-gateway-tool-selection-strategy":Lt,"019-remove-gateway-is-default":gt,"020-enabled-plugins":jt,"021-threads":Rt,"022-rename-gateway-to-virtual-mcp":Jt,"023-optimize-thread-indexes":At,"024-consolidate-virtual-mcp":Wt,"025-add-monitoring-virtual-mcp-id":$t,"026-restrict-child-connection-delete":Xt,"027-update-management-mcp-url":St,"028-update-management-mcp-to-self":Qt,"029-add-updated-by-to-connections":Ot,"030-member-tags":Zt,"031-add-dependency-mode":Ht,"032-projects":Yt,"033-thread-status":It,"034-monitoring-dashboards":Bt,"035-project-connections":Gt,"036-update-registry-url":vt,"037-ai-provider-keys":Vt,"038-oauth-pkce-states":qt,"039-automations":lt,"040-replace-next-run-at-with-last-run-at":dt,"041-ai-provider-keys-unique-constraint":bt,"042-rename-mesh-mcp-to-cms-mcp":te,"043-rename-cms-mcp-to-deco-cms":ee,"044-drop-connections-tools-column":ne,"045-thread-context-start-message":ie,"046-remove-object-storage-plugin":ue,"047-add-next-run-at":oe,"048-merge-projects-agents":me,"049-remove-org-admin-projects":xe,"050-durable-agent-runs":re,"051-org-sso":ye,"052-thread-agent-ids":se,"053-registry-config":fe,"054-connection-slug":pe,"055-spaces":we,"056-automation-project-scope":Ce,"057-thread-virtual-mcp-id":Ne,"058-trigger-callback-tokens":he,"059-kv":Ee,"060-member-index":Ke,"061-downstream-token-connection-index":ke,"062-private-registry":Pe,"063-event-subscriptions-enabled-boolean":ze,"064-brand-context":Ue,"065-organization-domains":De,"066-brand-context-structured":Le,"067-threads-metadata":ge,"068-threads-branch":je,"069-sandbox-runner-state":Re,"070-model-categories":Je,"071-default-home-agents":Ae,"072-ai-provider-key-preset-id":We,"073-backfill-basic-usage-roles":$e,"074-sandbox-runner-state-handle-nonunique":Xe,"075-thread-inflight-async-jobs":Fe,"076-automations-drop-agent-json":Se,"077-tier-only-model-selection":Qe,"078-automation-tool-call-kind":Oe,"079-strip-legacy-freestyle-vm-map-entries":Ze,"080-async-research-jobs":He,"081-async-research-jobs-result-content":Ye,"082-secrets":Ie,"083-thread-run-locally":Be,"084-drop-host-sandbox-rows":Ge,"085-rename-runner-kind":ve,"086-thread-pins-and-vm-map-rekey":Ve,"087-fix-vm-map-rekey":qe,"088-purge-cli-activate-keys":le,"089-rename-remote-user-to-desktop":de,"090-automation-webhook-triggers":be,"091-organization-domains-allow-multi":tn,"092-sandbox-naming-uniformization":en,"093-backfill-global-search-basic-usage":nn,"094-org-file-configs":un,"095-remove-automation-tool-call-kind":on,"096-org-file-configs-public-url-base":_n,"097-drop-local-docker-sandbox-state":xn,"098-thread-message-parts":rn,"099-run-fence":cn,"100-link-transport":yn,"101-cancel-requested-at":sn,"102-observational-agent":fn,"103-revert-observational-agent":Tn,"104-agent-sandbox-provider-kind":wn,"105-org-fs":Cn,"106-automation-tools":Nn,"107-org-fs-public-org":hn,"108-automation-max-agent-steps":En,"109-thread-message-parts-per-message-seq":Kn,"110-backfill-ghs-token-expiry":kn,"111-org-fs-thread-id":Pn,"112-org-file-configs-credential-type":zn,"113-thread-failure-reason":Un,"114-run-acked-seq":Dn,"115-thread-projected-seq":Ln,"116-org-sites":gn,"117-org-file-configs-site-slug":jn,"118-organization-domains-multi-verify":Rn,"119-organization-join-requests":Jn,"120-org-fs-read-public":An,"121-org-fs-share-password":Wn,"122-split-web-research-tier":Fn,"123-connection-credential-vault":Sn,"124-drop-thread-projected-seq":Mn,"125-github-child-single-parent":Qn},On=lm;import{getMigrations as gx}from"better-auth/db";import{sso as jx}from"@better-auth/sso";import{organization as Rx}from"@decocms/better-auth/plugins";import{admin as Jx,apiKey as Ax,jwt as Wx,magicLink as $x,mcp as Xx,openAPI as Fx}from"better-auth/plugins";import{emailOTP as Sx}from"better-auth/plugins/email-otp";import{Kysely as Kx,PostgresDialect as ji}from"kysely";import{Pool as Ri}from"pg";import{homedir as dm}from"os";var bm=new Set(["all","worker","api"]);function tx(t){let e=(t??"").trim();return bm.has(e)?e:"all"}function W(t){return t==="true"||t==="1"}function ex(t){if(t===void 0||t==="")return;return W(t)}function nx(t,e,n){if(e===void 0||e==="")return n;let u=Number(e);if(!Number.isSafeInteger(u)||u<=0)throw Error(`${t} must be a positive integer`);return u}function ix(t,e){if(t===void 0||t==="")return e;return t==="true"||t==="1"}function hi(t){if(!t)return null;try{let n=new URL(t).hostname;if(n==="localhost"||n==="127.0.0.1"||n==="::1")return null;return t}catch{return null}}var ax=new Set(["agent-sandbox","user-desktop"]);function ux(t){let e=t&&t.length>0?t:"user-desktop";if(e==="cluster")return"agent-sandbox";if(!ax.has(e))throw Error(`Unknown STUDIO_SANDBOX_PROVIDER="${t}" \u2014 expected "agent-sandbox", legacy "cluster", or "user-desktop".`);return e}function Ei(t,e){let n=t.home||e.DATA_DIR||e.DECOCMS_HOME||`${dm()}/deco`,u=t.localMode,a=t.nodeEnv||e.NODE_ENV||"development",o=e.NATS_URL||"nats://localhost:4222",m=ex(e.NATS_TUNNEL_PUBLIC_ENABLED)??!!e.NATS_PUBLIC_URL;return{settings:{nodeEnv:a,port:Number(t.port)||Number(e.PORT)||3000,baseUrl:t.baseUrl||e.BASE_URL,dataDir:n,databasePgSsl:W(e.DATABASE_PG_SSL),databasePoolMax:Number(e.DATABASE_POOL_MAX)||5,betterAuthSecret:e.BETTER_AUTH_SECRET||"",encryptionKey:e.ENCRYPTION_KEY||"",meshJwtSecret:e.MESH_JWT_SECRET,localMode:u,disableRateLimit:W(e.DISABLE_RATE_LIMIT),studioProvisionSecretKey:e.STUDIO_PROVISION_SECRET_KEY,clickhouseUrl:e.CLICKHOUSE_URL,clickhouseMaxMemoryUsage:Number(e.CLICKHOUSE_MAX_MEMORY_USAGE)||void 0,monitoringOtlpEndpoint:e.MONITORING_OTLP_ENDPOINT,otelServiceName:e.OTEL_SERVICE_NAME||"studio",natsPublicUrl:e.NATS_PUBLIC_URL,natsTunnelPublicEnabled:m,natsTunnelSessionTtlSeconds:nx("NATS_TUNNEL_SESSION_TTL_SECONDS",e.NATS_TUNNEL_SESSION_TTL_SECONDS,900),natsOperatorJwt:e.NATS_OPERATOR_JWT,natsAccountJwt:e.NATS_ACCOUNT_JWT,natsAccountSigningKey:e.NATS_ACCOUNT_SIGNING_KEY,natsCredsPath:e.NATS_CREDS,configPath:e.CONFIG_PATH||"./config.json",aiGatewayEnabled:W(e.DECO_AI_GATEWAY_ENABLED),aiGatewayUrl:e.DECO_AI_GATEWAY_URL||"https://ai-site.deco.site",enableDecoImport:W(e.ENABLE_DECO_IMPORT),mcpCacheEnabled:ix(e.MCP_CACHE_ENABLED,a!=="development"),orgFsPublicSetsJson:e.ORGFS_PUBLIC_SETS,orgFsMountsDisabled:W(e.DISABLE_ORGFS_MOUNTS),s3Endpoint:e.S3_ENDPOINT,s3Bucket:e.S3_BUCKET,s3Region:e.S3_REGION||"auto",s3AccessKeyId:e.S3_ACCESS_KEY_ID,s3SecretAccessKey:e.S3_SECRET_ACCESS_KEY,s3ForcePathStyle:e.S3_FORCE_PATH_STYLE===void 0||e.S3_FORCE_PATH_STYLE===""||e.S3_FORCE_PATH_STYLE==="true"||e.S3_FORCE_PATH_STYLE==="1",monitoringS3Bucket:e.MONITORING_S3_BUCKET,monitoringS3Endpoint:e.MONITORING_S3_ENDPOINT,monitoringS3Region:e.MONITORING_S3_REGION,monitoringS3AccessKeyId:e.MONITORING_S3_ACCESS_KEY_ID,monitoringS3SecretAccessKey:e.MONITORING_S3_SECRET_ACCESS_KEY,monitoringS3Prefix:e.MONITORING_S3_PREFIX,duckdbExtensionDirectory:e.DUCKDB_EXTENSION_DIRECTORY||"/opt/duckdb/extensions",duckdbMemoryLimit:e.DUCKDB_MEMORY_LIMIT||void 0,duckdbThreads:e.DUCKDB_THREADS?Number(e.DUCKDB_THREADS):void 0,isCli:!0,noTui:t.noTui===!0,podName:e.POD_NAME??crypto.randomUUID(),dispatchRole:tx(e.MESH_DISPATCH_ROLE),sandboxProviderKind:ux(e.STUDIO_SANDBOX_PROVIDER),decoSupabaseUrl:e.DECO_SUPABASE_URL,decoSupabaseServiceKey:e.DECO_SUPABASE_SERVICE_KEY,firecrawlApiKey:e.FIRECRAWL_API_KEY,commerceDiscoveryInternalApiUrl:e.COMMERCE_DISCOVERY_INTERNAL_API_URL,commerceDiscoveryInternalApiKey:e.COMMERCE_DISCOVERY_INTERNAL_API_KEY,s3TenantBucket:e.S3_TENANT_BUCKET||"new-deco-sites-assets",s3TenantRegion:e.S3_TENANT_REGION||"us-west-2",s3TenantEndpoint:e.S3_TENANT_ENDPOINT,s3TenantPublicUrlBase:e.S3_TENANT_PUBLIC_URL_BASE||"https://decoims.com",awsS3TenantRoleArn:e.AWS_S3_TENANT_ROLE_ARN,awsS3TenantProvisionerAccessKeyId:e.AWS_S3_TENANT_PROVISIONER_ACCESS_KEY_ID,awsS3TenantProvisionerSecretAccessKey:e.AWS_S3_TENANT_PROVISIONER_SECRET_ACCESS_KEY},externalDatabaseUrl:hi(e.DATABASE_URL),externalNatsUrl:hi(o),skipMigrations:t.skipMigrations}}var ot=null;function $(){if(!ot)ox();return ot}function ox(){if(ot)return;let t={...process.env},e=Ei({port:t.PORT||"3000",home:t.DATA_DIR||t.DECOCMS_HOME||"",localMode:t.DECOCMS_LOCAL_MODE==="true",skipMigrations:!0,noTui:t.DECO_NO_TUI==="true",vitePort:t.VITE_PORT,baseUrl:t.BASE_URL},t);ot=Object.freeze({...e.settings,databaseUrl:t.DATABASE_URL??"postgresql://postgres:postgres@localhost:5432/postgres",natsUrls:(t.NATS_URL||"nats://localhost:4222").split(",").map((n)=>n.trim()).filter(Boolean)})}import{createContextKey as yx,metrics as sx,propagation as Xy,ROOT_CONTEXT as Fy,SpanStatusCode as Sy,trace as fx}from"@opentelemetry/api";import{logs as Tx,SeverityNumber as Zn}from"@opentelemetry/api-logs";import{OTLPLogExporter as Oy}from"@opentelemetry/exporter-logs-otlp-proto";import{PrometheusExporter as px}from"@opentelemetry/exporter-prometheus";import{OTLPTraceExporter as Yy}from"@opentelemetry/exporter-trace-otlp-proto";import{RuntimeNodeInstrumentation as By}from"@opentelemetry/instrumentation-runtime-node";import{context as jc,propagation as Rc,SpanKind as Jc,SpanStatusCode as Ac}from"@opentelemetry/api";var $c=globalThis.fetch;import{ExportResultCode as Gc}from"@opentelemetry/core";import{ExportResultCode as _t}from"@opentelemetry/core";import{mkdir as _x,rename as mx,writeFile as xx}from"fs/promises";import{join as mt}from"path";class xt{bufferItems=[];bufferBytes=0;flushTimer=null;flushQueue=Promise.resolve();basePath;flushThreshold;maxBufferBytes;isShutdown=!1;knownDirs=new Set;partitionKey;constructor(t){this.basePath=t.basePath,this.flushThreshold=t.flushThreshold??1000,this.maxBufferBytes=t.maxBufferBytes??10485760,this.partitionKey=t.partitionKey;let e=t.flushIntervalMs??60000;if(e>0&&e<3600000){if(this.flushTimer=setInterval(()=>{this.flush().catch((n)=>{console.error("[NDJSONExporter] Timer flush failed:",n)})},e),this.flushTimer&&typeof this.flushTimer==="object"&&"unref"in this.flushTimer)this.flushTimer.unref()}}exportRows(t){if(this.isShutdown)return Promise.resolve({code:_t.FAILED});for(let e of t){let n=JSON.stringify(e),u=this.partitionKey?this.partitionKey(e):"";this.bufferItems.push({partition:u,json:n}),this.bufferBytes+=Buffer.byteLength(n,"utf8")+1}if(this.bufferItems.length>=this.flushThreshold||this.bufferBytes>=this.maxBufferBytes)return this.flush().then(()=>({code:_t.SUCCESS})).catch((e)=>{return console.error("[NDJSONExporter] Flush failed:",e),{code:_t.FAILED}});return Promise.resolve({code:_t.SUCCESS})}async shutdown(){if(this.isShutdown=!0,this.flushTimer)clearInterval(this.flushTimer),this.flushTimer=null;try{await this.flushQueue}catch{}if(this.bufferItems.length>0)await this.flush()}async forceFlush(){try{await this.flushQueue}catch{}if(this.bufferItems.length>0)await this.flush()}flush(){let e=this.flushQueue.catch(()=>{}).then(()=>this.doFlush());return this.flushQueue=e,e}async doFlush(){if(this.bufferItems.length===0)return;let t=this.bufferItems;this.bufferItems=[],this.bufferBytes=0;let e=new Map;for(let a of t){let o=e.get(a.partition);if(!o)o=[],e.set(a.partition,o);o.push(a.json)}let n=await Promise.allSettled(Array.from(e.entries()).map(([a,o])=>this.writeNDJSON(o,a).then(()=>a))),u=n.find((a)=>a.status==="rejected");if(u){let a=new Set;for(let m of n)if(m.status==="fulfilled")a.add(m.value);let o=t.filter((m)=>!a.has(m.partition));this.bufferItems=o.concat(this.bufferItems),this.bufferBytes=0;for(let m of this.bufferItems)this.bufferBytes+=Buffer.byteLength(m.json,"utf8")+1;throw u.reason}}async writeNDJSON(t,e){let n=new Date,u=[String(n.getUTCFullYear()),String(n.getUTCMonth()+1).padStart(2,"0"),String(n.getUTCDate()).padStart(2,"0"),String(n.getUTCHours()).padStart(2,"0")],a=e?mt(this.basePath,e,...u):mt(this.basePath,...u);if(!this.knownDirs.has(a))await _x(a,{recursive:!0,mode:448}),this.knownDirs.add(a);let o=`${crypto.randomUUID()}.ndjson`,m=mt(a,`.${o}.tmp`),_=mt(a,o),x=t.join(`
|
|
1010
|
+
`.execute(t)}async function dm(t){await L`DROP TRIGGER IF EXISTS trg_repo_github_child_single_parent ON connection_aggregations;`.execute(t),await L`DROP FUNCTION IF EXISTS enforce_repo_github_child_single_parent();`.execute(t),await L`DROP FUNCTION IF EXISTS try_parse_jsonb(text);`.execute(t)}var Zn={};i(Zn,{up:()=>bm,down:()=>tx});import{sql as On}from"kysely";async function bm(t){await t.schema.createTable("task_board_items").addColumn("id","text",(e)=>e.primaryKey().notNull()).addColumn("organization_id","text",(e)=>e.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(e)=>e.notNull()).addColumn("description","text").addColumn("status","text",(e)=>e.notNull().defaultTo("triage")).addColumn("priority","text",(e)=>e.notNull().defaultTo("medium")).addColumn("assignee_id","text").addColumn("created_by","text",(e)=>e.notNull()).addColumn("created_at","timestamptz",(e)=>e.notNull().defaultTo(On`now()`)).addColumn("updated_by","text",(e)=>e.notNull()).addColumn("updated_at","timestamptz",(e)=>e.notNull().defaultTo(On`now()`)).execute(),await t.schema.createIndex("idx_task_board_items_org").on("task_board_items").column("organization_id").execute(),await t.schema.alterTable("organization_settings").addColumn("task_board_enabled","boolean",(e)=>e.notNull().defaultTo(On`false`)).execute()}async function tx(t){await t.schema.alterTable("organization_settings").dropColumn("task_board_enabled").execute(),await t.schema.dropTable("task_board_items").execute()}var ex={"001-initial-schema":yt,"002-organization-settings":ct,"003-connection-schema-align":ft,"004-remove-models-binding":Tt,"005-connection-configuration":pt,"006-add-views-to-settings":st,"007-monitoring-logs":wt,"008-event-bus":Ct,"009-drop-audit-logs":Nt,"010-gateways":Et,"011-gateway-icon":ht,"012-gateway-tool-selection-mode":Kt,"013-monitoring-user-agent-gateway":kt,"014-gateway-resources-prompts":Pt,"015-monitoring-properties":zt,"016-downstream-token-client-info":Ut,"017-downstream-token-remove-userid":Dt,"018-drop-gateway-tool-selection-strategy":Lt,"019-remove-gateway-is-default":jt,"020-enabled-plugins":Rt,"021-threads":gt,"022-rename-gateway-to-virtual-mcp":Jt,"023-optimize-thread-indexes":At,"024-consolidate-virtual-mcp":Wt,"025-add-monitoring-virtual-mcp-id":$t,"026-restrict-child-connection-delete":Xt,"027-update-management-mcp-url":Ft,"028-update-management-mcp-to-self":Qt,"029-add-updated-by-to-connections":Ot,"030-member-tags":Zt,"031-add-dependency-mode":Ht,"032-projects":Yt,"033-thread-status":Bt,"034-monitoring-dashboards":It,"035-project-connections":Gt,"036-update-registry-url":vt,"037-ai-provider-keys":Vt,"038-oauth-pkce-states":qt,"039-automations":lt,"040-replace-next-run-at-with-last-run-at":dt,"041-ai-provider-keys-unique-constraint":bt,"042-rename-mesh-mcp-to-cms-mcp":te,"043-rename-cms-mcp-to-deco-cms":ee,"044-drop-connections-tools-column":ne,"045-thread-context-start-message":ie,"046-remove-object-storage-plugin":ue,"047-add-next-run-at":oe,"048-merge-projects-agents":me,"049-remove-org-admin-projects":xe,"050-durable-agent-runs":re,"051-org-sso":ce,"052-thread-agent-ids":fe,"053-registry-config":Te,"054-connection-slug":se,"055-spaces":we,"056-automation-project-scope":Ce,"057-thread-virtual-mcp-id":Ne,"058-trigger-callback-tokens":Ee,"059-kv":he,"060-member-index":Ke,"061-downstream-token-connection-index":ke,"062-private-registry":Pe,"063-event-subscriptions-enabled-boolean":ze,"064-brand-context":Ue,"065-organization-domains":De,"066-brand-context-structured":Le,"067-threads-metadata":je,"068-threads-branch":Re,"069-sandbox-runner-state":ge,"070-model-categories":Je,"071-default-home-agents":Ae,"072-ai-provider-key-preset-id":We,"073-backfill-basic-usage-roles":$e,"074-sandbox-runner-state-handle-nonunique":Xe,"075-thread-inflight-async-jobs":Se,"076-automations-drop-agent-json":Fe,"077-tier-only-model-selection":Qe,"078-automation-tool-call-kind":Oe,"079-strip-legacy-freestyle-vm-map-entries":Ze,"080-async-research-jobs":He,"081-async-research-jobs-result-content":Ye,"082-secrets":Be,"083-thread-run-locally":Ie,"084-drop-host-sandbox-rows":Ge,"085-rename-runner-kind":ve,"086-thread-pins-and-vm-map-rekey":Ve,"087-fix-vm-map-rekey":qe,"088-purge-cli-activate-keys":le,"089-rename-remote-user-to-desktop":de,"090-automation-webhook-triggers":be,"091-organization-domains-allow-multi":tn,"092-sandbox-naming-uniformization":en,"093-backfill-global-search-basic-usage":nn,"094-org-file-configs":un,"095-remove-automation-tool-call-kind":on,"096-org-file-configs-public-url-base":_n,"097-drop-local-docker-sandbox-state":xn,"098-thread-message-parts":rn,"099-run-fence":yn,"100-link-transport":cn,"101-cancel-requested-at":fn,"102-observational-agent":Tn,"103-revert-observational-agent":pn,"104-agent-sandbox-provider-kind":wn,"105-org-fs":Cn,"106-automation-tools":Nn,"107-org-fs-public-org":En,"108-automation-max-agent-steps":hn,"109-thread-message-parts-per-message-seq":Kn,"110-backfill-ghs-token-expiry":kn,"111-org-fs-thread-id":Pn,"112-org-file-configs-credential-type":zn,"113-thread-failure-reason":Un,"114-run-acked-seq":Dn,"115-thread-projected-seq":Ln,"116-org-sites":jn,"117-org-file-configs-site-slug":Rn,"118-organization-domains-multi-verify":gn,"119-organization-join-requests":Jn,"120-org-fs-read-public":An,"121-org-fs-share-password":Wn,"122-split-web-research-tier":Sn,"123-connection-credential-vault":Fn,"124-drop-thread-projected-seq":Mn,"125-github-child-single-parent":Qn,"126-task-board":Zn},Hn=ex;import{getMigrations as Ax}from"better-auth/db";import{sso as Wx}from"@better-auth/sso";import{organization as $x}from"@decocms/better-auth/plugins";import{admin as Xx,apiKey as Sx,jwt as Fx,magicLink as Mx,mcp as Qx,openAPI as Ox}from"better-auth/plugins";import{emailOTP as Zx}from"better-auth/plugins/email-otp";import{Kysely as Ux,PostgresDialect as Ji}from"kysely";import{Pool as Ai}from"pg";import{homedir as nx}from"os";var ix=new Set(["all","worker","api"]);function ax(t){let e=(t??"").trim();return ix.has(e)?e:"all"}function W(t){return t==="true"||t==="1"}function ux(t){if(t===void 0||t==="")return;return W(t)}function ox(t,e,n){if(e===void 0||e==="")return n;let u=Number(e);if(!Number.isSafeInteger(u)||u<=0)throw Error(`${t} must be a positive integer`);return u}function _x(t,e){if(t===void 0||t==="")return e;return t==="true"||t==="1"}function Ki(t){if(!t)return null;try{let n=new URL(t).hostname;if(n==="localhost"||n==="127.0.0.1"||n==="::1")return null;return t}catch{return null}}var mx=new Set(["agent-sandbox","user-desktop"]);function xx(t){let e=t&&t.length>0?t:"user-desktop";if(e==="cluster")return"agent-sandbox";if(!mx.has(e))throw Error(`Unknown STUDIO_SANDBOX_PROVIDER="${t}" \u2014 expected "agent-sandbox", legacy "cluster", or "user-desktop".`);return e}function ki(t,e){let n=t.home||e.DATA_DIR||e.DECOCMS_HOME||`${nx()}/deco`,u=t.localMode,a=t.nodeEnv||e.NODE_ENV||"development",o=e.NATS_URL||"nats://localhost:4222",m=ux(e.NATS_TUNNEL_PUBLIC_ENABLED)??!!e.NATS_PUBLIC_URL;return{settings:{nodeEnv:a,port:Number(t.port)||Number(e.PORT)||3000,baseUrl:t.baseUrl||e.BASE_URL,dataDir:n,databasePgSsl:W(e.DATABASE_PG_SSL),databasePoolMax:Number(e.DATABASE_POOL_MAX)||5,betterAuthSecret:e.BETTER_AUTH_SECRET||"",encryptionKey:e.ENCRYPTION_KEY||"",meshJwtSecret:e.MESH_JWT_SECRET,localMode:u,disableRateLimit:W(e.DISABLE_RATE_LIMIT),studioProvisionSecretKey:e.STUDIO_PROVISION_SECRET_KEY,clickhouseUrl:e.CLICKHOUSE_URL,clickhouseMaxMemoryUsage:Number(e.CLICKHOUSE_MAX_MEMORY_USAGE)||void 0,monitoringOtlpEndpoint:e.MONITORING_OTLP_ENDPOINT,otelServiceName:e.OTEL_SERVICE_NAME||"studio",natsPublicUrl:e.NATS_PUBLIC_URL,natsTunnelPublicEnabled:m,natsTunnelSessionTtlSeconds:ox("NATS_TUNNEL_SESSION_TTL_SECONDS",e.NATS_TUNNEL_SESSION_TTL_SECONDS,900),natsOperatorJwt:e.NATS_OPERATOR_JWT,natsAccountJwt:e.NATS_ACCOUNT_JWT,natsAccountSigningKey:e.NATS_ACCOUNT_SIGNING_KEY,natsCredsPath:e.NATS_CREDS,configPath:e.CONFIG_PATH||"./config.json",aiGatewayEnabled:W(e.DECO_AI_GATEWAY_ENABLED),aiGatewayUrl:e.DECO_AI_GATEWAY_URL||"https://ai-site.deco.site",enableDecoImport:W(e.ENABLE_DECO_IMPORT),mcpCacheEnabled:_x(e.MCP_CACHE_ENABLED,a!=="development"),orgFsPublicSetsJson:e.ORGFS_PUBLIC_SETS,orgFsMountsDisabled:W(e.DISABLE_ORGFS_MOUNTS),s3Endpoint:e.S3_ENDPOINT,s3Bucket:e.S3_BUCKET,s3Region:e.S3_REGION||"auto",s3AccessKeyId:e.S3_ACCESS_KEY_ID,s3SecretAccessKey:e.S3_SECRET_ACCESS_KEY,s3ForcePathStyle:e.S3_FORCE_PATH_STYLE===void 0||e.S3_FORCE_PATH_STYLE===""||e.S3_FORCE_PATH_STYLE==="true"||e.S3_FORCE_PATH_STYLE==="1",monitoringS3Bucket:e.MONITORING_S3_BUCKET,monitoringS3Endpoint:e.MONITORING_S3_ENDPOINT,monitoringS3Region:e.MONITORING_S3_REGION,monitoringS3AccessKeyId:e.MONITORING_S3_ACCESS_KEY_ID,monitoringS3SecretAccessKey:e.MONITORING_S3_SECRET_ACCESS_KEY,monitoringS3Prefix:e.MONITORING_S3_PREFIX,duckdbExtensionDirectory:e.DUCKDB_EXTENSION_DIRECTORY||"/opt/duckdb/extensions",duckdbMemoryLimit:e.DUCKDB_MEMORY_LIMIT||void 0,duckdbThreads:e.DUCKDB_THREADS?Number(e.DUCKDB_THREADS):void 0,isCli:!0,noTui:t.noTui===!0,podName:e.POD_NAME??crypto.randomUUID(),dispatchRole:ax(e.MESH_DISPATCH_ROLE),sandboxProviderKind:xx(e.STUDIO_SANDBOX_PROVIDER),decoSupabaseUrl:e.DECO_SUPABASE_URL,decoSupabaseServiceKey:e.DECO_SUPABASE_SERVICE_KEY,firecrawlApiKey:e.FIRECRAWL_API_KEY,commerceDiscoveryInternalApiUrl:e.COMMERCE_DISCOVERY_INTERNAL_API_URL,commerceDiscoveryInternalApiKey:e.COMMERCE_DISCOVERY_INTERNAL_API_KEY,s3TenantBucket:e.S3_TENANT_BUCKET||"new-deco-sites-assets",s3TenantRegion:e.S3_TENANT_REGION||"us-west-2",s3TenantEndpoint:e.S3_TENANT_ENDPOINT,s3TenantPublicUrlBase:e.S3_TENANT_PUBLIC_URL_BASE||"https://decoims.com",awsS3TenantRoleArn:e.AWS_S3_TENANT_ROLE_ARN,awsS3TenantProvisionerAccessKeyId:e.AWS_S3_TENANT_PROVISIONER_ACCESS_KEY_ID,awsS3TenantProvisionerSecretAccessKey:e.AWS_S3_TENANT_PROVISIONER_SECRET_ACCESS_KEY},externalDatabaseUrl:Ki(e.DATABASE_URL),externalNatsUrl:Ki(o),skipMigrations:t.skipMigrations}}var ot=null;function $(){if(!ot)rx();return ot}function rx(){if(ot)return;let t={...process.env},e=ki({port:t.PORT||"3000",home:t.DATA_DIR||t.DECOCMS_HOME||"",localMode:t.DECOCMS_LOCAL_MODE==="true",skipMigrations:!0,noTui:t.DECO_NO_TUI==="true",vitePort:t.VITE_PORT,baseUrl:t.BASE_URL},t);ot=Object.freeze({...e.settings,databaseUrl:t.DATABASE_URL??"postgresql://postgres:postgres@localhost:5432/postgres",natsUrls:(t.NATS_URL||"nats://localhost:4222").split(",").map((n)=>n.trim()).filter(Boolean)})}import{createContextKey as sx,metrics as wx,propagation as Oc,ROOT_CONTEXT as Zc,SpanStatusCode as Hc,trace as Cx}from"@opentelemetry/api";import{logs as Nx,SeverityNumber as Yn}from"@opentelemetry/api-logs";import{OTLPLogExporter as Ic}from"@opentelemetry/exporter-logs-otlp-proto";import{PrometheusExporter as Ex}from"@opentelemetry/exporter-prometheus";import{OTLPTraceExporter as Vc}from"@opentelemetry/exporter-trace-otlp-proto";import{RuntimeNodeInstrumentation as lc}from"@opentelemetry/instrumentation-runtime-node";import{context as $y,propagation as Xy,SpanKind as Sy,SpanStatusCode as Fy}from"@opentelemetry/api";var Qy=globalThis.fetch;import{ExportResultCode as dy}from"@opentelemetry/core";import{ExportResultCode as _t}from"@opentelemetry/core";import{mkdir as yx,rename as cx,writeFile as fx}from"fs/promises";import{join as mt}from"path";class xt{bufferItems=[];bufferBytes=0;flushTimer=null;flushQueue=Promise.resolve();basePath;flushThreshold;maxBufferBytes;isShutdown=!1;knownDirs=new Set;partitionKey;constructor(t){this.basePath=t.basePath,this.flushThreshold=t.flushThreshold??1000,this.maxBufferBytes=t.maxBufferBytes??10485760,this.partitionKey=t.partitionKey;let e=t.flushIntervalMs??60000;if(e>0&&e<3600000){if(this.flushTimer=setInterval(()=>{this.flush().catch((n)=>{console.error("[NDJSONExporter] Timer flush failed:",n)})},e),this.flushTimer&&typeof this.flushTimer==="object"&&"unref"in this.flushTimer)this.flushTimer.unref()}}exportRows(t){if(this.isShutdown)return Promise.resolve({code:_t.FAILED});for(let e of t){let n=JSON.stringify(e),u=this.partitionKey?this.partitionKey(e):"";this.bufferItems.push({partition:u,json:n}),this.bufferBytes+=Buffer.byteLength(n,"utf8")+1}if(this.bufferItems.length>=this.flushThreshold||this.bufferBytes>=this.maxBufferBytes)return this.flush().then(()=>({code:_t.SUCCESS})).catch((e)=>{return console.error("[NDJSONExporter] Flush failed:",e),{code:_t.FAILED}});return Promise.resolve({code:_t.SUCCESS})}async shutdown(){if(this.isShutdown=!0,this.flushTimer)clearInterval(this.flushTimer),this.flushTimer=null;try{await this.flushQueue}catch{}if(this.bufferItems.length>0)await this.flush()}async forceFlush(){try{await this.flushQueue}catch{}if(this.bufferItems.length>0)await this.flush()}flush(){let e=this.flushQueue.catch(()=>{}).then(()=>this.doFlush());return this.flushQueue=e,e}async doFlush(){if(this.bufferItems.length===0)return;let t=this.bufferItems;this.bufferItems=[],this.bufferBytes=0;let e=new Map;for(let a of t){let o=e.get(a.partition);if(!o)o=[],e.set(a.partition,o);o.push(a.json)}let n=await Promise.allSettled(Array.from(e.entries()).map(([a,o])=>this.writeNDJSON(o,a).then(()=>a))),u=n.find((a)=>a.status==="rejected");if(u){let a=new Set;for(let m of n)if(m.status==="fulfilled")a.add(m.value);let o=t.filter((m)=>!a.has(m.partition));this.bufferItems=o.concat(this.bufferItems),this.bufferBytes=0;for(let m of this.bufferItems)this.bufferBytes+=Buffer.byteLength(m.json,"utf8")+1;throw u.reason}}async writeNDJSON(t,e){let n=new Date,u=[String(n.getUTCFullYear()),String(n.getUTCMonth()+1).padStart(2,"0"),String(n.getUTCDate()).padStart(2,"0"),String(n.getUTCHours()).padStart(2,"0")],a=e?mt(this.basePath,e,...u):mt(this.basePath,...u);if(!this.knownDirs.has(a))await yx(a,{recursive:!0,mode:448}),this.knownDirs.add(a);let o=`${crypto.randomUUID()}.ndjson`,m=mt(a,`.${o}.tmp`),_=mt(a,o),x=t.join(`
|
|
1011
1011
|
`)+`
|
|
1012
|
-
`;await
|
|
1012
|
+
`;await fx(m,x,{mode:384}),await cx(m,_)}}import{ExportResultCode as ic}from"@opentelemetry/core";import{AggregationTemporality as uc,DataPointType as oc}from"@opentelemetry/sdk-metrics";import{ExportResultCode as cc}from"@opentelemetry/core";var sc=Buffer.byteLength("... [TRUNCATED]","utf8");import{BatchLogRecordProcessor as _f,LoggerProvider as mf}from"@opentelemetry/sdk-logs";import{detectResources as rf,envDetector as yf,hostDetector as cf,osDetector as ff,processDetector as Tf,resourceFromAttributes as pf}from"@opentelemetry/resources";import{PeriodicExportingMetricReader as wf}from"@opentelemetry/sdk-metrics";import{NOOP_LOGGER as Nc}from"@opentelemetry/api-logs";import{NodeSDK as Ef}from"@opentelemetry/sdk-node";import{BatchSpanProcessor as Kf,SamplingDecision as X}from"@opentelemetry/sdk-trace-base";import{SpanStatusCode as Pc}from"@opentelemetry/api";var hx="__d",Kx=sx("Current request"),kx=1;var zi=(t)=>{let n=new URL(t.url).searchParams.get(hx);if(n==="")return crypto.randomUUID();if(!n)n=t.headers.get("x-trace-debug-id");return n};class Ui{inner;constructor(t){this.inner=t}shouldSample(t,e,n,u,a,o){let m=t.getValue(Kx);if(!m){if(this.inner)return this.inner.shouldSample(t,e,n,u,a,o);return{decision:X.RECORD_AND_SAMPLED}}let _=zi(m);if(_)return{decision:X.RECORD_AND_SAMPLED,attributes:{"trace.debug.id":_}};if(this.inner){let x=this.inner.shouldSample(t,e,n,u,a,o);if(x.decision===X.RECORD_AND_SAMPLED){let r=crypto.randomUUID();x.attributes={...x.attributes??{},"trace.debug.id":r}}return x}return{decision:X.NOT_RECORD}}toString(){return"DebugSampler"}}class Di{ratio;constructor(t){this.ratio=t}shouldSample(){if(Math.random()<this.ratio)return{decision:X.RECORD_AND_SAMPLED};return{decision:X.NOT_RECORD}}toString(){return`RatioSampler(${this.ratio})`}}var Pf=new Ex({preventServerStart:!0}),zf=new Ui(new Di(kx));var Pi=Cx.getTracer("studio","1.0.0"),B=wx.getMeter("studio","1.0.0"),Px=Nx.getLogger("studio","1.0.0"),Bn=(t,e,n)=>{let u={},a=n,o=n[n.length-1];if(o!==null&&typeof o==="object"&&!Array.isArray(o)&&!(o instanceof Error)&&Object.getPrototypeOf(o)===Object.prototype)u=o,a=n.slice(0,-1);let m=a.map((_)=>{if(_ instanceof Error)return`${_.name}: ${_.message}`;if(typeof _==="object")try{return JSON.stringify(_)}catch{return"[Object]"}return String(_)}).join(" ");Px.emit({severityNumber:t,severityText:e,body:m,attributes:{"log.source":"console",...u}})},In={error:console.error.bind(console),warn:console.warn.bind(console),debug:console.debug.bind(console)};console.error=(...t)=>{Bn(Yn.ERROR,"ERROR",t),In.error(...t)};console.warn=(...t)=>{Bn(Yn.WARN,"WARN",t),In.warn(...t)};console.debug=(...t)=>{Bn(Yn.DEBUG,"DEBUG",t),In.debug(...t)};var Gn,Li=0,vn=500;function zx(){if(Gn)return;let t=performance.now()+vn;Gn=setInterval(()=>{let e=performance.now();Li=Math.max(0,e-t),t=e+vn},vn),Gn.unref?.()}function ji(){return zx(),Li}var Dx=()=>B.createHistogram("db.query.duration",{description:"Database query execution duration in milliseconds",unit:"ms"}),Ri=()=>B.createHistogram("db.pool.acquire.duration",{description:"Time spent waiting to acquire a connection from the pool",unit:"ms"}),gi=400,Lx=100,jx=(t)=>(e)=>{let n={"db.statement":e.query.sql,"db.status":e.level==="error"?"error":"success"};if(e.queryDurationMillis>gi){let u=ji(),a=u>gi/2;console.error(a?"Slow query measurement \u2014 likely event-loop lag, not slow SQL:":"Slow query detected:",{durationMs:e.queryDurationMillis,eventLoopLagMs:Math.round(u),sql:e.query.sql,pool:{total:t.totalCount,idle:t.idleCount,waiting:t.waitingCount,max:rt()}})}if(Dx().record(e.queryDurationMillis,n),e.level==="error")console.error("Query failed:",{durationMs:e.queryDurationMillis,error:e.error,sql:e.query.sql})};function Rx(t){let e=t.connect.bind(t);return t.connect=(n)=>{if(typeof n==="function")return e(n);let u=performance.now(),a=rt(),o=t.idleCount===0&&t.totalCount>=a,m=t.idleCount;return e().then((_)=>{let x=performance.now()-u;if(Ri().record(x,{"db.pool.outcome":o?"contended":"available"}),x>Lx)if(o)console.error("Slow db pool acquire \u2014 pool saturated:",{waitMs:x,total:t.totalCount,idle:t.idleCount,waiting:t.waitingCount,max:a});else console.warn("Slow db pool acquire \u2014 event-loop lag (not pool):",{waitMs:x,idleAtStart:m,total:t.totalCount,max:a});return _},(_)=>{throw Ri().record(performance.now()-u,{"db.pool.outcome":"error"}),_})},t}var Wi={keepAlive:!0,keepAliveInitialDelayMillis:1e4,idleTimeoutMillis:300000,connectionTimeoutMillis:30000,allowExitOnIdle:!0};function $i(){try{return $().databasePgSsl}catch{return!1}}function rt(){try{return $().databasePoolMax}catch{return 10}}function gx(t){let e=Rx(new Ai({connectionString:t,max:rt(),ssl:$i(),...Wi})),n=new Ji({pool:e});return{type:"postgres",db:new Ux({dialect:n,log:jx(e)}),pool:e}}function G(){return $().databaseUrl}function Xi(t){let e=t||G();return new Ji({pool:new Ai({connectionString:e,max:rt(),ssl:$i(),...Wi})})}function Jx(t){let e=t||G();return gx(e)}async function Si(t){if(await t.db.destroy(),!t.pool.ended)await t.pool.end();if(t===I)I=null}var I=null;function Vn(){if(!I)I=Jx(G());return I}async function Fi(t){let n={database:Xi(t||G()),plugins:[$x({dynamicAccessControl:{enabled:!0,enableCustomResources:!0}}),Xx(),Sx(),Fx(),Ox(),Qx({loginPage:"/login"}),Wx(),Mx({sendMagicLink:async()=>{}}),Zx({sendVerificationOTP:async()=>{}})]},{toBeAdded:u,toBeCreated:a,runMigrations:o}=await Ax(n);if(!u.length&&!a.length)return"up to date";return await o(),`${a.length+u.length} table(s) migrated`}async function Qi(t,e){return(await S`
|
|
1013
1013
|
SELECT table_name FROM information_schema.tables
|
|
1014
1014
|
WHERE table_schema='public' AND table_name=${e}
|
|
1015
|
-
`.execute(t)).rows.length>0}async function
|
|
1015
|
+
`.execute(t)).rows.length>0}async function Hx(t){if(await Qi(t,"plugin_migrations"))return;await S`
|
|
1016
1016
|
CREATE TABLE plugin_migrations (
|
|
1017
1017
|
plugin_id TEXT NOT NULL,
|
|
1018
1018
|
name TEXT NOT NULL,
|
|
1019
1019
|
timestamp TEXT NOT NULL,
|
|
1020
1020
|
PRIMARY KEY (plugin_id, name)
|
|
1021
1021
|
)
|
|
1022
|
-
`.execute(t)}async function
|
|
1022
|
+
`.execute(t)}async function Yx(t){if(!await Qi(t,"kysely_migration"))return;let e=await S`
|
|
1023
1023
|
SELECT name, timestamp FROM kysely_migration
|
|
1024
1024
|
WHERE name LIKE '%/%'
|
|
1025
|
-
`.execute(t);if(e.rows.length===0)return;for(let{name:n,timestamp:u}of e.rows){let a=n;if(n.includes("~plugins/"))a=n.substring(n.indexOf("~plugins/")+9);let o=a.indexOf("/");if(o===-1){console.warn(`Skipping malformed plugin migration: ${n}`);continue}let m=a.substring(0,o),_=a.substring(o+1);try{await
|
|
1025
|
+
`.execute(t);if(e.rows.length===0)return;for(let{name:n,timestamp:u}of e.rows){let a=n;if(n.includes("~plugins/"))a=n.substring(n.indexOf("~plugins/")+9);let o=a.indexOf("/");if(o===-1){console.warn(`Skipping malformed plugin migration: ${n}`);continue}let m=a.substring(0,o),_=a.substring(o+1);try{await S`
|
|
1026
1026
|
INSERT INTO plugin_migrations (plugin_id, name, timestamp)
|
|
1027
1027
|
VALUES (${m}, ${_}, ${u})
|
|
1028
|
-
`.execute(t)}catch{let x=await
|
|
1028
|
+
`.execute(t)}catch{let x=await S`
|
|
1029
1029
|
SELECT COUNT(*) as cnt FROM plugin_migrations
|
|
1030
1030
|
WHERE plugin_id = ${m} AND name = ${_}
|
|
1031
|
-
`.execute(t);if(Number(x.rows[0]?.cnt)===0){console.warn(`Failed to migrate ${m}/${_}, keeping in old table`);continue}}await
|
|
1031
|
+
`.execute(t);if(Number(x.rows[0]?.cnt)===0){console.warn(`Failed to migrate ${m}/${_}, keeping in old table`);continue}}await S`
|
|
1032
1032
|
DELETE FROM kysely_migration WHERE name = ${n}
|
|
1033
|
-
`.execute(t)}}async function
|
|
1033
|
+
`.execute(t)}}async function Bx(t){await Hx(t),await Yx(t);let e=new Mi({db:t,provider:{getMigrations:()=>Promise.resolve(Hn)}}),{error:n,results:u}=await e.migrateToLatest(),a=0;if(u?.forEach((o)=>{if(o.status==="Success")a++;else if(o.status==="Error")console.error(`Failed to execute migration "${o.migrationName}"`)}),n)throw console.error("Failed to migrate"),console.error(n),n;return a}async function Ix(t){let{keepOpen:e=!1,database:n,skipBetterAuth:u=!1}=t??{},a="skipped";if(!u&&!n)a=await Fi();let o=n??Vn(),m=async()=>{if(!e&&!n)await Si(o).catch((_)=>{console.warn("Warning: Error closing database:",_)})};try{let _=await Bx(o.db);return await m(),{betterAuth:a,kysely:_}}catch(_){throw await m(),_}}async function eT(){let t=Vn(),e=new Mi({db:t.db,provider:{getMigrations:()=>Promise.resolve(Hn)}}),{error:n,results:u}=await e.migrateDown();if(u?.forEach((a)=>{if(a.status==="Success")console.log(`\u2705 Migration "${a.migrationName}" rolled back successfully`);else if(a.status==="Error")console.error(`\u274C Failed to rollback migration "${a.migrationName}"`)}),n)throw console.error("Failed to rollback migration"),console.error(n),n}if(import.meta.main)(async()=>{try{await Ix(),console.log("Migrations completed."),process.exit(0)}catch(t){console.error("Migration failed:",t),process.exit(1)}})();export{Bx as runKyselyMigrations,Ix as migrateToLatest,eT as migrateDown};
|