decocms 2.180.0 → 2.180.1
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-B8eJ9Fod.js → AlertCircle-CbWLhYeZ.js} +1 -1
- package/dist/client/assets/{ArrowLeft-BsqjOo0a.js → ArrowLeft-B9NeadX7.js} +1 -1
- package/dist/client/assets/{ArrowUp-Cfk9ftkI.js → ArrowUp-DrfphUZ7.js} +1 -1
- package/dist/client/assets/{Check-LF3O8VSl.js → Check-DcjDmu9V.js} +1 -1
- package/dist/client/assets/{ChevronDown-CoxfMCD_.js → ChevronDown-DrbU8H5D.js} +1 -1
- package/dist/client/assets/{ChevronRight-CkZ762r8.js → ChevronRight-DDdv6Tbp.js} +1 -1
- package/dist/client/assets/{ChevronUp-CkQ5LXE4.js → ChevronUp-VuH0I39v.js} +1 -1
- package/dist/client/assets/{Container-C_jftBLa.js → Container-CGejuubt.js} +1 -1
- package/dist/client/assets/{Dataflow03-B_UyQRrQ.js → Dataflow03-pJrIM8ao.js} +1 -1
- package/dist/client/assets/{Download01-Dn7pc_mQ.js → Download01-CQYzJttq.js} +1 -1
- package/dist/client/assets/{FolderClosed-Csm3WP5B.js → FolderClosed-CVPLIN3O.js} +1 -1
- package/dist/client/assets/{Grid01-Bg8b-MfH.js → Grid01-B844I2C0.js} +1 -1
- package/dist/client/assets/{List-BpugyVN4.js → List-Tv7Uz5X9.js} +1 -1
- package/dist/client/assets/{Loading01-BkQZaZ86.js → Loading01-Bc-DhPB6.js} +1 -1
- package/dist/client/assets/{Play-Bpqump99.js → Play-DCXtg8WP.js} +1 -1
- package/dist/client/assets/{Plus-Dt2hP7ZJ.js → Plus-C4kspS_I.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-BEbjARvC.js → RefreshCcw01-WHy1Jkso.js} +1 -1
- package/dist/client/assets/{SearchMd-BFV4EEyM.js → SearchMd-BR3WTGyz.js} +1 -1
- package/dist/client/assets/{Settings01--CB8mKBF.js → Settings01-B10O7d_o.js} +1 -1
- package/dist/client/assets/{Trash01-QTnEOFQZ.js → Trash01-BuPEx0_k.js} +1 -1
- package/dist/client/assets/{Type01-_F3mzKx6.js → Type01-DOkYrJiE.js} +1 -1
- package/dist/client/assets/{Upload01-CGSlQvAp.js → Upload01-C0WOeUrY.js} +1 -1
- package/dist/client/assets/{User01-aj-zclnv.js → User01-BUPQq0ED.js} +1 -1
- package/dist/client/assets/{VideoRecorder-D9PsxJCT.js → VideoRecorder-BxZ6ULCH.js} +1 -1
- package/dist/client/assets/{X-CcYgD4OX.js → X-DCpTFZeq.js} +1 -1
- package/dist/client/assets/{XCircle-D3Nvo83i.js → XCircle-DYElgwI6.js} +1 -1
- package/dist/client/assets/{XClose-BbXP9DKi.js → XClose-D1beSwQV.js} +1 -1
- package/dist/client/assets/{Zap-CL-zS1_o.js → Zap-UiK1PUg9.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-yyYAc1Y_.js → agent-connections-preview-DgkBw1_l.js} +1 -1
- package/dist/client/assets/{agent-detail-CO6liKCV.js → agent-detail-Bd6DKOlD.js} +1 -1
- package/dist/client/assets/{agents-CnIjEcH1.js → agents-DWqpBnsH.js} +1 -1
- package/dist/client/assets/{ai-providers-logos-dK9NDdIF.js → ai-providers-logos-uG0Mew5d.js} +1 -1
- package/dist/client/assets/{alert-dialog-B7veNUkq.js → alert-dialog-CgAC3BOl.js} +1 -1
- package/dist/client/assets/{auth-catchall-BiyI3G0T.js → auth-catchall-CL8VE192.js} +1 -1
- package/dist/client/assets/{automation-detail-7rT6BloM.js → automation-detail-BhLrq0dM.js} +1 -1
- package/dist/client/assets/{automations-C4il4Gbe.js → automations-R_FawvUI.js} +1 -1
- package/dist/client/assets/{avatar-BM-8GWUG.js → avatar-DDDYpGJF.js} +1 -1
- package/dist/client/assets/{badge-Cumb6-S9.js → badge-Bjpq-dTo.js} +1 -1
- package/dist/client/assets/{binder-C7qDL2Qf.js → binder-NYNrYM3G.js} +1 -1
- package/dist/client/assets/{breadcrumb-7qt2G4oc.js → breadcrumb-CB7jsoFZ.js} +1 -1
- package/dist/client/assets/{card-MD3_cdl-.js → card-DpLO2iaY.js} +1 -1
- package/dist/client/assets/{checkbox-K8EP3pTL.js → checkbox-Cmst94pj.js} +1 -1
- package/dist/client/assets/{collapsible-xpsXy8wv.js → collapsible-CrFa4wr9.js} +1 -1
- package/dist/client/assets/{collection-detail-U2cng7ZV.js → collection-detail-DryS-0FT.js} +1 -1
- package/dist/client/assets/{collection-display-button-CneWEmV-.js → collection-display-button-D4lR44rH.js} +1 -1
- package/dist/client/assets/{collection-search-BjwxIPZo.js → collection-search-BWvT1mtI.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DIx3NJ4P.js → collection-table-wrapper-DtUdWdus.js} +1 -1
- package/dist/client/assets/{collection-tabs-Dh0Q01AZ.js → collection-tabs-KsFYJUlb.js} +1 -1
- package/dist/client/assets/{command-NoPVlaEu.js → command-D37huG2X.js} +1 -1
- package/dist/client/assets/{connection-card-yKH89qjd.js → connection-card-yQSrUKDB.js} +1 -1
- package/dist/client/assets/{connection-detail-AHaqgIR7.js → connection-detail-B53-efUG.js} +1 -1
- package/dist/client/assets/{connections-l_vSiTwM.js → connections-Bx9lPnWk.js} +1 -1
- package/dist/client/assets/{constants-CxMCfkTL.js → constants-zYgM_0a9.js} +1 -1
- package/dist/client/assets/{context-CSEQjmqr.js → context-ClaY50kW.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-DdxPGHeC.js → create-organization-dialog-Be59rwts.js} +1 -1
- package/dist/client/assets/{create-project-dialog-CcCDkiLS.js → create-project-dialog-BxooZZKw.js} +1 -1
- package/dist/client/assets/{danger-DDAzF_I4.js → danger-BqaBl_q3.js} +1 -1
- package/dist/client/assets/{danger-zone-BC1lNC6W.js → danger-zone-BfHnGFV8.js} +1 -1
- package/dist/client/assets/{dependencies-JXKC29RT.js → dependencies-c_Dnkt09.js} +1 -1
- package/dist/client/assets/{dialog-DrVTTNou.js → dialog-9dz0XD_x.js} +1 -1
- package/dist/client/assets/{drawer-D5CP8kBI.js → drawer-BUTpu_fr.js} +1 -1
- package/dist/client/assets/{dropdown-menu-C89gFzkt.js → dropdown-menu-Bu3FiY_L.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-BbaU9_8j.js → dynamic-plugin-layout-CmNTXSLI.js} +1 -1
- package/dist/client/assets/{editable-task-title-DsAH2SQ2.js → editable-task-title-o3X-MF0r.js} +1 -1
- package/dist/client/assets/{empty-state-DbZVzTBg.js → empty-state-BZHGNb7q.js} +1 -1
- package/dist/client/assets/{empty-state-BBvw3ZYd.js → empty-state-DZEt4GhJ.js} +1 -1
- package/dist/client/assets/{env-vars-editor-cvzwdQUu.js → env-vars-editor-B0qTLind.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BffW3qeV.js → extract-connection-data-etKnB491.js} +1 -1
- package/dist/client/assets/{file-browser-mmi6aXC9.js → file-browser-CgCeL4Le.js} +2 -2
- package/dist/client/assets/{form-CWBeLdT6.js → form-BqkPOMyB.js} +1 -1
- package/dist/client/assets/{general-CcztoxCU.js → general-CftlpT6m.js} +1 -1
- package/dist/client/assets/{generate-id-Dg3pJRJj.js → generate-id-DvtLadCy.js} +1 -1
- package/dist/client/assets/{grid-view-B7Dp989W.js → grid-view-DHsEK-PQ.js} +1 -1
- package/dist/client/assets/{home-VPKMEjYo.js → home-PSYpS_Lj.js} +1 -1
- package/dist/client/assets/{index-BtPRAwS7.js → index-BQdJvUAH.js} +1 -1
- package/dist/client/assets/{index-sDOHRFRE.js → index-BWrGddwd.js} +1 -1
- package/dist/client/assets/{index-8Rhr5q5h.js → index-BazPw9_O.js} +1 -1
- package/dist/client/assets/{index-B02T0zBo.js → index-Brr7A335.js} +3 -3
- package/dist/client/assets/{index-BLDRNzDY.js → index-C4N6EaVB.js} +1 -1
- package/dist/client/assets/{index-B3k9P-lf.js → index-COnRU3v7.js} +1 -1
- package/dist/client/assets/{index-BLdXKd8l.js → index-DYfGsM_t.js} +1 -1
- package/dist/client/assets/{index-C8GCLBuY.js → index-DZgMGqvO.js} +1 -1
- package/dist/client/assets/{index-DawpyEvM.js → index-Db4SWmqo.js} +1 -1
- package/dist/client/assets/{index-Digd80e7.js → index-JPBlKO3L.js} +1 -1
- package/dist/client/assets/{index-DhZa9JXj.js → index-PAn33g2N.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-CkKdAcwZ.js → infiniteQueryObserver-c6RXxZ0G.js} +1 -1
- package/dist/client/assets/{input-ForWep-5.js → input-BNjye-PL.js} +1 -1
- package/dist/client/assets/{integration-icon-BzBBJ1Fk.js → integration-icon-DNmpqadJ.js} +1 -1
- package/dist/client/assets/{label-W6RhX9gu.js → label-eGYyBJst.js} +1 -1
- package/dist/client/assets/{layout-C--X5eSs.js → layout-BlxQvRSL.js} +1 -1
- package/dist/client/assets/{layout-rVBMqKc2.js → layout-DekWEJhY.js} +1 -1
- package/dist/client/assets/{login-LyWPWfzK.js → login-DIFEZdtr.js} +1 -1
- package/dist/client/assets/{logo-upload-D9fV-5Wh.js → logo-upload-DiA99WAp.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-CEmMQe7U.js → mcp-app-renderer-CFNpTQ6E.js} +1 -1
- package/dist/client/assets/{mcp-server-card-BJN3Fvzu.js → mcp-server-card-CdsVz3jG.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-zBT-Z-Xy.js → mcp-server-detail-DJvBbAjW.js} +2 -2
- package/dist/client/assets/{members-BDM7TZxS.js → members-Dyh2zG1d.js} +1 -1
- package/dist/client/assets/{monaco-editor-kDZdmDDL.js → monaco-editor-Bo90MSIY.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-edit-BuUSd4S7.js → monitoring-dashboard-edit-xhJPKPVH.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-view-DxXnUjzJ.js → monitoring-dashboard-view-dy0Flwse.js} +1 -1
- package/dist/client/assets/{monitoring-6tVMGVPB.js → monitoring-gqmKl2bi.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BwublEtu.js → monitoring-stats-row-iYQx558q.js} +1 -1
- package/dist/client/assets/{oauth-callback-u8tTg7C5.js → oauth-callback-BqwcoIo6.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-CIS3s0nz.js → oauth-callback-ai-provider-Dgpw8lcY.js} +1 -1
- package/dist/client/assets/{org-ai-providers-B_fAMKG8.js → org-ai-providers-D56R_fMG.js} +1 -1
- package/dist/client/assets/{page-CAbxUZTp.js → page-0Lz9H1On.js} +1 -1
- package/dist/client/assets/{page-CKYYB5UO.js → page-DOK5Sw55.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-BJl5Ig-x.js → plugin-empty-state-CEDsozup.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-CwdpqFxA.js → plugin-empty-state-DWQhD8Mf.js} +1 -1
- package/dist/client/assets/{plugin-header-CecjK7-6.js → plugin-header-CLZrxRuX.js} +1 -1
- package/dist/client/assets/{plugin-header-9p_F2K9N.js → plugin-header-DzGPACOB.js} +1 -1
- package/dist/client/assets/plugins-BTfTKK1m.js +1 -0
- package/dist/client/assets/{popover-B4lCL3Ry.js → popover-Z3f6ZQm7.js} +1 -1
- package/dist/client/assets/{project-app-view-hEe0cnSR.js → project-app-view-V-uewlX6.js} +1 -1
- package/dist/client/assets/{project-layout-CZOciC9q.js → project-layout-BBK9e0vM.js} +1 -1
- package/dist/client/assets/{project-plugins-BYtvCgGC.js → project-plugins-Cwp30i4R.js} +1 -1
- package/dist/client/assets/{projects-list-DLy1jTdn.js → projects-list-B8C93dIo.js} +1 -1
- package/dist/client/assets/{registry-layout-9bTlGXFv.js → registry-layout-C4_a8IdE.js} +1 -1
- package/dist/client/assets/{registry-utils-Du5_ORZW.js → registry-utils-y_fNkZkQ.js} +1 -1
- package/dist/client/assets/{reset-password-VTtBosDY.js → reset-password-BERKFVJp.js} +1 -1
- package/dist/client/assets/{resizable-CmQhfOL7.js → resizable-VdsKauhj.js} +1 -1
- package/dist/client/assets/{save-actions-gCP1b0um.js → save-actions-CMjDy0Ce.js} +1 -1
- package/dist/client/assets/{scroll-area-XDfeLpGT.js → scroll-area-Dys6p7CY.js} +1 -1
- package/dist/client/assets/{select-DPY6FKWr.js → select-B4xbO58q.js} +1 -1
- package/dist/client/assets/{select-virtual-mcp-CIMYOASs.js → select-virtual-mcp-Dkfvl35G.js} +1 -1
- package/dist/client/assets/{shell-layout-Cvv7MmQe.js → shell-layout-CzWpNDNz.js} +2 -2
- package/dist/client/assets/{sidebar-settings-oum_h4r1.js → sidebar-settings-94-vpDCw.js} +1 -1
- package/dist/client/assets/{skeleton-D7_wHYzP.js → skeleton-BfSOCc9S.js} +1 -1
- package/dist/client/assets/{spinner-qAHxlGf5.js → spinner-DnOPQqyk.js} +1 -1
- package/dist/client/assets/{store-invite-CZfZboyf.js → store-invite-PCKKyOl8.js} +1 -1
- package/dist/client/assets/{switch-B_37GSuW.js → switch-Dn2VbcGQ.js} +1 -1
- package/dist/client/assets/{table-DirES7KL.js → table-BxPcvQ9o.js} +1 -1
- package/dist/client/assets/{tabs-CKfZGJCt.js → tabs-D70zg5lJ.js} +1 -1
- package/dist/client/assets/{task-status-DeYQ5Diz.js → task-status-DcA6CFUk.js} +1 -1
- package/dist/client/assets/tasks-DFBzNwFL.js +1 -0
- package/dist/client/assets/{tasks-panel-Bbz3xeDf.js → tasks-panel-B9bc_p-z.js} +1 -1
- package/dist/client/assets/{textarea-BKGwVT1m.js → textarea-Ct5_AtGA.js} +1 -1
- package/dist/client/assets/{time-range-picker-y1wEVr1m.js → time-range-picker-C3sQPl1b.js} +1 -1
- package/dist/client/assets/{toggle-group-C7uP4yM0.js → toggle-group-BTFft7Fn.js} +1 -1
- package/dist/client/assets/{tools-list-BrPZj3wN.js → tools-list-C87HbBZ8.js} +1 -1
- package/dist/client/assets/{tooltip-CFp3ORxD.js → tooltip-CkRG11nt.js} +1 -1
- package/dist/client/assets/{topbar-portal-DS87obgh.js → topbar-portal-DbW6t3qj.js} +1 -1
- package/dist/client/assets/{types-Cq5MfqXb.js → types-Dx34u3xT.js} +1 -1
- package/dist/client/assets/{use-automations-COEE-nvw.js → use-automations-CmTGPtG8.js} +1 -1
- package/dist/client/assets/{use-collections-Glkd82JS.js → use-collections-BuridTiI.js} +1 -1
- package/dist/client/assets/{use-connection-DEVOZTNJ.js → use-connection-WnniEfph.js} +1 -1
- package/dist/client/assets/{use-copy-C9sTW2YW.js → use-copy-BeVulQm3.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-Br5CSA0l.js → use-create-virtual-mcp-BbDtSF4k.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-Cxu6oap_.js → use-infinite-scroll-BitXf5wc.js} +1 -1
- package/dist/client/assets/{use-install-from-registry-B67DeFNR.js → use-install-from-registry-BbsHXAvF.js} +1 -1
- package/dist/client/assets/{use-list-state-9uBW39Lr.js → use-list-state-BS-4PDWE.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-DFUn-Vc8.js → use-mcp-prompts-C6hR9huh.js} +1 -1
- package/dist/client/assets/{use-mcp-resources-CkUyAyuG.js → use-mcp-resources-DhirVQgi.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CMxPCHjd.js → use-mcp-tools-BjoRAfDL.js} +1 -1
- package/dist/client/assets/{use-members-CXGpt7MK.js → use-members-BdRmI9FL.js} +1 -1
- package/dist/client/assets/{use-project-C-n-ZTz8.js → use-project-Dy3tSas3.js} +1 -1
- package/dist/client/assets/{use-store-discovery-CaaH9ZyH.js → use-store-discovery-DtyNi-FP.js} +1 -1
- package/dist/client/assets/{use-view-mode-CyRa2Tg7.js → use-view-mode-U7lICyoa.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-B29yPvq9.js → use-virtual-mcp-RrB-tK1z.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CsD7JLjH.js +1 -0
- package/dist/client/assets/{useMutation-r3KZb1HO.js → useMutation-BZjo1ZXS.js} +1 -1
- package/dist/client/assets/useQuery-Ck1ZbbFp.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-D1F_CbNV.js +1 -0
- package/dist/client/assets/{user-CSVNc19J.js → user-B-oJutpy.js} +1 -1
- package/dist/client/assets/{workflow-ZIi3x0hm.js → workflow-DxaY4-SA.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/migrate.js +1 -1
- package/dist/server/node_modules/pg/LICENSE +21 -0
- package/dist/server/node_modules/pg/README.md +95 -0
- package/dist/server/node_modules/pg/esm/index.mjs +20 -0
- package/dist/server/node_modules/pg/lib/client.js +743 -0
- package/dist/server/node_modules/pg/lib/connection-parameters.js +171 -0
- package/dist/server/node_modules/pg/lib/connection.js +221 -0
- package/dist/server/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
- package/dist/server/node_modules/pg/lib/crypto/sasl.js +212 -0
- package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +43 -0
- package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +89 -0
- package/dist/server/node_modules/pg/lib/crypto/utils.js +9 -0
- package/dist/server/node_modules/pg/lib/defaults.js +91 -0
- package/dist/server/node_modules/pg/lib/index.js +73 -0
- package/dist/server/node_modules/pg/lib/native/client.js +323 -0
- package/dist/server/node_modules/pg/lib/native/index.js +2 -0
- package/dist/server/node_modules/pg/lib/native/query.js +165 -0
- package/dist/server/node_modules/pg/lib/query.js +252 -0
- package/dist/server/node_modules/pg/lib/result.js +109 -0
- package/dist/server/node_modules/pg/lib/stream.js +83 -0
- package/dist/server/node_modules/pg/lib/type-overrides.js +35 -0
- package/dist/server/node_modules/pg/lib/utils.js +217 -0
- package/dist/server/node_modules/pg/package.json +76 -0
- package/dist/server/node_modules/pg-pool/LICENSE +21 -0
- package/dist/server/node_modules/pg-pool/README.md +357 -0
- package/dist/server/node_modules/pg-pool/esm/index.mjs +5 -0
- package/dist/server/node_modules/pg-pool/index.js +517 -0
- package/dist/server/node_modules/pg-pool/package.json +51 -0
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/plugins-FpJP518T.js +0 -1
- package/dist/client/assets/tasks-C-mIVJ1R.js +0 -1
- package/dist/client/assets/useInfiniteQuery-pONeFYZo.js +0 -1
- package/dist/client/assets/useQuery-D3gzovXd.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-ButnbJ6Q.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as ie,j as t,B as ge,e as pt,f as ft,u as $e,r as ht,O as Fe,v as ke,w as gt,K as Ke}from"./index-B02T0zBo.js";import{u as Qe,a as Ve}from"./constants-CxMCfkTL.js";import{B as xt,g as Me}from"./generate-id-Dg3pJRJj.js";import{C as Ye}from"./collection-display-button-CneWEmV-.js";import{C as jt}from"./collection-search-BjwxIPZo.js";import{C as Ct}from"./card-MD3_cdl-.js";import{I as Xe,e as Ze,q as Ue}from"./integration-icon-BzBBJ1Fk.js";import{D as et,a as tt,b as st,c as L}from"./dropdown-menu-C89gFzkt.js";import{c as ot}from"./Play-Bpqump99.js";import{i as it,s as nt}from"./RefreshCcw01-BEbjARvC.js";import{s as rt}from"./Trash01-QTnEOFQZ.js";import{C as bt}from"./collection-table-wrapper-DIx3NJ4P.js";import{E as We}from"./empty-state-BBvw3ZYd.js";import{U as yt}from"./user-CSVNc19J.js";import{E as lt}from"./empty-state-DbZVzTBg.js";import{u as vt}from"./use-list-state-9uBW39Lr.js";import{g as Nt}from"./connection-slug-Bw8dtz1U.js";import{A as wt,h as St,c as _t,b as Pt,d as Dt,e as It,a as At,f as Tt}from"./alert-dialog-B7veNUkq.js";import{u as Et,e as Ot}from"./use-collections-Glkd82JS.js";import{u as $t}from"./use-connection-DEVOZTNJ.js";import{s as kt}from"./Plus-Dt2hP7ZJ.js";import{a as Lt}from"./layout-rVBMqKc2.js";import{u as zt}from"./useMutation-r3KZb1HO.js";import{P as k}from"./index-Digd80e7.js";import{B as Be,a as Re,b as He,c as qe}from"./breadcrumb-7qt2G4oc.js";import{e as Ft}from"./Dataflow03-B_UyQRrQ.js";import"./ArrowUp-Cfk9ftkI.js";import"./Check-LF3O8VSl.js";import"./Grid01-Bg8b-MfH.js";import"./List-BpugyVN4.js";import"./tooltip-CFp3ORxD.js";import"./index-DawpyEvM.js";import"./badge-Cumb6-S9.js";import"./Loading01-BkQZaZ86.js";import"./SearchMd-BFV4EEyM.js";import"./input-ForWep-5.js";import"./Container-C_jftBLa.js";import"./AlertCircle-B8eJ9Fod.js";import"./ArrowLeft-BsqjOo0a.js";import"./XCircle-D3Nvo83i.js";import"./Type01-_F3mzKx6.js";import"./ChevronDown-CoxfMCD_.js";import"./ChevronRight-CkZ762r8.js";import"./ChevronUp-CkQ5LXE4.js";import"./Download01-Dn7pc_mQ.js";import"./VideoRecorder-D9PsxJCT.js";import"./FolderClosed-Csm3WP5B.js";import"./Settings01--CB8mKBF.js";import"./Upload01-CGSlQvAp.js";import"./User01-aj-zclnv.js";import"./XClose-BbXP9DKi.js";import"./X-CcYgD4OX.js";import"./Zap-CL-zS1_o.js";import"./table-DirES7KL.js";import"./avatar-BM-8GWUG.js";import"./useQuery-D3gzovXd.js";import"./use-view-mode-CyRa2Tg7.js";import"./slugify-CEUa2lfQ.js";function Kt(s,e){const o=s.properties||{};for(const n in o){const l=o[n];if(l&&l.type==="string"&&(l.format==="url"||l.format==="uri")&&e&&typeof e=="object"&&n in e&&e[n])return e[n]}const a=["image","img","avatar","icon","logo","thumbnail","cover"];for(const n of a)if(e&&typeof e=="object"&&n in e&&typeof e[n]=="string")return e[n]}function Mt(s){const e=ie.c(25),{item:o,schema:a,actions:n}=s;let l;e[0]!==o||e[1]!==a?(l=Kt(a,o),e[0]=o,e[1]=a,e[2]=l):l=e[2];const r=l,c=o&&typeof o=="object"&&"description"in o&&typeof o.description=="string"?o.description:void 0;let p;e[3]!==n?(p=n&&Object.keys(n).length>0,e[3]=n,e[4]=p):p=e[4];const i=p;let u;e[5]!==r||e[6]!==o.title?(u=t.jsx(Xe,{icon:r,name:o.title,size:"md",className:"shrink-0 shadow-sm"}),e[5]=r,e[6]=o.title,e[7]=u):u=e[7];let f;e[8]!==o.title?(f=t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:o.title}),e[8]=o.title,e[9]=f):f=e[9];const d=c||"No description";let m;e[10]!==d?(m=t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:d}),e[10]=d,e[11]=m):m=e[11];let b;e[12]!==f||e[13]!==m?(b=t.jsxs("div",{className:"flex flex-col gap-0 flex-1",children:[f,m]}),e[12]=f,e[13]=m,e[14]=b):b=e[14];let x;e[15]!==u||e[16]!==b?(x=t.jsxs("div",{className:"flex flex-col gap-4 p-6 flex-1",children:[u,b]}),e[15]=u,e[16]=b,e[17]=x):x=e[17];let N;e[18]!==n||e[19]!==i||e[20]!==o?(N=i&&t.jsx("div",{className:"absolute top-6 right-6 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",onClick:Rt,onMouseDown:Bt,children:t.jsxs(et,{children:[t.jsx(tt,{asChild:!0,children:t.jsx(ge,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Wt,children:t.jsx(it,{size:20})})}),t.jsxs(st,{align:"end",onClick:Ut,children:[n.open&&t.jsxs(L,{onClick:g=>{g.stopPropagation(),n.open?.(o)},children:[t.jsx(nt,{size:16}),"Open"]}),n.edit&&t.jsxs(L,{onClick:g=>{g.stopPropagation(),n.edit?.(o)},children:[t.jsx(Ze,{size:16}),"Edit"]}),n.duplicate&&t.jsxs(L,{onClick:g=>{g.stopPropagation(),n.duplicate?.(o)},children:[t.jsx(ot,{size:16}),"Duplicate"]}),n.delete&&t.jsxs(L,{variant:"destructive",onClick:g=>{g.stopPropagation(),n.delete?.(o)},children:[t.jsx(rt,{size:16}),"Delete"]})]})]})}),e[18]=n,e[19]=i,e[20]=o,e[21]=N):N=e[21];let j;return e[22]!==x||e[23]!==N?(j=t.jsxs(Ct,{className:"cursor-pointer transition-colors h-full flex flex-col group relative",children:[x,N]}),e[22]=x,e[23]=N,e[24]=j):j=e[24],j}function Ut(s){return s.stopPropagation()}function Wt(s){return s.stopPropagation()}function Bt(s){return s.stopPropagation()}function Rt(s){return s.stopPropagation()}const Ht=["icon","avatar","logo"],Ge=["created_at","created_by","id"];function qt(s){return Object.keys(s).find(e=>Ht.includes(e.toLowerCase()))}function at(s,e){return Object.keys(s.properties||{}).filter(o=>["id","created_at","updated_at","created_by","updated_by"].includes(o)?!1:e?e.includes(o):!0).map(o=>({id:o,label:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," ")}))}function Gt(s){const e=ie.c(30),{data:o,schema:a,viewMode:n,search:l,sortKey:r,sortDirection:c,onSort:p,actions:i,onItemClick:u,headerActions:f,emptyState:d,readOnly:m,columns:b,hideToolbar:x,sortableFields:N}=s,j=c===void 0?"asc":c,g=p===void 0?Yt:p;let h;e[0]!==i?(h=i===void 0?{}:i,e[0]=i,e[1]=h):h=e[1];const E=h,T=u===void 0?Vt:u,w=f===void 0?null:f,O=d===void 0?null:d,S=m===void 0?!1:m,_=b===void 0?void 0:b,z=x===void 0?!1:x,y=N===void 0?void 0:N;let v;e[2]!==_||e[3]!==a||e[4]!==y?(v=_?_.filter(Qt).filter(A=>!y||y.includes(A.id)).map(Jt):at(a,y),e[2]=_,e[3]=a,e[4]=y,e[5]=v):v=e[5];const I=v;let P;e[6]!==w||e[7]!==z||e[8]!==g||e[9]!==j||e[10]!==r||e[11]!==I?(P=!z&&t.jsx("div",{className:"shrink-0 w-full border-b border-border h-12",children:t.jsxs("div",{className:"flex items-center gap-3 h-12 px-4",children:[t.jsx("div",{className:"flex items-center gap-2 flex-1",children:w}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsx(Ye,{sortKey:r,sortDirection:j,onSort:g,sortOptions:I})})]})}),e[6]=w,e[7]=z,e[8]=g,e[9]=j,e[10]=r,e[11]=I,e[12]=P):P=e[12];let D;e[13]!==E||e[14]!==_||e[15]!==o||e[16]!==O||e[17]!==T||e[18]!==g||e[19]!==S||e[20]!==a||e[21]!==l||e[22]!==j||e[23]!==r||e[24]!==y||e[25]!==n?(D=n==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:o.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:O||t.jsx(We,{icon:t.jsx(Ue,{size:36,className:"text-muted-foreground"}),title:"No items found",description:l?"Try adjusting your search":"No items to display"})}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:o.map(A=>t.jsx("div",{onClick:()=>T?.(A),className:"cursor-pointer h-full",children:t.jsx(Mt,{item:A,schema:a,readOnly:S,actions:E})},A.id))})}):t.jsx(bt,{columns:es(_,a,y,E),data:o,sortKey:r,sortDirection:j,onSort:g,onRowClick:T,emptyState:O||t.jsx(We,{icon:t.jsx(Ue,{size:36,className:"text-muted-foreground"}),title:"No items found",description:l?"Try adjusting your search":"No items to display"})}),e[13]=E,e[14]=_,e[15]=o,e[16]=O,e[17]=T,e[18]=g,e[19]=S,e[20]=a,e[21]=l,e[22]=j,e[23]=r,e[24]=y,e[25]=n,e[26]=D):D=e[26];let $;return e[27]!==P||e[28]!==D?($=t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[P,D]}),e[27]=P,e[28]=D,e[29]=$):$=e[29],$}function Jt(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function Qt(s){return s.sortable!==!1}function Vt(){}function Yt(){}function Xt(s){return{id:"actions",header:"",render:e=>t.jsxs(et,{children:[t.jsx(tt,{asChild:!0,children:t.jsx(ge,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:o=>o.stopPropagation(),children:t.jsx(it,{size:20})})}),t.jsxs(st,{align:"end",onClick:o=>o.stopPropagation(),children:[s.open&&t.jsxs(L,{onClick:o=>{o.stopPropagation(),s.open?.(e)},children:[t.jsx(nt,{size:16}),"Open"]}),s.edit&&t.jsxs(L,{onClick:o=>{o.stopPropagation(),s.edit?.(e)},children:[t.jsx(Ze,{size:16}),"Edit"]}),s.duplicate&&t.jsxs(L,{onClick:o=>{o.stopPropagation(),s.duplicate?.(e)},children:[t.jsx(ot,{size:16}),"Duplicate"]}),s.delete&&t.jsxs(L,{variant:"destructive",onClick:o=>{o.stopPropagation(),s.delete?.(e)},children:[t.jsx(rt,{size:16}),"Delete"]})]})]}),cellClassName:"w-[60px]",sortable:!1}}function ct(s){const e=s.type;return Array.isArray(e)?e.every(o=>ct({type:o})):e==="string"||e==="number"||e==="integer"||e==="boolean"||e==="null"}function Zt(s,e){const o=s.properties||{},a=Object.keys(o).filter(i=>{const u=o[i];return u&&ct(u)}),n=qt(o),l=[],r=new Set;n&&a.includes(n)&&(l.push(n),r.add(n));const c=["title","description","updated_at","updated_by"];for(const i of c)a.includes(i)&&!r.has(i)&&(l.push(i),r.add(i));const p=a.filter(i=>!r.has(i)&&!Ge.includes(i)).sort((i,u)=>i.localeCompare(u));for(const i of p)l.push(i),r.add(i);for(const i of Ge)a.includes(i)&&!r.has(i)&&(l.push(i),r.add(i));return l.map(i=>{const u=o[i],f=e?e.includes(i):!["id"].includes(i);return i===n?{id:i,header:"",render:d=>{const m=d[i];return t.jsx(Xe,{icon:m,name:d.title,size:"sm",className:"shrink-0 shadow-sm"})},sortable:!1,cellClassName:"w-16 shrink-0",wrap:!0}:i==="description"?{id:i,header:"Description",render:d=>{const m=d[i];return m==null?"—":t.jsx("span",{className:"block truncate max-w-[50ch]",children:String(m)})},sortable:f,cellClassName:"max-w-[50ch]"}:i==="created_by"||i==="updated_by"?{id:i,header:i.charAt(0).toUpperCase()+i.slice(1).replace(/_/g," "),render:d=>{const m=d[i];return m?t.jsx(yt,{id:String(m),size:"xs"}):"—"},sortable:f,cellClassName:"max-w-[250px]"}:u?.format==="date-time"||i.endsWith("_at")?{id:i,header:i.charAt(0).toUpperCase()+i.slice(1).replace(/_/g," "),render:d=>{const m=d[i];return m?t.jsx("span",{className:"block truncate max-w-full",children:new Date(m).toLocaleDateString()}):"—"},sortable:f,cellClassName:"max-w-[200px]"}:{id:i,header:i.charAt(0).toUpperCase()+i.slice(1).replace(/_/g," "),render:d=>{const m=d[i];return m==null?"—":t.jsx("span",{className:"block truncate max-w-full",children:String(m)})},sortable:f,cellClassName:"max-w-[200px]"}})}function es(s,e,o,a){const n=s||Zt(e,o);return n.some(c=>c.id==="actions")?n:Object.keys(a).length>0?[...n,Xt(a)]:n}function ts(s){const e=ie.c(114),{connectionId:o,org:a,activeCollection:n}=s,l=n.name,r=n.schema??xt,c=n.hasCreateTool,p=n.hasUpdateTool,i=n.hasDeleteTool,u=pt(),{data:f}=ft.useSession(),d=f?.user?.id||"unknown",m=$t(o);let b;e[0]!==m||e[1]!==o?(b=m?Nt(m):o,e[0]=m,e[1]=o,e[2]=b):b=e[2];const x=b,{org:N}=$e();let j;e[3]!==o||e[4]!==N.id?(j={connectionId:o,orgId:N.id},e[3]=o,e[4]=N.id,e[5]=j):j=e[5];const g=Qe(j),h=Et(o,l,g),E=`${o}-${l}`;let T;e[6]!==a||e[7]!==E?(T={namespace:a,resource:E,defaultSortKey:"updated_at"},e[6]=a,e[7]=E,e[8]=T):T=e[8];const{search:w,searchTerm:O,setSearch:S,viewMode:_,setViewMode:z,sortKey:y,sortDirection:v,handleSort:I}=vt(T);let P;e[9]!==O||e[10]!==v||e[11]!==y?(P={searchTerm:O,sortKey:y,sortDirection:v},e[9]=O,e[10]=v,e[11]=y,e[12]=P):P=e[12];const D=Ot(o,l,g,P),$=!c&&!p&&!i;let A;e[13]!==x||e[14]!==l||e[15]!==u||e[16]!==a?(A=C=>{u({to:"/$org/$project/mcps/$appSlug/$collectionName/$itemId",params:{org:a,project:Fe,appSlug:x,collectionName:l,itemId:C.id}})},e[13]=x,e[14]=l,e[15]=u,e[16]=a,e[17]=A):A=e[17];const F=A;let ne;e[18]!==h.create||e[19]!==d?(ne=async C=>{const he=new Date().toISOString();await h.create.mutateAsync({...C,id:Me("conn"),title:`${C.title} (Copy)`,created_at:he,updated_at:he,created_by:d,updated_by:d})},e[18]=h.create,e[19]=d,e[20]=ne):ne=e[20];const xe=ne,[K,je]=ht.useState(null);let re;e[21]===Symbol.for("react.memo_cache_sentinel")?(re=C=>{je(C)},e[21]=re):re=e[21];const dt=re;let M;e[22]!==F||e[23]!==p?(M=p&&{edit:F},e[22]=F,e[23]=p,e[24]=M):M=e[24];let U;e[25]!==xe||e[26]!==c?(U=c&&{duplicate:xe},e[25]=xe,e[26]=c,e[27]=U):U=e[27];let W;e[28]!==i?(W=i&&{delete:dt},e[28]=i,e[29]=W):W=e[29];let le;e[30]!==U||e[31]!==W||e[32]!==M?(le={...M,...U,...W},e[30]=U,e[31]=W,e[32]=M,e[33]=le):le=e[33];const Ce=le;let ae;e[34]!==h.delete||e[35]!==K?(ae=async()=>{K&&(await h.delete.mutateAsync(K.id),je(null))},e[34]=h.delete,e[35]=K,e[36]=ae):ae=e[36];const be=ae;let ce;e[37]!==h.create||e[38]!==x||e[39]!==l||e[40]!==c||e[41]!==u||e[42]!==a||e[43]!==d?(ce=async()=>{if(!c){ke.error("Create operation is not available for this collection");return}const C=new Date().toISOString(),he={id:Me("conn"),title:"New Item",description:"A brief description of the item",created_at:C,updated_at:C,created_by:d,updated_by:d};try{const Oe=await h.create.mutateAsync(he);u({to:"/$org/$project/mcps/$appSlug/$collectionName/$itemId",params:{org:a,project:Fe,appSlug:x,collectionName:l,itemId:Oe.id}})}catch(Oe){console.error("Failed to create item:",Oe)}},e[37]=h.create,e[38]=x,e[39]=l,e[40]=c,e[41]=u,e[42]=a,e[43]=d,e[44]=ce):ce=e[44];const ye=ce;let de;e[45]!==r?(de=at(r),e[45]=r,e[46]=de):de=e[46];const ve=de,Le=(D?.length??0)>0,mt=c&&Le,ut=c&&!Le&&!w;let me;e[47]!==h.create||e[48]!==ye||e[49]!==c?(me=c?t.jsxs(ge,{onClick:ye,size:"sm",disabled:h.create.isPending,className:"h-7",children:[t.jsx(kt,{className:"mr-2 h-4 w-4"}),h.create.isPending?"Creating...":"Create"]}):null,e[47]=h.create,e[48]=ye,e[49]=c,e[50]=me):me=e[50];const ze=me,Ne=y;let B;e[51]!==I||e[52]!==v||e[53]!==ve||e[54]!==Ne?(B=t.jsx(Ye,{sortKey:Ne,sortDirection:v,onSort:I,sortOptions:ve}),e[51]=I,e[52]=v,e[53]=ve,e[54]=Ne,e[55]=B):B=e[55];const we=mt&&ze;let R;e[56]!==B||e[57]!==we?(R=t.jsxs(Lt,{children:[B,we]}),e[56]=B,e[57]=we,e[58]=R):R=e[58];const Se=`Search ${l}...`;let H;e[59]!==S?(H=C=>{C.key==="Escape"&&(S(""),C.target.blur())},e[59]=S,e[60]=H):H=e[60];let q;e[61]!==w||e[62]!==S||e[63]!==Se||e[64]!==H?(q=t.jsx(jt,{value:w,onChange:S,placeholder:Se,onKeyDown:H}),e[61]=w,e[62]=S,e[63]=Se,e[64]=H,e[65]=q):q=e[65];let G;e[66]!==D?(G=D??[],e[66]=D,e[67]=G):G=e[67];const _e=y;let J;e[68]!==F?(J=C=>F(C),e[68]=F,e[69]=J):J=e[69];const Pe="No items found",De=w?"Try adjusting your search terms":"This collection doesn't have any items yet.",Ie=ut?ze:void 0;let Q;e[70]!==Pe||e[71]!==De||e[72]!==Ie?(Q=t.jsx(lt,{image:null,title:Pe,description:De,actions:Ie}),e[70]=Pe,e[71]=De,e[72]=Ie,e[73]=Q):Q=e[73];let V;e[74]!==I||e[75]!==$||e[76]!==Ce||e[77]!==r||e[78]!==w||e[79]!==S||e[80]!==z||e[81]!==v||e[82]!==G||e[83]!==_e||e[84]!==J||e[85]!==Q||e[86]!==_?(V=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(Gt,{hideToolbar:!0,data:G,schema:r,viewMode:_,onViewModeChange:z,search:w,onSearchChange:S,sortKey:_e,sortDirection:v,onSort:I,actions:Ce,onItemClick:J,readOnly:$,emptyState:Q})}),e[74]=I,e[75]=$,e[76]=Ce,e[77]=r,e[78]=w,e[79]=S,e[80]=z,e[81]=v,e[82]=G,e[83]=_e,e[84]=J,e[85]=Q,e[86]=_,e[87]=V):V=e[87];let Y;e[88]!==q||e[89]!==V?(Y=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[q,V]}),e[88]=q,e[89]=V,e[90]=Y):Y=e[90];const Ae=!!K;let ue;e[91]===Symbol.for("react.memo_cache_sentinel")?(ue=C=>{C||je(null)},e[91]=ue):ue=e[91];let pe;e[92]===Symbol.for("react.memo_cache_sentinel")?(pe=t.jsx(_t,{children:"Delete item?"}),e[92]=pe):pe=e[92];const Te=K?.title;let X;e[93]!==Te?(X=t.jsxs(Pt,{children:[pe,t.jsxs(Dt,{children:['Are you sure you want to delete "',Te,'"? This action cannot be undone.']})]}),e[93]=Te,e[94]=X):X=e[94];let Z;e[95]!==h.delete.isPending?(Z=t.jsx(wt,{disabled:h.delete.isPending,children:"Cancel"}),e[95]=h.delete.isPending,e[96]=Z):Z=e[96];const Ee=h.delete.isPending?"Deleting...":"Delete";let ee;e[97]!==h.delete.isPending||e[98]!==be||e[99]!==Ee?(ee=t.jsx(St,{onClick:be,disabled:h.delete.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Ee}),e[97]=h.delete.isPending,e[98]=be,e[99]=Ee,e[100]=ee):ee=e[100];let te;e[101]!==Z||e[102]!==ee?(te=t.jsxs(It,{children:[Z,ee]}),e[101]=Z,e[102]=ee,e[103]=te):te=e[103];let se;e[104]!==X||e[105]!==te?(se=t.jsxs(At,{children:[X,te]}),e[104]=X,e[105]=te,e[106]=se):se=e[106];let oe;e[107]!==Ae||e[108]!==se?(oe=t.jsx(Tt,{open:Ae,onOpenChange:ue,children:se}),e[107]=Ae,e[108]=se,e[109]=oe):oe=e[109];let fe;return e[110]!==R||e[111]!==Y||e[112]!==oe?(fe=t.jsxs(t.Fragment,{children:[R,Y,oe]}),e[110]=R,e[111]=Y,e[112]=oe,e[113]=fe):fe=e[113],fe}function ss(){const s=ie.c(12),{org:e,project:o}=$e(),a=gt();let n;s[0]!==e.id?(n={connectionId:Ve,orgId:e.id},s[0]=e.id,s[1]=n):n=s[1];const l=Qe(n);let r;s[2]!==l||s[3]!==o?(r=async u=>{const f=o.enabledPlugins??[];if(f.includes(u))return;const d=[...f,u],m=await l.callTool({name:"PROJECT_UPDATE",arguments:{projectId:o.id,enabledPlugins:d}});return m.structuredContent??m},s[2]=l,s[3]=o,s[4]=r):r=s[4];let c;s[5]!==e.id||s[6]!==o||s[7]!==a?(c=()=>{a.invalidateQueries({queryKey:Ke.project(e.id,o.slug)}),a.invalidateQueries({queryKey:Ke.projects(e.id)})},s[5]=e.id,s[6]=o,s[7]=a,s[8]=c):c=s[8];let p;return s[9]!==r||s[10]!==c?(p={mutationFn:r,onSuccess:c,onError:os},s[9]=r,s[10]=c,s[11]=p):p=s[11],zt(p)}function os(s){ke.error("Failed to enable plugin: "+(s instanceof Error?s.message:"Unknown error"))}function is(s){const e=ie.c(12),{pluginId:o,title:a,description:n,icon:l}=s,r=ss();let c;e[0]!==r||e[1]!==o?(c=async()=>{try{await r.mutateAsync(o),ke.success("Plugin enabled!")}catch{}},e[0]=r,e[1]=o,e[2]=c):c=e[2];const p=c,i=l??null,u=r.isPending?"Enabling…":"Enable plugin";let f;e[3]!==r.isPending||e[4]!==p||e[5]!==u?(f=t.jsx(ge,{onClick:p,disabled:r.isPending,children:u}),e[3]=r.isPending,e[4]=p,e[5]=u,e[6]=f):f=e[6];let d;return e[7]!==n||e[8]!==i||e[9]!==f||e[10]!==a?(d=t.jsx(lt,{image:i,title:a,description:n,actions:f}),e[7]=n,e[8]=i,e[9]=f,e[10]=a,e[11]=d):d=e[11],d}const Je="workflows",ns={name:"WORKFLOW",displayName:"Workflow",hasCreateTool:!0,hasUpdateTool:!0,hasDeleteTool:!0};function uo(){const s=ie.c(5),{project:e,org:o}=$e();if(!(e.enabledPlugins??[]).includes(Je)){let c;s[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k.Header,{children:t.jsx(k.Header.Left,{children:t.jsx(Be,{children:t.jsx(Re,{children:t.jsx(He,{children:t.jsx(qe,{children:"Workflows"})})})})})}),s[0]=c):c=s[0];let p;return s[1]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsxs(k,{children:[c,t.jsx(k.Content,{children:t.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:t.jsx(is,{pluginId:Je,title:"Enable Workflows",description:"Automate multi-step processes by enabling the Workflows plugin. Once enabled you can create, run, and monitor workflows.",icon:t.jsx("div",{className:"bg-muted p-4 rounded-full",children:t.jsx(Ft,{className:"size-8 text-muted-foreground"})})})})})]}),s[1]=p):p=s[1],p}let l;s[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(k.Header,{children:t.jsx(k.Header.Left,{children:t.jsx(Be,{children:t.jsx(Re,{children:t.jsx(He,{children:t.jsx(qe,{children:"Workflows"})})})})})}),s[2]=l):l=s[2];let r;return s[3]!==o.slug?(r=t.jsxs(k,{children:[l,t.jsx(k.Content,{children:t.jsx(ts,{connectionId:Ve,org:o.slug,activeCollection:ns})})]}),s[3]=o.slug,s[4]=r):r=s[4],r}export{uo as default};
|
|
1
|
+
import{c as ie,j as t,B as ge,e as pt,f as ft,u as $e,r as ht,O as Fe,v as ke,w as gt,K as Ke}from"./index-Brr7A335.js";import{u as Qe,a as Ve}from"./constants-zYgM_0a9.js";import{B as xt,g as Me}from"./generate-id-DvtLadCy.js";import{C as Ye}from"./collection-display-button-D4lR44rH.js";import{C as jt}from"./collection-search-BWvT1mtI.js";import{C as Ct}from"./card-DpLO2iaY.js";import{I as Xe,e as Ze,q as Ue}from"./integration-icon-DNmpqadJ.js";import{D as et,a as tt,b as st,c as L}from"./dropdown-menu-Bu3FiY_L.js";import{c as ot}from"./Play-DCXtg8WP.js";import{i as it,s as nt}from"./RefreshCcw01-WHy1Jkso.js";import{s as rt}from"./Trash01-BuPEx0_k.js";import{C as bt}from"./collection-table-wrapper-DtUdWdus.js";import{E as We}from"./empty-state-DZEt4GhJ.js";import{U as yt}from"./user-B-oJutpy.js";import{E as lt}from"./empty-state-BZHGNb7q.js";import{u as vt}from"./use-list-state-BS-4PDWE.js";import{g as Nt}from"./connection-slug-Bw8dtz1U.js";import{A as wt,h as St,c as _t,b as Pt,d as Dt,e as It,a as At,f as Tt}from"./alert-dialog-CgAC3BOl.js";import{u as Et,e as Ot}from"./use-collections-BuridTiI.js";import{u as $t}from"./use-connection-WnniEfph.js";import{s as kt}from"./Plus-C4kspS_I.js";import{a as Lt}from"./layout-DekWEJhY.js";import{u as zt}from"./useMutation-BZjo1ZXS.js";import{P as k}from"./index-JPBlKO3L.js";import{B as Be,a as Re,b as He,c as qe}from"./breadcrumb-CB7jsoFZ.js";import{e as Ft}from"./Dataflow03-pJrIM8ao.js";import"./ArrowUp-DrfphUZ7.js";import"./Check-DcjDmu9V.js";import"./Grid01-B844I2C0.js";import"./List-Tv7Uz5X9.js";import"./tooltip-CkRG11nt.js";import"./index-Db4SWmqo.js";import"./badge-Bjpq-dTo.js";import"./Loading01-Bc-DhPB6.js";import"./SearchMd-BR3WTGyz.js";import"./input-BNjye-PL.js";import"./Container-CGejuubt.js";import"./AlertCircle-CbWLhYeZ.js";import"./ArrowLeft-B9NeadX7.js";import"./XCircle-DYElgwI6.js";import"./Type01-DOkYrJiE.js";import"./ChevronDown-DrbU8H5D.js";import"./ChevronRight-DDdv6Tbp.js";import"./ChevronUp-VuH0I39v.js";import"./Download01-CQYzJttq.js";import"./VideoRecorder-BxZ6ULCH.js";import"./FolderClosed-CVPLIN3O.js";import"./Settings01-B10O7d_o.js";import"./Upload01-C0WOeUrY.js";import"./User01-BUPQq0ED.js";import"./XClose-D1beSwQV.js";import"./X-DCpTFZeq.js";import"./Zap-UiK1PUg9.js";import"./table-BxPcvQ9o.js";import"./avatar-DDDYpGJF.js";import"./useQuery-Ck1ZbbFp.js";import"./use-view-mode-U7lICyoa.js";import"./slugify-CEUa2lfQ.js";function Kt(s,e){const o=s.properties||{};for(const n in o){const l=o[n];if(l&&l.type==="string"&&(l.format==="url"||l.format==="uri")&&e&&typeof e=="object"&&n in e&&e[n])return e[n]}const a=["image","img","avatar","icon","logo","thumbnail","cover"];for(const n of a)if(e&&typeof e=="object"&&n in e&&typeof e[n]=="string")return e[n]}function Mt(s){const e=ie.c(25),{item:o,schema:a,actions:n}=s;let l;e[0]!==o||e[1]!==a?(l=Kt(a,o),e[0]=o,e[1]=a,e[2]=l):l=e[2];const r=l,c=o&&typeof o=="object"&&"description"in o&&typeof o.description=="string"?o.description:void 0;let p;e[3]!==n?(p=n&&Object.keys(n).length>0,e[3]=n,e[4]=p):p=e[4];const i=p;let u;e[5]!==r||e[6]!==o.title?(u=t.jsx(Xe,{icon:r,name:o.title,size:"md",className:"shrink-0 shadow-sm"}),e[5]=r,e[6]=o.title,e[7]=u):u=e[7];let f;e[8]!==o.title?(f=t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:o.title}),e[8]=o.title,e[9]=f):f=e[9];const d=c||"No description";let m;e[10]!==d?(m=t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:d}),e[10]=d,e[11]=m):m=e[11];let b;e[12]!==f||e[13]!==m?(b=t.jsxs("div",{className:"flex flex-col gap-0 flex-1",children:[f,m]}),e[12]=f,e[13]=m,e[14]=b):b=e[14];let x;e[15]!==u||e[16]!==b?(x=t.jsxs("div",{className:"flex flex-col gap-4 p-6 flex-1",children:[u,b]}),e[15]=u,e[16]=b,e[17]=x):x=e[17];let N;e[18]!==n||e[19]!==i||e[20]!==o?(N=i&&t.jsx("div",{className:"absolute top-6 right-6 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",onClick:Rt,onMouseDown:Bt,children:t.jsxs(et,{children:[t.jsx(tt,{asChild:!0,children:t.jsx(ge,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Wt,children:t.jsx(it,{size:20})})}),t.jsxs(st,{align:"end",onClick:Ut,children:[n.open&&t.jsxs(L,{onClick:g=>{g.stopPropagation(),n.open?.(o)},children:[t.jsx(nt,{size:16}),"Open"]}),n.edit&&t.jsxs(L,{onClick:g=>{g.stopPropagation(),n.edit?.(o)},children:[t.jsx(Ze,{size:16}),"Edit"]}),n.duplicate&&t.jsxs(L,{onClick:g=>{g.stopPropagation(),n.duplicate?.(o)},children:[t.jsx(ot,{size:16}),"Duplicate"]}),n.delete&&t.jsxs(L,{variant:"destructive",onClick:g=>{g.stopPropagation(),n.delete?.(o)},children:[t.jsx(rt,{size:16}),"Delete"]})]})]})}),e[18]=n,e[19]=i,e[20]=o,e[21]=N):N=e[21];let j;return e[22]!==x||e[23]!==N?(j=t.jsxs(Ct,{className:"cursor-pointer transition-colors h-full flex flex-col group relative",children:[x,N]}),e[22]=x,e[23]=N,e[24]=j):j=e[24],j}function Ut(s){return s.stopPropagation()}function Wt(s){return s.stopPropagation()}function Bt(s){return s.stopPropagation()}function Rt(s){return s.stopPropagation()}const Ht=["icon","avatar","logo"],Ge=["created_at","created_by","id"];function qt(s){return Object.keys(s).find(e=>Ht.includes(e.toLowerCase()))}function at(s,e){return Object.keys(s.properties||{}).filter(o=>["id","created_at","updated_at","created_by","updated_by"].includes(o)?!1:e?e.includes(o):!0).map(o=>({id:o,label:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," ")}))}function Gt(s){const e=ie.c(30),{data:o,schema:a,viewMode:n,search:l,sortKey:r,sortDirection:c,onSort:p,actions:i,onItemClick:u,headerActions:f,emptyState:d,readOnly:m,columns:b,hideToolbar:x,sortableFields:N}=s,j=c===void 0?"asc":c,g=p===void 0?Yt:p;let h;e[0]!==i?(h=i===void 0?{}:i,e[0]=i,e[1]=h):h=e[1];const E=h,T=u===void 0?Vt:u,w=f===void 0?null:f,O=d===void 0?null:d,S=m===void 0?!1:m,_=b===void 0?void 0:b,z=x===void 0?!1:x,y=N===void 0?void 0:N;let v;e[2]!==_||e[3]!==a||e[4]!==y?(v=_?_.filter(Qt).filter(A=>!y||y.includes(A.id)).map(Jt):at(a,y),e[2]=_,e[3]=a,e[4]=y,e[5]=v):v=e[5];const I=v;let P;e[6]!==w||e[7]!==z||e[8]!==g||e[9]!==j||e[10]!==r||e[11]!==I?(P=!z&&t.jsx("div",{className:"shrink-0 w-full border-b border-border h-12",children:t.jsxs("div",{className:"flex items-center gap-3 h-12 px-4",children:[t.jsx("div",{className:"flex items-center gap-2 flex-1",children:w}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsx(Ye,{sortKey:r,sortDirection:j,onSort:g,sortOptions:I})})]})}),e[6]=w,e[7]=z,e[8]=g,e[9]=j,e[10]=r,e[11]=I,e[12]=P):P=e[12];let D;e[13]!==E||e[14]!==_||e[15]!==o||e[16]!==O||e[17]!==T||e[18]!==g||e[19]!==S||e[20]!==a||e[21]!==l||e[22]!==j||e[23]!==r||e[24]!==y||e[25]!==n?(D=n==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:o.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:O||t.jsx(We,{icon:t.jsx(Ue,{size:36,className:"text-muted-foreground"}),title:"No items found",description:l?"Try adjusting your search":"No items to display"})}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:o.map(A=>t.jsx("div",{onClick:()=>T?.(A),className:"cursor-pointer h-full",children:t.jsx(Mt,{item:A,schema:a,readOnly:S,actions:E})},A.id))})}):t.jsx(bt,{columns:es(_,a,y,E),data:o,sortKey:r,sortDirection:j,onSort:g,onRowClick:T,emptyState:O||t.jsx(We,{icon:t.jsx(Ue,{size:36,className:"text-muted-foreground"}),title:"No items found",description:l?"Try adjusting your search":"No items to display"})}),e[13]=E,e[14]=_,e[15]=o,e[16]=O,e[17]=T,e[18]=g,e[19]=S,e[20]=a,e[21]=l,e[22]=j,e[23]=r,e[24]=y,e[25]=n,e[26]=D):D=e[26];let $;return e[27]!==P||e[28]!==D?($=t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[P,D]}),e[27]=P,e[28]=D,e[29]=$):$=e[29],$}function Jt(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function Qt(s){return s.sortable!==!1}function Vt(){}function Yt(){}function Xt(s){return{id:"actions",header:"",render:e=>t.jsxs(et,{children:[t.jsx(tt,{asChild:!0,children:t.jsx(ge,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:o=>o.stopPropagation(),children:t.jsx(it,{size:20})})}),t.jsxs(st,{align:"end",onClick:o=>o.stopPropagation(),children:[s.open&&t.jsxs(L,{onClick:o=>{o.stopPropagation(),s.open?.(e)},children:[t.jsx(nt,{size:16}),"Open"]}),s.edit&&t.jsxs(L,{onClick:o=>{o.stopPropagation(),s.edit?.(e)},children:[t.jsx(Ze,{size:16}),"Edit"]}),s.duplicate&&t.jsxs(L,{onClick:o=>{o.stopPropagation(),s.duplicate?.(e)},children:[t.jsx(ot,{size:16}),"Duplicate"]}),s.delete&&t.jsxs(L,{variant:"destructive",onClick:o=>{o.stopPropagation(),s.delete?.(e)},children:[t.jsx(rt,{size:16}),"Delete"]})]})]}),cellClassName:"w-[60px]",sortable:!1}}function ct(s){const e=s.type;return Array.isArray(e)?e.every(o=>ct({type:o})):e==="string"||e==="number"||e==="integer"||e==="boolean"||e==="null"}function Zt(s,e){const o=s.properties||{},a=Object.keys(o).filter(i=>{const u=o[i];return u&&ct(u)}),n=qt(o),l=[],r=new Set;n&&a.includes(n)&&(l.push(n),r.add(n));const c=["title","description","updated_at","updated_by"];for(const i of c)a.includes(i)&&!r.has(i)&&(l.push(i),r.add(i));const p=a.filter(i=>!r.has(i)&&!Ge.includes(i)).sort((i,u)=>i.localeCompare(u));for(const i of p)l.push(i),r.add(i);for(const i of Ge)a.includes(i)&&!r.has(i)&&(l.push(i),r.add(i));return l.map(i=>{const u=o[i],f=e?e.includes(i):!["id"].includes(i);return i===n?{id:i,header:"",render:d=>{const m=d[i];return t.jsx(Xe,{icon:m,name:d.title,size:"sm",className:"shrink-0 shadow-sm"})},sortable:!1,cellClassName:"w-16 shrink-0",wrap:!0}:i==="description"?{id:i,header:"Description",render:d=>{const m=d[i];return m==null?"—":t.jsx("span",{className:"block truncate max-w-[50ch]",children:String(m)})},sortable:f,cellClassName:"max-w-[50ch]"}:i==="created_by"||i==="updated_by"?{id:i,header:i.charAt(0).toUpperCase()+i.slice(1).replace(/_/g," "),render:d=>{const m=d[i];return m?t.jsx(yt,{id:String(m),size:"xs"}):"—"},sortable:f,cellClassName:"max-w-[250px]"}:u?.format==="date-time"||i.endsWith("_at")?{id:i,header:i.charAt(0).toUpperCase()+i.slice(1).replace(/_/g," "),render:d=>{const m=d[i];return m?t.jsx("span",{className:"block truncate max-w-full",children:new Date(m).toLocaleDateString()}):"—"},sortable:f,cellClassName:"max-w-[200px]"}:{id:i,header:i.charAt(0).toUpperCase()+i.slice(1).replace(/_/g," "),render:d=>{const m=d[i];return m==null?"—":t.jsx("span",{className:"block truncate max-w-full",children:String(m)})},sortable:f,cellClassName:"max-w-[200px]"}})}function es(s,e,o,a){const n=s||Zt(e,o);return n.some(c=>c.id==="actions")?n:Object.keys(a).length>0?[...n,Xt(a)]:n}function ts(s){const e=ie.c(114),{connectionId:o,org:a,activeCollection:n}=s,l=n.name,r=n.schema??xt,c=n.hasCreateTool,p=n.hasUpdateTool,i=n.hasDeleteTool,u=pt(),{data:f}=ft.useSession(),d=f?.user?.id||"unknown",m=$t(o);let b;e[0]!==m||e[1]!==o?(b=m?Nt(m):o,e[0]=m,e[1]=o,e[2]=b):b=e[2];const x=b,{org:N}=$e();let j;e[3]!==o||e[4]!==N.id?(j={connectionId:o,orgId:N.id},e[3]=o,e[4]=N.id,e[5]=j):j=e[5];const g=Qe(j),h=Et(o,l,g),E=`${o}-${l}`;let T;e[6]!==a||e[7]!==E?(T={namespace:a,resource:E,defaultSortKey:"updated_at"},e[6]=a,e[7]=E,e[8]=T):T=e[8];const{search:w,searchTerm:O,setSearch:S,viewMode:_,setViewMode:z,sortKey:y,sortDirection:v,handleSort:I}=vt(T);let P;e[9]!==O||e[10]!==v||e[11]!==y?(P={searchTerm:O,sortKey:y,sortDirection:v},e[9]=O,e[10]=v,e[11]=y,e[12]=P):P=e[12];const D=Ot(o,l,g,P),$=!c&&!p&&!i;let A;e[13]!==x||e[14]!==l||e[15]!==u||e[16]!==a?(A=C=>{u({to:"/$org/$project/mcps/$appSlug/$collectionName/$itemId",params:{org:a,project:Fe,appSlug:x,collectionName:l,itemId:C.id}})},e[13]=x,e[14]=l,e[15]=u,e[16]=a,e[17]=A):A=e[17];const F=A;let ne;e[18]!==h.create||e[19]!==d?(ne=async C=>{const he=new Date().toISOString();await h.create.mutateAsync({...C,id:Me("conn"),title:`${C.title} (Copy)`,created_at:he,updated_at:he,created_by:d,updated_by:d})},e[18]=h.create,e[19]=d,e[20]=ne):ne=e[20];const xe=ne,[K,je]=ht.useState(null);let re;e[21]===Symbol.for("react.memo_cache_sentinel")?(re=C=>{je(C)},e[21]=re):re=e[21];const dt=re;let M;e[22]!==F||e[23]!==p?(M=p&&{edit:F},e[22]=F,e[23]=p,e[24]=M):M=e[24];let U;e[25]!==xe||e[26]!==c?(U=c&&{duplicate:xe},e[25]=xe,e[26]=c,e[27]=U):U=e[27];let W;e[28]!==i?(W=i&&{delete:dt},e[28]=i,e[29]=W):W=e[29];let le;e[30]!==U||e[31]!==W||e[32]!==M?(le={...M,...U,...W},e[30]=U,e[31]=W,e[32]=M,e[33]=le):le=e[33];const Ce=le;let ae;e[34]!==h.delete||e[35]!==K?(ae=async()=>{K&&(await h.delete.mutateAsync(K.id),je(null))},e[34]=h.delete,e[35]=K,e[36]=ae):ae=e[36];const be=ae;let ce;e[37]!==h.create||e[38]!==x||e[39]!==l||e[40]!==c||e[41]!==u||e[42]!==a||e[43]!==d?(ce=async()=>{if(!c){ke.error("Create operation is not available for this collection");return}const C=new Date().toISOString(),he={id:Me("conn"),title:"New Item",description:"A brief description of the item",created_at:C,updated_at:C,created_by:d,updated_by:d};try{const Oe=await h.create.mutateAsync(he);u({to:"/$org/$project/mcps/$appSlug/$collectionName/$itemId",params:{org:a,project:Fe,appSlug:x,collectionName:l,itemId:Oe.id}})}catch(Oe){console.error("Failed to create item:",Oe)}},e[37]=h.create,e[38]=x,e[39]=l,e[40]=c,e[41]=u,e[42]=a,e[43]=d,e[44]=ce):ce=e[44];const ye=ce;let de;e[45]!==r?(de=at(r),e[45]=r,e[46]=de):de=e[46];const ve=de,Le=(D?.length??0)>0,mt=c&&Le,ut=c&&!Le&&!w;let me;e[47]!==h.create||e[48]!==ye||e[49]!==c?(me=c?t.jsxs(ge,{onClick:ye,size:"sm",disabled:h.create.isPending,className:"h-7",children:[t.jsx(kt,{className:"mr-2 h-4 w-4"}),h.create.isPending?"Creating...":"Create"]}):null,e[47]=h.create,e[48]=ye,e[49]=c,e[50]=me):me=e[50];const ze=me,Ne=y;let B;e[51]!==I||e[52]!==v||e[53]!==ve||e[54]!==Ne?(B=t.jsx(Ye,{sortKey:Ne,sortDirection:v,onSort:I,sortOptions:ve}),e[51]=I,e[52]=v,e[53]=ve,e[54]=Ne,e[55]=B):B=e[55];const we=mt&&ze;let R;e[56]!==B||e[57]!==we?(R=t.jsxs(Lt,{children:[B,we]}),e[56]=B,e[57]=we,e[58]=R):R=e[58];const Se=`Search ${l}...`;let H;e[59]!==S?(H=C=>{C.key==="Escape"&&(S(""),C.target.blur())},e[59]=S,e[60]=H):H=e[60];let q;e[61]!==w||e[62]!==S||e[63]!==Se||e[64]!==H?(q=t.jsx(jt,{value:w,onChange:S,placeholder:Se,onKeyDown:H}),e[61]=w,e[62]=S,e[63]=Se,e[64]=H,e[65]=q):q=e[65];let G;e[66]!==D?(G=D??[],e[66]=D,e[67]=G):G=e[67];const _e=y;let J;e[68]!==F?(J=C=>F(C),e[68]=F,e[69]=J):J=e[69];const Pe="No items found",De=w?"Try adjusting your search terms":"This collection doesn't have any items yet.",Ie=ut?ze:void 0;let Q;e[70]!==Pe||e[71]!==De||e[72]!==Ie?(Q=t.jsx(lt,{image:null,title:Pe,description:De,actions:Ie}),e[70]=Pe,e[71]=De,e[72]=Ie,e[73]=Q):Q=e[73];let V;e[74]!==I||e[75]!==$||e[76]!==Ce||e[77]!==r||e[78]!==w||e[79]!==S||e[80]!==z||e[81]!==v||e[82]!==G||e[83]!==_e||e[84]!==J||e[85]!==Q||e[86]!==_?(V=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(Gt,{hideToolbar:!0,data:G,schema:r,viewMode:_,onViewModeChange:z,search:w,onSearchChange:S,sortKey:_e,sortDirection:v,onSort:I,actions:Ce,onItemClick:J,readOnly:$,emptyState:Q})}),e[74]=I,e[75]=$,e[76]=Ce,e[77]=r,e[78]=w,e[79]=S,e[80]=z,e[81]=v,e[82]=G,e[83]=_e,e[84]=J,e[85]=Q,e[86]=_,e[87]=V):V=e[87];let Y;e[88]!==q||e[89]!==V?(Y=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[q,V]}),e[88]=q,e[89]=V,e[90]=Y):Y=e[90];const Ae=!!K;let ue;e[91]===Symbol.for("react.memo_cache_sentinel")?(ue=C=>{C||je(null)},e[91]=ue):ue=e[91];let pe;e[92]===Symbol.for("react.memo_cache_sentinel")?(pe=t.jsx(_t,{children:"Delete item?"}),e[92]=pe):pe=e[92];const Te=K?.title;let X;e[93]!==Te?(X=t.jsxs(Pt,{children:[pe,t.jsxs(Dt,{children:['Are you sure you want to delete "',Te,'"? This action cannot be undone.']})]}),e[93]=Te,e[94]=X):X=e[94];let Z;e[95]!==h.delete.isPending?(Z=t.jsx(wt,{disabled:h.delete.isPending,children:"Cancel"}),e[95]=h.delete.isPending,e[96]=Z):Z=e[96];const Ee=h.delete.isPending?"Deleting...":"Delete";let ee;e[97]!==h.delete.isPending||e[98]!==be||e[99]!==Ee?(ee=t.jsx(St,{onClick:be,disabled:h.delete.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Ee}),e[97]=h.delete.isPending,e[98]=be,e[99]=Ee,e[100]=ee):ee=e[100];let te;e[101]!==Z||e[102]!==ee?(te=t.jsxs(It,{children:[Z,ee]}),e[101]=Z,e[102]=ee,e[103]=te):te=e[103];let se;e[104]!==X||e[105]!==te?(se=t.jsxs(At,{children:[X,te]}),e[104]=X,e[105]=te,e[106]=se):se=e[106];let oe;e[107]!==Ae||e[108]!==se?(oe=t.jsx(Tt,{open:Ae,onOpenChange:ue,children:se}),e[107]=Ae,e[108]=se,e[109]=oe):oe=e[109];let fe;return e[110]!==R||e[111]!==Y||e[112]!==oe?(fe=t.jsxs(t.Fragment,{children:[R,Y,oe]}),e[110]=R,e[111]=Y,e[112]=oe,e[113]=fe):fe=e[113],fe}function ss(){const s=ie.c(12),{org:e,project:o}=$e(),a=gt();let n;s[0]!==e.id?(n={connectionId:Ve,orgId:e.id},s[0]=e.id,s[1]=n):n=s[1];const l=Qe(n);let r;s[2]!==l||s[3]!==o?(r=async u=>{const f=o.enabledPlugins??[];if(f.includes(u))return;const d=[...f,u],m=await l.callTool({name:"PROJECT_UPDATE",arguments:{projectId:o.id,enabledPlugins:d}});return m.structuredContent??m},s[2]=l,s[3]=o,s[4]=r):r=s[4];let c;s[5]!==e.id||s[6]!==o||s[7]!==a?(c=()=>{a.invalidateQueries({queryKey:Ke.project(e.id,o.slug)}),a.invalidateQueries({queryKey:Ke.projects(e.id)})},s[5]=e.id,s[6]=o,s[7]=a,s[8]=c):c=s[8];let p;return s[9]!==r||s[10]!==c?(p={mutationFn:r,onSuccess:c,onError:os},s[9]=r,s[10]=c,s[11]=p):p=s[11],zt(p)}function os(s){ke.error("Failed to enable plugin: "+(s instanceof Error?s.message:"Unknown error"))}function is(s){const e=ie.c(12),{pluginId:o,title:a,description:n,icon:l}=s,r=ss();let c;e[0]!==r||e[1]!==o?(c=async()=>{try{await r.mutateAsync(o),ke.success("Plugin enabled!")}catch{}},e[0]=r,e[1]=o,e[2]=c):c=e[2];const p=c,i=l??null,u=r.isPending?"Enabling…":"Enable plugin";let f;e[3]!==r.isPending||e[4]!==p||e[5]!==u?(f=t.jsx(ge,{onClick:p,disabled:r.isPending,children:u}),e[3]=r.isPending,e[4]=p,e[5]=u,e[6]=f):f=e[6];let d;return e[7]!==n||e[8]!==i||e[9]!==f||e[10]!==a?(d=t.jsx(lt,{image:i,title:a,description:n,actions:f}),e[7]=n,e[8]=i,e[9]=f,e[10]=a,e[11]=d):d=e[11],d}const Je="workflows",ns={name:"WORKFLOW",displayName:"Workflow",hasCreateTool:!0,hasUpdateTool:!0,hasDeleteTool:!0};function uo(){const s=ie.c(5),{project:e,org:o}=$e();if(!(e.enabledPlugins??[]).includes(Je)){let c;s[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k.Header,{children:t.jsx(k.Header.Left,{children:t.jsx(Be,{children:t.jsx(Re,{children:t.jsx(He,{children:t.jsx(qe,{children:"Workflows"})})})})})}),s[0]=c):c=s[0];let p;return s[1]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsxs(k,{children:[c,t.jsx(k.Content,{children:t.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:t.jsx(is,{pluginId:Je,title:"Enable Workflows",description:"Automate multi-step processes by enabling the Workflows plugin. Once enabled you can create, run, and monitor workflows.",icon:t.jsx("div",{className:"bg-muted p-4 rounded-full",children:t.jsx(Ft,{className:"size-8 text-muted-foreground"})})})})})]}),s[1]=p):p=s[1],p}let l;s[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(k.Header,{children:t.jsx(k.Header.Left,{children:t.jsx(Be,{children:t.jsx(Re,{children:t.jsx(He,{children:t.jsx(qe,{children:"Workflows"})})})})})}),s[2]=l):l=s[2];let r;return s[3]!==o.slug?(r=t.jsxs(k,{children:[l,t.jsx(k.Content,{children:t.jsx(ts,{connectionId:Ve,org:o.slug,activeCollection:ns})})]}),s[3]=o.slug,s[4]=r):r=s[4],r}export{uo as default};
|
package/dist/client/index.html
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<meta name="twitter:description" content="Hire specialized agents, give them access to your tools, and let them deliver real projects — with planning, verification, and observability built in." />
|
|
14
14
|
<meta name="twitter:image" content="/og-image.png" />
|
|
15
15
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
16
|
-
<script type="module" crossorigin src="/assets/index-
|
|
16
|
+
<script type="module" crossorigin src="/assets/index-Brr7A335.js"></script>
|
|
17
17
|
<link rel="stylesheet" crossorigin href="/assets/index-DrcfnPK4.css">
|
|
18
18
|
</head>
|
|
19
19
|
<body>
|
package/dist/server/cli.js
CHANGED
|
@@ -376,7 +376,7 @@ Hint: Configure a valid Google account email in Monitor Configuration > Contexto
|
|
|
376
376
|
|
|
377
377
|
`).trim(),U=V.length>0?`Not executed tools (${V.length}/${Y.tools.length}): ${V.join(", ")}`:"",q=[z,U].filter((O)=>O.length>0).join(`
|
|
378
378
|
|
|
379
|
-
`);return{toolResults:H,agentSummary:q.length>0?q:null,unexecutedTools:V}}finally{await X.close?.().catch(()=>{})}}async function lD1(Y,X){let J=a6(),G=Y.organization.id,W=await J.monitorConnections.findByItemId(G,X.id);if(W){if(await Y.storage.connections.findById(W.connection_id,G))return W.connection_id}let K=Ao6(X);if(!K)throw Error(`Registry item ${X.id} has no remote URL`);let Z=wo6(Y),Q=Mo6(X),H=await Y.storage.connections.create({organization_id:G,created_by:Z,title:`[MCP Tester] ${X.title}`,description:`Auto-created monitor connection for ${X.id}`,app_name:"private-registry-monitor",app_id:`${i$}:monitor`,connection_type:Q,connection_url:K,metadata:{monitorConnection:!0,registryItemId:X.id,pluginId:i$}});return await J.monitorConnections.upsert({organization_id:G,item_id:X.id,connection_id:H.id,auth_status:"none"}),H.id}async function ko6(Y){let X=a6();switch(Y.action){case"unlisted":return await X.items.update(Y.organizationId,Y.item.id,{is_unlisted:!0}),"unlisted";case"remove_public":return await X.items.update(Y.organizationId,Y.item.id,{is_public:!1}),"removed_public";case"remove_private":case"remove_all":return await X.items.delete(Y.organizationId,Y.item.id),Y.action==="remove_all"?"removed_all":"removed_private";default:return"none"}}async function vo6(Y){let X=Date.now();if(Y.signal.aborted)throw Error("Run cancelled");let J="passed",G=!1,W=!1,K=null,Z="none",Q=null,H=[],$=null,V=async()=>{await Y.onProgress?.({status:J,connectionOk:G,toolsListed:W,toolResults:[...H],agentSummary:Q,errorMessage:K,actionTaken:Z,durationMs:Date.now()-X})};try{let z=await lD1(Y.ctx,Y.item);$=await Y.ctx.createMCPProxy(z),G=!0;let q=(await oh($.listTools?$.listTools():Promise.resolve({tools:[]}),Y.monitorConfig.perMcpTimeoutMs,`listTools ${Y.item.id}`)).tools??[];if(W=!0,Y.monitorConfig.monitorMode!=="health_check")H.push(...q.map((O)=>mD1(O.name))),await V();if(Y.monitorConfig.monitorMode==="full_agent"){let O=await _o6({ctx:Y.ctx,monitorConfig:Y.monitorConfig,item:Y.item,proxy:$,tools:q,signal:Y.signal,onProgress:async(L)=>{H.length=0,H.push(...EQ0({discoveredTools:q,executedResults:L})),J=L.some((M)=>!M.success)?"failed":"passed",await V()}});if(H.length=0,H.push(...EQ0({discoveredTools:q,executedResults:O.toolResults})),Q=O.agentSummary,O.toolResults.some((L)=>!L.success))J="failed";if(O.unexecutedTools.length>0){if(J="failed",!K)K=`Agent skipped ${O.unexecutedTools.length} tool(s): ${O.unexecutedTools.join(", ")}`}}else if(Y.monitorConfig.monitorMode!=="health_check"){for(let O=0;O<q.length;O++){let L=q[O];if(!L||Y.signal.aborted)throw Error("Run cancelled");let M=Date.now();try{let E={},R=await oh($.callTool({name:L.name,arguments:E}),Y.monitorConfig.perToolTimeoutMs,`tool ${L.name}`),C=!R.isError,T=Date.now()-M;PQ0(H,{toolName:L.name,success:C,input:E,durationMs:T,outputPreview:SQ0(R.structuredContent??R.content),error:C?null:ve(R.content?.find((P)=>P.type==="text")?.text?.slice(0,300)??"Tool returned error")}),await V()}catch(E){let R=Date.now()-M,C=E instanceof Error?E.message:String(E);PQ0(H,{toolName:L.name,success:!1,durationMs:R,error:ve(C)}),await V()}}if(H.some((O)=>!O.success))J="failed"}else for(let O of q)H.push(mD1(O.name));if(Y.canApplyFailureAction&&J==="failed"&&Y.monitorConfig.onFailure!=="none")Z=await ko6({organizationId:Y.organizationId,item:Y.item,action:Y.monitorConfig.onFailure})}catch(z){if(K=z instanceof Error?z.message:String(z),Eo6(z))J="needs_auth",await a6().monitorConnections.updateAuthStatus(Y.organizationId,Y.item.id,"needs_auth");else J="error"}finally{await $?.close?.().catch(()=>{})}return{status:J,connectionOk:G,toolsListed:W,toolResults:H,agentSummary:Q,errorMessage:K,actionTaken:Z,durationMs:Date.now()-X}}async function fo6(Y){let X=Date.now(),J=a6(),W=(await J.items.list(Y.organizationId,{includeUnlisted:!0})).items.filter((U)=>{if(Y.monitorConfig.testPublicOnly&&!U.is_public)return!1;if(Y.monitorConfig.testPrivateOnly&&U.is_public)return!1;return!0}),K=Y.monitorConfig.includePendingRequests?(await J.publishRequests.list(Y.organizationId,{status:"pending",limit:500})).items.map((U)=>yo6(U)):[],Z=[...W.map((U)=>({item:U,source:"registry_item"})),...K.map((U)=>({item:U,source:"publish_request"}))];if(Z.length===0){await J.monitorRuns.update(Y.organizationId,Y.runId,{total_items:0,status:"completed",started_at:new Date().toISOString(),finished_at:new Date().toISOString()}),await _e({ctx:Y.ctx,type:"registry.monitor.completed",subject:Y.runId,data:{runId:Y.runId,total:0}});return}await J.monitorRuns.update(Y.organizationId,Y.runId,{total_items:Z.length,status:"running",started_at:new Date().toISOString()});let Q=0,H=0,$=0,V=0;for(let U=0;U<Z.length;U++){let q=Z[U],O=q?.item;if(!O||Y.signal.aborted){await J.monitorRuns.update(Y.organizationId,Y.runId,{status:"cancelled",current_item_id:null,finished_at:new Date().toISOString()});return}await J.monitorRuns.update(Y.organizationId,Y.runId,{current_item_id:O.id});let L=null,M=async(R)=>{if(!L){L=(await J.monitorResults.create({run_id:Y.runId,organization_id:Y.organizationId,item_id:O.id,item_title:O.title,status:R.status,error_message:R.errorMessage,connection_ok:R.connectionOk,tools_listed:R.toolsListed,tool_results:R.toolResults,agent_summary:R.agentSummary,duration_ms:R.durationMs,action_taken:R.actionTaken})).id;return}await J.monitorResults.update(Y.organizationId,L,{status:R.status,error_message:R.errorMessage,connection_ok:R.connectionOk,tools_listed:R.toolsListed,tool_results:R.toolResults,agent_summary:R.agentSummary,duration_ms:R.durationMs,action_taken:R.actionTaken})},E=await vo6({ctx:Y.ctx,organizationId:Y.organizationId,item:O,monitorConfig:Y.monitorConfig,signal:Y.signal,canApplyFailureAction:q.source==="registry_item",onProgress:M});if(await M({status:E.status,connectionOk:E.connectionOk,toolsListed:E.toolsListed,toolResults:E.toolResults,agentSummary:E.agentSummary,errorMessage:E.errorMessage,actionTaken:E.actionTaken,durationMs:E.durationMs}),Q+=1,E.status==="passed")H+=1;else if(E.status==="failed"||E.status==="error")$+=1;else V+=1;if(await J.monitorRuns.update(Y.organizationId,Y.runId,{tested_items:Q,passed_items:H,failed_items:$,skipped_items:V}),E.status==="failed"||E.status==="error")await _e({ctx:Y.ctx,type:"registry.monitor.item_failed",subject:O.id,data:{runId:Y.runId,itemId:O.id,itemTitle:O.title,status:E.status,errorMessage:E.errorMessage,actionTaken:E.actionTaken}})}let z=Date.now()-X;await J.monitorRuns.update(Y.organizationId,Y.runId,{status:"completed",current_item_id:null,finished_at:new Date().toISOString()}),await _e({ctx:Y.ctx,type:"registry.monitor.completed",subject:Y.runId,data:{runId:Y.runId,total:Q,passed:H,failed:$,skipped:V,durationMs:z}})}function yo6(Y){return{id:`${yO}${Y.id}`,title:Y.title,description:Y.description,_meta:Y._meta,server:Y.server,is_public:!1,is_unlisted:!0,created_at:Y.created_at,updated_at:Y.updated_at}}async function ho6(Y,X){let J=jQ0(Y);await J.access.check();let G=a6(),W=await G.monitorRuns.create({organization_id:J.organization.id,status:"pending",config_snapshot:X,started_at:null}),K=new AbortController;return ke.set(W.id,K),fo6({ctx:J,runId:W.id,organizationId:J.organization.id,monitorConfig:X,signal:K.signal}).catch(async(Z)=>{await G.monitorRuns.update(J.organization.id,W.id,{status:"failed",current_item_id:null,finished_at:new Date().toISOString()}).catch(()=>{}),await _e({ctx:J,type:"registry.monitor.failed",subject:W.id,data:{runId:W.id,error:Z instanceof Error?Z.message:String(Z)}}),Do6(`Run ${W.id} failed with uncaught error:`,Z)}).finally(()=>{ke.delete(W.id)}),{run:{id:W.id}}}var ke,CQ0="[MONITOR-AGENT]",Lo6,No6="health_check: not called",vQ0;var fe=A(()=>{p9();$7();aD();TK();x9();ke=new Map,Lo6=q10;vQ0={name:"REGISTRY_MONITOR_RUN_START",description:"Start an MCP registry monitor run with an isolated set of monitor connections.",inputSchema:zQ0,outputSchema:UQ0,handler:async(Y,X)=>{let G=je(Y.config??{}),{run:W}=await ho6(X,G),Z=await a6().monitorRuns.findById(jQ0(X).organization.id,W.id);if(!Z)throw Error(`Failed to load monitor run ${W.id}`);return{run:Z}}}});var fQ0;var yQ0=A(()=>{TK();x9();fQ0={name:"REGISTRY_MONITOR_RUN_LIST",description:"List MCP registry monitor runs",inputSchema:vD1,outputSchema:OQ0,handler:z4(vD1,async(Y,X)=>{return a6().monitorRuns.list(X.organization.id,Y)})}});var hQ0;var bQ0=A(()=>{TK();x9();hQ0={name:"REGISTRY_MONITOR_RUN_GET",description:"Get details for one MCP registry monitor run",inputSchema:fD1,outputSchema:LQ0,handler:z4(fD1,async(Y,X)=>{return{run:await a6().monitorRuns.findById(X.organization.id,Y.runId)}})}});var xQ0;var gQ0=A(()=>{TK();fe();x9();xQ0={name:"REGISTRY_MONITOR_RUN_CANCEL",description:"Cancel a running MCP registry monitor run",inputSchema:kD1,outputSchema:qQ0,handler:z4(kD1,async(Y,X)=>{return IQ0(Y.runId),{run:await a6().monitorRuns.update(X.organization.id,Y.runId,{status:"cancelled",current_item_id:null,finished_at:new Date().toISOString()})}})}});var uQ0;var mQ0=A(()=>{TK();x9();uQ0={name:"REGISTRY_MONITOR_RESULT_LIST",description:"List results for a given MCP registry monitor run",inputSchema:yD1,outputSchema:NQ0,handler:z4(yD1,async(Y,X)=>{return a6().monitorResults.listByRun(X.organization.id,Y.runId,{status:Y.status,limit:Y.limit,offset:Y.offset})})}});var lQ0;var dQ0=A(()=>{TK();x9();aD();lQ0={name:"REGISTRY_MONITOR_CONNECTION_LIST",description:"List monitor connection mappings for private registry MCP monitor runs, including auth status",inputSchema:hD1,outputSchema:BQ0,handler:z4(hD1,async(Y,X)=>{let J=a6(),G=await J.monitorConnections.list(X.organization.id);return{items:await Promise.all(G.map(async(K)=>{let Z=await J.items.findById(X.organization.id,K.item_id);if(!Z&&K.item_id.startsWith(yO)){let $=K.item_id.slice(yO.length),V=await J.publishRequests.findById(X.organization.id,$);if(V)Z={id:K.item_id,title:V.title,description:V.description,_meta:V._meta,server:V.server,is_public:!1,is_unlisted:!0,created_at:V.created_at,updated_at:V.updated_at}}let Q=Z?.server.remotes?.find(($)=>$.url)?.url??null,H=K.item_id.startsWith(yO)?"request":"store";return{mapping:K,item:Z,remoteUrl:Q,source:H}}))}})}});function bo6(Y){return{id:`${yO}${Y.id}`,title:Y.title,description:Y.description,_meta:Y._meta,server:Y.server,is_public:!1,is_unlisted:!0,created_at:Y.created_at,updated_at:Y.updated_at}}var cQ0;var pQ0=A(()=>{TK();fe();x9();aD();cQ0={name:"REGISTRY_MONITOR_CONNECTION_SYNC",description:"Ensure every registry item has a dedicated monitor connection mapping for MCP monitors",inputSchema:bD1,outputSchema:DQ0,handler:z4(bD1,async(Y,X)=>{let J=a6(),G=(await J.items.list(X.organization.id,{includeUnlisted:!0})).items,K=(await J.publishRequests.list(X.organization.id,{status:"pending",limit:500})).items.map(bo6),Z=[...G,...K],Q=await J.monitorConnections.list(X.organization.id),H=new Set(Q.map((V)=>V.item_id)),$=0;for(let V of Z){if(!V.server.remotes?.some((z)=>z.url))continue;if(await lD1(X,V),!H.has(V.id))$+=1}return{created:$,updated:Math.max(Z.length-$,0)}})}});var nQ0;var iQ0=A(()=>{TK();x9();nQ0={name:"REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH",description:"Update the auth_status of a monitor connection mapping (by core connection ID)",inputSchema:xD1,outputSchema:wQ0,handler:z4(xD1,async({connectionId:Y,authStatus:X},J)=>{let G=a6(),W=J.organization.id,K=await G.monitorConnections.findByConnectionId(W,Y);if(!K)throw Error(`No monitor connection mapping found for connection ${Y}`);return await G.monitorConnections.updateAuthStatus(W,K.item_id,X),{success:!0}})}});function sh(Y){if(!Y||typeof Y!=="object")return null;let X=Y,J=X.id;if(typeof J==="string"&&J.length>0)return J;for(let G of["event","result","structuredContent","content"]){let W=X[G],K=sh(W);if(K)return K}if(Array.isArray(Y))for(let G of Y){let W=sh(G);if(W)return W}return null}var aQ0;var rQ0=A(()=>{p9();TK();x9();aQ0={name:"REGISTRY_MONITOR_SCHEDULE_SET",description:"Schedule recurring MCP monitor runs via EVENT_PUBLISH cron",inputSchema:gD1,outputSchema:MQ0,handler:z4(gD1,async(Y,X)=>{let J=sY.SELF(X.organization.id),G=await X.createMCPProxy(J);try{let W=await G.callTool({name:"EVENT_PUBLISH",arguments:{type:"registry.monitor.scheduled",subject:"private-registry",cron:Y.cronExpression,data:{config:Y.config??{}}}});if(W.isError)throw Error("Failed to create monitor schedule via EVENT_PUBLISH");let K=sh(W.structuredContent)??sh(W.content)??sh(W);if(!K)throw Error("Could not resolve schedule event id from EVENT_PUBLISH");return{scheduleEventId:K}}finally{await G.close?.().catch(()=>{})}})}});var oQ0;var sQ0=A(()=>{p9();TK();x9();oQ0={name:"REGISTRY_MONITOR_SCHEDULE_CANCEL",description:"Cancel a recurring MCP monitor schedule via EVENT_CANCEL",inputSchema:uD1,outputSchema:AQ0,handler:z4(uD1,async(Y,X)=>{let J=sY.SELF(X.organization.id),G=await X.createMCPProxy(J);try{if((await G.callTool({name:"EVENT_CANCEL",arguments:{eventId:Y.scheduleEventId}})).isError)throw Error("Failed to cancel monitor schedule via EVENT_CANCEL");return{success:!0}}finally{await G.close?.().catch(()=>{})}})}});function xo6(Y,X){if(!X)return Y;let J={field:["is_public"],operator:"eq",value:!1};if(!Y)return J;return{operator:"and",conditions:[Y,J]}}function go6(Y){let X=new Map,J=new Map;for(let W of Y){let K=W._meta?.["mcp.mesh"];for(let Z of K?.tags??[])X.set(Z,(X.get(Z)??0)+1);for(let Z of K?.categories??[])J.set(Z,(J.get(Z)??0)+1)}let G=(W)=>Array.from(W.entries()).map(([K,Z])=>({value:K,count:Z})).sort((K,Z)=>K.value.localeCompare(Z.value));return{tags:G(X),categories:G(J)}}var tQ0,eQ0,YK0,XK0;var JK0=A(()=>{t1();r5();x9();tQ0={name:"COLLECTION_REGISTRY_APP_LIST",description:"List registry items for Store discovery. Supports private-only mode from plugin settings.",inputSchema:$L,outputSchema:FR,handler:z4($L,async(Y,X)=>{let J=a6(),G=await Ih(X,X.organization.id);return J.items.list(X.organization.id,{...Y,where:xo6(Y.where,G.storePrivateOnly===!0)})})},eQ0={name:"COLLECTION_REGISTRY_APP_GET",description:"Get a registry item for Store details. Respects private-only mode from plugin settings.",inputSchema:WZ,outputSchema:Iw,handler:z4(WZ,async(Y,X)=>{let J=a6(),G=await Ih(X,X.organization.id),W=Y.id??Y.name;if(!W)return{item:null};let K=await J.items.findByIdOrName(X.organization.id,W);if(!K)return{item:null};if(G.storePrivateOnly&&K.is_public)return{item:null};return{item:K}})},YK0={name:"COLLECTION_REGISTRY_APP_VERSIONS",description:"Get registry item versions for Store details. Respects private-only mode from plugin settings.",inputSchema:WZ,outputSchema:F.object({versions:F.array(O3)}),handler:z4(WZ,async(Y,X)=>{let J=a6(),G=await Ih(X,X.organization.id),W=Y.id??Y.name;if(!W)return{versions:[]};let K=await J.items.findByIdOrName(X.organization.id,W);if(!K)return{versions:[]};if(G.storePrivateOnly&&K.is_public)return{versions:[]};return{versions:[K]}})},XK0={name:"COLLECTION_REGISTRY_APP_FILTERS",description:"List Store filter facets for registry items. Respects private-only mode from plugin settings.",inputSchema:F.object({}),outputSchema:VR,handler:z4(F.object({}),async(Y,X)=>{let J=a6();if(!(await Ih(X,X.organization.id)).storePrivateOnly)return J.items.getFilters(X.organization.id);let W=await J.items.list(X.organization.id,{limit:1e4,where:{field:["is_public"],operator:"eq",value:!1}});return go6(W.items)})}});var GK0;var WK0=A(()=>{t90();YY0();JY0();WY0();KY0();$Y0();VY0();UY0();OY0();NY0();DY0();MY0();EY0();TY0();CY0();jY0();_Y0();vY0();fe();yQ0();bQ0();gQ0();mQ0();dQ0();pQ0();iQ0();rQ0();sQ0();JK0();GK0=[tQ0,eQ0,YK0,XK0,zY0,qY0,FY0,BY0,XY0,s90,LY0,GY0,HY0,QY0,e90,wY0,AY0,PY0,RY0,IY0,SY0,kY0,vQ0,fQ0,hQ0,xQ0,uQ0,lQ0,cQ0,nQ0,aQ0,oQ0]});var ZK0;var QK0=A(()=>{aD();n60();d90();o90();WK0();TK();ZK0={id:i$,description:U10,tools:GK0,migrations:p60,publicRoutes:(Y,X)=>{aN1(Y,X),pN1(Y,X)},createStorage:r90,onEvents:{types:["registry.monitor.scheduled"],handler:async(Y,X)=>{let J=await X.createMCPProxy(X.connectionId);try{for(let G of Y){if(G.type!=="registry.monitor.scheduled")continue;let W=G.data&&typeof G.data==="object"?G.data:{},K=W.config&&typeof W.config==="object"?W.config:{},Z=je(K);await J.callTool({name:"REGISTRY_MONITOR_RUN_START",arguments:{config:Z}})}}finally{await J.close()}}}}});var KK0="MCP Workflows",HK0="Create workflows using your MCP tools";var $K0;var FK0=A(()=>{Lw();$K0={name:"001-workflows",async up(Y){await Y.schema.createTable("workflow_collection").addColumn("id","text",(X)=>X.primaryKey()).addColumn("organization_id","text",(X)=>X.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(X)=>X.notNull()).addColumn("description","text").addColumn("virtual_mcp_id","text",(X)=>X.notNull()).addColumn("steps","text",(X)=>X.notNull().defaultTo("[]")).addColumn("created_at","text",(X)=>X.notNull().defaultTo(W8`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(X)=>X.notNull().defaultTo(W8`CURRENT_TIMESTAMP`)).addColumn("created_by","text").addColumn("updated_by","text").execute(),await Y.schema.createIndex("idx_wf_collection_org").on("workflow_collection").column("organization_id").execute(),await Y.schema.createIndex("idx_wf_collection_created_at").on("workflow_collection").column("created_at").execute(),await Y.schema.createTable("workflow").addColumn("id","text",(X)=>X.primaryKey()).addColumn("workflow_collection_id","text").addColumn("organization_id","text",(X)=>X.notNull().references("organization.id").onDelete("cascade")).addColumn("steps","text",(X)=>X.notNull().defaultTo("[]")).addColumn("input","text").addColumn("virtual_mcp_id","text",(X)=>X.notNull()).addColumn("created_at_epoch_ms","bigint",(X)=>X.notNull()).addColumn("created_by","text").execute(),await Y.schema.createIndex("idx_workflow_created_at").on("workflow").column("created_at_epoch_ms").execute(),await Y.schema.createIndex("idx_workflow_collection_id").on("workflow").column("workflow_collection_id").execute(),await Y.schema.createTable("workflow_execution").addColumn("id","text",(X)=>X.primaryKey()).addColumn("workflow_id","text",(X)=>X.notNull().references("workflow.id").onDelete("cascade")).addColumn("organization_id","text",(X)=>X.notNull().references("organization.id").onDelete("cascade")).addColumn("status","text",(X)=>X.notNull().defaultTo("enqueued")).addColumn("input","text").addColumn("output","text").addColumn("error","text").addColumn("created_at","bigint",(X)=>X.notNull()).addColumn("updated_at","bigint",(X)=>X.notNull()).addColumn("start_at_epoch_ms","bigint").addColumn("started_at_epoch_ms","bigint").addColumn("completed_at_epoch_ms","bigint").addColumn("timeout_ms","bigint").addColumn("deadline_at_epoch_ms","bigint").addColumn("created_by","text").execute(),await Y.schema.createIndex("idx_wf_execution_status").on("workflow_execution").column("status").execute(),await Y.schema.createIndex("idx_wf_execution_workflow_id").on("workflow_execution").column("workflow_id").execute(),await Y.schema.createIndex("idx_wf_execution_org").on("workflow_execution").column("organization_id").execute(),await Y.schema.createIndex("idx_wf_execution_created_at").on("workflow_execution").column("created_at").execute(),await Y.schema.createTable("workflow_execution_step_result").addColumn("execution_id","text",(X)=>X.notNull().references("workflow_execution.id").onDelete("cascade")).addColumn("step_id","text",(X)=>X.notNull()).addColumn("started_at_epoch_ms","bigint").addColumn("completed_at_epoch_ms","bigint").addColumn("output","text").addColumn("error","text").addColumn("raw_tool_output","text").execute(),await Y.schema.createIndex("idx_wf_step_result_pk").on("workflow_execution_step_result").columns(["execution_id","step_id"]).unique().execute(),await Y.schema.createIndex("idx_wf_step_result_execution").on("workflow_execution_step_result").column("execution_id").execute()},async down(Y){await Y.schema.dropIndex("idx_wf_step_result_execution").ifExists().execute(),await Y.schema.dropIndex("idx_wf_step_result_pk").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_created_at").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_org").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_workflow_id").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_status").ifExists().execute(),await Y.schema.dropIndex("idx_workflow_collection_id").ifExists().execute(),await Y.schema.dropIndex("idx_workflow_created_at").ifExists().execute(),await Y.schema.dropIndex("idx_wf_collection_created_at").ifExists().execute(),await Y.schema.dropIndex("idx_wf_collection_org").ifExists().execute(),await Y.schema.dropTable("workflow_execution_step_result").ifExists().execute(),await Y.schema.dropTable("workflow_execution").ifExists().execute(),await Y.schema.dropTable("workflow").ifExists().execute(),await Y.schema.dropTable("workflow_collection").ifExists().execute()}}});var VK0;var zK0=A(()=>{VK0={name:"002-execution-list-index",async up(Y){await Y.schema.createIndex("idx_wf_execution_org_created_at").on("workflow_execution").columns(["organization_id","created_at desc"]).execute()},async down(Y){await Y.schema.dropIndex("idx_wf_execution_org_created_at").ifExists().execute()}}});var UK0;var qK0=A(()=>{FK0();zK0();UK0=[$K0,VK0]});function $Z(Y){let X=Y;if(!X.organization)throw Error("Organization context required for workflow tools");return X}function UG(Y){if(Y===null||Y===void 0)return null;if(typeof Y==="object")return Y;if(typeof Y!=="string")return Y;try{return JSON.parse(Y)}catch{return Y}}function OK0(Y){dD1=Y}function qG(){if(!dD1)throw Error('Plugin storage not initialized. Make sure the "workflows" plugin is enabled.');return dD1}var dD1=null;function LK0(Y){return{...Y,steps:UG(Y.steps)??[]}}class cD1{db;constructor(Y){this.db=Y}async list(Y,X={}){let{limit:J=50,offset:G=0}=X,W=await this.db.selectFrom("workflow_collection").selectAll().where("organization_id","=",Y).orderBy("created_at","desc").limit(J).offset(G).execute(),K=await this.db.selectFrom("workflow_collection").select((Z)=>Z.fn.countAll().as("count")).where("organization_id","=",Y).executeTakeFirstOrThrow();return{items:W,totalCount:Number(K.count)}}async getById(Y,X){let J=await this.db.selectFrom("workflow_collection").selectAll().where("id","=",Y).where("organization_id","=",X).executeTakeFirst();return J?LK0(J):null}async create(Y){let X=await this.db.insertInto("workflow_collection").values(Y).returningAll().executeTakeFirstOrThrow();return LK0(X)}async update(Y,X,J){return await this.db.updateTable("workflow_collection").set({...J,updated_at:new Date().toISOString()}).where("id","=",Y).where("organization_id","=",X).returningAll().executeTakeFirstOrThrow()}async delete(Y,X){return await this.db.deleteFrom("workflow_collection").where("id","=",Y).where("organization_id","=",X).returningAll().executeTakeFirstOrThrow()}}var NK0=()=>{};function uo6(Y){return{...Y,steps:UG(Y.steps)??[],input:UG(Y.input)??null}}function mw(Y){return{...Y,output:UG(Y.output),error:UG(Y.error),raw_tool_output:UG(Y.raw_tool_output)}}class pD1{db;constructor(Y){this.db=Y}async _createWorkflow(Y,X){let J=crypto.randomUUID(),G=Date.now();return await Y.insertInto("workflow").values({id:J,workflow_collection_id:X.workflowCollectionId??null,organization_id:X.organizationId,steps:JSON.stringify(X.steps),input:X.input?JSON.stringify(X.input):null,virtual_mcp_id:X.virtualMcpId,created_at_epoch_ms:G,created_by:X.createdBy??null}).execute(),{id:J}}async createWorkflow(Y){return this._createWorkflow(this.db,Y)}async getWorkflow(Y){let X=await this.db.selectFrom("workflow").selectAll().where("id","=",Y).executeTakeFirst();return X?uo6(X):null}async createExecution(Y){return this.db.transaction().execute(async(X)=>{let J=Date.now(),{id:G}=await this._createWorkflow(X,{organizationId:Y.organizationId,workflowCollectionId:Y.workflowCollectionId,virtualMcpId:Y.virtualMcpId,input:Y.input,steps:Y.steps,createdBy:Y.createdBy}),W=crypto.randomUUID(),K=Y.startAtEpochMs??J,Z=Y.timeoutMs?K+Y.timeoutMs:null;return await X.insertInto("workflow_execution").values({id:W,workflow_id:G,organization_id:Y.organizationId,status:"enqueued",input:Y.input?JSON.stringify(Y.input):null,created_at:J,updated_at:J,start_at_epoch_ms:K,timeout_ms:Y.timeoutMs??null,deadline_at_epoch_ms:Z,created_by:Y.createdBy??null}).execute(),{id:W}})}async getExecution(Y,X){return await this.db.selectFrom("workflow_execution").selectAll().where("id","=",Y).where("organization_id","=",X).executeTakeFirst()??null}async getExecutionFull(Y,X){let J=await this.db.selectFrom("workflow_execution").selectAll().where("id","=",Y).where("organization_id","=",X).executeTakeFirst();if(!J)return null;let G=await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).execute();return{execution:J,stepResults:G.map(mw)}}async getExecutionContext(Y){let[X,J]=await Promise.all([this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").select(["we.id","we.status","we.workflow_id","we.deadline_at_epoch_ms","w.steps","w.input","w.virtual_mcp_id"]).where("we.id","=",Y).executeTakeFirst(),this.db.selectFrom("workflow_execution_step_result").select(["step_id","completed_at_epoch_ms","output","error"]).where("execution_id","=",Y).execute()]);if(!X)return null;return{execution:{id:X.id,status:X.status,workflow_id:X.workflow_id,deadline_at_epoch_ms:X.deadline_at_epoch_ms},workflow:{steps:UG(X.steps)??[],input:UG(X.input)??null,virtual_mcp_id:X.virtual_mcp_id},stepResults:J.map((G)=>({step_id:G.step_id,completed_at_epoch_ms:G.completed_at_epoch_ms,output:UG(G.output),error:UG(G.error)}))}}async claimExecution(Y){let X=Date.now(),J=await this.db.updateTable("workflow_execution").set({status:"running",updated_at:X}).where("id","=",Y).where("status","=","enqueued").returningAll().executeTakeFirst();if(!J)return null;let G=await this.getWorkflow(J.workflow_id);if(!G)throw Error(`Workflow ${J.workflow_id} not found for execution ${Y}`);return{execution:J,workflow:G}}async updateExecution(Y,X,J){let W={updated_at:Date.now()};if(X.status!==void 0)W.status=X.status;if(X.output!==void 0)W.output=JSON.stringify(X.output);if(X.error!==void 0)W.error=JSON.stringify(X.error);if(X.completed_at_epoch_ms!==void 0)W.completed_at_epoch_ms=X.completed_at_epoch_ms;let K=this.db.updateTable("workflow_execution").set(W).where("id","=",Y);if(J?.onlyIfStatus)K=K.where("status","=",J.onlyIfStatus);return await K.returningAll().executeTakeFirst()??null}async cancelExecution(Y,X){let J=Date.now();return!!await this.db.updateTable("workflow_execution").set({status:"cancelled",updated_at:J}).where("id","=",Y).where("organization_id","=",X).where("status","in",["enqueued","running"]).returningAll().executeTakeFirst()}async resumeExecution(Y,X){return this.db.transaction().execute(async(J)=>{let G=Date.now();if(!await J.updateTable("workflow_execution").set({status:"enqueued",updated_at:G,completed_at_epoch_ms:null,error:null}).where("id","=",Y).where("organization_id","=",X).where((K)=>K.or([K("status","=","cancelled"),K("status","=","error")])).returningAll().executeTakeFirst())return!1;return await J.deleteFrom("workflow_execution_step_result").where("execution_id","=",Y).where((K)=>K.or([K("completed_at_epoch_ms","is",null),K("error","is not",null)])).execute(),!0})}async listExecutions(Y,X={}){let{limit:J=50,offset:G=0,status:W}=X,K=this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").leftJoin("workflow_collection as wc","w.workflow_collection_id","wc.id").select(["we.id","we.workflow_id","we.organization_id","we.status","we.input","we.output","we.error","we.created_at","we.updated_at","we.start_at_epoch_ms","we.started_at_epoch_ms","we.completed_at_epoch_ms","we.timeout_ms","we.deadline_at_epoch_ms","we.created_by","w.virtual_mcp_id"]).select((V)=>V.fn.coalesce("wc.title",V.val("Workflow Execution")).as("title")).where("we.organization_id","=",Y);if(W)K=K.where("we.status","=",W);let Z=await K.orderBy("we.created_at","desc").limit(J).offset(G).execute(),Q=this.db.selectFrom("workflow_execution").select((V)=>V.fn.countAll().as("count")).where("organization_id","=",Y);if(W)Q=Q.where("status","=",W);let H=await Q.executeTakeFirstOrThrow(),$=Number(H.count);return{items:Z,totalCount:$,hasMore:G+Z.length<$}}async createStepResult(Y){let X=await this.db.insertInto("workflow_execution_step_result").values({execution_id:Y.execution_id,step_id:Y.step_id,started_at_epoch_ms:Y.completed_at_epoch_ms?Date.now():null,completed_at_epoch_ms:Y.completed_at_epoch_ms??null,output:Y.output!==void 0?JSON.stringify(Y.output):null,error:Y.error!==void 0?JSON.stringify(Y.error):null}).onConflict((J)=>J.columns(["execution_id","step_id"]).doNothing()).returningAll().executeTakeFirst();return X?mw(X):null}async updateStepResult(Y,X,J){let G={};if(J.output!==void 0)G.output=JSON.stringify(J.output);if(J.error!==void 0)G.error=JSON.stringify(J.error);if(J.started_at_epoch_ms!==void 0)G.started_at_epoch_ms=J.started_at_epoch_ms;if(J.completed_at_epoch_ms!==void 0)G.completed_at_epoch_ms=J.completed_at_epoch_ms;if(Object.keys(G).length===0)return null;let W=await this.db.updateTable("workflow_execution_step_result").set(G).where("execution_id","=",Y).where("step_id","=",X).returningAll().executeTakeFirst();return W?mw(W):null}async checkpointAndTransform(Y,X,J,G){await this.db.updateTable("workflow_execution_step_result").set({raw_tool_output:JSON.stringify(J)}).where("execution_id","=",Y).where("step_id","=",X).execute();let W,K;try{let H=await G(J);W=H.output,K=H.error}catch(H){K=H instanceof Error?`Transform failed: ${H.message}`:`Transform failed: ${String(H)}`}let Z={completed_at_epoch_ms:Date.now()};if(W!==void 0)Z.output=JSON.stringify(W);if(K!==void 0)Z.error=JSON.stringify(K);let Q=await this.db.updateTable("workflow_execution_step_result").set(Z).where("execution_id","=",Y).where("step_id","=",X).returningAll().executeTakeFirst();return Q?mw(Q):null}async getStepResult(Y,X){let J=await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).where("step_id","=",X).executeTakeFirst();return J?mw(J):null}async getStepResults(Y){return(await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).execute()).map(mw)}async deleteStepResult(Y,X){await this.db.deleteFrom("workflow_execution_step_result").where("execution_id","=",Y).where("step_id","=",X).execute()}async getStepResultsByPrefix(Y,X){return(await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).where("step_id","like",`${X}%`).orderBy("step_id").execute()).map(mw)}async recoverStuckExecutions(){return this.db.updateTable("workflow_execution").set({status:"enqueued",updated_at:Date.now()}).where("status","=","running").returning(["id","organization_id"]).execute()}}var BK0=()=>{};function DK0(Y){let X=Y.db;return{collections:new cD1(X),executions:new pD1(X)}}var wK0=A(()=>{NK0();BK0()});var MK0,AK0,EK0,PK0,TK0;var RK0=A(()=>{t1();QR();p9();MK0={name:"COLLECTION_WORKFLOW_LIST",description:"List workflows with pagination. Does not include steps -- use GET for full details.",inputSchema:F.object({limit:F.number().optional().default(50),offset:F.number().optional().default(0)}),outputSchema:F.object({items:F.array(F.object({id:F.string(),title:F.string(),description:F.string().nullable(),virtual_mcp_id:F.string(),created_at:F.string(),updated_at:F.string()})),totalCount:F.number(),hasMore:F.boolean()}),handler:async(Y,X)=>{let J=$Z(X);await J.access.check();let G=Y,W=qG(),{items:K,totalCount:Z}=await W.collections.list(J.organization.id,{limit:G.limit,offset:G.offset});return{items:K.map((Q)=>({id:Q.id,title:Q.title,description:Q.description,virtual_mcp_id:Q.virtual_mcp_id,created_at:Q.created_at,updated_at:Q.updated_at})),totalCount:Z,hasMore:(G.offset??0)+K.length<Z}}},AK0={name:"COLLECTION_WORKFLOW_GET",description:"Get a single workflow by ID, including its steps.",inputSchema:F.object({id:F.string()}),outputSchema:F.object({item:F.object({id:F.string(),title:F.string(),description:F.string().nullable(),virtual_mcp_id:F.string(),steps:F.array(Pw),created_at:F.string(),updated_at:F.string()}).nullable()}),handler:async(Y,X)=>{let J=$Z(X);await J.access.check();let{id:G}=Y,K=await qG().collections.getById(G,J.organization.id);if(!K)return{item:null};return{item:{id:K.id,title:K.title,description:K.description,virtual_mcp_id:K.virtual_mcp_id,steps:K.steps,created_at:K.created_at,updated_at:K.updated_at}}}},EK0={name:"COLLECTION_WORKFLOW_CREATE",description:`Create a workflow template. This is a reusable definition, not an execution.
|
|
379
|
+
`);return{toolResults:H,agentSummary:q.length>0?q:null,unexecutedTools:V}}finally{await X.close?.().catch(()=>{})}}async function lD1(Y,X){let J=a6(),G=Y.organization.id,W=await J.monitorConnections.findByItemId(G,X.id);if(W){if(await Y.storage.connections.findById(W.connection_id,G))return W.connection_id}let K=Ao6(X);if(!K)throw Error(`Registry item ${X.id} has no remote URL`);let Z=wo6(Y),Q=Mo6(X),H=await Y.storage.connections.create({organization_id:G,created_by:Z,title:`[MCP Tester] ${X.title}`,description:`Auto-created monitor connection for ${X.id}`,app_name:"private-registry-monitor",app_id:`${i$}:monitor`,connection_type:Q,connection_url:K,metadata:{monitorConnection:!0,registryItemId:X.id,pluginId:i$}});return await J.monitorConnections.upsert({organization_id:G,item_id:X.id,connection_id:H.id,auth_status:"none"}),H.id}async function ko6(Y){let X=a6();switch(Y.action){case"unlisted":return await X.items.update(Y.organizationId,Y.item.id,{is_unlisted:!0}),"unlisted";case"remove_public":return await X.items.update(Y.organizationId,Y.item.id,{is_public:!1}),"removed_public";case"remove_private":case"remove_all":return await X.items.delete(Y.organizationId,Y.item.id),Y.action==="remove_all"?"removed_all":"removed_private";default:return"none"}}async function vo6(Y){let X=Date.now();if(Y.signal.aborted)throw Error("Run cancelled");let J="passed",G=!1,W=!1,K=null,Z="none",Q=null,H=[],$=null,V=async()=>{await Y.onProgress?.({status:J,connectionOk:G,toolsListed:W,toolResults:[...H],agentSummary:Q,errorMessage:K,actionTaken:Z,durationMs:Date.now()-X})};try{let z=await lD1(Y.ctx,Y.item);$=await Y.ctx.createMCPProxy(z),G=!0;let q=(await oh($.listTools?$.listTools():Promise.resolve({tools:[]}),Y.monitorConfig.perMcpTimeoutMs,`listTools ${Y.item.id}`)).tools??[];if(W=!0,Y.monitorConfig.monitorMode!=="health_check")H.push(...q.map((O)=>mD1(O.name))),await V();if(Y.monitorConfig.monitorMode==="full_agent"){let O=await _o6({ctx:Y.ctx,monitorConfig:Y.monitorConfig,item:Y.item,proxy:$,tools:q,signal:Y.signal,onProgress:async(L)=>{H.length=0,H.push(...EQ0({discoveredTools:q,executedResults:L})),J=L.some((M)=>!M.success)?"failed":"passed",await V()}});if(H.length=0,H.push(...EQ0({discoveredTools:q,executedResults:O.toolResults})),Q=O.agentSummary,O.toolResults.some((L)=>!L.success))J="failed";if(O.unexecutedTools.length>0){if(J="failed",!K)K=`Agent skipped ${O.unexecutedTools.length} tool(s): ${O.unexecutedTools.join(", ")}`}}else if(Y.monitorConfig.monitorMode!=="health_check"){for(let O=0;O<q.length;O++){let L=q[O];if(!L||Y.signal.aborted)throw Error("Run cancelled");let M=Date.now();try{let E={},R=await oh($.callTool({name:L.name,arguments:E}),Y.monitorConfig.perToolTimeoutMs,`tool ${L.name}`),C=!R.isError,T=Date.now()-M;PQ0(H,{toolName:L.name,success:C,input:E,durationMs:T,outputPreview:SQ0(R.structuredContent??R.content),error:C?null:ve(R.content?.find((P)=>P.type==="text")?.text?.slice(0,300)??"Tool returned error")}),await V()}catch(E){let R=Date.now()-M,C=E instanceof Error?E.message:String(E);PQ0(H,{toolName:L.name,success:!1,durationMs:R,error:ve(C)}),await V()}}if(H.some((O)=>!O.success))J="failed"}else for(let O of q)H.push(mD1(O.name));if(Y.canApplyFailureAction&&J==="failed"&&Y.monitorConfig.onFailure!=="none")Z=await ko6({organizationId:Y.organizationId,item:Y.item,action:Y.monitorConfig.onFailure})}catch(z){if(K=z instanceof Error?z.message:String(z),Eo6(z))J="needs_auth",await a6().monitorConnections.updateAuthStatus(Y.organizationId,Y.item.id,"needs_auth");else J="error"}finally{await $?.close?.().catch(()=>{})}return{status:J,connectionOk:G,toolsListed:W,toolResults:H,agentSummary:Q,errorMessage:K,actionTaken:Z,durationMs:Date.now()-X}}async function fo6(Y){let X=Date.now(),J=a6(),W=(await J.items.list(Y.organizationId,{includeUnlisted:!0})).items.filter((U)=>{if(Y.monitorConfig.testPublicOnly&&!U.is_public)return!1;if(Y.monitorConfig.testPrivateOnly&&U.is_public)return!1;return!0}),K=Y.monitorConfig.includePendingRequests?(await J.publishRequests.list(Y.organizationId,{status:"pending",limit:500})).items.map((U)=>yo6(U)):[],Z=[...W.map((U)=>({item:U,source:"registry_item"})),...K.map((U)=>({item:U,source:"publish_request"}))];if(Z.length===0){await J.monitorRuns.update(Y.organizationId,Y.runId,{total_items:0,status:"completed",started_at:new Date().toISOString(),finished_at:new Date().toISOString()}),await _e({ctx:Y.ctx,type:"registry.monitor.completed",subject:Y.runId,data:{runId:Y.runId,total:0}});return}await J.monitorRuns.update(Y.organizationId,Y.runId,{total_items:Z.length,status:"running",started_at:new Date().toISOString()});let Q=0,H=0,$=0,V=0;for(let U=0;U<Z.length;U++){let q=Z[U],O=q?.item;if(!O||Y.signal.aborted){await J.monitorRuns.update(Y.organizationId,Y.runId,{status:"cancelled",current_item_id:null,finished_at:new Date().toISOString()});return}await J.monitorRuns.update(Y.organizationId,Y.runId,{current_item_id:O.id});let L=null,M=async(R)=>{if(!L){L=(await J.monitorResults.create({run_id:Y.runId,organization_id:Y.organizationId,item_id:O.id,item_title:O.title,status:R.status,error_message:R.errorMessage,connection_ok:R.connectionOk,tools_listed:R.toolsListed,tool_results:R.toolResults,agent_summary:R.agentSummary,duration_ms:R.durationMs,action_taken:R.actionTaken})).id;return}await J.monitorResults.update(Y.organizationId,L,{status:R.status,error_message:R.errorMessage,connection_ok:R.connectionOk,tools_listed:R.toolsListed,tool_results:R.toolResults,agent_summary:R.agentSummary,duration_ms:R.durationMs,action_taken:R.actionTaken})},E=await vo6({ctx:Y.ctx,organizationId:Y.organizationId,item:O,monitorConfig:Y.monitorConfig,signal:Y.signal,canApplyFailureAction:q.source==="registry_item",onProgress:M});if(await M({status:E.status,connectionOk:E.connectionOk,toolsListed:E.toolsListed,toolResults:E.toolResults,agentSummary:E.agentSummary,errorMessage:E.errorMessage,actionTaken:E.actionTaken,durationMs:E.durationMs}),Q+=1,E.status==="passed")H+=1;else if(E.status==="failed"||E.status==="error")$+=1;else V+=1;if(await J.monitorRuns.update(Y.organizationId,Y.runId,{tested_items:Q,passed_items:H,failed_items:$,skipped_items:V}),E.status==="failed"||E.status==="error")await _e({ctx:Y.ctx,type:"registry.monitor.item_failed",subject:O.id,data:{runId:Y.runId,itemId:O.id,itemTitle:O.title,status:E.status,errorMessage:E.errorMessage,actionTaken:E.actionTaken}})}let z=Date.now()-X;await J.monitorRuns.update(Y.organizationId,Y.runId,{status:"completed",current_item_id:null,finished_at:new Date().toISOString()}),await _e({ctx:Y.ctx,type:"registry.monitor.completed",subject:Y.runId,data:{runId:Y.runId,total:Q,passed:H,failed:$,skipped:V,durationMs:z}})}function yo6(Y){return{id:`${yO}${Y.id}`,title:Y.title,description:Y.description,_meta:Y._meta,server:Y.server,is_public:!1,is_unlisted:!0,created_at:Y.created_at,updated_at:Y.updated_at}}async function ho6(Y,X){let J=jQ0(Y);await J.access.check();let G=a6(),W=await G.monitorRuns.create({organization_id:J.organization.id,status:"pending",config_snapshot:X,started_at:null}),K=new AbortController;return ke.set(W.id,K),fo6({ctx:J,runId:W.id,organizationId:J.organization.id,monitorConfig:X,signal:K.signal}).catch(async(Z)=>{await G.monitorRuns.update(J.organization.id,W.id,{status:"failed",current_item_id:null,finished_at:new Date().toISOString()}).catch(()=>{}),await _e({ctx:J,type:"registry.monitor.failed",subject:W.id,data:{runId:W.id,error:Z instanceof Error?Z.message:String(Z)}}),Do6(`Run ${W.id} failed with uncaught error:`,Z)}).finally(()=>{ke.delete(W.id)}),{run:{id:W.id}}}var ke,CQ0="[MONITOR-AGENT]",Lo6,No6="health_check: not called",vQ0;var fe=A(()=>{p9();$7();aD();TK();x9();ke=new Map,Lo6=q10;vQ0={name:"REGISTRY_MONITOR_RUN_START",description:"Start an MCP registry monitor run with an isolated set of monitor connections.",inputSchema:zQ0,outputSchema:UQ0,handler:async(Y,X)=>{let G=je(Y.config??{}),{run:W}=await ho6(X,G),Z=await a6().monitorRuns.findById(jQ0(X).organization.id,W.id);if(!Z)throw Error(`Failed to load monitor run ${W.id}`);return{run:Z}}}});var fQ0;var yQ0=A(()=>{TK();x9();fQ0={name:"REGISTRY_MONITOR_RUN_LIST",description:"List MCP registry monitor runs",inputSchema:vD1,outputSchema:OQ0,handler:z4(vD1,async(Y,X)=>{return a6().monitorRuns.list(X.organization.id,Y)})}});var hQ0;var bQ0=A(()=>{TK();x9();hQ0={name:"REGISTRY_MONITOR_RUN_GET",description:"Get details for one MCP registry monitor run",inputSchema:fD1,outputSchema:LQ0,handler:z4(fD1,async(Y,X)=>{return{run:await a6().monitorRuns.findById(X.organization.id,Y.runId)}})}});var xQ0;var gQ0=A(()=>{TK();fe();x9();xQ0={name:"REGISTRY_MONITOR_RUN_CANCEL",description:"Cancel a running MCP registry monitor run",inputSchema:kD1,outputSchema:qQ0,handler:z4(kD1,async(Y,X)=>{return IQ0(Y.runId),{run:await a6().monitorRuns.update(X.organization.id,Y.runId,{status:"cancelled",current_item_id:null,finished_at:new Date().toISOString()})}})}});var uQ0;var mQ0=A(()=>{TK();x9();uQ0={name:"REGISTRY_MONITOR_RESULT_LIST",description:"List results for a given MCP registry monitor run",inputSchema:yD1,outputSchema:NQ0,handler:z4(yD1,async(Y,X)=>{return a6().monitorResults.listByRun(X.organization.id,Y.runId,{status:Y.status,limit:Y.limit,offset:Y.offset})})}});var lQ0;var dQ0=A(()=>{TK();x9();aD();lQ0={name:"REGISTRY_MONITOR_CONNECTION_LIST",description:"List monitor connection mappings for private registry MCP monitor runs, including auth status",inputSchema:hD1,outputSchema:BQ0,handler:z4(hD1,async(Y,X)=>{let J=a6(),G=await J.monitorConnections.list(X.organization.id);return{items:await Promise.all(G.map(async(K)=>{let Z=await J.items.findById(X.organization.id,K.item_id);if(!Z&&K.item_id.startsWith(yO)){let $=K.item_id.slice(yO.length),V=await J.publishRequests.findById(X.organization.id,$);if(V)Z={id:K.item_id,title:V.title,description:V.description,_meta:V._meta,server:V.server,is_public:!1,is_unlisted:!0,created_at:V.created_at,updated_at:V.updated_at}}let Q=Z?.server.remotes?.find(($)=>$.url)?.url??null,H=K.item_id.startsWith(yO)?"request":"store";return{mapping:K,item:Z,remoteUrl:Q,source:H}}))}})}});function bo6(Y){return{id:`${yO}${Y.id}`,title:Y.title,description:Y.description,_meta:Y._meta,server:Y.server,is_public:!1,is_unlisted:!0,created_at:Y.created_at,updated_at:Y.updated_at}}var cQ0;var pQ0=A(()=>{TK();fe();x9();aD();cQ0={name:"REGISTRY_MONITOR_CONNECTION_SYNC",description:"Ensure every registry item has a dedicated monitor connection mapping for MCP monitors",inputSchema:bD1,outputSchema:DQ0,handler:z4(bD1,async(Y,X)=>{let J=a6(),G=(await J.items.list(X.organization.id,{includeUnlisted:!0})).items,K=(await J.publishRequests.list(X.organization.id,{status:"pending",limit:500})).items.map(bo6),Z=[...G,...K],Q=await J.monitorConnections.list(X.organization.id),H=new Set(Q.map((V)=>V.item_id)),$=0;for(let V of Z){if(!V.server.remotes?.some((z)=>z.url))continue;if(await lD1(X,V),!H.has(V.id))$+=1}return{created:$,updated:Math.max(Z.length-$,0)}})}});var nQ0;var iQ0=A(()=>{TK();x9();nQ0={name:"REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH",description:"Update the auth_status of a monitor connection mapping (by core connection ID)",inputSchema:xD1,outputSchema:wQ0,handler:z4(xD1,async({connectionId:Y,authStatus:X},J)=>{let G=a6(),W=J.organization.id,K=await G.monitorConnections.findByConnectionId(W,Y);if(!K)throw Error(`No monitor connection mapping found for connection ${Y}`);return await G.monitorConnections.updateAuthStatus(W,K.item_id,X),{success:!0}})}});function sh(Y){if(!Y||typeof Y!=="object")return null;let X=Y,J=X.id;if(typeof J==="string"&&J.length>0)return J;for(let G of["event","result","structuredContent","content"]){let W=X[G],K=sh(W);if(K)return K}if(Array.isArray(Y))for(let G of Y){let W=sh(G);if(W)return W}return null}var aQ0;var rQ0=A(()=>{p9();TK();x9();aQ0={name:"REGISTRY_MONITOR_SCHEDULE_SET",description:"Schedule recurring MCP monitor runs via EVENT_PUBLISH cron",inputSchema:gD1,outputSchema:MQ0,handler:z4(gD1,async(Y,X)=>{let J=sY.SELF(X.organization.id),G=await X.createMCPProxy(J);try{let W=await G.callTool({name:"EVENT_PUBLISH",arguments:{type:"registry.monitor.scheduled",subject:"private-registry",cron:Y.cronExpression,data:{config:Y.config??{}}}});if(W.isError)throw Error("Failed to create monitor schedule via EVENT_PUBLISH");let K=sh(W.structuredContent)??sh(W.content)??sh(W);if(!K)throw Error("Could not resolve schedule event id from EVENT_PUBLISH");return{scheduleEventId:K}}finally{await G.close?.().catch(()=>{})}})}});var oQ0;var sQ0=A(()=>{p9();TK();x9();oQ0={name:"REGISTRY_MONITOR_SCHEDULE_CANCEL",description:"Cancel a recurring MCP monitor schedule via EVENT_CANCEL",inputSchema:uD1,outputSchema:AQ0,handler:z4(uD1,async(Y,X)=>{let J=sY.SELF(X.organization.id),G=await X.createMCPProxy(J);try{if((await G.callTool({name:"EVENT_CANCEL",arguments:{eventId:Y.scheduleEventId}})).isError)throw Error("Failed to cancel monitor schedule via EVENT_CANCEL");return{success:!0}}finally{await G.close?.().catch(()=>{})}})}});function xo6(Y,X){if(!X)return Y;let J={field:["is_public"],operator:"eq",value:!1};if(!Y)return J;return{operator:"and",conditions:[Y,J]}}function go6(Y){let X=new Map,J=new Map;for(let W of Y){let K=W._meta?.["mcp.mesh"];for(let Z of K?.tags??[])X.set(Z,(X.get(Z)??0)+1);for(let Z of K?.categories??[])J.set(Z,(J.get(Z)??0)+1)}let G=(W)=>Array.from(W.entries()).map(([K,Z])=>({value:K,count:Z})).sort((K,Z)=>K.value.localeCompare(Z.value));return{tags:G(X),categories:G(J)}}var tQ0,eQ0,YK0,XK0;var JK0=A(()=>{t1();r5();x9();tQ0={name:"COLLECTION_REGISTRY_APP_LIST",description:"List registry items for Store discovery. Supports private-only mode from plugin settings.",inputSchema:$L,outputSchema:FR,handler:z4($L,async(Y,X)=>{let J=a6(),G=await Ih(X,X.organization.id);return J.items.list(X.organization.id,{...Y,where:xo6(Y.where,G.storePrivateOnly===!0)})})},eQ0={name:"COLLECTION_REGISTRY_APP_GET",description:"Get a registry item for Store details. Respects private-only mode from plugin settings.",inputSchema:WZ,outputSchema:Iw,handler:z4(WZ,async(Y,X)=>{let J=a6(),G=await Ih(X,X.organization.id),W=Y.id??Y.name;if(!W)return{item:null};let K=await J.items.findByIdOrName(X.organization.id,W);if(!K)return{item:null};if(G.storePrivateOnly&&K.is_public)return{item:null};return{item:K}})},YK0={name:"COLLECTION_REGISTRY_APP_VERSIONS",description:"Get registry item versions for Store details. Respects private-only mode from plugin settings.",inputSchema:WZ,outputSchema:F.object({versions:F.array(O3)}),handler:z4(WZ,async(Y,X)=>{let J=a6(),G=await Ih(X,X.organization.id),W=Y.id??Y.name;if(!W)return{versions:[]};let K=await J.items.findByIdOrName(X.organization.id,W);if(!K)return{versions:[]};if(G.storePrivateOnly&&K.is_public)return{versions:[]};return{versions:[K]}})},XK0={name:"COLLECTION_REGISTRY_APP_FILTERS",description:"List Store filter facets for registry items. Respects private-only mode from plugin settings.",inputSchema:F.object({}),outputSchema:VR,handler:z4(F.object({}),async(Y,X)=>{let J=a6();if(!(await Ih(X,X.organization.id)).storePrivateOnly)return J.items.getFilters(X.organization.id);let W=await J.items.list(X.organization.id,{limit:1e4,where:{field:["is_public"],operator:"eq",value:!1}});return go6(W.items)})}});var GK0;var WK0=A(()=>{t90();YY0();JY0();WY0();KY0();$Y0();VY0();UY0();OY0();NY0();DY0();MY0();EY0();TY0();CY0();jY0();_Y0();vY0();fe();yQ0();bQ0();gQ0();mQ0();dQ0();pQ0();iQ0();rQ0();sQ0();JK0();GK0=[tQ0,eQ0,YK0,XK0,zY0,qY0,FY0,BY0,XY0,s90,LY0,GY0,HY0,QY0,e90,wY0,AY0,PY0,RY0,IY0,SY0,kY0,vQ0,fQ0,hQ0,xQ0,uQ0,lQ0,cQ0,nQ0,aQ0,oQ0]});var ZK0;var QK0=A(()=>{aD();n60();d90();o90();WK0();TK();ZK0={id:i$,description:U10,tools:GK0,migrations:p60,publicRoutes:(Y,X)=>{aN1(Y,X),pN1(Y,X)},createStorage:r90,onEvents:{types:["registry.monitor.scheduled"],handler:async(Y,X)=>{let J=await X.createMCPProxy(X.connectionId);try{for(let G of Y){if(G.type!=="registry.monitor.scheduled")continue;let W=G.data&&typeof G.data==="object"?G.data:{},K=W.config&&typeof W.config==="object"?W.config:{},Z=je(K);await J.callTool({name:"REGISTRY_MONITOR_RUN_START",arguments:{config:Z}})}}finally{await J.close()}}}}});var KK0="MCP Workflows",HK0="Create workflows using your MCP tools";var $K0;var FK0=A(()=>{Lw();$K0={name:"001-workflows",async up(Y){await Y.schema.createTable("workflow_collection").ifNotExists().addColumn("id","text",(X)=>X.primaryKey()).addColumn("organization_id","text",(X)=>X.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(X)=>X.notNull()).addColumn("description","text").addColumn("virtual_mcp_id","text",(X)=>X.notNull()).addColumn("steps","text",(X)=>X.notNull().defaultTo("[]")).addColumn("created_at","text",(X)=>X.notNull().defaultTo(W8`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(X)=>X.notNull().defaultTo(W8`CURRENT_TIMESTAMP`)).addColumn("created_by","text").addColumn("updated_by","text").execute(),await Y.schema.createIndex("idx_wf_collection_org").ifNotExists().on("workflow_collection").column("organization_id").execute(),await Y.schema.createIndex("idx_wf_collection_created_at").ifNotExists().on("workflow_collection").column("created_at").execute(),await Y.schema.createTable("workflow").ifNotExists().addColumn("id","text",(X)=>X.primaryKey()).addColumn("workflow_collection_id","text").addColumn("organization_id","text",(X)=>X.notNull().references("organization.id").onDelete("cascade")).addColumn("steps","text",(X)=>X.notNull().defaultTo("[]")).addColumn("input","text").addColumn("virtual_mcp_id","text",(X)=>X.notNull()).addColumn("created_at_epoch_ms","bigint",(X)=>X.notNull()).addColumn("created_by","text").execute(),await Y.schema.createIndex("idx_workflow_created_at").ifNotExists().on("workflow").column("created_at_epoch_ms").execute(),await Y.schema.createIndex("idx_workflow_collection_id").ifNotExists().on("workflow").column("workflow_collection_id").execute(),await Y.schema.createTable("workflow_execution").ifNotExists().addColumn("id","text",(X)=>X.primaryKey()).addColumn("workflow_id","text",(X)=>X.notNull().references("workflow.id").onDelete("cascade")).addColumn("organization_id","text",(X)=>X.notNull().references("organization.id").onDelete("cascade")).addColumn("status","text",(X)=>X.notNull().defaultTo("enqueued")).addColumn("input","text").addColumn("output","text").addColumn("error","text").addColumn("created_at","bigint",(X)=>X.notNull()).addColumn("updated_at","bigint",(X)=>X.notNull()).addColumn("start_at_epoch_ms","bigint").addColumn("started_at_epoch_ms","bigint").addColumn("completed_at_epoch_ms","bigint").addColumn("timeout_ms","bigint").addColumn("deadline_at_epoch_ms","bigint").addColumn("created_by","text").execute(),await Y.schema.createIndex("idx_wf_execution_status").ifNotExists().on("workflow_execution").column("status").execute(),await Y.schema.createIndex("idx_wf_execution_workflow_id").ifNotExists().on("workflow_execution").column("workflow_id").execute(),await Y.schema.createIndex("idx_wf_execution_org").ifNotExists().on("workflow_execution").column("organization_id").execute(),await Y.schema.createIndex("idx_wf_execution_created_at").ifNotExists().on("workflow_execution").column("created_at").execute(),await Y.schema.createTable("workflow_execution_step_result").ifNotExists().addColumn("execution_id","text",(X)=>X.notNull().references("workflow_execution.id").onDelete("cascade")).addColumn("step_id","text",(X)=>X.notNull()).addColumn("started_at_epoch_ms","bigint").addColumn("completed_at_epoch_ms","bigint").addColumn("output","text").addColumn("error","text").addColumn("raw_tool_output","text").execute(),await Y.schema.createIndex("idx_wf_step_result_pk").ifNotExists().on("workflow_execution_step_result").columns(["execution_id","step_id"]).unique().execute(),await Y.schema.createIndex("idx_wf_step_result_execution").ifNotExists().on("workflow_execution_step_result").column("execution_id").execute()},async down(Y){await Y.schema.dropIndex("idx_wf_step_result_execution").ifExists().execute(),await Y.schema.dropIndex("idx_wf_step_result_pk").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_created_at").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_org").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_workflow_id").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_status").ifExists().execute(),await Y.schema.dropIndex("idx_workflow_collection_id").ifExists().execute(),await Y.schema.dropIndex("idx_workflow_created_at").ifExists().execute(),await Y.schema.dropIndex("idx_wf_collection_created_at").ifExists().execute(),await Y.schema.dropIndex("idx_wf_collection_org").ifExists().execute(),await Y.schema.dropTable("workflow_execution_step_result").ifExists().execute(),await Y.schema.dropTable("workflow_execution").ifExists().execute(),await Y.schema.dropTable("workflow").ifExists().execute(),await Y.schema.dropTable("workflow_collection").ifExists().execute()}}});var VK0;var zK0=A(()=>{VK0={name:"002-execution-list-index",async up(Y){await Y.schema.createIndex("idx_wf_execution_org_created_at").ifNotExists().on("workflow_execution").columns(["organization_id","created_at desc"]).execute()},async down(Y){await Y.schema.dropIndex("idx_wf_execution_org_created_at").ifExists().execute()}}});var UK0;var qK0=A(()=>{FK0();zK0();UK0=[$K0,VK0]});function $Z(Y){let X=Y;if(!X.organization)throw Error("Organization context required for workflow tools");return X}function UG(Y){if(Y===null||Y===void 0)return null;if(typeof Y==="object")return Y;if(typeof Y!=="string")return Y;try{return JSON.parse(Y)}catch{return Y}}function OK0(Y){dD1=Y}function qG(){if(!dD1)throw Error('Plugin storage not initialized. Make sure the "workflows" plugin is enabled.');return dD1}var dD1=null;function LK0(Y){return{...Y,steps:UG(Y.steps)??[]}}class cD1{db;constructor(Y){this.db=Y}async list(Y,X={}){let{limit:J=50,offset:G=0}=X,W=await this.db.selectFrom("workflow_collection").selectAll().where("organization_id","=",Y).orderBy("created_at","desc").limit(J).offset(G).execute(),K=await this.db.selectFrom("workflow_collection").select((Z)=>Z.fn.countAll().as("count")).where("organization_id","=",Y).executeTakeFirstOrThrow();return{items:W,totalCount:Number(K.count)}}async getById(Y,X){let J=await this.db.selectFrom("workflow_collection").selectAll().where("id","=",Y).where("organization_id","=",X).executeTakeFirst();return J?LK0(J):null}async create(Y){let X=await this.db.insertInto("workflow_collection").values(Y).returningAll().executeTakeFirstOrThrow();return LK0(X)}async update(Y,X,J){return await this.db.updateTable("workflow_collection").set({...J,updated_at:new Date().toISOString()}).where("id","=",Y).where("organization_id","=",X).returningAll().executeTakeFirstOrThrow()}async delete(Y,X){return await this.db.deleteFrom("workflow_collection").where("id","=",Y).where("organization_id","=",X).returningAll().executeTakeFirstOrThrow()}}var NK0=()=>{};function uo6(Y){return{...Y,steps:UG(Y.steps)??[],input:UG(Y.input)??null}}function mw(Y){return{...Y,output:UG(Y.output),error:UG(Y.error),raw_tool_output:UG(Y.raw_tool_output)}}class pD1{db;constructor(Y){this.db=Y}async _createWorkflow(Y,X){let J=crypto.randomUUID(),G=Date.now();return await Y.insertInto("workflow").values({id:J,workflow_collection_id:X.workflowCollectionId??null,organization_id:X.organizationId,steps:JSON.stringify(X.steps),input:X.input?JSON.stringify(X.input):null,virtual_mcp_id:X.virtualMcpId,created_at_epoch_ms:G,created_by:X.createdBy??null}).execute(),{id:J}}async createWorkflow(Y){return this._createWorkflow(this.db,Y)}async getWorkflow(Y){let X=await this.db.selectFrom("workflow").selectAll().where("id","=",Y).executeTakeFirst();return X?uo6(X):null}async createExecution(Y){return this.db.transaction().execute(async(X)=>{let J=Date.now(),{id:G}=await this._createWorkflow(X,{organizationId:Y.organizationId,workflowCollectionId:Y.workflowCollectionId,virtualMcpId:Y.virtualMcpId,input:Y.input,steps:Y.steps,createdBy:Y.createdBy}),W=crypto.randomUUID(),K=Y.startAtEpochMs??J,Z=Y.timeoutMs?K+Y.timeoutMs:null;return await X.insertInto("workflow_execution").values({id:W,workflow_id:G,organization_id:Y.organizationId,status:"enqueued",input:Y.input?JSON.stringify(Y.input):null,created_at:J,updated_at:J,start_at_epoch_ms:K,timeout_ms:Y.timeoutMs??null,deadline_at_epoch_ms:Z,created_by:Y.createdBy??null}).execute(),{id:W}})}async getExecution(Y,X){return await this.db.selectFrom("workflow_execution").selectAll().where("id","=",Y).where("organization_id","=",X).executeTakeFirst()??null}async getExecutionFull(Y,X){let J=await this.db.selectFrom("workflow_execution").selectAll().where("id","=",Y).where("organization_id","=",X).executeTakeFirst();if(!J)return null;let G=await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).execute();return{execution:J,stepResults:G.map(mw)}}async getExecutionContext(Y){let[X,J]=await Promise.all([this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").select(["we.id","we.status","we.workflow_id","we.deadline_at_epoch_ms","w.steps","w.input","w.virtual_mcp_id"]).where("we.id","=",Y).executeTakeFirst(),this.db.selectFrom("workflow_execution_step_result").select(["step_id","completed_at_epoch_ms","output","error"]).where("execution_id","=",Y).execute()]);if(!X)return null;return{execution:{id:X.id,status:X.status,workflow_id:X.workflow_id,deadline_at_epoch_ms:X.deadline_at_epoch_ms},workflow:{steps:UG(X.steps)??[],input:UG(X.input)??null,virtual_mcp_id:X.virtual_mcp_id},stepResults:J.map((G)=>({step_id:G.step_id,completed_at_epoch_ms:G.completed_at_epoch_ms,output:UG(G.output),error:UG(G.error)}))}}async claimExecution(Y){let X=Date.now(),J=await this.db.updateTable("workflow_execution").set({status:"running",updated_at:X}).where("id","=",Y).where("status","=","enqueued").returningAll().executeTakeFirst();if(!J)return null;let G=await this.getWorkflow(J.workflow_id);if(!G)throw Error(`Workflow ${J.workflow_id} not found for execution ${Y}`);return{execution:J,workflow:G}}async updateExecution(Y,X,J){let W={updated_at:Date.now()};if(X.status!==void 0)W.status=X.status;if(X.output!==void 0)W.output=JSON.stringify(X.output);if(X.error!==void 0)W.error=JSON.stringify(X.error);if(X.completed_at_epoch_ms!==void 0)W.completed_at_epoch_ms=X.completed_at_epoch_ms;let K=this.db.updateTable("workflow_execution").set(W).where("id","=",Y);if(J?.onlyIfStatus)K=K.where("status","=",J.onlyIfStatus);return await K.returningAll().executeTakeFirst()??null}async cancelExecution(Y,X){let J=Date.now();return!!await this.db.updateTable("workflow_execution").set({status:"cancelled",updated_at:J}).where("id","=",Y).where("organization_id","=",X).where("status","in",["enqueued","running"]).returningAll().executeTakeFirst()}async resumeExecution(Y,X){return this.db.transaction().execute(async(J)=>{let G=Date.now();if(!await J.updateTable("workflow_execution").set({status:"enqueued",updated_at:G,completed_at_epoch_ms:null,error:null}).where("id","=",Y).where("organization_id","=",X).where((K)=>K.or([K("status","=","cancelled"),K("status","=","error")])).returningAll().executeTakeFirst())return!1;return await J.deleteFrom("workflow_execution_step_result").where("execution_id","=",Y).where((K)=>K.or([K("completed_at_epoch_ms","is",null),K("error","is not",null)])).execute(),!0})}async listExecutions(Y,X={}){let{limit:J=50,offset:G=0,status:W}=X,K=this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").leftJoin("workflow_collection as wc","w.workflow_collection_id","wc.id").select(["we.id","we.workflow_id","we.organization_id","we.status","we.input","we.output","we.error","we.created_at","we.updated_at","we.start_at_epoch_ms","we.started_at_epoch_ms","we.completed_at_epoch_ms","we.timeout_ms","we.deadline_at_epoch_ms","we.created_by","w.virtual_mcp_id"]).select((V)=>V.fn.coalesce("wc.title",V.val("Workflow Execution")).as("title")).where("we.organization_id","=",Y);if(W)K=K.where("we.status","=",W);let Z=await K.orderBy("we.created_at","desc").limit(J).offset(G).execute(),Q=this.db.selectFrom("workflow_execution").select((V)=>V.fn.countAll().as("count")).where("organization_id","=",Y);if(W)Q=Q.where("status","=",W);let H=await Q.executeTakeFirstOrThrow(),$=Number(H.count);return{items:Z,totalCount:$,hasMore:G+Z.length<$}}async createStepResult(Y){let X=await this.db.insertInto("workflow_execution_step_result").values({execution_id:Y.execution_id,step_id:Y.step_id,started_at_epoch_ms:Y.completed_at_epoch_ms?Date.now():null,completed_at_epoch_ms:Y.completed_at_epoch_ms??null,output:Y.output!==void 0?JSON.stringify(Y.output):null,error:Y.error!==void 0?JSON.stringify(Y.error):null}).onConflict((J)=>J.columns(["execution_id","step_id"]).doNothing()).returningAll().executeTakeFirst();return X?mw(X):null}async updateStepResult(Y,X,J){let G={};if(J.output!==void 0)G.output=JSON.stringify(J.output);if(J.error!==void 0)G.error=JSON.stringify(J.error);if(J.started_at_epoch_ms!==void 0)G.started_at_epoch_ms=J.started_at_epoch_ms;if(J.completed_at_epoch_ms!==void 0)G.completed_at_epoch_ms=J.completed_at_epoch_ms;if(Object.keys(G).length===0)return null;let W=await this.db.updateTable("workflow_execution_step_result").set(G).where("execution_id","=",Y).where("step_id","=",X).returningAll().executeTakeFirst();return W?mw(W):null}async checkpointAndTransform(Y,X,J,G){await this.db.updateTable("workflow_execution_step_result").set({raw_tool_output:JSON.stringify(J)}).where("execution_id","=",Y).where("step_id","=",X).execute();let W,K;try{let H=await G(J);W=H.output,K=H.error}catch(H){K=H instanceof Error?`Transform failed: ${H.message}`:`Transform failed: ${String(H)}`}let Z={completed_at_epoch_ms:Date.now()};if(W!==void 0)Z.output=JSON.stringify(W);if(K!==void 0)Z.error=JSON.stringify(K);let Q=await this.db.updateTable("workflow_execution_step_result").set(Z).where("execution_id","=",Y).where("step_id","=",X).returningAll().executeTakeFirst();return Q?mw(Q):null}async getStepResult(Y,X){let J=await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).where("step_id","=",X).executeTakeFirst();return J?mw(J):null}async getStepResults(Y){return(await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).execute()).map(mw)}async deleteStepResult(Y,X){await this.db.deleteFrom("workflow_execution_step_result").where("execution_id","=",Y).where("step_id","=",X).execute()}async getStepResultsByPrefix(Y,X){return(await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).where("step_id","like",`${X}%`).orderBy("step_id").execute()).map(mw)}async recoverStuckExecutions(){return this.db.updateTable("workflow_execution").set({status:"enqueued",updated_at:Date.now()}).where("status","=","running").returning(["id","organization_id"]).execute()}}var BK0=()=>{};function DK0(Y){let X=Y.db;return{collections:new cD1(X),executions:new pD1(X)}}var wK0=A(()=>{NK0();BK0()});var MK0,AK0,EK0,PK0,TK0;var RK0=A(()=>{t1();QR();p9();MK0={name:"COLLECTION_WORKFLOW_LIST",description:"List workflows with pagination. Does not include steps -- use GET for full details.",inputSchema:F.object({limit:F.number().optional().default(50),offset:F.number().optional().default(0)}),outputSchema:F.object({items:F.array(F.object({id:F.string(),title:F.string(),description:F.string().nullable(),virtual_mcp_id:F.string(),created_at:F.string(),updated_at:F.string()})),totalCount:F.number(),hasMore:F.boolean()}),handler:async(Y,X)=>{let J=$Z(X);await J.access.check();let G=Y,W=qG(),{items:K,totalCount:Z}=await W.collections.list(J.organization.id,{limit:G.limit,offset:G.offset});return{items:K.map((Q)=>({id:Q.id,title:Q.title,description:Q.description,virtual_mcp_id:Q.virtual_mcp_id,created_at:Q.created_at,updated_at:Q.updated_at})),totalCount:Z,hasMore:(G.offset??0)+K.length<Z}}},AK0={name:"COLLECTION_WORKFLOW_GET",description:"Get a single workflow by ID, including its steps.",inputSchema:F.object({id:F.string()}),outputSchema:F.object({item:F.object({id:F.string(),title:F.string(),description:F.string().nullable(),virtual_mcp_id:F.string(),steps:F.array(Pw),created_at:F.string(),updated_at:F.string()}).nullable()}),handler:async(Y,X)=>{let J=$Z(X);await J.access.check();let{id:G}=Y,K=await qG().collections.getById(G,J.organization.id);if(!K)return{item:null};return{item:{id:K.id,title:K.title,description:K.description,virtual_mcp_id:K.virtual_mcp_id,steps:K.steps,created_at:K.created_at,updated_at:K.updated_at}}}},EK0={name:"COLLECTION_WORKFLOW_CREATE",description:`Create a workflow template. This is a reusable definition, not an execution.
|
|
380
380
|
|
|
381
381
|
Key concepts:
|
|
382
382
|
- Steps without references run immediately (in parallel).
|
package/dist/server/migrate.js
CHANGED
|
@@ -370,7 +370,7 @@ Hint: Configure a valid Google account email in Monitor Configuration > Contexto
|
|
|
370
370
|
|
|
371
371
|
`).trim(),U=V.length>0?`Not executed tools (${V.length}/${Y.tools.length}): ${V.join(", ")}`:"",q=[z,U].filter((D)=>D.length>0).join(`
|
|
372
372
|
|
|
373
|
-
`);return{toolResults:H,agentSummary:q.length>0?q:null,unexecutedTools:V}}finally{await X.close?.().catch(()=>{})}}async function nF1(Y,X){let J=m6(),G=Y.organization.id,W=await J.monitorConnections.findByItemId(G,X.id);if(W){if(await Y.storage.connections.findById(W.connection_id,G))return W.connection_id}let K=JI6(X);if(!K)throw Error(`Registry item ${X.id} has no remote URL`);let Z=YI6(Y),Q=XI6(X),H=await Y.storage.connections.create({organization_id:G,created_by:Z,title:`[MCP Tester] ${X.title}`,description:`Auto-created monitor connection for ${X.id}`,app_name:"private-registry-monitor",app_id:`${w3}:monitor`,connection_type:Q,connection_url:K,metadata:{monitorConnection:!0,registryItemId:X.id,pluginId:w3}});return await J.monitorConnections.upsert({organization_id:G,item_id:X.id,connection_id:H.id,auth_status:"none"}),H.id}async function zI6(Y){let X=m6();switch(Y.action){case"unlisted":return await X.items.update(Y.organizationId,Y.item.id,{is_unlisted:!0}),"unlisted";case"remove_public":return await X.items.update(Y.organizationId,Y.item.id,{is_public:!1}),"removed_public";case"remove_private":case"remove_all":return await X.items.delete(Y.organizationId,Y.item.id),Y.action==="remove_all"?"removed_all":"removed_private";default:return"none"}}async function UI6(Y){let X=Date.now();if(Y.signal.aborted)throw Error("Run cancelled");let J="passed",G=!1,W=!1,K=null,Z="none",Q=null,H=[],$=null,V=async()=>{await Y.onProgress?.({status:J,connectionOk:G,toolsListed:W,toolResults:[...H],agentSummary:Q,errorMessage:K,actionTaken:Z,durationMs:Date.now()-X})};try{let z=await nF1(Y.ctx,Y.item);$=await Y.ctx.createMCPProxy(z),G=!0;let q=(await F_($.listTools?$.listTools():Promise.resolve({tools:[]}),Y.monitorConfig.perMcpTimeoutMs,`listTools ${Y.item.id}`)).tools??[];if(W=!0,Y.monitorConfig.monitorMode!=="health_check")H.push(...q.map((D)=>pF1(D.name))),await V();if(Y.monitorConfig.monitorMode==="full_agent"){let D=await VI6({ctx:Y.ctx,monitorConfig:Y.monitorConfig,item:Y.item,proxy:$,tools:q,signal:Y.signal,onProgress:async(O)=>{H.length=0,H.push(...A00({discoveredTools:q,executedResults:O})),J=O.some((M)=>!M.success)?"failed":"passed",await V()}});if(H.length=0,H.push(...A00({discoveredTools:q,executedResults:D.toolResults})),Q=D.agentSummary,D.toolResults.some((O)=>!O.success))J="failed";if(D.unexecutedTools.length>0){if(J="failed",!K)K=`Agent skipped ${D.unexecutedTools.length} tool(s): ${D.unexecutedTools.join(", ")}`}}else if(Y.monitorConfig.monitorMode!=="health_check"){for(let D=0;D<q.length;D++){let O=q[D];if(!O||Y.signal.aborted)throw Error("Run cancelled");let M=Date.now();try{let P={},C=await F_($.callTool({name:O.name,arguments:P}),Y.monitorConfig.perToolTimeoutMs,`tool ${O.name}`),k=!C.isError,T=Date.now()-M;P00(H,{toolName:O.name,success:k,input:P,durationMs:T,outputPreview:S00(C.structuredContent??C.content),error:k?null:Yi(C.content?.find((E)=>E.type==="text")?.text?.slice(0,300)??"Tool returned error")}),await V()}catch(P){let C=Date.now()-M,k=P instanceof Error?P.message:String(P);P00(H,{toolName:O.name,success:!1,durationMs:C,error:Yi(k)}),await V()}}if(H.some((D)=>!D.success))J="failed"}else for(let D of q)H.push(pF1(D.name));if(Y.canApplyFailureAction&&J==="failed"&&Y.monitorConfig.onFailure!=="none")Z=await zI6({organizationId:Y.organizationId,item:Y.item,action:Y.monitorConfig.onFailure})}catch(z){if(K=z instanceof Error?z.message:String(z),GI6(z))J="needs_auth",await m6().monitorConnections.updateAuthStatus(Y.organizationId,Y.item.id,"needs_auth");else J="error"}finally{await $?.close?.().catch(()=>{})}return{status:J,connectionOk:G,toolsListed:W,toolResults:H,agentSummary:Q,errorMessage:K,actionTaken:Z,durationMs:Date.now()-X}}async function qI6(Y){let X=Date.now(),J=m6(),W=(await J.items.list(Y.organizationId,{includeUnlisted:!0})).items.filter((U)=>{if(Y.monitorConfig.testPublicOnly&&!U.is_public)return!1;if(Y.monitorConfig.testPrivateOnly&&U.is_public)return!1;return!0}),K=Y.monitorConfig.includePendingRequests?(await J.publishRequests.list(Y.organizationId,{status:"pending",limit:500})).items.map((U)=>DI6(U)):[],Z=[...W.map((U)=>({item:U,source:"registry_item"})),...K.map((U)=>({item:U,source:"publish_request"}))];if(Z.length===0){await J.monitorRuns.update(Y.organizationId,Y.runId,{total_items:0,status:"completed",started_at:new Date().toISOString(),finished_at:new Date().toISOString()}),await tn({ctx:Y.ctx,type:"registry.monitor.completed",subject:Y.runId,data:{runId:Y.runId,total:0}});return}await J.monitorRuns.update(Y.organizationId,Y.runId,{total_items:Z.length,status:"running",started_at:new Date().toISOString()});let Q=0,H=0,$=0,V=0;for(let U=0;U<Z.length;U++){let q=Z[U],D=q?.item;if(!D||Y.signal.aborted){await J.monitorRuns.update(Y.organizationId,Y.runId,{status:"cancelled",current_item_id:null,finished_at:new Date().toISOString()});return}await J.monitorRuns.update(Y.organizationId,Y.runId,{current_item_id:D.id});let O=null,M=async(C)=>{if(!O){O=(await J.monitorResults.create({run_id:Y.runId,organization_id:Y.organizationId,item_id:D.id,item_title:D.title,status:C.status,error_message:C.errorMessage,connection_ok:C.connectionOk,tools_listed:C.toolsListed,tool_results:C.toolResults,agent_summary:C.agentSummary,duration_ms:C.durationMs,action_taken:C.actionTaken})).id;return}await J.monitorResults.update(Y.organizationId,O,{status:C.status,error_message:C.errorMessage,connection_ok:C.connectionOk,tools_listed:C.toolsListed,tool_results:C.toolResults,agent_summary:C.agentSummary,duration_ms:C.durationMs,action_taken:C.actionTaken})},P=await UI6({ctx:Y.ctx,organizationId:Y.organizationId,item:D,monitorConfig:Y.monitorConfig,signal:Y.signal,canApplyFailureAction:q.source==="registry_item",onProgress:M});if(await M({status:P.status,connectionOk:P.connectionOk,toolsListed:P.toolsListed,toolResults:P.toolResults,agentSummary:P.agentSummary,errorMessage:P.errorMessage,actionTaken:P.actionTaken,durationMs:P.durationMs}),Q+=1,P.status==="passed")H+=1;else if(P.status==="failed"||P.status==="error")$+=1;else V+=1;if(await J.monitorRuns.update(Y.organizationId,Y.runId,{tested_items:Q,passed_items:H,failed_items:$,skipped_items:V}),P.status==="failed"||P.status==="error")await tn({ctx:Y.ctx,type:"registry.monitor.item_failed",subject:D.id,data:{runId:Y.runId,itemId:D.id,itemTitle:D.title,status:P.status,errorMessage:P.errorMessage,actionTaken:P.actionTaken}})}let z=Date.now()-X;await J.monitorRuns.update(Y.organizationId,Y.runId,{status:"completed",current_item_id:null,finished_at:new Date().toISOString()}),await tn({ctx:Y.ctx,type:"registry.monitor.completed",subject:Y.runId,data:{runId:Y.runId,total:Q,passed:H,failed:$,skipped:V,durationMs:z}})}function DI6(Y){return{id:`${hU}${Y.id}`,title:Y.title,description:Y.description,_meta:Y._meta,server:Y.server,is_public:!1,is_unlisted:!0,created_at:Y.created_at,updated_at:Y.updated_at}}async function LI6(Y,X){let J=I00(Y);await J.access.check();let G=m6(),W=await G.monitorRuns.create({organization_id:J.organization.id,status:"pending",config_snapshot:X,started_at:null}),K=new AbortController;return en.set(W.id,K),qI6({ctx:J,runId:W.id,organizationId:J.organization.id,monitorConfig:X,signal:K.signal}).catch(async(Z)=>{await G.monitorRuns.update(J.organization.id,W.id,{status:"failed",current_item_id:null,finished_at:new Date().toISOString()}).catch(()=>{}),await tn({ctx:J,type:"registry.monitor.failed",subject:W.id,data:{runId:W.id,error:Z instanceof Error?Z.message:String(Z)}}),eC6(`Run ${W.id} failed with uncaught error:`,Z)}).finally(()=>{en.delete(W.id)}),{run:{id:W.id}}}var en,R00="[MONITOR-AGENT]",oC6,sC6="health_check: not called",_00;var Xi=A(()=>{$X();Q00();DB();UQ();F9();en=new Map,oC6=mm1;_00={name:"REGISTRY_MONITOR_RUN_START",description:"Start an MCP registry monitor run with an isolated set of monitor connections.",inputSchema:V00,outputSchema:z00,handler:async(Y,X)=>{let G=on(Y.config??{}),{run:W}=await LI6(X,G),Z=await m6().monitorRuns.findById(I00(X).organization.id,W.id);if(!Z)throw Error(`Failed to load monitor run ${W.id}`);return{run:Z}}}});var v00;var f00=A(()=>{UQ();F9();v00={name:"REGISTRY_MONITOR_RUN_LIST",description:"List MCP registry monitor runs",inputSchema:bF1,outputSchema:q00,handler:J4(bF1,async(Y,X)=>{return m6().monitorRuns.list(X.organization.id,Y)})}});var y00;var h00=A(()=>{UQ();F9();y00={name:"REGISTRY_MONITOR_RUN_GET",description:"Get details for one MCP registry monitor run",inputSchema:xF1,outputSchema:D00,handler:J4(xF1,async(Y,X)=>{return{run:await m6().monitorRuns.findById(X.organization.id,Y.runId)}})}});var b00;var x00=A(()=>{UQ();Xi();F9();b00={name:"REGISTRY_MONITOR_RUN_CANCEL",description:"Cancel a running MCP registry monitor run",inputSchema:hF1,outputSchema:U00,handler:J4(hF1,async(Y,X)=>{return C00(Y.runId),{run:await m6().monitorRuns.update(X.organization.id,Y.runId,{status:"cancelled",current_item_id:null,finished_at:new Date().toISOString()})}})}});var g00;var u00=A(()=>{UQ();F9();g00={name:"REGISTRY_MONITOR_RESULT_LIST",description:"List results for a given MCP registry monitor run",inputSchema:gF1,outputSchema:L00,handler:J4(gF1,async(Y,X)=>{return m6().monitorResults.listByRun(X.organization.id,Y.runId,{status:Y.status,limit:Y.limit,offset:Y.offset})})}});var m00;var l00=A(()=>{UQ();F9();DB();m00={name:"REGISTRY_MONITOR_CONNECTION_LIST",description:"List monitor connection mappings for private registry MCP monitor runs, including auth status",inputSchema:uF1,outputSchema:B00,handler:J4(uF1,async(Y,X)=>{let J=m6(),G=await J.monitorConnections.list(X.organization.id);return{items:await Promise.all(G.map(async(K)=>{let Z=await J.items.findById(X.organization.id,K.item_id);if(!Z&&K.item_id.startsWith(hU)){let $=K.item_id.slice(hU.length),V=await J.publishRequests.findById(X.organization.id,$);if(V)Z={id:K.item_id,title:V.title,description:V.description,_meta:V._meta,server:V.server,is_public:!1,is_unlisted:!0,created_at:V.created_at,updated_at:V.updated_at}}let Q=Z?.server.remotes?.find(($)=>$.url)?.url??null,H=K.item_id.startsWith(hU)?"request":"store";return{mapping:K,item:Z,remoteUrl:Q,source:H}}))}})}});function BI6(Y){return{id:`${hU}${Y.id}`,title:Y.title,description:Y.description,_meta:Y._meta,server:Y.server,is_public:!1,is_unlisted:!0,created_at:Y.created_at,updated_at:Y.updated_at}}var d00;var c00=A(()=>{UQ();Xi();F9();DB();d00={name:"REGISTRY_MONITOR_CONNECTION_SYNC",description:"Ensure every registry item has a dedicated monitor connection mapping for MCP monitors",inputSchema:mF1,outputSchema:O00,handler:J4(mF1,async(Y,X)=>{let J=m6(),G=(await J.items.list(X.organization.id,{includeUnlisted:!0})).items,K=(await J.publishRequests.list(X.organization.id,{status:"pending",limit:500})).items.map(BI6),Z=[...G,...K],Q=await J.monitorConnections.list(X.organization.id),H=new Set(Q.map((V)=>V.item_id)),$=0;for(let V of Z){if(!V.server.remotes?.some((z)=>z.url))continue;if(await nF1(X,V),!H.has(V.id))$+=1}return{created:$,updated:Math.max(Z.length-$,0)}})}});var p00;var n00=A(()=>{UQ();F9();p00={name:"REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH",description:"Update the auth_status of a monitor connection mapping (by core connection ID)",inputSchema:lF1,outputSchema:N00,handler:J4(lF1,async({connectionId:Y,authStatus:X},J)=>{let G=m6(),W=J.organization.id,K=await G.monitorConnections.findByConnectionId(W,Y);if(!K)throw Error(`No monitor connection mapping found for connection ${Y}`);return await G.monitorConnections.updateAuthStatus(W,K.item_id,X),{success:!0}})}});function V_(Y){if(!Y||typeof Y!=="object")return null;let X=Y,J=X.id;if(typeof J==="string"&&J.length>0)return J;for(let G of["event","result","structuredContent","content"]){let W=X[G],K=V_(W);if(K)return K}if(Array.isArray(Y))for(let G of Y){let W=V_(G);if(W)return W}return null}var i00;var a00=A(()=>{$X();UQ();F9();i00={name:"REGISTRY_MONITOR_SCHEDULE_SET",description:"Schedule recurring MCP monitor runs via EVENT_PUBLISH cron",inputSchema:dF1,outputSchema:w00,handler:J4(dF1,async(Y,X)=>{let J=jY.SELF(X.organization.id),G=await X.createMCPProxy(J);try{let W=await G.callTool({name:"EVENT_PUBLISH",arguments:{type:"registry.monitor.scheduled",subject:"private-registry",cron:Y.cronExpression,data:{config:Y.config??{}}}});if(W.isError)throw Error("Failed to create monitor schedule via EVENT_PUBLISH");let K=V_(W.structuredContent)??V_(W.content)??V_(W);if(!K)throw Error("Could not resolve schedule event id from EVENT_PUBLISH");return{scheduleEventId:K}}finally{await G.close?.().catch(()=>{})}})}});var r00;var o00=A(()=>{$X();UQ();F9();r00={name:"REGISTRY_MONITOR_SCHEDULE_CANCEL",description:"Cancel a recurring MCP monitor schedule via EVENT_CANCEL",inputSchema:cF1,outputSchema:M00,handler:J4(cF1,async(Y,X)=>{let J=jY.SELF(X.organization.id),G=await X.createMCPProxy(J);try{if((await G.callTool({name:"EVENT_CANCEL",arguments:{eventId:Y.scheduleEventId}})).isError)throw Error("Failed to cancel monitor schedule via EVENT_CANCEL");return{success:!0}}finally{await G.close?.().catch(()=>{})}})}});function OI6(Y,X){if(!X)return Y;let J={field:["is_public"],operator:"eq",value:!1};if(!Y)return J;return{operator:"and",conditions:[Y,J]}}function NI6(Y){let X=new Map,J=new Map;for(let W of Y){let K=W._meta?.["mcp.mesh"];for(let Z of K?.tags??[])X.set(Z,(X.get(Z)??0)+1);for(let Z of K?.categories??[])J.set(Z,(J.get(Z)??0)+1)}let G=(W)=>Array.from(W.entries()).map(([K,Z])=>({value:K,count:Z})).sort((K,Z)=>K.value.localeCompare(Z.value));return{tags:G(X),categories:G(J)}}var s00,t00,e00,Y60;var X60=A(()=>{Y0();VX();F9();s00={name:"COLLECTION_REGISTRY_APP_LIST",description:"List registry items for Store discovery. Supports private-only mode from plugin settings.",inputSchema:Fq,outputSchema:aP,handler:J4(Fq,async(Y,X)=>{let J=m6(),G=await ck(X,X.organization.id);return J.items.list(X.organization.id,{...Y,where:OI6(Y.where,G.storePrivateOnly===!0)})})},t00={name:"COLLECTION_REGISTRY_APP_GET",description:"Get a registry item for Store details. Respects private-only mode from plugin settings.",inputSchema:WW,outputSchema:rB,handler:J4(WW,async(Y,X)=>{let J=m6(),G=await ck(X,X.organization.id),W=Y.id??Y.name;if(!W)return{item:null};let K=await J.items.findByIdOrName(X.organization.id,W);if(!K)return{item:null};if(G.storePrivateOnly&&K.is_public)return{item:null};return{item:K}})},e00={name:"COLLECTION_REGISTRY_APP_VERSIONS",description:"Get registry item versions for Store details. Respects private-only mode from plugin settings.",inputSchema:WW,outputSchema:F.object({versions:F.array(eK)}),handler:J4(WW,async(Y,X)=>{let J=m6(),G=await ck(X,X.organization.id),W=Y.id??Y.name;if(!W)return{versions:[]};let K=await J.items.findByIdOrName(X.organization.id,W);if(!K)return{versions:[]};if(G.storePrivateOnly&&K.is_public)return{versions:[]};return{versions:[K]}})},Y60={name:"COLLECTION_REGISTRY_APP_FILTERS",description:"List Store filter facets for registry items. Respects private-only mode from plugin settings.",inputSchema:F.object({}),outputSchema:rP,handler:J4(F.object({}),async(Y,X)=>{let J=m6();if(!(await ck(X,X.organization.id)).storePrivateOnly)return J.items.getFilters(X.organization.id);let W=await J.items.list(X.organization.id,{limit:1e4,where:{field:["is_public"],operator:"eq",value:!1}});return NI6(W.items)})}});var J60;var G60=A(()=>{Ri1();Ii1();ji1();_i1();yi1();bi1();gi1();mi1();di1();pi1();ii1();ri1();si1();ei1();Xa1();Ga1();Za1();Ka1();Xi();f00();h00();x00();u00();l00();c00();n00();a00();o00();X60();J60=[s00,t00,e00,Y60,ui1,li1,xi1,ni1,Si1,Ti1,ci1,ki1,hi1,fi1,Ci1,ai1,oi1,ti1,Ya1,Ja1,Wa1,Qa1,_00,v00,y00,b00,g00,m00,d00,p00,i00,r00]});var W60;var Z60=A(()=>{DB();Nc1();Bi1();Ei1();G60();UQ();W60={id:w3,description:um1,tools:J60,migrations:Oc1,publicRoutes:(Y,X)=>{K$1(Y,X),W$1(Y,X)},createStorage:Pi1,onEvents:{types:["registry.monitor.scheduled"],handler:async(Y,X)=>{let J=await X.createMCPProxy(X.connectionId);try{for(let G of Y){if(G.type!=="registry.monitor.scheduled")continue;let W=G.data&&typeof G.data==="object"?G.data:{},K=W.config&&typeof W.config==="object"?W.config:{},Z=on(K);await J.callTool({name:"REGISTRY_MONITOR_RUN_START",arguments:{config:Z}})}}finally{await J.close()}}}}});var Q60="MCP Workflows",K60="Create workflows using your MCP tools";var H60;var $60=A(()=>{bB();H60={name:"001-workflows",async up(Y){await Y.schema.createTable("workflow_collection").addColumn("id","text",(X)=>X.primaryKey()).addColumn("organization_id","text",(X)=>X.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(X)=>X.notNull()).addColumn("description","text").addColumn("virtual_mcp_id","text",(X)=>X.notNull()).addColumn("steps","text",(X)=>X.notNull().defaultTo("[]")).addColumn("created_at","text",(X)=>X.notNull().defaultTo(b4`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(X)=>X.notNull().defaultTo(b4`CURRENT_TIMESTAMP`)).addColumn("created_by","text").addColumn("updated_by","text").execute(),await Y.schema.createIndex("idx_wf_collection_org").on("workflow_collection").column("organization_id").execute(),await Y.schema.createIndex("idx_wf_collection_created_at").on("workflow_collection").column("created_at").execute(),await Y.schema.createTable("workflow").addColumn("id","text",(X)=>X.primaryKey()).addColumn("workflow_collection_id","text").addColumn("organization_id","text",(X)=>X.notNull().references("organization.id").onDelete("cascade")).addColumn("steps","text",(X)=>X.notNull().defaultTo("[]")).addColumn("input","text").addColumn("virtual_mcp_id","text",(X)=>X.notNull()).addColumn("created_at_epoch_ms","bigint",(X)=>X.notNull()).addColumn("created_by","text").execute(),await Y.schema.createIndex("idx_workflow_created_at").on("workflow").column("created_at_epoch_ms").execute(),await Y.schema.createIndex("idx_workflow_collection_id").on("workflow").column("workflow_collection_id").execute(),await Y.schema.createTable("workflow_execution").addColumn("id","text",(X)=>X.primaryKey()).addColumn("workflow_id","text",(X)=>X.notNull().references("workflow.id").onDelete("cascade")).addColumn("organization_id","text",(X)=>X.notNull().references("organization.id").onDelete("cascade")).addColumn("status","text",(X)=>X.notNull().defaultTo("enqueued")).addColumn("input","text").addColumn("output","text").addColumn("error","text").addColumn("created_at","bigint",(X)=>X.notNull()).addColumn("updated_at","bigint",(X)=>X.notNull()).addColumn("start_at_epoch_ms","bigint").addColumn("started_at_epoch_ms","bigint").addColumn("completed_at_epoch_ms","bigint").addColumn("timeout_ms","bigint").addColumn("deadline_at_epoch_ms","bigint").addColumn("created_by","text").execute(),await Y.schema.createIndex("idx_wf_execution_status").on("workflow_execution").column("status").execute(),await Y.schema.createIndex("idx_wf_execution_workflow_id").on("workflow_execution").column("workflow_id").execute(),await Y.schema.createIndex("idx_wf_execution_org").on("workflow_execution").column("organization_id").execute(),await Y.schema.createIndex("idx_wf_execution_created_at").on("workflow_execution").column("created_at").execute(),await Y.schema.createTable("workflow_execution_step_result").addColumn("execution_id","text",(X)=>X.notNull().references("workflow_execution.id").onDelete("cascade")).addColumn("step_id","text",(X)=>X.notNull()).addColumn("started_at_epoch_ms","bigint").addColumn("completed_at_epoch_ms","bigint").addColumn("output","text").addColumn("error","text").addColumn("raw_tool_output","text").execute(),await Y.schema.createIndex("idx_wf_step_result_pk").on("workflow_execution_step_result").columns(["execution_id","step_id"]).unique().execute(),await Y.schema.createIndex("idx_wf_step_result_execution").on("workflow_execution_step_result").column("execution_id").execute()},async down(Y){await Y.schema.dropIndex("idx_wf_step_result_execution").ifExists().execute(),await Y.schema.dropIndex("idx_wf_step_result_pk").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_created_at").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_org").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_workflow_id").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_status").ifExists().execute(),await Y.schema.dropIndex("idx_workflow_collection_id").ifExists().execute(),await Y.schema.dropIndex("idx_workflow_created_at").ifExists().execute(),await Y.schema.dropIndex("idx_wf_collection_created_at").ifExists().execute(),await Y.schema.dropIndex("idx_wf_collection_org").ifExists().execute(),await Y.schema.dropTable("workflow_execution_step_result").ifExists().execute(),await Y.schema.dropTable("workflow_execution").ifExists().execute(),await Y.schema.dropTable("workflow").ifExists().execute(),await Y.schema.dropTable("workflow_collection").ifExists().execute()}}});var F60;var V60=A(()=>{F60={name:"002-execution-list-index",async up(Y){await Y.schema.createIndex("idx_wf_execution_org_created_at").on("workflow_execution").columns(["organization_id","created_at desc"]).execute()},async down(Y){await Y.schema.dropIndex("idx_wf_execution_org_created_at").ifExists().execute()}}});var z60;var U60=A(()=>{$60();V60();z60=[H60,F60]});function QW(Y){let X=Y;if(!X.organization)throw Error("Organization context required for workflow tools");return X}function NJ(Y){if(Y===null||Y===void 0)return null;if(typeof Y==="object")return Y;if(typeof Y!=="string")return Y;try{return JSON.parse(Y)}catch{return Y}}function q60(Y){iF1=Y}function wJ(){if(!iF1)throw Error('Plugin storage not initialized. Make sure the "workflows" plugin is enabled.');return iF1}var iF1=null;function D60(Y){return{...Y,steps:NJ(Y.steps)??[]}}class aF1{db;constructor(Y){this.db=Y}async list(Y,X={}){let{limit:J=50,offset:G=0}=X,W=await this.db.selectFrom("workflow_collection").selectAll().where("organization_id","=",Y).orderBy("created_at","desc").limit(J).offset(G).execute(),K=await this.db.selectFrom("workflow_collection").select((Z)=>Z.fn.countAll().as("count")).where("organization_id","=",Y).executeTakeFirstOrThrow();return{items:W,totalCount:Number(K.count)}}async getById(Y,X){let J=await this.db.selectFrom("workflow_collection").selectAll().where("id","=",Y).where("organization_id","=",X).executeTakeFirst();return J?D60(J):null}async create(Y){let X=await this.db.insertInto("workflow_collection").values(Y).returningAll().executeTakeFirstOrThrow();return D60(X)}async update(Y,X,J){return await this.db.updateTable("workflow_collection").set({...J,updated_at:new Date().toISOString()}).where("id","=",Y).where("organization_id","=",X).returningAll().executeTakeFirstOrThrow()}async delete(Y,X){return await this.db.deleteFrom("workflow_collection").where("id","=",Y).where("organization_id","=",X).returningAll().executeTakeFirstOrThrow()}}var L60=()=>{};function wI6(Y){return{...Y,steps:NJ(Y.steps)??[],input:NJ(Y.input)??null}}function KO(Y){return{...Y,output:NJ(Y.output),error:NJ(Y.error),raw_tool_output:NJ(Y.raw_tool_output)}}class rF1{db;constructor(Y){this.db=Y}async _createWorkflow(Y,X){let J=crypto.randomUUID(),G=Date.now();return await Y.insertInto("workflow").values({id:J,workflow_collection_id:X.workflowCollectionId??null,organization_id:X.organizationId,steps:JSON.stringify(X.steps),input:X.input?JSON.stringify(X.input):null,virtual_mcp_id:X.virtualMcpId,created_at_epoch_ms:G,created_by:X.createdBy??null}).execute(),{id:J}}async createWorkflow(Y){return this._createWorkflow(this.db,Y)}async getWorkflow(Y){let X=await this.db.selectFrom("workflow").selectAll().where("id","=",Y).executeTakeFirst();return X?wI6(X):null}async createExecution(Y){return this.db.transaction().execute(async(X)=>{let J=Date.now(),{id:G}=await this._createWorkflow(X,{organizationId:Y.organizationId,workflowCollectionId:Y.workflowCollectionId,virtualMcpId:Y.virtualMcpId,input:Y.input,steps:Y.steps,createdBy:Y.createdBy}),W=crypto.randomUUID(),K=Y.startAtEpochMs??J,Z=Y.timeoutMs?K+Y.timeoutMs:null;return await X.insertInto("workflow_execution").values({id:W,workflow_id:G,organization_id:Y.organizationId,status:"enqueued",input:Y.input?JSON.stringify(Y.input):null,created_at:J,updated_at:J,start_at_epoch_ms:K,timeout_ms:Y.timeoutMs??null,deadline_at_epoch_ms:Z,created_by:Y.createdBy??null}).execute(),{id:W}})}async getExecution(Y,X){return await this.db.selectFrom("workflow_execution").selectAll().where("id","=",Y).where("organization_id","=",X).executeTakeFirst()??null}async getExecutionFull(Y,X){let J=await this.db.selectFrom("workflow_execution").selectAll().where("id","=",Y).where("organization_id","=",X).executeTakeFirst();if(!J)return null;let G=await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).execute();return{execution:J,stepResults:G.map(KO)}}async getExecutionContext(Y){let[X,J]=await Promise.all([this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").select(["we.id","we.status","we.workflow_id","we.deadline_at_epoch_ms","w.steps","w.input","w.virtual_mcp_id"]).where("we.id","=",Y).executeTakeFirst(),this.db.selectFrom("workflow_execution_step_result").select(["step_id","completed_at_epoch_ms","output","error"]).where("execution_id","=",Y).execute()]);if(!X)return null;return{execution:{id:X.id,status:X.status,workflow_id:X.workflow_id,deadline_at_epoch_ms:X.deadline_at_epoch_ms},workflow:{steps:NJ(X.steps)??[],input:NJ(X.input)??null,virtual_mcp_id:X.virtual_mcp_id},stepResults:J.map((G)=>({step_id:G.step_id,completed_at_epoch_ms:G.completed_at_epoch_ms,output:NJ(G.output),error:NJ(G.error)}))}}async claimExecution(Y){let X=Date.now(),J=await this.db.updateTable("workflow_execution").set({status:"running",updated_at:X}).where("id","=",Y).where("status","=","enqueued").returningAll().executeTakeFirst();if(!J)return null;let G=await this.getWorkflow(J.workflow_id);if(!G)throw Error(`Workflow ${J.workflow_id} not found for execution ${Y}`);return{execution:J,workflow:G}}async updateExecution(Y,X,J){let W={updated_at:Date.now()};if(X.status!==void 0)W.status=X.status;if(X.output!==void 0)W.output=JSON.stringify(X.output);if(X.error!==void 0)W.error=JSON.stringify(X.error);if(X.completed_at_epoch_ms!==void 0)W.completed_at_epoch_ms=X.completed_at_epoch_ms;let K=this.db.updateTable("workflow_execution").set(W).where("id","=",Y);if(J?.onlyIfStatus)K=K.where("status","=",J.onlyIfStatus);return await K.returningAll().executeTakeFirst()??null}async cancelExecution(Y,X){let J=Date.now();return!!await this.db.updateTable("workflow_execution").set({status:"cancelled",updated_at:J}).where("id","=",Y).where("organization_id","=",X).where("status","in",["enqueued","running"]).returningAll().executeTakeFirst()}async resumeExecution(Y,X){return this.db.transaction().execute(async(J)=>{let G=Date.now();if(!await J.updateTable("workflow_execution").set({status:"enqueued",updated_at:G,completed_at_epoch_ms:null,error:null}).where("id","=",Y).where("organization_id","=",X).where((K)=>K.or([K("status","=","cancelled"),K("status","=","error")])).returningAll().executeTakeFirst())return!1;return await J.deleteFrom("workflow_execution_step_result").where("execution_id","=",Y).where((K)=>K.or([K("completed_at_epoch_ms","is",null),K("error","is not",null)])).execute(),!0})}async listExecutions(Y,X={}){let{limit:J=50,offset:G=0,status:W}=X,K=this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").leftJoin("workflow_collection as wc","w.workflow_collection_id","wc.id").select(["we.id","we.workflow_id","we.organization_id","we.status","we.input","we.output","we.error","we.created_at","we.updated_at","we.start_at_epoch_ms","we.started_at_epoch_ms","we.completed_at_epoch_ms","we.timeout_ms","we.deadline_at_epoch_ms","we.created_by","w.virtual_mcp_id"]).select((V)=>V.fn.coalesce("wc.title",V.val("Workflow Execution")).as("title")).where("we.organization_id","=",Y);if(W)K=K.where("we.status","=",W);let Z=await K.orderBy("we.created_at","desc").limit(J).offset(G).execute(),Q=this.db.selectFrom("workflow_execution").select((V)=>V.fn.countAll().as("count")).where("organization_id","=",Y);if(W)Q=Q.where("status","=",W);let H=await Q.executeTakeFirstOrThrow(),$=Number(H.count);return{items:Z,totalCount:$,hasMore:G+Z.length<$}}async createStepResult(Y){let X=await this.db.insertInto("workflow_execution_step_result").values({execution_id:Y.execution_id,step_id:Y.step_id,started_at_epoch_ms:Y.completed_at_epoch_ms?Date.now():null,completed_at_epoch_ms:Y.completed_at_epoch_ms??null,output:Y.output!==void 0?JSON.stringify(Y.output):null,error:Y.error!==void 0?JSON.stringify(Y.error):null}).onConflict((J)=>J.columns(["execution_id","step_id"]).doNothing()).returningAll().executeTakeFirst();return X?KO(X):null}async updateStepResult(Y,X,J){let G={};if(J.output!==void 0)G.output=JSON.stringify(J.output);if(J.error!==void 0)G.error=JSON.stringify(J.error);if(J.started_at_epoch_ms!==void 0)G.started_at_epoch_ms=J.started_at_epoch_ms;if(J.completed_at_epoch_ms!==void 0)G.completed_at_epoch_ms=J.completed_at_epoch_ms;if(Object.keys(G).length===0)return null;let W=await this.db.updateTable("workflow_execution_step_result").set(G).where("execution_id","=",Y).where("step_id","=",X).returningAll().executeTakeFirst();return W?KO(W):null}async checkpointAndTransform(Y,X,J,G){await this.db.updateTable("workflow_execution_step_result").set({raw_tool_output:JSON.stringify(J)}).where("execution_id","=",Y).where("step_id","=",X).execute();let W,K;try{let H=await G(J);W=H.output,K=H.error}catch(H){K=H instanceof Error?`Transform failed: ${H.message}`:`Transform failed: ${String(H)}`}let Z={completed_at_epoch_ms:Date.now()};if(W!==void 0)Z.output=JSON.stringify(W);if(K!==void 0)Z.error=JSON.stringify(K);let Q=await this.db.updateTable("workflow_execution_step_result").set(Z).where("execution_id","=",Y).where("step_id","=",X).returningAll().executeTakeFirst();return Q?KO(Q):null}async getStepResult(Y,X){let J=await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).where("step_id","=",X).executeTakeFirst();return J?KO(J):null}async getStepResults(Y){return(await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).execute()).map(KO)}async deleteStepResult(Y,X){await this.db.deleteFrom("workflow_execution_step_result").where("execution_id","=",Y).where("step_id","=",X).execute()}async getStepResultsByPrefix(Y,X){return(await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).where("step_id","like",`${X}%`).orderBy("step_id").execute()).map(KO)}async recoverStuckExecutions(){return this.db.updateTable("workflow_execution").set({status:"enqueued",updated_at:Date.now()}).where("status","=","running").returning(["id","organization_id"]).execute()}}var B60=()=>{};function O60(Y){let X=Y.db;return{collections:new aF1(X),executions:new rF1(X)}}var N60=A(()=>{L60();B60()});var w60,M60,A60,P60,E60;var T60=A(()=>{Y0();pP();$X();w60={name:"COLLECTION_WORKFLOW_LIST",description:"List workflows with pagination. Does not include steps -- use GET for full details.",inputSchema:F.object({limit:F.number().optional().default(50),offset:F.number().optional().default(0)}),outputSchema:F.object({items:F.array(F.object({id:F.string(),title:F.string(),description:F.string().nullable(),virtual_mcp_id:F.string(),created_at:F.string(),updated_at:F.string()})),totalCount:F.number(),hasMore:F.boolean()}),handler:async(Y,X)=>{let J=QW(X);await J.access.check();let G=Y,W=wJ(),{items:K,totalCount:Z}=await W.collections.list(J.organization.id,{limit:G.limit,offset:G.offset});return{items:K.map((Q)=>({id:Q.id,title:Q.title,description:Q.description,virtual_mcp_id:Q.virtual_mcp_id,created_at:Q.created_at,updated_at:Q.updated_at})),totalCount:Z,hasMore:(G.offset??0)+K.length<Z}}},M60={name:"COLLECTION_WORKFLOW_GET",description:"Get a single workflow by ID, including its steps.",inputSchema:F.object({id:F.string()}),outputSchema:F.object({item:F.object({id:F.string(),title:F.string(),description:F.string().nullable(),virtual_mcp_id:F.string(),steps:F.array(pB),created_at:F.string(),updated_at:F.string()}).nullable()}),handler:async(Y,X)=>{let J=QW(X);await J.access.check();let{id:G}=Y,K=await wJ().collections.getById(G,J.organization.id);if(!K)return{item:null};return{item:{id:K.id,title:K.title,description:K.description,virtual_mcp_id:K.virtual_mcp_id,steps:K.steps,created_at:K.created_at,updated_at:K.updated_at}}}},A60={name:"COLLECTION_WORKFLOW_CREATE",description:`Create a workflow template. This is a reusable definition, not an execution.
|
|
373
|
+
`);return{toolResults:H,agentSummary:q.length>0?q:null,unexecutedTools:V}}finally{await X.close?.().catch(()=>{})}}async function nF1(Y,X){let J=m6(),G=Y.organization.id,W=await J.monitorConnections.findByItemId(G,X.id);if(W){if(await Y.storage.connections.findById(W.connection_id,G))return W.connection_id}let K=JI6(X);if(!K)throw Error(`Registry item ${X.id} has no remote URL`);let Z=YI6(Y),Q=XI6(X),H=await Y.storage.connections.create({organization_id:G,created_by:Z,title:`[MCP Tester] ${X.title}`,description:`Auto-created monitor connection for ${X.id}`,app_name:"private-registry-monitor",app_id:`${w3}:monitor`,connection_type:Q,connection_url:K,metadata:{monitorConnection:!0,registryItemId:X.id,pluginId:w3}});return await J.monitorConnections.upsert({organization_id:G,item_id:X.id,connection_id:H.id,auth_status:"none"}),H.id}async function zI6(Y){let X=m6();switch(Y.action){case"unlisted":return await X.items.update(Y.organizationId,Y.item.id,{is_unlisted:!0}),"unlisted";case"remove_public":return await X.items.update(Y.organizationId,Y.item.id,{is_public:!1}),"removed_public";case"remove_private":case"remove_all":return await X.items.delete(Y.organizationId,Y.item.id),Y.action==="remove_all"?"removed_all":"removed_private";default:return"none"}}async function UI6(Y){let X=Date.now();if(Y.signal.aborted)throw Error("Run cancelled");let J="passed",G=!1,W=!1,K=null,Z="none",Q=null,H=[],$=null,V=async()=>{await Y.onProgress?.({status:J,connectionOk:G,toolsListed:W,toolResults:[...H],agentSummary:Q,errorMessage:K,actionTaken:Z,durationMs:Date.now()-X})};try{let z=await nF1(Y.ctx,Y.item);$=await Y.ctx.createMCPProxy(z),G=!0;let q=(await F_($.listTools?$.listTools():Promise.resolve({tools:[]}),Y.monitorConfig.perMcpTimeoutMs,`listTools ${Y.item.id}`)).tools??[];if(W=!0,Y.monitorConfig.monitorMode!=="health_check")H.push(...q.map((D)=>pF1(D.name))),await V();if(Y.monitorConfig.monitorMode==="full_agent"){let D=await VI6({ctx:Y.ctx,monitorConfig:Y.monitorConfig,item:Y.item,proxy:$,tools:q,signal:Y.signal,onProgress:async(O)=>{H.length=0,H.push(...A00({discoveredTools:q,executedResults:O})),J=O.some((M)=>!M.success)?"failed":"passed",await V()}});if(H.length=0,H.push(...A00({discoveredTools:q,executedResults:D.toolResults})),Q=D.agentSummary,D.toolResults.some((O)=>!O.success))J="failed";if(D.unexecutedTools.length>0){if(J="failed",!K)K=`Agent skipped ${D.unexecutedTools.length} tool(s): ${D.unexecutedTools.join(", ")}`}}else if(Y.monitorConfig.monitorMode!=="health_check"){for(let D=0;D<q.length;D++){let O=q[D];if(!O||Y.signal.aborted)throw Error("Run cancelled");let M=Date.now();try{let P={},C=await F_($.callTool({name:O.name,arguments:P}),Y.monitorConfig.perToolTimeoutMs,`tool ${O.name}`),k=!C.isError,T=Date.now()-M;P00(H,{toolName:O.name,success:k,input:P,durationMs:T,outputPreview:S00(C.structuredContent??C.content),error:k?null:Yi(C.content?.find((E)=>E.type==="text")?.text?.slice(0,300)??"Tool returned error")}),await V()}catch(P){let C=Date.now()-M,k=P instanceof Error?P.message:String(P);P00(H,{toolName:O.name,success:!1,durationMs:C,error:Yi(k)}),await V()}}if(H.some((D)=>!D.success))J="failed"}else for(let D of q)H.push(pF1(D.name));if(Y.canApplyFailureAction&&J==="failed"&&Y.monitorConfig.onFailure!=="none")Z=await zI6({organizationId:Y.organizationId,item:Y.item,action:Y.monitorConfig.onFailure})}catch(z){if(K=z instanceof Error?z.message:String(z),GI6(z))J="needs_auth",await m6().monitorConnections.updateAuthStatus(Y.organizationId,Y.item.id,"needs_auth");else J="error"}finally{await $?.close?.().catch(()=>{})}return{status:J,connectionOk:G,toolsListed:W,toolResults:H,agentSummary:Q,errorMessage:K,actionTaken:Z,durationMs:Date.now()-X}}async function qI6(Y){let X=Date.now(),J=m6(),W=(await J.items.list(Y.organizationId,{includeUnlisted:!0})).items.filter((U)=>{if(Y.monitorConfig.testPublicOnly&&!U.is_public)return!1;if(Y.monitorConfig.testPrivateOnly&&U.is_public)return!1;return!0}),K=Y.monitorConfig.includePendingRequests?(await J.publishRequests.list(Y.organizationId,{status:"pending",limit:500})).items.map((U)=>DI6(U)):[],Z=[...W.map((U)=>({item:U,source:"registry_item"})),...K.map((U)=>({item:U,source:"publish_request"}))];if(Z.length===0){await J.monitorRuns.update(Y.organizationId,Y.runId,{total_items:0,status:"completed",started_at:new Date().toISOString(),finished_at:new Date().toISOString()}),await tn({ctx:Y.ctx,type:"registry.monitor.completed",subject:Y.runId,data:{runId:Y.runId,total:0}});return}await J.monitorRuns.update(Y.organizationId,Y.runId,{total_items:Z.length,status:"running",started_at:new Date().toISOString()});let Q=0,H=0,$=0,V=0;for(let U=0;U<Z.length;U++){let q=Z[U],D=q?.item;if(!D||Y.signal.aborted){await J.monitorRuns.update(Y.organizationId,Y.runId,{status:"cancelled",current_item_id:null,finished_at:new Date().toISOString()});return}await J.monitorRuns.update(Y.organizationId,Y.runId,{current_item_id:D.id});let O=null,M=async(C)=>{if(!O){O=(await J.monitorResults.create({run_id:Y.runId,organization_id:Y.organizationId,item_id:D.id,item_title:D.title,status:C.status,error_message:C.errorMessage,connection_ok:C.connectionOk,tools_listed:C.toolsListed,tool_results:C.toolResults,agent_summary:C.agentSummary,duration_ms:C.durationMs,action_taken:C.actionTaken})).id;return}await J.monitorResults.update(Y.organizationId,O,{status:C.status,error_message:C.errorMessage,connection_ok:C.connectionOk,tools_listed:C.toolsListed,tool_results:C.toolResults,agent_summary:C.agentSummary,duration_ms:C.durationMs,action_taken:C.actionTaken})},P=await UI6({ctx:Y.ctx,organizationId:Y.organizationId,item:D,monitorConfig:Y.monitorConfig,signal:Y.signal,canApplyFailureAction:q.source==="registry_item",onProgress:M});if(await M({status:P.status,connectionOk:P.connectionOk,toolsListed:P.toolsListed,toolResults:P.toolResults,agentSummary:P.agentSummary,errorMessage:P.errorMessage,actionTaken:P.actionTaken,durationMs:P.durationMs}),Q+=1,P.status==="passed")H+=1;else if(P.status==="failed"||P.status==="error")$+=1;else V+=1;if(await J.monitorRuns.update(Y.organizationId,Y.runId,{tested_items:Q,passed_items:H,failed_items:$,skipped_items:V}),P.status==="failed"||P.status==="error")await tn({ctx:Y.ctx,type:"registry.monitor.item_failed",subject:D.id,data:{runId:Y.runId,itemId:D.id,itemTitle:D.title,status:P.status,errorMessage:P.errorMessage,actionTaken:P.actionTaken}})}let z=Date.now()-X;await J.monitorRuns.update(Y.organizationId,Y.runId,{status:"completed",current_item_id:null,finished_at:new Date().toISOString()}),await tn({ctx:Y.ctx,type:"registry.monitor.completed",subject:Y.runId,data:{runId:Y.runId,total:Q,passed:H,failed:$,skipped:V,durationMs:z}})}function DI6(Y){return{id:`${hU}${Y.id}`,title:Y.title,description:Y.description,_meta:Y._meta,server:Y.server,is_public:!1,is_unlisted:!0,created_at:Y.created_at,updated_at:Y.updated_at}}async function LI6(Y,X){let J=I00(Y);await J.access.check();let G=m6(),W=await G.monitorRuns.create({organization_id:J.organization.id,status:"pending",config_snapshot:X,started_at:null}),K=new AbortController;return en.set(W.id,K),qI6({ctx:J,runId:W.id,organizationId:J.organization.id,monitorConfig:X,signal:K.signal}).catch(async(Z)=>{await G.monitorRuns.update(J.organization.id,W.id,{status:"failed",current_item_id:null,finished_at:new Date().toISOString()}).catch(()=>{}),await tn({ctx:J,type:"registry.monitor.failed",subject:W.id,data:{runId:W.id,error:Z instanceof Error?Z.message:String(Z)}}),eC6(`Run ${W.id} failed with uncaught error:`,Z)}).finally(()=>{en.delete(W.id)}),{run:{id:W.id}}}var en,R00="[MONITOR-AGENT]",oC6,sC6="health_check: not called",_00;var Xi=A(()=>{$X();Q00();DB();UQ();F9();en=new Map,oC6=mm1;_00={name:"REGISTRY_MONITOR_RUN_START",description:"Start an MCP registry monitor run with an isolated set of monitor connections.",inputSchema:V00,outputSchema:z00,handler:async(Y,X)=>{let G=on(Y.config??{}),{run:W}=await LI6(X,G),Z=await m6().monitorRuns.findById(I00(X).organization.id,W.id);if(!Z)throw Error(`Failed to load monitor run ${W.id}`);return{run:Z}}}});var v00;var f00=A(()=>{UQ();F9();v00={name:"REGISTRY_MONITOR_RUN_LIST",description:"List MCP registry monitor runs",inputSchema:bF1,outputSchema:q00,handler:J4(bF1,async(Y,X)=>{return m6().monitorRuns.list(X.organization.id,Y)})}});var y00;var h00=A(()=>{UQ();F9();y00={name:"REGISTRY_MONITOR_RUN_GET",description:"Get details for one MCP registry monitor run",inputSchema:xF1,outputSchema:D00,handler:J4(xF1,async(Y,X)=>{return{run:await m6().monitorRuns.findById(X.organization.id,Y.runId)}})}});var b00;var x00=A(()=>{UQ();Xi();F9();b00={name:"REGISTRY_MONITOR_RUN_CANCEL",description:"Cancel a running MCP registry monitor run",inputSchema:hF1,outputSchema:U00,handler:J4(hF1,async(Y,X)=>{return C00(Y.runId),{run:await m6().monitorRuns.update(X.organization.id,Y.runId,{status:"cancelled",current_item_id:null,finished_at:new Date().toISOString()})}})}});var g00;var u00=A(()=>{UQ();F9();g00={name:"REGISTRY_MONITOR_RESULT_LIST",description:"List results for a given MCP registry monitor run",inputSchema:gF1,outputSchema:L00,handler:J4(gF1,async(Y,X)=>{return m6().monitorResults.listByRun(X.organization.id,Y.runId,{status:Y.status,limit:Y.limit,offset:Y.offset})})}});var m00;var l00=A(()=>{UQ();F9();DB();m00={name:"REGISTRY_MONITOR_CONNECTION_LIST",description:"List monitor connection mappings for private registry MCP monitor runs, including auth status",inputSchema:uF1,outputSchema:B00,handler:J4(uF1,async(Y,X)=>{let J=m6(),G=await J.monitorConnections.list(X.organization.id);return{items:await Promise.all(G.map(async(K)=>{let Z=await J.items.findById(X.organization.id,K.item_id);if(!Z&&K.item_id.startsWith(hU)){let $=K.item_id.slice(hU.length),V=await J.publishRequests.findById(X.organization.id,$);if(V)Z={id:K.item_id,title:V.title,description:V.description,_meta:V._meta,server:V.server,is_public:!1,is_unlisted:!0,created_at:V.created_at,updated_at:V.updated_at}}let Q=Z?.server.remotes?.find(($)=>$.url)?.url??null,H=K.item_id.startsWith(hU)?"request":"store";return{mapping:K,item:Z,remoteUrl:Q,source:H}}))}})}});function BI6(Y){return{id:`${hU}${Y.id}`,title:Y.title,description:Y.description,_meta:Y._meta,server:Y.server,is_public:!1,is_unlisted:!0,created_at:Y.created_at,updated_at:Y.updated_at}}var d00;var c00=A(()=>{UQ();Xi();F9();DB();d00={name:"REGISTRY_MONITOR_CONNECTION_SYNC",description:"Ensure every registry item has a dedicated monitor connection mapping for MCP monitors",inputSchema:mF1,outputSchema:O00,handler:J4(mF1,async(Y,X)=>{let J=m6(),G=(await J.items.list(X.organization.id,{includeUnlisted:!0})).items,K=(await J.publishRequests.list(X.organization.id,{status:"pending",limit:500})).items.map(BI6),Z=[...G,...K],Q=await J.monitorConnections.list(X.organization.id),H=new Set(Q.map((V)=>V.item_id)),$=0;for(let V of Z){if(!V.server.remotes?.some((z)=>z.url))continue;if(await nF1(X,V),!H.has(V.id))$+=1}return{created:$,updated:Math.max(Z.length-$,0)}})}});var p00;var n00=A(()=>{UQ();F9();p00={name:"REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH",description:"Update the auth_status of a monitor connection mapping (by core connection ID)",inputSchema:lF1,outputSchema:N00,handler:J4(lF1,async({connectionId:Y,authStatus:X},J)=>{let G=m6(),W=J.organization.id,K=await G.monitorConnections.findByConnectionId(W,Y);if(!K)throw Error(`No monitor connection mapping found for connection ${Y}`);return await G.monitorConnections.updateAuthStatus(W,K.item_id,X),{success:!0}})}});function V_(Y){if(!Y||typeof Y!=="object")return null;let X=Y,J=X.id;if(typeof J==="string"&&J.length>0)return J;for(let G of["event","result","structuredContent","content"]){let W=X[G],K=V_(W);if(K)return K}if(Array.isArray(Y))for(let G of Y){let W=V_(G);if(W)return W}return null}var i00;var a00=A(()=>{$X();UQ();F9();i00={name:"REGISTRY_MONITOR_SCHEDULE_SET",description:"Schedule recurring MCP monitor runs via EVENT_PUBLISH cron",inputSchema:dF1,outputSchema:w00,handler:J4(dF1,async(Y,X)=>{let J=jY.SELF(X.organization.id),G=await X.createMCPProxy(J);try{let W=await G.callTool({name:"EVENT_PUBLISH",arguments:{type:"registry.monitor.scheduled",subject:"private-registry",cron:Y.cronExpression,data:{config:Y.config??{}}}});if(W.isError)throw Error("Failed to create monitor schedule via EVENT_PUBLISH");let K=V_(W.structuredContent)??V_(W.content)??V_(W);if(!K)throw Error("Could not resolve schedule event id from EVENT_PUBLISH");return{scheduleEventId:K}}finally{await G.close?.().catch(()=>{})}})}});var r00;var o00=A(()=>{$X();UQ();F9();r00={name:"REGISTRY_MONITOR_SCHEDULE_CANCEL",description:"Cancel a recurring MCP monitor schedule via EVENT_CANCEL",inputSchema:cF1,outputSchema:M00,handler:J4(cF1,async(Y,X)=>{let J=jY.SELF(X.organization.id),G=await X.createMCPProxy(J);try{if((await G.callTool({name:"EVENT_CANCEL",arguments:{eventId:Y.scheduleEventId}})).isError)throw Error("Failed to cancel monitor schedule via EVENT_CANCEL");return{success:!0}}finally{await G.close?.().catch(()=>{})}})}});function OI6(Y,X){if(!X)return Y;let J={field:["is_public"],operator:"eq",value:!1};if(!Y)return J;return{operator:"and",conditions:[Y,J]}}function NI6(Y){let X=new Map,J=new Map;for(let W of Y){let K=W._meta?.["mcp.mesh"];for(let Z of K?.tags??[])X.set(Z,(X.get(Z)??0)+1);for(let Z of K?.categories??[])J.set(Z,(J.get(Z)??0)+1)}let G=(W)=>Array.from(W.entries()).map(([K,Z])=>({value:K,count:Z})).sort((K,Z)=>K.value.localeCompare(Z.value));return{tags:G(X),categories:G(J)}}var s00,t00,e00,Y60;var X60=A(()=>{Y0();VX();F9();s00={name:"COLLECTION_REGISTRY_APP_LIST",description:"List registry items for Store discovery. Supports private-only mode from plugin settings.",inputSchema:Fq,outputSchema:aP,handler:J4(Fq,async(Y,X)=>{let J=m6(),G=await ck(X,X.organization.id);return J.items.list(X.organization.id,{...Y,where:OI6(Y.where,G.storePrivateOnly===!0)})})},t00={name:"COLLECTION_REGISTRY_APP_GET",description:"Get a registry item for Store details. Respects private-only mode from plugin settings.",inputSchema:WW,outputSchema:rB,handler:J4(WW,async(Y,X)=>{let J=m6(),G=await ck(X,X.organization.id),W=Y.id??Y.name;if(!W)return{item:null};let K=await J.items.findByIdOrName(X.organization.id,W);if(!K)return{item:null};if(G.storePrivateOnly&&K.is_public)return{item:null};return{item:K}})},e00={name:"COLLECTION_REGISTRY_APP_VERSIONS",description:"Get registry item versions for Store details. Respects private-only mode from plugin settings.",inputSchema:WW,outputSchema:F.object({versions:F.array(eK)}),handler:J4(WW,async(Y,X)=>{let J=m6(),G=await ck(X,X.organization.id),W=Y.id??Y.name;if(!W)return{versions:[]};let K=await J.items.findByIdOrName(X.organization.id,W);if(!K)return{versions:[]};if(G.storePrivateOnly&&K.is_public)return{versions:[]};return{versions:[K]}})},Y60={name:"COLLECTION_REGISTRY_APP_FILTERS",description:"List Store filter facets for registry items. Respects private-only mode from plugin settings.",inputSchema:F.object({}),outputSchema:rP,handler:J4(F.object({}),async(Y,X)=>{let J=m6();if(!(await ck(X,X.organization.id)).storePrivateOnly)return J.items.getFilters(X.organization.id);let W=await J.items.list(X.organization.id,{limit:1e4,where:{field:["is_public"],operator:"eq",value:!1}});return NI6(W.items)})}});var J60;var G60=A(()=>{Ri1();Ii1();ji1();_i1();yi1();bi1();gi1();mi1();di1();pi1();ii1();ri1();si1();ei1();Xa1();Ga1();Za1();Ka1();Xi();f00();h00();x00();u00();l00();c00();n00();a00();o00();X60();J60=[s00,t00,e00,Y60,ui1,li1,xi1,ni1,Si1,Ti1,ci1,ki1,hi1,fi1,Ci1,ai1,oi1,ti1,Ya1,Ja1,Wa1,Qa1,_00,v00,y00,b00,g00,m00,d00,p00,i00,r00]});var W60;var Z60=A(()=>{DB();Nc1();Bi1();Ei1();G60();UQ();W60={id:w3,description:um1,tools:J60,migrations:Oc1,publicRoutes:(Y,X)=>{K$1(Y,X),W$1(Y,X)},createStorage:Pi1,onEvents:{types:["registry.monitor.scheduled"],handler:async(Y,X)=>{let J=await X.createMCPProxy(X.connectionId);try{for(let G of Y){if(G.type!=="registry.monitor.scheduled")continue;let W=G.data&&typeof G.data==="object"?G.data:{},K=W.config&&typeof W.config==="object"?W.config:{},Z=on(K);await J.callTool({name:"REGISTRY_MONITOR_RUN_START",arguments:{config:Z}})}}finally{await J.close()}}}}});var Q60="MCP Workflows",K60="Create workflows using your MCP tools";var H60;var $60=A(()=>{bB();H60={name:"001-workflows",async up(Y){await Y.schema.createTable("workflow_collection").ifNotExists().addColumn("id","text",(X)=>X.primaryKey()).addColumn("organization_id","text",(X)=>X.notNull().references("organization.id").onDelete("cascade")).addColumn("title","text",(X)=>X.notNull()).addColumn("description","text").addColumn("virtual_mcp_id","text",(X)=>X.notNull()).addColumn("steps","text",(X)=>X.notNull().defaultTo("[]")).addColumn("created_at","text",(X)=>X.notNull().defaultTo(b4`CURRENT_TIMESTAMP`)).addColumn("updated_at","text",(X)=>X.notNull().defaultTo(b4`CURRENT_TIMESTAMP`)).addColumn("created_by","text").addColumn("updated_by","text").execute(),await Y.schema.createIndex("idx_wf_collection_org").ifNotExists().on("workflow_collection").column("organization_id").execute(),await Y.schema.createIndex("idx_wf_collection_created_at").ifNotExists().on("workflow_collection").column("created_at").execute(),await Y.schema.createTable("workflow").ifNotExists().addColumn("id","text",(X)=>X.primaryKey()).addColumn("workflow_collection_id","text").addColumn("organization_id","text",(X)=>X.notNull().references("organization.id").onDelete("cascade")).addColumn("steps","text",(X)=>X.notNull().defaultTo("[]")).addColumn("input","text").addColumn("virtual_mcp_id","text",(X)=>X.notNull()).addColumn("created_at_epoch_ms","bigint",(X)=>X.notNull()).addColumn("created_by","text").execute(),await Y.schema.createIndex("idx_workflow_created_at").ifNotExists().on("workflow").column("created_at_epoch_ms").execute(),await Y.schema.createIndex("idx_workflow_collection_id").ifNotExists().on("workflow").column("workflow_collection_id").execute(),await Y.schema.createTable("workflow_execution").ifNotExists().addColumn("id","text",(X)=>X.primaryKey()).addColumn("workflow_id","text",(X)=>X.notNull().references("workflow.id").onDelete("cascade")).addColumn("organization_id","text",(X)=>X.notNull().references("organization.id").onDelete("cascade")).addColumn("status","text",(X)=>X.notNull().defaultTo("enqueued")).addColumn("input","text").addColumn("output","text").addColumn("error","text").addColumn("created_at","bigint",(X)=>X.notNull()).addColumn("updated_at","bigint",(X)=>X.notNull()).addColumn("start_at_epoch_ms","bigint").addColumn("started_at_epoch_ms","bigint").addColumn("completed_at_epoch_ms","bigint").addColumn("timeout_ms","bigint").addColumn("deadline_at_epoch_ms","bigint").addColumn("created_by","text").execute(),await Y.schema.createIndex("idx_wf_execution_status").ifNotExists().on("workflow_execution").column("status").execute(),await Y.schema.createIndex("idx_wf_execution_workflow_id").ifNotExists().on("workflow_execution").column("workflow_id").execute(),await Y.schema.createIndex("idx_wf_execution_org").ifNotExists().on("workflow_execution").column("organization_id").execute(),await Y.schema.createIndex("idx_wf_execution_created_at").ifNotExists().on("workflow_execution").column("created_at").execute(),await Y.schema.createTable("workflow_execution_step_result").ifNotExists().addColumn("execution_id","text",(X)=>X.notNull().references("workflow_execution.id").onDelete("cascade")).addColumn("step_id","text",(X)=>X.notNull()).addColumn("started_at_epoch_ms","bigint").addColumn("completed_at_epoch_ms","bigint").addColumn("output","text").addColumn("error","text").addColumn("raw_tool_output","text").execute(),await Y.schema.createIndex("idx_wf_step_result_pk").ifNotExists().on("workflow_execution_step_result").columns(["execution_id","step_id"]).unique().execute(),await Y.schema.createIndex("idx_wf_step_result_execution").ifNotExists().on("workflow_execution_step_result").column("execution_id").execute()},async down(Y){await Y.schema.dropIndex("idx_wf_step_result_execution").ifExists().execute(),await Y.schema.dropIndex("idx_wf_step_result_pk").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_created_at").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_org").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_workflow_id").ifExists().execute(),await Y.schema.dropIndex("idx_wf_execution_status").ifExists().execute(),await Y.schema.dropIndex("idx_workflow_collection_id").ifExists().execute(),await Y.schema.dropIndex("idx_workflow_created_at").ifExists().execute(),await Y.schema.dropIndex("idx_wf_collection_created_at").ifExists().execute(),await Y.schema.dropIndex("idx_wf_collection_org").ifExists().execute(),await Y.schema.dropTable("workflow_execution_step_result").ifExists().execute(),await Y.schema.dropTable("workflow_execution").ifExists().execute(),await Y.schema.dropTable("workflow").ifExists().execute(),await Y.schema.dropTable("workflow_collection").ifExists().execute()}}});var F60;var V60=A(()=>{F60={name:"002-execution-list-index",async up(Y){await Y.schema.createIndex("idx_wf_execution_org_created_at").ifNotExists().on("workflow_execution").columns(["organization_id","created_at desc"]).execute()},async down(Y){await Y.schema.dropIndex("idx_wf_execution_org_created_at").ifExists().execute()}}});var z60;var U60=A(()=>{$60();V60();z60=[H60,F60]});function QW(Y){let X=Y;if(!X.organization)throw Error("Organization context required for workflow tools");return X}function NJ(Y){if(Y===null||Y===void 0)return null;if(typeof Y==="object")return Y;if(typeof Y!=="string")return Y;try{return JSON.parse(Y)}catch{return Y}}function q60(Y){iF1=Y}function wJ(){if(!iF1)throw Error('Plugin storage not initialized. Make sure the "workflows" plugin is enabled.');return iF1}var iF1=null;function D60(Y){return{...Y,steps:NJ(Y.steps)??[]}}class aF1{db;constructor(Y){this.db=Y}async list(Y,X={}){let{limit:J=50,offset:G=0}=X,W=await this.db.selectFrom("workflow_collection").selectAll().where("organization_id","=",Y).orderBy("created_at","desc").limit(J).offset(G).execute(),K=await this.db.selectFrom("workflow_collection").select((Z)=>Z.fn.countAll().as("count")).where("organization_id","=",Y).executeTakeFirstOrThrow();return{items:W,totalCount:Number(K.count)}}async getById(Y,X){let J=await this.db.selectFrom("workflow_collection").selectAll().where("id","=",Y).where("organization_id","=",X).executeTakeFirst();return J?D60(J):null}async create(Y){let X=await this.db.insertInto("workflow_collection").values(Y).returningAll().executeTakeFirstOrThrow();return D60(X)}async update(Y,X,J){return await this.db.updateTable("workflow_collection").set({...J,updated_at:new Date().toISOString()}).where("id","=",Y).where("organization_id","=",X).returningAll().executeTakeFirstOrThrow()}async delete(Y,X){return await this.db.deleteFrom("workflow_collection").where("id","=",Y).where("organization_id","=",X).returningAll().executeTakeFirstOrThrow()}}var L60=()=>{};function wI6(Y){return{...Y,steps:NJ(Y.steps)??[],input:NJ(Y.input)??null}}function KO(Y){return{...Y,output:NJ(Y.output),error:NJ(Y.error),raw_tool_output:NJ(Y.raw_tool_output)}}class rF1{db;constructor(Y){this.db=Y}async _createWorkflow(Y,X){let J=crypto.randomUUID(),G=Date.now();return await Y.insertInto("workflow").values({id:J,workflow_collection_id:X.workflowCollectionId??null,organization_id:X.organizationId,steps:JSON.stringify(X.steps),input:X.input?JSON.stringify(X.input):null,virtual_mcp_id:X.virtualMcpId,created_at_epoch_ms:G,created_by:X.createdBy??null}).execute(),{id:J}}async createWorkflow(Y){return this._createWorkflow(this.db,Y)}async getWorkflow(Y){let X=await this.db.selectFrom("workflow").selectAll().where("id","=",Y).executeTakeFirst();return X?wI6(X):null}async createExecution(Y){return this.db.transaction().execute(async(X)=>{let J=Date.now(),{id:G}=await this._createWorkflow(X,{organizationId:Y.organizationId,workflowCollectionId:Y.workflowCollectionId,virtualMcpId:Y.virtualMcpId,input:Y.input,steps:Y.steps,createdBy:Y.createdBy}),W=crypto.randomUUID(),K=Y.startAtEpochMs??J,Z=Y.timeoutMs?K+Y.timeoutMs:null;return await X.insertInto("workflow_execution").values({id:W,workflow_id:G,organization_id:Y.organizationId,status:"enqueued",input:Y.input?JSON.stringify(Y.input):null,created_at:J,updated_at:J,start_at_epoch_ms:K,timeout_ms:Y.timeoutMs??null,deadline_at_epoch_ms:Z,created_by:Y.createdBy??null}).execute(),{id:W}})}async getExecution(Y,X){return await this.db.selectFrom("workflow_execution").selectAll().where("id","=",Y).where("organization_id","=",X).executeTakeFirst()??null}async getExecutionFull(Y,X){let J=await this.db.selectFrom("workflow_execution").selectAll().where("id","=",Y).where("organization_id","=",X).executeTakeFirst();if(!J)return null;let G=await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).execute();return{execution:J,stepResults:G.map(KO)}}async getExecutionContext(Y){let[X,J]=await Promise.all([this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").select(["we.id","we.status","we.workflow_id","we.deadline_at_epoch_ms","w.steps","w.input","w.virtual_mcp_id"]).where("we.id","=",Y).executeTakeFirst(),this.db.selectFrom("workflow_execution_step_result").select(["step_id","completed_at_epoch_ms","output","error"]).where("execution_id","=",Y).execute()]);if(!X)return null;return{execution:{id:X.id,status:X.status,workflow_id:X.workflow_id,deadline_at_epoch_ms:X.deadline_at_epoch_ms},workflow:{steps:NJ(X.steps)??[],input:NJ(X.input)??null,virtual_mcp_id:X.virtual_mcp_id},stepResults:J.map((G)=>({step_id:G.step_id,completed_at_epoch_ms:G.completed_at_epoch_ms,output:NJ(G.output),error:NJ(G.error)}))}}async claimExecution(Y){let X=Date.now(),J=await this.db.updateTable("workflow_execution").set({status:"running",updated_at:X}).where("id","=",Y).where("status","=","enqueued").returningAll().executeTakeFirst();if(!J)return null;let G=await this.getWorkflow(J.workflow_id);if(!G)throw Error(`Workflow ${J.workflow_id} not found for execution ${Y}`);return{execution:J,workflow:G}}async updateExecution(Y,X,J){let W={updated_at:Date.now()};if(X.status!==void 0)W.status=X.status;if(X.output!==void 0)W.output=JSON.stringify(X.output);if(X.error!==void 0)W.error=JSON.stringify(X.error);if(X.completed_at_epoch_ms!==void 0)W.completed_at_epoch_ms=X.completed_at_epoch_ms;let K=this.db.updateTable("workflow_execution").set(W).where("id","=",Y);if(J?.onlyIfStatus)K=K.where("status","=",J.onlyIfStatus);return await K.returningAll().executeTakeFirst()??null}async cancelExecution(Y,X){let J=Date.now();return!!await this.db.updateTable("workflow_execution").set({status:"cancelled",updated_at:J}).where("id","=",Y).where("organization_id","=",X).where("status","in",["enqueued","running"]).returningAll().executeTakeFirst()}async resumeExecution(Y,X){return this.db.transaction().execute(async(J)=>{let G=Date.now();if(!await J.updateTable("workflow_execution").set({status:"enqueued",updated_at:G,completed_at_epoch_ms:null,error:null}).where("id","=",Y).where("organization_id","=",X).where((K)=>K.or([K("status","=","cancelled"),K("status","=","error")])).returningAll().executeTakeFirst())return!1;return await J.deleteFrom("workflow_execution_step_result").where("execution_id","=",Y).where((K)=>K.or([K("completed_at_epoch_ms","is",null),K("error","is not",null)])).execute(),!0})}async listExecutions(Y,X={}){let{limit:J=50,offset:G=0,status:W}=X,K=this.db.selectFrom("workflow_execution as we").innerJoin("workflow as w","we.workflow_id","w.id").leftJoin("workflow_collection as wc","w.workflow_collection_id","wc.id").select(["we.id","we.workflow_id","we.organization_id","we.status","we.input","we.output","we.error","we.created_at","we.updated_at","we.start_at_epoch_ms","we.started_at_epoch_ms","we.completed_at_epoch_ms","we.timeout_ms","we.deadline_at_epoch_ms","we.created_by","w.virtual_mcp_id"]).select((V)=>V.fn.coalesce("wc.title",V.val("Workflow Execution")).as("title")).where("we.organization_id","=",Y);if(W)K=K.where("we.status","=",W);let Z=await K.orderBy("we.created_at","desc").limit(J).offset(G).execute(),Q=this.db.selectFrom("workflow_execution").select((V)=>V.fn.countAll().as("count")).where("organization_id","=",Y);if(W)Q=Q.where("status","=",W);let H=await Q.executeTakeFirstOrThrow(),$=Number(H.count);return{items:Z,totalCount:$,hasMore:G+Z.length<$}}async createStepResult(Y){let X=await this.db.insertInto("workflow_execution_step_result").values({execution_id:Y.execution_id,step_id:Y.step_id,started_at_epoch_ms:Y.completed_at_epoch_ms?Date.now():null,completed_at_epoch_ms:Y.completed_at_epoch_ms??null,output:Y.output!==void 0?JSON.stringify(Y.output):null,error:Y.error!==void 0?JSON.stringify(Y.error):null}).onConflict((J)=>J.columns(["execution_id","step_id"]).doNothing()).returningAll().executeTakeFirst();return X?KO(X):null}async updateStepResult(Y,X,J){let G={};if(J.output!==void 0)G.output=JSON.stringify(J.output);if(J.error!==void 0)G.error=JSON.stringify(J.error);if(J.started_at_epoch_ms!==void 0)G.started_at_epoch_ms=J.started_at_epoch_ms;if(J.completed_at_epoch_ms!==void 0)G.completed_at_epoch_ms=J.completed_at_epoch_ms;if(Object.keys(G).length===0)return null;let W=await this.db.updateTable("workflow_execution_step_result").set(G).where("execution_id","=",Y).where("step_id","=",X).returningAll().executeTakeFirst();return W?KO(W):null}async checkpointAndTransform(Y,X,J,G){await this.db.updateTable("workflow_execution_step_result").set({raw_tool_output:JSON.stringify(J)}).where("execution_id","=",Y).where("step_id","=",X).execute();let W,K;try{let H=await G(J);W=H.output,K=H.error}catch(H){K=H instanceof Error?`Transform failed: ${H.message}`:`Transform failed: ${String(H)}`}let Z={completed_at_epoch_ms:Date.now()};if(W!==void 0)Z.output=JSON.stringify(W);if(K!==void 0)Z.error=JSON.stringify(K);let Q=await this.db.updateTable("workflow_execution_step_result").set(Z).where("execution_id","=",Y).where("step_id","=",X).returningAll().executeTakeFirst();return Q?KO(Q):null}async getStepResult(Y,X){let J=await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).where("step_id","=",X).executeTakeFirst();return J?KO(J):null}async getStepResults(Y){return(await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).execute()).map(KO)}async deleteStepResult(Y,X){await this.db.deleteFrom("workflow_execution_step_result").where("execution_id","=",Y).where("step_id","=",X).execute()}async getStepResultsByPrefix(Y,X){return(await this.db.selectFrom("workflow_execution_step_result").selectAll().where("execution_id","=",Y).where("step_id","like",`${X}%`).orderBy("step_id").execute()).map(KO)}async recoverStuckExecutions(){return this.db.updateTable("workflow_execution").set({status:"enqueued",updated_at:Date.now()}).where("status","=","running").returning(["id","organization_id"]).execute()}}var B60=()=>{};function O60(Y){let X=Y.db;return{collections:new aF1(X),executions:new rF1(X)}}var N60=A(()=>{L60();B60()});var w60,M60,A60,P60,E60;var T60=A(()=>{Y0();pP();$X();w60={name:"COLLECTION_WORKFLOW_LIST",description:"List workflows with pagination. Does not include steps -- use GET for full details.",inputSchema:F.object({limit:F.number().optional().default(50),offset:F.number().optional().default(0)}),outputSchema:F.object({items:F.array(F.object({id:F.string(),title:F.string(),description:F.string().nullable(),virtual_mcp_id:F.string(),created_at:F.string(),updated_at:F.string()})),totalCount:F.number(),hasMore:F.boolean()}),handler:async(Y,X)=>{let J=QW(X);await J.access.check();let G=Y,W=wJ(),{items:K,totalCount:Z}=await W.collections.list(J.organization.id,{limit:G.limit,offset:G.offset});return{items:K.map((Q)=>({id:Q.id,title:Q.title,description:Q.description,virtual_mcp_id:Q.virtual_mcp_id,created_at:Q.created_at,updated_at:Q.updated_at})),totalCount:Z,hasMore:(G.offset??0)+K.length<Z}}},M60={name:"COLLECTION_WORKFLOW_GET",description:"Get a single workflow by ID, including its steps.",inputSchema:F.object({id:F.string()}),outputSchema:F.object({item:F.object({id:F.string(),title:F.string(),description:F.string().nullable(),virtual_mcp_id:F.string(),steps:F.array(pB),created_at:F.string(),updated_at:F.string()}).nullable()}),handler:async(Y,X)=>{let J=QW(X);await J.access.check();let{id:G}=Y,K=await wJ().collections.getById(G,J.organization.id);if(!K)return{item:null};return{item:{id:K.id,title:K.title,description:K.description,virtual_mcp_id:K.virtual_mcp_id,steps:K.steps,created_at:K.created_at,updated_at:K.updated_at}}}},A60={name:"COLLECTION_WORKFLOW_CREATE",description:`Create a workflow template. This is a reusable definition, not an execution.
|
|
374
374
|
|
|
375
375
|
Key concepts:
|
|
376
376
|
- Steps without references run immediately (in parallel).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2010 - 2021 Brian Carlson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# node-postgres
|
|
2
|
+
|
|
3
|
+
[](http://travis-ci.org/brianc/node-postgres)
|
|
4
|
+
<span class="badge-npmversion"><a href="https://npmjs.org/package/pg" title="View this project on NPM"><img src="https://img.shields.io/npm/v/pg.svg" alt="NPM version" /></a></span>
|
|
5
|
+
<span class="badge-npmdownloads"><a href="https://npmjs.org/package/pg" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/pg.svg" alt="NPM downloads" /></a></span>
|
|
6
|
+
|
|
7
|
+
Non-blocking PostgreSQL client for Node.js. Pure JavaScript and optional native libpq bindings.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
$ npm install pg
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## :star: [Documentation](https://node-postgres.com) :star:
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
- Pure JavaScript client and native libpq bindings share _the same API_
|
|
22
|
+
- Connection pooling
|
|
23
|
+
- Extensible JS ↔ PostgreSQL data-type coercion
|
|
24
|
+
- Supported PostgreSQL features
|
|
25
|
+
- Parameterized queries
|
|
26
|
+
- Named statements with query plan caching
|
|
27
|
+
- Async notifications with `LISTEN/NOTIFY`
|
|
28
|
+
- Bulk import & export with `COPY TO/COPY FROM`
|
|
29
|
+
|
|
30
|
+
### Extras
|
|
31
|
+
|
|
32
|
+
node-postgres is by design pretty light on abstractions. These are some handy modules we've been using over the years to complete the picture.
|
|
33
|
+
The entire list can be found on our [wiki](https://github.com/brianc/node-postgres/wiki/Extras).
|
|
34
|
+
|
|
35
|
+
## Support
|
|
36
|
+
|
|
37
|
+
node-postgres is free software. If you encounter a bug with the library please open an issue on the [GitHub repo](https://github.com/brianc/node-postgres). If you have questions unanswered by the documentation please open an issue pointing out how the documentation was unclear & I will do my best to make it better!
|
|
38
|
+
|
|
39
|
+
When you open an issue please provide:
|
|
40
|
+
|
|
41
|
+
- version of Node
|
|
42
|
+
- version of Postgres
|
|
43
|
+
- smallest possible snippet of code to reproduce the problem
|
|
44
|
+
|
|
45
|
+
You can also follow me [@briancarlson](https://twitter.com/briancarlson) if that's your thing. I try to always announce noteworthy changes & developments with node-postgres on Twitter.
|
|
46
|
+
|
|
47
|
+
## Sponsorship :two_hearts:
|
|
48
|
+
|
|
49
|
+
node-postgres's continued development has been made possible in part by generous financial support from [the community](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md).
|
|
50
|
+
|
|
51
|
+
If you or your company are benefiting from node-postgres and would like to help keep the project financially sustainable [please consider supporting](https://github.com/sponsors/brianc) its development.
|
|
52
|
+
|
|
53
|
+
### Featured sponsor
|
|
54
|
+
|
|
55
|
+
Special thanks to [medplum](https://medplum.com) for their generous and thoughtful support of node-postgres!
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
## Contributing
|
|
60
|
+
|
|
61
|
+
**:heart: contributions!**
|
|
62
|
+
|
|
63
|
+
I will **happily** accept your pull request if it:
|
|
64
|
+
|
|
65
|
+
- **has tests**
|
|
66
|
+
- looks reasonable
|
|
67
|
+
- does not break backwards compatibility
|
|
68
|
+
|
|
69
|
+
If your change involves breaking backwards compatibility please please point that out in the pull request & we can discuss & plan when and how to release it and what type of documentation or communicate it will require.
|
|
70
|
+
|
|
71
|
+
## Troubleshooting and FAQ
|
|
72
|
+
|
|
73
|
+
The causes and solutions to common errors can be found among the [Frequently Asked Questions (FAQ)](https://github.com/brianc/node-postgres/wiki/FAQ)
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
Copyright (c) 2010-2020 Brian Carlson (brian.m.carlson@gmail.com)
|
|
78
|
+
|
|
79
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
80
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
81
|
+
in the Software without restriction, including without limitation the rights
|
|
82
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
83
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
84
|
+
furnished to do so, subject to the following conditions:
|
|
85
|
+
|
|
86
|
+
The above copyright notice and this permission notice shall be included in
|
|
87
|
+
all copies or substantial portions of the Software.
|
|
88
|
+
|
|
89
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
90
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
91
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
92
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
93
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
94
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
95
|
+
THE SOFTWARE.
|