@decocms/mesh 2.132.0 → 2.133.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-Dvy3oHwl.js → AlertCircle-DtdVhcv9.js} +1 -1
- package/dist/client/assets/{AlignLeft-C1Pd8crU.js → AlignLeft-CRHzRLnb.js} +1 -1
- package/dist/client/assets/{ArrowDown-B0XF9QfR.js → ArrowDown-CD9f6dVF.js} +1 -1
- package/dist/client/assets/{ArrowLeft-Ddv8Es1G.js → ArrowLeft-Dse_UWo5.js} +1 -1
- package/dist/client/assets/{ArrowUp-CjPyEOxC.js → ArrowUp-C5pU0t20.js} +1 -1
- package/dist/client/assets/{Check-BGWNBpXb.js → Check-llxZXJNk.js} +1 -1
- package/dist/client/assets/{CheckCircle-CDdaecse.js → CheckCircle-naMxBwcc.js} +1 -1
- package/dist/client/assets/{CheckDone01-DgNkGXSd.js → CheckDone01-DArNoCeR.js} +1 -1
- package/dist/client/assets/{CheckVerified02-yC2IepeU.js → CheckVerified02-B5N8FkZi.js} +1 -1
- package/dist/client/assets/{ChevronDown-CxLgy5uI.js → ChevronDown-BPvdqfh0.js} +1 -1
- package/dist/client/assets/ChevronLeft-BmfUl3Br.js +1 -0
- package/dist/client/assets/{ChevronRight-B-dZm0Fo.js → ChevronRight-bI92hTEK.js} +1 -1
- package/dist/client/assets/{Clock-DjTfMWYb.js → Clock-DCqyBdVg.js} +1 -1
- package/dist/client/assets/{Code01-C4dpeKsY.js → Code01-Cw3aSJX_.js} +1 -1
- package/dist/client/assets/{Container-CH2V2ATa.js → Container-BcN3rU1W.js} +1 -1
- package/dist/client/assets/{Copy01-Ba42JLNP.js → Copy01-DOsfcAr7.js} +1 -1
- package/dist/client/assets/{Dataflow03-Dbafm5jn.js → Dataflow03-BzHLq4N3.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-DF0XToJT.js → DotsHorizontal-jg8p8szZ.js} +1 -1
- package/dist/client/assets/{DotsVertical-D-x0DTAA.js → DotsVertical-D7GBR06C.js} +1 -1
- package/dist/client/assets/{Download01-x2RmdAQh.js → Download01-Dqv2OtJR.js} +1 -1
- package/dist/client/assets/{Edit01-NXKv8M2Y.js → Edit01-PGiGF51x.js} +1 -1
- package/dist/client/assets/{Eye-Da9OHWjs.js → Eye-BHQjRrk8.js} +1 -1
- package/dist/client/assets/{File02-BBbAYdh-.js → File02-8H6UbpEV.js} +1 -1
- package/dist/client/assets/{File06-CZSeKcKm.js → File06-C1Sd5E1A.js} +1 -1
- package/dist/client/assets/{FilterLines-CR4t6v_B.js → FilterLines-C4D0sIiB.js} +1 -1
- package/dist/client/assets/{Globe01-sstJp1qH.js → Globe01-DvHitX1A.js} +1 -1
- package/dist/client/assets/{Globe02-DED7nhMo.js → Globe02-8eZbLs7z.js} +1 -1
- package/dist/client/assets/{Grid01-C85povgK.js → Grid01-CfCG1RrY.js} +1 -1
- package/dist/client/assets/{Hash02-B-r__uQj.js → Hash02-B4zt7eqf.js} +1 -1
- package/dist/client/assets/{Home02-P9zxIWnB.js → Home02-BgWCBPhH.js} +1 -1
- package/dist/client/assets/{Image01-CyQ-9pmM.js → Image01-B8svV61f.js} +1 -1
- package/dist/client/assets/{Inbox01-DUxLR6jm.js → Inbox01-DktY8c3P.js} +1 -1
- package/dist/client/assets/{InfoCircle-ORvzz6Jj.js → InfoCircle-DDBpFLdR.js} +1 -1
- package/dist/client/assets/{Key01-B3LfJVTz.js → Key01-eAlJ77G3.js} +1 -1
- package/dist/client/assets/{LayersTwo01-D0hB1mlt.js → LayersTwo01-Cre7WmYe.js} +1 -1
- package/dist/client/assets/{LayoutLeft-CIizJ9p-.js → LayoutLeft-BdPuu6bH.js} +1 -1
- package/dist/client/assets/{LinkExternal01-zIQsCZyp.js → LinkExternal01-1-7TA6Ra.js} +1 -1
- package/dist/client/assets/{List-Dy03iFlP.js → List-uQZNVPQ-.js} +1 -1
- package/dist/client/assets/{Loading01-DvHkBn5K.js → Loading01-DUUFtL7S.js} +1 -1
- package/dist/client/assets/{Lock01-b36hjLYg.js → Lock01-BqRcOfbm.js} +1 -1
- package/dist/client/assets/{Play-B4gSKcOc.js → Play-DTlFqxwD.js} +1 -1
- package/dist/client/assets/{Plus-C48LE9QF.js → Plus-2wrCLrAD.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-B_P3Otqi.js → RefreshCcw01-CmQ_Zyfb.js} +1 -1
- package/dist/client/assets/{Rows03-RYFV31vk.js → Rows03-CeP6X8F6.js} +1 -1
- package/dist/client/assets/{Save01-C9eXS7Z1.js → Save01-Cq59fc-a.js} +1 -1
- package/dist/client/assets/{SearchMd-Bec1mZCp.js → SearchMd-DOdaT51-.js} +1 -1
- package/dist/client/assets/{Settings01-CGjDKLLq.js → Settings01-jEDDrq49.js} +1 -1
- package/dist/client/assets/{Shield01-QPvxKI9B.js → Shield01-_lpY_BlD.js} +1 -1
- package/dist/client/assets/{Terminal-Dg9FTns0.js → Terminal-CZIzfu4H.js} +1 -1
- package/dist/client/assets/{Trash01-DfwWsbuW.js → Trash01-DJpn1VG4.js} +1 -1
- package/dist/client/assets/{Upload01-CBnp-ZgO.js → Upload01-c6QpJwvP.js} +1 -1
- package/dist/client/assets/{Users03-zNQ-U5kI.js → Users03--eiqKjb_.js} +1 -1
- package/dist/client/assets/{X-BaOBrQh9.js → X-BGHsyt4s.js} +1 -1
- package/dist/client/assets/{XCircle-CGBoiIiF.js → XCircle-BJSW1V34.js} +1 -1
- package/dist/client/assets/{XClose-D5oa0b17.js → XClose-CYrOe1GU.js} +1 -1
- package/dist/client/assets/{Zap-B8kjj6jV.js → Zap-Div5wKlF.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-CpRlCZek.js → agent-connections-preview-B33aUr8j.js} +1 -1
- package/dist/client/assets/agent-detail-B1r6DbgP.js +2 -0
- package/dist/client/assets/agents--1wlh1On.js +1 -0
- package/dist/client/assets/{alert-dialog-CHhoNaC0.js → alert-dialog-WtbKGn3h.js} +1 -1
- package/dist/client/assets/{auth-catchall-Bks-N8b9.js → auth-catchall-C-FIrDOU.js} +1 -1
- package/dist/client/assets/{avatar-DX9xarA9.js → avatar-C0Za2Leb.js} +1 -1
- package/dist/client/assets/{badge-CMOYVtO8.js → badge-zns1OAW0.js} +1 -1
- package/dist/client/assets/{binder-CN-yhtfQ.js → binder-C2Kwp5aI.js} +1 -1
- package/dist/client/assets/{breadcrumb-CtNnsyqL.js → breadcrumb-BF7wgZMj.js} +1 -1
- package/dist/client/assets/{card-BECXECFc.js → card-yVoc5Dl_.js} +1 -1
- package/dist/client/assets/{chart-CA07zGfe.js → chart-C09J-0j8.js} +1 -1
- package/dist/client/assets/{checkbox-Bs5NWE_x.js → checkbox-C_yzLnRo.js} +1 -1
- package/dist/client/assets/{circle-alert-CEhC-Q81.js → circle-alert-DEWKfuYJ.js} +1 -1
- package/dist/client/assets/collapsible-e1478K7w.js +23 -0
- package/dist/client/assets/{collection-detail-CNXxywSm.js → collection-detail-12bPsl9i.js} +3 -3
- package/dist/client/assets/{collection-search-aEfiIRVT.js → collection-search-g7bCyEl4.js} +1 -1
- package/dist/client/assets/collection-tab-hxaftEha.js +1 -0
- package/dist/client/assets/{collection-table-wrapper-hM0ppyEG.js → collection-table-wrapper-Bx_0GgHe.js} +1 -1
- package/dist/client/assets/{collection-tabs-Dc6gZtTz.js → collection-tabs-CGvjmn7e.js} +1 -1
- package/dist/client/assets/{command-DI3JwfrE.js → command-DvXRXkaf.js} +1 -1
- package/dist/client/assets/{connect-C0SuJwzK.js → connect-BHcfLUsx.js} +1 -1
- package/dist/client/assets/{connection-card-CzCUOjTN.js → connection-card-Of-LfoL9.js} +1 -1
- package/dist/client/assets/connection-detail-Bfp_CthH.js +1 -0
- package/dist/client/assets/connections-CMRFgF2z.js +1 -0
- package/dist/client/assets/constants-BMZNxJu4.js +1 -0
- package/dist/client/assets/{constants-0JLhMmM7.js → constants-DLWxw8L_.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-BRKsH8XB.js → create-organization-dialog-DHmNDQVx.js} +1 -1
- package/dist/client/assets/{create-project-dialog-BUAUU3kY.js → create-project-dialog-BURFxz7l.js} +1 -1
- package/dist/client/assets/{danger--r_qw5of.js → danger-D0vNOgTj.js} +1 -1
- package/dist/client/assets/{danger-zone-fH4LWpAE.js → danger-zone-Dhz8OLxh.js} +1 -1
- package/dist/client/assets/decopilot-events-C1i2IOcF.js +1 -0
- package/dist/client/assets/{dependencies-CfLZZ12D.js → dependencies-DQgcVkpb.js} +1 -1
- package/dist/client/assets/{dialog-CzmRWg_H.js → dialog-B8ODwZHJ.js} +1 -1
- package/dist/client/assets/{dropdown-menu-bZQdGgsX.js → dropdown-menu-Bv0kDZGf.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-B44KCK2N.js → dynamic-plugin-layout-CfJ2iWdk.js} +1 -1
- package/dist/client/assets/editable-task-title-BECK0S9m.js +16 -0
- package/dist/client/assets/{empty-state-BuKC-FeY.js → empty-state-CS91-o6R.js} +1 -1
- package/dist/client/assets/{env-vars-editor-BUYd05S1.js → env-vars-editor-BoUKrNdn.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CDK2P3aY.js → extract-connection-data-DPrPXrw7.js} +1 -1
- package/dist/client/assets/{file-browser-B8HL2Mki.js → file-browser-Dyg6fn_p.js} +2 -2
- package/dist/client/assets/{form-EW4LFI0z.js → form-Bqy3P0kv.js} +1 -1
- package/dist/client/assets/{general-B-SJAejg.js → general-CcOfiluy.js} +1 -1
- package/dist/client/assets/{grid-view-B2G72x7D.js → grid-view-uc2-Xd10.js} +1 -1
- package/dist/client/assets/{home-C_Jstend.js → home-DYjBdnSm.js} +1 -1
- package/dist/client/assets/{index-RIE02s6T.js → index-1pfseT2B.js} +1 -1
- package/dist/client/assets/{index-BeKO7nFo.js → index-5XdaBbnC.js} +1 -1
- package/dist/client/assets/{index-hfshaOuF.js → index-B1uFfuid.js} +1 -1
- package/dist/client/assets/{index-gksA6r5d.js → index-BLvVZqmB.js} +1 -1
- package/dist/client/assets/{index-kE57LLiG.js → index-Br7gqIns.js} +22 -22
- package/dist/client/assets/{index-Cp50RRud.js → index-CLZkaGlC.js} +1 -1
- package/dist/client/assets/index-CUEtQJPr.css +1 -0
- package/dist/client/assets/index-CjU9lWJN.js +1 -0
- package/dist/client/assets/{index-CzFqQvXW.js → index-DVHuYwO5.js} +4 -4
- package/dist/client/assets/{index-V5ecgDUm.js → index-tDb6lai2.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-B0QSZ6Wg.js → infiniteQueryObserver-BU31NXJd.js} +1 -1
- package/dist/client/assets/{input-Rcf9et7W.js → input-CImrwNsE.js} +1 -1
- package/dist/client/assets/{integration-icon-Cr629JYK.js → integration-icon-CqdgwTQM.js} +1 -1
- package/dist/client/assets/{label-DdGHGWov.js → label-BEcdY3zl.js} +1 -1
- package/dist/client/assets/{layout-CUeJn5m4.js → layout-Cegg55DQ.js} +1 -1
- package/dist/client/assets/{layout-DvurrRZC.js → layout-D1FJR7dQ.js} +1 -1
- package/dist/client/assets/localstorage-keys-B3yhvN27.js +1 -0
- package/dist/client/assets/{login-C70j40x2.js → login-gpMZSjc_.js} +1 -1
- package/dist/client/assets/{markdown-BsZjpnFH.js → markdown-DigmZCi5.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-aRjr0jcc.js → mcp-app-renderer-elbh_bK3.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Dk3osgIf.js → mcp-oauth-BJK3oSr3.js} +1 -1
- package/dist/client/assets/{mcp-server-card-znSfWcaP.js → mcp-server-card-B_3KckAV.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-Csm9j29j.js → mcp-server-detail-BGmK7vBO.js} +2 -2
- package/dist/client/assets/{members-WbcVb7yX.js → members-DkvmaHrL.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-edit-ChxkdsCv.js → monitoring-dashboard-edit-Dq449CGn.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-view-CL8P3Zx7.js → monitoring-dashboard-view-KyEbCseW.js} +2 -2
- package/dist/client/assets/{monitoring-Dth-Uzfq.js → monitoring-mMb4oyh8.js} +2 -2
- package/dist/client/assets/{oauth-callback-CXzK_RYv.js → oauth-callback-BWIw_10O.js} +1 -1
- package/dist/client/assets/page-LuWQuTOB.js +1 -0
- package/dist/client/assets/{page-CCrDZNhS.js → page-MLghIZgZ.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-D7gmiZlA.js → plugin-empty-state-BYi0xCDZ.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-BIuYztei.js → plugin-empty-state-CfkX75Qn.js} +1 -1
- package/dist/client/assets/{plugin-header-BLBENlfU.js → plugin-header-Bpxodj_N.js} +1 -1
- package/dist/client/assets/{plugin-header-CmlDS_hv.js → plugin-header-C8NyMNoe.js} +1 -1
- package/dist/client/assets/plugins-VAc5tGcP.js +1 -0
- package/dist/client/assets/{popover-C5F2AcFP.js → popover-R_PT2IPW.js} +1 -1
- package/dist/client/assets/{project-app-view-NryMJvXO.js → project-app-view-Bai-Qf0R.js} +1 -1
- package/dist/client/assets/project-layout-daZ99y7q.js +1 -0
- package/dist/client/assets/{project-plugins-QbLHCPXi.js → project-plugins-D9btRO1g.js} +1 -1
- package/dist/client/assets/{projects-list-B_wyuNYf.js → projects-list-DLyGtlCx.js} +1 -1
- package/dist/client/assets/{ranking-layout-CVBOyQIw.js → ranking-layout-Difw19Tu.js} +1 -1
- package/dist/client/assets/{readme-viewer-BmxWIpiS.js → readme-viewer-DMIs62Jq.js} +1 -1
- package/dist/client/assets/{registry-layout-DHUM9TZu.js → registry-layout-DUQv-gnE.js} +1 -1
- package/dist/client/assets/{registry-utils-DRX9Fl5Z.js → registry-utils-BL3Z-ZuV.js} +1 -1
- package/dist/client/assets/{reports-layout-GUNpInzx.js → reports-layout-DOweGRAi.js} +1 -1
- package/dist/client/assets/{reset-password-C_jAWNzd.js → reset-password-gTGJs4eA.js} +1 -1
- package/dist/client/assets/{resizable-CmbMtBt6.js → resizable-C-gCkuLt.js} +1 -1
- package/dist/client/assets/{save-actions-CH-zbfme.js → save-actions-CdZGxDIR.js} +1 -1
- package/dist/client/assets/{scroll-area-B5BKtcc-.js → scroll-area-DsCd8vj6.js} +1 -1
- package/dist/client/assets/{select-CSl7KVC3.js → select-CZ5oa2ZG.js} +1 -1
- package/dist/client/assets/shell-layout-D95AudRc.js +3 -0
- package/dist/client/assets/{sidebar-settings-98pHpdNk.js → sidebar-settings-DoYo5_2f.js} +1 -1
- package/dist/client/assets/{skeleton-BGGjmBE-.js → skeleton-DIOpAjh1.js} +1 -1
- package/dist/client/assets/{spinner-BubUCjpb.js → spinner-B-yGP95y.js} +1 -1
- package/dist/client/assets/{store-invite-BidZUMAQ.js → store-invite-COyr13nI.js} +1 -1
- package/dist/client/assets/{switch-D_s2nP_j.js → switch-C_rwAMG7.js} +1 -1
- package/dist/client/assets/{table-C7IfzCau.js → table-BwN-DdG1.js} +1 -1
- package/dist/client/assets/tabs-CTOkjsDF.js +1 -0
- package/dist/client/assets/tasks-CxbK_rAM.js +1 -0
- package/dist/client/assets/tasks-panel-CI07RnJW.js +1 -0
- package/dist/client/assets/{textarea-CumbsokS.js → textarea-BOlS_fKd.js} +1 -1
- package/dist/client/assets/{time-range-picker-Brh1Ym1N.js → time-range-picker-DWAp9G7R.js} +4 -4
- package/dist/client/assets/{toggle-group-DaSKpJH5.js → toggle-group-CRwxfPk7.js} +1 -1
- package/dist/client/assets/{tools-list-BvNNjQQL.js → tools-list-CQrrEoBF.js} +1 -1
- package/dist/client/assets/{tooltip-BGn6dJhi.js → tooltip-BsUirxUt.js} +1 -1
- package/dist/client/assets/{topbar-portal-mNbAP1zZ.js → topbar-portal-Cy4hr4gX.js} +1 -1
- package/dist/client/assets/{types-CnosXlf3.js → types-gEqZqH3b.js} +1 -1
- package/dist/client/assets/{use-binding-Ctbwf5zu.js → use-binding-Dx_NAnJa.js} +1 -1
- package/dist/client/assets/{use-connection-CmCfM9T5.js → use-connection-CwB1S0Lk.js} +1 -1
- package/dist/client/assets/{use-copy-Dn5NzC6Z.js → use-copy-uCRP4yn6.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-b6Af6scy.js → use-create-virtual-mcp-Bm7L9HAR.js} +1 -1
- package/dist/client/assets/{use-install-from-registry-D4coW5d-.js → use-install-from-registry-CMYlie1K.js} +1 -1
- package/dist/client/assets/use-list-state-EN77XpOY.js +1 -0
- package/dist/client/assets/{use-llm-CPv795TN.js → use-llm-C5Q0H0cZ.js} +1 -1
- package/dist/client/assets/{use-mcp-resources--6yZ25c2.js → use-mcp-resources-kkSzYGiM.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-BTHDM3P3.js → use-mcp-tools-CT-LTM8z.js} +1 -1
- package/dist/client/assets/{use-members-Dzw-FOpA.js → use-members-CYCHCBAZ.js} +1 -1
- package/dist/client/assets/{use-mobile-DIBT-lEk.js → use-mobile-Bot_hVI8.js} +1 -1
- package/dist/client/assets/{use-project-Bd8syAM2.js → use-project-C5wS8512.js} +1 -1
- package/dist/client/assets/{use-settings-modal-D-rqbyuf.js → use-settings-modal-TyiexX8v.js} +1 -1
- package/dist/client/assets/{use-view-mode-k6uWDVq8.js → use-view-mode-CS5zZIj8.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CaM9kbfY.js → use-virtual-mcp-CGnbrFrJ.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CutnJ4kj.js +1 -0
- package/dist/client/assets/{useMutation-DsQcwaJP.js → useMutation-BskhtN65.js} +1 -1
- package/dist/client/assets/useQuery-CxvwMb--.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-DrLfXfJc.js +1 -0
- package/dist/client/assets/user-BRVh4xuS.js +1 -0
- package/dist/client/assets/workflow-D7s-e1ZH.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +2 -1
- package/dist/server/server.js +2 -1
- package/package.json +1 -1
- package/dist/client/assets/AlertOctagon-Y8Xx5Uc4.js +0 -1
- package/dist/client/assets/agent-detail-ge8lRsMy.js +0 -2
- package/dist/client/assets/agents-CYp6eaDL.js +0 -1
- package/dist/client/assets/collapsible-KhZqz8s6.js +0 -1
- package/dist/client/assets/collection-tab-ByOYG4eu.js +0 -1
- package/dist/client/assets/connection-detail-FUvYBL_f.js +0 -1
- package/dist/client/assets/connections-CZWiV45b.js +0 -1
- package/dist/client/assets/constants-BnCnMsvC.js +0 -1
- package/dist/client/assets/context-CnW_lI9R.js +0 -23
- package/dist/client/assets/decopilot-events-Brt4gAR6.js +0 -1
- package/dist/client/assets/editable-thread-title-BT5MJN2M.js +0 -16
- package/dist/client/assets/index-Bl1kPuE1.css +0 -1
- package/dist/client/assets/index-CLgM5v39.js +0 -1
- package/dist/client/assets/localstorage-keys-DtK7peUq.js +0 -1
- package/dist/client/assets/page-JQWUx5cS.js +0 -1
- package/dist/client/assets/plugins-kPtsND7u.js +0 -1
- package/dist/client/assets/project-layout-CDz2d0hE.js +0 -1
- package/dist/client/assets/shell-layout-DH6hyOML.js +0 -3
- package/dist/client/assets/tabs-BzChyqs4.js +0 -1
- package/dist/client/assets/tasks-fA5J94Ed.js +0 -1
- package/dist/client/assets/use-list-state-pp-Ywt5d.js +0 -1
- package/dist/client/assets/use-mcp-prompts-Bvv0Gku4.js +0 -1
- package/dist/client/assets/use-preferences-fTjyFgCz.js +0 -1
- package/dist/client/assets/useInfiniteQuery-BRjF-D1B.js +0 -1
- package/dist/client/assets/useQuery-BE7O7fKt.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BSW1dpRq.js +0 -1
- package/dist/client/assets/workflow-BfURwr1_.js +0 -1
package/dist/client/index.html
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<title>MCP Mesh</title>
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
6
|
+
<script type="module" crossorigin src="/assets/index-DVHuYwO5.js"></script>
|
|
7
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CUEtQJPr.css">
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
10
10
|
<div id="root"></div>
|
package/dist/server/cli.js
CHANGED
|
@@ -1565,7 +1565,8 @@ ${Y}`;return Q}function lo0(Y,Q,X){let{modelProvider:J,organization:G,models:K,n
|
|
|
1565
1565
|
|
|
1566
1566
|
`+"IMPORTANT: Every subtask call starts FRESH \u2014 no conversation history, no prior runs. Even if you call it multiple times, each run is isolated. Always include full context in the prompt; never use continuation phrases like 'continue' or 'as before'.",oc6={readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0}});var tc6,ec6,Yn6="Ask the user instead of guessing when requirements are ambiguous, multiple valid approaches exist, or before destructive changes. Prefer this tool over asking in plain text.",po0;var co0=S(()=>{sZ();m1();tc6=q.object({prompt:q.string().min(1).describe("The question to display"),type:q.enum(["text","choice","confirm"]).describe("'text': free-form, 'choice': pick from options (UI adds 'Other' automatically), 'confirm': yes/no"),options:q.array(q.string()).optional().describe("Required for 'choice'"),default:q.string().optional()}).refine((Y)=>{if(Y.type==="choice")return Y.options&&Y.options.length>=2;return!0},{message:"Options array with at least 2 items required for 'choice' type",path:["options"]}),ec6=q.object({response:q.string().describe("User's response")}),po0=fJ({description:Yn6,inputSchema:p8(tc6),outputSchema:p8(ec6)})});function no0(Y,Q,X){let{modelProvider:J,organization:G,models:K,toolApprovalLevel:W="none",toolOutputMap:Z}=Q;return{user_ask:po0,subtask:lo0(Y,{modelProvider:J,organization:G,models:K,needsApproval:Wo(W,!1)},X),agent_search:uo0(Y,{organization:G,needsApproval:Wo(W,!0)},X),read_tool_output:go0({toolOutputMap:Z})}}var io0=S(()=>{Ko();mo0();do0();co0();JM1()});function ao0(Y){let Q=Y.filter((J)=>J.role==="system"),X=Y.find((J)=>J.role!=="system");return{systemMessages:Q,requestMessage:X}}function Qn6(Y){let Q=!1,X=Y.map((J)=>{if(J.role!=="assistant")return J;if(!J.parts.some((K)=>("state"in K)&&K.state==="approval-requested"))return J;return Q=!0,{...J,parts:J.parts.map((K)=>{if(!("state"in K)||K.state!=="approval-requested"||!("approval"in K)||!K.approval)return K;return{...K,state:"output-denied",approval:{...K.approval,approved:!1,reason:"User sent a new message without approving this tool call."}}})}});return Q?X:Y}function Xn6(Y){let[Q,X]=Y.reduce((J,G)=>{if(G.role==="system")J[0].push(G);else J[1].push(G);return J},[[],[]]);return{systemMessages:Q,messages:X}}async function Jn6(Y,Q){return await Y.loadHistory(Q)}function Gn6(Y,Q){let X=Y.findIndex((G)=>G.id===Q.id);return X>=0?[...Y.slice(0,X),Q]:[...Y,Q]}async function ro0(Y,Q,X,J){let G=await Jn6(Y,J),K=Gn6(G,Q);return[...X,...K]}async function oo0(Y,Q){let X=await hx0({messages:Y}),J=Qn6(X),G=await bx0(J,{tools:Q.tools,ignoreIncompleteToolCalls:!0}),{systemMessages:K,messages:W}=Xn6(G),Z=gx0({messages:W,reasoning:"all",emptyMessages:"remove",toolCalls:"none"});return{systemMessages:K,messages:Z,originalMessages:X}}var so0=S(()=>{sZ()});class to0{thread;organization_id;storage;defaultWindowSize;constructor(Y){this.thread=Y.thread,this.organization_id=Y.thread.organization_id,this.storage=Y.storage,this.defaultWindowSize=Y.defaultWindowSize??50}async loadHistory(Y){let Q=Y??this.defaultWindowSize,{messages:X}=await this.storage.listMessages(this.thread.id,{limit:Q,sort:"desc"}),J=[...X].reverse(),G=J.findIndex((K)=>K.role==="user");return G>=0?J.slice(G):J}async save(Y){if(Y.length===0)return;await this.storage.saveMessages(Y)}}async function eo0(Y,Q){let{thread_id:X,organization_id:J,userId:G,defaultWindowSize:K}=Q,W;if(!X)W=await Y.create({id:d8("thrd"),organization_id:J,created_by:G});else{let Z=await Y.get(X);if(!Z||Z.organization_id!==J)W=await Y.create({id:Z?d8("thrd"):X,organization_id:J,created_by:G});else W=Z}return new to0({thread:W,storage:Y,defaultWindowSize:K})}var Ys0=S(()=>{LG()});function Qs0(Y,Q){if(!(Y.thinking.capabilities?.vision??!1)){if(Q.some((G)=>G.parts?.some((K)=>K.type==="file")))throw new XJ(400,{message:"This model does not support file uploads. Please change the model and try again."})}}var Xs0=S(()=>{jP()});function Wn6(Y){if(!Y)return;if(!("models"in Y))return;return Y.models??void 0}function Js0(Y,Q,X){if(!Y)return!0;return Y.includes("*:*")||Y.includes(`${Q}:*`)||Y.includes(`${Q}:${X}`)}function Gs0(Y){if(!Y)return{allowAll:!0,models:{}};if(Y.includes("*:*"))return{allowAll:!0,models:{}};let Q={};for(let X of Y){let J=X.indexOf(":");if(J===-1)continue;let G=X.slice(0,J),K=X.slice(J+1);if(!Q[G])Q[G]=[];Q[G].push(K)}return{allowAll:!1,models:Q}}async function WM1(Y,Q,X){if(!X||vr.includes(X))return;let J=await Y.selectFrom("organizationRole").select(["permission"]).where("organizationId","=",Q).where("role","=",X).executeTakeFirst();if(!J?.permission)return;try{let G=JSON.parse(J.permission);return Wn6(G)}catch{return console.error(`[model-permissions] Failed to parse permissions for role: ${X}`),[]}}var Ws0=S(()=>{_r()});function Zs0(Y){let Q=Y.trim();if(!Q)return null;if(Q.startsWith("event:"))return null;if(Q.startsWith("id:"))return null;if(Q.startsWith("retry:"))return null;let X=Q;if(X.startsWith("data:")){if(X=X.slice(5).trim(),!X)return null;if(X==="[DONE]")return null}try{return JSON.parse(X)}catch(J){return console.warn("[llm-provider] Failed to parse stream line as JSON. Skipping line.",{line:X.slice(0,200)},J),null}}function Zn6(Y){if(!Y.body)throw Error("Response body is null");let Q="";return Y.body.pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({transform(X,J){Q+=X;let G=Q.split(`
|
|
1567
1567
|
`);Q=G.pop()??"";for(let K of G)if(K.trim()){let W=Zs0(K);if(W)J.enqueue(W)}},flush(X){if(Q.trim()){let J=Zs0(Q);if(J)X.enqueue(J)}}}))}function Ks0(Y){let{prompt:Q,abortSignal:X,...J}=Y,G=Q.map((W)=>{if((W.role==="assistant"||W.role==="tool")&&Array.isArray(W.content)){let{providerOptions:Z,...H}=W;return{...H,content:W.content.map(({providerOptions:$,...F})=>{if(F.type==="tool-result"&&F.output&&F.output?.type==="execution-denied"){let V=F.output;return{...F,output:{type:"error-text",value:V.reason??"Tool execution denied."}}}return F})}}return W});return{...J,prompt:G}}var Kn6=(Y)=>{return Object.fromEntries(Object.entries(Y).map(([Q,X])=>[Q,X.map((J)=>new RegExp(J))]))},nv=(Y)=>{return{imageModel:()=>{throw Error("Image models are not supported by this provider")},textEmbeddingModel:()=>{throw Error("Text embedding models are not supported by this provider")},listModels:async()=>{return await Y.COLLECTION_LLM_LIST({})},languageModel:(Q)=>{let X=TP(()=>Y.LLM_METADATA({modelId:Q}).then((J)=>Kn6(J.supportedUrls)));return{specificationVersion:"v2",provider:"llm-binding",modelId:Q,supportedUrls:X,doGenerate:async(J)=>{let G=await Y.LLM_DO_GENERATE({callOptions:Ks0(J),modelId:Q}),K=G.response?.timestamp?new Date(G.response.timestamp):void 0;return{...G,response:{...G.response,timestamp:K},usage:{inputTokens:G.usage.inputTokens??void 0,outputTokens:G.usage.outputTokens??void 0,totalTokens:G.usage.totalTokens??void 0,reasoningTokens:G.usage.reasoningTokens??void 0}}},doStream:async(J)=>{let G=Ks0(J),K=await Y.LLM_DO_STREAM({callOptions:G,modelId:Q});if(!K.ok){let W=await K.text();throw Error(`Streaming failed for model ${Q} with the status code: ${K.status}
|
|
1568
|
-
${W}`)}return{stream:Zn6(K),response:{headers:Object.fromEntries(K.headers?.entries()??[])}}}}}}};var ZM1=()=>{};async function Hs0(Y,Q){let X=Lv.forClient(IO(Y)),J=nv(X);return{thinkingModel:J.languageModel(Q.thinking.id),codingModel:Q.coding?J.languageModel(Q.coding.id):void 0,fastModel:Q.fast?J.languageModel(Q.fast.id):void 0,connectionId:Q.connectionId}}var $s0=S(()=>{Pr();ZM1();jO()});var Hn6,$n6,Fn6,KM1,Vn6,Fs0;var Vs0=S(()=>{m1();_P();Hn6=q.looseObject({id:q.string().optional(),role:q.enum(["user","assistant","system"]),parts:q.array(q.record(q.string(),q.unknown())),metadata:q.unknown().optional()}),$n6=q.object({windowSize:q.number().default(sr),thread_id:q.string()}),Fn6=q.enum(["openai","anthropic","google","xai","deepseek","openrouter","openai-compatible"]).optional().nullable(),KM1=q.object({id:q.string(),capabilities:q.object({vision:q.boolean().optional(),text:q.boolean().optional(),tools:q.boolean().optional()}).optional(),provider:Fn6,limits:q.object({contextWindow:q.number().optional(),maxOutputTokens:q.number().optional()}).optional()}),Vn6=q.object({connectionId:q.string(),thinking:KM1.describe("Backbone model for the agentic loop"),coding:KM1.optional().describe("Good coding model"),fast:KM1.optional().describe("Cheap model for simple tasks")}).loose(),Fs0=q.object({messages:q.array(Hn6).min(1).refine((Y)=>Y.filter((Q)=>Q.role!=="system").length===1,{message:"Expected exactly one non-system message"}),memory:$n6.optional(),models:Vn6,agent:q.object({id:q.string(),mode:q.enum(["passthrough","smart_tool_selection","code_execution"])}).loose(),stream:q.boolean().optional(),temperature:q.number().default(0.5),thread_id:q.string().optional(),toolApprovalLevel:q.enum(["none","readonly","yolo"]).default("none")})});function qs0(Y,Q=[]){if(Y==="stop")return
|
|
1568
|
+
${W}`)}return{stream:Zn6(K),response:{headers:Object.fromEntries(K.headers?.entries()??[])}}}}}}};var ZM1=()=>{};async function Hs0(Y,Q){let X=Lv.forClient(IO(Y)),J=nv(X);return{thinkingModel:J.languageModel(Q.thinking.id),codingModel:Q.coding?J.languageModel(Q.coding.id):void 0,fastModel:Q.fast?J.languageModel(Q.fast.id):void 0,connectionId:Q.connectionId}}var $s0=S(()=>{Pr();ZM1();jO()});var Hn6,$n6,Fn6,KM1,Vn6,Fs0;var Vs0=S(()=>{m1();_P();Hn6=q.looseObject({id:q.string().optional(),role:q.enum(["user","assistant","system"]),parts:q.array(q.record(q.string(),q.unknown())),metadata:q.unknown().optional()}),$n6=q.object({windowSize:q.number().default(sr),thread_id:q.string()}),Fn6=q.enum(["openai","anthropic","google","xai","deepseek","openrouter","openai-compatible"]).optional().nullable(),KM1=q.object({id:q.string(),capabilities:q.object({vision:q.boolean().optional(),text:q.boolean().optional(),tools:q.boolean().optional()}).optional(),provider:Fn6,limits:q.object({contextWindow:q.number().optional(),maxOutputTokens:q.number().optional()}).optional()}),Vn6=q.object({connectionId:q.string(),thinking:KM1.describe("Backbone model for the agentic loop"),coding:KM1.optional().describe("Good coding model"),fast:KM1.optional().describe("Cheap model for simple tasks")}).loose(),Fs0=q.object({messages:q.array(Hn6).min(1).refine((Y)=>Y.filter((Q)=>Q.role!=="system").length===1,{message:"Expected exactly one non-system message"}),memory:$n6.optional(),models:Vn6,agent:q.object({id:q.string(),mode:q.enum(["passthrough","smart_tool_selection","code_execution"])}).loose(),stream:q.boolean().optional(),temperature:q.number().default(0.5),thread_id:q.string().optional(),toolApprovalLevel:q.enum(["none","readonly","yolo"]).default("none")})});function qs0(Y,Q=[]){if(Y==="stop")return Q.filter((G)=>G.type==="text"&&G.text).map((G)=>G.text).join(`
|
|
1569
|
+
`).replace(/https?:\/\/[^\s)>\]]+/g,"").includes("?")?"requires_action":"completed";if(Y==="tool-calls"){let X=Q.some((G)=>G.type==="tool-user_ask"&&G.state==="input-available"),J=Q.some((G)=>G.state==="approval-requested");return X||J?"requires_action":"completed"}return"failed"}async function Bs0(Y){let{abortSignal:Q,model:X,userMessage:J}=Y,G=new AbortController,K=()=>G.abort();Q.addEventListener("abort",K,{once:!0});let W=setTimeout(()=>{G.abort()},qn6);try{let H=(await sA({model:X,system:Bo0,messages:[{role:"user",content:J}],maxOutputTokens:60,temperature:0.2,abortSignal:G.signal})).text.trim();return(H.split(`
|
|
1569
1570
|
`)[0]??H).replace(/^["']|["']$/g,"").replace(/^(Title:|title:)\s*/i,"").replace(/[.!?]$/,"").slice(0,60).trim()}catch(Z){let H=Z;if(H.name==="AbortError")console.warn("[decopilot:title] Title generation aborted (timeout or parent abort)");else console.error("[decopilot:title] \u274C Failed to generate title:",H.message);return null}finally{clearTimeout(W),Q.removeEventListener("abort",K)}}var qn6=2500;var Us0=S(()=>{sZ();_P()});async function Bn6(Y){let Q=Zo(Y),X=await Y.req.json(),J=Fs0.safeParse(X);if(!J.success)throw new XJ(400,{message:J.error.message});let{messages:G,...K}=J.data,W=G,{systemMessages:Z,requestMessage:H}=ao0(W);return{organization:Q,systemMessages:Z,requestMessage:H,...K}}function HM1(Y){let{cancelBroadcast:Q,streamBuffer:X,runRegistry:J}=Y,G=new VQ;return G.get("/:org/decopilot/allowed-models",async(K)=>{try{let W=K.get("meshContext"),Z=Zo(K),H=W.auth.user?.role,$=await WM1(W.db,Z.id,H);return K.json(Gs0($))}catch(W){if(console.error("[decopilot:allowed-models] Error",W),W instanceof XJ)return K.json({error:W.message},W.status);return K.json({error:W instanceof Error?W.message:"Internal error"},500)}}),G.post("/:org/decopilot/stream",async(K)=>{let W,Z;try{let H=K.get("meshContext"),{organization:$,models:F,agent:V,systemMessages:B,requestMessage:U,temperature:D,memory:z,thread_id:L,toolApprovalLevel:w}=await Bn6(K),E=H.auth?.user?.id;if(!E)throw new XJ(401,{message:"User ID is required"});let T=await WM1(H.db,$.id,H.auth.user?.role);if(!Js0(T,F.connectionId,F.thinking.id))throw new XJ(403,{message:"Model not allowed for your role"});let C=z?.windowSize??sr,P=L??z?.thread_id,[I,k,v]=await Promise.all([H.storage.virtualMcps.findById(V.id,$.id),H.storage.connections.findById(F.connectionId,$.id),eo0(H.storage.threads,{organization_id:$.id,thread_id:P,userId:E,defaultWindowSize:C})]),f=async(...O1)=>{let S1=Date.now(),n1=[...new Map(O1.filter(Boolean).map((Y0)=>[Y0.id,Y0])).values()].map((Y0,I1)=>({...Y0,thread_id:v.thread.id,created_at:new Date(S1+I1).toISOString(),updated_at:new Date(S1+I1).toISOString()}));if(n1.length===0)return;await v.save(n1).catch((Y0)=>{console.error("[decopilot:stream] Error saving messages",Y0)})},b=(O1)=>{H.storage.threads.update(v.thread.id,{status:O1}).catch((n1)=>{console.error("[decopilot:stream] Error updating thread status",n1)});let S1=O1==="completed"?"completed":"failed";J.finishRun(v.thread.id,S1,(n1)=>X.purge(n1)),uJ.emit($.id,xT(v.thread.id,O1)),uJ.emit($.id,jx(v.thread.id,O1))};if(W=()=>b("failed"),!k)throw Error("Model connection not found");if(!I)throw Error("Agent not found");await H.storage.threads.update(v.thread.id,{status:"in_progress"}),uJ.emit($.id,xT(v.thread.id,"in_progress"));let r=J.startRun(v.thread.id,$.id,E).abortController.signal;X.purge(v.thread.id),await f(U),r.addEventListener("abort",()=>{Z?.(),W()});let m=V.mode!=="passthrough",h=F.thinking.limits?.maxOutputTokens??or,n=!1,H1=0,X1=null,N1=await ro0(v,U,[dL1(),...B],C),j1=new Map,D1=oU1({originalMessages:N1,execute:async({writer:O1})=>{let[S1,n1,Y0]=await Promise.all([y5(k,H,!1),OB(I,H,"passthrough"),m?OB(I,H,V.mode):Promise.resolve(null)]);Z=()=>{S1.close().catch(()=>{}),n1.close().catch(()=>{}),Y0?.close().catch(()=>{})};let I1=MO(S1,F.connectionId,k,H,{superUser:!1}),M1=await Hs0(I1,F),p1=n1.getInstructions(),q4=p1?.trim()?N1.map((_4)=>_4.id==="decopilot-system"?dL1(p1):_4):N1,a0=await cv(n1,j1,O1,w),V0=Y0?await cv(Y0,j1,O1,w):{},y1=await no0(O1,{modelProvider:M1,organization:$,models:F,toolApprovalLevel:w,toolOutputMap:j1},H),T1={...a0,...V0,...y1},i1=Y0?[...Object.keys(V0),...Object.keys(y1)]:void 0,{systemMessages:A1,messages:f1,originalMessages:R0}=await oo0(q4,{windowSize:C,models:F,tools:T1});if(Qs0(F,R0),v.thread.title===tr)Bs0({abortSignal:r,model:M1.fastModel??M1.thinkingModel,userMessage:JSON.stringify(f1[0]?.content)}).then(async(_4)=>{if(!_4)return;if(await H.storage.threads.update(v.thread.id,{title:_4}).catch((f0)=>{console.error("[decopilot:stream] Error updating thread title",f0)}),!n)O1.write({type:"data-thread-title",data:{title:_4},transient:!0})});let G0=null,p4,h6=tA({model:M1.thinkingModel,system:A1,messages:f1,tools:T1,activeTools:i1,temperature:D,maxOutputTokens:h,abortSignal:r,stopWhen:GB(Fo0),onError:async(_4)=>{throw console.error("[decopilot:stream] Error",_4),_4}}).toUIMessageStream({originalMessages:R0,generateMessageId:$o0,messageMetadata:({part:_4})=>{if(_4.type==="start")return{agent:{id:V.id??null,mode:V.mode},models:{connectionId:F.connectionId,thinking:F.thinking},created_at:new Date,thread_id:v.thread.id};if(_4.type==="reasoning-start"){if(G0===null)G0=new Date;return{reasoning_start_at:G0}}if(_4.type==="reasoning-end")return{reasoning_end_at:new Date};if(_4.type==="finish-step"){p4=_4.providerMetadata;return}if(_4.type==="finish"){let f0=F.thinking.provider,o1=_4.totalUsage,A0=p4??_4.providerMetadata,y4=o1?{inputTokens:o1.inputTokens??0,outputTokens:o1.outputTokens??0,reasoningTokens:o1.reasoningTokens??void 0,totalTokens:o1.totalTokens??0,providerMetadata:L91(f0&&A0?{...A0,[f0]:{...A0[f0]??{},reasoning_details:void 0}}:A0)}:void 0;return{...y4&&{usage:y4}}}return}});O1.merge(X.relay(h6,v.thread.id,r))},onFinish:async({responseMessage:O1,finishReason:S1})=>{if(n=!0,Z?.(),X1)await X1;if(await f(O1),r.aborted)return;let n1=qs0(S1,O1?.parts);b(n1)},onStepFinish:({responseMessage:O1})=>{if(H1++,uJ.emit($.id,Ix(v.thread.id,H1)),H1%5===0)X1=f(O1).finally(()=>{X1=null})},onError:(O1)=>{if(n=!0,Z?.(),r.aborted)return O1 instanceof Error?O1.message:String(O1);if(console.error("[decopilot] stream error:",O1),v.thread.id)W();return O1 instanceof Error?O1.message:String(O1)}});return $a({stream:D1,consumeSseStream:Ik})}catch(H){if(Z?.(),W)W();if(console.error("[decopilot:stream] Error",H),H instanceof XJ)return K.json({error:H.message},H.status);if(H instanceof Error&&H.name==="AbortError")return console.warn("[decopilot:stream] Aborted",{error:H.message}),K.json({error:"Request aborted"},400);return console.error("[decopilot:stream] Failed",{error:H instanceof Error?H.message:JSON.stringify(H),stack:H instanceof Error?H.stack:void 0}),K.json({error:H instanceof Error?H.message:JSON.stringify(H)},500)}}),G.post("/:org/decopilot/cancel/:threadId",async(K)=>{let{threadId:W}=await GM1(K);if(J.cancelLocal(W))return K.json({cancelled:!0});return Q.broadcast(W),K.json({cancelled:!0,async:!0},202)}),G.get("/:org/decopilot/attach/:threadId",async(K)=>{try{let{threadId:W}=await GM1(K),Z=J.getRun(W);if(!Z||Z.status!=="running")return K.body(null,204);let H=await X.createReplayStream(W);if(!H)return K.body(null,204);let $=oU1({execute:async({writer:F})=>{let V=H.getReader();try{while(!0){let{done:B,value:U}=await V.read();if(B)break;F.write(U)}}finally{V.releaseLock()}}});return $a({stream:$,consumeSseStream:Ik})}catch(W){if(W instanceof XJ)throw W;return console.error("[decopilot:attach] Error",W),K.body(null,500)}}),G}var Ds0=S(()=>{RP();Iv();QY();sZ();GK();jP();io0();_P();so0();Ko();Ys0();Xs0();Go();Ws0();$s0();Vs0();Us0()});var zs0=S(()=>{Ds0()});var Ho,Os0;var Ns0=S(()=>{GK();Mv();Ho=new VQ;Ho.post("/connections/:connectionId/oauth-token",async(Y)=>{let Q=Y.get("meshContext"),X=Y.req.param("connectionId");if(!(Q.auth.user?.id??Q.auth.apiKey?.userId??null))return Y.json({error:"Unauthorized"},401);if(!await Q.storage.connections.findById(X,Q.organization?.id))return Y.json({error:"Connection not found"},404);let K=await Y.req.json();if(!K.accessToken)return Y.json({error:"accessToken is required"},400);if(K.tokenEndpoint){let F;try{F=new URL(K.tokenEndpoint)}catch{return Y.json({error:"tokenEndpoint must be a valid URL"},400)}if(F.protocol!=="http:"&&F.protocol!=="https:")return Y.json({error:"tokenEndpoint must be an http(s) URL"},400)}let W=K.expiresIn?new Date(Date.now()+K.expiresIn*1000):null,Z=new XK(Q.db,Q.vault),H={connectionId:X,accessToken:K.accessToken,refreshToken:K.refreshToken??null,scope:K.scope??null,expiresAt:W,clientId:K.clientId??null,clientSecret:K.clientSecret??null,tokenEndpoint:K.tokenEndpoint??null},$=await Z.upsert(H);return Y.json({success:!0,expiresAt:$.expiresAt})});Ho.delete("/connections/:connectionId/oauth-token",async(Y)=>{let Q=Y.get("meshContext"),X=Y.req.param("connectionId");if(!(Q.auth.user?.id??Q.auth.apiKey?.userId??null))return Y.json({error:"Unauthorized"},401);return await new XK(Q.db,Q.vault).delete(X),Y.json({success:!0})});Ho.get("/connections/:connectionId/oauth-token/status",async(Y)=>{let Q=Y.get("meshContext"),X=Y.req.param("connectionId");if(!(Q.auth.user?.id??Q.auth.apiKey?.userId??null))return Y.json({error:"Unauthorized"},401);let G=new XK(Q.db,Q.vault),K=await G.get(X);if(!K)return Y.json({hasToken:!1,isExpired:!0,canRefresh:!1});let W=G.isExpired(K),Z=!!K.refreshToken&&!!K.tokenEndpoint;return Y.json({hasToken:!0,isExpired:W,canRefresh:Z,expiresAt:K.expiresAt})});Os0=Ho});var $M1=class{writer;encoder;writable;abortSubscribers=[];responseReadable;aborted=!1;closed=!1;constructor(Y,Q){this.writable=Y,this.writer=Y.getWriter(),this.encoder=new TextEncoder;let X=Q.getReader();this.abortSubscribers.push(async()=>{await X.cancel()}),this.responseReadable=new ReadableStream({async pull(J){let{done:G,value:K}=await X.read();G?J.close():J.enqueue(K)},cancel:()=>{this.abort()}})}async write(Y){try{if(typeof Y==="string")Y=this.encoder.encode(Y);await this.writer.write(Y)}catch{}return this}async writeln(Y){return await this.write(Y+`
|
|
1570
1571
|
`),this}sleep(Y){return new Promise((Q)=>setTimeout(Q,Y))}async close(){try{await this.writer.close()}catch{}this.closed=!0}async pipe(Y){this.writer.releaseLock(),await Y.pipeTo(this.writable,{preventClose:!0}),this.writer=this.writable.getWriter()}onAbort(Y){this.abortSubscribers.push(Y)}abort(){if(!this.aborted)this.aborted=!0,this.abortSubscribers.forEach((Y)=>Y())}};var FM1=()=>{};var $o=()=>{let Y=typeof Bun<"u"?Bun.version:void 0;if(Y===void 0)return!1;let Q=Y.startsWith("1.1")||Y.startsWith("1.0")||Y.startsWith("0.");return $o=()=>Q,Q};var VM1=()=>{};var Ls0=S(()=>{FM1();VM1()});var Ms0,Un6=async(Y,Q,X)=>{try{await Q(Y)}catch(J){if(J instanceof Error&&X)await X(J,Y),await Y.writeSSE({event:"error",data:J.message});else console.error(J)}finally{Y.close()}},Dn6,iv=(Y,Q,X)=>{let{readable:J,writable:G}=new TransformStream,K=new Ms0(G,J);if($o())Y.req.raw.signal.addEventListener("abort",()=>{if(!K.closed)K.abort()});return Dn6.set(K.responseReadable,Y),Y.header("Transfer-Encoding","chunked"),Y.header("Content-Type","text/event-stream"),Y.header("Cache-Control","no-cache"),Y.header("Connection","keep-alive"),Un6(K,Q,X),Y.newResponse(K.responseReadable)};var ws0=S(()=>{LL1();FM1();VM1();Ms0=class extends $M1{constructor(Y,Q){super(Y,Q)}async writeSSE(Y){let X=(await fv(Y.data,xr.Stringify,!1,{})).split(/\r\n|\r|\n/).map((G)=>{return`data: ${G}`}).join(`
|
|
1571
1572
|
`);for(let G of["event","id","retry"])if(Y[G]&&/[\r\n]/.test(Y[G]))throw Error(`${G} must not contain "\\r" or "\\n"`);let J=[Y.event&&`event: ${Y.event}`,X,Y.id&&`id: ${Y.id}`,Y.retry&&`retry: ${Y.retry}`].filter(Boolean).join(`
|
package/dist/server/server.js
CHANGED
|
@@ -1416,7 +1416,8 @@ End with a concise summary: what you did, what you found/produced, any assumptio
|
|
|
1416
1416
|
|
|
1417
1417
|
${Y}`;return Q}function li0(Y,Q,X){let{modelProvider:J,organization:G,models:K,needsApproval:W}=Q;return _J({description:Ym6,inputSchema:d8(eu6),needsApproval:W,execute:async function*({prompt:Z,agent_id:H},{abortSignal:$,toolCallId:F}){let V=performance.now(),B=await X.storage.virtualMcps.findById(H,G.id);if(!B||B.organization_id!==G.id)throw Error("Agent not found");if(B.status!=="active")throw Error("Agent is not active");let U=await $B(B,X,"passthrough"),D=await Tv(U,new Map,Y,"yolo",{disableOutputTruncation:!0}),z=Object.fromEntries(Object.entries(D).filter(([P])=>!Li0.includes(P))),L=U.getInstructions(),w=Xm6(L),E=S71(),T=dA({model:J.thinkingModel,system:w,prompt:Z,tools:z,abortSignal:$,stopWhen:rq(Ni0),maxOutputTokens:K.thinking.limits?.maxOutputTokens??Er,onStepFinish:({usage:P,providerMetadata:I})=>{E=k71(E,{...P,providerMetadata:I})},onAbort:()=>{console.error(`[subtask:${H}] Aborted`),U.close().catch(()=>{})},onError:(P)=>{console.error(`[subtask:${H}] Error`,P)}});for await(let P of Hh0({stream:T.toUIMessageStream()}))yield P;let C=performance.now()-V;Y.write({type:"data-tool-metadata",id:F,data:{annotations:Qm6,latencyMs:C}}),Y.write({type:"data-tool-subtask-metadata",id:F,data:{usage:E,agent:H,models:K}})},toModelOutput:({output:Z})=>{return{type:"text",value:Z?.parts?.findLast(($)=>("type"in $)&&$.type==="text"&&("text"in $))?.text??"Subtask completed (no output)."}}})}rZ();u1();var Jm6=q.object({prompt:q.string().min(1).describe("The question to display"),type:q.enum(["text","choice","confirm"]).describe("'text': free-form, 'choice': pick from options (UI adds 'Other' automatically), 'confirm': yes/no"),options:q.array(q.string()).optional().describe("Required for 'choice'"),default:q.string().optional()}).refine((Y)=>{if(Y.type==="choice")return Y.options&&Y.options.length>=2;return!0},{message:"Options array with at least 2 items required for 'choice' type",path:["options"]}),Gm6=q.object({response:q.string().describe("User's response")}),Wm6="Ask the user instead of guessing when requirements are ambiguous, multiple valid approaches exist, or before destructive changes. Prefer this tool over asking in plain text.",di0=_J({description:Wm6,inputSchema:d8(Jm6),outputSchema:d8(Gm6)});function pi0(Y,Q,X){let{modelProvider:J,organization:G,models:K,toolApprovalLevel:W="none",toolOutputMap:Z}=Q;return{user_ask:di0,subtask:li0(Y,{modelProvider:J,organization:G,models:K,needsApproval:kr(W,!1)},X),agent_search:mi0(Y,{organization:G,needsApproval:kr(W,!0)},X),read_tool_output:ui0({toolOutputMap:Z})}}rZ();function ci0(Y){let Q=Y.filter((J)=>J.role==="system"),X=Y.find((J)=>J.role!=="system");return{systemMessages:Q,requestMessage:X}}function Zm6(Y){let Q=!1,X=Y.map((J)=>{if(J.role!=="assistant")return J;if(!J.parts.some((K)=>("state"in K)&&K.state==="approval-requested"))return J;return Q=!0,{...J,parts:J.parts.map((K)=>{if(!("state"in K)||K.state!=="approval-requested"||!("approval"in K)||!K.approval)return K;return{...K,state:"output-denied",approval:{...K.approval,approved:!1,reason:"User sent a new message without approving this tool call."}}})}});return Q?X:Y}function Km6(Y){let[Q,X]=Y.reduce((J,G)=>{if(G.role==="system")J[0].push(G);else J[1].push(G);return J},[[],[]]);return{systemMessages:Q,messages:X}}async function Hm6(Y,Q){return await Y.loadHistory(Q)}function $m6(Y,Q){let X=Y.findIndex((G)=>G.id===Q.id);return X>=0?[...Y.slice(0,X),Q]:[...Y,Q]}async function ni0(Y,Q,X,J){let G=await Hm6(Y,J),K=$m6(G,Q);return[...X,...K]}async function ii0(Y,Q){let X=await Fh0({messages:Y}),J=Zm6(X),G=await $h0(J,{tools:Q.tools,ignoreIncompleteToolCalls:!0}),{systemMessages:K,messages:W}=Km6(G),Z=qh0({messages:W,reasoning:"all",emptyMessages:"remove",toolCalls:"none"});return{systemMessages:K,messages:Z,originalMessages:X}}LG();class ai0{thread;organization_id;storage;defaultWindowSize;constructor(Y){this.thread=Y.thread,this.organization_id=Y.thread.organization_id,this.storage=Y.storage,this.defaultWindowSize=Y.defaultWindowSize??50}async loadHistory(Y){let Q=Y??this.defaultWindowSize,{messages:X}=await this.storage.listMessages(this.thread.id,{limit:Q,sort:"desc"}),J=[...X].reverse(),G=J.findIndex((K)=>K.role==="user");return G>=0?J.slice(G):J}async save(Y){if(Y.length===0)return;await this.storage.saveMessages(Y)}}async function ri0(Y,Q){let{thread_id:X,organization_id:J,userId:G,defaultWindowSize:K}=Q,W;if(!X)W=await Y.create({id:l8("thrd"),organization_id:J,created_by:G});else{let Z=await Y.get(X);if(!Z||Z.organization_id!==J)W=await Y.create({id:Z?l8("thrd"):X,organization_id:J,created_by:G});else W=Z}return new ai0({thread:W,storage:Y,defaultWindowSize:K})}function oi0(Y,Q){if(!(Y.thinking.capabilities?.vision??!1)){if(Q.some((G)=>G.parts?.some((K)=>K.type==="file")))throw new TX(400,{message:"This model does not support file uploads. Please change the model and try again."})}}Nr();function Fm6(Y){if(!Y)return;if(!("models"in Y))return;return Y.models??void 0}function si0(Y,Q,X){if(!Y)return!0;return Y.includes("*:*")||Y.includes(`${Q}:*`)||Y.includes(`${Q}:${X}`)}function ti0(Y){if(!Y)return{allowAll:!0,models:{}};if(Y.includes("*:*"))return{allowAll:!0,models:{}};let Q={};for(let X of Y){let J=X.indexOf(":");if(J===-1)continue;let G=X.slice(0,J),K=X.slice(J+1);if(!Q[G])Q[G]=[];Q[G].push(K)}return{allowAll:!1,models:Q}}async function jN1(Y,Q,X){if(!X||Or.includes(X))return;let J=await Y.selectFrom("organizationRole").select(["permission"]).where("organizationId","=",Q).where("role","=",X).executeTakeFirst();if(!J?.permission)return;try{let G=JSON.parse(J.permission);return Fm6(G)}catch{return console.error(`[model-permissions] Failed to parse permissions for role: ${X}`),[]}}Hr();function ei0(Y){let Q=Y.trim();if(!Q)return null;if(Q.startsWith("event:"))return null;if(Q.startsWith("id:"))return null;if(Q.startsWith("retry:"))return null;let X=Q;if(X.startsWith("data:")){if(X=X.slice(5).trim(),!X)return null;if(X==="[DONE]")return null}try{return JSON.parse(X)}catch(J){return console.warn("[llm-provider] Failed to parse stream line as JSON. Skipping line.",{line:X.slice(0,200)},J),null}}function Vm6(Y){if(!Y.body)throw Error("Response body is null");let Q="";return Y.body.pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({transform(X,J){Q+=X;let G=Q.split(`
|
|
1418
1418
|
`);Q=G.pop()??"";for(let K of G)if(K.trim()){let W=ei0(K);if(W)J.enqueue(W)}},flush(X){if(Q.trim()){let J=ei0(Q);if(J)X.enqueue(J)}}}))}var qm6=(Y)=>{return Object.fromEntries(Object.entries(Y).map(([Q,X])=>[Q,X.map((J)=>new RegExp(J))]))};function Ya0(Y){let{prompt:Q,abortSignal:X,...J}=Y,G=Q.map((W)=>{if((W.role==="assistant"||W.role==="tool")&&Array.isArray(W.content)){let{providerOptions:Z,...H}=W;return{...H,content:W.content.map(({providerOptions:$,...F})=>{if(F.type==="tool-result"&&F.output&&F.output?.type==="execution-denied"){let V=F.output;return{...F,output:{type:"error-text",value:V.reason??"Tool execution denied."}}}return F})}}return W});return{...J,prompt:G}}var Cv=(Y)=>{return{imageModel:()=>{throw Error("Image models are not supported by this provider")},textEmbeddingModel:()=>{throw Error("Text embedding models are not supported by this provider")},listModels:async()=>{return await Y.COLLECTION_LLM_LIST({})},languageModel:(Q)=>{let X=DP(()=>Y.LLM_METADATA({modelId:Q}).then((J)=>qm6(J.supportedUrls)));return{specificationVersion:"v2",provider:"llm-binding",modelId:Q,supportedUrls:X,doGenerate:async(J)=>{let G=await Y.LLM_DO_GENERATE({callOptions:Ya0(J),modelId:Q}),K=G.response?.timestamp?new Date(G.response.timestamp):void 0;return{...G,response:{...G.response,timestamp:K},usage:{inputTokens:G.usage.inputTokens??void 0,outputTokens:G.usage.outputTokens??void 0,totalTokens:G.usage.totalTokens??void 0,reasoningTokens:G.usage.reasoningTokens??void 0}}},doStream:async(J)=>{let G=Ya0(J),K=await Y.LLM_DO_STREAM({callOptions:G,modelId:Q});if(!K.ok){let W=await K.text();throw Error(`Streaming failed for model ${Q} with the status code: ${K.status}
|
|
1419
|
-
${W}`)}return{stream:Vm6(K),response:{headers:Object.fromEntries(K.headers?.entries()??[])}}}}}}};async function Qa0(Y,Q){let X=Zv.forClient(NO(Y)),J=Cv(X);return{thinkingModel:J.languageModel(Q.thinking.id),codingModel:Q.coding?J.languageModel(Q.coding.id):void 0,fastModel:Q.fast?J.languageModel(Q.fast.id):void 0,connectionId:Q.connectionId}}u1();var Bm6=q.looseObject({id:q.string().optional(),role:q.enum(["user","assistant","system"]),parts:q.array(q.record(q.string(),q.unknown())),metadata:q.unknown().optional()}),Um6=q.object({windowSize:q.number().default(Tr),thread_id:q.string()}),Dm6=q.enum(["openai","anthropic","google","xai","deepseek","openrouter","openai-compatible"]).optional().nullable(),SN1=q.object({id:q.string(),capabilities:q.object({vision:q.boolean().optional(),text:q.boolean().optional(),tools:q.boolean().optional()}).optional(),provider:Dm6,limits:q.object({contextWindow:q.number().optional(),maxOutputTokens:q.number().optional()}).optional()}),zm6=q.object({connectionId:q.string(),thinking:SN1.describe("Backbone model for the agentic loop"),coding:SN1.optional().describe("Good coding model"),fast:SN1.optional().describe("Cheap model for simple tasks")}).loose(),Xa0=q.object({messages:q.array(Bm6).min(1).refine((Y)=>Y.filter((Q)=>Q.role!=="system").length===1,{message:"Expected exactly one non-system message"}),memory:Um6.optional(),models:zm6,agent:q.object({id:q.string(),mode:q.enum(["passthrough","smart_tool_selection","code_execution"])}).loose(),stream:q.boolean().optional(),temperature:q.number().default(0.5),thread_id:q.string().optional(),toolApprovalLevel:q.enum(["none","readonly","yolo"]).default("none")});function Ja0(Y,Q=[]){if(Y==="stop")return
|
|
1419
|
+
${W}`)}return{stream:Vm6(K),response:{headers:Object.fromEntries(K.headers?.entries()??[])}}}}}}};async function Qa0(Y,Q){let X=Zv.forClient(NO(Y)),J=Cv(X);return{thinkingModel:J.languageModel(Q.thinking.id),codingModel:Q.coding?J.languageModel(Q.coding.id):void 0,fastModel:Q.fast?J.languageModel(Q.fast.id):void 0,connectionId:Q.connectionId}}u1();var Bm6=q.looseObject({id:q.string().optional(),role:q.enum(["user","assistant","system"]),parts:q.array(q.record(q.string(),q.unknown())),metadata:q.unknown().optional()}),Um6=q.object({windowSize:q.number().default(Tr),thread_id:q.string()}),Dm6=q.enum(["openai","anthropic","google","xai","deepseek","openrouter","openai-compatible"]).optional().nullable(),SN1=q.object({id:q.string(),capabilities:q.object({vision:q.boolean().optional(),text:q.boolean().optional(),tools:q.boolean().optional()}).optional(),provider:Dm6,limits:q.object({contextWindow:q.number().optional(),maxOutputTokens:q.number().optional()}).optional()}),zm6=q.object({connectionId:q.string(),thinking:SN1.describe("Backbone model for the agentic loop"),coding:SN1.optional().describe("Good coding model"),fast:SN1.optional().describe("Cheap model for simple tasks")}).loose(),Xa0=q.object({messages:q.array(Bm6).min(1).refine((Y)=>Y.filter((Q)=>Q.role!=="system").length===1,{message:"Expected exactly one non-system message"}),memory:Um6.optional(),models:zm6,agent:q.object({id:q.string(),mode:q.enum(["passthrough","smart_tool_selection","code_execution"])}).loose(),stream:q.boolean().optional(),temperature:q.number().default(0.5),thread_id:q.string().optional(),toolApprovalLevel:q.enum(["none","readonly","yolo"]).default("none")});function Ja0(Y,Q=[]){if(Y==="stop")return Q.filter((G)=>G.type==="text"&&G.text).map((G)=>G.text).join(`
|
|
1420
|
+
`).replace(/https?:\/\/[^\s)>\]]+/g,"").includes("?")?"requires_action":"completed";if(Y==="tool-calls"){let X=Q.some((G)=>G.type==="tool-user_ask"&&G.state==="input-available"),J=Q.some((G)=>G.state==="approval-requested");return X||J?"requires_action":"completed"}return"failed"}rZ();var Om6=2500;async function Ga0(Y){let{abortSignal:Q,model:X,userMessage:J}=Y,G=new AbortController,K=()=>G.abort();Q.addEventListener("abort",K,{once:!0});let W=setTimeout(()=>{G.abort()},Om6);try{let H=(await lA({model:X,system:Mi0,messages:[{role:"user",content:J}],maxOutputTokens:60,temperature:0.2,abortSignal:G.signal})).text.trim();return(H.split(`
|
|
1420
1421
|
`)[0]??H).replace(/^["']|["']$/g,"").replace(/^(Title:|title:)\s*/i,"").replace(/[.!?]$/,"").slice(0,60).trim()}catch(Z){let H=Z;if(H.name==="AbortError")console.warn("[decopilot:title] Title generation aborted (timeout or parent abort)");else console.error("[decopilot:title] \u274C Failed to generate title:",H.message);return null}finally{clearTimeout(W),Q.removeEventListener("abort",K)}}async function Nm6(Y){let Q=vr(Y),X=await Y.req.json(),J=Xa0.safeParse(X);if(!J.success)throw new TX(400,{message:J.error.message});let{messages:G,...K}=J.data,W=G,{systemMessages:Z,requestMessage:H}=ci0(W);return{organization:Q,systemMessages:Z,requestMessage:H,...K}}function kN1(Y){let{cancelBroadcast:Q,streamBuffer:X,runRegistry:J}=Y,G=new JQ;return G.get("/:org/decopilot/allowed-models",async(K)=>{try{let W=K.get("meshContext"),Z=vr(K),H=W.auth.user?.role,$=await jN1(W.db,Z.id,H);return K.json(ti0($))}catch(W){if(console.error("[decopilot:allowed-models] Error",W),W instanceof TX)return K.json({error:W.message},W.status);return K.json({error:W instanceof Error?W.message:"Internal error"},500)}}),G.post("/:org/decopilot/stream",async(K)=>{let W,Z;try{let H=K.get("meshContext"),{organization:$,models:F,agent:V,systemMessages:B,requestMessage:U,temperature:D,memory:z,thread_id:L,toolApprovalLevel:w}=await Nm6(K),E=H.auth?.user?.id;if(!E)throw new TX(401,{message:"User ID is required"});let T=await jN1(H.db,$.id,H.auth.user?.role);if(!si0(T,F.connectionId,F.thinking.id))throw new TX(403,{message:"Model not allowed for your role"});let C=z?.windowSize??Tr,P=L??z?.thread_id,[I,S,v]=await Promise.all([H.storage.virtualMcps.findById(V.id,$.id),H.storage.connections.findById(F.connectionId,$.id),ri0(H.storage.threads,{organization_id:$.id,thread_id:P,userId:E,defaultWindowSize:C})]),f=async(...O1)=>{let S1=Date.now(),c1=[...new Map(O1.filter(Boolean).map((e1)=>[e1.id,e1])).values()].map((e1,I1)=>({...e1,thread_id:v.thread.id,created_at:new Date(S1+I1).toISOString(),updated_at:new Date(S1+I1).toISOString()}));if(c1.length===0)return;await v.save(c1).catch((e1)=>{console.error("[decopilot:stream] Error saving messages",e1)})},b=(O1)=>{H.storage.threads.update(v.thread.id,{status:O1}).catch((c1)=>{console.error("[decopilot:stream] Error updating thread status",c1)});let S1=O1==="completed"?"completed":"failed";J.finishRun(v.thread.id,S1,(c1)=>X.purge(c1)),xJ.emit($.id,IR(v.thread.id,O1)),xJ.emit($.id,im(v.thread.id,O1))};if(W=()=>b("failed"),!S)throw Error("Model connection not found");if(!I)throw Error("Agent not found");await H.storage.threads.update(v.thread.id,{status:"in_progress"}),xJ.emit($.id,IR(v.thread.id,"in_progress"));let r=J.startRun(v.thread.id,$.id,E).abortController.signal;X.purge(v.thread.id),await f(U),r.addEventListener("abort",()=>{Z?.(),W()});let m=V.mode!=="passthrough",h=F.thinking.limits?.maxOutputTokens??Er,n=!1,H1=0,X1=null,N1=await ni0(v,U,[ON1(),...B],C),j1=new Map,D1=uB1({originalMessages:N1,execute:async({writer:O1})=>{let[S1,c1,e1]=await Promise.all([_5(S,H,!1),$B(I,H,"passthrough"),m?$B(I,H,V.mode):Promise.resolve(null)]);Z=()=>{S1.close().catch(()=>{}),c1.close().catch(()=>{}),e1?.close().catch(()=>{})};let I1=DO(S1,F.connectionId,S,H,{superUser:!1}),M1=await Qa0(I1,F),d1=c1.getInstructions(),q4=d1?.trim()?N1.map((v4)=>v4.id==="decopilot-system"?ON1(d1):v4):N1,a0=await Tv(c1,j1,O1,w),F0=e1?await Tv(e1,j1,O1,w):{},_1=await pi0(O1,{modelProvider:M1,organization:$,models:F,toolApprovalLevel:w,toolOutputMap:j1},H),T1={...a0,...F0,..._1},n1=e1?[...Object.keys(F0),...Object.keys(_1)]:void 0,{systemMessages:A1,messages:y1,originalMessages:R0}=await ii0(q4,{windowSize:C,models:F,tools:T1});if(oi0(F,R0),v.thread.title===Cr)Ga0({abortSignal:r,model:M1.fastModel??M1.thinkingModel,userMessage:JSON.stringify(y1[0]?.content)}).then(async(v4)=>{if(!v4)return;if(await H.storage.threads.update(v.thread.id,{title:v4}).catch((f0)=>{console.error("[decopilot:stream] Error updating thread title",f0)}),!n)O1.write({type:"data-thread-title",data:{title:v4},transient:!0})});let J0=null,d4,b6=dA({model:M1.thinkingModel,system:A1,messages:y1,tools:T1,activeTools:n1,temperature:D,maxOutputTokens:h,abortSignal:r,stopWhen:rq(Oi0),onError:async(v4)=>{throw console.error("[decopilot:stream] Error",v4),v4}}).toUIMessageStream({originalMessages:R0,generateMessageId:zi0,messageMetadata:({part:v4})=>{if(v4.type==="start")return{agent:{id:V.id??null,mode:V.mode},models:{connectionId:F.connectionId,thinking:F.thinking},created_at:new Date,thread_id:v.thread.id};if(v4.type==="reasoning-start"){if(J0===null)J0=new Date;return{reasoning_start_at:J0}}if(v4.type==="reasoning-end")return{reasoning_end_at:new Date};if(v4.type==="finish-step"){d4=v4.providerMetadata;return}if(v4.type==="finish"){let f0=F.thinking.provider,r1=v4.totalUsage,A0=d4??v4.providerMetadata,_4=r1?{inputTokens:r1.inputTokens??0,outputTokens:r1.outputTokens??0,reasoningTokens:r1.reasoningTokens??void 0,totalTokens:r1.totalTokens??0,providerMetadata:j71(f0&&A0?{...A0,[f0]:{...A0[f0]??{},reasoning_details:void 0}}:A0)}:void 0;return{..._4&&{usage:_4}}}return}});O1.merge(X.relay(b6,v.thread.id,r))},onFinish:async({responseMessage:O1,finishReason:S1})=>{if(n=!0,Z?.(),X1)await X1;if(await f(O1),r.aborted)return;let c1=Ja0(S1,O1?.parts);b(c1)},onStepFinish:({responseMessage:O1})=>{if(H1++,xJ.emit($.id,nm(v.thread.id,H1)),H1%5===0)X1=f(O1).finally(()=>{X1=null})},onError:(O1)=>{if(n=!0,Z?.(),r.aborted)return O1 instanceof Error?O1.message:String(O1);if(console.error("[decopilot] stream error:",O1),v.thread.id)W();return O1 instanceof Error?O1.message:String(O1)}});return ii({stream:D1,consumeSseStream:zk})}catch(H){if(Z?.(),W)W();if(console.error("[decopilot:stream] Error",H),H instanceof TX)return K.json({error:H.message},H.status);if(H instanceof Error&&H.name==="AbortError")return console.warn("[decopilot:stream] Aborted",{error:H.message}),K.json({error:"Request aborted"},400);return console.error("[decopilot:stream] Failed",{error:H instanceof Error?H.message:JSON.stringify(H),stack:H instanceof Error?H.stack:void 0}),K.json({error:H instanceof Error?H.message:JSON.stringify(H)},500)}}),G.post("/:org/decopilot/cancel/:threadId",async(K)=>{let{threadId:W}=await IN1(K);if(J.cancelLocal(W))return K.json({cancelled:!0});return Q.broadcast(W),K.json({cancelled:!0,async:!0},202)}),G.get("/:org/decopilot/attach/:threadId",async(K)=>{try{let{threadId:W}=await IN1(K),Z=J.getRun(W);if(!Z||Z.status!=="running")return K.body(null,204);let H=await X.createReplayStream(W);if(!H)return K.body(null,204);let $=uB1({execute:async({writer:F})=>{let V=H.getReader();try{while(!0){let{done:B,value:U}=await V.read();if(B)break;F.write(U)}}finally{V.releaseLock()}}});return ii({stream:$,consumeSseStream:zk})}catch(W){if(W instanceof TX)throw W;return console.error("[decopilot:attach] Error",W),K.body(null,500)}}),G}Kv();var _r=new JQ;_r.post("/connections/:connectionId/oauth-token",async(Y)=>{let Q=Y.get("meshContext"),X=Y.req.param("connectionId");if(!(Q.auth.user?.id??Q.auth.apiKey?.userId??null))return Y.json({error:"Unauthorized"},401);if(!await Q.storage.connections.findById(X,Q.organization?.id))return Y.json({error:"Connection not found"},404);let K=await Y.req.json();if(!K.accessToken)return Y.json({error:"accessToken is required"},400);if(K.tokenEndpoint){let F;try{F=new URL(K.tokenEndpoint)}catch{return Y.json({error:"tokenEndpoint must be a valid URL"},400)}if(F.protocol!=="http:"&&F.protocol!=="https:")return Y.json({error:"tokenEndpoint must be an http(s) URL"},400)}let W=K.expiresIn?new Date(Date.now()+K.expiresIn*1000):null,Z=new YK(Q.db,Q.vault),H={connectionId:X,accessToken:K.accessToken,refreshToken:K.refreshToken??null,scope:K.scope??null,expiresAt:W,clientId:K.clientId??null,clientSecret:K.clientSecret??null,tokenEndpoint:K.tokenEndpoint??null},$=await Z.upsert(H);return Y.json({success:!0,expiresAt:$.expiresAt})});_r.delete("/connections/:connectionId/oauth-token",async(Y)=>{let Q=Y.get("meshContext"),X=Y.req.param("connectionId");if(!(Q.auth.user?.id??Q.auth.apiKey?.userId??null))return Y.json({error:"Unauthorized"},401);return await new YK(Q.db,Q.vault).delete(X),Y.json({success:!0})});_r.get("/connections/:connectionId/oauth-token/status",async(Y)=>{let Q=Y.get("meshContext"),X=Y.req.param("connectionId");if(!(Q.auth.user?.id??Q.auth.apiKey?.userId??null))return Y.json({error:"Unauthorized"},401);let G=new YK(Q.db,Q.vault),K=await G.get(X);if(!K)return Y.json({hasToken:!1,isExpired:!0,canRefresh:!1});let W=G.isExpired(K),Z=!!K.refreshToken&&!!K.tokenEndpoint;return Y.json({hasToken:!0,isExpired:W,canRefresh:Z,expiresAt:K.expiresAt})});var Wa0=_r;Hr();OP();rZ();var vN1=class{writer;encoder;writable;abortSubscribers=[];responseReadable;aborted=!1;closed=!1;constructor(Y,Q){this.writable=Y,this.writer=Y.getWriter(),this.encoder=new TextEncoder;let X=Q.getReader();this.abortSubscribers.push(async()=>{await X.cancel()}),this.responseReadable=new ReadableStream({async pull(J){let{done:G,value:K}=await X.read();G?J.close():J.enqueue(K)},cancel:()=>{this.abort()}})}async write(Y){try{if(typeof Y==="string")Y=this.encoder.encode(Y);await this.writer.write(Y)}catch{}return this}async writeln(Y){return await this.write(Y+`
|
|
1421
1422
|
`),this}sleep(Y){return new Promise((Q)=>setTimeout(Q,Y))}async close(){try{await this.writer.close()}catch{}this.closed=!0}async pipe(Y){this.writer.releaseLock(),await Y.pipeTo(this.writable,{preventClose:!0}),this.writer=this.writable.getWriter()}onAbort(Y){this.abortSubscribers.push(Y)}abort(){if(!this.aborted)this.aborted=!0,this.abortSubscribers.forEach((Y)=>Y())}};var yr=()=>{let Y=typeof Bun<"u"?Bun.version:void 0;if(Y===void 0)return!1;let Q=Y.startsWith("1.1")||Y.startsWith("1.0")||Y.startsWith("0.");return yr=()=>Q,Q};var Za0=class extends vN1{constructor(Y,Q){super(Y,Q)}async writeSSE(Y){let X=(await kR(Y.data,Ql.Stringify,!1,{})).split(/\r\n|\r|\n/).map((G)=>{return`data: ${G}`}).join(`
|
|
1422
1423
|
`);for(let G of["event","id","retry"])if(Y[G]&&/[\r\n]/.test(Y[G]))throw Error(`${G} must not contain "\\r" or "\\n"`);let J=[Y.event&&`event: ${Y.event}`,X,Y.id&&`id: ${Y.id}`,Y.retry&&`retry: ${Y.retry}`].filter(Boolean).join(`
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c}from"./index-CzFqQvXW.js";const o=({size:e=24,color:t="currentColor",...r})=>c.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},c.createElement("path",{d:"M12 8v4m0 4h.01M2 8.523v6.954c0 .245 0 .367.028.482a1 1 0 0 0 .12.29c.061.1.148.187.32.36l4.923 4.922c.173.173.26.26.36.322.09.054.188.095.29.12.115.027.237.027.482.027h6.954c.245 0 .367 0 .482-.028a.998.998 0 0 0 .29-.12c.1-.061.187-.148.36-.32l4.922-4.923c.173-.173.26-.26.322-.36a.998.998 0 0 0 .12-.29c.027-.115.027-.237.027-.482V8.523c0-.245 0-.367-.028-.482a.998.998 0 0 0-.12-.29c-.061-.1-.148-.187-.32-.36L16.608 2.47c-.173-.173-.26-.26-.36-.322a1 1 0 0 0-.29-.12C15.844 2 15.722 2 15.477 2H8.523c-.245 0-.367 0-.482.028a1 1 0 0 0-.29.12c-.1.061-.187.148-.36.32L2.47 7.392c-.173.173-.26.26-.322.36a1 1 0 0 0-.12.29C2 8.156 2 8.278 2 8.523Z"}));o.displayName="AlertOctagon";export{o as c};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as _,c as k,j as t,E as fe,B as J,v as ae,_ as Je,u as de,V as Ze,s as Qe,t as ce,b as Xe,e as et,O as Fe,l as tt,k as st,aD as lt,q as ot}from"./index-CzFqQvXW.js";import{c as Oe,u as nt}from"./context-CnW_lI9R.js";import{C as it,E as rt}from"./collection-search-aEfiIRVT.js";import{I as ge}from"./integration-icon-Cr629JYK.js";import{u as at}from"./index-BeKO7nFo.js";import{B as $e}from"./badge-CMOYVtO8.js";import{i as ct,a as dt,C as mt,b as ut}from"./collapsible-KhZqz8s6.js";import{I as Me}from"./input-Rcf9et7W.js";import{S as ft}from"./switch-D_s2nP_j.js";import{T as pt}from"./textarea-CumbsokS.js";import{a as pe,c as ve,T as xe,b as he}from"./tooltip-BGn6dJhi.js";import{h as xt,f as ht}from"./use-connection-CmCfM9T5.js";import{u as gt,a as jt}from"./use-virtual-mcp-CaM9kbfY.js";import{i as Ge}from"./ChevronRight-B-dZm0Fo.js";import{n as bt}from"./select-CSl7KVC3.js";import{i as De}from"./File02-BBbAYdh-.js";import{i as Le}from"./Loading01-DvHkBn5K.js";import{i as Nt}from"./Play-B4gSKcOc.js";import{s as Ve}from"./Plus-C48LE9QF.js";import{t as yt}from"./Users03-zNQ-U5kI.js";import{B as vt,a as Ct,b as Be,d as _t,e as St,c as Tt}from"./breadcrumb-CtNnsyqL.js";import{a as kt,V as wt}from"./layout-DvurrRZC.js";import{S as Et}from"./save-actions-CH-zbfme.js";import{a as It}from"./tools-list-BvNNjQQL.js";import{C as ze}from"./checkbox-Bs5NWE_x.js";import{e as At,a as He,D as Ue,b as Ot,c as $t}from"./dialog-CzmRWg_H.js";import{T as Ce,a as Dt,b as _e,c as Lt}from"./tabs-BzChyqs4.js";import{u as je,a as zt}from"./constants-0JLhMmM7.js";import{c as Rt}from"./use-mcp-tools-BTHDM3P3.js";import{a as Pt}from"./use-mcp-resources--6yZ25c2.js";import{u as Mt}from"./use-mcp-prompts-Bvv0Gku4.js";import{s as Ke}from"./slugify-CEUa2lfQ.js";import{I as Vt,R as Bt,a as Ft}from"./index-RIE02s6T.js";import{i as be}from"./Check-BGWNBpXb.js";import{i as Gt}from"./Code01-C4dpeKsY.js";import{a as Re}from"./Copy01-Ba42JLNP.js";import{i as Se}from"./InfoCircle-ORvzz6Jj.js";import{i as Ht}from"./Key01-B3LfJVTz.js";import{A as Ut}from"./agent-connections-preview-CpRlCZek.js";import"./decopilot-events-Brt4gAR6.js";import"./use-llm-CPv795TN.js";import"./use-binding-Ctbwf5zu.js";import"./binder-CN-yhtfQ.js";import"./useQuery-BE7O7fKt.js";import"./localstorage-keys-DtK7peUq.js";import"./useMutation-DsQcwaJP.js";import"./use-preferences-fTjyFgCz.js";import"./skeleton-BGGjmBE-.js";import"./AlignLeft-C1Pd8crU.js";import"./ArrowLeft-Ddv8Es1G.js";import"./ChevronDown-CxLgy5uI.js";import"./Image01-CyQ-9pmM.js";import"./RefreshCcw01-B_P3Otqi.js";import"./SearchMd-Bec1mZCp.js";import"./Settings01-CGjDKLLq.js";import"./useSuspenseInfiniteQuery-BSW1dpRq.js";import"./infiniteQueryObserver-B0QSZ6Wg.js";import"./Container-CH2V2ATa.js";import"./index-gksA6r5d.js";import"./Save01-C9eXS7Z1.js";import"./collection-table-wrapper-hM0ppyEG.js";import"./dropdown-menu-bZQdGgsX.js";import"./ArrowDown-B0XF9QfR.js";import"./ArrowUp-CjPyEOxC.js";import"./Grid01-C85povgK.js";import"./List-Dy03iFlP.js";import"./table-C7IfzCau.js";import"./card-BECXECFc.js";import"./types-CnosXlf3.js";import"./Eye-Da9OHWjs.js";import"./Globe02-DED7nhMo.js";import"./LayersTwo01-D0hB1mlt.js";import"./X-BaOBrQh9.js";const We=({size:o=24,color:e="currentColor",...s})=>_.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},_.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}));We.displayName="Circle";const Ne=({size:o=24,color:e="currentColor",...s})=>_.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},_.createElement("path",{d:"m9.75 20.75 1.473.818c.284.158.425.237.576.268.133.027.27.027.402 0 .15-.031.292-.11.576-.268l1.473-.818m-9-2.5-1.427-.793c-.3-.166-.45-.25-.558-.368a1 1 0 0 1-.215-.364C3 16.573 3 16.401 3 16.06V14.5m0-5V7.942c0-.343 0-.514.05-.667a1 1 0 0 1 .215-.364c.109-.119.258-.202.558-.368L5.25 5.75m4.5-2.5 1.473-.818c.284-.158.425-.237.576-.267a1 1 0 0 1 .402 0c.15.03.292.11.576.267l1.473.818m4.5 2.5 1.427.793c.3.166.45.25.558.368a1 1 0 0 1 .215.364c.05.153.05.324.05.667V9.5m0 5v1.559c0 .342 0 .514-.05.666a.999.999 0 0 1-.215.364c-.109.119-.258.202-.558.368l-1.427.793m-9-7.5L12 12m0 0 2.25-1.25M12 12v2.5M3 7l2.25 1.25m13.5 0L21 7m-9 12.5V22"}));Ne.displayName="CubeOutline";const Ye=({size:o=24,color:e="currentColor",...s})=>_.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},_.createElement("path",{d:"m12 5.5-4.638 6.747c-.28.406-.42.609-.41.778a.5.5 0 0 0 .195.373c.135.102.38.102.874.102H12v5l4.638-6.747c.28-.406.42-.609.41-.778a.5.5 0 0 0-.195-.373c-.135-.102-.38-.102-.874-.102H12v-5Z"}),_.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}));Ye.displayName="ZapCircle";function Te(o){return o===null?"all":o?.length??0}function Kt(o,e){const s=o[e];if(!s)return"";const i=[];return s.tools===null?i.push("all tools"):s.tools&&s.tools.length>0&&i.push(`${s.tools.length} tools`),s.resources===null?i.push("all resources"):s.resources&&s.resources.length>0&&i.push(`${s.resources.length} resources`),s.prompts===null?i.push("all prompts"):s.prompts&&s.prompts.length>0&&i.push(`${s.prompts.length} prompts`),i.join(", ")}function Wt(o,e){const s=o[e];return s?!((s.tools===void 0||s.tools!==null&&s.tools.length===0)&&(s.resources===void 0||s.resources!==null&&s.resources.length===0)&&(s.prompts===void 0||s.prompts!==null&&s.prompts.length===0)):!1}const Yt={tools:null,resources:null,prompts:null};function ke(){const o=k.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"flex items-center justify-center h-32",children:t.jsx(Le,{className:"animate-spin text-muted-foreground",size:24})}),o[0]=e):e=o[0],e}function we(o){return({error:e})=>e?.message?.includes("Method not found")||e?.code===-32601?t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:o})}):t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[t.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:t.jsx(Je,{className:"h-6 w-6 text-destructive"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:e?.message?e.message.length>200?`${e.message.slice(0,200)}...`:e.message:"An unexpected error occurred"})]})]})}function qt(o){const e=k.c(23),{item:s,isSelected:i,onToggle:l,disabled:n}=o,d=n?"cursor-not-allowed opacity-50":"cursor-pointer",a=i?"bg-accent/25":"hover:bg-muted/50";let r;e[0]!==d||e[1]!==a?(r=ae("flex items-start gap-3 p-4 rounded-lg transition-colors",d,a),e[0]=d,e[1]=a,e[2]=r):r=e[2];let c;e[3]!==s.name?(c=t.jsx("p",{className:"text-sm font-medium leading-none truncate",children:s.name}),e[3]=s.name,e[4]=c):c=e[4];let x;e[5]!==s.tags?(x=s.tags&&t.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=x):x=e[6];let g;e[7]!==c||e[8]!==x?(g=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,x]}),e[7]=c,e[8]=x,e[9]=g):g=e[9];let p;e[10]!==s.description?(p=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[10]=s.description,e[11]=p):p=e[11];let h;e[12]!==g||e[13]!==p?(h=t.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[g,p]}),e[12]=g,e[13]=p,e[14]=h):h=e[14];let m;e[15]!==n||e[16]!==i||e[17]!==l?(m=t.jsx(ze,{checked:i,onCheckedChange:l,disabled:n,className:"mt-0.5"}),e[15]=n,e[16]=i,e[17]=l,e[18]=m):m=e[18];let u;return e[19]!==r||e[20]!==h||e[21]!==m?(u=t.jsxs("label",{className:r,children:[h,m]}),e[19]=r,e[20]=h,e[21]=m,e[22]=u):u=e[22],u}function Pe(o){const e=k.c(32),{items:s,selections:i,onToggle:l,onToggleAll:n,emptyMessage:d,disabled:a}=o;let r,c,x,g,p;if(e[0]!==a||e[1]!==d||e[2]!==s||e[3]!==l||e[4]!==n||e[5]!==i){p=Symbol.for("react.early_return_sentinel");e:{const u=s.map(Jt);if(s.length===0){let v;e[11]!==d?(v=t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:d})}),e[11]=d,e[12]=v):v=e[12],p=v;break e}x="flex flex-col h-full";const b=a?"cursor-not-allowed opacity-50":"cursor-pointer";let f;e[13]!==b?(f=ae("flex items-start gap-3 p-4",b),e[13]=b,e[14]=f):f=e[14];let j;e[15]!==s.length?(j=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("span",{className:"text-sm font-medium",children:["Select All (",s.length,")"]})}),e[15]=s.length,e[16]=j):j=e[16];const y=i===null;let C;e[17]!==a||e[18]!==n||e[19]!==y?(C=t.jsx(ze,{checked:y,onCheckedChange:n,disabled:a,className:"mt-0.5"}),e[17]=a,e[18]=n,e[19]=y,e[20]=C):C=e[20],e[21]!==C||e[22]!==f||e[23]!==j?(g=t.jsx("div",{className:"px-4 border-b border-border shrink-0",children:t.jsxs("label",{className:f,children:[j,C]})}),e[21]=C,e[22]=f,e[23]=j,e[24]=g):g=e[24],r="flex-1 overflow-auto px-4 py-3 space-y-1",c=s.map(v=>t.jsx(qt,{item:v,isSelected:i===null||i?.includes(v.id),onToggle:()=>l(v.id,u),disabled:a},v.id))}e[0]=a,e[1]=d,e[2]=s,e[3]=l,e[4]=n,e[5]=i,e[6]=r,e[7]=c,e[8]=x,e[9]=g,e[10]=p}else r=e[6],c=e[7],x=e[8],g=e[9],p=e[10];if(p!==Symbol.for("react.early_return_sentinel"))return p;let h;e[25]!==r||e[26]!==c?(h=t.jsx("div",{className:r,children:c}),e[25]=r,e[26]=c,e[27]=h):h=e[27];let m;return e[28]!==x||e[29]!==g||e[30]!==h?(m=t.jsxs("div",{className:x,children:[g,h]}),e[28]=x,e[29]=g,e[30]=h,e[31]=m):m=e[31],m}function Jt(o){return o.id}function Zt(o){const e=k.c(13),{connectionId:s,selections:i,onToggle:l,onToggleAll:n,disabled:d}=o,{org:a}=de();let r;e[0]!==s||e[1]!==a.id?(r={connectionId:s,orgId:a.id},e[0]=s,e[1]=a.id,e[2]=r):r=e[2];const c=je(r);let x;e[3]!==c?(x={client:c},e[3]=c,e[4]=x):x=e[4];const{data:g}=Rt(x);let p;e[5]!==g.tools?(p=g.tools.map(Qt),e[5]=g.tools,e[6]=p):p=e[6];const h=p;let m;return e[7]!==d||e[8]!==h||e[9]!==l||e[10]!==n||e[11]!==i?(m=t.jsx(Pe,{items:h,selections:i,onToggle:l,onToggleAll:n,emptyMessage:"No tools available",disabled:d}),e[7]=d,e[8]=h,e[9]=l,e[10]=n,e[11]=i,e[12]=m):m=e[12],m}function Qt(o){return{id:o.name,name:o.name,description:o.description,tags:t.jsx(It,{annotations:o.annotations,_meta:o._meta})}}function Xt(o){const e=k.c(13),{connectionId:s,selections:i,onToggle:l,onToggleAll:n,disabled:d}=o,{org:a}=de();let r;e[0]!==s||e[1]!==a.id?(r={connectionId:s,orgId:a.id},e[0]=s,e[1]=a.id,e[2]=r):r=e[2];const c=je(r);let x;e[3]!==c?(x={client:c},e[3]=c,e[4]=x):x=e[4];const{data:g}=Pt(x);let p;e[5]!==g.resources?(p=g.resources.map(es),e[5]=g.resources,e[6]=p):p=e[6];const h=p;let m;return e[7]!==d||e[8]!==h||e[9]!==l||e[10]!==n||e[11]!==i?(m=t.jsx(Pe,{items:h,selections:i,onToggle:l,onToggleAll:n,emptyMessage:"No resources available",disabled:d}),e[7]=d,e[8]=h,e[9]=l,e[10]=n,e[11]=i,e[12]=m):m=e[12],m}function es(o){return{id:o.name||o.uri,name:o.name||o.uri,description:o.description}}function ts(o){const e=k.c(13),{connectionId:s,selections:i,onToggle:l,onToggleAll:n,disabled:d}=o,{org:a}=de();let r;e[0]!==s||e[1]!==a.id?(r={connectionId:s,orgId:a.id},e[0]=s,e[1]=a.id,e[2]=r):r=e[2];const c=je(r);let x;e[3]!==c?(x={client:c},e[3]=c,e[4]=x):x=e[4];const{data:g}=Mt(x);let p;e[5]!==g.prompts?(p=g.prompts.map(ss),e[5]=g.prompts,e[6]=p):p=e[6];const h=p;let m;return e[7]!==d||e[8]!==h||e[9]!==l||e[10]!==n||e[11]!==i?(m=t.jsx(Pe,{items:h,selections:i,onToggle:l,onToggleAll:n,emptyMessage:"No prompts available",disabled:d}),e[7]=d,e[8]=h,e[9]=l,e[10]=n,e[11]=i,e[12]=m):m=e[12],m}function ss(o){return{id:o.name,name:o.name,description:o.description}}function ls(o){const e=k.c(24),{connection:s,isSelected:i,hasSelections:l,summary:n,onClick:d,onToggleAll:a,disabled:r}=o,c=r?"cursor-not-allowed opacity-50":"cursor-pointer",x=i?"bg-accent":"hover:bg-muted/50";let g;e[0]!==c||e[1]!==x?(g=ae("flex items-center gap-2 p-2 h-12 rounded-lg transition-colors",c,x),e[0]=c,e[1]=x,e[2]=g):g=e[2];const p=r?void 0:d;let h;e[3]!==s.icon||e[4]!==s.title?(h=t.jsx(ge,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[3]=s.icon,e[4]=s.title,e[5]=h):h=e[5];let m;e[6]!==s.title?(m=t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:s.title}),e[6]=s.title,e[7]=m):m=e[7];let u;e[8]!==l||e[9]!==n?(u=l&&n&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n}),e[8]=l,e[9]=n,e[10]=u):u=e[10];let b;e[11]!==m||e[12]!==u?(b=t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:[m,u]}),e[11]=m,e[12]=u,e[13]=b):b=e[13];let f;e[14]!==r||e[15]!==l||e[16]!==a?(f=t.jsx(ze,{checked:l,onCheckedChange:a,onClick:os,disabled:r,className:"shrink-0"}),e[14]=r,e[15]=l,e[16]=a,e[17]=f):f=e[17];let j;return e[18]!==g||e[19]!==p||e[20]!==h||e[21]!==b||e[22]!==f?(j=t.jsxs("div",{className:g,onClick:p,children:[h,b,f]}),e[18]=g,e[19]=p,e[20]=h,e[21]=b,e[22]=f,e[23]=j):j=e[23],j}function os(o){return o.stopPropagation()}function ns(o){const e=k.c(22),{allConnections:s,searchTerm:i,selectedId:l,hasSelections:n,getSelectionSummary:d,onConnectionClick:a,onToggleAll:r,disabled:c}=o;let x;e[0]!==s||e[1]!==i?(x=i?s.filter(m=>m.title.toLowerCase().includes(i.toLowerCase())||m.description?.toLowerCase().includes(i.toLowerCase())):s,e[0]=s,e[1]=i,e[2]=x):x=e[2];const g=x;if(g.length===0){const m=i?"No connections found":"No connections available";let u;return e[3]!==m?(u=t.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground p-4",children:m}),e[3]=m,e[4]=u):u=e[4],u}let p;if(e[5]!==c||e[6]!==g||e[7]!==d||e[8]!==n||e[9]!==a||e[10]!==r||e[11]!==l){let m;e[13]!==c||e[14]!==d||e[15]!==n||e[16]!==a||e[17]!==r||e[18]!==l?(m=u=>t.jsx(ls,{connection:u,isSelected:l===u.id,hasSelections:n(u.id),summary:d(u.id),onClick:()=>a(u.id),onToggleAll:()=>r(u.id),disabled:c},u.id),e[13]=c,e[14]=d,e[15]=n,e[16]=a,e[17]=r,e[18]=l,e[19]=m):m=e[19],p=g.map(m),e[5]=c,e[6]=g,e[7]=d,e[8]=n,e[9]=a,e[10]=r,e[11]=l,e[12]=p}else p=e[12];let h;return e[20]!==p?(h=t.jsx("div",{className:"flex flex-col gap-0.5",children:p}),e[20]=p,e[21]=h):h=e[21],h}function is(o){const e=k.c(75),{currentConnection:s,activeTab:i,selectedId:l,formData:n,toggleTool:d,toggleResource:a,togglePrompt:r,toggleAllTools:c,toggleAllResources:x,toggleAllPrompts:g,onTabChange:p}=o;let h;e[0]!==s.icon||e[1]!==s.title?(h=t.jsx(ge,{icon:s.icon,name:s.title,size:"md",className:"shrink-0"}),e[0]=s.icon,e[1]=s.title,e[2]=h):h=e[2];let m;e[3]!==s.title?(m=t.jsx("h2",{className:"text-lg font-semibold truncate",children:s.title}),e[3]=s.title,e[4]=m):m=e[4];let u;e[5]!==s.description?(u=s.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:s.description}),e[5]=s.description,e[6]=u):u=e[6];let b;e[7]!==m||e[8]!==u?(b=t.jsxs("div",{className:"flex-1 min-w-0",children:[m,u]}),e[7]=m,e[8]=u,e[9]=b):b=e[9];let f;e[10]!==h||e[11]!==b?(f=t.jsx("div",{className:"p-6 border-b border-border shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[h,b]})}),e[10]=h,e[11]=b,e[12]=f):f=e[12];let j;e[13]!==p?(j=M=>p(M),e[13]=p,e[14]=j):j=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsxs(Ce,{value:"tools",variant:"underline",className:"gap-2",children:[t.jsx(Oe,{size:16}),"Tools"]}),e[15]=y):y=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs(Ce,{value:"resources",variant:"underline",className:"gap-2",children:[t.jsx(Ne,{size:16}),"Resources"]}),e[16]=C):C=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsxs(Dt,{variant:"underline",className:"shrink-0 px-6",children:[y,C,t.jsxs(Ce,{value:"prompts",variant:"underline",className:"gap-2",children:[t.jsx(De,{size:16}),"Prompts"]})]}),e[17]=v):v=e[17];let V;e[18]===Symbol.for("react.memo_cache_sentinel")?(V=we("Tools not supported by this server"),e[18]=V):V=e[18];let R;e[19]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx(ke,{}),e[19]=R):R=e[19];let T;e[20]!==n||e[21]!==l?(T=n[l]?n[l].tools:[],e[20]=n,e[21]=l,e[22]=T):T=e[22];let O;e[23]!==l||e[24]!==d?(O=(M,q)=>d(l,M,q),e[23]=l,e[24]=d,e[25]=O):O=e[25];let S;e[26]!==l||e[27]!==c?(S=()=>c(l),e[26]=l,e[27]=c,e[28]=S):S=e[28];let w;e[29]!==l||e[30]!==T||e[31]!==O||e[32]!==S?(w=t.jsx(_e,{value:"tools",className:"flex-1 overflow-hidden mt-0",children:t.jsx(fe,{fallback:V,children:t.jsx(_.Suspense,{fallback:R,children:t.jsx(Zt,{connectionId:l,selections:T,onToggle:O,onToggleAll:S})})})}),e[29]=l,e[30]=T,e[31]=O,e[32]=S,e[33]=w):w=e[33];let z;e[34]===Symbol.for("react.memo_cache_sentinel")?(z=we("Resources not supported by this server"),e[34]=z):z=e[34];let $;e[35]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(ke,{}),e[35]=$):$=e[35];let I;e[36]!==n||e[37]!==l?(I=n[l]?n[l].resources:[],e[36]=n,e[37]=l,e[38]=I):I=e[38];let D;e[39]!==l||e[40]!==a?(D=(M,q)=>a(l,M,q),e[39]=l,e[40]=a,e[41]=D):D=e[41];let A;e[42]!==l||e[43]!==x?(A=()=>x(l),e[42]=l,e[43]=x,e[44]=A):A=e[44];let E;e[45]!==l||e[46]!==I||e[47]!==D||e[48]!==A?(E=t.jsx(_e,{value:"resources",className:"flex-1 overflow-hidden mt-0",children:t.jsx(fe,{fallback:z,children:t.jsx(_.Suspense,{fallback:$,children:t.jsx(Xt,{connectionId:l,selections:I,onToggle:D,onToggleAll:A})})})}),e[45]=l,e[46]=I,e[47]=D,e[48]=A,e[49]=E):E=e[49];let B;e[50]===Symbol.for("react.memo_cache_sentinel")?(B=we("Prompts not supported by this server"),e[50]=B):B=e[50];let P;e[51]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(ke,{}),e[51]=P):P=e[51];let K;e[52]!==n||e[53]!==l?(K=n[l]?n[l].prompts:[],e[52]=n,e[53]=l,e[54]=K):K=e[54];let H;e[55]!==l||e[56]!==r?(H=(M,q)=>r(l,M,q),e[55]=l,e[56]=r,e[57]=H):H=e[57];let W;e[58]!==l||e[59]!==g?(W=()=>g(l),e[58]=l,e[59]=g,e[60]=W):W=e[60];let U;e[61]!==l||e[62]!==K||e[63]!==H||e[64]!==W?(U=t.jsx(_e,{value:"prompts",className:"flex-1 overflow-hidden mt-0",children:t.jsx(fe,{fallback:B,children:t.jsx(_.Suspense,{fallback:P,children:t.jsx(ts,{connectionId:l,selections:K,onToggle:H,onToggleAll:W})})})}),e[61]=l,e[62]=K,e[63]=H,e[64]=W,e[65]=U):U=e[65];let Y;e[66]!==i||e[67]!==w||e[68]!==E||e[69]!==U||e[70]!==j?(Y=t.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:t.jsxs(Lt,{value:i,onValueChange:j,variant:"underline",className:"flex-1 flex flex-col overflow-hidden",children:[v,w,E,U]})}),e[66]=i,e[67]=w,e[68]=E,e[69]=U,e[70]=j,e[71]=Y):Y=e[71];let Z;return e[72]!==Y||e[73]!==f?(Z=t.jsxs(t.Fragment,{children:[f,Y]}),e[72]=Y,e[73]=f,e[74]=Z):Z=e[74],Z}function rs(o){const e={};for(const s of o)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function Ee(o){return Object.entries(o).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function as(o,e){switch(e.type){case"SET_SEARCH_TERM":return{...o,searchTerm:e.payload};case"SET_SELECTED":return{...o,selectedId:e.payload};case"SET_ACTIVE_TAB":return{...o,activeTab:e.payload};case"RESET":return{searchTerm:"",selectedId:e.payload.selectedId??e.payload.firstConnectionId??null,activeTab:"tools"};case"SELECT_CONNECTION":return{...o,selectedId:e.payload,activeTab:"tools"};default:return o}}const cs=(o,e)=>o.find(s=>s.id===e)??o[0];function ds(o){const e=k.c(77),{open:s,onOpenChange:i,selectedId:l,form:n,connections:d}=o;let a;e[0]!==l?(a={activeTab:"tools",searchTerm:"",selectedId:l},e[0]=l,e[1]=a):a=e[1];const[r,c]=_.useReducer(as,a),x=_.useDeferredValue(r.searchTerm);let g;e[2]!==x?(g={searchTerm:x},e[2]=x,e[3]=g):g=e[3];const p=xt(g);let h;e[4]!==d?(h=d??[],e[4]=d,e[5]=h):h=e[5];let m;e[6]!==h?(m=rs(h),e[6]=h,e[7]=m):m=e[7];const u=m;let b;e[8]!==p||e[9]!==r.selectedId?(b=cs(p,r.selectedId),e[8]=p,e[9]=r.selectedId,e[10]=b):b=e[10];const f=b,j=f?.id??null;let y;e[11]!==u?(y=N=>Wt(u,N),e[11]=u,e[12]=y):y=e[12];const C=y;let v;e[13]!==u?(v=N=>Kt(u,N),e[13]=u,e[14]=v):v=e[14];const V=v;let R;e[15]!==n||e[16]!==u?(R=(N,L,F,Q)=>{const ie=u[N]?.[L];let G;ie===null?G=Q.filter(ye=>ye!==F):ie?.includes(F)?G=ie.filter(ye=>ye!==F):(G=[...ie??[],F],G.length===Q.length&&(G=null));const re={...u};re[N]?re[N]={...re[N]}:re[N]={tools:null,resources:null,prompts:null},re[N][L]=G,n.setValue("connections",Ee(re),{shouldDirty:!0,shouldTouch:!0})},e[15]=n,e[16]=u,e[17]=R):R=e[17];const T=R;let O;e[18]!==n||e[19]!==u?(O=(N,L)=>{const ie=u[N]?.[L]===null?[]:null,G={...u};G[N]?G[N]={...G[N]}:G[N]={tools:null,resources:null,prompts:null},G[N][L]=ie,n.setValue("connections",Ee(G),{shouldDirty:!0,shouldTouch:!0})},e[18]=n,e[19]=u,e[20]=O):O=e[20];const S=O;let w;e[21]!==T?(w=(N,L,F)=>T(N,"tools",L,F),e[21]=T,e[22]=w):w=e[22];const z=w;let $;e[23]!==T?($=(N,L,F)=>T(N,"resources",L,F),e[23]=T,e[24]=$):$=e[24];const I=$;let D;e[25]!==T?(D=(N,L,F)=>T(N,"prompts",L,F),e[25]=T,e[26]=D):D=e[26];const A=D;let E;e[27]!==S?(E=N=>S(N,"tools"),e[27]=S,e[28]=E):E=e[28];const B=E;let P;e[29]!==S?(P=N=>S(N,"resources"),e[29]=S,e[30]=P):P=e[30];const K=P;let H;e[31]!==S?(H=N=>S(N,"prompts"),e[31]=S,e[32]=H):H=e[32];const W=H;let U;e[33]!==n||e[34]!==u?(U=N=>{const L=u[N],F=L&&L.tools===null&&L.resources===null&&L.prompts===null,Q={...u};F?delete Q[N]:Q[N]=Yt,n.setValue("connections",Ee(Q),{shouldDirty:!0,shouldTouch:!0})},e[33]=n,e[34]=u,e[35]=U):U=e[35];const Y=U;let Z;e[36]!==p||e[37]!==i||e[38]!==l?(Z=N=>{N&&c({type:"RESET",payload:{selectedId:l,firstConnectionId:p[0]?.id??null}}),i(N)},e[36]=p,e[37]=i,e[38]=l,e[39]=Z):Z=e[39];const M=Z;let q;e[40]===Symbol.for("react.memo_cache_sentinel")?(q=N=>{c({type:"SELECT_CONNECTION",payload:N})},e[40]=q):q=e[40];const qe=q;let me;e[41]===Symbol.for("react.memo_cache_sentinel")?(me=N=>c({type:"SET_SEARCH_TERM",payload:N}),e[41]=me):me=e[41];let X;e[42]!==r.searchTerm?(X=t.jsx(it,{value:r.searchTerm,onChange:me,placeholder:"Search connections..."}),e[42]=r.searchTerm,e[43]=X):X=e[43];let ee;e[44]!==p||e[45]!==r.searchTerm||e[46]!==j||e[47]!==V||e[48]!==C||e[49]!==Y?(ee=t.jsx("div",{className:"flex-1 overflow-auto p-2",children:t.jsx(ns,{allConnections:p,searchTerm:r.searchTerm,selectedId:j,hasSelections:C,getSelectionSummary:V,onConnectionClick:qe,onToggleAll:Y})}),e[44]=p,e[45]=r.searchTerm,e[46]=j,e[47]=V,e[48]=C,e[49]=Y,e[50]=ee):ee=e[50];let te;e[51]!==X||e[52]!==ee?(te=t.jsxs("div",{className:"w-full sm:w-72 sm:border-r border-b sm:border-b-0 border-border flex flex-col bg-background sm:h-full max-h-[40vh] sm:max-h-full",children:[X,ee]}),e[51]=X,e[52]=ee,e[53]=te):te=e[53];let se;e[54]!==f||e[55]!==r.activeTab||e[56]!==j||e[57]!==u||e[58]!==W||e[59]!==K||e[60]!==B||e[61]!==A||e[62]!==I||e[63]!==z?(se=t.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:f&&j?t.jsx(is,{currentConnection:f,activeTab:r.activeTab,selectedId:j,formData:u,toggleTool:z,toggleResource:I,togglePrompt:A,toggleAllTools:B,toggleAllResources:K,toggleAllPrompts:W,onTabChange:N=>c({type:"SET_ACTIVE_TAB",payload:N})},j):t.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Select a connection to view its tools, resources, and prompts"})}),e[54]=f,e[55]=r.activeTab,e[56]=j,e[57]=u,e[58]=W,e[59]=K,e[60]=B,e[61]=A,e[62]=I,e[63]=z,e[64]=se):se=e[64];let le;e[65]!==te||e[66]!==se?(le=t.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 flex-col sm:flex-row",children:[te,se]}),e[65]=te,e[66]=se,e[67]=le):le=e[67];let oe;e[68]!==M?(oe=t.jsx(At,{className:"px-6 py-4 border-t border-border shrink-0",children:t.jsx(J,{variant:"outline",onClick:()=>M(!1),children:"Done"})}),e[68]=M,e[69]=oe):oe=e[69];let ne;e[70]!==le||e[71]!==oe?(ne=t.jsxs(He,{className:"sm:max-w-5xl h-[80vh] max-h-[80vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[le,oe]}),e[70]=le,e[71]=oe,e[72]=ne):ne=e[72];let ue;return e[73]!==M||e[74]!==s||e[75]!==ne?(ue=t.jsx(Ue,{open:s,onOpenChange:M,children:ne}),e[73]=M,e[74]=s,e[75]=ne,e[76]=ue):ue=e[76],ue}const ms=Ze.pick({title:!0,description:!0,status:!0,metadata:!0,connections:!0}).extend({title:Qe().min(1,"Name is required").max(255)});function us(o){const e=k.c(8);let s,i;e[0]!==o?({className:s,...i}=o,e[0]=o,e[1]=s,e[2]=i):(s=e[1],i=e[2]);let l;e[3]!==s?(l=ae("grid gap-3",s),e[3]=s,e[4]=l):l=e[4];let n;return e[5]!==i||e[6]!==l?(n=t.jsx(Bt,{"data-slot":"radio-group",className:l,...i}),e[5]=i,e[6]=l,e[7]=n):n=e[7],n}function Ie(o){const e=k.c(9);let s,i;e[0]!==o?({className:s,...i}=o,e[0]=o,e[1]=s,e[2]=i):(s=e[1],i=e[2]);let l;e[3]!==s?(l=ae("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",s),e[3]=s,e[4]=l):l=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(Ft,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:t.jsx(We,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})}),e[5]=n):n=e[5];let d;return e[6]!==i||e[7]!==l?(d=t.jsx(Vt,{"data-slot":"radio-group-item",className:l,...i,children:n}),e[6]=i,e[7]=l,e[8]=d):d=e[8],d}function fs(o){const s=new TextEncoder().encode(o),i=Array.from(s,l=>String.fromCharCode(l)).join("");return btoa(i)}function ps(o){const e=k.c(10),{url:s}=o,[i,l]=_.useState(!1);let n;e[0]!==s?(n=async()=>{await navigator.clipboard.writeText(s),l(!0),ce.success("Agent URL copied to clipboard"),setTimeout(()=>l(!1),2e3)},e[0]=s,e[1]=n):n=e[1];const d=n;let a;e[2]!==i?(a=i?t.jsx(be,{size:20,className:"text-green-600"}):t.jsx(Re,{size:20}),e[2]=i,e[3]=a):a=e[3];const r=i?"Copied!":"Copy URL";let c;e[4]!==r?(c=t.jsx("span",{className:"text-xs font-medium",children:r}),e[4]=r,e[5]=c):c=e[5];let x;return e[6]!==d||e[7]!==a||e[8]!==c?(x=t.jsxs(J,{type:"button",variant:"outline",onClick:d,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[a,c]}),e[6]=d,e[7]=a,e[8]=c,e[9]=x):x=e[9],x}function xs(o){const e=k.c(7),{url:s,serverName:i}=o;let l;e[0]!==i||e[1]!==s?(l=()=>{const c=Ke(i),g=fs(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),p=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(c)}&config=${encodeURIComponent(g)}`;window.open(p,"_blank"),ce.success("Opening Cursor...")},e[0]=i,e[1]=s,e[2]=l):l=e[2];const n=l;let d,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),a=t.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[3]=d,e[4]=a):(d=e[3],a=e[4]);let r;return e[5]!==n?(r=t.jsxs(J,{type:"button",variant:"outline",onClick:n,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[d,a]}),e[5]=n,e[6]=r):r=e[6],r}function hs(o){const e=k.c(11),{url:s,serverName:i}=o,[l,n]=_.useState(!1);let d;e[0]!==i||e[1]!==s?(d=async()=>{const p=Ke(i),m=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}},null,2),u=`claude mcp add-json "${p}" '${m.replace(/'/g,"'\\''")}'`;await navigator.clipboard.writeText(u),n(!0),ce.success("Claude Code command copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=i,e[1]=s,e[2]=d):d=e[2];const a=d;let r;e[3]!==l?(r=l?t.jsx(be,{size:20,className:"text-green-600"}):t.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[3]=l,e[4]=r):r=e[4];const c=l?"Copied!":"Install on Claude";let x;e[5]!==c?(x=t.jsx("span",{className:"text-xs font-medium",children:c}),e[5]=c,e[6]=x):x=e[6];let g;return e[7]!==a||e[8]!==r||e[9]!==x?(g=t.jsxs(J,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[r,x]}),e[7]=a,e[8]=r,e[9]=x,e[10]=g):g=e[10],g}function gs({virtualMcp:o}){const{org:e}=de(),s=je({connectionId:zt,orgId:e.id}),[i,l]=_.useState(null),[n,d]=_.useState(!1),[a,r]=_.useState(!1),c=o.id,x=o.title||`agent-${c.slice(0,8)}`,g=i?`bunx @decocms/typegen@latest --mcp ${c} --key ${i} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${c} --key <api-key> --output client.ts`,p=async()=>{d(!0);try{const u=(await s.callTool({name:"API_KEY_CREATE",arguments:{name:`typegen-${x}`,permissions:{[c]:["*"]}}})).structuredContent?.key;if(!u)throw new Error("No key in response");l(u)}catch{ce.error("Failed to generate API key")}finally{d(!1)}},h=async()=>{await navigator.clipboard.writeText(g),r(!0),ce.success("Command copied to clipboard"),setTimeout(()=>r(!1),2e3)};return t.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Generate typed client"}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Introspects this agent and writes a typed"," ",t.jsx("code",{className:"font-mono",children:"client.ts"})," you can import directly."]})]}),!i&&t.jsxs(J,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:p,disabled:n,children:[n?t.jsx(Le,{size:14,className:"animate-spin"}):t.jsx(Ht,{size:14}),t.jsx("span",{children:n?"Generating…":"Generate API key"})]})]}),i&&t.jsx("p",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700",children:"Store this key securely — it won't be shown again."}),t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Generate client"}),t.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:g}),t.jsx(J,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:h,children:a?t.jsx(be,{size:12,className:"text-green-600"}):t.jsx(Re,{size:12})})]})}),t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Runtime variables"}),t.jsx(js,{apiKey:i})]})}function js(o){const e=k.c(19),{apiKey:s}=o,[i,l]=_.useState(!1),n=window.location.origin,d=s?`MESH_API_KEY=${s}`:"MESH_API_KEY=<api-key>",a=`MESH_BASE_URL=${n}`,r=`${d}
|
|
2
|
-
${a}`;let c;e[0]!==r?(c=async()=>{await navigator.clipboard.writeText(r),l(!0),setTimeout(()=>l(!1),2e3)},e[0]=r,e[1]=c):c=e[1];const x=c,g=!s;let p;e[2]!==g?(p=ae({"opacity-50":g}),e[2]=g,e[3]=p):p=e[3];let h;e[4]!==d||e[5]!==p?(h=t.jsx("span",{className:p,children:d}),e[4]=d,e[5]=p,e[6]=h):h=e[6];let m,u;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("br",{}),u=t.jsx("span",{children:a}),e[7]=m,e[8]=u):(m=e[7],u=e[8]);let b;e[9]!==h?(b=t.jsxs("code",{className:"min-w-0 flex-1 font-mono text-xs text-muted-foreground",children:[h,m,u]}),e[9]=h,e[10]=b):b=e[10];let f;e[11]!==i?(f=i?t.jsx(be,{size:12,className:"text-green-600"}):t.jsx(Re,{size:12}),e[11]=i,e[12]=f):f=e[12];let j;e[13]!==x||e[14]!==f?(j=t.jsx(J,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:x,children:f}),e[13]=x,e[14]=f,e[15]=j):j=e[15];let y;return e[16]!==b||e[17]!==j?(y=t.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:t.jsxs("div",{className:"flex items-start gap-2",children:[b,j]})}),e[16]=b,e[17]=j,e[18]=y):y=e[18],y}function bs(o){const e=k.c(3),{virtualMcp:s}=o;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"h-20 animate-pulse rounded-md bg-muted"}),e[0]=i):i=e[0];let l;return e[1]!==s?(l=t.jsx(_.Suspense,{fallback:i,children:t.jsx(gs,{virtualMcp:s})}),e[1]=s,e[2]=l):l=e[2],l}function Ns(o){const e=k.c(44),{open:s,onOpenChange:i,virtualMcp:l}=o,[n,d]=_.useState("code_execution");let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=P=>{(P==="passthrough"||P==="smart_tool_selection"||P==="code_execution")&&d(P)},e[0]=a):a=e[0];const r=a;let c;e[1]!==n||e[2]!==l.id?(c=new URL(`/mcp/virtual-mcp/${l.id}`,window.location.origin),c.searchParams.set("mode",n),e[1]=n,e[2]=l.id,e[3]=c):c=e[3];let x;e[4]!==l.id||e[5]!==l.title?(x=l.title||`agent-${l.id?.slice(0,8)??"default"}`,e[4]=l.id,e[5]=l.title,e[6]=x):x=e[6];const g=x;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Ot,{children:t.jsx($t,{children:"Connect"})}),e[7]=p):p=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("div",{children:t.jsx("h4",{className:"text-sm font-medium text-foreground mt-1",children:"How should this agent work?"})}),e[8]=h):h=e[8];let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(ct,{className:"size-5 text-muted-foreground"})}),e[9]=m):m=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Direct access"}),e[10]=u):u=e[10];let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(pe,{asChild:!0,children:t.jsx(Se,{className:"size-3.5 text-muted-foreground"})}),e[11]=b):b=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsxs("label",{htmlFor:"mode-passthrough",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[m,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[u,t.jsx(ve,{children:t.jsxs(xe,{children:[b,t.jsx(he,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"All tools are exposed directly via tools/list. Best for small tool surfaces with deterministic behavior."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Best for small teams or when you need predictable behavior"})]}),t.jsx(Ie,{id:"mode-passthrough",value:"passthrough"})]}),e[12]=f):f=e[12];let j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(dt,{className:"size-5 text-muted-foreground"})}),e[13]=j):j=e[13];let y;e[14]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart discovery"}),e[14]=y):y=e[14];let C;e[15]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(pe,{asChild:!0,children:t.jsx(Se,{className:"size-3.5 text-muted-foreground"})}),e[15]=C):C=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsxs("label",{htmlFor:"mode-smart",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[j,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[y,t.jsx(ve,{children:t.jsxs(xe,{children:[C,t.jsx(he,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Uses meta-tools (GATEWAY_SEARCH_TOOLS, GATEWAY_DESCRIBE_TOOLS, GATEWAY_CALL_TOOL) to keep the tool list small and request details on demand."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Ideal for large teams with many tools - AI finds what it needs"})]}),t.jsx(Ie,{id:"mode-smart",value:"smart_tool_selection"})]}),e[16]=v):v=e[16];let V;e[17]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Gt,{className:"size-5 text-muted-foreground"})}),e[17]=V):V=e[17];let R;e[18]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart execution"}),e[18]=R):R=e[18];let T;e[19]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(pe,{asChild:!0,children:t.jsx(Se,{className:"size-3.5 text-muted-foreground"})}),e[19]=T):T=e[19];let O;e[20]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsxs("label",{htmlFor:"mode-code",className:"relative flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[V,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[R,t.jsx(ve,{children:t.jsxs(xe,{children:[T,t.jsx(he,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Exposes meta-tools for discovery + sandboxed execution (GATEWAY_RUN_CODE). Reduces overhead on large surfaces by shifting work into a controlled runtime."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Maximum flexibility - AI can write code to orchestrate tools"})]}),t.jsx(Ie,{id:"mode-code",value:"code_execution"}),t.jsx($e,{variant:"outline",className:"absolute -top-2.5 left-1/2 -translate-x-1/2 bg-background z-10",children:"Recommended"})]}),e[20]=O):O=e[20];let S;e[21]!==n?(S=t.jsxs("div",{className:"flex flex-col gap-3",children:[h,t.jsxs(us,{value:n,onValueChange:r,className:"flex flex-col gap-4.5",children:[f,v,O]})]}),e[21]=n,e[22]=S):S=e[22];let w;e[23]!==c.href?(w=t.jsx(ps,{url:c.href}),e[23]=c.href,e[24]=w):w=e[24];let z,$;e[25]!==g||e[26]!==c.href?(z=t.jsx(xs,{url:c.href,serverName:g}),$=t.jsx(hs,{url:c.href,serverName:g}),e[25]=g,e[26]=c.href,e[27]=z,e[28]=$):(z=e[27],$=e[28]);let I;e[29]!==w||e[30]!==z||e[31]!==$?(I=t.jsx("div",{className:"flex flex-col gap-3 pt-2",children:t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[w,z,$]})}),e[29]=w,e[30]=z,e[31]=$,e[32]=I):I=e[32];let D;e[33]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx("div",{className:"border-t border-border"}),e[33]=D):D=e[33];let A;e[34]!==l?(A=t.jsx(bs,{virtualMcp:l}),e[34]=l,e[35]=A):A=e[35];let E;e[36]!==S||e[37]!==I||e[38]!==A?(E=t.jsxs(He,{className:"max-h-[80vh] overflow-y-auto sm:max-w-2xl",children:[p,t.jsxs("div",{className:"flex flex-col gap-6",children:[S,I,D,A]})]}),e[36]=S,e[37]=I,e[38]=A,e[39]=E):E=e[39];let B;return e[40]!==i||e[41]!==s||e[42]!==E?(B=t.jsx(Ue,{open:s,onOpenChange:i,children:E}),e[40]=i,e[41]=s,e[42]=E,e[43]=B):B=e[43],B}function ys(o,e){switch(e.type){case"SET_SHARE_DIALOG_OPEN":return{...o,shareDialogOpen:e.payload};case"SET_CONNECTION_DIALOG_OPEN":return{...o,connectionDialogOpen:e.payload};case"SET_EDITING_CONNECTION_ID":return{...o,editingConnectionId:e.payload};case"SET_SKILLS_OPEN":return{...o,skillsOpen:e.payload};default:return o}}function Ae(o){const e=k.c(27),{connection_id:s,selected_tools:i,selected_resources:l,selected_prompts:n,onClick:d}=o,a=ht(s);if(!a)return null;let r;e[0]!==i?(r=Te(i),e[0]=i,e[1]=r):r=e[1];const c=r;let x;e[2]!==l?(x=Te(l),e[2]=l,e[3]=x):x=e[3];const g=x;let p;e[4]!==n?(p=Te(n),e[4]=n,e[5]=p):p=e[5];const h=p;let m;e[6]!==a.icon||e[7]!==a.title?(m=t.jsx(ge,{icon:a.icon,name:a.title,size:"xs"}),e[6]=a.icon,e[7]=a.title,e[8]=m):m=e[8];let u;e[9]!==a.title?(u=t.jsx("p",{className:"flex-1 text-sm font-normal text-foreground truncate",children:a.title}),e[9]=a.title,e[10]=u):u=e[10];let b;e[11]!==c?(b=c!==0&&t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:c==="all"?"all":c}),t.jsx(Oe,{size:12})]}),e[11]=c,e[12]=b):b=e[12];let f;e[13]!==g?(f=g!==0&&t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:g==="all"?"all":g}),t.jsx(Ne,{size:12})]}),e[13]=g,e[14]=f):f=e[14];let j;e[15]!==h?(j=h!==0&&t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:h==="all"?"all":h}),t.jsx(De,{size:12})]}),e[15]=h,e[16]=j):j=e[16];let y;e[17]!==b||e[18]!==f||e[19]!==j?(y=t.jsxs($e,{variant:"secondary",className:"bg-muted h-5 gap-2 px-1.5 py-1 flex items-center",children:[b,f,j]}),e[17]=b,e[18]=f,e[19]=j,e[20]=y):y=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Ge,{size:16,className:"text-muted-foreground shrink-0"}),e[21]=C):C=e[21];let v;return e[22]!==d||e[23]!==m||e[24]!==u||e[25]!==y?(v=t.jsxs("div",{onClick:d,className:"w-full h-12 flex items-center gap-2 px-3 rounded-lg border border-border hover:bg-accent/50 transition-colors cursor-pointer",children:[m,u,y,C]}),e[22]=d,e[23]=m,e[24]=u,e[25]=y,e[26]=v):v=e[26],v}Ae.Fallback=function(){return t.jsxs("div",{className:"w-full h-12 flex items-center gap-2 px-3 rounded-lg border border-border",children:[t.jsx("div",{className:"size-5 rounded bg-muted animate-pulse shrink-0"}),t.jsx("div",{className:"flex-1 h-4 rounded bg-muted animate-pulse"}),t.jsxs($e,{variant:"secondary",className:"bg-muted h-5 gap-2 px-1.5 py-1 flex items-center",children:[t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-3 rounded bg-muted-foreground/20 animate-pulse"}),t.jsx(Oe,{size:12})]}),t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-3 rounded bg-muted-foreground/20 animate-pulse"}),t.jsx(Ne,{size:12})]}),t.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",children:[t.jsx("div",{className:"w-3 h-3 rounded bg-muted-foreground/20 animate-pulse"}),t.jsx(De,{size:12})]})]}),t.jsx(Ge,{size:16,className:"text-muted-foreground shrink-0"})]})};function vs({virtualMcp:o}){const{org:e}=de(),s=jt(),i=tt({resolver:st(ms),defaultValues:o}),l=i.watch("connections"),[n,d]=_.useReducer(ys,{shareDialogOpen:!1,connectionDialogOpen:!1,editingConnectionId:null,skillsOpen:!1}),[,a]=at(),{setVirtualMcpId:r}=nt();_.useEffect(()=>{a(!0),r(o.id)},[o.id]);const c=()=>{r(o.id),a(!0)},x=i.formState.isDirty,g=async()=>{const f=i.getValues(),j=await s.update.mutateAsync({id:o.id,data:f});i.reset(j)},p=()=>{i.reset(o)},h=()=>{d({type:"SET_EDITING_CONNECTION_ID",payload:null}),d({type:"SET_CONNECTION_DIALOG_OPEN",payload:!0})},m=f=>{d({type:"SET_EDITING_CONNECTION_ID",payload:f}),d({type:"SET_CONNECTION_DIALOG_OPEN",payload:!0})},u=s.update.isPending,b=t.jsx(vt,{children:t.jsxs(Ct,{children:[t.jsx(Be,{children:t.jsx(_t,{asChild:!0,children:t.jsx(lt,{to:"/$org/$project/agents",params:{org:e.slug,project:Fe},children:"Agents"})})}),t.jsx(St,{}),t.jsx(Be,{children:t.jsx(Tt,{children:o.title})})]})});return t.jsxs(kt,{breadcrumb:b,children:[t.jsxs(wt,{children:[t.jsx(Et,{onSave:g,onUndo:p,isDirty:x,isSaving:u}),t.jsxs(xe,{delayDuration:0,children:[t.jsx(pe,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsxs(J,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 border border-input",onClick:c,"aria-label":"Test Agent",children:[t.jsx(Nt,{size:14}),"Test Agent"]})})}),t.jsx(he,{side:"bottom",children:"Test this agent in chat"})]}),t.jsxs(J,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 border border-input",onClick:()=>d({type:"SET_SHARE_DIALOG_OPEN",payload:!0}),children:[t.jsx(Ye,{size:14}),"Connect"]})]}),t.jsx("div",{className:"flex h-full w-full bg-background overflow-auto",children:t.jsxs("div",{className:"flex flex-col w-full",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4 p-6 shrink-0",children:[t.jsxs("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:[t.jsx(ge,{icon:o.icon,name:i.watch("title")||"Agent",size:"lg",className:"shrink-0 shadow-sm",fallbackIcon:t.jsx(yt,{})}),t.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[t.jsx(Me,{...i.register("title"),className:"h-auto py-0.5 text-lg! font-medium leading-7 px-1 -mx-1 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Agent Name"}),t.jsx(Me,{...i.register("description"),className:"h-auto py-0.5 text-base text-muted-foreground leading-6 px-1 -mx-1 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})]})]}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsx(ft,{checked:i.watch("status")==="active",onCheckedChange:f=>i.setValue("status",f?"active":"inactive",{shouldDirty:!0})})})]}),t.jsxs(mt,{open:n.skillsOpen,onOpenChange:f=>d({type:"SET_SKILLS_OPEN",payload:f}),className:"border-t border-border shrink-0 max-h-[400px] overflow-hidden flex flex-col",children:[l.length===0?t.jsxs("button",{type:"button",onClick:h,className:"w-full flex items-center justify-between px-6 py-4 hover:bg-muted/50 transition-colors cursor-pointer",children:[t.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Skills"}),t.jsxs("div",{className:"h-7 px-2 inline-flex items-center justify-center gap-1 rounded-md text-sm text-muted-foreground",children:[t.jsx(Ve,{size:14}),"Add"]})]}):t.jsx(ut,{asChild:!0,children:t.jsxs("button",{type:"button",className:"w-full flex items-center justify-between px-6 py-4 hover:bg-muted/50 transition-colors cursor-pointer",children:[t.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Skills"}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"ease-(--ease-out-expo)",style:{width:n.skillsOpen?0:"auto",marginRight:n.skillsOpen?0:4,opacity:n.skillsOpen?0:1,pointerEvents:n.skillsOpen?"none":"auto",transitionProperty:"all",transitionDuration:n.skillsOpen?"0ms":"200ms"},children:t.jsx(Ut,{connectionIds:l.map(f=>f.connection_id),maxVisibleIcons:2})}),t.jsxs("div",{role:"button",tabIndex:0,className:"h-7 inline-flex items-center justify-center rounded-md text-sm text-muted-foreground overflow-hidden transition-all duration-200 ease-(--ease-out-expo) hover:bg-accent hover:text-accent-foreground",style:{width:n.skillsOpen?"auto":28,paddingLeft:n.skillsOpen?8:0,paddingRight:n.skillsOpen?8:0,gap:n.skillsOpen?4:0},onPointerDown:f=>{f.stopPropagation()},onClick:f=>{f.stopPropagation(),f.preventDefault(),h()},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.stopPropagation(),f.preventDefault(),h())},children:[t.jsx(Ve,{size:14,className:"shrink-0"}),t.jsx("span",{className:"overflow-hidden whitespace-nowrap transition-all duration-200 ease-(--ease-out-expo)",style:{width:n.skillsOpen?"auto":0,opacity:n.skillsOpen?1:0},children:"Add"})]}),t.jsx("div",{className:"h-7 inline-flex items-center justify-center overflow-hidden transition-all duration-200 ease-(--ease-out-expo)",style:{width:n.skillsOpen?28:0,opacity:n.skillsOpen?1:0},children:t.jsx(bt,{size:16,className:"shrink-0"})})]})]})}),t.jsx("div",{className:"grid overflow-hidden transition-[grid-template-rows] duration-200 ease-(--ease-out-expo)",style:{gridTemplateRows:n.skillsOpen?"1fr":"0fr"},children:t.jsx("div",{className:"min-h-0 overflow-hidden",children:t.jsx("div",{className:"overflow-y-auto max-h-[300px] mask-[linear-gradient(to_bottom,black_calc(100%-40px),transparent_100%)]",children:t.jsx("div",{className:"flex flex-col gap-2 px-6 pb-4 pt-2",children:l.map(f=>t.jsx(_.Suspense,{fallback:t.jsx(Ae.Fallback,{}),children:t.jsx(Ae,{connection_id:f.connection_id,selected_tools:f.selected_tools,selected_resources:f.selected_resources,selected_prompts:f.selected_prompts,onClick:()=>m(f.connection_id)})},f.connection_id))})})})})]}),t.jsxs("div",{className:"flex flex-col flex-1 p-6 border-t border-border overflow-auto",children:[t.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Instructions"}),t.jsx(ot,{name:"metadata.instructions",control:i.control,render:({field:f})=>t.jsx(pt,{...f,value:f.value??"",placeholder:"Write instructions here...",className:"min-h-[200px] resize-none text-sm placeholder:text-muted-foreground/50 leading-relaxed border-0 rounded-none shadow-none px-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus:border-0 bg-transparent"})})]})]})}),t.jsx(ds,{open:n.connectionDialogOpen,onOpenChange:f=>d({type:"SET_CONNECTION_DIALOG_OPEN",payload:f}),selectedId:n.editingConnectionId,form:i,connections:l}),t.jsx(Ns,{open:n.shareDialogOpen,onOpenChange:f=>d({type:"SET_SHARE_DIALOG_OPEN",payload:f}),virtualMcp:o})]})}function Cs(){const o=k.c(6),e=Xe();let s;o[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/$project/agents/$agentId"},o[0]=s):s=o[0];const i=et(s),{org:l,agentId:n}=i,d=gt(n);if(!d){let r;return o[1]!==e||o[2]!==l?(r=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(rt,{title:"Agent not found",description:"This Agent may have been deleted or you may not have access.",actions:t.jsx(J,{variant:"outline",onClick:()=>e({to:"/$org/$project/agents",params:{org:l,project:Fe}}),children:"Back to agents"})})}),o[1]=e,o[2]=l,o[3]=r):r=o[3],r}let a;return o[4]!==d?(a=t.jsx(vs,{virtualMcp:d}),o[4]=d,o[5]=a):a=o[5],a}function Gl(){const o=k.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(fe,{children:t.jsx(_.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Le,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Cs,{})})}),o[0]=e):e=o[0],e}export{Gl as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as ie,j as t,E as ne,r as X,u as ae,b as le,B as q,O as V}from"./index-CzFqQvXW.js";import{C as ce,a as de}from"./collection-table-wrapper-hM0ppyEG.js";import{C as me,E as Q}from"./collection-search-aEfiIRVT.js";import{P as j}from"./index-BeKO7nFo.js";import{B as pe,a as ue,b as ge,c as he}from"./breadcrumb-CtNnsyqL.js";import{C as fe}from"./connection-card-CzCUOjTN.js";import{I as xe}from"./integration-icon-Cr629JYK.js";import{u as je,U as Ce}from"./use-list-state-pp-Ywt5d.js";import{u as be}from"./use-create-virtual-mcp-b6Af6scy.js";import{i as ye}from"./constants-0JLhMmM7.js";import{b as we,a as Ne}from"./use-virtual-mcp-CaM9kbfY.js";import{c as De,b as Se,d as _e,A as ke,e as ve,h as Ae,a as Ie,f as Pe}from"./alert-dialog-CHhoNaC0.js";import{D as Y,a as Z,b as ee,c as R}from"./dropdown-menu-bZQdGgsX.js";import{i as te}from"./DotsVertical-D-x0DTAA.js";import{s as se}from"./Eye-Da9OHWjs.js";import{i as $e}from"./Loading01-DvHkBn5K.js";import{s as oe}from"./Trash01-DfwWsbuW.js";import{t as C}from"./Users03-zNQ-U5kI.js";import{A as re}from"./agent-connections-preview-CpRlCZek.js";import{f as ze}from"./format-time-CMKyl-GC.js";import"./ArrowDown-B0XF9QfR.js";import"./ArrowUp-CjPyEOxC.js";import"./Check-BGWNBpXb.js";import"./Grid01-C85povgK.js";import"./List-Dy03iFlP.js";import"./tooltip-BGn6dJhi.js";import"./index-gksA6r5d.js";import"./table-C7IfzCau.js";import"./SearchMd-Bec1mZCp.js";import"./input-Rcf9et7W.js";import"./localstorage-keys-DtK7peUq.js";import"./useQuery-BE7O7fKt.js";import"./useMutation-DsQcwaJP.js";import"./ChevronRight-B-dZm0Fo.js";import"./card-BECXECFc.js";import"./Container-CH2V2ATa.js";import"./avatar-DX9xarA9.js";import"./use-view-mode-k6uWDVq8.js";import"./use-mobile-DIBT-lEk.js";import"./use-connection-CmCfM9T5.js";import"./differenceInSeconds-NQ4PDo0z.js";function Me(e,r){switch(r.type){case"delete":return{mode:"deleting",virtualMcp:r.virtualMcp};case"close":return{mode:"idle"}}}function Be(){const e=ie.c(65),{org:r}=ae(),n=le();let b;e[0]!==r.slug?(b={namespace:r.slug,resource:"agents"},e[0]=r.slug,e[1]=b):b=e[1];const s=je(b),x=we(s);let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y={navigateOnCreate:!0},e[2]=y):y=e[2];const{createVirtualMCP:T,isCreating:w}=be(y),U=Ne();let N;e[3]===Symbol.for("react.memo_cache_sentinel")?(N={mode:"idle"},e[3]=N):N=e[3];const[i,D]=X.useReducer(Me,N);let S;e[4]!==U||e[5]!==i.mode||e[6]!==i.virtualMcp?(S=async()=>{if(i.mode!=="deleting")return;const o=i.virtualMcp.id;if(D({type:"close"}),!(!o||ye(o)))try{await U.delete.mutateAsync(o)}catch{}},e[4]=U,e[5]=i.mode,e[6]=i.virtualMcp,e[7]=S):S=e[7];const L=S;let _,k,v,A,I;e[8]===Symbol.for("react.memo_cache_sentinel")?(_={id:"title",header:"Name",render:Fe,cellClassName:"w-48 min-w-0 shrink-0",sortable:!0},k={id:"description",header:"Description",render:He,cellClassName:"flex-1 min-w-0",wrap:!0,sortable:!0},v={id:"connections",header:"Connections",render:Ue,cellClassName:"w-28 shrink-0"},A={id:"updated_by",header:"Updated by",render:Te,cellClassName:"w-32 shrink-0",sortable:!0},I={id:"updated_at",header:"Updated",render:Re,cellClassName:"max-w-24 w-24 shrink-0",sortable:!0},e[8]=_,e[9]=k,e[10]=v,e[11]=A,e[12]=I):(_=e[8],k=e[9],v=e[10],A=e[11],I=e[12]);let P;e[13]!==n||e[14]!==r.slug?(P=[_,k,v,A,I,{id:"actions",header:"",render:o=>t.jsxs(Y,{children:[t.jsx(Z,{asChild:!0,children:t.jsx(q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ve,children:t.jsx(te,{size:20})})}),t.jsxs(ee,{align:"end",onClick:Ke,children:[t.jsxs(R,{onClick:a=>{a.stopPropagation(),n({to:"/$org/$project/agents/$agentId",params:{org:r.slug,project:V,agentId:o.id}})},children:[t.jsx(se,{size:16}),"Open"]}),t.jsxs(R,{variant:"destructive",onClick:a=>{a.stopPropagation(),D({type:"delete",virtualMcp:o})},children:[t.jsx(oe,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],e[13]=n,e[14]=r.slug,e[15]=P):P=e[15];const H=P,F=w?"Creating...":"Create Agent";let $;e[16]!==T||e[17]!==w||e[18]!==F?($=t.jsx(q,{onClick:T,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:w,children:F}),e[16]=T,e[17]=w,e[18]=F,e[19]=$):$=e[19];const G=$,J=i.mode==="deleting";let z;e[20]===Symbol.for("react.memo_cache_sentinel")?(z=o=>!o&&D({type:"close"}),e[20]=z):z=e[20];let M;e[21]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsx(De,{children:"Delete Agent?"}),e[21]=M):M=e[21];const W=i.mode==="deleting"&&i.virtualMcp.title;let l;e[22]!==W?(l=t.jsxs(Se,{children:[M,t.jsxs(_e,{children:["This action cannot be undone. This will permanently delete"," ",t.jsx("span",{className:"font-medium text-foreground",children:W}),"."]})]}),e[22]=W,e[23]=l):l=e[23];let B;e[24]===Symbol.for("react.memo_cache_sentinel")?(B=t.jsx(ke,{children:"Cancel"}),e[24]=B):B=e[24];let c;e[25]!==L?(c=t.jsxs(ve,{children:[B,t.jsx(Ae,{onClick:L,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[25]=L,e[26]=c):c=e[26];let d;e[27]!==l||e[28]!==c?(d=t.jsxs(Ie,{children:[l,c]}),e[27]=l,e[28]=c,e[29]=d):d=e[29];let m;e[30]!==J||e[31]!==d?(m=t.jsx(Pe,{open:J,onOpenChange:z,children:d}),e[30]=J,e[31]=d,e[32]=m):m=e[32];let O;e[33]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx(j.Header.Left,{children:t.jsx(pe,{children:t.jsx(ue,{children:t.jsx(ge,{children:t.jsx(he,{children:"Agents"})})})})}),e[33]=O):O=e[33];let E;e[34]===Symbol.for("react.memo_cache_sentinel")?(E=[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}],e[34]=E):E=e[34];let p;e[35]!==s.handleSort||e[36]!==s.setViewMode||e[37]!==s.sortDirection||e[38]!==s.sortKey||e[39]!==s.viewMode?(p=t.jsx(ce,{viewMode:s.viewMode,onViewModeChange:s.setViewMode,sortKey:s.sortKey,sortDirection:s.sortDirection,onSort:s.handleSort,sortOptions:E}),e[35]=s.handleSort,e[36]=s.setViewMode,e[37]=s.sortDirection,e[38]=s.sortKey,e[39]=s.viewMode,e[40]=p):p=e[40];let u;e[41]!==G||e[42]!==p?(u=t.jsxs(j.Header,{children:[O,t.jsxs(j.Header.Right,{children:[p,G]})]}),e[41]=G,e[42]=p,e[43]=u):u=e[43];let g;e[44]!==s?(g=o=>{o.key==="Escape"&&(s.setSearch(""),o.target.blur())},e[44]=s,e[45]=g):g=e[45];let h;e[46]!==s.search||e[47]!==s.setSearch||e[48]!==g?(h=t.jsx(me,{value:s.search,onChange:s.setSearch,placeholder:"Search for an agent...",onKeyDown:g}),e[46]=s.search,e[47]=s.setSearch,e[48]=g,e[49]=h):h=e[49];let f;e[50]!==H||e[51]!==s.handleSort||e[52]!==s.search||e[53]!==s.sortDirection||e[54]!==s.sortKey||e[55]!==s.viewMode||e[56]!==n||e[57]!==r.slug||e[58]!==x?(f=t.jsx(j.Content,{children:s.viewMode==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:x.length===0?t.jsx(Q,{image:t.jsx(C,{size:36,className:"text-muted-foreground"}),title:s.search?"No agents found":"No agents yet",description:s.search?`No agents match "${s.search}"`:"Create an agent to aggregate tools from multiple Connections."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:x.map(o=>t.jsx(fe,{connection:{id:o.id??"",title:o.title,description:o.description,icon:o.icon,status:o.status},fallbackIcon:t.jsx(C,{}),onClick:()=>n({to:"/$org/$project/agents/$agentId",params:{org:r.slug,project:V,agentId:o.id}}),footer:t.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:t.jsxs("span",{children:[o.connections.length," connection",o.connections.length!==1?"s":""]})}),headerActions:t.jsxs(Y,{children:[t.jsx(Z,{asChild:!0,children:t.jsx(q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Ee,children:t.jsx(te,{size:20})})}),t.jsxs(ee,{align:"end",onClick:Oe,children:[t.jsxs(R,{onClick:a=>{a.stopPropagation(),n({to:"/$org/$project/agents/$agentId",params:{org:r.slug,project:V,agentId:o.id}})},children:[t.jsx(se,{size:16}),"Open"]}),t.jsxs(R,{variant:"destructive",onClick:a=>{a.stopPropagation(),D({type:"delete",virtualMcp:o})},children:[t.jsx(oe,{size:16}),"Delete"]})]})]})},o.id??"default"))})}):t.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:t.jsx(de,{columns:H,data:x,isLoading:!1,sortKey:s.sortKey,sortDirection:s.sortDirection,onSort:s.handleSort,onRowClick:o=>n({to:"/$org/$project/agents/$agentId",params:{org:r.slug,project:V,agentId:o.id}}),emptyState:s.search?t.jsx(Q,{image:t.jsx(C,{size:36,className:"text-muted-foreground"}),title:"No agents found",description:`No agents match "${s.search}"`}):t.jsx(Q,{image:t.jsx(C,{size:36,className:"text-muted-foreground"}),title:"No agents yet",description:"Create an agent to aggregate tools from multiple Connections."})})})}),e[50]=H,e[51]=s.handleSort,e[52]=s.search,e[53]=s.sortDirection,e[54]=s.sortKey,e[55]=s.viewMode,e[56]=n,e[57]=r.slug,e[58]=x,e[59]=f):f=e[59];let K;return e[60]!==m||e[61]!==u||e[62]!==h||e[63]!==f?(K=t.jsxs(j,{children:[m,u,h,f]}),e[60]=m,e[61]=u,e[62]=h,e[63]=f,e[64]=K):K=e[64],K}function Oe(e){return e.stopPropagation()}function Ee(e){return e.stopPropagation()}function Ke(e){return e.stopPropagation()}function Ve(e){return e.stopPropagation()}function Re(e){return t.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:e.updated_at?ze(new Date(e.updated_at)):"—"})}function Te(e){return t.jsx(Ce,{id:e.updated_by??e.created_by,size:"3xs"})}function Ue(e){return t.jsx(X.Suspense,{fallback:t.jsx(re.Fallback,{}),children:t.jsx(re,{connectionIds:e.connections.map(Le),maxVisibleIcons:2})})}function Le(e){return e.connection_id}function He(e){return t.jsx("span",{className:"text-sm text-foreground line-clamp-2",children:e.description||"—"})}function Fe(e){return t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx(xe,{icon:e.icon,name:e.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:t.jsx(C,{size:16})}),t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:e.title})]})}function zt(){const e=ie.c(1);let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(ne,{children:t.jsx(X.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx($e,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Be,{})})}),e[0]=r):r=e[0],r}export{zt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,G as A,j as i,H as h,aH as I,M as L,U as $,T as O,I as S,bB as B,c as g}from"./index-CzFqQvXW.js";const D=({size:n=24,color:e="currentColor",...t})=>s.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},s.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));D.displayName="ArrowsRight";const H=({size:n=24,color:e="currentColor",...t})=>s.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},s.createElement("path",{d:"M10 17.659V20a2 2 0 1 0 4 0v-2.341M12 2v1m-9 9H2m3.5-6.5-.6-.6m13.6.6.6-.6M22 12h-1m-3 0a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z"}));H.displayName="Lightbulb02";var f="Collapsible",[F,U]=$(f),[G,v]=F(f),T=s.forwardRef((n,e)=>{const{__scopeCollapsible:t,open:o,defaultOpen:a,disabled:c,onOpenChange:l,...m}=n,[p,d]=A({prop:o,defaultProp:a??!1,onChange:l,caller:f});return i.jsx(G,{scope:t,disabled:c,contentId:I(),open:p,onOpenToggle:s.useCallback(()=>d(b=>!b),[d]),children:i.jsx(h.div,{"data-state":E(p),"data-disabled":c?"":void 0,...m,ref:e})})});T.displayName=f;var _="CollapsibleTrigger",x=s.forwardRef((n,e)=>{const{__scopeCollapsible:t,...o}=n,a=v(_,t);return i.jsx(h.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":E(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...o,ref:e,onClick:L(n.onClick,a.onOpenToggle)})});x.displayName=_;var R="CollapsibleContent",y=s.forwardRef((n,e)=>{const{forceMount:t,...o}=n,a=v(R,n.__scopeCollapsible);return i.jsx(O,{present:t||a.open,children:({present:c})=>i.jsx(z,{...o,ref:e,present:c})})});y.displayName=R;var z=s.forwardRef((n,e)=>{const{__scopeCollapsible:t,present:o,children:a,...c}=n,l=v(R,t),[m,p]=s.useState(o),d=s.useRef(null),b=S(e,d),N=s.useRef(0),j=N.current,w=s.useRef(0),P=w.current,C=l.open||m,k=s.useRef(C),u=s.useRef(void 0);return s.useEffect(()=>{const r=requestAnimationFrame(()=>k.current=!1);return()=>cancelAnimationFrame(r)},[]),B(()=>{const r=d.current;if(r){u.current=u.current||{transitionDuration:r.style.transitionDuration,animationName:r.style.animationName},r.style.transitionDuration="0s",r.style.animationName="none";const M=r.getBoundingClientRect();N.current=M.height,w.current=M.width,k.current||(r.style.transitionDuration=u.current.transitionDuration,r.style.animationName=u.current.animationName),p(o)}},[l.open,o]),i.jsx(h.div,{"data-state":E(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!C,...c,ref:b,style:{"--radix-collapsible-content-height":j?`${j}px`:void 0,"--radix-collapsible-content-width":P?`${P}px`:void 0,...n.style},children:C&&a})});function E(n){return n?"open":"closed"}var W=T,V=x,Z=y;function J(n){const e=g.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx(W,{"data-slot":"collapsible",...t}),e[2]=t,e[3]=o):o=e[3],o}function K(n){const e=g.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx(x,{"data-slot":"collapsible-trigger",...t}),e[2]=t,e[3]=o):o=e[3],o}function Q(n){const e=g.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=i.jsx(y,{"data-slot":"collapsible-content",...t}),e[2]=t,e[3]=o):o=e[3],o}export{J as C,W as R,V as T,H as a,K as b,Q as c,Z as d,U as e,D as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as Ae,j as t,B as Ie,b as Ye,d as Ze,u as et,r as tt,O as $e,t as st}from"./index-CzFqQvXW.js";import{g as Oe}from"./generate-id-Dyweu44Y.js";import{a as ot,C as Fe}from"./collection-table-wrapper-hM0ppyEG.js";import{C as it,E as nt}from"./collection-search-aEfiIRVT.js";import{C as rt}from"./card-BECXECFc.js";import{I as ke}from"./integration-icon-Cr629JYK.js";import{D as Ke,a as Ue,b as Le,c as k}from"./dropdown-menu-bZQdGgsX.js";import{a as Be}from"./Copy01-Ba42JLNP.js";import{i as Re}from"./DotsVertical-D-x0DTAA.js";import{i as Ve}from"./Edit01-NXKv8M2Y.js";import{s as Ge}from"./Eye-Da9OHWjs.js";import{s as Je}from"./Trash01-DfwWsbuW.js";import{E as ze}from"./empty-state-BuKC-FeY.js";import{n as Ee}from"./Inbox01-DUxLR6jm.js";import{U as lt,u as at}from"./use-list-state-pp-Ywt5d.js";import{B as ct}from"./constants-BnCnMsvC.js";import{A as dt,h as pt,c as mt,b as ut,d as ft,e as ht,a as xt,f as gt}from"./alert-dialog-CHhoNaC0.js";import{u as jt,e as Ct}from"./use-connection-CmCfM9T5.js";import{u as vt}from"./constants-0JLhMmM7.js";import{s as bt}from"./Plus-C48LE9QF.js";import{V as yt}from"./layout-DvurrRZC.js";function Nt(n,e){const s=n.properties||{};for(const i in s){const l=s[i];if(l&&l.type==="string"&&(l.format==="url"||l.format==="uri")&&e&&typeof e=="object"&&i in e&&e[i])return e[i]}const r=["image","img","avatar","icon","logo","thumbnail","cover"];for(const i of r)if(e&&typeof e=="object"&&i in e&&typeof e[i]=="string")return e[i]}function wt(n){const e=Ae.c(25),{item:s,schema:r,actions:i}=n;let l;e[0]!==s||e[1]!==r?(l=Nt(r,s),e[0]=s,e[1]=r,e[2]=l):l=e[2];const u=l,p=s&&typeof s=="object"&&"description"in s&&typeof s.description=="string"?s.description:void 0;let j;e[3]!==i?(j=i&&Object.keys(i).length>0,e[3]=i,e[4]=j):j=e[4];const o=j;let m;e[5]!==u||e[6]!==s.title?(m=t.jsx(ke,{icon:u,name:s.title,size:"md",className:"shrink-0 shadow-sm"}),e[5]=u,e[6]=s.title,e[7]=m):m=e[7];let f;e[8]!==s.title?(f=t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:s.title}),e[8]=s.title,e[9]=f):f=e[9];const d=p||"No description";let c;e[10]!==d?(c=t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:d}),e[10]=d,e[11]=c):c=e[11];let C;e[12]!==f||e[13]!==c?(C=t.jsxs("div",{className:"flex flex-col gap-0 flex-1",children:[f,c]}),e[12]=f,e[13]=c,e[14]=C):C=e[14];let y;e[15]!==m||e[16]!==C?(y=t.jsxs("div",{className:"flex flex-col gap-4 p-6 flex-1",children:[m,C]}),e[15]=m,e[16]=C,e[17]=y):y=e[17];let a;e[18]!==i||e[19]!==o||e[20]!==s?(a=o&&t.jsx("div",{className:"absolute top-6 right-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:At,onMouseDown:_t,children:t.jsxs(Ke,{children:[t.jsx(Ue,{asChild:!0,children:t.jsx(Ie,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Dt,children:t.jsx(Re,{size:20})})}),t.jsxs(Le,{align:"end",onClick:St,children:[i.open&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.open?.(s)},children:[t.jsx(Ge,{size:16}),"Open"]}),i.edit&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.edit?.(s)},children:[t.jsx(Ve,{size:16}),"Edit"]}),i.duplicate&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.duplicate?.(s)},children:[t.jsx(Be,{size:16}),"Duplicate"]}),i.delete&&t.jsxs(k,{variant:"destructive",onClick:h=>{h.stopPropagation(),i.delete?.(s)},children:[t.jsx(Je,{size:16}),"Delete"]})]})]})}),e[18]=i,e[19]=o,e[20]=s,e[21]=a):a=e[21];let S;return e[22]!==y||e[23]!==a?(S=t.jsxs(rt,{className:"cursor-pointer transition-colors h-full flex flex-col group relative",children:[y,a]}),e[22]=y,e[23]=a,e[24]=S):S=e[24],S}function St(n){return n.stopPropagation()}function Dt(n){return n.stopPropagation()}function _t(n){return n.stopPropagation()}function At(n){return n.stopPropagation()}const It=["icon","avatar","logo"],Me=["created_at","created_by","id"];function Pt(n){return Object.keys(n).find(e=>It.includes(e.toLowerCase()))}function We(n,e){return Object.keys(n.properties||{}).filter(s=>["id","created_at","updated_at","created_by","updated_by"].includes(s)?!1:e?e.includes(s):!0).map(s=>({id:s,label:s.charAt(0).toUpperCase()+s.slice(1).replace(/_/g," ")}))}function Tt(n){const e=Ae.c(32),{data:s,schema:r,viewMode:i,onViewModeChange:l,search:u,sortKey:p,sortDirection:j,onSort:o,actions:m,onItemClick:f,headerActions:d,emptyState:c,readOnly:C,columns:y,hideToolbar:a,sortableFields:S}=n,h=l===void 0?Mt:l,x=j===void 0?"asc":j,P=o===void 0?Et:o;let v;e[0]!==m?(v=m===void 0?{}:m,e[0]=m,e[1]=v):v=e[1];const D=v,_=f===void 0?zt:f,z=d===void 0?null:d,b=c===void 0?null:c,T=C===void 0?!1:C,N=y===void 0?void 0:y,F=a===void 0?!1:a,w=S===void 0?void 0:S;let E;e[2]!==N||e[3]!==r||e[4]!==w?(E=N?N.filter(Ot).filter(M=>!w||w.includes(M.id)).map($t):We(r,w),e[2]=N,e[3]=r,e[4]=w,e[5]=E):E=e[5];const $=E;let A;e[6]!==z||e[7]!==F||e[8]!==P||e[9]!==h||e[10]!==x||e[11]!==p||e[12]!==$||e[13]!==i?(A=!F&&t.jsx("div",{className:"shrink-0 w-full border-b border-border h-12",children:t.jsxs("div",{className:"flex items-center gap-3 h-12 px-4",children:[t.jsx("div",{className:"flex items-center gap-2 flex-1",children:z}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsx(Fe,{viewMode:i,onViewModeChange:h,sortKey:p,sortDirection:x,onSort:P,sortOptions:$})})]})}),e[6]=z,e[7]=F,e[8]=P,e[9]=h,e[10]=x,e[11]=p,e[12]=$,e[13]=i,e[14]=A):A=e[14];let O;e[15]!==D||e[16]!==N||e[17]!==s||e[18]!==b||e[19]!==_||e[20]!==P||e[21]!==T||e[22]!==r||e[23]!==u||e[24]!==x||e[25]!==p||e[26]!==w||e[27]!==i?(O=i==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:s.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:b||t.jsx(ze,{icon:t.jsx(Ee,{size:36,className:"text-muted-foreground"}),title:"No items found",description:u?"Try adjusting your search":"No items to display"})}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:s.map(M=>t.jsx("div",{onClick:()=>_?.(M),className:"cursor-pointer h-full",children:t.jsx(wt,{item:M,schema:r,readOnly:T,actions:D})},M.id))})}):t.jsx(ot,{columns:Kt(N,r,w,D),data:s,sortKey:p,sortDirection:x,onSort:P,onRowClick:_,emptyState:b||t.jsx(ze,{icon:t.jsx(Ee,{size:36,className:"text-muted-foreground"}),title:"No items found",description:u?"Try adjusting your search":"No items to display"})}),e[15]=D,e[16]=N,e[17]=s,e[18]=b,e[19]=_,e[20]=P,e[21]=T,e[22]=r,e[23]=u,e[24]=x,e[25]=p,e[26]=w,e[27]=i,e[28]=O):O=e[28];let I;return e[29]!==A||e[30]!==O?(I=t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[A,O]}),e[29]=A,e[30]=O,e[31]=I):I=e[31],I}function $t(n){return{id:n.id,label:typeof n.header=="string"?n.header:n.id}}function Ot(n){return n.sortable!==!1}function zt(){}function Et(){}function Mt(){}function Ft(n){return{id:"actions",header:"",render:e=>t.jsxs(Ke,{children:[t.jsx(Ue,{asChild:!0,children:t.jsx(Ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:s=>s.stopPropagation(),children:t.jsx(Re,{size:20})})}),t.jsxs(Le,{align:"end",onClick:s=>s.stopPropagation(),children:[n.open&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.open?.(e)},children:[t.jsx(Ge,{size:16}),"Open"]}),n.edit&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.edit?.(e)},children:[t.jsx(Ve,{size:16}),"Edit"]}),n.duplicate&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.duplicate?.(e)},children:[t.jsx(Be,{size:16}),"Duplicate"]}),n.delete&&t.jsxs(k,{variant:"destructive",onClick:s=>{s.stopPropagation(),n.delete?.(e)},children:[t.jsx(Je,{size:16}),"Delete"]})]})]}),cellClassName:"w-[60px]",sortable:!1}}function He(n){const e=n.type;return Array.isArray(e)?e.every(s=>He({type:s})):e==="string"||e==="number"||e==="integer"||e==="boolean"||e==="null"}function kt(n,e){const s=n.properties||{},r=Object.keys(s).filter(o=>{const m=s[o];return m&&He(m)}),i=Pt(s),l=[],u=new Set;i&&r.includes(i)&&(l.push(i),u.add(i));const p=["title","description","updated_at","updated_by"];for(const o of p)r.includes(o)&&!u.has(o)&&(l.push(o),u.add(o));const j=r.filter(o=>!u.has(o)&&!Me.includes(o)).sort((o,m)=>o.localeCompare(m));for(const o of j)l.push(o),u.add(o);for(const o of Me)r.includes(o)&&!u.has(o)&&(l.push(o),u.add(o));return l.map(o=>{const m=s[o],f=e?e.includes(o):!["id"].includes(o);return o===i?{id:o,header:"",render:d=>{const c=d[o];return t.jsx(ke,{icon:c,name:d.title,size:"sm",className:"shrink-0 shadow-sm"})},sortable:!1,cellClassName:"w-16 shrink-0",wrap:!0}:o==="description"?{id:o,header:"Description",render:d=>{const c=d[o];return c==null?"—":t.jsx("span",{className:"block truncate max-w-[50ch]",children:String(c)})},sortable:f,cellClassName:"max-w-[50ch]"}:o==="created_by"||o==="updated_by"?{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c?t.jsx(lt,{id:String(c),size:"xs"}):"—"},sortable:f,cellClassName:"max-w-[250px]"}:m?.format==="date-time"||o.endsWith("_at")?{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c?t.jsx("span",{className:"block truncate max-w-full",children:new Date(c).toLocaleDateString()}):"—"},sortable:f,cellClassName:"max-w-[200px]"}:{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c==null?"—":t.jsx("span",{className:"block truncate max-w-full",children:String(c)})},sortable:f,cellClassName:"max-w-[200px]"}})}function Kt(n,e,s,r){const i=n||kt(e,s);return i.some(p=>p.id==="actions")?i:Object.keys(r).length>0?[...i,Ft(r)]:i}function as(n){const e=Ae.c(113),{connectionId:s,org:r,activeCollection:i}=n,l=i.name,u=i.schema??ct,p=i.hasCreateTool,j=i.hasUpdateTool,o=i.hasDeleteTool,m=Ye(),{data:f}=Ze.useSession(),d=f?.user?.id||"unknown",{org:c}=et();let C;e[0]!==s||e[1]!==c.id?(C={connectionId:s,orgId:c.id},e[0]=s,e[1]=c.id,e[2]=C):C=e[2];const y=vt(C),a=jt(s,l,y),S=`${s}-${l}`;let h;e[3]!==r||e[4]!==S?(h={namespace:r,resource:S,defaultSortKey:"updated_at"},e[3]=r,e[4]=S,e[5]=h):h=e[5];const{search:x,searchTerm:P,setSearch:v,viewMode:D,setViewMode:_,sortKey:z,sortDirection:b,handleSort:T}=at(h);let N;e[6]!==P||e[7]!==b||e[8]!==z?(N={searchTerm:P,sortKey:z,sortDirection:b},e[6]=P,e[7]=b,e[8]=z,e[9]=N):N=e[9];const F=Ct(s,l,y,N),w=!p&&!j&&!o;let E;e[10]!==l||e[11]!==s||e[12]!==m||e[13]!==r?(E=g=>{m({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:$e,connectionId:s,collectionName:l,itemId:g.id}})},e[10]=l,e[11]=s,e[12]=m,e[13]=r,e[14]=E):E=e[14];const $=E;let A;e[15]!==a.create||e[16]!==d?(A=async g=>{const me=new Date().toISOString();await a.create.mutateAsync({...g,id:Oe("conn"),title:`${g.title} (Copy)`,created_at:me,updated_at:me,created_by:d,updated_by:d})},e[15]=a.create,e[16]=d,e[17]=A):A=e[17];const O=A,[I,M]=tt.useState(null);let oe;e[18]===Symbol.for("react.memo_cache_sentinel")?(oe=g=>{M(g)},e[18]=oe):oe=e[18];const qe=oe;let K;e[19]!==$||e[20]!==j?(K=j&&{edit:$},e[19]=$,e[20]=j,e[21]=K):K=e[21];let U;e[22]!==O||e[23]!==p?(U=p&&{duplicate:O},e[22]=O,e[23]=p,e[24]=U):U=e[24];let L;e[25]!==o?(L=o&&{delete:qe},e[25]=o,e[26]=L):L=e[26];let ie;e[27]!==L||e[28]!==K||e[29]!==U?(ie={...K,...U,...L},e[27]=L,e[28]=K,e[29]=U,e[30]=ie):ie=e[30];const ue=ie;let ne;e[31]!==a.delete||e[32]!==I?(ne=async()=>{I&&(await a.delete.mutateAsync(I.id),M(null))},e[31]=a.delete,e[32]=I,e[33]=ne):ne=e[33];const fe=ne;let re;e[34]!==a.create||e[35]!==l||e[36]!==s||e[37]!==p||e[38]!==m||e[39]!==r||e[40]!==d?(re=async()=>{if(!p){st.error("Create operation is not available for this collection");return}const g=new Date().toISOString(),me={id:Oe("conn"),title:"New Item",description:"A brief description of the item",created_at:g,updated_at:g,created_by:d,updated_by:d};try{const _e=await a.create.mutateAsync(me);m({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:$e,connectionId:s,collectionName:l,itemId:_e.id}})}catch(_e){console.error("Failed to create item:",_e)}},e[34]=a.create,e[35]=l,e[36]=s,e[37]=p,e[38]=m,e[39]=r,e[40]=d,e[41]=re):re=e[41];const he=re;let le;e[42]!==u?(le=We(u),e[42]=u,e[43]=le):le=e[43];const xe=le,Pe=(F?.length??0)>0,Qe=p&&Pe,Xe=p&&!Pe&&!x;let ae;e[44]!==a.create||e[45]!==he||e[46]!==p?(ae=p?t.jsxs(Ie,{onClick:he,size:"sm",disabled:a.create.isPending,className:"h-7",children:[t.jsx(bt,{className:"mr-2 h-4 w-4"}),a.create.isPending?"Creating...":"Create"]}):null,e[44]=a.create,e[45]=he,e[46]=p,e[47]=ae):ae=e[47];const Te=ae,ge=z;let B;e[48]!==T||e[49]!==_||e[50]!==b||e[51]!==xe||e[52]!==ge||e[53]!==D?(B=t.jsx(Fe,{viewMode:D,onViewModeChange:_,sortKey:ge,sortDirection:b,onSort:T,sortOptions:xe}),e[48]=T,e[49]=_,e[50]=b,e[51]=xe,e[52]=ge,e[53]=D,e[54]=B):B=e[54];const je=Qe&&Te;let R;e[55]!==B||e[56]!==je?(R=t.jsxs(yt,{children:[B,je]}),e[55]=B,e[56]=je,e[57]=R):R=e[57];const Ce=`Search ${l}...`;let V;e[58]!==v?(V=g=>{g.key==="Escape"&&(v(""),g.target.blur())},e[58]=v,e[59]=V):V=e[59];let G;e[60]!==x||e[61]!==v||e[62]!==Ce||e[63]!==V?(G=t.jsx(it,{value:x,onChange:v,placeholder:Ce,onKeyDown:V}),e[60]=x,e[61]=v,e[62]=Ce,e[63]=V,e[64]=G):G=e[64];let J;e[65]!==F?(J=F??[],e[65]=F,e[66]=J):J=e[66];const ve=z;let W;e[67]!==$?(W=g=>$(g),e[67]=$,e[68]=W):W=e[68];const be="No items found",ye=x?"Try adjusting your search terms":"This collection doesn't have any items yet.",Ne=Xe?Te:void 0;let H;e[69]!==be||e[70]!==ye||e[71]!==Ne?(H=t.jsx(nt,{image:null,title:be,description:ye,actions:Ne}),e[69]=be,e[70]=ye,e[71]=Ne,e[72]=H):H=e[72];let q;e[73]!==T||e[74]!==w||e[75]!==ue||e[76]!==u||e[77]!==x||e[78]!==v||e[79]!==_||e[80]!==b||e[81]!==J||e[82]!==ve||e[83]!==W||e[84]!==H||e[85]!==D?(q=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(Tt,{hideToolbar:!0,data:J,schema:u,viewMode:D,onViewModeChange:_,search:x,onSearchChange:v,sortKey:ve,sortDirection:b,onSort:T,actions:ue,onItemClick:W,readOnly:w,emptyState:H})}),e[73]=T,e[74]=w,e[75]=ue,e[76]=u,e[77]=x,e[78]=v,e[79]=_,e[80]=b,e[81]=J,e[82]=ve,e[83]=W,e[84]=H,e[85]=D,e[86]=q):q=e[86];let Q;e[87]!==G||e[88]!==q?(Q=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[G,q]}),e[87]=G,e[88]=q,e[89]=Q):Q=e[89];const we=!!I;let ce;e[90]===Symbol.for("react.memo_cache_sentinel")?(ce=g=>{g||M(null)},e[90]=ce):ce=e[90];let de;e[91]===Symbol.for("react.memo_cache_sentinel")?(de=t.jsx(mt,{children:"Delete item?"}),e[91]=de):de=e[91];const Se=I?.title;let X;e[92]!==Se?(X=t.jsxs(ut,{children:[de,t.jsxs(ft,{children:['Are you sure you want to delete "',Se,'"? This action cannot be undone.']})]}),e[92]=Se,e[93]=X):X=e[93];let Y;e[94]!==a.delete.isPending?(Y=t.jsx(dt,{disabled:a.delete.isPending,children:"Cancel"}),e[94]=a.delete.isPending,e[95]=Y):Y=e[95];const De=a.delete.isPending?"Deleting...":"Delete";let Z;e[96]!==a.delete.isPending||e[97]!==fe||e[98]!==De?(Z=t.jsx(pt,{onClick:fe,disabled:a.delete.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:De}),e[96]=a.delete.isPending,e[97]=fe,e[98]=De,e[99]=Z):Z=e[99];let ee;e[100]!==Y||e[101]!==Z?(ee=t.jsxs(ht,{children:[Y,Z]}),e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let te;e[103]!==X||e[104]!==ee?(te=t.jsxs(xt,{children:[X,ee]}),e[103]=X,e[104]=ee,e[105]=te):te=e[105];let se;e[106]!==we||e[107]!==te?(se=t.jsx(gt,{open:we,onOpenChange:ce,children:te}),e[106]=we,e[107]=te,e[108]=se):se=e[108];let pe;return e[109]!==R||e[110]!==Q||e[111]!==se?(pe=t.jsxs(t.Fragment,{children:[R,Q,se]}),e[109]=R,e[110]=Q,e[111]=se,e[112]=pe):pe=e[112],pe}export{as as C};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as U,j as t,b as Ne,B as Ue,O as ge,aD as it,u as Be,c1 as Ge,aB as gt,p as jt,r as X,o as at,bJ as bt,bR as vt,s as z,aF as Qe,aG as Nt,E as ct,e as yt,a as _t,m as Ct,k as St,l as wt,i as Tt,t as ve,K as Je}from"./index-CzFqQvXW.js";import{E as Z,C as ze}from"./collection-search-aEfiIRVT.js";import{E as kt,r as Pt,e as lt}from"./env-vars-editor-BUYd05S1.js";import{g as Ke}from"./types-CnosXlf3.js";import{S as It}from"./save-actions-CH-zbfme.js";import{b as $t,a as At}from"./use-binding-Ctbwf5zu.js";import{u as Vt,S as Mt}from"./index-V5ecgDUm.js";import{f as Dt,g as dt}from"./use-connection-CmCfM9T5.js";import{u as mt}from"./constants-0JLhMmM7.js";import{d as Ot}from"./use-mcp-tools-BTHDM3P3.js";import{b as Rt}from"./use-mcp-resources--6yZ25c2.js";import{a as Et}from"./use-mcp-prompts-Bvv0Gku4.js";import{a as Lt}from"./mcp-oauth-Dk3osgIf.js";import{b as Ye,c as Ut,d as Ft,e as Bt,B as zt,a as Kt}from"./breadcrumb-CtNnsyqL.js";import{C as Xt}from"./collection-tabs-Dc6gZtTz.js";import{i as Oe}from"./Loading01-DvHkBn5K.js";import{V as Xe,a as Ht}from"./layout-DvurrRZC.js";import{C as Wt}from"./collection-tab-ByOYG4eu.js";import{I as Re}from"./integration-icon-Cr629JYK.js";import{B as Fe}from"./badge-CMOYVtO8.js";import{D as qt,a as Gt,b as Qt,c as Ze}from"./dropdown-menu-bZQdGgsX.js";import{F as W,a as Jt,b as q,d as K,f as G,c as Y,e as Yt}from"./form-EW4LFI0z.js";import{I as Q}from"./input-Rcf9et7W.js";import{S as et,a as tt,b as st,c as nt,d as H}from"./select-CSl7KVC3.js";import{i as ut}from"./CheckCircle-CDdaecse.js";import{t as Zt}from"./ChevronDown-CxLgy5uI.js";import{n as es}from"./Container-CH2V2ATa.js";import{s as De}from"./Globe02-DED7nhMo.js";import{s as ts}from"./RefreshCcw01-B_P3Otqi.js";import{i as ss}from"./Terminal-Dg9FTns0.js";import{s as ns}from"./Trash01-DfwWsbuW.js";import{t as He}from"./Users03-zNQ-U5kI.js";import{s as os}from"./XClose-D5oa0b17.js";import{U as rs}from"./use-list-state-pp-Ywt5d.js";import{b as is,a as as}from"./use-virtual-mcp-CaM9kbfY.js";import{i as cs}from"./ChevronRight-B-dZm0Fo.js";import{s as ls}from"./Plus-C48LE9QF.js";import{f as ds}from"./formatDistanceToNow-Cb2QZZJn.js";import{a as pt,C as ft}from"./collection-table-wrapper-hM0ppyEG.js";import{C as We}from"./card-BECXECFc.js";import{R as ms}from"./readme-viewer-BmxWIpiS.js";import{T as us,a as ps}from"./tools-list-BvNNjQQL.js";import{M as fs}from"./mcp-app-renderer-aRjr0jcc.js";import"./SearchMd-Bec1mZCp.js";import"./Save01-C9eXS7Z1.js";import"./binder-CN-yhtfQ.js";import"./File06-CZSeKcKm.js";import"./Key01-B3LfJVTz.js";import"./constants-BnCnMsvC.js";import"./registry-utils-DRX9Fl5Z.js";import"./extract-connection-data-CDK2P3aY.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-D4coW5d-.js";import"./index-hfshaOuF.js";import"./circle-alert-CEhC-Q81.js";import"./index-RIE02s6T.js";import"./index-Cp50RRud.js";import"./index-kE57LLiG.js";import"./context-CnW_lI9R.js";import"./decopilot-events-Brt4gAR6.js";import"./use-llm-CPv795TN.js";import"./useQuery-BE7O7fKt.js";import"./localstorage-keys-DtK7peUq.js";import"./useMutation-DsQcwaJP.js";import"./use-preferences-fTjyFgCz.js";import"./checkbox-Bs5NWE_x.js";import"./Check-BGWNBpXb.js";import"./dialog-CzmRWg_H.js";import"./X-BaOBrQh9.js";import"./skeleton-BGGjmBE-.js";import"./AlignLeft-C1Pd8crU.js";import"./ArrowLeft-Ddv8Es1G.js";import"./Image01-CyQ-9pmM.js";import"./Settings01-CGjDKLLq.js";import"./useSuspenseInfiniteQuery-BSW1dpRq.js";import"./infiniteQueryObserver-B0QSZ6Wg.js";import"./popover-C5F2AcFP.js";import"./spinner-BubUCjpb.js";import"./tooltip-BGn6dJhi.js";import"./index-gksA6r5d.js";import"./usage-B8eRkRZY.js";import"./ArrowUp-CjPyEOxC.js";import"./Edit01-NXKv8M2Y.js";import"./XCircle-CGBoiIiF.js";import"./AlertCircle-Dvy3oHwl.js";import"./use-copy-Dn5NzC6Z.js";import"./tabs-BzChyqs4.js";import"./collapsible-KhZqz8s6.js";import"./Code01-C4dpeKsY.js";import"./use-create-virtual-mcp-b6Af6scy.js";import"./Copy01-Ba42JLNP.js";import"./marked.esm-BaswSlok.js";import"./markdown-BsZjpnFH.js";import"./Eye-Da9OHWjs.js";import"./LayersTwo01-D0hB1mlt.js";import"./index-BeKO7nFo.js";import"./Clock-DjTfMWYb.js";import"./DotsVertical-D-x0DTAA.js";import"./empty-state-BuKC-FeY.js";import"./Inbox01-DUxLR6jm.js";import"./alert-dialog-CHhoNaC0.js";import"./label-DdGHGWov.js";import"./avatar-DX9xarA9.js";import"./use-view-mode-k6uWDVq8.js";import"./use-mobile-DIBT-lEk.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./ArrowDown-B0XF9QfR.js";import"./Grid01-C85povgK.js";import"./List-Dy03iFlP.js";import"./table-C7IfzCau.js";function xs(s){const e=U.c(14),{virtualMcp:n,org:o}=s;let i;e[0]!==o||e[1]!==n.id?(i={org:o,project:ge,agentId:n.id},e[0]=o,e[1]=n.id,e[2]=i):i=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 l;e[4]!==n.icon||e[5]!==n.title?(l=t.jsx(Re,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:a}),e[4]=n.icon,e[5]=n.title,e[6]=l):l=e[6];let j;e[7]!==n.title?(j=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[7]=n.title,e[8]=j):j=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(cs,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[9]=f):f=e[9];let m;return e[10]!==i||e[11]!==l||e[12]!==j?(m=t.jsxs(it,{to:"/$org/$project/agents/$agentId",params:i,className:"flex items-center gap-3 p-2 pr-1 rounded-lg hover:bg-muted/50 transition-colors group",children:[l,j,f]}),e[10]=i,e[11]=l,e[12]=j,e[13]=m):m=e[13],m}function ot(s){const e=U.c(20),{connectionId:n,connectionTitle:o,connectionDescription:i,connectionIcon:a,org:l,hasExistingVirtualMcps:j}=s,f=Ne(),m=as();let x;e[0]!==m.create||e[1]!==i||e[2]!==a||e[3]!==n||e[4]!==o||e[5]!==f||e[6]!==l?(x=async()=>{const d=await m.create.mutateAsync({title:`${o} Agent`,description:i??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:l,project:ge,agentId:d.id}})},e[0]=m.create,e[1]=i,e[2]=a,e[3]=n,e[4]=o,e[5]=f,e[6]=l,e[7]=x):x=e[7];const c=x;if(j){let d;e[8]!==m.create.isPending?(d=m.create.isPending?t.jsx(Oe,{size:16,className:"animate-spin"}):t.jsx(ls,{size:16}),e[8]=m.create.isPending,e[9]=d):d=e[9];let u;return e[10]!==m.create.isPending||e[11]!==c||e[12]!==d?(u=t.jsx(Ue,{variant:"ghost",className:"size-6 p-0",onClick:c,disabled:m.create.isPending,children:d}),e[10]=m.create.isPending,e[11]=c,e[12]=d,e[13]=u):u=e[13],u}let r;e[14]!==m.create.isPending?(r=m.create.isPending?t.jsx(Oe,{className:"animate-spin text-muted-foreground"}):t.jsx(He,{className:"size-3 text-muted-foreground"}),e[14]=m.create.isPending,e[15]=r):r=e[15];let h;return e[16]!==m.create.isPending||e[17]!==c||e[18]!==r?(h=t.jsxs(Ue,{variant:"outline",size:"sm",onClick:c,disabled:m.create.isPending,children:[r,"Create an agent"]}),e[16]=m.create.isPending,e[17]=c,e[18]=r,e[19]=h):h=e[19],h}function hs(s){const e=U.c(26),{connectionId:n,connectionTitle:o,connectionDescription:i,connectionIcon:a,org:l}=s;let j;e[0]!==n?(j={filters:[{column:"connection_id",value:n}]},e[0]=n,e[1]=j):j=e[1];const f=is(j);if(!(f.length>0)){let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Use in your IDE"}),e[2]=u):u=e[2];let b;return e[3]!==i||e[4]!==a||e[5]!==n||e[6]!==o||e[7]!==l?(b=t.jsxs("div",{className:"p-5 flex items-center justify-between gap-3",children:[u,t.jsx(ot,{connectionId:n,connectionTitle:o,connectionDescription:i,connectionIcon:a,org:l,hasExistingVirtualMcps:!1})]}),e[3]=i,e[4]=a,e[5]=n,e[6]=o,e[7]=l,e[8]=b):b=e[8],b}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 c;e[10]!==i||e[11]!==a||e[12]!==n||e[13]!==o||e[14]!==l?(c=t.jsx("div",{className:"flex flex-col gap-1",children:t.jsxs("div",{className:"flex items-center justify-between",children:[x,t.jsx(ot,{connectionId:n,connectionTitle:o,connectionDescription:i,connectionIcon:a,org:l,hasExistingVirtualMcps:!0})]})}),e[10]=i,e[11]=a,e[12]=n,e[13]=o,e[14]=l,e[15]=c):c=e[15];let r;if(e[16]!==l||e[17]!==f){let u;e[19]!==l?(u=b=>t.jsx(xs,{virtualMcp:b,org:l},b.id),e[19]=l,e[20]=u):u=e[20],r=f.map(u),e[16]=l,e[17]=f,e[18]=r}else r=e[18];let h;e[21]!==r?(h=t.jsx("div",{className:"flex flex-col gap-2",children:r}),e[21]=r,e[22]=h):h=e[22];let d;return e[23]!==c||e[24]!==h?(d=t.jsxs("div",{className:"p-5 flex flex-col gap-3",children:[c,h]}),e[23]=c,e[24]=h,e[25]=d):d=e[25],d}function gs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:o,onRemoveOAuth:i}){const a=Ge({control:s.control,name:"ui_type"}),l=Ge({control:s.control,name:"connection_url"}),{stdioEnabled:j}=gt(),f=(()=>{if(typeof l!="string"||!l)return!1;try{const r=new URL(l);return r.hostname==="api.githubcopilot.com"&&r.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),m=j||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",c=x?jt(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."})]}),c&&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:c})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[t.jsx(W,{control:s.control,name:"ui_type",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{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(et,{value:r.value,onValueChange:r.onChange,children:[t.jsx(K,{children:t.jsxs(tt,{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(De,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(st,{})]})}),t.jsxs(nt,{children:[t.jsx(H,{value:"HTTP",children:"HTTP"}),t.jsx(H,{value:"SSE",children:"SSE"}),t.jsx(H,{value:"Websocket",children:"Websocket"}),m&&t.jsxs(t.Fragment,{children:[t.jsx(H,{value:"NPX",children:"NPX Package"}),t.jsx(H,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(W,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(q,{className:"flex-1 min-w-0",children:t.jsx(K,{children:t.jsx(Q,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(et,{value:r.value,onValueChange:r.onChange,children:[t.jsx(K,{children:t.jsx(tt,{className:"h-10",children:t.jsx(st,{})})}),t.jsxs(nt,{children:[t.jsx(H,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(De,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(H,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(De,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(H,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(De,{className:"w-4 h-4"}),"Websocket"]})}),m&&t.jsxs(t.Fragment,{children:[t.jsx(H,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(es,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(H,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ss,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(G,{})]})}),a==="NPX"&&t.jsx(W,{control:s.control,name:"npx_package",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(K,{children:t.jsx(Q,{placeholder:"@perplexity-ai/mcp-server",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx(G,{})]})}),a==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(W,{control:s.control,name:"stdio_command",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(K,{children:t.jsx(Q,{placeholder:"node, bun, python...",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx(G,{})]})}),t.jsx(W,{control:s.control,name:"stdio_args",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(K,{children:t.jsx(Q,{placeholder:"arg1 arg2 --flag value",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(G,{})]})})]}),t.jsx(W,{control:s.control,name:"stdio_cwd",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(K,{children:t.jsx(Q,{placeholder:"/path/to/project (optional)",...r,value:r.value||"",className:"h-10 rounded-lg"})}),t.jsx(G,{})]})})]}),(a==="NPX"||a==="STDIO")&&t.jsx(W,{control:s.control,name:"env_vars",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(K,{children:t.jsx(kt,{value:r.value??[],onChange:r.onChange})}),t.jsx(G,{})]})}),a!=="NPX"&&a!=="STDIO"&&t.jsx(W,{control:s.control,name:"connection_token",render:({field:r})=>t.jsxs(q,{className:"flex flex-col gap-3",children:[t.jsx(Y,{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(qt,{children:[t.jsx(Gt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Fe,{variant:"success",className:"gap-1.5",children:[t.jsx(ut,{size:12}),"Authenticated via OAuth",t.jsx(Zt,{size:12})]})})}),t.jsxs(Qt,{align:"start",children:[t.jsxs(Ze,{onClick:o,children:[t.jsx(ts,{size:16}),"Re-authenticate"]}),t.jsxs(Ze,{variant:"destructive",onClick:i,children:[t.jsx(ns,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&r.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:()=>r.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(os,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(K,{children:t.jsx(Q,{type:"password",placeholder:f?"Paste your GitHub PAT":"Enter access token...",...r,value:r.value||"",className:"h-10 rounded-lg"})}),f&&t.jsxs(Yt,{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(G,{})]})})]})}function js(s){const e=U.c(43),{form:n,connection:o,isMCPAuthenticated:i,hasOAuthToken:a,onReauthenticate:l,onRemoveOAuth:j}=s,{org:f}=Be();let m;e[0]!==o.icon||e[1]!==o.title?(m=t.jsx(Re,{icon:o.icon,name:o.title,size:"lg",className:"shadow-sm"}),e[0]=o.icon,e[1]=o.title,e[2]=m):m=e[2];let x;e[3]!==n.control?(x=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(W,{control:n.control,name:"title",render:vs}),t.jsx(W,{control:n.control,name:"description",render:bs})]}),e[3]=n.control,e[4]=x):x=e[4];let c;e[5]!==m||e[6]!==x?(c=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[m,x]}),e[5]=m,e[6]=x,e[7]=c):c=e[7];let r;e[8]!==o||e[9]!==n||e[10]!==a||e[11]!==l||e[12]!==j?(r=t.jsx(gs,{form:n,connection:o,hasOAuthToken:a,onReauthenticate:l,onRemoveOAuth:j}),e[8]=o,e[9]=n,e[10]=a,e[11]=l,e[12]=j,e[13]=r):r=e[13];let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Status"}),e[14]=h):h=e[14];let d;e[15]!==i?(d=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[h,i?t.jsxs(Fe,{variant:"success",className:"gap-1.5 bg-success-foreground text-success",children:[t.jsx(ut,{size:12}),"Connected"]}):t.jsx(Fe,{variant:"outline",className:"text-muted-foreground",children:"Not connected"})]}),e[15]=i,e[16]=d):d=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Created by"}),e[17]=u):u=e[17];let b;e[18]!==o.created_by?(b=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[u,t.jsx(rs,{id:o.created_by,size:"2xs"})]}),e[18]=o.created_by,e[19]=b):b=e[19];let v;e[20]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Updated"}),e[20]=v):v=e[20];let _;e[21]!==o.updated_at?(_=o.updated_at?ds(new Date(o.updated_at),{addSuffix:!0}):"Unknown",e[21]=o.updated_at,e[22]=_):_=e[22];let S;e[23]!==_?(S=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[v,t.jsx("span",{className:"text-sm text-foreground",children:_})]}),e[23]=_,e[24]=S):S=e[24];let p;e[25]!==S||e[26]!==d||e[27]!==b?(p=t.jsxs("div",{className:"flex flex-col gap-2 p-5 border-b border-border",children:[d,b,S]}),e[25]=S,e[26]=d,e[27]=b,e[28]=p):p=e[28];let C;e[29]!==o.description||e[30]!==o.icon||e[31]!==o.id||e[32]!==o.title||e[33]!==f.slug?(C=t.jsx(hs,{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]=C):C=e[34];let w;e[35]!==p||e[36]!==C||e[37]!==c||e[38]!==r?(w=t.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[c,r,p,C]}),e[35]=p,e[36]=C,e[37]=c,e[38]=r,e[39]=w):w=e[39];let g;return e[40]!==n||e[41]!==w?(g=t.jsx(Jt,{...n,children:w}),e[40]=n,e[41]=w,e[42]=g):g=e[42],g}function bs(s){const{field:e}=s;return t.jsxs(q,{className:"w-full space-y-0",children:[t.jsx(K,{children:t.jsx(Q,{...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(G,{})]})}function vs(s){const{field:e}=s;return t.jsxs(q,{className:"flex-1 space-y-0",children:[t.jsx(K,{children:t.jsx(Q,{...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(G,{})]})}function Ns(s){const e=U.c(39),{prompts:n,connectionId:o,org:i,onPromptClick:a,showToolbar:l,emptyMessage:j}=s,f=l===void 0?!0:l,m=j===void 0?"This connection doesn't have any prompts yet.":j,x=Ne(),[c,r]=X.useState(""),[h,d]=X.useState("table"),[u,b]=X.useState("name"),[v,_]=X.useState("asc");let S;e[0]!==v||e[1]!==u?(S=T=>{u===T?(_(ws),v==="desc"&&b(void 0)):(b(T),_("asc"))},e[0]=v,e[1]=u,e[2]=S):S=e[2];const p=S;let C;e[3]!==o||e[4]!==x||e[5]!==a||e[6]!==i?(C=T=>{a?a(T):o&&i&&x({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:i,project:ge,connectionId:o,collectionName:"prompts",itemId:encodeURIComponent(T.name)}})},e[3]=o,e[4]=x,e[5]=a,e[6]=i,e[7]=C):C=e[7];const w=C;let g;if(e[8]!==n||e[9]!==c||e[10]!==v||e[11]!==u){const T=!n||n.length===0?[]:c.trim()?(()=>{const F=c.toLowerCase();return n.filter(B=>B.name.toLowerCase().includes(F)||B.description&&B.description.toLowerCase().includes(F))})():n;g=!u||!v?T:[...T].sort((F,B)=>{const je=F[u]||"",ee=B[u]||"",J=String(je).localeCompare(String(ee));return v==="asc"?J:-J}),e[8]=n,e[9]=c,e[10]=v,e[11]=u,e[12]=g}else g=e[12];const I=g;let D;e[13]===Symbol.for("react.memo_cache_sentinel")?(D=[{id:"name",header:"Name",render:Ss,sortable:!0},{id:"description",header:"Description",render:Cs,cellClassName:"flex-1",sortable:!0}],e[13]=D):D=e[13];const A=D;let V;e[14]===Symbol.for("react.memo_cache_sentinel")?(V=A.filter(_s).map(ys),e[14]=V):V=e[14];const L=V;let y;e[15]!==p||e[16]!==f||e[17]!==v||e[18]!==u||e[19]!==h?(y=f&&t.jsx(Xe,{children:t.jsx(ft,{viewMode:h,onViewModeChange:d,sortKey:u,sortDirection:v,onSort:p,sortOptions:L})}),e[15]=p,e[16]=f,e[17]=v,e[18]=u,e[19]=h,e[20]=y):y=e[20];let R;e[21]===Symbol.for("react.memo_cache_sentinel")?(R=T=>{T.key==="Escape"&&(r(""),T.target.blur())},e[21]=R):R=e[21];let M;e[22]!==c?(M=t.jsx(ze,{value:c,onChange:r,placeholder:"Search prompts...",onKeyDown:R}),e[22]=c,e[23]=M):M=e[23];let N;e[24]!==m||e[25]!==w||e[26]!==p||e[27]!==c||e[28]!==v||e[29]!==u||e[30]!==I||e[31]!==h?(N=h==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:I.length===0?t.jsx(Z,{image:null,title:c?"No prompts found":"No prompts available",description:c?"Try adjusting your search terms":m}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:I.map(T=>t.jsx(We,{className:"cursor-pointer transition-colors",onClick:()=>w(T),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Re,{icon:null,name:T.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:T.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:T.description||"No description"})]})]})},T.name))})}):t.jsx(pt,{columns:A,data:I,isLoading:!1,sortKey:u,sortDirection:v,onSort:p,onRowClick:T=>w(T),emptyState:t.jsx(Z,{image:null,title:c?"No prompts found":"No prompts available",description:c?"Try adjusting your search terms":m})}),e[24]=m,e[25]=w,e[26]=p,e[27]=c,e[28]=v,e[29]=u,e[30]=I,e[31]=h,e[32]=N):N=e[32];let $;e[33]!==M||e[34]!==N?($=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[M,N]}),e[33]=M,e[34]=N,e[35]=$):$=e[35];let P;return e[36]!==$||e[37]!==y?(P=t.jsxs(t.Fragment,{children:[y,$]}),e[36]=$,e[37]=y,e[38]=P):P=e[38],P}function ys(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function _s(s){return s.sortable}function Cs(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Ss(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 Ts(s){const e=U.c(4),{prompts:n,connectionId:o,org:i}=s;let a;return e[0]!==o||e[1]!==i||e[2]!==n?(a=t.jsx(Ns,{prompts:n,connectionId:o,org:i}),e[0]=o,e[1]=i,e[2]=n,e[3]=a):a=e[3],a}function ks(s){const e=U.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(ms,{repository:n})}),e[0]=n,e[1]=o):o=e[1],o}function Ps(s){const e=U.c(36),{resources:n,onResourceClick:o,showToolbar:i,emptyMessage:a}=s,l=i===void 0?!0:i,j=a===void 0?"This connection doesn't have any resources yet.":a,[f,m]=X.useState(""),[x,c]=X.useState("table"),[r,h]=X.useState("name"),[d,u]=X.useState("asc");let b;e[0]!==d||e[1]!==r?(b=N=>{r===N?(u(Os),d==="desc"&&h(void 0)):(h(N),u("asc"))},e[0]=d,e[1]=r,e[2]=b):b=e[2];const v=b;let _;e[3]!==o?(_=N=>{o&&o(N)},e[3]=o,e[4]=_):_=e[4];const S=_;let p;if(e[5]!==n||e[6]!==f||e[7]!==d||e[8]!==r){const N=!n||n.length===0?[]:f.trim()?(()=>{const $=f.toLowerCase();return n.filter(P=>P.uri.toLowerCase().includes($)||P.name&&P.name.toLowerCase().includes($)||P.description&&P.description.toLowerCase().includes($))})():n;p=!r||!d?N:[...N].sort(($,P)=>{const T=$[r]||"",F=P[r]||"",B=String(T).localeCompare(String(F));return d==="asc"?B:-B}),e[5]=n,e[6]=f,e[7]=d,e[8]=r,e[9]=p}else p=e[9];const C=p;let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=[{id:"name",header:"Name",render:Ds,sortable:!0},{id:"uri",header:"URI",render:Ms,sortable:!0},{id:"description",header:"Description",render:Vs,cellClassName:"flex-1",sortable:!0},{id:"mimeType",header:"Type",render:As,sortable:!0}],e[10]=w):w=e[10];const g=w;let I;e[11]===Symbol.for("react.memo_cache_sentinel")?(I=g.filter($s).map(Is),e[11]=I):I=e[11];const D=I;let A;e[12]!==v||e[13]!==l||e[14]!==d||e[15]!==r||e[16]!==x?(A=l&&t.jsx(Xe,{children:t.jsx(ft,{viewMode:x,onViewModeChange:c,sortKey:r,sortDirection:d,onSort:v,sortOptions:D})}),e[12]=v,e[13]=l,e[14]=d,e[15]=r,e[16]=x,e[17]=A):A=e[17];let V;e[18]===Symbol.for("react.memo_cache_sentinel")?(V=N=>{N.key==="Escape"&&(m(""),N.target.blur())},e[18]=V):V=e[18];let L;e[19]!==f?(L=t.jsx(ze,{value:f,onChange:m,placeholder:"Search resources...",onKeyDown:V}),e[19]=f,e[20]=L):L=e[20];let y;e[21]!==j||e[22]!==S||e[23]!==v||e[24]!==f||e[25]!==d||e[26]!==r||e[27]!==C||e[28]!==x?(y=x==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:C.length===0?t.jsx(Z,{image:null,title:f?"No resources found":"No resources available",description:f?"Try adjusting your search terms":j}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:C.map(N=>t.jsx(We,{className:"cursor-pointer transition-colors",onClick:()=>S(N),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(Re,{icon:null,name:N.name||N.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:N.name||N.uri}),t.jsx("p",{className:"text-xs font-mono text-muted-foreground truncate",children:N.uri}),N.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:N.description})]})]})},N.uri))})}):t.jsx(pt,{columns:g,data:C,isLoading:!1,sortKey:r,sortDirection:d,onSort:v,onRowClick:N=>S(N),emptyState:t.jsx(Z,{image:null,title:f?"No resources found":"No resources available",description:f?"Try adjusting your search terms":j})}),e[21]=j,e[22]=S,e[23]=v,e[24]=f,e[25]=d,e[26]=r,e[27]=C,e[28]=x,e[29]=y):y=e[29];let R;e[30]!==L||e[31]!==y?(R=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[L,y]}),e[30]=L,e[31]=y,e[32]=R):R=e[32];let M;return e[33]!==R||e[34]!==A?(M=t.jsxs(t.Fragment,{children:[A,R]}),e[33]=R,e[34]=A,e[35]=M):M=e[35],M}function Is(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function $s(s){return s.sortable}function As(s){return t.jsx("span",{className:"text-sm text-muted-foreground",children:s.mimeType||"—"})}function Vs(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Ms(s){return t.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:s.uri})}function Ds(s){return t.jsx("span",{className:"text-sm font-medium text-foreground",children:s.name||s.uri})}function Os(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Rs(s){const e=U.c(4),{resources:n,connectionId:o,org:i}=s;let a;return e[0]!==o||e[1]!==i||e[2]!==n?(a=t.jsx(Ps,{resources:n,connectionId:o,org:i}),e[0]=o,e[1]=i,e[2]=n,e[3]=a):a=e[3],a}const Es=at({key:z().min(1,"Key is required"),value:z()}),Ls=at({title:z().min(1,"Name is required"),description:z().nullable().optional(),ui_type:Nt(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:z().optional(),connection_token:z().nullable().optional(),npx_package:z().optional(),stdio_command:z().optional(),stdio_args:z().optional(),stdio_cwd:z().optional(),env_vars:Qe(Es).optional(),configuration_scopes:Qe(z()).nullable().optional(),configuration_state:bt(z(),vt()).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 Us(s){const e=U.c(5),{tools:n,connectionId:o,org:i,isLoading:a}=s;let l;return e[0]!==o||e[1]!==a||e[2]!==i||e[3]!==n?(l=t.jsx(us,{tools:n,connectionId:o,org:i,isLoading:a}),e[0]=o,e[1]=a,e[2]=i,e[3]=n,e[4]=l):l=e[4],l}function Fs(s){const e=U.c(27),{tools:n,connectionId:o,org:i}=s,a=Ne(),{org:l}=Be();let j;e[0]!==o||e[1]!==l.id?(j={connectionId:o,orgId:l.id},e[0]=o,e[1]=l.id,e[2]=j):j=e[2];const f=mt(j),[m,x]=X.useState("");let c,r,h,d;if(e[3]!==f||e[4]!==o||e[5]!==a||e[6]!==i||e[7]!==m||e[8]!==n){const v=(n??[]).filter(Bs),_=m.toLowerCase().trim(),S=_?v.filter(g=>g.name.toLowerCase().includes(_)||g.description&&g.description.toLowerCase().includes(_)):v;let p;e[13]!==o||e[14]!==a||e[15]!==i?(p=g=>{a({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:i,project:ge,connectionId:o,collectionName:"tools",itemId:encodeURIComponent(g.name)}})},e[13]=o,e[14]=a,e[15]=i,e[16]=p):p=e[16];const C=p;h="flex flex-col h-full overflow-hidden";let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=g=>{g.key==="Escape"&&(x(""),g.target.blur())},e[17]=w):w=e[17],e[18]!==m?(d=t.jsx(ze,{value:m,onChange:x,placeholder:"Search apps...",onKeyDown:w}),e[18]=m,e[19]=d):d=e[19],c="flex-1 overflow-auto p-5",r=S.length===0?t.jsx(Z,{image:null,title:m?"No apps found":"No apps available",description:m?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:S.map(g=>{const I=Ke(g._meta);return t.jsxs(We,{className:"cursor-pointer transition-colors overflow-hidden",onClick:()=>C(g),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(fs,{resourceURI:I,toolName:g.name,displayMode:"inline",minHeight:200,maxHeight:200,client:f})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:g.name}),t.jsx(ps,{annotations:g.annotations,_meta:g._meta})]}),g.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:g.description})]})]},g.name)})}),e[3]=f,e[4]=o,e[5]=a,e[6]=i,e[7]=m,e[8]=n,e[9]=c,e[10]=r,e[11]=h,e[12]=d}else c=e[9],r=e[10],h=e[11],d=e[12];let u;e[20]!==c||e[21]!==r?(u=t.jsx("div",{className:c,children:r}),e[20]=c,e[21]=r,e[22]=u):u=e[22];let b;return e[23]!==h||e[24]!==d||e[25]!==u?(b=t.jsxs("div",{className:h,children:[d,u]}),e[23]=h,e[24]=d,e[25]=u,e[26]=b):b=e[26],b}function Bs(s){return!!Ke(s._meta)}function zs(s){return s.command==="npx"}function Ks(s){return s.args?.find(e=>!e.startsWith("-"))??""}function Xs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Hs(s,e){const n={command:"npx",args:["-y",s]},o=lt(e);return Object.keys(o).length>0&&(n.envVars=o),n}function Ws(s,e,n,o){const i={command:s};e.trim()&&(i.args=e.trim().split(/\s+/)),n?.trim()&&(i.cwd=n.trim());const a=lt(o);return Object.keys(a).length>0&&(i.envVars=a),i}function rt(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"&&Tt(s.connection_headers)){const o=s.connection_headers,i=Pt(o.envVars);if(zs(o)){const l=Ks(o);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:l,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:i}}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:i}}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,i=null;return s.ui_type==="NPX"?(e="STDIO",n="",i=Hs(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",i=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},...i&&{connection_headers:i},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function Gs(s){const e=U.c(116),{connection:n,connectionId:o,org:i,requestedTabId:a,collections:l,onUpdate:j,isUpdating:f,prompts:m,resources:x,tools:c,isLoadingTools:r}=s;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={from:"/$org/$project/mcps/$connectionId"},e[0]=h):h=e[0];const d=Ne(h),u=Ct(),b=dt();let v;e[1]!==o?(v={connectionId:o},e[1]=o,e[2]=v):v=e[2];const _=Vt(v),p=n?.connection_type==="VIRTUAL"||_.isAuthenticated;let C;e[3]!==n?(C={connections:[n],binding:"MCP"},e[3]=n,e[4]=C):C=e[4];const g=At(C).length>0,I=n?.metadata?.repository,D=!!I?.url;let A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A=St(Ls),e[5]=A):A=e[5];let V;e[6]!==n?(V=rt(n),e[6]=n,e[7]=V):V=e[7];let L;e[8]!==V?(L={resolver:A,values:V},e[8]=V,e[9]=L):L=e[9];const y=wt(L),R=y.formState.isDirty;let M;e[10]!==y||e[11]!==j?(M=async()=>{if(!await y.trigger())return;const E=y.getValues(),he=qs(E);await j(he),y.reset(E)},e[10]=y,e[11]=j,e[12]=M):M=e[12];const N=M;let $;e[13]!==n||e[14]!==y?($=()=>{y.reset(rt(n))},e[13]=n,e[14]=y,e[15]=$):$=e[15];const P=$;let T;e[16]!==n.id||e[17]!==b||e[18]!==u?(T=async()=>{const{token:k,tokenInfo:E,error:he}=await Lt({connectionId:n.id});if(he||!k){ve.error(`Authentication failed: ${he}`);return}if(E)try{const Me=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:E.accessToken,refreshToken:E.refreshToken,expiresIn:E.expiresIn,scope:E.scope,clientId:E.clientId,clientSecret:E.clientSecret,tokenEndpoint:E.tokenEndpoint})});if(!Me.ok)console.error("Failed to save OAuth token:",await Me.text()),await b.update.mutateAsync({id:n.id,data:{connection_token:k}});else try{await b.update.mutateAsync({id:n.id,data:{}})}catch(qe){console.warn("Failed to refresh connection tools after OAuth:",qe)}}catch(Me){console.error("Error saving OAuth token:",Me),await b.update.mutateAsync({id:n.id,data:{connection_token:k}})}else await b.update.mutateAsync({id:n.id,data:{connection_token:k}});const ht=new URL(`/mcp/${n.id}`,window.location.origin);await u.invalidateQueries({queryKey:Je.isMCPAuthenticated(ht.href,null)}),ve.success("Authentication successful")},e[16]=n.id,e[17]=b,e[18]=u,e[19]=T):T=e[19];const F=T;let B;e[20]!==n.id||e[21]!==u?(B=async()=>{try{const k=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!k.ok){const he=await k.text();ve.error(`Failed to remove OAuth: ${he}`);return}const E=new URL(`/mcp/${n.id}`,window.location.origin);await u.invalidateQueries({queryKey:Je.isMCPAuthenticated(E.href,null)}),ve.success("OAuth removed. You can now re-authenticate with a different account.")}catch(k){console.error("Error removing OAuth token:",k),ve.error("Failed to remove OAuth")}},e[20]=n.id,e[21]=u,e[22]=B):B=e[22];const je=B,ee=c.length,J=m.length,ye=x.length;let _e;e[23]!==c?(_e=c.filter(Ys),e[23]=c,e[24]=_e):_e=e[24];const Ce=_e.length,Ee=ee>0||r;let Se;e[25]===Symbol.for("react.memo_cache_sentinel")?(Se={id:"settings",label:"Settings"},e[25]=Se):Se=e[25];let te;e[26]!==r||e[27]!==p||e[28]!==Ee||e[29]!==ee?(te=p&&Ee?[{id:"tools",label:"Tools",count:r?void 0:ee}]:[],e[26]=r,e[27]=p,e[28]=Ee,e[29]=ee,e[30]=te):te=e[30];let se;e[31]!==p||e[32]!==J?(se=p&&J>0?[{id:"prompts",label:"Prompts",count:J}]:[],e[31]=p,e[32]=J,e[33]=se):se=e[33];let ne;e[34]!==p||e[35]!==ye?(ne=p&&ye>0?[{id:"resources",label:"Resources",count:ye}]:[],e[34]=p,e[35]=ye,e[36]=ne):ne=e[36];let oe;e[37]!==p||e[38]!==Ce?(oe=p&&Ce>0?[{id:"ui",label:"UI",count:Ce}]:[],e[37]=p,e[38]=Ce,e[39]=oe):oe=e[39];let we;if(e[40]!==l||e[41]!==D||e[42]!==p||e[43]!==te||e[44]!==se||e[45]!==ne||e[46]!==oe){let k;e[48]!==D?(k=D?[{id:"readme",label:"README"}]:[],e[48]=D,e[49]=k):k=e[49],we=[Se,...te,...se,...ne,...oe,...p?(l||[]).map(Js):[],...k],e[40]=l,e[41]=D,e[42]=p,e[43]=te,e[44]=se,e[45]=ne,e[46]=oe,e[47]=we}else we=e[47];const be=we,xt=p&&be.some(Qs)?"tools":"settings",O=be.some(k=>k.id===a)?a:xt;let Te;e[50]!==d?(Te=k=>{d({search:E=>({...E,tab:k}),replace:!0})},e[50]=d,e[51]=Te):Te=e[51];const re=Te;let ie;e[52]!==l?(ie=l||[],e[52]=l,e[53]=ie):ie=e[53];let ke;if(e[54]!==O||e[55]!==ie){let k;e[57]!==O?(k=E=>E.name===O,e[57]=O,e[58]=k):k=e[58],ke=ie.find(k),e[54]=O,e[55]=ie,e[56]=ke}else ke=e[56];const Pe=ke;let ae;e[59]!==i?(ae=t.jsx(Ye,{children:t.jsx(Ft,{asChild:!0,children:t.jsx(it,{to:"/$org/$project/mcps",params:{org:i,project:ge},children:"Connections"})})}),e[59]=i,e[60]=ae):ae=e[60];let Ie;e[61]===Symbol.for("react.memo_cache_sentinel")?(Ie=t.jsx(Bt,{}),e[61]=Ie):Ie=e[61];let ce;e[62]!==n.title?(ce=t.jsx(Ye,{children:t.jsx(Ut,{children:n.title})}),e[62]=n.title,e[63]=ce):ce=e[63];let $e;e[64]!==ae||e[65]!==ce?($e=t.jsx(zt,{children:t.jsxs(Kt,{children:[ae,Ie,ce]})}),e[64]=ae,e[65]=ce,e[66]=$e):$e=e[66];const Le=$e;let le;e[67]!==N||e[68]!==P||e[69]!==R||e[70]!==f?(le=t.jsx(Xe,{children:t.jsx(It,{onSave:N,onUndo:P,isDirty:R,isSaving:f})}),e[67]=N,e[68]=P,e[69]=R,e[70]=f,e[71]=le):le=e[71];let de;e[72]!==_.hasOAuthToken||e[73]!==n||e[74]!==y||e[75]!==F||e[76]!==je||e[77]!==p?(de=t.jsx("div",{className:"w-100 shrink-0 border-r border-border bg-background",children:t.jsx(js,{form:y,connection:n,isMCPAuthenticated:p,hasOAuthToken:_.hasOAuthToken,onReauthenticate:F,onRemoveOAuth:je})}),e[72]=_.hasOAuthToken,e[73]=n,e[74]=y,e[75]=F,e[76]=je,e[77]=p,e[78]=de):de=e[78];let me;e[79]!==O||e[80]!==re||e[81]!==be?(me=t.jsx("div",{className:"shrink-0 flex items-center gap-4 px-5 py-3 border-b border-border",children:t.jsx(Xt,{tabs:be,activeTab:O,onTabChange:re,className:"flex-1"})}),e[79]=O,e[80]=re,e[81]=be,e[82]=me):me=e[82];let Ae;e[83]===Symbol.for("react.memo_cache_sentinel")?(Ae=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Oe,{size:32,className:"animate-spin text-muted-foreground"})}),e[83]=Ae):Ae=e[83];let ue;e[84]!==Pe||e[85]!==O||e[86]!==_.isServerError||e[87]!==_.supportsOAuth||e[88]!==n||e[89]!==o||e[90]!==y||e[91]!==F||e[92]!==re||e[93]!==g||e[94]!==D||e[95]!==r||e[96]!==p||e[97]!==i||e[98]!==m||e[99]!==I||e[100]!==x||e[101]!==c?(ue=t.jsx(X.Suspense,{fallback:Ae,children:O==="tools"?t.jsx(Us,{tools:c,connectionId:o,org:i,isLoading:r}):O==="ui"?t.jsx(Fs,{tools:c,connectionId:o,org:i}):O==="prompts"?t.jsx(Ts,{prompts:m,connectionId:o,org:i}):O==="resources"?t.jsx(Rs,{resources:x,connectionId:o,org:i}):O==="settings"?t.jsx(Mt,{connection:n,form:y,hasMcpBinding:g,isMCPAuthenticated:p,supportsOAuth:_.supportsOAuth,isServerError:_.isServerError,onAuthenticate:F,onViewReadme:D?()=>re("readme"):void 0}):O==="readme"&&D?t.jsx(ks,{repository:I}):Pe&&p?t.jsx(Wt,{connectionId:o,org:i,activeCollection:Pe},O):t.jsx(Z,{title:"Collection not found",description:"This collection may have been deleted or you may not have access."})}),e[84]=Pe,e[85]=O,e[86]=_.isServerError,e[87]=_.supportsOAuth,e[88]=n,e[89]=o,e[90]=y,e[91]=F,e[92]=re,e[93]=g,e[94]=D,e[95]=r,e[96]=p,e[97]=i,e[98]=m,e[99]=I,e[100]=x,e[101]=c,e[102]=ue):ue=e[102];let pe;e[103]!==O||e[104]!==ue?(pe=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(ct,{children:ue},O)}),e[103]=O,e[104]=ue,e[105]=pe):pe=e[105];let fe;e[106]!==me||e[107]!==pe?(fe=t.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:[me,pe]}),e[106]=me,e[107]=pe,e[108]=fe):fe=e[108];let xe;e[109]!==de||e[110]!==fe?(xe=t.jsxs("div",{className:"flex h-full w-full bg-background overflow-hidden",children:[de,fe]}),e[109]=de,e[110]=fe,e[111]=xe):xe=e[111];let Ve;return e[112]!==Le||e[113]!==le||e[114]!==xe?(Ve=t.jsxs(Ht,{breadcrumb:Le,children:[le,xe]}),e[112]=Le,e[113]=le,e[114]=xe,e[115]=Ve):Ve=e[115],Ve}function Qs(s){return s.id==="tools"}function Js(s){return{id:s.name,label:s.displayName}}function Ys(s){return!!Ke(s._meta)}function Zs(){const s=U.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=Ne(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:i,org:a}=yt(o),{org:l}=Be();let j;s[2]===Symbol.for("react.memo_cache_sentinel")?(j={from:"/shell/$org/$project/mcps/$connectionId"},s[2]=j):j=s[2];const m=_t(j).tab??"",x=Dt(i),c=dt(),r=$t(x??void 0);let h;s[3]!==i||s[4]!==l.id?(h={connectionId:i,orgId:l.id},s[3]=i,s[4]=l.id,s[5]=h):h=s[5];const d=mt(h);let u;s[6]!==d?(u={client:d},s[6]=d,s[7]=u):u=s[7];const{data:b}=Et(u);let v;s[8]!==d?(v={client:d},s[8]=d,s[9]=v):v=s[9];const{data:_}=Rt(v),S=x?.connection_type==="VIRTUAL";let p;s[10]!==d||s[11]!==S?(p={client:d,enabled:S},s[10]=d,s[11]=S,s[12]=p):p=s[12];const{data:C,isLoading:w}=Ot(p);let g;s[13]!==b?.prompts?(g=b?.prompts??[],s[13]=b?.prompts,s[14]=g):g=s[14];let I;s[15]!==g?(I=g.map(sn),s[15]=g,s[16]=I):I=s[16];const D=I;let A;s[17]!==_?.resources?(A=_?.resources??[],s[17]=_?.resources,s[18]=A):A=s[18];let V;s[19]!==A?(V=A.map(tn),s[19]=A,s[20]=V):V=s[20];const L=V;let y;s[21]!==x?.tools||s[22]!==S||s[23]!==C?.tools?(y=S?(C?.tools??[]).map(en):x?.tools??[],s[21]=x?.tools,s[22]=S,s[23]=C?.tools,s[24]=y):y=s[24];const R=y;let M;s[25]!==c.update||s[26]!==i?(M=async P=>{await c.update.mutateAsync({id:i,data:P})},s[25]=c.update,s[26]=i,s[27]=M):M=s[27];const N=M;if(!x){let P;return s[28]!==n||s[29]!==a?(P=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Z,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(Ue,{variant:"outline",onClick:()=>n({to:"/$org/$project/mcps",params:{org:a,project:ge}}),children:"Back to connections"})})}),s[28]=n,s[29]=a,s[30]=P):P=s[30],P}let $;return s[31]!==c.update.isPending||s[32]!==r||s[33]!==x||s[34]!==i||s[35]!==N||s[36]!==w||s[37]!==a||s[38]!==D||s[39]!==m||s[40]!==L||s[41]!==R?($=t.jsx(Gs,{org:a,connection:x,connectionId:i,requestedTabId:m,collections:r,onUpdate:N,isUpdating:c.update.isPending,prompts:D,resources:L,tools:R,isLoadingTools:w}),s[31]=c.update.isPending,s[32]=r,s[33]=x,s[34]=i,s[35]=N,s[36]=w,s[37]=a,s[38]=D,s[39]=m,s[40]=L,s[41]=R,s[42]=$):$=s[42],$}function en(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,annotations:s.annotations,_meta:s._meta}}function tn(s){return{uri:s.uri,name:s.name,description:s.description}}function sn(s){return{name:s.name,description:s.description}}function nn(){const s=U.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ct,{children:t.jsx(X.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Oe,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Zs,{})})}),s[0]=e):e=s[0],e}function dr(){const s=U.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(nn,{}),s[0]=e):e=s[0],e}export{dr as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as be,j as e,E as Fe,r as X,u as Be,m as Ue,b as He,a as Le,d as Me,aB as ze,l as Re,k as Xe,i as We,B as S,O as g,t as D,o as ke,aF as Ke,s as C,aG as Ge}from"./index-CzFqQvXW.js";import{g as qe}from"./generate-id-Dyweu44Y.js";import{C as Qe,a as Je}from"./collection-table-wrapper-hM0ppyEG.js";import{C as Ye,E as L}from"./collection-search-aEfiIRVT.js";import{C as Ze}from"./connection-card-CzCUOjTN.js";import{B as M}from"./badge-CMOYVtO8.js";import{i as et}from"./AlertCircle-Dvy3oHwl.js";import{i as tt}from"./CheckCircle-CDdaecse.js";import{I as nt}from"./integration-icon-Cr629JYK.js";import{P as E}from"./index-BeKO7nFo.js";import{u as st,U as re}from"./use-list-state-pp-Ywt5d.js";import{u as ot}from"./use-binding-Ctbwf5zu.js";import{f as rt,e as it}from"./registry-utils-DRX9Fl5Z.js";import{f as ie,a as ae,b as ce,c as le,d as de,e as me,A as ue,h as pe}from"./alert-dialog-CHhoNaC0.js";import{B as at,a as ct,b as lt,c as dt}from"./breadcrumb-CtNnsyqL.js";import{D as mt,a as ut,b as pt,c as xt,d as ht,e as gt}from"./dialog-CzmRWg_H.js";import{D as xe,a as he,b as ge,c as F}from"./dropdown-menu-bZQdGgsX.js";import{a as jt,F as j,b as f,c as y,d as v,f as _}from"./form-EW4LFI0z.js";import{I as T}from"./input-Rcf9et7W.js";import{S as ft,a as yt,b as vt,c as _t,d as $}from"./select-CSl7KVC3.js";import{T as Ct}from"./textarea-CumbsokS.js";import{g as Nt,h as bt}from"./use-connection-CmCfM9T5.js";import{u as je,a as kt}from"./constants-0JLhMmM7.js";import{b as wt}from"./use-mcp-tools-BTHDM3P3.js";import{n as z}from"./Container-CH2V2ATa.js";import{i as fe}from"./DotsVertical-D-x0DTAA.js";import{s as ye}from"./Eye-Da9OHWjs.js";import{s as R}from"./Globe02-DED7nhMo.js";import{i as St}from"./Loading01-DvHkBn5K.js";import{i as Tt}from"./Terminal-Dg9FTns0.js";import{s as ve}from"./Trash01-DfwWsbuW.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-BUYd05S1.js";import"./ArrowDown-B0XF9QfR.js";import"./ArrowUp-CjPyEOxC.js";import"./Check-BGWNBpXb.js";import"./Grid01-C85povgK.js";import"./List-Dy03iFlP.js";import"./tooltip-BGn6dJhi.js";import"./index-gksA6r5d.js";import"./table-C7IfzCau.js";import"./SearchMd-Bec1mZCp.js";import"./card-BECXECFc.js";import"./localstorage-keys-DtK7peUq.js";import"./useQuery-BE7O7fKt.js";import"./useMutation-DsQcwaJP.js";import"./avatar-DX9xarA9.js";import"./use-view-mode-k6uWDVq8.js";import"./use-mobile-DIBT-lEk.js";import"./binder-CN-yhtfQ.js";import"./ChevronRight-B-dZm0Fo.js";import"./X-BaOBrQh9.js";import"./label-DdGHGWov.js";import"./ChevronDown-CxLgy5uI.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./Plus-C48LE9QF.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(tt,{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(et,{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:Ge(["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:Ke(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}=Be(),o=Ue(),i=He(),d=Le({strict:!1}),{data:c}=Me.useSession(),{stdioEnabled:N}=ze(),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=je({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=Re({resolver:Xe(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=We(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=je({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=qe("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(fe,{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(jt,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit($e),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(j,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Type *"}),e.jsxs(ft,{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(j,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(f,{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(j,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(f,{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(j,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(f,{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(j,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(f,{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(j,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(f,{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(j,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(f,{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(j,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(f,{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(j,{control:r.control,name:"title",render:({field:t})=>e.jsxs(f,{children:[e.jsx(y,{children:"Name *"}),e.jsx(v,{children:e.jsx(T,{placeholder:"My Connection",...t})}),e.jsx(_,{})]})}),e.jsx(j,{control:r.control,name:"description",render:({field:t})=>e.jsxs(f,{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(Ye,{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(Ze,{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(fe,{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(Je,{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 Rn(){const s=be.c(1);let o;return s[0]===Symbol.for("react.memo_cache_sentinel")?(o=e.jsx(Fe,{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{Rn as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a0 as a,a1 as t}from"./index-CzFqQvXW.js";const e=a(t,{target:"draft-7"});export{e as B};
|