diff --git a/python/packages/devui/agent_framework_devui/ui/assets/index.js b/python/packages/devui/agent_framework_devui/ui/assets/index.js index 1f71c0cb2..492345dbc 100644 --- a/python/packages/devui/agent_framework_devui/ui/assets/index.js +++ b/python/packages/devui/agent_framework_devui/ui/assets/index.js @@ -525,7 +525,7 @@ asyncio.run(main())`})]})]}),a.jsxs("div",{className:"flex gap-2 pt-4 border-t", opacity-0 group-hover:opacity-100`,title:s?"Copied!":"Copy code",children:s?a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-green-600 dark:text-green-400",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})}function H5({content:e,className:n=""}){const s=e.split(` `),o=[];let l=0;for(;la.jsx("li",{className:"text-sm break-words",children:pn(m)},p))},o.length));continue}if(c.match(/^[\s]*\d+\.\s+/)){const f=[];for(;la.jsx("li",{className:"text-sm break-words",children:pn(m)},p))},o.length));continue}if(c.trim().startsWith("|")&&c.trim().endsWith("|")){const f=[];for(;l=2){const m=f[0].split("|").slice(1,-1).map(g=>g.trim());if(f[1].match(/^\|[\s\-:|]+\|$/)){const g=f.slice(2).map(v=>v.split("|").slice(1,-1).map(y=>y.trim()));o.push(a.jsx("div",{className:"my-3 overflow-x-auto",children:a.jsxs("table",{className:"min-w-full border border-foreground/10 text-sm",children:[a.jsx("thead",{className:"bg-foreground/5",children:a.jsx("tr",{children:m.map((v,y)=>a.jsx("th",{className:"border-b border-foreground/10 px-3 py-2 text-left font-semibold break-words",children:pn(v)},y))})}),a.jsx("tbody",{children:g.map((v,y)=>a.jsx("tr",{className:"border-b border-foreground/5 last:border-b-0",children:v.map((b,S)=>a.jsx("td",{className:"px-3 py-2 border-r border-foreground/5 last:border-r-0 break-words",children:pn(b)},S))},y))})]})},o.length));continue}}for(const m of f)o.push(a.jsx("p",{className:"my-1",children:pn(m)},o.length));continue}if(c.trim().startsWith(">")){const f=[];for(;l");)f.push(s[l].replace(/^>\s?/,"")),l++;o.push(a.jsx("blockquote",{className:"my-2 pl-4 border-l-4 border-current/30 opacity-80 italic break-words",children:f.map((m,p)=>a.jsx("div",{className:"break-words",children:pn(m)},p))},o.length));continue}if(c.match(/^[\s]*[-*_]{3,}[\s]*$/)){o.push(a.jsx("hr",{className:"my-4 border-t border-border"},o.length)),l++;continue}if(c.trim()===""){o.push(a.jsx("div",{className:"h-2"},o.length)),l++;continue}o.push(a.jsx("p",{className:"my-1 break-words",children:pn(c)},o.length)),l++}return a.jsx("div",{className:`markdown-content break-words ${n}`,children:o})}function pn(e){const n=[];let s=e,o=0;for(;s.length>0;){const l=s.match(/`([^`]+)`/);if(l&&l.index!==void 0){l.index>0&&n.push(a.jsx("span",{children:qi(s.slice(0,l.index))},o++)),n.push(a.jsx("code",{className:"px-1.5 py-0.5 bg-foreground/10 rounded text-xs font-mono border border-foreground/20",children:l[1]},o++)),s=s.slice(l.index+l[0].length);continue}n.push(a.jsx("span",{children:qi(s)},o++));break}return n}function qi(e){const n=[];let s=e,o=0;for(;s.length>0;){const l=[{regex:/\*\*\[([^\]]+)\]\(([^)]+)\)\*\*/,component:"strong-link"},{regex:/__\[([^\]]+)\]\(([^)]+)\)__/,component:"strong-link"},{regex:/\*\[([^\]]+)\]\(([^)]+)\)\*/,component:"em-link"},{regex:/_\[([^\]]+)\]\(([^)]+)\)_/,component:"em-link"},{regex:/\[([^\]]+)\]\(([^)]+)\)/,component:"link"},{regex:/\*\*(.+?)\*\*/,component:"strong"},{regex:/__(.+?)__/,component:"strong"},{regex:/\*(.+?)\*/,component:"em"},{regex:/_(.+?)_/,component:"em"}];let c=!1;for(const d of l){const f=s.match(d.regex);if(f&&f.index!==void 0){if(f.index>0&&n.push(s.slice(0,f.index)),d.component==="strong")n.push(a.jsx("strong",{className:"font-semibold",children:f[1]},o++));else if(d.component==="em")n.push(a.jsx("em",{className:"italic",children:f[1]},o++));else if(d.component==="strong-link"){const m=f[1],p=f[2],g=qi(m);n.push(a.jsx("strong",{className:"font-semibold",children:a.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-words",children:g})},o++))}else if(d.component==="em-link"){const m=f[1],p=f[2],g=qi(m);n.push(a.jsx("em",{className:"italic",children:a.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-words",children:g})},o++))}else if(d.component==="link"){const m=f[1],p=f[2],g=qi(m);n.push(a.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-words",children:g},o++))}s=s.slice(f.index+f[0].length),c=!0;break}}if(!c){s.length>0&&n.push(s);break}}return n}function $5({content:e,className:n,isStreaming:s}){if(e.type!=="text"&&e.type!=="input_text"&&e.type!=="output_text")return null;const o=e.text;return a.jsxs("div",{className:`break-words ${n||""}`,children:[a.jsx(H5,{content:o}),s&&o.length>0&&a.jsx("span",{className:"ml-1 inline-block h-2 w-2 animate-pulse rounded-full bg-current"})]})}function B5({content:e,className:n}){const[s,o]=w.useState(!1),[l,c]=w.useState(!1);if(e.type!=="input_image"&&e.type!=="output_image")return null;const d=e.image_url;return s?a.jsx("div",{className:`my-2 p-3 border rounded-lg bg-muted ${n||""}`,children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Ns,{className:"h-4 w-4"}),a.jsx("span",{children:"Image could not be loaded"})]})}):a.jsxs("div",{className:`my-2 ${n||""}`,children:[a.jsx("img",{src:d,alt:"Uploaded image",className:`rounded-lg border max-w-full transition-all cursor-pointer ${l?"max-h-none":"max-h-64"}`,onClick:()=>c(!l),onError:()=>o(!0)}),l&&a.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Click to collapse"})]})}function P5({content:e,className:n}){if(e.type!=="input_file"&&e.type!=="output_file")return null;const s=e.file_url||e.file_data,o=e.filename||"file",l=o?.toLowerCase().endsWith(".pdf")||s?.includes("application/pdf"),c=o?.toLowerCase().match(/\.(mp3|wav|m4a|ogg|flac|aac)$/);return l&&s?a.jsxs("div",{className:`my-2 ${n||""}`,children:[a.jsx("div",{className:"border rounded-lg overflow-hidden",children:a.jsx("iframe",{src:s,className:"w-full h-96",title:o})}),a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsx(Ns,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:o}),s&&a.jsxs("a",{href:s,download:o,className:"ml-auto text-xs text-primary hover:underline flex items-center gap-1",children:[a.jsx(Eu,{className:"h-3 w-3"}),"Download"]})]})]}):c&&s?a.jsxs("div",{className:`my-2 p-3 border rounded-lg ${n||""}`,children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(P1,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:o})]}),a.jsxs("audio",{controls:!0,className:"w-full",children:[a.jsx("source",{src:s}),"Your browser does not support audio playback."]})]}):a.jsx("div",{className:`my-2 p-3 border rounded-lg bg-muted ${n||""}`,children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ns,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm",children:o})]}),s&&a.jsxs("a",{href:s,download:o,className:"text-xs text-primary hover:underline flex items-center gap-1",children:[a.jsx(Eu,{className:"h-3 w-3"}),"Download"]})]})})}function U5({content:e,className:n}){const[s,o]=w.useState(!1);if(e.type!=="output_data")return null;const l=e.data,c=e.mime_type,d=e.description;let f=l;try{const m=JSON.parse(l);f=JSON.stringify(m,null,2)}catch{}return a.jsxs("div",{className:`my-2 p-3 border rounded-lg bg-muted ${n||""}`,children:[a.jsxs("div",{className:"flex items-center gap-2 cursor-pointer",onClick:()=>o(!s),children:[a.jsx(Ns,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:d||"Data Output"}),a.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:c}),s?a.jsx(Zt,{className:"h-4 w-4 text-muted-foreground"}):a.jsx(Un,{className:"h-4 w-4 text-muted-foreground"})]}),s&&a.jsx("pre",{className:"mt-2 text-xs overflow-auto max-h-64 bg-background p-2 rounded border font-mono",children:f})]})}function V5({content:e,className:n}){if(e.type!=="function_approval_request")return null;const[s,o]=w.useState(!1),{status:l,function_call:c}=e,f={pending:{icon:YA,color:"amber",label:"Awaiting Approval",bgClass:"bg-amber-50 dark:bg-amber-950/20",borderClass:"border-amber-200 dark:border-amber-800",iconClass:"text-amber-600 dark:text-amber-400",textClass:"text-amber-800 dark:text-amber-300"},approved:{icon:Ea,color:"green",label:"Approved",bgClass:"bg-green-50 dark:bg-green-950/20",borderClass:"border-green-200 dark:border-green-800",iconClass:"text-green-600 dark:text-green-400",textClass:"text-green-800 dark:text-green-300"},rejected:{icon:Ji,color:"red",label:"Rejected",bgClass:"bg-red-50 dark:bg-red-950/20",borderClass:"border-red-200 dark:border-red-800",iconClass:"text-red-600 dark:text-red-400",textClass:"text-red-800 dark:text-red-300"}}[l],m=f.icon;let p;try{p=typeof c.arguments=="string"?JSON.parse(c.arguments):c.arguments}catch{p=c.arguments}return a.jsxs("div",{className:`my-2 p-3 border rounded ${f.bgClass} ${f.borderClass} ${n||""}`,children:[a.jsxs("div",{className:"flex items-center gap-2 cursor-pointer",onClick:()=>o(!s),children:[a.jsx(m,{className:`h-4 w-4 ${f.iconClass}`}),a.jsxs("span",{className:`text-sm font-medium ${f.textClass}`,children:[f.label,": ",c.name]}),s?a.jsx(Zt,{className:`h-4 w-4 ${f.iconClass} ml-auto`}):a.jsx(Un,{className:`h-4 w-4 ${f.iconClass} ml-auto`})]}),s&&a.jsxs("div",{className:"mt-2 text-xs font-mono bg-white dark:bg-gray-900 p-2 rounded border",children:[a.jsx("div",{className:`${f.textClass} mb-1`,children:"Arguments:"}),a.jsx("pre",{className:"whitespace-pre-wrap",children:JSON.stringify(p,null,2)})]})]})}function q5({content:e,className:n,isStreaming:s}){switch(e.type){case"text":case"input_text":case"output_text":return a.jsx($5,{content:e,className:n,isStreaming:s});case"input_image":case"output_image":return a.jsx(B5,{content:e,className:n});case"input_file":case"output_file":return a.jsx(P5,{content:e,className:n});case"output_data":return a.jsx(U5,{content:e,className:n});case"function_approval_request":return a.jsx(V5,{content:e,className:n});default:return null}}function F5({name:e,arguments:n,className:s}){const[o,l]=w.useState(!1);let c;try{c=typeof n=="string"?JSON.parse(n):n}catch{c=n}return a.jsxs("div",{className:`my-2 p-3 border rounded bg-blue-50 dark:bg-blue-950/20 ${s||""}`,children:[a.jsxs("div",{className:"flex items-center gap-2 cursor-pointer",onClick:()=>l(!o),children:[a.jsx(L1,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}),a.jsxs("span",{className:"text-sm font-medium text-blue-800 dark:text-blue-300",children:["Function Call: ",e]}),o?a.jsx(Zt,{className:"h-4 w-4 text-blue-600 dark:text-blue-400 ml-auto"}):a.jsx(Un,{className:"h-4 w-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),o&&a.jsxs("div",{className:"mt-2 text-xs font-mono bg-white dark:bg-gray-900 p-2 rounded border",children:[a.jsx("div",{className:"text-blue-600 dark:text-blue-400 mb-1",children:"Arguments:"}),a.jsx("pre",{className:"whitespace-pre-wrap",children:JSON.stringify(c,null,2)})]})]})}function Y5({output:e,call_id:n,className:s}){const[o,l]=w.useState(!1);let c;try{c=typeof e=="string"?JSON.parse(e):e}catch{c=e}return a.jsxs("div",{className:`my-2 p-3 border rounded bg-green-50 dark:bg-green-950/20 ${s||""}`,children:[a.jsxs("div",{className:"flex items-center gap-2 cursor-pointer",onClick:()=>l(!o),children:[a.jsx(L1,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),a.jsx("span",{className:"text-sm font-medium text-green-800 dark:text-green-300",children:"Function Result"}),o?a.jsx(Zt,{className:"h-4 w-4 text-green-600 dark:text-green-400 ml-auto"}):a.jsx(Un,{className:"h-4 w-4 text-green-600 dark:text-green-400 ml-auto"})]}),o&&a.jsxs("div",{className:"mt-2 text-xs font-mono bg-white dark:bg-gray-900 p-2 rounded border",children:[a.jsx("div",{className:"text-green-600 dark:text-green-400 mb-1",children:"Output:"}),a.jsx("pre",{className:"whitespace-pre-wrap",children:JSON.stringify(c,null,2)}),a.jsxs("div",{className:"text-gray-500 text-[10px] mt-2",children:["Call ID: ",n]})]})]})}function Pv({item:e,className:n}){if(e.type==="message"){const s=e.status==="in_progress",o=e.content.length>0;return a.jsxs("div",{className:n,children:[e.content.map((l,c)=>a.jsx(q5,{content:l,className:c>0?"mt-2":"",isStreaming:s},c)),s&&!o&&a.jsx("div",{className:"flex items-center space-x-1",children:a.jsxs("div",{className:"flex space-x-1",children:[a.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-current [animation-delay:-0.3s]"}),a.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-current [animation-delay:-0.15s]"}),a.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-current"})]})})]})}return e.type==="function_call"?a.jsx(F5,{name:e.name,arguments:e.arguments,className:n}):e.type==="function_call_output"?a.jsx(Y5,{output:e.output,call_id:e.call_id,className:n}):null}var B2=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),G5="VisuallyHidden",X5=w.forwardRef((e,n)=>a.jsx(Pe.span,{...e,ref:n,style:{...B2,...e.style}}));X5.displayName=G5;var Z5=[" ","Enter","ArrowUp","ArrowDown"],W5=[" ","Enter"],lo="Select",[ad,id,K5]=fp(lo),[ka,_I]=ir(lo,[K5,Xu]),ld=Xu(),[Q5,ks]=ka(lo),[J5,eR]=ka(lo),P2=e=>{const{__scopeSelect:n,children:s,open:o,defaultOpen:l,onOpenChange:c,value:d,defaultValue:f,onValueChange:m,dir:p,name:g,autoComplete:v,disabled:y,required:b,form:S}=e,N=ld(n),[_,E]=w.useState(null),[M,j]=w.useState(null),[k,R]=w.useState(!1),D=ml(p),[z,H]=so({prop:o,defaultProp:l??!1,onChange:c,caller:lo}),[B,X]=so({prop:d,defaultProp:f,onChange:m,caller:lo}),Q=w.useRef(null),G=_?S||!!_.closest("form"):!0,[re,L]=w.useState(new Set),V=Array.from(re).map(A=>A.props.value).join(";");return a.jsx(zw,{...N,children:a.jsxs(Q5,{required:b,scope:n,trigger:_,onTriggerChange:E,valueNode:M,onValueNodeChange:j,valueNodeHasChildren:k,onValueNodeHasChildrenChange:R,contentId:oo(),value:B,onValueChange:X,open:z,onOpenChange:H,dir:D,triggerPointerDownPosRef:Q,disabled:y,children:[a.jsx(ad.Provider,{scope:n,children:a.jsx(J5,{scope:e.__scopeSelect,onNativeOptionAdd:w.useCallback(A=>{L(I=>new Set(I).add(A))},[]),onNativeOptionRemove:w.useCallback(A=>{L(I=>{const $=new Set(I);return $.delete(A),$})},[]),children:s})}),G?a.jsxs(cN,{"aria-hidden":!0,required:b,tabIndex:-1,name:g,autoComplete:v,value:B,onChange:A=>X(A.target.value),disabled:y,form:S,children:[B===void 0?a.jsx("option",{value:""}):null,Array.from(re)]},V):null]})})};P2.displayName=lo;var U2="SelectTrigger",V2=w.forwardRef((e,n)=>{const{__scopeSelect:s,disabled:o=!1,...l}=e,c=ld(s),d=ks(U2,s),f=d.disabled||o,m=et(n,d.onTriggerChange),p=id(s),g=w.useRef("touch"),[v,y,b]=dN(N=>{const _=p().filter(j=>!j.disabled),E=_.find(j=>j.value===d.value),M=fN(_,N,E);M!==void 0&&d.onValueChange(M.value)}),S=N=>{f||(d.onOpenChange(!0),b()),N&&(d.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return a.jsx(Iw,{asChild:!0,...c,children:a.jsx(Pe.button,{type:"button",role:"combobox","aria-controls":d.contentId,"aria-expanded":d.open,"aria-required":d.required,"aria-autocomplete":"none",dir:d.dir,"data-state":d.open?"open":"closed",disabled:f,"data-disabled":f?"":void 0,"data-placeholder":uN(d.value)?"":void 0,...l,ref:m,onClick:Me(l.onClick,N=>{N.currentTarget.focus(),g.current!=="mouse"&&S(N)}),onPointerDown:Me(l.onPointerDown,N=>{g.current=N.pointerType;const _=N.target;_.hasPointerCapture(N.pointerId)&&_.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(S(N),N.preventDefault())}),onKeyDown:Me(l.onKeyDown,N=>{const _=v.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&y(N.key),!(_&&N.key===" ")&&Z5.includes(N.key)&&(S(),N.preventDefault())})})})});V2.displayName=U2;var q2="SelectValue",F2=w.forwardRef((e,n)=>{const{__scopeSelect:s,className:o,style:l,children:c,placeholder:d="",...f}=e,m=ks(q2,s),{onValueNodeHasChildrenChange:p}=m,g=c!==void 0,v=et(n,m.onValueNodeChange);return Vt(()=>{p(g)},[p,g]),a.jsx(Pe.span,{...f,ref:v,style:{pointerEvents:"none"},children:uN(m.value)?a.jsx(a.Fragment,{children:d}):c})});F2.displayName=q2;var tR="SelectIcon",Y2=w.forwardRef((e,n)=>{const{__scopeSelect:s,children:o,...l}=e;return a.jsx(Pe.span,{"aria-hidden":!0,...l,ref:n,children:o||"▼"})});Y2.displayName=tR;var nR="SelectPortal",G2=e=>a.jsx(jp,{asChild:!0,...e});G2.displayName=nR;var co="SelectContent",X2=w.forwardRef((e,n)=>{const s=ks(co,e.__scopeSelect),[o,l]=w.useState();if(Vt(()=>{l(new DocumentFragment)},[]),!s.open){const c=o;return c?fl.createPortal(a.jsx(Z2,{scope:e.__scopeSelect,children:a.jsx(ad.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),c):null}return a.jsx(W2,{...e,ref:n})});X2.displayName=co;var In=10,[Z2,As]=ka(co),rR="SelectContentImpl",sR=da("SelectContent.RemoveScroll"),W2=w.forwardRef((e,n)=>{const{__scopeSelect:s,position:o="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,side:f,sideOffset:m,align:p,alignOffset:g,arrowPadding:v,collisionBoundary:y,collisionPadding:b,sticky:S,hideWhenDetached:N,avoidCollisions:_,...E}=e,M=ks(co,s),[j,k]=w.useState(null),[R,D]=w.useState(null),z=et(n,ne=>k(ne)),[H,B]=w.useState(null),[X,Q]=w.useState(null),G=id(s),[re,L]=w.useState(!1),V=w.useRef(!1);w.useEffect(()=>{if(j)return Gw(j)},[j]),fw();const A=w.useCallback(ne=>{const[ie,...ve]=G().map(be=>be.ref.current),[we]=ve.slice(-1),je=document.activeElement;for(const be of ne)if(be===je||(be?.scrollIntoView({block:"nearest"}),be===ie&&R&&(R.scrollTop=0),be===we&&R&&(R.scrollTop=R.scrollHeight),be?.focus(),document.activeElement!==je))return},[G,R]),I=w.useCallback(()=>A([H,j]),[A,H,j]);w.useEffect(()=>{re&&I()},[re,I]);const{onOpenChange:$,triggerPointerDownPosRef:U}=M;w.useEffect(()=>{if(j){let ne={x:0,y:0};const ie=we=>{ne={x:Math.abs(Math.round(we.pageX)-(U.current?.x??0)),y:Math.abs(Math.round(we.pageY)-(U.current?.y??0))}},ve=we=>{ne.x<=10&&ne.y<=10?we.preventDefault():j.contains(we.target)||$(!1),document.removeEventListener("pointermove",ie),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",ve,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",ve,{capture:!0})}}},[j,$,U]),w.useEffect(()=>{const ne=()=>$(!1);return window.addEventListener("blur",ne),window.addEventListener("resize",ne),()=>{window.removeEventListener("blur",ne),window.removeEventListener("resize",ne)}},[$]);const[T,P]=dN(ne=>{const ie=G().filter(je=>!je.disabled),ve=ie.find(je=>je.ref.current===document.activeElement),we=fN(ie,ne,ve);we&&setTimeout(()=>we.ref.current.focus())}),K=w.useCallback((ne,ie,ve)=>{const we=!V.current&&!ve;(M.value!==void 0&&M.value===ie||we)&&(B(ne),we&&(V.current=!0))},[M.value]),W=w.useCallback(()=>j?.focus(),[j]),se=w.useCallback((ne,ie,ve)=>{const we=!V.current&&!ve;(M.value!==void 0&&M.value===ie||we)&&Q(ne)},[M.value]),ce=o==="popper"?Uh:K2,fe=ce===Uh?{side:f,sideOffset:m,align:p,alignOffset:g,arrowPadding:v,collisionBoundary:y,collisionPadding:b,sticky:S,hideWhenDetached:N,avoidCollisions:_}:{};return a.jsx(Z2,{scope:s,content:j,viewport:R,onViewportChange:D,itemRefCallback:K,selectedItem:H,onItemLeave:W,itemTextRefCallback:se,focusSelectedItem:I,selectedItemText:X,position:o,isPositioned:re,searchRef:T,children:a.jsx(_p,{as:sR,allowPinchZoom:!0,children:a.jsx(hp,{asChild:!0,trapped:M.open,onMountAutoFocus:ne=>{ne.preventDefault()},onUnmountAutoFocus:Me(l,ne=>{M.trigger?.focus({preventScroll:!0}),ne.preventDefault()}),children:a.jsx(mp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:ne=>ne.preventDefault(),onDismiss:()=>M.onOpenChange(!1),children:a.jsx(ce,{role:"listbox",id:M.contentId,"data-state":M.open?"open":"closed",dir:M.dir,onContextMenu:ne=>ne.preventDefault(),...E,...fe,onPlaced:()=>L(!0),ref:z,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:Me(E.onKeyDown,ne=>{const ie=ne.ctrlKey||ne.altKey||ne.metaKey;if(ne.key==="Tab"&&ne.preventDefault(),!ie&&ne.key.length===1&&P(ne.key),["ArrowUp","ArrowDown","Home","End"].includes(ne.key)){let we=G().filter(je=>!je.disabled).map(je=>je.ref.current);if(["ArrowUp","End"].includes(ne.key)&&(we=we.slice().reverse()),["ArrowUp","ArrowDown"].includes(ne.key)){const je=ne.target,be=we.indexOf(je);we=we.slice(be+1)}setTimeout(()=>A(we)),ne.preventDefault()}})})})})})})});W2.displayName=rR;var oR="SelectItemAlignedPosition",K2=w.forwardRef((e,n)=>{const{__scopeSelect:s,onPlaced:o,...l}=e,c=ks(co,s),d=As(co,s),[f,m]=w.useState(null),[p,g]=w.useState(null),v=et(n,z=>g(z)),y=id(s),b=w.useRef(!1),S=w.useRef(!0),{viewport:N,selectedItem:_,selectedItemText:E,focusSelectedItem:M}=d,j=w.useCallback(()=>{if(c.trigger&&c.valueNode&&f&&p&&N&&_&&E){const z=c.trigger.getBoundingClientRect(),H=p.getBoundingClientRect(),B=c.valueNode.getBoundingClientRect(),X=E.getBoundingClientRect();if(c.dir!=="rtl"){const je=X.left-H.left,be=B.left-je,Te=z.left-be,ee=z.width+Te,Re=Math.max(ee,H.width),Ve=window.innerWidth-In,We=$h(be,[In,Math.max(In,Ve-Re)]);f.style.minWidth=ee+"px",f.style.left=We+"px"}else{const je=H.right-X.right,be=window.innerWidth-B.right-je,Te=window.innerWidth-z.right-be,ee=z.width+Te,Re=Math.max(ee,H.width),Ve=window.innerWidth-In,We=$h(be,[In,Math.max(In,Ve-Re)]);f.style.minWidth=ee+"px",f.style.right=We+"px"}const Q=y(),G=window.innerHeight-In*2,re=N.scrollHeight,L=window.getComputedStyle(p),V=parseInt(L.borderTopWidth,10),A=parseInt(L.paddingTop,10),I=parseInt(L.borderBottomWidth,10),$=parseInt(L.paddingBottom,10),U=V+A+re+$+I,T=Math.min(_.offsetHeight*5,U),P=window.getComputedStyle(N),K=parseInt(P.paddingTop,10),W=parseInt(P.paddingBottom,10),se=z.top+z.height/2-In,ce=G-se,fe=_.offsetHeight/2,ne=_.offsetTop+fe,ie=V+A+ne,ve=U-ie;if(ie<=se){const je=Q.length>0&&_===Q[Q.length-1].ref.current;f.style.bottom="0px";const be=p.clientHeight-N.offsetTop-N.offsetHeight,Te=Math.max(ce,fe+(je?W:0)+be+I),ee=ie+Te;f.style.height=ee+"px"}else{const je=Q.length>0&&_===Q[0].ref.current;f.style.top="0px";const Te=Math.max(se,V+N.offsetTop+(je?K:0)+fe)+ve;f.style.height=Te+"px",N.scrollTop=ie-se+N.offsetTop}f.style.margin=`${In}px 0`,f.style.minHeight=T+"px",f.style.maxHeight=G+"px",o?.(),requestAnimationFrame(()=>b.current=!0)}},[y,c.trigger,c.valueNode,f,p,N,_,E,c.dir,o]);Vt(()=>j(),[j]);const[k,R]=w.useState();Vt(()=>{p&&R(window.getComputedStyle(p).zIndex)},[p]);const D=w.useCallback(z=>{z&&S.current===!0&&(j(),M?.(),S.current=!1)},[j,M]);return a.jsx(iR,{scope:s,contentWrapper:f,shouldExpandOnScrollRef:b,onScrollButtonChange:D,children:a.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:a.jsx(Pe.div,{...l,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});K2.displayName=oR;var aR="SelectPopperPosition",Uh=w.forwardRef((e,n)=>{const{__scopeSelect:s,align:o="start",collisionPadding:l=In,...c}=e,d=ld(s);return a.jsx(Lw,{...d,...c,ref:n,align:o,collisionPadding:l,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Uh.displayName=aR;var[iR,Qp]=ka(co,{}),Vh="SelectViewport",Q2=w.forwardRef((e,n)=>{const{__scopeSelect:s,nonce:o,...l}=e,c=As(Vh,s),d=Qp(Vh,s),f=et(n,c.onViewportChange),m=w.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),a.jsx(ad.Slot,{scope:s,children:a.jsx(Pe.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:Me(l.onScroll,p=>{const g=p.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:y}=d;if(y?.current&&v){const b=Math.abs(m.current-g.scrollTop);if(b>0){const S=window.innerHeight-In*2,N=parseFloat(v.style.minHeight),_=parseFloat(v.style.height),E=Math.max(N,_);if(E0?k:0,v.style.justifyContent="flex-end")}}}m.current=g.scrollTop})})})]})});Q2.displayName=Vh;var J2="SelectGroup",[lR,cR]=ka(J2),uR=w.forwardRef((e,n)=>{const{__scopeSelect:s,...o}=e,l=oo();return a.jsx(lR,{scope:s,id:l,children:a.jsx(Pe.div,{role:"group","aria-labelledby":l,...o,ref:n})})});uR.displayName=J2;var eN="SelectLabel",dR=w.forwardRef((e,n)=>{const{__scopeSelect:s,...o}=e,l=cR(eN,s);return a.jsx(Pe.div,{id:l.id,...o,ref:n})});dR.displayName=eN;var Tu="SelectItem",[fR,tN]=ka(Tu),nN=w.forwardRef((e,n)=>{const{__scopeSelect:s,value:o,disabled:l=!1,textValue:c,...d}=e,f=ks(Tu,s),m=As(Tu,s),p=f.value===o,[g,v]=w.useState(c??""),[y,b]=w.useState(!1),S=et(n,M=>m.itemRefCallback?.(M,o,l)),N=oo(),_=w.useRef("touch"),E=()=>{l||(f.onValueChange(o),f.onOpenChange(!1))};if(o==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(fR,{scope:s,value:o,disabled:l,textId:N,isSelected:p,onItemTextChange:w.useCallback(M=>{v(j=>j||(M?.textContent??"").trim())},[]),children:a.jsx(ad.ItemSlot,{scope:s,value:o,disabled:l,textValue:g,children:a.jsx(Pe.div,{role:"option","aria-labelledby":N,"data-highlighted":y?"":void 0,"aria-selected":p&&y,"data-state":p?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...d,ref:S,onFocus:Me(d.onFocus,()=>b(!0)),onBlur:Me(d.onBlur,()=>b(!1)),onClick:Me(d.onClick,()=>{_.current!=="mouse"&&E()}),onPointerUp:Me(d.onPointerUp,()=>{_.current==="mouse"&&E()}),onPointerDown:Me(d.onPointerDown,M=>{_.current=M.pointerType}),onPointerMove:Me(d.onPointerMove,M=>{_.current=M.pointerType,l?m.onItemLeave?.():_.current==="mouse"&&M.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Me(d.onPointerLeave,M=>{M.currentTarget===document.activeElement&&m.onItemLeave?.()}),onKeyDown:Me(d.onKeyDown,M=>{m.searchRef?.current!==""&&M.key===" "||(W5.includes(M.key)&&E(),M.key===" "&&M.preventDefault())})})})})});nN.displayName=Tu;var Bi="SelectItemText",rN=w.forwardRef((e,n)=>{const{__scopeSelect:s,className:o,style:l,...c}=e,d=ks(Bi,s),f=As(Bi,s),m=tN(Bi,s),p=eR(Bi,s),[g,v]=w.useState(null),y=et(n,E=>v(E),m.onItemTextChange,E=>f.itemTextRefCallback?.(E,m.value,m.disabled)),b=g?.textContent,S=w.useMemo(()=>a.jsx("option",{value:m.value,disabled:m.disabled,children:b},m.value),[m.disabled,m.value,b]),{onNativeOptionAdd:N,onNativeOptionRemove:_}=p;return Vt(()=>(N(S),()=>_(S)),[N,_,S]),a.jsxs(a.Fragment,{children:[a.jsx(Pe.span,{id:m.textId,...c,ref:y}),m.isSelected&&d.valueNode&&!d.valueNodeHasChildren?fl.createPortal(c.children,d.valueNode):null]})});rN.displayName=Bi;var sN="SelectItemIndicator",oN=w.forwardRef((e,n)=>{const{__scopeSelect:s,...o}=e;return tN(sN,s).isSelected?a.jsx(Pe.span,{"aria-hidden":!0,...o,ref:n}):null});oN.displayName=sN;var qh="SelectScrollUpButton",aN=w.forwardRef((e,n)=>{const s=As(qh,e.__scopeSelect),o=Qp(qh,e.__scopeSelect),[l,c]=w.useState(!1),d=et(n,o.onScrollButtonChange);return Vt(()=>{if(s.viewport&&s.isPositioned){let f=function(){const p=m.scrollTop>0;c(p)};const m=s.viewport;return f(),m.addEventListener("scroll",f),()=>m.removeEventListener("scroll",f)}},[s.viewport,s.isPositioned]),l?a.jsx(lN,{...e,ref:d,onAutoScroll:()=>{const{viewport:f,selectedItem:m}=s;f&&m&&(f.scrollTop=f.scrollTop-m.offsetHeight)}}):null});aN.displayName=qh;var Fh="SelectScrollDownButton",iN=w.forwardRef((e,n)=>{const s=As(Fh,e.__scopeSelect),o=Qp(Fh,e.__scopeSelect),[l,c]=w.useState(!1),d=et(n,o.onScrollButtonChange);return Vt(()=>{if(s.viewport&&s.isPositioned){let f=function(){const p=m.scrollHeight-m.clientHeight,g=Math.ceil(m.scrollTop)m.removeEventListener("scroll",f)}},[s.viewport,s.isPositioned]),l?a.jsx(lN,{...e,ref:d,onAutoScroll:()=>{const{viewport:f,selectedItem:m}=s;f&&m&&(f.scrollTop=f.scrollTop+m.offsetHeight)}}):null});iN.displayName=Fh;var lN=w.forwardRef((e,n)=>{const{__scopeSelect:s,onAutoScroll:o,...l}=e,c=As("SelectScrollButton",s),d=w.useRef(null),f=id(s),m=w.useCallback(()=>{d.current!==null&&(window.clearInterval(d.current),d.current=null)},[]);return w.useEffect(()=>()=>m(),[m]),Vt(()=>{f().find(g=>g.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[f]),a.jsx(Pe.div,{"aria-hidden":!0,...l,ref:n,style:{flexShrink:0,...l.style},onPointerDown:Me(l.onPointerDown,()=>{d.current===null&&(d.current=window.setInterval(o,50))}),onPointerMove:Me(l.onPointerMove,()=>{c.onItemLeave?.(),d.current===null&&(d.current=window.setInterval(o,50))}),onPointerLeave:Me(l.onPointerLeave,()=>{m()})})}),mR="SelectSeparator",hR=w.forwardRef((e,n)=>{const{__scopeSelect:s,...o}=e;return a.jsx(Pe.div,{"aria-hidden":!0,...o,ref:n})});hR.displayName=mR;var Yh="SelectArrow",pR=w.forwardRef((e,n)=>{const{__scopeSelect:s,...o}=e,l=ld(s),c=ks(Yh,s),d=As(Yh,s);return c.open&&d.position==="popper"?a.jsx(Hw,{...l,...o,ref:n}):null});pR.displayName=Yh;var gR="SelectBubbleInput",cN=w.forwardRef(({__scopeSelect:e,value:n,...s},o)=>{const l=w.useRef(null),c=et(o,l),d=Wp(n);return w.useEffect(()=>{const f=l.current;if(!f)return;const m=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(m,"value").set;if(d!==n&&g){const v=new Event("change",{bubbles:!0});g.call(f,n),f.dispatchEvent(v)}},[d,n]),a.jsx(Pe.select,{...s,style:{...B2,...s.style},ref:c,defaultValue:n})});cN.displayName=gR;function uN(e){return e===""||e===void 0}function dN(e){const n=Ut(e),s=w.useRef(""),o=w.useRef(0),l=w.useCallback(d=>{const f=s.current+d;n(f),(function m(p){s.current=p,window.clearTimeout(o.current),p!==""&&(o.current=window.setTimeout(()=>m(""),1e3))})(f)},[n]),c=w.useCallback(()=>{s.current="",window.clearTimeout(o.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(o.current),[]),[s,l,c]}function fN(e,n,s){const l=n.length>1&&Array.from(n).every(p=>p===n[0])?n[0]:n,c=s?e.indexOf(s):-1;let d=xR(e,Math.max(c,0));l.length===1&&(d=d.filter(p=>p!==s));const m=d.find(p=>p.textValue.toLowerCase().startsWith(l.toLowerCase()));return m!==s?m:void 0}function xR(e,n){return e.map((s,o)=>e[(n+o)%e.length])}var yR=P2,vR=V2,bR=F2,wR=Y2,NR=G2,SR=X2,jR=Q2,_R=nN,ER=rN,CR=oN,kR=aN,AR=iN;function cd({...e}){return a.jsx(yR,{"data-slot":"select",...e})}function ud({...e}){return a.jsx(bR,{"data-slot":"select-value",...e})}function dd({className:e,size:n="default",children:s,...o}){return a.jsxs(vR,{"data-slot":"select-trigger","data-size":n,className:Ge("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[s,a.jsx(wR,{asChild:!0,children:a.jsx(Zt,{className:"size-4 opacity-50"})})]})}function fd({className:e,children:n,position:s="popper",...o}){return a.jsx(NR,{children:a.jsxs(SR,{"data-slot":"select-content",className:Ge("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,...o,children:[a.jsx(MR,{}),a.jsx(jR,{className:Ge("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:n}),a.jsx(TR,{})]})})}function md({className:e,children:n,...s}){return a.jsxs(_R,{"data-slot":"select-item",className:Ge("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(CR,{children:a.jsx(Ea,{className:"size-4"})})}),a.jsx(ER,{children:n})]})}function MR({className:e,...n}){return a.jsx(kR,{"data-slot":"select-scroll-up-button",className:Ge("flex cursor-default items-center justify-center py-1",e),...n,children:a.jsx(_u,{className:"size-4"})})}function TR({className:e,...n}){return a.jsx(AR,{"data-slot":"select-scroll-down-button",className:Ge("flex cursor-default items-center justify-center py-1",e),...n,children:a.jsx(Zt,{className:"size-4"})})}function Ws({title:e,icon:n,children:s,className:o=""}){return a.jsxs("div",{className:`border rounded-lg p-4 bg-card ${o}`,children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n,a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:e})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:s})]})}function RR({agent:e,open:n,onOpenChange:s}){const o=e.source==="directory"?a.jsx(H1,{className:"h-4 w-4 text-muted-foreground"}):e.source==="in_memory"?a.jsx(Dh,{className:"h-4 w-4 text-muted-foreground"}):a.jsx($1,{className:"h-4 w-4 text-muted-foreground"}),l=e.source==="directory"?"Local":e.source==="in_memory"?"In-Memory":"Gallery";return a.jsx(js,{open:n,onOpenChange:s,children:a.jsxs(_s,{className:"max-w-4xl max-h-[90vh] flex flex-col",children:[a.jsxs(Es,{className:"px-6 pt-6 flex-shrink-0",children:[a.jsx(Cs,{children:"Agent Details"}),a.jsx(Ca,{onClose:()=>s(!1)})]}),a.jsxs("div",{className:"px-6 pb-6 overflow-y-auto flex-1",children:[a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx(rr,{className:"h-6 w-6 text-primary"}),a.jsx("h2",{className:"text-xl font-semibold text-foreground",children:e.name||e.id})]}),e.description&&a.jsx("p",{className:"text-muted-foreground",children:e.description})]}),a.jsx("div",{className:"h-px bg-border mb-6"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[(e.model||e.chat_client_type)&&a.jsx(Ws,{title:"Model & Client",icon:a.jsx(rr,{className:"h-4 w-4 text-muted-foreground"}),children:a.jsxs("div",{className:"space-y-1",children:[e.model&&a.jsx("div",{className:"font-mono text-foreground",children:e.model}),e.chat_client_type&&a.jsxs("div",{className:"text-xs",children:["(",e.chat_client_type,")"]})]})}),a.jsx(Ws,{title:"Source",icon:o,children:a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-foreground",children:l}),e.module_path&&a.jsx("div",{className:"font-mono text-xs break-all",children:e.module_path})]})}),a.jsx(Ws,{title:"Environment",icon:e.has_env?a.jsx(yl,{className:"h-4 w-4 text-orange-500"}):a.jsx(ed,{className:"h-4 w-4 text-green-500"}),className:"md:col-span-2",children:a.jsx("div",{className:e.has_env?"text-orange-600 dark:text-orange-400":"text-green-600 dark:text-green-400",children:e.has_env?"Requires environment variables":"No environment variables required"})})]}),e.instructions&&a.jsx(Ws,{title:"Instructions",icon:a.jsx(Ns,{className:"h-4 w-4 text-muted-foreground"}),className:"mb-4",children:a.jsx("div",{className:"text-sm text-foreground leading-relaxed whitespace-pre-wrap",children:e.instructions})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsx(Ws,{title:`Tools (${e.tools.length})`,icon:a.jsx(Oh,{className:"h-4 w-4 text-muted-foreground"}),children:e.tools.length>0?a.jsx("ul",{className:"space-y-1",children:e.tools.map((c,d)=>a.jsxs("li",{className:"font-mono text-xs text-foreground",children:["• ",c]},d))}):a.jsx("div",{className:"text-muted-foreground",children:"No tools configured"})}),e.middleware&&e.middleware.length>0&&a.jsx(Ws,{title:`Middleware (${e.middleware.length})`,icon:a.jsx(Oh,{className:"h-4 w-4 text-muted-foreground"}),children:a.jsx("ul",{className:"space-y-1",children:e.middleware.map((c,d)=>a.jsxs("li",{className:"font-mono text-xs text-foreground",children:["• ",c]},d))})}),e.context_providers&&e.context_providers.length>0&&a.jsx(Ws,{title:`Context Providers (${e.context_providers.length})`,icon:a.jsx(Dh,{className:"h-4 w-4 text-muted-foreground"}),className:!e.middleware||e.middleware.length===0?"md:col-start-2":"",children:a.jsx("ul",{className:"space-y-1",children:e.context_providers.map((c,d)=>a.jsxs("li",{className:"font-mono text-xs text-foreground",children:["• ",c]},d))})})]})]})]})})}function DR({item:e}){const[n,s]=w.useState(!1),[o,l]=w.useState(!1),c=()=>e.type==="message"?e.content.filter(f=>f.type==="text").map(f=>f.text).join(` -`):"",d=async()=>{const f=c();if(f)try{await navigator.clipboard.writeText(f),l(!0),setTimeout(()=>l(!1),2e3)}catch(m){console.error("Failed to copy:",m)}};if(e.type==="message"){const f=e.role==="user",m=e.status==="incomplete",p=f?V1:m?ws:rr,g=c();return a.jsxs("div",{className:`flex gap-3 ${f?"flex-row-reverse":""}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[a.jsx("div",{className:`flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border ${f?"bg-primary text-primary-foreground":m?"bg-orange-100 dark:bg-orange-900 text-orange-600 dark:text-orange-400 border-orange-200 dark:border-orange-800":"bg-muted"}`,children:a.jsx(p,{className:"h-4 w-4"})}),a.jsxs("div",{className:`flex flex-col space-y-1 ${f?"items-end":"items-start"} max-w-[80%]`,children:[a.jsxs("div",{className:"relative group",children:[a.jsxs("div",{className:`rounded px-3 py-2 text-sm break-all ${f?"bg-primary text-primary-foreground":m?"bg-orange-50 dark:bg-orange-950/50 text-orange-800 dark:text-orange-200 border border-orange-200 dark:border-orange-800":"bg-muted"}`,children:[m&&a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(ws,{className:"h-4 w-4 text-orange-500 mt-0.5 flex-shrink-0"}),a.jsx("span",{className:"font-medium text-sm",children:"Unable to process request"})]}),a.jsx("div",{className:m?"text-xs leading-relaxed break-all":"",children:a.jsx(Pv,{item:e})})]}),g&&n&&a.jsx("button",{onClick:d,className:`absolute top-1 right-1 +`):"",d=async()=>{const f=c();if(f)try{await navigator.clipboard.writeText(f),l(!0),setTimeout(()=>l(!1),2e3)}catch(m){console.error("Failed to copy:",m)}};if(e.type==="message"){const f=e.role==="user",m=e.status==="incomplete",p=f?V1:m?ws:rr,g=c();return a.jsxs("div",{className:`flex gap-3 ${f?"flex-row-reverse":""}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[a.jsx("div",{className:`flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border ${f?"bg-primary text-primary-foreground":m?"bg-orange-100 dark:bg-orange-900 text-orange-600 dark:text-orange-400 border-orange-200 dark:border-orange-800":"bg-muted"}`,children:a.jsx(p,{className:"h-4 w-4"})}),a.jsxs("div",{className:`flex flex-col space-y-1 ${f?"items-end":"items-start"} max-w-[80%]`,children:[a.jsxs("div",{className:"relative group",children:[a.jsxs("div",{className:`rounded px-3 py-2 text-sm ${f?"bg-primary text-primary-foreground":m?"bg-orange-50 dark:bg-orange-950/50 text-orange-800 dark:text-orange-200 border border-orange-200 dark:border-orange-800":"bg-muted"}`,children:[m&&a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(ws,{className:"h-4 w-4 text-orange-500 mt-0.5 flex-shrink-0"}),a.jsx("span",{className:"font-medium text-sm",children:"Unable to process request"})]}),a.jsx("div",{className:m?"text-xs leading-relaxed break-all":"",children:a.jsx(Pv,{item:e})})]}),g&&n&&a.jsx("button",{onClick:d,className:`absolute top-1 right-1 p-1.5 rounded-md border shadow-sm bg-background hover:bg-accent text-muted-foreground hover:text-foreground diff --git a/python/packages/devui/frontend/src/components/features/agent/agent-view.tsx b/python/packages/devui/frontend/src/components/features/agent/agent-view.tsx index 5aac46a11..4eda0e077 100644 --- a/python/packages/devui/frontend/src/components/features/agent/agent-view.tsx +++ b/python/packages/devui/frontend/src/components/features/agent/agent-view.tsx @@ -119,7 +119,7 @@ function ConversationItemBubble({ item }: ConversationItemBubbleProps) { >