decocms 2.304.0 → 2.304.2
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-BeiDn4Fp.js → AlertCircle-9O6VvAfH.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-hulNygQd.js → ArrowNarrowLeft-CG2ODQbf.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-lTwxwkJA.js → ArrowUpRight-C7hCAEbW.js} +1 -1
- package/dist/client/assets/{CheckCircle-3TB25Bcb.js → CheckCircle-BbvAf9Bo.js} +1 -1
- package/dist/client/assets/{ChevronDown-_b59faTm.js → ChevronDown-DTujp_Ze.js} +1 -1
- package/dist/client/assets/{ChevronRight-DEybByBs.js → ChevronRight-DmfKIycz.js} +1 -1
- package/dist/client/assets/{ChevronUp-B_td_jK6.js → ChevronUp-k_xkdO-G.js} +1 -1
- package/dist/client/assets/{Container-d8d36LPk.js → Container-Dwj81gCC.js} +1 -1
- package/dist/client/assets/{DotsVertical-9AuPT8gf.js → DotsVertical-BSgCnoHf.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BMrJcbl6.js → LinkExternal01-DceZ2oEY.js} +1 -1
- package/dist/client/assets/{Lock01-C5rgxGgu.js → Lock01-NMXz4ptn.js} +1 -1
- package/dist/client/assets/{Palette-DfnmIo6d.js → Palette-dLUnn7-k.js} +1 -1
- package/dist/client/assets/{Play-BGW505UY.js → Play-DBJO09gj.js} +1 -1
- package/dist/client/assets/{Plus-DlISHBLe.js → Plus-D5DLeNpq.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-Dbq2QLAC.js → RefreshCcw01-B6WkaYVq.js} +1 -1
- package/dist/client/assets/{SearchMd-C8WDOhfc.js → SearchMd-CCDT-gCm.js} +1 -1
- package/dist/client/assets/{Settings02-BIpL5e3f.js → Settings02-CnaVYpiu.js} +1 -1
- package/dist/client/assets/{Shield01-DCoI7_zY.js → Shield01-Bqcf2bTH.js} +1 -1
- package/dist/client/assets/{Star01-Chns_B29.js → Star01-SeWnXAup.js} +1 -1
- package/dist/client/assets/{Sun-CgSsJ8OX.js → Sun-0NoCfqDs.js} +1 -1
- package/dist/client/assets/{Tool01-B8RjIhe4.js → Tool01-CNtQXBy4.js} +1 -1
- package/dist/client/assets/{Trash01-CFncShuD.js → Trash01-UTo49HDl.js} +1 -1
- package/dist/client/assets/{User01-Bq8r53VC.js → User01-CVlz7odd.js} +1 -1
- package/dist/client/assets/{Users03-qD8JWxak.js → Users03-X35A5ADD.js} +1 -1
- package/dist/client/assets/{X-BNOerUAB.js → X-CeTLIvc6.js} +1 -1
- package/dist/client/assets/{XCircle-B-JS14_e.js → XCircle-DtPL7zg0.js} +1 -1
- package/dist/client/assets/{XClose-vOlmnMjZ.js → XClose-C2Cy4nwy.js} +1 -1
- package/dist/client/assets/{Zap-BPHOFmqu.js → Zap-D1n1nJno.js} +1 -1
- package/dist/client/assets/{ZapSquare-CX9zqrxv.js → ZapSquare-Wt7N_ZY-.js} +1 -1
- package/dist/client/assets/{accordion-DIyksd99.js → accordion-DPxobU6V.js} +1 -1
- package/dist/client/assets/{agent-icon-CLQAOsUE.js → agent-icon-rfR6G8ak.js} +1 -1
- package/dist/client/assets/{agents-list-D0BQglaf.js → agents-list-CSAgVNG9.js} +1 -1
- package/dist/client/assets/ai-providers-BWpsfrqy.js +1 -0
- package/dist/client/assets/{alert-dialog-BWduFhy-.js → alert-dialog-FP3uTtqS.js} +1 -1
- package/dist/client/assets/{auth-catchall-D-v4q1Qx.js → auth-catchall-x57v3jqK.js} +1 -1
- package/dist/client/assets/{automation-list-row-DPkrb87t.js → automation-list-row-DG25MDBi.js} +1 -1
- package/dist/client/assets/{automations-BCzY9gmM.js → automations-Dvzmj3cQ.js} +1 -1
- package/dist/client/assets/{avatar-C6HNjGDg.js → avatar-jxKfgW3P.js} +1 -1
- package/dist/client/assets/{badge-CZCn9Wwi.js → badge-DSbZ2xYh.js} +1 -1
- package/dist/client/assets/{brand-context-DcqBJ41j.js → brand-context-BnZBvexH.js} +1 -1
- package/dist/client/assets/{card-oNblR0HO.js → card-DxIIO9TM.js} +1 -1
- package/dist/client/assets/{chat-context-RcvBJBC7.js → chat-context-BFu5v0t2.js} +1 -1
- package/dist/client/assets/{checkbox-JSEUVCMB.js → checkbox-BC2-36Db.js} +1 -1
- package/dist/client/assets/{collection-detail-C5pV1mWu.js → collection-detail-CD-QyUWU.js} +1 -1
- package/dist/client/assets/{collection-display-button-DQSPcJBz.js → collection-display-button-C_CtGElp.js} +1 -1
- package/dist/client/assets/{collection-search-CLoorkFj.js → collection-search-C4byKAjw.js} +1 -1
- package/dist/client/assets/{collection-search-DGO6_1o7.js → collection-search-D4u3PzGA.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-P7sXgSq0.js → collection-table-wrapper-C_-94CeK.js} +1 -1
- package/dist/client/assets/{collection-tabs-6c5Oz0MD.js → collection-tabs-gMfs6Afq.js} +1 -1
- package/dist/client/assets/{collections-CcBlrCx6.js → collections-D7GHHPCg.js} +1 -1
- package/dist/client/assets/{command-C666DFpg.js → command-rz34Ys0W.js} +1 -1
- package/dist/client/assets/{connection-card-DbGlMaON.js → connection-card-B9DKOCXt.js} +1 -1
- package/dist/client/assets/{connection-detail-DOFWK_LZ.js → connection-detail-DsF7Nr0a.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-S9iwzj4v.js → connection-form-helpers-Dr9CZ_1s.js} +1 -1
- package/dist/client/assets/{connections-DZgnlfnc.js → connections-C8H8V7wn.js} +1 -1
- package/dist/client/assets/{constants-B22iOAkD.js → constants-DzBa_pVv.js} +1 -1
- package/dist/client/assets/{constants-DRQ2x-Dp.js → constants-ZacFr8c8.js} +1 -1
- package/dist/client/assets/{dialog-ReVTOuxu.js → dialog-DJXnl186.js} +1 -1
- package/dist/client/assets/{domain-settings-_aY4XST2.js → domain-settings-B6gsJfGm.js} +1 -1
- package/dist/client/assets/{drawer-BYHJ-8Om.js → drawer-CKRLj2vr.js} +1 -1
- package/dist/client/assets/{dropdown-menu-y8iKrNsS.js → dropdown-menu-BxJLGp-F.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-BxzD5223.js → dynamic-plugin-layout-EgA1-G6Q.js} +1 -1
- package/dist/client/assets/{empty-state-B4rhh1dc.js → empty-state-DP9kvNKh.js} +1 -1
- package/dist/client/assets/{empty-state-ByRM_QUo.js → empty-state-VyFb4d0_.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CbVt8VgN.js → extract-connection-data-DV87vwuC.js} +1 -1
- package/dist/client/assets/{features-BMKDqpeL.js → features-CKG88lyc.js} +1 -1
- package/dist/client/assets/{form-D8QDPjk9.js → form-Crn7uG02.js} +1 -1
- package/dist/client/assets/{general-WpQ82n-X.js → general-DN5VLZqF.js} +1 -1
- package/dist/client/assets/{index-D4IWA9IU.js → index-B3pJqV9Y.js} +2 -2
- package/dist/client/assets/{index-CgURykwj.js → index-B6JiqoZb.js} +1 -1
- package/dist/client/assets/index-B8vmm8Mh.js +1 -0
- package/dist/client/assets/{index-U5YmU8lc.js → index-BAGdGx2X.js} +1 -1
- package/dist/client/assets/{index-Bpod-O0_.js → index-BQYge0uD.js} +1 -1
- package/dist/client/assets/{index-BuLwXk3-.js → index-BUmhrApd.js} +15 -15
- package/dist/client/assets/{index-CPmmcxsi.js → index-Bw6Vawnl.js} +1 -1
- package/dist/client/assets/{index-BET8kMZe.js → index-C7apxcAd.js} +1 -1
- package/dist/client/assets/{index-CTWz6nN8.js → index-CD0IZENy.js} +1 -1
- package/dist/client/assets/{index-Bi-e-UKp.js → index-Cg6ppcFr.js} +1 -1
- package/dist/client/assets/{index-D9Q6YnJH.js → index-Crppsl-8.js} +1 -1
- package/dist/client/assets/{index-CeC26NPv.js → index-DMLydKBU.js} +1 -1
- package/dist/client/assets/{index-Cf5saV1q.js → index-DPV7Oao4.js} +1 -1
- package/dist/client/assets/{index-DXXI9MyH.js → index-DkUpgHdS.js} +1 -1
- package/dist/client/assets/{index-DBj2qw-o.js → index-Dql_sPLp.js} +1 -1
- package/dist/client/assets/{index-D8dvMQZl.js → index-vUSuyfsm.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-ClYEJj89.js → infiniteQueryObserver-FXpIkCb9.js} +1 -1
- package/dist/client/assets/{input-DhXllgVP.js → input-DylFJb_s.js} +1 -1
- package/dist/client/assets/{integration-icon-CNQIPioy.js → integration-icon-BrsREj94.js} +1 -1
- package/dist/client/assets/{label-BDcPRk17.js → label-BMcf8C3G.js} +1 -1
- package/dist/client/assets/{layout-DBK70FJ7.js → layout-Dp2Exmc7.js} +1 -1
- package/dist/client/assets/{lean-canvas-recruit-modal-Cosr7uB6.js → lean-canvas-recruit-modal-DrBzPrQ5.js} +1 -1
- package/dist/client/assets/{login-uRApKgz7.js → login-B4OITSYv.js} +1 -1
- package/dist/client/assets/{members-CgYS1Zxe.js → members-CyDwQ7ZL.js} +1 -1
- package/dist/client/assets/{monaco-editor-D34bkcWL.js → monaco-editor-CQLG9APn.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-Rw8mxMr8.js → monitoring-stats-row-Mv3iWLF5.js} +1 -1
- package/dist/client/assets/{oauth-callback-DLWU7IjL.js → oauth-callback-D86cP5gF.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-5FDIcGBj.js → oauth-callback-ai-provider-B2xTvzHM.js} +1 -1
- package/dist/client/assets/{onboarding-jyaCV8uq.js → onboarding-BVoZJerk.js} +1 -1
- package/dist/client/assets/{org-layout-DxW3YApR.js → org-layout-DvQadC0N.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-B-uqLn5y.js → org-plugin-layout-CZcCVNv6.js} +1 -1
- package/dist/client/assets/{pair-CM7Z5dgt.js → pair-D0CyaFmX.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-C-o1hhqY.js → plugin-empty-state-BYazHRIg.js} +1 -1
- package/dist/client/assets/{plugin-header-BTFD2Tcj.js → plugin-header-BNYKRXC9.js} +1 -1
- package/dist/client/assets/{plugin-layout-BiJEtvKW.js → plugin-layout-BWoK3Wuc.js} +1 -1
- package/dist/client/assets/{popover-DQq9bf6V.js → popover-CUnDbgJ2.js} +1 -1
- package/dist/client/assets/{profile-PICkTEdT.js → profile-CzybNlff.js} +1 -1
- package/dist/client/assets/{project-app-view-B1QcPr4W.js → project-app-view-CJwFT9Ix.js} +1 -1
- package/dist/client/assets/registry-Dfum406p.js +2 -0
- package/dist/client/assets/{registry-layout-DGmSzwah.js → registry-layout-DRAqgrZS.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CfAoaltR.js → required-auth-layout-BqWuvVf2.js} +1 -1
- package/dist/client/assets/{reset-password-NMO08kVP.js → reset-password-kytluBmt.js} +1 -1
- package/dist/client/assets/{roles-CCaqodZQ.js → roles-Ds1RHbZR.js} +1 -1
- package/dist/client/assets/{scroll-area-AhoYMTSF.js → scroll-area-3cZxZboM.js} +1 -1
- package/dist/client/assets/{search-input-BSmmjMtR.js → search-input-BmVPc4RV.js} +1 -1
- package/dist/client/assets/{select-dTphD0ES.js → select-FyLwzc48.js} +1 -1
- package/dist/client/assets/{select-model-D2H_jWcd.js → select-model-67avCsXE.js} +1 -1
- package/dist/client/assets/{settings-layout-Bn3d6rRU.js → settings-layout-BqPzbZI_.js} +1 -1
- package/dist/client/assets/{settings-section-DkPpouMA.js → settings-section-XEp6UNJA.js} +1 -1
- package/dist/client/assets/{shell-layout-DLX5f9iI.js → shell-layout-BiL6-6W9.js} +1 -1
- package/dist/client/assets/{skeleton-DCMX-VkN.js → skeleton-BWYBZf7m.js} +1 -1
- package/dist/client/assets/{sso-BeQadTWm.js → sso-CuSDTfdG.js} +1 -1
- package/dist/client/assets/{store-D-lrayyv.js → store-CHGpyb-m.js} +1 -1
- package/dist/client/assets/store-registry-BtOOqHJ7.js +2 -0
- package/dist/client/assets/{switch-D9uEYoPa.js → switch-BL_ICveF.js} +1 -1
- package/dist/client/assets/{table-BIcJswmk.js → table-Cri7VAeb.js} +1 -1
- package/dist/client/assets/{tabs-Bbs5xG17.js → tabs-DGNL4gIl.js} +1 -1
- package/dist/client/assets/{task-status-1zFON5T4.js → task-status-BsVHYvla.js} +1 -1
- package/dist/client/assets/{textarea-BMU9fnHG.js → textarea-B1YgZKSW.js} +1 -1
- package/dist/client/assets/{toggle-group-juphd3c4.js → toggle-group-cD20__YI.js} +1 -1
- package/dist/client/assets/{tools-list-BP78dRI3.js → tools-list-B1QLvdRl.js} +1 -1
- package/dist/client/assets/{tooltip-B5FrLY14.js → tooltip-DZIo6YZX.js} +1 -1
- package/dist/client/assets/{types-DmM_J5U9.js → types-PzC3rVhv.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CVAGId9e.js → use-ai-providers-Dsmx4U8L.js} +1 -1
- package/dist/client/assets/{use-collections-DKWG5Tun.js → use-collections-DcamXjGg.js} +1 -1
- package/dist/client/assets/{use-connection-Dy5vq_5j.js → use-connection-CesZaYzK.js} +1 -1
- package/dist/client/assets/{use-copy-BSYEct5q.js → use-copy-Chq89Uhn.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-ifW0Pllw.js → use-create-virtual-mcp-B0T0urBu.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-DVXCv4R8.js → use-decopilot-events-BCUB3DhH.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CRe3MUPe.js → use-delete-connection-CqpWV7PJ.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-4DQHfv5o.js → use-infinite-scroll-D6FvdXof.js} +1 -1
- package/dist/client/assets/{use-list-state-CihFBhY3.js → use-list-state-D_NiaDpI.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-Bog3rGRX.js → use-mcp-tools-oIEGFyCT.js} +1 -1
- package/dist/client/assets/{use-members-eWVl2b1I.js → use-members-C3jq0flu.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent--7ajKHhy.js → use-navigate-to-agent-DNFfIi8H.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-C-BGwXKo.js → use-org-auth-client-BniQTMze.js} +1 -1
- package/dist/client/assets/{use-org-sso-2mlDJ8c4.js → use-org-sso-SjyAvOWA.js} +1 -1
- package/dist/client/assets/{use-organization-roles-PByiiFjp.js → use-organization-roles-CLHZHSel.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DngIHmBy.js → use-organization-settings-C8pMgrh-.js} +1 -1
- package/dist/client/assets/{use-registry-connections-CDM-gpri.js → use-registry-connections-CPKTZHrX.js} +1 -1
- package/dist/client/assets/{use-status-sounds-BzXaoVC8.js → use-status-sounds-BYyaVEdO.js} +1 -1
- package/dist/client/assets/{use-tasks-M1RmMNT7.js → use-tasks-D-yLjF43.js} +1 -1
- package/dist/client/assets/{use-view-mode-DRDlksJe.js → use-view-mode-C06qcP9p.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CDCK02Yj.js → use-virtual-mcp-CEUQCho1.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-ANrroW8x.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-CgFHp-eh.js +1 -0
- package/dist/client/assets/{user-WYGHhGxH.js → user-DlFqYjZ6.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-CK1VLDTo.js → view-mode-toggle-CiYPbOW7.js} +1 -1
- package/dist/client/assets/{workflow-DkcKupEW.js → workflow-CYF9ayPN.js} +1 -1
- package/dist/client/assets/workflow-detail-DVsv_zWc.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +387 -387
- package/dist/server/node_modules/get-east-asian-width/index.d.ts +60 -0
- package/dist/server/node_modules/get-east-asian-width/index.js +30 -0
- package/dist/server/node_modules/get-east-asian-width/lookup-data.js +18 -0
- package/dist/server/node_modules/get-east-asian-width/lookup.js +135 -0
- package/dist/server/node_modules/get-east-asian-width/package.json +71 -0
- package/dist/server/node_modules/get-east-asian-width/readme.md +65 -0
- package/dist/server/node_modules/get-east-asian-width/utilities.js +24 -0
- package/dist/server/node_modules/is-unicode-supported/index.d.ts +12 -0
- package/dist/server/node_modules/is-unicode-supported/index.js +21 -0
- package/dist/server/node_modules/{slice-ansi → is-unicode-supported}/license +0 -1
- package/dist/server/node_modules/is-unicode-supported/package.json +47 -0
- package/dist/server/node_modules/is-unicode-supported/readme.md +35 -0
- package/dist/server/node_modules/pg/README.md +95 -0
- package/dist/server/node_modules/pg/esm/index.mjs +20 -0
- package/dist/server/node_modules/pg/lib/client.js +743 -0
- package/dist/server/node_modules/pg/lib/connection-parameters.js +171 -0
- package/dist/server/node_modules/pg/lib/connection.js +221 -0
- package/dist/server/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
- package/dist/server/node_modules/pg/lib/crypto/sasl.js +212 -0
- package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +43 -0
- package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +89 -0
- package/dist/server/node_modules/pg/lib/crypto/utils.js +9 -0
- package/dist/server/node_modules/pg/lib/defaults.js +91 -0
- package/dist/server/node_modules/pg/lib/index.js +73 -0
- package/dist/server/node_modules/pg/lib/native/client.js +323 -0
- package/dist/server/node_modules/pg/lib/native/index.js +2 -0
- package/dist/server/node_modules/pg/lib/native/query.js +165 -0
- package/dist/server/node_modules/pg/lib/query.js +252 -0
- package/dist/server/node_modules/pg/lib/result.js +109 -0
- package/dist/server/node_modules/pg/lib/stream.js +83 -0
- package/dist/server/node_modules/pg/lib/type-overrides.js +35 -0
- package/dist/server/node_modules/pg/lib/utils.js +217 -0
- package/dist/server/node_modules/pg/package.json +76 -0
- package/dist/server/node_modules/restore-cursor/index.d.ts +11 -0
- package/dist/server/node_modules/restore-cursor/index.js +11 -0
- package/dist/server/node_modules/restore-cursor/license +9 -0
- package/dist/server/node_modules/restore-cursor/package.json +55 -0
- package/dist/server/node_modules/restore-cursor/readme.md +31 -0
- package/dist/server/node_modules/string-width/index.d.ts +39 -0
- package/dist/server/node_modules/string-width/index.js +82 -0
- package/dist/server/node_modules/string-width/license +9 -0
- package/dist/server/node_modules/string-width/package.json +64 -0
- package/dist/server/node_modules/string-width/readme.md +66 -0
- package/dist/server/node_modules/strip-ansi/index.d.ts +15 -0
- package/dist/server/node_modules/strip-ansi/index.js +19 -0
- package/dist/server/node_modules/strip-ansi/license +9 -0
- package/dist/server/node_modules/{ansi-regex → strip-ansi}/package.json +18 -20
- package/dist/server/node_modules/strip-ansi/readme.md +37 -0
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-BnclkXxt.js +0 -1
- package/dist/client/assets/index-BB2bR64l.js +0 -1
- package/dist/client/assets/registry-Dr9Q687k.js +0 -2
- package/dist/client/assets/store-registry-dKQp57q_.js +0 -2
- package/dist/client/assets/useInfiniteQuery-DtJBa4_2.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-G-zitmER.js +0 -1
- package/dist/client/assets/workflow-detail-BtHvU2Pd.js +0 -1
- package/dist/server/node_modules/ansi-regex/index.d.ts +0 -33
- package/dist/server/node_modules/ansi-regex/index.js +0 -14
- package/dist/server/node_modules/ansi-regex/readme.md +0 -66
- package/dist/server/node_modules/convert-to-spaces/dist/index.d.ts +0 -2
- package/dist/server/node_modules/convert-to-spaces/dist/index.js +0 -4
- package/dist/server/node_modules/convert-to-spaces/license +0 -21
- package/dist/server/node_modules/convert-to-spaces/package.json +0 -40
- package/dist/server/node_modules/convert-to-spaces/readme.md +0 -39
- package/dist/server/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
- package/dist/server/node_modules/emoji-regex/README.md +0 -107
- package/dist/server/node_modules/emoji-regex/index.d.ts +0 -3
- package/dist/server/node_modules/emoji-regex/index.js +0 -4
- package/dist/server/node_modules/emoji-regex/index.mjs +0 -4
- package/dist/server/node_modules/emoji-regex/package.json +0 -45
- package/dist/server/node_modules/pg-cloudflare/README.md +0 -112
- package/dist/server/node_modules/pg-cloudflare/dist/empty.d.ts +0 -2
- package/dist/server/node_modules/pg-cloudflare/dist/empty.js +0 -6
- package/dist/server/node_modules/pg-cloudflare/dist/empty.js.map +0 -1
- package/dist/server/node_modules/pg-cloudflare/dist/index.d.ts +0 -31
- package/dist/server/node_modules/pg-cloudflare/dist/index.js +0 -152
- package/dist/server/node_modules/pg-cloudflare/dist/index.js.map +0 -1
- package/dist/server/node_modules/pg-cloudflare/esm/index.mjs +0 -3
- package/dist/server/node_modules/pg-cloudflare/package.json +0 -39
- package/dist/server/node_modules/pg-cloudflare/src/empty.ts +0 -3
- package/dist/server/node_modules/pg-cloudflare/src/index.ts +0 -166
- package/dist/server/node_modules/pg-cloudflare/src/types.d.ts +0 -25
- package/dist/server/node_modules/pg-connection-string/LICENSE +0 -21
- package/dist/server/node_modules/pg-connection-string/README.md +0 -105
- package/dist/server/node_modules/pg-connection-string/esm/index.mjs +0 -8
- package/dist/server/node_modules/pg-connection-string/index.d.ts +0 -36
- package/dist/server/node_modules/pg-connection-string/index.js +0 -231
- package/dist/server/node_modules/pg-connection-string/package.json +0 -52
- package/dist/server/node_modules/pg-int8/LICENSE +0 -13
- package/dist/server/node_modules/pg-int8/README.md +0 -16
- package/dist/server/node_modules/pg-int8/index.js +0 -100
- package/dist/server/node_modules/pg-int8/package.json +0 -24
- package/dist/server/node_modules/pg-protocol/LICENSE +0 -21
- package/dist/server/node_modules/pg-protocol/README.md +0 -3
- package/dist/server/node_modules/pg-protocol/dist/b.d.ts +0 -1
- package/dist/server/node_modules/pg-protocol/dist/b.js +0 -23
- package/dist/server/node_modules/pg-protocol/dist/b.js.map +0 -1
- package/dist/server/node_modules/pg-protocol/dist/buffer-reader.d.ts +0 -15
- package/dist/server/node_modules/pg-protocol/dist/buffer-reader.js +0 -55
- package/dist/server/node_modules/pg-protocol/dist/buffer-reader.js.map +0 -1
- package/dist/server/node_modules/pg-protocol/dist/buffer-writer.d.ts +0 -16
- package/dist/server/node_modules/pg-protocol/dist/buffer-writer.js +0 -81
- package/dist/server/node_modules/pg-protocol/dist/buffer-writer.js.map +0 -1
- package/dist/server/node_modules/pg-protocol/dist/inbound-parser.test.d.ts +0 -1
- package/dist/server/node_modules/pg-protocol/dist/inbound-parser.test.js +0 -530
- package/dist/server/node_modules/pg-protocol/dist/inbound-parser.test.js.map +0 -1
- package/dist/server/node_modules/pg-protocol/dist/index.d.ts +0 -6
- package/dist/server/node_modules/pg-protocol/dist/index.js +0 -15
- package/dist/server/node_modules/pg-protocol/dist/index.js.map +0 -1
- package/dist/server/node_modules/pg-protocol/dist/messages.d.ts +0 -162
- package/dist/server/node_modules/pg-protocol/dist/messages.js +0 -160
- package/dist/server/node_modules/pg-protocol/dist/messages.js.map +0 -1
- package/dist/server/node_modules/pg-protocol/dist/outbound-serializer.test.d.ts +0 -1
- package/dist/server/node_modules/pg-protocol/dist/outbound-serializer.test.js +0 -252
- package/dist/server/node_modules/pg-protocol/dist/outbound-serializer.test.js.map +0 -1
- package/dist/server/node_modules/pg-protocol/dist/parser.d.ts +0 -24
- package/dist/server/node_modules/pg-protocol/dist/parser.js +0 -324
- package/dist/server/node_modules/pg-protocol/dist/parser.js.map +0 -1
- package/dist/server/node_modules/pg-protocol/dist/serializer.d.ts +0 -42
- package/dist/server/node_modules/pg-protocol/dist/serializer.js +0 -189
- package/dist/server/node_modules/pg-protocol/dist/serializer.js.map +0 -1
- package/dist/server/node_modules/pg-protocol/esm/index.js +0 -11
- package/dist/server/node_modules/pg-protocol/package.json +0 -45
- package/dist/server/node_modules/pg-protocol/src/b.ts +0 -25
- package/dist/server/node_modules/pg-protocol/src/buffer-reader.ts +0 -58
- package/dist/server/node_modules/pg-protocol/src/buffer-writer.ts +0 -85
- package/dist/server/node_modules/pg-protocol/src/inbound-parser.test.ts +0 -575
- package/dist/server/node_modules/pg-protocol/src/index.ts +0 -11
- package/dist/server/node_modules/pg-protocol/src/messages.ts +0 -262
- package/dist/server/node_modules/pg-protocol/src/outbound-serializer.test.ts +0 -276
- package/dist/server/node_modules/pg-protocol/src/parser.ts +0 -413
- package/dist/server/node_modules/pg-protocol/src/serializer.ts +0 -274
- package/dist/server/node_modules/pg-protocol/src/testing/buffer-list.ts +0 -67
- package/dist/server/node_modules/pg-protocol/src/testing/test-buffers.ts +0 -166
- package/dist/server/node_modules/pg-protocol/src/types/chunky.d.ts +0 -1
- package/dist/server/node_modules/pg-types/.travis.yml +0 -7
- package/dist/server/node_modules/pg-types/Makefile +0 -14
- package/dist/server/node_modules/pg-types/README.md +0 -75
- package/dist/server/node_modules/pg-types/index.d.ts +0 -137
- package/dist/server/node_modules/pg-types/index.js +0 -47
- package/dist/server/node_modules/pg-types/index.test-d.ts +0 -21
- package/dist/server/node_modules/pg-types/lib/arrayParser.js +0 -11
- package/dist/server/node_modules/pg-types/lib/binaryParsers.js +0 -257
- package/dist/server/node_modules/pg-types/lib/builtins.js +0 -73
- package/dist/server/node_modules/pg-types/lib/textParsers.js +0 -215
- package/dist/server/node_modules/pg-types/package.json +0 -42
- package/dist/server/node_modules/pg-types/test/index.js +0 -24
- package/dist/server/node_modules/pg-types/test/types.js +0 -597
- package/dist/server/node_modules/pgpass/README.md +0 -74
- package/dist/server/node_modules/pgpass/lib/helper.js +0 -233
- package/dist/server/node_modules/pgpass/lib/index.js +0 -23
- package/dist/server/node_modules/pgpass/package.json +0 -41
- package/dist/server/node_modules/postgres-array/index.d.ts +0 -4
- package/dist/server/node_modules/postgres-array/index.js +0 -97
- package/dist/server/node_modules/postgres-array/license +0 -21
- package/dist/server/node_modules/postgres-array/package.json +0 -35
- package/dist/server/node_modules/postgres-array/readme.md +0 -43
- package/dist/server/node_modules/postgres-bytea/index.js +0 -33
- package/dist/server/node_modules/postgres-bytea/license +0 -21
- package/dist/server/node_modules/postgres-bytea/package.json +0 -34
- package/dist/server/node_modules/postgres-bytea/readme.md +0 -34
- package/dist/server/node_modules/postgres-date/index.js +0 -116
- package/dist/server/node_modules/postgres-date/license +0 -21
- package/dist/server/node_modules/postgres-date/package.json +0 -33
- package/dist/server/node_modules/postgres-date/readme.md +0 -49
- package/dist/server/node_modules/postgres-interval/index.d.ts +0 -20
- package/dist/server/node_modules/postgres-interval/index.js +0 -125
- package/dist/server/node_modules/postgres-interval/license +0 -21
- package/dist/server/node_modules/postgres-interval/package.json +0 -36
- package/dist/server/node_modules/postgres-interval/readme.md +0 -48
- package/dist/server/node_modules/slice-ansi/index.d.ts +0 -19
- package/dist/server/node_modules/slice-ansi/index.js +0 -260
- package/dist/server/node_modules/slice-ansi/package.json +0 -59
- package/dist/server/node_modules/slice-ansi/readme.md +0 -54
- package/dist/server/node_modules/slice-ansi/tokenize-ansi.js +0 -752
- package/dist/server/node_modules/split2/LICENSE +0 -13
- package/dist/server/node_modules/split2/README.md +0 -85
- package/dist/server/node_modules/split2/bench.js +0 -27
- package/dist/server/node_modules/split2/index.js +0 -141
- package/dist/server/node_modules/split2/package.json +0 -39
- package/dist/server/node_modules/split2/test.js +0 -409
- /package/dist/server/node_modules/{ansi-regex → get-east-asian-width}/license +0 -0
- /package/dist/server/node_modules/{pg-cloudflare → pg}/LICENSE +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{cj as ne,e as _,j as o,B as te,l as ln,bc as ze,ck as ms,r as T,s as oe,c as O,g as ps,o as cn,c5 as xs,a7 as hs,a8 as fe,aW as an,c6 as gs,aT as bs,c4 as Ss,c7 as un,b6 as js,cd as ys,ce as vs,ae as ws,cf as Ns,cl as $t,cm as dn,x as ks,y as _s,cn as Cs,co as Is}from"./index-D4IWA9IU.js";import{D as Ts,F as Es,B as $s}from"./index-CPmmcxsi.js";import{a as Fe,i as Os,u as ae}from"./constants-B22iOAkD.js";import{b as fn}from"./use-virtual-mcp-CDCK02Yj.js";import{M as Re}from"./monaco-editor-D34bkcWL.js";import{A as Rs,c as Ms,a as Ls,b as Ps,e as As,R as Ut,d as zs}from"./accordion-DIyksd99.js";import{B as le}from"./badge-CZCn9Wwi.js";import{c as vt,S as wt,d as nt,b as Nt,a as kt}from"./select-dTphD0ES.js";import{N as Ws,h as Ds,j as Fs,m as Be,P as Hs,i as Vs,R as Us,c as qs,k as Ks,e as qt,d as Bs,S as st}from"./index-Bi-e-UKp.js";import{V as Xs}from"./view-mode-toggle-CK1VLDTo.js";import{aa as Js,ab as Gs,i as Qs,a2 as mn,ac as Ys,Q as Zs,r as eo,ad as pn,Z as to,V as xn,ae as no,af as so,T as bt,ag as oo}from"./agent-icon-CLQAOsUE.js";import{i as hn}from"./Play-BGW505UY.js";import{b as ro,a as io,V as Qe}from"./layout-DBK70FJ7.js";import{c as gn,T as bn,a as Sn,b as jn}from"./tooltip-B5FrLY14.js";import{u as lo,a as co}from"./use-connection-Dy5vq_5j.js";import{u as Ot,d as Rt,b as yn}from"./use-mcp-tools-Bog3rGRX.js";import{c as ao,d as uo,e as fo,D as mo,a as po,b as xo}from"./dialog-ReVTOuxu.js";import"./index-CeC26NPv.js";import{S as ho}from"./index-D8dvMQZl.js";import{D as vn,a as wn,b as Nn,c as Ye}from"./dropdown-menu-y8iKrNsS.js";import{s as go}from"./Plus-DlISHBLe.js";import{b as kn}from"./Tool01-B8RjIhe4.js";import{i as He}from"./ChevronDown-_b59faTm.js";import{s as Mt}from"./XClose-vOlmnMjZ.js";import{I as Lt}from"./integration-icon-CNQIPioy.js";import{a as bo,S as So}from"./scroll-area-AhoYMTSF.js";import"./index-U5YmU8lc.js";import{i as _n}from"./X-BNOerUAB.js";import{u as Cn,a as jo}from"./use-collections-DKWG5Tun.js";import{E as In}from"./empty-state-ByRM_QUo.js";import{c as yo}from"./create-sse-subscription-CxkOgzKf.js";import{I as Kt}from"./input-DhXllgVP.js";const Tn=ne("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const En=ne("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const ot=ne("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const rt=ne("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const vo=ne("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const $n=ne("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const wo=ne("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const On=ne("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const Rn=ne("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const Mn=ne("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const No=ne("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);const Ln=ne("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Pn=ne("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const ko=ne("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const An=ne("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);function _o(t){const e=_.c(15),{onSave:n,onUndo:s,isDirty:i,isSaving:r,saveLabel:l,undoLabel:c}=t,a=l===void 0?"Save":l,u=c===void 0?"Undo":c;if(!i)return null;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Js,{size:14}),e[0]=d):d=e[0];let f;e[1]!==r||e[2]!==s||e[3]!==u?(f=o.jsxs(te,{variant:"outline",size:"sm",onClick:s,disabled:r,"aria-label":u,children:[d,u]}),e[1]=r,e[2]=s,e[3]=u,e[4]=f):f=e[4];let m;e[5]!==r?(m=r?o.jsx(ln,{size:14,className:"animate-spin"}):o.jsx(Gs,{size:14}),e[5]=r,e[6]=m):m=e[6];let x;e[7]!==r||e[8]!==n||e[9]!==a||e[10]!==m?(x=o.jsxs(te,{variant:"default",size:"sm",onClick:n,disabled:r,"aria-label":a,children:[m,a]}),e[7]=r,e[8]=n,e[9]=a,e[10]=m,e[11]=x):x=e[11];let p;return e[12]!==f||e[13]!==x?(p=o.jsxs(o.Fragment,{children:[f,x]}),e[12]=f,e[13]=x,e[14]=p):p=e[14],p}const Bt=t=>{let e;const n=new Set,s=(u,d)=>{const f=typeof u=="function"?u(e):u;if(!Object.is(f,e)){const m=e;e=d??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(x=>x(e,m))}},i=()=>e,c={setState:s,getState:i,getInitialState:()=>a,subscribe:u=>(n.add(u),()=>n.delete(u))},a=e=t(s,i,c);return c},Pt=(t=>t?Bt(t):Bt),Co=t=>t;function _t(t,e=Co){const n=ze.useSyncExternalStore(t.subscribe,ze.useCallback(()=>e(t.getState()),[t,e]),ze.useCallback(()=>e(t.getInitialState()),[t,e]));return ze.useDebugValue(n),n}const Io=t=>{const e=Pt(t),n=s=>_t(e,s);return Object.assign(n,e),n},To=(t=>Io);function zn(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var r;const l=a=>a===null?null:JSON.parse(a,void 0),c=(r=n.getItem(i))!=null?r:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,r)=>n.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>n.removeItem(i)}}const Ct=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Ct(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Ct(s)(n)}}}},Eo=(t,e)=>(n,s,i)=>{let r={storage:zn(()=>window.localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...e},l=!1,c=0;const a=new Set,u=new Set;let d=r.storage;if(!d)return t((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...g)},s,i);const f=()=>{const g=r.partialize({...s()});return d.setItem(r.name,{state:g,version:r.version})},m=i.setState;i.setState=(g,b)=>(m(g,b),f());const x=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>x;let p;const h=()=>{var g,b;if(!d)return;const j=++c;l=!1,a.forEach(y=>{var S;return y((S=s())!=null?S:x)});const v=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:x))||void 0;return Ct(d.getItem.bind(d))(r.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==r.version){if(r.migrate){const S=r.migrate(y.state,y.version);return S instanceof Promise?S.then(w=>[!0,w]):[!0,S]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,y.state];return[!1,void 0]}).then(y=>{var S;if(j!==c)return;const[w,N]=y;if(p=r.merge(N,(S=s())!=null?S:x),n(p,!0),w)return f()}).then(()=>{j===c&&(v?.(s(),void 0),p=s(),l=!0,u.forEach(y=>y(p)))}).catch(y=>{j===c&&v?.(void 0,y)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(d=g.storage)},clearStorage:()=>{d?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(u.add(g),()=>{u.delete(g)})},r.skipHydration||h(),p||x},Wn=Eo,{useSyncExternalStoreWithSelector:$o}=ms,Oo=t=>t;function Ro(t,e=Oo,n){const s=$o(t.subscribe,t.getState,t.getInitialState,e,n);return ze.useDebugValue(s),s}const Xt=t=>Symbol.iterator in t,Jt=t=>"entries"in t,Gt=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),s=e instanceof Map?e:new Map(e.entries());if(n.size!==s.size)return!1;for(const[i,r]of n)if(!s.has(i)||!Object.is(r,s.get(i)))return!1;return!0},Mo=(t,e)=>{const n=t[Symbol.iterator](),s=e[Symbol.iterator]();let i=n.next(),r=s.next();for(;!i.done&&!r.done;){if(!Object.is(i.value,r.value))return!1;i=n.next(),r=s.next()}return!!i.done&&!!r.done};function Lo(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:Xt(t)&&Xt(e)?Jt(t)&&Jt(e)?Gt(t,e):Mo(t,e):Gt({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Dn(t,e="Output"){if(!t)return`interface ${e} {}`;function n(r){if(!r||typeof r!="object")return"unknown";const l=r.type;if(Array.isArray(l))return l.map(c=>s(c)).join(" | ");switch(l){case"string":return r.enum?r.enum.map(c=>`"${c}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const c=r.items;return c?`${n(c)}[]`:"unknown[]"}case"object":return i(r);default:return r.anyOf?r.anyOf.map(n).join(" | "):r.oneOf?r.oneOf.map(n).join(" | "):r.allOf?r.allOf.map(n).join(" & "):"unknown"}}function s(r){switch(r){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function i(r){const l=r.properties;if(!l)return"Record<string, unknown>";const c=new Set(r.required||[]);return`{
|
|
1
|
+
import{cj as ne,e as _,j as o,B as te,l as ln,bc as ze,ck as ms,r as T,s as oe,c as O,g as ps,o as cn,c5 as xs,a7 as hs,a8 as fe,aW as an,c6 as gs,aT as bs,c4 as Ss,c7 as un,b6 as js,cd as ys,ce as vs,ae as ws,cf as Ns,cl as $t,cm as dn,x as ks,y as _s,cn as Cs,co as Is}from"./index-B3pJqV9Y.js";import{D as Ts,F as Es,B as $s}from"./index-Bw6Vawnl.js";import{a as Fe,i as Os,u as ae}from"./constants-DzBa_pVv.js";import{b as fn}from"./use-virtual-mcp-CEUQCho1.js";import{M as Re}from"./monaco-editor-CQLG9APn.js";import{A as Rs,c as Ms,a as Ls,b as Ps,e as As,R as Ut,d as zs}from"./accordion-DPxobU6V.js";import{B as le}from"./badge-DSbZ2xYh.js";import{c as vt,S as wt,d as nt,b as Nt,a as kt}from"./select-FyLwzc48.js";import{N as Ws,h as Ds,j as Fs,m as Be,P as Hs,i as Vs,R as Us,c as qs,k as Ks,e as qt,d as Bs,S as st}from"./index-Cg6ppcFr.js";import{V as Xs}from"./view-mode-toggle-CiYPbOW7.js";import{aa as Js,ab as Gs,i as Qs,a2 as mn,ac as Ys,Q as Zs,r as eo,ad as pn,Z as to,V as xn,ae as no,af as so,T as bt,ag as oo}from"./agent-icon-rfR6G8ak.js";import{i as hn}from"./Play-DBJO09gj.js";import{b as ro,a as io,V as Qe}from"./layout-Dp2Exmc7.js";import{c as gn,T as bn,a as Sn,b as jn}from"./tooltip-DZIo6YZX.js";import{u as lo,a as co}from"./use-connection-CesZaYzK.js";import{u as Ot,d as Rt,b as yn}from"./use-mcp-tools-oIEGFyCT.js";import{c as ao,d as uo,e as fo,D as mo,a as po,b as xo}from"./dialog-DJXnl186.js";import"./index-DMLydKBU.js";import{S as ho}from"./index-vUSuyfsm.js";import{D as vn,a as wn,b as Nn,c as Ye}from"./dropdown-menu-BxJLGp-F.js";import{s as go}from"./Plus-D5DLeNpq.js";import{b as kn}from"./Tool01-CNtQXBy4.js";import{i as He}from"./ChevronDown-DTujp_Ze.js";import{s as Mt}from"./XClose-C2Cy4nwy.js";import{I as Lt}from"./integration-icon-BrsREj94.js";import{a as bo,S as So}from"./scroll-area-3cZxZboM.js";import"./index-BAGdGx2X.js";import{i as _n}from"./X-CeTLIvc6.js";import{u as Cn,a as jo}from"./use-collections-DcamXjGg.js";import{E as In}from"./empty-state-VyFb4d0_.js";import{c as yo}from"./create-sse-subscription-CxkOgzKf.js";import{I as Kt}from"./input-DylFJb_s.js";const Tn=ne("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const En=ne("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const ot=ne("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const rt=ne("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const vo=ne("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const $n=ne("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const wo=ne("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const On=ne("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const Rn=ne("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const Mn=ne("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const No=ne("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);const Ln=ne("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Pn=ne("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const ko=ne("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const An=ne("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);function _o(t){const e=_.c(15),{onSave:n,onUndo:s,isDirty:i,isSaving:r,saveLabel:l,undoLabel:c}=t,a=l===void 0?"Save":l,u=c===void 0?"Undo":c;if(!i)return null;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Js,{size:14}),e[0]=d):d=e[0];let f;e[1]!==r||e[2]!==s||e[3]!==u?(f=o.jsxs(te,{variant:"outline",size:"sm",onClick:s,disabled:r,"aria-label":u,children:[d,u]}),e[1]=r,e[2]=s,e[3]=u,e[4]=f):f=e[4];let m;e[5]!==r?(m=r?o.jsx(ln,{size:14,className:"animate-spin"}):o.jsx(Gs,{size:14}),e[5]=r,e[6]=m):m=e[6];let x;e[7]!==r||e[8]!==n||e[9]!==a||e[10]!==m?(x=o.jsxs(te,{variant:"default",size:"sm",onClick:n,disabled:r,"aria-label":a,children:[m,a]}),e[7]=r,e[8]=n,e[9]=a,e[10]=m,e[11]=x):x=e[11];let p;return e[12]!==f||e[13]!==x?(p=o.jsxs(o.Fragment,{children:[f,x]}),e[12]=f,e[13]=x,e[14]=p):p=e[14],p}const Bt=t=>{let e;const n=new Set,s=(u,d)=>{const f=typeof u=="function"?u(e):u;if(!Object.is(f,e)){const m=e;e=d??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(x=>x(e,m))}},i=()=>e,c={setState:s,getState:i,getInitialState:()=>a,subscribe:u=>(n.add(u),()=>n.delete(u))},a=e=t(s,i,c);return c},Pt=(t=>t?Bt(t):Bt),Co=t=>t;function _t(t,e=Co){const n=ze.useSyncExternalStore(t.subscribe,ze.useCallback(()=>e(t.getState()),[t,e]),ze.useCallback(()=>e(t.getInitialState()),[t,e]));return ze.useDebugValue(n),n}const Io=t=>{const e=Pt(t),n=s=>_t(e,s);return Object.assign(n,e),n},To=(t=>Io);function zn(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var r;const l=a=>a===null?null:JSON.parse(a,void 0),c=(r=n.getItem(i))!=null?r:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,r)=>n.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>n.removeItem(i)}}const Ct=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Ct(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Ct(s)(n)}}}},Eo=(t,e)=>(n,s,i)=>{let r={storage:zn(()=>window.localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...e},l=!1,c=0;const a=new Set,u=new Set;let d=r.storage;if(!d)return t((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...g)},s,i);const f=()=>{const g=r.partialize({...s()});return d.setItem(r.name,{state:g,version:r.version})},m=i.setState;i.setState=(g,b)=>(m(g,b),f());const x=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>x;let p;const h=()=>{var g,b;if(!d)return;const j=++c;l=!1,a.forEach(y=>{var S;return y((S=s())!=null?S:x)});const v=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:x))||void 0;return Ct(d.getItem.bind(d))(r.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==r.version){if(r.migrate){const S=r.migrate(y.state,y.version);return S instanceof Promise?S.then(w=>[!0,w]):[!0,S]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,y.state];return[!1,void 0]}).then(y=>{var S;if(j!==c)return;const[w,N]=y;if(p=r.merge(N,(S=s())!=null?S:x),n(p,!0),w)return f()}).then(()=>{j===c&&(v?.(s(),void 0),p=s(),l=!0,u.forEach(y=>y(p)))}).catch(y=>{j===c&&v?.(void 0,y)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(d=g.storage)},clearStorage:()=>{d?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(u.add(g),()=>{u.delete(g)})},r.skipHydration||h(),p||x},Wn=Eo,{useSyncExternalStoreWithSelector:$o}=ms,Oo=t=>t;function Ro(t,e=Oo,n){const s=$o(t.subscribe,t.getState,t.getInitialState,e,n);return ze.useDebugValue(s),s}const Xt=t=>Symbol.iterator in t,Jt=t=>"entries"in t,Gt=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),s=e instanceof Map?e:new Map(e.entries());if(n.size!==s.size)return!1;for(const[i,r]of n)if(!s.has(i)||!Object.is(r,s.get(i)))return!1;return!0},Mo=(t,e)=>{const n=t[Symbol.iterator](),s=e[Symbol.iterator]();let i=n.next(),r=s.next();for(;!i.done&&!r.done;){if(!Object.is(i.value,r.value))return!1;i=n.next(),r=s.next()}return!!i.done&&!!r.done};function Lo(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:Xt(t)&&Xt(e)?Jt(t)&&Jt(e)?Gt(t,e):Mo(t,e):Gt({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Dn(t,e="Output"){if(!t)return`interface ${e} {}`;function n(r){if(!r||typeof r!="object")return"unknown";const l=r.type;if(Array.isArray(l))return l.map(c=>s(c)).join(" | ");switch(l){case"string":return r.enum?r.enum.map(c=>`"${c}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const c=r.items;return c?`${n(c)}[]`:"unknown[]"}case"object":return i(r);default:return r.anyOf?r.anyOf.map(n).join(" | "):r.oneOf?r.oneOf.map(n).join(" | "):r.allOf?r.allOf.map(n).join(" & "):"unknown"}}function s(r){switch(r){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function i(r){const l=r.properties;if(!l)return"Record<string, unknown>";const c=new Set(r.required||[]);return`{
|
|
2
2
|
${Object.entries(l).map(([u,d])=>{const f=c.has(u)?"":"?";return`${d.description?` /** ${d.description} */
|
|
3
3
|
`:""} ${u}${f}: ${n(d)};`}).join(`
|
|
4
4
|
`)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as ue,b as Bt,u as ui,z as kn,C as Nn,j as n,B as J,x as ne,r as w,o as qt,f as ct,l as He,G as rn,F as on,t as $,K as ve,e as L,Q as Vi,R as mi,c as z,a as _n,g as fi,d as pi,H as dt,J as Dt,E as hi,P as Cn,ap as gi,n as In,y as ps,aq as xi,ar as hs,as as bi,at as De,au as an,ao as yi,av as vi,aw as ln,ax as wi,ay as ji,az as Ai,aA as Si,w as ki,aB as Ni,aC as _i,aD as Ci,aE as Ii,aF as zn}from"./index-D4IWA9IU.js";import{b as Me,a as Le,c as Fe,d as Ue,e as Kt,D as gs}from"./dialog-ReVTOuxu.js";import{S as Ri}from"./switch-D9uEYoPa.js";import{I as _e}from"./input-DhXllgVP.js";import{b as Rn,u as Ti}from"./use-connection-Dy5vq_5j.js";import{S as kt,u as qe,W as xs,g as Tn,i as Bn,c as Pi}from"./constants-B22iOAkD.js";import{a as Ei,u as Di}from"./lean-canvas-recruit-modal-Cosr7uB6.js";import{a as Pn}from"./use-navigate-to-agent--7ajKHhy.js";import{a as Mi,A as En,M as Li,N as bs,O as ys,o as Fi,P as Ui,Q as Oi,b as $i,R as zi,I as vs}from"./agent-icon-CLQAOsUE.js";import{t as Bi,b as Yt,u as Dn,a as qi,g as Ki,h as Yi,w as Wi,A as Gi,i as Qi,j as Hi}from"./chat-context-RcvBJBC7.js";import{b as Wt,a as Gt,c as Qt,D as Ht,d as Ji,e as Xi,f as Zi}from"./drawer-BYHJ-8Om.js";import{u as Jt,T as xt,a as bt,b as yt,c as xn}from"./tooltip-B5FrLY14.js";import{I as ws}from"./integration-icon-CNQIPioy.js";import{a as js,b as er,u as tr}from"./use-virtual-mcp-CDCK02Yj.js";import{u as nr}from"./use-tasks-M1RmMNT7.js";import{r as sr,i as ir}from"./shell-layout-DLX5f9iI.js";import{j as Xt,k as Ge,l as rr,s as Mn,t as or,m as ar,n as lr,o as cr,q as wt,u as dr,v as ur,c as Vr,S as mr,w as fr,x as qn}from"./pair-CM7Z5dgt.js";import{S as Mt,u as Zt,P as bn,a as pr,b as hr,c as gr,E as xr,i as br,d as yr}from"./index-Bi-e-UKp.js";import{C as As}from"./collection-search-CLoorkFj.js";import{u as vr,g as Ln,a as wr,c as jr,l as Lt}from"./tabs-Bbs5xG17.js";import{F as me,b as fe,c as Ne,d as pe,f as he,a as jt}from"./form-D8QDPjk9.js";import{c as Ee,e as cn,f as dn,D as Ss,a as ks,b as Ns,d as Ar}from"./dropdown-menu-y8iKrNsS.js";import{s as Sr,i as kr}from"./XClose-vOlmnMjZ.js";import{c as _s}from"./ZapSquare-CX9zqrxv.js";import{i as Xe,t as Kn}from"./ChevronDown-_b59faTm.js";import{s as lt}from"./Star01-Chns_B29.js";import{a as yn,t as Nr}from"./Tool01-B8RjIhe4.js";import{i as Cs}from"./Lock01-C5rgxGgu.js";import{s as Is}from"./Plus-DlISHBLe.js";import{f as un,d as Rs,t as _r,g as Cr,b as Ir}from"./XCircle-B-JS14_e.js";import{i as pt}from"./X-BNOerUAB.js";import{i as Ts}from"./AlertCircle-BeiDn4Fp.js";import{S as Ps,a as Es,b as Ds,c as Ms,d as ot}from"./select-dTphD0ES.js";import{i as Rr}from"./RefreshCcw01-Dbq2QLAC.js";import{T as Ls,a as Ft}from"./toggle-group-juphd3c4.js";import{u as Tr,a as Pr}from"./use-ai-providers-CVAGId9e.js";import{m as en,g as Er,i as Dr,a as Fs,M as Mr,N as Lr}from"./select-model-D2H_jWcd.js";import{S as Fr}from"./index-D8dvMQZl.js";import{r as Us,l as vt}from"./types-DmM_J5U9.js";import{p as Ur,q as Yn}from"./question-004-sINsf4GQ.js";import{g as Wn}from"./ai-providers-logos-DD3qZ33J.js";import{g as Or}from"./connection-slug-eyAPH6o3.js";import{u as Os,a as $s,g as $r,C as Vn}from"./connection-card-DbGlMaON.js";import{C as zr}from"./collection-tabs-6c5Oz0MD.js";import{g as Br}from"./constants-DRQ2x-Dp.js";import{T as qr}from"./textarea-BMU9fnHG.js";import{n as Pt}from"./Container-d8d36LPk.js";import{c as Kr,i as It,a as Gn,E as Yr,p as Wr,b as Gr,d as Qr}from"./connection-form-helpers-S9iwzj4v.js";import{u as Qn}from"./use-infinite-scroll-4DQHfv5o.js";import{u as Hr}from"./useSuspenseInfiniteQuery-G-zitmER.js";import{g as Jr,e as Xr,a as Zr}from"./extract-connection-data-CbVt8VgN.js";import{B as Rt}from"./badge-CZCn9Wwi.js";import{i as eo}from"./ChevronRight-DEybByBs.js";function to({open:t,onOpenChange:e,onCreated:s}){const{org:i}=ue(),{data:r}=Bt.useSession(),{stdioEnabled:o}=ui(),a=Jt(),d=Rn(),l=Os(),V=$s(l,"").items,c=kn({resolver:Nn(Kr),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),m=c.watch("ui_type"),p=c.watch("connection_url"),x=c.watch("npx_package"),g=It({uiType:m,connectionUrl:p??"",npxPackage:x??""})??Gn({uiType:m,connectionUrl:p??"",registryItems:V}),f=S=>{const v=S.trim();if(!v)return;const j=!!c.formState.dirtyFields.title,E=!!c.formState.dirtyFields.description,D=!!c.formState.dirtyFields.env_vars,I=k=>{if(k&&(!j&&!c.getValues("title").trim()&&k.title&&c.setValue("title",k.title,{shouldDirty:!1}),!E&&!(c.getValues("description")??"").trim()&&k.description&&c.setValue("description",k.description,{shouldDirty:!1}),!D&&k.envVarKeys?.length)){const N=c.getValues("env_vars")??[],R=new Set(N.map(T=>T.key)),M=k.envVarKeys.filter(T=>!R.has(T));M.length>0&&c.setValue("env_vars",[...N,...M.map(T=>({key:T,value:""}))],{shouldDirty:!0})}},P=Wr(v);if(P&&o){c.setValue("ui_type","NPX",{shouldDirty:!0}),c.setValue("npx_package",P.packageName,{shouldDirty:!0}),c.setValue("connection_url","",{shouldDirty:!0}),c.setValue("connection_token",null,{shouldDirty:!0}),I(It({uiType:"NPX",npxPackage:P.packageName}));return}if(v.startsWith("http://")||v.startsWith("https://")){const k=m==="HTTP"||m==="SSE"||m==="Websocket"?m:"HTTP";c.setValue("ui_type",k,{shouldDirty:!0}),c.setValue("connection_url",v,{shouldDirty:!0}),I(It({uiType:k,connectionUrl:v})??Gn({uiType:k,connectionUrl:v,registryItems:V}));return}m==="NPX"&&I(It({uiType:"NPX",npxPackage:v}))},b=S=>{S||c.reset(),e(S)},h=async S=>{let v,j=null,E=null,D=null;S.ui_type==="NPX"?(v="STDIO",j="",D=Gr(S.npx_package||"",S.env_vars||[])):S.ui_type==="STDIO"?(v="STDIO",j="",D=Qr(S.stdio_command||"",S.stdio_args||"",S.stdio_cwd,S.env_vars||[])):(v=S.ui_type,j=S.connection_url||"",E=S.connection_token||null);const I=Br("conn");try{await d.create.mutateAsync({id:I,title:S.title,description:S.description||null,connection_type:v,connection_url:j,connection_token:E,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:r?.user?.id||"system",organization_id:i.id,icon:S.icon??null,app_name:null,app_id:null,connection_headers:D,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),c.reset(),e(!1),s?.(I)}catch{ne.error("Failed to create connection")}},y="Create Connection",A="Create a custom connection in your organization. Fill in the details below.",_=c.formState.isSubmitting?"Saving...":"Create Connection",C=n.jsxs("div",{className:"grid gap-4",children:[n.jsx(me,{control:c.control,name:"ui_type",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Type *"}),n.jsxs(Ps,{value:S.value,onValueChange:S.onChange,children:[n.jsx(pe,{children:n.jsx(Es,{children:n.jsx(Ds,{})})}),n.jsxs(Ms,{children:[n.jsx(ot,{value:"HTTP",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(lt,{className:"w-4 h-4"}),"HTTP"]})}),n.jsx(ot,{value:"SSE",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(lt,{className:"w-4 h-4"}),"SSE"]})}),n.jsx(ot,{value:"Websocket",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(lt,{className:"w-4 h-4"}),"Websocket"]})}),o&&n.jsxs(n.Fragment,{children:[n.jsx(ot,{value:"NPX",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Pt,{className:"w-4 h-4"}),"NPX Package"]})}),n.jsx(ot,{value:"STDIO",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Mi,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),n.jsx(he,{})]})}),m==="NPX"&&n.jsx(me,{control:c.control,name:"npx_package",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"NPM Package *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"@perplexity-ai/mcp-server",...S,value:S.value??"",onPaste:v=>{const j=v.clipboardData.getData("text");j&&(v.preventDefault(),c.setValue("npx_package",j.trim(),{shouldDirty:!0}),f(j))},onBlur:v=>{f(v.target.value),S.onBlur()}})}),n.jsx(he,{})]})}),m==="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[n.jsx(me,{control:c.control,name:"stdio_command",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Command *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"node, bun, python...",...S,value:S.value??""})}),n.jsx(he,{})]})}),n.jsx(me,{control:c.control,name:"stdio_args",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Arguments"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"arg1 arg2 --flag value",...S,value:S.value??""})}),n.jsx(he,{})]})})]}),n.jsx(me,{control:c.control,name:"stdio_cwd",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Working Directory"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"/path/to/project (optional)",...S,value:S.value??""})}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),n.jsx(he,{})]})})]}),(m==="NPX"||m==="STDIO")&&n.jsx(me,{control:c.control,name:"env_vars",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Environment Variables"}),n.jsx(pe,{children:n.jsx(Yr,{value:S.value??[],onChange:S.onChange})}),n.jsx(he,{})]})}),m!=="NPX"&&m!=="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsx(me,{control:c.control,name:"connection_url",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"URL *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"https://example.com/mcp",...S,value:S.value??"",onPaste:v=>{const j=v.clipboardData.getData("text");j&&(v.preventDefault(),c.setValue("connection_url",j.trim(),{shouldDirty:!0}),f(j))},onBlur:v=>{f(v.target.value),S.onBlur()}})}),n.jsx(he,{})]})}),n.jsx(me,{control:c.control,name:"connection_token",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:g?.token?.label??"Token (optional)"}),n.jsx(pe,{children:n.jsx(_e,{type:"password",placeholder:g?.token?.placeholder??"Bearer token or API key",className:"ph-no-capture",...S,value:S.value??""})}),g?.token?.helperText&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.id==="github"&&n.jsxs(n.Fragment,{children:[" ","·"," ",n.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"})]})]}),n.jsx(he,{})]})})]}),n.jsx(me,{control:c.control,name:"title",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Name *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"My Connection",...S})}),n.jsx(he,{})]})}),n.jsx(me,{control:c.control,name:"description",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Description"}),n.jsx(pe,{children:n.jsx(qr,{placeholder:"A brief description of this connection",rows:3,...S,value:S.value??""})}),n.jsx(he,{})]})})]});return a?n.jsx(Wt,{open:t,onOpenChange:b,children:n.jsxs(Gt,{className:"max-h-[90vh]",children:[n.jsx(Qt,{className:"pb-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"flex-1 text-left",children:[n.jsx(Ht,{children:y}),n.jsx(Ji,{className:"mt-1",children:A})]}),n.jsx(Xi,{asChild:!0,children:n.jsx(J,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:n.jsx(Sr,{size:16})})})]})}),n.jsx(jt,{...c,children:n.jsxs("form",{onSubmit:c.handleSubmit(h),children:[n.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:C}),n.jsx(Zi,{children:n.jsx(J,{type:"submit",disabled:c.formState.isSubmitting,className:"w-full",children:_})})]})})]})}):n.jsx(Me,{open:t,onOpenChange:b,children:n.jsxs(Le,{className:"sm:max-w-[525px]",children:[n.jsxs(Fe,{children:[n.jsx(Ue,{children:y}),n.jsx(Kt,{children:A})]}),n.jsx(jt,{...c,children:n.jsxs("form",{onSubmit:c.handleSubmit(h),children:[n.jsx("div",{className:"py-4",children:C}),n.jsxs(gs,{children:[n.jsx(J,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),n.jsx(J,{type:"submit",disabled:c.formState.isSubmitting,className:"min-w-40",children:_})]})]})})]})})}function no(t){const e=L.c(73),{mode:s,agentId:i,addedConnectionIds:r,onAdd:o,onCloneAndAdd:a,onConnectAndAdd:d,connectingItemId:l,search:u,onCreateConnection:V,onBrowseNavigate:c,defaultTab:m}=t,p=s===void 0?"add":s,x=m===void 0?"connected":m,{org:g}=ue(),f=w.useDeferredValue(u),b=u!==f,h=f.trim().toLowerCase();let y;e[0]!==x?(y=U=>U??x,e[0]=x,e[1]=y):y=e[1];const[A,_]=Vi(mi.connectionsTab(g.slug)+(x==="all"?":home-modal":":agent-modal"),y);let C;e[2]!==A||e[3]!==_?(C=U=>{U!==A&&$("connections_dialog_tab_changed",{to_tab:U}),_(U)},e[2]=A,e[3]=_,e[4]=C):C=e[4];const S=C;let v;e[5]!==g.id||e[6]!==g.slug?(v={connectionId:kt,orgId:g.id,orgSlug:g.slug},e[5]=g.id,e[6]=g.slug,e[7]=v):v=e[7];const j=qe(v);let E,D,I;if(e[8]!==j||e[9]!==f||e[10]!==g.id){I=f?.trim()?{operator:"or",conditions:[{field:["title"],operator:"contains",value:f.trim()},{field:["description"],operator:"contains",value:f.trim()}]}:void 0;const U={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},X=JSON.stringify(U);D=Hr,E=ve.collectionListInfinite(j,g.id,"","CONNECTIONS",X),e[8]=j,e[9]=f,e[10]=g.id,e[11]=E,e[12]=D,e[13]=I}else E=e[11],D=e[12],I=e[13];let P;e[14]!==j||e[15]!==I?(P=async U=>{const{pageParam:X}=U,Se=X===void 0?0:X;return(await j.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:Se}})).structuredContent},e[14]=j,e[15]=I,e[16]=P):P=e[16];let k;e[17]!==E||e[18]!==P?(k={queryKey:E,queryFn:P,initialPageParam:0,getNextPageParam:lo,staleTime:3e4},e[17]=E,e[18]=P,e[19]=k):k=e[19];const{data:N,fetchNextPage:R,hasNextPage:M,isFetchingNextPage:T}=D(k),F=N?.pages.flatMap(ao)??[],O=$r(F),q=new Set(F.filter(oo).map(ro)),K=Os(),H=$s(K,f),Z=Qn(H.loadMore,H.hasMore,H.isLoadingMore),Q=Qn(R,M??!1,T),W=A==="all"||!!h,ie=W?H.items.filter(U=>{const X=Jr(U);if(X&&q.has(X))return!1;if(!h)return!0;const Se=U._meta?.["mcp.mesh"];return[U.title,U.description,U.name,U.server?.title,U.server?.description,U.server?.name,Se?.friendly_name,Se?.friendlyName].filter(Boolean).join(" ").toLowerCase().includes(h)}):[],Y=ie.filter(io),ee=ie.filter(so);let te;e[20]!==r?(te=U=>U.some(X=>r.has(X.id)),e[20]=r,e[21]=te):te=e[21];const se=te;let ae;e[22]!==r||e[23]!==i||e[24]!==l||e[25]!==se||e[26]!==p||e[27]!==o||e[28]!==c||e[29]!==a?(ae=(U,X,Se,ke,Te)=>{const ze=se(Te),Be=Te.find(Pe=>!r.has(Pe.id)),le=Te[0];if(p==="browse"){const Pe=Or(le);return n.jsx(Vn,{connection:{title:X,icon:Se,description:Te.length>1?`${Te.length} instances`:ke??void 0},fallbackIcon:n.jsx(Pt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(Xe,{size:11})," Connected"]}),onClick:()=>{$("connection_browse_clicked",{app_name:le.app_name??null,connection_id:le.id,instances_count:Te.length}),c?.(Pe)}},U)}return n.jsx(Vn,{connection:{title:X,icon:Se,description:ke},fallbackIcon:n.jsx(Pt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[ze&&n.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(Xe,{size:11})," Added"]}),n.jsx(J,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Pe=>{Pe.stopPropagation(),Be?($("connection_add_clicked",{action:"use_existing",app_name:le.app_name??null,connection_id:Be.id}),i&&$("agent_connection_attached",{agent_id:i,connection_id:Be.id,app_name:le.app_name??null,mode:"existing"}),o(Be.id)):($("connection_add_clicked",{action:"clone",app_name:le.app_name??null,base_connection_id:le.id}),a(le))},children:"Add"})]})},U)},e[22]=r,e[23]=i,e[24]=l,e[25]=se,e[26]=p,e[27]=o,e[28]=c,e[29]=a,e[30]=ae):ae=e[30];const re=ae;let oe;e[31]!==l||e[32]!==p||e[33]!==d?(oe=U=>{const X=U._meta?.["mcp.mesh"],Se=X?.friendlyName||X?.friendly_name||U.server?.title||U.title||U.server?.name||U.name||U.id||"",ke=U.server?.description||U.description||null,Te=U.server?.icons?.[0]?.src||Zr(U.server?.repository)||null,ze=X?.official===!0,Be=X?.verified===!0,le=X?.owner==="deco";return n.jsx(Vn,{connection:{title:Se,description:ke,icon:Te},fallbackIcon:n.jsx(Pt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[le&&n.jsxs(xt,{children:[n.jsx(bt,{asChild:!0,children:n.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:n.jsx("img",{src:"/logos/deco logo.svg",alt:"Made by Deco",className:"size-3"})})}),n.jsx(yt,{children:"Built and maintained by Deco"})]}),!le&&ze&&n.jsxs(xt,{children:[n.jsx(bt,{asChild:!0,children:n.jsx(Rt,{variant:"outline",size:"icon",children:n.jsx(un,{})})}),n.jsx(yt,{children:"Built and maintained by the official vendor"})]}),!le&&!ze&&Be&&n.jsxs(xt,{children:[n.jsx(bt,{asChild:!0,children:n.jsx(Rt,{variant:"outline",size:"icon",children:n.jsx(un,{})})}),n.jsx(yt,{children:"Verified by the Deco team"})]}),n.jsx(J,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Pe=>{Pe.stopPropagation(),$("connection_add_clicked",{action:"connect_new",registry_item_id:U.id,app_name:X?.friendlyName||U.server?.name||U.name||null}),d(U)},children:l===U.id?n.jsx(He,{size:14,className:"animate-spin"}):p==="browse"?"Connect":"Add"})]})},`catalog-${U.id}`)},e[31]=l,e[32]=p,e[33]=d,e[34]=oe):oe=e[34];const ce=oe,ge=!h&&n.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[n.jsx(zr,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:A,onTabChange:U=>S(U)}),n.jsxs(J,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{$("connections_dialog_custom_clicked"),V()},children:[n.jsx(Is,{size:12}),"Custom Connection"]})]}),G=b&&"opacity-50 pointer-events-none";let de;e[35]!==G?(de=z("flex-1 overflow-auto p-5 transition-opacity duration-150",G),e[35]=G,e[36]=de):de=e[36];const Ze="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let Oe;e[37]!==re?(Oe=U=>{if(U.type==="group")return re(U.key,U.title,U.icon,null,U.connections);const X=U.connection;return re(X.id,X.title,X.icon,X.description??null,[X])},e[37]=re,e[38]=Oe):Oe=e[38];const Ce=O.map(Oe);let xe;e[39]!==Q?(xe=n.jsx("div",{ref:Q,className:"col-span-full h-1"}),e[39]=Q,e[40]=xe):xe=e[40];let be;e[41]!==T?(be=T&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),e[41]=T,e[42]=be):be=e[42];const Ie=W&&Y.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx(un,{size:13,className:"text-muted-foreground shrink-0"}),n.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),n.jsx("div",{className:"flex-1 h-px bg-border"})]}),Ke=W&&Y.map(ce),Ve=W&&ee.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),n.jsx("div",{className:"flex-1 h-px bg-border"})]}),ut=W&&ee.map(ce);let we;e[43]!==Z||e[44]!==K||e[45]!==W?(we=W&&K.length>0&&n.jsx("div",{ref:Z,className:"col-span-full h-1"}),e[43]=Z,e[44]=K,e[45]=W,e[46]=we):we=e[46];let Re;e[47]!==H.isLoadingMore||e[48]!==W?(Re=W&&H.isLoadingMore&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),e[47]=H.isLoadingMore,e[48]=W,e[49]=Re):Re=e[49];let je;e[50]!==Ce||e[51]!==xe||e[52]!==be||e[53]!==Ie||e[54]!==Ke||e[55]!==Ve||e[56]!==ut||e[57]!==we||e[58]!==Re?(je=n.jsxs("div",{className:Ze,children:[Ce,xe,be,Ie,Ke,Ve,ut,we,Re]}),e[50]=Ce,e[51]=xe,e[52]=be,e[53]=Ie,e[54]=Ke,e[55]=Ve,e[56]=ut,e[57]=we,e[58]=Re,e[59]=je):je=e[59];let Ae;e[60]!==A||e[61]!==O.length||e[62]!==ee||e[63]!==u||e[64]!==Y?(Ae=O.length===0&&Y.length===0&&ee.length===0&&n.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:u?`No connections match "${u}"`:A==="connected"?"No connections yet":"No connections available"}),e[60]=A,e[61]=O.length,e[62]=ee,e[63]=u,e[64]=Y,e[65]=Ae):Ae=e[65];let ye;e[66]!==de||e[67]!==je||e[68]!==Ae?(ye=n.jsxs("div",{className:de,children:[je,Ae]}),e[66]=de,e[67]=je,e[68]=Ae,e[69]=ye):ye=e[69];let $e;return e[70]!==ge||e[71]!==ye?($e=n.jsxs(n.Fragment,{children:[ge,ye]}),e[70]=ge,e[71]=ye,e[72]=$e):$e=e[72],$e}function so(t){return!t.verified&&!t._meta?.["mcp.mesh"]?.verified&&!t.meta?.verified}function io(t){return t.verified||t._meta?.["mcp.mesh"]?.verified||t.meta?.verified}function ro(t){return t.app_name}function oo(t){return t.app_name}function ao(t){return t?.items??[]}function lo(t,e){if(t?.hasMore)return e.reduce(co,0)}function co(t,e){return t+(e?.items?.length??0)}function uo({open:t,onOpenChange:e,defaultTab:s,initialSearch:i="",...r}){const o=r.mode??"add",a="agentId"in r?r.agentId:void 0,d="addedConnectionIds"in r?r.addedConnectionIds??new Set:new Set,l="onAdd"in r&&r.onAdd?r.onAdd:v=>{},u=(v,j,E)=>{a&&$("agent_connection_attached",{agent_id:a,connection_id:v,app_name:j,mode:E})},[V,c]=w.useState(null),[m,p]=w.useState(i),[x,g]=w.useState(!1),{org:f}=ue(),{data:b}=Bt.useSession(),h=Rn(),y=qt(),A=ct(),_=v=>{e(!1),A({to:"/$org/settings/connections/$appSlug",params:{org:f.slug,appSlug:v}})},C=async v=>{c(v.app_name??v.id);try{const E=`${v.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,I=(await h.create.mutateAsync({title:E,description:v.description??null,connection_type:v.connection_type,connection_url:v.connection_url??null,connection_token:null,icon:v.icon??null,app_name:v.app_name??null,app_id:v.app_id??null,connection_headers:v.connection_headers??null})).id,P=new URL(`/api/${f.slug}/mcp/${I}`,window.location.origin),k=await rn({url:P.href,token:null,orgId:f.id});if(k.supportsOAuth&&!k.isAuthenticated){const{token:N,tokenInfo:R,error:M}=await on({connectionId:I,orgSlug:f.slug,scope:"offline_access"});if(M||!N){$("connection_oauth_failed",{connection_id:I,flow:"clone",error:M??"no_token"}),ne.error(`Authentication failed: ${M??"no token received"}`),await h.delete.mutateAsync(I);return}if($("connection_oauth_succeeded",{connection_id:I,flow:"clone"}),R)try{(await fetch(`/api/${f.slug}/connections/${I}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:R.accessToken,refreshToken:R.refreshToken,expiresIn:R.expiresIn,scope:R.scope,clientId:R.clientId,clientSecret:R.clientSecret,tokenEndpoint:R.tokenEndpoint})})).ok?await h.update.mutateAsync({id:I,data:{}}):await h.update.mutateAsync({id:I,data:{connection_token:N}})}catch{await h.update.mutateAsync({id:I,data:{connection_token:N}})}else await h.update.mutateAsync({id:I,data:{connection_token:N}});await y.invalidateQueries({queryKey:ve.isMCPAuthenticated(P.href,null)})}u(I,v.app_name??null,"clone"),l(I)}catch(j){console.error("Failed to add connection:",j),ne.error("Failed to add connection")}finally{c(null)}},S=async v=>{if(!(!f||!b?.user?.id)){c(v.id);try{const j=Xr(v,f.id,b.user.id,{remoteIndex:0}),E=j.connection_type==="STDIO",D=!!j.connection_url,I=E&&j.connection_headers&&typeof j.connection_headers=="object"&&"command"in j.connection_headers;if(!D&&!I){ne.error("This MCP Server cannot be connected: no connection method available"),c(null);return}const{id:P}=await h.create.mutateAsync(j),k=new URL(`/api/${f.slug}/mcp/${P}`,window.location.origin),N=await rn({url:k.href,token:null,orgId:f.id});if(N.supportsOAuth&&!N.isAuthenticated){const{token:R,tokenInfo:M,error:T}=await on({connectionId:P,orgSlug:f.slug,scope:"offline_access"});if(T||!R){$("connection_oauth_failed",{connection_id:P,flow:"connect_new",error:T??"no_token"}),ne.error(`Authentication failed: ${T??"no token received"}`),u(P,j.app_name??null,"new"),l(P);return}if($("connection_oauth_succeeded",{connection_id:P,flow:"connect_new"}),M)try{(await fetch(`/api/${f.slug}/connections/${P}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:M.accessToken,refreshToken:M.refreshToken,expiresIn:M.expiresIn,scope:M.scope,clientId:M.clientId,clientSecret:M.clientSecret,tokenEndpoint:M.tokenEndpoint})})).ok?await h.update.mutateAsync({id:P,data:{}}):await h.update.mutateAsync({id:P,data:{connection_token:R}})}catch{await h.update.mutateAsync({id:P,data:{connection_token:R}})}else await h.update.mutateAsync({id:P,data:{connection_token:R}});await y.invalidateQueries({queryKey:ve.isMCPAuthenticated(k.href,null)}),ne.success("Connected and authenticated")}else ne.success("Connected");u(P,j.app_name??null,"new"),l(P)}catch(j){console.error("Failed to connect:",j),ne.error("Failed to connect")}finally{c(null)}}};return n.jsxs(Me,{open:t,onOpenChange:e,children:[n.jsxs(Le,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[n.jsx(Fe,{className:"px-6 pt-5 pb-0 shrink-0",children:n.jsx(Ue,{className:"text-base font-semibold",children:o==="browse"?"Connections":"Add Connection"})}),n.jsx("div",{className:"pt-3 shrink-0",children:n.jsx(As,{value:m,onChange:p,placeholder:"Search connections..."})}),n.jsx(w.Suspense,{fallback:n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),children:n.jsx(no,{mode:o,agentId:a,addedConnectionIds:d,onAdd:l,onCloneAndAdd:C,onConnectAndAdd:S,connectingItemId:V,search:m,onCreateConnection:()=>g(!0),onBrowseNavigate:_,defaultTab:s})})]}),n.jsx(to,{open:x,onOpenChange:g,onCreated:async v=>{g(!1);const j=new URL(`/api/${f.slug}/mcp/${v}`,window.location.origin),E=await rn({url:j.href,token:null,orgId:f.id});if(E.supportsOAuth&&!E.isAuthenticated){const{token:D,tokenInfo:I,error:P}=await on({connectionId:v,orgSlug:f.slug,scope:"offline_access"});if(P||!D){$("connection_oauth_failed",{connection_id:v,flow:"custom_create",error:P??"no_token"}),ne.error(`Authentication failed: ${P??"no token received"}`),await h.delete.mutateAsync(v);return}if($("connection_oauth_succeeded",{connection_id:v,flow:"custom_create"}),I)try{(await fetch(`/api/${f.slug}/connections/${v}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:I.accessToken,refreshToken:I.refreshToken,expiresIn:I.expiresIn,scope:I.scope,clientId:I.clientId,clientSecret:I.clientSecret,tokenEndpoint:I.tokenEndpoint})})).ok?await h.update.mutateAsync({id:v,data:{}}):await h.update.mutateAsync({id:v,data:{connection_token:D}})}catch{await h.update.mutateAsync({id:v,data:{connection_token:D}})}else await h.update.mutateAsync({id:v,data:{connection_token:D}});await y.invalidateQueries({queryKey:ve.isMCPAuthenticated(j.href,null)})}u(v,null,"custom"),l(v),e(!1)}})]})}const Vo='# Broken Link Finder\n\nYou are the **Broken Link Finder**, a specialist agent focused on the health of the site\'s link structure.\n\n## Your mission\n\nDiscover and track broken links and long redirect chains. You are invoked as a sub-task by an orchestrator agent — your job is to detect link health and return a structured findings report. The orchestrator decides what to do with your findings (file issues, dedup, etc.).\n\nYou are **mechanical**: collect → check → classify → emit findings. Leave subjective judgment to other agents.\n\n## Input (expect this in the prompt)\n\nThe orchestrator will pass per-site configuration. Expected fields:\n\n```yaml\nsite_root_url: <https://example.com>\nmax_pages: <optional integer, default 100, max 200>\ncheck_external: <optional bool, default false>\n```\n\nIf required fields are missing (`site_root_url`), return an error summary and stop — do not proceed with defaults or guess.\n\n## Available tools\n\n- **site-diagnostics MCP**:\n - `collect_site_links` — discovers all unique outbound link targets across the site and returns them with source-page attribution. Does NOT check status.\n - `check_urls` — takes a batch of URLs (max 100 per call) and returns their HTTP status, error kind, and redirect chains.\n\n---\n\n## Step 1 — Collect link targets (one call)\n\nCall `collect_site_links` once to get the full deduplicated list of outbound link targets and their source pages:\n\n```\ncollect_site_links({\n url: <site_root_url from input>,\n maxPages: <max_pages from input, default 100>,\n checkExternal: <check_external from input, default false>\n})\n```\n\nThis returns:\n- `links`: array of `{ targetUrl, scope: "internal"|"external", sourcePages, sourcePagesTotal }` — **each target appears exactly once**\n- Metadata: `pagesCrawled`, `pagesFetched`, `linksSkipped`, optional `error`\n\n**If `result.error` is set**, the scan failed at the root (e.g. site unreachable). Return a single finding with `kind: site-unreachable` and the error in `evidence`. Then stop.\n\nKeep the `links` array in memory — you\'ll need it in Step 3 for classification and source attribution.\n\n## Step 2 — Check the targets (batched calls)\n\nExtract `targetUrl` from each entry in `links`. Slice the resulting URL list into **disjoint batches of up to 100 URLs** and call `check_urls` on each batch:\n\n```\ncheck_urls({ urls: batch_of_100_urls })\n```\n\nCollect every batch\'s `results` entries into a single flat array. Order doesn\'t matter — you\'ll join back by `targetUrl`.\n\n**Rules for this step:**\n- Slice deterministically (e.g. consecutive slices of 100) so batches are disjoint. Do not pass the same URL in two batches.\n- Call `check_urls` sequentially or in parallel — your choice. The tool is idempotent.\n- If a single `check_urls` call errors entirely, skip that batch and continue with the others. Note the skipped count in the wrap-up summary.\n\n## Step 3 — Classify each finding\n\nFor every target with a check result, join the `collect_site_links` entry (for `scope`, `sourcePages`, `sourcePagesTotal`) with the `check_urls` entry (for `status`, `errorKind`, `chain`, `hops`).\n\nA finding is emitted for:\n- **Broken**: `status >= 400` OR `status === 0`\n- **Long redirect chain**: `hops > 3` (even if the final status is 2xx)\n\nOther targets (2xx, short-chain redirects) produce no finding.\n\nMap check result → `kind`:\n\n| Check result | `kind` |\n|---|---|\n| `status: 404` | `link-404` |\n| `status: 4xx` (not 404) | `link-4xx-other` |\n| `status: 5xx` | `link-5xx` |\n| `status: 0`, `errorKind: "dns"` | `link-dns-failure` |\n| `status: 0`, `errorKind: "redirect-loop"` | `redirect-loop` |\n| `hops > 3` (success final status) | `redirect-chain-long` |\n| `status: 0`, `errorKind: "timeout"` or `"connection"` | **skip — no finding** |\n\n**Important**: timeouts and connection errors are **not** broken links — they just mean the server didn\'t respond in our time window. Could be a slow server, an overloaded CDN, rate-limiting against our bot, or a transient network blip. Flagging these as broken produces false positives. If a URL is genuinely dead, it\'ll usually surface as `dns`, a 4xx/5xx, or a redirect loop. Skip timeout/connection entries silently.\n\n## Catalog of severity rules\n\n**High severity:**\n- `link-404` when `scope: "internal"`\n- `link-5xx` when `scope: "internal"`\n- `redirect-loop` (either scope)\n\n**Medium severity:**\n- `link-4xx-other` (internal)\n- `redirect-chain-long` (internal)\n- `link-404` (external) when `sourcePagesTotal >= 5`\n\n**Low severity:**\n- `link-404` (external) when `sourcePagesTotal < 5`\n- `link-dns-failure` (external)\n- `redirect-chain-long` (external)\n- `link-4xx-other` on external scope\n\n## Step 4 — Return a structured findings report\n\nReturn a single response with this shape (YAML preferred):\n\n```yaml\nspecialist: links\nsummary:\n pages_crawled: <pagesCrawled>\n pages_fetched: <pagesFetched>\n unique_link_targets: <links.length>\n targets_dropped_by_collect_cap: <linksSkipped>\n batches_checked: <n>\n batches_skipped_due_to_errors: <n>\n broken_links: <n> # internal + external\n long_redirect_chains: <n>\nfindings:\n - kind: <kind slug>\n severity: <low|medium|high>\n target:\n url: <full broken URL>\n route: <path if internal; otherwise the external host>\n scope: <internal | external>\n evidence: |\n - Status code / error: <e.g. `404 Not Found`, `DNS failure`, `redirect-loop`>\n - Redirect chain (if applicable): A → B → C → D → E\n - Found on pages (at time of detection):\n - /page-1\n - /page-2\n - (... up to 20 from `sourcePages`)\n - Total pages linking to this target: <sourcePagesTotal>\n impact: <1 sentence tailored to scope + kind>\n suggested_fix: |\n <actionable:>\n - If internal 404: update link to correct destination OR create 301 redirect\n - If internal 5xx: investigate server-side handler for the route (may be app bug)\n - If redirect chain: shorten to single-hop direct redirect in routing config\n - If external: update link to equivalent resource OR remove the mention\n - List likely files/components if you can infer (e.g. "appears on many pages — likely in a shared component like `app/components/Nav.tsx` or menu config")\n - ...\n```\n\nIf `collect_site_links` returned `error`, return a single `kind: site-unreachable` finding with the error in `evidence`.\n\nIf there are zero findings, return `findings: []` — that is the correct output for a healthy link graph.\n\n---\n\n## General rules\n\n- **Trust the scanner.** If `check_urls` reports a URL as broken or long-chain, emit a finding. Do not re-verify with other tools.\n- **Accept some flakiness.** A transient network blip may cause a false positive once. Downstream dedup across runs resolves it.\n- **Group by destination, not by origin.** One broken URL = one finding, even if linked on 50 pages. `collect_site_links` already returns it grouped this way.\n- **Prioritize internals.** Broken external links are the other site\'s responsibility; report but with lower severity.\n- **Never invent status codes.** Report what the scanner returned.\n',mo='# SEO Auditor\n\nYou are the **SEO Auditor**, a specialist agent focused on technical SEO hygiene.\n\n## Your mission\n\nAudit the on-page SEO health of target URLs and return a structured findings report. You focus on **technical SEO** (meta tags, structured data, canonicals, sitemap/robots, heading structure, indexability) — not editorial content or keyword strategy (those are the scope of other agents).\n\nYou are invoked as a sub-task by an orchestrator agent. Your job is to analyze and report. The orchestrator decides what to do with your findings (file issues, dedup against history, etc.).\n\n## Input (expect this in the prompt)\n\nThe orchestrator will pass per-site configuration. Expected fields:\n\n```yaml\nurls:\n - <url to audit>\n - <... one or more>\n```\n\nIf required fields are missing, return an error summary and stop — do not proceed with defaults or guess.\n\n## Available tools\n\n- **site-diagnostics MCP**: `audit_seo`, `fetch_page`, `render_page`, `crawl_site`\n\n---\n\n## Step 1 — Diagnostic\n\nFor each target URL:\n\n1. **Structured audit**: call `audit_seo({ url })`. It returns a structured report — use it as your primary source.\n2. **Raw HTML check**: use `fetch_page({ url })` to see the HTML served (important for crawlers that don\'t execute JS). Confirm critical meta tags are in the initial HTML, not only after hydration.\n3. **Post-render check**: use `render_page({ url })` to see the final DOM. Problems like canonical being overwritten by JS show up here.\n4. **Site structure checks** (only if you have permission for broad crawling, or via sampling): use `crawl_site` to identify orphan pages, canonical loops, or excessive navigation depth.\n5. **Always check**: `/robots.txt` and `/sitemap.xml` via `fetch_page`. These two are root-level and affect the whole site.\n\nOrganize findings into a list. Each finding must have:\n- `kind` (kebab-case slug, see catalog below)\n- `severity` (high | medium | low, see criteria below)\n- `target.url` and `target.route` (normalize: lowercase host, no query, no trailing slash except for `/`)\n- `evidence` (raw data: CSS selector, HTML snippet, observed value)\n- `impact` (1-2 sentences connecting to real metrics)\n- `suggested_fix` (actionable; include file/line if you can infer from framework patterns)\n\n## Step 1.5 — Validate page intent (critical; runs before classification)\n\nBefore you emit *any* finding about a page\'s title, meta description, headings, or indexability, you must answer one question: **did the site owner intend this URL to be a public, indexable page?**\n\nIf the answer is no, the observed "problems" are intentional configuration, not bugs. Reporting them wastes maintainer time and erodes this agent\'s credibility.\n\n### Three signals that the URL is NOT a real public page\n\nCheck these in order. Hitting any one of them means **skip all SEO findings for this URL** except legitimately site-wide problems (e.g. broken sitemap, broken robots.txt).\n\n**Signal 1 — Not in sitemap.** Fetch `/sitemap.xml` (and its child sitemaps, if it\'s a sitemap index). If the URL doesn\'t appear in any sitemap, the owner didn\'t declare it as public. Common on e-commerce platforms where routes like `/p`, `/c`, `/blog` are catchall or routing prefixes, not real pages.\n\n**Signal 2 — Explicit `noindex` + not in sitemap.** If the page serves `<meta name="robots" content="noindex*">` **and** isn\'t in the sitemap, this is a deliberate double-lock by the owner. Respect it. Do **not** flag `noindex-on-important-page` in this case.\n\n**Signal 3 — Title is the URL slug (template fallback).** If `<title>` equals the last path segment (e.g. `<title>blog</title>` for `/blog`, `<title>p</title>` for `/p`), the page is being rendered by a fallback template — nobody configured real content for this route. Skip.\n\n### Platform-specific catchalls (especially Brazilian e-commerce / VTEX / deco-cx)\n\nThese paths are routing prefixes, **not pages**. They may return HTTP 200 but are not meant to be indexable:\n\n- `/p`, `/c`, `/b` — VTEX product / category / brand route prefixes. Real pages live at `/<slug>/p`, `/<slug>/c`, etc. The bare prefixes are catchalls.\n- `/blog`, `/blogs`, `/editorial`, `/revista`, `/conteudo`, `/magazine`, `/noticias`, `/artigos` — common editorial prefixes. If the site doesn\'t have an editorial section, these hit a fallback.\n- `/search`, `/busca`, `/s` — search endpoints, not indexable pages.\n- `/departamento`, `/categoria` — category prefixes.\n- `/checkout`, `/cart`, `/carrinho`, `/login`, `/account`, `/minha-conta` — transactional/private routes. Intentionally `noindex`.\n\n### The "is this page actually important?" checklist\n\nBefore emitting a finding that calls a page "important" (like `noindex-on-important-page` or `title-missing` on anything critical):\n\n1. Is the URL in `/sitemap.xml`? → If no, skip.\n2. Does the page have substantive, unique content (not a fallback with title = URL slug)? → If no, skip.\n3. Is the path a known platform catchall (see list above)? → If yes, skip.\n\nOnly flag if all three pass.\n\n### What still counts as a finding even on non-indexable pages\n\nSite-wide SEO issues affect the whole domain and are worth reporting regardless of individual page intent:\n- `sitemap-missing` (the sitemap itself is broken)\n- `robots-blocking-important-path` (robots.txt blocks something that IS in the sitemap)\n- `structured-data-invalid` on pages that ARE in the sitemap\n- Duplicate titles / meta descriptions across pages that ARE in the sitemap\n\n## Catalog of `kind`\n\nTwo flavors of finding:\n\n- **Per-page** kinds — emitted when auditing a specific URL (e.g. `audit_seo` of a single page OR when your targeted inspection of one of the input URLs finds the issue). Marked **[intent-gated]** — must pass Step 1.5 before being emitted. Target is the specific URL.\n- **Aggregate** kinds — emitted once per site-wide pattern detected by `audit_seo`. Marked **[aggregate]**. Target is the site root (`/`). Evidence MUST include the affected URL sample from `audit_seo.issues[].sampleUrls`. One finding per aggregate kind per site.\n\n**High severity (per-page):**\n- `noindex-on-important-page` **[intent-gated]** — meta robots `noindex` on a page that IS in the sitemap and should be indexed\n- `canonical-pointing-to-wrong-url` **[intent-gated]** — canonical points to a different URL that isn\'t the canonical equivalent\n- `canonical-missing-on-paginated-or-faceted` **[intent-gated]** — pagination/filters without canonical\n- `title-missing` **[intent-gated]** — no `<title>` or empty on a page that IS in the sitemap\n- `structured-data-invalid` **[intent-gated]** — JSON-LD with syntax error or invalid schema.org\n\n**High severity (site-wide):**\n- `sitemap-missing` — `/sitemap.xml` returns 404 or 5xx\n- `robots-blocking-important-path` — `/robots.txt` disallows a path that IS in the sitemap\n- `broken-links-site-wide` **[aggregate]** — `audit_seo` reports broken outbound links across the site\n- `non-indexable-pages-site-wide` **[aggregate]** — `audit_seo` reports many non-indexable pages (note: some non-indexable pages are intentional catchalls — only high severity if the absolute count is large relative to `totalPagesCrawled`, e.g. > 30%)\n\n**Medium severity (per-page):**\n- `meta-description-missing` **[intent-gated]** — no `<meta name="description">` on a sitemap page the agent audited directly\n- `h1-missing` **[intent-gated]** — no `<h1>` on a sitemap page the agent audited directly\n- `h1-duplicate` **[intent-gated]** — multiple `<h1>` on a single page\n- `og-tags-missing` **[intent-gated]** — `og:title` and/or `og:description` missing\n- `structured-data-missing` **[intent-gated]** — page-type (product, article, etc.) without relevant JSON-LD\n- `title-too-long` **[intent-gated]** — `<title>` > 60 characters (truncation in SERP)\n- `title-too-short` **[intent-gated]** — `<title>` < 10 characters (rare; usually means template fallback — double-check page intent)\n- `meta-description-too-long` **[intent-gated]** — description > 160 characters\n\n**Medium severity (site-wide):**\n- `pages-missing-h1` **[aggregate]** — `audit_seo` reports N pages without an H1 tag\n- `pages-missing-meta-description` **[aggregate]** — `audit_seo` reports N pages without a meta description\n- `duplicate-titles` **[aggregate]** — multiple pages share the same `<title>`\n- `duplicate-meta-descriptions` **[aggregate]** — multiple pages share the same meta description\n- `duplicate-content` **[aggregate]** — multiple pages share substantially identical content\n- `broken-resources-site-wide` **[aggregate]** — broken images / scripts across the site\n- `hreflang-broken` — `hreflang` attribute with invalid value or broken reciprocity\n\n**Low severity (per-page):**\n- `meta-description-too-short` **[intent-gated]** — description < 50 characters\n- `og-image-missing` **[intent-gated]** — `og:image` missing\n- `heading-hierarchy-skipped` **[intent-gated]** — jumps from H1 to H3, etc.\n\n**Low severity (site-wide):**\n- `internal-link-using-absolute-url` — internal links with absolute URLs\n\n### Evidence requirements for aggregate kinds\n\nWhen emitting an `[aggregate]` kind, the `evidence` of the finding MUST include:\n\n1. **Total count** — from `audit_seo.issues[].count`\n2. **Sample URLs** — from `audit_seo.issues[].sampleUrls`. Render up to all 20 entries as a bulleted list. If `count > sampleUrls.length`, add a line like `(and <count - sampleUrls.length> more)`.\n3. **If `sampleUrls` is empty** (the tool didn\'t expose per-URL detail — happens for `broken-links-site-wide`, `duplicate-content`, `broken-resources-site-wide`), note it explicitly: `Note: audit_seo did not return per-URL detail for this issue type. A human will need to inspect the full audit_seo report or re-run with deeper crawling.`\n\nAn aggregate finding without either sample URLs or the note is **not actionable** and must not be emitted.\n\nTarget for aggregate kinds stays `target.url: https://<host>/` and `target.route: /`.\n\n## Step 2 — Return a structured findings report\n\nReturn a single response with this shape (YAML or JSON; YAML preferred for readability):\n\n```yaml\nspecialist: seo\nsummary:\n urls_audited: <n>\n findings: <n>\n diagnostic_failures: <n> # urls where audit tooling errored\nfindings:\n - kind: <kind slug>\n severity: <low|medium|high>\n target:\n url: <full URL>\n route: <normalized path>\n evidence: |\n <multi-line raw data: observed value, selector, HTML snippet, audit_seo output>\n impact: <1-2 sentences connecting to ranking/indexation/CTR>\n suggested_fix: <actionable; likely file/component, pseudo-code, correct value>\n - ...\n```\n\nIf a URL\'s diagnostic tooling errored entirely, emit a single `kind: diagnostic-failed` finding for that URL with the error in `evidence` instead of inventing data.\n\nIf there are zero findings, return `findings: []` — that is the correct output for healthy targets.\n\n---\n\n## General rules\n\n- **Never invent data in `evidence`.** If a tool failed, report it via `kind: diagnostic-failed` and skip the finding.\n- Always normalize `route`: lowercase host, no trailing slash (except for `/`), no query string, no fragment.\n- Your credibility is your currency. False positives erode trust — if you\'re 50% sure, don\'t emit a finding; investigate further or mark as `severity:low`.\n- **Never report a page as broken when it\'s a known catchall.** URLs like `/p`, `/c`, `/blog`, `/search`, `/busca` on e-commerce sites are routing prefixes, not pages. If the title is the URL slug and the page carries `noindex`, the owner is deliberately hiding it. That\'s correct behavior, not a bug.\n- **Sitemap is the ground truth for "is this page public?"**. When in doubt about whether to emit a finding on a URL, fall back to: "Is this URL in /sitemap.xml?" If not, default to silence.\n',fo=`# Performance Watchdog
|
|
1
|
+
import{s as ue,b as Bt,u as ui,z as kn,C as Nn,j as n,B as J,x as ne,r as w,o as qt,f as ct,l as He,G as rn,F as on,t as $,K as ve,e as L,Q as Vi,R as mi,c as z,a as _n,g as fi,d as pi,H as dt,J as Dt,E as hi,P as Cn,ap as gi,n as In,y as ps,aq as xi,ar as hs,as as bi,at as De,au as an,ao as yi,av as vi,aw as ln,ax as wi,ay as ji,az as Ai,aA as Si,w as ki,aB as Ni,aC as _i,aD as Ci,aE as Ii,aF as zn}from"./index-B3pJqV9Y.js";import{b as Me,a as Le,c as Fe,d as Ue,e as Kt,D as gs}from"./dialog-DJXnl186.js";import{S as Ri}from"./switch-BL_ICveF.js";import{I as _e}from"./input-DylFJb_s.js";import{b as Rn,u as Ti}from"./use-connection-CesZaYzK.js";import{S as kt,u as qe,W as xs,g as Tn,i as Bn,c as Pi}from"./constants-DzBa_pVv.js";import{a as Ei,u as Di}from"./lean-canvas-recruit-modal-DrBzPrQ5.js";import{a as Pn}from"./use-navigate-to-agent-DNFfIi8H.js";import{a as Mi,A as En,M as Li,N as bs,O as ys,o as Fi,P as Ui,Q as Oi,b as $i,R as zi,I as vs}from"./agent-icon-rfR6G8ak.js";import{t as Bi,b as Yt,u as Dn,a as qi,g as Ki,h as Yi,w as Wi,A as Gi,i as Qi,j as Hi}from"./chat-context-BFu5v0t2.js";import{b as Wt,a as Gt,c as Qt,D as Ht,d as Ji,e as Xi,f as Zi}from"./drawer-CKRLj2vr.js";import{u as Jt,T as xt,a as bt,b as yt,c as xn}from"./tooltip-DZIo6YZX.js";import{I as ws}from"./integration-icon-BrsREj94.js";import{a as js,b as er,u as tr}from"./use-virtual-mcp-CEUQCho1.js";import{u as nr}from"./use-tasks-D-yLjF43.js";import{r as sr,i as ir}from"./shell-layout-BiL6-6W9.js";import{j as Xt,k as Ge,l as rr,s as Mn,t as or,m as ar,n as lr,o as cr,q as wt,u as dr,v as ur,c as Vr,S as mr,w as fr,x as qn}from"./pair-D0CyaFmX.js";import{S as Mt,u as Zt,P as bn,a as pr,b as hr,c as gr,E as xr,i as br,d as yr}from"./index-Cg6ppcFr.js";import{C as As}from"./collection-search-C4byKAjw.js";import{u as vr,g as Ln,a as wr,c as jr,l as Lt}from"./tabs-DGNL4gIl.js";import{F as me,b as fe,c as Ne,d as pe,f as he,a as jt}from"./form-Crn7uG02.js";import{c as Ee,e as cn,f as dn,D as Ss,a as ks,b as Ns,d as Ar}from"./dropdown-menu-BxJLGp-F.js";import{s as Sr,i as kr}from"./XClose-C2Cy4nwy.js";import{c as _s}from"./ZapSquare-Wt7N_ZY-.js";import{i as Xe,t as Kn}from"./ChevronDown-DTujp_Ze.js";import{s as lt}from"./Star01-SeWnXAup.js";import{a as yn,t as Nr}from"./Tool01-CNtQXBy4.js";import{i as Cs}from"./Lock01-NMXz4ptn.js";import{s as Is}from"./Plus-D5DLeNpq.js";import{f as un,d as Rs,t as _r,g as Cr,b as Ir}from"./XCircle-DtPL7zg0.js";import{i as pt}from"./X-CeTLIvc6.js";import{i as Ts}from"./AlertCircle-9O6VvAfH.js";import{S as Ps,a as Es,b as Ds,c as Ms,d as ot}from"./select-FyLwzc48.js";import{i as Rr}from"./RefreshCcw01-B6WkaYVq.js";import{T as Ls,a as Ft}from"./toggle-group-cD20__YI.js";import{u as Tr,a as Pr}from"./use-ai-providers-Dsmx4U8L.js";import{m as en,g as Er,i as Dr,a as Fs,M as Mr,N as Lr}from"./select-model-67avCsXE.js";import{S as Fr}from"./index-vUSuyfsm.js";import{r as Us,l as vt}from"./types-PzC3rVhv.js";import{p as Ur,q as Yn}from"./question-004-sINsf4GQ.js";import{g as Wn}from"./ai-providers-logos-DD3qZ33J.js";import{g as Or}from"./connection-slug-eyAPH6o3.js";import{u as Os,a as $s,g as $r,C as Vn}from"./connection-card-B9DKOCXt.js";import{C as zr}from"./collection-tabs-gMfs6Afq.js";import{g as Br}from"./constants-ZacFr8c8.js";import{T as qr}from"./textarea-B1YgZKSW.js";import{n as Pt}from"./Container-Dwj81gCC.js";import{c as Kr,i as It,a as Gn,E as Yr,p as Wr,b as Gr,d as Qr}from"./connection-form-helpers-Dr9CZ_1s.js";import{u as Qn}from"./use-infinite-scroll-D6FvdXof.js";import{u as Hr}from"./useSuspenseInfiniteQuery-CgFHp-eh.js";import{g as Jr,e as Xr,a as Zr}from"./extract-connection-data-DV87vwuC.js";import{B as Rt}from"./badge-DSbZ2xYh.js";import{i as eo}from"./ChevronRight-DmfKIycz.js";function to({open:t,onOpenChange:e,onCreated:s}){const{org:i}=ue(),{data:r}=Bt.useSession(),{stdioEnabled:o}=ui(),a=Jt(),d=Rn(),l=Os(),V=$s(l,"").items,c=kn({resolver:Nn(Kr),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),m=c.watch("ui_type"),p=c.watch("connection_url"),x=c.watch("npx_package"),g=It({uiType:m,connectionUrl:p??"",npxPackage:x??""})??Gn({uiType:m,connectionUrl:p??"",registryItems:V}),f=S=>{const v=S.trim();if(!v)return;const j=!!c.formState.dirtyFields.title,E=!!c.formState.dirtyFields.description,D=!!c.formState.dirtyFields.env_vars,I=k=>{if(k&&(!j&&!c.getValues("title").trim()&&k.title&&c.setValue("title",k.title,{shouldDirty:!1}),!E&&!(c.getValues("description")??"").trim()&&k.description&&c.setValue("description",k.description,{shouldDirty:!1}),!D&&k.envVarKeys?.length)){const N=c.getValues("env_vars")??[],R=new Set(N.map(T=>T.key)),M=k.envVarKeys.filter(T=>!R.has(T));M.length>0&&c.setValue("env_vars",[...N,...M.map(T=>({key:T,value:""}))],{shouldDirty:!0})}},P=Wr(v);if(P&&o){c.setValue("ui_type","NPX",{shouldDirty:!0}),c.setValue("npx_package",P.packageName,{shouldDirty:!0}),c.setValue("connection_url","",{shouldDirty:!0}),c.setValue("connection_token",null,{shouldDirty:!0}),I(It({uiType:"NPX",npxPackage:P.packageName}));return}if(v.startsWith("http://")||v.startsWith("https://")){const k=m==="HTTP"||m==="SSE"||m==="Websocket"?m:"HTTP";c.setValue("ui_type",k,{shouldDirty:!0}),c.setValue("connection_url",v,{shouldDirty:!0}),I(It({uiType:k,connectionUrl:v})??Gn({uiType:k,connectionUrl:v,registryItems:V}));return}m==="NPX"&&I(It({uiType:"NPX",npxPackage:v}))},b=S=>{S||c.reset(),e(S)},h=async S=>{let v,j=null,E=null,D=null;S.ui_type==="NPX"?(v="STDIO",j="",D=Gr(S.npx_package||"",S.env_vars||[])):S.ui_type==="STDIO"?(v="STDIO",j="",D=Qr(S.stdio_command||"",S.stdio_args||"",S.stdio_cwd,S.env_vars||[])):(v=S.ui_type,j=S.connection_url||"",E=S.connection_token||null);const I=Br("conn");try{await d.create.mutateAsync({id:I,title:S.title,description:S.description||null,connection_type:v,connection_url:j,connection_token:E,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:r?.user?.id||"system",organization_id:i.id,icon:S.icon??null,app_name:null,app_id:null,connection_headers:D,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),c.reset(),e(!1),s?.(I)}catch{ne.error("Failed to create connection")}},y="Create Connection",A="Create a custom connection in your organization. Fill in the details below.",_=c.formState.isSubmitting?"Saving...":"Create Connection",C=n.jsxs("div",{className:"grid gap-4",children:[n.jsx(me,{control:c.control,name:"ui_type",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Type *"}),n.jsxs(Ps,{value:S.value,onValueChange:S.onChange,children:[n.jsx(pe,{children:n.jsx(Es,{children:n.jsx(Ds,{})})}),n.jsxs(Ms,{children:[n.jsx(ot,{value:"HTTP",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(lt,{className:"w-4 h-4"}),"HTTP"]})}),n.jsx(ot,{value:"SSE",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(lt,{className:"w-4 h-4"}),"SSE"]})}),n.jsx(ot,{value:"Websocket",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(lt,{className:"w-4 h-4"}),"Websocket"]})}),o&&n.jsxs(n.Fragment,{children:[n.jsx(ot,{value:"NPX",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Pt,{className:"w-4 h-4"}),"NPX Package"]})}),n.jsx(ot,{value:"STDIO",children:n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Mi,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),n.jsx(he,{})]})}),m==="NPX"&&n.jsx(me,{control:c.control,name:"npx_package",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"NPM Package *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"@perplexity-ai/mcp-server",...S,value:S.value??"",onPaste:v=>{const j=v.clipboardData.getData("text");j&&(v.preventDefault(),c.setValue("npx_package",j.trim(),{shouldDirty:!0}),f(j))},onBlur:v=>{f(v.target.value),S.onBlur()}})}),n.jsx(he,{})]})}),m==="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[n.jsx(me,{control:c.control,name:"stdio_command",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Command *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"node, bun, python...",...S,value:S.value??""})}),n.jsx(he,{})]})}),n.jsx(me,{control:c.control,name:"stdio_args",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Arguments"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"arg1 arg2 --flag value",...S,value:S.value??""})}),n.jsx(he,{})]})})]}),n.jsx(me,{control:c.control,name:"stdio_cwd",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Working Directory"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"/path/to/project (optional)",...S,value:S.value??""})}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),n.jsx(he,{})]})})]}),(m==="NPX"||m==="STDIO")&&n.jsx(me,{control:c.control,name:"env_vars",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Environment Variables"}),n.jsx(pe,{children:n.jsx(Yr,{value:S.value??[],onChange:S.onChange})}),n.jsx(he,{})]})}),m!=="NPX"&&m!=="STDIO"&&n.jsxs(n.Fragment,{children:[n.jsx(me,{control:c.control,name:"connection_url",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"URL *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"https://example.com/mcp",...S,value:S.value??"",onPaste:v=>{const j=v.clipboardData.getData("text");j&&(v.preventDefault(),c.setValue("connection_url",j.trim(),{shouldDirty:!0}),f(j))},onBlur:v=>{f(v.target.value),S.onBlur()}})}),n.jsx(he,{})]})}),n.jsx(me,{control:c.control,name:"connection_token",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:g?.token?.label??"Token (optional)"}),n.jsx(pe,{children:n.jsx(_e,{type:"password",placeholder:g?.token?.placeholder??"Bearer token or API key",className:"ph-no-capture",...S,value:S.value??""})}),g?.token?.helperText&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.id==="github"&&n.jsxs(n.Fragment,{children:[" ","·"," ",n.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"})]})]}),n.jsx(he,{})]})})]}),n.jsx(me,{control:c.control,name:"title",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Name *"}),n.jsx(pe,{children:n.jsx(_e,{placeholder:"My Connection",...S})}),n.jsx(he,{})]})}),n.jsx(me,{control:c.control,name:"description",render:({field:S})=>n.jsxs(fe,{children:[n.jsx(Ne,{children:"Description"}),n.jsx(pe,{children:n.jsx(qr,{placeholder:"A brief description of this connection",rows:3,...S,value:S.value??""})}),n.jsx(he,{})]})})]});return a?n.jsx(Wt,{open:t,onOpenChange:b,children:n.jsxs(Gt,{className:"max-h-[90vh]",children:[n.jsx(Qt,{className:"pb-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"flex-1 text-left",children:[n.jsx(Ht,{children:y}),n.jsx(Ji,{className:"mt-1",children:A})]}),n.jsx(Xi,{asChild:!0,children:n.jsx(J,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:n.jsx(Sr,{size:16})})})]})}),n.jsx(jt,{...c,children:n.jsxs("form",{onSubmit:c.handleSubmit(h),children:[n.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:C}),n.jsx(Zi,{children:n.jsx(J,{type:"submit",disabled:c.formState.isSubmitting,className:"w-full",children:_})})]})})]})}):n.jsx(Me,{open:t,onOpenChange:b,children:n.jsxs(Le,{className:"sm:max-w-[525px]",children:[n.jsxs(Fe,{children:[n.jsx(Ue,{children:y}),n.jsx(Kt,{children:A})]}),n.jsx(jt,{...c,children:n.jsxs("form",{onSubmit:c.handleSubmit(h),children:[n.jsx("div",{className:"py-4",children:C}),n.jsxs(gs,{children:[n.jsx(J,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),n.jsx(J,{type:"submit",disabled:c.formState.isSubmitting,className:"min-w-40",children:_})]})]})})]})})}function no(t){const e=L.c(73),{mode:s,agentId:i,addedConnectionIds:r,onAdd:o,onCloneAndAdd:a,onConnectAndAdd:d,connectingItemId:l,search:u,onCreateConnection:V,onBrowseNavigate:c,defaultTab:m}=t,p=s===void 0?"add":s,x=m===void 0?"connected":m,{org:g}=ue(),f=w.useDeferredValue(u),b=u!==f,h=f.trim().toLowerCase();let y;e[0]!==x?(y=U=>U??x,e[0]=x,e[1]=y):y=e[1];const[A,_]=Vi(mi.connectionsTab(g.slug)+(x==="all"?":home-modal":":agent-modal"),y);let C;e[2]!==A||e[3]!==_?(C=U=>{U!==A&&$("connections_dialog_tab_changed",{to_tab:U}),_(U)},e[2]=A,e[3]=_,e[4]=C):C=e[4];const S=C;let v;e[5]!==g.id||e[6]!==g.slug?(v={connectionId:kt,orgId:g.id,orgSlug:g.slug},e[5]=g.id,e[6]=g.slug,e[7]=v):v=e[7];const j=qe(v);let E,D,I;if(e[8]!==j||e[9]!==f||e[10]!==g.id){I=f?.trim()?{operator:"or",conditions:[{field:["title"],operator:"contains",value:f.trim()},{field:["description"],operator:"contains",value:f.trim()}]}:void 0;const U={...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},X=JSON.stringify(U);D=Hr,E=ve.collectionListInfinite(j,g.id,"","CONNECTIONS",X),e[8]=j,e[9]=f,e[10]=g.id,e[11]=E,e[12]=D,e[13]=I}else E=e[11],D=e[12],I=e[13];let P;e[14]!==j||e[15]!==I?(P=async U=>{const{pageParam:X}=U,Se=X===void 0?0:X;return(await j.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...I&&{where:I},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:Se}})).structuredContent},e[14]=j,e[15]=I,e[16]=P):P=e[16];let k;e[17]!==E||e[18]!==P?(k={queryKey:E,queryFn:P,initialPageParam:0,getNextPageParam:lo,staleTime:3e4},e[17]=E,e[18]=P,e[19]=k):k=e[19];const{data:N,fetchNextPage:R,hasNextPage:M,isFetchingNextPage:T}=D(k),F=N?.pages.flatMap(ao)??[],O=$r(F),q=new Set(F.filter(oo).map(ro)),K=Os(),H=$s(K,f),Z=Qn(H.loadMore,H.hasMore,H.isLoadingMore),Q=Qn(R,M??!1,T),W=A==="all"||!!h,ie=W?H.items.filter(U=>{const X=Jr(U);if(X&&q.has(X))return!1;if(!h)return!0;const Se=U._meta?.["mcp.mesh"];return[U.title,U.description,U.name,U.server?.title,U.server?.description,U.server?.name,Se?.friendly_name,Se?.friendlyName].filter(Boolean).join(" ").toLowerCase().includes(h)}):[],Y=ie.filter(io),ee=ie.filter(so);let te;e[20]!==r?(te=U=>U.some(X=>r.has(X.id)),e[20]=r,e[21]=te):te=e[21];const se=te;let ae;e[22]!==r||e[23]!==i||e[24]!==l||e[25]!==se||e[26]!==p||e[27]!==o||e[28]!==c||e[29]!==a?(ae=(U,X,Se,ke,Te)=>{const ze=se(Te),Be=Te.find(Pe=>!r.has(Pe.id)),le=Te[0];if(p==="browse"){const Pe=Or(le);return n.jsx(Vn,{connection:{title:X,icon:Se,description:Te.length>1?`${Te.length} instances`:ke??void 0},fallbackIcon:n.jsx(Pt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(Xe,{size:11})," Connected"]}),onClick:()=>{$("connection_browse_clicked",{app_name:le.app_name??null,connection_id:le.id,instances_count:Te.length}),c?.(Pe)}},U)}return n.jsx(Vn,{connection:{title:X,icon:Se,description:ke},fallbackIcon:n.jsx(Pt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[ze&&n.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[n.jsx(Xe,{size:11})," Added"]}),n.jsx(J,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Pe=>{Pe.stopPropagation(),Be?($("connection_add_clicked",{action:"use_existing",app_name:le.app_name??null,connection_id:Be.id}),i&&$("agent_connection_attached",{agent_id:i,connection_id:Be.id,app_name:le.app_name??null,mode:"existing"}),o(Be.id)):($("connection_add_clicked",{action:"clone",app_name:le.app_name??null,base_connection_id:le.id}),a(le))},children:"Add"})]})},U)},e[22]=r,e[23]=i,e[24]=l,e[25]=se,e[26]=p,e[27]=o,e[28]=c,e[29]=a,e[30]=ae):ae=e[30];const re=ae;let oe;e[31]!==l||e[32]!==p||e[33]!==d?(oe=U=>{const X=U._meta?.["mcp.mesh"],Se=X?.friendlyName||X?.friendly_name||U.server?.title||U.title||U.server?.name||U.name||U.id||"",ke=U.server?.description||U.description||null,Te=U.server?.icons?.[0]?.src||Zr(U.server?.repository)||null,ze=X?.official===!0,Be=X?.verified===!0,le=X?.owner==="deco";return n.jsx(Vn,{connection:{title:Se,description:ke,icon:Te},fallbackIcon:n.jsx(Pt,{}),headerActionsAlwaysVisible:!0,headerActions:n.jsxs("div",{className:"flex items-center gap-1.5",children:[le&&n.jsxs(xt,{children:[n.jsx(bt,{asChild:!0,children:n.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:n.jsx("img",{src:"/logos/deco logo.svg",alt:"Made by Deco",className:"size-3"})})}),n.jsx(yt,{children:"Built and maintained by Deco"})]}),!le&&ze&&n.jsxs(xt,{children:[n.jsx(bt,{asChild:!0,children:n.jsx(Rt,{variant:"outline",size:"icon",children:n.jsx(un,{})})}),n.jsx(yt,{children:"Built and maintained by the official vendor"})]}),!le&&!ze&&Be&&n.jsxs(xt,{children:[n.jsx(bt,{asChild:!0,children:n.jsx(Rt,{variant:"outline",size:"icon",children:n.jsx(un,{})})}),n.jsx(yt,{children:"Verified by the Deco team"})]}),n.jsx(J,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:Pe=>{Pe.stopPropagation(),$("connection_add_clicked",{action:"connect_new",registry_item_id:U.id,app_name:X?.friendlyName||U.server?.name||U.name||null}),d(U)},children:l===U.id?n.jsx(He,{size:14,className:"animate-spin"}):p==="browse"?"Connect":"Add"})]})},`catalog-${U.id}`)},e[31]=l,e[32]=p,e[33]=d,e[34]=oe):oe=e[34];const ce=oe,ge=!h&&n.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[n.jsx(zr,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:A,onTabChange:U=>S(U)}),n.jsxs(J,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{$("connections_dialog_custom_clicked"),V()},children:[n.jsx(Is,{size:12}),"Custom Connection"]})]}),G=b&&"opacity-50 pointer-events-none";let de;e[35]!==G?(de=z("flex-1 overflow-auto p-5 transition-opacity duration-150",G),e[35]=G,e[36]=de):de=e[36];const Ze="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let Oe;e[37]!==re?(Oe=U=>{if(U.type==="group")return re(U.key,U.title,U.icon,null,U.connections);const X=U.connection;return re(X.id,X.title,X.icon,X.description??null,[X])},e[37]=re,e[38]=Oe):Oe=e[38];const Ce=O.map(Oe);let xe;e[39]!==Q?(xe=n.jsx("div",{ref:Q,className:"col-span-full h-1"}),e[39]=Q,e[40]=xe):xe=e[40];let be;e[41]!==T?(be=T&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),e[41]=T,e[42]=be):be=e[42];const Ie=W&&Y.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx(un,{size:13,className:"text-muted-foreground shrink-0"}),n.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),n.jsx("div",{className:"flex-1 h-px bg-border"})]}),Ke=W&&Y.map(ce),Ve=W&&ee.length>0&&n.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[n.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),n.jsx("div",{className:"flex-1 h-px bg-border"})]}),ut=W&&ee.map(ce);let we;e[43]!==Z||e[44]!==K||e[45]!==W?(we=W&&K.length>0&&n.jsx("div",{ref:Z,className:"col-span-full h-1"}),e[43]=Z,e[44]=K,e[45]=W,e[46]=we):we=e[46];let Re;e[47]!==H.isLoadingMore||e[48]!==W?(Re=W&&H.isLoadingMore&&n.jsx("div",{className:"col-span-full flex justify-center py-6",children:n.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),e[47]=H.isLoadingMore,e[48]=W,e[49]=Re):Re=e[49];let je;e[50]!==Ce||e[51]!==xe||e[52]!==be||e[53]!==Ie||e[54]!==Ke||e[55]!==Ve||e[56]!==ut||e[57]!==we||e[58]!==Re?(je=n.jsxs("div",{className:Ze,children:[Ce,xe,be,Ie,Ke,Ve,ut,we,Re]}),e[50]=Ce,e[51]=xe,e[52]=be,e[53]=Ie,e[54]=Ke,e[55]=Ve,e[56]=ut,e[57]=we,e[58]=Re,e[59]=je):je=e[59];let Ae;e[60]!==A||e[61]!==O.length||e[62]!==ee||e[63]!==u||e[64]!==Y?(Ae=O.length===0&&Y.length===0&&ee.length===0&&n.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:u?`No connections match "${u}"`:A==="connected"?"No connections yet":"No connections available"}),e[60]=A,e[61]=O.length,e[62]=ee,e[63]=u,e[64]=Y,e[65]=Ae):Ae=e[65];let ye;e[66]!==de||e[67]!==je||e[68]!==Ae?(ye=n.jsxs("div",{className:de,children:[je,Ae]}),e[66]=de,e[67]=je,e[68]=Ae,e[69]=ye):ye=e[69];let $e;return e[70]!==ge||e[71]!==ye?($e=n.jsxs(n.Fragment,{children:[ge,ye]}),e[70]=ge,e[71]=ye,e[72]=$e):$e=e[72],$e}function so(t){return!t.verified&&!t._meta?.["mcp.mesh"]?.verified&&!t.meta?.verified}function io(t){return t.verified||t._meta?.["mcp.mesh"]?.verified||t.meta?.verified}function ro(t){return t.app_name}function oo(t){return t.app_name}function ao(t){return t?.items??[]}function lo(t,e){if(t?.hasMore)return e.reduce(co,0)}function co(t,e){return t+(e?.items?.length??0)}function uo({open:t,onOpenChange:e,defaultTab:s,initialSearch:i="",...r}){const o=r.mode??"add",a="agentId"in r?r.agentId:void 0,d="addedConnectionIds"in r?r.addedConnectionIds??new Set:new Set,l="onAdd"in r&&r.onAdd?r.onAdd:v=>{},u=(v,j,E)=>{a&&$("agent_connection_attached",{agent_id:a,connection_id:v,app_name:j,mode:E})},[V,c]=w.useState(null),[m,p]=w.useState(i),[x,g]=w.useState(!1),{org:f}=ue(),{data:b}=Bt.useSession(),h=Rn(),y=qt(),A=ct(),_=v=>{e(!1),A({to:"/$org/settings/connections/$appSlug",params:{org:f.slug,appSlug:v}})},C=async v=>{c(v.app_name??v.id);try{const E=`${v.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,I=(await h.create.mutateAsync({title:E,description:v.description??null,connection_type:v.connection_type,connection_url:v.connection_url??null,connection_token:null,icon:v.icon??null,app_name:v.app_name??null,app_id:v.app_id??null,connection_headers:v.connection_headers??null})).id,P=new URL(`/api/${f.slug}/mcp/${I}`,window.location.origin),k=await rn({url:P.href,token:null,orgId:f.id});if(k.supportsOAuth&&!k.isAuthenticated){const{token:N,tokenInfo:R,error:M}=await on({connectionId:I,orgSlug:f.slug,scope:"offline_access"});if(M||!N){$("connection_oauth_failed",{connection_id:I,flow:"clone",error:M??"no_token"}),ne.error(`Authentication failed: ${M??"no token received"}`),await h.delete.mutateAsync(I);return}if($("connection_oauth_succeeded",{connection_id:I,flow:"clone"}),R)try{(await fetch(`/api/${f.slug}/connections/${I}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:R.accessToken,refreshToken:R.refreshToken,expiresIn:R.expiresIn,scope:R.scope,clientId:R.clientId,clientSecret:R.clientSecret,tokenEndpoint:R.tokenEndpoint})})).ok?await h.update.mutateAsync({id:I,data:{}}):await h.update.mutateAsync({id:I,data:{connection_token:N}})}catch{await h.update.mutateAsync({id:I,data:{connection_token:N}})}else await h.update.mutateAsync({id:I,data:{connection_token:N}});await y.invalidateQueries({queryKey:ve.isMCPAuthenticated(P.href,null)})}u(I,v.app_name??null,"clone"),l(I)}catch(j){console.error("Failed to add connection:",j),ne.error("Failed to add connection")}finally{c(null)}},S=async v=>{if(!(!f||!b?.user?.id)){c(v.id);try{const j=Xr(v,f.id,b.user.id,{remoteIndex:0}),E=j.connection_type==="STDIO",D=!!j.connection_url,I=E&&j.connection_headers&&typeof j.connection_headers=="object"&&"command"in j.connection_headers;if(!D&&!I){ne.error("This MCP Server cannot be connected: no connection method available"),c(null);return}const{id:P}=await h.create.mutateAsync(j),k=new URL(`/api/${f.slug}/mcp/${P}`,window.location.origin),N=await rn({url:k.href,token:null,orgId:f.id});if(N.supportsOAuth&&!N.isAuthenticated){const{token:R,tokenInfo:M,error:T}=await on({connectionId:P,orgSlug:f.slug,scope:"offline_access"});if(T||!R){$("connection_oauth_failed",{connection_id:P,flow:"connect_new",error:T??"no_token"}),ne.error(`Authentication failed: ${T??"no token received"}`),u(P,j.app_name??null,"new"),l(P);return}if($("connection_oauth_succeeded",{connection_id:P,flow:"connect_new"}),M)try{(await fetch(`/api/${f.slug}/connections/${P}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:M.accessToken,refreshToken:M.refreshToken,expiresIn:M.expiresIn,scope:M.scope,clientId:M.clientId,clientSecret:M.clientSecret,tokenEndpoint:M.tokenEndpoint})})).ok?await h.update.mutateAsync({id:P,data:{}}):await h.update.mutateAsync({id:P,data:{connection_token:R}})}catch{await h.update.mutateAsync({id:P,data:{connection_token:R}})}else await h.update.mutateAsync({id:P,data:{connection_token:R}});await y.invalidateQueries({queryKey:ve.isMCPAuthenticated(k.href,null)}),ne.success("Connected and authenticated")}else ne.success("Connected");u(P,j.app_name??null,"new"),l(P)}catch(j){console.error("Failed to connect:",j),ne.error("Failed to connect")}finally{c(null)}}};return n.jsxs(Me,{open:t,onOpenChange:e,children:[n.jsxs(Le,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[n.jsx(Fe,{className:"px-6 pt-5 pb-0 shrink-0",children:n.jsx(Ue,{className:"text-base font-semibold",children:o==="browse"?"Connections":"Add Connection"})}),n.jsx("div",{className:"pt-3 shrink-0",children:n.jsx(As,{value:m,onChange:p,placeholder:"Search connections..."})}),n.jsx(w.Suspense,{fallback:n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsx(He,{size:24,className:"animate-spin text-muted-foreground"})}),children:n.jsx(no,{mode:o,agentId:a,addedConnectionIds:d,onAdd:l,onCloneAndAdd:C,onConnectAndAdd:S,connectingItemId:V,search:m,onCreateConnection:()=>g(!0),onBrowseNavigate:_,defaultTab:s})})]}),n.jsx(to,{open:x,onOpenChange:g,onCreated:async v=>{g(!1);const j=new URL(`/api/${f.slug}/mcp/${v}`,window.location.origin),E=await rn({url:j.href,token:null,orgId:f.id});if(E.supportsOAuth&&!E.isAuthenticated){const{token:D,tokenInfo:I,error:P}=await on({connectionId:v,orgSlug:f.slug,scope:"offline_access"});if(P||!D){$("connection_oauth_failed",{connection_id:v,flow:"custom_create",error:P??"no_token"}),ne.error(`Authentication failed: ${P??"no token received"}`),await h.delete.mutateAsync(v);return}if($("connection_oauth_succeeded",{connection_id:v,flow:"custom_create"}),I)try{(await fetch(`/api/${f.slug}/connections/${v}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:I.accessToken,refreshToken:I.refreshToken,expiresIn:I.expiresIn,scope:I.scope,clientId:I.clientId,clientSecret:I.clientSecret,tokenEndpoint:I.tokenEndpoint})})).ok?await h.update.mutateAsync({id:v,data:{}}):await h.update.mutateAsync({id:v,data:{connection_token:D}})}catch{await h.update.mutateAsync({id:v,data:{connection_token:D}})}else await h.update.mutateAsync({id:v,data:{connection_token:D}});await y.invalidateQueries({queryKey:ve.isMCPAuthenticated(j.href,null)})}u(v,null,"custom"),l(v),e(!1)}})]})}const Vo='# Broken Link Finder\n\nYou are the **Broken Link Finder**, a specialist agent focused on the health of the site\'s link structure.\n\n## Your mission\n\nDiscover and track broken links and long redirect chains. You are invoked as a sub-task by an orchestrator agent — your job is to detect link health and return a structured findings report. The orchestrator decides what to do with your findings (file issues, dedup, etc.).\n\nYou are **mechanical**: collect → check → classify → emit findings. Leave subjective judgment to other agents.\n\n## Input (expect this in the prompt)\n\nThe orchestrator will pass per-site configuration. Expected fields:\n\n```yaml\nsite_root_url: <https://example.com>\nmax_pages: <optional integer, default 100, max 200>\ncheck_external: <optional bool, default false>\n```\n\nIf required fields are missing (`site_root_url`), return an error summary and stop — do not proceed with defaults or guess.\n\n## Available tools\n\n- **site-diagnostics MCP**:\n - `collect_site_links` — discovers all unique outbound link targets across the site and returns them with source-page attribution. Does NOT check status.\n - `check_urls` — takes a batch of URLs (max 100 per call) and returns their HTTP status, error kind, and redirect chains.\n\n---\n\n## Step 1 — Collect link targets (one call)\n\nCall `collect_site_links` once to get the full deduplicated list of outbound link targets and their source pages:\n\n```\ncollect_site_links({\n url: <site_root_url from input>,\n maxPages: <max_pages from input, default 100>,\n checkExternal: <check_external from input, default false>\n})\n```\n\nThis returns:\n- `links`: array of `{ targetUrl, scope: "internal"|"external", sourcePages, sourcePagesTotal }` — **each target appears exactly once**\n- Metadata: `pagesCrawled`, `pagesFetched`, `linksSkipped`, optional `error`\n\n**If `result.error` is set**, the scan failed at the root (e.g. site unreachable). Return a single finding with `kind: site-unreachable` and the error in `evidence`. Then stop.\n\nKeep the `links` array in memory — you\'ll need it in Step 3 for classification and source attribution.\n\n## Step 2 — Check the targets (batched calls)\n\nExtract `targetUrl` from each entry in `links`. Slice the resulting URL list into **disjoint batches of up to 100 URLs** and call `check_urls` on each batch:\n\n```\ncheck_urls({ urls: batch_of_100_urls })\n```\n\nCollect every batch\'s `results` entries into a single flat array. Order doesn\'t matter — you\'ll join back by `targetUrl`.\n\n**Rules for this step:**\n- Slice deterministically (e.g. consecutive slices of 100) so batches are disjoint. Do not pass the same URL in two batches.\n- Call `check_urls` sequentially or in parallel — your choice. The tool is idempotent.\n- If a single `check_urls` call errors entirely, skip that batch and continue with the others. Note the skipped count in the wrap-up summary.\n\n## Step 3 — Classify each finding\n\nFor every target with a check result, join the `collect_site_links` entry (for `scope`, `sourcePages`, `sourcePagesTotal`) with the `check_urls` entry (for `status`, `errorKind`, `chain`, `hops`).\n\nA finding is emitted for:\n- **Broken**: `status >= 400` OR `status === 0`\n- **Long redirect chain**: `hops > 3` (even if the final status is 2xx)\n\nOther targets (2xx, short-chain redirects) produce no finding.\n\nMap check result → `kind`:\n\n| Check result | `kind` |\n|---|---|\n| `status: 404` | `link-404` |\n| `status: 4xx` (not 404) | `link-4xx-other` |\n| `status: 5xx` | `link-5xx` |\n| `status: 0`, `errorKind: "dns"` | `link-dns-failure` |\n| `status: 0`, `errorKind: "redirect-loop"` | `redirect-loop` |\n| `hops > 3` (success final status) | `redirect-chain-long` |\n| `status: 0`, `errorKind: "timeout"` or `"connection"` | **skip — no finding** |\n\n**Important**: timeouts and connection errors are **not** broken links — they just mean the server didn\'t respond in our time window. Could be a slow server, an overloaded CDN, rate-limiting against our bot, or a transient network blip. Flagging these as broken produces false positives. If a URL is genuinely dead, it\'ll usually surface as `dns`, a 4xx/5xx, or a redirect loop. Skip timeout/connection entries silently.\n\n## Catalog of severity rules\n\n**High severity:**\n- `link-404` when `scope: "internal"`\n- `link-5xx` when `scope: "internal"`\n- `redirect-loop` (either scope)\n\n**Medium severity:**\n- `link-4xx-other` (internal)\n- `redirect-chain-long` (internal)\n- `link-404` (external) when `sourcePagesTotal >= 5`\n\n**Low severity:**\n- `link-404` (external) when `sourcePagesTotal < 5`\n- `link-dns-failure` (external)\n- `redirect-chain-long` (external)\n- `link-4xx-other` on external scope\n\n## Step 4 — Return a structured findings report\n\nReturn a single response with this shape (YAML preferred):\n\n```yaml\nspecialist: links\nsummary:\n pages_crawled: <pagesCrawled>\n pages_fetched: <pagesFetched>\n unique_link_targets: <links.length>\n targets_dropped_by_collect_cap: <linksSkipped>\n batches_checked: <n>\n batches_skipped_due_to_errors: <n>\n broken_links: <n> # internal + external\n long_redirect_chains: <n>\nfindings:\n - kind: <kind slug>\n severity: <low|medium|high>\n target:\n url: <full broken URL>\n route: <path if internal; otherwise the external host>\n scope: <internal | external>\n evidence: |\n - Status code / error: <e.g. `404 Not Found`, `DNS failure`, `redirect-loop`>\n - Redirect chain (if applicable): A → B → C → D → E\n - Found on pages (at time of detection):\n - /page-1\n - /page-2\n - (... up to 20 from `sourcePages`)\n - Total pages linking to this target: <sourcePagesTotal>\n impact: <1 sentence tailored to scope + kind>\n suggested_fix: |\n <actionable:>\n - If internal 404: update link to correct destination OR create 301 redirect\n - If internal 5xx: investigate server-side handler for the route (may be app bug)\n - If redirect chain: shorten to single-hop direct redirect in routing config\n - If external: update link to equivalent resource OR remove the mention\n - List likely files/components if you can infer (e.g. "appears on many pages — likely in a shared component like `app/components/Nav.tsx` or menu config")\n - ...\n```\n\nIf `collect_site_links` returned `error`, return a single `kind: site-unreachable` finding with the error in `evidence`.\n\nIf there are zero findings, return `findings: []` — that is the correct output for a healthy link graph.\n\n---\n\n## General rules\n\n- **Trust the scanner.** If `check_urls` reports a URL as broken or long-chain, emit a finding. Do not re-verify with other tools.\n- **Accept some flakiness.** A transient network blip may cause a false positive once. Downstream dedup across runs resolves it.\n- **Group by destination, not by origin.** One broken URL = one finding, even if linked on 50 pages. `collect_site_links` already returns it grouped this way.\n- **Prioritize internals.** Broken external links are the other site\'s responsibility; report but with lower severity.\n- **Never invent status codes.** Report what the scanner returned.\n',mo='# SEO Auditor\n\nYou are the **SEO Auditor**, a specialist agent focused on technical SEO hygiene.\n\n## Your mission\n\nAudit the on-page SEO health of target URLs and return a structured findings report. You focus on **technical SEO** (meta tags, structured data, canonicals, sitemap/robots, heading structure, indexability) — not editorial content or keyword strategy (those are the scope of other agents).\n\nYou are invoked as a sub-task by an orchestrator agent. Your job is to analyze and report. The orchestrator decides what to do with your findings (file issues, dedup against history, etc.).\n\n## Input (expect this in the prompt)\n\nThe orchestrator will pass per-site configuration. Expected fields:\n\n```yaml\nurls:\n - <url to audit>\n - <... one or more>\n```\n\nIf required fields are missing, return an error summary and stop — do not proceed with defaults or guess.\n\n## Available tools\n\n- **site-diagnostics MCP**: `audit_seo`, `fetch_page`, `render_page`, `crawl_site`\n\n---\n\n## Step 1 — Diagnostic\n\nFor each target URL:\n\n1. **Structured audit**: call `audit_seo({ url })`. It returns a structured report — use it as your primary source.\n2. **Raw HTML check**: use `fetch_page({ url })` to see the HTML served (important for crawlers that don\'t execute JS). Confirm critical meta tags are in the initial HTML, not only after hydration.\n3. **Post-render check**: use `render_page({ url })` to see the final DOM. Problems like canonical being overwritten by JS show up here.\n4. **Site structure checks** (only if you have permission for broad crawling, or via sampling): use `crawl_site` to identify orphan pages, canonical loops, or excessive navigation depth.\n5. **Always check**: `/robots.txt` and `/sitemap.xml` via `fetch_page`. These two are root-level and affect the whole site.\n\nOrganize findings into a list. Each finding must have:\n- `kind` (kebab-case slug, see catalog below)\n- `severity` (high | medium | low, see criteria below)\n- `target.url` and `target.route` (normalize: lowercase host, no query, no trailing slash except for `/`)\n- `evidence` (raw data: CSS selector, HTML snippet, observed value)\n- `impact` (1-2 sentences connecting to real metrics)\n- `suggested_fix` (actionable; include file/line if you can infer from framework patterns)\n\n## Step 1.5 — Validate page intent (critical; runs before classification)\n\nBefore you emit *any* finding about a page\'s title, meta description, headings, or indexability, you must answer one question: **did the site owner intend this URL to be a public, indexable page?**\n\nIf the answer is no, the observed "problems" are intentional configuration, not bugs. Reporting them wastes maintainer time and erodes this agent\'s credibility.\n\n### Three signals that the URL is NOT a real public page\n\nCheck these in order. Hitting any one of them means **skip all SEO findings for this URL** except legitimately site-wide problems (e.g. broken sitemap, broken robots.txt).\n\n**Signal 1 — Not in sitemap.** Fetch `/sitemap.xml` (and its child sitemaps, if it\'s a sitemap index). If the URL doesn\'t appear in any sitemap, the owner didn\'t declare it as public. Common on e-commerce platforms where routes like `/p`, `/c`, `/blog` are catchall or routing prefixes, not real pages.\n\n**Signal 2 — Explicit `noindex` + not in sitemap.** If the page serves `<meta name="robots" content="noindex*">` **and** isn\'t in the sitemap, this is a deliberate double-lock by the owner. Respect it. Do **not** flag `noindex-on-important-page` in this case.\n\n**Signal 3 — Title is the URL slug (template fallback).** If `<title>` equals the last path segment (e.g. `<title>blog</title>` for `/blog`, `<title>p</title>` for `/p`), the page is being rendered by a fallback template — nobody configured real content for this route. Skip.\n\n### Platform-specific catchalls (especially Brazilian e-commerce / VTEX / deco-cx)\n\nThese paths are routing prefixes, **not pages**. They may return HTTP 200 but are not meant to be indexable:\n\n- `/p`, `/c`, `/b` — VTEX product / category / brand route prefixes. Real pages live at `/<slug>/p`, `/<slug>/c`, etc. The bare prefixes are catchalls.\n- `/blog`, `/blogs`, `/editorial`, `/revista`, `/conteudo`, `/magazine`, `/noticias`, `/artigos` — common editorial prefixes. If the site doesn\'t have an editorial section, these hit a fallback.\n- `/search`, `/busca`, `/s` — search endpoints, not indexable pages.\n- `/departamento`, `/categoria` — category prefixes.\n- `/checkout`, `/cart`, `/carrinho`, `/login`, `/account`, `/minha-conta` — transactional/private routes. Intentionally `noindex`.\n\n### The "is this page actually important?" checklist\n\nBefore emitting a finding that calls a page "important" (like `noindex-on-important-page` or `title-missing` on anything critical):\n\n1. Is the URL in `/sitemap.xml`? → If no, skip.\n2. Does the page have substantive, unique content (not a fallback with title = URL slug)? → If no, skip.\n3. Is the path a known platform catchall (see list above)? → If yes, skip.\n\nOnly flag if all three pass.\n\n### What still counts as a finding even on non-indexable pages\n\nSite-wide SEO issues affect the whole domain and are worth reporting regardless of individual page intent:\n- `sitemap-missing` (the sitemap itself is broken)\n- `robots-blocking-important-path` (robots.txt blocks something that IS in the sitemap)\n- `structured-data-invalid` on pages that ARE in the sitemap\n- Duplicate titles / meta descriptions across pages that ARE in the sitemap\n\n## Catalog of `kind`\n\nTwo flavors of finding:\n\n- **Per-page** kinds — emitted when auditing a specific URL (e.g. `audit_seo` of a single page OR when your targeted inspection of one of the input URLs finds the issue). Marked **[intent-gated]** — must pass Step 1.5 before being emitted. Target is the specific URL.\n- **Aggregate** kinds — emitted once per site-wide pattern detected by `audit_seo`. Marked **[aggregate]**. Target is the site root (`/`). Evidence MUST include the affected URL sample from `audit_seo.issues[].sampleUrls`. One finding per aggregate kind per site.\n\n**High severity (per-page):**\n- `noindex-on-important-page` **[intent-gated]** — meta robots `noindex` on a page that IS in the sitemap and should be indexed\n- `canonical-pointing-to-wrong-url` **[intent-gated]** — canonical points to a different URL that isn\'t the canonical equivalent\n- `canonical-missing-on-paginated-or-faceted` **[intent-gated]** — pagination/filters without canonical\n- `title-missing` **[intent-gated]** — no `<title>` or empty on a page that IS in the sitemap\n- `structured-data-invalid` **[intent-gated]** — JSON-LD with syntax error or invalid schema.org\n\n**High severity (site-wide):**\n- `sitemap-missing` — `/sitemap.xml` returns 404 or 5xx\n- `robots-blocking-important-path` — `/robots.txt` disallows a path that IS in the sitemap\n- `broken-links-site-wide` **[aggregate]** — `audit_seo` reports broken outbound links across the site\n- `non-indexable-pages-site-wide` **[aggregate]** — `audit_seo` reports many non-indexable pages (note: some non-indexable pages are intentional catchalls — only high severity if the absolute count is large relative to `totalPagesCrawled`, e.g. > 30%)\n\n**Medium severity (per-page):**\n- `meta-description-missing` **[intent-gated]** — no `<meta name="description">` on a sitemap page the agent audited directly\n- `h1-missing` **[intent-gated]** — no `<h1>` on a sitemap page the agent audited directly\n- `h1-duplicate` **[intent-gated]** — multiple `<h1>` on a single page\n- `og-tags-missing` **[intent-gated]** — `og:title` and/or `og:description` missing\n- `structured-data-missing` **[intent-gated]** — page-type (product, article, etc.) without relevant JSON-LD\n- `title-too-long` **[intent-gated]** — `<title>` > 60 characters (truncation in SERP)\n- `title-too-short` **[intent-gated]** — `<title>` < 10 characters (rare; usually means template fallback — double-check page intent)\n- `meta-description-too-long` **[intent-gated]** — description > 160 characters\n\n**Medium severity (site-wide):**\n- `pages-missing-h1` **[aggregate]** — `audit_seo` reports N pages without an H1 tag\n- `pages-missing-meta-description` **[aggregate]** — `audit_seo` reports N pages without a meta description\n- `duplicate-titles` **[aggregate]** — multiple pages share the same `<title>`\n- `duplicate-meta-descriptions` **[aggregate]** — multiple pages share the same meta description\n- `duplicate-content` **[aggregate]** — multiple pages share substantially identical content\n- `broken-resources-site-wide` **[aggregate]** — broken images / scripts across the site\n- `hreflang-broken` — `hreflang` attribute with invalid value or broken reciprocity\n\n**Low severity (per-page):**\n- `meta-description-too-short` **[intent-gated]** — description < 50 characters\n- `og-image-missing` **[intent-gated]** — `og:image` missing\n- `heading-hierarchy-skipped` **[intent-gated]** — jumps from H1 to H3, etc.\n\n**Low severity (site-wide):**\n- `internal-link-using-absolute-url` — internal links with absolute URLs\n\n### Evidence requirements for aggregate kinds\n\nWhen emitting an `[aggregate]` kind, the `evidence` of the finding MUST include:\n\n1. **Total count** — from `audit_seo.issues[].count`\n2. **Sample URLs** — from `audit_seo.issues[].sampleUrls`. Render up to all 20 entries as a bulleted list. If `count > sampleUrls.length`, add a line like `(and <count - sampleUrls.length> more)`.\n3. **If `sampleUrls` is empty** (the tool didn\'t expose per-URL detail — happens for `broken-links-site-wide`, `duplicate-content`, `broken-resources-site-wide`), note it explicitly: `Note: audit_seo did not return per-URL detail for this issue type. A human will need to inspect the full audit_seo report or re-run with deeper crawling.`\n\nAn aggregate finding without either sample URLs or the note is **not actionable** and must not be emitted.\n\nTarget for aggregate kinds stays `target.url: https://<host>/` and `target.route: /`.\n\n## Step 2 — Return a structured findings report\n\nReturn a single response with this shape (YAML or JSON; YAML preferred for readability):\n\n```yaml\nspecialist: seo\nsummary:\n urls_audited: <n>\n findings: <n>\n diagnostic_failures: <n> # urls where audit tooling errored\nfindings:\n - kind: <kind slug>\n severity: <low|medium|high>\n target:\n url: <full URL>\n route: <normalized path>\n evidence: |\n <multi-line raw data: observed value, selector, HTML snippet, audit_seo output>\n impact: <1-2 sentences connecting to ranking/indexation/CTR>\n suggested_fix: <actionable; likely file/component, pseudo-code, correct value>\n - ...\n```\n\nIf a URL\'s diagnostic tooling errored entirely, emit a single `kind: diagnostic-failed` finding for that URL with the error in `evidence` instead of inventing data.\n\nIf there are zero findings, return `findings: []` — that is the correct output for healthy targets.\n\n---\n\n## General rules\n\n- **Never invent data in `evidence`.** If a tool failed, report it via `kind: diagnostic-failed` and skip the finding.\n- Always normalize `route`: lowercase host, no trailing slash (except for `/`), no query string, no fragment.\n- Your credibility is your currency. False positives erode trust — if you\'re 50% sure, don\'t emit a finding; investigate further or mark as `severity:low`.\n- **Never report a page as broken when it\'s a known catchall.** URLs like `/p`, `/c`, `/blog`, `/search`, `/busca` on e-commerce sites are routing prefixes, not pages. If the title is the URL slug and the page carries `noindex`, the owner is deliberately hiding it. That\'s correct behavior, not a bug.\n- **Sitemap is the ground truth for "is this page public?"**. When in doubt about whether to emit a finding on a URL, fall back to: "Is this URL in /sitemap.xml?" If not, default to silence.\n',fo=`# Performance Watchdog
|
|
2
2
|
|
|
3
3
|
You are the **Performance Watchdog**, a specialist agent focused on web performance.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as z,a as G,D as H,o as J,p as Q}from"./index-
|
|
1
|
+
import{P as z,a as G,D as H,o as J,p as Q}from"./index-Cg6ppcFr.js";function V(x){var l;const{char:D,allowSpaces:b,allowToIncludeChar:P,allowedPrefixes:E,startOfLine:F,$position:v}=x,B=b&&!P,y=Q(D),K=new RegExp(`\\s${y}$`),h=F?"^":"",M=P?"":y,N=B?new RegExp(`${h}${y}.*?(?=\\s${M}|$)`,"gm"):new RegExp(`${h}(?:^)?${y}[^\\s${M}]*`,"gm"),q=((l=v.nodeBefore)==null?void 0:l.isText)&&v.nodeBefore.text;if(!q)return null;const O=v.pos-q.length,u=Array.from(q.matchAll(N)).pop();if(!u||u.input===void 0||u.index===void 0)return null;const d=u.input.slice(Math.max(0,u.index-1),u.index),e=new RegExp(`^[${E?.join("")}\0]?$`).test(d);if(E!==null&&!e)return null;const I=O+u.index;let p=I+u[0].length;return B&&K.test(q.slice(p-1,p+1))&&(u[0]+=" ",p+=1),I<v.pos&&p>=v.pos?{range:{from:I,to:p},query:u[0].slice(D.length),text:u[0]}:null}var W=new z("suggestion");function Y({pluginKey:x=W,editor:l,char:D="@",allowSpaces:b=!1,allowToIncludeChar:P=!1,allowedPrefixes:E=[" "],startOfLine:F=!1,decorationTag:v="span",decorationClass:B="suggestion",decorationContent:y="",decorationEmptyClass:K="is-empty",command:h=()=>null,items:M=()=>[],render:N=()=>({}),allow:q=()=>!0,findSuggestionMatch:O=V,shouldShow:u}){let d;const e=N?.(),I=()=>{const n=l.state.selection.$anchor.pos,a=l.view.coordsAtPos(n),{top:r,right:s,bottom:o,left:c}=a;try{return new DOMRect(c,r,s-c,o-r)}catch{return null}},p=(n,a)=>a?()=>{const r=x.getState(l.state),s=r?.decorationId,o=n.dom.querySelector(`[data-decoration-id="${s}"]`);return o?.getBoundingClientRect()||null}:I;function U(n,a){var r;try{const o=x.getState(n.state),c=o?.decorationId?n.dom.querySelector(`[data-decoration-id="${o.decorationId}"]`):null,g={editor:l,range:o?.range||{from:0,to:0},query:o?.query||null,text:o?.text||null,items:[],command:m=>h({editor:l,range:o?.range||{from:0,to:0},props:m}),decorationNode:c,clientRect:p(n,c)};(r=e?.onExit)==null||r.call(e,g)}catch{}const s=n.state.tr.setMeta(a,{exit:!0});n.dispatch(s)}const C=new G({key:x,view(){return{update:async(n,a)=>{var r,s,o,c,g,m,S;const t=(r=this.key)==null?void 0:r.getState(a),f=(s=this.key)==null?void 0:s.getState(n.state),i=t.active&&f.active&&t.range.from!==f.range.from,_=!t.active&&f.active,A=t.active&&!f.active,R=!_&&!A&&t.query!==f.query,w=_||i&&R,k=R||i,j=A||i&&R;if(!w&&!k&&!j)return;const $=j&&!w?t:f,T=n.dom.querySelector(`[data-decoration-id="${$.decorationId}"]`);d={editor:l,range:$.range,query:$.query,text:$.text,items:[],command:L=>h({editor:l,range:$.range,props:L}),decorationNode:T,clientRect:p(n,T)},w&&((o=e?.onBeforeStart)==null||o.call(e,d)),k&&((c=e?.onBeforeUpdate)==null||c.call(e,d)),(k||w)&&(d.items=await M({editor:l,query:$.query})),j&&((g=e?.onExit)==null||g.call(e,d)),k&&((m=e?.onUpdate)==null||m.call(e,d)),w&&((S=e?.onStart)==null||S.call(e,d))},destroy:()=>{var n;d&&((n=e?.onExit)==null||n.call(e,d))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(n,a,r,s){const{isEditable:o}=l,{composing:c}=l.view,{selection:g}=n,{empty:m,from:S}=g,t={...a},f=n.getMeta(x);if(f&&f.exit)return t.active=!1,t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null,t;if(t.composing=c,o&&(m||l.view.composing)){(S<a.range.from||S>a.range.to)&&!c&&!a.composing&&(t.active=!1);const i=O({char:D,allowSpaces:b,allowToIncludeChar:P,allowedPrefixes:E,startOfLine:F,$position:g.$from}),_=`id_${Math.floor(Math.random()*4294967295)}`;i&&q({editor:l,state:s,range:i.range,isActive:a.active})&&(!u||u({editor:l,range:i.range,query:i.query,text:i.text,transaction:n}))?(t.active=!0,t.decorationId=a.decorationId?a.decorationId:_,t.range=i.range,t.query=i.query,t.text=i.text):t.active=!1}else t.active=!1;return t.active||(t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null),t}},props:{handleKeyDown(n,a){var r,s,o,c;const{active:g,range:m}=C.getState(n.state);if(!g)return!1;if(a.key==="Escape"||a.key==="Esc"){const t=C.getState(n.state),f=(r=d?.decorationNode)!=null?r:null,i=f??(t?.decorationId?n.dom.querySelector(`[data-decoration-id="${t.decorationId}"]`):null);if(((s=e?.onKeyDown)==null?void 0:s.call(e,{view:n,event:a,range:t.range}))||!1)return!0;const A={editor:l,range:t.range,query:t.query,text:t.text,items:[],command:R=>h({editor:l,range:t.range,props:R}),decorationNode:i,clientRect:i?()=>i.getBoundingClientRect()||null:null};return(o=e?.onExit)==null||o.call(e,A),U(n,x),!0}return((c=e?.onKeyDown)==null?void 0:c.call(e,{view:n,event:a,range:m}))||!1},decorations(n){const{active:a,range:r,decorationId:s,query:o}=C.getState(n);if(!a)return null;const c=!o?.length,g=[B];return c&&g.push(K),H.create(n.doc,[J.inline(r.from,r.to,{nodeName:v,class:g.join(" "),"data-decoration-id":s,"data-decoration-content":y})])}}});return C}export{Y as S};
|
package/dist/client/assets/{infiniteQueryObserver-ClYEJj89.js → infiniteQueryObserver-FXpIkCb9.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dw as d,dx as f,dy as v,dz as x}from"./index-
|
|
1
|
+
import{dw as d,dx as f,dy as v,dz as x}from"./index-B3pJqV9Y.js";var N=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:f()})}getOptimisticResult(e){return e.behavior=f(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:P,isError:c,isRefetchError:g}=i,r=s.fetchMeta?.fetchMore?.direction,h=c&&r==="forward",o=a&&r==="forward",n=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:x(t,s.data),hasPreviousPage:v(t,s.data),isFetchNextPageError:h,isFetchingNextPage:o,isFetchPreviousPageError:n,isFetchingPreviousPage:u,isRefetchError:g&&!h&&!n,isRefetching:P&&!o&&!u}}};export{N as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as s,c as a,j as d}from"./index-
|
|
1
|
+
import{e as s,c as a,j as d}from"./index-B3pJqV9Y.js";function f(l){const e=s.c(10);let i,t,r;e[0]!==l?({className:i,type:r,...t}=l,e[0]=l,e[1]=i,e[2]=t,e[3]=r):(i=e[1],t=e[2],r=e[3]);let n;e[4]!==i?(n=a("file:text-foreground text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-9 w-full min-w-0 rounded-lg bg-background dark:bg-input/30 px-3 py-1 text-sm transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:opacity-50 card-shadow","focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[2px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),e[4]=i,e[5]=n):n=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==r?(o=d.jsx("input",{type:r,"data-slot":"input",className:n,...t}),e[6]=t,e[7]=n,e[8]=r,e[9]=o):o=e[9],o}export{f as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as A,j as h,r as z,c as _}from"./index-
|
|
1
|
+
import{e as A,j as h,r as z,c as _}from"./index-B3pJqV9Y.js";import{n as L}from"./Container-Dwj81gCC.js";import{A as k}from"./agent-icon-rfR6G8ak.js";const C={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-9 w-9",md:"h-12 w-12",lg:"h-16 w-16",xl:"h-14 w-14"},Z={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-9",md:"min-w-12",lg:"min-w-16",xl:"min-w-14"},y={"2xs":8,xs:12,sm:16,md:24,lg:32,xl:28},M={"2xs":"xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"lg"};function q(E){const e=A.c(12),{icon:t,name:s,size:w,className:o,fallbackIcon:c}=E,n=w===void 0?"md":w;if(t?.startsWith("icon://")||t?.includes("#agentcolor=")){const r=M[n];let l;return e[0]!==o||e[1]!==t||e[2]!==s||e[3]!==r?(l=h.jsx(k,{icon:t,name:s,size:r,className:o}),e[0]=o,e[1]=t,e[2]=s,e[3]=r,e[4]=l):l=e[4],l}const g=t??"no-icon";let i;return e[5]!==o||e[6]!==c||e[7]!==t||e[8]!==s||e[9]!==n||e[10]!==g?(i=h.jsx(R,{icon:t,name:s,size:n,className:o,fallbackIcon:c},g),e[5]=o,e[6]=c,e[7]=t,e[8]=s,e[9]=n,e[10]=g,e[11]=i):i=e[11],i}function R(E){const e=A.c(24),{icon:t,name:s,size:w,className:o,fallbackIcon:c}=E,n=w===void 0?"md":w,[g,i]=z.useState(!1),r=!!t&&g,l=C[n],b=Z[n];let a;e[0]!==o||e[1]!==l||e[2]!==b?(a=_("rounded-lg border border-border shrink-0 overflow-hidden aspect-square bg-white",l,b,o),e[0]=o,e[1]=l,e[2]=b,e[3]=a):a=e[3];const p=t||void 0,N=!r&&"hidden";let m;e[4]!==N?(m=_("h-full w-full object-cover",N),e[4]=N,e[5]=m):m=e[5];let I,S;e[6]===Symbol.for("react.memo_cache_sentinel")?(I=()=>i(!1),S=()=>i(!0),e[6]=I,e[7]=S):(I=e[6],S=e[7]);let d;e[8]!==s||e[9]!==p||e[10]!==m?(d=h.jsx("img",{src:p,alt:s,className:m,onError:I,onLoad:S}),e[8]=s,e[9]=p,e[10]=m,e[11]=d):d=e[11];const v=r&&"hidden";let f;e[12]!==v?(f=_("h-full w-full flex items-center justify-center bg-muted/20",v),e[12]=v,e[13]=f):f=e[13];let x;e[14]!==c||e[15]!==n?(x=c??h.jsx(L,{size:y[n],className:"text-muted-foreground"}),e[14]=c,e[15]=n,e[16]=x):x=e[16];let u;e[17]!==f||e[18]!==x?(u=h.jsx("div",{className:f,children:x}),e[17]=f,e[18]=x,e[19]=u):u=e[19];let j;return e[20]!==d||e[21]!==u||e[22]!==a?(j=h.jsxs("div",{className:a,children:[d,u]}),e[20]=d,e[21]=u,e[22]=a,e[23]=j):j=e[23],j}export{q as I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as n,c as r,j as i,b5 as p}from"./index-
|
|
1
|
+
import{e as n,c as r,j as i,b5 as p}from"./index-B3pJqV9Y.js";function c(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=r("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(p,{"data-slot":"label",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{c as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as C,r as i,c as A,j as a,ao as V}from"./index-
|
|
1
|
+
import{e as C,r as i,c as A,j as a,ao as V}from"./index-B3pJqV9Y.js";import{P as E}from"./index-C7apxcAd.js";const H=i.createContext(null);function z(x){const e=C.c(3),{children:l}=x,s=i.useContext(H);if(!s?.tabsEl)return null;let c;return e[0]!==l||e[1]!==s.tabsEl?(c=V.createPortal(l,s.tabsEl),e[0]=l,e[1]=s.tabsEl,e[2]=c):c=e[2],c}function D(x){const e=C.c(3),{children:l}=x,s=i.useContext(H);if(!s?.actionsEl)return null;let c;return e[0]!==l||e[1]!==s.actionsEl?(c=V.createPortal(l,s.actionsEl),e[0]=l,e[1]=s.actionsEl,e[2]=c):c=e[2],c}const B=D;function F(x){const e=C.c(21),{children:l,breadcrumb:s,hideHeader:c}=x;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={leftEl:null,tabsEl:null,actionsEl:null},e[0]=b):b=e[0];const[w,g]=i.useState(b),N=i.useRef(null),P=i.useRef(null),L=i.useRef(null);let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=t=>{N.current=t,t&&g(n=>n.leftEl===t?n:{...n,leftEl:t})},e[1]=h):h=e[1];const $=h;let R;e[2]===Symbol.for("react.memo_cache_sentinel")?(R=t=>{P.current=t,t&&g(n=>n.tabsEl===t?n:{...n,tabsEl:t})},e[2]=R):R=e[2];const _=R;let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t=>{L.current=t,t&&g(n=>n.actionsEl===t?n:{...n,actionsEl:t})},e[3]=d):d=e[3];const k=d,p=c&&"hidden";let o;e[4]!==p?(o=A(p),e[4]=p,e[5]=o):o=e[5];let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=a.jsx("div",{ref:$,className:"flex items-center gap-2 min-w-0"}),e[6]=j):j=e[6];let r;e[7]!==s?(r=a.jsxs(E.Header.Left,{children:[s,j]}),e[7]=s,e[8]=r):r=e[8];let y;e[9]===Symbol.for("react.memo_cache_sentinel")?(y=a.jsxs(E.Header.Right,{children:[a.jsx("div",{ref:_,className:"flex items-center gap-2 overflow-x-auto min-w-0"}),a.jsx("div",{ref:k,className:"flex items-center gap-2 shrink-0"})]}),e[9]=y):y=e[9];let f;e[10]!==o||e[11]!==r?(f=a.jsxs(E.Header,{className:o,children:[r,y]}),e[10]=o,e[11]=r,e[12]=f):f=e[12];let m;e[13]!==l?(m=a.jsx(E.Content,{children:l}),e[13]=l,e[14]=m):m=e[14];let u;e[15]!==f||e[16]!==m?(u=a.jsxs(E,{children:[f,m]}),e[15]=f,e[16]=m,e[17]=u):u=e[17];let S;return e[18]!==w||e[19]!==u?(S=a.jsx(H,{value:w,children:u}),e[18]=w,e[19]=u,e[20]=S):S=e[20],S}export{F as V,B as a,z as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as U,j as t,s as V,o as we,b as Fe,r as O,K as ne,n as He,a as Be,c as xe,B as ae,t as D,x as oe,G as Je,F as Xe,v as je,P as Ze,l as Ne,w as et,f as tt}from"./index-D4IWA9IU.js";import{S as ce,u as $,d as Se,W as qe,j as be}from"./constants-B22iOAkD.js";import{a as _e}from"./use-navigate-to-agent--7ajKHhy.js";import{a as le,b as de,c as ue,d as me,D as nt}from"./dialog-ReVTOuxu.js";import{i as Ae}from"./RefreshCcw01-Dbq2QLAC.js";import{C as Qe}from"./collection-search-CLoorkFj.js";import{C as st}from"./checkbox-JSEUVCMB.js";import{b as Ee,u as it}from"./use-connection-Dy5vq_5j.js";import{i as ot}from"./Lock01-C5rgxGgu.js";import{n as at}from"./agent-icon-CLQAOsUE.js";import{e as rt}from"./extract-connection-data-CbVt8VgN.js";import{b as Oe,a as Le,c as Re,D as Me}from"./drawer-BYHJ-8Om.js";import{u as ke}from"./tooltip-B5FrLY14.js";import{I as Ue}from"./integration-icon-CNQIPioy.js";import{u as ct,d as Ye}from"./use-mcp-tools-Bog3rGRX.js";import{a as Pe,b as lt}from"./use-virtual-mcp-CDCK02Yj.js";function re(a){const e=U.c(4),{size:s,className:o}=a;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=d):d=e[0];let n;return e[1]!==o||e[2]!==s?(n=t.jsx("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:d}),e[1]=o,e[2]=s,e[3]=n):n=e[3],n}function dt(a){return a.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function ut(a){const e=await fetch(`/api/${a}/deco-sites`);if(!e.ok){const s=await e.json().catch(()=>({}));throw new Error(s.error??`Failed to load sites (${e.status})`)}return e.json()}function Wt(a){const e=U.c(70),{open:s,onOpenChange:o,onBack:d}=a,{org:n}=V(),c=_e(),u=we(),{data:l}=Fe.useSession(),[_,p]=O.useState(null),[C,g]=O.useState("");let m;e[0]!==n.id||e[1]!==n.slug?(m={connectionId:ce,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=m):m=e[2];const f=$(m);let r;e[3]!==l?.user?.email?(r=ne.decoSites(l?.user?.email),e[3]=l?.user?.email,e[4]=r):r=e[4];let h;e[5]!==n.slug?(h=()=>ut(n.slug),e[5]=n.slug,e[6]=h):h=e[6];const x=s&&!!l?.user?.email;let T;e[7]!==r||e[8]!==h||e[9]!==x?(T={queryKey:r,queryFn:h,enabled:x,staleTime:6e4,retry:!1},e[7]=r,e[8]=h,e[9]=x,e[10]=T):T=e[10];const{data:b,isLoading:N,error:y}=He(T),i=b?.sites??[];let I;e[11]!==o?(I=w=>{w||(p(null),g("")),o(w)},e[11]=o,e[12]=I):I=e[12];const v=I;let j;e[13]!==C?(j=w=>w.name.toLowerCase().includes(C.toLowerCase())||w.domains?.[0]?.domain.toLowerCase().includes(C.toLowerCase()),e[13]=C,e[14]=j):j=e[14];const S=i.filter(j),A=!_||S.some(w=>w.name===_);let E;e[15]!==f||e[16]!==n.id||e[17]!==n.slug?(E=async w=>{D("deco_site_import_started",{site_name:w});const P=await fetch(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:w,orgId:n.id})}),G=await P.json().catch(gt);if(!P.ok)throw new Error(G.error??`Failed to create connection (${P.status})`);const M=G.connId;if(!M)throw new Error("Server did not return a connection ID");const he=G.icon??null,te=dt(w),Ge=await f.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:w,description:"Imported from deco.cx",pinned:!0,icon:he??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],ui:{banner:null,bannerColor:"#22C55E",icon:he,themeColor:"#22C55E",slug:te,pinnedViews:[{connectionId:M,toolName:"file_explorer",label:"Preview",icon:null},{connectionId:M,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:M,toolName:"get_monitor_data",label:"Monitor",icon:null},{connectionId:M,toolName:"list_pull_requests",label:"Pull Requests",icon:null},{connectionId:M,toolName:"list_releases",label:"Releases",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:M,toolName:"file_explorer"}}}},connections:[{connection_id:M}]}}}),De=Ge.structuredContent??Ge;return{slug:te,virtualMcpId:De.item.id,connId:M,item:De.item}},e[15]=f,e[16]=n.id,e[17]=n.slug,e[18]=E):E=e[18];let R;e[19]!==f||e[20]!==v||e[21]!==c||e[22]!==n.id||e[23]!==u?(R=w=>{const{slug:P,virtualMcpId:G,item:M}=w;D("deco_site_import_succeeded",{site_name:M.title,virtual_mcp_id:G,slug:P}),u.setQueryData(ne.collectionItem(f,n.id,"","VIRTUAL_MCP",G),{item:M}),u.invalidateQueries({predicate:he=>{const te=he.queryKey;return te[1]===n.id&&te[3]==="collection"&&te[4]==="VIRTUAL_MCP"}}),u.invalidateQueries({queryKey:ne.projects(n.id)}),oe.success(`Imported ${P} from deco.cx`),v(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),c(G)},e[19]=f,e[20]=v,e[21]=c,e[22]=n.id,e[23]=u,e[24]=R):R=e[24];let z;e[25]!==E||e[26]!==R?(z={mutationFn:E,onSuccess:R,onError:ft},e[25]=E,e[26]=R,e[27]=z):z=e[27];const k=Be(z),se=de,L=le,ie="sm:max-w-[900px] p-0 gap-0 overflow-hidden";let F;e[28]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:"Import from deco.cx"})}),e[28]=F):F=e[28];let H;e[29]!==d?(H=d&&t.jsx("button",{type:"button",onClick:d,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(Ae,{size:18})}),e[29]=d,e[30]=H):H=e[30];let fe;e[31]===Symbol.for("react.memo_cache_sentinel")?(fe=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"}),e[31]=fe):fe=e[31];let B;e[32]!==H?(B=t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[H,fe]}),e[32]=H,e[33]=B):B=e[33];let ge;e[34]===Symbol.for("react.memo_cache_sentinel")?(ge=w=>{w.key==="Escape"&&g("")},e[34]=ge):ge=e[34];let q;e[35]!==C?(q=t.jsx("div",{children:t.jsx(Qe,{value:C,onChange:g,placeholder:"Search sites...",onKeyDown:ge})}),e[35]=C,e[36]=q):q=e[36];const We="pb-0 min-h-[300px]";let Q;e[37]!==N?(Q=N&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),e[37]=N,e[38]=Q):Q=e[38];const Ce=!N&&!y&&i.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),Ie=!N&&i.length>0&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[S.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",C,"”"]}),S.map(w=>{const P=w.domains?.find(mt)?.domain??w.domains?.[0]?.domain,G=_===w.name;return t.jsxs("button",{type:"button",onClick:()=>p(w.name),className:xe("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",G?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:w.thumb_url?t.jsx("img",{src:w.thumb_url,alt:w.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:w.name}),P&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:P})]})]},w.name)})]});let Y;e[39]!==Q||e[40]!==Ce||e[41]!==Ie?(Y=t.jsxs("div",{className:We,children:[Q,Ce,Ie]}),e[39]=Q,e[40]=Ce,e[41]=Ie,e[42]=Y):Y=e[42];let K;e[43]!==v?(K=()=>v(!1),e[43]=v,e[44]=K):K=e[44];let W;e[45]!==k.isPending||e[46]!==K?(W=t.jsx(ae,{variant:"outline",onClick:K,disabled:k.isPending,children:"Cancel"}),e[45]=k.isPending,e[46]=K,e[47]=W):W=e[47];const Te=!_||!A||k.isPending||N;let J;e[48]!==k||e[49]!==_?(J=()=>_&&k.mutate(_),e[48]=k,e[49]=_,e[50]=J):J=e[50];const ye=k.isPending?"Importing...":"Import";let X;e[51]!==Te||e[52]!==J||e[53]!==ye?(X=t.jsx(ae,{disabled:Te,onClick:J,children:ye}),e[51]=Te,e[52]=J,e[53]=ye,e[54]=X):X=e[54];let Z;e[55]!==W||e[56]!==X?(Z=t.jsxs(nt,{className:"px-8 py-5 border-t border-border",children:[W,X]}),e[55]=W,e[56]=X,e[57]=Z):Z=e[57];let ee;e[58]!==L||e[59]!==F||e[60]!==B||e[61]!==q||e[62]!==Y||e[63]!==Z?(ee=t.jsxs(L,{className:ie,children:[F,B,q,Y,Z]}),e[58]=L,e[59]=F,e[60]=B,e[61]=q,e[62]=Y,e[63]=Z,e[64]=ee):ee=e[64];let pe;return e[65]!==se||e[66]!==v||e[67]!==s||e[68]!==ee?(pe=t.jsx(se,{open:s,onOpenChange:v,children:ee}),e[65]=se,e[66]=v,e[67]=s,e[68]=ee,e[69]=pe):pe=e[69],pe}function mt(a){return a.production}function ft(a){D("deco_site_import_failed",{error:a instanceof Error?a.message:"Unknown error"}),oe.error("Import failed: "+(a instanceof Error?a.message:"Unknown error"))}function gt(){return{}}function Ke(a,e){const s=U.c(12),{org:o}=V();let d;s[0]!==o.id?(d=Se.REGISTRY(o.id),s[0]=o.id,s[1]=d):d=s[1];const n=d;let c;s[2]!==o.id||s[3]!==o.slug||s[4]!==n?(c={connectionId:n,orgId:o.id,orgSlug:o.slug},s[2]=o.id,s[3]=o.slug,s[4]=n,s[5]=c):c=s[5];const u=$(c);let l;s[6]!==a?(l={name:a},s[6]=a,s[7]=l):l=s[7];const _=e?.enabled??!0;let p;return s[8]!==u||s[9]!==l||s[10]!==_?(p={client:u,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:l,enabled:_,staleTime:3e5,select:pt},s[8]=u,s[9]=l,s[10]=_,s[11]=p):p=s[11],ct(p)}function pt(a){return a.structuredContent?.item??null}const ht="deco/mcp-github";function xt(a){const{org:e}=V(),{data:s}=Fe.useSession(),o=Ee(),d=we(),[n,c]=O.useState("idle"),[u,l]=O.useState(null),[_,p]=O.useState(null),{data:C,isLoading:g}=Ke(ht,{enabled:a.enabled}),m=O.useRef(!1);a.enabled&&C&&!g&&!m.current&&s?.user?.id&&n==="idle"&&(m.current=!0,f());async function f(){if(!(!C||!s?.user?.id||!e))try{c("installing"),l(null);const h=rt(C,e.id,s.user.id,{remoteIndex:0});if(!h.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:T}=await o.create.mutateAsync(h);c("authenticating");const b=new URL(`/api/${e.slug}/mcp/${T}`,window.location.origin),N=await Je({url:b.href,token:null,orgId:e.id});if(N.supportsOAuth&&!N.isAuthenticated){const{token:y,tokenInfo:i,error:I}=await Xe({connectionId:T,orgSlug:e.slug,scope:"offline_access"});if(I||!y){try{await o.delete.mutateAsync(T)}catch{}throw new Error(I??"No token received from GitHub")}if(i)try{(await fetch(`/api/${e.slug}/connections/${T}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:i.accessToken,refreshToken:i.refreshToken,expiresIn:i.expiresIn,scope:i.scope,clientId:i.clientId,clientSecret:i.clientSecret,tokenEndpoint:i.tokenEndpoint})})).ok||await o.update.mutateAsync({id:T,data:{connection_token:y}})}catch{await o.update.mutateAsync({id:T,data:{connection_token:y}})}}je(d,e.id),p(h),c("ready")}catch(h){l(h instanceof Error?h.message:String(h)),c("error")}}function r(){c("idle"),l(null),p(null),m.current=!1}return a.enabled&&g&&n==="idle"?{status:"installing",error:null,connection:null,retry:r}:{status:n,error:u,connection:_,retry:r}}function Jt(a){const e=U.c(21),{open:s,onOpenChange:o,title:d,hideAutoRespondCheckbox:n,onImportComplete:c}=a,u=d===void 0?"Import from GitHub":d,l=n===void 0?!1:n,[_]=Ze(),[p,C]=O.useState(null);if(!_.experimental_vibecode)return null;let g;e[0]!==u?(g=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:u})}),e[0]=u,e[1]=g):g=e[1];let m;e[2]!==p||e[3]!==u?(m=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:p?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>C(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Ae,{size:16})}),t.jsx("img",{src:p.avatarUrl,alt:p.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:p.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(re,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:u})]})}),e[2]=p,e[3]=u,e[4]=m):m=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=f):f=e[5];let r;e[6]!==o?(r=()=>o(!1),e[6]=o,e[7]=r):r=e[7];let h;e[8]!==l||e[9]!==c||e[10]!==p||e[11]!==r?(h=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(O.Suspense,{fallback:f,children:t.jsx(Nt,{onComplete:r,selectedInstallation:p,onSelectInstallation:C,hideAutoRespondCheckbox:l,onImportComplete:c})})}),e[8]=l,e[9]=c,e[10]=p,e[11]=r,e[12]=h):h=e[12];let x;e[13]!==g||e[14]!==m||e[15]!==h?(x=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[g,m,h]}),e[13]=g,e[14]=m,e[15]=h,e[16]=x):x=e[16];let T;return e[17]!==o||e[18]!==s||e[19]!==x?(T=t.jsx(de,{open:s,onOpenChange:o,children:x}),e[17]=o,e[18]=s,e[19]=x,e[20]=T):T=e[20],T}function Nt({onComplete:a,selectedInstallation:e,onSelectInstallation:s,hideAutoRespondCheckbox:o,onImportComplete:d}){const{org:n}=V(),c=we(),u=_e(),[l,_]=O.useState(null),[p,C]=O.useState(!0),g=o?!0:p,m=it({slug:"mcp-github"}),f=xt({enabled:m.length===0}),r=m.length===1?m[0]??null:l,h=$({connectionId:r?.id??"",orgId:n.id,orgSlug:n.slug}),x=$({connectionId:ce,orgId:n.id,orgSlug:n.slug}),T=async(i,I)=>{try{const j=await h.callTool({name:"get_file_contents",arguments:{owner:i.owner,repo:i.name,path:I}});if(j.isError)return null;const A=j.content?.find(E=>E.type==="resource")?.resource?.text;if(!A)return null;try{const E=JSON.parse(A);return typeof E=="string"?E:JSON.stringify(E)}catch{return A}}catch{return null}},b=(i,I)=>{Promise.all([T(I,"AGENTS.md"),T(I,"CLAUDE.md")]).then(async([v,j])=>{const S=v??j??null;S&&(await x.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:i,data:{metadata:{instructions:S}}}}),je(c,n.id))}).catch(v=>{console.error("GitHub instructions fetch failed:",v)})},N=async({virtualMcpId:i,repo:I,connectionId:v})=>{const j=await h.callTool({name:"TRIGGER_LIST",arguments:{}}),S=j.structuredContent??j,A=S.triggers?.find(L=>L.type==="github.issues.opened")??S.triggers?.find(L=>{const ie=L.type.toLowerCase();return/\bissues?\./.test(ie)&&(ie.endsWith(".opened")||ie.endsWith(".created"))});if(!A)throw new Error("No issue-created trigger exposed by GitHub connection");const E=new Set;if(Array.isArray(A.params))for(const L of A.params)E.add(L.name);else if(A.params&&typeof A.params=="object")for(const L of Object.keys(A.params))E.add(L);if(A.paramsSchema)for(const L of Object.keys(A.paramsSchema))E.add(L);const R={};E.has("repo")?R.repo=`${I.owner}/${I.name}`:(E.has("owner")&&(R.owner=I.owner),E.has("name")&&(R.name=I.name),E.has("repository")&&(R.repository=`${I.owner}/${I.name}`));const z=`A new GitHub issue has been opened in ${I.owner}/${I.name}. Read the issue details, explore the relevant code in the repository, create a new branch, implement the fix or feature requested, and open a pull request that resolves the issue. Reference the issue number in the PR description.`,k=await x.callTool({name:"AUTOMATION_CREATE",arguments:{name:`${I.name}: auto-respond to issues`,virtual_mcp_id:i,agent:{id:i},messages:z,active:!0}}),se=k.structuredContent??k;await x.callTool({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:se.id,type:"event",connection_id:v,event_type:A.type,params:R}})},y=Be({mutationFn:async i=>{if(!r||!e)throw new Error("No GitHub connection or installation");const I=r.id,v=await x.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:i.name,description:i.description||"Imported from GitHub",pinned:!0,icon:null,metadata:{githubRepo:{owner:i.owner,name:i.name,url:i.url,installationId:e.installationId,connectionId:I},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"}}}},connections:[{connection_id:I}]}}}),j=v.structuredContent??v,S=j.item.id;return g&&await N({virtualMcpId:S,repo:i,connectionId:I}).catch(A=>{console.error("Failed to set up issue automation:",A),oe.warning("Imported repo, but failed to set up issue auto-response. You can add the trigger manually from the automations view.")}),{virtualMcpId:S,repo:i,connectionId:I,item:j.item}},onSuccess:({virtualMcpId:i,repo:I,connectionId:v,item:j})=>{if(c.setQueryData(ne.collectionItem(x,n.id,"","VIRTUAL_MCP",i),{item:j}),je(c,n.id),b(i,I),d){d({virtualMcpId:i,repo:I,connectionId:v});return}oe.success(`Imported ${I.name} from GitHub`),a(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),u(i)},onError:i=>{oe.error("Failed to import repo: "+(i instanceof Error?i.message:"Unknown error"))}});return f.status==="installing"||f.status==="authenticating"?t.jsx(ve,{status:f.status,error:null,retry:f.retry}):f.status==="error"?t.jsx(ve,{status:"error",error:f.error,retry:f.retry}):m.length===0&&f.status==="idle"?t.jsx(ve,{status:"installing",error:null,retry:f.retry}):m.length>1&&!r?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),m.map(i=>t.jsxs("button",{type:"button",onClick:()=>_(i),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[i.icon?t.jsx("img",{src:i.icon,alt:i.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(re,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:i.title})]},i.id))]}):r?e?t.jsx(Ct,{connectionId:r.id,orgId:n.id,orgSlug:n.slug,installation:e,onSelectRepo:i=>y.mutate(i),isSaving:y.isPending,autoRespondToIssues:p,onAutoRespondChange:C,hideAutoRespondCheckbox:o}):t.jsx(_t,{connectionId:r.id,orgId:n.id,orgSlug:n.slug,onSelect:s,showBackButton:m.length>1,onBack:()=>_(null)}):null}function _t(a){const e=U.c(31),{connectionId:s,orgId:o,orgSlug:d,onSelect:n,showBackButton:c,onBack:u}=a;let l;e[0]!==o||e[1]!==d?(l={connectionId:ce,orgId:o,orgSlug:d},e[0]=o,e[1]=d,e[2]=l):l=e[2];const _=$(l);let p;e[3]!==s||e[4]!==o?(p=ne.githubUserOrgs(o,s),e[3]=s,e[4]=o,e[5]=p):p=e[5];let C;e[6]!==s||e[7]!==_?(C=async()=>{const I=(await _.callTool({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:s}})).content?.[0]?.text;if(!I)throw new Error("No response from GITHUB_LIST_USER_ORGS");return JSON.parse(I)},e[6]=s,e[7]=_,e[8]=C):C=e[8];let g;e[9]!==p||e[10]!==C?(g={queryKey:p,queryFn:C},e[9]=p,e[10]=C,e[11]=g):g=e[11];const m=He(g);if(m.isLoading){let i;return e[12]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=i):i=e[12],i}if(m.isError){let i;return e[13]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=i):i=e[13],i}const f=m.data;if(!f)return null;let r;e[14]!==u||e[15]!==c?(r=c&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ae,{size:12}),"Change connection"]})}),e[14]=u,e[15]=c,e[16]=r):r=e[16];let h;if(e[17]!==f.installations||e[18]!==n){let i;e[20]!==n?(i=I=>t.jsxs("button",{type:"button",onClick:()=>n(I),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:I.avatarUrl,alt:I.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:I.login}),I.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},I.installationId),e[20]=n,e[21]=i):i=e[21],h=f.installations.map(i),e[17]=f.installations,e[18]=n,e[19]=h}else h=e[19];let x;e[22]!==h?(x=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:h}),e[22]=h,e[23]=x):x=e[23];const T=f.appSlug?`https://github.com/apps/${f.appSlug}/installations/new`:"https://github.com/settings/installations";let b;e[24]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=b):b=e[24];let N;e[25]!==T?(N=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",b]})}),e[25]=T,e[26]=N):N=e[26];let y;return e[27]!==N||e[28]!==r||e[29]!==x?(y=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r,x,N]}),e[27]=N,e[28]=r,e[29]=x,e[30]=y):y=e[30],y}function Ct(a){const e=U.c(25),{connectionId:s,orgId:o,orgSlug:d,installation:n,onSelectRepo:c,isSaving:u,autoRespondToIssues:l,onAutoRespondChange:_,hideAutoRespondCheckbox:p}=a,[C,g]=O.useState(""),m=O.useDeferredValue(C),f=C!==m;let r;e[0]!==f||e[1]!==C?(r=t.jsx(Qe,{placeholder:"Search repositories...",value:C,onChange:g,isSearching:f}),e[0]=f,e[1]=C,e[2]=r):r=e[2];const h=f?"opacity-40":"opacity-100";let x;e[3]!==h?(x=xe("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",h),e[3]=h,e[4]=x):x=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=T):T=e[5];let b;e[6]!==s||e[7]!==m||e[8]!==n||e[9]!==u||e[10]!==c||e[11]!==o||e[12]!==d?(b=t.jsx(O.Suspense,{fallback:T,children:t.jsx(It,{connectionId:s,orgId:o,orgSlug:d,installation:n,query:m,onSelectRepo:c,isSaving:u})}),e[6]=s,e[7]=m,e[8]=n,e[9]=u,e[10]=c,e[11]=o,e[12]=d,e[13]=b):b=e[13];let N;e[14]!==x||e[15]!==b?(N=t.jsx("div",{className:x,children:b}),e[14]=x,e[15]=b,e[16]=N):N=e[16];let y;e[17]!==l||e[18]!==p||e[19]!==_?(y=!p&&t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0 cursor-pointer select-none",children:[t.jsx(st,{checked:l,onCheckedChange:I=>_(I===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Auto-respond to new issues with a PR"})]}),e[17]=l,e[18]=p,e[19]=_,e[20]=y):y=e[20];let i;return e[21]!==r||e[22]!==N||e[23]!==y?(i=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r,N,y]}),e[21]=r,e[22]=N,e[23]=y,e[24]=i):i=e[24],i}function It(a){const e=U.c(29),{connectionId:s,orgId:o,orgSlug:d,installation:n,query:c,onSelectRepo:u,isSaving:l}=a;let _;e[0]!==s||e[1]!==o||e[2]!==d?(_={connectionId:s,orgId:o,orgSlug:d},e[0]=s,e[1]=o,e[2]=d,e[3]=_):_=e[3];const p=$(_),C=n.type==="User"?"user":"org",g=c?`${C}:${n.login} ${c} in:name`:`${C}:${n.login}`;let m;e[4]!==s||e[5]!==n.login||e[6]!==o||e[7]!==c?(m=ne.githubOrgRepos(o,s,n.login,c),e[4]=s,e[5]=n.login,e[6]=o,e[7]=c,e[8]=m):m=e[8];let f;e[9]!==p||e[10]!==g?(f=async()=>{const N=(await p.callTool({name:"search_repositories",arguments:{query:g,page:1,perPage:30}})).content?.[0]?.text;if(!N)throw new Error("No response from search_repositories");return(JSON.parse(N).items??[]).map(Tt)},e[9]=p,e[10]=g,e[11]=f):f=e[11];let r;e[12]!==m||e[13]!==f?(r={queryKey:m,queryFn:f},e[12]=m,e[13]=f,e[14]=r):r=e[14];const{data:h}=et(r);if(h.length===0){let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=b):b=e[15];let N;e[16]!==c?(N=c&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=c,e[17]=N):N=e[17];let y;return e[18]!==N?(y=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[b,N]}),e[18]=N,e[19]=y):y=e[19],y}let x;if(e[20]!==l||e[21]!==u||e[22]!==h){let b;e[24]!==l||e[25]!==u?(b=N=>t.jsxs("button",{type:"button",onClick:()=>u(N),disabled:l,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(re,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:N.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[N.private?t.jsx(ot,{size:10}):t.jsx(at,{size:10}),N.private?"Private":"Public"]})]},N.fullName),e[24]=l,e[25]=u,e[26]=b):b=e[26],x=h.map(b),e[20]=l,e[21]=u,e[22]=h,e[23]=x}else x=e[23];let T;return e[27]!==x?(T=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:x}),e[27]=x,e[28]=T):T=e[28],T}function Tt(a){return{name:a.name,fullName:a.full_name,owner:a.full_name.split("/")[0]??"",url:a.html_url,private:a.private,description:a.description,updatedAt:a.updated_at}}function ve(a){const e=U.c(33),{status:s,error:o,retry:d}=a;if(s==="error"){let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-destructive"})}),e[0]=i):i=e[0];let I;e[1]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=I):I=e[1];const v=o??"Something went wrong while connecting to GitHub.";let j;e[2]!==v?(j=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[I,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:v})]}),e[2]=v,e[3]=j):j=e[3];let S;e[4]!==d?(S=t.jsx("button",{type:"button",onClick:d,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=d,e[5]=S):S=e[5];let A;return e[6]!==j||e[7]!==S?(A=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[i,j,S]}),e[6]=j,e[7]=S,e[8]=A):A=e[8],A}const n=s==="authenticating";let c;e[9]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-foreground"})}),e[9]=c):c=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"relative size-10",children:[c,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(Ne,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=u):u=e[10];const l=n?"Authenticating with GitHub":"Setting up GitHub";let _;e[11]!==l?(_=t.jsx("p",{className:"text-sm font-medium",children:l}),e[11]=l,e[12]=_):_=e[12];const p=n?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let C;e[13]!==p?(C=t.jsx("p",{className:"text-xs text-muted-foreground",children:p}),e[13]=p,e[14]=C):C=e[14];let g;e[15]!==_||e[16]!==C?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[_,C]}),e[15]=_,e[16]=C,e[17]=g):g=e[17];const m=n?"bg-muted-foreground/30":"bg-foreground animate-pulse";let f;e[18]!==m?(f=xe("size-1.5 rounded-full",m),e[18]=m,e[19]=f):f=e[19];let r;e[20]!==f?(r=t.jsx("span",{className:f}),e[20]=f,e[21]=r):r=e[21];const h=n?"bg-foreground animate-pulse":"bg-muted-foreground/30";let x;e[22]!==h?(x=xe("size-1.5 rounded-full",h),e[22]=h,e[23]=x):x=e[23];let T;e[24]!==x?(T=t.jsx("span",{className:x}),e[24]=x,e[25]=T):T=e[25];let b;e[26]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=b):b=e[26];let N;e[27]!==r||e[28]!==T?(N=t.jsxs("div",{className:"flex items-center gap-1.5",children:[r,T,b]}),e[27]=r,e[28]=T,e[29]=N):N=e[29];let y;return e[30]!==N||e[31]!==g?(y=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[u,g,N]}),e[30]=N,e[31]=g,e[32]=y):y=e[32],y}const yt=["Full HAR capture with cache, TTFB, and request analysis","Screenshot capture for visual inspection","Page discovery via sitemap, navigation, and link crawling","SEO audit — meta tags, structured data, robots.txt","Third-party script inventory and size analysis","Dead link detection across the entire site","Deco-specific diagnostics (?__d debug mode)"];function $e(a){const e=U.c(7),{onRecruit:s,isRecruiting:o,isLoading:d}=a;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a blackbox diagnostics agent that tests your storefront from the outside — no internal access needed. Give it a URL and it produces a detailed performance and health report."}),e[0]=n):n=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=c):c=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"space-y-2",children:[c,t.jsx("ul",{className:"space-y-1.5",children:yt.map(bt)})]}),e[2]=u):u=e[2];const l=o||d,_=o?"Setting up...":"Add Site Diagnostics";let p;return e[3]!==s||e[4]!==l||e[5]!==_?(p=t.jsxs("div",{className:"flex flex-col gap-6",children:[n,u,t.jsx(ae,{onClick:s,disabled:l,className:"w-full cursor-pointer",children:_})]}),e[3]=s,e[4]=l,e[5]=_,e[6]=p):p=e[6],p}function bt(a){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),a]},a)}function Xt({open:a,onOpenChange:e,existingAgent:s}){const o=ke(),{org:d}=V(),n=_e(),c=Ee(),u=Pe(),l=$({connectionId:ce,orgId:d.id,orgSlug:d.slug}),_=Ye({client:l}),[p,C]=O.useState(!1),g=qe.find(y=>y.id==="site-diagnostics"),{data:m,isLoading:f}=Ke(g.appId,{enabled:a}),r=m?.title||m?.server?.title||m?.server?.name||g.title,h=m?.server?.icons?.[0]?.src??g.icon,x=m?.server?.description??null,T=t.jsx(Ue,{icon:h,name:r,size:"sm"}),b=async()=>{if(m){if(s){e(!1),n(s.id);return}C(!0);try{const y=await _.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:g.appId},limit:1,offset:0}});let i;const v=y?.structuredContent?.items?.find(S=>S.app_id===g.appId);if(v)i=v.id;else{const S=m.server?.remotes?.[0]?.url;if(!S)throw new Error("Registry item is missing a remote URL for site-diagnostics");i=(await c.create.mutateAsync({title:r,description:x,icon:m.server?.icons?.[0]?.src??g.icon,connection_type:"HTTP",connection_url:S,app_name:m.server?.name??"site-diagnostics",app_id:g.appId,metadata:{type:"site-diagnostics",source:"store",registry_item_id:g.appId,verified:!0}})).id}const j=await u.create.mutateAsync({title:r,description:x,icon:h,status:"active",connections:[{connection_id:i,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"site-diagnostics",instructions:null,ui:{pinnedViews:[{connectionId:i,toolName:"diagnose",label:"diagnose",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:i,toolName:"diagnose"}}}}});D("agent_recruit_confirmed",{template_id:"site-diagnostics",agent_id:j.id}),e(!1),n(j.id)}catch(y){D("agent_recruit_failed",{template_id:"site-diagnostics",error:y instanceof Error?y.message:String(y)}),console.error("Failed to create Site Diagnostics agent:",y)}finally{C(!1)}}},N=`Add ${r}`;return o?t.jsx(Oe,{open:a,onOpenChange:e,children:t.jsxs(Le,{className:"h-[70dvh]",children:[t.jsx(Re,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[T,t.jsx(Me,{className:"text-xl font-semibold",children:N})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx($e,{onRecruit:b,isRecruiting:p,isLoading:f})})]})}):t.jsx(de,{open:a,onOpenChange:e,children:t.jsxs(le,{className:"sm:max-w-[500px] p-8",children:[t.jsx(ue,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[T,t.jsx(me,{className:"text-xl font-semibold",children:N})]})}),t.jsx($e,{onRecruit:b,isRecruiting:p,isLoading:f})]})})}const vt=`<role>
|
|
1
|
+
import{e as U,j as t,s as V,o as we,b as Fe,r as O,K as ne,n as He,a as Be,c as xe,B as ae,t as D,x as oe,G as Je,F as Xe,v as je,P as Ze,l as Ne,w as et,f as tt}from"./index-B3pJqV9Y.js";import{S as ce,u as $,d as Se,W as qe,j as be}from"./constants-DzBa_pVv.js";import{a as _e}from"./use-navigate-to-agent-DNFfIi8H.js";import{a as le,b as de,c as ue,d as me,D as nt}from"./dialog-DJXnl186.js";import{i as Ae}from"./RefreshCcw01-B6WkaYVq.js";import{C as Qe}from"./collection-search-C4byKAjw.js";import{C as st}from"./checkbox-BC2-36Db.js";import{b as Ee,u as it}from"./use-connection-CesZaYzK.js";import{i as ot}from"./Lock01-NMXz4ptn.js";import{n as at}from"./agent-icon-rfR6G8ak.js";import{e as rt}from"./extract-connection-data-DV87vwuC.js";import{b as Oe,a as Le,c as Re,D as Me}from"./drawer-CKRLj2vr.js";import{u as ke}from"./tooltip-DZIo6YZX.js";import{I as Ue}from"./integration-icon-BrsREj94.js";import{u as ct,d as Ye}from"./use-mcp-tools-oIEGFyCT.js";import{a as Pe,b as lt}from"./use-virtual-mcp-CEUQCho1.js";function re(a){const e=U.c(4),{size:s,className:o}=a;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=d):d=e[0];let n;return e[1]!==o||e[2]!==s?(n=t.jsx("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:d}),e[1]=o,e[2]=s,e[3]=n):n=e[3],n}function dt(a){return a.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function ut(a){const e=await fetch(`/api/${a}/deco-sites`);if(!e.ok){const s=await e.json().catch(()=>({}));throw new Error(s.error??`Failed to load sites (${e.status})`)}return e.json()}function Wt(a){const e=U.c(70),{open:s,onOpenChange:o,onBack:d}=a,{org:n}=V(),c=_e(),u=we(),{data:l}=Fe.useSession(),[_,p]=O.useState(null),[C,g]=O.useState("");let m;e[0]!==n.id||e[1]!==n.slug?(m={connectionId:ce,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=m):m=e[2];const f=$(m);let r;e[3]!==l?.user?.email?(r=ne.decoSites(l?.user?.email),e[3]=l?.user?.email,e[4]=r):r=e[4];let h;e[5]!==n.slug?(h=()=>ut(n.slug),e[5]=n.slug,e[6]=h):h=e[6];const x=s&&!!l?.user?.email;let T;e[7]!==r||e[8]!==h||e[9]!==x?(T={queryKey:r,queryFn:h,enabled:x,staleTime:6e4,retry:!1},e[7]=r,e[8]=h,e[9]=x,e[10]=T):T=e[10];const{data:b,isLoading:N,error:y}=He(T),i=b?.sites??[];let I;e[11]!==o?(I=w=>{w||(p(null),g("")),o(w)},e[11]=o,e[12]=I):I=e[12];const v=I;let j;e[13]!==C?(j=w=>w.name.toLowerCase().includes(C.toLowerCase())||w.domains?.[0]?.domain.toLowerCase().includes(C.toLowerCase()),e[13]=C,e[14]=j):j=e[14];const S=i.filter(j),A=!_||S.some(w=>w.name===_);let E;e[15]!==f||e[16]!==n.id||e[17]!==n.slug?(E=async w=>{D("deco_site_import_started",{site_name:w});const P=await fetch(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:w,orgId:n.id})}),G=await P.json().catch(gt);if(!P.ok)throw new Error(G.error??`Failed to create connection (${P.status})`);const M=G.connId;if(!M)throw new Error("Server did not return a connection ID");const he=G.icon??null,te=dt(w),Ge=await f.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:w,description:"Imported from deco.cx",pinned:!0,icon:he??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],ui:{banner:null,bannerColor:"#22C55E",icon:he,themeColor:"#22C55E",slug:te,pinnedViews:[{connectionId:M,toolName:"file_explorer",label:"Preview",icon:null},{connectionId:M,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:M,toolName:"get_monitor_data",label:"Monitor",icon:null},{connectionId:M,toolName:"list_pull_requests",label:"Pull Requests",icon:null},{connectionId:M,toolName:"list_releases",label:"Releases",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:M,toolName:"file_explorer"}}}},connections:[{connection_id:M}]}}}),De=Ge.structuredContent??Ge;return{slug:te,virtualMcpId:De.item.id,connId:M,item:De.item}},e[15]=f,e[16]=n.id,e[17]=n.slug,e[18]=E):E=e[18];let R;e[19]!==f||e[20]!==v||e[21]!==c||e[22]!==n.id||e[23]!==u?(R=w=>{const{slug:P,virtualMcpId:G,item:M}=w;D("deco_site_import_succeeded",{site_name:M.title,virtual_mcp_id:G,slug:P}),u.setQueryData(ne.collectionItem(f,n.id,"","VIRTUAL_MCP",G),{item:M}),u.invalidateQueries({predicate:he=>{const te=he.queryKey;return te[1]===n.id&&te[3]==="collection"&&te[4]==="VIRTUAL_MCP"}}),u.invalidateQueries({queryKey:ne.projects(n.id)}),oe.success(`Imported ${P} from deco.cx`),v(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),c(G)},e[19]=f,e[20]=v,e[21]=c,e[22]=n.id,e[23]=u,e[24]=R):R=e[24];let z;e[25]!==E||e[26]!==R?(z={mutationFn:E,onSuccess:R,onError:ft},e[25]=E,e[26]=R,e[27]=z):z=e[27];const k=Be(z),se=de,L=le,ie="sm:max-w-[900px] p-0 gap-0 overflow-hidden";let F;e[28]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:"Import from deco.cx"})}),e[28]=F):F=e[28];let H;e[29]!==d?(H=d&&t.jsx("button",{type:"button",onClick:d,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(Ae,{size:18})}),e[29]=d,e[30]=H):H=e[30];let fe;e[31]===Symbol.for("react.memo_cache_sentinel")?(fe=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"}),e[31]=fe):fe=e[31];let B;e[32]!==H?(B=t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[H,fe]}),e[32]=H,e[33]=B):B=e[33];let ge;e[34]===Symbol.for("react.memo_cache_sentinel")?(ge=w=>{w.key==="Escape"&&g("")},e[34]=ge):ge=e[34];let q;e[35]!==C?(q=t.jsx("div",{children:t.jsx(Qe,{value:C,onChange:g,placeholder:"Search sites...",onKeyDown:ge})}),e[35]=C,e[36]=q):q=e[36];const We="pb-0 min-h-[300px]";let Q;e[37]!==N?(Q=N&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),e[37]=N,e[38]=Q):Q=e[38];const Ce=!N&&!y&&i.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),Ie=!N&&i.length>0&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[S.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",C,"”"]}),S.map(w=>{const P=w.domains?.find(mt)?.domain??w.domains?.[0]?.domain,G=_===w.name;return t.jsxs("button",{type:"button",onClick:()=>p(w.name),className:xe("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",G?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:w.thumb_url?t.jsx("img",{src:w.thumb_url,alt:w.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:w.name}),P&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:P})]})]},w.name)})]});let Y;e[39]!==Q||e[40]!==Ce||e[41]!==Ie?(Y=t.jsxs("div",{className:We,children:[Q,Ce,Ie]}),e[39]=Q,e[40]=Ce,e[41]=Ie,e[42]=Y):Y=e[42];let K;e[43]!==v?(K=()=>v(!1),e[43]=v,e[44]=K):K=e[44];let W;e[45]!==k.isPending||e[46]!==K?(W=t.jsx(ae,{variant:"outline",onClick:K,disabled:k.isPending,children:"Cancel"}),e[45]=k.isPending,e[46]=K,e[47]=W):W=e[47];const Te=!_||!A||k.isPending||N;let J;e[48]!==k||e[49]!==_?(J=()=>_&&k.mutate(_),e[48]=k,e[49]=_,e[50]=J):J=e[50];const ye=k.isPending?"Importing...":"Import";let X;e[51]!==Te||e[52]!==J||e[53]!==ye?(X=t.jsx(ae,{disabled:Te,onClick:J,children:ye}),e[51]=Te,e[52]=J,e[53]=ye,e[54]=X):X=e[54];let Z;e[55]!==W||e[56]!==X?(Z=t.jsxs(nt,{className:"px-8 py-5 border-t border-border",children:[W,X]}),e[55]=W,e[56]=X,e[57]=Z):Z=e[57];let ee;e[58]!==L||e[59]!==F||e[60]!==B||e[61]!==q||e[62]!==Y||e[63]!==Z?(ee=t.jsxs(L,{className:ie,children:[F,B,q,Y,Z]}),e[58]=L,e[59]=F,e[60]=B,e[61]=q,e[62]=Y,e[63]=Z,e[64]=ee):ee=e[64];let pe;return e[65]!==se||e[66]!==v||e[67]!==s||e[68]!==ee?(pe=t.jsx(se,{open:s,onOpenChange:v,children:ee}),e[65]=se,e[66]=v,e[67]=s,e[68]=ee,e[69]=pe):pe=e[69],pe}function mt(a){return a.production}function ft(a){D("deco_site_import_failed",{error:a instanceof Error?a.message:"Unknown error"}),oe.error("Import failed: "+(a instanceof Error?a.message:"Unknown error"))}function gt(){return{}}function Ke(a,e){const s=U.c(12),{org:o}=V();let d;s[0]!==o.id?(d=Se.REGISTRY(o.id),s[0]=o.id,s[1]=d):d=s[1];const n=d;let c;s[2]!==o.id||s[3]!==o.slug||s[4]!==n?(c={connectionId:n,orgId:o.id,orgSlug:o.slug},s[2]=o.id,s[3]=o.slug,s[4]=n,s[5]=c):c=s[5];const u=$(c);let l;s[6]!==a?(l={name:a},s[6]=a,s[7]=l):l=s[7];const _=e?.enabled??!0;let p;return s[8]!==u||s[9]!==l||s[10]!==_?(p={client:u,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:l,enabled:_,staleTime:3e5,select:pt},s[8]=u,s[9]=l,s[10]=_,s[11]=p):p=s[11],ct(p)}function pt(a){return a.structuredContent?.item??null}const ht="deco/mcp-github";function xt(a){const{org:e}=V(),{data:s}=Fe.useSession(),o=Ee(),d=we(),[n,c]=O.useState("idle"),[u,l]=O.useState(null),[_,p]=O.useState(null),{data:C,isLoading:g}=Ke(ht,{enabled:a.enabled}),m=O.useRef(!1);a.enabled&&C&&!g&&!m.current&&s?.user?.id&&n==="idle"&&(m.current=!0,f());async function f(){if(!(!C||!s?.user?.id||!e))try{c("installing"),l(null);const h=rt(C,e.id,s.user.id,{remoteIndex:0});if(!h.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:T}=await o.create.mutateAsync(h);c("authenticating");const b=new URL(`/api/${e.slug}/mcp/${T}`,window.location.origin),N=await Je({url:b.href,token:null,orgId:e.id});if(N.supportsOAuth&&!N.isAuthenticated){const{token:y,tokenInfo:i,error:I}=await Xe({connectionId:T,orgSlug:e.slug,scope:"offline_access"});if(I||!y){try{await o.delete.mutateAsync(T)}catch{}throw new Error(I??"No token received from GitHub")}if(i)try{(await fetch(`/api/${e.slug}/connections/${T}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:i.accessToken,refreshToken:i.refreshToken,expiresIn:i.expiresIn,scope:i.scope,clientId:i.clientId,clientSecret:i.clientSecret,tokenEndpoint:i.tokenEndpoint})})).ok||await o.update.mutateAsync({id:T,data:{connection_token:y}})}catch{await o.update.mutateAsync({id:T,data:{connection_token:y}})}}je(d,e.id),p(h),c("ready")}catch(h){l(h instanceof Error?h.message:String(h)),c("error")}}function r(){c("idle"),l(null),p(null),m.current=!1}return a.enabled&&g&&n==="idle"?{status:"installing",error:null,connection:null,retry:r}:{status:n,error:u,connection:_,retry:r}}function Jt(a){const e=U.c(21),{open:s,onOpenChange:o,title:d,hideAutoRespondCheckbox:n,onImportComplete:c}=a,u=d===void 0?"Import from GitHub":d,l=n===void 0?!1:n,[_]=Ze(),[p,C]=O.useState(null);if(!_.experimental_vibecode)return null;let g;e[0]!==u?(g=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:u})}),e[0]=u,e[1]=g):g=e[1];let m;e[2]!==p||e[3]!==u?(m=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:p?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>C(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Ae,{size:16})}),t.jsx("img",{src:p.avatarUrl,alt:p.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:p.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(re,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:u})]})}),e[2]=p,e[3]=u,e[4]=m):m=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=f):f=e[5];let r;e[6]!==o?(r=()=>o(!1),e[6]=o,e[7]=r):r=e[7];let h;e[8]!==l||e[9]!==c||e[10]!==p||e[11]!==r?(h=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(O.Suspense,{fallback:f,children:t.jsx(Nt,{onComplete:r,selectedInstallation:p,onSelectInstallation:C,hideAutoRespondCheckbox:l,onImportComplete:c})})}),e[8]=l,e[9]=c,e[10]=p,e[11]=r,e[12]=h):h=e[12];let x;e[13]!==g||e[14]!==m||e[15]!==h?(x=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[g,m,h]}),e[13]=g,e[14]=m,e[15]=h,e[16]=x):x=e[16];let T;return e[17]!==o||e[18]!==s||e[19]!==x?(T=t.jsx(de,{open:s,onOpenChange:o,children:x}),e[17]=o,e[18]=s,e[19]=x,e[20]=T):T=e[20],T}function Nt({onComplete:a,selectedInstallation:e,onSelectInstallation:s,hideAutoRespondCheckbox:o,onImportComplete:d}){const{org:n}=V(),c=we(),u=_e(),[l,_]=O.useState(null),[p,C]=O.useState(!0),g=o?!0:p,m=it({slug:"mcp-github"}),f=xt({enabled:m.length===0}),r=m.length===1?m[0]??null:l,h=$({connectionId:r?.id??"",orgId:n.id,orgSlug:n.slug}),x=$({connectionId:ce,orgId:n.id,orgSlug:n.slug}),T=async(i,I)=>{try{const j=await h.callTool({name:"get_file_contents",arguments:{owner:i.owner,repo:i.name,path:I}});if(j.isError)return null;const A=j.content?.find(E=>E.type==="resource")?.resource?.text;if(!A)return null;try{const E=JSON.parse(A);return typeof E=="string"?E:JSON.stringify(E)}catch{return A}}catch{return null}},b=(i,I)=>{Promise.all([T(I,"AGENTS.md"),T(I,"CLAUDE.md")]).then(async([v,j])=>{const S=v??j??null;S&&(await x.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:i,data:{metadata:{instructions:S}}}}),je(c,n.id))}).catch(v=>{console.error("GitHub instructions fetch failed:",v)})},N=async({virtualMcpId:i,repo:I,connectionId:v})=>{const j=await h.callTool({name:"TRIGGER_LIST",arguments:{}}),S=j.structuredContent??j,A=S.triggers?.find(L=>L.type==="github.issues.opened")??S.triggers?.find(L=>{const ie=L.type.toLowerCase();return/\bissues?\./.test(ie)&&(ie.endsWith(".opened")||ie.endsWith(".created"))});if(!A)throw new Error("No issue-created trigger exposed by GitHub connection");const E=new Set;if(Array.isArray(A.params))for(const L of A.params)E.add(L.name);else if(A.params&&typeof A.params=="object")for(const L of Object.keys(A.params))E.add(L);if(A.paramsSchema)for(const L of Object.keys(A.paramsSchema))E.add(L);const R={};E.has("repo")?R.repo=`${I.owner}/${I.name}`:(E.has("owner")&&(R.owner=I.owner),E.has("name")&&(R.name=I.name),E.has("repository")&&(R.repository=`${I.owner}/${I.name}`));const z=`A new GitHub issue has been opened in ${I.owner}/${I.name}. Read the issue details, explore the relevant code in the repository, create a new branch, implement the fix or feature requested, and open a pull request that resolves the issue. Reference the issue number in the PR description.`,k=await x.callTool({name:"AUTOMATION_CREATE",arguments:{name:`${I.name}: auto-respond to issues`,virtual_mcp_id:i,agent:{id:i},messages:z,active:!0}}),se=k.structuredContent??k;await x.callTool({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:se.id,type:"event",connection_id:v,event_type:A.type,params:R}})},y=Be({mutationFn:async i=>{if(!r||!e)throw new Error("No GitHub connection or installation");const I=r.id,v=await x.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:i.name,description:i.description||"Imported from GitHub",pinned:!0,icon:null,metadata:{githubRepo:{owner:i.owner,name:i.name,url:i.url,installationId:e.installationId,connectionId:I},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"}}}},connections:[{connection_id:I}]}}}),j=v.structuredContent??v,S=j.item.id;return g&&await N({virtualMcpId:S,repo:i,connectionId:I}).catch(A=>{console.error("Failed to set up issue automation:",A),oe.warning("Imported repo, but failed to set up issue auto-response. You can add the trigger manually from the automations view.")}),{virtualMcpId:S,repo:i,connectionId:I,item:j.item}},onSuccess:({virtualMcpId:i,repo:I,connectionId:v,item:j})=>{if(c.setQueryData(ne.collectionItem(x,n.id,"","VIRTUAL_MCP",i),{item:j}),je(c,n.id),b(i,I),d){d({virtualMcpId:i,repo:I,connectionId:v});return}oe.success(`Imported ${I.name} from GitHub`),a(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),u(i)},onError:i=>{oe.error("Failed to import repo: "+(i instanceof Error?i.message:"Unknown error"))}});return f.status==="installing"||f.status==="authenticating"?t.jsx(ve,{status:f.status,error:null,retry:f.retry}):f.status==="error"?t.jsx(ve,{status:"error",error:f.error,retry:f.retry}):m.length===0&&f.status==="idle"?t.jsx(ve,{status:"installing",error:null,retry:f.retry}):m.length>1&&!r?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),m.map(i=>t.jsxs("button",{type:"button",onClick:()=>_(i),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[i.icon?t.jsx("img",{src:i.icon,alt:i.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(re,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:i.title})]},i.id))]}):r?e?t.jsx(Ct,{connectionId:r.id,orgId:n.id,orgSlug:n.slug,installation:e,onSelectRepo:i=>y.mutate(i),isSaving:y.isPending,autoRespondToIssues:p,onAutoRespondChange:C,hideAutoRespondCheckbox:o}):t.jsx(_t,{connectionId:r.id,orgId:n.id,orgSlug:n.slug,onSelect:s,showBackButton:m.length>1,onBack:()=>_(null)}):null}function _t(a){const e=U.c(31),{connectionId:s,orgId:o,orgSlug:d,onSelect:n,showBackButton:c,onBack:u}=a;let l;e[0]!==o||e[1]!==d?(l={connectionId:ce,orgId:o,orgSlug:d},e[0]=o,e[1]=d,e[2]=l):l=e[2];const _=$(l);let p;e[3]!==s||e[4]!==o?(p=ne.githubUserOrgs(o,s),e[3]=s,e[4]=o,e[5]=p):p=e[5];let C;e[6]!==s||e[7]!==_?(C=async()=>{const I=(await _.callTool({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:s}})).content?.[0]?.text;if(!I)throw new Error("No response from GITHUB_LIST_USER_ORGS");return JSON.parse(I)},e[6]=s,e[7]=_,e[8]=C):C=e[8];let g;e[9]!==p||e[10]!==C?(g={queryKey:p,queryFn:C},e[9]=p,e[10]=C,e[11]=g):g=e[11];const m=He(g);if(m.isLoading){let i;return e[12]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=i):i=e[12],i}if(m.isError){let i;return e[13]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=i):i=e[13],i}const f=m.data;if(!f)return null;let r;e[14]!==u||e[15]!==c?(r=c&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ae,{size:12}),"Change connection"]})}),e[14]=u,e[15]=c,e[16]=r):r=e[16];let h;if(e[17]!==f.installations||e[18]!==n){let i;e[20]!==n?(i=I=>t.jsxs("button",{type:"button",onClick:()=>n(I),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:I.avatarUrl,alt:I.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:I.login}),I.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},I.installationId),e[20]=n,e[21]=i):i=e[21],h=f.installations.map(i),e[17]=f.installations,e[18]=n,e[19]=h}else h=e[19];let x;e[22]!==h?(x=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:h}),e[22]=h,e[23]=x):x=e[23];const T=f.appSlug?`https://github.com/apps/${f.appSlug}/installations/new`:"https://github.com/settings/installations";let b;e[24]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=b):b=e[24];let N;e[25]!==T?(N=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",b]})}),e[25]=T,e[26]=N):N=e[26];let y;return e[27]!==N||e[28]!==r||e[29]!==x?(y=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r,x,N]}),e[27]=N,e[28]=r,e[29]=x,e[30]=y):y=e[30],y}function Ct(a){const e=U.c(25),{connectionId:s,orgId:o,orgSlug:d,installation:n,onSelectRepo:c,isSaving:u,autoRespondToIssues:l,onAutoRespondChange:_,hideAutoRespondCheckbox:p}=a,[C,g]=O.useState(""),m=O.useDeferredValue(C),f=C!==m;let r;e[0]!==f||e[1]!==C?(r=t.jsx(Qe,{placeholder:"Search repositories...",value:C,onChange:g,isSearching:f}),e[0]=f,e[1]=C,e[2]=r):r=e[2];const h=f?"opacity-40":"opacity-100";let x;e[3]!==h?(x=xe("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",h),e[3]=h,e[4]=x):x=e[4];let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=T):T=e[5];let b;e[6]!==s||e[7]!==m||e[8]!==n||e[9]!==u||e[10]!==c||e[11]!==o||e[12]!==d?(b=t.jsx(O.Suspense,{fallback:T,children:t.jsx(It,{connectionId:s,orgId:o,orgSlug:d,installation:n,query:m,onSelectRepo:c,isSaving:u})}),e[6]=s,e[7]=m,e[8]=n,e[9]=u,e[10]=c,e[11]=o,e[12]=d,e[13]=b):b=e[13];let N;e[14]!==x||e[15]!==b?(N=t.jsx("div",{className:x,children:b}),e[14]=x,e[15]=b,e[16]=N):N=e[16];let y;e[17]!==l||e[18]!==p||e[19]!==_?(y=!p&&t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0 cursor-pointer select-none",children:[t.jsx(st,{checked:l,onCheckedChange:I=>_(I===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Auto-respond to new issues with a PR"})]}),e[17]=l,e[18]=p,e[19]=_,e[20]=y):y=e[20];let i;return e[21]!==r||e[22]!==N||e[23]!==y?(i=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r,N,y]}),e[21]=r,e[22]=N,e[23]=y,e[24]=i):i=e[24],i}function It(a){const e=U.c(29),{connectionId:s,orgId:o,orgSlug:d,installation:n,query:c,onSelectRepo:u,isSaving:l}=a;let _;e[0]!==s||e[1]!==o||e[2]!==d?(_={connectionId:s,orgId:o,orgSlug:d},e[0]=s,e[1]=o,e[2]=d,e[3]=_):_=e[3];const p=$(_),C=n.type==="User"?"user":"org",g=c?`${C}:${n.login} ${c} in:name`:`${C}:${n.login}`;let m;e[4]!==s||e[5]!==n.login||e[6]!==o||e[7]!==c?(m=ne.githubOrgRepos(o,s,n.login,c),e[4]=s,e[5]=n.login,e[6]=o,e[7]=c,e[8]=m):m=e[8];let f;e[9]!==p||e[10]!==g?(f=async()=>{const N=(await p.callTool({name:"search_repositories",arguments:{query:g,page:1,perPage:30}})).content?.[0]?.text;if(!N)throw new Error("No response from search_repositories");return(JSON.parse(N).items??[]).map(Tt)},e[9]=p,e[10]=g,e[11]=f):f=e[11];let r;e[12]!==m||e[13]!==f?(r={queryKey:m,queryFn:f},e[12]=m,e[13]=f,e[14]=r):r=e[14];const{data:h}=et(r);if(h.length===0){let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=b):b=e[15];let N;e[16]!==c?(N=c&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=c,e[17]=N):N=e[17];let y;return e[18]!==N?(y=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[b,N]}),e[18]=N,e[19]=y):y=e[19],y}let x;if(e[20]!==l||e[21]!==u||e[22]!==h){let b;e[24]!==l||e[25]!==u?(b=N=>t.jsxs("button",{type:"button",onClick:()=>u(N),disabled:l,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(re,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:N.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[N.private?t.jsx(ot,{size:10}):t.jsx(at,{size:10}),N.private?"Private":"Public"]})]},N.fullName),e[24]=l,e[25]=u,e[26]=b):b=e[26],x=h.map(b),e[20]=l,e[21]=u,e[22]=h,e[23]=x}else x=e[23];let T;return e[27]!==x?(T=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:x}),e[27]=x,e[28]=T):T=e[28],T}function Tt(a){return{name:a.name,fullName:a.full_name,owner:a.full_name.split("/")[0]??"",url:a.html_url,private:a.private,description:a.description,updatedAt:a.updated_at}}function ve(a){const e=U.c(33),{status:s,error:o,retry:d}=a;if(s==="error"){let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-destructive"})}),e[0]=i):i=e[0];let I;e[1]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=I):I=e[1];const v=o??"Something went wrong while connecting to GitHub.";let j;e[2]!==v?(j=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[I,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:v})]}),e[2]=v,e[3]=j):j=e[3];let S;e[4]!==d?(S=t.jsx("button",{type:"button",onClick:d,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=d,e[5]=S):S=e[5];let A;return e[6]!==j||e[7]!==S?(A=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[i,j,S]}),e[6]=j,e[7]=S,e[8]=A):A=e[8],A}const n=s==="authenticating";let c;e[9]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-foreground"})}),e[9]=c):c=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"relative size-10",children:[c,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(Ne,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=u):u=e[10];const l=n?"Authenticating with GitHub":"Setting up GitHub";let _;e[11]!==l?(_=t.jsx("p",{className:"text-sm font-medium",children:l}),e[11]=l,e[12]=_):_=e[12];const p=n?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let C;e[13]!==p?(C=t.jsx("p",{className:"text-xs text-muted-foreground",children:p}),e[13]=p,e[14]=C):C=e[14];let g;e[15]!==_||e[16]!==C?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[_,C]}),e[15]=_,e[16]=C,e[17]=g):g=e[17];const m=n?"bg-muted-foreground/30":"bg-foreground animate-pulse";let f;e[18]!==m?(f=xe("size-1.5 rounded-full",m),e[18]=m,e[19]=f):f=e[19];let r;e[20]!==f?(r=t.jsx("span",{className:f}),e[20]=f,e[21]=r):r=e[21];const h=n?"bg-foreground animate-pulse":"bg-muted-foreground/30";let x;e[22]!==h?(x=xe("size-1.5 rounded-full",h),e[22]=h,e[23]=x):x=e[23];let T;e[24]!==x?(T=t.jsx("span",{className:x}),e[24]=x,e[25]=T):T=e[25];let b;e[26]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=b):b=e[26];let N;e[27]!==r||e[28]!==T?(N=t.jsxs("div",{className:"flex items-center gap-1.5",children:[r,T,b]}),e[27]=r,e[28]=T,e[29]=N):N=e[29];let y;return e[30]!==N||e[31]!==g?(y=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[u,g,N]}),e[30]=N,e[31]=g,e[32]=y):y=e[32],y}const yt=["Full HAR capture with cache, TTFB, and request analysis","Screenshot capture for visual inspection","Page discovery via sitemap, navigation, and link crawling","SEO audit — meta tags, structured data, robots.txt","Third-party script inventory and size analysis","Dead link detection across the entire site","Deco-specific diagnostics (?__d debug mode)"];function $e(a){const e=U.c(7),{onRecruit:s,isRecruiting:o,isLoading:d}=a;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a blackbox diagnostics agent that tests your storefront from the outside — no internal access needed. Give it a URL and it produces a detailed performance and health report."}),e[0]=n):n=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=c):c=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"space-y-2",children:[c,t.jsx("ul",{className:"space-y-1.5",children:yt.map(bt)})]}),e[2]=u):u=e[2];const l=o||d,_=o?"Setting up...":"Add Site Diagnostics";let p;return e[3]!==s||e[4]!==l||e[5]!==_?(p=t.jsxs("div",{className:"flex flex-col gap-6",children:[n,u,t.jsx(ae,{onClick:s,disabled:l,className:"w-full cursor-pointer",children:_})]}),e[3]=s,e[4]=l,e[5]=_,e[6]=p):p=e[6],p}function bt(a){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),a]},a)}function Xt({open:a,onOpenChange:e,existingAgent:s}){const o=ke(),{org:d}=V(),n=_e(),c=Ee(),u=Pe(),l=$({connectionId:ce,orgId:d.id,orgSlug:d.slug}),_=Ye({client:l}),[p,C]=O.useState(!1),g=qe.find(y=>y.id==="site-diagnostics"),{data:m,isLoading:f}=Ke(g.appId,{enabled:a}),r=m?.title||m?.server?.title||m?.server?.name||g.title,h=m?.server?.icons?.[0]?.src??g.icon,x=m?.server?.description??null,T=t.jsx(Ue,{icon:h,name:r,size:"sm"}),b=async()=>{if(m){if(s){e(!1),n(s.id);return}C(!0);try{const y=await _.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:g.appId},limit:1,offset:0}});let i;const v=y?.structuredContent?.items?.find(S=>S.app_id===g.appId);if(v)i=v.id;else{const S=m.server?.remotes?.[0]?.url;if(!S)throw new Error("Registry item is missing a remote URL for site-diagnostics");i=(await c.create.mutateAsync({title:r,description:x,icon:m.server?.icons?.[0]?.src??g.icon,connection_type:"HTTP",connection_url:S,app_name:m.server?.name??"site-diagnostics",app_id:g.appId,metadata:{type:"site-diagnostics",source:"store",registry_item_id:g.appId,verified:!0}})).id}const j=await u.create.mutateAsync({title:r,description:x,icon:h,status:"active",connections:[{connection_id:i,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"site-diagnostics",instructions:null,ui:{pinnedViews:[{connectionId:i,toolName:"diagnose",label:"diagnose",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:i,toolName:"diagnose"}}}}});D("agent_recruit_confirmed",{template_id:"site-diagnostics",agent_id:j.id}),e(!1),n(j.id)}catch(y){D("agent_recruit_failed",{template_id:"site-diagnostics",error:y instanceof Error?y.message:String(y)}),console.error("Failed to create Site Diagnostics agent:",y)}finally{C(!1)}}},N=`Add ${r}`;return o?t.jsx(Oe,{open:a,onOpenChange:e,children:t.jsxs(Le,{className:"h-[70dvh]",children:[t.jsx(Re,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[T,t.jsx(Me,{className:"text-xl font-semibold",children:N})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx($e,{onRecruit:b,isRecruiting:p,isLoading:f})})]})}):t.jsx(de,{open:a,onOpenChange:e,children:t.jsxs(le,{className:"sm:max-w-[500px] p-8",children:[t.jsx(ue,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[T,t.jsx(me,{className:"text-xl font-semibold",children:N})]})}),t.jsx($e,{onRecruit:b,isRecruiting:p,isLoading:f})]})})}const vt=`<role>
|
|
2
2
|
You are the Agent Manager. You create, configure, and maintain agents (Virtual MCPs) in this workspace.
|
|
3
3
|
</role>
|
|
4
4
|
|