@decocms/mesh 2.117.0 → 2.119.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-BeDT_HtY.js → AlertCircle-Dcv7gp-I.js} +1 -1
- package/dist/client/assets/{AlertOctagon-QuXKgQ4Q.js → AlertOctagon-WUqMs46z.js} +1 -1
- package/dist/client/assets/{AlertTriangle-CpeNmzLj.js → AlertTriangle-CoVws0Do.js} +1 -1
- package/dist/client/assets/{ArrowLeft-C9FgjUgL.js → ArrowLeft-D34bf2DR.js} +1 -1
- package/dist/client/assets/{ArrowUp-CA_4TfDf.js → ArrowUp-D1Z3ZGMT.js} +1 -1
- package/dist/client/assets/{Check-CNueXKa4.js → Check-B6v8UYhw.js} +1 -1
- package/dist/client/assets/{CheckCircle-B30C7Ky0.js → CheckCircle-HtLjegW2.js} +1 -1
- package/dist/client/assets/{CheckDone01-DqdhuyiI.js → CheckDone01-Bd0reyKq.js} +1 -1
- package/dist/client/assets/{CheckVerified02-DMYVFl8x.js → CheckVerified02-Bk4SPa-V.js} +1 -1
- package/dist/client/assets/{ChevronDown-Dee8Rzkh.js → ChevronDown-RHEfxY7t.js} +1 -1
- package/dist/client/assets/{ChevronRight-BFKyuaLR.js → ChevronRight-CtfDv6KV.js} +1 -1
- package/dist/client/assets/{Clock-DcOt9vBU.js → Clock-Dd09ek7S.js} +1 -1
- package/dist/client/assets/{Code01-DIVdUEEy.js → Code01-bk_rrtBU.js} +1 -1
- package/dist/client/assets/{Container-Bdkg5Azu.js → Container-CMzzA9YA.js} +1 -1
- package/dist/client/assets/{Copy01-3VuAEFqa.js → Copy01-Cm4pdmsu.js} +1 -1
- package/dist/client/assets/{Dataflow03-DkdReOLA.js → Dataflow03-LkUhMtQK.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-Cm6mqww1.js → DotsHorizontal-CI9YTCjx.js} +1 -1
- package/dist/client/assets/{DotsVertical-By9o8N3R.js → DotsVertical-D_euv27G.js} +1 -1
- package/dist/client/assets/{Download01-CxQx0CfH.js → Download01-BLCuTA3o.js} +1 -1
- package/dist/client/assets/{Edit01-Dn0qA4Fa.js → Edit01-CWgM245j.js} +1 -1
- package/dist/client/assets/{Eye-DKDxswcA.js → Eye-CE7mKBNe.js} +1 -1
- package/dist/client/assets/{File02-DH9hOxy4.js → File02-ICiMggom.js} +1 -1
- package/dist/client/assets/{File06-VYjQ2z3_.js → File06-w124s0Yj.js} +1 -1
- package/dist/client/assets/{FilterLines-ynIeikqw.js → FilterLines-C_9_niv_.js} +1 -1
- package/dist/client/assets/{Globe01-DVxgQyR0.js → Globe01-A5I3f7rK.js} +1 -1
- package/dist/client/assets/{Globe02-b9LENZ6B.js → Globe02-RkDxZVVj.js} +1 -1
- package/dist/client/assets/{Grid01-DUtda9uA.js → Grid01-C8mqRkg1.js} +1 -1
- package/dist/client/assets/{Hash02-Dw_08A1w.js → Hash02-fxTBwD_m.js} +1 -1
- package/dist/client/assets/{Home02-ClPXGhcI.js → Home02-BXpHoQTc.js} +1 -1
- package/dist/client/assets/{Image01-C4HZ4Zao.js → Image01-DQLyBK8l.js} +1 -1
- package/dist/client/assets/{Inbox01-nMEKh3cP.js → Inbox01-BSel3biT.js} +1 -1
- package/dist/client/assets/{InfoCircle-CpJ9JrRf.js → InfoCircle-C_qDfuPt.js} +1 -1
- package/dist/client/assets/{Key01-ChuPC-p3.js → Key01-C0E2RPRQ.js} +1 -1
- package/dist/client/assets/{LinkExternal01-PWzAqpnw.js → LinkExternal01-DOmS5L3U.js} +1 -1
- package/dist/client/assets/{List-CKLUZ_VW.js → List-ChoGNa5p.js} +1 -1
- package/dist/client/assets/{Loading01-CamudhzM.js → Loading01-B5HJTtc0.js} +1 -1
- package/dist/client/assets/{Lock01-BeTJRb0k.js → Lock01-Y_aOvYlB.js} +1 -1
- package/dist/client/assets/{Pin01-Dz4KJ15m.js → Pin01-fdYVvyiL.js} +1 -1
- package/dist/client/assets/{Play-BGL_a2LJ.js → Play-CceuauhQ.js} +1 -1
- package/dist/client/assets/{Plus-SyEjnSE4.js → Plus-CRPlP_jA.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-CqYyfJ9G.js → RefreshCcw01-BrLEfK43.js} +1 -1
- package/dist/client/assets/{RefreshCw01-BSYC0kIK.js → RefreshCw01-DDRYQqjd.js} +1 -1
- package/dist/client/assets/{Rows03-CVpC9rtk.js → Rows03-CvkNcOMJ.js} +1 -1
- package/dist/client/assets/{Save01-DO1hEhxi.js → Save01-CuPUo8En.js} +1 -1
- package/dist/client/assets/{SearchMd-CcOZ3J1s.js → SearchMd-DBdGvvkJ.js} +1 -1
- package/dist/client/assets/{Settings01-CVcrQdKI.js → Settings01-BNTi5NiU.js} +1 -1
- package/dist/client/assets/{Shield01-ySArJjMl.js → Shield01-D2uet_XZ.js} +1 -1
- package/dist/client/assets/{Terminal-_VxivQ1F.js → Terminal-XYm-55WZ.js} +1 -1
- package/dist/client/assets/{Tool01-kjwZ_DfI.js → Tool01-BNr1hCcu.js} +1 -1
- package/dist/client/assets/{Trash01-CthEEWHa.js → Trash01-dBw88Tyb.js} +1 -1
- package/dist/client/assets/{Upload01-DGHq-B-f.js → Upload01-BqShC51I.js} +1 -1
- package/dist/client/assets/{Users03-C6wtpaWA.js → Users03-B_27GBWC.js} +1 -1
- package/dist/client/assets/{XCircle-CGrbp9z_.js → XCircle-DeSD2Nme.js} +1 -1
- package/dist/client/assets/{XClose-Ce3sBI6M.js → XClose-Dm4uRTid.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-DKNowgRk.js → agent-connections-preview-CFxXMoZI.js} +1 -1
- package/dist/client/assets/agent-detail-BGwIE9w0.js +2 -0
- package/dist/client/assets/{agents-CLA3FmYC.js → agents-DGXN72x8.js} +1 -1
- package/dist/client/assets/{alert-dialog-EoSV6_8V.js → alert-dialog-YO7F1UnW.js} +1 -1
- package/dist/client/assets/{auth-catchall-DKx2Jejf.js → auth-catchall-BFjwVkbi.js} +1 -1
- package/dist/client/assets/{avatar-L1PL1ayJ.js → avatar-CXlAe-d0.js} +1 -1
- package/dist/client/assets/{badge-CCE1KaWc.js → badge-HG4Wd9Mh.js} +1 -1
- package/dist/client/assets/{binder-BC9Wv1Ge.js → binder-gZKFqPm8.js} +1 -1
- package/dist/client/assets/{breadcrumb-DNYA-_ij.js → breadcrumb-CyS88-Ut.js} +1 -1
- package/dist/client/assets/{button-B7HyH-Uh.js → button-CVYD_l4f.js} +1 -1
- package/dist/client/assets/{card-C-0_lNug.js → card-BESAH6x0.js} +1 -1
- package/dist/client/assets/{checkbox-B2exkiKb.js → checkbox-CZ-w9z-K.js} +1 -1
- package/dist/client/assets/{circle-alert-t4DeJ--d.js → circle-alert-DxKlPZa9.js} +1 -1
- package/dist/client/assets/{collection-detail-B_yaQHdx.js → collection-detail-CQaDTYng.js} +1 -1
- package/dist/client/assets/{collection-tab-WrGrhfbg.js → collection-tab-C6CvbFAN.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-D0tfp6ae.js → collection-table-wrapper-DHsLzzwx.js} +1 -1
- package/dist/client/assets/{collection-tabs-C97wMcMs.js → collection-tabs-D7dYSph2.js} +1 -1
- package/dist/client/assets/{command-BICIAkBj.js → command-rnfIyzV8.js} +1 -1
- package/dist/client/assets/{connect-DobII6wG.js → connect-CY43AJJb.js} +1 -1
- package/dist/client/assets/{connection-card-DKiGEKqq.js → connection-card-BIBvjyy9.js} +1 -1
- package/dist/client/assets/{connection-detail-Czc0gPl-.js → connection-detail-BSMfitiZ.js} +1 -1
- package/dist/client/assets/{connections-CEzrYp9r.js → connections-CFWhXoRb.js} +1 -1
- package/dist/client/assets/{constants-zTlTQ-s2.js → constants-C7Ec6iJ9.js} +1 -1
- package/dist/client/assets/constants-D_v8WsQi.js +1 -0
- package/dist/client/assets/{create-organization-dialog-D3inyChm.js → create-organization-dialog-CgdOhXMu.js} +1 -1
- package/dist/client/assets/{create-project-dialog-DStWDJyz.js → create-project-dialog-C81f_5Rj.js} +1 -1
- package/dist/client/assets/{dialog-DZwwYB-k.js → dialog-VPGAGt8b.js} +1 -1
- package/dist/client/assets/{dropdown-menu-CjCphUtO.js → dropdown-menu-CFgggJR1.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-Do3oxBVH.js → dynamic-plugin-layout-ZnFuNGso.js} +1 -1
- package/dist/client/assets/{empty-state-DkqG8Hqu.js → empty-state-B_yeI3-8.js} +1 -1
- package/dist/client/assets/{empty-state-uNOuiWjX.js → empty-state-J0iNaH6o.js} +1 -1
- package/dist/client/assets/{env-vars-editor-D67dFx2L.js → env-vars-editor-BuXgYNmv.js} +1 -1
- package/dist/client/assets/{error-boundary-nhHtbH_I.js → error-boundary-Cw9mogkc.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BQcu6O4w.js → extract-connection-data-E0weV85e.js} +1 -1
- package/dist/client/assets/{file-browser--5zfCt9I.js → file-browser-sCHL9A-l.js} +2 -2
- package/dist/client/assets/{form-C__Se-gc.js → form-BVo4Hzsi.js} +1 -1
- package/dist/client/assets/{grid-view-DricZUwu.js → grid-view-guLzaDp8.js} +1 -1
- package/dist/client/assets/{home-CScbql-9.js → home-DOrtkQav.js} +1 -1
- package/dist/client/assets/{index-CZLAI6LF.js → index-C1U9FLFs.js} +1 -1
- package/dist/client/assets/{index-W9sjhIH3.js → index-CEFVWh1V.js} +1 -1
- package/dist/client/assets/{index-KAr3Peh7.js → index-CdvbUeMY.js} +1 -1
- package/dist/client/assets/{index-DCz2-LM2.js → index-Cgpi8OLK.js} +1 -1
- package/dist/client/assets/{index-D1HsOBPx.js → index-CsDBbm_y.js} +1 -1
- package/dist/client/assets/{index-BlyVvX4m.js → index-D3i0JpVn.js} +1 -1
- package/dist/client/assets/{index-BdZpvmLN.js → index-D6jt3Kr_.js} +1 -1
- package/dist/client/assets/{index-Bi-e0xzQ.js → index-DORq2iDV.js} +3 -3
- package/dist/client/assets/{index-Pglfh9Lp.css → index-LTKmnAwr.css} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-DNS00oad.js → infiniteQueryObserver-dJrk4KCF.js} +1 -1
- package/dist/client/assets/{input-CV0IyHA1.js → input-Bh5KX8XE.js} +1 -1
- package/dist/client/assets/{integration-icon-DbBoUTfS.js → integration-icon-BdGEh9QA.js} +1 -1
- package/dist/client/assets/{label-DJlc-dCS.js → label-DyOg7nzh.js} +1 -1
- package/dist/client/assets/{layout-BzWZWsG1.js → layout-BHHG3i-Y.js} +1 -1
- package/dist/client/assets/{localstorage-keys-kUhSSpkB.js → localstorage-keys-CCux6fjT.js} +1 -1
- package/dist/client/assets/{login-Bsyucgz_.js → login-CL6ai-T1.js} +1 -1
- package/dist/client/assets/{markdown-CLjWTZQW.js → markdown-CboA12Nd.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Cv-Vv7lB.js → mcp-oauth-BcBmIJkz.js} +1 -1
- package/dist/client/assets/{mcp-server-card-DsdRkuUr.js → mcp-server-card-oeessZZx.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-D0UXP2Wf.js → mcp-server-detail-ilOg-k_t.js} +2 -2
- package/dist/client/assets/{members-BetVYd73.js → members-CxeJ0faa.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-edit-Dz9ATxct.js → monitoring-dashboard-edit-D3Zv5EnU.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-view-CufWZm2V.js → monitoring-dashboard-view-i2EoV7O7.js} +1 -1
- package/dist/client/assets/{monitoring-DYNNygWn.js → monitoring-pq6iP8IO.js} +1 -1
- package/dist/client/assets/{oauth-callback-DcETJDHX.js → oauth-callback-mruvU8_Q.js} +1 -1
- package/dist/client/assets/page-MU3ZrOYG.js +1 -0
- package/dist/client/assets/{page-CwE-GYdz.js → page-SUnFSZe2.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-LXKnqiIZ.js → plugin-empty-state-BGVXlN99.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-C3ceUkNb.js → plugin-empty-state-FKGErfc3.js} +1 -1
- package/dist/client/assets/{plugin-header-Bs_1_ZLf.js → plugin-header-AzvPppMw.js} +1 -1
- package/dist/client/assets/{plugin-header-DPngncJX.js → plugin-header-CYSQypax.js} +1 -1
- package/dist/client/assets/{popover-Doa2WmZx.js → popover-DbRkjXcJ.js} +1 -1
- package/dist/client/assets/{project-layout-Chzqn7a8.js → project-layout-Xzi8hHvW.js} +1 -1
- package/dist/client/assets/{projects-list-DbbdsKoZ.js → projects-list-BSBHGQjq.js} +1 -1
- package/dist/client/assets/{ranking-layout-B9w-IUcw.js → ranking-layout-BiV09gtO.js} +1 -1
- package/dist/client/assets/{readme-viewer-B1hfMMDA.js → readme-viewer-CIbkQahX.js} +1 -1
- package/dist/client/assets/{registry-layout-pmNuLEj-.js → registry-layout-D1GPWf6h.js} +1 -1
- package/dist/client/assets/{registry-utils-DUuNgxkO.js → registry-utils-DbEnt6lf.js} +1 -1
- package/dist/client/assets/{reports-layout-C_VEjY7i.js → reports-layout-C4UCazNt.js} +1 -1
- package/dist/client/assets/{reset-password-DJ9buaXu.js → reset-password-BW5fMj5D.js} +1 -1
- package/dist/client/assets/{resizable-DF5zct6_.js → resizable-CHiJMo1_.js} +1 -1
- package/dist/client/assets/{save-actions-CQgOAn_J.js → save-actions-Bkd7XN5j.js} +1 -1
- package/dist/client/assets/{scroll-area-4enWoJt2.js → scroll-area-B27Z4ywl.js} +1 -1
- package/dist/client/assets/{select-DWD0v1iQ.js → select-jAphy_-Y.js} +1 -1
- package/dist/client/assets/{shell-layout-QL6x_YTa.js → shell-layout-BNjQGY2b.js} +1 -1
- package/dist/client/assets/{skeleton-Bl8OldYy.js → skeleton-B-gUpTJK.js} +1 -1
- package/dist/client/assets/{spinner-BLmAgQjq.js → spinner-CTHwgDFW.js} +1 -1
- package/dist/client/assets/{store-invite-hWU0qPjn.js → store-invite-uV1ADm6S.js} +1 -1
- package/dist/client/assets/{switch-Bbs0hJSB.js → switch-Bz-UbNfe.js} +1 -1
- package/dist/client/assets/{table-qdWaG6rv.js → table-oUu9PtOj.js} +1 -1
- package/dist/client/assets/{tasks-43KwpcUr.js → tasks-BbgjSYKX.js} +1 -1
- package/dist/client/assets/{textarea-BM9yIjbb.js → textarea-B4df3c-A.js} +1 -1
- package/dist/client/assets/{time-range-picker-BJw7emBI.js → time-range-picker-CYONyEzg.js} +1 -1
- package/dist/client/assets/{toggle-group-CBPaAms8.js → toggle-group-DKcaeoWn.js} +1 -1
- package/dist/client/assets/{tools-list-BZbKPMXf.js → tools-list-sjdDWTmZ.js} +1 -1
- package/dist/client/assets/{tooltip-BRqbDzB0.js → tooltip-4z3Dj1Ic.js} +1 -1
- package/dist/client/assets/{topbar-portal-DFVDwZxt.js → topbar-portal-LoTA5AY0.js} +1 -1
- package/dist/client/assets/{typewriter-title-DIjNHGtY.js → typewriter-title-DKa5565h.js} +1 -1
- package/dist/client/assets/{use-binding-BmXtAx4J.js → use-binding-JQRdy56n.js} +1 -1
- package/dist/client/assets/{use-connection-CClYhvEQ.js → use-connection-C7Ykn5We.js} +1 -1
- package/dist/client/assets/{use-copy-CTf1Ucv_.js → use-copy-BUr9JgMZ.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-K3AM9Z5N.js → use-create-virtual-mcp-CfhM_SAz.js} +1 -1
- package/dist/client/assets/{use-deco-chat-open-BMBO3145.js → use-deco-chat-open-uiDqNCbm.js} +7 -7
- package/dist/client/assets/{use-install-from-registry-BAWt0mcG.js → use-install-from-registry-CDxw1GCo.js} +1 -1
- package/dist/client/assets/{use-list-state-CCBTDGCJ.js → use-list-state-D5uNQEJf.js} +1 -1
- package/dist/client/assets/{use-llm-mBHjR_7D.js → use-llm-jw2BS-HP.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-CBDcBX2M.js → use-mcp-prompts-BIWdwpGe.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-BavCvJJV.js → use-mcp-tools-BPBUJeNd.js} +1 -1
- package/dist/client/assets/{use-mobile-DrHpoELT.js → use-mobile-aOwHFgFs.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CKyDGiTk.js → use-organization-settings-DMr0awSz.js} +1 -1
- package/dist/client/assets/{use-project-96IUPhFg.js → use-project-DfYNa3t-.js} +1 -1
- package/dist/client/assets/{use-settings-modal-D7JjTvmt.js → use-settings-modal-Cluj4Fcl.js} +1 -1
- package/dist/client/assets/{use-view-mode-BshQz6D5.js → use-view-mode-BKl_7npX.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-B-Bh55kx.js → use-virtual-mcp-ZHBbhgI3.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-ehcPTJqP.js +1 -0
- package/dist/client/assets/{useMutation-aO9r1_oG.js → useMutation-DIYvmP8t.js} +1 -1
- package/dist/client/assets/useQuery-psr46-dB.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-FMCIrxas.js +1 -0
- package/dist/client/assets/{workflow-Bo8vs7Cf.js → workflow-D02l7cpr.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +165 -165
- package/dist/server/migrate.js +144 -144
- package/dist/server/server.js +147 -147
- package/package.json +1 -1
- package/dist/client/assets/Share07-CiXbTaKB.js +0 -1
- package/dist/client/assets/agent-detail-JmY0Uz4k.js +0 -1
- package/dist/client/assets/constants-CG86Kieu.js +0 -1
- package/dist/client/assets/page-BAolWY3l.js +0 -1
- package/dist/client/assets/useInfiniteQuery-DkHP58UU.js +0 -1
- package/dist/client/assets/useQuery-BBSKX1go.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CHxgAZWb.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as T,bv as M,j as e,bw as P,y as q,r as R,t as h,e as O}from"./index-
|
|
1
|
+
import{c as T,bv as M,j as e,bw as P,y as q,r as R,t as h,e as O}from"./index-DORq2iDV.js";import{u as A}from"./useQuery-psr46-dB.js";import{u as _}from"./useMutation-DIYvmP8t.js";import{B as y}from"./button-CVYD_l4f.js";import{C as N,a as v}from"./card-BESAH6x0.js";import{i as L,a as U}from"./mcp-oauth-BcBmIJkz.js";import{c as C,C as K,a as w}from"./circle-alert-DxKlPZa9.js";const Q=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],D=C("external-link",Q);const H=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],k=C("loader-circle",H);const J=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],B=C("refresh-cw",J),Y=t=>{const n=T.c(6);let i;n[0]!==t?({...i}=t,n[0]=t,n[1]=i):i=n[1];const{theme:a}=M(),d=a===void 0?"system":a;let r;n[2]===Symbol.for("react.memo_cache_sentinel")?(r={"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},n[2]=r):r=n[2];let m;return n[3]!==i||n[4]!==d?(m=e.jsx(P,{theme:d,className:"toaster group",style:r,...i}),n[3]=i,n[4]=d,n[5]=m):m=n[5],m},b={session:t=>["user-sandbox-session",t]};function V({sessionId:t,onComplete:n,onError:i}){const a=q(),[p,d]=R.useState(null),{data:r,isLoading:m,error:j}=A({queryKey:b.session(t),queryFn:async()=>{const s=await fetch(`/api/user-sandbox/sessions/${t}`);if(!s.ok){const o=await s.json();throw new Error(o.error||"Failed to load session")}return s.json()}}),F=_({mutationFn:async({appName:s,connectionId:o})=>{const l=await fetch(`/api/user-sandbox/sessions/${t}/configure`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:s,connection_id:o})});if(!l.ok){const u=await l.json();throw new Error(u.error||"Configuration failed")}return l.json()},onSuccess:()=>{a.invalidateQueries({queryKey:b.session(t)})}}),x=_({mutationFn:async()=>{const s=await fetch(`/api/user-sandbox/sessions/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!s.ok){const o=await s.json();throw new Error(o.error||"Failed to complete")}return s.json()},onSuccess:s=>{s.redirectUrl?window.location.href=s.redirectUrl:(h.success("Setup complete!"),a.invalidateQueries({queryKey:b.session(t)}),n?.({agentId:s.agentId,redirectUrl:s.redirectUrl}))},onError:s=>{const o=s instanceof Error?s:new Error("Failed to complete");h.error(o.message),i?.(o)}}),S=async s=>{d(s.app_name);try{const o=await fetch(`/api/user-sandbox/sessions/${t}/provision`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:s.app_name})});if(!o.ok){const g=await o.json();throw new Error(g.error||"Failed to provision connection")}const u=(await o.json()).connection_id;if(s.connection_type==="HTTP"||s.connection_type==="SSE"||s.connection_type==="Websocket"){const g=`/mcp/${u}`,z=await L({url:g,token:null});if(!z.isAuthenticated&&z.supportsOAuth){h.info("Opening authentication window...");const c=await U({connectionId:u,clientName:s.title,timeout:3e5});if(c.error)throw new Error(c.error);if(c.tokenInfo){const E=await fetch(`/api/connections/${u}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:c.tokenInfo.accessToken,refreshToken:c.tokenInfo.refreshToken,expiresIn:c.tokenInfo.expiresIn,scope:c.tokenInfo.scope,clientId:c.tokenInfo.clientId,clientSecret:c.tokenInfo.clientSecret,tokenEndpoint:c.tokenInfo.tokenEndpoint})});if(!E.ok){const $=await E.json().catch(()=>({}));throw new Error($.error||"Failed to save authentication tokens. Please try again.")}}}}await F.mutateAsync({appName:s.app_name,connectionId:u}),h.success(`${s.title} connected successfully`)}catch(o){console.error("Connection error:",o);const l=o instanceof Error?o:new Error("Failed to connect");h.error(l.message),i?.(l)}finally{d(null)}},I=r?.apps.every(s=>s.status.configured),f=r?.session.status==="completed";return m?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(k,{className:"size-8 animate-spin text-muted-foreground"})}):j?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx(N,{className:"max-w-md w-full",children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[e.jsx("div",{className:"size-12 rounded-full bg-destructive/10 flex items-center justify-center",children:e.jsx(K,{className:"size-6 text-destructive"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Session Error"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:j instanceof Error?j.message:"Failed to load"})]})]})})})}):r?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(Y,{}),e.jsxs("div",{className:"max-w-lg mx-auto px-4 py-12",children:[e.jsxs("div",{className:"text-center mb-8",children:[r.template.icon&&e.jsx("div",{className:"size-16 mx-auto mb-4 rounded-xl bg-muted flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:r.template.icon,alt:"",className:"size-10 object-contain"})}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:r.template.title}),r.template.description&&e.jsx("p",{className:"text-muted-foreground mt-2",children:r.template.description})]}),f&&e.jsx(N,{className:"mb-6 border-green-500/20 bg-green-500/5",children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-10 rounded-full bg-green-500/10 flex items-center justify-center",children:e.jsx(w,{className:"size-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Setup Complete"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your integrations are ready to use."})]})]})})}),e.jsx("div",{className:"space-y-3",children:r.apps.map(s=>e.jsx(N,{children:e.jsx(v,{className:"py-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"size-10 rounded-lg bg-muted flex items-center justify-center shrink-0 overflow-hidden",children:s.icon?e.jsx("img",{src:s.icon,alt:"",className:"size-6 object-contain"}):e.jsx("span",{className:"text-lg",children:"📦"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.status.configured?e.jsxs("span",{className:"text-green-600 dark:text-green-400 flex items-center gap-1",children:[e.jsx(w,{className:"size-3"})," Connected"]}):s.requires_oauth?"Requires authentication":"Ready to connect"})]}),!s.status.configured&&!f&&e.jsx(y,{size:"sm",onClick:()=>S(s),disabled:p!==null||x.isPending,children:p===s.app_name?e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"size-4 mr-2 animate-spin"}),"Connecting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"size-4 mr-2"}),"Connect"]})}),s.status.configured&&!f&&e.jsxs(y,{size:"sm",variant:"outline",onClick:()=>S(s),disabled:p!==null||x.isPending,children:[e.jsx(B,{className:"size-4 mr-2"}),"Reconnect"]}),f&&e.jsx("div",{className:"size-8 rounded-full bg-green-500/10 flex items-center justify-center",children:e.jsx(w,{className:"size-4 text-green-500"})})]})})},s.app_name))}),I&&!f&&e.jsx("div",{className:"mt-6",children:e.jsx(y,{className:"w-full",size:"lg",onClick:()=>x.mutate(),disabled:x.isPending,children:x.isPending?e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"size-4 mr-2 animate-spin"}),"Completing..."]}):"Complete Setup"})}),e.jsx("div",{className:"mt-8 pt-6 border-t text-center",children:e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Session expires:"," ",new Date(r.session.expires_at).toLocaleString()]})})]})]}):null}function oe(){const t=T.c(3);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/connect/$sessionId"},t[0]=n):n=t[0];const{sessionId:i}=O(n);let a;return t[1]!==i?(a=e.jsx(V,{sessionId:i}),t[1]=i,t[2]=a):a=t[2],a}export{oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as $,j as t}from"./index-
|
|
1
|
+
import{c as $,j as t}from"./index-DORq2iDV.js";import{C as q}from"./card-BESAH6x0.js";import{c as N}from"./button-CVYD_l4f.js";import{I as B}from"./integration-icon-BdGEh9QA.js";function L(g){const e=$.c(46),{connection:s,onClick:C,headerActions:b,body:k,footer:y,className:I,size:A,fallbackIcon:w}=g,E=A===void 0?"md":A,i=E==="sm"?"p-4":"p-6",P=E==="sm"?"text-sm":"text-base",R=E==="sm"?"text-xs":"text-sm",S=C&&"hover:bg-muted/50";let l;e[0]!==I||e[1]!==S?(l=N("cursor-pointer transition-colors group overflow-hidden flex flex-col",S,I),e[0]=I,e[1]=S,e[2]=l):l=e[2];let o;e[3]!==i?(o=N("flex flex-col gap-4",i),e[3]=i,e[4]=o):o=e[4];let n;e[5]!==s.icon||e[6]!==s.title||e[7]!==w?(n=t.jsx(B,{icon:s.icon,name:s.title,size:"md",className:"shrink-0 shadow-sm",fallbackIcon:w}),e[5]=s.icon,e[6]=s.title,e[7]=w,e[8]=n):n=e[8];let c;e[9]!==b?(c=b&&t.jsx("div",{className:N("transition-opacity","opacity-0 group-hover:opacity-100"),onClick:F,children:b}),e[9]=b,e[10]=c):c=e[10];let r;e[11]!==c?(r=t.jsx("div",{className:"relative",children:c}),e[11]=c,e[12]=r):r=e[12];let a;e[13]!==n||e[14]!==r?(a=t.jsxs("div",{className:"flex items-start justify-between",children:[n,r]}),e[13]=n,e[14]=r,e[15]=a):a=e[15];let d;e[16]!==P?(d=N("font-medium text-foreground truncate",P),e[16]=P,e[17]=d):d=e[17];let m;e[18]!==s.title||e[19]!==d?(m=t.jsx("h3",{className:d,children:s.title}),e[18]=s.title,e[19]=d,e[20]=m):m=e[20];let f;e[21]!==R?(f=N("text-muted-foreground line-clamp-2",R),e[21]=R,e[22]=f):f=e[22];const _=s.description||"No description";let x;e[23]!==f||e[24]!==_?(x=t.jsx("p",{className:f,children:_}),e[23]=f,e[24]=_,e[25]=x):x=e[25];let p;e[26]!==m||e[27]!==x?(p=t.jsxs("div",{className:"flex flex-col gap-0",children:[m,x]}),e[26]=m,e[27]=x,e[28]=p):p=e[28];let h;e[29]!==k?(h=k&&t.jsx("div",{children:k}),e[29]=k,e[30]=h):h=e[30];let u;e[31]!==p||e[32]!==h||e[33]!==o||e[34]!==a?(u=t.jsxs("div",{className:o,children:[a,p,h]}),e[31]=p,e[32]=h,e[33]=o,e[34]=a,e[35]=u):u=e[35];let j;e[36]!==y||e[37]!==i?(j=y&&t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:N("h-14 flex items-center",i),onClick:D,children:y})}),e[36]=y,e[37]=i,e[38]=j):j=e[38];let v;e[39]!==u||e[40]!==j?(v=t.jsxs("div",{className:"flex flex-col flex-1",children:[u,j]}),e[39]=u,e[40]=j,e[41]=v):v=e[41];let z;return e[42]!==C||e[43]!==v||e[44]!==l?(z=t.jsx(q,{className:l,onClick:C,children:v}),e[42]=C,e[43]=v,e[44]=l,e[45]=z):z=e[45],z}function D(g){return g.stopPropagation()}function F(g){return g.stopPropagation()}export{L as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as X,j as t,b as Re,O as Se,aE as at,u as ct,bA as Ge,ai as vt,p as yt,by as Xe,r as Y,o as lt,b8 as Nt,bg as _t,s as W,aj as Je,ak as Ct,e as St,a as wt,y as Tt,k as kt,l as Pt,i as It,t as Ce,K as Ye}from"./index-Bi-e0xzQ.js";import{E as Ne,C as dt}from"./empty-state-uNOuiWjX.js";import{E as mt}from"./error-boundary-nhHtbH_I.js";import{E as $t,r as At,e as ut}from"./env-vars-editor-D67dFx2L.js";import{P as Ke}from"./index-BlyVvX4m.js";import{S as Vt}from"./save-actions-CQgOAn_J.js";import{b as Mt,a as Dt}from"./use-binding-BmXtAx4J.js";import{u as Ot,S as Et}from"./index-D1HsOBPx.js";import{f as We,g as pt}from"./use-connection-CClYhvEQ.js";import{u as Rt}from"./constants-zTlTQ-s2.js";import{d as Lt}from"./use-mcp-tools-BavCvJJV.js";import{b as Ut,d as Ft}from"./use-mcp-prompts-CBDcBX2M.js";import{a as Bt}from"./mcp-oauth-Cv-Vv7lB.js";import{b as Ze,c as zt,d as Xt,e as Kt,B as Wt,a as qt}from"./breadcrumb-DNYA-_ij.js";import{B as Be}from"./button-B7HyH-Uh.js";import{C as Ht}from"./collection-tabs-C97wMcMs.js";import{i as Ee}from"./Loading01-CamudhzM.js";import{V as qe,a as Qt}from"./layout-BzWZWsG1.js";import{C as Gt}from"./collection-tab-WrGrhfbg.js";import{I as Le}from"./integration-icon-DbBoUTfS.js";import{B as ze}from"./badge-CCE1KaWc.js";import{D as Jt,a as Yt,b as Zt,c as et}from"./dropdown-menu-CjCphUtO.js";import{F as G,a as es,b as J,d as q,f as Z,c as te,e as ts}from"./form-C__Se-gc.js";import{I as ee}from"./input-CV0IyHA1.js";import{S as tt,a as st,b as nt,c as ot,d as Q}from"./select-DWD0v1iQ.js";import{i as ft}from"./CheckCircle-B30C7Ky0.js";import{t as ss}from"./ChevronDown-Dee8Rzkh.js";import{n as ns}from"./Container-Bdkg5Azu.js";import{s as Oe}from"./Globe02-b9LENZ6B.js";import{s as os}from"./RefreshCcw01-CqYyfJ9G.js";import{i as rs}from"./Terminal-_VxivQ1F.js";import{s as is}from"./Trash01-CthEEWHa.js";import{t as He}from"./Users03-C6wtpaWA.js";import{s as as}from"./XClose-Ce3sBI6M.js";import{U as cs}from"./use-list-state-CCBTDGCJ.js";import{b as ls,a as ds}from"./use-virtual-mcp-B-Bh55kx.js";import{i as ms}from"./ChevronRight-BFKyuaLR.js";import{s as us}from"./Plus-SyEjnSE4.js";import{f as ps}from"./formatDistanceToNow-Cb2QZZJn.js";import{a as xt,C as ht}from"./collection-table-wrapper-D0tfp6ae.js";import{C as gt}from"./card-C-0_lNug.js";import{R as fs}from"./readme-viewer-B1hfMMDA.js";import{a as xs}from"./tools-list-BZbKPMXf.js";import"./SearchMd-CcOZ3J1s.js";import"./AlertTriangle-CpeNmzLj.js";import"./tooltip-BRqbDzB0.js";import"./Pin01-Dz4KJ15m.js";import"./use-organization-settings-CKyDGiTk.js";import"./useMutation-aO9r1_oG.js";import"./Save01-DO1hEhxi.js";import"./binder-BC9Wv1Ge.js";import"./File06-VYjQ2z3_.js";import"./Key01-ChuPC-p3.js";import"./constants-CG86Kieu.js";import"./registry-utils-DUuNgxkO.js";import"./extract-connection-data-BQcu6O4w.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-BAWt0mcG.js";import"./index-CZLAI6LF.js";import"./circle-alert-t4DeJ--d.js";import"./index-DCz2-LM2.js";import"./index-W9sjhIH3.js";import"./use-deco-chat-open-BMBO3145.js";import"./use-llm-mBHjR_7D.js";import"./useQuery-BBSKX1go.js";import"./localstorage-keys-kUhSSpkB.js";import"./skeleton-Bl8OldYy.js";import"./popover-Doa2WmZx.js";import"./Grid01-DUtda9uA.js";import"./Image01-C4HZ4Zao.js";import"./Settings01-CVcrQdKI.js";import"./useSuspenseInfiniteQuery-CHxgAZWb.js";import"./infiniteQueryObserver-DNS00oad.js";import"./spinner-BLmAgQjq.js";import"./dialog-DZwwYB-k.js";import"./usage-B8eRkRZY.js";import"./ArrowUp-CA_4TfDf.js";import"./Edit01-Dn0qA4Fa.js";import"./XCircle-CGrbp9z_.js";import"./AlertCircle-BeDT_HtY.js";import"./ArrowLeft-C9FgjUgL.js";import"./use-copy-CTf1Ucv_.js";import"./Check-CNueXKa4.js";import"./Code01-DIVdUEEy.js";import"./use-create-virtual-mcp-K3AM9Z5N.js";import"./marked.esm-BaswSlok.js";import"./markdown-CLjWTZQW.js";import"./Copy01-3VuAEFqa.js";import"./Clock-DcOt9vBU.js";import"./index-KAr3Peh7.js";import"./use-mobile-DrHpoELT.js";import"./DotsVertical-By9o8N3R.js";import"./Eye-DKDxswcA.js";import"./empty-state-DkqG8Hqu.js";import"./Inbox01-nMEKh3cP.js";import"./alert-dialog-EoSV6_8V.js";import"./label-DJlc-dCS.js";import"./avatar-L1PL1ayJ.js";import"./use-view-mode-BshQz6D5.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./List-CKLUZ_VW.js";import"./table-qdWaG6rv.js";import"./RefreshCw01-BSYC0kIK.js";function hs(s){const e=X.c(14),{virtualMcp:n,org:o}=s;let r;e[0]!==o||e[1]!==n.id?(r={org:o,project:Se,agentId:n.id},e[0]=o,e[1]=n.id,e[2]=r):r=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(He,{size:16}),e[3]=a):a=e[3];let c;e[4]!==n.icon||e[5]!==n.title?(c=t.jsx(Le,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:a}),e[4]=n.icon,e[5]=n.title,e[6]=c):c=e[6];let u;e[7]!==n.title?(u=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[7]=n.title,e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ms,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[9]=f):f=e[9];let l;return e[10]!==r||e[11]!==c||e[12]!==u?(l=t.jsxs(at,{to:"/$org/$project/agents/$agentId",params:r,className:"flex items-center gap-3 p-2 pr-1 rounded-lg hover:bg-muted/50 transition-colors group",children:[c,u,f]}),e[10]=r,e[11]=c,e[12]=u,e[13]=l):l=e[13],l}function rt(s){const e=X.c(20),{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:a,org:c,hasExistingVirtualMcps:u}=s,f=Re(),l=ds();let x;e[0]!==l.create||e[1]!==r||e[2]!==a||e[3]!==n||e[4]!==o||e[5]!==f||e[6]!==c?(x=async()=>{const m=await l.create.mutateAsync({title:`${o} Agent`,description:r??null,icon:a??null,status:"active",connections:[{connection_id:n,selected_tools:null,selected_resources:null,selected_prompts:null}]});f({to:"/$org/$project/agents/$agentId",params:{org:c,project:Se,agentId:m.id}})},e[0]=l.create,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=f,e[6]=c,e[7]=x):x=e[7];const p=x;if(u){let m;e[8]!==l.create.isPending?(m=l.create.isPending?t.jsx(Ee,{size:16,className:"animate-spin"}):t.jsx(us,{size:16}),e[8]=l.create.isPending,e[9]=m):m=e[9];let d;return e[10]!==l.create.isPending||e[11]!==p||e[12]!==m?(d=t.jsx(Be,{variant:"ghost",className:"size-6 p-0",onClick:p,disabled:l.create.isPending,children:m}),e[10]=l.create.isPending,e[11]=p,e[12]=m,e[13]=d):d=e[13],d}let i;e[14]!==l.create.isPending?(i=l.create.isPending?t.jsx(Ee,{className:"animate-spin text-muted-foreground"}):t.jsx(He,{className:"size-3 text-muted-foreground"}),e[14]=l.create.isPending,e[15]=i):i=e[15];let b;return e[16]!==l.create.isPending||e[17]!==p||e[18]!==i?(b=t.jsxs(Be,{variant:"outline",size:"sm",onClick:p,disabled:l.create.isPending,children:[i,"Create an agent"]}),e[16]=l.create.isPending,e[17]=p,e[18]=i,e[19]=b):b=e[19],b}function gs(s){const e=X.c(26),{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:a,org:c}=s;let u;e[0]!==n?(u={filters:[{column:"connection_id",value:n}]},e[0]=n,e[1]=u):u=e[1];const f=ls(u);if(!(f.length>0)){let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Use in your IDE"}),e[2]=d):d=e[2];let j;return e[3]!==r||e[4]!==a||e[5]!==n||e[6]!==o||e[7]!==c?(j=t.jsxs("div",{className:"p-5 flex items-center justify-between gap-3",children:[d,t.jsx(rt,{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:a,org:c,hasExistingVirtualMcps:!1})]}),e[3]=r,e[4]=a,e[5]=n,e[6]=o,e[7]=c,e[8]=j):j=e[8],j}let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Agents"}),e[9]=x):x=e[9];let p;e[10]!==r||e[11]!==a||e[12]!==n||e[13]!==o||e[14]!==c?(p=t.jsx("div",{className:"flex flex-col gap-1",children:t.jsxs("div",{className:"flex items-center justify-between",children:[x,t.jsx(rt,{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:a,org:c,hasExistingVirtualMcps:!0})]})}),e[10]=r,e[11]=a,e[12]=n,e[13]=o,e[14]=c,e[15]=p):p=e[15];let i;if(e[16]!==c||e[17]!==f){let d;e[19]!==c?(d=j=>t.jsx(hs,{virtualMcp:j,org:c},j.id),e[19]=c,e[20]=d):d=e[20],i=f.map(d),e[16]=c,e[17]=f,e[18]=i}else i=e[18];let b;e[21]!==i?(b=t.jsx("div",{className:"flex flex-col gap-2",children:i}),e[21]=i,e[22]=b):b=e[22];let m;return e[23]!==p||e[24]!==b?(m=t.jsxs("div",{className:"p-5 flex flex-col gap-3",children:[p,b]}),e[23]=p,e[24]=b,e[25]=m):m=e[25],m}function js({form:s,connection:e,hasOAuthToken:n,onReauthenticate:o,onRemoveOAuth:r}){const a=Ge({control:s.control,name:"ui_type"}),c=Ge({control:s.control,name:"connection_url"}),{stdioEnabled:u}=vt(),f=(()=>{if(typeof c!="string"||!c)return!1;try{const i=new URL(c);return i.hostname==="api.githubcopilot.com"&&i.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),l=u||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?yt(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(He,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[t.jsx(G,{control:s.control,name:"ui_type",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),a!=="NPX"&&a!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(tt,{value:i.value,onValueChange:i.onChange,children:[t.jsx(q,{children:t.jsxs(st,{className:"h-10 w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(Oe,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(nt,{})]})}),t.jsxs(ot,{children:[t.jsx(Q,{value:"HTTP",children:"HTTP"}),t.jsx(Q,{value:"SSE",children:"SSE"}),t.jsx(Q,{value:"Websocket",children:"Websocket"}),l&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{value:"NPX",children:"NPX Package"}),t.jsx(Q,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(G,{control:s.control,name:"connection_url",render:({field:b})=>t.jsx(J,{className:"flex-1 min-w-0",children:t.jsx(q,{children:t.jsx(ee,{placeholder:"https://example.com/mcp",...b,value:b.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(tt,{value:i.value,onValueChange:i.onChange,children:[t.jsx(q,{children:t.jsx(st,{className:"h-10",children:t.jsx(nt,{})})}),t.jsxs(ot,{children:[t.jsx(Q,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Oe,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(Q,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Oe,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(Q,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Oe,{className:"w-4 h-4"}),"Websocket"]})}),l&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ns,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(Q,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(rs,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(Z,{})]})}),a==="NPX"&&t.jsx(G,{control:s.control,name:"npx_package",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(q,{children:t.jsx(ee,{placeholder:"@perplexity-ai/mcp-server",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx(Z,{})]})}),a==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(G,{control:s.control,name:"stdio_command",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(q,{children:t.jsx(ee,{placeholder:"node, bun, python...",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx(Z,{})]})}),t.jsx(G,{control:s.control,name:"stdio_args",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(q,{children:t.jsx(ee,{placeholder:"arg1 arg2 --flag value",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(Z,{})]})})]}),t.jsx(G,{control:s.control,name:"stdio_cwd",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(q,{children:t.jsx(ee,{placeholder:"/path/to/project (optional)",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx(Z,{})]})})]}),(a==="NPX"||a==="STDIO")&&t.jsx(G,{control:s.control,name:"env_vars",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(q,{children:t.jsx($t,{value:i.value??[],onChange:i.onChange})}),t.jsx(Z,{})]})}),a!=="NPX"&&a!=="STDIO"&&t.jsx(G,{control:s.control,name:"connection_token",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:f?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Jt,{children:[t.jsx(Yt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(ze,{variant:"success",className:"gap-1.5",children:[t.jsx(ft,{size:12}),"Authenticated via OAuth",t.jsx(ss,{size:12})]})})}),t.jsxs(Zt,{align:"start",children:[t.jsxs(et,{onClick:o,children:[t.jsx(os,{size:16}),"Re-authenticate"]}),t.jsxs(et,{variant:"destructive",onClick:r,children:[t.jsx(is,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&i.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>i.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(as,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(ee,{type:"password",placeholder:f?"Paste your GitHub PAT":"Enter access token...",...i,value:i.value||"",className:"h-10 rounded-lg"})}),f&&t.jsxs(ts,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(Z,{})]})})]})}function bs(s){const e=X.c(43),{form:n,connection:o,isMCPAuthenticated:r,hasOAuthToken:a,onReauthenticate:c,onRemoveOAuth:u}=s,{org:f}=ct();let l;e[0]!==o.icon||e[1]!==o.title?(l=t.jsx(Le,{icon:o.icon,name:o.title,size:"lg",className:"shadow-sm"}),e[0]=o.icon,e[1]=o.title,e[2]=l):l=e[2];let x;e[3]!==n.control?(x=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(G,{control:n.control,name:"title",render:ys}),t.jsx(G,{control:n.control,name:"description",render:vs})]}),e[3]=n.control,e[4]=x):x=e[4];let p;e[5]!==l||e[6]!==x?(p=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[l,x]}),e[5]=l,e[6]=x,e[7]=p):p=e[7];let i;e[8]!==o||e[9]!==n||e[10]!==a||e[11]!==c||e[12]!==u?(i=t.jsx(js,{form:n,connection:o,hasOAuthToken:a,onReauthenticate:c,onRemoveOAuth:u}),e[8]=o,e[9]=n,e[10]=a,e[11]=c,e[12]=u,e[13]=i):i=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Status"}),e[14]=b):b=e[14];let m;e[15]!==r?(m=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[b,r?t.jsxs(ze,{variant:"success",className:"gap-1.5 bg-success-foreground text-success",children:[t.jsx(ft,{size:12}),"Connected"]}):t.jsx(ze,{variant:"outline",className:"text-muted-foreground",children:"Not connected"})]}),e[15]=r,e[16]=m):m=e[16];let d;e[17]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Created by"}),e[17]=d):d=e[17];let j;e[18]!==o.created_by?(j=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[d,t.jsx(cs,{id:o.created_by,size:"2xs"})]}),e[18]=o.created_by,e[19]=j):j=e[19];let T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Updated"}),e[20]=T):T=e[20];let v;e[21]!==o.updated_at?(v=o.updated_at?ps(new Date(o.updated_at),{addSuffix:!0}):"Unknown",e[21]=o.updated_at,e[22]=v):v=e[22];let N;e[23]!==v?(N=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[T,t.jsx("span",{className:"text-sm text-foreground",children:v})]}),e[23]=v,e[24]=N):N=e[24];let _;e[25]!==N||e[26]!==m||e[27]!==j?(_=t.jsxs("div",{className:"flex flex-col gap-2 p-5 border-b border-border",children:[m,j,N]}),e[25]=N,e[26]=m,e[27]=j,e[28]=_):_=e[28];let y;e[29]!==o.description||e[30]!==o.icon||e[31]!==o.id||e[32]!==o.title||e[33]!==f.slug?(y=t.jsx(gs,{connectionId:o.id,connectionTitle:o.title,connectionDescription:o.description,connectionIcon:o.icon,org:f.slug}),e[29]=o.description,e[30]=o.icon,e[31]=o.id,e[32]=o.title,e[33]=f.slug,e[34]=y):y=e[34];let h;e[35]!==_||e[36]!==y||e[37]!==p||e[38]!==i?(h=t.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[p,i,_,y]}),e[35]=_,e[36]=y,e[37]=p,e[38]=i,e[39]=h):h=e[39];let k;return e[40]!==n||e[41]!==h?(k=t.jsx(es,{...n,children:h}),e[40]=n,e[41]=h,e[42]=k):k=e[42],k}function vs(s){const{field:e}=s;return t.jsxs(J,{className:"w-full space-y-0",children:[t.jsx(q,{children:t.jsx(ee,{...e,value:e.value||"",className:"h-auto py-0.5 text-base text-muted-foreground leading-6 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})}),t.jsx(Z,{})]})}function ys(s){const{field:e}=s;return t.jsxs(J,{className:"flex-1 space-y-0",children:[t.jsx(q,{children:t.jsx(ee,{...e,className:"h-auto py-0.5 text-lg! font-medium leading-7 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Connection Name"})}),t.jsx(Z,{})]})}function Ns(s){const e=X.c(42),{prompts:n,connectionId:o,org:r,connectionTitle:a,connectionIcon:c,onPromptClick:u,showToolbar:f,emptyMessage:l}=s,x=f===void 0?!0:f,p=l===void 0?"This connection doesn't have any prompts yet.":l,i=Re(),m=Xe().location.href,[d,j]=Y.useState(""),[T,v]=Y.useState("table"),[N,_]=Y.useState("name"),[y,h]=Y.useState("asc");let k;e[0]!==y||e[1]!==N?(k=S=>{N===S?(h(Ts),y==="desc"&&_(void 0)):(_(S),h("asc"))},e[0]=y,e[1]=N,e[2]=k):k=e[2];const B=k;let $;e[3]!==o||e[4]!==i||e[5]!==u||e[6]!==r?($=S=>{u?u(S):o&&r&&i({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:Se,connectionId:o,collectionName:"prompts",itemId:encodeURIComponent(S.name)}})},e[3]=o,e[4]=i,e[5]=u,e[6]=r,e[7]=$):$=e[7];const M=$;let A;if(e[8]!==n||e[9]!==d||e[10]!==y||e[11]!==N){const S=!n||n.length===0?[]:d.trim()?(()=>{const H=d.toLowerCase();return n.filter(K=>K.name.toLowerCase().includes(H)||K.description&&K.description.toLowerCase().includes(H))})():n;A=!N||!y?S:[...S].sort((H,K)=>{const se=H[N]||"",ne=K[N]||"",oe=String(se).localeCompare(String(ne));return y==="asc"?oe:-oe}),e[8]=n,e[9]=d,e[10]=y,e[11]=N,e[12]=A}else A=e[12];const I=A;let R;e[13]===Symbol.for("react.memo_cache_sentinel")?(R=[{id:"name",header:"Name",render:ws,sortable:!0},{id:"description",header:"Description",render:Ss,cellClassName:"flex-1",sortable:!0}],e[13]=R):R=e[13];const L=R;let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=L.filter(Cs).map(_s),e[14]=C):C=e[14];const z=C;let P;e[15]!==c||e[16]!==a||e[17]!==B||e[18]!==x||e[19]!==y||e[20]!==N||e[21]!==m||e[22]!==T?(P=x&&t.jsxs(qe,{children:[t.jsx(ht,{viewMode:T,onViewModeChange:v,sortKey:N,sortDirection:y,onSort:B,sortOptions:z}),t.jsx(Ke,{title:a?`${a}: Prompts`:"Prompts",url:m,icon:c??"description"})]}),e[15]=c,e[16]=a,e[17]=B,e[18]=x,e[19]=y,e[20]=N,e[21]=m,e[22]=T,e[23]=P):P=e[23];let D;e[24]===Symbol.for("react.memo_cache_sentinel")?(D=S=>{S.key==="Escape"&&(j(""),S.target.blur())},e[24]=D):D=e[24];let V;e[25]!==d?(V=t.jsx(dt,{value:d,onChange:j,placeholder:"Search prompts...",onKeyDown:D}),e[25]=d,e[26]=V):V=e[26];let g;e[27]!==p||e[28]!==M||e[29]!==B||e[30]!==d||e[31]!==y||e[32]!==N||e[33]!==I||e[34]!==T?(g=T==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:I.length===0?t.jsx(Ne,{image:null,title:d?"No prompts found":"No prompts available",description:d?"Try adjusting your search terms":p}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:I.map(S=>t.jsx(gt,{className:"cursor-pointer transition-colors",onClick:()=>M(S),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Le,{icon:null,name:S.name,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:S.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:S.description||"No description"})]})]})},S.name))})}):t.jsx(xt,{columns:L,data:I,isLoading:!1,sortKey:N,sortDirection:y,onSort:B,onRowClick:S=>M(S),emptyState:t.jsx(Ne,{image:null,title:d?"No prompts found":"No prompts available",description:d?"Try adjusting your search terms":p})}),e[27]=p,e[28]=M,e[29]=B,e[30]=d,e[31]=y,e[32]=N,e[33]=I,e[34]=T,e[35]=g):g=e[35];let F;e[36]!==V||e[37]!==g?(F=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[V,g]}),e[36]=V,e[37]=g,e[38]=F):F=e[38];let O;return e[39]!==F||e[40]!==P?(O=t.jsxs(t.Fragment,{children:[P,F]}),e[39]=F,e[40]=P,e[41]=O):O=e[41],O}function _s(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function Cs(s){return s.sortable}function Ss(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function ws(s){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:s.name})}function Ts(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function ks(s){const e=X.c(6),{prompts:n,connectionId:o,org:r}=s,a=We(o),c=a?.title,u=a?.icon;let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==c||e[4]!==u?(f=t.jsx(Ns,{prompts:n,connectionId:o,org:r,connectionTitle:c,connectionIcon:u}),e[0]=o,e[1]=r,e[2]=n,e[3]=c,e[4]=u,e[5]=f):f=e[5],f}function Ps(s){const e=X.c(2),{repository:n}=s;let o;return e[0]!==n?(o=t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(fs,{repository:n})}),e[0]=n,e[1]=o):o=e[1],o}function Is(s){const e=X.c(39),{resources:n,connectionTitle:o,connectionIcon:r,onResourceClick:a,showToolbar:c,emptyMessage:u}=s,f=c===void 0?!0:c,l=u===void 0?"This connection doesn't have any resources yet.":u,p=Xe().location.href,[i,b]=Y.useState(""),[m,d]=Y.useState("table"),[j,T]=Y.useState("name"),[v,N]=Y.useState("asc");let _;e[0]!==v||e[1]!==j?(_=g=>{j===g?(N(Es),v==="desc"&&T(void 0)):(T(g),N("asc"))},e[0]=v,e[1]=j,e[2]=_):_=e[2];const y=_;let h;e[3]!==a?(h=g=>{a&&a(g)},e[3]=a,e[4]=h):h=e[4];const k=h;let B;if(e[5]!==n||e[6]!==i||e[7]!==v||e[8]!==j){const g=!n||n.length===0?[]:i.trim()?(()=>{const F=i.toLowerCase();return n.filter(O=>O.uri.toLowerCase().includes(F)||O.name&&O.name.toLowerCase().includes(F)||O.description&&O.description.toLowerCase().includes(F))})():n;B=!j||!v?g:[...g].sort((F,O)=>{const S=F[j]||"",H=O[j]||"",K=String(S).localeCompare(String(H));return v==="asc"?K:-K}),e[5]=n,e[6]=i,e[7]=v,e[8]=j,e[9]=B}else B=e[9];const $=B;let M;e[10]===Symbol.for("react.memo_cache_sentinel")?(M=[{id:"name",header:"Name",render:Os,sortable:!0},{id:"uri",header:"URI",render:Ds,sortable:!0},{id:"description",header:"Description",render:Ms,cellClassName:"flex-1",sortable:!0},{id:"mimeType",header:"Type",render:Vs,sortable:!0}],e[10]=M):M=e[10];const A=M;let I;e[11]===Symbol.for("react.memo_cache_sentinel")?(I=A.filter(As).map($s),e[11]=I):I=e[11];const R=I;let L;e[12]!==r||e[13]!==o||e[14]!==y||e[15]!==f||e[16]!==v||e[17]!==j||e[18]!==p||e[19]!==m?(L=f&&t.jsxs(qe,{children:[t.jsx(ht,{viewMode:m,onViewModeChange:d,sortKey:j,sortDirection:v,onSort:y,sortOptions:R}),t.jsx(Ke,{title:o?`${o}: Resources`:"Resources",url:p,icon:r??"folder"})]}),e[12]=r,e[13]=o,e[14]=y,e[15]=f,e[16]=v,e[17]=j,e[18]=p,e[19]=m,e[20]=L):L=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=g=>{g.key==="Escape"&&(b(""),g.target.blur())},e[21]=C):C=e[21];let z;e[22]!==i?(z=t.jsx(dt,{value:i,onChange:b,placeholder:"Search resources...",onKeyDown:C}),e[22]=i,e[23]=z):z=e[23];let P;e[24]!==l||e[25]!==k||e[26]!==y||e[27]!==i||e[28]!==v||e[29]!==j||e[30]!==$||e[31]!==m?(P=m==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:$.length===0?t.jsx(Ne,{image:null,title:i?"No resources found":"No resources available",description:i?"Try adjusting your search terms":l}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:$.map(g=>t.jsx(gt,{className:"cursor-pointer transition-colors",onClick:()=>k(g),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Le,{icon:null,name:g.name||g.uri,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:g.name||g.uri}),t.jsx("p",{className:"text-xs font-mono text-muted-foreground truncate",children:g.uri}),g.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:g.description})]})]})},g.uri))})}):t.jsx(xt,{columns:A,data:$,isLoading:!1,sortKey:j,sortDirection:v,onSort:y,onRowClick:g=>k(g),emptyState:t.jsx(Ne,{image:null,title:i?"No resources found":"No resources available",description:i?"Try adjusting your search terms":l})}),e[24]=l,e[25]=k,e[26]=y,e[27]=i,e[28]=v,e[29]=j,e[30]=$,e[31]=m,e[32]=P):P=e[32];let D;e[33]!==z||e[34]!==P?(D=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[z,P]}),e[33]=z,e[34]=P,e[35]=D):D=e[35];let V;return e[36]!==D||e[37]!==L?(V=t.jsxs(t.Fragment,{children:[L,D]}),e[36]=D,e[37]=L,e[38]=V):V=e[38],V}function $s(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function As(s){return s.sortable}function Vs(s){return t.jsx("span",{className:"text-sm text-muted-foreground",children:s.mimeType||"—"})}function Ms(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Ds(s){return t.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:s.uri})}function Os(s){return t.jsx("span",{className:"text-sm font-medium text-foreground",children:s.name||s.uri})}function Es(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Rs(s){const e=X.c(6),{resources:n,connectionId:o,org:r}=s,a=We(o),c=a?.title,u=a?.icon;let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==c||e[4]!==u?(f=t.jsx(Is,{resources:n,connectionId:o,org:r,connectionTitle:c,connectionIcon:u}),e[0]=o,e[1]=r,e[2]=n,e[3]=c,e[4]=u,e[5]=f):f=e[5],f}const Ls=lt({key:W().min(1,"Key is required"),value:W()}),Us=lt({title:W().min(1,"Name is required"),description:W().nullable().optional(),ui_type:Ct(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:W().optional(),connection_token:W().nullable().optional(),npx_package:W().optional(),stdio_command:W().optional(),stdio_args:W().optional(),stdio_cwd:W().optional(),env_vars:Je(Ls).optional(),configuration_scopes:Je(W()).nullable().optional(),configuration_state:Nt(W(),_t()).nullable().optional()}).refine(s=>s.ui_type==="NPX"?!!s.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(s=>s.ui_type==="STDIO"?!!s.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(s=>s.ui_type==="HTTP"||s.ui_type==="SSE"||s.ui_type==="Websocket"?!!s.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function Fs(s){const e=X.c(5),{tools:n,connectionId:o,org:r,isLoading:a}=s;let c;return e[0]!==o||e[1]!==a||e[2]!==r||e[3]!==n?(c=t.jsx(xs,{tools:n,connectionId:o,org:r,isLoading:a}),e[0]=o,e[1]=a,e[2]=r,e[3]=n,e[4]=c):c=e[4],c}function Bs(s){return s.command==="npx"}function zs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function Xs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Ks(s,e){const n={command:"npx",args:["-y",s]},o=ut(e);return Object.keys(o).length>0&&(n.envVars=o),n}function Ws(s,e,n,o){const r={command:s};e.trim()&&(r.args=e.trim().split(/\s+/)),n?.trim()&&(r.cwd=n.trim());const a=ut(o);return Object.keys(a).length>0&&(r.envVars=a),r}function it(s,e){const n={title:s.title,description:s.description??"",configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&It(s.connection_headers)){const o=s.connection_headers,r=At(o.envVars);if(Bs(o)){const c=zs(o);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:c,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const a=Xs(o);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:a.command,stdio_args:a.args,stdio_cwd:a.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function qs(s){let e,n=null,o=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=Ks(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Ws(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",o=s.connection_token||null),{title:s.title,description:s.description||null,connection_type:e,connection_url:n,...o&&{connection_token:o},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function Hs(s){const e=X.c(117),{connection:n,connectionId:o,org:r,requestedTabId:a,collections:c,onUpdate:u,isUpdating:f,prompts:l,resources:x,tools:p,isLoadingTools:i}=s;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={from:"/$org/$project/mcps/$connectionId"},e[0]=b):b=e[0];const m=Re(b),d=Tt(),T=Xe().location.href,v=pt();let N;e[1]!==o?(N={connectionId:o},e[1]=o,e[2]=N):N=e[2];const _=Ot(N),h=n?.connection_type==="VIRTUAL"||_.isAuthenticated;let k;e[3]!==n?(k={connections:[n],binding:"MCP"},e[3]=n,e[4]=k):k=e[4];const $=Dt(k).length>0,M=n?.metadata?.repository,A=!!M?.url;let I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=kt(Us),e[5]=I):I=e[5];let R;e[6]!==n?(R=it(n),e[6]=n,e[7]=R):R=e[7];let L;e[8]!==R?(L={resolver:I,values:R},e[8]=R,e[9]=L):L=e[9];const C=Pt(L),z=C.formState.isDirty;let P;e[10]!==C||e[11]!==u?(P=async()=>{if(!await C.trigger())return;const U=C.getValues(),ye=qs(U);await u(ye),C.reset(U)},e[10]=C,e[11]=u,e[12]=P):P=e[12];const D=P;let V;e[13]!==n||e[14]!==C?(V=()=>{C.reset(it(n))},e[13]=n,e[14]=C,e[15]=V):V=e[15];const g=V;let F;e[16]!==n.id||e[17]!==v||e[18]!==d?(F=async()=>{const{token:w,tokenInfo:U,error:ye}=await Bt({connectionId:n.id});if(ye||!w){Ce.error(`Authentication failed: ${ye}`);return}if(U)try{const De=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:U.accessToken,refreshToken:U.refreshToken,expiresIn:U.expiresIn,scope:U.scope,clientId:U.clientId,clientSecret:U.clientSecret,tokenEndpoint:U.tokenEndpoint})});if(!De.ok)console.error("Failed to save OAuth token:",await De.text()),await v.update.mutateAsync({id:n.id,data:{connection_token:w}});else try{await v.update.mutateAsync({id:n.id,data:{}})}catch(Qe){console.warn("Failed to refresh connection tools after OAuth:",Qe)}}catch(De){console.error("Error saving OAuth token:",De),await v.update.mutateAsync({id:n.id,data:{connection_token:w}})}else await v.update.mutateAsync({id:n.id,data:{connection_token:w}});const bt=new URL(`/mcp/${n.id}`,window.location.origin);await d.invalidateQueries({queryKey:Ye.isMCPAuthenticated(bt.href,null)}),Ce.success("Authentication successful")},e[16]=n.id,e[17]=v,e[18]=d,e[19]=F):F=e[19];const O=F;let S;e[20]!==n.id||e[21]!==d?(S=async()=>{try{const w=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!w.ok){const ye=await w.text();Ce.error(`Failed to remove OAuth: ${ye}`);return}const U=new URL(`/mcp/${n.id}`,window.location.origin);await d.invalidateQueries({queryKey:Ye.isMCPAuthenticated(U.href,null)}),Ce.success("OAuth removed. You can now re-authenticate with a different account.")}catch(w){console.error("Error removing OAuth token:",w),Ce.error("Failed to remove OAuth")}},e[20]=n.id,e[21]=d,e[22]=S):S=e[22];const H=S,K=p.length,se=l.length,ne=x.length,oe=K>0||i;let we;e[23]===Symbol.for("react.memo_cache_sentinel")?(we={id:"settings",label:"Settings"},e[23]=we):we=e[23];let re;e[24]!==i||e[25]!==h||e[26]!==oe||e[27]!==K?(re=h&&oe?[{id:"tools",label:"Tools",count:i?void 0:K}]:[],e[24]=i,e[25]=h,e[26]=oe,e[27]=K,e[28]=re):re=e[28];let ie;e[29]!==h||e[30]!==se?(ie=h&&se>0?[{id:"prompts",label:"Prompts",count:se}]:[],e[29]=h,e[30]=se,e[31]=ie):ie=e[31];let ae;e[32]!==h||e[33]!==ne?(ae=h&&ne>0?[{id:"resources",label:"Resources",count:ne}]:[],e[32]=h,e[33]=ne,e[34]=ae):ae=e[34];let Te;if(e[35]!==c||e[36]!==A||e[37]!==h||e[38]!==re||e[39]!==ie||e[40]!==ae){let w;e[42]!==A?(w=A?[{id:"readme",label:"README"}]:[],e[42]=A,e[43]=w):w=e[43],Te=[we,...re,...ie,...ae,...h?(c||[]).map(Gs):[],...w],e[35]=c,e[36]=A,e[37]=h,e[38]=re,e[39]=ie,e[40]=ae,e[41]=Te}else Te=e[41];const _e=Te,jt=h&&_e.some(Qs)?"tools":"settings",E=_e.some(w=>w.id===a)?a:jt;let ke;e[44]!==m?(ke=w=>{m({search:U=>({...U,tab:w}),replace:!0})},e[44]=m,e[45]=ke):ke=e[45];const ce=ke;let le;e[46]!==c?(le=c||[],e[46]=c,e[47]=le):le=e[47];let Pe;if(e[48]!==E||e[49]!==le){let w;e[51]!==E?(w=U=>U.name===E,e[51]=E,e[52]=w):w=e[52],Pe=le.find(w),e[48]=E,e[49]=le,e[50]=Pe}else Pe=e[50];const Ie=Pe;let de;e[53]!==r?(de=t.jsx(Ze,{children:t.jsx(Xt,{asChild:!0,children:t.jsx(at,{to:"/$org/$project/mcps",params:{org:r,project:Se},children:"Connections"})})}),e[53]=r,e[54]=de):de=e[54];let $e;e[55]===Symbol.for("react.memo_cache_sentinel")?($e=t.jsx(Kt,{}),e[55]=$e):$e=e[55];let me;e[56]!==n.title?(me=t.jsx(Ze,{children:t.jsx(zt,{children:n.title})}),e[56]=n.title,e[57]=me):me=e[57];let Ae;e[58]!==de||e[59]!==me?(Ae=t.jsx(Wt,{children:t.jsxs(qt,{children:[de,$e,me]})}),e[58]=de,e[59]=me,e[60]=Ae):Ae=e[60];const Ue=Ae;let ue;e[61]!==D||e[62]!==g||e[63]!==z||e[64]!==f?(ue=t.jsx(Vt,{onSave:D,onUndo:g,isDirty:z,isSaving:f}),e[61]=D,e[62]=g,e[63]=z,e[64]=f,e[65]=ue):ue=e[65];const Fe=n.icon??"settings";let pe;e[66]!==n.title||e[67]!==Fe||e[68]!==T?(pe=t.jsx(Ke,{title:n.title,url:T,icon:Fe}),e[66]=n.title,e[67]=Fe,e[68]=T,e[69]=pe):pe=e[69];let fe;e[70]!==ue||e[71]!==pe?(fe=t.jsxs(qe,{children:[ue,pe]}),e[70]=ue,e[71]=pe,e[72]=fe):fe=e[72];let xe;e[73]!==_.hasOAuthToken||e[74]!==n||e[75]!==C||e[76]!==O||e[77]!==H||e[78]!==h?(xe=t.jsx("div",{className:"w-100 shrink-0 border-r border-border bg-background",children:t.jsx(bs,{form:C,connection:n,isMCPAuthenticated:h,hasOAuthToken:_.hasOAuthToken,onReauthenticate:O,onRemoveOAuth:H})}),e[73]=_.hasOAuthToken,e[74]=n,e[75]=C,e[76]=O,e[77]=H,e[78]=h,e[79]=xe):xe=e[79];let he;e[80]!==E||e[81]!==ce||e[82]!==_e?(he=t.jsx("div",{className:"shrink-0 flex items-center gap-4 px-5 py-3 border-b border-border",children:t.jsx(Ht,{tabs:_e,activeTab:E,onTabChange:ce,className:"flex-1"})}),e[80]=E,e[81]=ce,e[82]=_e,e[83]=he):he=e[83];let Ve;e[84]===Symbol.for("react.memo_cache_sentinel")?(Ve=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Ee,{size:32,className:"animate-spin text-muted-foreground"})}),e[84]=Ve):Ve=e[84];let ge;e[85]!==Ie||e[86]!==E||e[87]!==_.isServerError||e[88]!==_.supportsOAuth||e[89]!==n||e[90]!==o||e[91]!==C||e[92]!==O||e[93]!==ce||e[94]!==$||e[95]!==A||e[96]!==i||e[97]!==h||e[98]!==r||e[99]!==l||e[100]!==M||e[101]!==x||e[102]!==p?(ge=t.jsx(Y.Suspense,{fallback:Ve,children:E==="tools"?t.jsx(Fs,{tools:p,connectionId:o,org:r,isLoading:i}):E==="prompts"?t.jsx(ks,{prompts:l,connectionId:o,org:r}):E==="resources"?t.jsx(Rs,{resources:x,connectionId:o,org:r}):E==="settings"?t.jsx(Et,{connection:n,form:C,hasMcpBinding:$,isMCPAuthenticated:h,supportsOAuth:_.supportsOAuth,isServerError:_.isServerError,onAuthenticate:O,onViewReadme:A?()=>ce("readme"):void 0}):E==="readme"&&A?t.jsx(Ps,{repository:M}):Ie&&h?t.jsx(Gt,{connectionId:o,org:r,activeCollection:Ie},E):t.jsx(Ne,{title:"Collection not found",description:"This collection may have been deleted or you may not have access."})}),e[85]=Ie,e[86]=E,e[87]=_.isServerError,e[88]=_.supportsOAuth,e[89]=n,e[90]=o,e[91]=C,e[92]=O,e[93]=ce,e[94]=$,e[95]=A,e[96]=i,e[97]=h,e[98]=r,e[99]=l,e[100]=M,e[101]=x,e[102]=p,e[103]=ge):ge=e[103];let je;e[104]!==E||e[105]!==ge?(je=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(mt,{children:ge},E)}),e[104]=E,e[105]=ge,e[106]=je):je=e[106];let be;e[107]!==he||e[108]!==je?(be=t.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:[he,je]}),e[107]=he,e[108]=je,e[109]=be):be=e[109];let ve;e[110]!==xe||e[111]!==be?(ve=t.jsxs("div",{className:"flex h-full w-full bg-background overflow-hidden",children:[xe,be]}),e[110]=xe,e[111]=be,e[112]=ve):ve=e[112];let Me;return e[113]!==Ue||e[114]!==fe||e[115]!==ve?(Me=t.jsxs(Qt,{breadcrumb:Ue,children:[fe,ve]}),e[113]=Ue,e[114]=fe,e[115]=ve,e[116]=Me):Me=e[116],Me}function Qs(s){return s.id==="tools"}function Gs(s){return{id:s.name,label:s.displayName}}function Js(){const s=X.c(43);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/$project/mcps/$connectionId"},s[0]=e):e=s[0];const n=Re(e);let o;s[1]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/$project/mcps/$connectionId"},s[1]=o):o=s[1];const{connectionId:r,org:a}=St(o),{org:c}=ct();let u;s[2]===Symbol.for("react.memo_cache_sentinel")?(u={from:"/shell/$org/$project/mcps/$connectionId"},s[2]=u):u=s[2];const l=wt(u).tab??"",x=We(r),p=pt(),i=Mt(x??void 0);let b;s[3]!==r||s[4]!==c.id?(b={connectionId:r,orgId:c.id},s[3]=r,s[4]=c.id,s[5]=b):b=s[5];const m=Rt(b);let d;s[6]!==m?(d={client:m},s[6]=m,s[7]=d):d=s[7];const{data:j}=Ut(d);let T;s[8]!==m?(T={client:m},s[8]=m,s[9]=T):T=s[9];const{data:v}=Ft(T),_=!(x?.connection_type==="VIRTUAL")&&x?.tools&&x.tools.length>0,y=!_;let h;s[10]!==m||s[11]!==y?(h={client:m,enabled:y},s[10]=m,s[11]=y,s[12]=h):h=s[12];const{data:k,isLoading:B}=Lt(h);let $;s[13]!==j?.prompts?($=j?.prompts??[],s[13]=j?.prompts,s[14]=$):$=s[14];let M;s[15]!==$?(M=$.map(en),s[15]=$,s[16]=M):M=s[16];const A=M;let I;s[17]!==v?.resources?(I=v?.resources??[],s[17]=v?.resources,s[18]=I):I=s[18];let R;s[19]!==I?(R=I.map(Zs),s[19]=I,s[20]=R):R=s[20];const L=R;let C;s[21]!==x||s[22]!==_||s[23]!==k?.tools?(C=_?x.tools??[]:(k?.tools??[]).map(Ys),s[21]=x,s[22]=_,s[23]=k?.tools,s[24]=C):C=s[24];const z=C;let P;s[25]!==p.update||s[26]!==r?(P=async g=>{await p.update.mutateAsync({id:r,data:g})},s[25]=p.update,s[26]=r,s[27]=P):P=s[27];const D=P;if(!x){let g;return s[28]!==n||s[29]!==a?(g=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ne,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(Be,{variant:"outline",onClick:()=>n({to:"/$org/$project/mcps",params:{org:a,project:Se}}),children:"Back to connections"})})}),s[28]=n,s[29]=a,s[30]=g):g=s[30],g}let V;return s[31]!==p.update.isPending||s[32]!==i||s[33]!==x||s[34]!==r||s[35]!==D||s[36]!==B||s[37]!==a||s[38]!==A||s[39]!==l||s[40]!==L||s[41]!==z?(V=t.jsx(Hs,{org:a,connection:x,connectionId:r,requestedTabId:l,collections:i,onUpdate:D,isUpdating:p.update.isPending,prompts:A,resources:L,tools:z,isLoadingTools:B}),s[31]=p.update.isPending,s[32]=i,s[33]=x,s[34]=r,s[35]=D,s[36]=B,s[37]=a,s[38]=A,s[39]=l,s[40]=L,s[41]=z,s[42]=V):V=s[42],V}function Ys(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,annotations:s.annotations}}function Zs(s){return{uri:s.uri,name:s.name,description:s.description}}function en(s){return{name:s.name,description:s.description}}function tn(){const s=X.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(mt,{children:t.jsx(Y.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Ee,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Js,{})})}),s[0]=e):e=s[0],e}function tr(){const s=X.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(tn,{}),s[0]=e):e=s[0],e}export{tr as default};
|
|
1
|
+
import{c as X,j as t,b as Re,O as Se,aE as at,u as ct,bA as Ge,ai as vt,p as yt,by as Xe,r as Y,o as lt,b8 as Nt,bg as _t,s as W,aj as Je,ak as Ct,e as St,a as Tt,y as wt,k as kt,l as Pt,i as It,t as Ce,K as Ye}from"./index-DORq2iDV.js";import{E as Ne,C as dt}from"./empty-state-J0iNaH6o.js";import{E as mt}from"./error-boundary-Cw9mogkc.js";import{E as $t,r as At,e as ut}from"./env-vars-editor-BuXgYNmv.js";import{P as Ke}from"./index-D3i0JpVn.js";import{S as Vt}from"./save-actions-Bkd7XN5j.js";import{b as Mt,a as Dt}from"./use-binding-JQRdy56n.js";import{u as Ot,S as Et}from"./index-CsDBbm_y.js";import{f as We,g as pt}from"./use-connection-C7Ykn5We.js";import{u as Rt}from"./constants-C7Ec6iJ9.js";import{d as Lt}from"./use-mcp-tools-BPBUJeNd.js";import{b as Ut,d as Ft}from"./use-mcp-prompts-BIWdwpGe.js";import{a as Bt}from"./mcp-oauth-BcBmIJkz.js";import{b as Ze,c as zt,d as Xt,e as Kt,B as Wt,a as qt}from"./breadcrumb-CyS88-Ut.js";import{B as Be}from"./button-CVYD_l4f.js";import{C as Ht}from"./collection-tabs-D7dYSph2.js";import{i as Ee}from"./Loading01-B5HJTtc0.js";import{V as qe,a as Qt}from"./layout-BHHG3i-Y.js";import{C as Gt}from"./collection-tab-C6CvbFAN.js";import{I as Le}from"./integration-icon-BdGEh9QA.js";import{B as ze}from"./badge-HG4Wd9Mh.js";import{D as Jt,a as Yt,b as Zt,c as et}from"./dropdown-menu-CFgggJR1.js";import{F as G,a as es,b as J,d as q,f as Z,c as te,e as ts}from"./form-BVo4Hzsi.js";import{I as ee}from"./input-Bh5KX8XE.js";import{S as tt,a as st,b as nt,c as ot,d as Q}from"./select-jAphy_-Y.js";import{i as ft}from"./CheckCircle-HtLjegW2.js";import{t as ss}from"./ChevronDown-RHEfxY7t.js";import{n as ns}from"./Container-CMzzA9YA.js";import{s as Oe}from"./Globe02-RkDxZVVj.js";import{s as os}from"./RefreshCcw01-BrLEfK43.js";import{i as rs}from"./Terminal-XYm-55WZ.js";import{s as is}from"./Trash01-dBw88Tyb.js";import{t as He}from"./Users03-B_27GBWC.js";import{s as as}from"./XClose-Dm4uRTid.js";import{U as cs}from"./use-list-state-D5uNQEJf.js";import{b as ls,a as ds}from"./use-virtual-mcp-ZHBbhgI3.js";import{i as ms}from"./ChevronRight-CtfDv6KV.js";import{s as us}from"./Plus-CRPlP_jA.js";import{f as ps}from"./formatDistanceToNow-Cb2QZZJn.js";import{a as xt,C as ht}from"./collection-table-wrapper-DHsLzzwx.js";import{C as gt}from"./card-BESAH6x0.js";import{R as fs}from"./readme-viewer-CIbkQahX.js";import{T as xs}from"./tools-list-sjdDWTmZ.js";import"./SearchMd-DBdGvvkJ.js";import"./AlertTriangle-CoVws0Do.js";import"./tooltip-4z3Dj1Ic.js";import"./Pin01-fdYVvyiL.js";import"./use-organization-settings-DMr0awSz.js";import"./useMutation-DIYvmP8t.js";import"./Save01-CuPUo8En.js";import"./binder-gZKFqPm8.js";import"./File06-w124s0Yj.js";import"./Key01-C0E2RPRQ.js";import"./constants-D_v8WsQi.js";import"./registry-utils-DbEnt6lf.js";import"./extract-connection-data-E0weV85e.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-CDxw1GCo.js";import"./index-C1U9FLFs.js";import"./circle-alert-DxKlPZa9.js";import"./index-Cgpi8OLK.js";import"./index-CEFVWh1V.js";import"./use-deco-chat-open-uiDqNCbm.js";import"./use-llm-jw2BS-HP.js";import"./useQuery-psr46-dB.js";import"./localstorage-keys-CCux6fjT.js";import"./skeleton-B-gUpTJK.js";import"./popover-DbRkjXcJ.js";import"./Grid01-C8mqRkg1.js";import"./Image01-DQLyBK8l.js";import"./Settings01-BNTi5NiU.js";import"./useSuspenseInfiniteQuery-FMCIrxas.js";import"./infiniteQueryObserver-dJrk4KCF.js";import"./spinner-CTHwgDFW.js";import"./dialog-VPGAGt8b.js";import"./usage-B8eRkRZY.js";import"./ArrowUp-D1Z3ZGMT.js";import"./Edit01-CWgM245j.js";import"./XCircle-DeSD2Nme.js";import"./AlertCircle-Dcv7gp-I.js";import"./ArrowLeft-D34bf2DR.js";import"./use-copy-BUr9JgMZ.js";import"./Check-B6v8UYhw.js";import"./Code01-bk_rrtBU.js";import"./use-create-virtual-mcp-CfhM_SAz.js";import"./marked.esm-BaswSlok.js";import"./markdown-CboA12Nd.js";import"./Copy01-Cm4pdmsu.js";import"./Clock-Dd09ek7S.js";import"./index-CdvbUeMY.js";import"./use-mobile-aOwHFgFs.js";import"./DotsVertical-D_euv27G.js";import"./Eye-CE7mKBNe.js";import"./empty-state-B_yeI3-8.js";import"./Inbox01-BSel3biT.js";import"./alert-dialog-YO7F1UnW.js";import"./label-DyOg7nzh.js";import"./avatar-CXlAe-d0.js";import"./use-view-mode-BKl_7npX.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./List-ChoGNa5p.js";import"./table-oUu9PtOj.js";import"./RefreshCw01-DDRYQqjd.js";function hs(s){const e=X.c(14),{virtualMcp:n,org:o}=s;let r;e[0]!==o||e[1]!==n.id?(r={org:o,project:Se,agentId:n.id},e[0]=o,e[1]=n.id,e[2]=r):r=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(He,{size:16}),e[3]=a):a=e[3];let c;e[4]!==n.icon||e[5]!==n.title?(c=t.jsx(Le,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:a}),e[4]=n.icon,e[5]=n.title,e[6]=c):c=e[6];let u;e[7]!==n.title?(u=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[7]=n.title,e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ms,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[9]=f):f=e[9];let l;return e[10]!==r||e[11]!==c||e[12]!==u?(l=t.jsxs(at,{to:"/$org/$project/agents/$agentId",params:r,className:"flex items-center gap-3 p-2 pr-1 rounded-lg hover:bg-muted/50 transition-colors group",children:[c,u,f]}),e[10]=r,e[11]=c,e[12]=u,e[13]=l):l=e[13],l}function rt(s){const e=X.c(20),{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:a,org:c,hasExistingVirtualMcps:u}=s,f=Re(),l=ds();let x;e[0]!==l.create||e[1]!==r||e[2]!==a||e[3]!==n||e[4]!==o||e[5]!==f||e[6]!==c?(x=async()=>{const m=await l.create.mutateAsync({title:`${o} Agent`,description:r??null,icon:a??null,status:"active",connections:[{connection_id:n,selected_tools:null,selected_resources:null,selected_prompts:null}]});f({to:"/$org/$project/agents/$agentId",params:{org:c,project:Se,agentId:m.id}})},e[0]=l.create,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=f,e[6]=c,e[7]=x):x=e[7];const p=x;if(u){let m;e[8]!==l.create.isPending?(m=l.create.isPending?t.jsx(Ee,{size:16,className:"animate-spin"}):t.jsx(us,{size:16}),e[8]=l.create.isPending,e[9]=m):m=e[9];let d;return e[10]!==l.create.isPending||e[11]!==p||e[12]!==m?(d=t.jsx(Be,{variant:"ghost",className:"size-6 p-0",onClick:p,disabled:l.create.isPending,children:m}),e[10]=l.create.isPending,e[11]=p,e[12]=m,e[13]=d):d=e[13],d}let i;e[14]!==l.create.isPending?(i=l.create.isPending?t.jsx(Ee,{className:"animate-spin text-muted-foreground"}):t.jsx(He,{className:"size-3 text-muted-foreground"}),e[14]=l.create.isPending,e[15]=i):i=e[15];let b;return e[16]!==l.create.isPending||e[17]!==p||e[18]!==i?(b=t.jsxs(Be,{variant:"outline",size:"sm",onClick:p,disabled:l.create.isPending,children:[i,"Create an agent"]}),e[16]=l.create.isPending,e[17]=p,e[18]=i,e[19]=b):b=e[19],b}function gs(s){const e=X.c(26),{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:a,org:c}=s;let u;e[0]!==n?(u={filters:[{column:"connection_id",value:n}]},e[0]=n,e[1]=u):u=e[1];const f=ls(u);if(!(f.length>0)){let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Use in your IDE"}),e[2]=d):d=e[2];let j;return e[3]!==r||e[4]!==a||e[5]!==n||e[6]!==o||e[7]!==c?(j=t.jsxs("div",{className:"p-5 flex items-center justify-between gap-3",children:[d,t.jsx(rt,{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:a,org:c,hasExistingVirtualMcps:!1})]}),e[3]=r,e[4]=a,e[5]=n,e[6]=o,e[7]=c,e[8]=j):j=e[8],j}let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Agents"}),e[9]=x):x=e[9];let p;e[10]!==r||e[11]!==a||e[12]!==n||e[13]!==o||e[14]!==c?(p=t.jsx("div",{className:"flex flex-col gap-1",children:t.jsxs("div",{className:"flex items-center justify-between",children:[x,t.jsx(rt,{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:a,org:c,hasExistingVirtualMcps:!0})]})}),e[10]=r,e[11]=a,e[12]=n,e[13]=o,e[14]=c,e[15]=p):p=e[15];let i;if(e[16]!==c||e[17]!==f){let d;e[19]!==c?(d=j=>t.jsx(hs,{virtualMcp:j,org:c},j.id),e[19]=c,e[20]=d):d=e[20],i=f.map(d),e[16]=c,e[17]=f,e[18]=i}else i=e[18];let b;e[21]!==i?(b=t.jsx("div",{className:"flex flex-col gap-2",children:i}),e[21]=i,e[22]=b):b=e[22];let m;return e[23]!==p||e[24]!==b?(m=t.jsxs("div",{className:"p-5 flex flex-col gap-3",children:[p,b]}),e[23]=p,e[24]=b,e[25]=m):m=e[25],m}function js({form:s,connection:e,hasOAuthToken:n,onReauthenticate:o,onRemoveOAuth:r}){const a=Ge({control:s.control,name:"ui_type"}),c=Ge({control:s.control,name:"connection_url"}),{stdioEnabled:u}=vt(),f=(()=>{if(typeof c!="string"||!c)return!1;try{const i=new URL(c);return i.hostname==="api.githubcopilot.com"&&i.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),l=u||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?yt(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(He,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[t.jsx(G,{control:s.control,name:"ui_type",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),a!=="NPX"&&a!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(tt,{value:i.value,onValueChange:i.onChange,children:[t.jsx(q,{children:t.jsxs(st,{className:"h-10 w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(Oe,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(nt,{})]})}),t.jsxs(ot,{children:[t.jsx(Q,{value:"HTTP",children:"HTTP"}),t.jsx(Q,{value:"SSE",children:"SSE"}),t.jsx(Q,{value:"Websocket",children:"Websocket"}),l&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{value:"NPX",children:"NPX Package"}),t.jsx(Q,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(G,{control:s.control,name:"connection_url",render:({field:b})=>t.jsx(J,{className:"flex-1 min-w-0",children:t.jsx(q,{children:t.jsx(ee,{placeholder:"https://example.com/mcp",...b,value:b.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(tt,{value:i.value,onValueChange:i.onChange,children:[t.jsx(q,{children:t.jsx(st,{className:"h-10",children:t.jsx(nt,{})})}),t.jsxs(ot,{children:[t.jsx(Q,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Oe,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(Q,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Oe,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(Q,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Oe,{className:"w-4 h-4"}),"Websocket"]})}),l&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ns,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(Q,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(rs,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(Z,{})]})}),a==="NPX"&&t.jsx(G,{control:s.control,name:"npx_package",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(q,{children:t.jsx(ee,{placeholder:"@perplexity-ai/mcp-server",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx(Z,{})]})}),a==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(G,{control:s.control,name:"stdio_command",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(q,{children:t.jsx(ee,{placeholder:"node, bun, python...",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx(Z,{})]})}),t.jsx(G,{control:s.control,name:"stdio_args",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(q,{children:t.jsx(ee,{placeholder:"arg1 arg2 --flag value",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(Z,{})]})})]}),t.jsx(G,{control:s.control,name:"stdio_cwd",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(q,{children:t.jsx(ee,{placeholder:"/path/to/project (optional)",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx(Z,{})]})})]}),(a==="NPX"||a==="STDIO")&&t.jsx(G,{control:s.control,name:"env_vars",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(q,{children:t.jsx($t,{value:i.value??[],onChange:i.onChange})}),t.jsx(Z,{})]})}),a!=="NPX"&&a!=="STDIO"&&t.jsx(G,{control:s.control,name:"connection_token",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:f?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Jt,{children:[t.jsx(Yt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(ze,{variant:"success",className:"gap-1.5",children:[t.jsx(ft,{size:12}),"Authenticated via OAuth",t.jsx(ss,{size:12})]})})}),t.jsxs(Zt,{align:"start",children:[t.jsxs(et,{onClick:o,children:[t.jsx(os,{size:16}),"Re-authenticate"]}),t.jsxs(et,{variant:"destructive",onClick:r,children:[t.jsx(is,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&i.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>i.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(as,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(ee,{type:"password",placeholder:f?"Paste your GitHub PAT":"Enter access token...",...i,value:i.value||"",className:"h-10 rounded-lg"})}),f&&t.jsxs(ts,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(Z,{})]})})]})}function bs(s){const e=X.c(43),{form:n,connection:o,isMCPAuthenticated:r,hasOAuthToken:a,onReauthenticate:c,onRemoveOAuth:u}=s,{org:f}=ct();let l;e[0]!==o.icon||e[1]!==o.title?(l=t.jsx(Le,{icon:o.icon,name:o.title,size:"lg",className:"shadow-sm"}),e[0]=o.icon,e[1]=o.title,e[2]=l):l=e[2];let x;e[3]!==n.control?(x=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(G,{control:n.control,name:"title",render:ys}),t.jsx(G,{control:n.control,name:"description",render:vs})]}),e[3]=n.control,e[4]=x):x=e[4];let p;e[5]!==l||e[6]!==x?(p=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[l,x]}),e[5]=l,e[6]=x,e[7]=p):p=e[7];let i;e[8]!==o||e[9]!==n||e[10]!==a||e[11]!==c||e[12]!==u?(i=t.jsx(js,{form:n,connection:o,hasOAuthToken:a,onReauthenticate:c,onRemoveOAuth:u}),e[8]=o,e[9]=n,e[10]=a,e[11]=c,e[12]=u,e[13]=i):i=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Status"}),e[14]=b):b=e[14];let m;e[15]!==r?(m=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[b,r?t.jsxs(ze,{variant:"success",className:"gap-1.5 bg-success-foreground text-success",children:[t.jsx(ft,{size:12}),"Connected"]}):t.jsx(ze,{variant:"outline",className:"text-muted-foreground",children:"Not connected"})]}),e[15]=r,e[16]=m):m=e[16];let d;e[17]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Created by"}),e[17]=d):d=e[17];let j;e[18]!==o.created_by?(j=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[d,t.jsx(cs,{id:o.created_by,size:"2xs"})]}),e[18]=o.created_by,e[19]=j):j=e[19];let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Updated"}),e[20]=w):w=e[20];let v;e[21]!==o.updated_at?(v=o.updated_at?ps(new Date(o.updated_at),{addSuffix:!0}):"Unknown",e[21]=o.updated_at,e[22]=v):v=e[22];let N;e[23]!==v?(N=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[w,t.jsx("span",{className:"text-sm text-foreground",children:v})]}),e[23]=v,e[24]=N):N=e[24];let _;e[25]!==N||e[26]!==m||e[27]!==j?(_=t.jsxs("div",{className:"flex flex-col gap-2 p-5 border-b border-border",children:[m,j,N]}),e[25]=N,e[26]=m,e[27]=j,e[28]=_):_=e[28];let y;e[29]!==o.description||e[30]!==o.icon||e[31]!==o.id||e[32]!==o.title||e[33]!==f.slug?(y=t.jsx(gs,{connectionId:o.id,connectionTitle:o.title,connectionDescription:o.description,connectionIcon:o.icon,org:f.slug}),e[29]=o.description,e[30]=o.icon,e[31]=o.id,e[32]=o.title,e[33]=f.slug,e[34]=y):y=e[34];let h;e[35]!==_||e[36]!==y||e[37]!==p||e[38]!==i?(h=t.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[p,i,_,y]}),e[35]=_,e[36]=y,e[37]=p,e[38]=i,e[39]=h):h=e[39];let k;return e[40]!==n||e[41]!==h?(k=t.jsx(es,{...n,children:h}),e[40]=n,e[41]=h,e[42]=k):k=e[42],k}function vs(s){const{field:e}=s;return t.jsxs(J,{className:"w-full space-y-0",children:[t.jsx(q,{children:t.jsx(ee,{...e,value:e.value||"",className:"h-auto py-0.5 text-base text-muted-foreground leading-6 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})}),t.jsx(Z,{})]})}function ys(s){const{field:e}=s;return t.jsxs(J,{className:"flex-1 space-y-0",children:[t.jsx(q,{children:t.jsx(ee,{...e,className:"h-auto py-0.5 text-lg! font-medium leading-7 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Connection Name"})}),t.jsx(Z,{})]})}function Ns(s){const e=X.c(42),{prompts:n,connectionId:o,org:r,connectionTitle:a,connectionIcon:c,onPromptClick:u,showToolbar:f,emptyMessage:l}=s,x=f===void 0?!0:f,p=l===void 0?"This connection doesn't have any prompts yet.":l,i=Re(),m=Xe().location.href,[d,j]=Y.useState(""),[w,v]=Y.useState("table"),[N,_]=Y.useState("name"),[y,h]=Y.useState("asc");let k;e[0]!==y||e[1]!==N?(k=S=>{N===S?(h(ws),y==="desc"&&_(void 0)):(_(S),h("asc"))},e[0]=y,e[1]=N,e[2]=k):k=e[2];const B=k;let $;e[3]!==o||e[4]!==i||e[5]!==u||e[6]!==r?($=S=>{u?u(S):o&&r&&i({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:Se,connectionId:o,collectionName:"prompts",itemId:encodeURIComponent(S.name)}})},e[3]=o,e[4]=i,e[5]=u,e[6]=r,e[7]=$):$=e[7];const M=$;let A;if(e[8]!==n||e[9]!==d||e[10]!==y||e[11]!==N){const S=!n||n.length===0?[]:d.trim()?(()=>{const H=d.toLowerCase();return n.filter(K=>K.name.toLowerCase().includes(H)||K.description&&K.description.toLowerCase().includes(H))})():n;A=!N||!y?S:[...S].sort((H,K)=>{const se=H[N]||"",ne=K[N]||"",oe=String(se).localeCompare(String(ne));return y==="asc"?oe:-oe}),e[8]=n,e[9]=d,e[10]=y,e[11]=N,e[12]=A}else A=e[12];const I=A;let R;e[13]===Symbol.for("react.memo_cache_sentinel")?(R=[{id:"name",header:"Name",render:Ts,sortable:!0},{id:"description",header:"Description",render:Ss,cellClassName:"flex-1",sortable:!0}],e[13]=R):R=e[13];const L=R;let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=L.filter(Cs).map(_s),e[14]=C):C=e[14];const z=C;let P;e[15]!==c||e[16]!==a||e[17]!==B||e[18]!==x||e[19]!==y||e[20]!==N||e[21]!==m||e[22]!==w?(P=x&&t.jsxs(qe,{children:[t.jsx(ht,{viewMode:w,onViewModeChange:v,sortKey:N,sortDirection:y,onSort:B,sortOptions:z}),t.jsx(Ke,{title:a?`${a}: Prompts`:"Prompts",url:m,icon:c??"description"})]}),e[15]=c,e[16]=a,e[17]=B,e[18]=x,e[19]=y,e[20]=N,e[21]=m,e[22]=w,e[23]=P):P=e[23];let D;e[24]===Symbol.for("react.memo_cache_sentinel")?(D=S=>{S.key==="Escape"&&(j(""),S.target.blur())},e[24]=D):D=e[24];let V;e[25]!==d?(V=t.jsx(dt,{value:d,onChange:j,placeholder:"Search prompts...",onKeyDown:D}),e[25]=d,e[26]=V):V=e[26];let g;e[27]!==p||e[28]!==M||e[29]!==B||e[30]!==d||e[31]!==y||e[32]!==N||e[33]!==I||e[34]!==w?(g=w==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:I.length===0?t.jsx(Ne,{image:null,title:d?"No prompts found":"No prompts available",description:d?"Try adjusting your search terms":p}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:I.map(S=>t.jsx(gt,{className:"cursor-pointer transition-colors",onClick:()=>M(S),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Le,{icon:null,name:S.name,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:S.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:S.description||"No description"})]})]})},S.name))})}):t.jsx(xt,{columns:L,data:I,isLoading:!1,sortKey:N,sortDirection:y,onSort:B,onRowClick:S=>M(S),emptyState:t.jsx(Ne,{image:null,title:d?"No prompts found":"No prompts available",description:d?"Try adjusting your search terms":p})}),e[27]=p,e[28]=M,e[29]=B,e[30]=d,e[31]=y,e[32]=N,e[33]=I,e[34]=w,e[35]=g):g=e[35];let F;e[36]!==V||e[37]!==g?(F=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[V,g]}),e[36]=V,e[37]=g,e[38]=F):F=e[38];let O;return e[39]!==F||e[40]!==P?(O=t.jsxs(t.Fragment,{children:[P,F]}),e[39]=F,e[40]=P,e[41]=O):O=e[41],O}function _s(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function Cs(s){return s.sortable}function Ss(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Ts(s){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:s.name})}function ws(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function ks(s){const e=X.c(6),{prompts:n,connectionId:o,org:r}=s,a=We(o),c=a?.title,u=a?.icon;let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==c||e[4]!==u?(f=t.jsx(Ns,{prompts:n,connectionId:o,org:r,connectionTitle:c,connectionIcon:u}),e[0]=o,e[1]=r,e[2]=n,e[3]=c,e[4]=u,e[5]=f):f=e[5],f}function Ps(s){const e=X.c(2),{repository:n}=s;let o;return e[0]!==n?(o=t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(fs,{repository:n})}),e[0]=n,e[1]=o):o=e[1],o}function Is(s){const e=X.c(39),{resources:n,connectionTitle:o,connectionIcon:r,onResourceClick:a,showToolbar:c,emptyMessage:u}=s,f=c===void 0?!0:c,l=u===void 0?"This connection doesn't have any resources yet.":u,p=Xe().location.href,[i,b]=Y.useState(""),[m,d]=Y.useState("table"),[j,w]=Y.useState("name"),[v,N]=Y.useState("asc");let _;e[0]!==v||e[1]!==j?(_=g=>{j===g?(N(Es),v==="desc"&&w(void 0)):(w(g),N("asc"))},e[0]=v,e[1]=j,e[2]=_):_=e[2];const y=_;let h;e[3]!==a?(h=g=>{a&&a(g)},e[3]=a,e[4]=h):h=e[4];const k=h;let B;if(e[5]!==n||e[6]!==i||e[7]!==v||e[8]!==j){const g=!n||n.length===0?[]:i.trim()?(()=>{const F=i.toLowerCase();return n.filter(O=>O.uri.toLowerCase().includes(F)||O.name&&O.name.toLowerCase().includes(F)||O.description&&O.description.toLowerCase().includes(F))})():n;B=!j||!v?g:[...g].sort((F,O)=>{const S=F[j]||"",H=O[j]||"",K=String(S).localeCompare(String(H));return v==="asc"?K:-K}),e[5]=n,e[6]=i,e[7]=v,e[8]=j,e[9]=B}else B=e[9];const $=B;let M;e[10]===Symbol.for("react.memo_cache_sentinel")?(M=[{id:"name",header:"Name",render:Os,sortable:!0},{id:"uri",header:"URI",render:Ds,sortable:!0},{id:"description",header:"Description",render:Ms,cellClassName:"flex-1",sortable:!0},{id:"mimeType",header:"Type",render:Vs,sortable:!0}],e[10]=M):M=e[10];const A=M;let I;e[11]===Symbol.for("react.memo_cache_sentinel")?(I=A.filter(As).map($s),e[11]=I):I=e[11];const R=I;let L;e[12]!==r||e[13]!==o||e[14]!==y||e[15]!==f||e[16]!==v||e[17]!==j||e[18]!==p||e[19]!==m?(L=f&&t.jsxs(qe,{children:[t.jsx(ht,{viewMode:m,onViewModeChange:d,sortKey:j,sortDirection:v,onSort:y,sortOptions:R}),t.jsx(Ke,{title:o?`${o}: Resources`:"Resources",url:p,icon:r??"folder"})]}),e[12]=r,e[13]=o,e[14]=y,e[15]=f,e[16]=v,e[17]=j,e[18]=p,e[19]=m,e[20]=L):L=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=g=>{g.key==="Escape"&&(b(""),g.target.blur())},e[21]=C):C=e[21];let z;e[22]!==i?(z=t.jsx(dt,{value:i,onChange:b,placeholder:"Search resources...",onKeyDown:C}),e[22]=i,e[23]=z):z=e[23];let P;e[24]!==l||e[25]!==k||e[26]!==y||e[27]!==i||e[28]!==v||e[29]!==j||e[30]!==$||e[31]!==m?(P=m==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:$.length===0?t.jsx(Ne,{image:null,title:i?"No resources found":"No resources available",description:i?"Try adjusting your search terms":l}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:$.map(g=>t.jsx(gt,{className:"cursor-pointer transition-colors",onClick:()=>k(g),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Le,{icon:null,name:g.name||g.uri,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:g.name||g.uri}),t.jsx("p",{className:"text-xs font-mono text-muted-foreground truncate",children:g.uri}),g.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:g.description})]})]})},g.uri))})}):t.jsx(xt,{columns:A,data:$,isLoading:!1,sortKey:j,sortDirection:v,onSort:y,onRowClick:g=>k(g),emptyState:t.jsx(Ne,{image:null,title:i?"No resources found":"No resources available",description:i?"Try adjusting your search terms":l})}),e[24]=l,e[25]=k,e[26]=y,e[27]=i,e[28]=v,e[29]=j,e[30]=$,e[31]=m,e[32]=P):P=e[32];let D;e[33]!==z||e[34]!==P?(D=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[z,P]}),e[33]=z,e[34]=P,e[35]=D):D=e[35];let V;return e[36]!==D||e[37]!==L?(V=t.jsxs(t.Fragment,{children:[L,D]}),e[36]=D,e[37]=L,e[38]=V):V=e[38],V}function $s(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function As(s){return s.sortable}function Vs(s){return t.jsx("span",{className:"text-sm text-muted-foreground",children:s.mimeType||"—"})}function Ms(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Ds(s){return t.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:s.uri})}function Os(s){return t.jsx("span",{className:"text-sm font-medium text-foreground",children:s.name||s.uri})}function Es(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Rs(s){const e=X.c(6),{resources:n,connectionId:o,org:r}=s,a=We(o),c=a?.title,u=a?.icon;let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==c||e[4]!==u?(f=t.jsx(Is,{resources:n,connectionId:o,org:r,connectionTitle:c,connectionIcon:u}),e[0]=o,e[1]=r,e[2]=n,e[3]=c,e[4]=u,e[5]=f):f=e[5],f}const Ls=lt({key:W().min(1,"Key is required"),value:W()}),Us=lt({title:W().min(1,"Name is required"),description:W().nullable().optional(),ui_type:Ct(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:W().optional(),connection_token:W().nullable().optional(),npx_package:W().optional(),stdio_command:W().optional(),stdio_args:W().optional(),stdio_cwd:W().optional(),env_vars:Je(Ls).optional(),configuration_scopes:Je(W()).nullable().optional(),configuration_state:Nt(W(),_t()).nullable().optional()}).refine(s=>s.ui_type==="NPX"?!!s.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(s=>s.ui_type==="STDIO"?!!s.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(s=>s.ui_type==="HTTP"||s.ui_type==="SSE"||s.ui_type==="Websocket"?!!s.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function Fs(s){const e=X.c(5),{tools:n,connectionId:o,org:r,isLoading:a}=s;let c;return e[0]!==o||e[1]!==a||e[2]!==r||e[3]!==n?(c=t.jsx(xs,{tools:n,connectionId:o,org:r,isLoading:a}),e[0]=o,e[1]=a,e[2]=r,e[3]=n,e[4]=c):c=e[4],c}function Bs(s){return s.command==="npx"}function zs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function Xs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Ks(s,e){const n={command:"npx",args:["-y",s]},o=ut(e);return Object.keys(o).length>0&&(n.envVars=o),n}function Ws(s,e,n,o){const r={command:s};e.trim()&&(r.args=e.trim().split(/\s+/)),n?.trim()&&(r.cwd=n.trim());const a=ut(o);return Object.keys(a).length>0&&(r.envVars=a),r}function it(s,e){const n={title:s.title,description:s.description??"",configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&It(s.connection_headers)){const o=s.connection_headers,r=At(o.envVars);if(Bs(o)){const c=zs(o);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:c,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const a=Xs(o);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:a.command,stdio_args:a.args,stdio_cwd:a.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function qs(s){let e,n=null,o=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=Ks(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Ws(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",o=s.connection_token||null),{title:s.title,description:s.description||null,connection_type:e,connection_url:n,...o&&{connection_token:o},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function Hs(s){const e=X.c(117),{connection:n,connectionId:o,org:r,requestedTabId:a,collections:c,onUpdate:u,isUpdating:f,prompts:l,resources:x,tools:p,isLoadingTools:i}=s;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={from:"/$org/$project/mcps/$connectionId"},e[0]=b):b=e[0];const m=Re(b),d=wt(),w=Xe().location.href,v=pt();let N;e[1]!==o?(N={connectionId:o},e[1]=o,e[2]=N):N=e[2];const _=Ot(N),h=n?.connection_type==="VIRTUAL"||_.isAuthenticated;let k;e[3]!==n?(k={connections:[n],binding:"MCP"},e[3]=n,e[4]=k):k=e[4];const $=Dt(k).length>0,M=n?.metadata?.repository,A=!!M?.url;let I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=kt(Us),e[5]=I):I=e[5];let R;e[6]!==n?(R=it(n),e[6]=n,e[7]=R):R=e[7];let L;e[8]!==R?(L={resolver:I,values:R},e[8]=R,e[9]=L):L=e[9];const C=Pt(L),z=C.formState.isDirty;let P;e[10]!==C||e[11]!==u?(P=async()=>{if(!await C.trigger())return;const U=C.getValues(),ye=qs(U);await u(ye),C.reset(U)},e[10]=C,e[11]=u,e[12]=P):P=e[12];const D=P;let V;e[13]!==n||e[14]!==C?(V=()=>{C.reset(it(n))},e[13]=n,e[14]=C,e[15]=V):V=e[15];const g=V;let F;e[16]!==n.id||e[17]!==v||e[18]!==d?(F=async()=>{const{token:T,tokenInfo:U,error:ye}=await Bt({connectionId:n.id});if(ye||!T){Ce.error(`Authentication failed: ${ye}`);return}if(U)try{const De=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:U.accessToken,refreshToken:U.refreshToken,expiresIn:U.expiresIn,scope:U.scope,clientId:U.clientId,clientSecret:U.clientSecret,tokenEndpoint:U.tokenEndpoint})});if(!De.ok)console.error("Failed to save OAuth token:",await De.text()),await v.update.mutateAsync({id:n.id,data:{connection_token:T}});else try{await v.update.mutateAsync({id:n.id,data:{}})}catch(Qe){console.warn("Failed to refresh connection tools after OAuth:",Qe)}}catch(De){console.error("Error saving OAuth token:",De),await v.update.mutateAsync({id:n.id,data:{connection_token:T}})}else await v.update.mutateAsync({id:n.id,data:{connection_token:T}});const bt=new URL(`/mcp/${n.id}`,window.location.origin);await d.invalidateQueries({queryKey:Ye.isMCPAuthenticated(bt.href,null)}),Ce.success("Authentication successful")},e[16]=n.id,e[17]=v,e[18]=d,e[19]=F):F=e[19];const O=F;let S;e[20]!==n.id||e[21]!==d?(S=async()=>{try{const T=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!T.ok){const ye=await T.text();Ce.error(`Failed to remove OAuth: ${ye}`);return}const U=new URL(`/mcp/${n.id}`,window.location.origin);await d.invalidateQueries({queryKey:Ye.isMCPAuthenticated(U.href,null)}),Ce.success("OAuth removed. You can now re-authenticate with a different account.")}catch(T){console.error("Error removing OAuth token:",T),Ce.error("Failed to remove OAuth")}},e[20]=n.id,e[21]=d,e[22]=S):S=e[22];const H=S,K=p.length,se=l.length,ne=x.length,oe=K>0||i;let Te;e[23]===Symbol.for("react.memo_cache_sentinel")?(Te={id:"settings",label:"Settings"},e[23]=Te):Te=e[23];let re;e[24]!==i||e[25]!==h||e[26]!==oe||e[27]!==K?(re=h&&oe?[{id:"tools",label:"Tools",count:i?void 0:K}]:[],e[24]=i,e[25]=h,e[26]=oe,e[27]=K,e[28]=re):re=e[28];let ie;e[29]!==h||e[30]!==se?(ie=h&&se>0?[{id:"prompts",label:"Prompts",count:se}]:[],e[29]=h,e[30]=se,e[31]=ie):ie=e[31];let ae;e[32]!==h||e[33]!==ne?(ae=h&&ne>0?[{id:"resources",label:"Resources",count:ne}]:[],e[32]=h,e[33]=ne,e[34]=ae):ae=e[34];let we;if(e[35]!==c||e[36]!==A||e[37]!==h||e[38]!==re||e[39]!==ie||e[40]!==ae){let T;e[42]!==A?(T=A?[{id:"readme",label:"README"}]:[],e[42]=A,e[43]=T):T=e[43],we=[Te,...re,...ie,...ae,...h?(c||[]).map(Gs):[],...T],e[35]=c,e[36]=A,e[37]=h,e[38]=re,e[39]=ie,e[40]=ae,e[41]=we}else we=e[41];const _e=we,jt=h&&_e.some(Qs)?"tools":"settings",E=_e.some(T=>T.id===a)?a:jt;let ke;e[44]!==m?(ke=T=>{m({search:U=>({...U,tab:T}),replace:!0})},e[44]=m,e[45]=ke):ke=e[45];const ce=ke;let le;e[46]!==c?(le=c||[],e[46]=c,e[47]=le):le=e[47];let Pe;if(e[48]!==E||e[49]!==le){let T;e[51]!==E?(T=U=>U.name===E,e[51]=E,e[52]=T):T=e[52],Pe=le.find(T),e[48]=E,e[49]=le,e[50]=Pe}else Pe=e[50];const Ie=Pe;let de;e[53]!==r?(de=t.jsx(Ze,{children:t.jsx(Xt,{asChild:!0,children:t.jsx(at,{to:"/$org/$project/mcps",params:{org:r,project:Se},children:"Connections"})})}),e[53]=r,e[54]=de):de=e[54];let $e;e[55]===Symbol.for("react.memo_cache_sentinel")?($e=t.jsx(Kt,{}),e[55]=$e):$e=e[55];let me;e[56]!==n.title?(me=t.jsx(Ze,{children:t.jsx(zt,{children:n.title})}),e[56]=n.title,e[57]=me):me=e[57];let Ae;e[58]!==de||e[59]!==me?(Ae=t.jsx(Wt,{children:t.jsxs(qt,{children:[de,$e,me]})}),e[58]=de,e[59]=me,e[60]=Ae):Ae=e[60];const Ue=Ae;let ue;e[61]!==D||e[62]!==g||e[63]!==z||e[64]!==f?(ue=t.jsx(Vt,{onSave:D,onUndo:g,isDirty:z,isSaving:f}),e[61]=D,e[62]=g,e[63]=z,e[64]=f,e[65]=ue):ue=e[65];const Fe=n.icon??"settings";let pe;e[66]!==n.title||e[67]!==Fe||e[68]!==w?(pe=t.jsx(Ke,{title:n.title,url:w,icon:Fe}),e[66]=n.title,e[67]=Fe,e[68]=w,e[69]=pe):pe=e[69];let fe;e[70]!==ue||e[71]!==pe?(fe=t.jsxs(qe,{children:[ue,pe]}),e[70]=ue,e[71]=pe,e[72]=fe):fe=e[72];let xe;e[73]!==_.hasOAuthToken||e[74]!==n||e[75]!==C||e[76]!==O||e[77]!==H||e[78]!==h?(xe=t.jsx("div",{className:"w-100 shrink-0 border-r border-border bg-background",children:t.jsx(bs,{form:C,connection:n,isMCPAuthenticated:h,hasOAuthToken:_.hasOAuthToken,onReauthenticate:O,onRemoveOAuth:H})}),e[73]=_.hasOAuthToken,e[74]=n,e[75]=C,e[76]=O,e[77]=H,e[78]=h,e[79]=xe):xe=e[79];let he;e[80]!==E||e[81]!==ce||e[82]!==_e?(he=t.jsx("div",{className:"shrink-0 flex items-center gap-4 px-5 py-3 border-b border-border",children:t.jsx(Ht,{tabs:_e,activeTab:E,onTabChange:ce,className:"flex-1"})}),e[80]=E,e[81]=ce,e[82]=_e,e[83]=he):he=e[83];let Ve;e[84]===Symbol.for("react.memo_cache_sentinel")?(Ve=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Ee,{size:32,className:"animate-spin text-muted-foreground"})}),e[84]=Ve):Ve=e[84];let ge;e[85]!==Ie||e[86]!==E||e[87]!==_.isServerError||e[88]!==_.supportsOAuth||e[89]!==n||e[90]!==o||e[91]!==C||e[92]!==O||e[93]!==ce||e[94]!==$||e[95]!==A||e[96]!==i||e[97]!==h||e[98]!==r||e[99]!==l||e[100]!==M||e[101]!==x||e[102]!==p?(ge=t.jsx(Y.Suspense,{fallback:Ve,children:E==="tools"?t.jsx(Fs,{tools:p,connectionId:o,org:r,isLoading:i}):E==="prompts"?t.jsx(ks,{prompts:l,connectionId:o,org:r}):E==="resources"?t.jsx(Rs,{resources:x,connectionId:o,org:r}):E==="settings"?t.jsx(Et,{connection:n,form:C,hasMcpBinding:$,isMCPAuthenticated:h,supportsOAuth:_.supportsOAuth,isServerError:_.isServerError,onAuthenticate:O,onViewReadme:A?()=>ce("readme"):void 0}):E==="readme"&&A?t.jsx(Ps,{repository:M}):Ie&&h?t.jsx(Gt,{connectionId:o,org:r,activeCollection:Ie},E):t.jsx(Ne,{title:"Collection not found",description:"This collection may have been deleted or you may not have access."})}),e[85]=Ie,e[86]=E,e[87]=_.isServerError,e[88]=_.supportsOAuth,e[89]=n,e[90]=o,e[91]=C,e[92]=O,e[93]=ce,e[94]=$,e[95]=A,e[96]=i,e[97]=h,e[98]=r,e[99]=l,e[100]=M,e[101]=x,e[102]=p,e[103]=ge):ge=e[103];let je;e[104]!==E||e[105]!==ge?(je=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(mt,{children:ge},E)}),e[104]=E,e[105]=ge,e[106]=je):je=e[106];let be;e[107]!==he||e[108]!==je?(be=t.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:[he,je]}),e[107]=he,e[108]=je,e[109]=be):be=e[109];let ve;e[110]!==xe||e[111]!==be?(ve=t.jsxs("div",{className:"flex h-full w-full bg-background overflow-hidden",children:[xe,be]}),e[110]=xe,e[111]=be,e[112]=ve):ve=e[112];let Me;return e[113]!==Ue||e[114]!==fe||e[115]!==ve?(Me=t.jsxs(Qt,{breadcrumb:Ue,children:[fe,ve]}),e[113]=Ue,e[114]=fe,e[115]=ve,e[116]=Me):Me=e[116],Me}function Qs(s){return s.id==="tools"}function Gs(s){return{id:s.name,label:s.displayName}}function Js(){const s=X.c(43);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/$project/mcps/$connectionId"},s[0]=e):e=s[0];const n=Re(e);let o;s[1]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/$project/mcps/$connectionId"},s[1]=o):o=s[1];const{connectionId:r,org:a}=St(o),{org:c}=ct();let u;s[2]===Symbol.for("react.memo_cache_sentinel")?(u={from:"/shell/$org/$project/mcps/$connectionId"},s[2]=u):u=s[2];const l=Tt(u).tab??"",x=We(r),p=pt(),i=Mt(x??void 0);let b;s[3]!==r||s[4]!==c.id?(b={connectionId:r,orgId:c.id},s[3]=r,s[4]=c.id,s[5]=b):b=s[5];const m=Rt(b);let d;s[6]!==m?(d={client:m},s[6]=m,s[7]=d):d=s[7];const{data:j}=Ut(d);let w;s[8]!==m?(w={client:m},s[8]=m,s[9]=w):w=s[9];const{data:v}=Ft(w),_=!(x?.connection_type==="VIRTUAL")&&x?.tools&&x.tools.length>0,y=!_;let h;s[10]!==m||s[11]!==y?(h={client:m,enabled:y},s[10]=m,s[11]=y,s[12]=h):h=s[12];const{data:k,isLoading:B}=Lt(h);let $;s[13]!==j?.prompts?($=j?.prompts??[],s[13]=j?.prompts,s[14]=$):$=s[14];let M;s[15]!==$?(M=$.map(en),s[15]=$,s[16]=M):M=s[16];const A=M;let I;s[17]!==v?.resources?(I=v?.resources??[],s[17]=v?.resources,s[18]=I):I=s[18];let R;s[19]!==I?(R=I.map(Zs),s[19]=I,s[20]=R):R=s[20];const L=R;let C;s[21]!==x||s[22]!==_||s[23]!==k?.tools?(C=_?x.tools??[]:(k?.tools??[]).map(Ys),s[21]=x,s[22]=_,s[23]=k?.tools,s[24]=C):C=s[24];const z=C;let P;s[25]!==p.update||s[26]!==r?(P=async g=>{await p.update.mutateAsync({id:r,data:g})},s[25]=p.update,s[26]=r,s[27]=P):P=s[27];const D=P;if(!x){let g;return s[28]!==n||s[29]!==a?(g=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ne,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(Be,{variant:"outline",onClick:()=>n({to:"/$org/$project/mcps",params:{org:a,project:Se}}),children:"Back to connections"})})}),s[28]=n,s[29]=a,s[30]=g):g=s[30],g}let V;return s[31]!==p.update.isPending||s[32]!==i||s[33]!==x||s[34]!==r||s[35]!==D||s[36]!==B||s[37]!==a||s[38]!==A||s[39]!==l||s[40]!==L||s[41]!==z?(V=t.jsx(Hs,{org:a,connection:x,connectionId:r,requestedTabId:l,collections:i,onUpdate:D,isUpdating:p.update.isPending,prompts:A,resources:L,tools:z,isLoadingTools:B}),s[31]=p.update.isPending,s[32]=i,s[33]=x,s[34]=r,s[35]=D,s[36]=B,s[37]=a,s[38]=A,s[39]=l,s[40]=L,s[41]=z,s[42]=V):V=s[42],V}function Ys(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,annotations:s.annotations}}function Zs(s){return{uri:s.uri,name:s.name,description:s.description}}function en(s){return{name:s.name,description:s.description}}function tn(){const s=X.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(mt,{children:t.jsx(Y.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Ee,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Js,{})})}),s[0]=e):e=s[0],e}function tr(){const s=X.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(tn,{}),s[0]=e):e=s[0],e}export{tr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as be,j as e,r as X,u as Fe,y as Be,b as Ue,a as He,d as Le,ai as Me,l as ze,k as Re,i as Xe,O as g,t as D,o as ke,aj as We,s as C,ak as Ke}from"./index-Bi-e0xzQ.js";import{g as Ge}from"./generate-id-Dyweu44Y.js";import{C as qe,a as Qe}from"./collection-table-wrapper-D0tfp6ae.js";import{C as Je,E as L}from"./empty-state-uNOuiWjX.js";import{C as Ye}from"./connection-card-DKiGEKqq.js";import{B as M}from"./badge-CCE1KaWc.js";import{i as Ze}from"./AlertCircle-BeDT_HtY.js";import{i as et}from"./CheckCircle-B30C7Ky0.js";import{E as tt}from"./error-boundary-nhHtbH_I.js";import{I as nt}from"./integration-icon-DbBoUTfS.js";import{P as E}from"./index-KAr3Peh7.js";import{u as st,U as re}from"./use-list-state-CCBTDGCJ.js";import{u as ot}from"./use-binding-BmXtAx4J.js";import{f as rt,e as it}from"./registry-utils-DUuNgxkO.js";import{f as ie,a as ae,b as ce,c as le,d as de,e as me,A as ue,g as pe}from"./alert-dialog-EoSV6_8V.js";import{B as at,a as ct,b as lt,c as dt}from"./breadcrumb-DNYA-_ij.js";import{B as S}from"./button-B7HyH-Uh.js";import{D as mt,a as ut,b as pt,c as xt,d as ht,e as gt}from"./dialog-DZwwYB-k.js";import{D as xe,a as he,b as ge,c as F}from"./dropdown-menu-CjCphUtO.js";import{a as ft,F as f,b as j,c as y,d as v,f as _}from"./form-C__Se-gc.js";import{I as T}from"./input-CV0IyHA1.js";import{S as jt,a as yt,b as vt,c as _t,d as $}from"./select-DWD0v1iQ.js";import{T as Ct}from"./textarea-BM9yIjbb.js";import{g as Nt,h as bt}from"./use-connection-CClYhvEQ.js";import{u as fe,a as kt}from"./constants-zTlTQ-s2.js";import{b as wt}from"./use-mcp-tools-BavCvJJV.js";import{n as z}from"./Container-Bdkg5Azu.js";import{i as je}from"./DotsVertical-By9o8N3R.js";import{s as ye}from"./Eye-DKDxswcA.js";import{s as R}from"./Globe02-b9LENZ6B.js";import{i as St}from"./Loading01-CamudhzM.js";import{i as Tt}from"./Terminal-_VxivQ1F.js";import{s as ve}from"./Trash01-CthEEWHa.js";import{f as _e}from"./format-time-CMKyl-GC.js";import{r as Dt,E as Pt,e as we}from"./env-vars-editor-D67dFx2L.js";import"./ArrowUp-CA_4TfDf.js";import"./Check-CNueXKa4.js";import"./Grid01-DUtda9uA.js";import"./List-CKLUZ_VW.js";import"./tooltip-BRqbDzB0.js";import"./table-qdWaG6rv.js";import"./SearchMd-CcOZ3J1s.js";import"./card-C-0_lNug.js";import"./AlertTriangle-CpeNmzLj.js";import"./use-mobile-DrHpoELT.js";import"./avatar-L1PL1ayJ.js";import"./useQuery-BBSKX1go.js";import"./use-view-mode-BshQz6D5.js";import"./binder-BC9Wv1Ge.js";import"./ChevronRight-BFKyuaLR.js";import"./label-DJlc-dCS.js";import"./ChevronDown-Dee8Rzkh.js";import"./useMutation-aO9r1_oG.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./Plus-SyEjnSE4.js";function Ce(s){const o=be.c(3),{status:i}=s;if(i==="active"){let c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsxs(M,{variant:"success",className:"gap-1.5 text-success border-success/40 bg-background",children:[e.jsx(et,{size:12}),"Active"]}),o[0]=c):c=o[0],c}if(i==="error"){let c;return o[1]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsxs(M,{variant:"outline",className:"gap-1.5 text-destructive border-destructive/40 bg-background",children:[e.jsx(Ze,{size:12}),"Error"]}),o[1]=c):c=o[1],c}let d;return o[2]===Symbol.for("react.memo_cache_sentinel")?(d=e.jsx(M,{variant:"outline",className:"text-muted-foreground",children:"Inactive"}),o[2]=d):d=o[2],d}const It=ke({key:C(),value:C()}),Et=ke({title:C().min(1,"Name is required"),description:C().nullable().optional(),ui_type:Ke(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:C().optional(),connection_token:C().nullable().optional(),npx_package:C().optional(),stdio_command:C().optional(),stdio_args:C().optional(),stdio_cwd:C().optional(),env_vars:We(It).optional()}).refine(s=>s.ui_type==="NPX"?!!s.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(s=>s.ui_type==="STDIO"?!!s.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(s=>s.ui_type==="HTTP"||s.ui_type==="SSE"||s.ui_type==="Websocket"?!!s.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function U(s){const o=s.trim();if(!o)return"";try{const i=new URL(o),d=i.pathname.length>1?i.pathname.replace(/\/+$/,""):i.pathname;return`${i.origin}${d}`}catch{return o.replace(/\/+$/,"")}}function $t(s){const o=s.trim().split(/\s+/).filter(Boolean);if(o.length<2)return null;const i=o[0]?.toLowerCase();if(i!=="npx"&&i!=="bunx")return null;const c=o.slice(1).find(N=>!N.startsWith("-"));return c?{packageName:c}:null}function B(s){const{uiType:o}=s,i=U(s.connectionUrl??"");if((o==="HTTP"||o==="SSE"||o==="Websocket")&&i===U("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const d=(s.npxPackage??"").trim();return o==="NPX"&&d==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function Ne(s){if(s.registryItems.length===0||s.uiType!=="HTTP"&&s.uiType!=="SSE"&&s.uiType!=="Websocket")return null;const o=U(s.connectionUrl??"");if(!o)return null;const i=s.registryItems.find(N=>(N.server?.remotes??[]).some(O=>U(O.url??"")===o));if(!i)return null;const d=i.title||i.name||i.server?.title||i.server?.name||"",c=i.server?.description||i.description||i.summary||null;return d?{id:"registry",title:d,description:c}:null}function Ot(s,o){const i={command:"npx",args:["-y",s]},d=we(o);return Object.keys(d).length>0&&(i.envVars=d),i}function At(s,o,i,d){const c={command:s};o.trim()&&(c.args=o.trim().split(/\s+/)),i?.trim()&&(c.cwd=i.trim());const N=we(d);return Object.keys(N).length>0&&(c.envVars=N),c}function Vt(s){return s.command==="npx"}function Ft(s){return s.args?.find(o=>!o.startsWith("-"))??""}function Bt(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Ut(s,o){switch(o.type){case"edit":return{mode:"editing",connection:o.connection};case"delete":return{mode:"deleting",connection:o.connection};case"force-delete":return{mode:"force-deleting",connection:o.connection,agentNames:o.agentNames};case"close":return{mode:"idle"}}}function Ht(){const{org:s}=Fe(),o=Be(),i=Ue(),d=He({strict:!1}),{data:c}=Le.useSession(),{stdioEnabled:N}=Me(),l=st({namespace:s.slug,resource:"connections"}),O=Nt(),A=bt(l),[u,b]=X.useReducer(Ut,{mode:"idle"}),W=ot(A)[0],K=W?.id??"",G=rt(W?.tools),Se=fe({connectionId:K||null,orgId:s.id}),{data:Te}=wt({client:Se,toolName:G,toolArguments:{limit:200},enabled:!!(K&&G),staleTime:3600*1e3,select:t=>t.structuredContent??t}),q=it(Te??[]),Q=d.action==="create",De=()=>{i({to:"/$org/$project/mcps",params:{org:s.slug,project:g},search:{action:"create"}})},J=()=>{i({to:"/$org/$project/mcps",params:{org:s.slug,project:g},search:{}})},r=ze({resolver:Re(Et),defaultValues:{title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),p=r.watch("ui_type"),Y=r.watch("connection_url"),Pe=r.watch("npx_package"),P=B({uiType:p,connectionUrl:Y??"",npxPackage:Pe??""})??Ne({uiType:p,connectionUrl:Y??"",registryItems:q}),m=u.mode==="editing"?u.connection:null;X.useEffect(()=>{if(m){const t=Xe(m.connection_headers)?m.connection_headers:null;if(t&&m.connection_type==="STDIO"){const n=Dt(t.envVars);if(Vt(t)){const a=Ft(t);r.reset({title:m.title,description:m.description,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:a,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:n})}else{const a=Bt(t);r.reset({title:m.title,description:m.description,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:a.command,stdio_args:a.args,stdio_cwd:a.cwd,env_vars:n})}}else r.reset({title:m.title,description:m.description,ui_type:m.connection_type,connection_url:m.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else r.reset({title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[m,r]);const Z=fe({connectionId:kt,orgId:s.id}),ee=()=>{o.invalidateQueries({predicate:t=>{const n=t.queryKey;return n[1]===s.id&&n[3]==="collection"&&n[4]==="CONNECTIONS"}})},te=t=>{const n=t.content;return Array.isArray(n)&&n[0]?.type==="text"&&typeof n[0].text=="string"?n[0].text:"Unknown error"},Ie=async()=>{if(u.mode!=="deleting")return;const t=u.connection;b({type:"close"});try{const n=await Z.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:t.id}});if(n.isError){const a=te(n),k=a.replace(/^Error:\s*/,"");try{const x=JSON.parse(k);if(x.code==="CONNECTION_IN_USE"&&x.agentNames){b({type:"force-delete",connection:t,agentNames:x.agentNames.map(w=>`"${w}"`).join(", ")});return}}catch{}D.error(`Failed to delete connection: ${a}`);return}ee(),D.success("Connection deleted successfully")}catch(n){const a=n instanceof Error?n.message:String(n);D.error(`Failed to delete connection: ${a}`)}},Ee=async()=>{if(u.mode!=="force-deleting")return;const t=u.connection.id;b({type:"close"});try{const n=await Z.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:t,force:!0}});if(n.isError){D.error(`Failed to delete connection: ${te(n)}`);return}ee(),D.success("Connection deleted successfully")}catch(n){const a=n instanceof Error?n.message:String(n);D.error(`Failed to delete connection: ${a}`)}},$e=async t=>{let n,a=null,k=null,x=null;if(t.ui_type==="NPX"?(n="STDIO",a="",x=Ot(t.npx_package||"",t.env_vars||[])):t.ui_type==="STDIO"?(n="STDIO",a="",x=At(t.stdio_command||"",t.stdio_args||"",t.stdio_cwd,t.env_vars||[])):(n=t.ui_type,a=t.connection_url||"",k=t.connection_token||null),m){await O.update.mutateAsync({id:m.id,data:{title:t.title,description:t.description||null,connection_type:n,connection_url:a,...k&&{connection_token:k},...x&&{connection_headers:x}}}),b({type:"close"}),r.reset();return}const w=Ge("conn");await O.create.mutateAsync({id:w,title:t.title,description:t.description||null,connection_type:n,connection_url:a,connection_token:k,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:c?.user?.id||"system",organization_id:s.id,icon:null,app_name:null,app_id:null,connection_headers:x,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),J(),r.reset(),i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:w}})},ne=t=>{t||(Q?J():b({type:"close"}),r.reset())},V=t=>{const n=t.trim();if(!n)return;const a=!!r.formState.dirtyFields.title,k=!!r.formState.dirtyFields.description,x=!!r.formState.dirtyFields.env_vars,w=h=>{if(h&&(!a&&!r.getValues("title").trim()&&h.title&&r.setValue("title",h.title,{shouldDirty:!1}),!k&&!(r.getValues("description")??"").trim()&&h.description&&r.setValue("description",h.description,{shouldDirty:!1}),!x&&h.envVarKeys?.length)){const se=r.getValues("env_vars")??[],Ve=new Set(se.map(I=>I.key)),oe=h.envVarKeys.filter(I=>!Ve.has(I));oe.length>0&&r.setValue("env_vars",[...se,...oe.map(I=>({key:I,value:""}))],{shouldDirty:!0})}},H=$t(n);if(H&&N){r.setValue("ui_type","NPX",{shouldDirty:!0}),r.setValue("npx_package",H.packageName,{shouldDirty:!0}),r.setValue("connection_url","",{shouldDirty:!0}),r.setValue("connection_token",null,{shouldDirty:!0}),w(B({uiType:"NPX",npxPackage:H.packageName}));return}if(n.startsWith("http://")||n.startsWith("https://")){const h=p==="HTTP"||p==="SSE"||p==="Websocket"?p:"HTTP";r.setValue("ui_type",h,{shouldDirty:!0}),r.setValue("connection_url",n,{shouldDirty:!0}),w(B({uiType:h,connectionUrl:n})??Ne({uiType:h,connectionUrl:n,registryItems:q}));return}p==="NPX"&&w(B({uiType:"NPX",npxPackage:n}))},Oe=[{id:"title",header:"Name",render:t=>e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(nt,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:e.jsx(z,{})}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate block",title:t.title,children:t.title})]}),cellClassName:"w-32 min-w-0 shrink-0",sortable:!0},{id:"description",header:"Description",render:t=>e.jsx("span",{className:"text-sm text-muted-foreground truncate block",title:t.description||"",children:t.description||"—"}),cellClassName:"flex-1 min-w-0 max-w-0",wrap:!1,sortable:!0},{id:"connection_type",header:"Type",accessor:t=>e.jsx("span",{className:"text-xs font-medium",children:t.connection_type}),cellClassName:"w-16 shrink-0",sortable:!0},{id:"status",header:"Status",render:t=>e.jsx(Ce,{status:t.status}),cellClassName:"w-28 shrink-0",sortable:!1},{id:"updated_by",header:"Updated by",render:t=>e.jsx(re,{id:t.updated_by??t.created_by,size:"3xs"}),cellClassName:"w-32 shrink-0",sortable:!0},{id:"updated_at",header:"Updated",render:t=>e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:t.updated_at?_e(new Date(t.updated_at)):"—"}),cellClassName:"max-w-24 w-24 shrink-0",sortable:!0},{id:"actions",header:"",render:t=>e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:n=>n.stopPropagation(),children:e.jsx(je,{size:20})})}),e.jsxs(ge,{align:"end",onClick:n=>n.stopPropagation(),children:[e.jsxs(F,{onClick:n=>{n.stopPropagation(),i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}})},children:[e.jsx(ye,{size:16}),"Open"]}),e.jsxs(F,{variant:"destructive",onClick:n=>{n.stopPropagation(),b({type:"delete",connection:t})},children:[e.jsx(ve,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],Ae=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",onClick:()=>i({to:"/$org/$project/store",params:{org:s.slug,project:g}}),size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Browse Store"}),e.jsx(S,{onClick:De,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})]});return e.jsxs(E,{children:[e.jsx(mt,{open:Q||u.mode==="editing",onOpenChange:ne,children:e.jsxs(ut,{className:"sm:max-w-[525px]",children:[e.jsxs(pt,{children:[e.jsx(xt,{children:m?"Edit Connection":"Create Connection"}),e.jsx(ht,{children:m?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),e.jsx(ft,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit($e),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(f,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Type *"}),e.jsxs(jt,{value:t.value,onValueChange:t.onChange,children:[e.jsx(v,{children:e.jsx(yt,{children:e.jsx(vt,{})})}),e.jsxs(_t,{children:[e.jsx($,{value:"HTTP",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"HTTP"]})}),e.jsx($,{value:"SSE",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"SSE"]})}),e.jsx($,{value:"Websocket",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"Websocket"]})}),N&&e.jsxs(e.Fragment,{children:[e.jsx($,{value:"NPX",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"NPX Package"]})}),e.jsx($,{value:"STDIO",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Tt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),e.jsx(_,{})]})}),p==="NPX"&&e.jsx(e.Fragment,{children:e.jsx(f,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"NPM Package *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"@perplexity-ai/mcp-server",...t,value:t.value??"",onPaste:n=>{const a=n.clipboardData.getData("text");a&&(n.preventDefault(),r.setValue("npx_package",a.trim(),{shouldDirty:!0}),V(a))},onBlur:n=>{V(n.target.value),t.onBlur()}})}),e.jsx(_,{})]})})}),p==="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[e.jsx(f,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Command *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"node, bun, python...",...t,value:t.value??""})}),e.jsx(_,{})]})}),e.jsx(f,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Arguments"}),e.jsx(v,{children:e.jsx(T,{placeholder:"arg1 arg2 --flag value",...t,value:t.value??""})}),e.jsx(_,{})]})})]}),e.jsx(f,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Working Directory"}),e.jsx(v,{children:e.jsx(T,{placeholder:"/path/to/project (optional)",...t,value:t.value??""})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),e.jsx(_,{})]})})]}),(p==="NPX"||p==="STDIO")&&e.jsx(f,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Environment Variables"}),e.jsx(v,{children:e.jsx(Pt,{value:t.value??[],onChange:t.onChange})}),e.jsx(_,{})]})}),p!=="NPX"&&p!=="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsx(f,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"URL *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"https://example.com/mcp",...t,value:t.value??"",onPaste:n=>{const a=n.clipboardData.getData("text");a&&(n.preventDefault(),r.setValue("connection_url",a.trim(),{shouldDirty:!0}),V(a))},onBlur:n=>{V(n.target.value),t.onBlur()}})}),e.jsx(_,{})]})}),e.jsx(f,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:P?.token?.label??"Token (optional)"}),e.jsx(v,{children:e.jsx(T,{type:"password",placeholder:P?.token?.placeholder??"Bearer token or API key",...t,value:t.value??""})}),P?.token?.helperText&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.token.helperText,P.id==="github"&&e.jsxs(e.Fragment,{children:[" ","·"," ",e.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),e.jsx(_,{})]})})]}),e.jsx(f,{control:r.control,name:"title",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Name *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"My Connection",...t})}),e.jsx(_,{})]})}),e.jsx(f,{control:r.control,name:"description",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Description"}),e.jsx(v,{children:e.jsx(Ct,{placeholder:"A brief description of this connection",rows:3,...t,value:t.value??""})}),e.jsx(_,{})]})})]}),e.jsxs(gt,{children:[e.jsx(S,{type:"button",variant:"outline",onClick:()=>ne(!1),children:"Cancel"}),e.jsx(S,{type:"submit",disabled:r.formState.isSubmitting,className:"min-w-40",children:r.formState.isSubmitting?"Saving...":m?"Update Connection":"Create Connection"})]})]})})]})}),e.jsx(ie,{open:u.mode==="deleting",onOpenChange:t=>!t&&b({type:"close"}),children:e.jsxs(ae,{children:[e.jsxs(ce,{children:[e.jsx(le,{children:"Delete Connection?"}),e.jsxs(de,{children:["This action cannot be undone. This will permanently delete"," ",e.jsx("span",{className:"font-medium text-foreground",children:u.mode==="deleting"&&u.connection.title}),"."]})]}),e.jsxs(me,{children:[e.jsx(ue,{children:"Cancel"}),e.jsx(pe,{onClick:Ie,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e.jsx(ie,{open:u.mode==="force-deleting",onOpenChange:t=>!t&&b({type:"close"}),children:e.jsxs(ae,{children:[e.jsxs(ce,{children:[e.jsx(le,{children:"Connection Used by Agents"}),e.jsx(de,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["The connection"," ",e.jsx("span",{className:"font-medium text-foreground",children:u.mode==="force-deleting"&&u.connection.title})," ","is currently used by the following agent(s):"," ",e.jsx("span",{className:"font-medium text-foreground",children:u.mode==="force-deleting"&&u.agentNames}),"."]}),e.jsx("p",{className:"mt-2",children:"Deleting this connection will remove it from those agents, which may impact existing workflows that depend on them."})]})})]}),e.jsxs(me,{children:[e.jsx(ue,{children:"Cancel"}),e.jsx(pe,{onClick:Ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Anyway"})]})]})}),e.jsxs(E.Header,{children:[e.jsx(E.Header.Left,{children:e.jsx(at,{children:e.jsx(ct,{children:e.jsx(lt,{children:e.jsx(dt,{children:"Connections"})})})})}),e.jsxs(E.Header.Right,{children:[e.jsx(qe,{viewMode:l.viewMode,onViewModeChange:l.setViewMode,sortKey:l.sortKey,sortDirection:l.sortDirection,onSort:l.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}]}),Ae]})]}),e.jsx(Je,{value:l.search,onChange:l.setSearch,placeholder:"Search for a Connection...",onKeyDown:t=>{t.key==="Escape"&&(l.setSearch(""),t.target.blur())}}),e.jsx(E.Content,{children:l.viewMode==="cards"?e.jsx("div",{className:"flex-1 overflow-auto p-5",children:A.length===0?e.jsx(L,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:(l.search,"No Connections found"),description:l.search?`No Connections match "${l.search}"`:"Create a connection to get started.",actions:!l.search&&e.jsx(S,{variant:"outline",onClick:()=>i({to:"/$org/$project/store",params:{org:s.slug,project:g}}),children:"Browse Store"})}):e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:A.map(t=>e.jsx(Ye,{connection:t,fallbackIcon:e.jsx(z,{}),onClick:()=>i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}}),headerActions:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:n=>n.stopPropagation(),children:e.jsx(je,{size:20})})}),e.jsxs(ge,{align:"end",onClick:n=>n.stopPropagation(),children:[e.jsxs(F,{onClick:n=>{n.stopPropagation(),i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}})},children:[e.jsx(ye,{size:16}),"Open"]}),e.jsxs(F,{variant:"destructive",onClick:n=>{n.stopPropagation(),b({type:"delete",connection:t})},children:[e.jsx(ve,{size:16}),"Delete"]})]})]}),body:e.jsx(Ce,{status:t.status}),footer:e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground w-full min-w-0",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(re,{id:t.updated_by??t.created_by,size:"3xs"})}),e.jsx("span",{className:"shrink-0 ml-2",children:t.updated_at?_e(new Date(t.updated_at)):"—"})]})},t.id))})}):e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-auto min-w-0",children:e.jsx("div",{className:"min-w-[1000px]",children:e.jsx(Qe,{columns:Oe,data:A,isLoading:!1,sortKey:l.sortKey,sortDirection:l.sortDirection,onSort:l.handleSort,onRowClick:t=>i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}}),emptyState:l.search?e.jsx(L,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:`No Connections match "${l.search}"`}):e.jsx(L,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:"Create a connection to get started.",actions:e.jsx(S,{variant:"outline",onClick:()=>i({to:"/$org/$project/store",params:{org:s.slug,project:g}}),children:"Browse Store"})})})})})})})]})}function zn(){const s=be.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(tt,{children:e.jsx(X.Suspense,{fallback:e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(St,{size:32,className:"animate-spin text-muted-foreground"})}),children:e.jsx(Ht,{})})}),s[0]=o):o=s[0],o}export{zn as default};
|
|
1
|
+
import{c as be,j as e,r as X,u as Fe,y as Be,b as Ue,a as He,d as Le,ai as Me,l as ze,k as Re,i as Xe,O as g,t as D,o as ke,aj as We,s as C,ak as Ke}from"./index-DORq2iDV.js";import{g as Ge}from"./generate-id-Dyweu44Y.js";import{C as qe,a as Qe}from"./collection-table-wrapper-DHsLzzwx.js";import{C as Je,E as L}from"./empty-state-J0iNaH6o.js";import{C as Ye}from"./connection-card-BIBvjyy9.js";import{B as M}from"./badge-HG4Wd9Mh.js";import{i as Ze}from"./AlertCircle-Dcv7gp-I.js";import{i as et}from"./CheckCircle-HtLjegW2.js";import{E as tt}from"./error-boundary-Cw9mogkc.js";import{I as nt}from"./integration-icon-BdGEh9QA.js";import{P as E}from"./index-CdvbUeMY.js";import{u as st,U as re}from"./use-list-state-D5uNQEJf.js";import{u as ot}from"./use-binding-JQRdy56n.js";import{f as rt,e as it}from"./registry-utils-DbEnt6lf.js";import{f as ie,a as ae,b as ce,c as le,d as de,e as me,A as ue,g as pe}from"./alert-dialog-YO7F1UnW.js";import{B as at,a as ct,b as lt,c as dt}from"./breadcrumb-CyS88-Ut.js";import{B as S}from"./button-CVYD_l4f.js";import{D as mt,a as ut,b as pt,c as xt,d as ht,e as gt}from"./dialog-VPGAGt8b.js";import{D as xe,a as he,b as ge,c as F}from"./dropdown-menu-CFgggJR1.js";import{a as ft,F as f,b as j,c as y,d as v,f as _}from"./form-BVo4Hzsi.js";import{I as T}from"./input-Bh5KX8XE.js";import{S as jt,a as yt,b as vt,c as _t,d as $}from"./select-jAphy_-Y.js";import{T as Ct}from"./textarea-B4df3c-A.js";import{g as Nt,h as bt}from"./use-connection-C7Ykn5We.js";import{u as fe,a as kt}from"./constants-C7Ec6iJ9.js";import{b as wt}from"./use-mcp-tools-BPBUJeNd.js";import{n as z}from"./Container-CMzzA9YA.js";import{i as je}from"./DotsVertical-D_euv27G.js";import{s as ye}from"./Eye-CE7mKBNe.js";import{s as R}from"./Globe02-RkDxZVVj.js";import{i as St}from"./Loading01-B5HJTtc0.js";import{i as Tt}from"./Terminal-XYm-55WZ.js";import{s as ve}from"./Trash01-dBw88Tyb.js";import{f as _e}from"./format-time-CMKyl-GC.js";import{r as Dt,E as Pt,e as we}from"./env-vars-editor-BuXgYNmv.js";import"./ArrowUp-D1Z3ZGMT.js";import"./Check-B6v8UYhw.js";import"./Grid01-C8mqRkg1.js";import"./List-ChoGNa5p.js";import"./tooltip-4z3Dj1Ic.js";import"./table-oUu9PtOj.js";import"./SearchMd-DBdGvvkJ.js";import"./card-BESAH6x0.js";import"./AlertTriangle-CoVws0Do.js";import"./use-mobile-aOwHFgFs.js";import"./avatar-CXlAe-d0.js";import"./useQuery-psr46-dB.js";import"./use-view-mode-BKl_7npX.js";import"./binder-gZKFqPm8.js";import"./ChevronRight-CtfDv6KV.js";import"./label-DyOg7nzh.js";import"./ChevronDown-RHEfxY7t.js";import"./useMutation-DIYvmP8t.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./Plus-CRPlP_jA.js";function Ce(s){const o=be.c(3),{status:i}=s;if(i==="active"){let c;return o[0]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsxs(M,{variant:"success",className:"gap-1.5 text-success border-success/40 bg-background",children:[e.jsx(et,{size:12}),"Active"]}),o[0]=c):c=o[0],c}if(i==="error"){let c;return o[1]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsxs(M,{variant:"outline",className:"gap-1.5 text-destructive border-destructive/40 bg-background",children:[e.jsx(Ze,{size:12}),"Error"]}),o[1]=c):c=o[1],c}let d;return o[2]===Symbol.for("react.memo_cache_sentinel")?(d=e.jsx(M,{variant:"outline",className:"text-muted-foreground",children:"Inactive"}),o[2]=d):d=o[2],d}const It=ke({key:C(),value:C()}),Et=ke({title:C().min(1,"Name is required"),description:C().nullable().optional(),ui_type:Ke(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:C().optional(),connection_token:C().nullable().optional(),npx_package:C().optional(),stdio_command:C().optional(),stdio_args:C().optional(),stdio_cwd:C().optional(),env_vars:We(It).optional()}).refine(s=>s.ui_type==="NPX"?!!s.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(s=>s.ui_type==="STDIO"?!!s.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(s=>s.ui_type==="HTTP"||s.ui_type==="SSE"||s.ui_type==="Websocket"?!!s.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function U(s){const o=s.trim();if(!o)return"";try{const i=new URL(o),d=i.pathname.length>1?i.pathname.replace(/\/+$/,""):i.pathname;return`${i.origin}${d}`}catch{return o.replace(/\/+$/,"")}}function $t(s){const o=s.trim().split(/\s+/).filter(Boolean);if(o.length<2)return null;const i=o[0]?.toLowerCase();if(i!=="npx"&&i!=="bunx")return null;const c=o.slice(1).find(N=>!N.startsWith("-"));return c?{packageName:c}:null}function B(s){const{uiType:o}=s,i=U(s.connectionUrl??"");if((o==="HTTP"||o==="SSE"||o==="Websocket")&&i===U("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const d=(s.npxPackage??"").trim();return o==="NPX"&&d==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function Ne(s){if(s.registryItems.length===0||s.uiType!=="HTTP"&&s.uiType!=="SSE"&&s.uiType!=="Websocket")return null;const o=U(s.connectionUrl??"");if(!o)return null;const i=s.registryItems.find(N=>(N.server?.remotes??[]).some(O=>U(O.url??"")===o));if(!i)return null;const d=i.title||i.name||i.server?.title||i.server?.name||"",c=i.server?.description||i.description||i.summary||null;return d?{id:"registry",title:d,description:c}:null}function Ot(s,o){const i={command:"npx",args:["-y",s]},d=we(o);return Object.keys(d).length>0&&(i.envVars=d),i}function At(s,o,i,d){const c={command:s};o.trim()&&(c.args=o.trim().split(/\s+/)),i?.trim()&&(c.cwd=i.trim());const N=we(d);return Object.keys(N).length>0&&(c.envVars=N),c}function Vt(s){return s.command==="npx"}function Ft(s){return s.args?.find(o=>!o.startsWith("-"))??""}function Bt(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Ut(s,o){switch(o.type){case"edit":return{mode:"editing",connection:o.connection};case"delete":return{mode:"deleting",connection:o.connection};case"force-delete":return{mode:"force-deleting",connection:o.connection,agentNames:o.agentNames};case"close":return{mode:"idle"}}}function Ht(){const{org:s}=Fe(),o=Be(),i=Ue(),d=He({strict:!1}),{data:c}=Le.useSession(),{stdioEnabled:N}=Me(),l=st({namespace:s.slug,resource:"connections"}),O=Nt(),A=bt(l),[u,b]=X.useReducer(Ut,{mode:"idle"}),W=ot(A)[0],K=W?.id??"",G=rt(W?.tools),Se=fe({connectionId:K||null,orgId:s.id}),{data:Te}=wt({client:Se,toolName:G,toolArguments:{limit:200},enabled:!!(K&&G),staleTime:3600*1e3,select:t=>t.structuredContent??t}),q=it(Te??[]),Q=d.action==="create",De=()=>{i({to:"/$org/$project/mcps",params:{org:s.slug,project:g},search:{action:"create"}})},J=()=>{i({to:"/$org/$project/mcps",params:{org:s.slug,project:g},search:{}})},r=ze({resolver:Re(Et),defaultValues:{title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),p=r.watch("ui_type"),Y=r.watch("connection_url"),Pe=r.watch("npx_package"),P=B({uiType:p,connectionUrl:Y??"",npxPackage:Pe??""})??Ne({uiType:p,connectionUrl:Y??"",registryItems:q}),m=u.mode==="editing"?u.connection:null;X.useEffect(()=>{if(m){const t=Xe(m.connection_headers)?m.connection_headers:null;if(t&&m.connection_type==="STDIO"){const n=Dt(t.envVars);if(Vt(t)){const a=Ft(t);r.reset({title:m.title,description:m.description,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:a,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:n})}else{const a=Bt(t);r.reset({title:m.title,description:m.description,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:a.command,stdio_args:a.args,stdio_cwd:a.cwd,env_vars:n})}}else r.reset({title:m.title,description:m.description,ui_type:m.connection_type,connection_url:m.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else r.reset({title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[m,r]);const Z=fe({connectionId:kt,orgId:s.id}),ee=()=>{o.invalidateQueries({predicate:t=>{const n=t.queryKey;return n[1]===s.id&&n[3]==="collection"&&n[4]==="CONNECTIONS"}})},te=t=>{const n=t.content;return Array.isArray(n)&&n[0]?.type==="text"&&typeof n[0].text=="string"?n[0].text:"Unknown error"},Ie=async()=>{if(u.mode!=="deleting")return;const t=u.connection;b({type:"close"});try{const n=await Z.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:t.id}});if(n.isError){const a=te(n),k=a.replace(/^Error:\s*/,"");try{const x=JSON.parse(k);if(x.code==="CONNECTION_IN_USE"&&x.agentNames){b({type:"force-delete",connection:t,agentNames:x.agentNames.map(w=>`"${w}"`).join(", ")});return}}catch{}D.error(`Failed to delete connection: ${a}`);return}ee(),D.success("Connection deleted successfully")}catch(n){const a=n instanceof Error?n.message:String(n);D.error(`Failed to delete connection: ${a}`)}},Ee=async()=>{if(u.mode!=="force-deleting")return;const t=u.connection.id;b({type:"close"});try{const n=await Z.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:t,force:!0}});if(n.isError){D.error(`Failed to delete connection: ${te(n)}`);return}ee(),D.success("Connection deleted successfully")}catch(n){const a=n instanceof Error?n.message:String(n);D.error(`Failed to delete connection: ${a}`)}},$e=async t=>{let n,a=null,k=null,x=null;if(t.ui_type==="NPX"?(n="STDIO",a="",x=Ot(t.npx_package||"",t.env_vars||[])):t.ui_type==="STDIO"?(n="STDIO",a="",x=At(t.stdio_command||"",t.stdio_args||"",t.stdio_cwd,t.env_vars||[])):(n=t.ui_type,a=t.connection_url||"",k=t.connection_token||null),m){await O.update.mutateAsync({id:m.id,data:{title:t.title,description:t.description||null,connection_type:n,connection_url:a,...k&&{connection_token:k},...x&&{connection_headers:x}}}),b({type:"close"}),r.reset();return}const w=Ge("conn");await O.create.mutateAsync({id:w,title:t.title,description:t.description||null,connection_type:n,connection_url:a,connection_token:k,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:c?.user?.id||"system",organization_id:s.id,icon:null,app_name:null,app_id:null,connection_headers:x,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),J(),r.reset(),i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:w}})},ne=t=>{t||(Q?J():b({type:"close"}),r.reset())},V=t=>{const n=t.trim();if(!n)return;const a=!!r.formState.dirtyFields.title,k=!!r.formState.dirtyFields.description,x=!!r.formState.dirtyFields.env_vars,w=h=>{if(h&&(!a&&!r.getValues("title").trim()&&h.title&&r.setValue("title",h.title,{shouldDirty:!1}),!k&&!(r.getValues("description")??"").trim()&&h.description&&r.setValue("description",h.description,{shouldDirty:!1}),!x&&h.envVarKeys?.length)){const se=r.getValues("env_vars")??[],Ve=new Set(se.map(I=>I.key)),oe=h.envVarKeys.filter(I=>!Ve.has(I));oe.length>0&&r.setValue("env_vars",[...se,...oe.map(I=>({key:I,value:""}))],{shouldDirty:!0})}},H=$t(n);if(H&&N){r.setValue("ui_type","NPX",{shouldDirty:!0}),r.setValue("npx_package",H.packageName,{shouldDirty:!0}),r.setValue("connection_url","",{shouldDirty:!0}),r.setValue("connection_token",null,{shouldDirty:!0}),w(B({uiType:"NPX",npxPackage:H.packageName}));return}if(n.startsWith("http://")||n.startsWith("https://")){const h=p==="HTTP"||p==="SSE"||p==="Websocket"?p:"HTTP";r.setValue("ui_type",h,{shouldDirty:!0}),r.setValue("connection_url",n,{shouldDirty:!0}),w(B({uiType:h,connectionUrl:n})??Ne({uiType:h,connectionUrl:n,registryItems:q}));return}p==="NPX"&&w(B({uiType:"NPX",npxPackage:n}))},Oe=[{id:"title",header:"Name",render:t=>e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(nt,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:e.jsx(z,{})}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate block",title:t.title,children:t.title})]}),cellClassName:"w-32 min-w-0 shrink-0",sortable:!0},{id:"description",header:"Description",render:t=>e.jsx("span",{className:"text-sm text-muted-foreground truncate block",title:t.description||"",children:t.description||"—"}),cellClassName:"flex-1 min-w-0 max-w-0",wrap:!1,sortable:!0},{id:"connection_type",header:"Type",accessor:t=>e.jsx("span",{className:"text-xs font-medium",children:t.connection_type}),cellClassName:"w-16 shrink-0",sortable:!0},{id:"status",header:"Status",render:t=>e.jsx(Ce,{status:t.status}),cellClassName:"w-28 shrink-0",sortable:!1},{id:"updated_by",header:"Updated by",render:t=>e.jsx(re,{id:t.updated_by??t.created_by,size:"3xs"}),cellClassName:"w-32 shrink-0",sortable:!0},{id:"updated_at",header:"Updated",render:t=>e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:t.updated_at?_e(new Date(t.updated_at)):"—"}),cellClassName:"max-w-24 w-24 shrink-0",sortable:!0},{id:"actions",header:"",render:t=>e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:n=>n.stopPropagation(),children:e.jsx(je,{size:20})})}),e.jsxs(ge,{align:"end",onClick:n=>n.stopPropagation(),children:[e.jsxs(F,{onClick:n=>{n.stopPropagation(),i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}})},children:[e.jsx(ye,{size:16}),"Open"]}),e.jsxs(F,{variant:"destructive",onClick:n=>{n.stopPropagation(),b({type:"delete",connection:t})},children:[e.jsx(ve,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],Ae=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{variant:"outline",onClick:()=>i({to:"/$org/$project/store",params:{org:s.slug,project:g}}),size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Browse Store"}),e.jsx(S,{onClick:De,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})]});return e.jsxs(E,{children:[e.jsx(mt,{open:Q||u.mode==="editing",onOpenChange:ne,children:e.jsxs(ut,{className:"sm:max-w-[525px]",children:[e.jsxs(pt,{children:[e.jsx(xt,{children:m?"Edit Connection":"Create Connection"}),e.jsx(ht,{children:m?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),e.jsx(ft,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit($e),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(f,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Type *"}),e.jsxs(jt,{value:t.value,onValueChange:t.onChange,children:[e.jsx(v,{children:e.jsx(yt,{children:e.jsx(vt,{})})}),e.jsxs(_t,{children:[e.jsx($,{value:"HTTP",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"HTTP"]})}),e.jsx($,{value:"SSE",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"SSE"]})}),e.jsx($,{value:"Websocket",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-4 h-4"}),"Websocket"]})}),N&&e.jsxs(e.Fragment,{children:[e.jsx($,{value:"NPX",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"NPX Package"]})}),e.jsx($,{value:"STDIO",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Tt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),e.jsx(_,{})]})}),p==="NPX"&&e.jsx(e.Fragment,{children:e.jsx(f,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"NPM Package *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"@perplexity-ai/mcp-server",...t,value:t.value??"",onPaste:n=>{const a=n.clipboardData.getData("text");a&&(n.preventDefault(),r.setValue("npx_package",a.trim(),{shouldDirty:!0}),V(a))},onBlur:n=>{V(n.target.value),t.onBlur()}})}),e.jsx(_,{})]})})}),p==="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[e.jsx(f,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Command *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"node, bun, python...",...t,value:t.value??""})}),e.jsx(_,{})]})}),e.jsx(f,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Arguments"}),e.jsx(v,{children:e.jsx(T,{placeholder:"arg1 arg2 --flag value",...t,value:t.value??""})}),e.jsx(_,{})]})})]}),e.jsx(f,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Working Directory"}),e.jsx(v,{children:e.jsx(T,{placeholder:"/path/to/project (optional)",...t,value:t.value??""})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),e.jsx(_,{})]})})]}),(p==="NPX"||p==="STDIO")&&e.jsx(f,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Environment Variables"}),e.jsx(v,{children:e.jsx(Pt,{value:t.value??[],onChange:t.onChange})}),e.jsx(_,{})]})}),p!=="NPX"&&p!=="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsx(f,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"URL *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"https://example.com/mcp",...t,value:t.value??"",onPaste:n=>{const a=n.clipboardData.getData("text");a&&(n.preventDefault(),r.setValue("connection_url",a.trim(),{shouldDirty:!0}),V(a))},onBlur:n=>{V(n.target.value),t.onBlur()}})}),e.jsx(_,{})]})}),e.jsx(f,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:P?.token?.label??"Token (optional)"}),e.jsx(v,{children:e.jsx(T,{type:"password",placeholder:P?.token?.placeholder??"Bearer token or API key",...t,value:t.value??""})}),P?.token?.helperText&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.token.helperText,P.id==="github"&&e.jsxs(e.Fragment,{children:[" ","·"," ",e.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),e.jsx(_,{})]})})]}),e.jsx(f,{control:r.control,name:"title",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Name *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"My Connection",...t})}),e.jsx(_,{})]})}),e.jsx(f,{control:r.control,name:"description",render:({field:t})=>e.jsxs(j,{children:[e.jsx(y,{children:"Description"}),e.jsx(v,{children:e.jsx(Ct,{placeholder:"A brief description of this connection",rows:3,...t,value:t.value??""})}),e.jsx(_,{})]})})]}),e.jsxs(gt,{children:[e.jsx(S,{type:"button",variant:"outline",onClick:()=>ne(!1),children:"Cancel"}),e.jsx(S,{type:"submit",disabled:r.formState.isSubmitting,className:"min-w-40",children:r.formState.isSubmitting?"Saving...":m?"Update Connection":"Create Connection"})]})]})})]})}),e.jsx(ie,{open:u.mode==="deleting",onOpenChange:t=>!t&&b({type:"close"}),children:e.jsxs(ae,{children:[e.jsxs(ce,{children:[e.jsx(le,{children:"Delete Connection?"}),e.jsxs(de,{children:["This action cannot be undone. This will permanently delete"," ",e.jsx("span",{className:"font-medium text-foreground",children:u.mode==="deleting"&&u.connection.title}),"."]})]}),e.jsxs(me,{children:[e.jsx(ue,{children:"Cancel"}),e.jsx(pe,{onClick:Ie,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e.jsx(ie,{open:u.mode==="force-deleting",onOpenChange:t=>!t&&b({type:"close"}),children:e.jsxs(ae,{children:[e.jsxs(ce,{children:[e.jsx(le,{children:"Connection Used by Agents"}),e.jsx(de,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["The connection"," ",e.jsx("span",{className:"font-medium text-foreground",children:u.mode==="force-deleting"&&u.connection.title})," ","is currently used by the following agent(s):"," ",e.jsx("span",{className:"font-medium text-foreground",children:u.mode==="force-deleting"&&u.agentNames}),"."]}),e.jsx("p",{className:"mt-2",children:"Deleting this connection will remove it from those agents, which may impact existing workflows that depend on them."})]})})]}),e.jsxs(me,{children:[e.jsx(ue,{children:"Cancel"}),e.jsx(pe,{onClick:Ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Anyway"})]})]})}),e.jsxs(E.Header,{children:[e.jsx(E.Header.Left,{children:e.jsx(at,{children:e.jsx(ct,{children:e.jsx(lt,{children:e.jsx(dt,{children:"Connections"})})})})}),e.jsxs(E.Header.Right,{children:[e.jsx(qe,{viewMode:l.viewMode,onViewModeChange:l.setViewMode,sortKey:l.sortKey,sortDirection:l.sortDirection,onSort:l.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}]}),Ae]})]}),e.jsx(Je,{value:l.search,onChange:l.setSearch,placeholder:"Search for a Connection...",onKeyDown:t=>{t.key==="Escape"&&(l.setSearch(""),t.target.blur())}}),e.jsx(E.Content,{children:l.viewMode==="cards"?e.jsx("div",{className:"flex-1 overflow-auto p-5",children:A.length===0?e.jsx(L,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:(l.search,"No Connections found"),description:l.search?`No Connections match "${l.search}"`:"Create a connection to get started.",actions:!l.search&&e.jsx(S,{variant:"outline",onClick:()=>i({to:"/$org/$project/store",params:{org:s.slug,project:g}}),children:"Browse Store"})}):e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:A.map(t=>e.jsx(Ye,{connection:t,fallbackIcon:e.jsx(z,{}),onClick:()=>i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}}),headerActions:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:n=>n.stopPropagation(),children:e.jsx(je,{size:20})})}),e.jsxs(ge,{align:"end",onClick:n=>n.stopPropagation(),children:[e.jsxs(F,{onClick:n=>{n.stopPropagation(),i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}})},children:[e.jsx(ye,{size:16}),"Open"]}),e.jsxs(F,{variant:"destructive",onClick:n=>{n.stopPropagation(),b({type:"delete",connection:t})},children:[e.jsx(ve,{size:16}),"Delete"]})]})]}),body:e.jsx(Ce,{status:t.status}),footer:e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground w-full min-w-0",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(re,{id:t.updated_by??t.created_by,size:"3xs"})}),e.jsx("span",{className:"shrink-0 ml-2",children:t.updated_at?_e(new Date(t.updated_at)):"—"})]})},t.id))})}):e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-auto min-w-0",children:e.jsx("div",{className:"min-w-[1000px]",children:e.jsx(Qe,{columns:Oe,data:A,isLoading:!1,sortKey:l.sortKey,sortDirection:l.sortDirection,onSort:l.handleSort,onRowClick:t=>i({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:g,connectionId:t.id}}),emptyState:l.search?e.jsx(L,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:`No Connections match "${l.search}"`}):e.jsx(L,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:"Create a connection to get started.",actions:e.jsx(S,{variant:"outline",onClick:()=>i({to:"/$org/$project/store",params:{org:s.slug,project:g}}),children:"Browse Store"})})})})})})})]})}function zn(){const s=be.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(tt,{children:e.jsx(X.Suspense,{fallback:e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(St,{size:32,className:"animate-spin text-muted-foreground"})}),children:e.jsx(Ht,{})})}),s[0]=o):o=s[0],o}export{zn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as y,j as _,ar as b,br as C,c as d,m as f,bs as T}from"./index-
|
|
1
|
+
import{r as y,j as _,ar as b,br as C,c as d,m as f,bs as T}from"./index-DORq2iDV.js";var v=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),w="VisuallyHidden",g=y.forwardRef((t,e)=>_.jsx(b.span,{...t,ref:e,style:{...v,...t.style}}));g.displayName=w;var D=g;const m={authConfig:()=>["authConfig"],threads:t=>["threads",t],virtualMcpThreads:(t,e)=>["threads",t,"virtual-mcp",e],thread:(t,e)=>["thread",t,e],threadMessages:(t,e)=>["thread-messages",t,e],messages:t=>["messages",t],organizations:()=>["organizations"],members:t=>[t,"members"],invitations:t=>[t,"invitations"],organizationRoles:t=>[t,"organization-roles"],connections:t=>[t,"connections"],connectionsByBinding:(t,e)=>[t,"connections",`binding:${e}`],connection:(t,e)=>[t,"connection",e],isMCPAuthenticated:(t,e)=>["is-mcp-authenticated",t,e],mcpTools:(t,e)=>["mcp","tools",t,e],mcpClient:(t,e,n,o)=>["mcp","client",t,e,n,o],mcpToolsList:t=>["mcp","client",t,"tools"],mcpResourcesList:t=>["mcp","client",t,"resources"],mcpPromptsList:t=>["mcp","client",t,"prompts"],mcpReadResource:(t,e)=>["mcp","client",t,"resource",e],mcpGetPrompt:(t,e,n)=>["mcp","client",t,"prompt",e,n],mcpToolCall:(t,e,n)=>["mcp","client",t,"tool-call",e,n],organizationSettings:t=>["organization-settings",t],activeOrganization:t=>["activeOrganization",t],modelsList:t=>["models-list",t],connectionCollections:t=>[t,"collections","discovery"],toolCall:(t,e,n)=>["tool-call",t,e,n],collectionItems:(t,e)=>["collection",t,e],collection:(t,e,n)=>[t,e,"collection",n],collectionItem:(t,e,n,o,i)=>[t,e,n,"collection",o,i],collectionList:(t,e,n,o,i)=>[t,e,n,"collection",o,"list",i],collectionListInfinite:(t,e,n,o,i)=>[t,e,n,"collection",o,"list-infinite",i],githubReadme:(t,e)=>["github-readme",t,e],monitoringStats:()=>["monitoring","stats"],monitoringLogs:t=>["monitoring","logs",t],monitoringLogsInfinite:(t,e)=>["monitoring","logs-infinite",t,e],virtualMcpPrompts:t=>["virtual-mcp",t,"prompts"],connectionPrompts:t=>["connection",t,"prompts"],connectionResources:t=>["connection",t,"resources"],user:t=>["user",t]};class P extends C{constructor(e,n){super(e,n)}send(e,n){const o=S(e);return o?.type==="emit"?(this.onmessage?.(o.message),Promise.resolve()):o?.type==="suppress"?Promise.resolve():super.send(e,n)}}function S(t){const e=t;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const n=e?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{},resources:{},prompts:{},tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}},serverInfo:{name:"mesh-virtual-mcp",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}const I={name:"mesh-sdk",version:"1.0.0"};function R(t,e){const n=e??(typeof window<"u"?window.location.origin:void 0);if(!n)throw new Error("MCP client requires either meshUrl option or a browser environment.");const o=t?`/mcp/${t}`:"/mcp";return new URL(o,n).href}async function h({connectionId:t,orgId:e,token:n,meshUrl:o}){const i=R(t,o),c=new T(I,{capabilities:{tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}}}),r=new P(new URL(i),{requestInit:{headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","x-org-id":e,...n?{Authorization:`Bearer ${n}`}:{}}}});await c.connect(r);const a=m.mcpClient(e,t??"self",n??"",o??"");return c.toJSON=()=>`mcp-client:${a.join(":")}`,c}function A(t){const e=d.c(13),{connectionId:n,orgId:o,token:i,meshUrl:c}=t;let r;e[0]!==n||e[1]!==c||e[2]!==o||e[3]!==i?(r=m.mcpClient(o,n??"self",i??"",c??""),e[0]=n,e[1]=c,e[2]=o,e[3]=i,e[4]=r):r=e[4];const a=r;let s;e[5]!==n||e[6]!==c||e[7]!==o||e[8]!==i?(s=()=>h({connectionId:n,orgId:o,token:i,meshUrl:c}),e[5]=n,e[6]=c,e[7]=o,e[8]=i,e[9]=s):s=e[9];let l;e[10]!==a||e[11]!==s?(l={queryKey:a,queryFn:s,staleTime:1/0,gcTime:0},e[10]=a,e[11]=s,e[12]=l):l=e[12];const{data:p}=f(l);return p}function O(t){const e=d.c(13),{connectionId:n,orgId:o,token:i,meshUrl:c}=t;let r;e[0]!==n||e[1]!==c||e[2]!==o||e[3]!==i?(r=n!==void 0?m.mcpClient(o,n??"self",i??"",c??""):["mcp","client","skip",o],e[0]=n,e[1]=c,e[2]=o,e[3]=i,e[4]=r):r=e[4];const a=r;let s;e[5]!==n||e[6]!==c||e[7]!==o||e[8]!==i?(s=async()=>n===void 0?null:h({connectionId:n,orgId:o,token:i,meshUrl:c}),e[5]=n,e[6]=c,e[7]=o,e[8]=i,e[9]=s):s=e[9];let l;e[10]!==a||e[11]!==s?(l={queryKey:a,queryFn:s,staleTime:1/0,gcTime:0},e[10]=a,e[11]=s,e[12]=l):l=e[12];const{data:p}=f(l);return p??null}const M={SELF:t=>`${t}_self`,REGISTRY:t=>`${t}_registry`,COMMUNITY_REGISTRY:t=>`${t}_community-registry`,DEV_ASSETS:t=>`${t}_dev-assets`},$="self";function j(t){return{id:M.REGISTRY(t),title:"Deco Store",description:"Official deco MCP registry with curated integrations",connection_type:"HTTP",connection_url:"https://api.decocms.com/mcp/registry",icon:"https://assets.decocache.com/decocms/00ccf6c3-9e13-4517-83b0-75ab84554bb9/596364c63320075ca58483660156b6d9de9b526e.png",app_name:"deco-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function z(){return{id:"community-registry",title:"MCP Registry",description:"Community MCP registry with thousands of handy MCPs",connection_type:"HTTP",connection_url:"https://sites-registry.decocache.com/mcp",icon:"https://assets.decocache.com/decocms/cd7ca472-0f72-463a-b0de-6e44bdd0f9b4/mcp.png",app_name:"mcp-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function K(t={}){return{id:t.id,title:"OpenRouter",description:"Access hundreds of LLM models from a single API",icon:"https://assets.decocache.com/decocms/b2e2f64f-6025-45f7-9e8c-3b3ebdd073d8/openrouter_logojpg.jpg",app_name:"openrouter",app_id:"openrouter",connection_type:"HTTP",connection_url:"https://sites-openrouter.decocache.com/mcp",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{source:"chat",verified:!1,scopeName:"deco",toolsCount:0,publishedAt:null,repository:null}}}function k(){return{title:"MCP Studio",description:"An app that allows you to create and manage MCPs",icon:"https://assets.decocache.com/mcp/09e44283-f47d-4046-955f-816d227c626f/app.png",app_name:"mcp-studio",app_id:"65a1b407-b6af-41e2-a89f-ce9450c05bbc",connection_type:"HTTP",connection_url:"https://sites-vibemcp.decocache.com/mcp",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!1,type:"mcp-studio"}}}function q(t){return{id:L(t),organization_id:t,title:"Decopilot",description:"Default agent that aggregates all organization connections",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,metadata:{instructions:null},connections:[]}}const u="decopilot_";function x(t){return!t||!t.startsWith(u)?null:t.slice(u.length)||null}function L(t){return`${u}${t}`}export{m as K,D as R,P as S,v as V,M as W,$ as a,z as b,h as c,q as d,k as e,K as f,L as g,j as h,x as i,O as j,A as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as t,E as a}from"./index-DORq2iDV.js";const e=t(a,{target:"draft-7"});export{e as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as A,s as D,c as O,k as v,l as E,j as r,d as N}from"./index-
|
|
1
|
+
import{o as A,s as D,c as O,k as v,l as E,j as r,d as N}from"./index-DORq2iDV.js";import{A as I,a as M,b as L,c as R,d as T,e as $,f as k}from"./alert-dialog-YO7F1UnW.js";import{B}from"./button-CVYD_l4f.js";import{F as V,a as q,b as H,c as U,d as G,e as J,f as K}from"./form-BVo4Hzsi.js";import{I as P}from"./input-Bh5KX8XE.js";import{S as Q}from"./spinner-CTHwgDFW.js";import{u as W}from"./useMutation-DIYvmP8t.js";function _(o){return o.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const X=A({name:D().min(2,"Organization name is required")});function ne(o){const e=O.c(41),{open:a,onOpenChange:s}=o;let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j={resolver:v(X),defaultValues:{name:""}},e[0]=j):j=e[0];const t=E(j);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={mutationFn:Z,onSuccess:Y},e[1]=w):w=e[1];const i=W(w),z=i.error instanceof Error?i.error.message:i.error?"Failed to create organization.":null;let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r.jsxs(L,{children:[r.jsx(R,{children:"Create a new organization"}),r.jsx(T,{children:"Set up a new organization to collaborate with others."})]}),e[2]=F):F=e[2];let n;if(e[3]!==i||e[4]!==t){let x;e[6]!==i?(x=b=>i.mutateAsync(b),e[6]=i,e[7]=x):x=e[7],n=t.handleSubmit(x),e[3]=i,e[4]=t,e[5]=n}else n=e[5];let l;e[8]!==t.formState.isSubmitting?(l=x=>{const{field:b}=x;return r.jsxs(H,{children:[r.jsx(U,{children:"Organization Name"}),r.jsx(G,{children:r.jsx(P,{...b,placeholder:"Acme Inc.",disabled:t.formState.isSubmitting})}),r.jsx(J,{children:"The name of your company or organization"}),b.value&&r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",r.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",_(b.value)]})]}),r.jsx(K,{})]})},e[8]=t.formState.isSubmitting,e[9]=l):l=e[9];let m;e[10]!==t.control||e[11]!==l?(m=r.jsx(V,{control:t.control,name:"name",render:l}),e[10]=t.control,e[11]=l,e[12]=m):m=e[12];let c;e[13]!==z?(c=z&&r.jsx("div",{className:"text-destructive text-sm mt-2",children:z}),e[13]=z,e[14]=c):c=e[14];let f;e[15]!==i||e[16]!==t?(f=()=>{i.reset(),t.reset()},e[15]=i,e[16]=t,e[17]=f):f=e[17];let g;e[18]!==t.formState.isSubmitting||e[19]!==f?(g=r.jsx(I,{disabled:t.formState.isSubmitting,onClick:f,children:"Cancel"}),e[18]=t.formState.isSubmitting,e[19]=f,e[20]=g):g=e[20];const y=!t.formState.isValid||t.formState.isSubmitting;let u;e[21]!==t.formState.isSubmitting?(u=t.formState.isSubmitting?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Q,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=t.formState.isSubmitting,e[22]=u):u=e[22];let d;e[23]!==y||e[24]!==u?(d=r.jsx(B,{type:"submit",variant:"default",disabled:y,children:u}),e[23]=y,e[24]=u,e[25]=d):d=e[25];let S;e[26]!==d||e[27]!==g?(S=r.jsxs($,{children:[g,d]}),e[26]=d,e[27]=g,e[28]=S):S=e[28];let h;e[29]!==S||e[30]!==n||e[31]!==m||e[32]!==c?(h=r.jsxs("form",{className:"space-y-6",onSubmit:n,autoComplete:"off",children:[m,c,S]}),e[29]=S,e[30]=n,e[31]=m,e[32]=c,e[33]=h):h=e[33];let p;e[34]!==t||e[35]!==h?(p=r.jsxs(M,{children:[F,r.jsx(q,{...t,children:h})]}),e[34]=t,e[35]=h,e[36]=p):p=e[36];let C;return e[37]!==s||e[38]!==a||e[39]!==p?(C=r.jsx(k,{open:a,onOpenChange:s,children:p}),e[37]=s,e[38]=a,e[39]=p,e[40]=C):C=e[40],C}function Y(o){const{orgSlug:e}=o;window.location.href=`/${e}`}async function Z(o){const e=_(o.name);if(!e)throw new Error("Organization slug is invalid");const a=await N.organization.create({name:o.name,slug:e});if(a?.error)throw new Error(a.error.message||"Failed to create organization");const s=a?.data?.slug??e;if(!s)throw new Error("Failed to create organization");return{orgSlug:s}}export{ne as C};
|
package/dist/client/assets/{create-project-dialog-DStWDJyz.js → create-project-dialog-C81f_5Rj.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as A,j as e,u as L,b as R,y as k,r as z,l as M,t as B,K as T,O as j,o as V,s as f}from"./index-
|
|
1
|
+
import{c as A,j as e,u as L,b as R,y as k,r as z,l as M,t as B,K as T,O as j,o as V,s as f}from"./index-DORq2iDV.js";import{u as $}from"./useMutation-DIYvmP8t.js";import{u as q,a as O}from"./constants-C7Ec6iJ9.js";import{D as K,a as U,b as G,c as J,d as Q,e as Y}from"./dialog-VPGAGt8b.js";import{c as H,B as D}from"./button-CVYD_l4f.js";import{a as W,F as v,b as F,c as N,d as S,f as w}from"./form-BVo4Hzsi.js";import{I}from"./input-Bh5KX8XE.js";import{T as X}from"./textarea-B4df3c-A.js";import{L as Z}from"./label-DyOg7nzh.js";import{i as ee}from"./Check-B6v8UYhw.js";function se(l){return l.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function _(l){return/^[a-z0-9-]+$/.test(l)&&l.length>0&&l.length<=100}const te=["#3B82F6","#8B5CF6","#EC4899","#EF4444","#F97316","#EAB308","#22C55E","#14B8A6","#06B6D4","#6366F1","#64748B","#000000"];function re(l){const s=A.c(16),{value:n,onChange:i}=l;let c;s[0]!==i||s[1]!==n?(c=te.map(o=>e.jsx("button",{type:"button",onClick:()=>i(o),className:H("size-8 rounded-lg transition-all",n===o&&"ring-2 ring-offset-2 ring-primary"),style:{backgroundColor:o},children:n===o&&e.jsx(ee,{className:"size-4 text-white mx-auto"})},o)),s[0]=i,s[1]=n,s[2]=c):c=s[2];let u;s[3]!==c?(u=e.jsx("div",{className:"grid grid-cols-6 gap-2",children:c}),s[3]=c,s[4]=u):u=s[4];const g=n??"#3B82F6";let d;s[5]!==i?(d=o=>i(o.target.value),s[5]=i,s[6]=d):d=s[6];let t;s[7]!==g||s[8]!==d?(t=e.jsx("input",{type:"color",value:g,onChange:d,className:"size-8 rounded cursor-pointer"}),s[7]=g,s[8]=d,s[9]=t):t=s[9];let a;s[10]===Symbol.for("react.memo_cache_sentinel")?(a=e.jsx("span",{className:"text-sm text-muted-foreground",children:"Custom color"}),s[10]=a):a=s[10];let m;s[11]!==t?(m=e.jsxs("div",{className:"flex items-center gap-2",children:[t,a]}),s[11]=t,s[12]=m):m=s[12];let x;return s[13]!==u||s[14]!==m?(x=e.jsxs("div",{className:"space-y-3",children:[u,m]}),s[13]=u,s[14]=m,s[15]=x):x=s[15],x}V({name:f().min(1,"Name is required").max(200),slug:f().min(1,"Slug is required").max(100),description:f().max(1e3).optional(),bannerColor:f().nullable().optional()});function xe({open:l,onOpenChange:s}){const{org:n}=L(),i=R(),c=k(),[u,g]=z.useState(!1),d=q({connectionId:O,orgId:n.id}),t=M({mode:"onChange",defaultValues:{name:"",slug:"",description:"",bannerColor:"#3B82F6"}}),a=$({mutationFn:async r=>{const h=await d.callTool({name:"PROJECT_CREATE",arguments:{organizationId:n.id,slug:r.slug,name:r.name,description:r.description||null,enabledPlugins:[],ui:{banner:null,bannerColor:r.bannerColor??null,icon:null,themeColor:r.bannerColor??null}}});return h.structuredContent??h},onSuccess:r=>{c.invalidateQueries({queryKey:T.projects(n.id)}),B.success("Project created successfully"),s(!1),t.reset({name:"",slug:"",description:"",bannerColor:"#3B82F6"}),g(!1),i({to:"/$org/$project",params:{org:n.slug,project:r.project.slug}})},onError:r=>{B.error("Failed to create project: "+(r instanceof Error?r.message:"Unknown error"))}}),m=async r=>{if(!_(r.slug)){t.setError("slug",{message:"Slug must be lowercase alphanumeric with hyphens only"});return}if(r.slug===j){t.setError("slug",{message:`"${j}" is a reserved slug`});return}await a.mutateAsync(r)},x=r=>{const h=r.target.value;if(t.setValue("name",h),!u){const P=se(h);t.setValue("slug",P)}},o=r=>{g(!0),t.setValue("slug",r.target.value.toLowerCase().replace(/[^a-z0-9-]/g,""))},C=t.watch("bannerColor"),p=t.watch("slug"),b=t.watch("name"),y=p===j,E=p.length>0&&!_(p);return e.jsx(K,{open:l,onOpenChange:s,children:e.jsxs(U,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(G,{children:[e.jsx(J,{children:"Create New Project"}),e.jsxs(Q,{children:["Set up a new project in ",n.name,". You can configure plugins and settings after creation."]})]}),e.jsx(W,{...t,children:e.jsxs("form",{onSubmit:t.handleSubmit(m),className:"space-y-6",children:[e.jsx("div",{className:"h-20 rounded-lg relative",style:{backgroundColor:C??"#3B82F6"},children:e.jsx("div",{className:"absolute -bottom-4 left-4",children:e.jsx("div",{className:"size-12 rounded-lg border-2 border-background flex items-center justify-center text-lg font-semibold text-white",style:{backgroundColor:C??"#3B82F6"},children:b?.charAt(0)?.toUpperCase()||"P"})})}),e.jsxs("div",{className:"space-y-2 pt-4",children:[e.jsx(Z,{children:"Banner Color"}),e.jsx(re,{value:C??null,onChange:r=>t.setValue("bannerColor",r)})]}),e.jsx(v,{control:t.control,name:"name",render:()=>e.jsxs(F,{children:[e.jsx(N,{children:"Project Name *"}),e.jsx(S,{children:e.jsx(I,{value:b,onChange:x,placeholder:"My Awesome Project",autoFocus:!0,disabled:a.isPending})}),e.jsx(w,{})]})}),e.jsx(v,{control:t.control,name:"slug",render:()=>e.jsxs(F,{children:[e.jsx(N,{children:"Slug *"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["/",n.slug,"/"]}),e.jsx(S,{children:e.jsx(I,{value:p,onChange:o,placeholder:"my-awesome-project",className:"flex-1",disabled:a.isPending})})]}),y&&e.jsxs("p",{className:"text-xs text-destructive",children:['"',j,'" is a reserved slug']}),E&&!y&&e.jsx("p",{className:"text-xs text-destructive",children:"Slug must be lowercase alphanumeric with hyphens only"}),e.jsx(w,{})]})}),e.jsx(v,{control:t.control,name:"description",render:({field:r})=>e.jsxs(F,{children:[e.jsx(N,{children:"Description"}),e.jsx(S,{children:e.jsx(X,{...r,placeholder:"What is this project for?",rows:2,disabled:a.isPending})}),e.jsx(w,{})]})}),e.jsxs(Y,{children:[e.jsx(D,{type:"button",variant:"outline",onClick:()=>s(!1),disabled:a.isPending,children:"Cancel"}),e.jsx(D,{type:"submit",disabled:a.isPending||y||E||!b||!p,children:a.isPending?"Creating...":"Create Project"})]})]})})]})})}export{xe as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as n,j as i,I as m,J as g,T as u,M as x,Q as j,U as N,W as b,X as D}from"./index-
|
|
1
|
+
import{c as n,j as i,I as m,J as g,T as u,M as x,Q as j,U as N,W as b,X as D}from"./index-DORq2iDV.js";import{i as h}from"./tooltip-4z3Dj1Ic.js";import{c}from"./button-CVYD_l4f.js";function k(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(m,{"data-slot":"dialog",...t}),e[2]=t,e[3]=s):s=e[3],s}function w(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(D,{"data-slot":"dialog-trigger",...t}),e[2]=t,e[3]=s):s=e[3],s}function v(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(j,{"data-slot":"dialog-portal",...t}),e[2]=t,e[3]=s):s=e[3],s}function y(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/45 backdrop-blur-[0.15px]",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(N,{"data-slot":"dialog-overlay",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function $(l){const e=n.c(6),{className:t}=l;let s;e[0]!==t?(s=c("cursor-pointer ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground","absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2","focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[0]=t,e[1]=s):s=e[1];let a,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(h,{}),o=i.jsx("span",{className:"sr-only",children:"Close"}),e[2]=a,e[3]=o):(a=e[2],o=e[3]);let r;return e[4]!==s?(r=i.jsxs(b,{className:s,children:[a,o]}),e[4]=s,e[5]=r):r=e[5],r}function T(l){const e=n.c(15);let t,s,a,o;e[0]!==l?({className:s,children:t,closeButtonClassName:a,...o}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=o):(t=e[1],s=e[2],a=e[3],o=e[4]);let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(y,{}),e[5]=r):r=e[5];let d;e[6]!==s?(d=c("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border p-6 shadow-md duration-200 sm:max-w-lg",s),e[6]=s,e[7]=d):d=e[7];let f;e[8]!==a?(f=i.jsx($,{className:a}),e[8]=a,e[9]=f):f=e[9];let p;return e[10]!==t||e[11]!==o||e[12]!==d||e[13]!==f?(p=i.jsxs(v,{"data-slot":"dialog-portal",children:[r,i.jsxs(g,{"data-slot":"dialog-content",className:d,...o,children:[t,f]})]}),e[10]=t,e[11]=o,e[12]=d,e[13]=f,e[14]=p):p=e[14],p}function R(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col gap-2 text-center sm:text-left",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-header",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function B(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-footer",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function E(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-lg leading-none font-semibold",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(u,{"data-slot":"dialog-title",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function O(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-muted-foreground text-sm",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(x,{"data-slot":"dialog-description",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{k as D,T as a,R as b,E as c,O as d,B as e,w as f};
|