@axiom-lattice/gateway 4.2.5 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/embed/agent-chat-loader.js +1 -1
- package/dist/embed/{embed-page-AgentDetailSideApp-YPN3NDEA.js → embed-page-AgentDetailSideApp-7FH2JSZI.js} +1 -1
- package/dist/embed/{embed-page-AgentGovernanceWorkbench-FAZQNPAM.js → embed-page-AgentGovernanceWorkbench-Y5F3ZPYC.js} +1 -1
- package/dist/embed/{embed-page-MessageGraph-CEOPX4GM.js → embed-page-MessageGraph-ONODQPG4.js} +1 -1
- package/dist/embed/{embed-page-ReactChart-NZAYQOQH.js → embed-page-ReactChart-GZQSKCUG.js} +1 -1
- package/dist/embed/{embed-page-TasksSideApp-3EAPMISU.js → embed-page-TasksSideApp-HYKCJ356.js} +1 -1
- package/dist/embed/{embed-page-TeamWorkspace-HB7ER45L.js → embed-page-TeamWorkspace-IOHS4RJV.js} +1 -1
- package/dist/embed/{embed-page-TopologyRuntimeView-O7JPR22B.js → embed-page-TopologyRuntimeView-QLMZ4OE7.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-OUXOBHXC.js → embed-page-WorkflowAutomationView-FJJSGY7Z.js} +1 -1
- package/dist/embed/{embed-page-chunk-TQPMRDLI.js → embed-page-chunk-6LL6YULZ.js} +1 -1
- package/dist/embed/{embed-page-chunk-6C2UZV63.js → embed-page-chunk-D3NRIME3.js} +1 -1
- package/dist/embed/embed-page-chunk-EMPMOO53.js +466 -0
- package/dist/embed/{embed-page-chunk-ILNGM4RN.js → embed-page-chunk-FXTSVMPN.js} +89 -38
- package/dist/embed/{embed-page-chunk-GCDGRO6A.js → embed-page-chunk-L7RMIQ7C.js} +9 -9
- package/dist/embed/{embed-page-chunk-4SKSUBXL.js → embed-page-chunk-MCUFFMAW.js} +110 -109
- package/dist/embed/{embed-page-chunk-U6JBLAYD.js → embed-page-chunk-SMQZEZYG.js} +1 -1
- package/dist/embed/{embed-page-chunk-RTVQJYET.js → embed-page-chunk-VVYB3C4O.js} +1 -1
- package/dist/embed/embed-page.js +3 -3
- package/dist/index.js +138 -144
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/dist/embed/embed-page-chunk-5XKUKLZQ.js +0 -467
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as _r}from"./embed-page-chunk-VVYB3C4O.js";import{$ as Sr,Aa as Ar,B as yr,Da as Er,Ea as Mr,Ja as Nr,K as Lo,Ka as Bt,L as hr,La as Br,Ma as C,Na as Dr,O as br,Oa as Se,P as vr,Q as st,Qa as no,R as Oo,Ra as tt,Sa as Ho,Ta as lt,Ua as ke,Va as ro,W as xr,Wa as Fr,Xa as io,Y as kt,Z as wr,_ as Cr,a as at,c as Gt,d as Qn,e as Yn,ea as to,eb as Dt,f as Jn,g as zo,h as et,i as Zt,ia as kr,k as ur,ka as oo,la as Rr,nb as zr,o as Mt,pa as Tr,q as gr,qa as Ve,rb as jr,sa as Wo,t as fr,ta as Pr,tb as $r,u as eo,ua as Ir,vb as Ko,w as Nt,za as Uo}from"./embed-page-chunk-MCUFFMAW.js";import{f as Gn,i as Oe,k as Xn,m as Zn,o as er,p as Ce,q as ue}from"./embed-page-chunk-KFUAWYJ7.js";import{a as i}from"./embed-page-chunk-MB65DZAX.js";import{$ as Vt,$b as ir,Ac as cr,Ca as qn,Eb as Qt,Fa as Ct,Gc as dr,Ia as be,Ic as pr,Ja as Le,Kc as Xt,La as P,Lc as Jt,Ma as Vn,Nc as mr,Tb as rr,V as Et,Va as jo,W as z,Y as Do,Z as xe,_ as Ne,aa as je,bc as ar,fc as sr,ia as _e,la as Kn,mb as St,mc as Yt,na as Fo,oa as de,ob as tr,pa as qe,qb as or,rc as yt,sb as $o,ta as K,tb as nr,va as re,wa as Pe,xa as q,ya as me,yb as _o,yc as lr}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 Lr=n(i()),va=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
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}=va();return(0,Lr.jsx)(z,{type:"text",size:"small",className:s.button,icon:t,onClick:o,"aria-label":e,"aria-pressed":r})};var qo=n(i()),Vo=()=>{let{toolsVisible:e,toggleTools:t}=ke();return(0,qo.jsx)(Rt,{ariaLabel:"Toggle file directory",icon:(0,qo.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)(Rr,{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()),Or={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}},xa=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
63
63
|
width: 22px;
|
|
64
64
|
height: 22px;
|
|
65
65
|
}
|
|
66
|
-
`})),
|
|
66
|
+
`})),wa=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}=xa(),{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)(()=>wa(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)(Lo,{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)(Lo,{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)(Pr,{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)(Fo,{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:{...Or,header:{padding:"16px 20px",borderBottom:"1px solid rgba(0, 0, 0, 0.04)"},content:{...Or.content,borderRadius:"0 24px 24px 0",overflow:"hidden"}},closable:!1,mask:!1,destroyOnClose:!0,children:k.content},k.id))]})};var Wr=n(w());var Ur=n(i()),{TextArea:jl}=K;var Hr=n(w());var Kr=n(i());var qr=n(i());var Tt=n(w());var Go=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},Sa=new Go;var ka=n(i()),Gl=(0,Tt.createContext)(null);var Gr=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 ui=n(w());var Aa=n(w());var Qo=n(i());var Qr=n(i());var ct=n(w());var Ma=n(i());var yc=300*1e3,hc=(0,ct.createContext)(null);var Na=n(i());var dn=n(w());var Xo=n(w());var Da=n(w());var Fa=n(i());var Xr=n(i()),Mc=C(({token:e,css:t})=>({container:t`
|
|
67
67
|
display: flex;
|
|
68
68
|
flex-direction: column;
|
|
69
69
|
height: 100%;
|
|
@@ -166,7 +166,7 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
166
166
|
gap: 2px;
|
|
167
167
|
`,emptyContainer:t`
|
|
168
168
|
padding: 24px 16px;
|
|
169
|
-
`}));var
|
|
169
|
+
`}));var Ya=n(w());var dt=n(w());var za=n(i());var Xc=(0,dt.createContext)(null);var Ot=n(w());var Ae=n(w());var N=n(i()),ja=C(({token:e,css:t})=>({container:t`
|
|
170
170
|
display: flex;
|
|
171
171
|
flex-direction: column;
|
|
172
172
|
height: 100%;
|
|
@@ -411,7 +411,7 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
411
411
|
transform: translateY(0);
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
`}))
|
|
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)})]}),lo=e=>(0,N.jsx)(jo,{style:{fontSize:12,opacity:.6}}),co=({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=Ko(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:[lo(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:[lo(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:[lo(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:[lo(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)(jo,{className:"icon"}),(0,N.jsx)("span",{children:"Select an app to start"})]})})})]})};var zt=n(w());var Jo=n(w());var Zo=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
479
479
|
font-size: 13px;
|
|
480
480
|
color: ${e.colorTextSecondary};
|
|
481
481
|
padding: 4px 0;
|
|
482
|
-
`}));var
|
|
482
|
+
`}));var Jr=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
533
533
|
color: ${e.colorTextTertiary};
|
|
534
534
|
opacity: 0;
|
|
535
535
|
transition: opacity 0.15s ease;
|
|
536
|
-
`}));var
|
|
536
|
+
`}));var Zr=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
566
566
|
`,dividerText:t`
|
|
567
567
|
font-size: 12px;
|
|
568
568
|
color: ${e.colorTextTertiary};
|
|
569
|
-
`}));var
|
|
569
|
+
`}));var jt=n(w());var ei=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
587
587
|
margin-top: 8px;
|
|
588
588
|
font-size: 13px;
|
|
589
589
|
color: ${e.colorErrorText};
|
|
590
|
-
`}));var
|
|
590
|
+
`}));var La=n(w());var ti=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
613
613
|
gap: 6px;
|
|
614
614
|
flex-shrink: 0;
|
|
615
615
|
margin-left: auto;
|
|
616
|
-
`}));var
|
|
616
|
+
`}));var $t=n(w());var po=[{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 tn=n(i());var Cp=po.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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
728
728
|
opacity: 0.7;
|
|
729
729
|
`,error:t`
|
|
730
730
|
margin-bottom: 12px;
|
|
731
|
-
`}));var
|
|
731
|
+
`}));var _t=n(w());var oi=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
778
778
|
gap: 8px;
|
|
779
779
|
font-size: 12px;
|
|
780
780
|
color: ${e.colorTextSecondary};
|
|
781
|
-
`}));var
|
|
781
|
+
`}));var cn=n(w());var ie=n(w());var on=e=>{if(!e)return"";let t=e.split("/").filter(Boolean);return t[t.length-1]??""},ni=(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=on(r.path),p=on(s.path);return o==="asc"?c.localeCompare(p):p.localeCompare(c)}let a=ni(r,t),d=ni(s,t);return a===null&&d===null?0:a===null?1:d===null?-1:o==="asc"?a-d:d-a})}function ri(e,t){let o=t.trim().toLowerCase();return o?e.filter(r=>{let s=(r.path||"").toLowerCase(),a=on(r.path).toLowerCase();return s.includes(o)||a.includes(o)}):e}function ii(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 nn(e,t="name",o="asc"){return Lt(e,t,o).map(r=>r.children?{...r,children:nn(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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
967
967
|
width: 14px;
|
|
968
968
|
height: 14px;
|
|
969
969
|
}
|
|
970
|
-
`})),oi=e=>{if(!e)return"";let t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString()},Fa=e=>{if(!e)return"";let t=e.split(/[/\\]/);return t[t.length-1]},on=e=>Fa(e.name||e.path),$a=e=>(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{style:{fontWeight:600},children:on(e)}),e.created_at?(0,y.jsxs)("div",{children:["Created: ",oi(e.created_at)]}):null,e.modified_at?(0,y.jsxs)("div",{children:["Modified: ",oi(e.modified_at)]}):null]}),ja={display:"flex",flexDirection:"column",gap:12},nn=({workspaceId:e,projectId:t,resourceFolders:o,folderEntries:r,folderLoading:s,directoryChildren:i,directoryLoading:d,directoryExpanded:c,uploadingFolder:p,onRefreshFolder:g,onUploadFolder:v,onToggleDirectory:x,onAssetClick:h})=>{let{styles:u}=za(),{message:m}=No.useApp(),{currentAssistant:b}=et(),{getFileDownloadUrl:O,downloadFolder:L,getDirectFileUrl:M,listPathByFolder:X}=Ie(),{openSideApp:ee}=Se(),{currentTenant:de}=Oe(),Q=de?.id||"",[S,B]=(0,re.useState)(null),[J,Z]=(0,re.useState)(null),{check:A,pin:ae,unpin:D,enableCustomMenu:$,get:se}=po(),_=rn(),[R,I]=(0,re.useState)(_);(0,re.useEffect)(()=>{I(_)},[_]);let[T,le]=(0,re.useState)({}),[k,oe]=(0,re.useState)(null),[z,U]=(0,re.useState)(""),[We,Ke]=(0,re.useState)(""),[Ze,ft]=(0,re.useState)(!1),[rt,W]=(0,re.useState)(""),[fe,it]=(0,re.useState)("name"),[Qe,sa]=(0,re.useState)("asc"),[Kt,Io]=(0,re.useState)(null),[la,Ao]=(0,re.useState)(!1);(0,re.useEffect)(()=>{k&&an(se).then(f=>{I(Array.from(new Set([..._,...f])).sort())})},[k]),(0,re.useEffect)(()=>{let f=rt.trim();if(!f){Io(null),Ao(!1);return}let Y=!1;return Ao(!0),Br(X,o.map(K=>K.name),b?.id).then(K=>{Y||Io(ei(K,f))}).catch(()=>{Y||Io([])}).finally(()=>{Y||Ao(!1)}),()=>{Y=!0}},[rt,X,o,b?.id]);let Eo=(0,re.useMemo)(()=>Kt?tn(ti(Kt),fe,Qe):null,[Kt,fe,Qe]),Ht=(0,re.useCallback)((f,Y)=>{if(!Y||!$)return;le(j=>j[f]?j:{...j,[f]:{isPinned:!1,pinnedId:null,loading:!0}});let K={contentType:"file",contentConfig:{resourcePath:f,tenantId:Q,workspaceId:e||"",projectId:t||"",assistantId:b?.id||"",fileName:f.split("/").pop()||f},isMatch:j=>j.resourcePath===f};A(K).then(j=>{le(He=>({...He,[f]:{...j,loading:!1}}))}).catch(()=>{le(j=>({...j,[f]:{isPinned:!1,pinnedId:null,loading:!1}}))})},[$,A,b?.id]),ca=async()=>{if(!k||!z.trim()){m.warning("Please enter a menu name");return}ft(!0);try{let f=k.split("/").pop()||k;await ae({contentType:"file",name:z.trim(),group:We.trim()||void 0,contentConfig:{resourcePath:k,tenantId:Q,workspaceId:e||"",projectId:t||"",assistantId:b?.id||"",fileName:f},isMatch:Y=>Y.resourcePath===k}),m.success("Pinned to menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),oe(null),U(""),Ke(""),le(Y=>{let K={...Y};return delete K[k],K})}catch(f){m.error(f.message||"Failed to pin")}finally{ft(!1)}},qt=(0,re.useCallback)(async(f,Y)=>{le(K=>({...K,[f]:{...K[f],loading:!0}}));try{await D(Y),m.success("Unpinned from menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),le(K=>({...K,[f]:{isPinned:!1,pinnedId:null,loading:!1}}))}catch(K){m.error(K.message||"Failed to unpin"),le(j=>({...j,[f]:{...j[f],loading:!1}}))}},[D,m]),Ln=(0,re.useCallback)(async f=>{Z(f);try{let Y=await L(f,b?.id),K=URL.createObjectURL(Y),j=document.createElement("a");j.href=K;let He=f.replace(/\/$/,"").split("/").pop()||"folder";j.download=`${He}.zip`,j.click(),window.setTimeout(()=>URL.revokeObjectURL(K),0)}catch(Y){m.error(Y instanceof Error?Y.message:"Failed to download folder")}finally{Z(null)}},[L,b?.id,m]),Mo=re.default.useCallback((f,Y)=>{let K=on(f);if(f.is_dir){let j=c[f.path]||!1,He=i[f.path]||[],da=d[f.path]||!1;return(0,y.jsxs)("div",{className:u.treeChildren,children:[(0,y.jsxs)("div",{className:u.treeRow,children:[Array.from({length:Y}).map((Ye,pa)=>(0,y.jsx)("span",{className:u.treeIndent},`${f.path}-indent-${pa}`)),(0,y.jsx)("button",{type:"button",className:u.treeToggle,"aria-label":`${j?"collapse":"expand"} ${K}`,onClick:()=>void x(f.path),children:(0,y.jsx)(Nt,{size:14,style:{transform:j?"rotate(90deg)":void 0}})}),(0,y.jsxs)("button",{type:"button",className:u.assetItem,"aria-label":`toggle ${K}`,onClick:()=>void x(f.path),title:K,children:[(0,y.jsx)("div",{className:u.assetIcon,children:(0,y.jsx)(st,{size:14})}),(0,y.jsx)("div",{className:u.assetInfo,children:(0,y.jsx)("div",{className:u.assetName,children:K})})]}),(0,y.jsx)(qe,{trigger:["click"],onOpenChange:Ye=>Ht(f.path,Ye),menu:{items:[...$?T[f.path]?.isPinned?[{key:"unpin",icon:(0,y.jsx)(Ve,{size:14}),label:"Unpin from Menu",onClick:()=>{let Ye=T[f.path];Ye?.pinnedId&&qt(f.path,Ye.pinnedId)}}]:[{key:"pin",icon:(0,y.jsx)(Ve,{size:14}),label:"Pin to Menu",onClick:()=>{oe(f.path),U(K),Ke("")}}]:[],{key:"preview",icon:(0,y.jsx)(Qt,{}),label:"Preview",onClick:()=>{let Ye=M(f.path);Ye&&ee({component_key:"attachments",data:{file_id:f.path,url:Ye},message:K})}},{key:"share",icon:(0,y.jsx)(Yt,{}),label:"Share",onClick:()=>B(f.path)},{key:"download-folder",icon:(0,y.jsx)($o,{}),label:"Download",disabled:J===f.path,onClick:()=>{Ln(f.path)}}]},children:(0,y.jsx)(F,{type:"text",size:"small",icon:(0,y.jsx)(yt,{})})})]}),j?da?(0,y.jsx)("div",{className:u.loading,children:(0,y.jsx)(ne,{size:"small"})}):He.length>0?_t(He,fe,Qe).map(Ye=>Mo(Ye,Y+1)):(0,y.jsx)("div",{className:u.emptyState,children:"No files in this folder"}):null]},f.path)}return(0,y.jsxs)("div",{className:u.treeRow,children:[Array.from({length:Y}).map((j,He)=>(0,y.jsx)("span",{className:u.treeIndent},`${f.path}-indent-${He}`)),(0,y.jsx)("span",{className:u.treeSpacer}),(0,y.jsx)(Fe,{title:$a(f),placement:"rightTop",children:(0,y.jsxs)("button",{type:"button",className:u.assetItem,onClick:()=>h(f),"aria-label":`open ${K}`,children:[(0,y.jsx)("div",{className:u.assetIcon,children:Nr(K)}),(0,y.jsx)("div",{className:u.assetInfo,children:(0,y.jsx)("div",{className:u.assetName,children:K})})]})}),(0,y.jsx)(qe,{trigger:["click"],onOpenChange:j=>Ht(f.path,j),menu:{items:[...$?T[f.path]?.isPinned?[{key:"unpin",icon:(0,y.jsx)(Ve,{size:14}),label:"Unpin from Menu",onClick:()=>{let j=T[f.path];j?.pinnedId&&qt(f.path,j.pinnedId)}}]:[{key:"pin",icon:(0,y.jsx)(Ve,{size:14}),label:"Pin to Menu",onClick:()=>{oe(f.path),U(""),Ke("")}}]:[],{key:"preview",icon:(0,y.jsx)(Qt,{}),label:"Preview",onClick:()=>h(f)},{key:"download",icon:(0,y.jsx)($o,{}),label:"Download",onClick:()=>{let j=O(f.path,b?.id);window.open(j,"_blank")}},{key:"share",icon:(0,y.jsx)(Yt,{}),label:"Share",onClick:()=>B(f.path)}]},children:(0,y.jsx)(F,{type:"text",size:"small",icon:(0,y.jsx)(yt,{})})})]},f.path)},[i,c,d,h,x,u,O,L,b?.id,$,T,Ht,qt,J,Ln,fe,Qe]),_n=(f,Y)=>{if(!f.is_dir)return Mo(f,Y);let K=on(f);return(0,y.jsxs)("div",{className:u.treeChildren,children:[(0,y.jsxs)("div",{className:u.treeRow,children:[Array.from({length:Y}).map((j,He)=>(0,y.jsx)("span",{className:u.treeIndent},`${f.path}-indent-${He}`)),(0,y.jsx)("span",{className:u.treeSpacer}),(0,y.jsxs)("button",{type:"button",className:u.assetItem,title:K,children:[(0,y.jsx)("div",{className:u.assetIcon,children:(0,y.jsx)(st,{size:14})}),(0,y.jsx)("div",{className:u.assetInfo,children:(0,y.jsx)("div",{className:u.assetName,children:K})})]}),(0,y.jsx)(qe,{trigger:["click"],onOpenChange:j=>Ht(f.path,j),menu:{items:[...$?T[f.path]?.isPinned?[{key:"unpin",icon:(0,y.jsx)(Ve,{size:14}),label:"Unpin from Menu",onClick:()=>{let j=T[f.path];j?.pinnedId&&qt(f.path,j.pinnedId)}}]:[{key:"pin",icon:(0,y.jsx)(Ve,{size:14}),label:"Pin to Menu",onClick:()=>{oe(f.path),U(K),Ke("")}}]:[],{key:"preview",icon:(0,y.jsx)(Qt,{}),label:"Preview",onClick:()=>{let j=M(f.path);j&&ee({component_key:"attachments",data:{file_id:f.path,url:j},message:K})}},{key:"share",icon:(0,y.jsx)(Yt,{}),label:"Share",onClick:()=>B(f.path)}]},children:(0,y.jsx)(F,{type:"text",size:"small",icon:(0,y.jsx)(yt,{})})})]}),f.children&&f.children.length>0?_t(f.children,fe,Qe).map(j=>_n(j,Y+1)):null]},f.path)};return t?(0,y.jsxs)("div",{className:u.container,children:[(0,y.jsxs)("h3",{className:u.header,children:[(0,y.jsx)(st,{size:16}),(0,y.jsx)("span",{children:"Files"})]}),(0,y.jsxs)("div",{className:u.toolbar,children:[(0,y.jsx)(H,{size:"small",placeholder:"Search files\u2026",allowClear:!0,value:rt,onChange:f=>W(f.target.value)}),(0,y.jsxs)("div",{className:u.toolbarRow,children:[(0,y.jsx)(Ee,{size:"small",style:{flex:1,minWidth:0},value:fe,onChange:f=>it(f),options:[{value:"name",label:"Name"},{value:"created",label:"Created"},{value:"modified",label:"Modified"}]}),(0,y.jsx)(F,{size:"small",icon:Qe==="asc"?(0,y.jsx)(Xt,{}):(0,y.jsx)(Jt,{}),onClick:()=>sa(f=>f==="asc"?"desc":"asc"),title:Qe==="asc"?"Ascending":"Descending"})]})]}),Kt!==null?(0,y.jsx)("div",{className:u.assetList,children:la?(0,y.jsx)("div",{className:u.loading,children:(0,y.jsx)(ne,{size:"small"})}):Eo&&Eo.length>0?Eo.map(f=>_n(f,0)):(0,y.jsxs)("div",{className:u.emptyState,children:['No files match "',rt.trim(),'"']})}):o.map(f=>{let Y=r[f.name]||[],K=s[f.name]||!1,j=Y.length;return(0,y.jsxs)("div",{className:u.section,children:[(0,y.jsxs)("div",{className:u.sectionHeader,children:[(0,y.jsx)("span",{className:u.sectionTitle,onClick:()=>void g(f),title:"Click to refresh",children:f.displayName||f.name}),(0,y.jsx)("span",{className:u.badge,children:j})]}),K?(0,y.jsx)("div",{className:u.loading,children:(0,y.jsx)(ne,{size:"small"})}):(0,y.jsxs)("div",{className:u.assetList,children:[_t(Y,fe,Qe).map(He=>Mo(He,0)),Y.length===0?(0,y.jsx)("div",{className:u.emptyState,children:"No files in this folder"}):null,f.allowUpload?(0,y.jsx)("button",{type:"button",className:u.uploadBtn,onClick:()=>void v(f.name),disabled:!e||!t||p===f.name,children:p===f.name?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(ne,{size:"small"}),(0,y.jsx)("span",{children:"Uploading..."})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Pr,{size:14}),(0,y.jsx)("span",{children:"Upload"})]})}):null]})]},f.name)}),S&&(0,y.jsx)(Mr,{open:!!S,filePath:S,assistantId:b?.id,fileName:S.split("/").pop(),onClose:()=>B(null)}),(0,y.jsx)(pe,{title:"Pin to Menu",open:!!k,onOk:ca,onCancel:()=>oe(null),confirmLoading:Ze,okText:"Pin",children:(0,y.jsxs)("div",{style:ja,children:[(0,y.jsx)(H,{placeholder:"Menu name (required)",value:z,onChange:f=>U(f.target.value)}),(0,y.jsx)(Vt,{placeholder:"Group (optional, select or type new)",value:We,options:R.map(f=>({value:f})),onChange:f=>Ke(f),filterOption:(f,Y)=>Y?.value?.toUpperCase().includes(f.toUpperCase())??!1})]})})]}):(0,y.jsx)("div",{className:u.emptyState,children:"Please select a project to browse files"})};var ni=n(a());var Kp=C(({token:e,css:t})=>({root:t`
|
|
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`
|
|
971
971
|
display: flex;
|
|
972
972
|
flex-direction: column;
|
|
973
973
|
height: 100%;
|
|
@@ -992,7 +992,7 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
992
992
|
flex: 1;
|
|
993
993
|
min-height: 0;
|
|
994
994
|
overflow: hidden;
|
|
995
|
-
`}));var
|
|
995
|
+
`}));var li=n(i());var Im=C(({token:e,css:t})=>({root:t`
|
|
996
996
|
display: flex;
|
|
997
997
|
flex-direction: column;
|
|
998
998
|
height: 100%;
|
|
@@ -1080,11 +1080,11 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1080
1080
|
cursor: pointer;
|
|
1081
1081
|
padding: 0;
|
|
1082
1082
|
margin-left: -8px;
|
|
1083
|
-
`}));var
|
|
1083
|
+
`}));var Xa=n(i()),zm=C(({css:e})=>({wrapper:e`
|
|
1084
1084
|
height: 100%;
|
|
1085
1085
|
width: 100%;
|
|
1086
1086
|
overflow: hidden;
|
|
1087
|
-
`}));var
|
|
1087
|
+
`}));var ci=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1105
1105
|
flex: 1;
|
|
1106
1106
|
min-height: 0;
|
|
1107
1107
|
overflow: hidden;
|
|
1108
|
-
`}));var
|
|
1108
|
+
`}));var mi=n(w());var pn=n(w());var di=n(i()),Zm=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1192
1192
|
color: ${e.colorPrimary};
|
|
1193
1193
|
`,emptyContainer:t`
|
|
1194
1194
|
padding: 24px 16px;
|
|
1195
|
-
`}));var
|
|
1195
|
+
`}));var pi=n(i()),ou=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1285
1285
|
display: flex;
|
|
1286
1286
|
flex-direction: column;
|
|
1287
1287
|
gap: 12px;
|
|
1288
|
-
`}));var
|
|
1288
|
+
`}));var mn=n(i()),uu=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1337
1337
|
flex: 1;
|
|
1338
1338
|
min-height: 0;
|
|
1339
1339
|
overflow: hidden;
|
|
1340
|
-
`}));var
|
|
1340
|
+
`}));var gi=n(i()),Iu=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1424
1424
|
&.active {
|
|
1425
1425
|
color: ${e.colorPrimary};
|
|
1426
1426
|
}
|
|
1427
|
-
`}));var
|
|
1427
|
+
`}));var ls=n(i());var Wt=n(w());var uo=18,Ou={agent:Wt.default.createElement(Mt,{size:uo}),html:Wt.default.createElement(xr,{size:uo}),custom:Wt.default.createElement(Ir,{size:uo}),file:Wt.default.createElement(br,{size:uo})};var xs=n(w());var cs=n(w());var fi=n(i());var Pi=n(w());var go=n(w());var pt=n(w());function yi(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||Zn).filter(b=>!p.has(b.type)),[o]),isLoading:s,isFallback:d}}var hi=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1538
1538
|
height: 6px;
|
|
1539
1539
|
border-radius: 9999px;
|
|
1540
1540
|
flex-shrink: 0;
|
|
1541
|
-
`}));var
|
|
1541
|
+
`}));var bi=n(i()),{Text:Zu}=P;var ge=n(w());var mt=n(w());var $e=n(i()),{Text:vi}=P,xi=({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)(vi,{style:{fontSize:12},children:v.name}),description:v.description?(0,$e.jsx)(vi,{type:"secondary",style:{fontSize:10},children:v.description}):void 0})},v.key))})]})};var l=n(i()),{Text:we}=P,un=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 at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1607
1607
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1608
1608
|
gap: 12px 16px;
|
|
1609
1609
|
padding: 8px 0;
|
|
1610
|
-
`})),go=({title:e,selectedCount:t,totalCount:o,searchPlaceholder:r,searchText:s,onSearchChange:i,onSelectAll:d,onClearAll:c,children:p,styles:g})=>{let v=o>0&&t===o;return(0,l.jsxs)("div",{className:g.dataSection,children:[(0,l.jsxs)("div",{className:g.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)(ce,{size:4,children:(0,l.jsx)(F,{type:"link",size:"small",onClick:v?c:d,children:v?"Clear":"Select All"})})]}),(0,l.jsx)("div",{style:{marginBottom:10},children:(0,l.jsx)(H,{size:"small",allowClear:!0,prefix:(0,l.jsx)(ar,{style:{fontSize:12}}),placeholder:r,value:s,onChange:x=>i(x.target.value),style:{width:"100%"}})}),(0,l.jsx)("div",{className:g.dataList,children:p})]})},os=({text:e,className:t})=>(0,l.jsx)(Fe,{title:e,placement:"topLeft",children:(0,l.jsx)("div",{className:t,children:e})}),ns=({tools:e,selectedToolNames:t,allToolNames:o,onChange:r,styles:s})=>{let i=e.length>0&&t.length===o.length,d=c=>{if(t.includes(c)){let p=t.filter(g=>g!==c);r(p.length===0?void 0:p)}else{let p=[...t,c];r(p.length===o.length&&o.every(g=>p.includes(g))?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)(ce,{size:4,children:(0,l.jsx)(F,{type:"link",size:"small",onClick:()=>r(i?[]:void 0),children:i?"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)(os,{text:c.description,className:s.toolDesc}),renderHeaderActions:()=>(0,l.jsx)(Le,{checked:p,onClick:g=>g.stopPropagation(),onChange:()=>d(c.name)})},c.id)})})]})},rs=({value:e,onChange:t,token:o,styles:r})=>{let[s,i]=(0,ue.useState)([]),[d,c]=(0,ue.useState)(!1),[p,g]=(0,ue.useState)(""),{get:v}=me(),x=(0,ue.useRef)(!1);(0,ue.useEffect)(()=>{if(x.current)return;x.current=!0,(async()=>{c(!0);try{let b=await v("/api/skills");b.success&&b.data&&Array.isArray(b.data.records)&&i(b.data.records)}catch(b){console.error("Failed to fetch skills:",b)}finally{c(!1)}})()},[v]);let h=Array.isArray(e)?e:[],u=s.filter(m=>m.name.toLowerCase().includes(p.toLowerCase())||m.description.toLowerCase().includes(p.toLowerCase()));return(0,l.jsx)(go,{title:"Skill Library",selectedCount:h.length,totalCount:s.length,searchPlaceholder:"Search skills\u2026",searchText:p,onSearchChange:g,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)(ne,{size:"small"})}):u.length===0?(0,l.jsx)(xe,{description:"No skills available",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):(0,l.jsx)(Te,{dataSource:u,split:!1,size:"small",renderItem:m=>{let b=h.includes(m.id);return(0,l.jsx)(Te.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:o.borderRadius,backgroundColor:b?o.colorSuccessBg:"transparent",border:`1px solid ${b?o.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.15s ease"},onClick:()=>t(b?h.filter(O=>O!==m.id):[...h,m.id]),children:(0,l.jsx)(Te.Item.Meta,{avatar:(0,l.jsx)(Le,{checked:b}),title:(0,l.jsx)(we,{strong:b,style:{fontSize:13},children:m.name}),description:(0,l.jsx)(we,{type:"secondary",style:{fontSize:12},ellipsis:!0,children:m.description})})},m.id)}})})},is=({value:e,onChange:t,token:o,styles:r})=>{let[s,i]=(0,ue.useState)([]),[d,c]=(0,ue.useState)(!1),[p,g]=(0,ue.useState)(""),{get:v}=me(),x=(0,ue.useRef)(!1);(0,ue.useEffect)(()=>{if(x.current)return;x.current=!0,(async()=>{c(!0);try{let b=await v("/api/database-configs");b.success&&b.data&&Array.isArray(b.data.records)&&i(b.data.records)}catch(b){console.error("Failed to fetch database configs:",b)}finally{c(!1)}})()},[v]);let h=Array.isArray(e)?e:[],u=s.filter(m=>(m.name||m.key).toLowerCase().includes(p.toLowerCase())||(m.description||"").toLowerCase().includes(p.toLowerCase()));return(0,l.jsx)(go,{title:"Databases",selectedCount:h.length,totalCount:s.length,searchPlaceholder:"Search databases\u2026",searchText:p,onSearchChange:g,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)(ne,{size:"small"})}):u.length===0?(0,l.jsx)(xe,{description:"No databases available",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):(0,l.jsx)(Te,{dataSource:u,split:!1,size:"small",renderItem:m=>{let b=h.includes(m.key);return(0,l.jsx)(Te.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:o.borderRadius,backgroundColor:b?o.colorSuccessBg:"transparent",border:`1px solid ${b?o.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.15s ease"},onClick:()=>t(b?h.filter(O=>O!==m.key):[...h,m.key]),children:(0,l.jsx)(Te.Item.Meta,{avatar:(0,l.jsx)(Le,{checked:b}),title:(0,l.jsx)(we,{strong:b,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)}})})},as=({value:e,onChange:t,token:o,styles:r})=>{let[s,i]=(0,ue.useState)([]),[d,c]=(0,ue.useState)(!1),[p,g]=(0,ue.useState)(""),{get:v}=me(),x=(0,ue.useRef)(!1);(0,ue.useEffect)(()=>{if(x.current)return;x.current=!0,(async()=>{c(!0);try{let b=await v("/api/metrics-configs");b.success&&b.data&&Array.isArray(b.data.records)&&i(b.data.records)}catch(b){console.error("Failed to fetch metrics configs:",b)}finally{c(!1)}})()},[v]);let h=Array.isArray(e)?e:[],u=s.filter(m=>(m.name||m.key).toLowerCase().includes(p.toLowerCase())||(m.description||"").toLowerCase().includes(p.toLowerCase()));return(0,l.jsx)(go,{title:"Metrics Servers",selectedCount:h.length,totalCount:s.length,searchPlaceholder:"Search servers\u2026",searchText:p,onSearchChange:g,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)(ne,{size:"small"})}):u.length===0?(0,l.jsx)(xe,{description:"No servers available",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):(0,l.jsx)(Te,{dataSource:u,split:!1,size:"small",renderItem:m=>{let b=h.includes(m.key);return(0,l.jsx)(Te.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:o.borderRadius,backgroundColor:b?o.colorSuccessBg:"transparent",border:`1px solid ${b?o.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.15s ease"},onClick:()=>t(b?h.filter(O=>O!==m.key):[...h,m.key]),children:(0,l.jsx)(Te.Item.Meta,{avatar:(0,l.jsx)(Le,{checked:b}),title:(0,l.jsx)(we,{strong:b,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)}})})},ss=({value:e,onChange:t,token:o,styles:r})=>{let[s,i]=(0,ue.useState)([]),[d,c]=(0,ue.useState)(!1),[p,g]=(0,ue.useState)(""),{get:v}=me(),x=(0,ue.useRef)(!1);(0,ue.useEffect)(()=>{x.current||(x.current=!0,c(!0),v("/api/collections").then(m=>{m.success&&i(m.data.records)}).catch(()=>{}).finally(()=>c(!1)))},[v]);let h=Array.isArray(e)?e:[],u=s.filter(m=>(m.label||m.name).toLowerCase().includes(p.toLowerCase())||m.name.toLowerCase().includes(p.toLowerCase()));return(0,l.jsx)(go,{title:"Collections",selectedCount:h.length,totalCount:s.length,searchPlaceholder:"Search collections\u2026",searchText:p,onSearchChange:g,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)(ne,{size:"small"})}):u.length===0?(0,l.jsx)(xe,{description:"No collections available",image:xe.PRESENTED_IMAGE_SIMPLE,style:{padding:12}}):(0,l.jsx)(Te,{dataSource:u,split:!1,size:"small",renderItem:m=>{let b=h.includes(m.name);return(0,l.jsx)(Te.Item,{style:{padding:"6px 8px",cursor:"pointer",borderRadius:o.borderRadius,backgroundColor:b?o.colorSuccessBg:"transparent",border:`1px solid ${b?o.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.15s ease"},onClick:()=>t(b?h.filter(O=>O!==m.name):[...h,m.name]),children:(0,l.jsx)(Te.Item.Meta,{avatar:(0,l.jsx)(Le,{checked:b}),title:(0,l.jsx)(we,{strong:b,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)}})})},ls=({value:e,onChange:t,token:o,styles:r})=>{let s=Array.isArray(e)?e:[],[i,d]=(0,ue.useState)({from:"",to:"",purpose:""}),c=()=>{!i.from.trim()||!i.to.trim()||!i.purpose.trim()||(t([...s,{...i}]),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,g)=>(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)(F,{type:"text",size:"small",danger:!0,icon:(0,l.jsx)(Zn,{}),onClick:()=>t(s.filter((v,x)=>x!==g))})]},g))}),(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)(ce,{direction:"vertical",size:6,style:{width:"100%"},children:[(0,l.jsx)(H,{size:"small",placeholder:"Source Agent ID",value:i.from,onChange:p=>d({...i,from:p.target.value})}),(0,l.jsx)(H,{size:"small",placeholder:"Target Agent ID",value:i.to,onChange:p=>d({...i,to:p.target.value})}),(0,l.jsx)(H,{size:"small",placeholder:"Purpose (e.g. classify invoice fields)",value:i.purpose,onChange:p=>d({...i,purpose:p.target.value}),onPressEnter:c}),(0,l.jsx)(F,{type:"dashed",size:"small",icon:(0,l.jsx)(rr,{}),onClick:c,disabled:!i.from.trim()||!i.to.trim()||!i.purpose.trim(),block:!0,children:"Add Edge"})]})]})]})},hi=(e,t,o,r,s)=>{let i=t.title||e,d=t.description?(0,l.jsx)(Fe,{title:t.description,children:(0,l.jsx)(ir,{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:i}),d]}),(0,l.jsx)(Ct,{size:"small",checked:o,onChange:r})]},e),gridItem:null};if(t.widget==="segmented"){let g=t.enum?.map(v=>({value:v,label:{global:"Global",agent:"Agent",project:"Project"}[v]||v}))||[];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:i}),d]}),(0,l.jsx)(On,{size:"small",value:o,onChange:r,options:g})]},e),gridItem:null}}let c=(0,l.jsxs)("span",{children:[i,d&&(0,l.jsxs)(l.Fragment,{children:["\xA0",d]})]}),p;if(t.type==="number"||t.type==="integer")p=(0,l.jsx)(H,{size:"small",type:"number",value:o,onChange:g=>r(parseFloat(g.target.value)||t.default),min:t.minimum,max:t.maximum,style:{width:"100%"}});else if(t.widget==="select"||t.enum&&!t.widget){let g=t.enumLabels,v=g?Object.entries(g).map(([x,h])=>({value:x,label:h})):t.enum?.map(x=>({value:x,label:x}))||[];p=(0,l.jsx)(Ee,{size:"small",value:o,onChange:r,options:v,style:{width:"100%"}})}else t.widget==="textarea"?p=(0,l.jsx)(H.TextArea,{size:"small",value:o,onChange:g=>r(g.target.value),placeholder:t.default,autoSize:{minRows:2,maxRows:4}}):p=(0,l.jsx)(H,{size:"small",value:o,onChange:g=>r(g.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)}},bi=({type:e})=>{let{token:t}=_e.useToken();switch(e){case"browser":return(0,l.jsx)(or,{style:{color:t.colorPrimary}});case"sql":return(0,l.jsx)(Fo,{style:{color:t.colorWarning}});case"skill":return(0,l.jsx)(lr,{style:{color:t.colorSuccess}});case"filesystem":return(0,l.jsx)(tr,{style:{color:t.colorInfo}});case"code_eval":return(0,l.jsx)(Xn,{style:{color:t.colorError}});case"metrics":return(0,l.jsx)(Zt,{size:20,style:{color:t.colorWarning}});case"topology":return(0,l.jsx)(sr,{style:{color:t.colorPrimary}});case"document-parser":return(0,l.jsx)(er,{style:{color:t.colorSuccess}});case"collection":return(0,l.jsx)(Fo,{style:{color:t.colorInfo}});default:return(0,l.jsx)(nr,{style:{color:t.colorWarning}})}},cs=({middleware:e,middlewareType:t,onToggle:o,onConfigChange:r,onAllowedToolsChange:s,enabledAriaLabel:i,sectionTitles:d,headerActions:c,token:p,styles:g,renderListSubSection:v})=>{let x=t?.schema?.properties??{},h=Object.keys(x),u=h.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=h.filter(S=>{let B=x[S];return u.includes(S)?!1:B.widget==="switch"||B.widget==="segmented"}),b=h.filter(S=>!(u.includes(S)||m.includes(S)||S==="vmIsolation")),O=u.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}),L=()=>(0,l.jsxs)(l.Fragment,{children:[m.map(S=>{let B=x[S],{row:J}=hi(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)}),b.length>0&&(0,l.jsx)("div",{className:g.configGrid,children:b.map(S=>{let B=x[S],{gridItem:J}=hi(S,B,e.config[S]??B.default,Z=>r({[S]:Z}),p);return J})})]}),M=t?.tools,X=M?.map(S=>S.name)??[],ee=e.allowedTools??X,de=M&&M.length>0,Q=m.length>0||b.length>0;return(0,l.jsxs)("div",{style:{maxWidth:960},children:[(0,l.jsxs)("div",{className:g.pageHeader,children:[(0,l.jsx)("div",{className:g.pageIcon,children:(0,l.jsx)(bi,{type:e.type})}),(0,l.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,l.jsx)("h2",{className:g.pageName,children:e.name}),(0,l.jsx)("p",{className:g.pageDesc,children:e.description})]}),(0,l.jsxs)(ce,{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":i,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:g.blockTitle,children:d?.config??"Config"}),(0,l.jsx)("div",{style:{marginTop:12},children:L()})]}),O.length>0&&(0,l.jsxs)("div",{style:{marginTop:24},children:[(0,l.jsx)("h3",{className:g.blockTitle,style:{marginBottom:4},children:d?.resources??"Resources Permission"}),O.map(S=>{let B=x[S],J=e.config[S]??B.default??[];return v(S,B,J,Z=>r({[S]:Z}),e.type)})]}),de&&M&&(0,l.jsxs)("div",{style:{marginTop:24},children:[(0,l.jsx)("h3",{className:g.blockTitle,style:{marginBottom:4},children:d?.tools??"Tools Permission"}),(0,l.jsx)(ns,{tools:M,selectedToolNames:ee,allToolNames:X,onChange:s,styles:g})]})]})},ds=e=>{let{token:t}=_e.useToken(),{styles:o}=pn();return(0,l.jsx)(cs,{...e,token:t,styles:o,renderListSubSection:(s,i,d,c,p)=>{switch(i.widget){case"skillSelect":return(0,l.jsx)(rs,{value:d,onChange:c,token:t,styles:o},s);case"databaseSelect":return(0,l.jsx)(is,{value:d,onChange:c,token:t,styles:o},s);case"metricsSelect":return(0,l.jsx)(as,{value:d,onChange:c,token:t,styles:o},s);case"collectionSelect":return(0,l.jsx)(ss,{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:i.title||"Connections"})}),(0,l.jsx)(yi,{connectionType:i.connectionType??(s==="connections"?p:""),value:d||[],onChange:c})]},s);case"topologyEdgeBuilder":return(0,l.jsx)(ls,{value:d,onChange:c,token:t,styles:o},s);default:return null}}})};var vi=n(a()),{Text:lg}=P,cg=C(({css:e,token:t})=>({toolRow:e`
|
|
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`
|
|
1611
1611
|
width: 100%;
|
|
1612
1612
|
background: ${t.colorFillQuaternary};
|
|
1613
1613
|
border-color: ${t.colorBorderSecondary};
|
|
@@ -1618,7 +1618,7 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1618
1618
|
`,toolName:e`
|
|
1619
1619
|
font-weight: 600;
|
|
1620
1620
|
font-size: 13px;
|
|
1621
|
-
`}));var
|
|
1621
|
+
`}));var ki=n(i()),{Text:Tg}=P,Pg=C(({css:e,token:t})=>({diagram:e`
|
|
1622
1622
|
display: flex;
|
|
1623
1623
|
flex-direction: column;
|
|
1624
1624
|
gap: 0;
|
|
@@ -1653,7 +1653,58 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1653
1653
|
font-size: 12px;
|
|
1654
1654
|
line-height: 1.5;
|
|
1655
1655
|
color: ${t.colorTextSecondary};
|
|
1656
|
-
`}));var
|
|
1656
|
+
`}));var Ri=n(w());var Ti=n(i());var yo=n(w());var gn=n(i()),jg=po.map(({role:e,label:t,description:o})=>({value:e,label:t,description:o})),$g=C(({token:e,css:t})=>({root:t`
|
|
1657
|
+
display: flex;
|
|
1658
|
+
flex-direction: column;
|
|
1659
|
+
gap: 24px;
|
|
1660
|
+
max-width: 720px;
|
|
1661
|
+
`,section:t`
|
|
1662
|
+
display: flex;
|
|
1663
|
+
flex-direction: column;
|
|
1664
|
+
gap: 8px;
|
|
1665
|
+
`,sectionHeader:t`
|
|
1666
|
+
display: flex;
|
|
1667
|
+
align-items: center;
|
|
1668
|
+
justify-content: space-between;
|
|
1669
|
+
gap: 8px;
|
|
1670
|
+
padding-bottom: 6px;
|
|
1671
|
+
border-bottom: 1px solid ${e.colorBorderSecondary};
|
|
1672
|
+
`,sectionTitle:t`
|
|
1673
|
+
margin: 0;
|
|
1674
|
+
font-size: 14px;
|
|
1675
|
+
font-weight: 600;
|
|
1676
|
+
color: ${e.colorText};
|
|
1677
|
+
`,sectionHint:t`
|
|
1678
|
+
font-size: 12px;
|
|
1679
|
+
color: ${e.colorTextTertiary};
|
|
1680
|
+
`,row:t`
|
|
1681
|
+
display: flex;
|
|
1682
|
+
align-items: center;
|
|
1683
|
+
gap: 10px;
|
|
1684
|
+
padding: 6px 4px;
|
|
1685
|
+
border-radius: ${e.borderRadius}px;
|
|
1686
|
+
|
|
1687
|
+
&:hover {
|
|
1688
|
+
background: ${e.colorFillQuaternary};
|
|
1689
|
+
}
|
|
1690
|
+
`,identity:t`
|
|
1691
|
+
flex: 1;
|
|
1692
|
+
min-width: 0;
|
|
1693
|
+
display: flex;
|
|
1694
|
+
flex-direction: column;
|
|
1695
|
+
`,name:t`
|
|
1696
|
+
font-size: 14px;
|
|
1697
|
+
color: ${e.colorText};
|
|
1698
|
+
white-space: nowrap;
|
|
1699
|
+
overflow: hidden;
|
|
1700
|
+
text-overflow: ellipsis;
|
|
1701
|
+
`,meta:t`
|
|
1702
|
+
font-size: 12px;
|
|
1703
|
+
color: ${e.colorTextTertiary};
|
|
1704
|
+
white-space: nowrap;
|
|
1705
|
+
overflow: hidden;
|
|
1706
|
+
text-overflow: ellipsis;
|
|
1707
|
+
`}));var fn=n(i()),{Text:nf,Title:rf}=P,af=C(({css:e,token:t})=>({layout:e`
|
|
1657
1708
|
display: flex;
|
|
1658
1709
|
height: 100%;
|
|
1659
1710
|
gap: 20px;
|
|
@@ -1686,7 +1737,7 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1686
1737
|
font-size: 13px;
|
|
1687
1738
|
font-weight: 600;
|
|
1688
1739
|
padding: 2px 8px;
|
|
1689
|
-
`}));var
|
|
1740
|
+
`}));var yn=n(i());var Ii=n(i());var Ai=n(w());var hn=n(i()),{Text:Af}=P,{TextArea:Ef}=K,{useToken:Mf}=Le;var Ei=n(w());var vn=n(i()),{Text:$f}=P,{TextArea:_f}=K,Lf=C(({token:e,css:t})=>({container:t`
|
|
1690
1741
|
height: 100%;
|
|
1691
1742
|
display: flex;
|
|
1692
1743
|
flex-direction: column;
|
|
@@ -1735,14 +1786,14 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1735
1786
|
font-size: 13px;
|
|
1736
1787
|
color: ${e.colorTextSecondary};
|
|
1737
1788
|
margin-top: 8px;
|
|
1738
|
-
`}));var
|
|
1789
|
+
`}));var bo=n(w());var Mi=n(w());var xn=n(i()),{Text:Vf}=P,Gf=C(({css:e})=>({formField:e`
|
|
1739
1790
|
margin-bottom: 16px;
|
|
1740
1791
|
`,fieldLabel:e`
|
|
1741
1792
|
display: block;
|
|
1742
1793
|
margin-bottom: 6px;
|
|
1743
1794
|
font-weight: 500;
|
|
1744
1795
|
font-size: 13px;
|
|
1745
|
-
`}));var
|
|
1796
|
+
`}));var Cs=n(i()),{Text:ny}=P;var Bi=n(w());var Ss=n(w());var Ni=n(i());var wn=n(i()),{Text:gy}=P,{TextArea:fy}=K,{useToken:yy}=Le,{Panel:hy}=Et;var xt=n(w());var Cn=n(i()),Ry=(0,xt.lazy)(()=>import("./embed-page-SkillFlow-TPESM4DI.js")),{Text:Ty}=P,{TextArea:Py}=K;var Di=n(w());var kn=n(w());var Rn=n(i()),{Text:Fy,Paragraph:zy}=P,jy=C(({token:e,css:t})=>({root:t`
|
|
1746
1797
|
height: 100%;
|
|
1747
1798
|
display: flex;
|
|
1748
1799
|
flex-direction: column;
|
|
@@ -1816,7 +1867,7 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1816
1867
|
background: ${e.colorPrimaryBg} !important;
|
|
1817
1868
|
transition: background 0.25s;
|
|
1818
1869
|
}
|
|
1819
|
-
`}));var
|
|
1870
|
+
`}));var Pn=n(i()),{Text:qy}=P,Vy=C(({token:e,css:t})=>({container:t`
|
|
1820
1871
|
padding: ${e.paddingLG}px;
|
|
1821
1872
|
height: 100%;
|
|
1822
1873
|
overflow-y: auto;
|
|
@@ -1830,7 +1881,7 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1830
1881
|
gap: ${e.marginSM}px;
|
|
1831
1882
|
margin-bottom: ${e.marginSM}px;
|
|
1832
1883
|
align-items: center;
|
|
1833
|
-
`}));var
|
|
1884
|
+
`}));var In=n(w());var Fi=n(i());var zi=n(w());var ji=n(i()),{Text:nh,Title:rh}=P;var xo=n(w());var vo=n(w());var $i=n(w());var _i=n(i()),{Text:uh}=P;var Li=n(i()),{Text:Ch}=P;var An=n(w());var En=n(i()),{Text:Nh,Paragraph:Bh}=P;var Mn=n(i()),{Text:Hh}=P;var Nn=n(w());var Oi=n(i()),{Text:Qh}=P;var Bn=n(w());var wo=n(w());var Wi=n(w());var Ui=n(i()),{Text:ab}=P;var Dn=n(i()),{Text:yb}=P;var So=n(w());var Co=n(w());var Pt=n(i()),Rs=(0,Co.lazy)(()=>import("./embed-page-TasksSideApp-HYKCJ356.js").then(e=>({default:e.TasksSideApp}))),Fn=()=>{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)(Co.Suspense,{fallback:(0,Pt.jsx)(re,{style:{display:"block",margin:"auto"}}),children:(0,Pt.jsx)(Rs,{showProjectFilter:!1})})}})}})};var Ut=n(w());var zn=n(i()),{Text:Eb}=P;var Mb=C(({css:e,token:t})=>({body:e`
|
|
1834
1885
|
display: flex;
|
|
1835
1886
|
height: 460px;
|
|
1836
1887
|
`,leftPanel:e`
|
|
@@ -1989,7 +2040,7 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
1989
2040
|
padding: 12px 24px;
|
|
1990
2041
|
border-top: 1px solid ${t.colorBorderSecondary};
|
|
1991
2042
|
flex-shrink: 0;
|
|
1992
|
-
`}));var
|
|
2043
|
+
`}));var jn=n(i()),{Title:Gb,Text:Qb,Paragraph:Yb}=P,Xb=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`
|
|
1993
2044
|
width: 56px; height: 56px; border-radius: ${t.borderRadiusLG}px;
|
|
1994
2045
|
background: linear-gradient(135deg, ${t.colorPrimary}, ${t.colorPrimaryActive});
|
|
1995
2046
|
color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; margin: 0 auto 12px;
|
|
@@ -2004,7 +2055,7 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
2004
2055
|
`,chatRoot:e` display: flex; flex-direction: column; height: 100%; min-height: 0; `,chatBar:e`
|
|
2005
2056
|
display: flex; align-items: center; justify-content: space-between;
|
|
2006
2057
|
padding: 8px 16px; border-bottom: 1px solid ${t.colorBorderSecondary}; flex-shrink: 0;
|
|
2007
|
-
`,chatFill:e` flex: 1; min-height: 0; `}));var
|
|
2058
|
+
`,chatFill:e` flex: 1; min-height: 0; `}));var Yi=n(w());var Gi=n(w());var ve=n(w());function qi(e,t){let o=t.trim().toLowerCase();return o?e.filter(r=>(r.label||"").toLowerCase().includes(o)):e}var Ki=(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 Vi(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=Ki(r,t),d=Ki(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`
|
|
2008
2059
|
padding: 4px;
|
|
2009
2060
|
font-size: 13px;
|
|
2010
2061
|
background: transparent;
|
|
@@ -2131,7 +2182,7 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
2131
2182
|
text-align: center;
|
|
2132
2183
|
color: ${e.colorTextSecondary};
|
|
2133
2184
|
font-size: 12px;
|
|
2134
|
-
`})),Dn=()=>{let{styles:e}=vs(),{threads:t,threadId:o,selectThread:r,deleteThread:s,updateThread:i,isLoading:d}=tt(),[c,p]=(0,ve.useState)(null),[g,v]=(0,ve.useState)(!1),[x,h]=(0,ve.useState)(null),[u,m]=(0,ve.useState)(""),[b,O]=(0,ve.useState)(!1),[L,M]=(0,ve.useState)(""),[X,ee]=(0,ve.useState)("updated"),[de,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){v(!0);try{await s(c),q.success("Conversation deleted"),p(null)}catch{q.error("Failed to delete conversation")}finally{v(!1)}}},[c,s]),A=(0,ve.useCallback)((R,I)=>{R.stopPropagation(),h(I.id),m(I.label)},[]),ae=(0,ve.useCallback)(async R=>{if(B.current)return;let I=u.trim();if(!I||I===R.label){h(null);return}B.current=!0,O(!0);try{await i({...R,label:I}),q.success("Conversation renamed")}catch{q.error("Failed to rename conversation")}finally{B.current=!1,O(!1),h(null)}},[u,i]),D=(0,ve.useCallback)(()=>{S.current=!0,h(null)},[]),$=(0,ve.useCallback)(R=>{R.key==="Enter"?(R.preventDefault(),R.currentTarget.blur()):R.key==="Escape"&&(R.preventDefault(),D())},[D]),se=(0,ve.useCallback)(R=>{if(S.current){S.current=!1;return}ae(R)},[ae]),_=ve.default.useMemo(()=>Oi(_i(t,L),X,de),[t,L,X,de]);return(0,V.jsxs)("div",{className:e.container,children:[(0,V.jsxs)("div",{className:e.toolbar,children:[(0,V.jsx)(H,{size:"small",placeholder:"Search conversations\u2026",allowClear:!0,value:L,onChange:R=>M(R.target.value)}),(0,V.jsxs)("div",{className:e.toolbarRow,children:[(0,V.jsx)(Ee,{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)(F,{size:"small",icon:de==="asc"?(0,V.jsx)(Xt,{}):(0,V.jsx)(Jt,{}),onClick:()=>Q(R=>R==="asc"?"desc":"asc"),title:de==="asc"?"Ascending":"Descending"})]})]}),d?(0,V.jsx)("div",{className:e.loading,children:"Loading conversations..."}):_.length===0?(0,V.jsx)("div",{className:e.emptyState,children:L.trim()?`No conversations match "${L.trim()}"`:"No conversations yet"}):(0,V.jsx)("div",{className:e.threadList,children:_.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)(xr,{size:14})}),x===R.id?(0,V.jsx)("input",{className:e.renameInput,"aria-label":"Conversation name",value:u,autoFocus:!0,disabled:b,onClick:I=>I.stopPropagation(),onFocus:I=>I.target.select(),onChange:I=>m(I.target.value),onKeyDown:I=>$(I),onBlur:()=>se(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:b,onMouseDown:I=>I.preventDefault(),onClick:I=>{I.stopPropagation(),ae(R)},children:(0,V.jsx)(pr,{size:12})}),(0,V.jsx)("button",{className:`${e.actionBtn} ${e.actionBtnVisible}`,title:"Cancel rename",disabled:b,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=>A(I,R),title:"Rename conversation",children:(0,V.jsx)(Cr,{size:12})}),(0,V.jsx)("button",{className:e.actionBtn,onClick:I=>J(I,R.id),title:"Delete conversation",children:(0,V.jsx)(Tr,{size:12})})]})]},R.id))}),(0,V.jsx)(pe,{title:"Delete Conversation",open:c!==null,onCancel:()=>p(null),onOk:Z,okText:"Delete",okButtonProps:{danger:!0,loading:g},cancelText:"Cancel",children:(0,V.jsx)("p",{children:"Are you sure you want to delete this conversation? This action cannot be undone."})})]})};var Ui=n(a());var Hi=n(a());var qi=n(w());var Vi=n(a()),{Text:sv}=P;var Rs=n(w());var zn=n(w());var Gi=n(a()),{Text:uv}=P;var ks=n(w());var Ss=n(w());var Fn=n(a());var $n=n(a()),{Dragger:Cv}=Un,{Text:Sv,Title:kv}=P;var Qi=n(a()),{Title:Nv,Text:Bv}=P;var ye=n(a()),Yi=[{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)(ur,{size:20}),order:20,group:"DataSource"},{id:"connections",builtin:"connections",type:"route",name:"Plugins",icon:(0,ye.jsx)(_o,{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)(hr,{size:20}),order:27,group:"Process"},{id:"workflows",type:"route",name:"Automations",icon:(0,ye.jsx)(Oo,{size:20}),order:25,group:"Process"},{id:"shares",type:"route",name:"Shares",icon:(0,ye.jsx)(Oo,{size:20}),order:55,group:"Settings"},{id:"workspace_migration",type:"route",name:"Migration",icon:(0,ye.jsx)(cr,{size:20}),order:56,group:"Settings"},{id:"eval",type:"route",name:"Eval",icon:(0,ye.jsx)(fr,{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)(Ar,{size:20}),order:35,group:"Settings"},{id:"collections",type:"route",name:"Collections",icon:(0,ye.jsx)(vr,{size:20}),order:29,group:"Knowledge"},{id:"mcp",builtin:"mcp",type:"route",name:"MCP",icon:(0,ye.jsx)(_o,{size:20}),order:40,group:"Settings"},{id:"a2a-keys",type:"route",name:"API Keys",icon:(0,ye.jsx)(br,{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)(Rr,{size:20}),order:46,group:"Settings"},{id:"tools",builtin:"tools",type:"route",name:"Tools",icon:(0,ye.jsx)(Ir,{size:20}),order:50,group:"Settings"},{id:"tasks",type:"route",name:"Tasks",icon:(0,ye.jsx)(to,{size:20}),order:100}];var Xx=(0,Ue.lazy)(()=>import("./embed-page-AgentGovernanceWorkbench-FAZQNPAM.js").then(e=>({default:e.AgentGovernanceWorkbench}))),Jx=(0,Ue.lazy)(()=>import("./embed-page-TopologyRuntimeView-O7JPR22B.js").then(e=>({default:e.TopologyRuntimeView}))),Zx=(0,Ue.lazy)(()=>import("./embed-page-WorkflowAutomationView-OUXOBHXC.js").then(e=>({default:e.WorkflowAutomationView}))),ew=(0,Ue.lazy)(()=>import("./embed-page-TasksSideApp-3EAPMISU.js").then(e=>({default:e.TasksSideApp}))),tw=(0,Ue.lazy)(()=>import("./embed-page-AgentDetailSideApp-YPN3NDEA.js").then(e=>({default:e.AgentDetailSideApp})));var Me=n(a());function Ts(e){let{contentType:t,assistantId:o,contentConfig:r,workspaceId:s,projectId:i}=e;return t==="agent"?{agentId:o,workspaceId:s||void 0,projectId:i||void 0}:{...r,workspaceId:s||void 0,projectId:i||void 0}}async function Ps(e,t,o){let{contentType:r,assistantId:s,contentConfig:i,isMatch:d}=t;if(!(r==="agent"?!!s:!!i)||!o)return{isPinned:!1,pinnedId:null};let p=await e("/api/menu-items?menuTarget=workspace");if(p.success&&p.data?.records){let g=d??(x=>r==="agent"&&x.agentId===s),v=p.data.records.find(x=>x.contentType===r&&g(x.contentConfig));if(v)return{isPinned:!0,pinnedId:v.id}}return{isPinned:!1,pinnedId:null}}async function Is(e,t){let{contentType:o,name:r,group:s}=t,i=Ts(t),d={menuTarget:"workspace",contentType:o,contentConfig:i,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 As(e,t){let o=await e(`/api/menu-items/${t}`);if(!o.success)throw new Error(o.message||"Failed to unpin")}function po(){let e=he.default.useContext(Er),{config:t}=Ce(),{post:o,get:r,del:s}=me(),i=t.enableCustomMenu??!1,d=(0,he.useCallback)(async g=>Ps(r,g,i),[r,i]),c=(0,he.useCallback)(async g=>Is(o,{...g,workspaceId:e?.workspaceId,projectId:e?.projectId}),[o,e]),p=(0,he.useCallback)(async g=>As(s,g),[s]);return{check:d,pin:c,unpin:p,enableCustomMenu:i,get:r}}function Xi(e){let t=new Set;for(let o of e)o.group?.trim()&&t.add(o.group.trim());return Array.from(t).sort()}function rn(){let{config:e}=Ce(),t=he.default.useMemo(()=>Xi(Yi),[]),o=he.default.useMemo(()=>Xi(e.workspaceMenuItems??[]),[e.workspaceMenuItems]);return he.default.useMemo(()=>Array.from(new Set([...t,...o])).sort(),[t,o])}async function an(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 Es={display:"flex",flexDirection:"column",gap:12},Cn=({assistantId:e,contentType:t="agent",contentConfig:o,isMatch:r,size:s="small",label:i,block:d})=>{let{check:c,pin:p,unpin:g,enableCustomMenu:v,get:x}=po(),[h,u]=(0,he.useState)(!1),[m,b]=(0,he.useState)(""),[O,L]=(0,he.useState)(""),[M,X]=(0,he.useState)(!1),[ee,de]=(0,he.useState)(!1),[Q,S]=(0,he.useState)(null),[B,J]=(0,he.useState)(!0),Z=rn(),[A,ae]=(0,he.useState)(Z);(0,he.useEffect)(()=>{ae(Z)},[Z]),(0,he.useEffect)(()=>{h&&an(x).then(I=>{ae(Array.from(new Set([...Z,...I])).sort())})},[h]);let D=t==="agent"?!!e:!!o,$=(0,he.useCallback)(async()=>{if(!D||!v){J(!1);return}J(!0);try{let I=await c({contentType:t,assistantId:e,contentConfig:o,isMatch:r});de(I.isPinned),S(I.pinnedId)}catch{}finally{J(!1)}},[D,v,c,t,e,o,r]);if((0,he.useEffect)(()=>{$()},[$]),!D||!v)return null;let se=async()=>{if(!O.trim()){q.warning("Please enter a menu name");return}X(!0);try{await p({contentType:t,assistantId:e,contentConfig:o,isMatch:r,name:O.trim(),group:m.trim()||void 0}),q.success("Pinned to menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),u(!1),b(""),L(""),$()}catch(I){q.error(I.message||"Failed to pin to menu")}finally{X(!1)}},_=async()=>{if(Q){X(!0);try{await g(Q),q.success("Unpinned from menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),de(!1),S(null)}catch(I){q.error(I.message||"Failed to unpin from menu")}finally{X(!1)}}},R=()=>{ee?_():u(!0)};return(0,Me.jsxs)(Me.Fragment,{children:[(0,Me.jsx)(Fe,{title:ee?"Unpin from Menu":"Pin to Menu",children:i?(0,Me.jsx)(F,{type:"text",size:s,block:d,icon:ee?(0,Me.jsx)(Ve,{size:14,fill:"currentColor"}):(0,Me.jsx)(Ve,{size:14}),onClick:R,loading:B||M&&ee,children:i}):(0,Me.jsx)(F,{type:"text",size:s,block:d,icon:ee?(0,Me.jsx)(Ve,{size:14,fill:"currentColor"}):(0,Me.jsx)(Ve,{size:14}),onClick:R,loading:B||M&&ee})}),(0,Me.jsx)(pe,{title:"Pin to Menu",open:h,onOk:se,onCancel:()=>u(!1),confirmLoading:M,okText:"Pin",children:(0,Me.jsxs)("div",{style:Es,children:[(0,Me.jsx)(H,{placeholder:"Menu name (required)",value:O,onChange:I=>L(I.target.value)}),(0,Me.jsx)(Vt,{placeholder:"Group (optional, select or type new)",value:m,options:A.map(I=>({value:I})),onChange:I=>b(I),filterOption:(I,T)=>T?.value?.toUpperCase().includes(I.toUpperCase())??!1})]})})]})};var ie=n(w());var G=n(a()),jn=50,Ms=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(()=>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`
|
|
2135
2186
|
position: relative;
|
|
2136
2187
|
`,projectTrigger:t`
|
|
2137
2188
|
display: flex;
|
|
@@ -2330,11 +2381,11 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
2330
2381
|
display: flex;
|
|
2331
2382
|
justify-content: flex-end;
|
|
2332
2383
|
gap: 8px;
|
|
2333
|
-
`})),
|
|
2384
|
+
`})),ko=({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>Wn?`Name must be ${Wn} 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)(gr,{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)(Oo,{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)(Oo,{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:Wn+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 ia=n(i()),ra=()=>{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,ia.jsx)(an,{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 Ro=n(w());var Qe=n(i()),{Text:_s,Paragraph:Ls}=P,aa={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&&aa[t[1]]?`${e.name}: Minified React error #${t[1]} \u2014 ${aa[t[1]]}`:`${e.name}: ${e.message}`}var gt=class extends Ro.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(`
|
|
2334
2385
|
|
|
2335
|
-
`);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,
|
|
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)(qn,{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?`
|
|
2336
2387
|
|
|
2337
|
-
`:"",o?.componentStack||""]})}]})]}),extra:[(0,
|
|
2388
|
+
`:"",o?.componentStack||""]})}]})]}),extra:[(0,Qe.jsx)(z,{icon:(0,Qe.jsx)(or,{}),onClick:this.handleCopyError,children:"Copy Details"},"copy"),(0,Qe.jsx)(z,{type:"primary",onClick:this.handleRetry,children:"Retry"},"retry")]})}return(0,Qe.jsx)(Ro.default.Fragment,{children:this.props.children},this.state.retryKey)}};var oe=n(i()),Ws=C(({css:e})=>({wrapper:e`
|
|
2338
2389
|
display: flex;
|
|
2339
2390
|
flex-direction: column;
|
|
2340
2391
|
width: 100%;
|
|
@@ -2355,5 +2406,5 @@ import{a as at,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-5XKUKLZQ.js";impo
|
|
|
2355
2406
|
align-items: center;
|
|
2356
2407
|
justify-content: flex-end;
|
|
2357
2408
|
flex-shrink: 0;
|
|
2358
|
-
`})),
|
|
2359
|
-
`),o))if(await t(h),d=h.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 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 De(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function je(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 ge(e){return typeof e=="string"}function Ro(e){if(!De(e)||!je(e,["id","projectId","createdAt","updatedAt"],["label"])||!ge(e.id)||!ge(e.projectId)||e.label!==void 0&&!ge(e.label)||!ge(e.createdAt)||!ge(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 oa(e){if(!De(e)||e.success!==!1||!De(e.error))return!1;let t=e.error;return je(e,["success","error"])&&je(t,["code","message","retryable"])&&typeof t.code=="string"&&Ks.has(t.code)&&typeof t.message=="string"&&typeof t.retryable=="boolean"}function Hs(e){if(!De(e))return!1;let t=["projectSelector","modelSelector","threadManagement","attachments","hitl","genUI"];return je(e,t,["files"])&&t.every(o=>typeof e[o]=="boolean")&&(e.files===void 0||typeof e.files=="boolean")}function qs(e){return De(e)&&je(e,[],["title","welcomeMessage","primaryColor"])&&Object.values(e).every(ge)}function Vs(e){if(!De(e)||!je(e,["webApp","projects","models"],["thread"])||!De(e.webApp))return;let t=e.webApp;if(!je(t,["id","name","assistant","defaultProjectId","features","appearance","identityAssurance"],["description","defaultModelKey"])||!ge(t.id)||!ge(t.name)||!ge(t.defaultProjectId)||t.description!==void 0&&!ge(t.description)||t.defaultModelKey!==void 0&&!ge(t.defaultModelKey)||t.identityAssurance!=="unverified"||!De(t.assistant)||!je(t.assistant,["id","name"],["description"])||!ge(t.assistant.id)||!ge(t.assistant.name)||t.assistant.description!==void 0&&!ge(t.assistant.description)||!Hs(t.features)||!qs(t.appearance)||!Array.isArray(e.projects)||!e.projects.every(r=>De(r)&&je(r,["id","name"])&&ge(r.id)&&ge(r.name))||!Array.isArray(e.models)||!e.models.every(r=>De(r)&&je(r,["key","label"])&&ge(r.key)&&ge(r.label)))return;let o=e.thread===void 0?void 0:Ro(e.thread);if(!(e.thread!==void 0&&!o))return{...e,...o?{thread:o}:{}}}function Gs(e){if(!De(e)||!je(e,["records","total"])||!Array.isArray(e.records)||typeof e.total!="number")return;let t=e.records.map(Ro);return t.every(o=>o!==void 0)?{records:t,total:e.total}:void 0}function Qs(e){return De(e)&&ge(e.id)&&(e.role==="human"||e.role==="ai")&&(e.content===void 0||ge(e.content)||Array.isArray(e.content)&&e.content.every(t=>Gt(t)!==void 0))}function Ys(e){return De(e)&&je(e,["messages"])&&Array.isArray(e.messages)&&e.messages.every(Qs)?e:void 0}function Xs(e){return De(e)&&je(e,["ref","name","mimeType","size"])&&ge(e.ref)&&ge(e.name)&&ge(e.mimeType)&&typeof e.size=="number"?e:void 0}function na(e,t){return o=>De(o)&&je(o,e)&&t(o)?o:void 0}var To=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",Vs,{query:t,signal:o})}async listThreads(t={},o){return this.request("threads",Gs,{query:t,signal:o})}async createThread(t={},o){return this.request("threads",Ro,{method:"POST",body:t,signal:o})}async updateThread(t,o,r){return this.request(`threads/${encodeURIComponent(t)}`,Ro,{method:"PATCH",body:o,signal:r})}async deleteThread(t,o={},r){await this.request(`threads/${encodeURIComponent(t)}`,na(["id"],s=>ge(s.id)),{method:"DELETE",query:o,signal:r})}async getMessages(t,o={},r){return this.request(`threads/${encodeURIComponent(t)}/messages`,Ys,{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,i){return this.streamRequest(`threads/${encodeURIComponent(t)}/interrupts/${encodeURIComponent(o)}/resume`,r,s,i)}async streamRequest(t,o,r,s){let i;try{i=await this.fetchRequest(t,{method:"POST",body:o,signal:s})}catch(d){throw ra(d)||d instanceof Be?d:new Be("STREAM_FAILED","Stream failed",!0)}if(i.ok||await this.throwResponseError(i),!i.body||!i.headers.get("content-type")?.toLowerCase().includes("text/event-stream")){if(i.body)try{await i.body.cancel()}catch{}throw new Be("STREAM_FAILED","Stream failed",!0,i.status)}await ta(i.body,r)}async abort(t,o={},r){await this.request(`threads/${encodeURIComponent(t)}/abort`,na(["aborted"],s=>typeof s.aborted=="boolean"),{method:"POST",query:o,signal:r})}async uploadAttachment(t,o,r={},s){let i=new FormData,d=typeof File<"u"&&o instanceof File?o.name:"attachment";return i.append("file",o,d),this.request(`threads/${encodeURIComponent(t)}/attachments`,Xs,{method:"POST",query:r,body:i,signal:s})}async request(t,o,r={}){let s;try{s=await this.fetchRequest(t,r)}catch(c){throw ra(c)||c instanceof Be?c:new Be("INTERNAL_ERROR","Request failed",!0)}let i;try{i=await s.json()}catch{throw this.internalError(s.status)}if(oa(i))throw new Be(i.error.code,i.error.message,i.error.retryable,s.status);if(!s.ok||!De(i)||!je(i,["success","data"])||i.success!==!0)throw this.internalError(s.status);let d=o(i.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 i=new Headers;r.bearerToken!==void 0?i.set("Authorization",`Bearer ${r.bearerToken}`):i.set("X-Axiom-External-User-Id",r.externalUserId??"");let d;return o.body instanceof FormData?d=o.body:o.body!==void 0&&(i.set("Content-Type","application/json"),d=JSON.stringify(o.body)),this.fetchImplementation(s,{method:o.method??"GET",headers:i,body:d,signal:o.signal,credentials:"omit"})}async throwResponseError(t){let o;try{o=await t.json()}catch{throw this.internalError(t.status)}throw oa(o)?new Be(o.error.code,o.error.message,o.error.retryable,t.status):this.internalError(t.status)}internalError(t){return new Be("INTERNAL_ERROR","Invalid server response",!1,t)}};function ra(e){return typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError"}var Po=n(w());var At=n(a());function ia(){let{createThread:e}=tt(),{menuCollapsed:t,setMenuCollapsed:o}=Se();(0,Po.useEffect)(()=>{t===void 0&&o(!0)},[t,o]);let r=(0,Po.useCallback)(async()=>{try{await e("New Thread")}catch(g){console.error("Failed to create new thread:",g)}},[e]),s=t??!0,p=[{id:"new-analysis",builtin:"new-analysis",type:"action",name:"New Thread",icon:(0,At.jsx)(mr,{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)(Dn,{})}]];return(0,At.jsx)(so,{items:p,showBranding:!1,showToggle:!0,showNewAnalysis:!1,defaultExpanded:!s,collapsed:s,onCollapsedChange:o,onNewAnalysis:r,onItemClick:g=>{g.type==="action"&&g.builtin==="new-analysis"?r():g.type==="action"&&g.id==="thread-history-toggle"&&o(!1)}},s?"agent-chat-sidebar-collapsed":"agent-chat-sidebar-expanded")}function aa(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(a());function Js(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 Zs(e){return e instanceof Be?e:new Be("INTERNAL_ERROR","Request failed",!0)}function el(e){return e.mode==="unverified"?`unverified:${e.userId}`:"verified:token"}function RC(e){Js(e);let t=`${e.gatewayUrl}\0${e.webAppId}\0${el(e.identity)}`;return(0,Re.jsx)(tl,{...e},t)}function tl({gatewayUrl:e,webAppId:t,identity:o,onError:r,onChatReady:s,onChatMessage:i,fetch:d,className:c}){let[p,g]=(0,ze.useState)({status:"loading"}),v=(0,ze.useRef)(o);v.current=o;let x=(0,ze.useRef)(r);x.current=r;let h=(0,ze.useRef)();return h.current||(h.current=new To({gatewayUrl:e,webAppId:t,identityProvider:{getIdentity:async()=>{let u=v.current;if(u.mode!=="verified")return{externalUserId:u.userId};try{return{bearerToken:await u.tokenProvider()}}catch{throw new Be("USER_ID_REQUIRED","Identity token provider failed",!0)}}},...d?{fetch:d}:{}})),(0,ze.useEffect)(()=>aa({gatewayUrl:e,webAppId:t,identity:o}),[e,t,o]),(0,ze.useEffect)(()=>{let u=!1,m=h.current;return(async()=>{try{let b=await m.bootstrap({});if(u)return;g({status:"ready",bootstrap:b})}catch(b){if(u)return;let O=Zs(b);g({status:"error",error:O}),x.current?.(O)}})(),()=>{u=!0}},[]),p.status==="loading"?(0,Re.jsx)("div",{className:c}):p.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:p.error.code}),(0,Re.jsx)("button",{type:"button",onClick:()=>g({status:"loading"}),children:"Retry"})]}):(0,Re.jsx)(nl,{className:c,gatewayUrl:e,webAppId:t,identity:o,bootstrap:p.bootstrap,onChatReady:s,onChatMessage:i})}function ol(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 nl({gatewayUrl:e,webAppId:t,identity:o,bootstrap:r,onChatReady:s,onChatMessage:i,className:d}){let c=(0,ze.useMemo)(()=>ol(r.webApp.assistant),[r.webApp.assistant]),p=(0,ze.useMemo)(()=>o.mode==="unverified"?{mode:"unverified",userId:o.userId}:{mode:"verified",tokenProvider:o.tokenProvider},[o]),g=(0,ze.useCallback)(h=>new Kn({gatewayUrl:e,webAppId:t,identity:p,assistantId:h.assistantId,transport:h.transport,...h.timeout!==void 0?{timeout:h.timeout}:{},...h.headers!==void 0?{headers:h.headers}:{}}),[e,t,p]),v=(0,ze.useMemo)(()=>({baseURL:`${e.replace(/\/$/,"")}/api/web-apps/${t}/runtime`,apiKey:"",transport:"sse",assistantId:c.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}),[c.id,e,t]),x=(0,ze.useMemo)(()=>({assistants:[c],currentAssistant:c,isLoading:!1,error:null,listAssistants:async()=>{},getAssistant:async()=>c,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()=>{}}),[c]);return(0,Re.jsx)(Vn,{config:{baseURL:v.baseURL,apiKey:"",assistantId:"__BASE__",transport:"sse"},createClient:g,children:(0,Re.jsx)(Yn,{initialConfig:v,persistToLocalStorage:!1,children:(0,Re.jsx)(Gn.Provider,{value:x,children:(0,Re.jsx)(no,{children:(0,Re.jsx)(rl,{className:d,onChatReady:s,onChatMessage:i})})})})})}function rl({className:e,onChatReady:t,onChatMessage:o}){let{threadId:r}=tt(),{currentAssistant:s}=et();if(!s)return null;let i=r??"";return i?(0,Re.jsx)("div",{className:e,children:(0,Re.jsx)(ko,{thread_id:i,assistant_id:s.id,name:s.name,description:s.description,menu:(0,Re.jsx)(ia,{}),showProjectSelector:!1,showSkillSlot:!1,showDatabaseSlot:!1,showAgentSlot:!1,showMetricsDataSourceSlot:!1,headerRight:null,onChatReady:t,onChatMessage:o})}):(0,Re.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,Re.jsx)(ne,{tip:"Creating conversation..."})})}export{ot as a,mi as b,ui as c,os as d,ds as e,Co as f,ji as g,RC 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)(ko,{}):null)}),(0,oe.jsx)("div",{className:x.headerRight,children:a!==void 0?a:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Tn,{assistantId:t}),(0,oe.jsx)(Fn,{}),(0,oe.jsx)(Vo,{})]})})]});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)(co,{})}),tools:(0,oe.jsx)(gt,{name:"Tools panel",children:(0,oe.jsx)(ra,{})})})]})},To=e=>(0,oe.jsx)(gt,{name:"Thread",children:(0,oe.jsx)(Ho,{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)(To,{thread_id:c,name:t??a?.name,description:o??a?.description,headerSelector:r??(0,nt.jsx)(ko,{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..."})})},Hi=({defaultWorkspaceId:e,defaultProjectId:t,assistant_id:o,...r})=>(0,nt.jsx)(_r,{defaultWorkspaceId:e,defaultProjectId:t,children:(0,nt.jsx)(zo,{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=Yn(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 sa(e,t){let o=Qn({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 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};
|