decocms
Version:
Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools
2 lines (1 loc) • 5.98 kB
JavaScript
import{c as He,b as Le,u as Oe,a6 as $e,h9 as Be,ha as Ke,hb as le,hc as de,am as Qe,aj as me,hd as We,he as _e,r as Y,hf as qe,ev as ze,U as pe,hg as Ge,hh as Je}from"./index-ztdGKvBm.js";import{a as Xe}from"./use-chat-layout-state-Im_c7sw4.js";import{b as Ye}from"./agent-icon-BYWtutu9.js";import{i as Ze}from"./Monitor01-DMFbvudn.js";import{i as et}from"./UserSquare-CafFh5_d.js";import{b as tt}from"./use-connection-CcG4QE1K.js";import{a as at}from"./use-mcp-client-2MG3LveS.js";import{u as ot}from"./use-mcp-tools-DOqvKogJ.js";import{b as nt}from"./repository-binding-D_Xc1yRH.js";import{g as st}from"./types-5-cDe_8u.js";import{t as it}from"./utils-CVEq3hMx.js";import{a as R}from"./agent-capabilities-CyWfHGWp.js";import"./index-5erPNBmj.js";import{u as ct}from"./use-sandbox-events-E6fWuIsO.js";import{F as ue}from"./file-type-icon-CdjLDWdN.js";import{a as rt,u as lt}from"./use-panel-navigate-0z93k6Ut.js";import{r as Z}from"./resolve-tab-icon-XkjIOifK.js";import{u as dt}from"./use-task-metadata-DZBgcb3y.js";import{r as mt}from"./preview-source-BsRLGWUP.js";import{i as pt,n as ut,s as ft}from"./use-org-notice-Bg0zOPPj.js";import{u as bt}from"./use-voice-input-BMrsODyI.js";import{a as Tt}from"./use-organization-settings-C2vcrj4S.js";import{a as It}from"./use-project-scope-BwqdbGG4.js";import{c as vt,u as ht,d as Pt,e as gt,f as kt}from"./use-project-native-view-presence-C7OB-luC.js";import{c as yt}from"./chat-context-DFEln8mI.js";import{r as wt}from"./virtual-mcp-CAb2l-zV.js";function ta(o){const e=He.c(35),c=Le(),{openPanel:f,closePanel:F}=rt();let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={strict:!1},e[0]=b):b=e[0];const fe=Oe(b),ee=lt(),te=Xe(),i=nt(o.virtualMcpId),T=dt(o.taskId),{org:n}=$e(),{currentBranch:be,activeTask:I}=yt(),m=i?.metadata.ui?.layout??null,r=m?.tabs??[],l=i?.id?Be(i.id):null,v=T?.expanded_tools??[],h=Tt(),{scopeId:Te,project:Ie}=It(),U=vt(Te,Ie,i),P=ht(U.project),ae=Pt(U.resolvedScopeId,R(U.project?.metadata),P.presence);let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g={includeVirtual:!0},e[1]=g):g=e[1];const p=tt(g),ve=ct(),x=I?.branch??be;let k;e[2]!==I?.metadata||e[3]!==o.taskId||e[4]!==i?.metadata||e[5]!==T||e[6]!==x?(k=mt({threadId:o.taskId,sandboxBranch:x,agentHasRepo:R(i?.metadata),threadHasRepo:R(T)||R(I?.metadata)}),e[2]=I?.metadata,e[3]=o.taskId,e[4]=i?.metadata,e[5]=T,e[6]=x,e[7]=k):k=e[7];const he=k,E=ve.lifecycle.phase==="running",{runtime:Pe,resolved:oe}=bt(o.virtualMcpId),H=!!l&&E;let y;e[8]!==H?(y={enabled:H},e[8]=H,e[9]=y):y=e[9];const ne=at({connectionId:l,orgId:n.id,orgSlug:n.slug},y),L=ne,O=!!ne&&E;let w;e[10]!==L||e[11]!==O?(w={client:L,enabled:O},e[10]=L,e[11]=O,e[12]=w):w=e[12];const{data:ge}=ot(w),se=l&&E?(ge?.tools??[]).filter(St).map(t=>({connectionId:l,toolName:t.name,label:it(t.name),icon:null})):[],$=se[0],ke=$?se:[],u=$&&l?{type:"ext-apps",id:l,toolName:$.toolName}:m?.defaultMainView??null,ye=wt(m),ie={assets:P.assetsPending,siteAccess:P.siteAccessPending,blog:P.blogPending},{activeTab:C,mainOpen:d}=Ke({panelTabId:ee,mainPanelParam:fe.mainpanel,routeDefaultMain:te,metadata:u||m?{defaultMainView:u,tabs:r.map(Mt)}:null}),we=u||m?{defaultMainView:u,tabs:r.map(Vt)}:null,V=ut({hasSource:he==="repo"||h,runtime:Pe,cmsMode:ye}),Ce=V.includes("content"),Ve=le(we),Me=u?.type,ce=gt(Me,ae,ie,V,oe),B=ce?le(null):Ve,Se=kt(C,ae,ie),Ne=!V.includes("code")&&oe&&de(C)!==null,a=!ee&&!te&&ce||C==="content"&&!Ce||Ne||Se?B:C,K=Qe(a);let M;e[13]!==c?(M=t=>c(t==="site-editor"?"common.mainPanelTabs.preview":t==="content"?"common.mainPanelTabs.content":"common.mainPanelTabs.code"),e[13]=c,e[14]=M):M=e[14];const je=M,Q=new Map;for(const t of v){const s=me(t.appId,t.toolName);Q.set(s,{id:s,title:t.toolName,appId:t.appId,iconKey:t.toolName})}for(const t of ke){if(t.toolName==="fetch_assets")continue;const s=me(t.connectionId,t.toolName);Q.set(s,{id:s,title:t.label||t.toolName,appId:t.connectionId,iconKey:t.toolName,iconUrl:t.icon??null})}const W=We(a),_=W?W.key.split("/").pop()??W.key:null,Ae=_?[{id:a,title:_,kind:"file",icon:{kind:"component",Component:t=>Y.createElement(ue,{filename:_,...t})}}]:[],S=_e(a),De=S?[{id:a,title:(S.path.split("/").pop()??S.path).replace(/\.html$/i,""),kind:"file",icon:{kind:"component",Component:t=>Y.createElement(S.path.startsWith("pages/")?Ye:Ze,t)}}]:[],Re=qe(a)?[{id:a,title:c("page.businessCase"),kind:"file",icon:{kind:"component",Component:et}}]:[],q=ze(a),z=q?q.path.split("/").pop()??q.path:null,Fe=z?[{id:a,title:z,kind:"file",icon:{kind:"component",Component:t=>Y.createElement(ue,{filename:z,...t})}}]:[],Ue=pt(a)?V.map(t=>({id:t==="code"&&de(a)?a:t,title:je(t),kind:"system",icon:Z({tabId:t,kind:"system",connections:p})})):[];let N;e[15]!==p?(N=t=>({id:Ge(t.id),title:t.title,kind:"agent",icon:Z({tabId:t.id,kind:"agent",appId:t.view.appId,connections:p})}),e[15]=p,e[16]=N):N=e[16];const xe=[...Ue,...Ae,...De,...Re,...Fe,...r.map(N),...Array.from(Q.values()).map(t=>({id:t.id,title:t.title,kind:"expanded",icon:Z({tabId:t.iconKey,kind:"expanded",appId:t.appId,iconUrl:t.iconUrl,connections:p})}))],re=new Set,G=xe.filter(t=>re.has(t.id)?!1:(re.add(t.id),!0)),Ee=o.virtualMcpId;let j;e[17]!==n.id?(j=pe(n.id),e[17]=n.id,e[18]=j):j=e[18];const J=Ee===j;let A;e[19]!==a||e[20]!==F||e[21]!==d||e[22]!==J||e[23]!==f||e[24]!==n.id||e[25]!==h?(A=t=>{if(ft({reportsOnly:h,onReportAgent:J,tabId:t})){f(t,{virtualmcpid:pe(n.id),search:Ct});return}const s=Je({clickedId:t,activeTab:a,mainOpen:d});"close"in s?F():f(s.tabId)},e[19]=a,e[20]=F,e[21]=d,e[22]=J,e[23]=f,e[24]=n.id,e[25]=h,e[26]=A):A=e[26];const X=A;let D;return e[27]!==a||e[28]!==K||e[29]!==v||e[30]!==r||e[31]!==d||e[32]!==X||e[33]!==G?(D={activeTab:a,mainOpen:d,setActiveTab:X,layoutTabs:r,expandedTools:v,automationTabParsed:K,tabs:G},e[27]=a,e[28]=K,e[29]=v,e[30]=r,e[31]=d,e[32]=X,e[33]=G,e[34]=D):D=e[34],D}function Ct(o){return{...o,thread:void 0}}function Vt(o){return{id:o.id}}function Mt(o){return{id:o.id}}function St(o){return!!st(o._meta)}export{ta as u};