@axiom-lattice/gateway 4.3.0 → 4.3.1
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/embed/{embed-page-AgentDetailSideApp-7FH2JSZI.js → embed-page-AgentDetailSideApp-ONXG4B3D.js} +1 -1
- package/dist/embed/{embed-page-AgentGovernanceWorkbench-Y5F3ZPYC.js → embed-page-AgentGovernanceWorkbench-LCIQ5UF3.js} +1 -1
- package/dist/embed/{embed-page-MessageGraph-ONODQPG4.js → embed-page-MessageGraph-P7DBTZCL.js} +1 -1
- package/dist/embed/{embed-page-ReactChart-GZQSKCUG.js → embed-page-ReactChart-XS7D26VP.js} +1 -1
- package/dist/embed/{embed-page-SkillFlow-TPESM4DI.js → embed-page-SkillFlow-HPH37PZH.js} +1 -1
- package/dist/embed/{embed-page-TasksSideApp-HYKCJ356.js → embed-page-TasksSideApp-MQTUCJO4.js} +1 -1
- package/dist/embed/{embed-page-TeamWorkspace-IOHS4RJV.js → embed-page-TeamWorkspace-7T2HRXLG.js} +1 -1
- package/dist/embed/{embed-page-TopologyRuntimeView-QLMZ4OE7.js → embed-page-TopologyRuntimeView-PU2D7VZ7.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-FJJSGY7Z.js → embed-page-WorkflowAutomationView-ST76M33F.js} +1 -1
- package/dist/embed/{embed-page-chunk-ZTRCHYWV.js → embed-page-chunk-4ZSGPIBZ.js} +1 -1
- package/dist/embed/{embed-page-chunk-MCUFFMAW.js → embed-page-chunk-BRETUPSG.js} +86 -86
- package/dist/embed/{embed-page-chunk-SMQZEZYG.js → embed-page-chunk-LE6OFJ7R.js} +1 -1
- package/dist/embed/{embed-page-chunk-KFUAWYJ7.js → embed-page-chunk-T25T2YE6.js} +1 -1
- package/dist/embed/{embed-page-chunk-FXTSVMPN.js → embed-page-chunk-U6SL5TG6.js} +37 -37
- package/dist/embed/{embed-page-chunk-EMPMOO53.js → embed-page-chunk-VRV57DFE.js} +1 -1
- package/dist/embed/embed-page-chunk-YPV4BAWI.js +245 -0
- package/dist/embed/{embed-page-chunk-D3NRIME3.js → embed-page-chunk-Z4S4OYA4.js} +1 -1
- package/dist/embed/{embed-page-chunk-6LL6YULZ.js → embed-page-chunk-ZKJ7Z7P3.js} +1 -1
- package/dist/embed/{embed-page-chunk-VVYB3C4O.js → embed-page-chunk-ZXFZANZM.js} +1 -1
- package/dist/embed/embed-page.js +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/embed/embed-page-chunk-L7RMIQ7C.js +0 -245
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as Lr}from"./embed-page-chunk-ZXFZANZM.js";import{$ as kr,Aa as Er,B as hr,Da as Mr,Ea as Nr,Ja as Br,K as Oo,Ka as Bt,L as br,La as Dr,Ma as C,Na as Fr,O as vr,Oa as Se,P as xr,Q as st,Qa as no,R as Wo,Ra as tt,Sa as Ko,Ta as lt,Ua as ke,Va as ro,W as wr,Wa as zr,Xa as io,Y as kt,Z as Cr,_ as Sr,a as at,c as Gt,d as Yn,e as Xn,ea as to,eb as Dt,f as Zn,g as jo,h as et,i as Zt,ia as Rr,k as gr,ka as oo,la as Tr,nb as jr,o as Mt,pa as Pr,q as fr,qa as Ve,rb as $r,sa as Uo,t as yr,ta as Ir,tb as _r,u as eo,ua as Ar,vb as qo,w as Nt,za as Ho}from"./embed-page-chunk-BRETUPSG.js";import{f as Qn,j as Oe,l as Jn,n as er,p as tr,q as Ce,r as ue}from"./embed-page-chunk-T25T2YE6.js";import{a as i}from"./embed-page-chunk-MB65DZAX.js";import{$ as Vt,$b as ar,Ac as dr,Ca as Vn,Eb as Qt,Fa as Ct,Gc as pr,Ia as be,Ic as mr,Ja as Le,Kc as Xt,La as P,Lc as Jt,Ma as Gn,Nc as ur,Tb as ir,V as Et,Va as $o,W as z,Y as Fo,Z as xe,_ as Ne,aa as je,bc as sr,fc as lr,ia as _e,la as qn,mb as St,mc as Yt,na as zo,oa as de,ob as or,pa as qe,qb as nr,rc as yt,sb as _o,ta as K,tb as rr,va as re,wa as Pe,xa as q,ya as me,yb as Lo,yc as cr}from"./embed-page-chunk-O4QK5LWZ.js";import{a as w}from"./embed-page-chunk-4BKXE5ON.js";import{e as n}from"./embed-page-chunk-6Y3UYJ6Z.js";var Or=n(i()),xa=C(({token:e,css:t})=>({button:t`
|
|
2
2
|
display: inline-flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -19,7 +19,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
19
19
|
background: ${e.colorBgTextHover};
|
|
20
20
|
border-color: ${e.colorBorderSecondary};
|
|
21
21
|
}
|
|
22
|
-
`})),Rt=({ariaLabel:e,icon:t,onClick:o,pressed:r=!1})=>{let{styles:s}=
|
|
22
|
+
`})),Rt=({ariaLabel:e,icon:t,onClick:o,pressed:r=!1})=>{let{styles:s}=xa();return(0,Or.jsx)(z,{type:"text",size:"small",className:s.button,icon:t,onClick:o,"aria-label":e,"aria-pressed":r})};var Vo=n(i()),Go=()=>{let{toolsVisible:e,toggleTools:t}=ke();return(0,Vo.jsx)(Rt,{ariaLabel:"Toggle file directory",icon:(0,Vo.jsx)(st,{size:16}),onClick:t,pressed:e})};var he=n(w());var Ue=n(w());var ao=n(w());function ot(e){let[t,o]=(0,ao.useState)(()=>typeof window<"u"?window.matchMedia(e).matches:!1);return(0,ao.useEffect)(()=>{let r=window.matchMedia(e),s=a=>{o(a.matches)};return r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[e]),t}var Te=n(i()),ht=({main:e,detail:t,tools:o,logo:r,menu:s,header:a,mainStyle:d})=>{let{styles:c}=ro(),{detailVisible:p,detailSize:u,detailSelectedCard:b,toolsVisible:x,toolSelectedCard:v,contentAppSelectedCard:g,menuCollapsed:m,setMenuCollapsed:f,closeDetail:W,closeTools:j}=ke(),A=ot("(max-width: 768px)"),X=ot("(max-width: 1100px)"),ee=p||(m??A),pe=p&&!A,Q=ee?"collapsed":"expanded",S=p||x,B=x&&(u||"large")==="large"?"middle":u||"large";return(0,Te.jsxs)("div",{className:`fina_chat ${c.layout}`,children:[s&&(0,Te.jsxs)("div",{className:`${c.menu} ${Q} ${pe?c.menuSnap:""}`,children:[r,s]}),(0,Te.jsxs)("div",{className:c.contentArea,children:[(a||A&&s)&&(0,Te.jsxs)("div",{className:c.header,children:[A&&s?(0,Te.jsx)("button",{className:c.mobileMenuToggle,onClick:()=>f(!ee),"aria-label":"Toggle menu",children:(0,Te.jsx)(Tr,{size:18})}):null,a]}),(0,Te.jsxs)("div",{className:c.columns,style:{gap:S?void 0:0},children:[(0,Te.jsx)("div",{className:`${c.mainContent} ${S?"open":""}`,children:(0,Te.jsx)("div",{className:`${c.chat} ${g?"full_content_width":""}`,style:d,children:e})}),(0,Te.jsxs)("div",{className:`${c.detailPanel} ${p?`open ${B}`:""}`,children:[p&&A&&(0,Te.jsx)("button",{className:c.mobilePanelClose,onClick:W,"aria-label":"Close detail panel",children:(0,Te.jsx)(Bt,{size:20})}),p&&b&&t?(0,Te.jsx)("div",{className:c.detailContent,children:t}):null]}),(0,Te.jsxs)("div",{className:`${c.toolPanel} ${x?"open":""}`,children:[x&&X&&(0,Te.jsx)("button",{className:c.mobilePanelClose,onClick:j,"aria-label":"Close tool panel",children:(0,Te.jsx)(Bt,{size:20})}),x&&o?(0,Te.jsx)("div",{className:c.detailContent,children:o}):null]})]})]})]})};var Ie=n(w());var M=n(i()),Wr={wrapper:{background:"transparent",borderRadius:"0 24px 24px 0"},content:{background:"rgba(255, 255, 255, 0.72)",backdropFilter:"blur(20px) saturate(180%)",WebkitBackdropFilter:"blur(20px) saturate(180%)"},header:{background:"transparent",borderBottom:"1px solid rgba(0, 0, 0, 0.06)"},body:{padding:0}},wa=C(({token:e,css:t})=>({sidebar:t`
|
|
23
23
|
display: flex;
|
|
24
24
|
flex-direction: column;
|
|
25
25
|
height: 100%;
|
|
@@ -63,7 +63,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
63
63
|
width: 22px;
|
|
64
64
|
height: 22px;
|
|
65
65
|
}
|
|
66
|
-
`})),
|
|
66
|
+
`})),Ca=e=>{let t=new Map;return e.forEach(o=>{let r=o.group||null;t.has(r)||t.set(r,[]),t.get(r).push(o)}),Array.from(t.entries()).map(([o,r])=>({group:o,items:r.sort((s,a)=>(s.order??0)-(a.order??0))})).sort((o,r)=>{if(o.group===null)return-1;if(r.group===null)return 1;let s=o.items[0]?.order??0,a=r.items[0]?.order??0;return s-a})},so=({items:e,onItemClick:t,logo:o,logoIcon:r,logoText:s="Menu",showBranding:a=!0,showToggle:d=!0,showNewAnalysis:c=!1,onNewAnalysis:p,defaultExpanded:u=!0,forceIconMode:b=!1,collapsed:x,onCollapsedChange:v,className:g,style:m,footer:f,getContextMenuItems:W})=>{let{styles:j}=wa(),{styles:A}=ro(),X=x!==void 0,[ee,pe]=(0,Ie.useState)(!u),Q=X?x:ee;(0,Ie.useEffect)(()=>{X||v?.(Q)},[]);let[S,B]=(0,Ie.useState)({}),[J,Z]=(0,Ie.useState)(()=>{let k=new Set;return e.forEach(ne=>{ne.type==="drawer"&&ne.inline&&ne.inlineDefaultExpanded&&k.add(ne.id)}),k}),E=Q||b,D=!!E,$=(0,Ie.useMemo)(()=>Ca(e),[e]),le=(0,Ie.useCallback)(k=>{t?.(k),k.type==="drawer"&&((k.inline??!1)&&!E?Z(F=>{let U=new Set(F);return U.has(k.id)?U.delete(k.id):U.add(k.id),U}):B(F=>({...F,[k.id]:!0})))},[t,E]),L=(0,Ie.useCallback)(k=>{B(ne=>({...ne,[k]:!1}))},[]),R=(0,Ie.useMemo)(()=>e.filter(k=>k.type==="drawer"&&S[k.id]).map(k=>k.id),[e,S]);(0,Ie.useEffect)(()=>{if(R.length===0)return;let k=ne=>{let F=ne.target;!F||typeof F.closest!="function"||R.forEach(U=>{F.closest(`.menu-drawer-${U}`)||L(U)})};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[R,L]);let I=(0,Ie.useCallback)(()=>{if(!b){let k=!Q;X?v?.(k):pe(k)}},[b,Q,X,v]);return(0,M.jsxs)(M.Fragment,{children:[E?(0,M.jsxs)("div",{className:`${j.sidebar} ${A.iconMode} ${g||""}`,style:m,children:[a?(0,M.jsx)("div",{className:A.iconModeLogo,children:o||r||(0,M.jsx)(Oo,{size:28,color:"#1677ff"})}):null,(0,M.jsx)("div",{className:A.iconModeContainer,children:$.map(({group:k,items:ne},F)=>(0,M.jsxs)(Ie.default.Fragment,{children:[F>0&&(0,M.jsx)("div",{className:A.iconModeDivider}),(0,M.jsx)("div",{className:A.iconModeGroup,children:ne.map(U=>{let We=W?.(U),He=U.badge!==void 0&&U.badge!==!1&&U.badge!==0,Ze=(0,M.jsxs)("button",{className:A.iconModeButton,onClick:()=>le(U),title:U.name,"aria-label":U.name,style:{position:"relative"},children:[(0,M.jsx)("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:U.icon}),He&&(0,M.jsx)("span",{style:{position:"absolute",top:2,right:2,minWidth:typeof U.badge=="number"?16:8,height:typeof U.badge=="number"?16:8,borderRadius:typeof U.badge=="number"?8:4,background:"#ef4444",color:"#fff",fontSize:10,fontWeight:600,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,padding:typeof U.badge=="number"?"0 3px":0},children:typeof U.badge=="number"?U.badge>99?"99+":U.badge:null})]},U.id);return We?(0,M.jsx)(qe,{menu:{items:We},trigger:["contextMenu"],children:Ze},U.id):Ze})})]},k||`group-${F}`))}),d&&(0,M.jsx)("button",{className:A.iconModeButton,onClick:I,title:"Expand sidebar","aria-label":"Expand sidebar",style:{marginTop:"auto"},children:(0,M.jsx)("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:(0,M.jsx)(Nt,{size:22})})}),f&&(0,M.jsx)("div",{style:{marginTop:"auto",paddingTop:8},children:typeof f=="function"?f({isIconMode:E}):f})]}):(0,M.jsxs)("div",{className:`${j.sidebar} ${A.expandedMenu} ${g||""}`,style:m,children:[a?(0,M.jsxs)("div",{className:`${A.expandedMenuLogo} ${D?"collapsed":""}`,children:[(0,M.jsx)("div",{className:"logo-icon",children:o||r||(0,M.jsx)(Oo,{size:28,color:"#1677ff"})}),(0,M.jsx)("span",{className:"logo-text",children:s}),d&&!b&&(0,M.jsx)("button",{className:A.collapseBtn,onClick:I,title:"Collapse sidebar","aria-label":"Collapse sidebar",children:(0,M.jsx)(oo,{size:18})})]}):d&&!b?(0,M.jsx)("button",{className:A.collapseBtn,onClick:I,title:"Collapse sidebar","aria-label":"Collapse sidebar",style:{alignSelf:"flex-end",marginBottom:8},children:(0,M.jsx)(oo,{size:18})}):null,c&&(0,M.jsxs)("button",{className:`${A.newAnalysisBtn} ${D?"collapsed":""}`,onClick:p,children:[(0,M.jsx)(Ir,{size:18}),(0,M.jsx)("span",{className:"btn-text",children:"New Thread"})]}),(0,M.jsx)("div",{className:A.buttonContainerExpanded,children:$.map(({group:k,items:ne})=>(0,M.jsxs)("div",{className:A.menuGroup,children:[k&&(0,M.jsx)("div",{className:`${A.menuGroupTitle} ${D?"collapsed":""}`,children:k}),ne.map(F=>{let U=F.inline??!1,We=J.has(F.id),He=W?.(F),Ze=F.badge!==void 0&&F.badge!==!1&&F.badge!==0,ft=(0,M.jsxs)("button",{className:`${A.menuItemExpanded} ${D?"collapsed":""} ${We?A.menuItemExpandedActive:""}`,onClick:()=>le(F),title:D?F.name:void 0,"aria-label":F.name,"aria-expanded":We,children:[(0,M.jsx)("span",{className:"menu-icon",children:F.icon}),(0,M.jsx)("span",{className:"menu-label",children:F.name}),Ze&&(0,M.jsx)("span",{style:{marginLeft:"auto",minWidth:typeof F.badge=="number"?18:8,height:typeof F.badge=="number"?18:8,borderRadius:typeof F.badge=="number"?9:4,background:"#ef4444",color:"#fff",fontSize:11,fontWeight:600,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,padding:typeof F.badge=="number"?"0 4px":0},children:typeof F.badge=="number"?F.badge>99?"99+":F.badge:null}),U&&!D&&(0,M.jsx)("span",{className:A.inlineDrawerIndicator,children:We?(0,M.jsx)(eo,{size:16}):(0,M.jsx)(Nt,{size:16})})]}),rt=He?(0,M.jsx)(qe,{menu:{items:He},trigger:["contextMenu"],children:ft},F.id):(0,M.jsx)(Ie.default.Fragment,{children:ft},F.id);return(0,M.jsxs)(Ie.default.Fragment,{children:[rt,U&&We&&!D&&(0,M.jsx)("div",{className:A.inlineDrawerContainer,children:F.content})]},F.id)})]},k||"ungrouped"))}),f&&(0,M.jsx)("div",{style:{marginTop:"auto",paddingTop:16,borderTop:"1px solid rgba(0, 0, 0, 0.06)"},children:typeof f=="function"?f({isIconMode:E}):f})]}),e.filter(k=>k.type==="drawer").map(k=>(0,M.jsx)(zo,{rootClassName:`menu-drawer-${k.id}`,title:(0,M.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[(0,M.jsx)("span",{style:{fontSize:16,fontWeight:600,textTransform:"uppercase",letterSpacing:.5},children:k.title||k.name}),(0,M.jsx)("button",{onClick:()=>L(k.id),style:{display:"flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:8,border:"1px solid rgba(0, 0, 0, 0.1)",background:"rgba(255, 255, 255, 0.5)",cursor:"pointer"},children:(0,M.jsx)(oo,{size:24})})]}),open:S[k.id]||!1,onClose:()=>L(k.id),placement:"left",width:k.width||600,styles:{...Wr,header:{padding:"16px 20px",borderBottom:"1px solid rgba(0, 0, 0, 0.04)"},content:{...Wr.content,borderRadius:"0 24px 24px 0",overflow:"hidden"}},closable:!1,mask:!1,destroyOnClose:!0,children:k.content},k.id))]})};var Ur=n(w());var Hr=n(i()),{TextArea:jl}=K;var Kr=n(w());var qr=n(i());var Vr=n(i());var Tt=n(w());var Qo=class{apps=new Map;defaultId=void 0;register(t){if(!t.id)throw new Error("App must have an id");this.apps.set(t.id,t),this.defaultId===void 0&&(this.defaultId=t.id)}get(t){return this.apps.get(t)}list(){return Array.from(this.apps.values())}getDefaultId(){return this.defaultId}setDefault(t){if(!this.apps.has(t))throw new Error(`Cannot set default to unregistered app: ${t}`);this.defaultId=t}getCurrentId(){return this.currentId}setCurrent(t){if(!this.apps.has(t))throw new Error(`Cannot set current to unregistered app: ${t}`);this.currentId=t}resetCurrent(){this.currentId=void 0}currentId=void 0},ka=new Qo;var Ra=n(i()),Gl=(0,Tt.createContext)(null);var Qr=n(i()),Jl=C(({token:e})=>({container:{display:"flex",flexDirection:"column",gap:e.padding,padding:e.padding},header:{fontSize:e.fontSizeHeading5,fontWeight:600,color:e.colorText,paddingBottom:e.paddingSM,borderBottom:`1px solid ${e.colorBorderSecondary}`},grid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(120px, 1fr))",gap:e.padding},card:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:e.paddingXS,padding:e.paddingLG,borderRadius:e.borderRadiusLG,border:`1px solid ${e.colorBorder}`,cursor:"pointer",transition:"all 0.2s",background:e.colorBgContainer,"&:hover":{borderColor:e.colorPrimary,background:e.colorPrimaryBg}},activeCard:{borderColor:e.colorPrimary,background:e.colorPrimaryBg},icon:{fontSize:28,lineHeight:1},name:{fontSize:e.fontSize,fontWeight:500,color:e.colorText,textAlign:"center"},activeName:{color:e.colorPrimary}}));var gi=n(w());var Ea=n(w());var Yo=n(i());var Yr=n(i());var ct=n(w());var Na=n(i());var yc=300*1e3,hc=(0,ct.createContext)(null);var Ba=n(i());var pn=n(w());var Jo=n(w());var Da=n(w());var Fa=n(i());var Jr=n(i()),Mc=C(({token:e,css:t})=>({container:t`
|
|
67
67
|
display: flex;
|
|
68
68
|
flex-direction: column;
|
|
69
69
|
height: 100%;
|
|
@@ -411,7 +411,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
411
411
|
transform: translateY(0);
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
`})),$a=({component_key:e,data:t})=>t?.component?(0,N.jsx)(N.Fragment,{children:t.component}):(0,N.jsxs)("div",{children:[(0,N.jsx)("p",{children:"Component view not found"}),(0,N.jsx)("pre",{children:JSON.stringify({component_key:e,data:t},null,2)})]}),
|
|
414
|
+
`})),$a=({component_key:e,data:t})=>t?.component?(0,N.jsx)(N.Fragment,{children:t.component}):(0,N.jsxs)("div",{children:[(0,N.jsx)("p",{children:"Component view not found"}),(0,N.jsx)("pre",{children:JSON.stringify({component_key:e,data:t},null,2)})]}),co=e=>(0,N.jsx)($o,{style:{fontSize:12,opacity:.6}}),po=({region:e="side",compact:t=!0,showCloseButton:o=!0})=>{let{styles:r}=ja(),{sideAppSelectedCard:s,contentAppSelectedCard:a,closeSideApp:d,closeContentApp:c,openSideApp:p,openContentApp:u}=ke(),b=e==="side"?s:a,x=e==="side"?d:c,v=e==="side"?p:u,[g,m]=(0,Ae.useState)(JSON.stringify(b)),[f,W]=(0,Ae.useState)(null),[j,A]=(0,Ae.useState)([]),[X,ee]=(0,Ae.useState)(!1),[pe,Q]=(0,Ae.useState)(!1),[S,B]=(0,Ae.useState)(!1),J=(0,Ae.useRef)(null),Z=(0,Ae.useCallback)(()=>{J.current&&(clearTimeout(J.current),J.current=null),Q(!1),B(!1),ee(!0)},[]),E=(0,Ae.useCallback)(()=>{J.current=setTimeout(()=>{Q(!0)},150)},[]),se=(0,Ae.useCallback)(()=>{pe&&(ee(!1),Q(!1))},[pe]),D=(T,ce,k,ne)=>{let F=[...j,{label:ce,children:k,key:T,componentKey:ne}];A(F),m(T)},$=T=>{let ce=g,k=j.findIndex(F=>F.key===T),ne=j.filter(F=>F.key!==T);if(ne.length===0){x();return}ce===T&&(k>0?ce=j[k-1].key:ce=ne[0].key),A(ne),m(ce)},le=T=>{m(T)};(0,Ae.useEffect)(()=>{if(!b)return;let T=JSON.stringify(b);if(j.find(k=>k.key===T)){m(T),setTimeout(()=>{document.querySelector(`[data-tab-key="${T}"]`)?.scrollIntoView({behavior:"smooth",inline:"center"})},100);return}let ce=qo(b?.component_key)?.side_app_view||$a;D(T,b?.message||b?.data?.message||"Unnamed",(0,N.jsx)(ce,{component_key:b?.component_key||"",data:b?.data,context:b?.context}),b?.component_key),J.current&&clearTimeout(J.current),ee(!0),Q(!1),B(!0),J.current=setTimeout(()=>{Q(!0)},1500)},[b]);let L=j.find(T=>T.key===g),R=j.map(T=>({key:T.key,label:(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"4px 0"},children:[co(T.componentKey),(0,N.jsx)("span",{style:{flex:1},children:T.label}),(0,N.jsx)(St,{style:{fontSize:10,opacity:.5},onClick:ce=>{ce.stopPropagation(),$(T.key)}})]}),onClick:()=>le(T.key)})),I=(0,Ae.useMemo)(()=>({openApp:v}),[v]);return(0,N.jsxs)("div",{className:r.container,children:[t&&j.length>0&&(0,N.jsx)("div",{className:r.compactWrapper,onMouseEnter:Z,onMouseLeave:E,children:X?(0,N.jsxs)("div",{className:`${r.floatingHeader} ${S?r.floatingHeaderPeek:""} ${pe?r.floatingHeaderLeaving:""}`,onAnimationEnd:se,children:[(0,N.jsx)("div",{className:r.floatingTabsStrip,children:j.map(T=>(0,N.jsx)(je,{title:T.label,placement:"bottom",children:(0,N.jsxs)("div",{"data-tab-key":T.key,className:`${r.tab} ${T.key===g?"active":""}`,onClick:()=>le(T.key),onMouseEnter:()=>W(T.key),onMouseLeave:()=>W(null),children:[co(T.componentKey),(0,N.jsx)("span",{className:r.tabLabel,children:T.label}),(0,N.jsx)("span",{className:`${r.closeIndicator} ${f===T.key||T.key===g?"always-visible":""}`,onClick:ce=>{ce.stopPropagation(),$(T.key)},children:(0,N.jsx)(St,{style:{fontSize:10}})})]})},T.key))}),j.length>1&&(0,N.jsx)(qe,{menu:{items:R},placement:"bottomRight",trigger:["click"],children:(0,N.jsx)("button",{className:r.actionBtn,title:"All tabs",children:(0,N.jsx)(yt,{})})}),o&&(0,N.jsx)(je,{title:"Close",children:(0,N.jsx)("button",{className:r.actionBtn,onClick:x,children:(0,N.jsx)(St,{})})})]}):L&&(0,N.jsxs)("div",{className:r.compactPill,children:[co(L.componentKey),(0,N.jsx)("span",{className:r.compactPillLabel,children:L.label})]})}),!t&&(0,N.jsxs)("div",{className:r.header,children:[(0,N.jsx)("div",{className:r.tabsStrip,children:j.map(T=>(0,N.jsx)(je,{title:T.label,placement:"bottom",children:(0,N.jsxs)("div",{"data-tab-key":T.key,className:`${r.tab} ${T.key===g?"active":""}`,onClick:()=>le(T.key),onMouseEnter:()=>W(T.key),onMouseLeave:()=>W(null),children:[co(T.componentKey),(0,N.jsx)("span",{className:r.tabLabel,children:T.label}),(0,N.jsx)("span",{className:`${r.closeIndicator} ${f===T.key||T.key===g?"always-visible":""}`,onClick:ce=>{ce.stopPropagation(),$(T.key)},children:(0,N.jsx)(St,{style:{fontSize:10}})})]})},T.key))}),(0,N.jsxs)("div",{className:r.actions,children:[j.length>0&&(0,N.jsx)("div",{className:r.tabCounter,children:j.length}),j.length>1&&(0,N.jsx)(qe,{menu:{items:R},placement:"bottomRight",trigger:["click"],children:(0,N.jsx)("button",{className:r.actionBtn,title:"All tabs",children:(0,N.jsx)(yt,{})})}),o&&(0,N.jsx)(je,{title:"Close",children:(0,N.jsx)("button",{className:r.actionBtn,onClick:x,children:(0,N.jsx)(St,{})})})]})]}),(0,N.jsx)("div",{className:r.content,style:t&&j.length>0?{paddingTop:10}:void 0,children:(0,N.jsx)(io.Provider,{value:I,children:L?(0,N.jsx)("div",{className:r.contentWrapper,children:L.children},L.key):(0,N.jsxs)("div",{className:r.emptyState,children:[(0,N.jsx)($o,{className:"icon"}),(0,N.jsx)("span",{children:"Select an app to start"})]})})})]})};var zt=n(w());var Zo=n(w());var en=n(i());var md=C(({token:e,css:t})=>({content:t`
|
|
415
415
|
display: flex;
|
|
416
416
|
flex-direction: column;
|
|
417
417
|
gap: 4px;
|
|
@@ -479,7 +479,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
479
479
|
font-size: 13px;
|
|
480
480
|
color: ${e.colorTextSecondary};
|
|
481
481
|
padding: 4px 0;
|
|
482
|
-
`}));var
|
|
482
|
+
`}));var Zr=n(i());var bd=C(({token:e,css:t})=>({row:t`
|
|
483
483
|
display: flex;
|
|
484
484
|
align-items: center;
|
|
485
485
|
gap: 8px;
|
|
@@ -533,7 +533,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
533
533
|
color: ${e.colorTextTertiary};
|
|
534
534
|
opacity: 0;
|
|
535
535
|
transition: opacity 0.15s ease;
|
|
536
|
-
`}));var
|
|
536
|
+
`}));var ei=n(i());var Nd=5*6e4,Bd=C(({token:e,css:t})=>({root:t`
|
|
537
537
|
flex: 1;
|
|
538
538
|
min-height: 0;
|
|
539
539
|
overflow-y: auto;
|
|
@@ -566,7 +566,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
566
566
|
`,dividerText:t`
|
|
567
567
|
font-size: 12px;
|
|
568
568
|
color: ${e.colorTextTertiary};
|
|
569
|
-
`}));var jt=n(w());var
|
|
569
|
+
`}));var jt=n(w());var ti=n(i());var ip=C(({token:e,css:t})=>({root:t`
|
|
570
570
|
flex-shrink: 0;
|
|
571
571
|
border-top: 1px solid ${e.colorBorderSecondary};
|
|
572
572
|
background: ${e.colorBgContainer};
|
|
@@ -587,7 +587,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
587
587
|
margin-top: 8px;
|
|
588
588
|
font-size: 13px;
|
|
589
589
|
color: ${e.colorErrorText};
|
|
590
|
-
`}));var La=n(w());var
|
|
590
|
+
`}));var La=n(w());var oi=n(i());var cp=C(({token:e,css:t})=>({root:t`
|
|
591
591
|
display: flex;
|
|
592
592
|
align-items: center;
|
|
593
593
|
gap: 12px;
|
|
@@ -613,7 +613,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
613
613
|
gap: 6px;
|
|
614
614
|
flex-shrink: 0;
|
|
615
615
|
margin-left: auto;
|
|
616
|
-
`}));var $t=n(w());var
|
|
616
|
+
`}));var $t=n(w());var mo=[{role:"owner",label:"Owner",description:"Full control: settings, members, and messages."},{role:"admin",label:"Admin",description:"Manage settings and members; can send messages."},{role:"member",label:"Member",description:"Send messages and work in the project."},{role:"viewer",label:"Viewer",description:"Read-only access."}];var on=n(i());var Cp=mo.map(({role:e,label:t,description:o})=>({value:e,label:t,description:o}));var Sp=C(({token:e,css:t})=>({root:t`
|
|
617
617
|
display: flex;
|
|
618
618
|
flex-direction: column;
|
|
619
619
|
height: 100%;
|
|
@@ -728,7 +728,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
728
728
|
opacity: 0.7;
|
|
729
729
|
`,error:t`
|
|
730
730
|
margin-bottom: 12px;
|
|
731
|
-
`}));var _t=n(w());var
|
|
731
|
+
`}));var _t=n(w());var ni=n(i()),Bp=C(({token:e,css:t})=>({root:t`
|
|
732
732
|
display: flex;
|
|
733
733
|
flex-direction: column;
|
|
734
734
|
height: 100%;
|
|
@@ -778,7 +778,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
778
778
|
gap: 8px;
|
|
779
779
|
font-size: 12px;
|
|
780
780
|
color: ${e.colorTextSecondary};
|
|
781
|
-
`}));var
|
|
781
|
+
`}));var dn=n(w());var ie=n(w());var nn=e=>{if(!e)return"";let t=e.split("/").filter(Boolean);return t[t.length-1]??""},ri=(e,t)=>{if(t==="name")return null;let o=t==="created"?e.created_at:e.modified_at;if(!o)return null;let r=Date.parse(o);return Number.isNaN(r)?null:r};function Lt(e,t="name",o="asc"){return[...e].sort((r,s)=>{if(!!r.is_dir!=!!s.is_dir)return r.is_dir?-1:1;if(t==="name"){let c=nn(r.path),p=nn(s.path);return o==="asc"?c.localeCompare(p):p.localeCompare(c)}let a=ri(r,t),d=ri(s,t);return a===null&&d===null?0:a===null?1:d===null?-1:o==="asc"?a-d:d-a})}function ii(e,t){let o=t.trim().toLowerCase();return o?e.filter(r=>{let s=(r.path||"").toLowerCase(),a=nn(r.path).toLowerCase();return s.includes(o)||a.includes(o)}):e}function ai(e){let t=[];return e.forEach(o=>{let r=(o.path||"").split("/").filter(Boolean);if(r.length===0)return;let s=t;r.forEach((a,d)=>{let c=d===r.length-1,p="/"+r.slice(0,d+1).join("/"),u=s.find(b=>b.path===p);u||(u=c?{...o,path:p,name:a}:{path:p,name:a,is_dir:!0,children:[]},s.push(u)),c||(s=u.children??(u.children=[]))})}),t}function rn(e,t="name",o="asc"){return Lt(e,t,o).map(r=>r.children?{...r,children:rn(r.children,t,o)}:r)}var h=n(i()),Ua=C(({token:e,css:t})=>({container:t`
|
|
782
782
|
height: 100%;
|
|
783
783
|
overflow-y: auto;
|
|
784
784
|
overflow-x: hidden;
|
|
@@ -967,7 +967,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
967
967
|
width: 14px;
|
|
968
968
|
height: 14px;
|
|
969
969
|
}
|
|
970
|
-
`})),ai=e=>{if(!e)return"";let t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString()},Ha=e=>{if(!e)return"";let t=e.split(/[/\\]/);return t[t.length-1]},rn=e=>Ha(e.name||e.path),Ka=e=>(0,h.jsxs)("div",{children:[(0,h.jsx)("div",{style:{fontWeight:600},children:rn(e)}),e.created_at?(0,h.jsxs)("div",{children:["Created: ",ai(e.created_at)]}):null,e.modified_at?(0,h.jsxs)("div",{children:["Modified: ",ai(e.modified_at)]}):null]}),qa={display:"flex",flexDirection:"column",gap:12},an=({workspaceId:e,projectId:t,resourceFolders:o,folderEntries:r,folderLoading:s,directoryChildren:a,directoryLoading:d,directoryExpanded:c,uploadingFolder:p,onRefreshFolder:u,onUploadFolder:b,onToggleDirectory:x,onAssetClick:v})=>{let{styles:g}=Ua(),{message:m}=Do.useApp(),{currentAssistant:f}=et(),{getFileDownloadUrl:W,downloadFolder:j,getDirectFileUrl:A,listPathByFolder:X}=Se(),{openSideApp:ee}=ke(),{currentTenant:pe}=Oe(),Q=pe?.id||"",[S,B]=(0,ie.useState)(null),[J,Z]=(0,ie.useState)(null),{check:E,pin:se,unpin:D,enableCustomMenu:$,get:le}=mo(),L=sn(),[R,I]=(0,ie.useState)(L);(0,ie.useEffect)(()=>{I(L)},[L]);let[T,ce]=(0,ie.useState)({}),[k,ne]=(0,ie.useState)(null),[F,U]=(0,ie.useState)(""),[We,He]=(0,ie.useState)(""),[Ze,ft]=(0,ie.useState)(!1),[rt,O]=(0,ie.useState)(""),[fe,it]=(0,ie.useState)("name"),[Ye,ga]=(0,ie.useState)("asc"),[Ht,Eo]=(0,ie.useState)(null),[fa,Mo]=(0,ie.useState)(!1);(0,ie.useEffect)(()=>{k&&ln(le).then(y=>{I(Array.from(new Set([...L,...y])).sort())})},[k]),(0,ie.useEffect)(()=>{let y=rt.trim();if(!y){Eo(null),Mo(!1);return}let Y=!1;return Mo(!0),jr(X,o.map(H=>H.name),f?.id).then(H=>{Y||Eo(ri(H,y))}).catch(()=>{Y||Eo([])}).finally(()=>{Y||Mo(!1)}),()=>{Y=!0}},[rt,X,o,f?.id]);let No=(0,ie.useMemo)(()=>Ht?nn(ii(Ht),fe,Ye):null,[Ht,fe,Ye]),Kt=(0,ie.useCallback)((y,Y)=>{if(!Y||!$)return;ce(_=>_[y]?_:{..._,[y]:{isPinned:!1,pinnedId:null,loading:!0}});let H={contentType:"file",contentConfig:{resourcePath:y,tenantId:Q,workspaceId:e||"",projectId:t||"",assistantId:f?.id||"",fileName:y.split("/").pop()||y},isMatch:_=>_.resourcePath===y};E(H).then(_=>{ce(Ke=>({...Ke,[y]:{..._,loading:!1}}))}).catch(()=>{ce(_=>({..._,[y]:{isPinned:!1,pinnedId:null,loading:!1}}))})},[$,E,f?.id]),ya=async()=>{if(!k||!F.trim()){m.warning("Please enter a menu name");return}ft(!0);try{let y=k.split("/").pop()||k;await se({contentType:"file",name:F.trim(),group:We.trim()||void 0,contentConfig:{resourcePath:k,tenantId:Q,workspaceId:e||"",projectId:t||"",assistantId:f?.id||"",fileName:y},isMatch:Y=>Y.resourcePath===k}),m.success("Pinned to menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),ne(null),U(""),He(""),ce(Y=>{let H={...Y};return delete H[k],H})}catch(y){m.error(y.message||"Failed to pin")}finally{ft(!1)}},qt=(0,ie.useCallback)(async(y,Y)=>{ce(H=>({...H,[y]:{...H[y],loading:!0}}));try{await D(Y),m.success("Unpinned from menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),ce(H=>({...H,[y]:{isPinned:!1,pinnedId:null,loading:!1}}))}catch(H){m.error(H.message||"Failed to unpin"),ce(_=>({..._,[y]:{..._[y],loading:!1}}))}},[D,m]),Un=(0,ie.useCallback)(async y=>{Z(y);try{let Y=await j(y,f?.id),H=URL.createObjectURL(Y),_=document.createElement("a");_.href=H;let Ke=y.replace(/\/$/,"").split("/").pop()||"folder";_.download=`${Ke}.zip`,_.click(),window.setTimeout(()=>URL.revokeObjectURL(H),0)}catch(Y){m.error(Y instanceof Error?Y.message:"Failed to download folder")}finally{Z(null)}},[j,f?.id,m]),Bo=ie.default.useCallback((y,Y)=>{let H=rn(y);if(y.is_dir){let _=c[y.path]||!1,Ke=a[y.path]||[],ha=d[y.path]||!1;return(0,h.jsxs)("div",{className:g.treeChildren,children:[(0,h.jsxs)("div",{className:g.treeRow,children:[Array.from({length:Y}).map((Xe,ba)=>(0,h.jsx)("span",{className:g.treeIndent},`${y.path}-indent-${ba}`)),(0,h.jsx)("button",{type:"button",className:g.treeToggle,"aria-label":`${_?"collapse":"expand"} ${H}`,onClick:()=>void x(y.path),children:(0,h.jsx)(Nt,{size:14,style:{transform:_?"rotate(90deg)":void 0}})}),(0,h.jsxs)("button",{type:"button",className:g.assetItem,"aria-label":`toggle ${H}`,onClick:()=>void x(y.path),title:H,children:[(0,h.jsx)("div",{className:g.assetIcon,children:(0,h.jsx)(st,{size:14})}),(0,h.jsx)("div",{className:g.assetInfo,children:(0,h.jsx)("div",{className:g.assetName,children:H})})]}),(0,h.jsx)(qe,{trigger:["click"],onOpenChange:Xe=>Kt(y.path,Xe),menu:{items:[...$?T[y.path]?.isPinned?[{key:"unpin",icon:(0,h.jsx)(Ve,{size:14}),label:"Unpin from Menu",onClick:()=>{let Xe=T[y.path];Xe?.pinnedId&&qt(y.path,Xe.pinnedId)}}]:[{key:"pin",icon:(0,h.jsx)(Ve,{size:14}),label:"Pin to Menu",onClick:()=>{ne(y.path),U(H),He("")}}]:[],{key:"preview",icon:(0,h.jsx)(Qt,{}),label:"Preview",onClick:()=>{let Xe=A(y.path);Xe&&ee({component_key:"attachments",data:{file_id:y.path,url:Xe},message:H})}},{key:"share",icon:(0,h.jsx)(Yt,{}),label:"Share",onClick:()=>B(y.path)},{key:"download-folder",icon:(0,h.jsx)(_o,{}),label:"Download",disabled:J===y.path,onClick:()=>{Un(y.path)}}]},children:(0,h.jsx)(z,{type:"text",size:"small",icon:(0,h.jsx)(yt,{})})})]}),_?ha?(0,h.jsx)("div",{className:g.loading,children:(0,h.jsx)(re,{size:"small"})}):Ke.length>0?Lt(Ke,fe,Ye).map(Xe=>Bo(Xe,Y+1)):(0,h.jsx)("div",{className:g.emptyState,children:"No files in this folder"}):null]},y.path)}return(0,h.jsxs)("div",{className:g.treeRow,children:[Array.from({length:Y}).map((_,Ke)=>(0,h.jsx)("span",{className:g.treeIndent},`${y.path}-indent-${Ke}`)),(0,h.jsx)("span",{className:g.treeSpacer}),(0,h.jsx)(je,{title:Ka(y),placement:"rightTop",children:(0,h.jsxs)("button",{type:"button",className:g.assetItem,onClick:()=>v(y),"aria-label":`open ${H}`,children:[(0,h.jsx)("div",{className:g.assetIcon,children:zr(H)}),(0,h.jsx)("div",{className:g.assetInfo,children:(0,h.jsx)("div",{className:g.assetName,children:H})})]})}),(0,h.jsx)(qe,{trigger:["click"],onOpenChange:_=>Kt(y.path,_),menu:{items:[...$?T[y.path]?.isPinned?[{key:"unpin",icon:(0,h.jsx)(Ve,{size:14}),label:"Unpin from Menu",onClick:()=>{let _=T[y.path];_?.pinnedId&&qt(y.path,_.pinnedId)}}]:[{key:"pin",icon:(0,h.jsx)(Ve,{size:14}),label:"Pin to Menu",onClick:()=>{ne(y.path),U(""),He("")}}]:[],{key:"preview",icon:(0,h.jsx)(Qt,{}),label:"Preview",onClick:()=>v(y)},{key:"download",icon:(0,h.jsx)(_o,{}),label:"Download",onClick:()=>{let _=W(y.path,f?.id);window.open(_,"_blank")}},{key:"share",icon:(0,h.jsx)(Yt,{}),label:"Share",onClick:()=>B(y.path)}]},children:(0,h.jsx)(z,{type:"text",size:"small",icon:(0,h.jsx)(yt,{})})})]},y.path)},[a,c,d,v,x,g,W,j,f?.id,$,T,Kt,qt,J,Un,fe,Ye]),Hn=(y,Y)=>{if(!y.is_dir)return Bo(y,Y);let H=rn(y);return(0,h.jsxs)("div",{className:g.treeChildren,children:[(0,h.jsxs)("div",{className:g.treeRow,children:[Array.from({length:Y}).map((_,Ke)=>(0,h.jsx)("span",{className:g.treeIndent},`${y.path}-indent-${Ke}`)),(0,h.jsx)("span",{className:g.treeSpacer}),(0,h.jsxs)("button",{type:"button",className:g.assetItem,title:H,children:[(0,h.jsx)("div",{className:g.assetIcon,children:(0,h.jsx)(st,{size:14})}),(0,h.jsx)("div",{className:g.assetInfo,children:(0,h.jsx)("div",{className:g.assetName,children:H})})]}),(0,h.jsx)(qe,{trigger:["click"],onOpenChange:_=>Kt(y.path,_),menu:{items:[...$?T[y.path]?.isPinned?[{key:"unpin",icon:(0,h.jsx)(Ve,{size:14}),label:"Unpin from Menu",onClick:()=>{let _=T[y.path];_?.pinnedId&&qt(y.path,_.pinnedId)}}]:[{key:"pin",icon:(0,h.jsx)(Ve,{size:14}),label:"Pin to Menu",onClick:()=>{ne(y.path),U(H),He("")}}]:[],{key:"preview",icon:(0,h.jsx)(Qt,{}),label:"Preview",onClick:()=>{let _=A(y.path);_&&ee({component_key:"attachments",data:{file_id:y.path,url:_},message:H})}},{key:"share",icon:(0,h.jsx)(Yt,{}),label:"Share",onClick:()=>B(y.path)}]},children:(0,h.jsx)(z,{type:"text",size:"small",icon:(0,h.jsx)(yt,{})})})]}),y.children&&y.children.length>0?Lt(y.children,fe,Ye).map(_=>Hn(_,Y+1)):null]},y.path)};return t?(0,h.jsxs)("div",{className:g.container,children:[(0,h.jsxs)("h3",{className:g.header,children:[(0,h.jsx)(st,{size:16}),(0,h.jsx)("span",{children:"Files"})]}),(0,h.jsxs)("div",{className:g.toolbar,children:[(0,h.jsx)(K,{size:"small",placeholder:"Search files\u2026",allowClear:!0,value:rt,onChange:y=>O(y.target.value)}),(0,h.jsxs)("div",{className:g.toolbarRow,children:[(0,h.jsx)(Ne,{size:"small",style:{flex:1,minWidth:0},value:fe,onChange:y=>it(y),options:[{value:"name",label:"Name"},{value:"created",label:"Created"},{value:"modified",label:"Modified"}]}),(0,h.jsx)(z,{size:"small",icon:Ye==="asc"?(0,h.jsx)(Xt,{}):(0,h.jsx)(Jt,{}),onClick:()=>ga(y=>y==="asc"?"desc":"asc"),title:Ye==="asc"?"Ascending":"Descending"})]})]}),Ht!==null?(0,h.jsx)("div",{className:g.assetList,children:fa?(0,h.jsx)("div",{className:g.loading,children:(0,h.jsx)(re,{size:"small"})}):No&&No.length>0?No.map(y=>Hn(y,0)):(0,h.jsxs)("div",{className:g.emptyState,children:['No files match "',rt.trim(),'"']})}):o.map(y=>{let Y=r[y.name]||[],H=s[y.name]||!1,_=Y.length;return(0,h.jsxs)("div",{className:g.section,children:[(0,h.jsxs)("div",{className:g.sectionHeader,children:[(0,h.jsx)("span",{className:g.sectionTitle,onClick:()=>void u(y),title:"Click to refresh",children:y.displayName||y.name}),(0,h.jsx)("span",{className:g.badge,children:_})]}),H?(0,h.jsx)("div",{className:g.loading,children:(0,h.jsx)(re,{size:"small"})}):(0,h.jsxs)("div",{className:g.assetList,children:[Lt(Y,fe,Ye).map(Ke=>Bo(Ke,0)),Y.length===0?(0,h.jsx)("div",{className:g.emptyState,children:"No files in this folder"}):null,y.allowUpload?(0,h.jsx)("button",{type:"button",className:g.uploadBtn,onClick:()=>void b(y.name),disabled:!e||!t||p===y.name,children:p===y.name?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(re,{size:"small"}),(0,h.jsx)("span",{children:"Uploading..."})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Mr,{size:14}),(0,h.jsx)("span",{children:"Upload"})]})}):null]})]},y.name)}),S&&(0,h.jsx)(Fr,{open:!!S,filePath:S,assistantId:f?.id,fileName:S.split("/").pop(),onClose:()=>B(null)}),(0,h.jsx)(me,{title:"Pin to Menu",open:!!k,onOk:ya,onCancel:()=>ne(null),confirmLoading:Ze,okText:"Pin",children:(0,h.jsxs)("div",{style:qa,children:[(0,h.jsx)(K,{placeholder:"Menu name (required)",value:F,onChange:y=>U(y.target.value)}),(0,h.jsx)(Vt,{placeholder:"Group (optional, select or type new)",value:We,options:R.map(y=>({value:y})),onChange:y=>He(y),filterOption:(y,Y)=>Y?.value?.toUpperCase().includes(y.toUpperCase())??!1})]})})]}):(0,h.jsx)("div",{className:g.emptyState,children:"Please select a project to browse files"})};var si=n(i());var nm=C(({token:e,css:t})=>({root:t`
|
|
970
|
+
`})),si=e=>{if(!e)return"";let t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString()},Ha=e=>{if(!e)return"";let t=e.split(/[/\\]/);return t[t.length-1]},an=e=>Ha(e.name||e.path),Ka=e=>(0,h.jsxs)("div",{children:[(0,h.jsx)("div",{style:{fontWeight:600},children:an(e)}),e.created_at?(0,h.jsxs)("div",{children:["Created: ",si(e.created_at)]}):null,e.modified_at?(0,h.jsxs)("div",{children:["Modified: ",si(e.modified_at)]}):null]}),qa={display:"flex",flexDirection:"column",gap:12},sn=({workspaceId:e,projectId:t,resourceFolders:o,folderEntries:r,folderLoading:s,directoryChildren:a,directoryLoading:d,directoryExpanded:c,uploadingFolder:p,onRefreshFolder:u,onUploadFolder:b,onToggleDirectory:x,onAssetClick:v})=>{let{styles:g}=Ua(),{message:m}=Fo.useApp(),{currentAssistant:f}=et(),{getFileDownloadUrl:W,downloadFolder:j,getDirectFileUrl:A,listPathByFolder:X}=Se(),{openSideApp:ee}=ke(),{currentTenant:pe}=Oe(),Q=pe?.id||"",[S,B]=(0,ie.useState)(null),[J,Z]=(0,ie.useState)(null),{check:E,pin:se,unpin:D,enableCustomMenu:$,get:le}=uo(),L=ln(),[R,I]=(0,ie.useState)(L);(0,ie.useEffect)(()=>{I(L)},[L]);let[T,ce]=(0,ie.useState)({}),[k,ne]=(0,ie.useState)(null),[F,U]=(0,ie.useState)(""),[We,He]=(0,ie.useState)(""),[Ze,ft]=(0,ie.useState)(!1),[rt,O]=(0,ie.useState)(""),[fe,it]=(0,ie.useState)("name"),[Ye,fa]=(0,ie.useState)("asc"),[Ht,Mo]=(0,ie.useState)(null),[ya,No]=(0,ie.useState)(!1);(0,ie.useEffect)(()=>{k&&cn(le).then(y=>{I(Array.from(new Set([...L,...y])).sort())})},[k]),(0,ie.useEffect)(()=>{let y=rt.trim();if(!y){Mo(null),No(!1);return}let Y=!1;return No(!0),$r(X,o.map(H=>H.name),f?.id).then(H=>{Y||Mo(ii(H,y))}).catch(()=>{Y||Mo([])}).finally(()=>{Y||No(!1)}),()=>{Y=!0}},[rt,X,o,f?.id]);let Bo=(0,ie.useMemo)(()=>Ht?rn(ai(Ht),fe,Ye):null,[Ht,fe,Ye]),Kt=(0,ie.useCallback)((y,Y)=>{if(!Y||!$)return;ce(_=>_[y]?_:{..._,[y]:{isPinned:!1,pinnedId:null,loading:!0}});let H={contentType:"file",contentConfig:{resourcePath:y,tenantId:Q,workspaceId:e||"",projectId:t||"",assistantId:f?.id||"",fileName:y.split("/").pop()||y},isMatch:_=>_.resourcePath===y};E(H).then(_=>{ce(Ke=>({...Ke,[y]:{..._,loading:!1}}))}).catch(()=>{ce(_=>({..._,[y]:{isPinned:!1,pinnedId:null,loading:!1}}))})},[$,E,f?.id]),ha=async()=>{if(!k||!F.trim()){m.warning("Please enter a menu name");return}ft(!0);try{let y=k.split("/").pop()||k;await se({contentType:"file",name:F.trim(),group:We.trim()||void 0,contentConfig:{resourcePath:k,tenantId:Q,workspaceId:e||"",projectId:t||"",assistantId:f?.id||"",fileName:y},isMatch:Y=>Y.resourcePath===k}),m.success("Pinned to menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),ne(null),U(""),He(""),ce(Y=>{let H={...Y};return delete H[k],H})}catch(y){m.error(y.message||"Failed to pin")}finally{ft(!1)}},qt=(0,ie.useCallback)(async(y,Y)=>{ce(H=>({...H,[y]:{...H[y],loading:!0}}));try{await D(Y),m.success("Unpinned from menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),ce(H=>({...H,[y]:{isPinned:!1,pinnedId:null,loading:!1}}))}catch(H){m.error(H.message||"Failed to unpin"),ce(_=>({..._,[y]:{..._[y],loading:!1}}))}},[D,m]),Hn=(0,ie.useCallback)(async y=>{Z(y);try{let Y=await j(y,f?.id),H=URL.createObjectURL(Y),_=document.createElement("a");_.href=H;let Ke=y.replace(/\/$/,"").split("/").pop()||"folder";_.download=`${Ke}.zip`,_.click(),window.setTimeout(()=>URL.revokeObjectURL(H),0)}catch(Y){m.error(Y instanceof Error?Y.message:"Failed to download folder")}finally{Z(null)}},[j,f?.id,m]),Do=ie.default.useCallback((y,Y)=>{let H=an(y);if(y.is_dir){let _=c[y.path]||!1,Ke=a[y.path]||[],ba=d[y.path]||!1;return(0,h.jsxs)("div",{className:g.treeChildren,children:[(0,h.jsxs)("div",{className:g.treeRow,children:[Array.from({length:Y}).map((Xe,va)=>(0,h.jsx)("span",{className:g.treeIndent},`${y.path}-indent-${va}`)),(0,h.jsx)("button",{type:"button",className:g.treeToggle,"aria-label":`${_?"collapse":"expand"} ${H}`,onClick:()=>void x(y.path),children:(0,h.jsx)(Nt,{size:14,style:{transform:_?"rotate(90deg)":void 0}})}),(0,h.jsxs)("button",{type:"button",className:g.assetItem,"aria-label":`toggle ${H}`,onClick:()=>void x(y.path),title:H,children:[(0,h.jsx)("div",{className:g.assetIcon,children:(0,h.jsx)(st,{size:14})}),(0,h.jsx)("div",{className:g.assetInfo,children:(0,h.jsx)("div",{className:g.assetName,children:H})})]}),(0,h.jsx)(qe,{trigger:["click"],onOpenChange:Xe=>Kt(y.path,Xe),menu:{items:[...$?T[y.path]?.isPinned?[{key:"unpin",icon:(0,h.jsx)(Ve,{size:14}),label:"Unpin from Menu",onClick:()=>{let Xe=T[y.path];Xe?.pinnedId&&qt(y.path,Xe.pinnedId)}}]:[{key:"pin",icon:(0,h.jsx)(Ve,{size:14}),label:"Pin to Menu",onClick:()=>{ne(y.path),U(H),He("")}}]:[],{key:"preview",icon:(0,h.jsx)(Qt,{}),label:"Preview",onClick:()=>{let Xe=A(y.path);Xe&&ee({component_key:"attachments",data:{file_id:y.path,url:Xe},message:H})}},{key:"share",icon:(0,h.jsx)(Yt,{}),label:"Share",onClick:()=>B(y.path)},{key:"download-folder",icon:(0,h.jsx)(Lo,{}),label:"Download",disabled:J===y.path,onClick:()=>{Hn(y.path)}}]},children:(0,h.jsx)(z,{type:"text",size:"small",icon:(0,h.jsx)(yt,{})})})]}),_?ba?(0,h.jsx)("div",{className:g.loading,children:(0,h.jsx)(re,{size:"small"})}):Ke.length>0?Lt(Ke,fe,Ye).map(Xe=>Do(Xe,Y+1)):(0,h.jsx)("div",{className:g.emptyState,children:"No files in this folder"}):null]},y.path)}return(0,h.jsxs)("div",{className:g.treeRow,children:[Array.from({length:Y}).map((_,Ke)=>(0,h.jsx)("span",{className:g.treeIndent},`${y.path}-indent-${Ke}`)),(0,h.jsx)("span",{className:g.treeSpacer}),(0,h.jsx)(je,{title:Ka(y),placement:"rightTop",children:(0,h.jsxs)("button",{type:"button",className:g.assetItem,onClick:()=>v(y),"aria-label":`open ${H}`,children:[(0,h.jsx)("div",{className:g.assetIcon,children:jr(H)}),(0,h.jsx)("div",{className:g.assetInfo,children:(0,h.jsx)("div",{className:g.assetName,children:H})})]})}),(0,h.jsx)(qe,{trigger:["click"],onOpenChange:_=>Kt(y.path,_),menu:{items:[...$?T[y.path]?.isPinned?[{key:"unpin",icon:(0,h.jsx)(Ve,{size:14}),label:"Unpin from Menu",onClick:()=>{let _=T[y.path];_?.pinnedId&&qt(y.path,_.pinnedId)}}]:[{key:"pin",icon:(0,h.jsx)(Ve,{size:14}),label:"Pin to Menu",onClick:()=>{ne(y.path),U(""),He("")}}]:[],{key:"preview",icon:(0,h.jsx)(Qt,{}),label:"Preview",onClick:()=>v(y)},{key:"download",icon:(0,h.jsx)(Lo,{}),label:"Download",onClick:()=>{let _=W(y.path,f?.id);window.open(_,"_blank")}},{key:"share",icon:(0,h.jsx)(Yt,{}),label:"Share",onClick:()=>B(y.path)}]},children:(0,h.jsx)(z,{type:"text",size:"small",icon:(0,h.jsx)(yt,{})})})]},y.path)},[a,c,d,v,x,g,W,j,f?.id,$,T,Kt,qt,J,Hn,fe,Ye]),Kn=(y,Y)=>{if(!y.is_dir)return Do(y,Y);let H=an(y);return(0,h.jsxs)("div",{className:g.treeChildren,children:[(0,h.jsxs)("div",{className:g.treeRow,children:[Array.from({length:Y}).map((_,Ke)=>(0,h.jsx)("span",{className:g.treeIndent},`${y.path}-indent-${Ke}`)),(0,h.jsx)("span",{className:g.treeSpacer}),(0,h.jsxs)("button",{type:"button",className:g.assetItem,title:H,children:[(0,h.jsx)("div",{className:g.assetIcon,children:(0,h.jsx)(st,{size:14})}),(0,h.jsx)("div",{className:g.assetInfo,children:(0,h.jsx)("div",{className:g.assetName,children:H})})]}),(0,h.jsx)(qe,{trigger:["click"],onOpenChange:_=>Kt(y.path,_),menu:{items:[...$?T[y.path]?.isPinned?[{key:"unpin",icon:(0,h.jsx)(Ve,{size:14}),label:"Unpin from Menu",onClick:()=>{let _=T[y.path];_?.pinnedId&&qt(y.path,_.pinnedId)}}]:[{key:"pin",icon:(0,h.jsx)(Ve,{size:14}),label:"Pin to Menu",onClick:()=>{ne(y.path),U(H),He("")}}]:[],{key:"preview",icon:(0,h.jsx)(Qt,{}),label:"Preview",onClick:()=>{let _=A(y.path);_&&ee({component_key:"attachments",data:{file_id:y.path,url:_},message:H})}},{key:"share",icon:(0,h.jsx)(Yt,{}),label:"Share",onClick:()=>B(y.path)}]},children:(0,h.jsx)(z,{type:"text",size:"small",icon:(0,h.jsx)(yt,{})})})]}),y.children&&y.children.length>0?Lt(y.children,fe,Ye).map(_=>Kn(_,Y+1)):null]},y.path)};return t?(0,h.jsxs)("div",{className:g.container,children:[(0,h.jsxs)("h3",{className:g.header,children:[(0,h.jsx)(st,{size:16}),(0,h.jsx)("span",{children:"Files"})]}),(0,h.jsxs)("div",{className:g.toolbar,children:[(0,h.jsx)(K,{size:"small",placeholder:"Search files\u2026",allowClear:!0,value:rt,onChange:y=>O(y.target.value)}),(0,h.jsxs)("div",{className:g.toolbarRow,children:[(0,h.jsx)(Ne,{size:"small",style:{flex:1,minWidth:0},value:fe,onChange:y=>it(y),options:[{value:"name",label:"Name"},{value:"created",label:"Created"},{value:"modified",label:"Modified"}]}),(0,h.jsx)(z,{size:"small",icon:Ye==="asc"?(0,h.jsx)(Xt,{}):(0,h.jsx)(Jt,{}),onClick:()=>fa(y=>y==="asc"?"desc":"asc"),title:Ye==="asc"?"Ascending":"Descending"})]})]}),Ht!==null?(0,h.jsx)("div",{className:g.assetList,children:ya?(0,h.jsx)("div",{className:g.loading,children:(0,h.jsx)(re,{size:"small"})}):Bo&&Bo.length>0?Bo.map(y=>Kn(y,0)):(0,h.jsxs)("div",{className:g.emptyState,children:['No files match "',rt.trim(),'"']})}):o.map(y=>{let Y=r[y.name]||[],H=s[y.name]||!1,_=Y.length;return(0,h.jsxs)("div",{className:g.section,children:[(0,h.jsxs)("div",{className:g.sectionHeader,children:[(0,h.jsx)("span",{className:g.sectionTitle,onClick:()=>void u(y),title:"Click to refresh",children:y.displayName||y.name}),(0,h.jsx)("span",{className:g.badge,children:_})]}),H?(0,h.jsx)("div",{className:g.loading,children:(0,h.jsx)(re,{size:"small"})}):(0,h.jsxs)("div",{className:g.assetList,children:[Lt(Y,fe,Ye).map(Ke=>Do(Ke,0)),Y.length===0?(0,h.jsx)("div",{className:g.emptyState,children:"No files in this folder"}):null,y.allowUpload?(0,h.jsx)("button",{type:"button",className:g.uploadBtn,onClick:()=>void b(y.name),disabled:!e||!t||p===y.name,children:p===y.name?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(re,{size:"small"}),(0,h.jsx)("span",{children:"Uploading..."})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Nr,{size:14}),(0,h.jsx)("span",{children:"Upload"})]})}):null]})]},y.name)}),S&&(0,h.jsx)(zr,{open:!!S,filePath:S,assistantId:f?.id,fileName:S.split("/").pop(),onClose:()=>B(null)}),(0,h.jsx)(me,{title:"Pin to Menu",open:!!k,onOk:ha,onCancel:()=>ne(null),confirmLoading:Ze,okText:"Pin",children:(0,h.jsxs)("div",{style:qa,children:[(0,h.jsx)(K,{placeholder:"Menu name (required)",value:F,onChange:y=>U(y.target.value)}),(0,h.jsx)(Vt,{placeholder:"Group (optional, select or type new)",value:We,options:R.map(y=>({value:y})),onChange:y=>He(y),filterOption:(y,Y)=>Y?.value?.toUpperCase().includes(y.toUpperCase())??!1})]})})]}):(0,h.jsx)("div",{className:g.emptyState,children:"Please select a project to browse files"})};var li=n(i());var nm=C(({token:e,css:t})=>({root:t`
|
|
971
971
|
display: flex;
|
|
972
972
|
flex-direction: column;
|
|
973
973
|
height: 100%;
|
|
@@ -992,7 +992,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
992
992
|
flex: 1;
|
|
993
993
|
min-height: 0;
|
|
994
994
|
overflow: hidden;
|
|
995
|
-
`}));var
|
|
995
|
+
`}));var ci=n(i());var Im=C(({token:e,css:t})=>({root:t`
|
|
996
996
|
display: flex;
|
|
997
997
|
flex-direction: column;
|
|
998
998
|
height: 100%;
|
|
@@ -1084,7 +1084,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1084
1084
|
height: 100%;
|
|
1085
1085
|
width: 100%;
|
|
1086
1086
|
overflow: hidden;
|
|
1087
|
-
`}));var
|
|
1087
|
+
`}));var di=n(i()),qm=C(({token:e,css:t})=>({menuList:t`
|
|
1088
1088
|
height: 100%;
|
|
1089
1089
|
overflow-y: auto;
|
|
1090
1090
|
`,empty:t`
|
|
@@ -1105,7 +1105,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1105
1105
|
flex: 1;
|
|
1106
1106
|
min-height: 0;
|
|
1107
1107
|
overflow: hidden;
|
|
1108
|
-
`}));var
|
|
1108
|
+
`}));var ui=n(w());var mn=n(w());var pi=n(i()),eu=C(({token:e,css:t})=>({container:t`
|
|
1109
1109
|
display: flex;
|
|
1110
1110
|
flex-direction: column;
|
|
1111
1111
|
height: 100%;
|
|
@@ -1192,7 +1192,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1192
1192
|
color: ${e.colorPrimary};
|
|
1193
1193
|
`,emptyContainer:t`
|
|
1194
1194
|
padding: 24px 16px;
|
|
1195
|
-
`}));var
|
|
1195
|
+
`}));var mi=n(i()),nu=C(({token:e,css:t})=>({container:t`
|
|
1196
1196
|
display: flex;
|
|
1197
1197
|
flex-direction: column;
|
|
1198
1198
|
height: 100%;
|
|
@@ -1285,7 +1285,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1285
1285
|
display: flex;
|
|
1286
1286
|
flex-direction: column;
|
|
1287
1287
|
gap: 12px;
|
|
1288
|
-
`}));var
|
|
1288
|
+
`}));var un=n(i()),fu=C(({token:e,css:t})=>({menuList:t`
|
|
1289
1289
|
height: 100%;
|
|
1290
1290
|
overflow-y: auto;
|
|
1291
1291
|
`,header:t`
|
|
@@ -1337,7 +1337,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1337
1337
|
flex: 1;
|
|
1338
1338
|
min-height: 0;
|
|
1339
1339
|
overflow: hidden;
|
|
1340
|
-
`}));var
|
|
1340
|
+
`}));var fi=n(i()),Eu=C(({token:e,css:t})=>({outer:t`
|
|
1341
1341
|
display: flex;
|
|
1342
1342
|
flex-direction: column;
|
|
1343
1343
|
height: 100%;
|
|
@@ -1424,7 +1424,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1424
1424
|
&.active {
|
|
1425
1425
|
color: ${e.colorPrimary};
|
|
1426
1426
|
}
|
|
1427
|
-
`}));var ls=n(i());var Wt=n(w());var
|
|
1427
|
+
`}));var ls=n(i());var Wt=n(w());var go=18,Uu={agent:Wt.default.createElement(Mt,{size:go}),html:Wt.default.createElement(wr,{size:go}),custom:Wt.default.createElement(Ar,{size:go}),file:Wt.default.createElement(vr,{size:go})};var xs=n(w());var cs=n(w());var yi=n(i());var Ii=n(w());var fo=n(w());var pt=n(w());function hi(e){let{get:t}=ue(),[o,r]=(0,pt.useState)(null),[s,a]=(0,pt.useState)(!0),[d,c]=(0,pt.useState)(!1);(0,pt.useEffect)(()=>{let b=!0,x=e||"/api/middleware-types";return a(!0),c(!1),r(null),t(x).then(v=>{if(!b)return;if(!Array.isArray(v)||v.length===0){c(!0);return}let g=v.map(m=>({type:m.type,name:m.name,description:m.description,icon:m.icon,tools:Array.isArray(m.tools)?m.tools.map(f=>({id:f.name,name:f.name,description:f.description})):[],schema:m.configSchema,defaultConfig:m.defaultConfig||{},category:m.category,capabilityBundleEligible:m.capabilityBundleEligible===!0,connectionSchema:m.connectionSchema?{fields:m.connectionSchema.fields,hasTest:m.connectionSchema.hasTest,hasDiscover:m.connectionSchema.hasDiscover,resourceLabel:m.connectionSchema.resourceLabel}:void 0}));r(g)}).catch(()=>{b&&c(!0)}).finally(()=>{b&&a(!1)}),()=>{b=!1}},[e,t]);let p=new Set(["topology"]);return{middlewareTypes:(0,pt.useMemo)(()=>(o||er).filter(b=>!p.has(b.type)),[o]),isLoading:s,isFallback:d}}var bi=C(({token:e,css:t})=>({nav:t`
|
|
1428
1428
|
width: clamp(180px, 20vw, 240px);
|
|
1429
1429
|
flex-shrink: 0;
|
|
1430
1430
|
border-right: 1px solid ${e.colorBorderSecondary};
|
|
@@ -1538,7 +1538,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1538
1538
|
height: 6px;
|
|
1539
1539
|
border-radius: 9999px;
|
|
1540
1540
|
flex-shrink: 0;
|
|
1541
|
-
`}));var
|
|
1541
|
+
`}));var vi=n(i()),{Text:tg}=P;var ge=n(w());var mt=n(w());var $e=n(i()),{Text:xi}=P,wi=({connectionType:e,value:t=[],onChange:o})=>{let{token:r}=Le.useToken(),{get:s}=ue(),[a,d]=(0,mt.useState)([]),[c,p]=(0,mt.useState)(!0),u=(0,mt.useRef)(e),b=(0,mt.useRef)(o);b.current=o,(0,mt.useEffect)(()=>{let v=!0;return u.current!==e&&(u.current=e,b.current([])),d([]),p(!0),s(`/api/connections?type=${encodeURIComponent(e)}`).then(g=>{v&&(Array.isArray(g)?d(g):g?.data?.records&&d(g.data.records))}).catch(()=>{v&&d([])}).finally(()=>{v&&p(!1)}),()=>{v=!1}},[e,s]);let x=new Set(t);return c?(0,$e.jsx)("div",{style:{textAlign:"center",padding:20},children:(0,$e.jsx)(re,{size:"small"})}):a.length===0?(0,$e.jsx)(xe,{description:`No "${e}" connections`,image:xe.PRESENTED_IMAGE_SIMPLE}):(0,$e.jsxs)("div",{children:[(0,$e.jsxs)(de,{style:{marginBottom:8},children:[(0,$e.jsx)(z,{size:"small",onClick:()=>o(a.map(v=>v.key)),children:"Select All"}),(0,$e.jsx)(z,{size:"small",onClick:()=>o([]),children:"Deselect All"})]}),(0,$e.jsx)(Pe,{size:"small",style:{maxHeight:"30vh",overflowY:"auto"},children:a.map(v=>(0,$e.jsx)(Pe.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:r.borderRadius,backgroundColor:x.has(v.key)?r.colorPrimaryBg:"transparent",border:`1px solid ${x.has(v.key)?r.colorPrimary:"transparent"}`,marginBottom:4},onClick:()=>{x.has(v.key)?o(t.filter(g=>g!==v.key)):o([...t,v.key])},children:(0,$e.jsx)(Pe.Item.Meta,{avatar:(0,$e.jsx)(_e,{checked:x.has(v.key)}),title:(0,$e.jsx)(xi,{style:{fontSize:12},children:v.name}),description:v.description?(0,$e.jsx)(xi,{type:"secondary",style:{fontSize:10},children:v.description}):void 0})},v.key))})]})};var l=n(i()),{Text:we}=P,gn=C(({token:e,css:t})=>({pageHeader:t`
|
|
1542
1542
|
display: flex;
|
|
1543
1543
|
align-items: center;
|
|
1544
1544
|
gap: 16px;
|
|
@@ -1607,7 +1607,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1607
1607
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1608
1608
|
gap: 12px 16px;
|
|
1609
1609
|
padding: 8px 0;
|
|
1610
|
-
`})),fo=({title:e,selectedCount:t,totalCount:o,searchPlaceholder:r,searchText:s,onSearchChange:a,onSelectAll:d,onClearAll:c,children:p,styles:u})=>{let b=o>0&&t===o;return(0,l.jsxs)("div",{className:u.dataSection,children:[(0,l.jsxs)("div",{className:u.dataSectionHeader,children:[(0,l.jsxs)(we,{strong:!0,style:{fontSize:13},children:[e,(0,l.jsxs)(we,{type:"secondary",style:{fontSize:12,marginLeft:8},children:[t," / ",o," selected"]})]}),(0,l.jsx)(de,{size:4,children:(0,l.jsx)(z,{type:"link",size:"small",onClick:b?c:d,children:b?"Clear":"Select All"})})]}),(0,l.jsx)("div",{style:{marginBottom:10},children:(0,l.jsx)(K,{size:"small",allowClear:!0,prefix:(0,l.jsx)(dr,{style:{fontSize:12}}),placeholder:r,value:s,onChange:x=>a(x.target.value),style:{width:"100%"}})}),(0,l.jsx)("div",{className:u.dataList,children:p})]})},ds=({text:e,className:t})=>(0,l.jsx)(je,{title:e,placement:"topLeft",children:(0,l.jsx)("div",{className:t,children:e})}),ps=({tools:e,selectedToolNames:t,allToolNames:o,onChange:r,styles:s})=>{let a=e.length>0&&t.length===o.length,d=c=>{if(t.includes(c)){let p=t.filter(u=>u!==c);r(p.length===0?void 0:p)}else{let p=[...t,c];r(p.length===o.length&&o.every(u=>p.includes(u))?void 0:p)}};return(0,l.jsxs)("div",{className:s.dataSection,children:[(0,l.jsxs)("div",{className:s.dataSectionHeader,children:[(0,l.jsxs)(we,{strong:!0,style:{fontSize:13},children:["Tools",(0,l.jsxs)(we,{type:"secondary",style:{fontSize:12,marginLeft:8},children:[t.length," / ",o.length," selected"]})]}),(0,l.jsx)(de,{size:4,children:(0,l.jsx)(z,{type:"link",size:"small",onClick:()=>r(a?[]:void 0),children:a?"Clear":"Select All"})})]}),(0,l.jsx)("div",{className:s.toolsGrid,children:e.map(c=>{let p=t.includes(c.name);return(0,l.jsx)(Dt,{item:c,dense:!0,className:p?s.selectedCard:void 0,onClick:()=>d(c.name),renderIcon:()=>(0,l.jsx)("span",{style:{fontSize:14,fontWeight:600},children:c.name.charAt(0).toUpperCase()}),renderPrimary:()=>c.name,renderDetails:()=>(0,l.jsx)(ds,{text:c.description,className:s.toolDesc}),renderHeaderActions:()=>(0,l.jsx)(_e,{checked:p,onClick:u=>u.stopPropagation(),onChange:()=>d(c.name)})},c.id)})})]})},ms=({value:e,onChange:t,token:o,styles:r})=>{let[s,a]=(0,ge.useState)([]),[d,c]=(0,ge.useState)(!1),[p,u]=(0,ge.useState)(""),{get:b}=ue(),x=(0,ge.useRef)(!1);(0,ge.useEffect)(()=>{if(x.current)return;x.current=!0,(async()=>{c(!0);try{let f=await b("/api/skills");f.success&&f.data&&Array.isArray(f.data.records)&&a(f.data.records)}catch(f){console.error("Failed to fetch skills:",f)}finally{c(!1)}})()},[b]);let v=Array.isArray(e)?e:[],g=s.filter(m=>m.name.toLowerCase().includes(p.toLowerCase())||m.description.toLowerCase().includes(p.toLowerCase()));return(0,l.jsx)(fo,{title:"Skill Library",selectedCount:v.length,totalCount:s.length,searchPlaceholder:"Search skills\u2026",searchText:p,onSearchChange:u,onSelectAll:()=>t(s.map(m=>m.id)),onClearAll:()=>t([]),styles:r,children:d?(0,l.jsx)("div",{style:{textAlign:"center",padding:20},children:(0,l.jsx)(re,{size:"small"})}):g.length===0?(0,l.jsx)(xe,{description:"No skills available",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):(0,l.jsx)(Pe,{dataSource:g,split:!1,size:"small",renderItem:m=>{let f=v.includes(m.id);return(0,l.jsx)(Pe.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:o.borderRadius,backgroundColor:f?o.colorSuccessBg:"transparent",border:`1px solid ${f?o.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.15s ease"},onClick:()=>t(f?v.filter(W=>W!==m.id):[...v,m.id]),children:(0,l.jsx)(Pe.Item.Meta,{avatar:(0,l.jsx)(_e,{checked:f}),title:(0,l.jsx)(we,{strong:f,style:{fontSize:13},children:m.name}),description:(0,l.jsx)(we,{type:"secondary",style:{fontSize:12},ellipsis:!0,children:m.description})})},m.id)}})})},us=({value:e,onChange:t,token:o,styles:r})=>{let[s,a]=(0,ge.useState)([]),[d,c]=(0,ge.useState)(!1),[p,u]=(0,ge.useState)(""),{get:b}=ue(),x=(0,ge.useRef)(!1);(0,ge.useEffect)(()=>{if(x.current)return;x.current=!0,(async()=>{c(!0);try{let f=await b("/api/database-configs");f.success&&f.data&&Array.isArray(f.data.records)&&a(f.data.records)}catch(f){console.error("Failed to fetch database configs:",f)}finally{c(!1)}})()},[b]);let v=Array.isArray(e)?e:[],g=s.filter(m=>(m.name||m.key).toLowerCase().includes(p.toLowerCase())||(m.description||"").toLowerCase().includes(p.toLowerCase()));return(0,l.jsx)(fo,{title:"Databases",selectedCount:v.length,totalCount:s.length,searchPlaceholder:"Search databases\u2026",searchText:p,onSearchChange:u,onSelectAll:()=>t(s.map(m=>m.key)),onClearAll:()=>t([]),styles:r,children:d?(0,l.jsx)("div",{style:{textAlign:"center",padding:20},children:(0,l.jsx)(re,{size:"small"})}):g.length===0?(0,l.jsx)(xe,{description:"No databases available",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):(0,l.jsx)(Pe,{dataSource:g,split:!1,size:"small",renderItem:m=>{let f=v.includes(m.key);return(0,l.jsx)(Pe.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:o.borderRadius,backgroundColor:f?o.colorSuccessBg:"transparent",border:`1px solid ${f?o.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.15s ease"},onClick:()=>t(f?v.filter(W=>W!==m.key):[...v,m.key]),children:(0,l.jsx)(Pe.Item.Meta,{avatar:(0,l.jsx)(_e,{checked:f}),title:(0,l.jsx)(we,{strong:f,style:{fontSize:13},children:m.name||m.key}),description:m.description?(0,l.jsx)(we,{type:"secondary",style:{fontSize:12},ellipsis:!0,children:m.description}):void 0})},m.key)}})})},gs=({value:e,onChange:t,token:o,styles:r})=>{let[s,a]=(0,ge.useState)([]),[d,c]=(0,ge.useState)(!1),[p,u]=(0,ge.useState)(""),{get:b}=ue(),x=(0,ge.useRef)(!1);(0,ge.useEffect)(()=>{if(x.current)return;x.current=!0,(async()=>{c(!0);try{let f=await b("/api/metrics-configs");f.success&&f.data&&Array.isArray(f.data.records)&&a(f.data.records)}catch(f){console.error("Failed to fetch metrics configs:",f)}finally{c(!1)}})()},[b]);let v=Array.isArray(e)?e:[],g=s.filter(m=>(m.name||m.key).toLowerCase().includes(p.toLowerCase())||(m.description||"").toLowerCase().includes(p.toLowerCase()));return(0,l.jsx)(fo,{title:"Metrics Servers",selectedCount:v.length,totalCount:s.length,searchPlaceholder:"Search servers\u2026",searchText:p,onSearchChange:u,onSelectAll:()=>t(s.map(m=>m.key)),onClearAll:()=>t([]),styles:r,children:d?(0,l.jsx)("div",{style:{textAlign:"center",padding:20},children:(0,l.jsx)(re,{size:"small"})}):g.length===0?(0,l.jsx)(xe,{description:"No servers available",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):(0,l.jsx)(Pe,{dataSource:g,split:!1,size:"small",renderItem:m=>{let f=v.includes(m.key);return(0,l.jsx)(Pe.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:o.borderRadius,backgroundColor:f?o.colorSuccessBg:"transparent",border:`1px solid ${f?o.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.15s ease"},onClick:()=>t(f?v.filter(W=>W!==m.key):[...v,m.key]),children:(0,l.jsx)(Pe.Item.Meta,{avatar:(0,l.jsx)(_e,{checked:f}),title:(0,l.jsx)(we,{strong:f,style:{fontSize:13},children:m.name||m.key}),description:m.description?(0,l.jsx)(we,{type:"secondary",style:{fontSize:12},ellipsis:!0,children:m.description}):void 0})},m.key)}})})},fs=({value:e,onChange:t,token:o,styles:r})=>{let[s,a]=(0,ge.useState)([]),[d,c]=(0,ge.useState)(!1),[p,u]=(0,ge.useState)(""),{get:b}=ue(),x=(0,ge.useRef)(!1);(0,ge.useEffect)(()=>{x.current||(x.current=!0,c(!0),b("/api/collections").then(m=>{m.success&&a(m.data.records)}).catch(()=>{}).finally(()=>c(!1)))},[b]);let v=Array.isArray(e)?e:[],g=s.filter(m=>(m.label||m.name).toLowerCase().includes(p.toLowerCase())||m.name.toLowerCase().includes(p.toLowerCase()));return(0,l.jsx)(fo,{title:"Collections",selectedCount:v.length,totalCount:s.length,searchPlaceholder:"Search collections\u2026",searchText:p,onSearchChange:u,onSelectAll:()=>t(s.map(m=>m.name)),onClearAll:()=>t([]),styles:r,children:d?(0,l.jsx)("div",{style:{textAlign:"center",padding:20},children:(0,l.jsx)(re,{size:"small"})}):g.length===0?(0,l.jsx)(xe,{description:"No collections available",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):(0,l.jsx)(Pe,{dataSource:g,split:!1,size:"small",renderItem:m=>{let f=v.includes(m.name);return(0,l.jsx)(Pe.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:o.borderRadius,backgroundColor:f?o.colorSuccessBg:"transparent",border:`1px solid ${f?o.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.15s ease"},onClick:()=>t(f?v.filter(W=>W!==m.name):[...v,m.name]),children:(0,l.jsx)(Pe.Item.Meta,{avatar:(0,l.jsx)(_e,{checked:f}),title:(0,l.jsx)(we,{strong:f,style:{fontSize:13},children:m.label||m.name}),description:(0,l.jsx)(we,{type:"secondary",style:{fontSize:12},ellipsis:!0,children:m.name})})},m.name)}})})},ys=({value:e,onChange:t,token:o,styles:r})=>{let s=Array.isArray(e)?e:[],[a,d]=(0,ge.useState)({from:"",to:"",purpose:""}),c=()=>{!a.from.trim()||!a.to.trim()||!a.purpose.trim()||(t([...s,{...a}]),d({from:"",to:"",purpose:""}))};return(0,l.jsxs)("div",{className:r.dataSection,children:[(0,l.jsx)("div",{className:r.dataSectionHeader,children:(0,l.jsxs)(we,{strong:!0,style:{fontSize:13},children:["Dependencies",(0,l.jsxs)(we,{type:"secondary",style:{fontSize:12,marginLeft:8},children:[s.length," edges"]})]})}),(0,l.jsx)("div",{className:r.dataList,children:s.length===0?(0,l.jsx)(xe,{description:"No dependencies defined yet",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):s.map((p,u)=>(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 10px",marginBottom:4,borderRadius:o.borderRadius,backgroundColor:o.colorBgContainer,border:`1px solid ${o.colorBorderSecondary}`},children:[(0,l.jsx)(be,{color:"blue",style:{margin:0,fontSize:11},children:p.from}),(0,l.jsx)(we,{type:"secondary",style:{fontSize:12},children:"\u2192"}),(0,l.jsx)(be,{color:"green",style:{margin:0,fontSize:11},children:p.to}),(0,l.jsx)(we,{style:{fontSize:12,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.purpose}),(0,l.jsx)(z,{type:"text",size:"small",danger:!0,icon:(0,l.jsx)(nr,{}),onClick:()=>t(s.filter((b,x)=>x!==u))})]},u))}),(0,l.jsxs)("div",{style:{borderTop:`1px solid ${o.colorBorderSecondary}`,paddingTop:12,marginTop:12},children:[(0,l.jsx)(we,{strong:!0,style:{fontSize:13,display:"block",marginBottom:8},children:"Add Dependency"}),(0,l.jsxs)(de,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,l.jsx)(K,{size:"small",placeholder:"Source Agent ID",value:a.from,onChange:p=>d({...a,from:p.target.value})}),(0,l.jsx)(K,{size:"small",placeholder:"Target Agent ID",value:a.to,onChange:p=>d({...a,to:p.target.value})}),(0,l.jsx)(K,{size:"small",placeholder:"Purpose (e.g. classify invoice fields)",value:a.purpose,onChange:p=>d({...a,purpose:p.target.value}),onPressEnter:c}),(0,l.jsx)(z,{type:"dashed",size:"small",icon:(0,l.jsx)(lr,{}),onClick:c,disabled:!a.from.trim()||!a.to.trim()||!a.purpose.trim(),block:!0,children:"Add Edge"})]})]})]})},wi=(e,t,o,r,s)=>{let a=t.title||e,d=t.description?(0,l.jsx)(je,{title:t.description,children:(0,l.jsx)(cr,{style:{color:s.colorTextSecondary,cursor:"pointer"}})}):null;if(t.widget==="switch"||!t.widget&&t.type==="boolean")return{row:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,padding:"8px 0"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,l.jsx)(we,{style:{fontSize:13},children:a}),d]}),(0,l.jsx)(Ct,{size:"small",checked:o,onChange:r})]},e),gridItem:null};if(t.widget==="segmented"){let u=t.enum?.map(b=>({value:b,label:{global:"Global",agent:"Agent",project:"Project"}[b]||b}))||[];return{row:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,padding:"8px 0"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,l.jsx)(we,{style:{fontSize:13},children:a}),d]}),(0,l.jsx)(Kn,{size:"small",value:o,onChange:r,options:u})]},e),gridItem:null}}let c=(0,l.jsxs)("span",{children:[a,d&&(0,l.jsxs)(l.Fragment,{children:["\xA0",d]})]}),p;if(t.type==="number"||t.type==="integer")p=(0,l.jsx)(K,{size:"small",type:"number",value:o,onChange:u=>r(parseFloat(u.target.value)||t.default),min:t.minimum,max:t.maximum,style:{width:"100%"}});else if(t.widget==="select"||t.enum&&!t.widget){let u=t.enumLabels,b=u?Object.entries(u).map(([x,v])=>({value:x,label:v})):t.enum?.map(x=>({value:x,label:x}))||[];p=(0,l.jsx)(Ne,{size:"small",value:o,onChange:r,options:b,style:{width:"100%"}})}else t.widget==="textarea"?p=(0,l.jsx)(K.TextArea,{size:"small",value:o,onChange:u=>r(u.target.value),placeholder:t.default,autoSize:{minRows:2,maxRows:4}}):p=(0,l.jsx)(K,{size:"small",value:o,onChange:u=>r(u.target.value),placeholder:t.default});return{row:null,gridItem:(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,l.jsx)(we,{style:{fontSize:12,color:s.colorTextSecondary},children:c}),p]},e)}},Ci=({type:e})=>{let{token:t}=Le.useToken();switch(e){case"browser":return(0,l.jsx)(ar,{style:{color:t.colorPrimary}});case"sql":return(0,l.jsx)($o,{style:{color:t.colorWarning}});case"skill":return(0,l.jsx)(mr,{style:{color:t.colorSuccess}});case"filesystem":return(0,l.jsx)(ir,{style:{color:t.colorInfo}});case"code_eval":return(0,l.jsx)(tr,{style:{color:t.colorError}});case"metrics":return(0,l.jsx)(Zt,{size:20,style:{color:t.colorWarning}});case"topology":return(0,l.jsx)(pr,{style:{color:t.colorPrimary}});case"document-parser":return(0,l.jsx)(rr,{style:{color:t.colorSuccess}});case"collection":return(0,l.jsx)($o,{style:{color:t.colorInfo}});default:return(0,l.jsx)(sr,{style:{color:t.colorWarning}})}},hs=({middleware:e,middlewareType:t,onToggle:o,onConfigChange:r,onAllowedToolsChange:s,enabledAriaLabel:a,sectionTitles:d,headerActions:c,token:p,styles:u,renderListSubSection:b})=>{let x=t?.schema?.properties??{},v=Object.keys(x),g=v.filter(S=>{let B=x[S];return B.widget==="skillSelect"||B.widget==="databaseSelect"||B.widget==="metricsSelect"||B.widget==="collectionSelect"||B.widget==="connectionSelect"||B.widget==="topologyEdgeBuilder"}),m=v.filter(S=>{let B=x[S];return g.includes(S)?!1:B.widget==="switch"||B.widget==="segmented"}),f=v.filter(S=>!(g.includes(S)||m.includes(S)||S==="vmIsolation")),W=g.filter(S=>{let B=x[S];return S==="skills"&&e.config.readAll===!0||S==="serverKeys"&&e.config.connectAll===!0||S==="collectionKeys"&&e.config.connectAll===!0||S==="connections"&&e.config.connectAll===!0?!1:!!B.widget}),j=()=>(0,l.jsxs)(l.Fragment,{children:[m.map(S=>{let B=x[S],{row:J}=wi(S,B,e.config[S]??B.default,Z=>r({[S]:Z}),p);return(0,l.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:2},children:J},S)}),f.length>0&&(0,l.jsx)("div",{className:u.configGrid,children:f.map(S=>{let B=x[S],{gridItem:J}=wi(S,B,e.config[S]??B.default,Z=>r({[S]:Z}),p);return J})})]}),A=t?.tools,X=A?.map(S=>S.name)??[],ee=e.allowedTools??X,pe=A&&A.length>0,Q=m.length>0||f.length>0;return(0,l.jsxs)("div",{style:{maxWidth:960},children:[(0,l.jsxs)("div",{className:u.pageHeader,children:[(0,l.jsx)("div",{className:u.pageIcon,children:(0,l.jsx)(Ci,{type:e.type})}),(0,l.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,l.jsx)("h2",{className:u.pageName,children:e.name}),(0,l.jsx)("p",{className:u.pageDesc,children:e.description})]}),(0,l.jsxs)(de,{size:10,children:[c,(0,l.jsx)(be,{color:e.enabled?"success":"default",style:{margin:0,fontSize:11},children:e.enabled?"Enabled":"Disabled"}),(0,l.jsx)(Ct,{"aria-label":a,checked:e.enabled,onChange:S=>{if(o(),S){let B=t;B?.defaultConfig&&!e.config&&r(B.defaultConfig)}}})]})]}),Q&&(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:u.blockTitle,children:d?.config??"Config"}),(0,l.jsx)("div",{style:{marginTop:12},children:j()})]}),W.length>0&&(0,l.jsxs)("div",{style:{marginTop:24},children:[(0,l.jsx)("h3",{className:u.blockTitle,style:{marginBottom:4},children:d?.resources??"Resources Permission"}),W.map(S=>{let B=x[S],J=e.config[S]??B.default??[];return b(S,B,J,Z=>r({[S]:Z}),e.type)})]}),pe&&A&&(0,l.jsxs)("div",{style:{marginTop:24},children:[(0,l.jsx)("h3",{className:u.blockTitle,style:{marginBottom:4},children:d?.tools??"Tools Permission"}),(0,l.jsx)(ps,{tools:A,selectedToolNames:ee,allToolNames:X,onChange:s,styles:u})]})]})},bs=e=>{let{token:t}=Le.useToken(),{styles:o}=un();return(0,l.jsx)(hs,{...e,token:t,styles:o,renderListSubSection:(s,a,d,c,p)=>{switch(a.widget){case"skillSelect":return(0,l.jsx)(ms,{value:d,onChange:c,token:t,styles:o},s);case"databaseSelect":return(0,l.jsx)(us,{value:d,onChange:c,token:t,styles:o},s);case"metricsSelect":return(0,l.jsx)(gs,{value:d,onChange:c,token:t,styles:o},s);case"collectionSelect":return(0,l.jsx)(fs,{value:d,onChange:c,token:t,styles:o},s);case"connectionSelect":return(0,l.jsxs)("div",{className:o.dataSection,children:[(0,l.jsx)("div",{className:o.dataSectionHeader,children:(0,l.jsx)(we,{strong:!0,style:{fontSize:13},children:a.title||"Connections"})}),(0,l.jsx)(xi,{connectionType:a.connectionType??(s==="connections"?p:""),value:d||[],onChange:c})]},s);case"topologyEdgeBuilder":return(0,l.jsx)(ys,{value:d,onChange:c,token:t,styles:o},s);default:return null}}})};var Si=n(i()),{Text:wg}=P,Cg=C(({css:e,token:t})=>({toolRow:e`
|
|
1610
|
+
`})),yo=({title:e,selectedCount:t,totalCount:o,searchPlaceholder:r,searchText:s,onSearchChange:a,onSelectAll:d,onClearAll:c,children:p,styles:u})=>{let b=o>0&&t===o;return(0,l.jsxs)("div",{className:u.dataSection,children:[(0,l.jsxs)("div",{className:u.dataSectionHeader,children:[(0,l.jsxs)(we,{strong:!0,style:{fontSize:13},children:[e,(0,l.jsxs)(we,{type:"secondary",style:{fontSize:12,marginLeft:8},children:[t," / ",o," selected"]})]}),(0,l.jsx)(de,{size:4,children:(0,l.jsx)(z,{type:"link",size:"small",onClick:b?c:d,children:b?"Clear":"Select All"})})]}),(0,l.jsx)("div",{style:{marginBottom:10},children:(0,l.jsx)(K,{size:"small",allowClear:!0,prefix:(0,l.jsx)(pr,{style:{fontSize:12}}),placeholder:r,value:s,onChange:x=>a(x.target.value),style:{width:"100%"}})}),(0,l.jsx)("div",{className:u.dataList,children:p})]})},ds=({text:e,className:t})=>(0,l.jsx)(je,{title:e,placement:"topLeft",children:(0,l.jsx)("div",{className:t,children:e})}),ps=({tools:e,selectedToolNames:t,allToolNames:o,onChange:r,styles:s})=>{let a=e.length>0&&t.length===o.length,d=c=>{if(t.includes(c)){let p=t.filter(u=>u!==c);r(p.length===0?void 0:p)}else{let p=[...t,c];r(p.length===o.length&&o.every(u=>p.includes(u))?void 0:p)}};return(0,l.jsxs)("div",{className:s.dataSection,children:[(0,l.jsxs)("div",{className:s.dataSectionHeader,children:[(0,l.jsxs)(we,{strong:!0,style:{fontSize:13},children:["Tools",(0,l.jsxs)(we,{type:"secondary",style:{fontSize:12,marginLeft:8},children:[t.length," / ",o.length," selected"]})]}),(0,l.jsx)(de,{size:4,children:(0,l.jsx)(z,{type:"link",size:"small",onClick:()=>r(a?[]:void 0),children:a?"Clear":"Select All"})})]}),(0,l.jsx)("div",{className:s.toolsGrid,children:e.map(c=>{let p=t.includes(c.name);return(0,l.jsx)(Dt,{item:c,dense:!0,className:p?s.selectedCard:void 0,onClick:()=>d(c.name),renderIcon:()=>(0,l.jsx)("span",{style:{fontSize:14,fontWeight:600},children:c.name.charAt(0).toUpperCase()}),renderPrimary:()=>c.name,renderDetails:()=>(0,l.jsx)(ds,{text:c.description,className:s.toolDesc}),renderHeaderActions:()=>(0,l.jsx)(_e,{checked:p,onClick:u=>u.stopPropagation(),onChange:()=>d(c.name)})},c.id)})})]})},ms=({value:e,onChange:t,token:o,styles:r})=>{let[s,a]=(0,ge.useState)([]),[d,c]=(0,ge.useState)(!1),[p,u]=(0,ge.useState)(""),{get:b}=ue(),x=(0,ge.useRef)(!1);(0,ge.useEffect)(()=>{if(x.current)return;x.current=!0,(async()=>{c(!0);try{let f=await b("/api/skills");f.success&&f.data&&Array.isArray(f.data.records)&&a(f.data.records)}catch(f){console.error("Failed to fetch skills:",f)}finally{c(!1)}})()},[b]);let v=Array.isArray(e)?e:[],g=s.filter(m=>m.name.toLowerCase().includes(p.toLowerCase())||m.description.toLowerCase().includes(p.toLowerCase()));return(0,l.jsx)(yo,{title:"Skill Library",selectedCount:v.length,totalCount:s.length,searchPlaceholder:"Search skills\u2026",searchText:p,onSearchChange:u,onSelectAll:()=>t(s.map(m=>m.id)),onClearAll:()=>t([]),styles:r,children:d?(0,l.jsx)("div",{style:{textAlign:"center",padding:20},children:(0,l.jsx)(re,{size:"small"})}):g.length===0?(0,l.jsx)(xe,{description:"No skills available",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):(0,l.jsx)(Pe,{dataSource:g,split:!1,size:"small",renderItem:m=>{let f=v.includes(m.id);return(0,l.jsx)(Pe.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:o.borderRadius,backgroundColor:f?o.colorSuccessBg:"transparent",border:`1px solid ${f?o.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.15s ease"},onClick:()=>t(f?v.filter(W=>W!==m.id):[...v,m.id]),children:(0,l.jsx)(Pe.Item.Meta,{avatar:(0,l.jsx)(_e,{checked:f}),title:(0,l.jsx)(we,{strong:f,style:{fontSize:13},children:m.name}),description:(0,l.jsx)(we,{type:"secondary",style:{fontSize:12},ellipsis:!0,children:m.description})})},m.id)}})})},us=({value:e,onChange:t,token:o,styles:r})=>{let[s,a]=(0,ge.useState)([]),[d,c]=(0,ge.useState)(!1),[p,u]=(0,ge.useState)(""),{get:b}=ue(),x=(0,ge.useRef)(!1);(0,ge.useEffect)(()=>{if(x.current)return;x.current=!0,(async()=>{c(!0);try{let f=await b("/api/database-configs");f.success&&f.data&&Array.isArray(f.data.records)&&a(f.data.records)}catch(f){console.error("Failed to fetch database configs:",f)}finally{c(!1)}})()},[b]);let v=Array.isArray(e)?e:[],g=s.filter(m=>(m.name||m.key).toLowerCase().includes(p.toLowerCase())||(m.description||"").toLowerCase().includes(p.toLowerCase()));return(0,l.jsx)(yo,{title:"Databases",selectedCount:v.length,totalCount:s.length,searchPlaceholder:"Search databases\u2026",searchText:p,onSearchChange:u,onSelectAll:()=>t(s.map(m=>m.key)),onClearAll:()=>t([]),styles:r,children:d?(0,l.jsx)("div",{style:{textAlign:"center",padding:20},children:(0,l.jsx)(re,{size:"small"})}):g.length===0?(0,l.jsx)(xe,{description:"No databases available",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):(0,l.jsx)(Pe,{dataSource:g,split:!1,size:"small",renderItem:m=>{let f=v.includes(m.key);return(0,l.jsx)(Pe.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:o.borderRadius,backgroundColor:f?o.colorSuccessBg:"transparent",border:`1px solid ${f?o.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.15s ease"},onClick:()=>t(f?v.filter(W=>W!==m.key):[...v,m.key]),children:(0,l.jsx)(Pe.Item.Meta,{avatar:(0,l.jsx)(_e,{checked:f}),title:(0,l.jsx)(we,{strong:f,style:{fontSize:13},children:m.name||m.key}),description:m.description?(0,l.jsx)(we,{type:"secondary",style:{fontSize:12},ellipsis:!0,children:m.description}):void 0})},m.key)}})})},gs=({value:e,onChange:t,token:o,styles:r})=>{let[s,a]=(0,ge.useState)([]),[d,c]=(0,ge.useState)(!1),[p,u]=(0,ge.useState)(""),{get:b}=ue(),x=(0,ge.useRef)(!1);(0,ge.useEffect)(()=>{if(x.current)return;x.current=!0,(async()=>{c(!0);try{let f=await b("/api/metrics-configs");f.success&&f.data&&Array.isArray(f.data.records)&&a(f.data.records)}catch(f){console.error("Failed to fetch metrics configs:",f)}finally{c(!1)}})()},[b]);let v=Array.isArray(e)?e:[],g=s.filter(m=>(m.name||m.key).toLowerCase().includes(p.toLowerCase())||(m.description||"").toLowerCase().includes(p.toLowerCase()));return(0,l.jsx)(yo,{title:"Metrics Servers",selectedCount:v.length,totalCount:s.length,searchPlaceholder:"Search servers\u2026",searchText:p,onSearchChange:u,onSelectAll:()=>t(s.map(m=>m.key)),onClearAll:()=>t([]),styles:r,children:d?(0,l.jsx)("div",{style:{textAlign:"center",padding:20},children:(0,l.jsx)(re,{size:"small"})}):g.length===0?(0,l.jsx)(xe,{description:"No servers available",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):(0,l.jsx)(Pe,{dataSource:g,split:!1,size:"small",renderItem:m=>{let f=v.includes(m.key);return(0,l.jsx)(Pe.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:o.borderRadius,backgroundColor:f?o.colorSuccessBg:"transparent",border:`1px solid ${f?o.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.15s ease"},onClick:()=>t(f?v.filter(W=>W!==m.key):[...v,m.key]),children:(0,l.jsx)(Pe.Item.Meta,{avatar:(0,l.jsx)(_e,{checked:f}),title:(0,l.jsx)(we,{strong:f,style:{fontSize:13},children:m.name||m.key}),description:m.description?(0,l.jsx)(we,{type:"secondary",style:{fontSize:12},ellipsis:!0,children:m.description}):void 0})},m.key)}})})},fs=({value:e,onChange:t,token:o,styles:r})=>{let[s,a]=(0,ge.useState)([]),[d,c]=(0,ge.useState)(!1),[p,u]=(0,ge.useState)(""),{get:b}=ue(),x=(0,ge.useRef)(!1);(0,ge.useEffect)(()=>{x.current||(x.current=!0,c(!0),b("/api/collections").then(m=>{m.success&&a(m.data.records)}).catch(()=>{}).finally(()=>c(!1)))},[b]);let v=Array.isArray(e)?e:[],g=s.filter(m=>(m.label||m.name).toLowerCase().includes(p.toLowerCase())||m.name.toLowerCase().includes(p.toLowerCase()));return(0,l.jsx)(yo,{title:"Collections",selectedCount:v.length,totalCount:s.length,searchPlaceholder:"Search collections\u2026",searchText:p,onSearchChange:u,onSelectAll:()=>t(s.map(m=>m.name)),onClearAll:()=>t([]),styles:r,children:d?(0,l.jsx)("div",{style:{textAlign:"center",padding:20},children:(0,l.jsx)(re,{size:"small"})}):g.length===0?(0,l.jsx)(xe,{description:"No collections available",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):(0,l.jsx)(Pe,{dataSource:g,split:!1,size:"small",renderItem:m=>{let f=v.includes(m.name);return(0,l.jsx)(Pe.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:o.borderRadius,backgroundColor:f?o.colorSuccessBg:"transparent",border:`1px solid ${f?o.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.15s ease"},onClick:()=>t(f?v.filter(W=>W!==m.name):[...v,m.name]),children:(0,l.jsx)(Pe.Item.Meta,{avatar:(0,l.jsx)(_e,{checked:f}),title:(0,l.jsx)(we,{strong:f,style:{fontSize:13},children:m.label||m.name}),description:(0,l.jsx)(we,{type:"secondary",style:{fontSize:12},ellipsis:!0,children:m.name})})},m.name)}})})},ys=({value:e,onChange:t,token:o,styles:r})=>{let s=Array.isArray(e)?e:[],[a,d]=(0,ge.useState)({from:"",to:"",purpose:""}),c=()=>{!a.from.trim()||!a.to.trim()||!a.purpose.trim()||(t([...s,{...a}]),d({from:"",to:"",purpose:""}))};return(0,l.jsxs)("div",{className:r.dataSection,children:[(0,l.jsx)("div",{className:r.dataSectionHeader,children:(0,l.jsxs)(we,{strong:!0,style:{fontSize:13},children:["Dependencies",(0,l.jsxs)(we,{type:"secondary",style:{fontSize:12,marginLeft:8},children:[s.length," edges"]})]})}),(0,l.jsx)("div",{className:r.dataList,children:s.length===0?(0,l.jsx)(xe,{description:"No dependencies defined yet",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):s.map((p,u)=>(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 10px",marginBottom:4,borderRadius:o.borderRadius,backgroundColor:o.colorBgContainer,border:`1px solid ${o.colorBorderSecondary}`},children:[(0,l.jsx)(be,{color:"blue",style:{margin:0,fontSize:11},children:p.from}),(0,l.jsx)(we,{type:"secondary",style:{fontSize:12},children:"\u2192"}),(0,l.jsx)(be,{color:"green",style:{margin:0,fontSize:11},children:p.to}),(0,l.jsx)(we,{style:{fontSize:12,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.purpose}),(0,l.jsx)(z,{type:"text",size:"small",danger:!0,icon:(0,l.jsx)(rr,{}),onClick:()=>t(s.filter((b,x)=>x!==u))})]},u))}),(0,l.jsxs)("div",{style:{borderTop:`1px solid ${o.colorBorderSecondary}`,paddingTop:12,marginTop:12},children:[(0,l.jsx)(we,{strong:!0,style:{fontSize:13,display:"block",marginBottom:8},children:"Add Dependency"}),(0,l.jsxs)(de,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,l.jsx)(K,{size:"small",placeholder:"Source Agent ID",value:a.from,onChange:p=>d({...a,from:p.target.value})}),(0,l.jsx)(K,{size:"small",placeholder:"Target Agent ID",value:a.to,onChange:p=>d({...a,to:p.target.value})}),(0,l.jsx)(K,{size:"small",placeholder:"Purpose (e.g. classify invoice fields)",value:a.purpose,onChange:p=>d({...a,purpose:p.target.value}),onPressEnter:c}),(0,l.jsx)(z,{type:"dashed",size:"small",icon:(0,l.jsx)(cr,{}),onClick:c,disabled:!a.from.trim()||!a.to.trim()||!a.purpose.trim(),block:!0,children:"Add Edge"})]})]})]})},Ci=(e,t,o,r,s)=>{let a=t.title||e,d=t.description?(0,l.jsx)(je,{title:t.description,children:(0,l.jsx)(dr,{style:{color:s.colorTextSecondary,cursor:"pointer"}})}):null;if(t.widget==="switch"||!t.widget&&t.type==="boolean")return{row:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,padding:"8px 0"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,l.jsx)(we,{style:{fontSize:13},children:a}),d]}),(0,l.jsx)(Ct,{size:"small",checked:o,onChange:r})]},e),gridItem:null};if(t.widget==="segmented"){let u=t.enum?.map(b=>({value:b,label:{global:"Global",agent:"Agent",project:"Project"}[b]||b}))||[];return{row:(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,padding:"8px 0"},children:[(0,l.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,l.jsx)(we,{style:{fontSize:13},children:a}),d]}),(0,l.jsx)(qn,{size:"small",value:o,onChange:r,options:u})]},e),gridItem:null}}let c=(0,l.jsxs)("span",{children:[a,d&&(0,l.jsxs)(l.Fragment,{children:["\xA0",d]})]}),p;if(t.type==="number"||t.type==="integer")p=(0,l.jsx)(K,{size:"small",type:"number",value:o,onChange:u=>r(parseFloat(u.target.value)||t.default),min:t.minimum,max:t.maximum,style:{width:"100%"}});else if(t.widget==="select"||t.enum&&!t.widget){let u=t.enumLabels,b=u?Object.entries(u).map(([x,v])=>({value:x,label:v})):t.enum?.map(x=>({value:x,label:x}))||[];p=(0,l.jsx)(Ne,{size:"small",value:o,onChange:r,options:b,style:{width:"100%"}})}else t.widget==="textarea"?p=(0,l.jsx)(K.TextArea,{size:"small",value:o,onChange:u=>r(u.target.value),placeholder:t.default,autoSize:{minRows:2,maxRows:4}}):p=(0,l.jsx)(K,{size:"small",value:o,onChange:u=>r(u.target.value),placeholder:t.default});return{row:null,gridItem:(0,l.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[(0,l.jsx)(we,{style:{fontSize:12,color:s.colorTextSecondary},children:c}),p]},e)}},Si=({type:e})=>{let{token:t}=Le.useToken();switch(e){case"browser":return(0,l.jsx)(sr,{style:{color:t.colorPrimary}});case"sql":return(0,l.jsx)(_o,{style:{color:t.colorWarning}});case"skill":return(0,l.jsx)(ur,{style:{color:t.colorSuccess}});case"filesystem":return(0,l.jsx)(ar,{style:{color:t.colorInfo}});case"code_eval":return(0,l.jsx)(or,{style:{color:t.colorError}});case"metrics":return(0,l.jsx)(Zt,{size:20,style:{color:t.colorWarning}});case"topology":return(0,l.jsx)(mr,{style:{color:t.colorPrimary}});case"document-parser":return(0,l.jsx)(ir,{style:{color:t.colorSuccess}});case"collection":return(0,l.jsx)(_o,{style:{color:t.colorInfo}});default:return(0,l.jsx)(lr,{style:{color:t.colorWarning}})}},hs=({middleware:e,middlewareType:t,onToggle:o,onConfigChange:r,onAllowedToolsChange:s,enabledAriaLabel:a,sectionTitles:d,headerActions:c,token:p,styles:u,renderListSubSection:b})=>{let x=t?.schema?.properties??{},v=Object.keys(x),g=v.filter(S=>{let B=x[S];return B.widget==="skillSelect"||B.widget==="databaseSelect"||B.widget==="metricsSelect"||B.widget==="collectionSelect"||B.widget==="connectionSelect"||B.widget==="topologyEdgeBuilder"}),m=v.filter(S=>{let B=x[S];return g.includes(S)?!1:B.widget==="switch"||B.widget==="segmented"}),f=v.filter(S=>!(g.includes(S)||m.includes(S)||S==="vmIsolation")),W=g.filter(S=>{let B=x[S];return S==="skills"&&e.config.readAll===!0||S==="serverKeys"&&e.config.connectAll===!0||S==="collectionKeys"&&e.config.connectAll===!0||S==="connections"&&e.config.connectAll===!0?!1:!!B.widget}),j=()=>(0,l.jsxs)(l.Fragment,{children:[m.map(S=>{let B=x[S],{row:J}=Ci(S,B,e.config[S]??B.default,Z=>r({[S]:Z}),p);return(0,l.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:2},children:J},S)}),f.length>0&&(0,l.jsx)("div",{className:u.configGrid,children:f.map(S=>{let B=x[S],{gridItem:J}=Ci(S,B,e.config[S]??B.default,Z=>r({[S]:Z}),p);return J})})]}),A=t?.tools,X=A?.map(S=>S.name)??[],ee=e.allowedTools??X,pe=A&&A.length>0,Q=m.length>0||f.length>0;return(0,l.jsxs)("div",{style:{maxWidth:960},children:[(0,l.jsxs)("div",{className:u.pageHeader,children:[(0,l.jsx)("div",{className:u.pageIcon,children:(0,l.jsx)(Si,{type:e.type})}),(0,l.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,l.jsx)("h2",{className:u.pageName,children:e.name}),(0,l.jsx)("p",{className:u.pageDesc,children:e.description})]}),(0,l.jsxs)(de,{size:10,children:[c,(0,l.jsx)(be,{color:e.enabled?"success":"default",style:{margin:0,fontSize:11},children:e.enabled?"Enabled":"Disabled"}),(0,l.jsx)(Ct,{"aria-label":a,checked:e.enabled,onChange:S=>{if(o(),S){let B=t;B?.defaultConfig&&!e.config&&r(B.defaultConfig)}}})]})]}),Q&&(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:u.blockTitle,children:d?.config??"Config"}),(0,l.jsx)("div",{style:{marginTop:12},children:j()})]}),W.length>0&&(0,l.jsxs)("div",{style:{marginTop:24},children:[(0,l.jsx)("h3",{className:u.blockTitle,style:{marginBottom:4},children:d?.resources??"Resources Permission"}),W.map(S=>{let B=x[S],J=e.config[S]??B.default??[];return b(S,B,J,Z=>r({[S]:Z}),e.type)})]}),pe&&A&&(0,l.jsxs)("div",{style:{marginTop:24},children:[(0,l.jsx)("h3",{className:u.blockTitle,style:{marginBottom:4},children:d?.tools??"Tools Permission"}),(0,l.jsx)(ps,{tools:A,selectedToolNames:ee,allToolNames:X,onChange:s,styles:u})]})]})},bs=e=>{let{token:t}=Le.useToken(),{styles:o}=gn();return(0,l.jsx)(hs,{...e,token:t,styles:o,renderListSubSection:(s,a,d,c,p)=>{switch(a.widget){case"skillSelect":return(0,l.jsx)(ms,{value:d,onChange:c,token:t,styles:o},s);case"databaseSelect":return(0,l.jsx)(us,{value:d,onChange:c,token:t,styles:o},s);case"metricsSelect":return(0,l.jsx)(gs,{value:d,onChange:c,token:t,styles:o},s);case"collectionSelect":return(0,l.jsx)(fs,{value:d,onChange:c,token:t,styles:o},s);case"connectionSelect":return(0,l.jsxs)("div",{className:o.dataSection,children:[(0,l.jsx)("div",{className:o.dataSectionHeader,children:(0,l.jsx)(we,{strong:!0,style:{fontSize:13},children:a.title||"Connections"})}),(0,l.jsx)(wi,{connectionType:a.connectionType??(s==="connections"?p:""),value:d||[],onChange:c})]},s);case"topologyEdgeBuilder":return(0,l.jsx)(ys,{value:d,onChange:c,token:t,styles:o},s);default:return null}}})};var ki=n(i()),{Text:Sg}=P,kg=C(({css:e,token:t})=>({toolRow:e`
|
|
1611
1611
|
width: 100%;
|
|
1612
1612
|
background: ${t.colorFillQuaternary};
|
|
1613
1613
|
border-color: ${t.colorBorderSecondary};
|
|
@@ -1618,7 +1618,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1618
1618
|
`,toolName:e`
|
|
1619
1619
|
font-weight: 600;
|
|
1620
1620
|
font-size: 13px;
|
|
1621
|
-
`}));var
|
|
1621
|
+
`}));var Ri=n(i()),{Text:Ig}=P,Ag=C(({css:e,token:t})=>({diagram:e`
|
|
1622
1622
|
display: flex;
|
|
1623
1623
|
flex-direction: column;
|
|
1624
1624
|
gap: 0;
|
|
@@ -1653,7 +1653,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1653
1653
|
font-size: 12px;
|
|
1654
1654
|
line-height: 1.5;
|
|
1655
1655
|
color: ${t.colorTextSecondary};
|
|
1656
|
-
`}));var
|
|
1656
|
+
`}));var Ti=n(w());var Pi=n(i());var ho=n(w());var fn=n(i()),_g=mo.map(({role:e,label:t,description:o})=>({value:e,label:t,description:o})),Lg=C(({token:e,css:t})=>({root:t`
|
|
1657
1657
|
display: flex;
|
|
1658
1658
|
flex-direction: column;
|
|
1659
1659
|
gap: 24px;
|
|
@@ -1704,7 +1704,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1704
1704
|
white-space: nowrap;
|
|
1705
1705
|
overflow: hidden;
|
|
1706
1706
|
text-overflow: ellipsis;
|
|
1707
|
-
`}));var
|
|
1707
|
+
`}));var yn=n(i()),{Text:af,Title:sf}=P,lf=C(({css:e,token:t})=>({layout:e`
|
|
1708
1708
|
display: flex;
|
|
1709
1709
|
height: 100%;
|
|
1710
1710
|
gap: 20px;
|
|
@@ -1737,7 +1737,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1737
1737
|
font-size: 13px;
|
|
1738
1738
|
font-weight: 600;
|
|
1739
1739
|
padding: 2px 8px;
|
|
1740
|
-
`}));var
|
|
1740
|
+
`}));var hn=n(i());var Ai=n(i());var Ei=n(w());var bn=n(i()),{Text:Mf}=P,{TextArea:Nf}=K,{useToken:Bf}=Le;var Mi=n(w());var xn=n(i()),{Text:Lf}=P,{TextArea:Of}=K,Wf=C(({token:e,css:t})=>({container:t`
|
|
1741
1741
|
height: 100%;
|
|
1742
1742
|
display: flex;
|
|
1743
1743
|
flex-direction: column;
|
|
@@ -1786,14 +1786,14 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1786
1786
|
font-size: 13px;
|
|
1787
1787
|
color: ${e.colorTextSecondary};
|
|
1788
1788
|
margin-top: 8px;
|
|
1789
|
-
`}));var
|
|
1789
|
+
`}));var vo=n(w());var Ni=n(w());var wn=n(i()),{Text:Qf}=P,Yf=C(({css:e})=>({formField:e`
|
|
1790
1790
|
margin-bottom: 16px;
|
|
1791
1791
|
`,fieldLabel:e`
|
|
1792
1792
|
display: block;
|
|
1793
1793
|
margin-bottom: 6px;
|
|
1794
1794
|
font-weight: 500;
|
|
1795
1795
|
font-size: 13px;
|
|
1796
|
-
`}));var Cs=n(i()),{Text:
|
|
1796
|
+
`}));var Cs=n(i()),{Text:iy}=P;var Di=n(w());var Ss=n(w());var Bi=n(i());var Cn=n(i()),{Text:yy}=P,{TextArea:hy}=K,{useToken:by}=Le,{Panel:vy}=Et;var xt=n(w());var Sn=n(i()),Py=(0,xt.lazy)(()=>import("./embed-page-SkillFlow-HPH37PZH.js")),{Text:Iy}=P,{TextArea:Ay}=K;var Fi=n(w());var Rn=n(w());var Tn=n(i()),{Text:jy,Paragraph:$y}=P,_y=C(({token:e,css:t})=>({root:t`
|
|
1797
1797
|
height: 100%;
|
|
1798
1798
|
display: flex;
|
|
1799
1799
|
flex-direction: column;
|
|
@@ -1867,7 +1867,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1867
1867
|
background: ${e.colorPrimaryBg} !important;
|
|
1868
1868
|
transition: background 0.25s;
|
|
1869
1869
|
}
|
|
1870
|
-
`}));var
|
|
1870
|
+
`}));var In=n(i()),{Text:Gy}=P,Qy=C(({token:e,css:t})=>({container:t`
|
|
1871
1871
|
padding: ${e.paddingLG}px;
|
|
1872
1872
|
height: 100%;
|
|
1873
1873
|
overflow-y: auto;
|
|
@@ -1881,7 +1881,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
1881
1881
|
gap: ${e.marginSM}px;
|
|
1882
1882
|
margin-bottom: ${e.marginSM}px;
|
|
1883
1883
|
align-items: center;
|
|
1884
|
-
`}));var
|
|
1884
|
+
`}));var An=n(w());var zi=n(i());var ji=n(w());var $i=n(i()),{Text:ih,Title:ah}=P;var wo=n(w());var xo=n(w());var _i=n(w());var Li=n(i()),{Text:fh}=P;var Oi=n(i()),{Text:kh}=P;var En=n(w());var Mn=n(i()),{Text:Dh,Paragraph:Fh}=P;var Nn=n(i()),{Text:qh}=P;var Bn=n(w());var Wi=n(i()),{Text:Xh}=P;var Dn=n(w());var Co=n(w());var Ui=n(w());var Hi=n(i()),{Text:lb}=P;var Fn=n(i()),{Text:bb}=P;var ko=n(w());var So=n(w());var Pt=n(i()),Rs=(0,So.lazy)(()=>import("./embed-page-TasksSideApp-MQTUCJO4.js").then(e=>({default:e.TasksSideApp}))),zn=()=>{let{openSideApp:e,sideAppVisible:t,sideAppSelectedCard:o}=ke(),r=t&&o?.component_key==="tasks_side_app_pin";return(0,Pt.jsx)(Rt,{ariaLabel:"Open tasks",icon:(0,Pt.jsx)(to,{size:16}),onClick:()=>{r||e({component_key:"tasks_side_app_pin",message:"Tasks",data:{component:(0,Pt.jsx)(So.Suspense,{fallback:(0,Pt.jsx)(re,{style:{display:"block",margin:"auto"}}),children:(0,Pt.jsx)(Rs,{showProjectFilter:!1})})}})}})};var Ut=n(w());var jn=n(i()),{Text:Nb}=P;var Bb=C(({css:e,token:t})=>({body:e`
|
|
1885
1885
|
display: flex;
|
|
1886
1886
|
height: 460px;
|
|
1887
1887
|
`,leftPanel:e`
|
|
@@ -2040,7 +2040,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
2040
2040
|
padding: 12px 24px;
|
|
2041
2041
|
border-top: 1px solid ${t.colorBorderSecondary};
|
|
2042
2042
|
flex-shrink: 0;
|
|
2043
|
-
`}));var
|
|
2043
|
+
`}));var $n=n(i()),{Title:Xb,Text:Jb,Paragraph:Zb}=P,ev=C(({css:e,token:t})=>({container:e` display: flex; flex-direction: column; height: 100%; padding: 24px; overflow-y: auto; `,setupWrap:e` max-width: 520px; margin: 30px auto 0; `,card:e` border-radius: ${t.borderRadiusLG}px; `,statusCard:e` max-width: 560px; margin: 40px auto 0; border-radius: ${t.borderRadiusLG}px; `,loadingWrap:e` display: flex; align-items: center; justify-content: center; height: 100%; `,avatar:e`
|
|
2044
2044
|
width: 56px; height: 56px; border-radius: ${t.borderRadiusLG}px;
|
|
2045
2045
|
background: linear-gradient(135deg, ${t.colorPrimary}, ${t.colorPrimaryActive});
|
|
2046
2046
|
color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; margin: 0 auto 12px;
|
|
@@ -2055,7 +2055,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
2055
2055
|
`,chatRoot:e` display: flex; flex-direction: column; height: 100%; min-height: 0; `,chatBar:e`
|
|
2056
2056
|
display: flex; align-items: center; justify-content: space-between;
|
|
2057
2057
|
padding: 8px 16px; border-bottom: 1px solid ${t.colorBorderSecondary}; flex-shrink: 0;
|
|
2058
|
-
`,chatFill:e` flex: 1; min-height: 0; `}));var
|
|
2058
|
+
`,chatFill:e` flex: 1; min-height: 0; `}));var Xi=n(w());var Qi=n(w());var ve=n(w());function Vi(e,t){let o=t.trim().toLowerCase();return o?e.filter(r=>(r.label||"").toLowerCase().includes(o)):e}var qi=(e,t)=>{let o=t==="created"?e.createdAt:e.updatedAt;if(!o)return null;let r=Date.parse(o);return Number.isNaN(r)?null:r};function Gi(e,t="updated",o="desc"){return[...e].sort((r,s)=>{if(t==="name"){let c=r.label||"",p=s.label||"";return o==="asc"?c.localeCompare(p):p.localeCompare(c)}let a=qi(r,t),d=qi(s,t);return a===null&&d===null?0:a===null?1:d===null?-1:o==="asc"?a-d:d-a})}var V=n(i()),Ts=C(({token:e,css:t})=>({container:t`
|
|
2059
2059
|
padding: 4px;
|
|
2060
2060
|
font-size: 13px;
|
|
2061
2061
|
background: transparent;
|
|
@@ -2182,7 +2182,7 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
2182
2182
|
text-align: center;
|
|
2183
2183
|
color: ${e.colorTextSecondary};
|
|
2184
2184
|
font-size: 12px;
|
|
2185
|
-
`})),$n=()=>{let{styles:e}=Ts(),{threads:t,threadId:o,selectThread:r,deleteThread:s,updateThread:a,isLoading:d}=tt(),[c,p]=(0,ve.useState)(null),[u,b]=(0,ve.useState)(!1),[x,v]=(0,ve.useState)(null),[g,m]=(0,ve.useState)(""),[f,W]=(0,ve.useState)(!1),[j,A]=(0,ve.useState)(""),[X,ee]=(0,ve.useState)("updated"),[pe,Q]=(0,ve.useState)("desc"),S=(0,ve.useRef)(!1),B=(0,ve.useRef)(!1),J=(0,ve.useCallback)((R,I)=>{R.stopPropagation(),p(I)},[]),Z=(0,ve.useCallback)(async()=>{if(c){b(!0);try{await s(c),q.success("Conversation deleted"),p(null)}catch{q.error("Failed to delete conversation")}finally{b(!1)}}},[c,s]),E=(0,ve.useCallback)((R,I)=>{R.stopPropagation(),v(I.id),m(I.label)},[]),se=(0,ve.useCallback)(async R=>{if(B.current)return;let I=g.trim();if(!I||I===R.label){v(null);return}B.current=!0,W(!0);try{await a({...R,label:I}),q.success("Conversation renamed")}catch{q.error("Failed to rename conversation")}finally{B.current=!1,W(!1),v(null)}},[g,a]),D=(0,ve.useCallback)(()=>{S.current=!0,v(null)},[]),$=(0,ve.useCallback)(R=>{R.key==="Enter"?(R.preventDefault(),R.currentTarget.blur()):R.key==="Escape"&&(R.preventDefault(),D())},[D]),le=(0,ve.useCallback)(R=>{if(S.current){S.current=!1;return}se(R)},[se]),L=ve.default.useMemo(()=>Vi(qi(t,j),X,pe),[t,j,X,pe]);return(0,V.jsxs)("div",{className:e.container,children:[(0,V.jsxs)("div",{className:e.toolbar,children:[(0,V.jsx)(K,{size:"small",placeholder:"Search conversations\u2026",allowClear:!0,value:j,onChange:R=>A(R.target.value)}),(0,V.jsxs)("div",{className:e.toolbarRow,children:[(0,V.jsx)(Ne,{size:"small",style:{flex:1,minWidth:0},value:X,onChange:R=>ee(R),options:[{value:"name",label:"Name"},{value:"updated",label:"Updated"},{value:"created",label:"Created"}]}),(0,V.jsx)(z,{size:"small",icon:pe==="asc"?(0,V.jsx)(Xt,{}):(0,V.jsx)(Jt,{}),onClick:()=>Q(R=>R==="asc"?"desc":"asc"),title:pe==="asc"?"Ascending":"Descending"})]})]}),d?(0,V.jsx)("div",{className:e.loading,children:"Loading conversations..."}):L.length===0?(0,V.jsx)("div",{className:e.emptyState,children:j.trim()?`No conversations match "${j.trim()}"`:"No conversations yet"}):(0,V.jsx)("div",{className:e.threadList,children:L.map(R=>(0,V.jsxs)("div",{className:`${e.threadItem} ${R.id===o?"active":""}`,onClick:()=>r(R.id),title:R.label,children:[(0,V.jsx)("div",{className:e.threadIcon,children:(0,V.jsx)(kr,{size:14})}),x===R.id?(0,V.jsx)("input",{className:e.renameInput,"aria-label":"Conversation name",value:g,autoFocus:!0,disabled:f,onClick:I=>I.stopPropagation(),onFocus:I=>I.target.select(),onChange:I=>m(I.target.value),onKeyDown:I=>$(I),onBlur:()=>le(R)}):(0,V.jsx)("div",{className:R.id===o?e.threadNameActive:e.threadName,children:R.label}),x===R.id?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("button",{className:`${e.actionBtn} ${e.actionBtnVisible}`,title:"Save name",disabled:f,onMouseDown:I=>I.preventDefault(),onClick:I=>{I.stopPropagation(),se(R)},children:(0,V.jsx)(fr,{size:12})}),(0,V.jsx)("button",{className:`${e.actionBtn} ${e.actionBtnVisible}`,title:"Cancel rename",disabled:f,onMouseDown:I=>I.preventDefault(),onClick:I=>{I.stopPropagation(),D()},children:(0,V.jsx)(Bt,{size:12})})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("button",{className:e.actionBtn,onClick:I=>E(I,R),title:"Rename conversation",children:(0,V.jsx)(Tr,{size:12})}),(0,V.jsx)("button",{className:e.actionBtn,onClick:I=>J(I,R.id),title:"Delete conversation",children:(0,V.jsx)(Er,{size:12})})]})]},R.id))}),(0,V.jsx)(me,{title:"Delete Conversation",open:c!==null,onCancel:()=>p(null),onOk:Z,okText:"Delete",okButtonProps:{danger:!0,loading:u},cancelText:"Cancel",children:(0,V.jsx)("p",{children:"Are you sure you want to delete this conversation? This action cannot be undone."})})]})};var Qi=n(i());var Xi=n(i());var Ji=n(w());var Zi=n(i()),{Text:Fv}=P;var Ns=n(w());var _n=n(w());var ea=n(i()),{Text:Ov}=P;var Ms=n(w());var Es=n(w());var Ln=n(i());var On=n(i()),{Dragger:Yv}=Vn,{Text:Xv,Title:Jv}=P;var ta=n(i()),{Title:ax,Text:sx}=P;var ye=n(i()),oa=[{id:"personal_assistant",type:"route",name:"Personal Assistant",icon:(0,ye.jsx)(Mt,{size:20}),order:-10},{id:"workspace_projects",type:"route",name:"Projects",icon:(0,ye.jsx)(st,{size:20}),order:0},{id:"metrics",builtin:"metrics",type:"route",name:"Metrics",icon:(0,ye.jsx)(Zt,{size:20}),order:10,group:"DataSource"},{id:"database",builtin:"database",type:"route",name:"Database",icon:(0,ye.jsx)(hr,{size:20}),order:20,group:"DataSource"},{id:"connections",builtin:"connections",type:"route",name:"Plugins",icon:(0,ye.jsx)(Wo,{size:20}),order:21},{id:"topology-runtimes",type:"route",name:"Runtime",icon:(0,ye.jsx)(kt,{size:20}),order:26,group:"Process"},{id:"topology-inbox",type:"route",name:"Inbox",icon:(0,ye.jsx)(wr,{size:20}),order:27,group:"Process"},{id:"workflows",type:"route",name:"Automations",icon:(0,ye.jsx)(Uo,{size:20}),order:25,group:"Process"},{id:"shares",type:"route",name:"Shares",icon:(0,ye.jsx)(Uo,{size:20}),order:55,group:"Settings"},{id:"workspace_migration",type:"route",name:"Migration",icon:(0,ye.jsx)(ur,{size:20}),order:56,group:"Settings"},{id:"eval",type:"route",name:"Eval",icon:(0,ye.jsx)(vr,{size:20}),order:28,group:"Process"},{id:"assistants",builtin:"assistants",type:"route",name:"Assistants",icon:(0,ye.jsx)(Mt,{size:20}),order:30,group:"Settings"},{id:"skills",builtin:"skills",type:"route",name:"Skills",icon:(0,ye.jsx)(Br,{size:20}),order:35,group:"Settings"},{id:"collections",type:"route",name:"Collections",icon:(0,ye.jsx)(Sr,{size:20}),order:29,group:"Knowledge"},{id:"mcp",builtin:"mcp",type:"route",name:"MCP",icon:(0,ye.jsx)(Wo,{size:20}),order:40,group:"Settings"},{id:"a2a-keys",type:"route",name:"API Keys",icon:(0,ye.jsx)(Cr,{size:20}),order:45,group:"Settings"},{id:"open-audit",type:"route",name:"Audit Log",icon:(0,ye.jsx)(kt,{size:20}),order:47,group:"Settings"},{id:"capability-bundles",type:"route",name:"Runtime Profiles",icon:(0,ye.jsx)(Ar,{size:20}),order:46,group:"Settings"},{id:"tools",builtin:"tools",type:"route",name:"Tools",icon:(0,ye.jsx)(Nr,{size:20}),order:50,group:"Settings"},{id:"tasks",type:"route",name:"Tasks",icon:(0,ye.jsx)(to,{size:20}),order:100}];var Rw=(0,Ue.lazy)(()=>import("./embed-page-AgentGovernanceWorkbench-Y5F3ZPYC.js").then(e=>({default:e.AgentGovernanceWorkbench}))),Tw=(0,Ue.lazy)(()=>import("./embed-page-TopologyRuntimeView-QLMZ4OE7.js").then(e=>({default:e.TopologyRuntimeView}))),Pw=(0,Ue.lazy)(()=>import("./embed-page-WorkflowAutomationView-FJJSGY7Z.js").then(e=>({default:e.WorkflowAutomationView}))),Iw=(0,Ue.lazy)(()=>import("./embed-page-TasksSideApp-HYKCJ356.js").then(e=>({default:e.TasksSideApp}))),Aw=(0,Ue.lazy)(()=>import("./embed-page-AgentDetailSideApp-7FH2JSZI.js").then(e=>({default:e.AgentDetailSideApp})));var Be=n(i());function Bs(e){let{contentType:t,assistantId:o,contentConfig:r,workspaceId:s,projectId:a}=e;return t==="agent"?{agentId:o,workspaceId:s||void 0,projectId:a||void 0}:{...r,workspaceId:s||void 0,projectId:a||void 0}}async function Ds(e,t,o){let{contentType:r,assistantId:s,contentConfig:a,isMatch:d}=t;if(!(r==="agent"?!!s:!!a)||!o)return{isPinned:!1,pinnedId:null};let p=await e("/api/menu-items?menuTarget=workspace");if(p.success&&p.data?.records){let u=d??(x=>r==="agent"&&x.agentId===s),b=p.data.records.find(x=>x.contentType===r&&u(x.contentConfig));if(b)return{isPinned:!0,pinnedId:b.id}}return{isPinned:!1,pinnedId:null}}async function Fs(e,t){let{contentType:o,name:r,group:s}=t,a=Bs(t),d={menuTarget:"workspace",contentType:o,contentConfig:a,group:s?.trim()||void 0,name:r.trim(),sortOrder:0},c=await e("/api/menu-items",d);if(!c.success)throw new Error(c.message||"Failed to pin");return{id:c.data.id}}async function zs(e,t){let o=await e(`/api/menu-items/${t}`);if(!o.success)throw new Error(o.message||"Failed to unpin")}function mo(){let e=he.default.useContext(Dr),{config:t}=Ce(),{post:o,get:r,del:s}=ue(),a=t.enableCustomMenu??!1,d=(0,he.useCallback)(async u=>Ds(r,u,a),[r,a]),c=(0,he.useCallback)(async u=>Fs(o,{...u,workspaceId:e?.workspaceId,projectId:e?.projectId}),[o,e]),p=(0,he.useCallback)(async u=>zs(s,u),[s]);return{check:d,pin:c,unpin:p,enableCustomMenu:a,get:r}}function na(e){let t=new Set;for(let o of e)o.group?.trim()&&t.add(o.group.trim());return Array.from(t).sort()}function sn(){let{config:e}=Ce(),t=he.default.useMemo(()=>na(oa),[]),o=he.default.useMemo(()=>na(e.workspaceMenuItems??[]),[e.workspaceMenuItems]);return he.default.useMemo(()=>Array.from(new Set([...t,...o])).sort(),[t,o])}async function ln(e){let t=await e("/api/menu-items?menuTarget=workspace");if(t.success&&t.data?.records){let o=new Set;for(let r of t.data.records)r.group?.trim()&&o.add(r.group.trim());return Array.from(o).sort()}return[]}var js={display:"flex",flexDirection:"column",gap:12},Tn=({assistantId:e,contentType:t="agent",contentConfig:o,isMatch:r,size:s="small",label:a,block:d})=>{let{check:c,pin:p,unpin:u,enableCustomMenu:b,get:x}=mo(),[v,g]=(0,he.useState)(!1),[m,f]=(0,he.useState)(""),[W,j]=(0,he.useState)(""),[A,X]=(0,he.useState)(!1),[ee,pe]=(0,he.useState)(!1),[Q,S]=(0,he.useState)(null),[B,J]=(0,he.useState)(!0),Z=sn(),[E,se]=(0,he.useState)(Z);(0,he.useEffect)(()=>{se(Z)},[Z]),(0,he.useEffect)(()=>{v&&ln(x).then(I=>{se(Array.from(new Set([...Z,...I])).sort())})},[v]);let D=t==="agent"?!!e:!!o,$=(0,he.useCallback)(async()=>{if(!D||!b){J(!1);return}J(!0);try{let I=await c({contentType:t,assistantId:e,contentConfig:o,isMatch:r});pe(I.isPinned),S(I.pinnedId)}catch{}finally{J(!1)}},[D,b,c,t,e,o,r]);if((0,he.useEffect)(()=>{$()},[$]),!D||!b)return null;let le=async()=>{if(!W.trim()){q.warning("Please enter a menu name");return}X(!0);try{await p({contentType:t,assistantId:e,contentConfig:o,isMatch:r,name:W.trim(),group:m.trim()||void 0}),q.success("Pinned to menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),g(!1),f(""),j(""),$()}catch(I){q.error(I.message||"Failed to pin to menu")}finally{X(!1)}},L=async()=>{if(Q){X(!0);try{await u(Q),q.success("Unpinned from menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),pe(!1),S(null)}catch(I){q.error(I.message||"Failed to unpin from menu")}finally{X(!1)}}},R=()=>{ee?L():g(!0)};return(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)(je,{title:ee?"Unpin from Menu":"Pin to Menu",children:a?(0,Be.jsx)(z,{type:"text",size:s,block:d,icon:ee?(0,Be.jsx)(Ve,{size:14,fill:"currentColor"}):(0,Be.jsx)(Ve,{size:14}),onClick:R,loading:B||A&&ee,children:a}):(0,Be.jsx)(z,{type:"text",size:s,block:d,icon:ee?(0,Be.jsx)(Ve,{size:14,fill:"currentColor"}):(0,Be.jsx)(Ve,{size:14}),onClick:R,loading:B||A&&ee})}),(0,Be.jsx)(me,{title:"Pin to Menu",open:v,onOk:le,onCancel:()=>g(!1),confirmLoading:A,okText:"Pin",children:(0,Be.jsxs)("div",{style:js,children:[(0,Be.jsx)(K,{placeholder:"Menu name (required)",value:W,onChange:I=>j(I.target.value)}),(0,Be.jsx)(Vt,{placeholder:"Group (optional, select or type new)",value:m,options:E.map(I=>({value:I})),onChange:I=>f(I),filterOption:(I,T)=>T?.value?.toUpperCase().includes(I.toUpperCase())??!1})]})})]})};var ae=n(w());var G=n(i()),Wn=50,$s=C(({token:e,css:t})=>({container:t`
|
|
2185
|
+
`})),_n=()=>{let{styles:e}=Ts(),{threads:t,threadId:o,selectThread:r,deleteThread:s,updateThread:a,isLoading:d}=tt(),[c,p]=(0,ve.useState)(null),[u,b]=(0,ve.useState)(!1),[x,v]=(0,ve.useState)(null),[g,m]=(0,ve.useState)(""),[f,W]=(0,ve.useState)(!1),[j,A]=(0,ve.useState)(""),[X,ee]=(0,ve.useState)("updated"),[pe,Q]=(0,ve.useState)("desc"),S=(0,ve.useRef)(!1),B=(0,ve.useRef)(!1),J=(0,ve.useCallback)((R,I)=>{R.stopPropagation(),p(I)},[]),Z=(0,ve.useCallback)(async()=>{if(c){b(!0);try{await s(c),q.success("Conversation deleted"),p(null)}catch{q.error("Failed to delete conversation")}finally{b(!1)}}},[c,s]),E=(0,ve.useCallback)((R,I)=>{R.stopPropagation(),v(I.id),m(I.label)},[]),se=(0,ve.useCallback)(async R=>{if(B.current)return;let I=g.trim();if(!I||I===R.label){v(null);return}B.current=!0,W(!0);try{await a({...R,label:I}),q.success("Conversation renamed")}catch{q.error("Failed to rename conversation")}finally{B.current=!1,W(!1),v(null)}},[g,a]),D=(0,ve.useCallback)(()=>{S.current=!0,v(null)},[]),$=(0,ve.useCallback)(R=>{R.key==="Enter"?(R.preventDefault(),R.currentTarget.blur()):R.key==="Escape"&&(R.preventDefault(),D())},[D]),le=(0,ve.useCallback)(R=>{if(S.current){S.current=!1;return}se(R)},[se]),L=ve.default.useMemo(()=>Gi(Vi(t,j),X,pe),[t,j,X,pe]);return(0,V.jsxs)("div",{className:e.container,children:[(0,V.jsxs)("div",{className:e.toolbar,children:[(0,V.jsx)(K,{size:"small",placeholder:"Search conversations\u2026",allowClear:!0,value:j,onChange:R=>A(R.target.value)}),(0,V.jsxs)("div",{className:e.toolbarRow,children:[(0,V.jsx)(Ne,{size:"small",style:{flex:1,minWidth:0},value:X,onChange:R=>ee(R),options:[{value:"name",label:"Name"},{value:"updated",label:"Updated"},{value:"created",label:"Created"}]}),(0,V.jsx)(z,{size:"small",icon:pe==="asc"?(0,V.jsx)(Xt,{}):(0,V.jsx)(Jt,{}),onClick:()=>Q(R=>R==="asc"?"desc":"asc"),title:pe==="asc"?"Ascending":"Descending"})]})]}),d?(0,V.jsx)("div",{className:e.loading,children:"Loading conversations..."}):L.length===0?(0,V.jsx)("div",{className:e.emptyState,children:j.trim()?`No conversations match "${j.trim()}"`:"No conversations yet"}):(0,V.jsx)("div",{className:e.threadList,children:L.map(R=>(0,V.jsxs)("div",{className:`${e.threadItem} ${R.id===o?"active":""}`,onClick:()=>r(R.id),title:R.label,children:[(0,V.jsx)("div",{className:e.threadIcon,children:(0,V.jsx)(Rr,{size:14})}),x===R.id?(0,V.jsx)("input",{className:e.renameInput,"aria-label":"Conversation name",value:g,autoFocus:!0,disabled:f,onClick:I=>I.stopPropagation(),onFocus:I=>I.target.select(),onChange:I=>m(I.target.value),onKeyDown:I=>$(I),onBlur:()=>le(R)}):(0,V.jsx)("div",{className:R.id===o?e.threadNameActive:e.threadName,children:R.label}),x===R.id?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("button",{className:`${e.actionBtn} ${e.actionBtnVisible}`,title:"Save name",disabled:f,onMouseDown:I=>I.preventDefault(),onClick:I=>{I.stopPropagation(),se(R)},children:(0,V.jsx)(yr,{size:12})}),(0,V.jsx)("button",{className:`${e.actionBtn} ${e.actionBtnVisible}`,title:"Cancel rename",disabled:f,onMouseDown:I=>I.preventDefault(),onClick:I=>{I.stopPropagation(),D()},children:(0,V.jsx)(Bt,{size:12})})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("button",{className:e.actionBtn,onClick:I=>E(I,R),title:"Rename conversation",children:(0,V.jsx)(Pr,{size:12})}),(0,V.jsx)("button",{className:e.actionBtn,onClick:I=>J(I,R.id),title:"Delete conversation",children:(0,V.jsx)(Mr,{size:12})})]})]},R.id))}),(0,V.jsx)(me,{title:"Delete Conversation",open:c!==null,onCancel:()=>p(null),onOk:Z,okText:"Delete",okButtonProps:{danger:!0,loading:u},cancelText:"Cancel",children:(0,V.jsx)("p",{children:"Are you sure you want to delete this conversation? This action cannot be undone."})})]})};var Yi=n(i());var Ji=n(i());var Zi=n(w());var ea=n(i()),{Text:$v}=P;var Ns=n(w());var Ln=n(w());var ta=n(i()),{Text:Hv}=P;var Ms=n(w());var Es=n(w());var On=n(i());var Wn=n(i()),{Dragger:Zv}=Gn,{Text:ex,Title:tx}=P;var oa=n(i()),{Title:cx,Text:dx}=P;var ye=n(i()),na=[{id:"personal_assistant",type:"route",name:"Personal Assistant",icon:(0,ye.jsx)(Mt,{size:20}),order:-10},{id:"workspace_projects",type:"route",name:"Projects",icon:(0,ye.jsx)(st,{size:20}),order:0},{id:"metrics",builtin:"metrics",type:"route",name:"Metrics",icon:(0,ye.jsx)(Zt,{size:20}),order:10,group:"DataSource"},{id:"database",builtin:"database",type:"route",name:"Database",icon:(0,ye.jsx)(br,{size:20}),order:20,group:"DataSource"},{id:"connections",builtin:"connections",type:"route",name:"Plugins",icon:(0,ye.jsx)(Uo,{size:20}),order:21},{id:"topology-runtimes",type:"route",name:"Runtime",icon:(0,ye.jsx)(kt,{size:20}),order:26,group:"Process"},{id:"topology-inbox",type:"route",name:"Inbox",icon:(0,ye.jsx)(Cr,{size:20}),order:27,group:"Process"},{id:"workflows",type:"route",name:"Automations",icon:(0,ye.jsx)(Ho,{size:20}),order:25,group:"Process"},{id:"shares",type:"route",name:"Shares",icon:(0,ye.jsx)(Ho,{size:20}),order:55,group:"Settings"},{id:"workspace_migration",type:"route",name:"Migration",icon:(0,ye.jsx)(gr,{size:20}),order:56,group:"Settings"},{id:"eval",type:"route",name:"Eval",icon:(0,ye.jsx)(xr,{size:20}),order:28,group:"Process"},{id:"assistants",builtin:"assistants",type:"route",name:"Assistants",icon:(0,ye.jsx)(Mt,{size:20}),order:30,group:"Settings"},{id:"skills",builtin:"skills",type:"route",name:"Skills",icon:(0,ye.jsx)(Dr,{size:20}),order:35,group:"Settings"},{id:"collections",type:"route",name:"Collections",icon:(0,ye.jsx)(kr,{size:20}),order:29,group:"Knowledge"},{id:"mcp",builtin:"mcp",type:"route",name:"MCP",icon:(0,ye.jsx)(Uo,{size:20}),order:40,group:"Settings"},{id:"a2a-keys",type:"route",name:"API Keys",icon:(0,ye.jsx)(Sr,{size:20}),order:45,group:"Settings"},{id:"open-audit",type:"route",name:"Audit Log",icon:(0,ye.jsx)(kt,{size:20}),order:47,group:"Settings"},{id:"capability-bundles",type:"route",name:"Runtime Profiles",icon:(0,ye.jsx)(Er,{size:20}),order:46,group:"Settings"},{id:"tools",builtin:"tools",type:"route",name:"Tools",icon:(0,ye.jsx)(Br,{size:20}),order:50,group:"Settings"},{id:"tasks",type:"route",name:"Tasks",icon:(0,ye.jsx)(to,{size:20}),order:100}];var Iw=(0,Ue.lazy)(()=>import("./embed-page-AgentGovernanceWorkbench-LCIQ5UF3.js").then(e=>({default:e.AgentGovernanceWorkbench}))),Aw=(0,Ue.lazy)(()=>import("./embed-page-TopologyRuntimeView-PU2D7VZ7.js").then(e=>({default:e.TopologyRuntimeView}))),Ew=(0,Ue.lazy)(()=>import("./embed-page-WorkflowAutomationView-ST76M33F.js").then(e=>({default:e.WorkflowAutomationView}))),Mw=(0,Ue.lazy)(()=>import("./embed-page-TasksSideApp-MQTUCJO4.js").then(e=>({default:e.TasksSideApp}))),Nw=(0,Ue.lazy)(()=>import("./embed-page-AgentDetailSideApp-ONXG4B3D.js").then(e=>({default:e.AgentDetailSideApp})));var Be=n(i());function Bs(e){let{contentType:t,assistantId:o,contentConfig:r,workspaceId:s,projectId:a}=e;return t==="agent"?{agentId:o,workspaceId:s||void 0,projectId:a||void 0}:{...r,workspaceId:s||void 0,projectId:a||void 0}}async function Ds(e,t,o){let{contentType:r,assistantId:s,contentConfig:a,isMatch:d}=t;if(!(r==="agent"?!!s:!!a)||!o)return{isPinned:!1,pinnedId:null};let p=await e("/api/menu-items?menuTarget=workspace");if(p.success&&p.data?.records){let u=d??(x=>r==="agent"&&x.agentId===s),b=p.data.records.find(x=>x.contentType===r&&u(x.contentConfig));if(b)return{isPinned:!0,pinnedId:b.id}}return{isPinned:!1,pinnedId:null}}async function Fs(e,t){let{contentType:o,name:r,group:s}=t,a=Bs(t),d={menuTarget:"workspace",contentType:o,contentConfig:a,group:s?.trim()||void 0,name:r.trim(),sortOrder:0},c=await e("/api/menu-items",d);if(!c.success)throw new Error(c.message||"Failed to pin");return{id:c.data.id}}async function zs(e,t){let o=await e(`/api/menu-items/${t}`);if(!o.success)throw new Error(o.message||"Failed to unpin")}function uo(){let e=he.default.useContext(Fr),{config:t}=Ce(),{post:o,get:r,del:s}=ue(),a=t.enableCustomMenu??!1,d=(0,he.useCallback)(async u=>Ds(r,u,a),[r,a]),c=(0,he.useCallback)(async u=>Fs(o,{...u,workspaceId:e?.workspaceId,projectId:e?.projectId}),[o,e]),p=(0,he.useCallback)(async u=>zs(s,u),[s]);return{check:d,pin:c,unpin:p,enableCustomMenu:a,get:r}}function ra(e){let t=new Set;for(let o of e)o.group?.trim()&&t.add(o.group.trim());return Array.from(t).sort()}function ln(){let{config:e}=Ce(),t=he.default.useMemo(()=>ra(na),[]),o=he.default.useMemo(()=>ra(e.workspaceMenuItems??[]),[e.workspaceMenuItems]);return he.default.useMemo(()=>Array.from(new Set([...t,...o])).sort(),[t,o])}async function cn(e){let t=await e("/api/menu-items?menuTarget=workspace");if(t.success&&t.data?.records){let o=new Set;for(let r of t.data.records)r.group?.trim()&&o.add(r.group.trim());return Array.from(o).sort()}return[]}var js={display:"flex",flexDirection:"column",gap:12},Pn=({assistantId:e,contentType:t="agent",contentConfig:o,isMatch:r,size:s="small",label:a,block:d})=>{let{check:c,pin:p,unpin:u,enableCustomMenu:b,get:x}=uo(),[v,g]=(0,he.useState)(!1),[m,f]=(0,he.useState)(""),[W,j]=(0,he.useState)(""),[A,X]=(0,he.useState)(!1),[ee,pe]=(0,he.useState)(!1),[Q,S]=(0,he.useState)(null),[B,J]=(0,he.useState)(!0),Z=ln(),[E,se]=(0,he.useState)(Z);(0,he.useEffect)(()=>{se(Z)},[Z]),(0,he.useEffect)(()=>{v&&cn(x).then(I=>{se(Array.from(new Set([...Z,...I])).sort())})},[v]);let D=t==="agent"?!!e:!!o,$=(0,he.useCallback)(async()=>{if(!D||!b){J(!1);return}J(!0);try{let I=await c({contentType:t,assistantId:e,contentConfig:o,isMatch:r});pe(I.isPinned),S(I.pinnedId)}catch{}finally{J(!1)}},[D,b,c,t,e,o,r]);if((0,he.useEffect)(()=>{$()},[$]),!D||!b)return null;let le=async()=>{if(!W.trim()){q.warning("Please enter a menu name");return}X(!0);try{await p({contentType:t,assistantId:e,contentConfig:o,isMatch:r,name:W.trim(),group:m.trim()||void 0}),q.success("Pinned to menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),g(!1),f(""),j(""),$()}catch(I){q.error(I.message||"Failed to pin to menu")}finally{X(!1)}},L=async()=>{if(Q){X(!0);try{await u(Q),q.success("Unpinned from menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),pe(!1),S(null)}catch(I){q.error(I.message||"Failed to unpin from menu")}finally{X(!1)}}},R=()=>{ee?L():g(!0)};return(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)(je,{title:ee?"Unpin from Menu":"Pin to Menu",children:a?(0,Be.jsx)(z,{type:"text",size:s,block:d,icon:ee?(0,Be.jsx)(Ve,{size:14,fill:"currentColor"}):(0,Be.jsx)(Ve,{size:14}),onClick:R,loading:B||A&&ee,children:a}):(0,Be.jsx)(z,{type:"text",size:s,block:d,icon:ee?(0,Be.jsx)(Ve,{size:14,fill:"currentColor"}):(0,Be.jsx)(Ve,{size:14}),onClick:R,loading:B||A&&ee})}),(0,Be.jsx)(me,{title:"Pin to Menu",open:v,onOk:le,onCancel:()=>g(!1),confirmLoading:A,okText:"Pin",children:(0,Be.jsxs)("div",{style:js,children:[(0,Be.jsx)(K,{placeholder:"Menu name (required)",value:W,onChange:I=>j(I.target.value)}),(0,Be.jsx)(Vt,{placeholder:"Group (optional, select or type new)",value:m,options:E.map(I=>({value:I})),onChange:I=>f(I),filterOption:(I,T)=>T?.value?.toUpperCase().includes(I.toUpperCase())??!1})]})})]})};var ae=n(w());var G=n(i()),Un=50,$s=C(({token:e,css:t})=>({container:t`
|
|
2186
2186
|
position: relative;
|
|
2187
2187
|
`,projectTrigger:t`
|
|
2188
2188
|
display: flex;
|
|
@@ -2381,11 +2381,11 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
2381
2381
|
display: flex;
|
|
2382
2382
|
justify-content: flex-end;
|
|
2383
2383
|
gap: 8px;
|
|
2384
|
-
`})),
|
|
2384
|
+
`})),Ro=({disableDropdown:e=!0,showWorkspace:t=!0,value:o,onChange:r,kind:s})=>{let{styles:a}=$s(),{workspaceId:d,workspaces:c,projectId:p,projects:u,trainingProjects:b=[],personalProjects:x=[],setWorkspace:v,setProject:g,createProject:m}=Se(),[f,W]=(0,ae.useState)(!1),j=(0,ae.useRef)(null),A=(0,ae.useRef)(null),[X,ee]=(0,ae.useState)(!1),[pe,Q]=(0,ae.useState)(!1),[S,B]=(0,ae.useState)(""),[J,Z]=(0,ae.useState)(null),[E,se]=(0,ae.useState)(!1),D=(0,ae.useRef)(null),$=o!==void 0,le=$?o:p,L=(0,ae.useMemo)(()=>{if(s==="business")return u;if(s==="training")return b;if(s==="personal")return x;let O=new Map;for(let fe of[...u,...b,...x])O.has(fe.id)||O.set(fe.id,fe);return Array.from(O.values())},[s,u,b,x]);(0,ae.useEffect)(()=>{let O=fe=>{A.current&&!A.current.contains(fe.target)&&(ee(!1),W(!1))};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let R=(0,ae.useMemo)(()=>L.find(O=>O.id===le),[L,le]),I=(0,ae.useMemo)(()=>c.find(O=>O.id===d),[c,d]),T=(0,ae.useCallback)(O=>{$?r?.(O):g(O),ee(!1)},[$,r,g]),ce=(0,ae.useCallback)(()=>{$?r?.(null):g(null)},[$,r,g]),k=(0,ae.useCallback)(()=>{ee(O=>!O)},[]),ne=(0,ae.useCallback)(()=>{W(O=>!O)},[]),F=(0,ae.useCallback)(O=>{let fe=O.trim();return fe?fe.length>Un?`Name must be ${Un} characters or less`:null:"Project name is required"},[]),U=(0,ae.useCallback)(O=>{if(O.stopPropagation(),!d){q.warning("Please select a workspace first");return}B(""),Z(null),Q(!0),setTimeout(()=>D.current?.input?.focus(),100)},[d]),We=(0,ae.useCallback)(()=>{Q(!1),B(""),Z(null)},[]),He=O=>{let fe=O.target.value;B(fe),Z(F(fe))},Ze=(0,ae.useCallback)(async()=>{if(!d)return;let O=S.trim(),fe=F(O);if(fe){Z(fe);return}se(!0),Z(null);try{let it=await m(d,{name:O});Q(!1),B(""),Z(null),$?r?.(it.id):g(it.id),q.success(`Project "${it.name}" created`)}catch(it){let Ye=it instanceof Error?it.message:"Failed to create project";Z(Ye)}finally{se(!1)}},[d,S,F,m,g,$,r]),ft=O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),F(S.trim())||Ze())},rt=!F(S.trim());return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)("div",{className:a.container,ref:A,children:(0,G.jsxs)("div",{className:a.selectorWrapper,children:[t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)("div",{style:{position:"relative"},ref:j,children:(0,G.jsx)("button",{className:a.workspaceButton,onClick:ce,title:I?.name||"Select Workspace",children:(0,G.jsx)("div",{className:a.workspaceButtonIcon,children:(0,G.jsx)(fr,{size:16})})})}),(0,G.jsx)("span",{className:a.divider,children:"/"})]}),(0,G.jsxs)("div",{className:a.projectTrigger,onClick:e?void 0:k,style:{cursor:e?"default":"pointer"},children:[(0,G.jsx)("div",{className:a.projectTriggerIcon,children:(0,G.jsx)(Wo,{size:16})}),(0,G.jsx)("div",{className:a.projectTriggerInfo,children:(0,G.jsx)("div",{className:a.projectTriggerName,children:R?.name||"Select Project"})}),!e&&(0,G.jsx)("div",{className:`${a.projectTriggerArrow} ${X?"expanded":""}`,children:(0,G.jsx)(eo,{size:14})})]}),!e&&X&&(0,G.jsxs)("div",{className:a.projectDropdown,children:[L.map(O=>(0,G.jsxs)("div",{className:`${a.projectDropdownItem} ${O.id===le?"active":""}`,onClick:()=>T(O.id),children:[(0,G.jsx)("div",{className:a.projectDropdownItemIcon,children:(0,G.jsx)(Wo,{size:14})}),(0,G.jsx)("div",{className:O.id===le?a.projectDropdownItemNameActive:a.projectDropdownItemName,children:O.name})]},O.id)),L.length===0&&(0,G.jsx)("div",{className:a.emptyState,children:"No projects"})]})]})}),(0,G.jsxs)(me,{title:"Create New Project",open:pe,onCancel:We,wrapClassName:a.modalWrap,centered:!0,destroyOnClose:!0,maskClosable:!E,keyboard:!0,closable:!0,footer:(0,G.jsxs)("div",{className:a.modalFooter,children:[(0,G.jsx)(z,{onClick:We,disabled:E,children:"Cancel"}),(0,G.jsx)(z,{type:"primary",onClick:Ze,loading:E,disabled:!rt,children:"Create"})]}),children:[(0,G.jsx)(K,{ref:D,value:S,onChange:He,onKeyDown:ft,placeholder:"Enter project name",maxLength:Un+10,status:J?"error":void 0}),J&&(0,G.jsx)("div",{style:{color:"#ff4d4f",fontSize:"12px",marginTop:"4px"},children:J})]})]})};var De=n(w());var aa=n(i()),ia=()=>{let{config:e}=Ce(),{openSideApp:t}=ke(),{workspaceId:o,projectId:r,listPath:s,listPathByFolder:a,getFileViewUrl:d,getFileDownloadUrl:c,uploadFileToFolder:p}=Se(),{currentAssistant:u}=et(),[b,x]=(0,De.useState)({}),[v,g]=(0,De.useState)({}),[m,f]=(0,De.useState)({}),[W,j]=(0,De.useState)({}),[A,X]=(0,De.useState)({}),[ee,pe]=(0,De.useState)(null),Q=(0,De.useMemo)(()=>e.resourceFolders&&e.resourceFolders.length>0?e.resourceFolders:[{name:"/",displayName:"Project Assets",allowUpload:!0}],[e.resourceFolders]),S=(0,De.useCallback)(async(E,se=!0)=>{if(!o||!r){x(D=>({...D,[E.name]:[]}));return}g(D=>({...D,[E.name]:!0}));try{let D=await a(E.name,u?.id);if(x($=>({...$,[E.name]:D})),se){let $=E.name==="/"?"/":E.name.replace(/\/$/,"");f(le=>{let L={...le};return Object.keys(L).forEach(R=>{(R===$||R.startsWith(`${$}/`))&&delete L[R]}),L}),X(le=>{let L={...le};return Object.keys(L).forEach(R=>{(R===$||R.startsWith(`${$}/`))&&delete L[R]}),L})}}catch(D){console.error(`Failed to load assets for folder ${E.name}:`,D),x($=>({...$,[E.name]:[]}))}finally{g(D=>({...D,[E.name]:!1}))}},[o,r,a,u?.id]),B=(0,De.useCallback)(async E=>{if(A[E]||!1){X(D=>({...D,[E]:!1}));return}X(D=>({...D,[E]:!0})),j(D=>({...D,[E]:!0}));try{let D=await s(E,u?.id);f($=>({...$,[E]:D}))}catch(D){console.error(`Failed to load directory ${E}:`,D),f($=>({...$,[E]:[]}))}finally{j(D=>({...D,[E]:!1}))}},[A,s,u?.id]);(0,De.useEffect)(()=>{Q.forEach(E=>{S(E,!1)})},[Q,S]);let J=(0,De.useCallback)(E=>{let se=d(E.path,u?.id),D=c(E.path,u?.id);if(!se||!D){q.warning("Please select a workspace and project first.");return}t({component_key:"attachments",data:{file_id:E.path,message:`Preview: ${E.name||E.path}`,full_url:se,download_url:D},message:`Preview: ${E.name||E.path}`})},[d,c,t,u?.id]),Z=(0,De.useCallback)(async E=>{if(!o||!r){q.warning("Please select a workspace and project before uploading.");return}let se=document.createElement("input");se.type="file",se.onchange=async D=>{let le=D.target?.files?.[0];if(le){pe(E);try{await p(E,le,u?.id),q.success(`Uploaded "${le.name}" successfully`);let L=Q.find(R=>R.name===E);L&&await S(L)}catch(L){let R=L instanceof Error?L.message:"Failed to upload file";q.error(R)}finally{pe(null),se.remove()}}},se.click()},[o,r,p,Q,S,u?.id]);return(0,aa.jsx)(sn,{workspaceId:o,projectId:r,resourceFolders:Q,folderEntries:b,folderLoading:v,directoryChildren:m,directoryLoading:W,directoryExpanded:A,uploadingFolder:ee,onRefreshFolder:S,onUploadFolder:Z,onToggleDirectory:B,onAssetClick:J})};var To=n(w());var Qe=n(i()),{Text:_s,Paragraph:Ls}=P,sa={185:"Maximum update depth exceeded \u2014 likely an infinite re-render loop",31:"Objects are not valid as a React child",130:"Element type is invalid \u2014 check render method",152:"Too many re-renders \u2014 React limits renders to prevent an infinite loop",301:"Rendered fewer hooks than expected",306:"Rendered more hooks than during the previous render",310:"Rendered more hooks than during the previous render",321:"Invalid hook call \u2014 hooks can only be called inside function components",418:"Hydration failed because the server rendered content didn't match the client",423:"Hydration error \u2014 server/client mismatch in suspense boundary",424:"Could not find recovery element for hydrated instance",425:"Text content doesn't match server-rendered HTML"};function Os(e){if(!e)return"";let t=e.message?.match(/Minified React error #(\d+)/);return t&&sa[t[1]]?`${e.name}: Minified React error #${t[1]} \u2014 ${sa[t[1]]}`:`${e.name}: ${e.message}`}var gt=class extends To.Component{constructor(t){super(t),this.state={hasError:!1,error:null,errorInfo:null,retryKey:0}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,o){let r=this.props.name||"ChatErrorBoundary";console.error(`[${r}] Caught rendering error:`,t,o),this.setState({errorInfo:o}),this.props.onError?.(t,o)}handleRetry=()=>{this.setState(t=>({hasError:!1,error:null,errorInfo:null,retryKey:t.retryKey+1}))};handleCopyError=()=>{let{error:t,errorInfo:o}=this.state,s=[`[${this.props.name||"ChatErrorBoundary"}]`,`Error: ${t?.name}: ${t?.message}`,`Stack: ${t?.stack}`,`Component Stack: ${o?.componentStack}`].join(`
|
|
2385
2385
|
|
|
2386
|
-
`);navigator.clipboard.writeText(s).then(()=>{q.success("Error details copied")}).catch(()=>{q.error("Failed to copy")})};render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;let{error:t,errorInfo:o}=this.state,r=this.props.name||"this section";return(0,Qe.jsx)(
|
|
2386
|
+
`);navigator.clipboard.writeText(s).then(()=>{q.success("Error details copied")}).catch(()=>{q.error("Failed to copy")})};render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;let{error:t,errorInfo:o}=this.state,r=this.props.name||"this section";return(0,Qe.jsx)(Vn,{status:"error",title:`Failed to render ${r}`,subTitle:(0,Qe.jsxs)(de,{direction:"vertical",size:"small",style:{textAlign:"left"},children:[(0,Qe.jsx)(_s,{type:"danger",strong:!0,children:Os(t)}),(t?.stack||o?.componentStack)&&(0,Qe.jsx)(Et,{size:"small",ghost:!0,items:[{key:"details",label:"Error details",children:(0,Qe.jsxs)(Ls,{code:!0,style:{maxHeight:200,overflow:"auto",whiteSpace:"pre-wrap",fontSize:12},children:[t?.stack||"",t?.stack&&o?.componentStack?`
|
|
2387
2387
|
|
|
2388
|
-
`:"",o?.componentStack||""]})}]})]}),extra:[(0,Qe.jsx)(z,{icon:(0,Qe.jsx)(
|
|
2388
|
+
`:"",o?.componentStack||""]})}]})]}),extra:[(0,Qe.jsx)(z,{icon:(0,Qe.jsx)(nr,{}),onClick:this.handleCopyError,children:"Copy Details"},"copy"),(0,Qe.jsx)(z,{type:"primary",onClick:this.handleRetry,children:"Retry"},"retry")]})}return(0,Qe.jsx)(To.default.Fragment,{children:this.props.children},this.state.retryKey)}};var oe=n(i()),Ws=C(({css:e})=>({wrapper:e`
|
|
2389
2389
|
display: flex;
|
|
2390
2390
|
flex-direction: column;
|
|
2391
2391
|
width: 100%;
|
|
@@ -2406,5 +2406,5 @@ import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as
|
|
|
2406
2406
|
align-items: center;
|
|
2407
2407
|
justify-content: flex-end;
|
|
2408
2408
|
flex-shrink: 0;
|
|
2409
|
-
`})),Us=e=>{let{assistant_id:t,thread_id:o="",menu:r,header:s,headerRight:a,showProjectSelector:d,headerSelector:c,emptyPlaceholder:p,...u}=e,{config:b}=Ce(),{styles:x}=Ws(),v=d??b.enableWorkspace,g=(0,oe.jsxs)("div",{className:x.headerBar,children:[(0,oe.jsx)("div",{className:x.headerLeft,children:c??(v?(0,oe.jsx)(
|
|
2410
|
-
`),o))if(await t(v),d=v.type==="stream.completed",d)break;if(d)break}}if(p.done)break}if(!d)throw wt()}finally{if(!c)try{await r.cancel()}catch{}r.releaseLock()}}var Xs=new Set(["WEB_APP_NOT_FOUND","WEB_APP_DISABLED","USER_ID_REQUIRED","INVALID_USER_ID","PROJECT_NOT_ALLOWED","PROJECT_SELECTOR_DISABLED","MODEL_NOT_ALLOWED","FEATURE_DISABLED","THREAD_NOT_FOUND","STREAM_CONFLICT","STREAM_FAILED","INVALID_REQUEST","INTERNAL_ERROR"]);function Ee(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ze(e,t,o=[]){let r=Object.keys(e);return t.every(s=>s in e)&&r.every(s=>t.includes(s)||o.includes(s))}function te(e){return typeof e=="string"}function Po(e){if(!Ee(e)||!ze(e,["id","projectId","createdAt","updatedAt"],["label"])||!te(e.id)||!te(e.projectId)||e.label!==void 0&&!te(e.label)||!te(e.createdAt)||!te(e.updatedAt))return;let t=new Date(e.createdAt),o=new Date(e.updatedAt);if(!(Number.isNaN(t.getTime())||Number.isNaN(o.getTime())))return{id:e.id,projectId:e.projectId,...e.label===void 0?{}:{label:e.label},createdAt:t,updatedAt:o}}function la(e){if(!Ee(e)||e.success!==!1||!Ee(e.error))return!1;let t=e.error;return ze(e,["success","error"])&&ze(t,["code","message","retryable"])&&typeof t.code=="string"&&Xs.has(t.code)&&typeof t.message=="string"&&typeof t.retryable=="boolean"}function Js(e){if(!Ee(e))return!1;let t=["projectSelector","modelSelector","threadManagement","attachments","hitl","genUI"];return ze(e,t,["files"])&&t.every(o=>typeof e[o]=="boolean")&&(e.files===void 0||typeof e.files=="boolean")}function Zs(e){return Array.isArray(e)&&e.length<=6&&e.every(t=>Ee(t)&&ze(t,["label","text"])&&te(t.label)&&t.label.length>=1&&t.label.length<=40&&te(t.text)&&t.text.length>=1&&t.text.length<=500)}function el(e){return Ee(e)&&ze(e,[],["title","welcomeMessage","primaryColor","quickPrompts"])&&(e.title===void 0||te(e.title))&&(e.welcomeMessage===void 0||te(e.welcomeMessage))&&(e.primaryColor===void 0||te(e.primaryColor))&&(e.quickPrompts===void 0||Zs(e.quickPrompts))}function tl(e){if(!Ee(e)||!ze(e,["webApp","projects","models"],["thread"])||!Ee(e.webApp))return;let t=e.webApp;if(!ze(t,["id","name","assistant","defaultProjectId","features","appearance","identityAssurance"],["description","defaultModelKey"])||!te(t.id)||!te(t.name)||!te(t.defaultProjectId)||t.description!==void 0&&!te(t.description)||t.defaultModelKey!==void 0&&!te(t.defaultModelKey)||t.identityAssurance!=="unverified"||!Ee(t.assistant)||!ze(t.assistant,["id","name"],["description"])||!te(t.assistant.id)||!te(t.assistant.name)||t.assistant.description!==void 0&&!te(t.assistant.description)||!Js(t.features)||!el(t.appearance)||!Array.isArray(e.projects)||!e.projects.every(r=>Ee(r)&&ze(r,["id","name"])&&te(r.id)&&te(r.name))||!Array.isArray(e.models)||!e.models.every(r=>Ee(r)&&ze(r,["key","label"])&&te(r.key)&&te(r.label)))return;let o=e.thread===void 0?void 0:Po(e.thread);if(!(e.thread!==void 0&&!o))return{...e,...o?{thread:o}:{}}}function ol(e){if(!Ee(e)||!ze(e,["records","total"])||!Array.isArray(e.records)||typeof e.total!="number")return;let t=e.records.map(Po);return t.every(o=>o!==void 0)?{records:t,total:e.total}:void 0}function nl(e){return Ee(e)&&te(e.id)&&(e.role==="human"||e.role==="ai")&&(e.content===void 0||te(e.content)||Array.isArray(e.content)&&e.content.every(t=>Gt(t)!==void 0))}function rl(e){return Ee(e)&&ze(e,["messages"])&&Array.isArray(e.messages)&&e.messages.every(nl)?e:void 0}function il(e){return Ee(e)&&ze(e,["ref","name","mimeType","size"])&&te(e.ref)&&te(e.name)&&te(e.mimeType)&&typeof e.size=="number"?e:void 0}function ca(e,t){return o=>Ee(o)&&ze(o,e)&&t(o)?o:void 0}var Io=class{constructor(t){this.options=t;this.baseUrl=`${t.gatewayUrl.replace(/\/+$/,"")}/api/web-apps/${encodeURIComponent(t.webAppId)}/runtime`,this.fetchImplementation=t.fetch??globalThis.fetch.bind(globalThis)}baseUrl;fetchImplementation;async bootstrap(t={},o){return this.request("bootstrap",tl,{query:t,signal:o})}async listThreads(t={},o){return this.request("threads",ol,{query:t,signal:o})}async createThread(t={},o){return this.request("threads",Po,{method:"POST",body:t,signal:o})}async updateThread(t,o,r){return this.request(`threads/${encodeURIComponent(t)}`,Po,{method:"PATCH",body:o,signal:r})}async deleteThread(t,o={},r){await this.request(`threads/${encodeURIComponent(t)}`,ca(["id"],s=>te(s.id)),{method:"DELETE",query:o,signal:r})}async getMessages(t,o={},r){return this.request(`threads/${encodeURIComponent(t)}/messages`,rl,{query:o,signal:r})}async streamMessage(t,o,r,s){return this.streamRequest(`threads/${encodeURIComponent(t)}/messages/stream`,o,r,s)}async resumeInterrupt(t,o,r,s,a){return this.streamRequest(`threads/${encodeURIComponent(t)}/interrupts/${encodeURIComponent(o)}/resume`,r,s,a)}async streamRequest(t,o,r,s){let a;try{a=await this.fetchRequest(t,{method:"POST",body:o,signal:s})}catch(d){throw da(d)||d instanceof Fe?d:new Fe("STREAM_FAILED","Stream failed",!0)}if(a.ok||await this.throwResponseError(a),!a.body||!a.headers.get("content-type")?.toLowerCase().includes("text/event-stream")){if(a.body)try{await a.body.cancel()}catch{}throw new Fe("STREAM_FAILED","Stream failed",!0,a.status)}await sa(a.body,r)}async abort(t,o={},r){await this.request(`threads/${encodeURIComponent(t)}/abort`,ca(["aborted"],s=>typeof s.aborted=="boolean"),{method:"POST",query:o,signal:r})}async uploadAttachment(t,o,r={},s){let a=new FormData,d=typeof File<"u"&&o instanceof File?o.name:"attachment";return a.append("file",o,d),this.request(`threads/${encodeURIComponent(t)}/attachments`,il,{method:"POST",query:r,body:a,signal:s})}async request(t,o,r={}){let s;try{s=await this.fetchRequest(t,r)}catch(c){throw da(c)||c instanceof Fe?c:new Fe("INTERNAL_ERROR","Request failed",!0)}let a;try{a=await s.json()}catch{throw this.internalError(s.status)}if(la(a))throw new Fe(a.error.code,a.error.message,a.error.retryable,s.status);if(!s.ok||!Ee(a)||!ze(a,["success","data"])||a.success!==!0)throw this.internalError(s.status);let d=o(a.data);if(d===void 0)throw this.internalError(s.status);return d}async fetchRequest(t,o){let r=await this.options.identityProvider.getIdentity(o.signal),s=new URL(`${this.baseUrl}/${t}`);for(let[c,p]of Object.entries(o.query??{}))p!==void 0&&s.searchParams.set(c,p);let a=new Headers;r.bearerToken!==void 0?a.set("Authorization",`Bearer ${r.bearerToken}`):a.set("X-Axiom-External-User-Id",r.externalUserId??"");let d;return o.body instanceof FormData?d=o.body:o.body!==void 0&&(a.set("Content-Type","application/json"),d=JSON.stringify(o.body)),this.fetchImplementation(s,{method:o.method??"GET",headers:a,body:d,signal:o.signal,credentials:"omit"})}async throwResponseError(t){let o;try{o=await t.json()}catch{throw this.internalError(t.status)}throw la(o)?new Fe(o.error.code,o.error.message,o.error.retryable,t.status):this.internalError(t.status)}internalError(t){return new Fe("INTERNAL_ERROR","Invalid server response",!1,t)}};function da(e){return typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError"}var Ao=n(w());var At=n(i());function pa(){let{createThread:e}=tt(),{menuCollapsed:t,setMenuCollapsed:o}=ke();(0,Ao.useEffect)(()=>{t===void 0&&o(!0)},[t,o]);let r=(0,Ao.useCallback)(async()=>{try{await e("New Thread")}catch(u){console.error("Failed to create new thread:",u)}},[e]),s=t??!0,p=[{id:"new-analysis",builtin:"new-analysis",type:"action",name:"New Thread",icon:(0,At.jsx)(yr,{size:20}),order:0},...s?[{id:"thread-history-toggle",type:"action",name:"History",icon:(0,At.jsx)(kt,{size:20}),order:1}]:[{id:"thread-history",builtin:"thread-history",type:"drawer",name:"History",icon:(0,At.jsx)(kt,{size:20}),order:1,title:"Conversation History",width:320,inline:!0,inlineDefaultExpanded:!0,content:(0,At.jsx)($n,{})}]];return(0,At.jsx)(so,{items:p,showBranding:!1,showToggle:!0,showNewAnalysis:!1,defaultExpanded:!s,collapsed:s,onCollapsedChange:o,onNewAnalysis:r,onItemClick:u=>{u.type==="action"&&u.builtin==="new-analysis"?r():u.type==="action"&&u.id==="thread-history-toggle"&&o(!1)}},s?"agent-chat-sidebar-collapsed":"agent-chat-sidebar-expanded")}function ma(e){if(typeof window>"u"||typeof XMLHttpRequest>"u")return()=>{};let t=`${e.gatewayUrl.replace(/\/+$/,"")}/api/web-apps/${encodeURIComponent(e.webAppId)}/runtime/`,o=XMLHttpRequest.prototype.open,r=XMLHttpRequest.prototype.send,s=new WeakMap;return XMLHttpRequest.prototype.open=function(d,c){s.set(this,String(c)),o.call(this,d,c,!0)},XMLHttpRequest.prototype.send=function(d){let c=s.get(this)??"";if(!c.startsWith(t)||!/\/sandbox\/uploadfile$/.test(c)){r.call(this,d);return}if(e.identity.mode==="unverified"){this.setRequestHeader("X-Axiom-External-User-Id",e.identity.userId),r.call(this,d);return}e.identity.tokenProvider().then(p=>{this.setRequestHeader("Authorization",`Bearer ${p}`),r.call(this,d)}).catch(()=>{r.call(this,d)})},()=>{XMLHttpRequest.prototype.open=o,XMLHttpRequest.prototype.send=r}}var Re=n(i());function al(e,t){let r=ua(e.welcome)??ua(t.welcomeMessage),s=e.quickPrompts??t.quickPrompts??[];return{...r!==void 0?{welcome:r}:{},quickPrompts:s}}function ua(e){return typeof e=="string"&&e.length>0?e:void 0}function sl(e){if(!e.gatewayUrl.trim())throw new Error("AgentChatApp requires gatewayUrl");try{new URL(e.gatewayUrl)}catch{throw new Error("AgentChatApp gatewayUrl must be a valid URL")}if(!e.webAppId.trim())throw new Error("AgentChatApp requires webAppId");if(e.identity.mode==="unverified"){if(!e.identity.userId.trim())throw new Error("AgentChatApp requires identity.userId")}else if(typeof e.identity.tokenProvider!="function")throw new Error("AgentChatApp requires identity.tokenProvider");if(!e.fetch&&typeof globalThis.fetch!="function")throw new Error("AgentChatApp requires a fetch implementation")}function ll(e){return e instanceof Fe?e:new Fe("INTERNAL_ERROR","Request failed",!0)}function cl(e){return e.mode==="unverified"?`unverified:${e.userId}`:"verified:token"}function ZC(e){sl(e);let t=`${e.gatewayUrl}\0${e.webAppId}\0${cl(e.identity)}`;return(0,Re.jsx)(dl,{...e},t)}function dl({gatewayUrl:e,webAppId:t,identity:o,onError:r,onChatReady:s,onChatMessage:a,fetch:d,className:c,welcome:p,quickPrompts:u}){let[b,x]=(0,Me.useState)({status:"loading"}),v=(0,Me.useRef)(o);v.current=o;let g=(0,Me.useRef)(r);g.current=r;let m=(0,Me.useRef)();return m.current||(m.current=new Io({gatewayUrl:e,webAppId:t,identityProvider:{getIdentity:async()=>{let f=v.current;if(f.mode!=="verified")return{externalUserId:f.userId};try{return{bearerToken:await f.tokenProvider()}}catch{throw new Fe("USER_ID_REQUIRED","Identity token provider failed",!0)}}},...d?{fetch:d}:{}})),(0,Me.useEffect)(()=>ma({gatewayUrl:e,webAppId:t,identity:o}),[e,t,o]),(0,Me.useEffect)(()=>{let f=!1,W=m.current;return(async()=>{try{let j=await W.bootstrap({});if(f)return;x({status:"ready",bootstrap:j})}catch(j){if(f)return;let A=ll(j);x({status:"error",error:A}),g.current?.(A)}})(),()=>{f=!0}},[]),b.status==="loading"?(0,Re.jsx)("div",{className:c}):b.status==="error"?(0,Re.jsxs)("div",{className:c,role:"alert",children:[(0,Re.jsx)("strong",{children:"Unable to load the assistant"}),(0,Re.jsx)("div",{children:b.error.code}),(0,Re.jsx)("button",{type:"button",onClick:()=>x({status:"loading"}),children:"Retry"})]}):(0,Re.jsx)(ml,{className:c,gatewayUrl:e,webAppId:t,identity:o,bootstrap:b.bootstrap,onChatReady:s,onChatMessage:a,welcome:p,quickPrompts:u})}function pl(e){return{id:e.id,name:e.name,...e.description!==void 0?{description:e.description}:{},graphDefinition:void 0,createdAt:new Date(0),updatedAt:new Date(0)}}function ml({gatewayUrl:e,webAppId:t,identity:o,bootstrap:r,onChatReady:s,onChatMessage:a,className:d,welcome:c,quickPrompts:p}){let u=(0,Me.useMemo)(()=>pl(r.webApp.assistant),[r.webApp.assistant]),b=(0,Me.useMemo)(()=>al({welcome:c,quickPrompts:p},r.webApp.appearance),[c,p,r.webApp.appearance]),x=(0,Me.useMemo)(()=>o.mode==="unverified"?{mode:"unverified",userId:o.userId}:{mode:"verified",tokenProvider:o.tokenProvider},[o]),v=(0,Me.useCallback)(f=>new Gn({gatewayUrl:e,webAppId:t,identity:x,assistantId:f.assistantId,transport:f.transport,...f.timeout!==void 0?{timeout:f.timeout}:{},...f.headers!==void 0?{headers:f.headers}:{}}),[e,t,x]),g=(0,Me.useMemo)(()=>({baseURL:`${e.replace(/\/$/,"")}/api/web-apps/${t}/runtime`,apiKey:"",transport:"sse",assistantId:u.id,enableSkillSlot:!1,enableDatabaseSlot:!1,enableAgentSlot:!1,enableMetricsDataSourceSlot:!1,enableModelSelector:!1,enableWorkspace:!1,enableCustomMenu:!1,showSideMenu:!1,enableAssistantCreation:!1,enableAssistantEditing:!1,enableThreadCreation:!0,enableThreadList:!0}),[u.id,e,t]),m=(0,Me.useMemo)(()=>({assistants:[u],currentAssistant:u,isLoading:!1,error:null,listAssistants:async()=>{},getAssistant:async()=>u,createAssistant:async()=>{throw new Error("Not implemented in a Web App")},updateAssistant:async()=>{throw new Error("Not implemented in a Web App")},deleteAssistant:async()=>{},selectAssistant:async()=>{},clearCurrentAssistant:()=>{},refresh:async()=>{}}),[u]);return(0,Re.jsx)(Xn,{config:{baseURL:g.baseURL,apiKey:"",assistantId:"__BASE__",transport:"sse"},createClient:v,children:(0,Re.jsx)(er,{initialConfig:g,persistToLocalStorage:!1,children:(0,Re.jsx)(Jn.Provider,{value:m,children:(0,Re.jsx)(no,{children:(0,Re.jsx)(ul,{className:d,onChatReady:s,onChatMessage:a,welcome:b.welcome,quickPrompts:b.quickPrompts})})})})})}function ul({className:e,onChatReady:t,onChatMessage:o,welcome:r,quickPrompts:s=[]}){let{threadId:a}=tt(),{currentAssistant:d}=et();if(!d)return null;let c=a??"";return c?(0,Re.jsx)("div",{className:e,children:(0,Re.jsx)(To,{thread_id:c,assistant_id:d.id,name:d.name,description:d.description,menu:(0,Re.jsx)(pa,{}),showProjectSelector:!1,showSkillSlot:!1,showDatabaseSlot:!1,showAgentSlot:!1,showMetricsDataSourceSlot:!1,headerRight:null,emptyStateGreeting:r?(0,Re.jsx)("span",{children:r}):void 0,senderPromptsItems:s.length>0?s.map((p,u)=>({key:`quick-${u}`,label:p.label,description:p.text})):void 0,showSkillPrompts:!1,showQuickAnalysis:!1,onChatReady:t,onChatMessage:o})}):(0,Re.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,Re.jsx)(re,{tip:"Creating conversation..."})})}export{ot as a,yi as b,hi as c,ds as d,bs as e,ko as f,Hi as g,ZC as h};
|
|
2409
|
+
`})),Us=e=>{let{assistant_id:t,thread_id:o="",menu:r,header:s,headerRight:a,showProjectSelector:d,headerSelector:c,emptyPlaceholder:p,...u}=e,{config:b}=Ce(),{styles:x}=Ws(),v=d??b.enableWorkspace,g=(0,oe.jsxs)("div",{className:x.headerBar,children:[(0,oe.jsx)("div",{className:x.headerLeft,children:c??(v?(0,oe.jsx)(Ro,{}):null)}),(0,oe.jsx)("div",{className:x.headerRight,children:a!==void 0?a:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Pn,{assistantId:t}),(0,oe.jsx)(zn,{}),(0,oe.jsx)(Go,{})]})})]});return(0,oe.jsxs)("div",{className:x.wrapper,children:[s,(0,oe.jsx)(ht,{menu:r?(0,oe.jsx)(gt,{name:"Sidebar",children:r}):void 0,header:g,main:(0,oe.jsx)(gt,{name:"Chat panel",children:o?(0,oe.jsx)(_r,{...u}):p??(0,oe.jsx)("div",{children:"Please create a conversation first"})}),detail:(0,oe.jsx)(gt,{name:"Detail panel",children:(0,oe.jsx)(po,{})}),tools:(0,oe.jsx)(gt,{name:"Tools panel",children:(0,oe.jsx)(ia,{})})})]})},Po=e=>(0,oe.jsx)(gt,{name:"Thread",children:(0,oe.jsx)(Ko,{assistantId:e.assistant_id,threadId:e.thread_id||"",options:{streaming:!0,enableReturnStateWhenStreamCompleted:!0,enableResumeStream:!0},children:(0,oe.jsx)(io.Provider,{value:null,children:(0,oe.jsx)(lt,{children:(0,oe.jsx)(Us,{...e})})})})});var nt=n(i()),Hs=({thread_id:e,name:t,description:o,headerSelector:r,...s})=>{let{currentAssistant:a}=et(),{thread:d}=tt(),c=e??d?.id??"";return c?(0,nt.jsx)(Po,{thread_id:c,name:t??a?.name,description:o??a?.description,headerSelector:r??(0,nt.jsx)(Ro,{showWorkspace:!1,disableDropdown:!1}),...s}):(0,nt.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,nt.jsx)(re,{tip:"Creating conversation..."})})},Ki=({defaultWorkspaceId:e,defaultProjectId:t,assistant_id:o,...r})=>(0,nt.jsx)(Lr,{defaultWorkspaceId:e,defaultProjectId:t,children:(0,nt.jsx)(jo,{autoLoad:!0,initialAssistantId:o,children:(0,nt.jsx)(no,{children:(0,nt.jsx)(Hs,{assistant_id:o,...r})})})});var Me=n(w());var Fe=class extends Error{code;retryable;status;constructor(t,o,r,s){super(o),this.name="AgentWebAppRuntimeClientError",this.code=t,this.retryable=r,this.status=s}};function wt(){return new Fe("STREAM_FAILED","Stream failed",!0)}var Ks=new Set(["WEB_APP_NOT_FOUND","WEB_APP_DISABLED","USER_ID_REQUIRED","INVALID_USER_ID","PROJECT_NOT_ALLOWED","PROJECT_SELECTOR_DISABLED","MODEL_NOT_ALLOWED","FEATURE_DISABLED","THREAD_NOT_FOUND","STREAM_CONFLICT","STREAM_FAILED","INVALID_REQUEST","INTERNAL_ERROR"]);function It(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Je(e,t){return Object.keys(e).length===t.length&&t.every(r=>r in e)}function qs(e){return It(e)&&Je(e,["code","message","retryable"])&&typeof e.code=="string"&&Ks.has(e.code)&&typeof e.message=="string"&&typeof e.retryable=="boolean"}function Vs(e){if(!It(e))return!1;let t=e.data===void 0?["id","type","prompt"]:["id","type","prompt","data"];return Je(e,t)&&typeof e.id=="string"&&typeof e.type=="string"&&typeof e.prompt=="string"&&(e.data===void 0||It(e.data))}var Gs=new Set([at.HUMAN,at.AI,at.TOOL,at.INTERRUPT,at.MESSAGE_COMPLETED,at.MESSAGE_FAILED,at.THREAD_IDLE]);function Qs(e,t){let o;try{o=JSON.parse(e)}catch{throw wt()}if(!It(o)||typeof o.type!="string")throw wt();if(Gs.has(o.type)||o.type==="error"&&It(o.data)&&!It(o.error)){let r=Xn(o,t);return r.length===0?[]:r}switch(o.type){case"message.delta":if(Je(o,["type","text"])&&typeof o.text=="string")return[o];break;case"message.completed":if(Je(o,["type","messageId"])&&typeof o.messageId=="string")return[o];break;case"tool.started":if(Je(o,["type","id","name"])&&typeof o.id=="string"&&typeof o.name=="string")return[o];break;case"tool.completed":if(Je(o,["type","id"])&&typeof o.id=="string")return[o];break;case"interrupt.created":if(Je(o,["type","interrupt"])&&Vs(o.interrupt))return[o];break;case"genui.render":if(Je(o,["type","block"])&&Gt(o.block))return[o];break;case"error":if(Je(o,["type","error"])&&qs(o.error))return[o];break;case"stream.completed":if(Je(o,["type"]))return[o];break}throw wt()}function Ys(e){return e instanceof Error&&e.name==="AbortError"}async function la(e,t){let o=Yn({allowGenUI:!0,allowInterrupts:!0}),r=e.getReader(),s=new TextDecoder,a="",d=!1,c=!1;try{for(;!d;){let p;try{p=await r.read()}catch(b){if(Ys(b))return;throw wt()}p.done&&(c=!0);try{a+=s.decode(p.value,{stream:!p.done})}catch{throw wt()}let u=a.split(/\r?\n\r?\n/);a=p.done?"":u.pop()??"";for(let b of u){let x=b.split(/\r?\n/).filter(v=>v==="data"||v.startsWith("data:")).map(v=>v==="data"?"":v.slice(5).replace(/^ /,""));if(x.length!==0){for(let v of Qs(x.join(`
|
|
2410
|
+
`),o))if(await t(v),d=v.type==="stream.completed",d)break;if(d)break}}if(p.done)break}if(!d)throw wt()}finally{if(!c)try{await r.cancel()}catch{}r.releaseLock()}}var Xs=new Set(["WEB_APP_NOT_FOUND","WEB_APP_DISABLED","USER_ID_REQUIRED","INVALID_USER_ID","PROJECT_NOT_ALLOWED","PROJECT_SELECTOR_DISABLED","MODEL_NOT_ALLOWED","FEATURE_DISABLED","THREAD_NOT_FOUND","STREAM_CONFLICT","STREAM_FAILED","INVALID_REQUEST","INTERNAL_ERROR"]);function Ee(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ze(e,t,o=[]){let r=Object.keys(e);return t.every(s=>s in e)&&r.every(s=>t.includes(s)||o.includes(s))}function te(e){return typeof e=="string"}function Io(e){if(!Ee(e)||!ze(e,["id","projectId","createdAt","updatedAt"],["label"])||!te(e.id)||!te(e.projectId)||e.label!==void 0&&!te(e.label)||!te(e.createdAt)||!te(e.updatedAt))return;let t=new Date(e.createdAt),o=new Date(e.updatedAt);if(!(Number.isNaN(t.getTime())||Number.isNaN(o.getTime())))return{id:e.id,projectId:e.projectId,...e.label===void 0?{}:{label:e.label},createdAt:t,updatedAt:o}}function ca(e){if(!Ee(e)||e.success!==!1||!Ee(e.error))return!1;let t=e.error;return ze(e,["success","error"])&&ze(t,["code","message","retryable"])&&typeof t.code=="string"&&Xs.has(t.code)&&typeof t.message=="string"&&typeof t.retryable=="boolean"}function Js(e){if(!Ee(e))return!1;let t=["projectSelector","modelSelector","threadManagement","attachments","hitl","genUI"];return ze(e,t,["files"])&&t.every(o=>typeof e[o]=="boolean")&&(e.files===void 0||typeof e.files=="boolean")}function Zs(e){return Array.isArray(e)&&e.length<=6&&e.every(t=>Ee(t)&&ze(t,["label","text"])&&te(t.label)&&t.label.length>=1&&t.label.length<=40&&te(t.text)&&t.text.length>=1&&t.text.length<=500)}function el(e){return Ee(e)&&ze(e,[],["title","welcomeMessage","primaryColor","quickPrompts"])&&(e.title===void 0||te(e.title))&&(e.welcomeMessage===void 0||te(e.welcomeMessage))&&(e.primaryColor===void 0||te(e.primaryColor))&&(e.quickPrompts===void 0||Zs(e.quickPrompts))}function tl(e){if(!Ee(e)||!ze(e,["webApp","projects","models"],["thread"])||!Ee(e.webApp))return;let t=e.webApp;if(!ze(t,["id","name","assistant","defaultProjectId","features","appearance","identityAssurance"],["description","defaultModelKey"])||!te(t.id)||!te(t.name)||!te(t.defaultProjectId)||t.description!==void 0&&!te(t.description)||t.defaultModelKey!==void 0&&!te(t.defaultModelKey)||t.identityAssurance!=="unverified"||!Ee(t.assistant)||!ze(t.assistant,["id","name"],["description"])||!te(t.assistant.id)||!te(t.assistant.name)||t.assistant.description!==void 0&&!te(t.assistant.description)||!Js(t.features)||!el(t.appearance)||!Array.isArray(e.projects)||!e.projects.every(r=>Ee(r)&&ze(r,["id","name"])&&te(r.id)&&te(r.name))||!Array.isArray(e.models)||!e.models.every(r=>Ee(r)&&ze(r,["key","label"])&&te(r.key)&&te(r.label)))return;let o=e.thread===void 0?void 0:Io(e.thread);if(!(e.thread!==void 0&&!o))return{...e,...o?{thread:o}:{}}}function ol(e){if(!Ee(e)||!ze(e,["records","total"])||!Array.isArray(e.records)||typeof e.total!="number")return;let t=e.records.map(Io);return t.every(o=>o!==void 0)?{records:t,total:e.total}:void 0}function nl(e){return Ee(e)&&te(e.id)&&(e.role==="human"||e.role==="ai")&&(e.content===void 0||te(e.content)||Array.isArray(e.content)&&e.content.every(t=>Gt(t)!==void 0))}function rl(e){return Ee(e)&&ze(e,["messages"])&&Array.isArray(e.messages)&&e.messages.every(nl)?e:void 0}function il(e){return Ee(e)&&ze(e,["ref","name","mimeType","size"])&&te(e.ref)&&te(e.name)&&te(e.mimeType)&&typeof e.size=="number"?e:void 0}function da(e,t){return o=>Ee(o)&&ze(o,e)&&t(o)?o:void 0}var Ao=class{constructor(t){this.options=t;this.baseUrl=`${t.gatewayUrl.replace(/\/+$/,"")}/api/web-apps/${encodeURIComponent(t.webAppId)}/runtime`,this.fetchImplementation=t.fetch??globalThis.fetch.bind(globalThis)}baseUrl;fetchImplementation;async bootstrap(t={},o){return this.request("bootstrap",tl,{query:t,signal:o})}async listThreads(t={},o){return this.request("threads",ol,{query:t,signal:o})}async createThread(t={},o){return this.request("threads",Io,{method:"POST",body:t,signal:o})}async updateThread(t,o,r){return this.request(`threads/${encodeURIComponent(t)}`,Io,{method:"PATCH",body:o,signal:r})}async deleteThread(t,o={},r){await this.request(`threads/${encodeURIComponent(t)}`,da(["id"],s=>te(s.id)),{method:"DELETE",query:o,signal:r})}async getMessages(t,o={},r){return this.request(`threads/${encodeURIComponent(t)}/messages`,rl,{query:o,signal:r})}async streamMessage(t,o,r,s){return this.streamRequest(`threads/${encodeURIComponent(t)}/messages/stream`,o,r,s)}async resumeInterrupt(t,o,r,s,a){return this.streamRequest(`threads/${encodeURIComponent(t)}/interrupts/${encodeURIComponent(o)}/resume`,r,s,a)}async streamRequest(t,o,r,s){let a;try{a=await this.fetchRequest(t,{method:"POST",body:o,signal:s})}catch(d){throw pa(d)||d instanceof Fe?d:new Fe("STREAM_FAILED","Stream failed",!0)}if(a.ok||await this.throwResponseError(a),!a.body||!a.headers.get("content-type")?.toLowerCase().includes("text/event-stream")){if(a.body)try{await a.body.cancel()}catch{}throw new Fe("STREAM_FAILED","Stream failed",!0,a.status)}await la(a.body,r)}async abort(t,o={},r){await this.request(`threads/${encodeURIComponent(t)}/abort`,da(["aborted"],s=>typeof s.aborted=="boolean"),{method:"POST",query:o,signal:r})}async uploadAttachment(t,o,r={},s){let a=new FormData,d=typeof File<"u"&&o instanceof File?o.name:"attachment";return a.append("file",o,d),this.request(`threads/${encodeURIComponent(t)}/attachments`,il,{method:"POST",query:r,body:a,signal:s})}async request(t,o,r={}){let s;try{s=await this.fetchRequest(t,r)}catch(c){throw pa(c)||c instanceof Fe?c:new Fe("INTERNAL_ERROR","Request failed",!0)}let a;try{a=await s.json()}catch{throw this.internalError(s.status)}if(ca(a))throw new Fe(a.error.code,a.error.message,a.error.retryable,s.status);if(!s.ok||!Ee(a)||!ze(a,["success","data"])||a.success!==!0)throw this.internalError(s.status);let d=o(a.data);if(d===void 0)throw this.internalError(s.status);return d}async fetchRequest(t,o){let r=await this.options.identityProvider.getIdentity(o.signal),s=new URL(`${this.baseUrl}/${t}`);for(let[c,p]of Object.entries(o.query??{}))p!==void 0&&s.searchParams.set(c,p);let a=new Headers;r.bearerToken!==void 0?a.set("Authorization",`Bearer ${r.bearerToken}`):a.set("X-Axiom-External-User-Id",r.externalUserId??"");let d;return o.body instanceof FormData?d=o.body:o.body!==void 0&&(a.set("Content-Type","application/json"),d=JSON.stringify(o.body)),this.fetchImplementation(s,{method:o.method??"GET",headers:a,body:d,signal:o.signal,credentials:"omit"})}async throwResponseError(t){let o;try{o=await t.json()}catch{throw this.internalError(t.status)}throw ca(o)?new Fe(o.error.code,o.error.message,o.error.retryable,t.status):this.internalError(t.status)}internalError(t){return new Fe("INTERNAL_ERROR","Invalid server response",!1,t)}};function pa(e){return typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError"}var Eo=n(w());var At=n(i());function ma(){let{createThread:e}=tt(),{menuCollapsed:t,setMenuCollapsed:o}=ke();(0,Eo.useEffect)(()=>{t===void 0&&o(!0)},[t,o]);let r=(0,Eo.useCallback)(async()=>{try{await e("New Thread")}catch(u){console.error("Failed to create new thread:",u)}},[e]),s=t??!0,p=[{id:"new-analysis",builtin:"new-analysis",type:"action",name:"New Thread",icon:(0,At.jsx)(hr,{size:20}),order:0},...s?[{id:"thread-history-toggle",type:"action",name:"History",icon:(0,At.jsx)(kt,{size:20}),order:1}]:[{id:"thread-history",builtin:"thread-history",type:"drawer",name:"History",icon:(0,At.jsx)(kt,{size:20}),order:1,title:"Conversation History",width:320,inline:!0,inlineDefaultExpanded:!0,content:(0,At.jsx)(_n,{})}]];return(0,At.jsx)(so,{items:p,showBranding:!1,showToggle:!0,showNewAnalysis:!1,defaultExpanded:!s,collapsed:s,onCollapsedChange:o,onNewAnalysis:r,onItemClick:u=>{u.type==="action"&&u.builtin==="new-analysis"?r():u.type==="action"&&u.id==="thread-history-toggle"&&o(!1)}},s?"agent-chat-sidebar-collapsed":"agent-chat-sidebar-expanded")}function ua(e){if(typeof window>"u"||typeof XMLHttpRequest>"u")return()=>{};let t=`${e.gatewayUrl.replace(/\/+$/,"")}/api/web-apps/${encodeURIComponent(e.webAppId)}/runtime/`,o=XMLHttpRequest.prototype.open,r=XMLHttpRequest.prototype.send,s=new WeakMap;return XMLHttpRequest.prototype.open=function(d,c){s.set(this,String(c)),o.call(this,d,c,!0)},XMLHttpRequest.prototype.send=function(d){let c=s.get(this)??"";if(!c.startsWith(t)||!/\/sandbox\/uploadfile$/.test(c)){r.call(this,d);return}if(e.identity.mode==="unverified"){this.setRequestHeader("X-Axiom-External-User-Id",e.identity.userId),r.call(this,d);return}e.identity.tokenProvider().then(p=>{this.setRequestHeader("Authorization",`Bearer ${p}`),r.call(this,d)}).catch(()=>{r.call(this,d)})},()=>{XMLHttpRequest.prototype.open=o,XMLHttpRequest.prototype.send=r}}var Re=n(i());function al(e,t){let r=ga(e.welcome)??ga(t.welcomeMessage),s=e.quickPrompts??t.quickPrompts??[];return{...r!==void 0?{welcome:r}:{},quickPrompts:s}}function ga(e){return typeof e=="string"&&e.length>0?e:void 0}function sl(e){if(!e.gatewayUrl.trim())throw new Error("AgentChatApp requires gatewayUrl");try{new URL(e.gatewayUrl)}catch{throw new Error("AgentChatApp gatewayUrl must be a valid URL")}if(!e.webAppId.trim())throw new Error("AgentChatApp requires webAppId");if(e.identity.mode==="unverified"){if(!e.identity.userId.trim())throw new Error("AgentChatApp requires identity.userId")}else if(typeof e.identity.tokenProvider!="function")throw new Error("AgentChatApp requires identity.tokenProvider");if(!e.fetch&&typeof globalThis.fetch!="function")throw new Error("AgentChatApp requires a fetch implementation")}function ll(e){return e instanceof Fe?e:new Fe("INTERNAL_ERROR","Request failed",!0)}function cl(e){return e.mode==="unverified"?`unverified:${e.userId}`:"verified:token"}function oS(e){sl(e);let t=`${e.gatewayUrl}\0${e.webAppId}\0${cl(e.identity)}`;return(0,Re.jsx)(dl,{...e},t)}function dl({gatewayUrl:e,webAppId:t,identity:o,onError:r,onChatReady:s,onChatMessage:a,fetch:d,className:c,welcome:p,quickPrompts:u}){let[b,x]=(0,Me.useState)({status:"loading"}),v=(0,Me.useRef)(o);v.current=o;let g=(0,Me.useRef)(r);g.current=r;let m=(0,Me.useRef)();return m.current||(m.current=new Ao({gatewayUrl:e,webAppId:t,identityProvider:{getIdentity:async()=>{let f=v.current;if(f.mode!=="verified")return{externalUserId:f.userId};try{return{bearerToken:await f.tokenProvider()}}catch{throw new Fe("USER_ID_REQUIRED","Identity token provider failed",!0)}}},...d?{fetch:d}:{}})),(0,Me.useEffect)(()=>ua({gatewayUrl:e,webAppId:t,identity:o}),[e,t,o]),(0,Me.useEffect)(()=>{let f=!1,W=m.current;return(async()=>{try{let j=await W.bootstrap({});if(f)return;x({status:"ready",bootstrap:j})}catch(j){if(f)return;let A=ll(j);x({status:"error",error:A}),g.current?.(A)}})(),()=>{f=!0}},[]),b.status==="loading"?(0,Re.jsx)("div",{className:c}):b.status==="error"?(0,Re.jsxs)("div",{className:c,role:"alert",children:[(0,Re.jsx)("strong",{children:"Unable to load the assistant"}),(0,Re.jsx)("div",{children:b.error.code}),(0,Re.jsx)("button",{type:"button",onClick:()=>x({status:"loading"}),children:"Retry"})]}):(0,Re.jsx)(ml,{className:c,gatewayUrl:e,webAppId:t,identity:o,bootstrap:b.bootstrap,onChatReady:s,onChatMessage:a,welcome:p,quickPrompts:u})}function pl(e){return{id:e.id,name:e.name,...e.description!==void 0?{description:e.description}:{},graphDefinition:void 0,createdAt:new Date(0),updatedAt:new Date(0)}}function ml({gatewayUrl:e,webAppId:t,identity:o,bootstrap:r,onChatReady:s,onChatMessage:a,className:d,welcome:c,quickPrompts:p}){let u=(0,Me.useMemo)(()=>pl(r.webApp.assistant),[r.webApp.assistant]),b=(0,Me.useMemo)(()=>al({welcome:c,quickPrompts:p},r.webApp.appearance),[c,p,r.webApp.appearance]),x=(0,Me.useMemo)(()=>o.mode==="unverified"?{mode:"unverified",userId:o.userId}:{mode:"verified",tokenProvider:o.tokenProvider},[o]),v=(0,Me.useCallback)(f=>new Qn({gatewayUrl:e,webAppId:t,identity:x,assistantId:f.assistantId,transport:f.transport,...f.timeout!==void 0?{timeout:f.timeout}:{},...f.headers!==void 0?{headers:f.headers}:{}}),[e,t,x]),g=(0,Me.useMemo)(()=>({baseURL:`${e.replace(/\/$/,"")}/api/web-apps/${t}/runtime`,apiKey:"",transport:"sse",assistantId:u.id,enableSkillSlot:!1,enableDatabaseSlot:!1,enableAgentSlot:!1,enableMetricsDataSourceSlot:!1,enableModelSelector:!1,enableWorkspace:!1,enableCustomMenu:!1,showSideMenu:!1,enableAssistantCreation:!1,enableAssistantEditing:!1,enableThreadCreation:!0,enableThreadList:!0}),[u.id,e,t]),m=(0,Me.useMemo)(()=>({assistants:[u],currentAssistant:u,isLoading:!1,error:null,listAssistants:async()=>{},getAssistant:async()=>u,createAssistant:async()=>{throw new Error("Not implemented in a Web App")},updateAssistant:async()=>{throw new Error("Not implemented in a Web App")},deleteAssistant:async()=>{},selectAssistant:async()=>{},clearCurrentAssistant:()=>{},refresh:async()=>{}}),[u]);return(0,Re.jsx)(Jn,{config:{baseURL:g.baseURL,apiKey:"",assistantId:"__BASE__",transport:"sse"},createClient:v,children:(0,Re.jsx)(tr,{initialConfig:g,persistToLocalStorage:!1,children:(0,Re.jsx)(Zn.Provider,{value:m,children:(0,Re.jsx)(no,{children:(0,Re.jsx)(ul,{className:d,onChatReady:s,onChatMessage:a,welcome:b.welcome,quickPrompts:b.quickPrompts})})})})})}function ul({className:e,onChatReady:t,onChatMessage:o,welcome:r,quickPrompts:s=[]}){let{threadId:a}=tt(),{currentAssistant:d}=et();if(!d)return null;let c=a??"";return c?(0,Re.jsx)("div",{className:e,children:(0,Re.jsx)(Po,{thread_id:c,assistant_id:d.id,name:d.name,description:d.description,menu:(0,Re.jsx)(ma,{}),showProjectSelector:!1,showSkillSlot:!1,showDatabaseSlot:!1,showAgentSlot:!1,showMetricsDataSourceSlot:!1,headerRight:null,emptyStateGreeting:r?(0,Re.jsx)("span",{children:r}):void 0,senderPromptsItems:s.length>0?s.map((p,u)=>({key:`quick-${u}`,label:p.label,description:p.text})):void 0,showSkillPrompts:!1,showQuickAnalysis:!1,onChatReady:t,onChatMessage:o})}):(0,Re.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,Re.jsx)(re,{tip:"Creating conversation..."})})}export{ot as a,hi as b,bi as c,ds as d,bs as e,Ro as f,Ki as g,oS as h};
|