decocms 3.105.0 → 3.106.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-DRN6XAl_.js → AlertCircle-BJGXp4ka.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-CS4sxU2z.js → ArrowUpRight-BBdsIfGH.js} +1 -1
- package/dist/client/assets/{CheckCircle-Dof-gkrW.js → CheckCircle-BiabCmdF.js} +1 -1
- package/dist/client/assets/{ChevronDown-CiTptxE7.js → ChevronDown-CejcQRgy.js} +1 -1
- package/dist/client/assets/{ChevronLeft-LnaPgJ0y.js → ChevronLeft-fHsU-TVg.js} +1 -1
- package/dist/client/assets/{ChevronRight-BRlgGlqj.js → ChevronRight-Bajwpni4.js} +1 -1
- package/dist/client/assets/{ChevronUp-CZ6Mxabg.js → ChevronUp-DQ-5P7bA.js} +1 -1
- package/dist/client/assets/{DotsVertical-BSRrIcA1.js → DotsVertical-eDubkUAQ.js} +1 -1
- package/dist/client/assets/{Eye-D3ZcE9lW.js → Eye-CMlUam6_.js} +1 -1
- package/dist/client/assets/{FilterLines-nV95nFgf.js → FilterLines-CwMZDhi2.js} +1 -1
- package/dist/client/assets/{Globe01-6U0-ZV4l.js → Globe01-DKKcLl4T.js} +1 -1
- package/dist/client/assets/{Globe04-10fsKNwF.js → Globe04-D95JskSa.js} +1 -1
- package/dist/client/assets/{HardDrive-CcAdoaFI.js → HardDrive-C2eOF8dK.js} +1 -1
- package/dist/client/assets/{Key01-CzkLmrt_.js → Key01-DZIUNEvu.js} +1 -1
- package/dist/client/assets/{LayoutLeft-CpEUT3tP.js → LayoutLeft-CASwb6NS.js} +1 -1
- package/dist/client/assets/{LinkExternal01-TXfR4Hhy.js → LinkExternal01-DEXnL1UU.js} +1 -1
- package/dist/client/assets/{Monitor01-CcWvKUoP.js → Monitor01-C1hxhUiJ.js} +1 -1
- package/dist/client/assets/{Palette-BmXhqV8p.js → Palette-Dt-qaRPY.js} +1 -1
- package/dist/client/assets/{Play-BRcSzafX.js → Play-D4JYUILT.js} +1 -1
- package/dist/client/assets/{Plus-BS57SLmT.js → Plus-TQEhHIaf.js} +1 -1
- package/dist/client/assets/{SearchLg-CIaBccbb.js → SearchLg-D4TTfBZy.js} +1 -1
- package/dist/client/assets/{SearchMd-BOQbygpw.js → SearchMd-D7Nisqin.js} +1 -1
- package/dist/client/assets/{Settings02-Du9J1LY1.js → Settings02-NpgkR8L_.js} +1 -1
- package/dist/client/assets/{Shield01-Dq_-3VLc.js → Shield01-C1PqlQRA.js} +1 -1
- package/dist/client/assets/{Star01-gn_l3mpc.js → Star01-IvEBJsCV.js} +1 -1
- package/dist/client/assets/{Stars01-D0EbchXz.js → Stars01-Bg13RpyJ.js} +1 -1
- package/dist/client/assets/{Stars02-CTQVeFIY.js → Stars02-Cqwr8Ws9.js} +1 -1
- package/dist/client/assets/{Sun-CXETDRVX.js → Sun-DikA3hIV.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-Bpd1Utek.js → SwitchHorizontal01-BiabkfKZ.js} +1 -1
- package/dist/client/assets/{Tool01-CMzj8Zow.js → Tool01-Bdi-BBKJ.js} +1 -1
- package/dist/client/assets/{Trash01-pbf89pjs.js → Trash01-CdGzaXWc.js} +1 -1
- package/dist/client/assets/{Upload01-DvmBqoDO.js → Upload01-BLuoqDyn.js} +1 -1
- package/dist/client/assets/{User01-C5OEqKDJ.js → User01-CXAxBhFG.js} +1 -1
- package/dist/client/assets/{Users01-B7An2LNd.js → Users01-DCjMjVCn.js} +1 -1
- package/dist/client/assets/{Users03-CcZFUmPD.js → Users03-B2-Dpsqz.js} +1 -1
- package/dist/client/assets/{X-DtGx_Eqi.js → X-C2rVRme5.js} +1 -1
- package/dist/client/assets/{XCircle-DS2uELKv.js → XCircle-CBjK62zF.js} +1 -1
- package/dist/client/assets/{XClose-vcxupN64.js → XClose-DOorWLJQ.js} +1 -1
- package/dist/client/assets/{Zap-BcCmjpc0.js → Zap-BjNrPOTp.js} +1 -1
- package/dist/client/assets/{ZapSquare-WzwrglCu.js → ZapSquare-BLlgXs9L.js} +1 -1
- package/dist/client/assets/{ZoomOut-AiYlkF58.js → ZoomOut-NGATVClW.js} +1 -1
- package/dist/client/assets/{access-gate-CNy3mt4Q.js → access-gate-CEYZDlvH.js} +1 -1
- package/dist/client/assets/{add-section-modal-DQX8P5JM.js → add-section-modal-CCRNugwW.js} +1 -1
- package/dist/client/assets/{agent-icon-B97sy6nN.js → agent-icon-CPn767vi.js} +1 -1
- package/dist/client/assets/{agents-list-ek6-vWo8.js → agents-list-Cl_EsGPj.js} +1 -1
- package/dist/client/assets/ai-providers-HhkRLdHl.js +1 -0
- package/dist/client/assets/{alert-P80CneWK.js → alert-K1aHkZrD.js} +1 -1
- package/dist/client/assets/{alert-dialog-BAuzNhCD.js → alert-dialog-Dz8imfBX.js} +1 -1
- package/dist/client/assets/app-editor-RWsNU1_V.js +1 -0
- package/dist/client/assets/{auth-CZ0pDy2E.js → auth-DCR9ETmd.js} +1 -1
- package/dist/client/assets/{auth-catchall-DReu1MMe.js → auth-catchall-9nkYIsIV.js} +1 -1
- package/dist/client/assets/{auth-entry-BHFViQ2Q.js → auth-entry-CaGUpf5G.js} +1 -1
- package/dist/client/assets/{auth-split-layout-BzmIhdES.js → auth-split-layout-C9tdNO6I.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-CRdn4J0q.js → authenticate-and-persist-oauth-s0rsdpEF.js} +1 -1
- package/dist/client/assets/{automation-list-row-CcPQPkfW.js → automation-list-row-B2xN_dPF.js} +1 -1
- package/dist/client/assets/{automation-runs-B16B6scX.js → automation-runs-Bkpk06w6.js} +1 -1
- package/dist/client/assets/{automations-e6hyDbBm.js → automations-A0sOYZmC.js} +1 -1
- package/dist/client/assets/{avatar-CM9_qKlB.js → avatar-C8rHGBAI.js} +1 -1
- package/dist/client/assets/{badge-BTVwpu14.js → badge-CyH98isx.js} +1 -1
- package/dist/client/assets/{block-document-B_2YkDzB.js → block-document-BaSGgwbA.js} +1 -1
- package/dist/client/assets/{brand-context-BTCLVIfv.js → brand-context-C9-Fue2A.js} +1 -1
- package/dist/client/assets/{buckets-dQcAziCW.js → buckets-BtrNVl3M.js} +1 -1
- package/dist/client/assets/{capability-load-error-COE1Yb09.js → capability-load-error-CiAu-JyH.js} +1 -1
- package/dist/client/assets/{card-BdlGnaGa.js → card-DOpZHkJr.js} +1 -1
- package/dist/client/assets/category-editor-nmJa-PEX.js +1 -0
- package/dist/client/assets/chat-context-A3TdA-KT.js +21 -0
- package/dist/client/assets/{checkbox-DNTx2aD9.js → checkbox-C7qfaduP.js} +1 -1
- package/dist/client/assets/{cli-auth-success-DkUL2Zau.js → cli-auth-success-RVqv2vB6.js} +1 -1
- package/dist/client/assets/collection-detail-Dh8aT7dW.js +1 -0
- package/dist/client/assets/{collection-display-button-DE-_ORce.js → collection-display-button-C1hErbyw.js} +1 -1
- package/dist/client/assets/{collection-search-D7ygKNJe.js → collection-search-DaeCK9xr.js} +1 -1
- package/dist/client/assets/{collection-tabs-BcopigLE.js → collection-tabs-DNE8Urvp.js} +1 -1
- package/dist/client/assets/{command-Dgi7YlH_.js → command-J9Wy9n_1.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-CeW0pOg4.js → commerce-onboarding-ay94EDvY.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-BP6qp00q.js → connect-desktop-dialog-Bx-n41ou.js} +1 -1
- package/dist/client/assets/{connection-card-DyrxiMlh.js → connection-card-DgYNR14j.js} +1 -1
- package/dist/client/assets/{connection-detail-CVRd2Oso.js → connection-detail-NDadBpY7.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-DwJWrgb4.js → connection-form-helpers-DW2qQjX-.js} +1 -1
- package/dist/client/assets/{connections-Ci7jZee5.js → connections-dTN5hfGr.js} +1 -1
- package/dist/client/assets/{context-menu-Bl3xBEgW.js → context-menu-BpE4NlKX.js} +1 -1
- package/dist/client/assets/{decopilot-BB1FfLa4.js → decopilot-Ds8Sp1JG.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-C_k3BuPx.js → decopilot-sse-pool-DVGFq1Bs.js} +1 -1
- package/dist/client/assets/{dialog-CUMtGMOn.js → dialog-w2u9ahjo.js} +1 -1
- package/dist/client/assets/{domain-settings-D2iifdat.js → domain-settings-DQwVxg0e.js} +1 -1
- package/dist/client/assets/{drawer-BKOVC1Nv.js → drawer-M1tJGuIB.js} +1 -1
- package/dist/client/assets/{dropdown-menu-swLhScJn.js → dropdown-menu-Bw00TpsM.js} +1 -1
- package/dist/client/assets/{empty-state-D_f-_l9W.js → empty-state-C_fk-KEj.js} +1 -1
- package/dist/client/assets/{extract-connection-data-0didS_pX.js → extract-connection-data-Wwim23p3.js} +1 -1
- package/dist/client/assets/file-explorer-D83SKUgJ.js +2 -0
- package/dist/client/assets/{file-type-icon-DFA7UObK.js → file-type-icon-D_3mz8is.js} +1 -1
- package/dist/client/assets/{files-ucrckVVv.js → files-DEtwnxTG.js} +1 -1
- package/dist/client/assets/{form-zKde5vNL.js → form-Cbgir1KX.js} +1 -1
- package/dist/client/assets/{general-8c6QxyCW.js → general-BHfBapWI.js} +1 -1
- package/dist/client/assets/{github-repo-picker-xaTZuOQc.js → github-repo-picker-7ankcqDv.js} +1 -1
- package/dist/client/assets/{hooks-BE7YwHtm.js → hooks-DODv-wVV.js} +6 -6
- package/dist/client/assets/{import-from-deco-dialog-ApAuQTYQ.js → import-from-deco-dialog-C2qQnsFK.js} +1 -1
- package/dist/client/assets/index-BADtduG9.css +1 -0
- package/dist/client/assets/{index-DCQ51csQ.js → index-BkUdQUyL.js} +1 -1
- package/dist/client/assets/{index-Dso3mm7m.js → index-BnDi5HAq.js} +1 -1
- package/dist/client/assets/{index-vshYv_PV.js → index-BskdskYZ.js} +1 -1
- package/dist/client/assets/{index-D6UYBk79.js → index-C7P-sIHE.js} +2 -2
- package/dist/client/assets/{index-C_7VA7XD.js → index-CC2delq7.js} +1 -1
- package/dist/client/assets/{index-BAz1StX_.js → index-CHOLxMH7.js} +1 -1
- package/dist/client/assets/{index-CN4fylaJ.js → index-CWb9Wsg4.js} +3 -3
- package/dist/client/assets/{index-CXoUE4MX.js → index-CeQQD9lF.js} +1 -1
- package/dist/client/assets/{index-DezmxNOz.js → index-CfDDnM0w.js} +1 -1
- package/dist/client/assets/{index-D87D-9z8.js → index-D2LhxKOJ.js} +1 -1
- package/dist/client/assets/index-D7jdL_DZ.js +1 -0
- package/dist/client/assets/index-DHLGskzl.js +503 -0
- package/dist/client/assets/index-DQSbAZfL.js +1 -0
- package/dist/client/assets/index-DjmwjOWv.js +3 -0
- package/dist/client/assets/{index-redirect-uTSJ_a-J.js → index-redirect-C1i6X1BQ.js} +1 -1
- package/dist/client/assets/{input-Cs0DBSJe.js → input-DeTgNphX.js} +1 -1
- package/dist/client/assets/{integration-icon-DO0aMlRM.js → integration-icon-DMSKHFp1.js} +1 -1
- package/dist/client/assets/{label-BrslM_UB.js → label-C5upVuqQ.js} +1 -1
- package/dist/client/assets/{login-lFInXfZJ.js → login-CgdoANZA.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CXbxPU1K.js → mcp-oauth-a3FzewVg.js} +1 -1
- package/dist/client/assets/{members-Gx2he5rW.js → members-DpZ9A5f0.js} +1 -1
- package/dist/client/assets/{monaco-editor-BvqPmzKC.js → monaco-editor-CUY1wKmW.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-XFFgvHZ6.js → monitoring-stats-row-CBjQbEuF.js} +1 -1
- package/dist/client/assets/{oauth-callback-zFcikTHT.js → oauth-callback-DlNHjcXi.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BKXb-3JP.js → oauth-callback-ai-provider-DijOsYgL.js} +1 -1
- package/dist/client/assets/{onboarding-BzMw4CHm.js → onboarding-BsVL9OWm.js} +1 -1
- package/dist/client/assets/{org-install-B9VpD5Ge.js → org-install-LgrIXD0Y.js} +1 -1
- package/dist/client/assets/{org-layout-CbU8O3mn.js → org-layout-vDUTh50X.js} +1 -1
- package/dist/client/assets/{organization-choice-Bfynthz9.js → organization-choice-XuATQzah.js} +1 -1
- package/dist/client/assets/{page-seo-form-B4VE05hk.js → page-seo-form-Xun3Gb-0.js} +1 -1
- package/dist/client/assets/page-seo-sheet-CUpKopG7.js +1 -0
- package/dist/client/assets/{popover-BWjew7H2.js → popover-Sng9qlGZ.js} +1 -1
- package/dist/client/assets/post-editor-CGhDEOwt.js +1 -0
- package/dist/client/assets/{preview-dialog-CgmGD8zP.js → preview-dialog-DNK26uoS.js} +1 -1
- package/dist/client/assets/{primitives-CriWeTQD.js → primitives-BX1TQnm6.js} +1 -1
- package/dist/client/assets/{profile-C3qIZkKk.js → profile-2qqK3Ndl.js} +1 -1
- package/dist/client/assets/project-app-view-E03tCSaX.js +1 -0
- package/dist/client/assets/record-editor-aq3fvSFo.js +1 -0
- package/dist/client/assets/registry-DsQsIymK.js +2 -0
- package/dist/client/assets/{registry-layout-RI9gze0O.js → registry-layout-Dh1yj8yr.js} +1 -1
- package/dist/client/assets/{require-capability-DfOBFcgm.js → require-capability-DQCVcrTE.js} +1 -1
- package/dist/client/assets/{required-auth-layout-D985wSIU.js → required-auth-layout-BYjSLRKw.js} +1 -1
- package/dist/client/assets/{reset-password-D8szBvSb.js → reset-password-CGTbeNnn.js} +1 -1
- package/dist/client/assets/{roles-BAYOWZvJ.js → roles-DHBhA_58.js} +1 -1
- package/dist/client/assets/{scroll-area-BUT5ZZ5w.js → scroll-area-D5K2cFR-.js} +1 -1
- package/dist/client/assets/{search-input-Csp-MZi9.js → search-input-Dcdjp99e.js} +1 -1
- package/dist/client/assets/{secrets-Bmkvij6U.js → secrets-CZTBZ18F.js} +1 -1
- package/dist/client/assets/{sections-editor-_L7UQKbk.js → sections-editor-DR11Z6Ds.js} +2 -2
- package/dist/client/assets/{select-DqJQ5lRE.js → select-Cc21tKCb.js} +1 -1
- package/dist/client/assets/{select-model-04vQ8QxB.js → select-model-C3sVs6BI.js} +1 -1
- package/dist/client/assets/seo-editor-Cch9eI4T.js +1 -0
- package/dist/client/assets/settings-layout-B6-JV7a0.js +1 -0
- package/dist/client/assets/{settings-section-8KZ8wW1V.js → settings-section-BI5jS2Dt.js} +1 -1
- package/dist/client/assets/{sheet-DCM0ToXL.js → sheet-DOvMDZuR.js} +1 -1
- package/dist/client/assets/{shell-controls-lY6GRy9S.js → shell-controls-BXNxuXv0.js} +1 -1
- package/dist/client/assets/{shell-layout-B87-IiK6.js → shell-layout-BmSdYmam.js} +1 -1
- package/dist/client/assets/{shell-route-loading-J3bIbZOA.js → shell-route-loading-DPMEw2M6.js} +1 -1
- package/dist/client/assets/{sidebar-DwyKpA9b.js → sidebar-CtBbCGBG.js} +1 -1
- package/dist/client/assets/{skeleton-D1BsF23p.js → skeleton-D6by2dpn.js} +1 -1
- package/dist/client/assets/{sortable.esm-BC4ZOnIG.js → sortable.esm-CzWimVLQ.js} +1 -1
- package/dist/client/assets/{sso-CGQWOdqo.js → sso-DJ-zP7sp.js} +1 -1
- package/dist/client/assets/{store-DtzhH1Gt.js → store-g3lyqmRz.js} +1 -1
- package/dist/client/assets/store-registry-Bl8dzute.js +2 -0
- package/dist/client/assets/{studio-tools-BXeKF31x.js → studio-tools-BJ-UdyTW.js} +1 -1
- package/dist/client/assets/{switch-Dv2j6d5M.js → switch-BRov-LAY.js} +1 -1
- package/dist/client/assets/{table-JD_NL-TZ.js → table-5b-Z4cr5.js} +1 -1
- package/dist/client/assets/{tabs-uIdHwBqm.js → tabs-CP761j-X.js} +1 -1
- package/dist/client/assets/{task-status-C0XtJQEC.js → task-status-DwC3l4SN.js} +1 -1
- package/dist/client/assets/{textarea-BSHQNfh6.js → textarea-DGEx65DJ.js} +1 -1
- package/dist/client/assets/{toggle-group-DC-9R-kx.js → toggle-group-Bb1gTTUv.js} +1 -1
- package/dist/client/assets/{toolbar-DevcmIZ4.js → toolbar-IDz7ohMs.js} +1 -1
- package/dist/client/assets/{tooltip-DPkvAJEu.js → tooltip-DlNdoWTC.js} +1 -1
- package/dist/client/assets/{types-D5SLCq2u.js → types-DIkr-zoW.js} +1 -1
- package/dist/client/assets/{use-ai-providers-3vPjPOz2.js → use-ai-providers-Bk-PEV0W.js} +1 -1
- package/dist/client/assets/{use-automations-DpEBzEk5.js → use-automations-B3A8m1Qa.js} +1 -1
- package/dist/client/assets/{use-capability-NnDdgNkk.js → use-capability-CIrGamSD.js} +1 -1
- package/dist/client/assets/{use-clock-tick-DR_O_bL8.js → use-clock-tick-NRQ6Jq9B.js} +1 -1
- package/dist/client/assets/{use-collections-B6zlDXKN.js → use-collections-Dx9nw5SH.js} +1 -1
- package/dist/client/assets/{use-connection-8FX2zzcI.js → use-connection-CADUWJLS.js} +1 -1
- package/dist/client/assets/{use-copy-DNq3T6SH.js → use-copy-CWemy_te.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-D2BkJoeH.js → use-create-virtual-mcp-BF63k0IF.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-DgaYGNmY.js → use-debounced-autosave-Ddf6ohdu.js} +1 -1
- package/dist/client/assets/{use-debounced-value-BO0E-um9.js → use-debounced-value-CqnvF_Tx.js} +1 -1
- package/dist/client/assets/use-decopilot-events-DRFfNsO4.js +1 -0
- package/dist/client/assets/{use-delete-connection-CKcZdVmk.js → use-delete-connection-BeE9B7tk.js} +1 -1
- package/dist/client/assets/{use-file-configs-DAJdFU9z.js → use-file-configs-Dqn5vTip.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-C_MuFtOU.js → use-infinite-scroll-X3H24Vh-.js} +1 -1
- package/dist/client/assets/{use-join-requests-XEQwCrOs.js → use-join-requests-pqzRJ1mW.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CIYxX4P5.js → use-mcp-client-H0qGyw4S.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-l61zrviT.js → use-mcp-prompts-CMH8dkIp.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-C_waYweR.js → use-mcp-tools-ClpDupwI.js} +1 -1
- package/dist/client/assets/{use-members-CIjbWJiD.js → use-members-CLe24wAb.js} +1 -1
- package/dist/client/assets/{use-mobile-d3rX0VX2.js → use-mobile-AEMP8WrJ.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-X5p7bWf4.js → use-navigate-to-agent-CCdQ4egc.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-Bv_Zhbk4.js → use-org-auth-client-e-AT3UBL.js} +1 -1
- package/dist/client/assets/{use-org-sso-CGtfMwKv.js → use-org-sso-oYTowyM2.js} +1 -1
- package/dist/client/assets/{use-organization-roles-D3oelrch.js → use-organization-roles-BrNdhD0R.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DQjKRGQP.js → use-organization-settings-Ddf63XoW.js} +1 -1
- package/dist/client/assets/{use-registry-connections-Dg8ovbRG.js → use-registry-connections-FPQXF8Rq.js} +1 -1
- package/dist/client/assets/{use-secrets-CNTh-cii.js → use-secrets-DqSD7GLo.js} +1 -1
- package/dist/client/assets/use-status-sounds-C40CL6QW.js +1 -0
- package/dist/client/assets/{use-view-mode-DaTOu9GC.js → use-view-mode-BgbYtI9e.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CbdTA-7x.js → use-virtual-mcp-BOv3TeD0.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DfyfHpXx.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-BAdfxWHo.js +1 -0
- package/dist/client/assets/{useSuspenseQueries-CFW3Iq_K.js → useSuspenseQueries-Dz__3zJy.js} +1 -1
- package/dist/client/assets/variant-calendar-ColyLdfo.js +1 -0
- package/dist/client/assets/{view-mode-toggle-CyfUtpac.js → view-mode-toggle-buFuODEl.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +452 -452
- package/dist/server/server.js +303 -303
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-BaHP49WU.js +0 -1
- package/dist/client/assets/app-editor-COUlt3p_.js +0 -1
- package/dist/client/assets/category-editor-Ba4nODjX.js +0 -1
- package/dist/client/assets/chat-context-CXJPuJv7.js +0 -21
- package/dist/client/assets/collection-detail-HEwECOGy.js +0 -1
- package/dist/client/assets/file-explorer-DhPfqNXk.js +0 -2
- package/dist/client/assets/index-BBz2M403.css +0 -1
- package/dist/client/assets/index-CtWjggum.js +0 -1
- package/dist/client/assets/index-DUtbK69S.js +0 -1
- package/dist/client/assets/index-DbCqW7YA.js +0 -3
- package/dist/client/assets/index-qW-QuY3O.js +0 -503
- package/dist/client/assets/page-seo-sheet-DBPQmzng.js +0 -1
- package/dist/client/assets/post-editor-D8nQWF9y.js +0 -1
- package/dist/client/assets/project-app-view-BJlOxcBQ.js +0 -1
- package/dist/client/assets/record-editor-DCCH2xtR.js +0 -1
- package/dist/client/assets/registry-cFcLecRz.js +0 -2
- package/dist/client/assets/seo-editor-CXdh_6vp.js +0 -1
- package/dist/client/assets/settings-layout-DgIrfyYZ.js +0 -1
- package/dist/client/assets/store-registry-BSzLfLBD.js +0 -2
- package/dist/client/assets/use-status-sounds-DVCwZxOR.js +0 -1
- package/dist/client/assets/useInfiniteQuery-DiJ0Xsij.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-B2CIiwRu.js +0 -1
- package/dist/client/assets/variant-calendar-CGvOWJ50.js +0 -1
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as B,s as N,aD as ae,aF as le,aG as he,aE as xe,b7 as me,c as U,n as ge,p as be,r as O,j as s,af as Ee,t as Q,ae as ye,D as re,m as oe,d as J,K as G,k as ve,l as ue,B as V,v as je,E as $e}from"./index-CN4fylaJ.js";import{i as Fe}from"./AlertCircle-DRN6XAl_.js";import{P as te}from"./index-Dso3mm7m.js";import{S as ne}from"./skeleton-D1BsF23p.js";import{b as _e,a as ce,S as de,c as Re}from"./settings-section-8KZ8wW1V.js";import{u as X,b as se,c as Se}from"./use-ai-providers-3vPjPOz2.js";import{i as Oe}from"./CheckCircle-Dof-gkrW.js";import{i as Me,j as Te,p as Ue,S as ze}from"./chat-context-CXJPuJv7.js";import{d as qe,e as Le}from"./use-organization-settings-DQjKRGQP.js";import{M as Ve}from"./select-model-04vQ8QxB.js";import{u as Be}from"./use-debounced-autosave-DgaYGNmY.js";import{I as ie}from"./input-Cs0DBSJe.js";import{a as fe,T as Ge}from"./toggle-group-DC-9R-kx.js";import{b as ke,c as Ie,d as Ce,A as Ne,a as Pe,e as we,g as De,f as Ae}from"./alert-dialog-BAuzNhCD.js";import{u as H}from"./studio-tools-BXeKF31x.js";import{s as Qe}from"./Plus-BS57SLmT.js";import{b as Ye}from"./Tool01-CMzj8Zow.js";import{s as We}from"./Trash01-pbf89pjs.js";import{A as He}from"./avatar-CM9_qKlB.js";import{O as Ke,P as Je,C as pe}from"./decopilot-BB1FfLa4.js";import{i as Xe}from"./Settings02-Du9J1LY1.js";import{s as Ze}from"./Eye-D3ZcE9lW.js";import{D as et,c as tt,a as st,d as it,e as rt}from"./dialog-CUMtGMOn.js";import{f as ot}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as lt}from"./require-capability-DfOBFcgm.js";import"./sidebar-DwyKpA9b.js";import"./LayoutLeft-CpEUT3tP.js";import"./use-mobile-d3rX0VX2.js";import"./sheet-DCM0ToXL.js";import"./X-DtGx_Eqi.js";import"./tooltip-DPkvAJEu.js";import"./card-BdlGnaGa.js";import"./ArrowUpRight-CS4sxU2z.js";import"./hooks-BE7YwHtm.js";import"./use-mcp-client-CIYxX4P5.js";import"./auth-CZ0pDy2E.js";import"./decopilot-sse-pool-C_k3BuPx.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-CbdTA-7x.js";import"./use-collections-B6zlDXKN.js";import"./tab-id-BptcWVWa.js";import"./drawer-BKOVC1Nv.js";import"./connect-desktop-dialog-BP6qp00q.js";import"./ChevronUp-CZ6Mxabg.js";import"./User01-C5OEqKDJ.js";import"./checkbox-DNTx2aD9.js";import"./select-DqJQ5lRE.js";import"./ChevronDown-CiTptxE7.js";import"./Key01-CzkLmrt_.js";import"./SearchMd-BOQbygpw.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-CcWvKUoP.js";import"./ChevronRight-BRlgGlqj.js";import"./Stars01-D0EbchXz.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-NnDdgNkk.js";import"./access-gate-CNy3mt4Q.js";import"./capability-load-error-COE1Yb09.js";B({title:N(),url:N(),icon:N()});B({registries:le(N(),B({enabled:he()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:ae(N()).describe("List of MCP app_name or app_id values to hide from the store.")});const W=B({keyId:N(),modelId:N(),title:N().optional()}).nullable();xe(["fast","smart","thinking","image","web_search","deep_research"]);xe(["fast","smart","thinking"]);const at=B({tiers:B({fast:W,smart:W,thinking:W,image:W,web_search:W,deep_research:W})});B({ids:ae(N()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});B({id:N().describe("Brand context ID"),name:N().describe("Company name"),domain:N().describe("Company domain (e.g. example.com)"),overview:N().describe("Company overview / description"),logo:N().nullable().optional().describe("Logo URL"),favicon:N().nullable().optional().describe("Favicon URL"),ogImage:N().nullable().optional().describe("OG image URL"),fonts:B({heading:N().optional().describe("Font family for headings"),body:N().optional().describe("Font family for body text"),code:N().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:B({primary:N().optional().describe("Primary brand color (hex)"),secondary:N().optional().describe("Secondary brand color (hex)"),accent:N().optional().describe("Accent / highlight color (hex)"),background:N().optional().describe("Background color (hex)"),foreground:N().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:ae(le(N(),me())).nullable().optional().describe("Brand images"),metadata:le(N(),me()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:N().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:he().optional().describe("Whether this is the default brand for the organization")});const nt=e=>e.capabilities?.includes("image")===!0,ct=e=>Me(e),dt=e=>Te(e),mt=[{key:"fast",label:"Fast",description:"Fastest responses, best for quick tasks",filter:void 0},{key:"smart",label:"Smart",description:"Balanced speed and capability",filter:void 0},{key:"thinking",label:"Thinking",description:"Most capable, best for complex tasks",filter:void 0},{key:"image",label:"Image",description:"Image generation",filter:nt},{key:"web_search",label:"Web search",description:"Quick, up-to-date answers from the web",filter:ct},{key:"deep_research",label:"Deep research",description:"In-depth, multi-source research reports",filter:dt}];function ut(e){const t=U.c(20),{slot:i,onSlotChange:a,filterModels:r,defaultKeyId:l}=e,o=X(),[x,S]=O.useState(i?.keyId??l);let b;t[0]!==i?(b=()=>{i?.keyId&&S(i.keyId)},t[0]=i,t[1]=b):b=t[1];const d=i?.keyId;let n;t[2]!==d?(n=[d],t[2]=d,t[3]=n):n=t[3],O.useEffect(b,n);const m=x??l;let c;t[4]!==m||t[5]!==o?(c=m?o.find(y=>y.id===m):null,t[4]=m,t[5]=o,t[6]=c):c=t[6];const u=c,{models:g,isLoading:j}=se(r?m??void 0:void 0),_=r?j||g.some(r):!0;let f;t[7]!==i||t[8]!==u?.providerId?(f=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:u?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=u?.providerId,t[9]=f):f=t[9];const k=f;if(r&&!_){let y;return t[10]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}),t[10]=y):y=t[10],y}let I;t[11]===Symbol.for("react.memo_cache_sentinel")?(I=y=>S(y),t[11]=I):I=t[11];let h;t[12]!==m||t[13]!==a?(h=y=>{const F=y.keyId??m??"";S(F),a({keyId:F,modelId:y.modelId,title:y.title})},t[12]=m,t[13]=a,t[14]=h):h=t[14];let p;return t[15]!==m||t[16]!==r||t[17]!==k||t[18]!==h?(p=s.jsx(Ve,{variant:"bordered",placeholder:"Pick model",model:k,credentialId:m,filterModels:r,onCredentialChange:I,onModelChange:h}),t[15]=m,t[16]=r,t[17]=k,t[18]=h,t[19]=p):p=t[19],p}function ft(e){const t=U.c(2),{isPending:i,showSaved:a}=e;if(i){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(ye,{size:12,className:"animate-spin"}),"Saving…"]}),t[0]=r):r=t[0],r}if(a){let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Oe,{size:12}),"Saved"]}),t[1]=r):r=t[1],r}return null}function pt(){const e=U.c(42),t=X(),i=qe(),a=t.length>0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=ge(at),e[0]=r):r=e[0];let l;e[1]!==i?(l={resolver:r,values:i,mode:"onChange"},e[1]=i,e[2]=l):l=e[2];const o=be(l),{mutate:x,isPending:S,isSuccess:b}=Le(),d=o.formState.isDirty;let n;e[3]!==o||e[4]!==i||e[5]!==x?(n={delayMs:250,save:async()=>{const v=o.getValues();x(v,{onSuccess:()=>o.reset(v,{keepValues:!0}),onError:w=>{o.reset(i),Q.error(`Failed to save: ${w.message}`)}})}},e[3]=o,e[4]=i,e[5]=x,e[6]=n):n=e[6];const{schedule:m}=Be(n),c=t[0],u=t[1],g=t[2],{models:j}=se(c?.id),{models:_}=se(u?.id),{models:f}=se(g?.id);let k,I;e[7]!==o||e[8]!==a?(k=()=>{a||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},I=[a,o],e[7]=o,e[8]=a,e[9]=k,e[10]=I):(k=e[9],I=e[10]),O.useEffect(k,I);let h;e[11]!==t||e[12]!==o||e[13]!==c||e[14]!==u||e[15]!==g||e[16]!==j||e[17]!==_||e[18]!==f?(h=()=>{const v=o.getValues(),w=new Set(t.map(ht)),$={};c?.id&&($[c.id]=j),u?.id&&($[u.id]=_),g?.id&&($[g.id]=f);const P=Y=>Y!=null&&!w.has(Y.keyId),C={fast:P(v.tiers.fast)?null:v.tiers.fast,smart:P(v.tiers.smart)?null:v.tiers.smart,thinking:P(v.tiers.thinking)?null:v.tiers.thinking,image:P(v.tiers.image)?null:v.tiers.image,web_search:P(v.tiers.web_search)?null:v.tiers.web_search,deep_research:P(v.tiers.deep_research)?null:v.tiers.deep_research},q=!C.fast||!C.smart||!C.thinking||!C.image||!C.web_search||!C.deep_research,z=C.fast===v.tiers.fast&&C.smart===v.tiers.smart&&C.thinking===v.tiers.thinking&&C.image===v.tiers.image&&C.web_search===v.tiers.web_search&&C.deep_research===v.tiers.deep_research;if(!q&&z)return;const L=Ue(t,$);o.reset({tiers:{fast:C.fast??L.chat.fast,smart:C.smart??L.chat.smart,thinking:C.thinking??L.chat.thinking,image:C.image??L.image,web_search:C.web_search??L.webSearch,deep_research:C.deep_research??L.deepResearch}},{keepDirty:!0})},e[11]=t,e[12]=o,e[13]=c,e[14]=u,e[15]=g,e[16]=j,e[17]=_,e[18]=f,e[19]=h):h=e[19];const p=c?.id,y=u?.id,F=g?.id;let M;e[20]!==t||e[21]!==o||e[22]!==j||e[23]!==_||e[24]!==f||e[25]!==p||e[26]!==y||e[27]!==F?(M=[o,t,j,_,f,p,y,F],e[20]=t,e[21]=o,e[22]=j,e[23]=_,e[24]=f,e[25]=p,e[26]=y,e[27]=F,e[28]=M):M=e[28],O.useEffect(h,M);let T;e[29]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx("p",{className:"text-sm text-muted-foreground",children:"These models power chat, automations, and tools across your organization."}),e[29]=T):T=e[29];const R=b&&!d;let D;e[30]!==S||e[31]!==R?(D=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[T,s.jsx(ft,{isPending:S,showSaved:R})]}),e[30]=S,e[31]=R,e[32]=D):D=e[32];let A;e[33]!==t[0]?.id||e[34]!==o.control||e[35]!==m?(A=mt.map(v=>s.jsx(Ee,{control:o.control,name:`tiers.${v.key}`,render:w=>{const{field:$}=w;return s.jsx(_e,{title:v.label,description:v.description,action:s.jsx(ut,{slot:$.value,defaultKeyId:t[0]?.id??null,filterModels:v.filter,onSlotChange:P=>{$.onChange(P),m()}})})}},v.key)),e[33]=t[0]?.id,e[34]=o.control,e[35]=m,e[36]=A):A=e[36];let K;e[37]!==A?(K=s.jsx(ce,{children:A}),e[37]=A,e[38]=K):K=e[38];let E;return e[39]!==D||e[40]!==K?(E=s.jsxs(de,{title:"Default models",headerClassName:"pl-0",children:[D,K]}),e[39]=D,e[40]=K,e[41]=E):E=e[41],E}function ht(e){return e.id}const xt={usd:[10,20,100],brl:[50,100,500]};function gt(){const e=U.c(26),t=H(),[i,a]=O.useState(!1),{mutate:r,isPending:l}=J({mutationFn:async h=>{const{url:p}=await t.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:h,currency:d});return p},onSuccess:yt,onError:bt}),[o,x]=O.useState(""),[S,b]=O.useState("usd"),d=S,n=parseFloat(o),m=!isNaN(n)&&n>=1,c=d==="brl"?"R$":"$";let u;e[0]!==b?(u=h=>{h&&b(h)},e[0]=b,e[1]=u):u=e[1];let g,j;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(fe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),j=s.jsx(fe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[2]=g,e[3]=j):(g=e[2],j=e[3]);let _;e[4]!==d||e[5]!==u?(_=s.jsxs(Ge,{type:"single",variant:"outline",size:"default",value:d,onValueChange:u,children:[g,j]}),e[4]=d,e[5]=u,e[6]=_):_=e[6];let f;e[7]!==d||e[8]!==c||e[9]!==i||e[10]!==l||e[11]!==r?(f=!i&&s.jsxs(s.Fragment,{children:[xt[d].map(h=>s.jsxs(V,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:l,onClick:()=>r(h*100),children:[c,h]},h)),s.jsx(V,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:l,children:"Custom"})]}),e[7]=d,e[8]=c,e[9]=i,e[10]=l,e[11]=r,e[12]=f):f=e[12];let k;e[13]!==c||e[14]!==o||e[15]!==n||e[16]!==i||e[17]!==m||e[18]!==l||e[19]!==x||e[20]!==r?(k=i&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:c}),s.jsx(ie,{type:"number",min:"1",step:"1",placeholder:"50",value:o,onChange:h=>x(h.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(V,{className:"h-10",disabled:!m||l,onClick:()=>r(Math.round(n*100)),children:l?"...":"Add"}),s.jsx(V,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),x("")},children:"Cancel"})]}),e[13]=c,e[14]=o,e[15]=n,e[16]=i,e[17]=m,e[18]=l,e[19]=x,e[20]=r,e[21]=k):k=e[21];let I;return e[22]!==_||e[23]!==f||e[24]!==k?(I=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[_,f,k]})}),e[22]=_,e[23]=f,e[24]=k,e[25]=I):I=e[25],I}function bt(e){Q.error(`Top-up failed: ${e.message}`)}function yt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function vt(e){return e<=0?"text-destructive":e<=1?"text-amber-500 dark:text-amber-400":"text-foreground"}function jt(){const e=U.c(58),{org:t}=re(),i=H(),a=oe(),r=X();let l;e[0]!==r?(l=r.find(St),e[0]=r,e[1]=l):l=e[1];const o=l,[x,S]=O.useState(!1);let b;e[2]!==o||e[3]!==i?(b=async()=>{o&&await i.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=i,e[4]=b):b=e[4];let d;e[5]!==t.id||e[6]!==a?(d=()=>{a.invalidateQueries({queryKey:G.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:G.aiProviders(t.id)}),Q.success("Deco AI Gateway disconnected"),S(!1)},e[5]=t.id,e[6]=a,e[7]=d):d=e[7];let n;e[8]!==b||e[9]!==d?(n={mutationFn:b,onSuccess:d,onError:_t},e[8]=b,e[9]=d,e[10]=n):n=e[10];const{mutate:m,isPending:c}=J(n);let u;e[11]!==t.id?(u=G.aiProviderCredits(t.id,"deco"),e[11]=t.id,e[12]=u):u=e[12];const g=!!o;let j;e[13]!==i?(j=async()=>{try{return await i.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[13]=i,e[14]=j):j=e[14];let _;e[15]!==u||e[16]!==g||e[17]!==j?(_={queryKey:u,enabled:g,staleTime:6e4,queryFn:j},e[15]=u,e[16]=g,e[17]=j,e[18]=_):_=e[18];const{data:f,isLoading:k,refetch:I,isFetching:h}=ve(_);if(!o)return null;const p=f?.balanceCents!=null?f.balanceCents/100:null;let y;e[19]!==p?(y=p!=null?`$${p.toFixed(2)}`:"—",e[19]=p,e[20]=y):y=e[20];const F=y;let M;e[21]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})})]}),e[21]=M):M=e[21];let T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=()=>S(!0),e[22]=T):T=e[22];let R;e[23]!==c?(R=s.jsxs("div",{className:"flex items-center justify-between",children:[M,s.jsx(V,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:T,disabled:c,children:"Disconnect"})]}),e[23]=c,e[24]=R):R=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs(ke,{children:[s.jsx(Ie,{children:"Disconnect Deco AI Gateway"}),s.jsx(Ce,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),e[25]=D):D=e[25];let A;e[26]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Ne,{children:"Cancel"}),e[26]=A):A=e[26];let K;e[27]!==m?(K=s.jsxs(Pe,{children:[D,s.jsxs(we,{children:[A,s.jsx(De,{onClick:()=>m(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),e[27]=m,e[28]=K):K=e[28];let E;e[29]!==x||e[30]!==K?(E=s.jsx(Ae,{open:x,onOpenChange:S,children:K}),e[29]=x,e[30]=K,e[31]=E):E=e[31];let v;e[32]!==p||e[33]!==F||e[34]!==h||e[35]!==k?(v=k||h?s.jsx(ne,{className:"h-9 w-24"}):s.jsx("span",{className:ue("text-3xl font-semibold tabular-nums tracking-tight",p!=null&&vt(p)),children:F}),e[32]=p,e[33]=F,e[34]=h,e[35]=k,e[36]=v):v=e[36];let w;e[37]!==I?(w=()=>I(),e[37]=I,e[38]=w):w=e[38];const $=h&&"animate-spin";let P;e[39]!==$?(P=ue($),e[39]=$,e[40]=P):P=e[40];let C;e[41]!==P?(C=s.jsx(ye,{size:14,className:P}),e[41]=P,e[42]=C):C=e[42];let q;e[43]!==h||e[44]!==w||e[45]!==C?(q=s.jsx("button",{type:"button",onClick:w,disabled:h,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:C}),e[43]=h,e[44]=w,e[45]=C,e[46]=q):q=e[46];let z;e[47]!==v||e[48]!==q?(z=s.jsxs("div",{className:"flex items-baseline gap-2",children:[v,q]}),e[47]=v,e[48]=q,e[49]=z):z=e[49];let L;e[50]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Available credit balance"}),e[50]=L):L=e[50];let Y;e[51]!==z?(Y=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[z,L]}),e[51]=z,e[52]=Y):Y=e[52];let Z;e[53]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),s.jsx(gt,{})]}),e[53]=Z):Z=e[53];let ee;return e[54]!==R||e[55]!==E||e[56]!==Y?(ee=s.jsx(de,{title:"Deco AI Gateway",children:s.jsx(ce,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[R,E,Y,Z]})})}),e[54]=R,e[55]=E,e[56]=Y,e[57]=ee):ee=e[57],ee}function _t(e){Q.error(`Failed to disconnect: ${e.message}`)}function St(e){return e.providerId==="deco"}function kt(){const e=U.c(8),{org:t}=re(),i=H(),a=oe();let r;e[0]!==i?(r=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=r):r=e[1];let l;e[2]!==t||e[3]!==a?(l=()=>{je("ai_provider_provision_succeeded",{provider_id:"deco"}),a.invalidateQueries({queryKey:G.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:G.aiProviders(t.id)}),Q.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=a,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o={mutationFn:r,onSuccess:l,onError:It},e[5]=r,e[6]=l,e[7]=o):o=e[7],J(o)}function It(e){je("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),Q.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Ct(){const e=U.c(10),{mutate:t,isPending:i}=kt();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=a):a=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:a.join(", ")}}),e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[2]=l):l=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("p",{className:"text-base font-semibold",children:"Deco AI Gateway"}),s.jsx("span",{className:"rounded-full border border-border/60 bg-background/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:"Recommended"})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"100+ models, one connection — pay as you go, no API keys to juggle."})]}),e[3]=o):o=e[3];let x;e[4]!==t?(x=()=>t(),e[4]=t,e[5]=x):x=e[5];const S=i?"Connecting…":"Connect Deco";let b;return e[6]!==i||e[7]!==x||e[8]!==S?(b=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[r,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[l,o,s.jsx(V,{variant:"outline",disabled:i,onClick:x,children:S})]})]}),e[6]=i,e[7]=x,e[8]=S,e[9]=b):b=e[9],b}const Nt=B({label:N().min(1,"Label is required").max(100),apiKey:N().optional(),baseUrl:N().optional()});function Pt({providerKey:e,provider:t,preset:i,maskedKey:a,currentLabel:r,currentBaseUrl:l,onCancel:o,onSuccess:x}){const{org:S}=re(),b=H(),d=oe(),[n,m]=O.useState(!1),c=t.id==="openai-compatible",u=t.supportedMethods.includes("api-key"),{register:g,handleSubmit:j,watch:_,formState:{errors:f}}=be({resolver:ge(Nt),defaultValues:{label:r,apiKey:"",baseUrl:l??""}}),k=_("apiKey")??"",{mutate:I,isPending:h}=J({mutationFn:async p=>{let y;p.apiKey?c?y=JSON.stringify({baseUrl:p.baseUrl||l||"",apiKey:p.apiKey}):y=p.apiKey:c&&p.baseUrl&&p.baseUrl!==l&&(y=JSON.stringify({baseUrl:p.baseUrl,apiKey:""})),await b.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:p.label,...y!==void 0?{apiKey:y}:{}})},onSuccess:()=>{d.invalidateQueries({queryKey:G.aiProviderKeys(S.id)}),d.invalidateQueries({queryKey:G.aiProviders(S.id)}),Q.success("Provider updated"),x()},onError:p=>Q.error(`Failed to update: ${p.message}`)});return s.jsxs("form",{onSubmit:j(p=>I(p)),className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),s.jsx(ie,{placeholder:"e.g. Personal key",...g("label"),className:"h-8 text-sm"}),f.label&&s.jsx("p",{className:"text-xs text-destructive",children:f.label.message})]}),c&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),s.jsx(ie,{type:"url",placeholder:i?.baseUrlPlaceholder??"http://localhost:4000/v1",...g("baseUrl"),className:"h-8 text-sm"})]}),u&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API key"," ",s.jsx("span",{className:"text-muted-foreground/60",children:"(leave blank to keep current)"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ie,{type:n&&k?"text":"password",placeholder:a,...g("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),k&&s.jsx("button",{type:"button",onClick:()=>m(!n),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:n?s.jsx(Xe,{size:14}):s.jsx(Ze,{size:14})})]})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(et,{children:[s.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:o,disabled:h,children:"Cancel"}),s.jsx(V,{type:"submit",size:"sm",disabled:h,children:h?"Saving...":"Save"})]})]})}function wt(e){const t=U.c(28),{providerKey:i,provider:a,open:r,onOpenChange:l}=e,o=H();let x;t[0]!==a.id||t[1]!==i.presetId?(x=a.id==="openai-compatible"&&i.presetId?Ke.find(k=>k.id===i.presetId):void 0,t[0]=a.id,t[1]=i.presetId,t[2]=x):x=t[2];const S=x,b=S?.name??a.name;let d;t[3]!==i.id?(d=G.aiProviderKeyPreview(i.id),t[3]=i.id,t[4]=d):d=t[4];let n;t[5]!==i.id||t[6]!==o?(n=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[5]=i.id,t[6]=o,t[7]=n):n=t[7];let m;t[8]!==r||t[9]!==d||t[10]!==n?(m={queryKey:d,queryFn:n,enabled:r,staleTime:0},t[8]=r,t[9]=d,t[10]=n,t[11]=m):m=t[11];const{data:c,isLoading:u}=ve(m);let g;t[12]!==b?(g=s.jsx(tt,{children:s.jsxs(st,{children:["Edit ",b]})}),t[12]=b,t[13]=g):g=t[13];let j;t[14]!==u||t[15]!==l||t[16]!==S||t[17]!==c||t[18]!==a||t[19]!==i?(j=u||!c?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(ze,{})}):s.jsx(Pt,{providerKey:i,provider:a,preset:S,maskedKey:c.maskedKey,currentLabel:c.label,currentBaseUrl:c.baseUrl,onCancel:()=>l(!1),onSuccess:()=>l(!1)}),t[14]=u,t[15]=l,t[16]=S,t[17]=c,t[18]=a,t[19]=i,t[20]=j):j=t[20];let _;t[21]!==g||t[22]!==j?(_=s.jsxs(it,{className:"sm:max-w-md",children:[g,j]}),t[21]=g,t[22]=j,t[23]=_):_=t[23];let f;return t[24]!==l||t[25]!==r||t[26]!==_?(f=s.jsx(rt,{open:r,onOpenChange:l,children:_}),t[24]=l,t[25]=r,t[26]=_,t[27]=f):f=t[27],f}function Dt(e){const t=U.c(48),{providerKey:i,provider:a}=e,{org:r}=re(),l=H(),o=oe(),[x,S]=O.useState(!1),[b,d]=O.useState(!1),n=a.id==="openai-compatible";let m;t[0]!==n||t[1]!==i.presetId?(m=n&&i.presetId?Ke.find(q=>q.id===i.presetId):void 0,t[0]=n,t[1]=i.presetId,t[2]=m):m=t[2];const c=m,u=c?c.name:n?"Custom OpenAI-compatible":a.name,g=c?.logo??a.logo;let j;e:{if(n){j=i.label;break e}const q=i.label;let z;t[3]!==i.createdAt?(z=ot(new Date(i.createdAt)),t[3]=i.createdAt,t[4]=z):z=t[4],j=`${q} · added ${z} ago`}const _=j;let f;t[5]!==i.id||t[6]!==l?(f=async()=>{await l.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[5]=i.id,t[6]=l,t[7]=f):f=t[7];let k;t[8]!==r||t[9]!==i.id||t[10]!==o?(k=()=>{o.invalidateQueries({queryKey:G.aiProviderKeys(r.id)}),o.invalidateQueries({queryKey:G.aiProviders(r.id)}),o.invalidateQueries({queryKey:G.aiProviderModels(r.id,i.id)}),Q.success("Key deleted"),S(!1)},t[8]=r,t[9]=i.id,t[10]=o,t[11]=k):k=t[11];let I;t[12]!==f||t[13]!==k?(I={mutationFn:f,onSuccess:k,onError:At},t[12]=f,t[13]=k,t[14]=I):I=t[14];const{mutate:h,isPending:p}=J(I);let y;t[15]!==u||t[16]!==g?(y=g?s.jsx("img",{src:g,alt:u,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(He,{fallback:u.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[15]=u,t[16]=g,t[17]=y):y=t[17];let F;t[18]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>d(!0),children:s.jsx(Ye,{size:14})}),t[18]=F):F=t[18];let M,T;t[19]===Symbol.for("react.memo_cache_sentinel")?(M=()=>S(!0),T=s.jsx(We,{size:14}),t[19]=M,t[20]=T):(M=t[19],T=t[20]);let R;t[21]!==p?(R=s.jsxs("div",{className:"flex items-center gap-0.5",children:[F,s.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:p,onClick:M,children:T})]}),t[21]=p,t[22]=R):R=t[22];let D;t[23]!==_||t[24]!==u||t[25]!==R||t[26]!==y?(D=s.jsx(_e,{icon:y,title:u,description:_,action:R}),t[23]=_,t[24]=u,t[25]=R,t[26]=y,t[27]=D):D=t[27];let A;t[28]!==b||t[29]!==a||t[30]!==i?(A=s.jsx(wt,{providerKey:i,provider:a,open:b,onOpenChange:d}),t[28]=b,t[29]=a,t[30]=i,t[31]=A):A=t[31];let K;t[32]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Ie,{children:"Delete API key"}),t[32]=K):K=t[32];let E;t[33]!==i.label?(E=s.jsxs(ke,{children:[K,s.jsxs(Ce,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]})]}),t[33]=i.label,t[34]=E):E=t[34];let v;t[35]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(Ne,{children:"Cancel"}),t[35]=v):v=t[35];let w;t[36]!==h?(w=s.jsxs(we,{children:[v,s.jsx(De,{onClick:()=>h(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[36]=h,t[37]=w):w=t[37];let $;t[38]!==E||t[39]!==w?($=s.jsxs(Pe,{children:[E,w]}),t[38]=E,t[39]=w,t[40]=$):$=t[40];let P;t[41]!==x||t[42]!==$?(P=s.jsx(Ae,{open:x,onOpenChange:S,children:$}),t[41]=x,t[42]=$,t[43]=P):P=t[43];let C;return t[44]!==D||t[45]!==A||t[46]!==P?(C=s.jsxs(s.Fragment,{children:[D,A,P]}),t[44]=D,t[45]=A,t[46]=P,t[47]=C):C=t[47],C}function At(e){return Q.error(`Failed to delete key: ${e.message}`)}function Kt(e){const t=U.c(11),{onConnectClick:i}=e,a=X(),r=Se();let l;t[0]!==r?.providers?(l=r?.providers??[],t[0]=r?.providers,t[1]=l):l=t[1];const o=l;let x;if(t[2]!==a||t[3]!==i||t[4]!==o){let S;t[6]!==o?(S=m=>({key:m,provider:o.find(c=>c.id===m.providerId)}),t[6]=o,t[7]=S):S=t[7];const b=a.filter(Ft).map(S).filter($t);let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Qe,{size:14}),t[8]=d):d=t[8];let n;t[9]!==i?(n=s.jsxs(V,{size:"sm",onClick:i,children:[d,"Connect provider"]}),t[9]=i,t[10]=n):n=t[10],x=s.jsx(de,{title:"Connected providers",headerClassName:"px-0",actions:n,children:b.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:"Bring your own keys to use specific models alongside Deco's gateway."}):s.jsx(ce,{children:b.map(Et)})}),t[2]=a,t[3]=i,t[4]=o,t[5]=x}else x=t[5];return x}function Et(e){const{key:t,provider:i}=e;return s.jsx(Dt,{providerKey:t,provider:i},t.id)}function $t(e){return e.provider!==void 0}function Ft(e){return e.providerId!=="deco"}function Rt(e){const t=U.c(3),{error:i}=e;let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Fe,{size:16}),t[0]=a):a=t[0];let r;return t[1]!==i.message?(r=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[a,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=r):r=t[2],r}function Ot(){const e=U.c(23),t=X();let i;e[0]!==t?(i=t.some(Mt),e[0]=t,e[1]=i):i=e[1];const a=i,r=t.length>0,[l,o]=O.useState(!1),[x,S]=O.useState(null),b=Se();let d;e[2]!==b?.providers?(d=b?.providers??[],e[2]=b?.providers,e[3]=d):d=e[3];const n=d;if(!r){let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=()=>o(!0),e[4]=_):_=e[4];let f;e[5]!==n?(f=s.jsx(Je,{providers:n,onSelect:S,onShowAll:_}),e[5]=n,e[6]=f):f=e[6];const k=x!==null||l;let I;e[7]===Symbol.for("react.memo_cache_sentinel")?(I=F=>{F||(S(null),o(!1))},e[7]=I):I=e[7];const h=x??void 0;let p;e[8]!==k||e[9]!==h?(p=s.jsx(pe,{open:k,onOpenChange:I,initialProvider:h}),e[8]=k,e[9]=h,e[10]=p):p=e[10];let y;return e[11]!==f||e[12]!==p?(y=s.jsxs(s.Fragment,{children:[f,p]}),e[11]=f,e[12]=p,e[13]=y):y=e[13],y}let m;e[14]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(O.Suspense,{fallback:s.jsx(ne,{className:"h-16 w-full"}),children:s.jsx(pt,{})}),e[14]=m):m=e[14];let c;e[15]!==a?(c=a?s.jsx(jt,{}):s.jsx(Ct,{}),e[15]=a,e[16]=c):c=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Kt,{onConnectClick:()=>o(!0)}),e[17]=u):u=e[17];let g;e[18]!==l?(g=s.jsx(pe,{open:l,onOpenChange:o}),e[18]=l,e[19]=g):g=e[19];let j;return e[20]!==c||e[21]!==g?(j=s.jsxs(s.Fragment,{children:[m,c,u,g]}),e[20]=c,e[21]=g,e[22]=j):j=e[22],j}function Mt(e){return e.providerId==="deco"}function Tt(){const e=U.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(te.Title,{children:"AI Providers"}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs(Re,{children:[t,s.jsx($e,{fallback:Ut,children:s.jsx(O.Suspense,{fallback:s.jsx(ne,{className:"h-64 w-full"}),children:s.jsx(Ot,{})})})]})})})}),e[1]=i):i=e[1],i}function Ut(e){const{error:t}=e;return s.jsx(Rt,{error:t??new Error("Failed to load AI providers")})}function Gs(){const e=U.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(lt,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(Tt,{})}),e[0]=t):t=e[0],t}export{Gs as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as ge,r as w,j as o,l as ye,t as ue,i as Se}from"./index-CN4fylaJ.js";import{i as je}from"./ChevronRight-BRlgGlqj.js";import{S as ke}from"./scroll-area-BUT5ZZ5w.js";import{A as _e}from"./add-section-modal-DQX8P5JM.js";import{ap as Be,aq as we,ar as Ae,j as Ne,k as Re,as as Ce,Y as Ee,at as Ke,ac as Te}from"./index-qW-QuY3O.js";import"./agent-icon-B97sy6nN.js";import"./AlertCircle-DRN6XAl_.js";import"./Tool01-CMzj8Zow.js";import"./SwitchHorizontal01-Bpd1Utek.js";import"./Settings02-Du9J1LY1.js";import"./XCircle-DS2uELKv.js";import"./ArrowUpRight-CS4sxU2z.js";import"./ZapSquare-WzwrglCu.js";import"./Users03-CcZFUmPD.js";import"./CheckCircle-Dof-gkrW.js";import"./ChevronUp-CZ6Mxabg.js";import"./ChevronDown-CiTptxE7.js";import"./ChevronLeft-LnaPgJ0y.js";import"./DotsVertical-BSRrIcA1.js";import"./Stars02-CTQVeFIY.js";import"./Eye-D3ZcE9lW.js";import"./ZoomOut-AiYlkF58.js";import"./Globe01-6U0-ZV4l.js";import"./FilterLines-nV95nFgf.js";import"./Star01-gn_l3mpc.js";import"./Globe04-10fsKNwF.js";import"./HardDrive-CcAdoaFI.js";import"./Key01-CzkLmrt_.js";import"./LayoutLeft-CpEUT3tP.js";import"./LinkExternal01-TXfR4Hhy.js";import"./Monitor01-CcWvKUoP.js";import"./Sun-CXETDRVX.js";import"./Palette-BmXhqV8p.js";import"./Play-BRcSzafX.js";import"./Plus-BS57SLmT.js";import"./SearchLg-CIaBccbb.js";import"./SearchMd-BOQbygpw.js";import"./Shield01-Dq_-3VLc.js";import"./Stars01-D0EbchXz.js";import"./Trash01-pbf89pjs.js";import"./Upload01-DvmBqoDO.js";import"./User01-C5OEqKDJ.js";import"./Users01-B7An2LNd.js";import"./XClose-vcxupN64.js";import"./X-DtGx_Eqi.js";import"./Zap-BcCmjpc0.js";import"./use-clock-tick-DR_O_bL8.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-DNq3T6SH.js";import"./tooltip-DPkvAJEu.js";import"./file-type-icon-DFA7UObK.js";import"./dialog-CUMtGMOn.js";import"./use-mobile-d3rX0VX2.js";import"./tab-id-BptcWVWa.js";import"./content-blocks-o63cs2vh.js";import"./types-D5SLCq2u.js";import"./use-mcp-client-CIYxX4P5.js";import"./auth-CZ0pDy2E.js";import"./chat-context-CXJPuJv7.js";import"./hooks-BE7YwHtm.js";import"./decopilot-sse-pool-C_k3BuPx.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-CbdTA-7x.js";import"./use-collections-B6zlDXKN.js";import"./use-ai-providers-3vPjPOz2.js";import"./studio-tools-BXeKF31x.js";import"./use-organization-settings-DQjKRGQP.js";import"./shell-layout-B87-IiK6.js";import"./avatar-CM9_qKlB.js";import"./required-auth-layout-D985wSIU.js";import"./use-org-sso-CGtfMwKv.js";import"./sheet-DCM0ToXL.js";import"./integration-icon-DO0aMlRM.js";import"./use-navigate-to-agent-X5p7bWf4.js";import"./use-connection-8FX2zzcI.js";import"./use-mcp-prompts-l61zrviT.js";import"./form-zKde5vNL.js";import"./label-BrslM_UB.js";import"./input-Cs0DBSJe.js";import"./select-DqJQ5lRE.js";import"./index-DbCqW7YA.js";import"./drawer-BKOVC1Nv.js";import"./collection-search-D7ygKNJe.js";import"./tabs-uIdHwBqm.js";import"./toggle-group-DC-9R-kx.js";import"./sortable.esm-BC4ZOnIG.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-DyrxiMlh.js";import"./use-registry-connections-Dg8ovbRG.js";import"./useInfiniteQuery-DiJ0Xsij.js";import"./use-infinite-scroll-C_MuFtOU.js";import"./extract-connection-data-0didS_pX.js";import"./card-BdlGnaGa.js";import"./collection-tabs-BcopigLE.js";import"./badge-BTVwpu14.js";import"./textarea-BSHQNfh6.js";import"./connection-form-helpers-DwJWrgb4.js";import"./authenticate-and-persist-oauth-CRdn4J0q.js";import"./mcp-oauth-CXbxPU1K.js";import"./useSuspenseInfiniteQuery-B2CIiwRu.js";import"./connect-desktop-dialog-BP6qp00q.js";import"./decopilot-BB1FfLa4.js";import"./checkbox-DNTx2aD9.js";import"./skeleton-D1BsF23p.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-8KZ8wW1V.js";import"./popover-BWjew7H2.js";import"./command-Dgi7YlH_.js";import"./index-C_7VA7XD.js";import"./dropdown-menu-swLhScJn.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-DVCwZxOR.js";import"./empty-state-D_f-_l9W.js";import"./toolbar-DevcmIZ4.js";import"./preview-dialog-CgmGD8zP.js";import"./index-D87D-9z8.js";import"./use-mcp-tools-C_waYweR.js";import"./use-capability-NnDdgNkk.js";import"./shell-route-loading-J3bIbZOA.js";import"./index-CXoUE4MX.js";import"./alert-dialog-BAuzNhCD.js";import"./switch-Dv2j6d5M.js";import"./use-debounced-autosave-DgaYGNmY.js";import"./index-Dso3mm7m.js";import"./sidebar-DwyKpA9b.js";import"./search-input-Csp-MZi9.js";import"./github-repo-picker-xaTZuOQc.js";import"./use-debounced-value-BO0E-um9.js";import"./use-secrets-CNTh-cii.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-CyfUtpac.js";import"./automation-runs-B16B6scX.js";import"./table-JD_NL-TZ.js";import"./use-members-CIjbWJiD.js";import"./use-org-auth-client-Bv_Zhbk4.js";import"./task-status-C0XtJQEC.js";import"./use-automations-DpEBzEk5.js";import"./use-file-configs-DAJdFU9z.js";import"./monaco-editor-BvqPmzKC.js";import"./select-model-04vQ8QxB.js";import"./automation-list-row-CcPQPkfW.js";function $e(l,e){const m=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),f=/^[A-Za-z]/.test(m)&&m.length>0?m:"Section",a=Be(e,f);return{blockKey:a,data:{__resolveType:l.resolveType,name:a}}}function br(l){const e=ge.c(77),{orgSlug:m,virtualMcpId:f,branch:a,blockKey:i,block:n,meta:s,decofile:c,title:D,excludeFields:H,schemaPending:ae,previewBaseUrl:ne}=l,Y=ae===void 0?!1:ae,u=ne===void 0?null:ne,x=typeof n?.__resolveType=="string"?n.__resolveType:"";let R;e[0]!==H||e[1]!==s||e[2]!==x?(R=we(x,s,H),e[0]=H,e[1]=s,e[2]=x,e[3]=R):R=e[3];const h=R;let C;e[4]!==h?(C=!!h&&Object.keys(h.properties??{}).length>0,e[4]=h,e[5]=C):C=e[5];const G=C;let E;e[6]!==n||e[7]!==i||e[8]!==s||e[9]!==D?(E=D??(n?Ae(i,n,s):i),e[6]=n,e[7]=i,e[8]=s,e[9]=D,e[10]=E):E=e[10];const v=E;let K;e[11]!==a||e[12]!==m||e[13]!==f?(K={orgSlug:m,virtualMcpId:f,branch:a},e[11]=a,e[12]=m,e[13]=f,e[14]=K):K=e[14];const{save:b,flush:J,isPending:Q}=Ne(K);let T;e[15]!==a||e[16]!==m||e[17]!==f?(T={orgSlug:m,virtualMcpId:f,branch:a},e[15]=a,e[16]=m,e[17]=f,e[18]=T):T=e[18];const W=Re(T);let $;e[19]!==b?($=Ee((t,r)=>b(t,r)),e[19]=b,e[20]=$):$=e[20];const X=$,[he,xe]=w.useState(i),[ee,ce]=w.useState(null),[te,de]=w.useState(0);let F;e[21]===Symbol.for("react.memo_cache_sentinel")?(F=[],e[21]=F):F=e[21];const[p,fe]=w.useState(F),[oe,re]=w.useState(!1),P=w.useRef(null);he!==i&&(xe(i),ce(null),de(Pe),fe([]));let O;e[22]!==n?(O=n??{},e[22]=n,e[23]=O):O=e[23];const ie=O;let g;e[24]!==ee?(g=ee??{},e[24]=ee,e[25]=g):g=e[25];let q;e[26]!==ie||e[27]!==g?(q={...ie,...g},e[26]=ie,e[27]=g,e[28]=q):q=e[28];const se=q;let z;e[29]!==i||e[30]!==x||e[31]!==b?(z=t=>{const r=t;ce(r),b(i,{...r,__resolveType:x})},e[29]=i,e[30]=x,e[31]=b,e[32]=z):z=e[32];const me=z;let L;e[33]===Symbol.for("react.memo_cache_sentinel")?(L=t=>{fe(t)},e[33]=L):L=e[33];const pe=L;let V;e[34]!==c||e[35]!==J||e[36]!==W?(V=async(t,r)=>{try{const{blockKey:d,data:N}=$e(t,c);await W.mutateAsync({blockKey:d,data:N}),ue.success(`Created section "${d}"`),r({__resolveType:d}),J()}catch(d){const N=d,be=N instanceof Error?N.message:"Could not add section";throw ue.error(be),N}},e[34]=c,e[35]=J,e[36]=W,e[37]=V):V=e[37];const y=V;let I;e[38]===Symbol.for("react.memo_cache_sentinel")?(I=t=>{P.current=t.append,re(!0)},e[38]=I):I=e[38];const ve=I;let U;e[39]!==y?(U=async t=>{const r=P.current;if(r)try{await y(t,d=>{r(d),re(!1),P.current=null})}catch{}},e[39]=y,e[40]=U):U=e[40];const le=U;let M;e[41]!==p||e[42]!==v?(M=p.length>0?[v,...p]:[],e[41]=p,e[42]=v,e[43]=M):M=e[43];const A=M;let S;e[44]!==p||e[45]!==A||e[46]!==v?(S=A.length>0?o.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:A.map((t,r)=>{const d=r===A.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(je,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{pe(r===0?[]:Ce(p,r)),de(Fe)},title:t,className:ye("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",d?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:v}),e[44]=p,e[45]=A,e[46]=v,e[47]=S):S=e[47];let j;e[48]!==Q?(j=o.jsx(Ke,{isPending:Q,isError:!1}),e[48]=Q,e[49]=j):j=e[49];let k;e[50]!==S||e[51]!==j?(k=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[S,j]}),e[50]=S,e[51]=j,e[52]=k):k=e[52];let _;e[53]!==i||e[54]!==p||e[55]!==c||e[56]!==se||e[57]!==te||e[58]!==y||e[59]!==me||e[60]!==G||e[61]!==s||e[62]!==u||e[63]!==X||e[64]!==h||e[65]!==Y?(_=o.jsx(ke,{className:"min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-6 py-6",children:o.jsx("div",{className:"mx-auto max-w-xl",children:G?o.jsx(Te,{schema:h,value:se,onChange:me,basePath:"",breadcrumbPath:p,onBreadcrumbChange:pe,decofile:c,meta:s,onSaveReferencedBlock:X,previewBaseUrl:u,onAddSectionItem:y,onRequestAddSection:ve},`${i}:${te}`):Y?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(Se,{size:16,className:"animate-spin"}),"Loading app schema…"]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:"No editable schema found for this app."})})})}),e[53]=i,e[54]=p,e[55]=c,e[56]=se,e[57]=te,e[58]=y,e[59]=me,e[60]=G,e[61]=s,e[62]=u,e[63]=X,e[64]=h,e[65]=Y,e[66]=_):_=e[66];let B;e[67]!==oe||e[68]!==c||e[69]!==le||e[70]!==s||e[71]!==u?(B=u&&o.jsx(_e,{open:oe,onOpenChange:t=>{re(t),t||(P.current=null)},meta:s,decofile:c,previewBaseUrl:u,onSelect:t=>{le(t)}}),e[67]=oe,e[68]=c,e[69]=le,e[70]=s,e[71]=u,e[72]=B):B=e[72];let Z;return e[73]!==k||e[74]!==_||e[75]!==B?(Z=o.jsxs("div",{className:"flex h-full flex-col",children:[k,_,B]}),e[73]=k,e[74]=_,e[75]=B,e[76]=Z):Z=e[76],Z}function Fe(l){return l+1}function Pe(l){return l+1}export{br as AppEditor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as W,r as S,l as q,j as t,B as U,i as Q,t as I}from"./index-CN4fylaJ.js";import{i as X}from"./XCircle-DS2uELKv.js";import{aB as Y,V as T}from"./agent-icon-B97sy6nN.js";import{n as Z}from"./LinkExternal01-TXfR4Hhy.js";import{f as _,a as K,b as tt,c as et,d as ot,e as rt,A as st,g as it}from"./alert-dialog-BAuzNhCD.js";import{I as M}from"./input-Cs0DBSJe.js";import{L}from"./label-BrslM_UB.js";import{au as at,av as nt,aD as mt,at as lt,aw as R,ay as pt,aE as ct}from"./index-qW-QuY3O.js";import{c as dt,B as ut,a as gt}from"./block-document-B_2YkDzB.js";import{u as xt,s as v,E as ht}from"./primitives-CriWeTQD.js";import{t as ft}from"./ChevronDown-CiTptxE7.js";import{f as yt,h as jt,e as vt}from"./scroll-area-BUT5ZZ5w.js";import"./AlertCircle-DRN6XAl_.js";import"./Tool01-CMzj8Zow.js";import"./SwitchHorizontal01-Bpd1Utek.js";import"./Settings02-Du9J1LY1.js";import"./ArrowUpRight-CS4sxU2z.js";import"./ZapSquare-WzwrglCu.js";import"./Users03-CcZFUmPD.js";import"./CheckCircle-Dof-gkrW.js";import"./ChevronUp-CZ6Mxabg.js";import"./ChevronLeft-LnaPgJ0y.js";import"./ChevronRight-BRlgGlqj.js";import"./DotsVertical-BSRrIcA1.js";import"./Stars02-CTQVeFIY.js";import"./Eye-D3ZcE9lW.js";import"./ZoomOut-AiYlkF58.js";import"./Globe01-6U0-ZV4l.js";import"./FilterLines-nV95nFgf.js";import"./Star01-gn_l3mpc.js";import"./Globe04-10fsKNwF.js";import"./HardDrive-CcAdoaFI.js";import"./Key01-CzkLmrt_.js";import"./LayoutLeft-CpEUT3tP.js";import"./Monitor01-CcWvKUoP.js";import"./Sun-CXETDRVX.js";import"./Palette-BmXhqV8p.js";import"./Play-BRcSzafX.js";import"./Plus-BS57SLmT.js";import"./SearchLg-CIaBccbb.js";import"./SearchMd-BOQbygpw.js";import"./Shield01-Dq_-3VLc.js";import"./Stars01-D0EbchXz.js";import"./Trash01-pbf89pjs.js";import"./Upload01-DvmBqoDO.js";import"./User01-C5OEqKDJ.js";import"./Users01-B7An2LNd.js";import"./XClose-vcxupN64.js";import"./X-DtGx_Eqi.js";import"./Zap-BcCmjpc0.js";import"./index-DbCqW7YA.js";import"./chat-context-CXJPuJv7.js";import"./hooks-BE7YwHtm.js";import"./use-mcp-client-CIYxX4P5.js";import"./auth-CZ0pDy2E.js";import"./decopilot-sse-pool-C_k3BuPx.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-CbdTA-7x.js";import"./use-collections-B6zlDXKN.js";import"./use-ai-providers-3vPjPOz2.js";import"./studio-tools-BXeKF31x.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-DQjKRGQP.js";import"./tooltip-DPkvAJEu.js";import"./dialog-CUMtGMOn.js";import"./drawer-BKOVC1Nv.js";import"./collection-search-D7ygKNJe.js";import"./use-mobile-d3rX0VX2.js";import"./use-mcp-prompts-l61zrviT.js";import"./shell-layout-B87-IiK6.js";import"./avatar-CM9_qKlB.js";import"./required-auth-layout-D985wSIU.js";import"./use-org-sso-CGtfMwKv.js";import"./form-zKde5vNL.js";import"./select-DqJQ5lRE.js";import"./tabs-uIdHwBqm.js";import"./toggle-group-DC-9R-kx.js";import"./sortable.esm-BC4ZOnIG.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-DyrxiMlh.js";import"./use-registry-connections-Dg8ovbRG.js";import"./use-connection-8FX2zzcI.js";import"./useInfiniteQuery-DiJ0Xsij.js";import"./use-infinite-scroll-C_MuFtOU.js";import"./extract-connection-data-0didS_pX.js";import"./card-BdlGnaGa.js";import"./integration-icon-DO0aMlRM.js";import"./collection-tabs-BcopigLE.js";import"./badge-BTVwpu14.js";import"./textarea-BSHQNfh6.js";import"./connection-form-helpers-DwJWrgb4.js";import"./authenticate-and-persist-oauth-CRdn4J0q.js";import"./mcp-oauth-CXbxPU1K.js";import"./useSuspenseInfiniteQuery-B2CIiwRu.js";import"./connect-desktop-dialog-BP6qp00q.js";import"./decopilot-BB1FfLa4.js";import"./checkbox-DNTx2aD9.js";import"./skeleton-D1BsF23p.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-8KZ8wW1V.js";import"./popover-BWjew7H2.js";import"./command-Dgi7YlH_.js";import"./index-C_7VA7XD.js";import"./dropdown-menu-swLhScJn.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-DVCwZxOR.js";import"./empty-state-D_f-_l9W.js";import"./toolbar-DevcmIZ4.js";import"./preview-dialog-CgmGD8zP.js";import"./index-D87D-9z8.js";import"./file-type-icon-DFA7UObK.js";import"./use-mcp-tools-C_waYweR.js";import"./types-D5SLCq2u.js";import"./use-capability-NnDdgNkk.js";import"./shell-route-loading-J3bIbZOA.js";import"./index-CXoUE4MX.js";import"./switch-Dv2j6d5M.js";import"./use-debounced-autosave-DgaYGNmY.js";import"./index-Dso3mm7m.js";import"./sidebar-DwyKpA9b.js";import"./sheet-DCM0ToXL.js";import"./search-input-Csp-MZi9.js";import"./github-repo-picker-xaTZuOQc.js";import"./use-debounced-value-BO0E-um9.js";import"./use-navigate-to-agent-X5p7bWf4.js";import"./use-secrets-CNTh-cii.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./view-mode-toggle-CyfUtpac.js";import"./automation-runs-B16B6scX.js";import"./table-JD_NL-TZ.js";import"./use-members-CIjbWJiD.js";import"./use-org-auth-client-Bv_Zhbk4.js";import"./task-status-C0XtJQEC.js";import"./use-automations-DpEBzEk5.js";import"./use-file-configs-DAJdFU9z.js";import"./monaco-editor-BvqPmzKC.js";import"./select-model-04vQ8QxB.js";import"./automation-list-row-CcPQPkfW.js";import"./use-clock-tick-DR_O_bL8.js";import"./use-copy-DNq3T6SH.js";import"./content-blocks-o63cs2vh.js";function bt(k){const e=W.c(18),{icon:f,title:m,defaultOpen:b,children:u}=k,D=b===void 0?!1:b,[h,A]=S.useState(D);let l;e[0]!==f?(l=t.jsx(f,{size:15}),e[0]=f,e[1]=l):l=e[1];let s;e[2]!==m?(s=t.jsx("span",{className:"flex-1 text-left",children:m}),e[2]=m,e[3]=s):s=e[3];const y=h&&"rotate-180";let r;e[4]!==y?(r=q("transition-transform",y),e[4]=y,e[5]=r):r=e[5];let p;e[6]!==r?(p=t.jsx(ft,{size:15,className:r}),e[6]=r,e[7]=p):p=e[7];let c;e[8]!==l||e[9]!==s||e[10]!==p?(c=t.jsx(yt,{asChild:!0,children:t.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:[l,s,p]})}),e[8]=l,e[9]=s,e[10]=p,e[11]=c):c=e[11];let i;e[12]!==u?(i=t.jsx(jt,{className:"px-2 pt-4",children:u}),e[12]=u,e[13]=i):i=e[13];let g;return e[14]!==h||e[15]!==c||e[16]!==i?(g=t.jsxs(vt,{open:h,onOpenChange:A,className:"mt-4",children:[c,i]}),e[14]=h,e[15]=c,e[16]=i,e[17]=g):g=e[17],g}function sr({orgSlug:k,virtualMcpId:e,branch:f,blockKey:m,block:b,decofile:u,meta:D,onManagePosts:h,onOpenPost:A,previewBaseUrl:l}){const s=at({orgSlug:k,virtualMcpId:e,branch:f}),y=nt(b,"categories"),[r,p,c]=xt(y,o=>{s.mutate({blockKey:m,data:R(m,"categories",o)})}),i=(o,w)=>p({...r,[o]:w}),g=dt({decofile:u,category:r,previewBaseUrl:l}),a=v(r.slug),[B,j]=S.useState(a),[n,C]=S.useState(null),[N,E]=S.useState(!1),$=a?mt(u).filter(o=>o.categorySlugs.includes(a)):[],d=$.length,G=o=>i("slug",o),H=async(o,w)=>{const V=v(r.name);E(!0);try{let x=0;for(const{key:O,payload:P}of pt(u,"posts")){const F=ct(P,o,{name:V,slug:w});F!==P&&(await s.mutateAsync({blockKey:O,data:R(O,"posts",F)}),x+=1)}const z={...r,slug:w};await s.mutateAsync({blockKey:m,data:R(m,"categories",z)}),c(z),I.success(x>0?`Renamed slug and updated ${x} ${x===1?"post":"posts"}`:"Renamed slug"),C(null)}catch(x){j(o),C(null),I.error(x instanceof Error?x.message:"Rename failed")}finally{E(!1)}},J=()=>{const o=B.trim();if(o===a){B!==o&&j(o);return}if(!o){j(a);return}if(d===0){G(o);return}C({oldSlug:a,newSlug:o,count:d})};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex h-full flex-col",children:[t.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[t.jsx("span",{className:"truncate text-sm font-medium",children:v(r.name)||"Untitled category"}),t.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[t.jsx(lt,{isPending:s.isPending,isError:s.isError}),g&&t.jsxs(U,{type:"button",variant:"outline",size:"sm",title:"Open the category preview in a new tab",onClick:()=>window.open(g,"_blank","noopener,noreferrer"),children:[t.jsx(Z,{size:14}),"See category preview"]})]})]}),t.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:t.jsxs("div",{className:"mx-auto max-w-4xl px-8 py-8",children:[t.jsx(ht,{value:v(r.name),onChange:o=>i("name",o),placeholder:"Category name",className:"py-1 text-3xl font-bold text-foreground"}),t.jsxs("div",{className:"mt-4 space-y-2",children:[t.jsx(L,{htmlFor:"category-slug",children:"Slug"}),t.jsx(M,{id:"category-slug",value:B,onChange:o=>j(o.target.value),onBlur:J,placeholder:"my-category",className:"h-10"})]}),t.jsxs("div",{className:"mt-4 space-y-2",children:[t.jsx(L,{htmlFor:"category-description",children:"Description"}),t.jsx(M,{id:"category-description",value:v(r.description),onChange:o=>i("description",o.target.value),placeholder:"Short description for this category",className:"h-10"})]}),t.jsx(bt,{icon:Y,title:"Content",defaultOpen:!0,children:t.jsx(ut,{value:gt(r.sections),onChange:o=>i("sections",o),meta:D,emptyMessage:"This category has no content yet. Use ⊕ to add your first block."})}),t.jsxs("div",{className:"mt-6 overflow-hidden rounded-lg border bg-muted/30",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx(T,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsxs("span",{className:"text-sm",children:[d," ",d===1?"post":"posts"," in this category"]})]}),t.jsxs(U,{type:"button",variant:"outline",size:"sm",disabled:!a,title:a?d===0?"Go to the posts list to add posts to this category":"Jump to the posts list filtered by this category":"Set a slug to manage this category's posts",onClick:()=>h(d===0?"":a),children:[d===0?"Add posts":"Manage posts",t.jsx(X,{size:14})]})]}),d>0&&t.jsx("ul",{className:"divide-y border-t bg-background",children:$.map(o=>t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>A(o.key),className:"flex w-full items-center gap-2.5 px-4 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[t.jsx(T,{size:14,className:"shrink-0 text-muted-foreground"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-sm",children:o.title||"Untitled post"}),o.slug&&t.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:o.slug})]})]})},o.key))})]})]})})]}),t.jsx(_,{open:!!n,onOpenChange:o=>{o||N||(j(a),C(null))},children:t.jsxs(K,{children:[t.jsxs(tt,{children:[t.jsx(et,{children:"Rename category slug?"}),t.jsx(ot,{children:n?`Changing the slug from "${n.oldSlug}" to "${n.newSlug}" will update ${n.count} ${n.count===1?"post":"posts"} that reference this category.`:null})]}),t.jsxs(rt,{children:[t.jsx(st,{disabled:N,children:"Cancel"}),t.jsx(it,{onClick:o=>{o.preventDefault(),n&&H(n.oldSlug,n.newSlug)},disabled:N,children:N?t.jsxs(t.Fragment,{children:[t.jsx(Q,{size:14,className:"animate-spin"}),"Renaming…"]}):"Rename & update posts"})]})]})})]})}export{sr as CategoryEditor};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{c as pe,l as Fe,bF as Ue,j as L,cv as qe,I as Me,m as Ee,D as re,K as ue,t as _e,C as ae,L as oe,b as Ae,u as we,e as Ke,r as h,v as Ve,a as We,J as He,aJ as Qe}from"./index-CN4fylaJ.js";import{A as Re,a as Be,d as ze,e as Ge,f as Xe,u as Ze,w as Ye}from"./hooks-BE7YwHtm.js";import{a as Je,u as et,S as tt}from"./use-mcp-client-CIYxX4P5.js";import{a as nt}from"./use-virtual-mcp-CbdTA-7x.js";import{u as st,b as de}from"./use-ai-providers-3vPjPOz2.js";import{n as at,k as ot}from"./tab-id-BptcWVWa.js";import{d as rt}from"./use-organization-settings-DQjKRGQP.js";const it={anthropic:["claude-haiku-4-5","claude-haiku"],openrouter:["qwen/qwen3.5-flash","anthropic/claude-haiku-4.5","anthropic/claude-haiku","google/gemini-3-flash"],deco:["qwen/qwen3.5-flash","anthropic/claude-haiku"],llmapi:["claude-haiku-4-5","claude-haiku","gpt-4o-mini"],google:["gemini-2.5-flash","gemini-3-flash"],"claude-code":["claude-code:haiku","claude-code:sonnet"],codex:["codex:gpt-5.4-mini"]},ct={anthropic:["claude-sonnet-5","claude-sonnet"],openrouter:["anthropic/claude-sonnet-5","anthropic/claude-sonnet","anthropic/claude-opus-4.8","google/gemini-3-pro"],deco:["anthropic/claude-sonnet-5","anthropic/claude-sonnet","anthropic/claude"],llmapi:["claude-sonnet-4-6","claude-sonnet"],google:["gemini-3-pro","gemini-3-flash"],"claude-code":["claude-code:sonnet"],codex:["codex:gpt-5.4"]},lt={anthropic:["claude-opus-4-8","claude-sonnet-5","claude-sonnet","claude-fable-5"],openrouter:["anthropic/claude-opus-4.8:extended","anthropic/claude-opus-4.8","anthropic/claude-sonnet-5:extended","anthropic/claude-sonnet-5","google/gemini-3-pro","anthropic/claude-fable-5"],deco:["anthropic/claude-opus","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude-fable"],llmapi:["claude-opus-4-8","claude-opus","claude-sonnet-4-6"],google:["gemini-3-pro"],"claude-code":["claude-code:opus-1m","claude-code:opus","claude-code:sonnet"],codex:["codex:gpt-5.5"]},dt={openrouter:["openai/gpt-image-1","google/gemini-2.0-flash-image"],deco:["openai/gpt-image-1","google/gemini-2.0-flash-image"],llmapi:["gemini-2.5-flash-image","gpt-image-1"],google:["gemini-2.0-flash-image"]},ut={openrouter:["perplexity/sonar","perplexity/sonar-pro"],deco:["perplexity/sonar","perplexity/sonar-pro"]},pt={openrouter:["perplexity/deep-research","perplexity/sonar-pro"],deco:["perplexity/deep-research","perplexity/sonar-pro"]};function Pe(t){return t.toLowerCase().replace(/[^a-z0-9]/g,"")}function ht(t){return Pe(t).includes("deepresearch")}const ft=["sonar","searchpreview","online"];function De(t){const e=Pe(t);return e.includes("deepresearch")?!1:ft.some(a=>e.includes(a))}function $e(t){return t.asyncResearch!==!0&&De(t.modelId)}function Oe(t){return t.asyncResearch===!0||ht(t.modelId)||De(t.modelId)}function ne(t,e,a,n){for(const s of a){const o=t.find(r=>r.modelId===s);if(o)return{keyId:e,modelId:o.modelId,title:o.title}}for(const s of a){const o=t.find(r=>r.modelId.includes(s));if(o)return{keyId:e,modelId:o.modelId,title:o.title}}if(n){const s=t.find(n);if(s)return{keyId:e,modelId:s.modelId,title:s.title}}return null}function mt(t,e){const a={chat:{fast:null,smart:null,thinking:null},image:null,webSearch:null,deepResearch:null};for(const n of t){const s=e[n.id]??[],o=n.providerId;a.chat.fast||(a.chat.fast=ne(s,n.id,it[o]??[])),a.chat.smart||(a.chat.smart=ne(s,n.id,ct[o]??[])),a.chat.thinking||(a.chat.thinking=ne(s,n.id,lt[o]??[])),a.image||(a.image=ne(s,n.id,dt[o]??[],r=>r.capabilities?.includes("image")===!0)),a.webSearch||(a.webSearch=ne(s,n.id,ut[o]??[],$e)),a.deepResearch||(a.deepResearch=ne(s,n.id,pt[o]??[],Oe))}return a}const gt=Ue("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",success:"fill-success text-gray-200",special:"fill-special text-background"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function Kt(t){const e=pe.c(10),{variant:a,size:n}=t;let s;e[0]!==n||e[1]!==a?(s=Fe(gt({variant:a,size:n})),e[0]=n,e[1]=a,e[2]=s):s=e[2];let o,r;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=L.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),r=L.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=o,e[4]=r):(o=e[3],r=e[4]);let i;e[5]!==s?(i=L.jsxs("svg",{"aria-hidden":"true",className:s,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o,r]}),e[5]=s,e[6]=i):i=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=L.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=f):f=e[7];let g;return e[8]!==i?(g=L.jsxs("div",{role:"status",children:[i,f]}),e[8]=i,e[9]=g):g=e[9],g}function xt(t,e=[]){return t==="stop"?e.filter(s=>s.type==="text"&&s.text).map(s=>s.text).join(`
|
|
2
|
-
`).replace(/https?:\/\/[^\s)>\]]+/g,"").includes("?")?"requires_action":"completed":t==="tool-calls"?e.some(n=>n.type==="tool-user_ask"&&n.state==="input-available"||n.state==="approval-requested")?"requires_action":"completed":"failed"}const Ie={decopilot:{harness:"decopilot",sandbox:"agent-sandbox"},"decopilot-desktop":{harness:"decopilot",sandbox:"user-desktop"},"claude-code-desktop":{harness:"claude-code",sandbox:"user-desktop"},"codex-desktop":{harness:"codex",sandbox:"user-desktop"}};function yt(t,e){if(!t)return null;const a=e?qe(e):null;if(t==="decopilot"&&a===null)return"decopilot";for(const[n,s]of Object.entries(Ie))if(s.harness===t&&s.sandbox===a)return n;return null}function It(t){return t.thread?.harness_id!=null?{}:{harnessId:t.globals.harnessId,sandboxProviderKind:t.globals.sandboxProviderKind,branch:t.globals.branch??null}}function St(t){const e=pe.c(10);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},e[0]=a):a=e[0];const n=Me(a);let s;if(e[1]!==n?.params.appSlug||e[2]!==n?.params.collectionName||e[3]!==n?.params.itemId||e[4]!==t){s=[],t&&s.push(`### Selected Agent
|
|
3
|
-
- ID: ${t}`);let o;e[6]!==n?.params.appSlug||e[7]!==n?.params.collectionName||e[8]!==n?.params.itemId?(o=[],n?.params.appSlug&&o.push(`- Connection ID: ${n?.params.appSlug}`),n?.params.collectionName&&o.push(`- Collection: ${n?.params.collectionName}`),n?.params.itemId&&o.push(`- Item ID: ${n?.params.itemId}`),e[6]=n?.params.appSlug,e[7]=n?.params.collectionName,e[8]=n?.params.itemId,e[9]=o):o=e[9],o.length>0&&s.push(`### Current Resource
|
|
4
|
-
The user is viewing the following resource:
|
|
5
|
-
${o.join(`
|
|
6
|
-
`)}
|
|
7
|
-
|
|
8
|
-
Help the user understand and work with this resource.`),e[1]=n?.params.appSlug,e[2]=n?.params.collectionName,e[3]=n?.params.itemId,e[4]=t,e[5]=s}else s=e[5];return s.join(`
|
|
9
|
-
|
|
10
|
-
`)}function Ct(){const t=pe.c(5),e=Ee(),{org:a}=re();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},t[0]=n):n=t[0];const s=Me(n);let o;return t[1]!==s?.params||t[2]!==a||t[3]!==e?(o=r=>{const f=r.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!f||!f[1])return;const g=f[1],y=s?.params.appSlug;if(!y)return;e.invalidateQueries({queryKey:ue.collection(a.slug,y,g)});const b=g.toLowerCase().replace(/_/g," ");_e.success(`${b} updated`)},t[1]=s?.params,t[2]=a,t[3]=e,t[4]=o):o=t[4],o}function vt(){const t=pe.c(4),{org:e,project:a}=re(),n=`${e.id}/${a.id}`;let s;t[0]!==n?(s=oe.taskLastViewed(n),t[0]=n,t[1]=s):s=t[1];const[,o]=ae(s,bt);let r;return t[2]!==o?(r={markTaskRead:f=>{o(g=>({...g,[f]:new Date().toISOString()}))}},t[2]=o,t[3]=r):r=t[3],r}function bt(t){return t??{}}function Ne(){const t=Ae(),{org:e}=re(),a=we({strict:!1}),n=Ke({strict:!1}),s=a.virtualmcpid??Je(e.id).id,o=(f,g)=>{t({to:"/$org/$taskId",params:{org:e.slug,taskId:f},search:y=>{const b={},D=g?.virtualMcpId??y.virtualmcpid;D&&(b.virtualmcpid=D);const d=y.main;return d&&typeof d=="string"&&!at(d)&&(b.main=d),y.chat&&(b.chat=y.chat),g?.autosend&&(b.autosend=Re),b}})},r=h.useRef(crypto.randomUUID()),i=n.taskId??r.current;return{virtualMcpId:s,taskId:i,navigateToTask:o}}function kt(t,e){const{mimeType:a,data:n}=t;if(a.startsWith("text/"))try{const s=new TextDecoder().decode(Uint8Array.from(atob(n),o=>o.charCodeAt(0)));return[{type:"text",text:`${e}
|
|
11
|
-
${s}`}]}catch(s){console.error("Failed to decode text file:",s)}return[{type:"file",url:`data:${a};base64,${n}`,filename:e,mediaType:a}]}function ke(t,e){const a=[];for(const n of t)"text"in n&&n.text?a.push({type:"text",text:`[${e}]
|
|
12
|
-
${n.text}`}):"blob"in n&&n.blob&&n.mimeType&&a.push({type:"file",url:`data:${n.mimeType};base64,${n.blob}`,filename:String(n.uri),mediaType:String(n.mimeType)});return a}function Tt(t,e){const a=[];for(const n of t){if(n.role!=="user"||!n.content)continue;const s=Array.isArray(n.content)?n.content:[n.content];for(const o of s)switch(o.type){case"text":{const r=o.text?.trim();if(!r)continue;a.push({type:"text",text:`[${e}]
|
|
13
|
-
${r}`});break}case"image":case"audio":{if(!o.data||!o.mimeType)continue;a.push({type:"file",url:`data:${o.mimeType};base64,${o.data}`,mediaType:o.mimeType});break}case"resource":{const r=o.resource;if(!r||!r.mimeType)continue;r&&("text"in r&&r.text?a.push({type:"text",text:`[${e}]
|
|
14
|
-
${r.text}`}):"blob"in r&&r.blob&&r.mimeType&&a.push({type:"file",url:`data:${r.mimeType};base64,${r.blob}`,filename:String(r.uri),mediaType:String(r.mimeType)}));break}}}return a}function Le(t){if(!t)return[];const e=[];let a="";const n=s=>{if(s){if(s.type==="text"&&"text"in s&&typeof s.text=="string")a+=s.text;else if(s.type==="mention"&&s.attrs){const o=s.attrs.char??"/",r=`${o}${s.attrs.name}`;if(a+=r,o==="@"){const i=s.attrs.metadata;i&&!Array.isArray(i)&&"agentId"in i?e.push({type:"text",text:`[DELEGATE TO AGENT: ${i.title??s.attrs.name} (agent_id: ${i.agentId})]
|
|
15
|
-
Use the subtask tool to delegate this task to the agent above. Include the full relevant context from this conversation in the prompt field — the subagent has no conversation history.`}):Array.isArray(i)&&e.push(...ke(i,r))}else{const i=s.attrs.metadata||s.attrs.prompts||[];Array.isArray(i)&&i.length>0&&"role"in i[0]?e.push(...Tt(i,r)):Array.isArray(i)&&e.push(...ke(i,r))}}else if(s.type==="file"&&s.attrs){const o=s.attrs,r=`[file:://${encodeURIComponent(o.name)}]`;a+=r,e.push(...kt(o,r))}if("content"in s&&Array.isArray(s.content))for(const o of s.content)n(o)}};return n(t),a.trim()&&e.unshift({type:"text",text:a.trim()}),e}function Vt(t){const e=Le(t);return e.length===0?[]:[{id:crypto.randomUUID(),role:"user",parts:e,metadata:{tiptapDoc:t}}]}const Te=new Set;function se(t){return h.useSyncExternalStore(t.subscribe,t.get,t.get)}function Mt(t){return t.kind==="loading"?"ready":t.kind}function Y(t,e,a,n){if(!t)return null;const s=e.find(r=>r.id===t.keyId);if(!s)return null;const o=a.find(r=>r.modelId===t.modelId);return o?{...o,keyId:t.keyId}:{modelId:t.modelId,title:n??t.modelId,keyId:t.keyId,providerId:s.providerId,description:null,logo:null,capabilities:[],limits:null,costs:null}}function Et(t){return t==="fast"||t==="smart"||t==="thinking"?t:"smart"}function _t(t,e,a,n){if(!a||n.length===0)return null;const s=e.find(f=>f.id===a);if(!s)return null;const o=mt([s],{[a]:n}),r=t==="fast"?o.chat.fast:t==="thinking"?o.chat.thinking:o.chat.smart;if(!r)return null;const i=n.find(f=>f.modelId===r.modelId);return i?{...i,keyId:a}:null}const At=1e4,wt=10,Se=h.createContext(null),Ce=h.createContext(null),ve=h.createContext(null),je=h.createContext(null);function Rt({children:t}){const{locator:e}=re(),{virtualMcpId:a}=Ne(),[n,s]=ae(oe.chatSelectedImageModel(e),null),[o,r]=ae(oe.chatSelectedWebSearchModel(e),null),[i,f]=ae(oe.chatSelectedDeepResearchModel(e),null),[g,y]=h.useState(null),[b,D]=h.useState("default"),d=rt(),[T,j]=ae(oe.chatSimpleModeTier(e),null),$=Et(T),I=st(),S=d.tiers[$],M=g&&I.some(c=>c.id===g)?g:S?.keyId??I[0]?.id??null,{models:C,isLoading:F}=de(M??void 0),{models:V}=de(S?.keyId),{models:U}=de(d.tiers.image?.keyId),{models:k}=de(d.tiers.web_search?.keyId),{models:q}=de(d.tiers.deep_research?.keyId),W=Y(S,I,V,S?.title)??_t($,I,M,C),K=F,H=C.filter(c=>c.capabilities?.includes("image")),u=Y(n,I,H),E=Y(d.tiers.image,I,U,d.tiers.image?.title)??u??H[0]??null,_=C.filter($e),Q=Y(o,I,_),X=_.find(c=>c.modelId==="perplexity/sonar")??_[0]??null,O=Y(d.tiers.web_search,I,k,d.tiers.web_search?.title)??Q??X,R=C.filter(Oe),m=Y(i,I,R),A=R.find(c=>c.modelId==="perplexity/deep-research")??R.find(c=>c.asyncResearch===!0)??R[0]??null,J=Y(d.tiers.deep_research,I,q,d.tiers.deep_research?.title)??m??A,ge=nt(a)??{id:a,title:"",description:null,icon:null},[he,fe]=h.useState({}),te=(c,ie)=>{const ce=[];for(const G of ie.content??[])G.type==="text"&&G.text?.trim()&&ce.push(G.text.trim());const le=ce.join(`
|
|
16
|
-
`);if(!le){me(c);return}new TextEncoder().encode(le).length>At||fe(G=>Object.keys(G).length>=wt&&!(c in G)?G:{...G,[c]:le})},me=c=>{fe(ie=>{const{[c]:ce,...le}=ie;return le})},[xe,be]=ae(oe.chatLastAgentOption(e),c=>c&&c in Ie?c:null),B=$t(),ye=B?.isThreadLocked&&B.lockedHarness!=null?yt(B.lockedHarness,B.lockedSandbox):null,l=xe,p=B?.isThreadLocked?ye:l,P=p?Ie[p]:null,w=P?.harness??null,x=P?.sandbox??null,[N,Z]=h.useState(void 0),z=h.useRef(N);z.current=N;const v={selectedModel:W,setModel:()=>{},credentialId:M,setCredentialId:y,allModelsConnections:I,isModelsLoading:K,selectedVirtualMcp:ge,imageModel:E,setImageModel:c=>{s(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},webSearchModel:O,setWebSearchModel:c=>{r(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},deepResearchModel:J,setDeepResearchModel:c=>{f(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},chatMode:b,setChatMode:D,appContexts:he,setAppContext:te,clearAppContext:me,tiptapDoc:N,setTiptapDoc:Z,tiptapDocRef:z,resetInteraction:()=>{},simpleModeTier:$,setSimpleModeTier:c=>j(c),pendingAgentOption:p,setPendingAgentOption:be,pendingHarnessId:w,pendingSandboxProviderKind:x};return L.jsx(ve.Provider,{value:v,children:t})}function Wt(t){const e=pe.c(41),{virtualMcpId:a,task:n,children:s}=t,{locator:o}=re(),{data:r}=We.useSession(),i=r?.user??null,{taskId:f,virtualMcpId:g,navigateToTask:y}=Ne(),[b]=He(),{markTaskRead:D}=vt(),d=Ze(),T=f,j=g,$=St(j);let I;e[0]!==D||e[1]!==y?(I=(m,A)=>{D(m),y(m,{virtualMcpId:A?.virtualMcpId,autosend:A?.autosend})},e[0]=D,e[1]=y,e[2]=I):I=e[2];const S=I,M=T&&n?.id===T?n:null,C=M?.harness_id??null,F=M?.sandbox_provider_kind??null,V=M?.branch??null,U=C!=null,k=V;let q;e[3]!==k||e[4]!==S||e[5]!==d||e[6]!==a?(q=()=>{const m=crypto.randomUUID();return d.create({id:m,virtual_mcp_id:a,...k?{branch:k}:{}}).then(()=>S(m)).catch(()=>{S(m)}),m},e[3]=k,e[4]=S,e[5]=d,e[6]=a,e[7]=q):q=e[7];const W=q;let K;e[8]!==k||e[9]!==o||e[10]!==S||e[11]!==d||e[12]!==a?(K=m=>{const A=crypto.randomUUID(),J=m.virtualMcpId??a,ee=J===a?k:null;Ye(sessionStorage,o,A,m.message),d.create({id:A,virtual_mcp_id:J,...ee?{branch:ee}:{}}).then(()=>S(A,{virtualMcpId:m.virtualMcpId,autosend:!0})).catch(()=>{S(A,{virtualMcpId:m.virtualMcpId,autosend:!0})})},e[8]=k,e[9]=o,e[10]=S,e[11]=d,e[12]=a,e[13]=K):K=e[13];const H=K;let u;e[14]!==T||e[15]!==d?(u=m=>{T&&d.setBranch(T,m)},e[14]=T,e[15]=d,e[16]=u):u=e[16];let E;e[17]!==M||e[18]!==W||e[19]!==H||e[20]!==k||e[21]!==T||e[22]!==j||e[23]!==U||e[24]!==V||e[25]!==C||e[26]!==F||e[27]!==S||e[28]!==u?(E={virtualMcpId:j,taskId:T,openTask:S,createTask:W,createTaskWithMessage:H,activeTask:M,isThreadLocked:U,lockedHarness:C,lockedSandbox:F,lockedBranch:V,currentBranch:k,setCurrentTaskBranch:u},e[17]=M,e[18]=W,e[19]=H,e[20]=k,e[21]=T,e[22]=j,e[23]=U,e[24]=V,e[25]=C,e[26]=F,e[27]=S,e[28]=u,e[29]=E):E=e[29];const _=E;let Q;e[30]!==$||e[31]!==b||e[32]!==y||e[33]!==i?(Q={user:i,contextPrompt:$,preferences:b,rawNavigateToTask:y},e[30]=$,e[31]=b,e[32]=y,e[33]=i,e[34]=Q):Q=e[34];const X=Q;let O;e[35]!==s||e[36]!==X?(O=L.jsx(Rt,{children:L.jsx(je.Provider,{value:X,children:s})}),e[35]=s,e[36]=X,e[37]=O):O=e[37];let R;return e[38]!==O||e[39]!==_?(R=L.jsx(Ce.Provider,{value:_,children:O}),e[38]=O,e[39]=_,e[40]=R):R=e[40],R}function Ht({taskId:t,children:e}){const{virtualMcpId:a,activeTask:n,currentBranch:s}=Pt();t&&!Te.has(t)&&(Te.add(t),Ve("chat_opened",{thread_id:t}));const{imageModel:o,webSearchModel:r,deepResearchModel:i,chatMode:f,setChatMode:g,appContexts:y,setTiptapDoc:b,simpleModeTier:D,pendingSandboxProviderKind:d,pendingHarnessId:T}=Dt(),j=h.useContext(je);if(!j)throw new Error("ActiveTaskProvider must be used within ChatContextProvider");const{user:$,contextPrompt:I,preferences:S,rawNavigateToTask:M}=j,{org:C,locator:F}=re(),[V,U]=h.useState(null),k=Ct(),q=Ee(),W=Be(),K=Ae(),H=et({connectionId:tt,orgId:C.id,orgSlug:C.slug}),u=ze(C.slug,t,{client:H});h.use(u.ready);const E=se(u.messages),_=se(u.status),Q=se(u.finishReason),X=se(u.runStatusStage),O=se(u.hasMoreOlder),R=se(u.isFetchingOlder),m=h.useRef({onToolCall:k,queryClient:q,rawNavigateToTask:M,taskId:t,manager:W,navigate:K,orgId:C.id,orgSlug:C.slug});m.current={onToolCall:k,queryClient:q,rawNavigateToTask:M,taskId:t,manager:W,navigate:K,orgId:C.id,orgSlug:C.slug},h.useEffect(()=>{const l={onData:p=>{if(p.type==="data-thread-title"){const P=p.data;if(!P?.title)return;const w=m.current;if(!w.taskId)return;w.manager.patchThread({id:w.taskId,title:P.title,updated_at:new Date().toISOString()});return}if(p.type==="data-deck-updated"){const P=p.data;if(!P?.path)return;const w=P.path,x=m.current;x.queryClient.invalidateQueries({queryKey:ue.orgFsStat(x.orgId,"home",w)}),x.queryClient.invalidateQueries({queryKey:ue.orgFsRecent(x.orgId)}),x.navigate({to:".",search:N=>({...N,main:ot(w)}),replace:!0});return}},onFinish:(p,P,w)=>{const x=m.current;x.taskId&&x.manager.patchThread({id:x.taskId,status:xt(w,p.parts),updated_at:new Date().toISOString()});const N=p.parts?.some(z=>{const v=z;return(v.type==="tool-share_with_user"||v.type==="tool-bash"||v.type==="tool-write")&&v.state==="output-available"});if(x.taskId&&N){const z=ue.threadOutputs(x.taskId);for(const v of[0,1500,3e3,6e3,12e3,25e3])setTimeout(()=>{x.queryClient.invalidateQueries({queryKey:z})},v)}x.queryClient.invalidateQueries({queryKey:ue.homeNextActions(x.orgSlug)});const Z=p.metadata?.thread_id;Z&&Z!==x.taskId&&x.rawNavigateToTask(Z)},onError:p=>{U(p),console.error("[chat] Error",p)},onToolCall:p=>m.current.onToolCall(p)};return u.observer=l,()=>{u.observer===l&&(u.observer=null)}},[u]);const A=_.kind==="submitted"||_.kind==="streaming",J=E.length===0,ee=E.at(-1),ge=!A&&ee?.role==="assistant"&&ee.parts.some(l=>"state"in l&&l.state==="approval-requested"),he=n,fe=(he?.status==="in_progress"||he?.status==="expired")&&_.kind==="ready"&&E.length>0;async function te(l){const p=l.parts??Le(l.tiptapDoc);if(p.length===0)return;const P=t,w=a;U(null),b(void 0);const x={tiptapDoc:l.tiptapDoc,created_at:new Date().toISOString(),user:{avatar:$?.image??void 0,name:$?.name??"you"}},N=Object.entries(y),Z=N.length>0?N.map(([ie,ce])=>`### App Context: ${ie}
|
|
17
|
-
${ce}`).join(`
|
|
18
|
-
|
|
19
|
-
`):"",z=[I,Z].filter(Boolean).join(`
|
|
20
|
-
|
|
21
|
-
`);let v=f;v==="gen-image"&&!o&&(v="default"),v==="web-search"&&!r&&(v="default"),v==="deep-research"&&!i&&(v="default"),(v==="web-search"||v==="deep-research")&&g("default");const c={id:crypto.randomUUID(),role:"user",parts:p,metadata:x};await u.submit({kind:"message",message:c},{tier:D,mode:v,toolApprovalLevel:S.toolApprovalLevel??Qe(),system:z||void 0,agent:{id:w},thread_id:P,...It({thread:n?{harness_id:n.harness_id??null,sandbox_provider_kind:n.sandbox_provider_kind??null,branch:n.branch??null}:null,globals:{harnessId:T??void 0,sandboxProviderKind:d??void 0,branch:s}})})}const me=async()=>{u.stop();try{const l=await fetch(`/api/${C.slug}/decopilot/cancel/${t}`,{method:"POST",credentials:"include"});if(l.status===404)return;if(!l.ok){const p=await l.json().catch(()=>({}));throw new Error(p.message??`Cancel failed: ${l.status}`)}}catch(l){const p=l instanceof Error?l.message:"Failed to cancel";_e.error(p),console.error("[chat] cancelRun",l)}},xe=l=>l&&typeof l=="object"&&"type"in l?te({tiptapDoc:l}):te(l),B=we({strict:!1}).autosend===Re;h.useEffect(()=>{if(!B||E.length>0)return;const l=Ge(sessionStorage,F,t);l&&te(l.message).then(()=>{Xe(sessionStorage,F,t)})},[B,E.length,F,t,te]);const ye={messages:E,status:Mt(_),sendMessage:xe,stop:()=>{me()},submit:(l,p)=>u.submit(l,p),error:V,clearError:()=>U(null),finishReason:Q,runStatusStage:X,clearFinishReason:()=>u.finishReason.set(null),isStreaming:A,isChatEmpty:J,isWaitingForApprovals:ge??!1,isRunInProgress:fe,hasMoreOlder:O,isFetchingOlder:R,fetchOlderMessages:u.fetchOlderMessages.bind(u)};return L.jsx(Se.Provider,{value:ye,children:e})}function Qt(){const t=h.useContext(Se);if(!t)throw new Error("useChatStream must be used within ActiveTaskProvider");return t}function Bt(){return h.useContext(Se)}function Pt(){const t=h.useContext(Ce);if(!t)throw new Error("useChatTask must be used within ChatContextProvider");return t}function Dt(){const t=h.useContext(ve);if(!t)throw new Error("useChatPrefs must be used within ChatContextProvider");return t}function zt(){return h.useContext(ve)}function $t(){return h.useContext(Ce)}export{Ht as A,Rt as C,Kt as S,Pt as a,Dt as b,$t as c,Le as d,yt as e,Bt as f,Wt as g,zt as h,$e as i,Oe as j,mt as p,Vt as t,Qt as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as y,j as t,B as F,i as Z,o as Ge,s as se,E as Pe,r as T,D as ie,p as Qe,l as V,bg as Ye,u as Ze,G,t as Xe,e as ae,b2 as ke}from"./index-CN4fylaJ.js";import{E as Ee}from"./empty-state-D_f-_l9W.js";import{u as et,a as Ae}from"./use-collections-B6zlDXKN.js";import{u as ce}from"./use-mcp-client-CIYxX4P5.js";import{F as ne,a as tt,b as de,d as me}from"./form-zKde5vNL.js";import{I as ue}from"./input-Cs0DBSJe.js";import{T as re}from"./textarea-BSHQNfh6.js";import{a as st,b as nt,V as xe,O as ot,M as lt}from"./index-DezmxNOz.js";import{ak as rt,y as it,a9 as at,al as ct,Z as dt,am as mt,N as be}from"./agent-icon-B97sy6nN.js";import{g as ut,M as xt,a as Ne}from"./types-D5SLCq2u.js";import{A as pt,a as ft,b as ht}from"./alert-P80CneWK.js";import{d as ve,b as Se,c as ye,S as we,a as oe}from"./select-DqJQ5lRE.js";import{c as gt,T as Ce,a as Ie,b as $e}from"./tooltip-DPkvAJEu.js";import{i as jt}from"./AlertCircle-DRN6XAl_.js";import{s as bt}from"./Stars02-CTQVeFIY.js";import{a as Nt}from"./Eye-D3ZcE9lW.js";import{i as vt}from"./Play-BRcSzafX.js";import{i as St}from"./ChevronRight-BRlgGlqj.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./index-CXoUE4MX.js";import{a as Oe,u as Re}from"./use-connection-8FX2zzcI.js";import{a as It}from"./use-mcp-tools-C_waYweR.js";import{c as $t}from"./content-blocks-o63cs2vh.js";import{I as Te}from"./integration-icon-DO0aMlRM.js";import{f as Tt,h as Pt}from"./chat-context-CXJPuJv7.js";import{b as kt}from"./shell-layout-B87-IiK6.js";import{M as Et}from"./monaco-editor-BvqPmzKC.js";import{n as At}from"./XCircle-DS2uELKv.js";import"./auth-CZ0pDy2E.js";import"./label-BrslM_UB.js";import"./index-Dso3mm7m.js";import"./sidebar-DwyKpA9b.js";import"./LayoutLeft-CpEUT3tP.js";import"./use-mobile-d3rX0VX2.js";import"./sheet-DCM0ToXL.js";import"./X-DtGx_Eqi.js";import"./ZoomOut-AiYlkF58.js";import"./Key01-CzkLmrt_.js";import"./extract-connection-data-0didS_pX.js";import"./use-registry-connections-Dg8ovbRG.js";import"./use-organization-settings-DQjKRGQP.js";import"./studio-tools-BXeKF31x.js";import"./Plus-BS57SLmT.js";import"./index-vshYv_PV.js";import"./index-C_7VA7XD.js";import"./popover-BWjew7H2.js";import"./use-virtual-mcp-CbdTA-7x.js";import"./ChevronUp-CZ6Mxabg.js";import"./SearchMd-BOQbygpw.js";import"./Users03-CcZFUmPD.js";import"./use-create-virtual-mcp-D2BkJoeH.js";import"./use-navigate-to-agent-X5p7bWf4.js";import"./Tool01-CMzj8Zow.js";import"./SwitchHorizontal01-Bpd1Utek.js";import"./Settings02-Du9J1LY1.js";import"./ArrowUpRight-CS4sxU2z.js";import"./ZapSquare-WzwrglCu.js";import"./CheckCircle-Dof-gkrW.js";import"./ChevronDown-CiTptxE7.js";import"./ChevronLeft-LnaPgJ0y.js";import"./DotsVertical-BSRrIcA1.js";import"./Globe01-6U0-ZV4l.js";import"./FilterLines-nV95nFgf.js";import"./Star01-gn_l3mpc.js";import"./Globe04-10fsKNwF.js";import"./HardDrive-CcAdoaFI.js";import"./LinkExternal01-TXfR4Hhy.js";import"./Monitor01-CcWvKUoP.js";import"./Sun-CXETDRVX.js";import"./Palette-BmXhqV8p.js";import"./SearchLg-CIaBccbb.js";import"./Shield01-Dq_-3VLc.js";import"./Stars01-D0EbchXz.js";import"./Trash01-pbf89pjs.js";import"./Upload01-DvmBqoDO.js";import"./User01-C5OEqKDJ.js";import"./Users01-B7An2LNd.js";import"./XClose-vcxupN64.js";import"./Zap-BcCmjpc0.js";import"./mcp-oauth-CXbxPU1K.js";import"./badge-BTVwpu14.js";import"./hooks-BE7YwHtm.js";import"./decopilot-sse-pool-C_k3BuPx.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-3vPjPOz2.js";import"./tab-id-BptcWVWa.js";import"./avatar-CM9_qKlB.js";import"./dialog-CUMtGMOn.js";import"./required-auth-layout-D985wSIU.js";import"./use-org-sso-CGtfMwKv.js";import"./index-D87D-9z8.js";function Ot(s){const e=y.c(15),{onSave:o,onUndo:n,isDirty:l,isSaving:r,saveLabel:a,undoLabel:c}=s,i=a===void 0?"Save":a,u=c===void 0?"Undo":c;if(!l)return null;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(rt,{size:14}),e[0]=x):x=e[0];let m;e[1]!==r||e[2]!==n||e[3]!==u?(m=t.jsxs(F,{variant:"outline",size:"sm",onClick:n,disabled:r,"aria-label":u,children:[x,u]}),e[1]=r,e[2]=n,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==r?(p=r?t.jsx(Z,{size:14,className:"animate-spin"}):t.jsx(it,{size:14}),e[5]=r,e[6]=p):p=e[6];let f;e[7]!==r||e[8]!==o||e[9]!==i||e[10]!==p?(f=t.jsxs(F,{variant:"default",size:"sm",onClick:o,disabled:r,"aria-label":i,children:[p,i]}),e[7]=r,e[8]=o,e[9]=i,e[10]=p,e[11]=f):f=e[11];let g;return e[12]!==m||e[13]!==f?(g=t.jsxs(t.Fragment,{children:[m,f]}),e[12]=m,e[13]=f,e[14]=g):g=e[14],g}Ge({title:se().min(1),description:se().nullable(),body:se()});function le(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Rt(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(n=>n==="mcps"),o=e>=0?s[e+1]:void 0;return o?decodeURIComponent(o):void 0}function _t(s){const e=y.c(13),{form:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=n):n=e[0];let l;e[1]!==o.control?(l=t.jsxs("div",{className:"flex flex-col gap-4",children:[n,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(ne,{control:o.control,name:"title",render:zt}),t.jsx(ne,{control:o.control,name:"description",render:Mt})]})]}),e[1]=o.control,e[2]=l):l=e[2];let r,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),a=t.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=a):(r=e[3],a=e[4]);let c;e[5]!==o.control?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[r,a,t.jsx(ne,{control:o.control,name:"body",render:Dt})]}),e[5]=o.control,e[6]=c):c=e[6];let i;e[7]!==l||e[8]!==c?(i=t.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[l,c]}),e[7]=l,e[8]=c,e[9]=i):i=e[9];let u;return e[10]!==o||e[11]!==i?(u=t.jsx(tt,{...o,children:i}),e[10]=o,e[11]=i,e[12]=u):u=e[12],u}function Dt(s){const{field:e}=s;return t.jsx(de,{children:t.jsx(me,{children:t.jsx(re,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Mt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),t.jsx(me,{children:t.jsx(ue,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function zt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),t.jsx(me,{children:t.jsx(ue,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Lt(s){const e=y.c(36),{providerId:o,promptId:n}=s,{org:l}=ie(),r=o||null;let a;e[0]!==l.id||e[1]!==l.slug||e[2]!==r?(a={connectionId:r,orgId:l.id,orgSlug:l.slug},e[0]=l.id,e[1]=l.slug,e[2]=r,e[3]=a):a=e[3];const c=ce(a),i=et(o,"PROMPT",n,c),u=Ae(o,"PROMPT",c),x=u.update.isPending;let m;e[4]!==i?(m=i?{title:i.title,description:i.description??null,body:le(i)}:void 0,e[4]=i,e[5]=m):m=e[5];let p;e[6]!==m?(p={values:m},e[6]=m,e[7]=p):p=e[7];const f=Qe(p);let g;e[8]!==f||e[9]!==i?(g=()=>{i&&f.reset({title:i.title,description:i.description??null,body:le(i)})},e[8]=f,e[9]=i,e[10]=g):g=e[10];const S=g;let I;e[11]!==u.update||e[12]!==f||e[13]!==n?(I=f.handleSubmit(async N=>{const A=await u.update.mutateAsync({id:n,data:{title:N.title,description:N.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:N.body}}]}});f.reset({title:A.title,description:A.description??null,body:le(A)})}),e[11]=u.update,e[12]=f,e[13]=n,e[14]=I):I=e[14];const R=I;if(!i){let N;return e[15]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[15]=N):N=e[15],N}let $;e[16]!==i.title?($=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[16]=i.title,e[17]=$):$=e[17];let E;e[18]!==i.description?(E=i.description?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),t.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:i.description})]}):null,e[18]=i.description,e[19]=E):E=e[19];let P;e[20]!==$||e[21]!==E?(P=t.jsx(nt,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[$,E]})}),e[20]=$,e[21]=E,e[22]=P):P=e[22];let b;e[23]!==R?(b=()=>{R()},e[23]=R,e[24]=b):b=e[24];let w;e[25]!==f.formState.isDirty||e[26]!==x||e[27]!==S||e[28]!==b?(w=t.jsx(st,{children:t.jsx(Ot,{onSave:b,onUndo:S,isDirty:f.formState.isDirty,isSaving:x})}),e[25]=f.formState.isDirty,e[26]=x,e[27]=S,e[28]=b,e[29]=w):w=e[29];let C;e[30]!==f?(C=t.jsx("div",{className:"h-full",children:t.jsx(_t,{form:f})}),e[30]=f,e[31]=C):C=e[31];let k;return e[32]!==w||e[33]!==C||e[34]!==P?(k=t.jsxs(xe,{children:[P,w,C]}),e[32]=w,e[33]=C,e[34]=P,e[35]=k):k=e[35],k}function Ut(s){const e=y.c(4),{itemId:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Rt(),e[0]=n):n=e[0];const l=n;if(!l){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=a):a=e[1],a}let r;return e[2]!==o?(r=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:null,children:t.jsx(Lt,{providerId:l,promptId:o})})}),e[2]=o,e[3]=r):r=e[3],r}function _e(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("min-w-0 overflow-hidden",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function De(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("flex items-center gap-1.5 text-sm sm:gap-2 overflow-hidden",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("ol",{"data-slot":"breadcrumb-list",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function q(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("inline-flex items-center gap-1.5 min-w-0",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("li",{"data-slot":"breadcrumb-item",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Q(s){const e=y.c(10);let o,n,l;e[0]!==s?({asChild:o,className:n,...l}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=l):(o=e[1],n=e[2],l=e[3]);const r=o?Ye:"a";let a;e[4]!==n?(a=V("hover:text-foreground transition-colors truncate",n),e[4]=n,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==a?(c=t.jsx(r,{"data-slot":"breadcrumb-link",className:a,...l}),e[6]=r,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}function Me(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("text-foreground font-medium truncate",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Y(s){const e=y.c(12);let o,n,l;e[0]!==s?({children:o,className:n,...l}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=l):(o=e[1],n=e[2],l=e[3]);let r;e[4]!==n?(r=V("[&>svg]:size-3.5 text-muted-foreground opacity-50 list-none shrink-0",n),e[4]=n,e[5]=r):r=e[5];let a;e[6]!==o?(a=o??t.jsx(St,{}),e[6]=o,e[7]=a):a=e[7];let c;return e[8]!==l||e[9]!==r||e[10]!==a?(c=t.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:r,...l,children:a}),e[8]=l,e[9]=r,e[10]=a,e[11]=c):c=e[11],c}const Bt=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Ft(s){const e=y.c(11),{toolName:o,connectionId:n,siblings:l,onSelectInstance:r,onBack:a}=s;let c;e[0]!==n?(c={connectionId:n},e[0]=n,e[1]=c):c=e[1];const i=wt(c);if(!i.isAuthenticated){let m;return e[2]!==i.supportsOAuth||e[3]!==a?(m=t.jsx("div",{className:"flex h-full items-center justify-center",children:i.supportsOAuth?t.jsx(ot,{onAuthenticate:()=>a(),buttonText:"Go back to authenticate"}):t.jsx(lt,{hasReadme:!1})}),e[2]=i.supportsOAuth,e[3]=a,e[4]=m):m=e[4],m}const u=`${n}:${o}`;let x;return e[5]!==n||e[6]!==r||e[7]!==l||e[8]!==u||e[9]!==o?(x=t.jsx(Vt,{toolName:o,connectionId:n,siblings:l,onSelectInstance:r},u),e[5]=n,e[6]=r,e[7]=l,e[8]=u,e[9]=o,e[10]=x):x=e[10],x}function Vt({toolName:s,connectionId:e,siblings:o,onSelectInstance:n}){const{replayId:l}=Ze({strict:!1}),r=(()=>{if(!l)return null;const d=`replay-${l}`,h=sessionStorage.getItem(d);if(!h)return null;sessionStorage.removeItem(d);try{return JSON.parse(h)}catch{return null}})(),a=(()=>{if(!r)return null;const d={};for(const[h,v]of Object.entries(r))v!==null&&typeof v=="object"?d[h]=JSON.stringify(v,null,2):d[h]=v;return d})(),[c,i]=T.useState(a??{}),[u,x]=T.useState(r?JSON.stringify(r,null,2):"{}"),[m,p]=T.useState(null),[f,g]=T.useState(null),[S,I]=T.useState(null),[R,$]=T.useState(null),[E,P]=T.useState(!1),[b,w]=T.useState(null),{org:C}=ie(),k=Oe(e),N=Tt(),A=Pt(),{setChatOpen:U}=kt(),z=`${e}:${s}`,_=ce({connectionId:e,orgId:C.id,orgSlug:C.slug}),L=It({client:_}),j=L.data?.tools?.find(d=>d.name===s),O=ut(j?._meta),J=d=>{if(!N)return;const h=$t(d.content);h.content.length>0&&(U(!0),N.sendMessage({tiptapDoc:h}))},[D,X]=T.useState("json"),[ze,Le]=T.useState(!1);O&&!ze&&(X("ui"),Le(!0));const pe=j?.inputSchema?.properties,fe=pe?Object.keys(pe):[],H=fe.length>0,K={};if(H&&j?.inputSchema?.properties)for(const d of fe)K[d]=j.inputSchema.required?.includes(d)?"":void 0;const ee=d=>Object.prototype.hasOwnProperty.call(c,d),Ue=async()=>{P(!0),$(null),p(null),g(null),I(null),w(null);const d=performance.now();try{if(!_)throw new Error("MCP client is not available");const h=H?{...K,...c}:(()=>{const M=u.trim();if(!M)return{};const B=JSON.parse(M);if(B&&typeof B=="object")return B;throw new Error("Raw JSON input must be an object.")})();H&&j?.inputSchema?.properties&&Object.entries(j.inputSchema.properties).forEach(([M,B])=>{if((B.type==="object"||B.type==="array")&&typeof h[M]=="string")try{h[M]=JSON.parse(h[M])}catch{}else if((B.type==="number"||B.type==="integer")&&typeof h[M]=="string"&&h[M]!==""){const je=Number(h[M]);Number.isNaN(je)||(h[M]=je)}});const v=await _.callTool({name:s,arguments:h}),W=v.structuredContent??v,He=performance.now(),Ke=Math.round(He-d);p(W),g(v),I(h);const We=JSON.stringify(W),ge=new TextEncoder().encode(We).length;w({duration:`${Ke}ms`,bytes:`${ge} bytes`,tokens:`~${Math.ceil(ge/4)} tokens`,cost:"$0.0000"})}catch(h){const v=h instanceof Error?h.message:String(h);$(v||"Unknown error occurred");const W=performance.now();w({duration:`${Math.round(W-d)}ms`})}finally{P(!1)}},te=(d,h)=>{i(v=>({...v,[d]:h}))},Be=()=>{p(null),g(null),I(null),$(null),w(null)},Fe=j?.name??Bt(s),Ve=t.jsx(_e,{children:t.jsxs(De,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:C.slug},children:"Connections"})})}),t.jsx(Y,{}),k&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:C.slug,appSlug:yt(k)},search:{tab:"tools"},children:k.title})})}),t.jsx(Y,{})]}),t.jsx(q,{children:t.jsx(Me,{children:Fe})})]})}),he=o.length>1&&t.jsxs(ve,{value:e,onValueChange:n,children:[t.jsx(Se,{className:"h-8 w-auto min-w-[200px]",children:t.jsx(ye,{})}),t.jsx(we,{children:o.map(d=>t.jsx(oe,{value:d.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Te,{icon:d.icon,name:d.title,size:"xs",className:"shrink-0"}),d.title]})},d.id))})]}),Je=t.jsxs("div",{className:"flex flex-col p-6 gap-4 overflow-auto",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),j?.inputSchema?.required&&j.inputSchema.required.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),t.jsx("div",{className:"space-y-4",children:H&&j?.inputSchema?.properties?Object.entries(j.inputSchema.properties).map(([d,h])=>t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[d,j.inputSchema?.required?.includes(d)&&t.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),t.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:h.type})]}),h.description&&t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:h.description}),h.type==="object"||h.type==="array"?t.jsx(re,{className:"font-mono text-xs",value:ee(d)?c[d]??"":K[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d} as JSON...`,rows:3}):h.type==="boolean"?t.jsxs(ve,{value:ee(d)?String(c[d]??""):"",onValueChange:v=>te(d,v==="true"),children:[t.jsx(Se,{children:t.jsx(ye,{placeholder:"Select true or false..."})}),t.jsxs(we,{children:[t.jsx(oe,{value:"true",children:"true"}),t.jsx(oe,{value:"false",children:"false"})]})]}):t.jsx(ue,{value:ee(d)?c[d]??"":K[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d}...`})]},d)):j?.inputSchema&&!H?t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),t.jsx(re,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:d=>x(d.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):t.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})}),t.jsx("div",{className:"flex items-center gap-2 pt-2",children:E?t.jsxs(F,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:Be,children:[t.jsx(at,{className:"h-3.5 w-3.5"}),"Cancel"]}):t.jsxs(F,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:Ue,children:[t.jsx(vt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})})]}),qe=t.jsxs("div",{className:"flex flex-col @3xl:h-full @3xl:overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-border bg-background",children:[t.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),t.jsxs("div",{className:"flex items-center gap-3",children:[b&&t.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(bt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.duration})]}),b.tokens&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ct,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.tokens})]}),b.bytes&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(dt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.bytes})]}),b.cost&&t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx("span",{className:"font-mono text-foreground",children:b.cost})})]}),O&&t.jsx(gt,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:D==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("ui"),children:t.jsx(mt,{size:14})})}),t.jsx($e,{children:"Interactive view"})]}),t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:D==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("json"),children:t.jsx(be,{size:14})})}),t.jsx($e,{children:"JSON view"})]})]})})]})]}),R&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(pt,{variant:"destructive",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(jt,{className:"h-4 w-4"}),t.jsx(ft,{className:"mb-0",children:"Execution Failed"})]}),t.jsx(ht,{className:"text-xs text-destructive",children:R})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:O&&D==="ui"&&_?t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center h-48",children:t.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),t.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:t.jsx(xt,{resourceURI:O,toolInfo:j?{tool:j}:void 0,toolInput:S??void 0,toolResult:f??void 0,displayMode:"fullscreen",minHeight:Ne.view.minHeight,maxHeight:Ne.view.maxHeight,client:_,onMessage:J,onUpdateModelContext:d=>A?.setAppContext(z,d),onTeardown:()=>A?.clearAppContext(z),className:"h-full"})}):m?t.jsxs(t.Fragment,{children:[t.jsx(Et,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(F,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(m,null,2)),Xe.success("Copied to clipboard")},children:t.jsx(Nt,{className:"h-3.5 w-3.5"})})]}):t.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[t.jsx(be,{className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]});return t.jsx(xe,{breadcrumb:Ve,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden @container",children:[t.jsxs("div",{className:"flex flex-col gap-3 py-7 px-8 bg-background border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(Te,{icon:k?.icon||null,name:k?.title||s,size:"xl",className:"shrink-0"}),t.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground leading-none truncate",children:s}),t.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit shrink-0",children:[L.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):L.isLoading?t.jsx(Z,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),t.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:L.isSuccess?"ready":L.isLoading?"connecting":"error"})]}),t.jsx(Ct,{annotations:j?.annotations,_meta:j?._meta}),t.jsx("div",{className:"hidden @3xl:flex items-center ml-auto shrink-0",children:he})]}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:j?.description||"No description available"})]}),o.length>1&&t.jsxs("div",{className:"flex @3xl:hidden items-center gap-3 px-8 py-3 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Instance"}),he]}),t.jsx("div",{className:"flex-1 overflow-auto @3xl:overflow-hidden",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,5fr)] @3xl:h-full @3xl:grid-rows-1",children:[t.jsx("div",{className:"@3xl:border-r border-border @3xl:overflow-auto",children:Je}),qe]})})]})})}function Jt(s){const e=y.c(10),{itemId:o,siblings:n,onBack:l}=s,[r,a]=T.useState(n[0]?.id??"");let c;e[0]!==r||e[1]!==n?(c=n.find(p=>p.id===r)?.id??n[0]?.id??"",e[0]=r,e[1]=n,e[2]=c):c=e[2];const i=c;if(!Oe(i||void 0)||!i){let p;return e[3]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[3]=p):p=e[3],p}let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Z,{size:32,className:"animate-spin text-muted-foreground"})}),e[4]=x):x=e[4];let m;return e[5]!==i||e[6]!==l||e[7]!==n||e[8]!==o?(m=t.jsx(T.Suspense,{fallback:x,children:t.jsx(Ft,{toolName:o,connectionId:i,siblings:n,onSelectInstance:a,onBack:l})}),e[5]=i,e[6]=l,e[7]=n,e[8]=o,e[9]=m):m=e[9],m}function qt(s){const e=y.c(21),{icon:o,illustration:n,title:l,description:r,buttonProps:a,buttonComponent:c,className:i,children:u}=s;let x;e[0]!==i?(x=V("flex flex-col items-center justify-center py-16 text-center",i),e[0]=i,e[1]=x):x=e[1];let m;e[2]!==o||e[3]!==n?(m=n?t.jsx("div",{className:"mb-4 text-muted-foreground/50",children:n}):o?t.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-muted/50 text-muted-foreground",children:o}):null,e[2]=o,e[3]=n,e[4]=m):m=e[4];let p;e[5]!==l?(p=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:l}),e[5]=l,e[6]=p):p=e[6];let f;e[7]!==r?(f=r&&t.jsx("div",{className:"text-sm text-muted-foreground",children:r}),e[7]=r,e[8]=f):f=e[8];let g;e[9]!==p||e[10]!==f?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 max-w-sm",children:[p,f]}),e[9]=p,e[10]=f,e[11]=g):g=e[11];let S;e[12]!==c||e[13]!==a?(S=(c??a)&&t.jsx("div",{className:"mt-4",children:c??(a&&t.jsx(F,{size:"sm",className:V(a?.className),...a}))}),e[12]=c,e[13]=a,e[14]=S):S=e[14];let I;return e[15]!==u||e[16]!==x||e[17]!==m||e[18]!==g||e[19]!==S?(I=t.jsxs("div",{className:x,children:[m,g,S,u]}),e[15]=u,e[16]=x,e[17]=m,e[18]=g,e[19]=S,e[20]=I):I=e[20],I}const Ht={prompt:Ut};function Kt(){const s=y.c(9),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),l=decodeURIComponent(n.itemId);let r;s[1]!==n.appSlug?(r={slug:n.appSlug},s[1]=n.appSlug,s[2]=r):r=s[2];const a=Re(r);let c;s[3]!==e.history?(c=()=>{e.history.back()},s[3]=e.history,s[4]=c):c=s[4];const i=c,u=Wt;let x;return s[5]!==i||s[6]!==l||s[7]!==a?(x=t.jsx(Jt,{itemId:l,siblings:a,onBack:i,onUpdate:u}),s[5]=i,s[6]=l,s[7]=a,s[8]=x):x=s[8],x}async function Wt(s){return Promise.resolve()}function Gt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Qt(){const s=y.c(41),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),l=decodeURIComponent(n.collectionName),r=decodeURIComponent(n.itemId);let a;s[1]!==e.history?(a=()=>{e.history.back()},s[1]=e.history,s[2]=a):a=s[2];const c=a,{org:i}=ie();let u;s[3]!==n.appSlug?(u={slug:n.appSlug},s[3]=n.appSlug,s[4]=u):u=s[4];const m=Re(u)[0]??null,p=m?.id??"",f=p||"no-connection",g=p??null;let S;s[5]!==i.id||s[6]!==i.slug||s[7]!==g?(S={connectionId:g,orgId:i.id,orgSlug:i.slug},s[5]=i.id,s[6]=i.slug,s[7]=g,s[8]=S):S=s[8];const I=ce(S),R=Ae(f,l,I);let $;s[9]!==R||s[10]!==r?($=async D=>{r&&await R.update.mutateAsync({id:r,data:D})},s[9]=R,s[10]=r,s[11]=$):$=s[11];const E=$;let P;s[12]!==l?(P=l?.toLowerCase(),s[12]=l,s[13]=P):P=s[13];const b=P,w=b&&Ht[b];let C;s[14]!==l?(C=Gt(l),s[14]=l,s[15]=C):C=s[15];const k=C;let N;s[16]!==i.slug?(N=t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:i.slug},children:"Connections"})})}),s[16]=i.slug,s[17]=N):N=s[17];let A;s[18]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(Y,{}),s[18]=A):A=s[18];let U;s[19]!==l||s[20]!==m||s[21]!==i.slug||s[22]!==n.appSlug?(U=m&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:n.appSlug},search:{tab:l},children:m.title})})}),t.jsx(Y,{})]}),s[19]=l,s[20]=m,s[21]=i.slug,s[22]=n.appSlug,s[23]=U):U=s[23];let z;s[24]!==k?(z=t.jsx(q,{children:t.jsx(Me,{children:k})}),s[24]=k,s[25]=z):z=s[25];let _;s[26]!==U||s[27]!==z||s[28]!==N?(_=t.jsx(_e,{children:t.jsxs(De,{children:[N,A,U,z]})}),s[26]=U,s[27]=z,s[28]=N,s[29]=_):_=s[29];const L=_;if(w){let D;return s[30]!==w||s[31]!==c||s[32]!==E||s[33]!==r?(D=t.jsx(w,{itemId:r,onBack:c,onUpdate:E}),s[30]=w,s[31]=c,s[32]=E,s[33]=r,s[34]=D):D=s[34],D}let j;s[35]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(At,{size:36,className:"text-muted-foreground"}),s[35]=j):j=s[35];let O;s[36]!==c?(O=t.jsx(qt,{icon:j,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:c,children:"Go back"}}),s[36]=c,s[37]=O):O=s[37];let J;return s[38]!==L||s[39]!==O?(J=t.jsx(xe,{breadcrumb:L,children:O}),s[38]=L,s[39]=O,s[40]=J):J=s[40],J}function Yt(){const s=y.c(3);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=e):e=s[0];const o=ae(e);if(decodeURIComponent(o.collectionName)==="tools"){let a;return s[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Kt,{}),s[1]=a):a=s[1],a}let r;return s[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Qt,{}),s[2]=r):r=s[2],r}function Mn(){const s=y.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Z,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Yt,{})})}),s[0]=e):e=s[0],e}export{Mn as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as Ke,r as l,j as i,i as re,B as fe,l as Ve,m as ut,t as $,K as Te}from"./index-CN4fylaJ.js";import{F as mt,l as pt}from"./index-D87D-9z8.js";import{i as ht,ax as xt,ay as gt,az as ae,aA as yt,V as $e}from"./agent-icon-B97sy6nN.js";import{a as wt}from"./Tool01-CMzj8Zow.js";import{s as jt}from"./XClose-vcxupN64.js";import{S as bt}from"./scroll-area-BUT5ZZ5w.js";import{T as Oe,a as Re,b as ze}from"./tooltip-DPkvAJEu.js";import{f as Ct,a as vt,b as Nt,c as St,d as Dt,e as kt,A as Ft,g as Lt}from"./alert-dialog-BAuzNhCD.js";import{u as Et}from"./chat-context-CXJPuJv7.js";import{b as Pt}from"./shell-layout-B87-IiK6.js";import{am as le,an as Ae,ao as Tt}from"./index-qW-QuY3O.js";import{a as $t,b as Ot,c as Rt,D as zt,d as At,e as Wt}from"./dialog-CUMtGMOn.js";import{I as We}from"./input-Cs0DBSJe.js";import{b as It,C as _,a as Ie,c as Mt,d as Kt}from"./context-menu-Bl3xBEgW.js";import{t as Vt}from"./ChevronDown-CiTptxE7.js";import{i as Bt}from"./ChevronRight-BRlgGlqj.js";import{a as Gt}from"./ZoomOut-AiYlkF58.js";import{E as qt,C as Me,D as he,G as Qt,I as Ut,J as Jt,K as M,M as ce,g as xe,N as ge,O as Ht,P as Xt,Q as ye,U as de,V as we,W as Yt,X as Zt}from"./preview-dialog-CgmGD8zP.js";import"./AlertCircle-DRN6XAl_.js";import"./SwitchHorizontal01-Bpd1Utek.js";import"./Settings02-Du9J1LY1.js";import"./XCircle-DS2uELKv.js";import"./ArrowUpRight-CS4sxU2z.js";import"./ZapSquare-WzwrglCu.js";import"./Users03-CcZFUmPD.js";import"./CheckCircle-Dof-gkrW.js";import"./ChevronUp-CZ6Mxabg.js";import"./ChevronLeft-LnaPgJ0y.js";import"./DotsVertical-BSRrIcA1.js";import"./Stars02-CTQVeFIY.js";import"./Eye-D3ZcE9lW.js";import"./Globe01-6U0-ZV4l.js";import"./FilterLines-nV95nFgf.js";import"./Star01-gn_l3mpc.js";import"./Globe04-10fsKNwF.js";import"./HardDrive-CcAdoaFI.js";import"./Key01-CzkLmrt_.js";import"./LayoutLeft-CpEUT3tP.js";import"./LinkExternal01-TXfR4Hhy.js";import"./Monitor01-CcWvKUoP.js";import"./Sun-CXETDRVX.js";import"./Palette-BmXhqV8p.js";import"./Play-BRcSzafX.js";import"./Plus-BS57SLmT.js";import"./SearchLg-CIaBccbb.js";import"./SearchMd-BOQbygpw.js";import"./Shield01-Dq_-3VLc.js";import"./Stars01-D0EbchXz.js";import"./Trash01-pbf89pjs.js";import"./Upload01-DvmBqoDO.js";import"./User01-C5OEqKDJ.js";import"./Users01-B7An2LNd.js";import"./X-DtGx_Eqi.js";import"./Zap-BcCmjpc0.js";import"./use-clock-tick-DR_O_bL8.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-DNq3T6SH.js";import"./file-type-icon-DFA7UObK.js";import"./use-mobile-d3rX0VX2.js";import"./tab-id-BptcWVWa.js";import"./content-blocks-o63cs2vh.js";import"./types-D5SLCq2u.js";import"./use-mcp-client-CIYxX4P5.js";import"./auth-CZ0pDy2E.js";import"./hooks-BE7YwHtm.js";import"./decopilot-sse-pool-C_k3BuPx.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./studio-tools-BXeKF31x.js";import"./sheet-DCM0ToXL.js";import"./integration-icon-DO0aMlRM.js";import"./use-virtual-mcp-CbdTA-7x.js";import"./use-collections-B6zlDXKN.js";import"./use-navigate-to-agent-X5p7bWf4.js";import"./use-connection-8FX2zzcI.js";import"./use-mcp-prompts-l61zrviT.js";import"./form-zKde5vNL.js";import"./label-BrslM_UB.js";import"./select-DqJQ5lRE.js";import"./use-ai-providers-3vPjPOz2.js";import"./use-organization-settings-DQjKRGQP.js";import"./avatar-CM9_qKlB.js";import"./required-auth-layout-D985wSIU.js";import"./use-org-sso-CGtfMwKv.js";import"./index-DbCqW7YA.js";import"./drawer-BKOVC1Nv.js";import"./collection-search-D7ygKNJe.js";import"./tabs-uIdHwBqm.js";import"./toggle-group-DC-9R-kx.js";import"./sortable.esm-BC4ZOnIG.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-DyrxiMlh.js";import"./use-registry-connections-Dg8ovbRG.js";import"./useInfiniteQuery-DiJ0Xsij.js";import"./use-infinite-scroll-C_MuFtOU.js";import"./extract-connection-data-0didS_pX.js";import"./card-BdlGnaGa.js";import"./collection-tabs-BcopigLE.js";import"./badge-BTVwpu14.js";import"./textarea-BSHQNfh6.js";import"./connection-form-helpers-DwJWrgb4.js";import"./authenticate-and-persist-oauth-CRdn4J0q.js";import"./mcp-oauth-CXbxPU1K.js";import"./useSuspenseInfiniteQuery-B2CIiwRu.js";import"./connect-desktop-dialog-BP6qp00q.js";import"./decopilot-BB1FfLa4.js";import"./checkbox-DNTx2aD9.js";import"./skeleton-D1BsF23p.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-8KZ8wW1V.js";import"./popover-BWjew7H2.js";import"./command-Dgi7YlH_.js";import"./index-C_7VA7XD.js";import"./dropdown-menu-swLhScJn.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-DVCwZxOR.js";import"./empty-state-D_f-_l9W.js";import"./toolbar-DevcmIZ4.js";import"./use-mcp-tools-C_waYweR.js";import"./use-capability-NnDdgNkk.js";import"./shell-route-loading-J3bIbZOA.js";import"./index-CXoUE4MX.js";import"./switch-Dv2j6d5M.js";import"./use-debounced-autosave-DgaYGNmY.js";import"./index-Dso3mm7m.js";import"./sidebar-DwyKpA9b.js";import"./search-input-Csp-MZi9.js";import"./github-repo-picker-xaTZuOQc.js";import"./use-debounced-value-BO0E-um9.js";import"./use-secrets-CNTh-cii.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-CyfUtpac.js";import"./automation-runs-B16B6scX.js";import"./table-JD_NL-TZ.js";import"./use-members-CIjbWJiD.js";import"./use-org-auth-client-Bv_Zhbk4.js";import"./task-status-C0XtJQEC.js";import"./use-automations-DpEBzEk5.js";import"./use-file-configs-DAJdFU9z.js";import"./monaco-editor-BvqPmzKC.js";import"./select-model-04vQ8QxB.js";import"./automation-list-row-CcPQPkfW.js";const _t={"new-file":{title:"New File",description:"Enter a name for the new file.",submit:"Create",placeholder:"filename.ts"},"new-folder":{title:"New Folder",description:"Enter a name for the new folder.",submit:"Create",placeholder:"folder-name"},rename:{title:"Rename",description:"Enter a new name for this item.",submit:"Rename",placeholder:"new-name"}};function en(y){const e=Ke.c(51),{open:c,mode:K,initialName:X,parentLabel:Q,isPending:A,onSubmit:V,onOpenChange:P}=y,W=X===void 0?"":X,o=A===void 0?!1:A,[p,O]=l.useState(W),[I,B]=l.useState(c),f=_t[K];c!==I&&(B(c),c&&O(W));let F;e[0]!==o||e[1]!==P?(F=E=>{!E&&!o&&P(!1)},e[0]=o,e[1]=P,e[2]=F):F=e[2];const U=F;let G;e[3]!==o||e[4]!==p||e[5]!==V?(G=async E=>{E.preventDefault();const z=p.trim();!z||o||await V(z)},e[3]=o,e[4]=p,e[5]=V,e[6]=G):G=e[6];const q=G;let L;e[7]!==f.title?(L=i.jsx($t,{children:f.title}),e[7]=f.title,e[8]=L):L=e[8];let N;e[9]!==f.description?(N=i.jsx(Ot,{children:f.description}),e[9]=f.description,e[10]=N):N=e[10];let R;e[11]!==L||e[12]!==N?(R=i.jsxs(Rt,{children:[L,N]}),e[11]=L,e[12]=N,e[13]=R):R=e[13];let S;e[14]!==Q?(S=Q&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Location"}),i.jsx(We,{value:Q,readOnly:!0,disabled:!0,className:"font-mono text-xs"})]}),e[14]=Q,e[15]=S):S=e[15];let D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=i.jsx("label",{htmlFor:"file-explorer-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[16]=D):D=e[16];let j;e[17]===Symbol.for("react.memo_cache_sentinel")?(j=E=>O(E.target.value),e[17]=j):j=e[17];let b;e[18]!==f.placeholder||e[19]!==o||e[20]!==p?(b=i.jsxs("div",{className:"space-y-1.5",children:[D,i.jsx(We,{id:"file-explorer-name",value:p,onChange:j,placeholder:f.placeholder,autoFocus:!0,disabled:o})]}),e[18]=f.placeholder,e[19]=o,e[20]=p,e[21]=b):b=e[21];let h;e[22]!==b||e[23]!==S?(h=i.jsxs("div",{className:"space-y-4 py-4",children:[S,b]}),e[22]=b,e[23]=S,e[24]=h):h=e[24];let x;e[25]!==P?(x=()=>P(!1),e[25]=P,e[26]=x):x=e[26];let C;e[27]!==o||e[28]!==x?(C=i.jsx(fe,{type:"button",variant:"outline",onClick:x,disabled:o,children:"Cancel"}),e[27]=o,e[28]=x,e[29]=C):C=e[29];let v;e[30]!==o||e[31]!==p?(v=!p.trim()||o,e[30]=o,e[31]=p,e[32]=v):v=e[32];let u;e[33]!==f.submit||e[34]!==o?(u=o?i.jsxs(i.Fragment,{children:[i.jsx(re,{size:14,className:"animate-spin"}),"Saving…"]}):f.submit,e[33]=f.submit,e[34]=o,e[35]=u):u=e[35];let k;e[36]!==v||e[37]!==u?(k=i.jsx(fe,{type:"submit",disabled:v,children:u}),e[36]=v,e[37]=u,e[38]=k):k=e[38];let m;e[39]!==C||e[40]!==k?(m=i.jsxs(zt,{children:[C,k]}),e[39]=C,e[40]=k,e[41]=m):m=e[41];let g;e[42]!==q||e[43]!==h||e[44]!==m||e[45]!==R?(g=i.jsx(At,{className:"sm:max-w-md",children:i.jsxs("form",{onSubmit:q,children:[R,h,m]})}),e[42]=q,e[43]=h,e[44]=m,e[45]=R,e[46]=g):g=e[46];let T;return e[47]!==U||e[48]!==c||e[49]!==g?(T=i.jsx(Wt,{open:c,onOpenChange:U,children:g}),e[47]=U,e[48]=c,e[49]=g,e[50]=T):T=e[50],T}const tn="#d9a441";function nn(y){const e=Ke.c(45),{node:c,depth:K,isExpanded:X,isSelected:Q,isLoading:A,fileVisual:V,onOpen:P,onSelect:W,onNewFile:o,onNewFolder:p,onCopyPath:O,onCopyRelativePath:I,onRename:B,onDelete:f}=y,F=A===void 0?!1:A,U=c.kind==="directory",{Icon:G,color:q}=V,L=Q&&"bg-accent";let N;e[0]!==L?(N=Ve("flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-[13px] hover:bg-accent transition-colors",L),e[0]=L,e[1]=N):N=e[1];const R=`${K*14+8}px`;let S;e[2]!==R?(S={paddingLeft:R},e[2]=R,e[3]=S):S=e[3];let D;e[4]!==P||e[5]!==W?(D=()=>{W(),P()},e[4]=P,e[5]=W,e[6]=D):D=e[6];let j;e[7]!==G||e[8]!==q||e[9]!==U||e[10]!==X||e[11]!==F?(j=U?i.jsxs(i.Fragment,{children:[F?i.jsx(re,{size:14,className:"shrink-0 animate-spin text-muted-foreground"}):X?i.jsx(Vt,{size:14,className:"shrink-0 text-muted-foreground"}):i.jsx(Bt,{size:14,className:"shrink-0 text-muted-foreground"}),i.jsx(Gt,{size:16,className:"shrink-0",style:{color:tn}})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"w-3.5 shrink-0"}),i.jsx(G,{size:16,className:"shrink-0",style:{color:q}})]}),e[7]=G,e[8]=q,e[9]=U,e[10]=X,e[11]=F,e[12]=j):j=e[12];let b;e[13]!==c.name?(b=i.jsx("span",{className:"truncate",children:c.name}),e[13]=c.name,e[14]=b):b=e[14];let h;e[15]!==N||e[16]!==S||e[17]!==D||e[18]!==j||e[19]!==b?(h=i.jsx(It,{asChild:!0,children:i.jsxs("button",{type:"button",className:N,style:S,onClick:D,children:[j,b]})}),e[15]=N,e[16]=S,e[17]=D,e[18]=j,e[19]=b,e[20]=h):h=e[20];let x;e[21]!==o?(x=i.jsx(_,{onSelect:o,children:"New File"}),e[21]=o,e[22]=x):x=e[22];let C;e[23]!==p?(C=i.jsx(_,{onSelect:p,children:"New Folder"}),e[23]=p,e[24]=C):C=e[24];let v;e[25]===Symbol.for("react.memo_cache_sentinel")?(v=i.jsx(Ie,{}),e[25]=v):v=e[25];let u;e[26]!==O?(u=i.jsx(_,{onSelect:O,children:"Copy Path"}),e[26]=O,e[27]=u):u=e[27];let k;e[28]!==I?(k=i.jsx(_,{onSelect:I,children:"Copy Relative Path"}),e[28]=I,e[29]=k):k=e[29];let m;e[30]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(Ie,{}),e[30]=m):m=e[30];let g;e[31]!==B?(g=i.jsx(_,{onSelect:B,children:"Rename"}),e[31]=B,e[32]=g):g=e[32];let T;e[33]!==f?(T=i.jsx(_,{variant:"destructive",onSelect:f,children:"Delete"}),e[33]=f,e[34]=T):T=e[34];let E;e[35]!==x||e[36]!==C||e[37]!==u||e[38]!==k||e[39]!==g||e[40]!==T?(E=i.jsxs(Mt,{className:"w-52",children:[x,C,v,u,k,m,g,T]}),e[35]=x,e[36]=C,e[37]=u,e[38]=k,e[39]=g,e[40]=T,e[41]=E):E=e[41];let z;return e[42]!==E||e[43]!==h?(z=i.jsxs(Kt,{children:[h,E]}),e[42]=E,e[43]=h,e[44]=z):z=e[44],z}pt.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function je(y,e,c,K){return`/api/${y}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(c)}/${K}`}function rn(y){const e=M(y);return!e||e.includes("..")||e.includes("\\")?!1:e.startsWith(".deco/blocks/")||!e.startsWith("/")&&!e.includes("://")}const sn="#94a3b8";function on(y){const e=y.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?{Icon:ae,color:"#3b82f6"}:e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?{Icon:ae,color:"#d9a441"}:e.endsWith(".json")?{Icon:yt,color:"#cb9b3f"}:e.endsWith(".css")||e.endsWith(".scss")?{Icon:ae,color:"#06b6d4"}:e.endsWith(".html")||e.endsWith(".xml")?{Icon:ae,color:"#f97316"}:/\.(png|jpe?g|gif|webp|avif|ico|svg)$/.test(e)?{Icon:wt,color:"#a855f7"}:e.endsWith(".md")||e.endsWith(".mdx")?{Icon:$e,color:"#64748b"}:{Icon:$e,color:sn}}function Ki({orgSlug:y,virtualMcpId:e,branch:c,openPath:K}){const[X,Q]=l.useState({files:[],directories:[],truncated:!1}),{files:A,directories:V}=X,[P,W]=l.useState(new Set),[o,p]=l.useState(null),[O,I]=l.useState(null),[B,f]=l.useState([]),[F,U]=l.useState(""),[G,q]=l.useState(!1),[L,N]=l.useState(!1),[,R]=l.useState(new Set),[S,D]=l.useState(new Set),j=l.useRef(0),b=l.useRef(null),h=l.useRef(new Set),x=l.useRef(new Map);function C(t){R(n=>{const r=typeof t=="function"?t(n):t;return h.current=r,r})}const[v,u]=l.useState(new Map),k=l.useRef(null),[m,g]=l.useState(null),{sendMessage:T}=Et(),{setChatOpen:E}=Pt(),z=ut(),[w,J]=l.useState(null),[H,ue]=l.useState(null),[ee,ie]=l.useState(!1);async function te(t,n){const r=await fetch(je(y,e,c,t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`Request failed (${r.status})`)}return r.json()}async function se(){z.invalidateQueries({queryKey:Ae(y,e,c)})}function be(t,n){navigator.clipboard.writeText(n).then(()=>$.success(`${t} copied`),()=>$.error(`Failed to copy ${t.toLowerCase()}`))}function Be(t){const n=Yt(t);if(!n)return;const r=`${y}/${e}/${c}`;z.setQueryData(Te.decofile(r),s=>{if(!s)return s;const{[n]:a,...d}=s;return d}),z.invalidateQueries({queryKey:Te.liveMeta(r)})}function Ge(t){const n=t.kind==="file"?[t.path]:A.filter(r=>r.startsWith(".deco/blocks/")).map(r=>ce(r)).filter(r=>r===t.path||r.startsWith(`${t.path}/`));for(const r of n)Be(r)}function qe(t){const n=ce(t);return B.filter(r=>{if(r!==n&&!r.startsWith(`${n}/`))return!1;const s=v.get(r);return!!(s?.loaded&&s.editorValue!==s.savedContent)})}function Ce(t){f(n=>n.map(r=>t(r)).filter(r=>r!==null)),p(n=>n&&t(n)),u(n=>{const r=new Map;for(const[s,a]of n){const d=t(s);d&&r.set(d,a)}return r}),I(n=>{if(!n)return n;const r=t(n.path);return r?r===n.path?n:{...n,path:r,name:r.split("/").pop()??r}:null})}function Qe(t){const n=ce(t);I(r=>r&&(r.path===n||r.path.startsWith(`${n}/`)?null:r)),Ce(r=>r===n||r.startsWith(`${n}/`)?null:r)}async function Ue(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,V))throw new Error(`"${t}" already exists`);await te("write",{path:M(n),content:""}),await ne(),await se(),J(null),me(n)}async function Je(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,V))throw new Error(`"${t}" already exists`);const r=M(n);await te("mkdir",{path:r}),Q(s=>({...s,directories:s.directories.includes(r)?s.directories:[...s.directories,r]})),await ne(),await se(),J(null),W(s=>{const a=new Set(s);for(const d of he(n))a.add(d);return a.add(n),a}),I({name:t,path:n,kind:"directory",children:[]})}async function He(t){if(!w)return;const n=w.node.path,r=ye(n),s=de(r,t);if(s===n){J(null);return}if(we(s,A,V))throw new Error(`"${t}" already exists`);await te("rename",{from:M(n),to:M(s)}),Ce(a=>a===n?s:a.startsWith(`${n}/`)?de(s,a.slice(n.length+1)):a),await ne(),await se(),J(null)}async function Xe(t){ie(!0);try{await te("unlink",{path:M(t.path),recursive:t.kind==="directory"}),Ge(t),Qe(t.path),await ne(),await se(),ue(null),$.success(`Deleted "${t.name}"`)}catch(n){$.error(n instanceof Error?n.message:"Delete failed")}finally{ie(!1)}}async function Ye(t){const n=Xt(t);if(n){$.error(n);return}ie(!0);try{w?.mode==="new-file"?(await Ue(t),$.success(`Created "${t}"`)):w?.mode==="new-folder"?(await Je(t),$.success(`Created folder "${t}"`)):w?.mode==="rename"&&(await He(t),$.success(`Renamed to "${t}"`))}catch(r){$.error(r instanceof Error?r.message:"Operation failed")}finally{ie(!1)}}const ve=l.useRef(!1);ve.current||(ve.current=!0,b.current=ne());const[Ze,_e]=l.useState(null);if(K&&K!==Ze){_e(K);const t=K;queueMicrotask(()=>{rn(t)&&me(t).catch(n=>{$.error(n instanceof Error?n.message:"Failed to open file")})})}async function Ne(t){const n=await te("glob",t);return{files:n.files??[],directories:n.directories??[],truncated:n.truncated}}function Se(t,n,r){if(r!==j.current)return!1;let s=!1;return Q(a=>{const d=n?Zt(a.files,a.directories,t,a.truncated):{files:t.files,directories:t.directories??[],truncated:!!t.truncated};return s=!!d.truncated,{files:d.files,directories:d.directories,truncated:s}}),s&&$.warning("File list truncated — some files may be hidden"),s}async function et(t){const n=x.current.get(t);if(n)return n;const r=j.current,s=(async()=>{const a=await Ne({pattern:"**/*",path:M(t),limit:Me}),d=Se(a,!0,r);return!d&&r===j.current&&C(Y=>{const oe=new Set(Y);return oe.add(t),oe}),d})();x.current.set(t,s);try{return await s}finally{x.current.delete(t)}}async function De(t){if(!ge(t,h.current))return!1;D(n=>new Set(n).add(t));try{return await et(t)}finally{D(n=>{const r=new Set(n);return r.delete(t),r})}}async function tt(t){const n=new Set(h.current);for(const r of he(t)){if(!ge(r,n))continue;if(await De(r))throw new Error("Folder listing truncated — expand again to load more");n.add(r)}}async function ne(){const t=++j.current;x.current.clear(),q(!0),C(new Set),W(new Set),D(new Set);try{const n=await Ne({pattern:"**/*",limit:Me,maxDepth:qt});Se(n,!1,t),N(!0)}catch{L&&$.error("Failed to refresh file tree")}finally{q(!1)}}async function ke(t){if(!v.get(t)?.loaded){u(r=>{const s=new Map(r);return s.set(t,{savedContent:"",editorValue:"",loaded:!1}),s});try{const r=await fetch(je(y,e,c,"read"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),full:!0})});if(!r.ok)return;const s=await r.json(),a=Ht(s.content??"");u(d=>{const Y=new Map(d);return Y.set(t,{savedContent:a,editorValue:a,loaded:!0}),Y})}catch{}}}async function nt(t,n){try{const r=await fetch(je(y,e,c,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),content:n})});if(!r.ok){le("file save failed",{path:t,status:r.status});return}le("file saved via sandbox /write",{path:t}),z.invalidateQueries({queryKey:Ae(y,e,c)});try{const s=await Tt(y,e,c);le("git status after save",s)}catch(s){le("git status after save failed",{path:t,error:s instanceof Error?s.message:String(s)})}u(s=>{const a=new Map(s),d=a.get(t);return d&&a.set(t,{...d,savedContent:n}),a})}catch{}}function rt(t){p(t),I({name:t.split("/").pop()??t,path:t,kind:"file",children:[]}),g(null),B.includes(t)||f(n=>[...n,t]),ke(t)}function it(t){f(n=>{const r=n.filter(s=>s!==t);return o===t&&p(r[r.length-1]??null),r}),u(n=>{const r=new Map(n);return r.delete(t),r})}function Fe(t){W(n=>{const r=new Set(n);return r.has(t)?r.delete(t):r.add(t),r})}async function st(t){if(ge(t,h.current))try{if(await De(t))return}catch(n){$.error(n instanceof Error?n.message:"Failed to load folder");return}Fe(t)}async function ot(t,n){if(n){Fe(t);return}await st(t)}async function me(t){await b.current,await tt(t);const n=he(t);W(r=>{const s=new Set(r);for(const a of n)s.add(a);return s}),rt(t)}function at(){return O?.kind==="directory"?O.path:O?.kind==="file"?ye(O.path):o?ye(o):"/"}function Le(t){const n=at();J({mode:t,parentDir:n,node:{name:"",path:n,kind:"directory",children:[]}})}const lt=Qt(A,V),Ee=Ut(lt,P),Pe=F?Ee.filter(t=>t.node.name.toLowerCase().includes(F.toLowerCase())):Ee,Z=o?v.get(o):null,ct=Z?.loaded&&Z.editorValue!==Z.savedContent,pe=H?qe(H.path):[],dt=(t,n)=>{k.current=t,t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyS,async()=>{if(!o)return;const r=t.getValue();await nt(o,r)}),t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyK,()=>{const r=t.getSelection(),s=t.getModel();if(!r||!s||!o)return;const a=s.getValueInRange(r);g({filePath:o,lineStart:r.startLineNumber,lineEnd:r.endLineNumber,selectedCode:a})})};function ft(t){if(!m)return;const n=[`The user selected code in the file explorer and asked: **"${t.trim()}"**`,"",`**File:** \`${m.filePath}\``,`**Lines:** ${m.lineStart}–${m.lineEnd}`];if(m.selectedCode){const r=xe(m.filePath),s=m.selectedCode.replace(/```/g,"`` `");n.push("","**Selected code:**","```"+r,s,"```")}n.push("","Please read the source file, locate the code, and apply the requested change."),E(!0),T({parts:[{type:"text",text:n.join(`
|
|
2
|
-
`)}]}),g(null)}return G&&!L?i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}):i.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[i.jsxs("div",{className:"w-64 shrink-0 border-r flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center gap-1 p-2 border-b",children:[i.jsxs("div",{className:"relative min-w-0 flex-1",children:[i.jsx(ht,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),i.jsx("input",{type:"text",value:F,onChange:t=>U(t.target.value),placeholder:"Search files...","aria-label":"Search files",className:"w-full rounded-md border border-input bg-transparent pl-7 pr-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground focus:ring-1 focus:ring-ring"})]}),i.jsxs(Oe,{children:[i.jsx(Re,{asChild:!0,children:i.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New file",onClick:()=>Le("new-file"),children:i.jsx(xt,{size:14})})}),i.jsx(ze,{side:"bottom",children:"New file"})]}),i.jsxs(Oe,{children:[i.jsx(Re,{asChild:!0,children:i.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New folder",onClick:()=>Le("new-folder"),children:i.jsx(gt,{size:14})})}),i.jsx(ze,{side:"bottom",children:"New folder"})]})]}),i.jsx(bt,{className:"flex-1",children:i.jsxs("div",{className:"py-1",children:[Pe.map(t=>{const{node:n,depth:r}=t,s=n.kind==="directory",a=P.has(n.path),d=O?.path===n.path,Y=Jt(n.path,n.kind),oe=s&&S.has(n.path);return i.jsx(nn,{node:n,depth:r,isExpanded:a,isSelected:d,isLoading:oe,fileVisual:on(n.name),onSelect:()=>I(n),onOpen:()=>{s?ot(n.path,a):me(n.path)},onNewFile:()=>J({mode:"new-file",node:n,parentDir:Y}),onNewFolder:()=>J({mode:"new-folder",node:n,parentDir:Y}),onCopyPath:()=>be("Path",ce(n.path)),onCopyRelativePath:()=>be("Relative path",M(n.path)),onRename:()=>J({mode:"rename",node:n,parentDir:Y}),onDelete:()=>ue(n)},n.path)}),L&&Pe.length===0&&i.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:F?`No files match "${F}"`:"No files found"})]})})]}),i.jsxs("div",{className:"relative flex-1 flex flex-col overflow-hidden",children:[B.length>0&&i.jsx("div",{className:"flex items-center border-b overflow-x-auto shrink-0",children:B.map(t=>{const n=v.get(t),r=n?.loaded&&n.editorValue!==n.savedContent,s=o===t,a=t.split("/").pop()??t;return i.jsxs("div",{className:Ve("flex items-center gap-1 px-3 py-1.5 text-xs border-r cursor-pointer transition-colors",s?"bg-background text-foreground":"bg-muted/50 text-muted-foreground hover:bg-accent"),onClick:()=>{p(t),ke(t)},onKeyDown:()=>{},role:"tab",tabIndex:0,"aria-selected":s,children:[i.jsx("span",{className:"truncate max-w-32",children:a}),r&&i.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-foreground/60 shrink-0"}),i.jsx("button",{type:"button",className:"ml-1 rounded p-0.5 hover:bg-accent-foreground/10",onClick:d=>{d.stopPropagation(),it(t)},children:i.jsx(jt,{size:12})})]},t)})}),m&&i.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 z-20 mt-2",style:{width:"360px"},children:i.jsxs("form",{className:"flex w-full items-center gap-1.5 rounded-xl border border-border bg-background/95 px-3 py-1.5 shadow-lg backdrop-blur",onSubmit:t=>{t.preventDefault();const r=t.currentTarget.elements.namedItem("askAiInput");r.value.trim()&&ft(r.value)},children:[i.jsx("input",{name:"askAiInput",autoFocus:!0,type:"text",placeholder:"Ask the AI...",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",onKeyDown:t=>{t.stopPropagation(),t.key==="Escape"&&g(null)}}),i.jsx("button",{type:"submit",className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background transition-opacity",title:"Send",children:i.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[i.jsx("title",{children:"Send"}),i.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})}),i.jsx("div",{className:"flex-1 overflow-hidden",children:o&&Z?.loaded?i.jsx(mt,{language:xe(o),theme:document.documentElement.classList.contains("dark")?"vs-dark":"light",value:Z.editorValue,path:o,onChange:t=>{const n=o;n&&u(r=>{const s=new Map(r),a=s.get(n);return a&&s.set(n,{...a,editorValue:t??""}),s})},onMount:dt,loading:i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}),options:{fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbersMinChars:2,wordWrap:"on",minimap:{enabled:!1},padding:{top:12,bottom:12},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8}}},o):o&&!Z?.loaded?i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}):i.jsx("div",{className:"flex items-center justify-center h-full w-full text-sm text-muted-foreground",children:"Select a file to edit"})}),o&&i.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-t text-[11px] text-muted-foreground shrink-0",children:[i.jsx("span",{className:"truncate",children:o}),i.jsxs("span",{children:[ct?"Modified":"Saved"," ·"," ",xe(o)]})]})]}),i.jsx(en,{open:w!==null,mode:w?.mode??"new-file",initialName:w?.mode==="rename"?w.node.name:"",parentLabel:w&&w.mode!=="rename"?w.parentDir==="/"?"/":M(w.parentDir):void 0,isPending:ee,onSubmit:Ye,onOpenChange:t=>{!t&&!ee&&J(null)}}),i.jsx(Ct,{open:H!==null,onOpenChange:t=>{!t&&!ee&&ue(null)},children:i.jsxs(vt,{children:[i.jsxs(Nt,{children:[i.jsxs(St,{children:["Delete ",H?.kind==="directory"?"folder":"file","?"]}),i.jsxs(Dt,{children:["This will permanently delete"," ",i.jsx("span",{className:"font-mono",children:H?.name}),H?.kind==="directory"?" and everything inside it.":".",pe.length>0&&i.jsxs(i.Fragment,{children:[" ",pe.length===1?"One open file has unsaved changes that will be lost.":`${pe.length} open files have unsaved changes that will be lost.`]})]})]}),i.jsxs(kt,{children:[i.jsx(Ft,{disabled:ee,children:"Cancel"}),i.jsx(Lt,{disabled:ee||!H,onClick:t=>{t.preventDefault(),H&&Xe(H)},children:"Delete"})]})]})})]})}export{Ki as FileExplorer};
|