@standardagents/builder 0.9.12 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/index.css +1 -1
- package/dist/client/index.js +19 -19
- package/dist/client/vendor.js +1 -1
- package/dist/client/vue.js +35 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
package/dist/client/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import{m as _e,c as a,o,a as e,r as v,d as se,b as xe,e as Be,w as ue,n as pt,f as He,g as ge,h as K,u as ze,i as le,j as L,k as ee,l as Z,F as pe,p as fe,q as E,s as we,t as de,v as et,x as it,y as C,R as Tt,z as ye,T as _t,A as We,B as Se,C as Oe,D as go,E as Ee,L as qt,G as $t,H as mt,I as vt,J as bo,K as xo,P as bt,M as Mt,N as yo,O as Ft,Q as ko,S as Ye,U as zt,V as wo,W as _o,X as xt,Y as Ne,Z as Je,_ as $o,$ as Co,a0 as Ht,a1 as Wt,a2 as Vo,a3 as So,a4 as To,a5 as Mo,a6 as Lo}from"./vue.js";import{f as Io}from"./vendor.js";import{W as Eo,a as Ao,e as Lt}from"./monaco.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))u(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const r of c.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&u(r)}).observe(document,{childList:!0,subtree:!0});function n(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function u(l){if(l.ep)return;l.ep=!0;const c=n(l);fetch(l.href,c)}})();const Po={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Oo(t,i){return o(),a("svg",Po,[...i[0]||(i[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M12 8V4H8"}),e("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),e("path",{d:"M2 14h2m16 0h2m-7-1v2m-6-2v2"})],-1)])])}const It=_e({name:"lucide-bot",render:Oo}),jo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Do(t,i){return o(),a("svg",jo,[...i[0]||(i[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"},null,-1)])])}const Et=_e({name:"lucide-message-square",render:Do}),Uo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ro(t,i){return o(),a("svg",Uo,[...i[0]||(i[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M12 20v2m0-20v2m5 16v2m0-20v2M2 12h2m-2 5h2M2 7h2m16 5h2m-2 5h2M20 7h2M7 20v2M7 2v2"}),e("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),e("rect",{width:"8",height:"8",x:"8",y:"8",rx:"1"})],-1)])])}const No=_e({name:"lucide-cpu",render:Ro}),Bo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function qo(t,i){return o(),a("svg",Bo,[...i[0]||(i[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),e("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),e("path",{d:"M6 6h.01M6 18h.01"})],-1)])])}const Fo=_e({name:"lucide-server",render:qo}),zo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ho(t,i){return o(),a("svg",zo,[...i[0]||(i[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"},null,-1)])])}const Wo=_e({name:"lucide-wrench",render:Ho}),Jo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Zo(t,i){return o(),a("svg",Jo,[...i[0]||(i[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0a2.34 2.34 0 0 0 3.319 1.915a2.34 2.34 0 0 1 2.33 4.033a2.34 2.34 0 0 0 0 3.831a2.34 2.34 0 0 1-2.33 4.033a2.34 2.34 0 0 0-3.319 1.915a2.34 2.34 0 0 1-4.659 0a2.34 2.34 0 0 0-3.32-1.915a2.34 2.34 0 0 1-2.33-4.033a2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}),e("circle",{cx:"12",cy:"12",r:"3"})],-1)])])}const Ko=_e({name:"lucide-settings",render:Zo}),Go={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xo(t,i){return o(),a("svg",Go,[...i[0]||(i[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 18l-6-6l6-6"},null,-1)])])}const Yo=_e({name:"lucide-chevron-left",render:Xo}),Qo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function el(t,i){return o(),a("svg",Qo,[...i[0]||(i[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"4"}),e("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})],-1)])])}const tl=_e({name:"lucide-sun",render:el}),ol={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ll(t,i){return o(),a("svg",ol,[...i[0]||(i[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"},null,-1)])])}const al=_e({name:"lucide-moon",render:ll}),sl={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function nl(t,i){return o(),a("svg",sl,[...i[0]||(i[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"},null,-1)])])}const rl=_e({name:"lucide-activity",render:nl}),il={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function dl(t,i){return o(),a("svg",il,[...i[0]||(i[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),e("path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3m-6 4.2h5.7"})],-1)])])}const ul=_e({name:"lucide-function-square",render:dl}),cl={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function pl(t,i){return o(),a("svg",cl,[...i[0]||(i[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 17l5-5l-5-5m5 5H9m0 9H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"},null,-1)])])}const ml=_e({name:"lucide-log-out",render:pl}),vl={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function fl(t,i){return o(),a("svg",vl,[...i[0]||(i[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M16 3.128a4 4 0 0 1 0 7.744M22 21v-2a4 4 0 0 0-3-3.87"}),e("circle",{cx:"9",cy:"7",r:"4"})],-1)])])}const hl=_e({name:"lucide-users",render:fl}),gl={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function bl(t,i){return o(),a("svg",gl,[...i[0]||(i[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"m15.5 7.5l2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4m2-2l-9.6 9.6"}),e("circle",{cx:"7.5",cy:"15.5",r:"5.5"})],-1)])])}const xl=_e({name:"lucide-key",render:bl}),yl={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function kl(t,i){return o(),a("svg",yl,[...i[0]||(i[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 7v14m-9-3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4a4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3a3 3 0 0 0-3-3z"},null,-1)])])}const wl=_e({name:"lucide-book-open",render:kl}),_l={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function $l(t,i){return o(),a("svg",_l,[...i[0]||(i[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m-11 5L21 3m-3 10v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"},null,-1)])])}const Cl=_e({name:"lucide-external-link",render:$l}),Jt="agentbuilder-accent-theme",Zt=["amber","lime","emerald","sky","blue","indigo","purple","fuchsia","pink","white"],yt=v("purple");let At=!1;function Kt(t){typeof document>"u"||(t==="purple"?delete document.documentElement.dataset.accent:document.documentElement.dataset.accent=t)}function Vl(t){try{localStorage.setItem(Jt,t)}catch{}}function Sl(){try{const t=localStorage.getItem(Jt);if(t&&Zt.includes(t))return t}catch{}return"purple"}function Gt(){if(At)return;At=!0;const t=Sl();yt.value=t,Kt(t)}function Tl(){Gt();function t(i){yt.value=i,Kt(i),Vl(i)}return{theme:yt,themes:Zt,setTheme:t}}const tt=se({__name:"DropShadow",props:{offsetX:{default:8},offsetY:{default:8},intensity:{default:.5},pattern:{default:"crosshatch"}},setup(t){const i=t,n=v(),u=v(),l=v(),c=v(0),r=(s,d,h,$,g,m)=>{s.beginPath(),s.moveTo(d+m,h),s.lineTo(d+$-m,h),s.quadraticCurveTo(d+$,h,d+$,h+m),s.lineTo(d+$,h+g-m),s.quadraticCurveTo(d+$,h+g,d+$-m,h+g),s.lineTo(d+m,h+g),s.quadraticCurveTo(d,h+g,d,h+g-m),s.lineTo(d,h+m),s.quadraticCurveTo(d,h,d+m,h),s.closePath()},p=async()=>{if(await ge(),!n.value||!u.value||!l.value)return;const s=n.value.getContext("2d");if(!s)return;const d=l.value.getBoundingClientRect(),h=l.value.firstElementChild;if(h){const w=getComputedStyle(h);c.value=parseFloat(w.borderRadius)||0}const $=d.width+i.offsetX+4,g=d.height+i.offsetY+4;n.value.width=$,n.value.height=g,n.value.style.width=`${$}px`,n.value.style.height=`${g}px`,s.clearRect(0,0,n.value.width,n.value.height);const m=document.documentElement.classList.contains("dark");if(s.fillStyle=m?"#6b7280":"black",s.globalAlpha=i.intensity,s.save(),r(s,i.offsetX,i.offsetY,d.width,d.height,c.value),s.clip(),i.pattern==="crosshatch"){const w=m?4:3;s.lineWidth=1,s.strokeStyle=m?"#6b7280":"black";for(let k=-d.height;k<d.width;k+=w)s.beginPath(),s.moveTo(i.offsetX+k,i.offsetY),s.lineTo(i.offsetX+k+d.height,i.offsetY+d.height),s.stroke();for(let k=0;k<d.width+d.height;k+=w)s.beginPath(),s.moveTo(i.offsetX+k,i.offsetY+d.height),s.lineTo(i.offsetX+k-d.height,i.offsetY),s.stroke()}else if(i.pattern==="dots"){const k=m?3:2,O=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]];for(let D=0;D<d.width;D+=k)for(let F=0;F<d.height;F+=k){const X=Math.floor(D/k)%4,te=Math.floor(F/k)%4;O[te][X]/16<i.intensity&&s.fillRect(i.offsetX+D,i.offsetY+F,1,1)}}else if(i.pattern==="diagonal"){const w=m?5:4;s.lineWidth=1,s.strokeStyle=m?"#6b7280":"black";for(let k=-d.height;k<d.width;k+=w)s.beginPath(),s.moveTo(i.offsetX+k,i.offsetY),s.lineTo(i.offsetX+k+d.height,i.offsetY+d.height),s.stroke()}s.restore()};let f=null,b=null;return xe(()=>{f=new ResizeObserver(()=>{p()}),l.value&&f.observe(l.value),p(),b=new MutationObserver(()=>{p()}),b.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})}),Be(()=>{l.value&&f&&f.unobserve(l.value),b&&b.disconnect()}),ue(()=>[i.offsetX,i.offsetY,i.intensity,i.pattern],()=>{p()}),(s,d)=>(o(),a("div",{ref_key:"container",ref:u,class:"relative",style:pt({paddingRight:`${t.offsetX}px`,paddingBottom:`${t.offsetY}px`})},[e("canvas",{ref_key:"canvas",ref:n,class:"absolute top-0 left-0 pointer-events-none"},null,512),e("div",{ref_key:"contentEl",ref:l,class:"relative"},[He(s.$slots,"default")],512)],4))}}),Xt="/agents/assets/img/agent-builder-logo-light.svg",Yt="/agents/assets/img/agent-builder-logo-dark.svg",Ml="data:image/svg+xml,%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20150%20150'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%20id='Artboard1'%20transform='matrix(1,0,0,1,1,1)'%3e%3crect%20x='-1'%20y='-1'%20width='150'%20height='150'%20style='fill:none;'/%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.816,92.912L108.064,59.193C103.573,53.307%20101.473,45.937%20102.197,38.566L105.475,5.046L99.553,4.466L96.312,37.643C95.895,41.808%2091.44,44.27%2087.71,42.369L30.34,13.394L27.659,18.7L84.686,47.494C87.184,48.762%2087.076,52.347%2084.504,53.452L0.387,89.671L2.741,95.139L86.189,59.211C88.76,58.106%2091.422,60.587%2090.48,63.231L62.918,141.119L68.532,143.111L96.384,64.408C97.507,61.257%20101.672,60.605%20103.7,63.249L129.107,96.498L133.834,92.876L133.816,92.912Z'%20style='fill:rgb(31,41,55);fill-opacity:0.5;fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.925,90.214L107.648,7.346C106.036,2.257%20100.875,-0.821%2095.624,0.193L32.64,12.344C29.959,12.869%2027.605,14.408%2026.066,16.6C25.523,17.36%2025.07,18.211%2024.744,19.117L0.622,86.284C-0.917,90.594%200.459,95.375%204.081,98.164L59.568,141.137C61.469,142.604%2063.733,143.346%2066.015,143.346C68.079,143.346%2070.144,142.731%2071.937,141.517L129.832,102.111C133.707,99.468%20135.355,94.687%20133.943,90.232L133.925,90.214ZM116.92,85.922L47.127,53.923C44.374,52.673%2043.994,48.925%2046.421,47.132L94.175,11.873C97.416,9.483%20102.034,10.95%20103.284,14.771C108.173,29.548%20118.64,62.054%20124.218,79.457C125.631,83.876%20121.121,87.859%20116.902,85.94L116.92,85.922ZM79.162,15.567L42.455,42.659C40.083,44.415%2036.696,43.057%2036.189,40.16L33.781,26.342C33.038,22.05%2035.845,17.94%2040.119,17.089C49.409,15.241%2065.254,12.145%2076.681,9.917C79.995,9.265%2081.879,13.557%2079.162,15.567ZM29.126,34.238L31.716,49.069C31.915,50.21%2031.607,51.388%2030.865,52.275L16.559,69.587C15.291,71.127%2012.846,69.732%2013.516,67.849L25.704,33.93C26.32,32.21%2028.8,32.427%2029.126,34.22L29.126,34.238ZM12.882,83.386L29.543,63.231C31.517,60.84%2035.356,61.547%2036.352,64.499L56.308,123.661C57.322,126.668%2053.809,129.149%2051.31,127.193C41.223,119.297%2024.4,106.132%2014.404,98.164C9.84,94.542%209.152,87.878%2012.864,83.386L12.882,83.386ZM63.498,126.305L43.161,66.002C42.056,62.706%2045.407,59.681%2048.576,61.13L117.337,92.677C121.375,94.524%20121.864,100.083%20118.206,102.6C107.358,110.061%2088.326,123.064%2076.826,130.815C71.991,134.074%2065.381,131.829%2063.516,126.305L63.498,126.305Z'%20style='fill:rgb(31,41,55);fill-rule:nonzero;'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Ll="data:image/svg+xml,%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20150%20150'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%20id='Artboard1'%20transform='matrix(1,0,0,1,1,1)'%3e%3crect%20x='-1'%20y='-1'%20width='150'%20height='150'%20style='fill:none;'/%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.816,92.912L108.064,59.193C103.573,53.307%20101.473,45.937%20102.197,38.566L105.475,5.046L99.553,4.466L96.312,37.643C95.895,41.808%2091.44,44.27%2087.71,42.369L30.34,13.394L27.659,18.7L84.686,47.494C87.184,48.762%2087.076,52.347%2084.504,53.452L0.387,89.671L2.741,95.139L86.189,59.211C88.76,58.106%2091.422,60.587%2090.48,63.231L62.918,141.119L68.532,143.111L96.384,64.408C97.507,61.257%20101.672,60.605%20103.7,63.249L129.107,96.498L133.834,92.876L133.816,92.912Z'%20style='fill:rgb(249,250,251);fill-opacity:0.5;fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.925,90.214L107.648,7.346C106.036,2.257%20100.875,-0.821%2095.624,0.193L32.64,12.344C29.959,12.869%2027.605,14.408%2026.066,16.6C25.523,17.36%2025.07,18.211%2024.744,19.117L0.622,86.284C-0.917,90.594%200.459,95.375%204.081,98.164L59.568,141.137C61.469,142.604%2063.733,143.346%2066.015,143.346C68.079,143.346%2070.144,142.731%2071.937,141.517L129.832,102.111C133.707,99.468%20135.355,94.687%20133.943,90.232L133.925,90.214ZM116.92,85.922L47.127,53.923C44.374,52.673%2043.994,48.925%2046.421,47.132L94.175,11.873C97.416,9.483%20102.034,10.95%20103.284,14.771C108.173,29.548%20118.64,62.054%20124.218,79.457C125.631,83.876%20121.121,87.859%20116.902,85.94L116.92,85.922ZM79.162,15.567L42.455,42.659C40.083,44.415%2036.696,43.057%2036.189,40.16L33.781,26.342C33.038,22.05%2035.845,17.94%2040.119,17.089C49.409,15.241%2065.254,12.145%2076.681,9.917C79.995,9.265%2081.879,13.557%2079.162,15.567ZM29.126,34.238L31.716,49.069C31.915,50.21%2031.607,51.388%2030.865,52.275L16.559,69.587C15.291,71.127%2012.846,69.732%2013.516,67.849L25.704,33.93C26.32,32.21%2028.8,32.427%2029.126,34.22L29.126,34.238ZM12.882,83.386L29.543,63.231C31.517,60.84%2035.356,61.547%2036.352,64.499L56.308,123.661C57.322,126.668%2053.809,129.149%2051.31,127.193C41.223,119.297%2024.4,106.132%2014.404,98.164C9.84,94.542%209.152,87.878%2012.864,83.386L12.882,83.386ZM63.498,126.305L43.161,66.002C42.056,62.706%2045.407,59.681%2048.576,61.13L117.337,92.677C121.375,94.524%20121.864,100.083%20118.206,102.6C107.358,110.061%2088.326,123.064%2076.826,130.815C71.991,134.074%2065.381,131.829%2063.516,126.305L63.498,126.305Z'%20style='fill:rgb(249,250,251);fill-rule:nonzero;'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";function Il(){return window.__AGENTBUILDER_CONFIG__||{mountPoint:"/agentbuilder"}}function ot(){return Il().mountPoint}function ae(t){const i=ot(),n=t.startsWith("/")?t:`/${t}`;return i==="/"?n:`${i}${n}`}const El=["src"],Al=["src"],Pl={class:"flex-1 flex flex-col justify-between pt-2 pb-4"},Ol={class:"flex flex-col gap-1 px-2"},jl={key:0},Dl=["onClick","title"],Ul={key:0,class:"flex-1 whitespace-nowrap overflow-hidden text-ellipsis text-left"},Rl={key:0,class:"ml-4 space-y-0.5"},Nl=["onClick"],Bl={class:"whitespace-nowrap overflow-hidden text-ellipsis"},ql=["onClick","title"],Fl={key:0,class:"whitespace-nowrap overflow-hidden text-ellipsis"},zl={class:"flex flex-col gap-1 px-2"},Hl=["title"],Wl={key:0,class:"flex-1 whitespace-nowrap overflow-hidden text-ellipsis"},Jl={class:"relative settings-menu-container"},Zl={key:0,class:"absolute bottom-full mb-2 left-0 z-50"},Kl={class:"bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-600 rounded-lg py-2 min-w-[200px]"},Gl={class:"px-4 py-3 border-b border-neutral-200 dark:border-neutral-700"},Xl=["title"],Yl={class:"relative z-10 flex items-center justify-center w-8 h-full"},Ql={class:"relative z-10 flex items-center justify-center w-8 h-full"},ea={class:"px-4 pt-3 pb-4 border-b border-neutral-200 dark:border-neutral-700"},ta={class:"grid grid-cols-5 gap-3"},oa=["onClick","title"],la={key:0,class:"w-2 h-2 rounded-full bg-white shadow-sm"},aa={key:0,class:"text-sm overflow-hidden whitespace-nowrap max-w-0 group-hover:max-w-[60px] group-hover:ml-2 transition-all duration-200"},sa=se({__name:"Sidebar",props:{isCollapsed:{type:Boolean},isDark:{type:Boolean}},emits:["toggle-sidebar","toggle-theme"],setup(t,{emit:i}){function n(N){if(N.startsWith("/src/")||N.startsWith("data:"))return N;const U=ot();return U==="/"?N.replace("/agents/","/"):N.replace("/agents/",`${U}/`)}const u=n(Xt),l=n(Yt),c=n(Ml),r=n(Ll),p=t,f=ze(),b=et(),s=K(()=>f.name);function d(N){const U=f.path;return U===N.path||U.startsWith(N.path+"/")}const h=K(()=>p.isDark?l:u),$=K(()=>p.isDark?r:c),g=[{id:"threads",label:"Threads",icon:rl,path:"/threads"},{id:"agents",label:"Agents",icon:It,path:"/agents"},{id:"prompts",label:"Prompts",icon:Et,path:"/prompts"},{id:"tools",label:"Tools",icon:Wo,path:"/tools",hasSubnav:!0,subnav:[{id:"tools-functions",label:"Functions",icon:ul,path:"/tools#functions"},{id:"tools-prompts",label:"Prompts",icon:Et,path:"/tools#prompts"},{id:"tools-agents",label:"Agents",icon:It,path:"/tools#agents"}]},{id:"models",label:"Models",icon:No,path:"/models"},{id:"providers",label:"Providers",icon:Fo,path:"/providers"}],m=N=>{b.push(N)},w=N=>{b.push(N),O.value=!1},k=K(()=>typeof s.value=="string"&&(s.value==="tools"||s.value.startsWith("tools-"))),O=v(!1),{theme:D,themes:F,setTheme:X}=Tl(),te={amber:"bg-amber-500",lime:"bg-lime-500",emerald:"bg-emerald-500",sky:"bg-sky-500",blue:"bg-blue-500",indigo:"bg-indigo-500",purple:"bg-purple-500",fuchsia:"bg-fuchsia-500",pink:"bg-pink-500",white:"bg-neutral-400 dark:bg-neutral-500"},R=K(()=>s.value==="users"||s.value==="api-keys"),j=()=>{O.value=!O.value},W=()=>{localStorage.removeItem("auth_token"),b.push("/login")},B=N=>{const U=N.target;O.value&&!U.closest(".settings-menu-container")&&(O.value=!1)};return xe(()=>{document.addEventListener("click",B)}),Be(()=>{document.removeEventListener("click",B)}),(N,U)=>(o(),a("aside",{class:le(["flex flex-col transition-all duration-300 pt-2.5",t.isCollapsed?"w-16":"w-60"])},[e("div",{class:le(`flex items-center justify-between ${t.isCollapsed?"px-2 py-4":"p-4"}`)},[t.isCollapsed?L("",!0):(o(),a("img",{key:0,src:h.value,alt:"AgentBuilder",class:"h-8 mr-2 mt-0.5"},null,8,El)),e("button",{onClick:U[0]||(U[0]=y=>N.$emit("toggle-sidebar")),class:le(`p-1 rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors ${t.isCollapsed?"m-auto":"border border-black/20 dark:border-white/20 opacity-50 hover:opacity-100"}`),"aria-label":"Toggle sidebar"},[t.isCollapsed?(o(),a("img",{key:1,src:$.value,alt:"AgentBuilder",class:"w-7 h-7 m-auto"},null,8,Al)):(o(),ee(Z(Yo),{key:0,class:"w-5 h-5"}))],2)],2),e("nav",Pl,[e("div",Ol,[(o(),a(pe,null,fe(g,y=>(o(),a(pe,{key:y.id},[y.hasSubnav?(o(),a("div",jl,[e("button",{onClick:x=>m(y.path),class:le(["flex items-center gap-3 px-3 py-3 rounded text-sm font-medium transition-all w-full",k.value?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10",t.isCollapsed&&"justify-center"]),title:t.isCollapsed?y.label:void 0},[(o(),ee(it(y.icon),{class:"w-5 h-5 flex-shrink-0"})),t.isCollapsed?L("",!0):(o(),a("span",Ul,C(y.label),1))],10,Dl),!t.isCollapsed&&y.subnav?(o(),a("div",Rl,[(o(!0),a(pe,null,fe(y.subnav,x=>(o(),a("button",{key:x.id,onClick:V=>m(x.path),class:le(["flex items-center gap-3 px-3 py-1.5 text-sm transition-all w-full",s.value===x.id?"bg-black text-white dark:bg-white dark:text-black rounded":"hover:underline"])},[(o(),ee(it(x.icon),{class:"w-4 h-4 flex-shrink-0"})),e("span",Bl,C(x.label),1)],10,Nl))),128))])):L("",!0)])):(o(),a("button",{key:1,onClick:x=>m(y.path),class:le(["flex items-center gap-3 px-3 py-3 rounded text-sm font-medium transition-all",d(y)?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10",t.isCollapsed&&"justify-center"]),title:t.isCollapsed?y.label:void 0},[(o(),ee(it(y.icon),{class:"w-5 h-5 flex-shrink-0"})),t.isCollapsed?L("",!0):(o(),a("span",Fl,C(y.label),1))],10,ql))],64))),64))]),e("div",zl,[e("a",{href:"https://docs.standardagentbuilder.com/",target:"_blank",rel:"noopener noreferrer",class:le(["flex items-center gap-3 px-3 py-2 rounded text-sm transition-all","hover:bg-black/5 dark:hover:bg-white/10 text-neutral-600 dark:text-neutral-400 hover:text-black dark:hover:text-white",t.isCollapsed&&"justify-center"]),title:t.isCollapsed?"Documentation":void 0},[E(Z(wl),{class:"w-5 h-5 flex-shrink-0"}),t.isCollapsed?L("",!0):(o(),a("span",Wl," Docs ")),t.isCollapsed?L("",!0):(o(),ee(Z(Cl),{key:1,class:"w-3 h-3 flex-shrink-0 opacity-50"}))],10,Hl),e("div",{class:le(["flex items-center gap-1 pt-2 mt-1 border-t border-black/10 dark:border-white/10",t.isCollapsed?"flex-col":"justify-between"])},[e("div",Jl,[e("button",{onClick:we(j,["stop"]),class:le(["p-2 rounded transition-colors flex items-center",O.value||R.value?"bg-black/10 dark:bg-white/10 text-black dark:text-white":"hover:bg-black/5 dark:hover:bg-white/10 text-neutral-600 dark:text-neutral-400 hover:text-black dark:hover:text-white"]),title:"Settings"},[E(Z(Ko),{class:"w-5 h-5 flex-shrink-0"})],2),O.value?(o(),a("div",Zl,[E(tt,{"offset-x":6,"offset-y":6,intensity:.4},{default:de(()=>[e("div",Kl,[e("div",Gl,[U[4]||(U[4]=e("div",{class:"text-xs font-bold text-neutral-600 dark:text-neutral-400 pb-3"}," Appearance ",-1)),e("button",{onClick:U[1]||(U[1]=we(y=>N.$emit("toggle-theme"),["stop"])),class:"relative flex items-center h-7 rounded-full bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 transition-colors",title:t.isDark?"Switch to light mode":"Switch to dark mode"},[e("span",{class:le(["absolute top-0.5 h-6 w-8 rounded-full bg-white dark:bg-black shadow-sm transition-transform duration-200",t.isDark?"translate-x-[calc(100%-2px)]":"translate-x-0.5"])},null,2),e("span",Yl,[E(Z(tl),{class:le(["w-4 h-4",t.isDark?"text-neutral-500":"text-black"])},null,8,["class"])]),e("span",Ql,[E(Z(al),{class:le(["w-4 h-4",t.isDark?"text-white":"text-neutral-400"])},null,8,["class"])])],8,Xl)]),e("div",ea,[U[5]||(U[5]=e("div",{class:"text-xs font-bold text-neutral-600 dark:text-neutral-400 pb-3"}," Accent Color ",-1)),e("div",ta,[(o(!0),a(pe,null,fe(Z(F),y=>(o(),a("button",{key:y,onClick:we(x=>Z(X)(y),["stop"]),class:le(["w-6 h-6 rounded-full transition-all flex items-center justify-center ring-1 ring-black/10 dark:ring-white/10",[te[y],Z(D)===y?"ring-2 ring-black/50 dark:ring-white/50":"hover:scale-110"]]),title:y.charAt(0).toUpperCase()+y.slice(1)},[Z(D)===y?(o(),a("span",la)):L("",!0)],10,oa))),128))])]),e("button",{onClick:U[2]||(U[2]=y=>w("/settings/users")),class:le(["flex items-center gap-3 px-4 py-2 text-sm transition-all w-full text-left",s.value==="users"?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10"])},[E(Z(hl),{class:"w-4 h-4 flex-shrink-0"}),U[6]||(U[6]=e("span",{class:"whitespace-nowrap"},"Users",-1))],2),e("button",{onClick:U[3]||(U[3]=y=>w("/settings/api-keys")),class:le(["flex items-center gap-3 px-4 py-2 text-sm transition-all w-full text-left",s.value==="api-keys"?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10"])},[E(Z(xl),{class:"w-4 h-4 flex-shrink-0"}),U[7]||(U[7]=e("span",{class:"whitespace-nowrap"},"API Keys",-1))],2)])]),_:1})])):L("",!0)]),e("button",{onClick:W,class:"group p-2 rounded hover:bg-red-500/10 transition-colors text-neutral-600 dark:text-neutral-400 hover:text-red-600 dark:hover:text-red-400 flex items-center",title:"Logout"},[E(Z(ml),{class:"w-5 h-5 flex-shrink-0"}),t.isCollapsed?L("",!0):(o(),a("span",aa,"Logout"))])],2)])])],2))}}),na={class:"warning-banner-container"},ra={key:0,class:"warning-banner flex items-center justify-between gap-3 px-4 py-2 bg-amber-50 dark:bg-amber-900/30 border-b border-amber-200 dark:border-amber-800 text-amber-800 dark:text-amber-200 text-sm"},ia={class:"flex items-center gap-2"},da=["onClick"],ua=se({__name:"WarningBanner",setup(t){const i=v([]),n=v(new Set),u=async()=>{if(localStorage.getItem("auth_token"))try{const f=await fetch(ae("/api/diagnostics"));if(f.ok){const b=await f.json();i.value=b.warnings||[]}}catch{}},l=p=>{const f=`${p.type}:${p.details?.name||p.message}`;n.value.add(f)},c=p=>{const f=`${p.type}:${p.details?.name||p.message}`;return!n.value.has(f)},r=p=>{if(p.type==="duplicate_tool_name"){const f=p.details?.sources?.join(" and ")||"multiple sources";return`Duplicate tool name "${p.details?.name}" (defined as both ${f}). This may cause unexpected behavior.`}return p.message};return xe(()=>{u()}),(p,f)=>(o(),a("div",na,[(o(!0),a(pe,null,fe(i.value,b=>(o(),a(pe,{key:`${b.type}:${b.details?.name}`},[c(b)?(o(),a("div",ra,[e("div",ia,[f[0]||(f[0]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 flex-shrink-0",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})],-1)),e("span",null,C(r(b)),1)]),e("button",{onClick:s=>l(b),class:"text-amber-600 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-200 p-1",title:"Dismiss"},[...f[1]||(f[1]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)])],8,da)])):L("",!0)],64))),128))]))}}),ca={key:2,class:"flex-1 overflow-auto my-3 mr-4 border border-neutral-300 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 flex flex-col"},pa={class:"flex-1 overflow-auto"},ma=se({__name:"App",setup(t){Gt();const i=ze(),n=v(!1),u=v(!1),l=K(()=>i.name!=="login"),c=()=>{n.value=!n.value},r=()=>{u.value=!u.value,u.value?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))};return xe(()=>{const p=localStorage.getItem("theme");(p==="dark"||!p&&window.matchMedia("(prefers-color-scheme: dark)").matches)&&(u.value=!0,document.documentElement.classList.add("dark"))}),(p,f)=>(o(),a("div",{class:le(["app-container relative flex h-screen font-sans bg-neutral-50/80 text-black dark:bg-black dark:text-white",{"is-dark":u.value}])},[l.value?(o(),ee(sa,{key:0,"is-collapsed":n.value,"is-dark":u.value,onToggleSidebar:c,onToggleTheme:r},null,8,["is-collapsed","is-dark"])):L("",!0),l.value?(o(),a("main",ca,[E(ua),e("div",pa,[E(Z(Tt))])])):(o(),ee(Z(Tt),{key:1}))],2))}}),Ze=(t,i)=>{const n=t.__vccOpts||t;for(const[u,l]of i)n[u]=l;return n},va=Ze(ma,[["__scopeId","data-v-2125e5d3"]]),fa={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ha(t,i){return o(),a("svg",fa,[...i[0]||(i[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"},null,-1)])])}const ga=_e({name:"lucide-trash-2",render:ha}),ba={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xa(t,i){return o(),a("svg",ba,[...i[0]||(i[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e("path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"})],-1)])])}const ya=_e({name:"lucide-edit",render:xa}),ka={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function wa(t,i){return o(),a("svg",ka,[...i[0]||(i[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),e("circle",{cx:"12",cy:"12",r:"3"})],-1)])])}const kt=_e({name:"lucide-eye",render:wa}),_a={class:"w-full"},$a={class:"border border-black dark:border-neutral-300 rounded overflow-hidden"},Ca={class:"overflow-x-auto"},Va={class:"w-full"},Sa={class:"border-b border-black dark:border-neutral-300"},Ta={key:0,class:"px-4 py-3 text-right font-medium text-sm"},Ma={key:0},La=["colspan"],Ia={key:1},Ea=["colspan"],Aa=["innerHTML"],Pa={key:0,class:"px-4 py-3 text-right"},Oa={class:"inline-flex gap-1"},ja=["onClick","title"],Fe=se({__name:"DataTable",props:{columns:{},data:{},actions:{},emptyMessage:{default:"No data available"},loading:{type:Boolean,default:!1}},setup(t){const i=c=>{switch(c){case"edit":return ya;case"delete":return ga;case"view":return kt;default:return null}},n=(c,r)=>{const p=c[r.key];return r.formatter?r.formatter(p):p??"-"},u=c=>{switch(c){case"center":return"text-center";case"right":return"text-right";default:return"text-left"}},l=(c,r)=>{if(c.confirm){const p=c.confirmMessage||`Are you sure you want to ${c.label.toLowerCase()}?`;confirm(p)&&c.handler(r)}else c.handler(r)};return(c,r)=>(o(),a("div",_a,[e("div",$a,[e("div",Ca,[e("table",Va,[e("thead",Sa,[e("tr",null,[(o(!0),a(pe,null,fe(t.columns,p=>(o(),a("th",{key:p.key,class:le(["px-4 py-3 font-medium text-sm",u(p.align),p.width||""])},C(p.label),3))),128)),t.actions&&t.actions.length>0?(o(),a("th",Ta," Actions ")):L("",!0)])]),e("tbody",null,[t.loading?(o(),a("tr",Ma,[e("td",{colspan:t.columns.length+(t.actions?1:0),class:"px-4 py-8 text-center text-neutral-500"},[...r[0]||(r[0]=[e("div",{class:"inline-flex items-center gap-2"},[e("svg",{class:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]),ye(" Loading... ")],-1)])],8,La)])):t.data.length===0?(o(),a("tr",Ia,[e("td",{colspan:t.columns.length+(t.actions?1:0),class:"px-4 py-8 text-center text-neutral-500"},C(t.emptyMessage),9,Ea)])):(o(!0),a(pe,{key:2},fe(t.data,(p,f)=>(o(),a("tr",{key:f,class:"border-t border-neutral-200 dark:border-neutral-800 hover:bg-black/5 dark:hover:bg-white/5 transition-colors"},[(o(!0),a(pe,null,fe(t.columns,b=>(o(),a("td",{key:b.key,class:le(["px-4 py-3 text-sm",u(b.align)])},[He(c.$slots,`cell-${b.key}`,{value:p[b.key],row:p,column:b},()=>[b.html?(o(),a("span",{key:0,innerHTML:n(p,b)},null,8,Aa)):(o(),a(pe,{key:1},[ye(C(n(p,b)),1)],64))])],2))),128)),t.actions&&t.actions.length>0?(o(),a("td",Pa,[e("div",Oa,[(o(!0),a(pe,null,fe(t.actions,(b,s)=>(o(),a("button",{key:s,onClick:d=>l(b,p),class:"p-1.5 rounded hover:bg-black/10 dark:hover:bg-white/10 transition-colors",title:b.label},[(o(),ee(it(i(b.icon)),{class:"w-4 h-4"}))],8,ja))),128))])])):L("",!0)]))),128))])])])])]))}}),Da=se({__name:"AgentsDataTable",emits:["add","edit","delete"],setup(t,{expose:i,emit:n}){const u=n,l=v([]),c=v(!1),r=[{key:"title",label:"Title",width:"w-1/5"},{key:"type",label:"Type",width:"w-1/12",formatter:s=>s==="dual_ai"?"Dual AI":"AI+Human"},{key:"side_a_agent_prompt_name",label:"Side A",width:"w-1/5",formatter:s=>s||"-"},{key:"side_b_agent_prompt_name",label:"Side B",width:"w-1/5",formatter:s=>s||"Human"},{key:"created_at",label:"Created",width:"w-1/6",formatter:s=>s?new Date(s*1e3).toLocaleDateString():"-"}],p=[{icon:"edit",label:"Edit",handler:s=>u("edit",s)},{icon:"delete",label:"Delete",handler:async s=>{await b(s)},confirm:!0,confirmMessage:"Are you sure you want to delete this agent?"}],f=async()=>{c.value=!0;try{const s=await fetch(ae("/api/agents"));if(s.ok){const d=await s.json();l.value=d.agents||[]}}catch(s){console.error("Error fetching agents:",s)}finally{c.value=!1}},b=async s=>{try{const d=await fetch(ae(`/api/agents/${s.id}`),{method:"DELETE"});if(d.ok)await f();else{const h=await d.json();alert(h.error||"Failed to delete agent")}}catch(d){console.error("Error deleting agent:",d),alert("Failed to delete agent")}};return xe(()=>{f()}),i({refresh:f}),(s,d)=>(o(),a("div",null,[E(Fe,{columns:r,data:l.value,actions:p,loading:c.value,"empty-message":"No agents available. Create your first agent to get started."},null,8,["data","loading"])]))}}),Ua={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ra(t,i){return o(),a("svg",Ua,[...i[0]||(i[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Qt=_e({name:"lucide-x",render:Ra}),Na={key:0,class:"w-full max-w-md"},Ba={class:"flex items-center justify-between p-4 border-b-2 border-red-600 flex-shrink-0"},qa={class:"text-xl font-bold text-red-600"},Fa={class:"p-6"},za={class:"text-neutral-700 dark:text-neutral-300 mb-6"},Ha={class:"flex justify-end gap-3"},eo=se({__name:"ConfirmDialog",props:{modelValue:{type:Boolean},title:{default:"Confirm Action"},message:{default:"Are you sure you want to continue? You will lose any unsaved changes."},confirmText:{default:"Continue"},cancelText:{default:"Cancel"}},emits:["update:modelValue","confirm","cancel"],setup(t,{emit:i}){const n=t,u=i,l=()=>{u("update:modelValue",!1)},c=()=>{u("confirm"),l()},r=()=>{u("cancel"),l()},p=f=>{f.key==="Escape"&&n.modelValue&&r()};return ue(()=>n.modelValue,f=>{f?(document.addEventListener("keydown",p),document.body.style.overflow="hidden"):(document.removeEventListener("keydown",p),document.body.style.overflow="")}),(f,b)=>(o(),ee(_t,{to:"body"},[E(We,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:de(()=>[t.modelValue?(o(),a("div",{key:0,class:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-white/80 dark:bg-black/80 backdrop-blur-sm dark:text-white",onClick:r},[E(We,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:de(()=>[t.modelValue?(o(),a("div",Na,[E(tt,{"offset-x":12,"offset-y":12,intensity:.4},{default:de(()=>[e("div",{class:"bg-white dark:bg-black border-2 border-red-600 flex flex-col",onClick:b[0]||(b[0]=we(()=>{},["stop"]))},[e("div",Ba,[e("h2",qa,C(t.title),1),e("button",{onClick:r,class:"p-1 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors","aria-label":"Close dialog"},[E(Z(Qt),{class:"w-5 h-5 text-red-600"})])]),e("div",Fa,[e("p",za,C(t.message),1),e("div",Ha,[e("button",{onClick:r,class:"px-4 py-2 border-2 border-black dark:border-white bg-white dark:bg-black text-black dark:text-white hover:bg-neutral-50 dark:hover:bg-neutral-900 transition-colors"},C(t.cancelText),1),e("button",{onClick:c,class:"px-4 py-2 border-2 border-red-600 bg-red-600 text-white hover:bg-red-700 hover:border-red-700 transition-colors"},C(t.confirmText),1)])])])]),_:1})])):L("",!0)]),_:1})])):L("",!0)]),_:1})]))}}),Wa={class:"flex items-center justify-between p-4 border-b-2 border-black dark:border-neutral-300 flex-shrink-0"},Ja={class:"text-xl font-bold"},Za={class:"overflow-y-auto flex-1"},Ka={class:"p-6"},Ga={key:0,class:"p-6 border-t-2 border-black dark:border-neutral-300 flex-shrink-0"},je=se({__name:"Modal",props:{modelValue:{type:Boolean},title:{},width:{default:"max-w-lg"},minHeight:{default:"min-h-[24rem]"},hasChanges:{type:Boolean,default:void 0}},emits:["update:modelValue","close"],setup(t,{emit:i}){const n=t,u=i,l=v(),c=v(!1),r=v(new Map),p=()=>l.value&&(l.value.querySelector("input")||l.value.querySelector("textarea")||l.value.querySelector("select")||l.value.querySelector("[contenteditable]")||l.value.querySelector(".monaco-editor")),f=()=>{if(!l.value)return;l.value.querySelectorAll(".monaco-editor-container").forEach(F=>{const X=F.__monacoEditor;if(X&&typeof X.getValue=="function"){const te=X.getValue();r.value.set(F,te)}})},b=()=>{if(!l.value)return!1;const D=l.value.querySelectorAll(".monaco-editor-container");for(const F of D){const X=F.__monacoEditor;if(X&&typeof X.getValue=="function"){const te=X.getValue(),R=r.value.get(F);if(R===void 0||(X.getRawOptions?.()||{}).readOnly===!0)continue;if(te!==R)return!0}}return!1},s=()=>{if(n.hasChanges!==void 0)return n.hasChanges;if(!l.value)return!1;if(b())return!0;const D=l.value.querySelectorAll("form");for(const X of D){const R=X.querySelectorAll("input, textarea, select");for(const j of R){const W=j;if(W.type==="checkbox"||W.type==="radio"){const B=W;if(B.checked!==B.defaultChecked)return!0}else if(W.tagName==="SELECT"){const B=W;if(B.value!==B.defaultValue)return!0}else if(W.value!==W.defaultValue)return!0}}const F=l.value.querySelectorAll("input:not(form input), textarea:not(form textarea), select:not(form select)");for(const X of F){const te=X;if(te.type==="checkbox"||te.type==="radio"){const R=te;if(R.checked!==R.defaultChecked)return!0}else if(te.tagName==="SELECT"){const R=te;if(R.value!==R.defaultValue)return!0}else if(te.value!==te.defaultValue)return!0}return!1},d=()=>{p()&&s()?c.value=!0:h()},h=()=>{u("update:modelValue",!1),u("close")},$=()=>{c.value=!1,h()},g=()=>{c.value=!1},m=D=>{D.key==="Escape"&&n.modelValue&&(p()||h())};ue(()=>n.modelValue,async D=>{D?(document.addEventListener("keydown",m),document.body.style.overflow="hidden",await ge(),setTimeout(()=>{f()},100)):(document.removeEventListener("keydown",m),document.body.style.overflow="",r.value.clear())});const w=v(!1),k=D=>{w.value=D.target===D.currentTarget},O=D=>{D.target===D.currentTarget&&w.value&&(p()||h()),w.value=!1};return(D,F)=>(o(),ee(_t,{to:"body"},[E(We,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:de(()=>[t.modelValue?(o(),a("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-white/80 dark:bg-black/80 backdrop-blur-sm dark:text-white",onMousedown:k,onClick:O},[E(We,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:de(()=>[t.modelValue?(o(),a("div",{key:0,class:le(["w-full",t.width,"max-h-[85vh] flex flex-col"])},[E(tt,{"offset-x":12,"offset-y":12,intensity:.4},{default:de(()=>[e("div",{ref_key:"modalRef",ref:l,class:le(["bg-white dark:bg-black border-2 border-black dark:border-neutral-300 flex flex-col max-h-[85vh]",t.minHeight])},[e("div",Wa,[e("h2",Ja,C(t.title),1),e("button",{onClick:d,class:"p-1 hover:bg-black/5 dark:hover:bg-white/10 rounded transition-colors","aria-label":"Close modal"},[E(Z(Qt),{class:"w-5 h-5"})])]),e("div",Za,[e("div",Ka,[He(D.$slots,"default")])]),D.$slots.footer?(o(),a("div",Ga,[He(D.$slots,"footer")])):L("",!0)],2)]),_:3})],2)):L("",!0)]),_:3})],32)):L("",!0)]),_:3}),E(eo,{modelValue:c.value,"onUpdate:modelValue":F[0]||(F[0]=X=>c.value=X),title:"Unsaved Changes",message:"You have unsaved changes that will be lost. Are you sure you want to close?","confirm-text":"Close Anyway","cancel-text":"Keep Editing",onConfirm:$,onCancel:g},null,8,["modelValue"])]))}}),Xa={class:"space-y-1.5"},Ya={key:0,class:"block text-sm font-medium text-neutral-700 dark:text-neutral-300"},Qa={key:0,class:"text-red-500"},es=["type","value","placeholder","disabled"],ts={key:1,class:"text-xs text-red-500 dark:text-red-400"},Ce=se({__name:"TextInput",props:{modelValue:{},label:{},placeholder:{},type:{default:"text"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","focus","click"],setup(t,{expose:i,emit:n}){const u=t,l=n,c=v(null),r=K(()=>["w-full px-3 py-2.5 bg-neutral-50 dark:bg-neutral-950 border rounded-md text-sm","focus:outline-none focus:ring-2 focus:ring-neutral-400 dark:focus:ring-neutral-500 focus:border-transparent","transition-colors placeholder:text-neutral-400 dark:placeholder:text-neutral-500",u.error?"border-red-500 dark:border-red-400":"border-neutral-300 dark:border-neutral-800",u.disabled?"opacity-50 cursor-not-allowed":""]),p=s=>{const d=s.target;l("update:modelValue",d.value)},f=s=>{l("focus",s)},b=s=>{l("click",s)};return i({inputRef:c}),(s,d)=>(o(),a("div",Xa,[t.label?(o(),a("label",Ya,[ye(C(t.label)+" ",1),t.required?(o(),a("span",Qa,"*")):L("",!0)])):L("",!0),e("input",{ref_key:"inputRef",ref:c,type:t.type,value:t.modelValue,placeholder:t.placeholder,disabled:t.disabled,class:le(r.value),onInput:p,onFocus:f,onClick:b},null,42,es),t.error?(o(),a("p",ts,C(t.error),1)):L("",!0)]))}}),os={class:"space-y-1"},ls={key:0,class:"block text-sm font-medium"},as={key:0,class:"text-red-500"},ss=["value","placeholder","disabled","rows"],ns={key:1,class:"text-xs text-red-500 dark:text-red-400"},to=se({__name:"TextareaInput",props:{modelValue:{},label:{},placeholder:{},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},rows:{default:4}},emits:["update:modelValue"],setup(t,{emit:i}){const n=t,u=i,l=K(()=>["w-full px-3 py-2 bg-white dark:bg-black border rounded font-mono text-sm","focus:outline-none focus:ring-2 focus:ring-black dark:focus:ring-white","transition-colors resize-y",n.error?"border-red-500 dark:border-red-400":"border-black dark:border-neutral-300",n.disabled?"opacity-50 cursor-not-allowed":""]),c=r=>{const p=r.target;u("update:modelValue",p.value)};return(r,p)=>(o(),a("div",os,[t.label?(o(),a("label",ls,[ye(C(t.label)+" ",1),t.required?(o(),a("span",as,"*")):L("",!0)])):L("",!0),e("textarea",{value:t.modelValue,placeholder:t.placeholder,disabled:t.disabled,rows:t.rows,class:le(l.value),onInput:c},null,42,ss),t.error?(o(),a("p",ns,C(t.error),1)):L("",!0)]))}}),rs={key:0,class:"block text-sm font-medium mb-2"},is={key:0,class:"text-red-500"},ds=["disabled","aria-expanded"],us={class:"flex items-center justify-between gap-1"},cs={key:0,class:"flex items-center gap-2 text-neutral-400 flex-1 min-w-0"},ps={key:1,class:"flex items-center gap-2 flex-1 min-w-0"},ms=["src","alt"],vs={class:"block truncate"},fs={key:2,class:"block truncate text-neutral-400 flex-1 min-w-0"},hs={class:"bg-white dark:bg-black border-2 border-black dark:border-neutral-300 rounded-lg overflow-hidden"},gs={class:"p-2 border-b border-neutral-200 dark:border-neutral-700"},bs=["placeholder"],xs={class:"max-h-60 overflow-y-auto"},ys={key:0,class:"px-4 py-3 text-sm text-neutral-500 dark:text-neutral-400"},ks=["onClick","onMouseenter"],ws={class:"flex-shrink-0 w-5 h-5 mt-0.5"},_s=["src","alt"],$s={key:1,class:"w-full h-full bg-neutral-200 dark:bg-neutral-700 rounded"},Cs={class:"flex-1 min-w-0"},Vs={class:"text-sm font-medium text-black dark:text-white"},Ss={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},Ts={key:2,class:"mt-1 text-xs text-red-500 dark:text-red-400"},he=se({__name:"SelectInput",props:{modelValue:{},options:{},placeholder:{default:"Select an option"},searchPlaceholder:{default:"Search..."},label:{},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},error:{},required:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:i}){const n=t,u=i,l=v(!1),c=v(""),r=v(),p=v(),f=v(),b=v(),s=v(-1),d=K(()=>n.options.find(j=>j.value===n.modelValue)),h=K(()=>["w-full px-3 py-2 text-left rounded focus:outline-none focus:ring-2 bg-white dark:bg-black disabled:opacity-50 disabled:cursor-not-allowed font-mono text-sm overflow-hidden",n.error?"border border-red-500 dark:border-red-400 focus:ring-red-500 dark:focus:ring-red-400":"border border-black dark:border-neutral-300 focus:ring-black dark:focus:ring-white"]),$=K(()=>{if(!c.value)return n.options;const j=c.value.toLowerCase();return n.options.filter(W=>W.label.toLowerCase().includes(j)||W.value.toLowerCase().includes(j)||W.description&&W.description.toLowerCase().includes(j))});ue($,()=>{s.value=-1});const g=()=>{n.disabled||(l.value?k():(l.value=!0,c.value="",s.value=-1,ge(()=>{if(b.value&&(b.value.setAttribute("popover","auto"),b.value.addEventListener("toggle",R),"showPopover"in b.value))try{b.value.showPopover()}catch{}O(),setTimeout(()=>r.value?.focus(),0)})))},m=j=>{u("update:modelValue",j.value),k(),c.value="",s.value=-1},w=j=>{j.stopPropagation(),u("update:modelValue","")},k=()=>{if(b.value){if("hidePopover"in b.value)try{b.value.hidePopover()}catch{}b.value.removeEventListener("toggle",R)}l.value=!1,s.value=-1},O=()=>{if(!f.value||!b.value)return;const j=f.value.getBoundingClientRect();b.value.offsetWidth||j.width,b.value.style.position="fixed",b.value.style.top=`${j.bottom+8}px`,b.value.style.left=`${j.left}px`,b.value.style.width=`${j.width}px`,b.value.style.margin="0"},D=j=>{p.value&&!p.value.contains(j.target)&&b.value&&!b.value.contains(j.target)&&k()},F=j=>{j.key==="Escape"&&l.value&&(k(),f.value?.focus())},X=j=>{if(!l.value)return;const W=$.value;if(W.length!==0)switch(j.key){case"ArrowDown":j.preventDefault(),s.value=s.value<W.length-1?s.value+1:0,te();break;case"ArrowUp":j.preventDefault(),s.value=s.value>0?s.value-1:W.length-1,te();break;case"Enter":j.preventDefault(),s.value>=0&&s.value<W.length&&m(W[s.value]);break}},te=()=>{ge(()=>{const j=b.value?.querySelector(".highlighted-option");j&&j.scrollIntoView({block:"nearest",behavior:"smooth"})})},R=j=>{j.target===b.value&&(l.value=j.newState==="open",l.value&&O())};return xe(()=>{document.addEventListener("click",D),document.addEventListener("keydown",F);const j=()=>{l.value&&O()};window.addEventListener("resize",j),window.addEventListener("scroll",j,!0)}),Be(()=>{document.removeEventListener("click",D),document.removeEventListener("keydown",F),window.removeEventListener("resize",O),window.removeEventListener("scroll",O,!0)}),(j,W)=>(o(),a("div",{ref_key:"dropdownRef",ref:p,class:"relative"},[t.label?(o(),a("label",rs,[ye(C(t.label)+" ",1),t.required?(o(),a("span",is,"*")):L("",!0)])):L("",!0),e("button",{ref_key:"buttonRef",ref:f,type:"button",onClick:g,disabled:t.disabled,"aria-expanded":l.value,"aria-haspopup":!0,class:le(h.value)},[e("div",us,[t.loading?(o(),a("span",cs,[...W[1]||(W[1]=[e("svg",{class:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1),ye(" Loading... ",-1)])])):d.value?(o(),a("span",ps,[d.value.icon?(o(),a("img",{key:0,src:d.value.icon,alt:d.value.label,class:"w-5 h-5 flex-shrink-0"},null,8,ms)):L("",!0),e("span",vs,C(d.value.label),1)])):(o(),a("span",fs,C(t.placeholder),1)),d.value&&!t.disabled?(o(),a("button",{key:3,type:"button",onClick:w,class:"flex-shrink-0 p-0.5 hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded transition-colors","aria-label":"Clear selection"},[...W[2]||(W[2]=[e("svg",{class:"h-4 w-4 text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)])])):L("",!0),W[3]||(W[3]=e("svg",{class:"h-5 w-5 text-neutral-400 flex-shrink-0",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1))])],10,ds),l.value?(o(),a("div",{key:1,ref_key:"popoverRef",ref:b,class:"dropdown-popover"},[E(tt,{"offset-x":4,"offset-y":4,intensity:.3},{default:de(()=>[e("div",hs,[e("div",gs,[Se(e("input",{ref_key:"searchInput",ref:r,"onUpdate:modelValue":W[0]||(W[0]=B=>c.value=B),type:"text",placeholder:t.searchPlaceholder,onKeydown:X,class:"w-full px-3 py-1.5 text-sm border border-neutral-300 dark:border-neutral-600 rounded focus:outline-none focus:ring-1 focus:ring-black dark:focus:ring-white bg-white dark:bg-black text-black dark:text-white placeholder:text-neutral-400 dark:placeholder:text-neutral-500"},null,40,bs),[[Oe,c.value]])]),e("div",xs,[$.value.length===0?(o(),a("div",ys," No options found ")):L("",!0),(o(!0),a(pe,null,fe($.value,(B,N)=>(o(),a("button",{key:B.value,type:"button",onClick:U=>m(B),onMouseenter:U=>s.value=N,class:le(["w-full px-4 py-2 text-left hover:bg-neutral-100 dark:hover:bg-neutral-900 focus:bg-neutral-100 dark:focus:bg-neutral-900 focus:outline-none flex items-start gap-3",{"bg-neutral-50 dark:bg-neutral-900":B.value===t.modelValue,"bg-neutral-100 dark:bg-neutral-800 highlighted-option":N===s.value}])},[e("div",ws,[B.icon?(o(),a("img",{key:0,src:B.icon,alt:B.label,class:"w-full h-full"},null,8,_s)):(o(),a("div",$s))]),e("div",Cs,[e("div",Vs,C(B.label),1),B.description?(o(),a("div",Ss,C(B.description),1)):L("",!0)])],42,ks))),128))])])]),_:1})],512)):L("",!0),t.error?(o(),a("p",Ts,C(t.error),1)):L("",!0)],512))}}),Ms={class:"flex items-start"},Ls=["for"],Is=["id","checked","disabled"],Es={class:"flex items-center h-5"},As={class:"flex-1"},Ps={key:0,class:"text-red-500"},Os={key:1,class:"text-xs text-neutral-600 dark:text-neutral-400 mt-1"},js={key:2,class:"text-xs text-red-500 dark:text-red-400 mt-1"},Te=se({__name:"CheckboxInput",props:{modelValue:{type:Boolean,default:!1},label:{},helpText:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},error:{}},emits:["update:modelValue"],setup(t,{emit:i}){const n=t,u=i,l=go(),c=K(()=>["w-5 h-5 border-2 rounded relative flex-shrink-0","transition-all duration-150",n.error?"border-red-500 dark:border-red-400":"border-black dark:border-neutral-300",n.disabled?"opacity-50":"hover:scale-110",n.modelValue?"bg-black dark:bg-white":"bg-white dark:bg-black","before:content-[''] before:absolute before:inset-0 before:m-auto before:w-2.5 before:h-1.5 before:border-white dark:before:border-black before:border-b-2 before:border-l-2 before:rotate-[-45deg]",n.modelValue?"before:block":"before:hidden"]),r=p=>{if(!n.disabled){const f=p.target;u("update:modelValue",f.checked)}};return(p,f)=>(o(),a("div",Ms,[e("label",{for:Z(l),class:le(["flex items-start space-x-3 cursor-pointer select-none",{"cursor-not-allowed":t.disabled}])},[e("input",{id:Z(l),type:"checkbox",checked:t.modelValue,disabled:t.disabled,onChange:r,class:"absolute left-[-9999px]"},null,40,Is),e("div",Es,[e("span",{class:le(c.value)},null,2)]),e("div",As,[t.label?(o(),a("span",{key:0,class:le(["block text-sm font-medium",{"opacity-50":t.disabled}])},[ye(C(t.label)+" ",1),t.required?(o(),a("span",Ps,"*")):L("",!0)],2)):L("",!0),t.helpText?(o(),a("p",Os,C(t.helpText),1)):L("",!0),t.error?(o(),a("p",js,C(t.error),1)):L("",!0)])],10,Ls)]))}}),Ds={key:0,class:"min-h-[400px] flex items-center justify-center"},Us={key:1,class:"space-y-6 pr-2 pb-4"},Rs={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Ns={key:1,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Bs={key:0},qs={key:1},Fs={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},zs={key:2},Hs={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Ws={class:"grid grid-cols-2 gap-6"},Js={class:"space-y-4 p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},Zs={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Ks={class:"space-y-3"},Gs={class:"flex items-start"},Xs={key:0,class:"ml-8 mt-2 space-y-2"},Ys={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-1"},Qs={key:1},en={key:0,class:"mt-3 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded"},tn={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},on={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},ln={class:"space-y-4 p-4 bg-neutral-100 dark:bg-neutral-800 rounded-lg"},an={class:"font-semibold text-base mb-4 text-neutral-800 dark:text-neutral-200"},sn={key:0,class:"flex flex-col items-center justify-center py-8"},nn={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},rn={class:"space-y-3"},dn={class:"flex items-start"},un={key:0,class:"ml-8 mt-2 space-y-2"},cn={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-1"},pn={key:1},mn={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},vn={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},fn={class:"flex justify-between"},hn=["disabled"],gn=se({__name:"AgentModal",props:{modelValue:{type:Boolean},editAgent:{},mode:{}},emits:["update:modelValue","save"],setup(t,{emit:i}){const n=t,u=i,l=K(()=>n.mode==="edit"),c=v(!1),r=v(""),p=v(""),f=v(""),b=v(null),s=v(""),d=v("dual_ai"),h=v(!1),$=v(""),g=v(""),m=v(null),w=v(""),k=v(""),O=v(""),D=v(""),F=v(!0),X=v(!1),te=v(""),R=v(""),j=v(""),W=v(""),B=v(!1),N=v(null),U=v(""),y=v(""),x=v(""),V=v(""),_=v(""),T=v(""),S=v(!0),P=v(!1),J=v(""),re=v(""),A=v(""),I=v(""),M=v(null),oe=v(""),Y=v(""),ie=v(""),{data:ve,execute:ke}=Ee(ae("/api/prompts"),{immediate:!1}).json(),{data:Ie,execute:$e}=Ee(ae("/api/tools?schema=true"),{immediate:!1}).json(),Me=v(null),Pe=v(!1),Le=v(null),z=v(!1),H=v(!1),G=K(()=>{if(!ve.value)return[{value:"",label:"Select a prompt..."}];const ne=ve.value?.prompts||[];return[{value:"",label:"None"},...ne.map(q=>({value:q.id,label:q.name}))]}),ce=ne=>Ie.value?Ie.value[ne]:null,me=K(()=>!Me.value||!Me.value.tools?[{value:"",label:"None"}]:[{value:"",label:"None"},...Me.value.tools.map(ne=>{const q=typeof ne=="string"?ne:ne.name;return{value:q,label:q}})]),Ve=K(()=>!Le.value||!Le.value.tools?[{value:"",label:"None"}]:[{value:"",label:"None"},...Le.value.tools.map(ne=>{const q=typeof ne=="string"?ne:ne.name;return{value:q,label:q}})]),Ue=K(()=>{if(!te.value)return[];const ne=ce(te.value);return!ne||!ne.schema||!ne.schema.properties?[]:Object.keys(ne.schema.properties).map(q=>({value:q,label:q}))}),De=K(()=>{if(!J.value)return[];const ne=ce(J.value);return!ne||!ne.schema||!ne.schema.properties?[]:Object.keys(ne.schema.properties).map(q=>({value:q,label:q}))}),lt=[{value:"dual_ai",label:"AI + AI (Subagent)"},{value:"ai_human",label:"AI + Human"}],Ge=K({get(){return p.value},set(ne){const q=b.value?.inputRef,Q=q?.selectionStart??ne.length;let Re=ne.toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"");if(Re.endsWith("_agent")||(Re=Re+"_agent"),p.value=Re,q){q.value=Re;const Ae=Math.min(Q,Re.length-6);q.setSelectionRange(Ae,Ae)}}}),St=async()=>{await ge();const ne=b.value?.inputRef;if(ne&&p.value.endsWith("_agent")){const q=p.value.length-6;ne.setSelectionRange(q,q)}},io=ne=>!ne||ne==="_agent"?(f.value="Name is required",!1):/^[a-z][a-z0-9_]*_agent$/.test(ne)?(f.value="",!0):(f.value="Name must start with a letter",!1),at=()=>{p.value="",r.value="",f.value="",s.value="",d.value="dual_ai",h.value=!1,$.value="",g.value="",m.value=null,w.value="",O.value="",D.value="",F.value=!0,X.value=!1,te.value="",R.value="",j.value="",W.value="",B.value=!1,N.value=null,U.value="",y.value="",x.value="",Me.value=null,_.value="",T.value="",S.value=!0,P.value=!1,J.value="",re.value="",A.value="",I.value="",M.value=null,oe.value="",Y.value="",ie.value="",Le.value=null},uo=async()=>{if(n.editAgent?.id){c.value=!0,H.value=!0;try{const ne=await fetch(ae(`/api/agents/${n.editAgent.id}`));if(ne.ok){const q=await ne.json(),Q=q.agent||q;p.value=Q.name||"",r.value=Q.name||"",s.value=Q.title||"",d.value=Q.type||"dual_ai",h.value=Q.expose_as_tool||!1,$.value=Q.tool_description||"",m.value=Q.max_session_turns;const Re=Q.side_a_stop_tool||"",Ae=Q.side_a_stop_tool_response_property||"",mo=Q.side_b_stop_tool||"",vo=Q.side_b_stop_tool_response_property||"",fo=Q.side_a_end_conversation_tool||"",ho=Q.side_b_end_conversation_tool||"";k.value=Q.side_a_label||"",V.value=Q.side_b_label||"",O.value=Q.side_a_agent_prompt||"",_.value=Q.side_b_agent_prompt||"",F.value=!!Q.side_a_stop_on_response,X.value=!!Q.side_a_stop_tool,B.value=!!Q.side_a_manual_stop_condition,N.value=Q.side_a_max_turns,S.value=!!Q.side_b_stop_on_response,P.value=!!Q.side_b_stop_tool,M.value=Q.side_b_max_turns,await ge(),te.value=Re,j.value=Ae,J.value=mo,A.value=vo,y.value=fo,Y.value=ho}}catch(ne){console.error("Error loading agent data:",ne)}finally{c.value=!1,H.value=!1}}},co=async()=>{f.value="",w.value="",D.value="",R.value="",W.value="",U.value="",x.value="",T.value="",re.value="",I.value="",oe.value="",ie.value="";let ne=!1;io(p.value)||(ne=!0);const q=p.value;d.value==="dual_ai"&&m.value!==null&&m.value!==void 0&&m.value<=0&&(w.value="Max session turns must be a positive number",ne=!0),O.value||(D.value="Please select an agent prompt",ne=!0);const Q=F.value||te.value,Re=d.value==="ai_human"&&B.value;if(!Q&&!Re&&(D.value="At least one stop condition is required (or check manual stop condition for ai_human agents)",ne=!0),te.value&&!j.value&&(W.value="Response property required when using stop tool",ne=!0),N.value!==null&&N.value<=0&&(U.value="Max turns must be a positive number",ne=!0),d.value==="dual_ai"&&!y.value&&!Y.value&&(x.value="At least one side must have an end conversation tool",ie.value="At least one side must have an end conversation tool",ne=!0),d.value==="dual_ai"&&(_.value||(T.value="Please select an agent prompt",ne=!0),J.value&&!A.value&&(I.value="Response property required when using stop tool",ne=!0),M.value!==null&&M.value<=0&&(oe.value="Max turns must be a positive number",ne=!0)),ne)return;const Ae={name:q,title:s.value||null,type:d.value,expose_as_tool:h.value,tool_description:h.value?$.value:null,max_session_turns:d.value==="dual_ai"?m.value:null,side_a_label:k.value||null,side_a_agent_prompt:O.value,side_a_stop_on_response:F.value,side_a_stop_tool:te.value||null,side_a_stop_tool_response_property:j.value||null,side_a_manual_stop_condition:B.value,side_a_max_turns:N.value,side_a_end_conversation_tool:y.value||null};d.value==="dual_ai"&&(Ae.side_b_label=V.value||null,Ae.side_b_agent_prompt=_.value,Ae.side_b_stop_on_response=S.value,Ae.side_b_stop_tool=J.value||null,Ae.side_b_stop_tool_response_property=A.value||null,Ae.side_b_max_turns=M.value,Ae.side_b_end_conversation_tool=Y.value||null),l.value&&n.editAgent?.id&&(Ae.id=n.editAgent.id),u("save",Ae),at(),u("update:modelValue",!1)},po=()=>{at(),u("update:modelValue",!1)};return ue(O,async ne=>{if(H.value||(te.value="",j.value=""),!ne){Me.value=null;return}Pe.value=!0;try{const q=await fetch(ae(`/api/prompts/${ne}`));q.ok&&(Me.value=await q.json())}catch(q){console.error("Error fetching Side A prompt:",q)}finally{Pe.value=!1}}),ue(_,async ne=>{if(H.value||(J.value="",A.value=""),!ne){Le.value=null;return}z.value=!0;try{const q=await fetch(ae(`/api/prompts/${ne}`));q.ok&&(Le.value=await q.json())}catch(q){console.error("Error fetching Side B prompt:",q)}finally{z.value=!1}}),ue(X,ne=>{ne||(te.value="",j.value="")}),ue(P,ne=>{ne||(J.value="",A.value="")}),ue(()=>n.modelValue,async ne=>{ne&&(await Promise.all([ke(),$e()]),l.value?(at(),await uo()):at())}),(ne,q)=>(o(),ee(je,{"model-value":t.modelValue,"onUpdate:modelValue":q[23]||(q[23]=Q=>ne.$emit("update:modelValue",Q)),title:l.value?"Edit Agent":"Create Agent",width:"max-w-6xl"},{footer:de(()=>[e("div",fn,[e("button",{onClick:po,type:"button",class:"px-3 py-1.5 text-sm border border-black dark:border-white rounded font-medium hover:bg-black/5 dark:hover:bg-white/10 transition-colors"}," Cancel "),e("button",{onClick:co,type:"button",class:"px-3 py-1.5 text-sm bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity",disabled:c.value},C(l.value?"Update Agent":"Create Agent"),9,hn)])]),default:de(()=>[c.value?(o(),a("div",Ds,[...q[24]||(q[24]=[e("span",{class:"text-neutral-500"},"Loading agent data...",-1)])])):(o(),a("div",Us,[e("div",null,[E(Ce,{ref_key:"nameInputRef",ref:b,modelValue:Ge.value,"onUpdate:modelValue":q[0]||(q[0]=Q=>Ge.value=Q),label:"Agent Name",placeholder:"research_agent",error:f.value,required:"",disabled:l.value,onFocus:St,onClick:St},null,8,["modelValue","error","disabled"]),!f.value&&!l.value?(o(),a("p",Rs," Names are automatically formatted to snake_case with the _agent suffix ")):L("",!0),l.value?(o(),a("p",Ns," Agent names cannot be changed after creation (used as foreign key for threads) ")):L("",!0)]),e("div",null,[E(Ce,{modelValue:s.value,"onUpdate:modelValue":q[1]||(q[1]=Q=>s.value=Q),label:"Display Title (Optional)",placeholder:"Research Assistant"},null,8,["modelValue"]),q[25]||(q[25]=e("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Human-readable title shown in the UI. If not set, the name will be used. ",-1))]),e("div",null,[E(he,{modelValue:d.value,"onUpdate:modelValue":q[2]||(q[2]=Q=>d.value=Q),label:"Agent Type",options:lt},null,8,["modelValue"]),q[26]||(q[26]=e("p",{class:"mt-1 text-sm text-neutral-500 dark:text-neutral-400"}," Choose between two AI agents conversing, or an AI agent conversing with a human ",-1))]),d.value==="dual_ai"?(o(),a("div",Bs,[E(Te,{modelValue:h.value,"onUpdate:modelValue":q[3]||(q[3]=Q=>h.value=Q),label:"Expose as Tool"},null,8,["modelValue"]),q[27]||(q[27]=e("p",{class:"mt-1 text-sm text-neutral-500 dark:text-neutral-400"}," Make this subagent available as a tool that can be called by other prompts or agents. When called, it will execute as a subagent. ",-1))])):L("",!0),h.value&&d.value==="dual_ai"?(o(),a("div",qs,[E(to,{modelValue:$.value,"onUpdate:modelValue":q[4]||(q[4]=Q=>$.value=Q),label:"Tool Description",placeholder:"Describe what this agent does when called as a tool",error:g.value,rows:3},null,8,["modelValue","error"]),g.value?L("",!0):(o(),a("p",Fs," This description helps other agents understand when to use this agent "))])):L("",!0),d.value==="dual_ai"?(o(),a("div",zs,[E(Ce,{"model-value":m.value?.toString()||"","onUpdate:modelValue":q[5]||(q[5]=Q=>m.value=Q?parseInt(Q):null),label:"Max Session Turns",type:"number",error:w.value,placeholder:"Unlimited"},null,8,["model-value","error"]),w.value?L("",!0):(o(),a("p",Hs," Maximum number of back-and-forth exchanges between the two agents before the conversation ends "))])):L("",!0),e("div",Ws,[e("div",Js,[q[34]||(q[34]=e("h4",{class:"font-semibold text-base mb-4 text-neutral-800 dark:text-neutral-200"}," Side A (AI) ",-1)),e("div",null,[E(Ce,{modelValue:k.value,"onUpdate:modelValue":q[6]||(q[6]=Q=>k.value=Q),label:"Side Label (Optional)",placeholder:"e.g., ATC, Pilot, Customer, Support"},null,8,["modelValue"]),q[28]||(q[28]=e("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Custom label for this side (shows in message bubbles and toggle) ",-1))]),e("div",null,[E(he,{modelValue:O.value,"onUpdate:modelValue":q[7]||(q[7]=Q=>O.value=Q),label:"Agent Prompt",options:G.value,error:D.value,required:""},null,8,["modelValue","options","error"]),D.value?L("",!0):(o(),a("p",Zs," The prompt that defines this agent's behavior "))]),e("div",Ks,[q[31]||(q[31]=e("label",{class:"block text-sm font-medium"}," Stop Conditions ",-1)),q[32]||(q[32]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400"}," Optional. If no stop conditions are set, the agent will continue until programmatically stopped or end conversation tool is called. ",-1)),e("div",Gs,[E(Te,{modelValue:F.value,"onUpdate:modelValue":q[8]||(q[8]=Q=>F.value=Q),label:"Stop when agent returns content"},null,8,["modelValue"])]),q[33]||(q[33]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-2 ml-6"}," Agent stops when it returns a response without calling tools ",-1)),e("div",null,[E(Te,{modelValue:X.value,"onUpdate:modelValue":q[9]||(q[9]=Q=>X.value=Q),label:"Stop on specific tool call"},null,8,["modelValue"]),X.value?(o(),a("div",Xs,[E(he,{modelValue:te.value,"onUpdate:modelValue":q[10]||(q[10]=Q=>te.value=Q),label:"Stop Tool",options:me.value,error:R.value,placeholder:"Select a tool...",disabled:Pe.value||!O.value},null,8,["modelValue","options","error","disabled"]),R.value?L("",!0):(o(),a("p",Ys," Agent stops when this tool is called ")),te.value?(o(),a("div",Qs,[E(he,{modelValue:j.value,"onUpdate:modelValue":q[11]||(q[11]=Q=>j.value=Q),label:"Response Property",options:Ue.value,error:W.value,placeholder:"Select property..."},null,8,["modelValue","options","error"]),q[29]||(q[29]=e("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Property from tool arguments to return as final response ",-1))])):L("",!0)])):L("",!0)]),d.value==="ai_human"&&!F.value&&!X.value?(o(),a("div",en,[E(Te,{modelValue:B.value,"onUpdate:modelValue":q[12]||(q[12]=Q=>B.value=Q),label:"I have manually implemented a stop condition"},null,8,["modelValue"]),q[30]||(q[30]=e("p",{class:"mt-2 text-xs text-yellow-800 dark:text-yellow-200"}," ⚠️ Warning: Only check this if you have implemented a custom stop condition in your code (e.g., via hooks or custom logic). Without a stop condition, the agent may run indefinitely. ",-1))])):L("",!0)]),e("div",null,[E(Ce,{"model-value":N.value?.toString()||"","onUpdate:modelValue":q[13]||(q[13]=Q=>N.value=Q?parseInt(Q):null),label:"Max Turns",type:"number",error:U.value,placeholder:"Unlimited"},null,8,["model-value","error"]),U.value?L("",!0):(o(),a("p",tn," Maximum turns this side can take before yielding (safety limit) "))]),e("div",null,[E(he,{modelValue:y.value,"onUpdate:modelValue":q[14]||(q[14]=Q=>y.value=Q),label:"End Conversation Tool",options:me.value,error:x.value,placeholder:"Select a tool...",disabled:Pe.value||!O.value},null,8,["modelValue","options","error","disabled"]),x.value?L("",!0):(o(),a("p",on," Tool that ends the entire conversation when called "))])]),e("div",ln,[e("h4",an," Side B ("+C(d.value==="ai_human"?"Human":"AI")+") ",1),e("div",null,[E(Ce,{modelValue:V.value,"onUpdate:modelValue":q[15]||(q[15]=Q=>V.value=Q),label:"Side Label (Optional)",placeholder:"e.g., ATC, Pilot, Customer, Support"},null,8,["modelValue"]),q[35]||(q[35]=e("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Custom label for this side (shows in message bubbles and toggle) ",-1))]),d.value==="ai_human"?(o(),a("div",sn,[...q[36]||(q[36]=[e("svg",{class:"w-20 h-20 mb-4 text-neutral-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})],-1),e("h5",{class:"font-medium text-lg mb-2"},"Human User",-1),e("p",{class:"text-sm text-neutral-500 dark:text-neutral-400 text-center max-w-xs"}," This side of the conversation will be handled by a human user through the interface ",-1)])])):(o(),a(pe,{key:1},[e("div",null,[E(he,{modelValue:_.value,"onUpdate:modelValue":q[16]||(q[16]=Q=>_.value=Q),label:"Agent Prompt",options:G.value,error:T.value,required:""},null,8,["modelValue","options","error"]),T.value?L("",!0):(o(),a("p",nn," The prompt that defines this agent's behavior "))]),e("div",rn,[q[38]||(q[38]=e("label",{class:"block text-sm font-medium"}," Stop Conditions ",-1)),q[39]||(q[39]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400"}," Optional. If no stop conditions are set, the agent will continue until programmatically stopped or end conversation tool is called. ",-1)),e("div",dn,[E(Te,{modelValue:S.value,"onUpdate:modelValue":q[17]||(q[17]=Q=>S.value=Q),label:"Stop when agent returns content"},null,8,["modelValue"])]),q[40]||(q[40]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-2 ml-6"}," Agent stops when it returns a response without calling tools ",-1)),e("div",null,[E(Te,{modelValue:P.value,"onUpdate:modelValue":q[18]||(q[18]=Q=>P.value=Q),label:"Stop on specific tool call"},null,8,["modelValue"]),P.value?(o(),a("div",un,[E(he,{modelValue:J.value,"onUpdate:modelValue":q[19]||(q[19]=Q=>J.value=Q),label:"Stop Tool",options:Ve.value,error:re.value,placeholder:"Select a tool...",disabled:z.value||!_.value},null,8,["modelValue","options","error","disabled"]),re.value?L("",!0):(o(),a("p",cn," Agent stops when this tool is called ")),J.value?(o(),a("div",pn,[E(he,{modelValue:A.value,"onUpdate:modelValue":q[20]||(q[20]=Q=>A.value=Q),label:"Response Property",options:De.value,error:I.value,placeholder:"Select property..."},null,8,["modelValue","options","error"]),q[37]||(q[37]=e("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Property from tool arguments to return as final response ",-1))])):L("",!0)])):L("",!0)])]),e("div",null,[E(Ce,{"model-value":M.value?.toString()||"","onUpdate:modelValue":q[21]||(q[21]=Q=>M.value=Q?parseInt(Q):null),label:"Max Turns",type:"number",error:oe.value,placeholder:"Unlimited"},null,8,["model-value","error"]),oe.value?L("",!0):(o(),a("p",mn," Maximum turns this side can take before yielding (safety limit) "))]),e("div",null,[E(he,{modelValue:Y.value,"onUpdate:modelValue":q[22]||(q[22]=Q=>Y.value=Q),label:"End Conversation Tool",options:Ve.value,error:ie.value,placeholder:"Select a tool...",disabled:z.value||!_.value},null,8,["modelValue","options","error","disabled"]),ie.value?L("",!0):(o(),a("p",vn," Tool that ends the entire conversation when called "))])],64))])])]))]),_:1},8,["model-value","title"]))}}),bn={},xn={class:"p-8 w-full max-w-7xl mx-auto"};function yn(t,i){return o(),a("div",xn,[He(t.$slots,"default")])}const Ke=Ze(bn,[["render",yn]]),kn=se({__name:"AgentsView",setup(t){const i=et(),n=ze(),u=v(!1),l=v("add"),c=v(null),r=v(null);ue(()=>n.query.refresh,()=>{n.query.refresh&&(r.value?.refresh(),i.replace({path:"/agents",query:{}}))});const p=()=>{l.value="add",c.value=null,u.value=!0},f=s=>{l.value="edit",c.value=s,u.value=!0},b=async s=>{try{const d=l.value==="edit"&&c.value?.id,{originalName:h,...$}=s,g=ae(d?`/api/agents/${c.value.id}`:"/api/agents"),w=await fetch(g,{method:d?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});if(w.ok)r.value?.refresh(),u.value=!1,c.value=null;else{const k=await w.json();alert(k.error||`Failed to ${d?"update":"create"} agent`)}}catch(d){console.error(`Error ${l.value==="edit"?"updating":"creating"} agent:`,d),alert(`Failed to ${l.value==="edit"?"update":"create"} agent`)}};return(s,d)=>(o(),ee(Ke,null,{default:de(()=>[e("div",{class:"flex justify-between items-center mb-6"},[d[1]||(d[1]=e("h1",{class:"text-3xl font-bold"},"Agents",-1)),e("button",{onClick:p,class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"}," Create Agent ")]),d[2]||(d[2]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-6"}," Configure and manage your AI agents. ",-1)),E(Da,{ref_key:"dataTableRef",ref:r,onAdd:p,onEdit:f},null,512),E(gn,{modelValue:u.value,"onUpdate:modelValue":d[0]||(d[0]=h=>u.value=h),mode:l.value,editAgent:c.value,onSave:b},null,8,["modelValue","mode","editAgent"])]),_:1}))}});function wn(t){const{limit:i=50,offset:n=0,agentId:u=null,userId:l=null,autoFetch:c=!0}={},r=K(()=>{const w=new URLSearchParams,k=typeof i=="number"?i:i.value,O=typeof n=="number"?n:n.value,D=typeof u=="string"?u:u?.value,F=typeof l=="string"?l:l?.value;return w.append("limit",k.toString()),w.append("offset",O.toString()),D&&w.append("agent_id",D),F&&w.append("user_id",F),ae(`/api/threads?${w.toString()}`)}),{data:p,error:f,isFetching:b,isFinished:s,execute:d,abort:h}=Ee(r,{immediate:c}).get().json(),$=K(()=>p.value?.threads||[]),g=K(()=>p.value?.total||0),m=K(()=>p.value?.hasMore||!1);return{threads:$,total:g,hasMore:m,error:f,isFetching:b,isFinished:s,refetch:d,abort:h}}function Ct(t){const i=K(()=>!!(typeof t=="string"?t:t?.value)),n=K(()=>{const s=typeof t=="string"?t:t?.value;return ae(s?`/api/threads/${s}`:"/api/threads/placeholder")}),{data:u,error:l,isFetching:c,isFinished:r,execute:p,abort:f}=Ee(n,{immediate:!1}).get().json();return ue(i,s=>{s&&p()},{immediate:!0}),{thread:K(()=>u.value?{id:u.value.thread.id,agent_id:u.value.thread.agent_id,user_id:u.value.thread.user_id,tags:u.value.thread.tags||[],created_at:u.value.thread.created_at,agent:u.value.agent||{id:"",title:"Unknown",type:"unknown"},stats:u.value.stats}:null),error:l,isFetching:c,isFinished:r,refetch:p,abort:f}}function _n(t){const{autoConnect:i=!0,onEvent:n}=t||{},u=v(null),l=v(!1),c=v(null),r=()=>{u.value&&u.value.close();const f=window.location.protocol==="https:"?"wss:":"ws:",b=window.location.host;let s=`${f}//${b}${ae("/api/events")}`;const d=localStorage.getItem("auth_token");d&&(s+=`?token=${encodeURIComponent(d)}`);try{u.value=new WebSocket(s),u.value.onopen=()=>{l.value=!0,c.value=null,console.log("[AgentBuilderEvents] WebSocket connected")},u.value.onmessage=h=>{try{const $=JSON.parse(h.data);console.log("[AgentBuilderEvents] Received event:",$.type),n&&n($)}catch($){console.error("[AgentBuilderEvents] Failed to parse WebSocket message:",$)}},u.value.onerror=h=>{c.value="WebSocket connection error",l.value=!1,console.error("[AgentBuilderEvents] WebSocket error:",h)},u.value.onclose=()=>{l.value=!1,console.log("[AgentBuilderEvents] WebSocket disconnected")}}catch(h){c.value=h.message||"Failed to create WebSocket",console.error("[AgentBuilderEvents] WebSocket creation error:",h)}},p=()=>{u.value&&(u.value.close(),u.value=null,l.value=!1)};return i&&r(),Be(()=>{p()}),{wsConnected:l,wsError:c,connect:r,disconnect:p}}const $n={class:"inline-flex items-center justify-center"},be=se({__name:"Loader",props:{size:{default:"md"}},setup(t){const i=t,n=K(()=>{switch(i.size){case"xs":return"w-3 h-3 border";case"sm":return"w-3.5 h-3.5 border";case"md":default:return"w-4 h-4 border-2"}});return(u,l)=>(o(),a("div",$n,[e("div",{class:le([n.value,"border-black/20 dark:border-white/20 border-t-black dark:border-t-white rounded-full animate-spin"])},null,2)]))}});function Cn(t){const n=Date.now()*1e3-t,u=Math.floor(n/1e6);if(u<60)return u===1?"1 second ago":`${u} seconds ago`;const l=Math.floor(u/60);if(l<60)return l===1?"1 minute ago":`${l} minutes ago`;const c=Math.floor(l/60);if(c<24)return c===1?"1 hour ago":`${c} hours ago`;const r=Math.floor(c/24);if(r<30)return r===1?"1 day ago":`${r} days ago`;const p=Math.floor(r/30);if(p<12)return p===1?"1 month ago":`${p} months ago`;const f=Math.floor(p/12);return f===1?"1 year ago":`${f} years ago`}function Vn(t){const i=v("");let n=null;const u=()=>typeof t=="function"?t():typeof t=="number"?t:t.value,l=()=>{const c=u();i.value=Cn(c);const p=Date.now()*1e3-c,f=Math.floor(p/1e6);n!==null&&(clearInterval(n),n=null),f<60?n=setInterval(l,1e3):f<3600?n=setInterval(l,6e4):f<86400&&(n=setInterval(l,6e5))};return l(),Be(()=>{n!==null&&clearInterval(n)}),i}const dt=se({__name:"TimeAgo",props:{timestamp:{}},setup(t){const i=t,n=Vn(()=>i.timestamp);return(u,l)=>(o(),a("span",null,C(Z(n)),1))}}),Sn={class:"relative inline-flex items-center"},Tn={key:0,class:"inline-block w-2 h-2 rounded-full bg-green-500 dark:bg-green-400"},Mn={key:1,class:"inline-block w-2 h-2 rounded-full bg-red-500 dark:bg-red-400"},Ln={key:2,class:"inline-block w-2 h-2 rounded-full bg-neutral-400 dark:bg-neutral-600"},In={key:0},En={key:1},An={key:2},Vt=se({__name:"StatusDot",props:{connected:{type:Boolean},error:{type:Boolean}},setup(t){const i=v(!1),n=v(null);return(u,l)=>(o(),a("div",Sn,[e("span",{class:"p-0.5 cursor-default outline-none",tabindex:"-1",onMouseenter:l[0]||(l[0]=c=>i.value=!0),onMouseleave:l[1]||(l[1]=c=>i.value=!1)},[t.connected?(o(),a("span",Tn)):t.error?(o(),a("span",Mn)):(o(),a("span",Ln))],32),E(We,{"enter-active-class":"transition-opacity duration-150","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:de(()=>[i.value?(o(),a("div",{key:0,ref_key:"popoverRef",ref:n,class:le(["absolute top-full left-1/2 -translate-x-1/2 mt-1 px-2 py-1 text-xs rounded shadow-lg whitespace-nowrap z-50 border",{"bg-green-50 dark:bg-green-950 border-green-200 dark:border-green-800 text-green-700 dark:text-green-300":t.connected,"bg-red-50 dark:bg-red-950 border-red-200 dark:border-red-800 text-red-700 dark:text-red-300":!t.connected&&t.error,"bg-neutral-50 dark:bg-neutral-900 border-neutral-200 dark:border-neutral-700 text-neutral-600 dark:text-neutral-400":!t.connected&&!t.error}])},[t.connected?(o(),a("span",In,"Live - Connected")):t.error?(o(),a("span",En,"Connection Error")):(o(),a("span",An,"Offline"))],2)):L("",!0)]),_:1})]))}}),Pn={class:"flex flex-col flex-1"},On={class:"px-4 py-3 border-b border-neutral-300 dark:border-neutral-700"},jn={class:"flex items-center justify-between"},Dn={class:"flex items-center gap-2"},Un={class:"flex items-center gap-2"},Rn={class:"flex-1 overflow-y-auto text-xs"},Nn={key:0,class:"p-2 flex justify-center"},Bn={key:1,class:"p-2 text-red-600 dark:text-red-400"},qn={key:2,class:"text-neutral-500 dark:text-neutral-400 text-center py-12 text-base"},Fn={key:3},zn=["id","onClick"],Hn={class:"flex items-center gap-2 mb-1"},Wn={class:"font-medium truncate flex-1 min-w-0"},Jn={class:"flex-shrink-0 text-neutral-500 dark:text-neutral-400"},Zn={key:0,class:"flex flex-wrap gap-1"},Kn=se({__name:"ThreadListPane",props:{selectedThreadId:{}},emits:["selectThread","collapse","createThread","threadsLoaded"],setup(t,{expose:i,emit:n}){const u=n;v("");const{threads:l,isFetching:c,isFinished:r,error:p,refetch:f}=wn(),b=v([]),s=v(new Set),d=K(()=>{const k=l.value.filter(F=>!s.value.has(F.id)),O=new Set(k.map(F=>F.id));return[...b.value.filter(F=>!O.has(F.id)&&!s.value.has(F.id)),...k].sort((F,X)=>X.created_at-F.created_at)}),h=async k=>{if(k.type==="thread_created"){const O={id:k.thread.id,agent_id:k.thread.agent_name,user_id:k.thread.user_id,tags:k.thread.tags||[],created_at:k.thread.created_at,agent:{title:k.thread.agent_name,type:"ai_human"}};b.value.unshift(O)}else k.type==="thread_deleted"&&(s.value.add(k.threadId),b.value=b.value.filter(O=>O.id!==k.threadId))},{wsConnected:$,wsError:g}=_n({onEvent:h});ue(l,()=>{b.value=[]});const m=v(!1);ue(()=>({threads:l.value,finished:r.value}),({threads:k,finished:O})=>{O&&!m.value&&(m.value=!0,u("threadsLoaded",k[0]?.id??null))},{immediate:!0}),i({refetch:f});const w=k=>{u("selectThread",k)};return(k,O)=>(o(),a("div",Pn,[e("div",On,[e("div",jn,[e("div",Dn,[E(Z(qt),{size:18,class:"shrink-0"}),O[2]||(O[2]=e("h2",{class:"text-base font-bold"},"Threads",-1)),E(Vt,{connected:Z($),error:Z(g)},null,8,["connected","error"])]),e("div",Un,[e("button",{onClick:O[0]||(O[0]=D=>u("createThread")),type:"button",class:"px-2 py-1 text-xs bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity whitespace-nowrap"}," + New "),e("button",{onClick:O[1]||(O[1]=D=>u("collapse")),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Collapse pane"},[E(Z($t),{size:20})])])])]),e("div",Rn,[Z(c)?(o(),a("div",Nn,[E(be)])):Z(p)?(o(),a("div",Bn," Error: "+C(Z(p)),1)):d.value.length===0?(o(),a("div",qn," No threads found ")):(o(),a("div",Fn,[(o(!0),a(pe,null,fe(d.value,D=>(o(),a("button",{key:D.id,id:`thread-${D.id}`,class:le(["w-full text-left px-2 py-2 border-b border-neutral-200 dark:border-neutral-800 cursor-pointer transition-colors relative hover:ring-2 hover:ring-inset hover:ring-accent-400 dark:hover:ring-accent-400",{"bg-accent-100 dark:bg-accent-900 dark:text-white ring-2 ring-inset ring-accent-400 dark:ring-accent-400":t.selectedThreadId===D.id}]),onClick:F=>w(D.id)},[e("div",Hn,[e("span",Wn,C(D.agent.title),1),e("span",Jn,[E(dt,{timestamp:D.created_at*1e6},null,8,["timestamp"])])]),D.tags.length>0?(o(),a("div",Zn,[(o(!0),a(pe,null,fe(D.tags,F=>(o(),a("span",{key:F,class:le(["inline-block px-1.5 py-0.5 rounded text-[10px]",t.selectedThreadId===D.id?"bg-accent-400 dark:bg-accent-950 text-accent-950 dark:text-accent-200":"bg-neutral-200 dark:bg-neutral-800 text-neutral-700 dark:text-neutral-300"])},C(F),3))),128))])):L("",!0)],10,zn))),128))]))])]))}}),st=150;function Gn(t,i={}){const{enableWebSocket:n=!0,autoConnect:u=!0}=i,l=v([]),c=v(null),r=v(!1),p=v(!1),f=v(null),b=v(!1),s=v(null),d=v(!1),h=v(!1),$=v(0),g=v(0);let m=null,w=null;function k(x){if(!c.value?.agent)return null;const V=c.value.agent,_=x==="assistant"?"A":"B";return _==="A"&&V.side_a_label?V.side_a_label:_==="B"&&V.side_b_label?V.side_b_label:null}function O(x,V){return x==="system"||V==="system"?!1:x!==V}const D=K(()=>{const x=[],V=l.value.filter(S=>(S.depth??0)===0),_=new Map;for(let S=0;S<V.length;S++){const P=V[S],J=P.role;if(J==="tool"){const ie=P.tool_call_id;if(ie&&_.has(ie)){const ve=_.get(ie),ke=x[ve],Ie=ke.items.find($e=>$e.type==="tool_call"&&$e.tool_call_id===ie);if(Ie){Ie.response=P.content||"",Ie.response_log_id=P.log_id;const $e=(P.content||"").toLowerCase(),Me=$e.length,Pe=$e.includes("failed")||$e.includes("error"),Le=Me<500;Pe&&Le?Ie.response_status="failed":Ie.response_status="success"}ke.updated_at=P.created_at,_.delete(ie)}continue}const re=k(J==="tool"?"assistant":J),A=x[x.length-1],I=A?.role;A&&O(J,I)&&A.type==="work"&&!A.isComplete&&(A.isComplete=!0);let M=null;if(P.tool_calls)if(typeof P.tool_calls=="string")try{M=JSON.parse(P.tool_calls)}catch(ie){console.error("Failed to parse tool_calls:",ie)}else Array.isArray(P.tool_calls)&&(M=P.tool_calls);const oe=M&&M.length>0,Y=A?.type==="work"&&A.role===J&&!A.isComplete;if(oe){let ie,ve;Y?(ie=A,ve=x.length-1):(ie={type:"work",id:P.id,role:J,items:[],created_at:P.created_at,updated_at:P.created_at,isComplete:!1,sideLabel:re,isExpanded:!1,request_sent_at:P.request_sent_at,response_completed_at:P.response_completed_at,status:P.status||"completed"},x.push(ie),ve=x.length-1),P.reasoning_content&&ie.items.push({id:`${P.id}-reasoning`,type:"reasoning",content:P.reasoning_content,created_at:P.created_at,log_id:P.log_id}),P.content&&ie.items.push({id:`${P.id}-content`,type:"content",content:P.content,created_at:P.created_at,log_id:P.log_id}),M.forEach(ke=>{ie.items.push({id:ke.id,type:"tool_call",content:ke.function.name,created_at:P.created_at,tool_name:ke.function.name,tool_call_id:ke.id,tool_arguments:ke.function.arguments,log_id:P.log_id,response:null,response_status:"pending",response_log_id:null}),_.set(ke.id,ve)}),ie.updated_at=P.created_at,P.response_completed_at&&(ie.response_completed_at=P.response_completed_at),P.status&&P.status!=="completed"?ie.status=P.status:P.status==="completed"&&ie.status==="pending"&&(ie.status="completed")}else Y&&P.status!=="pending"&&(A.isComplete=!0),(P.content||J==="system"||P.status==="pending")&&x.push({type:"text",id:P.id,role:J,content:P.content||"",created_at:P.created_at,log_id:P.log_id,sideLabel:re,isOptimistic:P.isOptimistic,status:P.status})}const T=x[x.length-1];return T?.type==="work"&&!T.isComplete&&(T.isComplete=!0),x});async function F(){if(!t.value){l.value=[],c.value=null,h.value=!1,$.value=0,g.value=0;return}r.value=!0,f.value=null;try{const x=await fetch(ae(`/api/threads/${t.value}/messages?limit=${st}&includeSilent=true`));if(!x.ok)throw new Error(`Failed to fetch messages: ${x.statusText}`);const V=await x.json();l.value=V.messages||[],h.value=V.hasMore||!1,$.value=V.total||0,g.value=st,console.log(`Loaded ${l.value.length} messages, total: ${$.value}, hasMore: ${h.value}`);const _=await fetch(ae(`/api/threads/${t.value}`));if(_.ok){const T=await _.json();c.value=T}}catch(x){f.value=x instanceof Error?x.message:"Unknown error",console.error("Error fetching messages:",x)}finally{r.value=!1}}async function X(){if(!(!t.value||p.value||!h.value)){p.value=!0;try{const x=await fetch(ae(`/api/threads/${t.value}/messages?limit=${st}&offset=${g.value}`));if(!x.ok)throw new Error(`Failed to fetch more messages: ${x.statusText}`);const V=await x.json(),_=V.messages||[];l.value=[..._,...l.value],h.value=V.hasMore||!1,g.value+=st,console.log(`Loaded ${_.length} more messages, offset now: ${g.value}, hasMore: ${h.value}`)}catch(x){f.value=x instanceof Error?x.message:"Unknown error",console.error("Error loading more messages:",x)}finally{p.value=!1}}}function te(){if(!(!n||!t.value||m))try{let V=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${ae(`/api/threads/${t.value}/stream?includeSilent=true`)}`;const _=localStorage.getItem("auth_token");_&&(V+=`&token=${encodeURIComponent(_)}`),m=new WebSocket(V),m.onopen=()=>{b.value=!0,s.value=null,console.log("WebSocket connected")},m.onmessage=T=>{try{if(T.data==="pong")return;const S=JSON.parse(T.data);if(S.type==="message_data"&&S.message_id){const P=S.message_id,J=S.data,re=l.value.findIndex(A=>A.id===P);if(re>=0)l.value[re]={...l.value[re],...J,id:P};else{const A={id:P,...J},I=l.value.filter(M=>{if(!M.isOptimistic)return!0;if(M.id===P)return!1;const oe=M.content===A.content,Y=M.role===A.role,ie=Math.abs(M.created_at-A.created_at)<5e6;return!(oe&&Y&&ie)});I.push(A),l.value=I.sort((M,oe)=>M.created_at-oe.created_at)}if(J.status==="pending")d.value=!0;else if(J.status==="completed"||J.status==="failed"){const A=l.value.some(I=>{if((I.depth??0)>0)return!1;if(I.status==="pending"||I.role==="tool"&&I.tool_call_id&&!I.tool_status)return!0;if(I.tool_calls)try{const oe=JSON.parse(I.tool_calls);if(Array.isArray(oe)&&oe.length>0&&!oe.every(ie=>l.value.some(ve=>(ve.depth??0)===0&&ve.role==="tool"&&ve.tool_call_id===ie.id&&ve.tool_status)))return!0}catch{}return!1});d.value=A}}else if(S.type==="message_chunk"){const P=S.message_id,J=S.chunk,re=l.value.findIndex(A=>A.id===P);if(re>=0){const A=l.value[re].content||"",I={...l.value[re],content:A+J};l.value.splice(re,1,I)}else{const A={id:P,role:"assistant",content:J,created_at:Date.now()*1e3,status:"pending"};l.value.push(A),l.value=l.value.sort((I,M)=>I.created_at-M.created_at)}}else S.type==="event"?console.log("📡",S.eventType,S.data):S.type==="error"&&(s.value=S.error||"WebSocket error",console.error("WebSocket error:",S.error))}catch(S){console.error("Error parsing WebSocket message:",S)}},m.onerror=T=>{s.value="WebSocket connection error",console.error("WebSocket error:",T)},m.onclose=()=>{b.value=!1,m=null,t.value&&n&&(w=setTimeout(()=>{console.log("Attempting WebSocket reconnect..."),te()},3e3))}}catch(x){s.value=x instanceof Error?x.message:"Unknown error",console.error("Error connecting WebSocket:",x)}}function R(){w&&(clearTimeout(w),w=null),m&&(m.close(),m=null,b.value=!1)}async function j(){await F()}function W(x){l.value.push({...x,isOptimistic:!0})}function B(x){l.value=l.value.filter(V=>V.id!==x)}async function N(x){if(!t.value)return;const V=[...l.value];l.value=l.value.filter(_=>_.id!==x);try{if(!(await fetch(ae(`/api/threads/${t.value}/messages/${x}`),{method:"DELETE"})).ok)throw l.value=V,new Error("Failed to delete message")}catch(_){throw l.value=V,_}}async function U(x,V){if(!t.value)return;const _=[...l.value];l.value=l.value.map(T=>T.id===x?{...T,content:V}:T);try{if(!(await fetch(ae(`/api/threads/${t.value}/messages/${x}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:V})})).ok)throw l.value=_,new Error("Failed to update message")}catch(T){throw l.value=_,T}}async function y(){if(t.value){d.value=!1;try{if(!(await fetch(ae(`/api/threads/${t.value}/stop`),{method:"POST"})).ok)throw new Error("Failed to stop thread")}catch(x){throw console.error("Error stopping thread:",x),x}}}return ue(t,async(x,V)=>{x!==V&&(R(),x?(await F(),u&&n&&te()):(l.value=[],c.value=null))},{immediate:u}),Be(()=>{R()}),{messages:D,threadInfo:c,isFetching:r,isLoadingMore:p,error:f,wsConnected:b,wsError:s,isExecuting:d,hasMore:h,totalMessages:$,refetch:j,loadMoreMessages:X,connectWebSocket:te,disconnectWebSocket:R,addOptimisticMessage:W,removeOptimisticMessage:B,deleteMessageById:N,updateMessageContent:U,stopThread:y}}const Xn=["onMouseenter","onMouseleave","onClick"],Yn=["onClick"],Qn={key:0,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"3",stroke:"currentColor",class:"w-3 h-3 text-white"},er={key:1,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2.5",stroke:"currentColor",class:"w-3 h-3 text-white"},tr={key:0,class:"w-full text-center text-xs text-neutral-400 dark:text-neutral-500 py-1"},or=["contenteditable","onInput"],lr={key:1,class:"flex gap-1 items-center min-h-[1.5rem]"},ar={key:0,class:"opacity-50"},sr={key:1,class:"opacity-50 italic text-neutral-500 dark:text-neutral-400"},nr=["onClick","onMouseenter"],rr={key:0,class:"space-y-1"},ir={class:"flex items-start gap-2"},dr={class:"flex-1 min-w-0"},ur={key:0,class:"truncate opacity-80"},cr={key:1,class:"italic opacity-60"},pr={class:"flex items-center gap-2 pl-5 opacity-60"},mr={class:"text-[10px]"},vr={class:"text-[10px]"},fr={key:1,class:"space-y-2"},hr={class:"flex items-center gap-2 pb-1 border-b border-current opacity-70"},gr={class:"text-[10px] italic"},br={class:"text-[10px] ml-auto"},xr={key:0,class:"space-y-1"},yr=["onClick","onMouseenter"],kr={class:"font-mono text-[11px] flex-shrink-0"},wr={key:2,class:"text-[10px] opacity-60 px-2 truncate flex-1 min-w-0"},_r={key:3,class:"text-[10px] text-green-600 dark:text-green-400 ml-auto flex-shrink-0"},$r={key:0,class:"pl-4 space-y-2 text-[10px]"},Cr={key:0},Vr={class:"w-full border-collapse"},Sr={class:"py-0.5 pr-2 opacity-65 align-top"},Tr={class:"py-0.5 opacity-85 break-all"},Mr={key:1},Lr=["onClick","onMouseenter"],Ir={class:"whitespace-pre-wrap break-all"},Er={key:1,class:"text-[10px]"},Ar=["onClick"],Pr={key:0,class:"mt-1 pl-4 whitespace-pre-wrap break-words opacity-80"},Or={key:2,class:"text-[10px] opacity-80 pl-4 pb-2 break-words"},jr=se({__name:"AgentMessages",props:{messages:{},selectedMessageId:{},selectedLogId:{},hoveredLogId:{},isEditMode:{type:Boolean},selectedForDelete:{},editedMessages:{}},emits:["messageClick","messageHover","selectionChange","messageEdit"],setup(t,{expose:i,emit:n}){const u=t,l=n;function c(A){const I=u.selectedForDelete?.has(A)??!1;l("selectionChange",A,!I)}function r(A,I){const oe=A.target.innerText;l("messageEdit",I,oe)}function p(A){return u.editedMessages?.has(A)??!1}const f=v(new Map);function b(A,I){I?f.value.set(A,I):f.value.delete(A)}function s(A){const I=u.messages.findIndex(M=>M.log_id===A);if(I<=0)return-1;for(let M=I-1;M>=0;M--){const oe=u.messages[M];if(oe.role==="user")return M;if(oe.role==="assistant"&&oe.log_id)break}return-1}function d(A){for(let I=0;I<u.messages.length;I++){const M=u.messages[I];if(M.log_id===A||M.type==="work"&&M.items&&M.items.some(ie=>ie.log_id===A||ie.response_log_id===A))return I}return-1}function h(A,I){const oe=d(A);if(oe===-1)return!1;const Y=f.value.get(oe);if(!Y)return!1;const ie=u.messages[oe];let ve=null;if(ie.role==="assistant"&&ie.log_id){const $e=s(ie.log_id);ve=$e!==-1?f.value.get($e):null}const ke=I.getBoundingClientRect(),Ie=Y.getBoundingClientRect();if(Ie.top<ke.top){const Pe=(ve||Y).getBoundingClientRect().top-ke.top-10;I.scrollBy({top:Pe,behavior:"smooth"})}else if(Ie.bottom>ke.bottom){const $e=Ie.bottom-ke.bottom+10;I.scrollBy({top:$e,behavior:"smooth"})}else if(ve){const $e=ve.getBoundingClientRect();if($e.top<ke.top){const Me=$e.top-ke.top-10;I.scrollBy({top:Me,behavior:"smooth"})}}return!0}function $(A){for(const I of u.messages){if(I.type!=="work")continue;if(I.items.some(Y=>Y.log_id===A||Y.response_log_id===A))return!0}return!1}i({scrollToLogId:h,hasWorkblockForLogId:$});function g(A){const I=u.messages[A];if(I.log_id)return I.log_id;if(I.role==="user")for(let M=A+1;M<u.messages.length;M++){const oe=u.messages[M];if(oe.log_id)return oe.log_id;if(oe.role==="user")break}return null}function m(A,I){return I?g(A)===I:!1}function w(A){const I=g(A);I&&l("messageHover",I)}function k(A){g(A)&&l("messageHover",null)}function O(A){const I=u.messages[A],M=g(A);M&&l("messageClick",I.id,M)}const D=v(new Set),F=v(new Set),X=v(new Set);function te(A){D.value.has(A)?D.value.delete(A):D.value.add(A)}function R(A){F.value.has(A)?F.value.delete(A):F.value.add(A)}function j(A){X.value.has(A)?X.value.delete(A):X.value.add(A)}function W(A){if(!A)return{};try{return JSON.parse(A)}catch{return{raw:A}}}function B(A){if(!A)return null;const I=W(A),M=Object.keys(I);if(M.length===0)return null;const oe=I[M[0]];return typeof oe=="string"?oe:JSON.stringify(oe)}function N(A){return new Date(A/1e3).toLocaleTimeString()}function U(A){const I=Math.round(A/1e6);if(I<1)return"< 1s";if(I<60)return`${I}s`;const M=Math.floor(I/60),oe=I%60;return`${M}m ${oe}s`}function y(A){if(A.status==="pending")return"...";if(!A.isComplete)return"Working...";let I;return A.request_sent_at&&A.response_completed_at?I=A.response_completed_at-A.request_sent_at:I=A.updated_at-A.created_at,`Worked for ${U(I)}`}function x(A){const I=A.filter(M=>M.type==="content");if(I.length===0){const M=A.filter(oe=>oe.type==="reasoning");return M.length>0?M[M.length-1].content:null}return I[I.length-1].content}function V(A){const M=A.trim().split(`
|
|
2
|
-
`)[0];return M.length>60?M.substring(0,60):M}function _(A){return u.selectedMessageId===A.id?!0:u.selectedLogId?A.items.some(I=>I.log_id===u.selectedLogId||I.response_log_id===u.selectedLogId):!1}function T(A){return!!(u.selectedLogId&&(A.log_id===u.selectedLogId||A.response_log_id===u.selectedLogId))}function S(A){return u.hoveredLogId?A.items.some(I=>I.log_id===u.hoveredLogId||I.response_log_id===u.hoveredLogId):!1}function P(A){return!!(u.hoveredLogId&&(A.log_id===u.hoveredLogId||A.response_log_id===u.hoveredLogId))}function J(A){const I=[];for(const M of A.items)M.log_id&&I.push(M.log_id),M.response_log_id&&I.push(M.response_log_id);return I}function re(A){return A?A.trim():""}return(A,I)=>(o(),a("div",null,[(o(!0),a(pe,null,fe(t.messages,(M,oe)=>(o(),a("div",{key:M.id,ref_for:!0,ref:Y=>b(oe,Y),class:"flex items-center gap-2 pb-3",onMouseenter:Y=>w(oe),onMouseleave:Y=>k(oe),onClick:Y=>t.isEditMode?c(M.id):O(oe)},[t.isEditMode&&M.role!=="system"?(o(),a("button",{key:0,onClick:we(Y=>c(M.id),["stop"]),class:le(["flex-shrink-0 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",{"border-red-500 bg-red-500":t.selectedForDelete?.has(M.id),"border-green-500 bg-green-500":!t.selectedForDelete?.has(M.id)&&p(M.id),"border-neutral-400 dark:border-neutral-500 bg-transparent hover:border-neutral-500 dark:hover:border-neutral-400":!t.selectedForDelete?.has(M.id)&&!p(M.id)}])},[t.selectedForDelete?.has(M.id)?(o(),a("svg",Qn,[...I[4]||(I[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 12.75l6 6 9-13.5"},null,-1)])])):p(M.id)?(o(),a("svg",er,[...I[5]||(I[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"},null,-1)])])):L("",!0)],10,Yn)):L("",!0),e("div",{class:le(["flex-1 flex items-center gap-2 min-w-0",{"justify-start":M.role==="assistant","justify-end":M.role==="user","justify-center":M.role==="system","cursor-pointer":g(oe)&&!t.isEditMode}])},[M.type==="text"&&M.role==="system"&&M.content?.includes("Execution stopped")?(o(),a("div",tr,C(M.content),1)):M.type==="text"?(o(),a("div",{key:1,class:le(["max-w-[80%] rounded-2xl px-4 py-2 text-sm transition-all min-h-[2.5rem]",[M.silent?"bg-neutral-300 text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400 opacity-70 border-2 border-dashed border-neutral-400 dark:border-neutral-500":!t.isEditMode&&M.role!=="user"&&m(oe,t.selectedLogId)?"bg-accent-200 text-accent-950 dark:bg-accent-200 dark:text-accent-950 ring-2 ring-accent-400 dark:ring-accent-400":M.role==="assistant"?"bg-neutral-800 text-white dark:bg-neutral-300 dark:text-black":M.role==="user"?"bg-neutral-200 text-black dark:bg-neutral-800 dark:text-white":"bg-neutral-100 text-neutral-600 dark:bg-neutral-900 dark:text-neutral-400 text-xs",{"opacity-60":M.isOptimistic},{"ring-2 ring-accent-400 dark:ring-accent-400 !bg-accent-200 !text-accent-950 dark:!bg-accent-200 dark:!text-accent-950":!t.isEditMode&&M.role!=="user"&&g(oe)&&!M.silent&&!m(oe,t.selectedLogId)&&m(oe,t.hoveredLogId)},{"ring-2 ring-green-500 dark:ring-green-400":t.isEditMode&&p(M.id),"border border-dashed border-neutral-400 dark:border-neutral-500":t.isEditMode&&M.role!=="system"&&!p(M.id)}]])},[M.content||t.isEditMode?(o(),a("div",{key:0,class:"whitespace-pre-wrap break-words text-sm outline-none",contenteditable:t.isEditMode&&M.role!=="system",onInput:Y=>r(Y,M.id),onClick:I[0]||(I[0]=Y=>t.isEditMode&&Y.stopPropagation())},C(re(M.content)),41,or)):M.status==="pending"?(o(),a("div",lr,[...I[6]||(I[6]=[e("span",{class:"typing-dot",style:{"animation-delay":"0ms"}},null,-1),e("span",{class:"typing-dot",style:{"animation-delay":"150ms"}},null,-1),e("span",{class:"typing-dot",style:{"animation-delay":"300ms"}},null,-1)])])):L("",!0),M.status!=="pending"?(o(),a("div",{key:2,class:le(["text-[10px] mt-1 opacity-50 flex gap-2",{"justify-start":M.role==="assistant","justify-end":M.role!=="assistant"}])},[M.sideLabel?(o(),a("span",ar,C(M.sideLabel),1)):L("",!0),e("span",null,C(N(M.created_at)),1),M.silent?(o(),a("span",sr," silent ")):L("",!0)],2)):L("",!0)],2)):M.type==="work"?(o(),a("div",{key:2,class:le(["w-full rounded-lg px-3 py-2 text-xs transition-all border overflow-hidden",{"cursor-pointer":!t.isEditMode,"bg-neutral-50 text-neutral-700 border-neutral-200 dark:bg-neutral-900 dark:text-neutral-300 dark:border-neutral-700":M.role==="assistant"&&!M.silent,"bg-accent-50 text-accent-700 border-accent-200 dark:bg-accent-50 dark:text-accent-700 dark:border-accent-200":M.role==="user"&&!M.silent,"bg-neutral-200 text-neutral-500 border-neutral-400 dark:bg-neutral-800 dark:text-neutral-400 dark:border-neutral-600 opacity-70 border-dashed":M.silent,"ring-2 ring-accent-500":!t.isEditMode&&_(M),"ring-2 ring-accent-400":!t.isEditMode&&!_(M)&&S(M)}]),onClick:Y=>!t.isEditMode&&(te(M.id),J(M)[0]&&l("messageClick",M.id,J(M)[0])),onMouseenter:Y=>!t.isEditMode&&J(M)[0]&&l("messageHover",J(M)[0]),onMouseleave:I[3]||(I[3]=Y=>!t.isEditMode&&l("messageHover",null))},[D.value.has(M.id)?(o(),a("div",fr,[e("div",hr,[E(Z(vt),{size:14,class:"flex-shrink-0"}),e("span",gr,C(y(M)),1),e("span",br,C(M.items.length)+" operation"+C(M.items.length!==1?"s":""),1)]),(o(!0),a(pe,null,fe(M.items,Y=>(o(),a("div",{key:Y.id,class:"mb-1"},[Y.type==="tool_call"?(o(),a("div",xr,[e("div",{onClick:we(ie=>{R(Y.id),Y.log_id&&l("messageClick",M.id,Y.log_id)},["stop"]),onMouseenter:we(ie=>Y.log_id&&l("messageHover",Y.log_id),["stop"]),onMouseleave:I[1]||(I[1]=we(ie=>l("messageHover",null),["stop"])),class:le(["flex items-center gap-2 cursor-pointer hover:opacity-70 transition-opacity min-w-0",{"ring-1 ring-accent-500":T(Y),"ring-1 ring-accent-400":!T(Y)&&P(Y)}])},[F.value.has(Y.id)?(o(),ee(Z(vt),{key:1,size:12,class:"flex-shrink-0 opacity-50"})):(o(),ee(Z(mt),{key:0,size:12,class:"flex-shrink-0 opacity-50"})),e("span",kr,C(Y.tool_name),1),B(Y.tool_arguments)?(o(),a("span",wr,C(B(Y.tool_arguments)),1)):L("",!0),Y.response_status==="success"?(o(),a("span",_r,"✓")):Y.response_status==="failed"?(o(),ee(Z(bo),{key:4,size:12,class:"ml-auto text-red-600 dark:text-red-400"})):L("",!0)],42,yr),F.value.has(Y.id)?(o(),a("div",$r,[Y.tool_arguments?(o(),a("div",Cr,[I[7]||(I[7]=e("div",{class:"font-semibold mb-1 opacity-70"},"Arguments:",-1)),e("table",Vr,[e("tbody",null,[(o(!0),a(pe,null,fe(W(Y.tool_arguments),(ie,ve)=>(o(),a("tr",{key:ve,class:"border-b border-current border-opacity-10"},[e("td",Sr,C(ve),1),e("td",Tr,C(typeof ie=="object"?JSON.stringify(ie):ie),1)]))),128))])])])):L("",!0),Y.response?(o(),a("div",Mr,[I[8]||(I[8]=e("div",{class:"font-semibold mb-1 opacity-70"},"Response:",-1)),e("div",{class:le(["opacity-80 cursor-pointer hover:opacity-100",{"ring-1 ring-accent-500":t.selectedLogId&&Y.response_log_id===t.selectedLogId,"ring-1 ring-accent-400":t.hoveredLogId&&Y.response_log_id===t.hoveredLogId&&Y.response_log_id!==t.selectedLogId}]),onClick:we(ie=>Y.response_log_id&&l("messageClick",M.id,Y.response_log_id),["stop"]),onMouseenter:we(ie=>Y.response_log_id&&l("messageHover",Y.response_log_id),["stop"]),onMouseleave:I[2]||(I[2]=we(ie=>l("messageHover",null),["stop"]))},[e("div",Ir,C(re(Y.response)),1)],42,Lr)])):L("",!0)])):L("",!0)])):Y.type==="reasoning"?(o(),a("div",Er,[e("button",{onClick:we(ie=>j(Y.id),["stop"]),class:"flex items-center gap-1 opacity-70 hover:opacity-100 transition-opacity"},[X.value.has(Y.id)?(o(),ee(Z(vt),{key:1,size:12,class:"flex-shrink-0"})):(o(),ee(Z(mt),{key:0,size:12,class:"flex-shrink-0"})),I[9]||(I[9]=e("span",{class:"font-semibold"},"Reasoning",-1))],8,Ar),X.value.has(Y.id)?(o(),a("div",Pr,C(re(Y.content)),1)):L("",!0)])):Y.type==="content"?(o(),a("div",Or,C(re(Y.content)),1)):L("",!0)]))),128))])):(o(),a("div",rr,[e("div",ir,[E(Z(mt),{size:14,class:"flex-shrink-0 mt-0.5 opacity-50"}),e("div",dr,[x(M.items)?(o(),a("div",ur,C(V(x(M.items)))+"... ",1)):(o(),a("div",cr,C(y(M)),1))])]),e("div",pr,[e("span",mr,C(M.items.length)+" operation"+C(M.items.length!==1?"s":""),1),e("span",vr,"• "+C(y(M)),1)])]))],42,nr)):L("",!0)],2)],40,Xn))),128))]))}}),Dr=Ze(jr,[["__scopeId","data-v-84fabff1"]]),Ur={key:0,class:"overflow-hidden border-b border-neutral-300 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-900"},Rr={class:"max-h-[400px] overflow-y-auto"},Nr={class:"flex items-center justify-between px-4 py-2 border-b border-neutral-200 dark:border-neutral-800 sticky top-0 bg-neutral-50 dark:bg-neutral-900"},Br={class:"p-4"},qr={key:0,class:"flex justify-center py-4"},Fr={key:1,class:"text-red-600 dark:text-red-400 text-center py-4 text-sm"},zr={key:2,class:"space-y-3 text-sm"},Hr={class:"flex items-start gap-2"},Wr={class:"font-mono text-xs break-all"},Jr={class:"flex items-start gap-2"},Zr={class:"flex-1"},Kr={key:0,class:"flex items-center gap-2"},Gr={class:"text-xs text-neutral-500"},Xr={key:1,class:"space-y-2"},Yr={class:"flex gap-2"},Qr=["disabled"],ei=["disabled"],ti={class:"flex items-start gap-2"},oi={key:0,class:"flex items-start gap-2"},li={class:"font-mono text-xs"},ai={class:"flex items-start gap-2"},si={class:"flex-1 flex items-center gap-2 flex-wrap"},ni={key:1,class:"text-neutral-500 dark:text-neutral-500 italic text-xs"},ri={class:"flex items-start gap-2"},ii=["disabled"],di={key:1,class:"flex justify-center py-2"},ui={key:1,class:"p-3 rounded border border-neutral-200 dark:border-neutral-700 bg-neutral-100 dark:bg-neutral-800 space-y-2"},ci={class:"flex items-center gap-4 text-xs"},pi={class:"font-mono font-bold ml-1"},mi={class:"font-mono font-bold ml-1"},vi={key:0,class:"text-xs"},fi={class:"w-full"},hi={class:"py-1"},gi={class:"text-right py-1 font-mono"},bi={class:"text-right py-1 font-mono"},xi={class:"pt-2 border-t border-neutral-200 dark:border-neutral-800 flex justify-end"},yi=["disabled"],ki={key:0},wi={key:1},_i=se({__name:"MetadataSlidePane",props:{threadId:{},show:{type:Boolean}},emits:["close","threadDeleted","editThread"],setup(t,{emit:i}){const n=t,u=i,{thread:l,isFetching:c,error:r}=Ct(K(()=>n.threadId)),p=v(!1),f=v(!1),b=v(!1),s=v(!1),d=v(""),h=v(!1),$=v(!1),g=v(null),{data:m,isFetching:w}=Ee(ae("/api/agents"),{refetch:!0}).json(),k=K(()=>m.value?.agents?m.value.agents.filter(B=>B.type==="ai_human").map(B=>({value:B.id,label:B.title,description:`Type: ${B.type}`})):[]),O=K(()=>l.value?.agent.type==="ai_human"),D=B=>new Date(B*1e3).toLocaleString(),F=()=>{l.value&&(d.value=l.value.agent.id,b.value=!0)},X=()=>{b.value=!1,d.value=""},te=async()=>{if(!(!n.threadId||!d.value)){s.value=!0;try{const B=await fetch(ae(`/api/threads/${n.threadId}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent_id:d.value})});if(!B.ok){const N=await B.json();throw new Error(N.error||"Failed to update agent")}window.location.reload()}catch(B){console.error("Error updating agent:",B),alert(`Failed to update agent: ${B.message}`)}finally{s.value=!1}}},R=async()=>{if(n.threadId){$.value=!0,h.value=!0;try{const B=await fetch(ae(`/api/threads/${n.threadId}/cost`));if(!B.ok){const N=await B.json();throw new Error(N.error||"Failed to fetch cost breakdown")}g.value=await B.json()}catch(B){console.error("Error fetching cost breakdown:",B),alert(`Failed to fetch cost breakdown: ${B.message}`),h.value=!1}finally{$.value=!1}}},j=B=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(B),W=async()=>{if(n.threadId){f.value=!0;try{const B=await fetch(ae(`/api/threads/${n.threadId}`),{method:"DELETE"});if(!B.ok){const N=await B.json();throw new Error(N.error||"Failed to delete thread")}u("threadDeleted",n.threadId)}catch(B){console.error("Error deleting thread:",B),alert(`Failed to delete thread: ${B.message}`)}finally{f.value=!1}}};return ue(()=>n.show,B=>{B||(b.value=!1,d.value="")}),(B,N)=>(o(),ee(We,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"max-h-0 opacity-0","enter-to-class":"max-h-[400px] opacity-100","leave-active-class":"transition-all duration-200 ease-in","leave-from-class":"max-h-[400px] opacity-100","leave-to-class":"max-h-0 opacity-0"},{default:de(()=>[t.show&&t.threadId?(o(),a("div",Ur,[e("div",Rr,[e("div",Nr,[N[6]||(N[6]=e("span",{class:"text-sm font-medium text-neutral-600 dark:text-neutral-400"},"Thread Info",-1)),e("button",{onClick:N[0]||(N[0]=U=>u("close")),type:"button",class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors",title:"Close metadata"},[E(Z(xo),{size:16})])]),e("div",Br,[Z(c)?(o(),a("div",qr,[E(be)])):Z(r)?(o(),a("div",Fr," Error loading metadata: "+C(Z(r)),1)):Z(l)?(o(),a("div",zr,[e("div",Hr,[N[7]||(N[7]=e("span",{class:"font-medium text-neutral-600 dark:text-neutral-400 w-14 flex-shrink-0 text-left"},"ID",-1)),e("span",Wr,C(Z(l).id),1)]),e("div",Jr,[N[8]||(N[8]=e("span",{class:"font-medium text-neutral-600 dark:text-neutral-400 w-14 flex-shrink-0 text-left"},"Agent",-1)),e("div",Zr,[b.value?(o(),a("div",Xr,[E(he,{modelValue:d.value,"onUpdate:modelValue":N[1]||(N[1]=U=>d.value=U),options:k.value,loading:Z(w),placeholder:"Select an agent"},null,8,["modelValue","options","loading"]),e("div",Yr,[e("button",{onClick:te,disabled:s.value||!d.value,class:"px-2 py-1 text-xs bg-black dark:bg-white text-white dark:text-black hover:bg-black/80 dark:hover:bg-white/80 transition-colors disabled:opacity-50 disabled:cursor-not-allowed rounded"},C(s.value?"Saving...":"Save"),9,Qr),e("button",{onClick:X,disabled:s.value,class:"px-2 py-1 text-xs border border-black dark:border-neutral-300 hover:bg-black/5 dark:hover:bg-white/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed rounded"}," Cancel ",8,ei)])])):(o(),a("div",Kr,[e("span",null,C(Z(l).agent.title),1),e("span",Gr,"("+C(Z(l).agent.type)+")",1),O.value?(o(),a("button",{key:0,onClick:F,type:"button",class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors",title:"Change agent"},[E(Z(bt),{size:12})])):L("",!0)]))])]),e("div",ti,[N[9]||(N[9]=e("span",{class:"font-medium text-neutral-600 dark:text-neutral-400 w-14 flex-shrink-0 text-left"},"Created",-1)),e("span",null,C(D(Z(l).created_at)),1)]),Z(l).user_id?(o(),a("div",oi,[N[10]||(N[10]=e("span",{class:"font-medium text-neutral-600 dark:text-neutral-400 w-14 flex-shrink-0 text-left"},"User",-1)),e("span",li,C(Z(l).user_id),1)])):L("",!0),e("div",ai,[N[11]||(N[11]=e("span",{class:"font-medium text-neutral-600 dark:text-neutral-400 w-14 flex-shrink-0 text-left"},"Tags",-1)),e("div",si,[Z(l).tags?.length>0?(o(!0),a(pe,{key:0},fe(Z(l).tags,U=>(o(),a("span",{key:U,class:"inline-block px-2 py-0.5 text-xs rounded bg-black text-white dark:bg-white dark:text-black"},C(U),1))),128)):(o(),a("span",ni,"No tags")),e("button",{onClick:N[2]||(N[2]=U=>u("editThread")),type:"button",class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors",title:"Edit tags"},[E(Z(bt),{size:12})])])]),e("div",ri,[N[14]||(N[14]=e("span",{class:"font-medium text-neutral-600 dark:text-neutral-400 w-14 shrink-0 text-left"},"Cost",-1)),!h.value&&!$.value?(o(),a("button",{key:0,onClick:R,disabled:$.value,type:"button",class:"flex items-center gap-1 px-2 py-1 text-xs border border-black dark:border-white rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},[E(Z(Mt),{size:12}),N[12]||(N[12]=e("span",null,"View Costs",-1))],8,ii)):L("",!0),$.value?(o(),a("div",di,[E(be)])):L("",!0),h.value?(o(),a("button",{key:2,onClick:N[3]||(N[3]=U=>h.value=!1),type:"button",class:"flex items-center gap-1 px-2 py-1 text-xs border border-black dark:border-white rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors"},[E(Z(Mt),{size:12}),N[13]||(N[13]=e("span",null,"Hide Costs",-1))])):L("",!0)]),h.value&&g.value?(o(),a("div",ui,[e("div",ci,[e("div",null,[N[15]||(N[15]=e("span",{class:"text-neutral-500"},"Total:",-1)),e("span",pi,C(j(g.value.totalCost)),1)]),e("div",null,[N[16]||(N[16]=e("span",{class:"text-neutral-500"},"Avg/msg:",-1)),e("span",mi,C(j(g.value.avgCostPerMessage)),1)])]),g.value.modelBreakdown.length>0?(o(),a("div",vi,[e("table",fi,[N[17]||(N[17]=e("thead",null,[e("tr",{class:"border-b border-neutral-300 dark:border-neutral-600"},[e("th",{class:"text-left py-1 font-medium text-neutral-500"}," Model "),e("th",{class:"text-right py-1 font-medium text-neutral-500"}," Reqs "),e("th",{class:"text-right py-1 font-medium text-neutral-500"}," Cost ")])],-1)),e("tbody",null,[(o(!0),a(pe,null,fe(g.value.modelBreakdown,U=>(o(),a("tr",{key:U.modelName},[e("td",hi,C(U.modelName),1),e("td",gi,C(U.requestCount),1),e("td",bi,C(j(U.totalCost)),1)]))),128))])])])):L("",!0)])):L("",!0),e("div",xi,[e("button",{onClick:N[4]||(N[4]=U=>p.value=!0),disabled:f.value,class:"flex items-center gap-1 px-2 py-1 text-xs text-red-600 border border-red-600 rounded hover:bg-red-50 dark:hover:bg-red-950/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},[E(Z(yo),{size:12}),f.value?(o(),a("span",ki,"Deleting...")):(o(),a("span",wi,"Delete Thread"))],8,yi)])])):L("",!0)])]),E(eo,{modelValue:p.value,"onUpdate:modelValue":N[5]||(N[5]=U=>p.value=U),title:"Delete Thread?",message:"Are you sure you want to delete this thread? This will permanently delete all messages, logs, and associated data. This action cannot be undone.","confirm-text":"Delete Thread","cancel-text":"Cancel",onConfirm:W},null,8,["modelValue"])])):L("",!0)]),_:1}))}}),$i={class:"flex flex-col h-full"},Ci={class:"px-4 py-3 border-b border-neutral-300 dark:border-neutral-700"},Vi={class:"flex items-center justify-between"},Si={class:"flex items-center gap-2"},Ti={class:"flex items-center gap-2"},Mi={class:"flex-1 flex flex-col overflow-hidden relative"},Li={key:0,class:"text-neutral-500 dark:text-neutral-400 text-center py-8"},Ii={key:1,class:"flex justify-center py-2"},Ei={key:2,class:"flex justify-center py-8"},Ai={key:3,class:"text-red-600 dark:text-red-400 text-center py-8"},Pi={key:4,class:"text-neutral-500 dark:text-neutral-400 text-center py-8"},Oi={key:0,class:"p-3 bg-white dark:bg-neutral-900 border-t border-neutral-300 dark:border-neutral-700"},ji={class:"flex items-center justify-end gap-2"},Di=["disabled"],Ui={key:1,class:"p-3 bg-white dark:bg-neutral-900 border-t border-neutral-300 dark:border-neutral-700"},Ri={class:"flex items-start gap-2"},Ni={class:"flex-1 flex items-start gap-2 p-2 rounded-2xl border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-900"},Bi=["disabled"],qi=["disabled"],Fi={key:0,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",class:"w-4 h-4"},zi={key:1,class:"w-4 h-4"},Hi=se({__name:"MessagesPane",props:{threadId:{},selectedMessageId:{},selectedLogId:{},hoveredLogId:{}},emits:["collapse","messageClick","messageHover","threadDeleted","editThread","logsDeleted"],setup(t,{expose:i,emit:n}){const u=t,l=n,c=v(!1),r=()=>{c.value=!c.value},p=v(!1),f=v(new Set),b=v(new Map),s=()=>{p.value=!p.value,p.value||(f.value=new Set,b.value=new Map)},d=(z,H)=>{const G=new Set(f.value);H?G.add(z):G.delete(z),f.value=G},h=(z,H)=>{const G=new Map(b.value);G.set(z,H),b.value=G},$=()=>{p.value=!1,f.value=new Set,b.value=new Map},g=K(()=>f.value.size),m=K(()=>{let z=0;for(const[H]of b.value)f.value.has(H)||z++;return z}),w=K(()=>{const z=g.value,H=m.value;return z>0&&H>0?`Delete (${z}), Update (${H})`:z>0?`Delete (${z})`:H>0?`Save changes (${H})`:"Delete"}),k=K(()=>g.value>0||m.value>0),O=async()=>{if(!u.threadId||!k.value)return;const z=[];for(const H of f.value){const G=D.value.find(ce=>ce.id===H);G&&"log_id"in G&&G.log_id&&z.push(G.log_id)}try{for(const[H,G]of b.value)f.value.has(H)||await _(H,G);for(const H of f.value)await V(H);z.length>0&&l("logsDeleted",z)}catch(H){console.error("Error applying changes:",H)}finally{$()}},{messages:D,threadInfo:F,isFetching:X,isLoadingMore:te,error:R,wsConnected:j,wsError:W,isExecuting:B,hasMore:N,loadMoreMessages:U,addOptimisticMessage:y,removeOptimisticMessage:x,deleteMessageById:V,updateMessageContent:_,stopThread:T}=Gn(K(()=>u.threadId),{enableWebSocket:!0}),{thread:S}=Ct(K(()=>u.threadId)),P=v(null),J=v(null);i({scrollToLogId:z=>J.value&&P.value?J.value.scrollToLogId(z,P.value):!1,hasWorkblockForLogId:z=>J.value?J.value.hasWorkblockForLogId(z):!1}),typeof window<"u"&&(window.__testLoadMoreMessages=U);const I=v(""),M=v(null),oe=v("B"),Y=v(!1),ie=v(!1),ve=async()=>{await ge(),P.value&&(P.value.scrollTop=P.value.scrollHeight)},ke=async z=>{z.target.scrollTop<100&&N.value&&!te.value&&!ie.value&&(ie.value=!0,await U(),ie.value=!1)};ue(()=>D.value.length,async()=>{!te.value&&!ie.value&&await ve()}),ue(()=>u.threadId,async z=>{z&&await ve()}),ue(X,async(z,H)=>{H&&!z&&await ve()});const Ie=K(()=>{const z=F.value?.agent||S.value?.agent;if(!z)return"ai A";const H=z.type;return oe.value==="A"&&z.side_a_label?z.side_a_label:oe.value==="B"&&z.side_b_label?z.side_b_label:H==="ai_human"?oe.value==="A"?"ai":"human":oe.value==="A"?"ai A":"ai B"}),$e=()=>{oe.value=oe.value==="A"?"B":"A"},Me=async()=>{if(!I.value.trim()||!u.threadId||Y.value)return;const z=I.value,H=oe.value==="A"?"assistant":"user",G=`optimistic-${Date.now()}`,ce={id:G,role:H,content:z,created_at:Date.now()*1e3,isOptimistic:!0};y(ce),I.value="",M.value&&(M.value.style.height="auto",M.value.style.height="24px"),Y.value=!0;try{if(!(await fetch(ae(`/api/threads/${u.threadId}/message`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:z,role:H})})).ok)throw new Error("Failed to send message");await ve()}catch(me){console.error("Error sending message:",me),x(G)}finally{Y.value=!1,await ge(),M.value&&M.value.focus()}},Pe=z=>{z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),Me())},Le=async()=>{if(u.threadId)try{await T()}catch(z){console.error("Error stopping thread:",z)}};return(z,H)=>(o(),a("div",$i,[e("div",Ci,[e("div",Vi,[e("div",Si,[E(Z(Ft),{size:18,class:"shrink-0"}),H[8]||(H[8]=e("h2",{class:"text-base font-bold"},"Messages",-1)),t.threadId?(o(),ee(Vt,{key:0,connected:Z(j),error:Z(W)},null,8,["connected","error"])):L("",!0)]),e("div",Ti,[t.threadId?(o(),a("button",{key:0,onClick:r,type:"button",class:le(["p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",{"bg-neutral-200 dark:bg-neutral-800":c.value}]),title:"Toggle metadata"},[E(Z(ko),{size:20})],2)):L("",!0),t.threadId&&Z(D).length>0?(o(),a("button",{key:1,onClick:s,type:"button",class:le(["p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",{"bg-neutral-200 dark:bg-neutral-800":p.value}]),title:"Edit messages"},[E(Z(bt),{size:20})],2)):L("",!0),e("button",{onClick:H[0]||(H[0]=G=>l("collapse")),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Collapse pane"},[E(Z($t),{size:20})])])])]),e("div",Mi,[E(_i,{"thread-id":t.threadId,show:c.value,onClose:H[1]||(H[1]=G=>c.value=!1),onThreadDeleted:H[2]||(H[2]=G=>l("threadDeleted",G)),onEditThread:H[3]||(H[3]=G=>l("editThread"))},null,8,["thread-id","show"]),e("div",{ref_key:"messagesContainer",ref:P,class:"flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-4",onScroll:ke},[t.threadId?L("",!0):(o(),a("div",Li," Select a thread to view messages ")),Z(te)?(o(),a("div",Ii,[E(be,{size:"sm"}),H[9]||(H[9]=e("span",{class:"ml-2 text-xs text-neutral-500"},"Loading older messages...",-1))])):Z(X)?(o(),a("div",Ei,[E(be)])):Z(R)?(o(),a("div",Ai," Error loading messages: "+C(Z(R)),1)):t.threadId&&Z(D).length===0?(o(),a("div",Pi," No messages yet ")):(o(),ee(Dr,{key:5,ref_key:"agentMessagesRef",ref:J,messages:Z(D),selectedMessageId:t.selectedMessageId,selectedLogId:t.selectedLogId,hoveredLogId:t.hoveredLogId,isEditMode:p.value,selectedForDelete:f.value,editedMessages:b.value,onMessageClick:H[4]||(H[4]=(G,ce)=>l("messageClick",G,ce)),onMessageHover:H[5]||(H[5]=G=>l("messageHover",G)),onSelectionChange:d,onMessageEdit:h},null,8,["messages","selectedMessageId","selectedLogId","hoveredLogId","isEditMode","selectedForDelete","editedMessages"]))],544),t.threadId&&p.value?(o(),a("div",Oi,[e("div",ji,[e("button",{onClick:$,class:"px-4 py-2 rounded-lg font-medium text-sm transition-colors bg-neutral-200 text-black hover:bg-neutral-300 dark:bg-neutral-700 dark:text-white dark:hover:bg-neutral-600"}," Cancel "),e("button",{onClick:O,disabled:!k.value,class:le(["px-4 py-2 rounded-lg font-medium text-sm transition-colors",{"bg-red-600 text-white hover:bg-red-700":k.value&&g.value>0,"bg-black text-white hover:bg-neutral-800 dark:bg-white dark:text-black dark:hover:bg-neutral-200":k.value&&g.value===0,"bg-neutral-200 text-neutral-400 dark:bg-neutral-700 dark:text-neutral-500 cursor-not-allowed":!k.value}])},C(w.value),11,Di)])])):t.threadId?(o(),a("div",Ui,[e("div",Ri,[e("button",{onClick:$e,class:le(["flex-shrink-0 px-2 h-7 rounded-md flex items-center justify-center font-medium text-xs transition-colors mt-2.5",{"bg-black text-white dark:bg-white dark:text-black":oe.value==="A","bg-neutral-300 text-black dark:bg-neutral-600 dark:text-white":oe.value==="B"}]),title:"Toggle between sides"},C(Ie.value),3),e("div",Ni,[Se(e("textarea",{ref_key:"messageTextarea",ref:M,"onUpdate:modelValue":H[6]||(H[6]=G=>I.value=G),onKeydown:Pe,disabled:Y.value,placeholder:"Type a message...",rows:"1",class:"flex-1 bg-transparent text-black dark:text-white resize-none focus:outline-none disabled:opacity-50 mt-0.5",style:{"max-height":"120px","min-height":"24px"},onInput:H[7]||(H[7]=G=>{const ce=G.target;ce.style.height="auto",ce.style.height=Math.min(ce.scrollHeight,120)+"px"})},null,40,Bi),[[Oe,I.value]]),Z(B)?(o(),a("button",{key:1,id:"stop-thread-button",onClick:Le,class:"flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center transition-all bg-red-600 text-white dark:bg-red-500 hover:bg-red-700 dark:hover:bg-red-600",title:"Stop execution"},[...H[11]||(H[11]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",class:"w-4 h-4"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})],-1)])])):(o(),a("button",{key:0,id:"send-message-button",onClick:Me,disabled:!I.value.trim()||Y.value,class:le(["flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center transition-all",{"bg-black text-white dark:bg-white dark:text-black":I.value.trim()&&!Y.value,"bg-neutral-200 text-neutral-400 dark:bg-neutral-700 dark:text-neutral-600":!I.value.trim()||Y.value}]),title:"Send message (Enter)"},[Y.value?(o(),a("div",zi,[E(be)])):(o(),a("svg",Fi,[...H[10]||(H[10]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"},null,-1)])]))],10,qi))])])])):L("",!0)])]))}});function Wi(t,i){const{limit:n=100,offset:u=0,order:l="desc",autoFetch:c=!0,enableWebSocket:r=!1}=i||{};K(()=>!!(typeof t=="string"?t:t?.value));const p=K(()=>{const W=typeof t=="string"?t:t?.value;if(!W)return ae("/api/threads/placeholder/logs");const B=new URLSearchParams,N=typeof n=="number"?n:n.value,U=typeof u=="number"?u:u.value,y=typeof l=="string"?l:l.value;return B.append("limit",N.toString()),B.append("offset",U.toString()),B.append("order",y),ae(`/api/threads/${W}/logs?${B.toString()}`)}),{data:f,error:b,isFetching:s,isFinished:d,execute:h,abort:$}=Ee(p,{immediate:!1}).get().json();ue([p,()=>c],([W,B])=>{W&&!W.includes("placeholder")&&B&&h()},{immediate:!0});const g=K(()=>!b.value||b.value.toString().includes("aborted")||b.value.toString().includes("abort")?null:b.value),m=K(()=>f.value?.logs||[]),w=K(()=>f.value?.total||0),k=K(()=>f.value?.hasMore||!1),O=v(null),D=v(!1),F=v(null),X=v([]),te=()=>{const W=typeof t=="string"?t:t?.value;if(!W||!r)return;O.value&&O.value.close(),X.value=[];const B=window.location.protocol==="https:"?"wss:":"ws:",N=window.location.host;let U=`${B}//${N}${ae(`/api/threads/${W}/logs`)}`;const y=localStorage.getItem("auth_token");y&&(U+=`?token=${encodeURIComponent(y)}`);try{O.value=new WebSocket(U),O.value.onopen=()=>{D.value=!0,F.value=null,console.log("WebSocket connected for logs")},O.value.onmessage=x=>{try{const V=JSON.parse(x.data);if(V.type==="log_data"){const _=X.value.findIndex(S=>S.id===V.log_id),T=m.value.find(S=>S.id===V.log_id);_>=0?(X.value[_]={...X.value[_],...V.data},console.log("[WebSocket] Updated existing realtime log:",V.log_id)):T?(X.value.push({...T,...V.data}),console.log("[WebSocket] Updated HTTP log:",V.log_id)):(X.value.push({id:V.log_id,...V.data}),console.log("[WebSocket] Added new log:",V.log_id))}}catch(V){console.error("Failed to parse WebSocket message:",V)}},O.value.onerror=x=>{F.value="WebSocket connection error",D.value=!1,console.error("WebSocket error:",x)},O.value.onclose=()=>{D.value=!1,console.log("WebSocket disconnected")}}catch(x){F.value=x.message||"Failed to create WebSocket",console.error("WebSocket creation error:",x)}},R=()=>{O.value&&(O.value.close(),O.value=null,D.value=!1),X.value=[]};return Be(()=>{R()}),{logs:K(()=>{if(!r)return m.value;const W=new Map;m.value.forEach(U=>W.set(U.id,U)),X.value.forEach(U=>W.set(U.id,U));const B=typeof l=="string"?l:l.value;return Array.from(W.values()).sort((U,y)=>B==="desc"?y.created_at-U.created_at:U.created_at-y.created_at)}),total:w,hasMore:k,error:g,isFetching:s,isFinished:d,refetch:h,abort:$,wsConnected:D,wsError:F,connectWebSocket:te,disconnectWebSocket:R}}function Ji(t,i){const n=K(()=>{const p=t.value,f=i.value;return!p||!f?null:ae(`/api/threads/${p}/logs/${f}`)}),{data:u,error:l,isFetching:c,execute:r}=Ee(n,{immediate:!1}).get().json();return ue([t,i],([p,f])=>{p&&f&&r()},{immediate:!0}),{logDetails:u,error:l,isFetching:c,refetch:r}}const Zi=["disabled","title"],Ki={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Gi={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Xi={key:3},ft=se({__name:"CopyButton",props:{content:{},variant:{},size:{},disabled:{type:Boolean}},setup(t){const i=t,n=v(!1),u=v(!1),l=async()=>{n.value=!0;try{await navigator.clipboard.writeText(i.content),u.value=!0,setTimeout(()=>{u.value=!1},2e3)}catch(p){console.error("Failed to copy:",p),alert(`Failed to copy: ${p instanceof Error?p.message:"Unknown error"}`)}finally{n.value=!1}},c={xs:"p-1 text-xs",sm:"px-2 py-1 text-xs"},r={solid:"bg-black text-white dark:bg-white dark:text-black",ghost:"bg-white dark:bg-neutral-950 border border-neutral-300 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-900"};return(p,f)=>(o(),a("button",{onClick:l,disabled:n.value||t.disabled,class:le([c[t.size||"sm"],r[t.variant||"solid"],"font-medium rounded hover:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed transition-all"]),title:t.disabled?"No content to copy":u.value?"Copied!":"Copy to clipboard"},[n.value?(o(),ee(be,{key:0,size:"xs"})):t.variant==="ghost"&&!u.value?(o(),a("svg",Ki,[...f[0]||(f[0]=[e("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),e("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},null,-1)])])):t.variant==="ghost"&&u.value?(o(),a("svg",Gi,[...f[1]||(f[1]=[e("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(o(),a("span",Xi,C(u.value?"Copied!":"Copy"),1))],10,Zi))}}),ht="__shiki_highlighter__";let nt=null;async function Yi(){return typeof window<"u"&&window[ht]?window[ht]:nt||(nt=Io({themes:["min-light","github-dark-high-contrast"],langs:["json","markdown"]}).then(t=>(typeof window<"u"&&(window[ht]=t),t)),nt)}const Qi={class:"code-block"},ed={key:0,class:"text-xs text-neutral-500 p-2"},td=["innerHTML"],Xe=se({__name:"CodeBlock",props:{code:{},language:{}},setup(t){const i=t,n=v(""),u=v(!0),l=async()=>{const c=i.code??"";if(!c){n.value='<pre class="shiki"><code></code></pre>',u.value=!1;return}try{const r=await Yi();if(i.language==="json"||i.language==="markdown")n.value=r.codeToHtml(c,{lang:i.language,themes:{light:"min-light",dark:"github-dark-high-contrast"}});else{const p=c.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");n.value=`<pre class="shiki shiki-text"><code>${p}</code></pre>`}}catch{const p=c.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");n.value=`<pre class="shiki"><code>${p}</code></pre>`}finally{u.value=!1}};return xe(()=>{l()}),ue(()=>i.code,()=>{l()}),(c,r)=>(o(),a("div",Qi,[u.value?(o(),a("div",ed,"Loading...")):(o(),a("div",{key:1,innerHTML:n.value,class:"code-content"},null,8,td))]))}}),od={class:"text-xs font-semibold"},ld={class:"flex items-center gap-2"},ad={class:"text-neutral-500 text-xs"},rt=se({__name:"CollapsibleSection",props:{title:{},sectionId:{},expanded:{type:Boolean},scrollContainer:{}},emits:["toggle"],setup(t,{expose:i,emit:n}){const u=t,l=n,c=v(null),r=v(!1),p=()=>{ge(()=>{if(!c.value||!u.scrollContainer){r.value=!1;return}const s=u.scrollContainer.clientHeight;r.value=c.value.scrollHeight>s*2})};ue(()=>u.expanded,s=>{s?p():r.value=!1});const f=()=>{if(c.value&&u.scrollContainer){const h=c.value.offsetTop-88;u.scrollContainer.scrollTo({top:Math.max(0,h),behavior:"smooth"})}},b=()=>{if(c.value&&u.scrollContainer){const s=c.value.offsetTop+c.value.offsetHeight,d=u.scrollContainer.clientHeight,h=s-d+10;u.scrollContainer.scrollTo({top:Math.max(0,h),behavior:"smooth"})}};return i({checkHeight:p,contentRef:c}),(s,d)=>(o(),a("div",null,[e("div",{class:"sticky top-[27px] z-5 w-full px-3 py-2 bg-neutral-50 dark:bg-neutral-950 flex items-center justify-between border border-neutral-300 dark:border-neutral-700 rounded cursor-pointer hover:bg-neutral-100 dark:hover:bg-neutral-950 transition-colors",onClick:d[0]||(d[0]=h=>l("toggle"))},[e("span",od,C(t.title),1),e("div",ld,[r.value&&t.expanded?(o(),a(pe,{key:0},[e("button",{onClick:we(f,["stop"]),class:"text-[10px] text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300"},"↑ Top"),e("button",{onClick:we(b,["stop"]),class:"text-[10px] text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300"},"↓ Bottom")],64)):L("",!0),e("span",ad,C(t.expanded?"▼":"▶"),1)])]),Se(e("div",{ref_key:"contentRef",ref:c,class:"border-x border-b border-neutral-300 dark:border-neutral-700 rounded-b"},[He(s.$slots,"default")],512),[[Ye,t.expanded]])]))}}),sd={class:"flex items-center justify-between mb-3"},nd={class:"flex items-center gap-2"},rd={class:"flex items-center gap-1"},id=["disabled"],dd=["disabled"],ud={class:"text-lg font-bold"},cd={class:"flex items-center gap-2"},pd=["disabled","title"],md={key:1},vd={class:"@container border-b border-neutral-300 dark:border-neutral-700 pb-3"},fd={class:"hidden @[600px]:block"},hd={class:"w-full text-xs"},gd={class:"py-1 font-mono"},bd={class:"py-1 font-mono"},xd={key:1},yd={class:"py-1 font-mono"},kd={key:1},wd={class:"py-1 font-mono"},_d={key:1},$d={class:"py-1 font-mono"},Cd={key:1},Vd={class:"py-1 font-mono text-xs"},Sd={class:"@[600px]:hidden space-y-2"},Td={class:"w-full text-xs"},Md={class:"py-1 font-mono"},Ld={class:"py-1 font-mono"},Id={key:1},Ed={class:"w-full text-xs"},Ad={class:"py-1 font-mono"},Pd={key:1},Od={class:"py-1 font-mono"},jd={key:1},Dd={class:"py-1 font-mono"},Ud={key:1},Rd={class:"py-1 font-mono text-xs"},Nd={class:"sticky -top-4 z-10 bg-white dark:bg-neutral-900 border-b border-neutral-300 dark:border-neutral-700 mb-3 pt-3 -mx-4 px-4"},Bd={class:"flex gap-4"},qd={key:0,class:"text-red-600 dark:text-red-400"},Fd={class:"space-y-3"},zd={class:"space-y-2"},Hd=["onClick"],Wd={class:"font-mono"},Jd={class:"text-neutral-500"},Zd={class:"px-2 py-2 bg-white dark:bg-neutral-950 border-t border-neutral-200 dark:border-neutral-800"},Kd={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mb-2"},Gd={class:"relative bg-white dark:bg-neutral-900"},Xd={class:"absolute top-[5px] right-[5px]"},Yd={class:"relative bg-white dark:bg-neutral-900"},Qd={class:"absolute top-[5px] right-[5px]"},eu={class:"relative bg-white dark:bg-neutral-900"},tu={class:"absolute top-[5px] right-[5px]"},ou={key:0,class:"mb-4"},lu={class:"text-xs font-semibold text-red-600 dark:text-red-400 mb-1"},au={class:"space-y-2"},su={class:"px-2 py-1 bg-red-100 dark:bg-red-900/30 text-xs font-medium text-red-800 dark:text-red-200"},nu={class:"text-xs bg-red-50 dark:bg-red-950 p-2 overflow-x-auto text-red-900 dark:text-red-100"},ru={key:1,class:"mb-4"},iu={class:"text-xs font-semibold text-red-600 dark:text-red-400 mb-1"},du={class:"text-xs bg-red-50 dark:bg-red-950 p-2 rounded overflow-x-auto text-red-900 dark:text-red-100 border border-red-300 dark:border-red-700"},uu={key:2,class:"mb-4"},cu={class:"w-full text-xs border border-neutral-300 dark:border-neutral-700 rounded"},pu={class:"border-b border-neutral-200 dark:border-neutral-800"},mu={class:"py-1 px-2 font-mono"},vu={key:1},fu={class:"border-b border-neutral-200 dark:border-neutral-800"},hu={class:"py-1 px-2 font-mono"},gu={key:1},bu={key:0,class:"border-b border-neutral-200 dark:border-neutral-800"},xu={class:"py-1 px-2 font-mono"},yu={key:1},ku={class:"border-b border-neutral-200 dark:border-neutral-800"},wu={class:"py-1 px-2 font-mono"},_u={key:1},$u={key:1,class:"border-b border-neutral-200 dark:border-neutral-800"},Cu={class:"py-1 px-2 font-mono text-accent-600 dark:text-accent-400"},Vu={class:"border-b border-neutral-200 dark:border-neutral-800"},Su={class:"py-1 px-2 font-mono font-semibold"},Tu={key:1},Mu={class:"py-1 px-2 font-mono font-semibold"},Lu={key:1},Iu={key:3,class:"mb-4"},Eu={class:"text-xs font-semibold mb-1"},Au={class:"border border-neutral-300 dark:border-neutral-700 rounded overflow-hidden"},Pu=["onClick"],Ou={class:"font-mono"},ju={class:"text-neutral-500"},Du={class:"px-2 py-2 bg-white dark:bg-neutral-950 border-t border-neutral-200 dark:border-neutral-800"},Uu={class:"text-xs mb-2"},Ru={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-neutral-200 dark:border-neutral-800"},Nu={class:"text-xs mb-2"},Bu={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-neutral-200 dark:border-neutral-800"},qu={class:"text-xs mb-2"},Fu={class:"rounded overflow-hidden border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-black"},zu={key:0,class:"text-xs"},Hu={class:"text-xs overflow-x-auto bg-green-50 dark:bg-green-950/20 p-2 rounded border border-green-300 dark:border-green-700 whitespace-pre-wrap"},Wu={key:1,class:"text-xs"},Ju={key:4,class:"mb-4"},Zu={class:"border border-accent-300 dark:border-accent-700 rounded overflow-hidden bg-accent-50 dark:bg-accent-950/20"},Ku={class:"text-xs p-2 overflow-x-auto whitespace-pre-wrap max-h-96 text-accent-900 dark:text-accent-100"},Gu={key:5,class:"mb-4"},Xu={class:"text-xs font-semibold mb-1"},Yu={class:"border border-purple-300 dark:border-purple-700 rounded overflow-hidden bg-purple-50 dark:bg-purple-950/20"},Qu={class:"divide-y divide-purple-200 dark:divide-purple-800"},ec={class:"flex items-center gap-2 mb-1"},tc={class:"text-xs font-semibold text-purple-700 dark:text-purple-300"},oc={key:0,class:"text-xs font-mono text-purple-600 dark:text-purple-400"},lc={key:1,class:"text-xs text-purple-500 dark:text-purple-500"},ac={key:2,class:"text-xs text-purple-500 dark:text-purple-500"},sc={key:0,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},nc={class:"text-purple-900 dark:text-purple-100 whitespace-pre-wrap"},rc={key:1,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},ic={class:"font-mono text-purple-700 dark:text-purple-300 break-all"},dc={key:2,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},uc={class:"text-purple-900 dark:text-purple-100 whitespace-pre-wrap"},cc={key:0,class:"mt-2 pt-2 border-t border-purple-200 dark:border-purple-800"},pc={class:"font-mono text-purple-700 dark:text-purple-300 text-xs break-all"},mc={key:3,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},vc={class:"text-purple-900 dark:text-purple-100 overflow-x-auto"},fc={key:6,class:"mb-4"},hc={class:"bg-white dark:bg-neutral-900 rounded overflow-hidden border border-neutral-300 dark:border-neutral-700"},gc=se({__name:"LogDetails",props:{log:{},hasPrevious:{type:Boolean},hasNext:{type:Boolean}},emits:["close","previous","next"],setup(t,{emit:i}){const n=t,u=i,l=v("request"),c=v(new Set),r=v(new Set),p=v(!1),f=v(!1),b=v(null),s=v(null),d=v(null),h=v(null),$=v(null),g=v(null),m=v(new Set(["system_prompt","request_body","tools"])),w=U=>{if(!U)return"N/A";try{return JSON.stringify(JSON.parse(U),null,2)}catch{return U}},k=K(()=>{if(!n.log.tools_schema)return[];try{const U=JSON.parse(n.log.tools_schema);return Array.isArray(U)?U:[]}catch{return[]}}),O=K(()=>{if(!n.log.response_body)return[];try{const y=JSON.parse(n.log.response_body)?.choices?.[0]?.message?.tool_calls;return Array.isArray(y)?y:[]}catch{return[]}}),D=K(()=>{if(!n.log.tool_results)return new Map;try{const U=JSON.parse(n.log.tool_results),y=new Map;return Array.isArray(U)&&U.forEach(x=>{x.tool_call_id&&y.set(x.tool_call_id,{content:x.content,status:x.status,tool_name:x.tool_name,timestamp:x.timestamp})}),y}catch{return new Map}}),F=K(()=>{if(!n.log.response_body)return[];try{const y=JSON.parse(n.log.response_body)?.choices?.[0]?.message?.reasoning_details;return Array.isArray(y)?y:[]}catch{return[]}}),X=U=>{c.value.has(U)?c.value.delete(U):c.value.add(U)},te=U=>{r.value.has(U)?r.value.delete(U):r.value.add(U)},R=U=>{m.value.has(U)?m.value.delete(U):m.value.add(U)},j=U=>!m.value.has(U),W=K(()=>{if(!n.log.errors)return[];try{const U=JSON.parse(n.log.errors);return Array.isArray(U)?U:[]}catch{return[]}}),B=()=>{ge(()=>{b.value&&(b.value.scrollTop=b.value.scrollHeight)})};ue(()=>n.log.message_history,()=>{B()},{immediate:!0}),ue(()=>n.log,()=>{ge(()=>{d.value?.checkHeight(),h.value?.checkHeight(),$.value?.checkHeight(),g.value?.checkHeight()})});const N=async()=>{p.value=!0;try{if(!n.log.request_body||!n.log.model)throw new Error("Missing request data");const U=await fetch(ae(`/api/models/${n.log.model}/curl-data`));if(!U.ok)throw new Error("Failed to fetch model data");const y=await U.json(),x=w(n.log.request_body);let V=`curl -X POST '${y.endpoint}' \\
|
|
3
|
-
`;
|
|
4
|
-
`,
|
|
5
|
-
`,
|
|
6
|
-
`,
|
|
7
|
-
`):
|
|
8
|
-
`),V+=` -d '${x.replace(/'/g,"'\\''")}'`,await navigator.clipboard.writeText(V),f.value=!0,setTimeout(()=>{f.value=!1},2e3)}catch(U){console.error("Failed to copy cURL command:",U),alert(`Failed to copy cURL: ${U instanceof Error?U.message:"Unknown error"}`)}finally{p.value=!1}};return(U,y)=>(o(),a("div",{ref_key:"scrollContainer",ref:s,class:"p-4 h-full overflow-y-auto"},[e("div",sd,[e("div",nd,[e("div",rd,[e("button",{onClick:y[0]||(y[0]=x=>u("previous")),disabled:!t.hasPrevious,class:"w-7 h-7 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent dark:disabled:hover:bg-transparent transition-all","aria-label":"Previous log",title:"Previous log"},[...y[9]||(y[9]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("polyline",{points:"15 18 9 12 15 6"})],-1)])],8,id),e("button",{onClick:y[1]||(y[1]=x=>u("next")),disabled:!t.hasNext,class:"w-7 h-7 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent dark:disabled:hover:bg-transparent transition-all","aria-label":"Next log",title:"Next log"},[...y[10]||(y[10]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("polyline",{points:"9 18 15 12 9 6"})],-1)])],8,dd)]),e("h3",ud,C(t.log.prompt_name||t.log.model_name||t.log.model),1)]),e("div",cd,[e("button",{onClick:N,disabled:p.value||!t.log.request_body,class:"px-3 py-1 text-xs font-medium bg-black text-white dark:bg-white dark:text-black rounded hover:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed transition-opacity",title:t.log.request_body?"Copy cURL command":"No request data available"},[p.value?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",md,C(f.value?"Copied!":"Copy cURL"),1))],8,pd),e("button",{onClick:y[2]||(y[2]=x=>u("close")),class:"w-7 h-7 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 transition-all","aria-label":"Close details",title:"Close"},[...y[11]||(y[11]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])]),e("div",vd,[e("div",fd,[e("table",hd,[y[12]||(y[12]=e("thead",null,[e("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Status "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Provider "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Prompt "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Latency "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Tokens "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Cost "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Created ")])],-1)),e("tbody",null,[e("tr",null,[e("td",{class:le(["py-1 font-mono",t.log.error?"text-red-600 dark:text-red-400":t.log.is_complete?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"])},C(t.log.error?"ERROR":t.log.is_complete?"SUCCESS":"LOADING"),3),e("td",gd,C(t.log.provider),1),e("td",bd,[!t.log.is_complete&&!t.log.prompt_name?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",xd,C(t.log.prompt_name||"—"),1))]),e("td",yd,[!t.log.is_complete&&!t.log.latency_ms?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",kd,C(t.log.latency_ms?`${t.log.latency_ms}ms`:"—"),1))]),e("td",wd,[!t.log.is_complete&&!t.log.total_tokens?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",_d,C(t.log.total_tokens?`${t.log.input_tokens}/${t.log.output_tokens} (${t.log.total_tokens})`:"—"),1))]),e("td",$d,[!t.log.is_complete&&!t.log.cost_total?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",Cd,C(t.log.cost_total?`$${t.log.cost_total.toFixed(6)}`:"—"),1))]),e("td",Vd,[E(dt,{timestamp:t.log.created_at},null,8,["timestamp"])])])])])]),e("div",Sd,[e("table",Td,[y[13]||(y[13]=e("thead",null,[e("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Status "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Provider "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Prompt ")])],-1)),e("tbody",null,[e("tr",null,[e("td",{class:le(["py-1 font-mono",t.log.error?"text-red-600 dark:text-red-400":t.log.is_complete?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"])},C(t.log.error?"ERROR":t.log.is_complete?"SUCCESS":"LOADING"),3),e("td",Md,C(t.log.provider),1),e("td",Ld,[!t.log.is_complete&&!t.log.prompt_name?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",Id,C(t.log.prompt_name||"—"),1))])])])]),e("table",Ed,[y[14]||(y[14]=e("thead",null,[e("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Latency "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Tokens "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Cost "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Created ")])],-1)),e("tbody",null,[e("tr",null,[e("td",Ad,[!t.log.is_complete&&!t.log.latency_ms?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",Pd,C(t.log.latency_ms?`${t.log.latency_ms}ms`:"—"),1))]),e("td",Od,[!t.log.is_complete&&!t.log.total_tokens?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",jd,C(t.log.total_tokens?`${t.log.input_tokens}/${t.log.output_tokens} (${t.log.total_tokens})`:"—"),1))]),e("td",Dd,[!t.log.is_complete&&!t.log.cost_total?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",Ud,C(t.log.cost_total?`$${t.log.cost_total.toFixed(6)}`:"—"),1))]),e("td",Rd,[E(dt,{timestamp:t.log.created_at},null,8,["timestamp"])])])])])])]),e("div",Nd,[e("div",Bd,[e("button",{onClick:y[3]||(y[3]=x=>l.value="request"),class:le(["pb-2 px-1 text-sm font-medium border-b-2 transition-colors",l.value==="request"?"border-black dark:border-white text-black dark:text-white":"border-transparent text-neutral-500 dark:text-neutral-400 hover:text-black dark:hover:text-white"])}," Request ",2),e("button",{onClick:y[4]||(y[4]=x=>l.value="response"),class:le(["pb-2 px-1 text-sm font-medium border-b-2 transition-colors flex items-center gap-1",l.value==="response"?"border-black dark:border-white text-black dark:text-white":"border-transparent text-neutral-500 dark:text-neutral-400 hover:text-black dark:hover:text-white"])},[y[15]||(y[15]=ye(" Response ",-1)),t.log.error||W.value.length>0?(o(),a("span",qd,"⚠")):L("",!0)],2)])]),e("div",Fd,[Se(e("div",zd,[k.value.length>0?(o(),ee(rt,{key:0,ref_key:"toolsSectionRef",ref:d,title:`Available Tools (${k.value.length})`,"section-id":"tools",expanded:j("tools"),"scroll-container":s.value,onToggle:y[5]||(y[5]=x=>R("tools"))},{default:de(()=>[(o(!0),a(pe,null,fe(k.value,(x,V)=>(o(),a("div",{key:V,class:"border-b border-neutral-200 dark:border-neutral-800 last:border-b-0"},[e("button",{onClick:_=>X(V),class:"w-full px-2 py-1.5 text-left hover:bg-neutral-50 dark:hover:bg-neutral-900 transition-colors flex items-center justify-between text-xs"},[e("span",Wd,C(x.function?.name||x.name||"Unknown"),1),e("span",Jd,C(c.value.has(V)?"▼":"▶"),1)],8,Hd),Se(e("div",Zd,[x.function?.description||x.description?(o(),a("div",Kd,C(x.function?.description||x.description),1)):L("",!0),E(Xe,{code:JSON.stringify(x,null,2),language:"json"},null,8,["code"])],512),[[Ye,c.value.has(V)]])]))),128))]),_:1},8,["title","expanded","scroll-container"])):L("",!0),t.log.message_history?(o(),ee(rt,{key:1,ref_key:"messagesSectionRef",ref:h,title:`Messages (${t.log.message_history_length||0} messages)`,"section-id":"messages",expanded:j("messages"),"scroll-container":s.value,onToggle:y[6]||(y[6]=x=>R("messages"))},{default:de(()=>[e("div",Gd,[E(Xe,{code:w(t.log.message_history),language:"json"},null,8,["code"]),e("div",Xd,[E(ft,{content:w(t.log.message_history),variant:"ghost",size:"xs"},null,8,["content"])])])]),_:1},8,["title","expanded","scroll-container"])):L("",!0),t.log.system_prompt?(o(),ee(rt,{key:2,ref_key:"systemPromptSectionRef",ref:$,title:"System Prompt","section-id":"system_prompt",expanded:j("system_prompt"),"scroll-container":s.value,onToggle:y[7]||(y[7]=x=>R("system_prompt"))},{default:de(()=>[e("div",Yd,[E(Xe,{code:t.log.system_prompt,language:"markdown"},null,8,["code"]),e("div",Qd,[E(ft,{content:t.log.system_prompt,variant:"ghost",size:"xs"},null,8,["content"])])])]),_:1},8,["expanded","scroll-container"])):L("",!0),t.log.request_body?(o(),ee(rt,{key:3,ref_key:"requestBodySectionRef",ref:g,title:"Full Request Body","section-id":"request_body",expanded:j("request_body"),"scroll-container":s.value,onToggle:y[8]||(y[8]=x=>R("request_body"))},{default:de(()=>[e("div",eu,[E(Xe,{code:w(t.log.request_body),language:"json"},null,8,["code"]),e("div",tu,[E(ft,{content:w(t.log.request_body),variant:"ghost",size:"xs"},null,8,["content"])])])]),_:1},8,["expanded","scroll-container"])):L("",!0)],512),[[Ye,l.value==="request"]]),Se(e("div",null,[W.value.length>0?(o(),a("div",ou,[e("div",lu,C(W.value.length>1?`Errors (${W.value.length})`:"Error"),1),e("div",au,[(o(!0),a(pe,null,fe(W.value,(x,V)=>(o(),a("div",{key:V,class:"border border-red-300 dark:border-red-700 rounded overflow-hidden"},[e("div",su,C(x.type||"error"),1),e("pre",nu,C(x.message),1)]))),128))])])):t.log.error?(o(),a("div",ru,[e("div",iu," Error "+C(t.log.error_type?`(${t.log.error_type})`:""),1),e("pre",du,C(t.log.error),1)])):L("",!0),t.log.is_complete||!t.log.error?(o(),a("div",uu,[y[23]||(y[23]=e("div",{class:"text-xs font-semibold mb-1"},"Response Stats",-1)),e("table",cu,[e("tbody",null,[e("tr",pu,[y[16]||(y[16]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Finish Reason ",-1)),e("td",mu,[!t.log.is_complete&&!t.log.finish_reason?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",vu,C(t.log.finish_reason||"—"),1))])]),e("tr",fu,[y[17]||(y[17]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Input Tokens ",-1)),e("td",hu,[!t.log.is_complete&&!t.log.input_tokens?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",gu,C(t.log.input_tokens||"—"),1))])]),t.log.cached_tokens||!t.log.is_complete?(o(),a("tr",bu,[y[18]||(y[18]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Cached Tokens ",-1)),e("td",xu,[!t.log.is_complete&&!t.log.cached_tokens?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",yu,C(t.log.cached_tokens||0),1))])])):L("",!0),e("tr",ku,[y[19]||(y[19]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Output Tokens ",-1)),e("td",wu,[!t.log.is_complete&&!t.log.output_tokens?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",_u,C(t.log.output_tokens||"—"),1))])]),t.log.reasoning_tokens&&t.log.reasoning_tokens>0?(o(),a("tr",$u,[y[20]||(y[20]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Reasoning Tokens ",-1)),e("td",Cu,C(t.log.reasoning_tokens),1)])):L("",!0),e("tr",Vu,[y[21]||(y[21]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Total Tokens ",-1)),e("td",Su,[!t.log.is_complete&&!t.log.total_tokens?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",Tu,C(t.log.total_tokens||"—"),1))])]),e("tr",null,[y[22]||(y[22]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Total Cost ",-1)),e("td",Mu,[!t.log.is_complete&&!t.log.cost_total?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",Lu,C(t.log.cost_total?`$${t.log.cost_total.toFixed(6)}`:"—"),1))])])])])])):L("",!0),O.value.length>0?(o(),a("div",Iu,[e("div",Eu," Tools Called ("+C(O.value.length)+") ",1),e("div",Au,[(o(!0),a(pe,null,fe(O.value,(x,V)=>(o(),a("div",{key:V,class:"border-b border-neutral-200 dark:border-neutral-800 last:border-b-0"},[e("button",{onClick:_=>te(V),class:"w-full px-2 py-1.5 text-left hover:bg-neutral-50 dark:hover:bg-neutral-900 transition-colors flex items-center justify-between text-xs"},[e("span",Ou,C(x.function?.name||"Unknown"),1),e("span",ju,C(r.value.has(V)?"▼":"▶"),1)],8,Pu),Se(e("div",Du,[e("div",Uu,[y[24]||(y[24]=e("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Tool Call ID ",-1)),e("div",Ru,C(x.id),1)]),e("div",Nu,[y[25]||(y[25]=e("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Function Name ",-1)),e("div",Bu,C(x.function?.name),1)]),e("div",qu,[y[26]||(y[26]=e("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Arguments ",-1)),e("div",Fu,[E(Xe,{code:w(x.function?.arguments||"{}"),language:"json"},null,8,["code"])])]),D.value.has(x.id)?(o(),a("div",zu,[y[27]||(y[27]=e("div",{class:"font-semibold text-green-600 dark:text-green-400 mb-1"}," Result ",-1)),e("pre",Hu,C(D.value.get(x.id)?.content||"No content"),1)])):(o(),a("div",Wu,[...y[28]||(y[28]=[e("div",{class:"font-semibold text-neutral-500 dark:text-neutral-500 mb-1"}," Result ",-1),e("div",{class:"text-xs text-neutral-500 dark:text-neutral-500 italic"}," No result available ",-1)])]))],512),[[Ye,r.value.has(V)]])]))),128))])])):L("",!0),t.log.reasoning_content?(o(),a("div",Ju,[y[30]||(y[30]=e("div",{class:"text-xs font-semibold mb-1"},"Reasoning Content",-1)),e("div",Zu,[y[29]||(y[29]=e("div",{class:"px-2 py-1.5 bg-accent-100 dark:bg-accent-900/30 text-xs text-accent-800 dark:text-accent-200 border-b border-accent-300 dark:border-accent-700"}," Internal reasoning output (not displayed to users) ",-1)),e("pre",Ku,C(t.log.reasoning_content),1)])])):L("",!0),F.value.length>0?(o(),a("div",Gu,[e("div",Xu," Reasoning Details ("+C(F.value.length)+" blocks) ",1),e("div",Yu,[y[35]||(y[35]=e("div",{class:"px-2 py-1.5 bg-purple-100 dark:bg-purple-900/30 text-xs text-purple-800 dark:text-purple-200 border-b border-purple-300 dark:border-purple-700"}," Structured reasoning blocks from OpenRouter (preserved for multi-turn continuity) ",-1)),e("div",Qu,[(o(!0),a(pe,null,fe(F.value,(x,V)=>(o(),a("div",{key:V,class:"p-2"},[e("div",ec,[e("span",tc,C(x.type||"unknown"),1),x.id?(o(),a("span",oc," ID: "+C(x.id),1)):L("",!0),x.format?(o(),a("span",lc," Format: "+C(x.format),1)):L("",!0),x.index!==void 0?(o(),a("span",ac," Index: "+C(x.index),1)):L("",!0)]),x.type==="reasoning.summary"&&x.summary?(o(),a("div",sc,[y[31]||(y[31]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Summary: ",-1)),e("div",nc,C(x.summary),1)])):L("",!0),x.type==="reasoning.encrypted"&&x.data?(o(),a("div",rc,[y[32]||(y[32]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Encrypted Data: ",-1)),e("div",ic,C(x.data),1)])):L("",!0),x.type==="reasoning.text"&&x.text?(o(),a("div",dc,[y[34]||(y[34]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Reasoning Text: ",-1)),e("div",uc,C(x.text),1),x.signature?(o(),a("div",cc,[y[33]||(y[33]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Signature: ",-1)),e("div",pc,C(x.signature),1)])):L("",!0)])):L("",!0),["reasoning.summary","reasoning.encrypted","reasoning.text"].includes(x.type)?L("",!0):(o(),a("div",mc,[e("pre",vc,C(JSON.stringify(x,null,2)),1)]))]))),128))])])])):L("",!0),t.log.response_body?(o(),a("div",fc,[y[36]||(y[36]=e("div",{class:"text-xs font-semibold mb-1"},"Full Response Body",-1)),e("div",hc,[E(Xe,{code:w(t.log.response_body),language:"json"},null,8,["code"])])])):L("",!0)],512),[[Ye,l.value==="response"]])])],512))}}),bc={class:"flex flex-col h-full"},xc={class:"px-4 py-3 border-b border-neutral-300 dark:border-neutral-700"},yc={class:"flex items-center justify-between"},kc={class:"flex items-center gap-2"},wc={class:"flex items-center gap-2"},_c={key:0,class:"text-neutral-500 dark:text-neutral-400 text-center py-12"},$c={key:1,class:"flex justify-center py-12"},Cc={key:2,class:"text-red-600 dark:text-red-400 text-center py-12"},Vc={key:3,class:"text-neutral-500 dark:text-neutral-400 text-center py-12"},Sc={key:4},Tc={key:0,class:"border-b border-neutral-300 dark:border-neutral-700 bg-white dark:bg-black sticky top-0 z-10"},Mc=["disabled"],Lc={key:1},Ic={key:2},Ec={key:3},Ac={class:"w-full text-sm"},Pc=["onClick","onMouseenter"],Oc={class:"px-3 py-2 text-xs"},jc={class:"flex items-center gap-1"},Dc={key:0,class:"text-neutral-400 dark:text-neutral-600 mr-1"},Uc={key:3},Rc={class:"px-3 py-2"},Nc={class:"flex items-center gap-2"},Bc={key:0,class:"text-red-600 dark:text-red-400",title:"Error"},qc={class:"font-mono text-xs"},Fc={class:"px-3 py-2 font-mono text-xs"},zc={key:1},Hc={key:1},Wc={key:0,class:"log-details-panel relative shrink-0 bg-neutral-100 dark:bg-neutral-950 border-t border-neutral-300 dark:border-neutral-700 overflow-hidden"},Jc={class:"m-2 border h-[calc(100%-1rem)] border-neutral-300 shrink-0 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 overflow-auto"},Zc={key:0,class:"flex flex-col items-center justify-center h-full gap-3 text-neutral-500 dark:text-neutral-400"},Kc={key:2,class:"absolute inset-0 bg-white/50 dark:bg-black/50 flex items-center justify-center"},Pt=20,Gc=20,Xc=se({__name:"LogsPane",props:{threadId:{},selectedLogId:{},hoveredLogId:{}},emits:["collapse","logClick","logHover","logsLoaded"],setup(t,{expose:i,emit:n}){const u=t,l=n,c=v(0),r=v(Pt),{logs:p,hasMore:f,isFetching:b,error:s,wsConnected:d,wsError:h,connectWebSocket:$,disconnectWebSocket:g,refetch:m}=Wi(K(()=>u.threadId),{limit:K(()=>r.value),offset:K(()=>c.value),enableWebSocket:!0,order:"desc"}),w=v([]),k=v(!0),O=v(null),D=v(null),F=v(!1),X=v(!1),te=v(new Map),R=async()=>{await ge(),D.value&&(D.value.scrollTop=D.value.scrollHeight)},j=v(null);ue(p,async z=>{if(c.value===0)w.value=[...z].reverse(),k.value&&w.value.length>0&&(await R(),k.value=!1);else{const H=[...z].reverse(),G=new Map;w.value.forEach(ce=>G.set(ce.id,ce)),H.forEach(ce=>G.set(ce.id,ce)),w.value=Array.from(G.values()).sort((ce,me)=>ce.created_at-me.created_at)}},{deep:!0,immediate:!0}),ue(b,(z,H)=>{if(H&&!z&&c.value===0&&u.threadId&&j.value!==u.threadId&&w.value.length>0){j.value=u.threadId;const G=w.value[w.value.length-1];l("logsLoaded",G?.id??null)}});const{logDetails:W,isFetching:B}=Ji(K(()=>u.threadId),K(()=>O.value)),N=K(()=>{if(!O.value)return null;const H=w.value.find(G=>G.id===O.value);return H?W.value?{...W.value,...H}:H:null}),U=K(()=>O.value?Le.value.findIndex(z=>z.id===O.value):-1),y=K(()=>U.value>0),x=K(()=>U.value>=0&&U.value<Le.value.length-1),V=()=>{if(y.value){const z=Le.value[U.value-1];S(z)}},_=()=>{if(x.value){const z=Le.value[U.value+1];S(z)}},T=z=>{if(!D.value)return;const H=te.value.get(z);if(!H)return;const G=D.value,ce=H.getBoundingClientRect(),me=G.getBoundingClientRect(),Ve=G.querySelectorAll(".sticky");let Ue=0;Ve.forEach(Ge=>{Ue+=Ge.getBoundingClientRect().height}),Ue+=16;const De=ce.top<me.top+Ue,lt=ce.bottom>me.bottom;De?G.scrollBy({top:ce.top-me.top-Ue,behavior:"smooth"}):lt&&G.scrollBy({top:ce.bottom-me.bottom,behavior:"smooth"})},S=z=>{l("logClick",z.id),O.value=z.id},P=(z,H)=>{H?te.value.set(z,H):te.value.delete(z)};ue(O,async z=>{z&&(await ge(),T(z))}),ue(()=>u.selectedLogId,z=>{z&&(O.value=z)},{immediate:!0});const J=z=>{O.value=z},re=async z=>{await ge();const H=te.value.get(z);if(H&&D.value){const G=D.value,ce=H.getBoundingClientRect(),me=G.getBoundingClientRect(),Ve=G.querySelector("thead"),Ue=G.querySelector(":scope > div > div.sticky");let De=0;Ve&&(De+=Ve.getBoundingClientRect().height),Ue&&(De+=Ue.getBoundingClientRect().height),De+=40;const lt=ce.top<me.top+De,Ge=ce.bottom>me.bottom;lt?G.scrollBy({top:ce.top-me.top-De,behavior:"smooth"}):Ge&&G.scrollBy({top:ce.bottom-me.bottom,behavior:"smooth"})}},A=z=>{if(z.length===0)return;const H=new Set(z);w.value=w.value.filter(G=>!H.has(G.id))},I=v(!1),M=z=>w.value.some(H=>H.id===z),oe=z=>w.value.find(H=>H.id===z)??null,Y=(z,H=3e3)=>new Promise(G=>{const ce=Date.now(),me=ue(w,()=>{w.value.length!==z&&(me(),G(!0))},{deep:!0}),Ve=setInterval(()=>{w.value.length!==z?(clearInterval(Ve),me(),G(!0)):Date.now()-ce>H&&(clearInterval(Ve),me(),G(!1))},50)});i({scrollToLog:re,selectLogById:J,removeLogsByIds:A,loadUntilLogId:async z=>{if(M(z))return!0;if(!f.value)return!1;I.value=!0;const H=100,G=50;try{let ce=0;for(;f.value&&!M(z)&&ce<G;){ce++;const me=w.value.length;if(c.value+=r.value,r.value=H,await m(),!await Y(me))break}return M(z)}finally{I.value=!1}},hasLog:M,getLog:oe,setLoadingForLog:z=>{I.value=z},waitForLogRow:async(z,H=2e3)=>{const G=Date.now();for(;Date.now()-G<H;){if(te.value.has(z))return!0;if(!Le.value.some(me=>me.id===z)){await ge(),await new Promise(me=>setTimeout(me,16));continue}await ge(),await new Promise(me=>setTimeout(me,16))}return!1}});const Ie=async()=>{if(X.value||!f.value||b.value)return;X.value=!0;const z=D.value?.scrollHeight||0;if(c.value+=r.value,r.value=Gc,await m(),await ge(),D.value){const H=D.value.scrollHeight;D.value.scrollTop+=H-z}X.value=!1};ue(()=>u.threadId,async z=>{z?(g(),$()):g(),c.value=0,r.value=Pt,w.value=[],O.value=null,F.value=!1,k.value=!0},{immediate:!0}),ue(w,async()=>{F.value||await R()},{deep:!0});const $e=()=>{if(!D.value)return;const{scrollTop:z,scrollHeight:H,clientHeight:G}=D.value,ce=H-z-G<50;F.value=!ce},Me=z=>{if(!z.tools_called)return"—";try{const H=JSON.parse(z.tools_called);return Array.isArray(H)?H.join(", "):z.tools_called}catch{return z.tools_called}},Pe=z=>z==null?"—":`$${z.toFixed(6)}`,Le=K(()=>{const z=new Map,H=new Map;w.value.forEach(me=>{z.set(me.id,me);const Ve=me.parent_log_id;Ve&&(H.has(Ve)||H.set(Ve,[]),H.get(Ve).push(me))});const G=[],ce=(me,Ve)=>{G.push({...me,depth:Ve}),(H.get(me.id)||[]).forEach(De=>{ce(De,Ve+1)})};return w.value.forEach(me=>{me.parent_log_id||ce(me,0)}),G});return(z,H)=>(o(),a("div",bc,[e("div",xc,[e("div",yc,[e("div",kc,[E(Z(zt),{size:18,class:"shrink-0"}),H[4]||(H[4]=e("h2",{class:"text-base font-bold"},"Logs",-1)),t.threadId?(o(),ee(Vt,{key:0,connected:Z(d),error:Z(h)},null,8,["connected","error"])):L("",!0)]),e("div",wc,[e("button",{onClick:H[0]||(H[0]=G=>l("collapse")),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Collapse pane"},[E(Z($t),{size:20})])])])]),e("div",{ref_key:"logsScrollContainer",ref:D,class:"logs-list-container flex-1 overflow-y-auto overflow-x-auto",onScroll:$e},[t.threadId?Z(b)&&c.value===0?(o(),a("div",$c,[E(be)])):Z(s)?(o(),a("div",Cc," Error loading logs: "+C(Z(s)),1)):w.value.length===0?(o(),a("div",Vc," No logs yet ")):(o(),a("div",Sc,[Z(f)?(o(),a("div",Tc,[e("button",{onClick:Ie,disabled:X.value||I.value,type:"button",class:"w-full px-3 py-2 text-xs font-medium text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-900 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"},[X.value||I.value?(o(),ee(be,{key:0,size:"xs"})):L("",!0),I.value?(o(),a("span",Lc,"Loading to find log...")):X.value?(o(),a("span",Ic,"Loading older logs...")):(o(),a("span",Ec,"Load previous logs"))],8,Mc)])):L("",!0),e("table",Ac,[e("thead",{class:le(["border-b border-neutral-300 dark:border-neutral-700 sticky bg-white z-[10] dark:bg-black",{"top-0":!Z(f),"top-[34px]":Z(f)}])},[...H[5]||(H[5]=[e("tr",null,[e("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Prompt"),e("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Model"),e("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Cost"),e("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Tools Called"),e("th",{class:"text-right px-3 py-1.5 text-xs font-semibold"},"Called At")],-1)])],2),e("tbody",null,[(o(!0),a(pe,null,fe(Le.value,G=>(o(),a("tr",{key:G.id,ref_for:!0,ref:ce=>P(G.id,ce),class:le(["border-b border-neutral-200 dark:border-neutral-800 cursor-pointer transition-colors relative",{"last:border-b-0":N.value,"bg-red-50 dark:bg-red-950/20":G.error,"bg-accent-100 dark:bg-accent-900 dark:text-white":O.value===G.id,"ring-2 ring-inset ring-accent-400 dark:ring-accent-400":G.id===u.selectedLogId||G.id!==u.selectedLogId&&G.id===u.hoveredLogId}]),onClick:ce=>S(G),onMouseenter:ce=>l("logHover",G.id),onMouseleave:H[1]||(H[1]=ce=>l("logHover",null))},[e("td",Oc,[e("div",jc,[G.depth>0?(o(),a("span",Dc,"└─")):L("",!0),G.retry_of_log_id?(o(),ee(Z(wo),{key:1,size:14,class:"text-neutral-500 dark:text-neutral-400 flex-shrink-0"})):L("",!0),!G.is_complete&&!G.prompt_name?(o(),ee(be,{key:2,size:"xs"})):(o(),a("span",Uc,C(G.prompt_name||"—"),1))])]),e("td",Rc,[e("div",Nc,[G.error?(o(),a("span",Bc," ✕ ")):L("",!0),e("span",qc,C(G.model_name||G.model),1)])]),e("td",Fc,[!G.is_complete&&!G.cost_total?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",zc,C(Pe(G.cost_total)),1))]),e("td",{class:le(["px-3 py-2 text-xs",O.value===G.id?"text-neutral-800 dark:text-neutral-100":"text-neutral-600 dark:text-neutral-400"])},[!G.is_complete&&Me(G)==="—"?(o(),ee(be,{key:0,size:"xs"})):(o(),a("span",Hc,C(Me(G)),1))],2),e("td",{class:le(["px-3 py-2 text-right text-xs",O.value===G.id?"text-neutral-800 dark:text-neutral-100":"text-neutral-500 dark:text-neutral-500"])},[E(dt,{timestamp:G.created_at},null,8,["timestamp"])],2)],42,Pc))),128))])])])):(o(),a("div",_c," Select a thread to view logs "))],544),E(We,{name:"slide-up",onAfterEnter:H[3]||(H[3]=()=>O.value&&T(O.value))},{default:de(()=>[N.value||I.value&&O.value?(o(),a("div",Wc,[e("div",Jc,[I.value&&!N.value?(o(),a("div",Zc,[E(be),H[6]||(H[6]=e("span",{class:"text-sm"},"Loading log...",-1))])):N.value?(o(),ee(gc,{key:1,log:N.value,"has-previous":y.value,"has-next":x.value,onClose:H[2]||(H[2]=G=>O.value=null),onPrevious:V,onNext:_},null,8,["log","has-previous","has-next"])):L("",!0),Z(B)&&N.value?(o(),a("div",Kc,[E(be)])):L("",!0)])])):L("",!0)]),_:1})]))}}),Yc=Ze(Xc,[["__scopeId","data-v-fd2bcb0e"]]),Qc={class:"space-y-4"},e0={key:0,class:"p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded text-sm text-red-800 dark:text-red-200"},t0={class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},o0={key:0},l0={key:1},a0={key:1,class:"space-y-4 p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},s0={key:3,class:"flex items-center gap-2"},n0=["onUpdate:modelValue","id"],r0=["for"],i0={key:0,class:"text-red-500"},d0={key:5,class:"text-xs text-neutral-500 dark:text-neutral-400 mt-1"},u0={key:2,class:"p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg text-center text-sm text-neutral-500"},c0={key:3},p0={key:0,class:"space-y-3 mb-4 max-h-64 overflow-y-auto p-2"},m0={class:"text-xs font-medium mb-1 opacity-70"},v0={class:"text-sm whitespace-pre-wrap"},f0=["onClick"],h0={key:1,class:"text-center py-8 text-neutral-500 dark:text-neutral-400 text-sm"},g0={class:"space-y-2"},b0={class:"flex items-stretch border border-black dark:border-neutral-300 rounded overflow-hidden bg-white dark:bg-neutral-900"},x0=["disabled","title"],y0={class:"flex-1 relative"},k0=["disabled","title"],w0={class:"text-xs text-neutral-500 dark:text-neutral-400"},_0={class:"flex justify-between"},$0=["disabled"],C0=["disabled"],V0=se({__name:"CreateThreadModal",props:{modelValue:{type:Boolean},editThread:{}},emits:["update:modelValue","thread-created","thread-updated"],setup(t,{emit:i}){const n=t,u=i,l=K(()=>!!n.editThread),c=v(""),r=v(""),p=v({}),f=v([]),b=v(""),s=v(!1),d=v(""),h=v(null),{data:$,isFetching:g,execute:m}=Ee(ae("/api/agents"),{immediate:!1}).json(),w=K(()=>$.value?($.value?.agents||[]).map(T=>({value:T.id,label:T.title})):[]),k=K(()=>!c.value||!$.value?null:($.value?.agents||[]).find(T=>T.id===c.value)),O=K(()=>k.value&&k.value.type==="ai_human"?"AI":"Side A"),D=K(()=>k.value&&k.value.type==="ai_human"?"Human":"Side B"),{data:F,isFetching:X,execute:te}=Ee(K(()=>k.value?.side_a_system_prompt?ae(`/api/prompts/${k.value.side_a_system_prompt}`):""),{immediate:!1}).json(),R=K(()=>{if(!F.value)return null;const _=F.value?.required_schema;if(!_)return null;try{return typeof _=="string"?JSON.parse(_):_}catch{return null}}),j=K(()=>{const _=R.value;return!_||!_.properties?[]:Object.entries(_.properties).map(([T,S])=>({name:T,type:S.type||"string",description:S.description||"",required:_.required?.includes(T)||!1,enum:S.enum}))});ue(c,async _=>{_&&k.value?.side_a_system_prompt?(await te(),p.value={}):p.value={}});const W=()=>{const _=h.value;_&&(_.style.height="auto",_.style.height=`${_.scrollHeight}px`)},B=_=>{b.value.trim()&&(f.value.push({id:crypto.randomUUID(),role:_,content:b.value.trim()}),b.value="",setTimeout(()=>W(),0))},N=_=>{f.value=f.value.filter(T=>T.id!==_)},U=()=>{c.value="",r.value="",p.value={},f.value=[],b.value="",d.value=""},y=()=>{n.editThread&&(c.value=n.editThread.agent_id,r.value=n.editThread.tags?.join(", ")||"")},x=async()=>{if(!c.value){d.value="Please select an agent";return}if(!l.value&&j.value.length>0){for(const _ of j.value)if(_.required&&!p.value[_.name]){d.value=`Please provide ${_.name}`;return}}s.value=!0,d.value="";try{const _=r.value.split(",").map(T=>T.trim()).filter(T=>T.length>0);if(l.value){const T=await fetch(ae(`/api/threads/${n.editThread.id}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tags:_})});if(!T.ok){const S=await T.json();throw new Error(S.error||"Failed to update thread")}u("thread-updated"),U(),u("update:modelValue",!1)}else{const T={agent_id:c.value,tags:_.length>0?_:void 0};f.value.length>0&&(T.initial_messages=f.value.map(re=>({role:re.role,content:re.content}))),Object.keys(p.value).length>0&&(T.data=p.value);const S=await fetch(ae("/api/threads"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)});if(!S.ok){const re=await S.json();throw new Error(re.error||"Failed to create thread")}const J=(await S.json()).threadId;if(!J)throw new Error("Thread created but ID not found in response");u("thread-created",J),U(),u("update:modelValue",!1)}}catch(_){console.error(`Error ${l.value?"updating":"creating"} thread:`,_),d.value=_.message||`Failed to ${l.value?"update":"create"} thread`}finally{s.value=!1}},V=()=>{U(),u("update:modelValue",!1)};return ue(()=>n.modelValue,async _=>{_&&(await m(),U(),l.value&&y())}),(_,T)=>(o(),ee(je,{"model-value":t.modelValue,"onUpdate:modelValue":T[7]||(T[7]=S=>_.$emit("update:modelValue",S)),title:l.value?"Edit Thread":"Create New Thread",width:"max-w-3xl"},{footer:de(()=>[e("div",_0,[e("button",{onClick:V,type:"button",disabled:s.value,class:"px-3 py-1.5 text-sm border border-black dark:border-white rounded font-medium hover:bg-black/5 dark:hover:bg-white/10 transition-colors disabled:opacity-50"}," Cancel ",8,$0),e("button",{onClick:x,type:"button",disabled:s.value||Z(g),class:"px-3 py-1.5 text-sm bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity disabled:opacity-50"},[l.value?(o(),a(pe,{key:0},[ye(C(s.value?"Updating...":"Update Thread"),1)],64)):(o(),a(pe,{key:1},[ye(C(s.value?"Creating...":"Create Thread"),1)],64))],8,C0)])]),default:de(()=>[e("div",Qc,[d.value?(o(),a("div",e0,C(d.value),1)):L("",!0),e("div",null,[E(he,{modelValue:c.value,"onUpdate:modelValue":T[0]||(T[0]=S=>c.value=S),label:"Agent",options:w.value,disabled:Z(g)||l.value,placeholder:"Select an agent...",required:""},null,8,["modelValue","options","disabled"]),e("p",t0,[l.value?(o(),a("span",o0,"Agent cannot be changed after thread creation")):(o(),a("span",l0,"Choose which agent will handle this conversation"))])]),!l.value&&j.value.length>0&&!Z(X)?(o(),a("div",a0,[T[8]||(T[8]=e("h4",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"}," Required Information ",-1)),(o(!0),a(pe,null,fe(j.value,S=>(o(),a("div",{key:S.name,class:"space-y-2"},[S.enum?(o(),ee(he,{key:0,modelValue:p.value[S.name],"onUpdate:modelValue":P=>p.value[S.name]=P,label:S.name,options:[{value:"",label:"Select..."},...S.enum.map(P=>({value:P,label:P}))],required:S.required},null,8,["modelValue","onUpdate:modelValue","label","options","required"])):S.type==="string"?(o(),ee(Ce,{key:1,modelValue:p.value[S.name],"onUpdate:modelValue":P=>p.value[S.name]=P,label:S.name,placeholder:S.description,required:S.required},null,8,["modelValue","onUpdate:modelValue","label","placeholder","required"])):S.type==="number"||S.type==="integer"?(o(),ee(Ce,{key:2,modelValue:p.value[S.name],"onUpdate:modelValue":P=>p.value[S.name]=P,modelModifiers:{number:!0},label:S.name,placeholder:S.description,type:"number",required:S.required},null,8,["modelValue","onUpdate:modelValue","label","placeholder","required"])):S.type==="boolean"?(o(),a("div",s0,[Se(e("input",{"onUpdate:modelValue":P=>p.value[S.name]=P,type:"checkbox",id:`field-${S.name}`,class:"w-4 h-4"},null,8,n0),[[_o,p.value[S.name]]]),e("label",{for:`field-${S.name}`,class:"text-sm"},[ye(C(S.name)+" ",1),S.required?(o(),a("span",i0,"*")):L("",!0)],8,r0)])):(o(),ee(to,{key:4,modelValue:p.value[S.name],"onUpdate:modelValue":P=>p.value[S.name]=P,label:S.name,placeholder:S.description||`Enter ${S.name} (JSON format)`,required:S.required,rows:3},null,8,["modelValue","onUpdate:modelValue","label","placeholder","required"])),S.description?(o(),a("p",d0,C(S.description),1)):L("",!0)]))),128))])):L("",!0),!l.value&&Z(X)?(o(),a("div",u0," Loading agent requirements... ")):L("",!0),l.value?L("",!0):(o(),a("div",c0,[T[11]||(T[11]=e("h4",{class:"text-sm font-medium mb-3"},"Initial Conversation",-1)),f.value.length>0?(o(),a("div",p0,[(o(!0),a(pe,null,fe(f.value,S=>(o(),a("div",{key:S.id,class:le(["flex items-start gap-2",{"justify-start":S.role==="assistant","justify-end":S.role==="user"}])},[e("div",{class:le(["max-w-[80%] rounded-2xl px-4 py-2 break-words",{"bg-black text-white dark:bg-white dark:text-black":S.role==="assistant","bg-neutral-200 text-black dark:bg-neutral-800 dark:text-white":S.role==="user"}])},[e("div",m0,C(S.role==="assistant"?O.value:D.value),1),e("div",v0,C(S.content),1)],2),e("button",{onClick:P=>N(S.id),type:"button",class:"text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-200 text-xs mt-2"}," ✕ ",8,f0)],2))),128))])):(o(),a("div",h0," No messages yet. Add messages to start the conversation. ")),e("div",g0,[e("div",b0,[e("button",{onClick:T[1]||(T[1]=S=>B("assistant")),type:"button",disabled:!b.value.trim(),title:`Add as ${O.value}`,class:"px-3 py-2 bg-black text-white dark:bg-white dark:text-black text-sm hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap inline-flex items-center gap-1 border-r border-black dark:border-neutral-300 flex-shrink-0"},[T[9]||(T[9]=e("svg",{class:"w-[1em] h-[1em]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 10l7-7m0 0l7 7m-7-7v18"})],-1)),e("span",null,C(O.value),1)],8,x0),e("div",y0,[Se(e("textarea",{"onUpdate:modelValue":T[2]||(T[2]=S=>b.value=S),placeholder:"Type a message...",class:"w-full px-3 py-2 bg-transparent border-0 font-mono text-sm focus:outline-none resize-none overflow-hidden",rows:"1",ref_key:"textareaRef",ref:h,onInput:W,onKeydown:[T[3]||(T[3]=xt(we(S=>B("user"),["meta"]),["enter"])),T[4]||(T[4]=xt(we(S=>B("user"),["ctrl"]),["enter"]))]},null,544),[[Oe,b.value]])]),e("button",{onClick:T[5]||(T[5]=S=>B("user")),type:"button",disabled:!b.value.trim(),title:`Add as ${D.value}`,class:"px-3 py-2 bg-black text-white dark:bg-white dark:text-black text-sm hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap inline-flex items-center gap-1 border-l border-black dark:border-neutral-300 flex-shrink-0"},[T[10]||(T[10]=e("svg",{class:"w-[1em] h-[1em]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 10l7-7m0 0l7 7m-7-7v18"})],-1)),e("span",null,C(D.value),1)],8,k0)]),e("p",w0," Type a message and click "+C(O.value)+" (left) or "+C(D.value)+" (right) to add. Or press Cmd+Enter (Mac) / Ctrl+Enter (Windows) to add as "+C(D.value)+". ",1)])])),e("div",null,[E(Ce,{modelValue:r.value,"onUpdate:modelValue":T[6]||(T[6]=S=>r.value=S),label:"Tags",placeholder:"research, urgent, production"},null,8,["modelValue"]),T[12]||(T[12]=e("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Comma-separated tags to help organize and search threads ",-1))])])]),_:1},8,["model-value","title"]))}}),S0={class:"flex h-full overflow-hidden"},T0={key:0,class:"flex flex-col items-center p-4"},M0={key:0,class:"flex flex-col items-center p-4"},L0={key:0,class:"flex flex-col items-center p-4"},Ot=se({__name:"ThreadsView",setup(t){const i=ze(),n=et(),u=v(typeof i.params.id=="string"?i.params.id:null),l=v({threadList:!1,messages:!1,logs:!1}),c=v(!1),r=v(null),p=v(null),{thread:f}=Ct(K(()=>u.value)),b=v(null),s=v(null),d=v(null),h=v(null),$=v(null),g=x=>{h.value=x,$.value=x},m=x=>{if(h.value=x,!x){$.value=null;return}$.value=x;const V=w.value,_=k.value;if(!V||!_||V.hasWorkblockForLogId(x))return;let T=x;const S=10;for(let P=0;P<S&&T;P++){const J=_.getLog(T);if(!J)break;const re=J.parent_log_id;if(!re)break;if(V.hasWorkblockForLogId(re)){$.value=re;return}T=re}},w=v(null),k=v(null);ue(()=>i.params.id,x=>{u.value=typeof x=="string"?x:null,b.value=null,s.value=null,d.value=null});const O=x=>{n.push(`/threads/${x}`)},D=x=>{window.location.href="/threads"},F=()=>{f.value&&(r.value=f.value,c.value=!0)},X=()=>{r.value=null,c.value=!0},te=x=>{p.value?.refetch(),n.push(`/threads/${x}`)},R=()=>{window.location.reload()},j=x=>{l.value[x]=!l.value[x]},W=async(x,V)=>{if(b.value=x,!V){s.value=null,d.value=null;return}const _=k.value;if(!_){s.value=V,d.value=V;return}const T=!_.hasLog(V);if(T&&_.setLoadingForLog(!0),s.value=V,d.value=V,T&&!await _.loadUntilLogId(V)){console.warn(`Could not find log ${V} after loading all available logs`),_.setLoadingForLog(!1);return}if(!await _.waitForLogRow(V)){console.warn(`Log row ${V} not rendered in time`);return}_.scrollToLog(V),_.selectLogById(V)},B=x=>{s.value=x,d.value=x,b.value=null;const V=w.value,_=k.value;if(!V||!_)return;let T=V.scrollToLogId(x);if(T)return;let S=x;const P=10;for(let J=0;J<P&&S;J++){const re=_.getLog(S);if(!re)break;const A=re.parent_log_id;if(!A)break;if(T=V.scrollToLogId(A),T){d.value=A;return}S=A}},N=x=>{x&&(s.value=x)},U=x=>{k.value?.removeLogsByIds(x)},y=x=>{x&&!u.value&&n.push(`/threads/${x}`)};return(x,V)=>(o(),a("div",S0,[e("div",{class:le([l.value.threadList?"w-[60px]":"w-[320px]","border-r border-neutral-300 dark:border-neutral-700 flex-shrink-0 overflow-hidden transition-all duration-200"])},[l.value.threadList?(o(),a("div",T0,[e("button",{onClick:V[0]||(V[0]=_=>j("threadList")),class:"p-2 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Expand Threads pane"},[E(Z(qt),{size:20})])])):(o(),ee(Kn,{key:1,ref_key:"threadListPaneRef",ref:p,"selected-thread-id":u.value,onSelectThread:O,onCollapse:V[1]||(V[1]=_=>j("threadList")),onCreateThread:X,onThreadsLoaded:y},null,8,["selected-thread-id"]))],2),e("div",{class:le([l.value.messages?"w-[60px]":"w-[380px]","border-r border-neutral-300 dark:border-neutral-700 flex-shrink-0 overflow-hidden transition-all duration-200"])},[l.value.messages?(o(),a("div",M0,[e("button",{onClick:V[2]||(V[2]=_=>j("messages")),class:"p-2 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Expand Messages pane"},[E(Z(Ft),{size:20})])])):(o(),ee(Hi,{key:1,ref_key:"messagesPaneRef",ref:w,"thread-id":u.value,"selected-message-id":b.value,"selected-log-id":d.value,"hovered-log-id":$.value,onCollapse:V[3]||(V[3]=_=>j("messages")),onMessageClick:W,onMessageHover:g,onThreadDeleted:D,onEditThread:F,onLogsDeleted:U},null,8,["thread-id","selected-message-id","selected-log-id","hovered-log-id"]))],2),e("div",{class:le([l.value.logs?"w-[60px]":"flex-1","overflow-hidden transition-all duration-200"])},[l.value.logs?(o(),a("div",L0,[e("button",{onClick:V[4]||(V[4]=_=>j("logs")),class:"p-2 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Expand Logs pane"},[E(Z(zt),{size:20})])])):(o(),ee(Yc,{key:1,ref_key:"logsPaneRef",ref:k,"thread-id":u.value,"selected-log-id":s.value,"hovered-log-id":h.value,onCollapse:V[5]||(V[5]=_=>j("logs")),onLogClick:B,onLogHover:m,onLogsLoaded:N},null,8,["thread-id","selected-log-id","hovered-log-id"]))],2),E(V0,{modelValue:c.value,"onUpdate:modelValue":V[6]||(V[6]=_=>c.value=_),"edit-thread":r.value,onThreadCreated:te,onThreadUpdated:R},null,8,["modelValue","edit-thread"])]))}}),I0=se({__name:"PromptsDataTable",emits:["add","edit","delete"],setup(t,{expose:i,emit:n}){const u=n,l=v([]),c=v(!1),r=[{key:"name",label:"Name",width:"w-1/4"},{key:"tool_description",label:"Description",width:"w-2/5"},{key:"model_name",label:"Model",width:"w-1/5",formatter:(s,d)=>s||d.model_id||"-"},{key:"created_at",label:"Created",width:"w-1/6",formatter:s=>s?new Date(s*1e3).toLocaleDateString():"-"}],p=[{icon:"edit",label:"Edit",handler:s=>u("edit",s)},{icon:"delete",label:"Delete",handler:async s=>{await b(s)},confirm:!0,confirmMessage:"Are you sure you want to delete this prompt?"}],f=async()=>{c.value=!0;try{const s=await fetch(ae("/api/prompts"));if(s.ok){const d=await s.json();l.value=d.prompts||[]}}catch(s){console.error("Error fetching prompts:",s)}finally{c.value=!1}},b=async s=>{try{const d=await fetch(ae(`/api/prompts/${s.id}`),{method:"DELETE"});if(d.ok)await f();else{const h=await d.json();alert(h.error||"Failed to delete prompt")}}catch(d){console.error("Error deleting prompt:",d),alert("Failed to delete prompt")}};return xe(()=>{f()}),i({refresh:f}),(s,d)=>(o(),a("div",null,[E(Fe,{columns:r,data:l.value,actions:p,loading:c.value,"empty-message":"No prompts available. Create your first prompt to get started."},null,8,["data","loading"])]))}}),E0={class:"space-y-4"},A0={key:0,class:"mt-1 text-sm text-red-500"},P0={key:1,class:"mt-1 text-sm text-neutral-500 dark:text-neutral-400"},O0={class:"px-1 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},j0=["value"],D0=se({__name:"PromptBasicInfo",props:{name:{},toolDescription:{}},emits:["update:name","update:toolDescription"],setup(t,{emit:i}){const n=t,u=i,l=v(""),c=p=>{let f=p.replace(/[^a-zA-Z0-9\s_]/g,"");return f=f.trim().toLowerCase().replace(/\s+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),f?/^[a-z][a-z0-9_]*$/.test(f)?l.value="":l.value="Name must start with a letter and contain only lowercase letters, numbers, and underscores":l.value="Name is required",f},r=p=>{const f=c(p);u("update:name",f)};return ue(()=>n.name,p=>{p&&c(p)},{immediate:!0}),(p,f)=>(o(),a("div",E0,[e("div",null,[E(Ce,{"model-value":t.name,"onUpdate:modelValue":r,label:"Prompt Name",placeholder:"Enter a unique name (will be converted to snake_case)"},null,8,["model-value"]),l.value?(o(),a("p",A0,C(l.value),1)):t.name?(o(),a("p",P0,[f[1]||(f[1]=ye(" Will be saved as: ",-1)),e("code",O0,C(t.name),1)])):L("",!0)]),e("div",null,[f[2]||(f[2]=e("label",{class:"block text-sm font-medium mb-2"},"Tool Description",-1)),e("textarea",{value:t.toolDescription,onInput:f[0]||(f[0]=b=>u("update:toolDescription",b.target.value)),placeholder:"Describe what this prompt does (shown when used as a tool)",class:"w-full px-3 py-2 border border-black dark:border-white rounded bg-transparent resize-none",rows:"3"},null,40,j0)])]))}}),U0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%3e%3crect%20width='48'%20height='48'%20fill='%23F0EFEA'/%3e%3cpath%20d='M32.84%2010H26.72L37.88%2038H44L32.84%2010Z'%20fill='black'/%3e%3cpath%20d='M15.16%2010L4%2038H10.24L12.5224%2032.12H24.1976L26.48%2038H32.72L21.56%2010H15.16ZM14.5408%2026.92L18.36%2017.08L22.1793%2026.92H14.5408Z'%20fill='black'/%3e%3c/svg%3e",wt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%3e%3crect%20width='48'%20height='48'%20rx='24'%20fill='white'/%3e%3cpath%20d='M19.3418%2018.5599V14.7599C19.3418%2014.4399%2019.4608%2014.1998%2019.7382%2014.04L27.3102%209.63997C28.3409%209.03999%2029.5699%208.76014%2030.8383%208.76014C35.5954%208.76014%2038.6085%2012.4802%2038.6085%2016.4401C38.6085%2016.72%2038.6085%2017.04%2038.5687%2017.3601L30.7194%2012.72C30.2437%2012.4401%2029.7678%2012.4401%2029.2922%2012.72L19.3418%2018.5599ZM37.0226%2033.36V24.2799C37.0226%2023.7197%2036.7846%2023.3197%2036.309%2023.0398L26.3586%2017.1998L29.6093%2015.3197C29.8868%2015.1599%2030.1247%2015.1599%2030.4022%2015.3197L37.9741%2019.7197C40.1547%2020.9999%2041.6213%2023.7197%2041.6213%2026.3596C41.6213%2029.3995%2039.8375%2032.1999%2037.0226%2033.36ZM17.0029%2025.3601L13.7522%2023.4402C13.4748%2023.2804%2013.3557%2023.0402%2013.3557%2022.7202V13.9203C13.3557%209.64039%2016.6065%206.40016%2021.0069%206.40016C22.6722%206.40016%2024.2179%206.96029%2025.5265%207.96025L17.7168%2012.5204C17.2412%2012.8003%2017.0033%2013.2002%2017.0033%2013.7605L17.0029%2025.3601ZM24%2029.44L19.3418%2026.8001V21.2003L24%2018.5604L28.6578%2021.2003V26.8001L24%2029.44ZM26.993%2041.6002C25.3278%2041.6002%2023.7821%2041.04%2022.4735%2040.0402L30.2831%2035.4799C30.7588%2035.2001%2030.9967%2034.8001%2030.9967%2034.2399V22.6399L34.2873%2024.5598C34.5646%2024.7196%2034.6837%2024.9597%2034.6837%2025.2798V34.0797C34.6837%2038.3596%2031.3931%2041.6002%2026.993%2041.6002ZM17.5975%2032.6802L10.0255%2028.2803C7.84493%2027.0001%206.37833%2024.2803%206.37833%2021.6404C6.37833%2018.5604%208.20193%2015.8004%2011.0164%2014.6403V23.7602C11.0164%2024.3204%2011.2544%2024.7204%2011.73%2025.0003L21.641%2030.8001L18.3902%2032.6802C18.1129%2032.84%2017.8749%2032.84%2017.5975%2032.6802ZM17.1617%2039.2402C12.682%2039.2402%209.39151%2035.8402%209.39151%2031.6401C9.39151%2031.3201%209.43125%2031.0001%209.47066%2030.68L17.2803%2035.2402C17.7559%2035.5201%2018.2319%2035.5201%2018.7074%2035.2402L28.6578%2029.4404V33.2404C28.6578%2033.5605%2028.5388%2033.8005%2028.2614%2033.9604L20.6894%2038.3604C19.6586%2038.9603%2018.4301%2039.2402%2017.1617%2039.2402ZM26.993%2044C31.7899%2044%2035.7936%2040.5601%2036.7057%2036C41.1457%2034.8399%2044%2030.6399%2044%2026.36C44%2023.5598%2042.8108%2020.8401%2040.6701%2018.88C40.8683%2018.0399%2040.9872%2017.1998%2040.9872%2016.3602C40.9872%2010.6403%2036.3885%206.35998%2031.0763%206.35998C30.0062%206.35998%2028.9754%206.51979%2027.9446%206.88001C26.1604%205.11992%2023.7025%204%2021.0069%204C16.2101%204%2012.2064%207.4398%2011.2943%2012C6.8543%2013.1601%204%2017.3601%204%2021.6399C4%2024.4401%205.18916%2027.1599%207.32995%2029.1199C7.13174%2029.96%207.01277%2030.8001%207.01277%2031.6398C7.01277%2037.3597%2011.6114%2041.6399%2016.9236%2041.6399C17.9938%2041.6399%2019.0246%2041.4801%2020.0554%2041.1199C21.8392%2042.88%2024.2971%2044%2026.993%2044Z'%20fill='black'/%3e%3c/svg%3e",R0="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%3e%3cpath%20fill='%234285F4'%20d='M14.9%208.161c0-.476-.039-.954-.121-1.422h-6.64v2.695h3.802a3.24%203.24%200%2001-1.407%202.127v1.75h2.269c1.332-1.22%202.097-3.02%202.097-5.15z'/%3e%3cpath%20fill='%2334A853'%20d='M8.14%2015c1.898%200%203.499-.62%204.665-1.69l-2.268-1.749c-.631.427-1.446.669-2.395.669-1.836%200-3.393-1.232-3.952-2.888H1.85v1.803A7.044%207.044%200%20008.14%2015z'/%3e%3cpath%20fill='%23FBBC04'%20d='M4.187%209.342a4.17%204.17%200%20010-2.68V4.859H1.849a6.97%206.97%200%20000%206.286l2.338-1.803z'/%3e%3cpath%20fill='%23EA4335'%20d='M8.14%203.77a3.837%203.837%200%20012.7%201.05l2.01-1.999a6.786%206.786%200%2000-4.71-1.82%207.042%207.042%200%2000-6.29%203.858L4.186%206.66c.556-1.658%202.116-2.89%203.952-2.89z'/%3e%3c/svg%3e",jt="/agents/assets/img/meta.svg",N0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%3e%3cpath%20d='M17.8962%2017.7465V14.9519C18.1789%2014.9346%2018.4615%2014.9174%2018.7442%2014.9174C26.5881%2014.6758%2031.7291%2021.5072%2031.7291%2021.5072C31.7291%2021.5072%2026.1818%2029.0287%2020.2282%2029.0287C19.4332%2029.0287%2018.6559%2028.9079%2017.9139%2028.6664V20.1789C20.9702%2020.5412%2021.5885%2021.8523%2023.4082%2024.8367L27.4891%2021.49C27.4891%2021.49%2024.5035%2017.6775%2019.4862%2017.6775C18.9562%2017.6603%2018.4262%2017.6948%2017.8962%2017.7465ZM17.8962%208.5V12.6747L18.7442%2012.623C29.6445%2012.2607%2036.7641%2021.352%2036.7641%2021.352C36.7641%2021.352%2028.6021%2031.047%2020.1045%2031.047C19.3625%2031.047%2018.6382%2030.978%2017.9139%2030.8573V33.4449C18.5145%2033.5139%2019.1329%2033.5657%2019.7335%2033.5657C27.6481%2033.5657%2033.3721%2029.6152%2038.9194%2024.9574C39.8381%2025.682%2043.601%2027.4243%2044.3784%2028.1834C39.1137%2032.4961%2026.8355%2035.9636%2019.8749%2035.9636C19.2035%2035.9636%2018.5675%2035.9291%2017.9315%2035.86V39.5H48V8.5L17.8962%208.5ZM17.8962%2028.6664V30.8745C10.5823%2029.5979%208.55061%2022.1628%208.55061%2022.1628C8.55061%2022.1628%2012.0662%2018.3676%2017.8962%2017.7465V20.1617H17.8785C14.8222%2019.7994%2012.4196%2022.594%2012.4196%2022.594C12.4196%2022.594%2013.7799%2027.3036%2017.8962%2028.6664ZM4.9113%2021.8523C4.9113%2021.8523%209.2396%2015.6074%2017.9139%2014.9519V12.6747C8.30327%2013.4338%200%2021.3692%200%2021.3692C0%2021.3692%204.6993%2034.6525%2017.8962%2035.86V33.4449C8.21494%2032.2718%204.9113%2021.8523%204.9113%2021.8523Z'%20fill='%2376B900'/%3e%3c/svg%3e",B0="data:image/svg+xml,%3csvg%20version='1.2'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201513%20975'%20width='1513'%20height='975'%3e%3ctitle%3eae99cd49-2667-464e-b9db-b39cee0126e1-svg%3c/title%3e%3cstyle%3e%20.s0%20{%20fill:%20%23ff5a00%20}%20%3c/style%3e%3cg%20id='%23ff5a00ff'%3e%3cpath%20id='Layer'%20class='s0'%20d='m989.5%200h67.8c95.3%205.4%20196.5%2023.1%20272.4%2085.5%2060.6%2049.1%2086.3%20133%2071.4%20208.6-11.4%2056.4-37.4%20108.4-65.4%20158.1-56.8%2098.4-126.6%20188.2-193%20280.1-11.9%2015.2-21.2%2033.8-20%2053.6%201.1%2015.7%2013.1%2028.4%2027.2%2034%2027.3%2011.1%2057.5%208.9%2086.2%207.3%2090.7-9.5%20178.1-37%20264.6-64.6%206.6-4.1%208.8%202.6%2011.3%207.4-91.9%2061.3-190.8%20112.4-294.8%20150-57.5%2019.3-118.3%2037.6-179.6%2030.4-32.2-3.2-64.5-22.4-74.6-54.5-12.5-41.8-7.9-88.1%2010.2-127.6%2027.5-61.7%2070.2-114.7%20110.7-168.2%2067.1-88%20136.4-175.5%20189.1-273.3%2017.4-34.7%2036-76.8%2018.7-115.1-16.3-35.3-51.7-56.1-85.6-71.8-60.2-26.9-124.4-43.1-187.7-61.1q-14.3%209.4-28.5%2019c22%2016.8%2044%2033.6%2065.8%2050.7-83.3%2015-166.3%2031.8-248.3%2052.7-124.9%2031-246.8%2072.5-367.6%20116.5%2011.8%2023.5%2023.5%2047.1%2034.7%2070.9-27.3%2030.2-54.4%2060.7-81.7%2090.9%2065.6%2019.6%20136.3%2022.3%20203.2%207.5%2057.2-12.8%20111-40.2%20154.7-79.3-11.9-14.8-26.9-26.7-43.1-36.5%2053.1%201.1%20101.4%2047.4%20101.5%20101.1q-15.6%200.1-31%200.2c-2.2-11.7-5.3-23-9.4-34.1-60.3%2054.5-138.2%2088.6-218.9%2097.4-71.1%208.2-143.8-1.6-210.7-26.6%204.5%2041.4%209%2082.6%2013.2%20124-38%2014.8-73.3%2036.2-104.9%2062-25.1%2021.9-50%2047.1-59.6%2079.9-9.2%2028.9%205.8%2061.7%2031.1%2077.2%2030.7%2019%2066.5%2027.8%20101.9%2032.9%2046.7%206.1%2093.9%205.6%20140.8%202.3%2092.1-6.8%20183.1-24.1%20272.7-45.8%208.9-3.6%2013.1%2011.1%204%2013.4-71.5%2036.8-146.3%2067.8-224.3%2087.8-73.3%2018.9-148.8%2028.6-224.4%2031.2-77.1-2.4-159-17.3-220.1-67.8-45.4-36.8-69.3-95.2-69.5-153.1v-3.1c1.5-61.2%2022.2-120.4%2052-173.4%2039.2-74.8%2087.5-145%20144.6-207.3%2098.7-108.7%20222.5-192.8%20355.6-253.7%20137.9-62.5%20285.5-107.4%20437.3-115.7z'/%3e%3c/g%3e%3c/svg%3e",q0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%3e%3cpath%20d='M47.4964%209.43757C46.988%209.19072%2046.769%209.66115%2046.4717%209.90013C46.37%209.97722%2046.284%2010.0774%2046.1979%2010.1699C45.4548%2010.9562%2044.5866%2011.4729%2043.4523%2011.4112C41.794%2011.3186%2040.3781%2011.8353%2039.1265%2013.092C38.8605%2011.5423%2037.9767%2010.617%2036.6312%2010.0234C35.9273%209.71497%2035.2154%209.40651%2034.7226%208.7357C34.3784%208.25783%2034.2845%207.7258%2034.1124%207.20147C34.0029%206.8854%2033.8934%206.56146%2033.5257%206.50747C33.1268%206.44587%2032.9703%206.77725%2032.8138%207.05499C32.1881%208.18844%2031.9456%209.43749%2031.969%2010.7019C32.0237%2013.5471%2033.2363%2015.8137%2035.6455%2017.4252C35.9193%2017.6103%2035.9896%2017.7952%2035.9036%2018.0652C35.7393%2018.6204%2035.5437%2019.16%2035.3717%2019.7151C35.2622%2020.0699%2035.0978%2020.147%2034.7146%2019.9926C33.3926%2019.4453%2032.2505%2018.6357%2031.2414%2017.6566C29.5284%2016.0143%2027.9795%2014.2024%2026.0475%2012.7837C25.5938%2012.4521%2025.1401%2012.1438%2024.6707%2011.8507C22.6994%209.95412%2024.9289%208.39653%2025.4451%208.21163C25.9848%208.01885%2025.6329%207.35566%2023.8884%207.36353C22.144%207.37114%2020.5483%207.94946%2018.5146%208.72047C18.2173%208.83615%2017.9043%208.92086%2017.5836%208.99025C15.7376%208.64338%2013.8211%208.56612%2011.8186%208.78986C8.04819%209.20613%205.03671%2010.9718%202.823%2013.9865C0.16347%2017.6103%20-0.462297%2021.7274%200.304303%2026.0221C1.11002%2030.5478%203.44099%2034.295%207.02367%2037.225C10.7393%2040.2626%2015.0181%2041.7507%2019.8992%2041.4655C22.8639%2041.2959%2026.1649%2040.9027%2029.8884%2037.7801C30.827%2038.2427%2031.8126%2038.4276%2033.4475%2038.5664C34.7069%2038.6821%2035.9194%2038.5048%2036.858%2038.3121C38.3286%2038.0037%2038.227%2036.6544%2037.6951%2036.4077C33.385%2034.4185%2034.3314%2035.228%2033.471%2034.5726C35.6613%2032.0052%2038.9624%2029.3374%2040.253%2020.6942C40.3546%2020.0081%2040.2686%2019.5763%2040.253%2019.0211C40.2451%2018.682%2040.3234%2018.551%2040.7145%2018.5123C41.794%2018.3889%2042.8422%2018.096%2043.8043%2017.5717C46.5969%2016.0606%2047.7233%2013.5779%2047.9892%2010.6017C48.0284%2010.1468%2047.9814%209.67638%2047.4964%209.43757ZM23.1611%2036.2225C18.984%2032.969%2016.9581%2031.8971%2016.1211%2031.9434C15.3388%2031.9897%2015.4797%2032.8764%2015.6517%2033.4547C15.8316%2034.0252%2016.0663%2034.4185%2016.3948%2034.9196C16.6216%2035.2511%2016.7782%2035.7445%2016.168%2036.1147C14.8226%2036.9397%2012.4836%2035.8371%2012.3741%2035.7832C9.65202%2034.1948%207.37571%2032.0975%205.77205%2029.2295C4.22322%2026.4691%203.32373%2023.5086%203.17504%2020.3474C3.13592%2019.5841%203.36276%2019.3141%204.12936%2019.1755C5.13843%2018.9904%206.17884%2018.9517%207.1879%2019.0982C11.4512%2019.7151%2015.0807%2021.6041%2018.1235%2024.5956C19.86%2026.2995%2021.1742%2028.3352%2022.5275%2030.3243C23.9668%2032.4368%2025.5156%2034.4493%2027.4868%2036.0992C28.183%2036.6775%2028.7384%2037.1169%2029.2703%2037.4408C27.6668%2037.6181%2024.9915%2037.6568%2023.1611%2036.2225ZM25.1636%2023.4623C25.1636%2023.123%2025.4374%2022.8532%2025.7817%2022.8532C25.8599%2022.8532%2025.9303%2022.8685%2025.9929%2022.8916C26.079%2022.9225%2026.1572%2022.9688%2026.2198%2023.038C26.3293%2023.1461%2026.3919%2023.3002%2026.3919%2023.4622C26.3919%2023.8014%2026.1181%2024.0712%2025.774%2024.0712C25.4299%2024.0712%2025.1636%2023.8015%2025.1636%2023.4623ZM31.3824%2026.6235C30.9835%2026.7854%2030.5846%2026.9241%2030.2013%2026.9395C29.6068%2026.9703%2028.9575%2026.7313%2028.6056%2026.4383C28.058%2025.9834%2027.6669%2025.7291%2027.5026%2024.9349C27.4322%2024.5956%2027.4713%2024.0713%2027.534%2023.7707C27.6747%2023.123%2027.5183%2022.7067%2027.0568%2022.3288C26.6813%2022.0204%2026.2041%2021.9357%2025.68%2021.9357C25.4844%2021.9357%2025.3046%2021.8508%2025.1716%2021.7814C24.9525%2021.6735%2024.7727%2021.4036%2024.9447%2021.0721C24.9995%2020.9643%2025.2655%2020.702%2025.3281%2020.6558C26.04%2020.2548%2026.8613%2020.3859%2027.6201%2020.6866C28.3242%2020.9719%2028.8561%2021.4962%2029.6226%2022.2363C30.4048%2023.1306%2030.5456%2023.3776%2030.9915%2024.0482C31.3436%2024.5725%2031.6643%2025.1122%2031.8833%2025.7291C32.0162%2026.1146%2031.844%2026.4307%2031.3824%2026.6235Z'%20fill='%234D6BFE'/%3e%3c/svg%3e",F0="data:image/svg+xml,%3csvg%20version='1.2'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201513%20975'%20width='1513'%20height='975'%3e%3ctitle%3eae99cd49-2667-464e-b9db-b39cee0126e1-svg%3c/title%3e%3cstyle%3e%20.s0%20{%20fill:%20%23ff5a00%20}%20%3c/style%3e%3cg%20id='%23ff5a00ff'%3e%3cpath%20id='Layer'%20class='s0'%20d='m989.5%200h67.8c95.3%205.4%20196.5%2023.1%20272.4%2085.5%2060.6%2049.1%2086.3%20133%2071.4%20208.6-11.4%2056.4-37.4%20108.4-65.4%20158.1-56.8%2098.4-126.6%20188.2-193%20280.1-11.9%2015.2-21.2%2033.8-20%2053.6%201.1%2015.7%2013.1%2028.4%2027.2%2034%2027.3%2011.1%2057.5%208.9%2086.2%207.3%2090.7-9.5%20178.1-37%20264.6-64.6%206.6-4.1%208.8%202.6%2011.3%207.4-91.9%2061.3-190.8%20112.4-294.8%20150-57.5%2019.3-118.3%2037.6-179.6%2030.4-32.2-3.2-64.5-22.4-74.6-54.5-12.5-41.8-7.9-88.1%2010.2-127.6%2027.5-61.7%2070.2-114.7%20110.7-168.2%2067.1-88%20136.4-175.5%20189.1-273.3%2017.4-34.7%2036-76.8%2018.7-115.1-16.3-35.3-51.7-56.1-85.6-71.8-60.2-26.9-124.4-43.1-187.7-61.1q-14.3%209.4-28.5%2019c22%2016.8%2044%2033.6%2065.8%2050.7-83.3%2015-166.3%2031.8-248.3%2052.7-124.9%2031-246.8%2072.5-367.6%20116.5%2011.8%2023.5%2023.5%2047.1%2034.7%2070.9-27.3%2030.2-54.4%2060.7-81.7%2090.9%2065.6%2019.6%20136.3%2022.3%20203.2%207.5%2057.2-12.8%20111-40.2%20154.7-79.3-11.9-14.8-26.9-26.7-43.1-36.5%2053.1%201.1%20101.4%2047.4%20101.5%20101.1q-15.6%200.1-31%200.2c-2.2-11.7-5.3-23-9.4-34.1-60.3%2054.5-138.2%2088.6-218.9%2097.4-71.1%208.2-143.8-1.6-210.7-26.6%204.5%2041.4%209%2082.6%2013.2%20124-38%2014.8-73.3%2036.2-104.9%2062-25.1%2021.9-50%2047.1-59.6%2079.9-9.2%2028.9%205.8%2061.7%2031.1%2077.2%2030.7%2019%2066.5%2027.8%20101.9%2032.9%2046.7%206.1%2093.9%205.6%20140.8%202.3%2092.1-6.8%20183.1-24.1%20272.7-45.8%208.9-3.6%2013.1%2011.1%204%2013.4-71.5%2036.8-146.3%2067.8-224.3%2087.8-73.3%2018.9-148.8%2028.6-224.4%2031.2-77.1-2.4-159-17.3-220.1-67.8-45.4-36.8-69.3-95.2-69.5-153.1v-3.1c1.5-61.2%2022.2-120.4%2052-173.4%2039.2-74.8%2087.5-145%20144.6-207.3%2098.7-108.7%20222.5-192.8%20355.6-253.7%20137.9-62.5%20285.5-107.4%20437.3-115.7z'/%3e%3c/g%3e%3c/svg%3e",z0="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBmaWxsPSJub25lIj4KICA8cmVjdCB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIGZpbGw9IiNGRjZCNkIiLz4KICA8dGV4dCB4PSI1MCUiIHk9IjUwJSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZmlsbD0id2hpdGUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZm9udC13ZWlnaHQ9ImJvbGQiPk1NPC90ZXh0Pgo8L3N2Zz4=",H0="/agents/assets/img/moonshotai.svg",W0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%3e%3crect%20width='48'%20height='48'%20fill='black'/%3e%3cpath%20d='M10.008%2019.311L24.0672%2040H30.3165L16.2557%2019.311H10.008ZM16.2509%2030.8017L10%2040H16.2541L19.3771%2035.4017L16.2509%2030.8017ZM31.7459%208L20.941%2023.8993L24.0672%2028.5009L38%208H31.7459ZM32.8777%2017.8382V40H38V10.3008L32.8777%2017.8382Z'%20fill='white'/%3e%3c/svg%3e",J0="/agents/assets/img/zai.svg",Z0="/agents/assets/img/zai.svg",K0="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBmaWxsPSJub25lIj4KICA8cmVjdCB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIGZpbGw9IiNBOEU2QTMiLz4KICA8dGV4dCB4PSI1MCUiIHk9IjUwJSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZmlsbD0iIzJDM0U1MCIgZm9udC1mYW1pbHk9IkFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE0IiBmb250LXdlaWdodD0iYm9sZCI+RVhBPC90ZXh0Pgo8L3N2Zz4=",oo="data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eOpenRouter%3c/title%3e%3cpath%20d='M16.804%201.957l7.22%204.105v.087L16.73%2010.21l.017-2.117-.821-.03c-1.059-.028-1.611.002-2.268.11-1.064.175-2.038.577-3.147%201.352L8.345%2011.03c-.284.195-.495.336-.68.455l-.515.322-.397.234.385.23.53.338c.476.314%201.17.796%202.701%201.866%201.11.775%202.083%201.177%203.147%201.352l.3.045c.694.091%201.375.094%202.825.033l.022-2.159%207.22%204.105v.087L16.589%2022l.014-1.862-.635.022c-1.386.042-2.137.002-3.138-.162-1.694-.28-3.26-.926-4.881-2.059l-2.158-1.5a21.997%2021.997%200%2000-.755-.498l-.467-.28a55.927%2055.927%200%2000-.76-.43C2.908%2014.73.563%2014.116%200%2014.116V9.888l.14.004c.564-.007%202.91-.622%203.809-1.124l1.016-.58.438-.274c.428-.28%201.072-.726%202.686-1.853%201.621-1.133%203.186-1.78%204.881-2.059%201.152-.19%201.974-.213%203.814-.138l.02-1.907z'%3e%3c/path%3e%3c/svg%3e";function G0(t){const i=ot();return i==="/"?t.replace("/agents/","/"):t.replace("/agents/",`${i}/`)}const X0={anthropic:U0,openai:wt,"openai-sdk":wt,google:R0,meta:jt,"meta-llama":jt,nvidia:N0,alibaba:B0,deepseek:q0,qwen:F0,minimax:z0,moonshotai:H0,"x-ai":W0,"z-ai":J0,zai:Z0,exaone:K0,openrouter:oo},Y0=new Proxy(X0,{get(t,i){const n=t[i];return n?G0(n):void 0}});function Q0(t){if(t&&t.includes("/"))return t.split("/")[0].toLowerCase()}function ut(t){return Y0[t.toLowerCase()]}function Qe(t,i){const n=Q0(t);if(n){const u=ut(n);if(u)return u}if(i)return ut(i)}const e2={class:"space-y-4"},t2=se({__name:"PromptModelSelect",props:{modelValue:{}},emits:["update:modelValue"],setup(t,{emit:i}){const n=i,u=v([]),l=v(!1),c=K(()=>u.value.map(p=>({value:p.id,label:p.name,description:p.model||p.provider,icon:Qe(p.model||p.name,p.provider_id||p.provider)}))),r=async()=>{l.value=!0;try{const p=await fetch(ae("/api/models"));if(p.ok){const f=await p.json();u.value=f.models||[]}}catch(p){console.error("Error fetching models:",p)}finally{l.value=!1}};return xe(()=>{r()}),(p,f)=>(o(),a("div",e2,[E(he,{"model-value":t.modelValue,"onUpdate:modelValue":f[0]||(f[0]=b=>n("update:modelValue",b)),options:c.value,label:"Model",placeholder:"Select a model for this prompt","search-placeholder":"Search models...",loading:l.value},null,8,["model-value","options","loading"])]))}}),o2=["data-property-id","data-nested-property-id"],l2={class:"p-3 space-y-3"},a2={class:"flex items-start gap-2"},s2={key:0,class:"drag-handle cursor-move text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400 mt-2"},n2={class:"flex-1 grid grid-cols-1 md:grid-cols-3 gap-2"},r2={class:"flex items-center gap-2 mt-2"},i2=["disabled"],d2={key:0,class:"ml-6"},u2={key:0,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg space-y-2"},c2={class:"flex items-center justify-between mb-2"},p2=["disabled"],m2={key:0,class:"space-y-1"},v2=["onClick","disabled"],f2={key:1,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},h2={class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"},g2={class:"space-y-2"},b2={class:"flex items-center justify-between"},x2=["disabled"],y2={class:"space-y-2"},k2={key:2,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},w2={key:0,class:"mb-2"},_2=["disabled"],$2={key:1,class:"space-y-2"},C2=se({__name:"PropertyEditor",props:Ne({propertyId:{},isNested:{type:Boolean,default:!1},parentId:{},disabled:{type:Boolean,default:!1},enableDrag:{type:Boolean,default:!0}},{modelValue:{required:!0},modelModifiers:{}}),emits:Ne(["remove","description-keydown","add-top-level"],["update:modelValue"]),setup(t,{emit:i}){const n=t,u=i,l=Je(t,"modelValue"),c=v(!1);v();const r=[{value:"string",label:"String",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z'/%3E%3C/svg%3E"},{value:"number",label:"Number",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 20l4-16m2 16l4-16M6 9h14M4 15h14'/%3E%3C/svg%3E"},{value:"boolean",label:"Boolean",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E"},{value:"object",label:"Object",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10'/%3E%3C/svg%3E"},{value:"array",label:"Array",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6h16M4 10h16M4 14h16M4 18h16'/%3E%3C/svg%3E"},{value:"enum",label:"Enum",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4'/%3E%3C/svg%3E"},{value:"anyOf",label:"Any Of (Multiple Types)",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E"}],p=K(()=>["object","array","enum","anyOf"].includes(l.value.type));ue(()=>l.value.type,async(g,m)=>{if(["object","array","enum","anyOf"].includes(g)&&(c.value=!0,g==="anyOf"&&!l.value.anyOf&&(l.value.anyOf=[]),g==="object"&&!l.value.properties&&(l.value.properties=[{id:crypto.randomUUID(),name:"property1",type:"string",description:""}]),g==="array"&&!l.value.items&&(l.value.items={id:crypto.randomUUID(),name:"",type:"string",description:""}),g==="enum"&&!l.value.enum&&(l.value.enum=["value1"])),m!==void 0){await ge();const w=n.isNested?`[data-nested-property-id="${n.propertyId}"] input[placeholder="Description"]`:`[data-property-id="${n.propertyId}"] input[placeholder="Description"]`,k=document.querySelector(w);k&&k.focus()}});const f=g=>{g.shiftKey&&l.value.type==="object"&&l.value.properties?h():u("add-top-level")},b=()=>{l.value.items||(l.value.items={id:crypto.randomUUID(),name:"",type:"string",description:""})},s=()=>{l.value.enum||(l.value.enum=[]),l.value.enum.push(`value${l.value.enum.length+1}`)},d=g=>{l.value.enum&&l.value.enum.splice(g,1)},h=async()=>{const g={id:crypto.randomUUID(),name:l.value.type==="anyOf"?"":`property${(l.value.properties?.length||l.value.anyOf?.length||0)+1}`,type:"string",description:""};l.value.type==="anyOf"?(l.value.anyOf||(l.value.anyOf=[]),l.value.anyOf.push(g)):(l.value.properties||(l.value.properties=[]),l.value.properties.push(g)),await ge();const m=document.querySelector(`[data-nested-property-id="${g.id}"] input[placeholder="Property name"]`);m&&(m.focus(),m.select())},$=g=>{l.value.type==="anyOf"&&l.value.anyOf?l.value.anyOf=l.value.anyOf.filter(m=>m.id!==g):l.value.properties&&(l.value.properties=l.value.properties.filter(m=>m.id!==g))};return(g,m)=>{const w=$o("PropertyEditor",!0);return o(),a("div",{"data-property-id":t.isNested?void 0:t.propertyId,"data-nested-property-id":t.isNested?t.propertyId:void 0,class:le(["border rounded-lg",t.isNested?"border-neutral-100 dark:border-neutral-900":"border-neutral-200 dark:border-neutral-800"])},[e("div",l2,[e("div",a2,[t.enableDrag?(o(),a("div",s2,[...m[10]||(m[10]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})],-1)])])):L("",!0),e("div",n2,[E(Ce,{modelValue:l.value.name,"onUpdate:modelValue":m[0]||(m[0]=k=>l.value.name=k),placeholder:"Property name",disabled:t.disabled},null,8,["modelValue","disabled"]),E(he,{modelValue:l.value.type,"onUpdate:modelValue":m[1]||(m[1]=k=>l.value.type=k),options:r,disabled:t.disabled},null,8,["modelValue","disabled"]),E(Ce,{modelValue:l.value.description,"onUpdate:modelValue":m[2]||(m[2]=k=>l.value.description=k),placeholder:"Description",disabled:t.disabled,onKeydown:m[3]||(m[3]=xt(we(k=>f(k),["prevent"]),["enter"]))},null,8,["modelValue","disabled"])]),e("div",r2,[p.value?(o(),a("button",{key:0,onClick:m[4]||(m[4]=k=>c.value=!c.value),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded transition-colors"},[(o(),a("svg",{class:le(["w-4 h-4 transition-transform",c.value?"rotate-90":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...m[11]||(m[11]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))])):L("",!0),e("button",{onClick:m[5]||(m[5]=k=>g.$emit("remove")),type:"button",disabled:t.disabled,class:"p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors disabled:opacity-50"},[...m[12]||(m[12]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,i2)])]),c.value&&p.value?(o(),a("div",d2,[l.value.type==="enum"?(o(),a("div",u2,[e("div",c2,[m[13]||(m[13]=e("h4",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400"}," Enum Values ",-1)),e("button",{onClick:s,type:"button",disabled:t.disabled,class:"px-2 py-0.5 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"}," Add Value ",8,p2)]),l.value.enum?(o(),a("div",m2,[(o(!0),a(pe,null,fe(l.value.enum,(k,O)=>(o(),a("div",{key:O,class:"flex items-center gap-2"},[E(Ce,{modelValue:l.value.enum[O],"onUpdate:modelValue":D=>l.value.enum[O]=D,placeholder:"Enum value",disabled:t.disabled,class:"flex-1"},null,8,["modelValue","onUpdate:modelValue","disabled"]),e("button",{onClick:D=>d(O),type:"button",disabled:t.disabled,class:"p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors disabled:opacity-50"},[...m[14]||(m[14]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,v2)]))),128))])):L("",!0)])):L("",!0),l.value.type==="object"||l.value.type==="anyOf"?(o(),a("div",f2,[e("h4",h2,C(l.value.type==="anyOf"?"Type Options":"Nested Properties"),1),e("div",g2,[e("div",b2,[e("button",{onClick:h,type:"button",disabled:t.disabled,class:"px-2 py-0.5 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"}," Add "+C(l.value.type==="anyOf"?"Type Option":"Property"),9,x2)]),e("div",y2,[(o(!0),a(pe,null,fe(l.value.type==="anyOf"?l.value.anyOf:l.value.properties,(k,O)=>(o(),ee(w,{key:k.id,modelValue:(l.value.type==="anyOf"?l.value.anyOf:l.value.properties)[O],"onUpdate:modelValue":D=>(l.value.type==="anyOf"?l.value.anyOf:l.value.properties)[O]=D,"property-id":k.id,"is-nested":!0,"parent-id":t.propertyId,disabled:t.disabled,"enable-drag":!1,onRemove:D=>$(k.id),onAddTopLevel:m[6]||(m[6]=D=>u("add-top-level"))},null,8,["modelValue","onUpdate:modelValue","property-id","parent-id","disabled","onRemove"]))),128))])])])):L("",!0),l.value.type==="array"?(o(),a("div",k2,[m[15]||(m[15]=e("h4",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"}," Array Item Type ",-1)),l.value.items?L("",!0):(o(),a("div",w2,[e("button",{onClick:b,type:"button",disabled:t.disabled,class:"px-2 py-0.5 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"}," Define Item Type ",8,_2)])),l.value.items?(o(),a("div",$2,[E(w,{modelValue:l.value.items,"onUpdate:modelValue":m[7]||(m[7]=k=>l.value.items=k),"property-id":l.value.items.id,"is-nested":!0,"parent-id":t.propertyId,disabled:t.disabled,"enable-drag":!1,onRemove:m[8]||(m[8]=k=>l.value.items=null),onAddTopLevel:m[9]||(m[9]=k=>u("add-top-level"))},null,8,["modelValue","property-id","parent-id","disabled"])])):L("",!0)])):L("",!0)])):L("",!0)])],10,o2)}}}),V2={class:"space-y-2"},S2=["disabled"],T2=se({__name:"PropertyList",props:Ne({disabled:{type:Boolean,default:!1},parentId:{},isNested:{type:Boolean,default:!1}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:Ne(["add-property","description-keydown"],["update:modelValue"]),setup(t,{expose:i,emit:n}){const u=t,l=n,c=Je(t,"modelValue"),r=v();let p=!1;xe(async()=>{}),Be(()=>{});const f=async()=>{if(p)return;p=!0;const s={id:crypto.randomUUID(),name:`property${c.value.length+1}`,type:"string",description:"",required:!1};c.value=[...c.value,s],await ge();const d=u.parentId?`[data-nested-property-id="${s.id}"]`:`[data-property-id="${s.id}"]`,h=document.querySelector(`${d} input[placeholder="Property name"]`);h&&(h.focus(),h.select()),l("add-property"),p=!1},b=s=>{c.value=c.value.filter(d=>d.id!==s)};return i({addProperty:f}),(s,d)=>(o(),a("div",V2,[e("div",{ref_key:"dragAreaRef",ref:r,class:"space-y-2"},[(o(!0),a(pe,null,fe(c.value,h=>(o(),ee(C2,{key:h.id,modelValue:c.value[c.value.indexOf(h)],"onUpdate:modelValue":$=>c.value[c.value.indexOf(h)]=$,"property-id":h.id,"is-nested":t.isNested,"parent-id":t.parentId,disabled:t.disabled,"enable-drag":!t.isNested,onRemove:$=>b(h.id),onAddTopLevel:d[0]||(d[0]=$=>s.$emit("add-property"))},null,8,["modelValue","onUpdate:modelValue","property-id","is-nested","parent-id","disabled","enable-drag","onRemove"]))),128))],512),e("div",{class:le(t.isNested?"mt-2":"mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-800")},[e("button",{onClick:f,type:"button",disabled:t.disabled,class:le(t.isNested?"px-2 py-1 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50":"w-full px-3 py-2 text-sm bg-neutral-50 dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800 text-neutral-700 dark:text-neutral-300 rounded transition-colors disabled:opacity-50 border border-dashed border-neutral-300 dark:border-neutral-700")},[...d[1]||(d[1]=[e("span",{class:"flex items-center justify-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),ye(" Add Property ")],-1)])],10,S2)],2)]))}}),M2={class:"space-y-4"},L2={key:0,class:"flex items-center justify-between"},I2={class:"text-sm font-medium"},E2={key:0,class:"text-red-500"},A2={class:"space-y-2 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4"},P2={key:0,class:"flex items-center justify-between mb-2"},O2={key:1,class:"text-center py-12"},j2=["disabled"],D2={class:"mt-4 text-center"},U2={key:3,class:"mt-4"},R2={class:"bg-neutral-50 dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4 overflow-x-auto"},N2={class:"text-xs leading-relaxed"},B2=["innerHTML"],lo=se({__name:"JSONSchemaInput",props:Ne({label:{},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1}},{modelValue:{required:!0,default:()=>({type:"object",properties:{},required:[]})},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const i=Je(t,"modelValue"),n=v([]),u=v(),l=v(!1),c=()=>{if(i.value?.properties){const g=[];i.value.required;for(const[m,w]of Object.entries(i.value.properties)){const k=w,O={id:crypto.randomUUID(),name:m,type:k.type||"string",description:k.description||""};k.enum&&(O.enum=k.enum),k.anyOf&&(O.type="anyOf",O.anyOf=r(k.anyOf)),k.type==="array"&&k.items&&(O.items=p(k.items)),k.type==="object"&&k.properties&&(O.properties=f(k.properties,k.required||[])),g.push(O)}n.value=g}},r=g=>g.map(m=>typeof m=="object"&&m.type?{id:crypto.randomUUID(),name:"",type:m.type,description:m.description||"",properties:m.properties?f(m.properties,m.required||[]):void 0,items:m.items?p(m.items):void 0,enum:m.enum}:{id:crypto.randomUUID(),name:"",type:"string",description:""}),p=g=>{const m={id:crypto.randomUUID(),name:"",type:g.type||"string",description:g.description||""};return g.enum&&(m.enum=g.enum),g.anyOf&&(m.type="anyOf",m.anyOf=r(g.anyOf)),g.type==="array"&&g.items&&(m.items=p(g.items)),g.type==="object"&&g.properties&&(m.properties=f(g.properties,g.required||[])),m},f=(g,m)=>{const w=[];for(const[k,O]of Object.entries(g)){const D=O,F={id:crypto.randomUUID(),name:k,type:D.type||"string",description:D.description||""};D.enum&&(F.enum=D.enum),D.anyOf&&(F.type="anyOf",F.anyOf=r(D.anyOf)),D.type==="array"&&D.items&&(F.items=p(D.items)),D.type==="object"&&D.properties&&(F.properties=f(D.properties,D.required||[])),w.push(F)}return w};c();const b=()=>{const g={type:"object",properties:{},required:[],additionalProperties:!1},{properties:m}=d(n.value);g.properties=m,g.required=Object.keys(m),i.value=g},s=g=>{const m={type:g.type==="anyOf"?void 0:g.type,description:g.description};if(g.type==="enum"&&g.enum&&(m.enum=g.enum,m.type="string"),g.type==="anyOf"&&g.anyOf&&(delete m.type,m.anyOf=g.anyOf.map(s)),g.type==="object"&&g.properties){const{properties:w}=d(g.properties);m.properties=w,m.required=Object.keys(w),m.additionalProperties=!1}return g.type==="array"&&g.items&&(m.items=s(g.items)),m},d=g=>{const m={},w=[];for(const k of g){const O={type:k.type==="anyOf"?void 0:k.type,description:k.description};if(w.push(k.name),k.type==="enum"&&k.enum&&(O.enum=k.enum,O.type="string"),k.type==="anyOf"&&k.anyOf&&k.anyOf.length>0&&(delete O.type,O.anyOf=k.anyOf.map(s)),k.type==="array"&&k.items&&(O.items=s(k.items)),k.type==="object"&&k.properties){const{properties:D}=d(k.properties);O.properties=D,O.required=Object.keys(D),O.additionalProperties=!1}m[k.name]=O}return{properties:m,required:w}};ue(n,()=>{b()},{deep:!0}),b();const h=K(()=>JSON.stringify(i.value,null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"]+)":/g,'<span class="text-blue-600 dark:text-blue-400">"$1"</span>:').replace(/:"([^"]*)"/g,':<span class="text-green-600 dark:text-green-400">"$1"</span>').replace(/:(\d+)/g,':<span class="text-yellow-600 dark:text-yellow-400">$1</span>').replace(/:(true|false)/g,':<span class="text-purple-600 dark:text-purple-400">$1</span>').replace(/:(null)/g,':<span class="text-red-600 dark:text-red-400">$1</span>')),$=async()=>{if(n.value.length===0){const g={id:crypto.randomUUID(),name:"property1",type:"string",description:""};n.value.push(g),await ge();const m=document.querySelector(`[data-property-id="${g.id}"] input[placeholder="Property name"]`);m&&(m.focus(),m.select())}else u.value&&u.value.addProperty()};return(g,m)=>(o(),a("div",M2,[t.label?(o(),a("div",L2,[e("label",I2,[ye(C(t.label)+" ",1),t.required?(o(),a("span",E2,"*")):L("",!0)])])):L("",!0),e("div",A2,[n.value.length>0?(o(),a("div",P2,[...m[2]||(m[2]=[e("h3",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"}," Properties ",-1)])])):L("",!0),n.value.length===0?(o(),a("div",O2,[m[4]||(m[4]=e("div",{class:"mb-4"},[e("svg",{class:"w-12 h-12 mx-auto text-neutral-400 dark:text-neutral-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})])],-1)),m[5]||(m[5]=e("p",{class:"text-neutral-500 dark:text-neutral-400 text-sm mb-4"}," No properties defined ",-1)),e("button",{onClick:$,type:"button",disabled:t.disabled,class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black rounded hover:bg-neutral-800 dark:hover:bg-neutral-200 transition-colors disabled:opacity-50 font-medium text-sm"},[...m[3]||(m[3]=[e("span",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),ye(" Add Property ")],-1)])],8,j2)])):L("",!0),n.value.length>0?(o(),ee(T2,{key:2,ref_key:"propertyListRef",ref:u,modelValue:n.value,"onUpdate:modelValue":m[0]||(m[0]=w=>n.value=w),disabled:t.disabled,onAddProperty:$},null,8,["modelValue","disabled"])):L("",!0),e("div",D2,[e("button",{onClick:m[1]||(m[1]=w=>l.value=!l.value),type:"button",class:"text-xs text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 hover:underline transition-colors"},C(l.value?"Hide":"Show")+" JSON Schema ",1)]),l.value?(o(),a("div",U2,[e("div",R2,[e("pre",N2,[e("code",{class:"font-mono",innerHTML:h.value},null,8,B2)])])])):L("",!0)])]))}}),q2={class:"prompt-input-container relative"},F2=["contenteditable","data-placeholder"],z2={class:"bg-white dark:bg-black border-2 border-black dark:border-neutral-300 rounded-lg overflow-hidden min-w-[240px] max-w-[320px]"},H2={key:0,class:"p-3 text-sm text-neutral-500"},W2={key:1,class:"p-3 text-sm text-neutral-500"},J2={key:2,class:"max-h-[220px] overflow-y-auto"},Z2=["onClick"],K2={class:"font-medium flex items-center gap-2"},G2=["title"],X2={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},Y2={key:1,class:"text-xs text-red-600 dark:text-red-400 mt-1"},Q2={class:"text-xs mt-1"},ep=se({__name:"PromptInput",props:{modelValue:{},search:{},placeholder:{default:"Type @ to insert variables or prompts..."},disabled:{type:Boolean,default:!1},maxLength:{},allowedTypes:{default:()=>["variable","prompt"]}},emits:["update:modelValue","segment-click"],setup(t,{emit:i}){const n=t,u=i,l=v(),c=v(),r=Co({segments:n.modelValue&&n.modelValue.length?n.modelValue:[{type:"string",value:""}],dialogOpen:!1,dialogPosition:{x:0,y:0},searchQuery:"",searchResults:[],selectedIndex:0,isSearching:!1,atTriggerIndex:-1,isComposing:!1,ignoreNextWatch:!1}),p=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),f=y=>y.type==="string"?"":`@${y.type==="variable"?y.label||y.value:y.label||y.id}`,b=()=>{const y=window.getSelection();if(!y||!y.rangeCount||!l.value)return null;const x=y.getRangeAt(0);let V=0;const _=Array.from(l.value.childNodes);for(let T=0;T<_.length;T++){const S=_[T];if(S===x.startContainer||S.contains?.(x.startContainer)){if(S.nodeType===Node.TEXT_NODE)return{segmentIndex:V,offset:x.startOffset};if(S.nodeType===Node.ELEMENT_NODE&&S.classList?.contains("prompt-tag"))return{segmentIndex:V,offset:0}}(S.nodeType===Node.TEXT_NODE||S.nodeType===Node.ELEMENT_NODE&&S.classList?.contains("prompt-tag"))&&V++}return{segmentIndex:0,offset:0}},s=()=>{if(!l.value)return;const y=r.segments.map(x=>{if(x.type==="string")return(x.value||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>")||"";{const V=x._uid||(x._uid=p()),_=f(x),T=x.type==="variable"?{type:"variable",value:x.value,label:x.label,schema:x.schema,meta:x.meta}:{type:"prompt",id:x.id,label:x.label,schema:x.schema,meta:x.meta},S=encodeURIComponent(JSON.stringify(T)),P=x.type==="prompt"&&x.meta&&!x.meta.isValid,J=P?'<span class="prompt-tag-warning" title="'+(x.meta.validationMessage||"").replace(/"/g,""")+'">⚠️</span>':"";return`<span class="prompt-tag prompt-tag-clickable${P?" prompt-tag-invalid":""}" contenteditable="false" data-segment-uid="${V}" data-segment="${S}">${_}${J}</span>`}}).join("");l.value.innerHTML=y||"<br>"},d=()=>{const y=[];for(const x of r.segments)x.type==="string"&&y.length>0&&y[y.length-1].type==="string"?y[y.length-1].value+=x.value:y.push(x);r.segments=y.length?y:[{type:"string",value:""}]},h=y=>{const x=y.dataset.segmentUid;let V=r.segments.find(_=>_._uid===x);if(!V){const _=y.dataset.segment;if(_)try{const T=JSON.parse(decodeURIComponent(_));T&&(T.type==="variable"||T.type==="prompt")&&(V=T.type==="variable"?{type:"variable",value:T.value,label:T.label,schema:T.schema,meta:T.meta,_uid:x}:{type:"prompt",id:T.id,label:T.label,schema:T.schema,meta:T.meta,_uid:x})}catch{}}return V||null},$=y=>{const x=y.target;if(x.classList?.contains("prompt-tag")){const V=h(x);V&&u("segment-click",V,y)}},g=y=>{if(r.isComposing)return;const x=y.target,V=[];let _="";const T=()=>{_.length>0&&(V.push({type:"string",value:_}),_="")},S=A=>{if(A.nodeType===Node.TEXT_NODE){const I=(A.textContent||"").replace(/\u00A0/g," ");_+=I;return}if(A.nodeType===Node.ELEMENT_NODE){const I=A;if(I.classList?.contains("prompt-tag")){T();const oe=h(I);oe&&V.push(oe);return}if(I.tagName==="BR"){_+=`
|
|
9
|
-
`;return}const
|
|
10
|
-
`);return}},
|
|
11
|
-
`)}];
|
|
12
|
-
`)||re.length>r.searchQuery.length+5?k():(r.searchQuery=re,F(re))}else k()}else k()},w=async()=>{r.dialogOpen=!0,r.selectedIndex=0,await ge(),O()},k=()=>{r.dialogOpen=!1,r.searchResults=[],r.searchQuery="",r.atTriggerIndex=-1,r.isSearching=!1},O=()=>{if(!c.value||!l.value)return;const y=window.getSelection();if(!y||!y.rangeCount)return;const V=y.getRangeAt(0).getBoundingClientRect(),_=l.value.getBoundingClientRect();r.dialogPosition={x:V.left-_.left,y:V.bottom-_.top+4}};let D=null;const F=async y=>{if(!n.search){r.searchResults=[];return}D&&clearTimeout(D),r.isSearching=!0,D=setTimeout(async()=>{try{const x=await n.search(y);r.searchResults=(x||[]).filter(V=>n.allowedTypes?.includes(V.type))}catch(x){console.error("Search error:",x),r.searchResults=[]}finally{r.isSearching=!1}},200)},X=y=>y.type==="variable"?{type:"variable",value:y.value??y.id??"",label:y.label,schema:y.schema,_uid:p(),meta:y.meta}:{type:"prompt",id:y.id??y.value??"",label:y.label,schema:y.schema,_uid:p(),meta:y.meta},te=y=>{if(r.atTriggerIndex<0||!l.value)return;const x=window.getSelection();if(!x||!x.rangeCount)return;const V=x.getRangeAt(0);if(V.startContainer.nodeType!==Node.TEXT_NODE)return;const _=V.startContainer,T=_.data.slice(0,r.atTriggerIndex),S=_.data.slice(V.startOffset),P=document.createElement("span"),J=X(y),re=J.type==="prompt"&&J.meta&&!J.meta.isValid;P.className=`prompt-tag${re?" prompt-tag-invalid":""}`,P.setAttribute("contenteditable","false");const A=J._uid||(J._uid=p());P.dataset.segmentUid=A;const I=J.type==="variable"?{type:"variable",value:J.value,label:J.label,schema:J.schema}:{type:"prompt",id:J.id,label:J.label,schema:J.schema};if(P.dataset.segment=encodeURIComponent(JSON.stringify(I)),P.textContent=f(J),re){const ve=document.createElement("span");ve.className="prompt-tag-warning",ve.textContent="⚠️",ve.setAttribute("title",J.meta.validationMessage||"Validation error"),P.appendChild(ve)}const M=_.parentNode,oe=document.createTextNode(S),Y=document.createTextNode(T);M.insertBefore(Y,_),M.insertBefore(P,_),M.insertBefore(oe,_),M.removeChild(_),k(),g({target:l.value});const ie=window.getSelection();if(ie){const ve=document.createRange();ve.setStart(oe,0),ve.collapse(!0),ie.removeAllRanges(),ie.addRange(ve)}l.value.focus()},R=y=>{if((y.key==="ArrowLeft"||y.key==="ArrowRight")&&setTimeout(()=>m(),0),r.dialogOpen)y.key==="ArrowDown"?(y.preventDefault(),r.selectedIndex=Math.min(r.selectedIndex+1,r.searchResults.length-1)):y.key==="ArrowUp"?(y.preventDefault(),r.selectedIndex=Math.max(r.selectedIndex-1,0)):y.key==="Enter"?(y.preventDefault(),r.searchResults[r.selectedIndex]&&te(r.searchResults[r.selectedIndex])):(y.key==="Escape"||y.key==="Esc")&&(y.preventDefault(),k());else if(y.key==="Backspace"||y.key==="Delete"){const x=b();if(y.key==="Backspace"){const V=window.getSelection();if(V&&V.rangeCount){const _=V.getRangeAt(0);if(_.collapsed&&_.startContainer.nodeType===Node.TEXT_NODE&&_.startOffset===0){let T=_.startContainer;for(;T&&T!==l.value;){const S=T.previousSibling;if(S&&S.nodeType===Node.ELEMENT_NODE&&S.classList?.contains("prompt-tag")){y.preventDefault(),S.parentNode?.removeChild(S),g({target:l.value});return}T=T.parentNode}}}}if(!x)return;if(y.key==="Backspace"&&x.offset===0&&x.segmentIndex>0)r.segments[x.segmentIndex-1].type!=="string"&&(y.preventDefault(),r.segments.splice(x.segmentIndex-1,1),d(),B(),s());else if(y.key==="Delete"&&x.segmentIndex<r.segments.length-1){const V=r.segments[x.segmentIndex];V.type==="string"&&(V.value?.length??0)===x.offset&&r.segments[x.segmentIndex+1].type!=="string"&&(y.preventDefault(),r.segments.splice(x.segmentIndex+1,1),d(),B(),s())}}},j=y=>{y.preventDefault();const x=y.clipboardData?.getData("text/plain")||"";document.execCommand("insertText",!1,x)},W=y=>{if(!r.dialogOpen)return;const x=c.value;x&&(x.contains(y.target)||k())},B=()=>{r.ignoreNextWatch=!0;const y=r.segments.map(x=>{const{_uid:V,..._}=x||{};return _});u("update:modelValue",y)},N=()=>{const y=window.getSelection();if(!y||!l.value)return;const x=y.anchorNode;x&&l.value.contains(x)&&m()},U=y=>{(y.key==="Escape"||y.key==="Esc")&&r.dialogOpen&&(y.preventDefault(),k())};return xe(()=>{n.modelValue&&n.modelValue.length&&(r.segments=JSON.parse(JSON.stringify(n.modelValue))),s(),document.addEventListener("mousedown",W),document.addEventListener("selectionchange",N),document.addEventListener("keydown",U,!0)}),Be(()=>{document.removeEventListener("mousedown",W),document.removeEventListener("selectionchange",N),document.removeEventListener("keydown",U,!0)}),ue(()=>n.modelValue,y=>{if(r.ignoreNextWatch){r.ignoreNextWatch=!1;return}y&&(r.segments=JSON.parse(JSON.stringify(y)),s())},{deep:!0}),(y,x)=>(o(),a("div",q2,[e("div",{ref_key:"editorRef",ref:l,contenteditable:!t.disabled,onInput:g,onKeydown:R,onPaste:j,onClick:$,onKeyup:x[0]||(x[0]=V=>{V.key==="Escape"?(V.preventDefault(),k()):(V.key==="ArrowLeft"||V.key==="ArrowRight")&&m()}),onCompositionstart:x[1]||(x[1]=V=>r.isComposing=!0),onCompositionend:x[2]||(x[2]=V=>r.isComposing=!1),class:le(["prompt-input-editor","min-h-[100px] p-3 border-2 rounded-lg","border-black dark:border-neutral-300","bg-white dark:bg-black","focus:outline-none focus:ring-2 focus:ring-black dark:focus:ring-white",t.disabled?"opacity-50 cursor-not-allowed":""]),"data-placeholder":t.placeholder},[Se(e("div",null,[He(y.$slots,"segment",{segment:null},void 0,!0)],512),[[Ye,!1]])],42,F2),r.dialogOpen?(o(),a("div",{key:0,ref_key:"dialogRef",ref:c,class:"absolute z-50",style:pt({left:`${r.dialogPosition.x}px`,top:`${r.dialogPosition.y}px`})},[E(tt,{"offset-x":2,"offset-y":2,intensity:.3},{default:de(()=>[e("div",z2,[r.isSearching?(o(),a("div",H2," Searching... ")):r.searchResults.length===0?(o(),a("div",W2," No results found ")):(o(),a("div",J2,[(o(!0),a(pe,null,fe(r.searchResults,(V,_)=>(o(),a("button",{key:V.id||V.value||_,type:"button",onClick:T=>te(V),class:le(["w-full px-3 py-2 text-left text-sm","hover:bg-neutral-100 dark:hover:bg-neutral-900","focus:bg-neutral-100 dark:focus:bg-neutral-900 focus:outline-none",r.selectedIndex===_?"bg-neutral-100 dark:bg-neutral-900":""])},[e("div",K2,[ye(C(V.label||V.id||V.value)+" ",1),V.type==="prompt"&&V.meta&&!V.meta.isValid?(o(),a("span",{key:0,title:V.meta.validationMessage,class:"text-red-500"},"⚠️",8,G2)):L("",!0)]),V.description?(o(),a("div",X2,C(V.description),1)):L("",!0),V.type==="prompt"&&V.meta&&!V.meta.isValid?(o(),a("div",Y2,C(V.meta.validationMessage),1)):L("",!0),e("div",Q2,[e("span",{class:le(["inline-block px-1.5 py-0.5 rounded",V.type==="variable"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-purple-100 dark:bg-purple-900 text-purple-700 dark:text-purple-300"])},C(V.type),3)])],10,Z2))),128))]))])]),_:1})],4)):L("",!0)]))}}),ao=Ze(ep,[["__scopeId","data-v-7ee6148f"]]);function Dt(t,i){if(!i||!i.properties||Object.keys(i.properties).length===0)return!0;if(!t||!t.properties)return Object.keys(i.properties);const n=[],u=t.properties||{},l=i.properties||{};return(i.required||[]).forEach(r=>{r in u||n.push(r)}),Object.keys(l).forEach(r=>{!(r in u)&&!n.includes(r)&&n.push(r)}),n.length>0?n:!0}function Ut(t){return t.length===0?"":t.length===1?`Missing required field: ${t[0]}`:`Missing required fields: ${t.join(", ")}`}const tp={class:"space-y-4"},op=se({__name:"PromptTemplate",props:{promptText:{},beforeTool:{},afterTool:{},requiredSchema:{},currentPromptName:{}},emits:["update:promptText","update:beforeTool","update:afterTool"],setup(t,{emit:i}){const n=t,u=i,l=v([]),c=v(!1),r=h=>h.type==="text"?{type:"string",value:h.content||""}:h.type==="include"?{type:"prompt",id:h.prompt||"",label:h.prompt||""}:h.type==="string"?{type:"string",value:h.value||""}:h.type==="prompt"?{type:"prompt",id:h.id||"",label:h.label||h.id||""}:h.type==="variable"?{type:"variable",value:h.value||"",label:h.label||h.value||""}:{type:"string",value:""},p=K(()=>{if(!n.promptText)return[{type:"string",value:""}];let h=[];try{const g=JSON.parse(n.promptText);Array.isArray(g)?h=g.map(r):h=[{type:"string",value:n.promptText}]}catch{h=[{type:"string",value:n.promptText}]}const $=n.requiredSchema?JSON.parse(n.requiredSchema):{};return h.map(g=>{if(g.type==="prompt"&&g.schema){const m=Dt($,g.schema),w=m===!0,k=w?[]:m;return{...g,meta:{isValid:w,missingFields:k,validationMessage:w?"":Ut(k)}}}return g})}),f=K(()=>{try{const h=JSON.parse(n.requiredSchema);if(h.properties&&typeof h.properties=="object")return Object.keys(h.properties)}catch{return[]}return[]}),b=async h=>{c.value=!0;try{const $=new URLSearchParams;h&&$.set("search",h);const g=await fetch(ae(`/api/prompts${$.toString()?"?"+$.toString():""}`));if(g.ok){const m=await g.json();l.value=m.prompts||[]}}catch($){console.error("Error fetching prompts:",$)}finally{c.value=!1}},s=async h=>{const $=[];return f.value.forEach(g=>{(!h||g.toLowerCase().includes(h.toLowerCase()))&&$.push({type:"variable",value:g,label:g,description:"Schema property"})}),h!==void 0&&await b(h),l.value.forEach(g=>{if(!(n.currentPromptName&&g.name===n.currentPromptName)&&(!h||g.name.toLowerCase().includes(h.toLowerCase()))){const m=n.requiredSchema?JSON.parse(n.requiredSchema):{},w=Dt(m,g.required_schema),k=w===!0,O=k?[]:w;$.push({type:"prompt",id:g.name,label:g.name,description:g.tool_description||"Available prompt",schema:g.required_schema,meta:{isValid:k,missingFields:O,validationMessage:k?"":Ut(O)}})}}),$},d=h=>{const $=h.map(g=>{const{type:m,value:w,label:k,id:O,schema:D}=g;return m==="string"?{type:m,value:w||""}:m==="variable"?{type:m,value:w||"",label:k}:m==="prompt"?{type:m,id:O||"",label:k,schema:D}:g});u("update:promptText",JSON.stringify($))};return xe(()=>{b()}),(h,$)=>(o(),a("div",tp,[e("div",null,[$[0]||($[0]=e("label",{class:"block text-sm font-medium mb-2"},"Prompt Template",-1)),$[1]||($[1]=e("p",{class:"text-sm text-neutral-600 dark:text-neutral-400 mb-2"}," Type @ to insert schema properties or other prompts ",-1)),E(ao,{"model-value":p.value,"onUpdate:modelValue":d,search:s,placeholder:"Enter your prompt template... Type @ to insert variables or prompts"},null,8,["model-value"])])]))}}),lp={class:"space-y-3"},ap={class:"space-y-2 pl-4 border-l-2 border-accent-200 dark:border-accent-700"},sp={class:"space-y-1"},np={class:"space-y-2 pl-4 border-l-2 border-neutral-200 dark:border-neutral-700"},rp=se({__name:"PromptToolOptions",props:{toolName:{},toolConfig:{},disabled:{type:Boolean}},emits:["update:option"],setup(t,{emit:i}){const n=t,u=i,l=v(null),c=v(!0),r=K(()=>l.value?.properties?Object.entries(l.value.properties).map(([b,s])=>({value:b,label:b,description:s.description||s.type||""})):[]),p=async()=>{try{const b=await fetch(ae(`/api/prompts/${encodeURIComponent(n.toolName)}`));if(b.ok){const s=await b.json();s?.prompt?.required_schema&&(l.value=s.prompt.required_schema)}}catch(b){console.error("Error fetching prompt schema:",b)}finally{c.value=!1}};xe(()=>{p()});const f=(b,s)=>{u("update:option",b,s)};return(b,s)=>(o(),a("div",lp,[e("div",ap,[s[6]||(s[6]=e("p",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"}," Initialization Options: ",-1)),e("div",sp,[s[4]||(s[4]=e("label",{class:"block text-xs font-medium text-neutral-700 dark:text-neutral-300"}," User message property ",-1)),E(he,{"model-value":t.toolConfig.init_user_message_property||"","onUpdate:modelValue":s[0]||(s[0]=d=>f("init_user_message_property",d||null)),placeholder:"Don't inject a user message",options:r.value,disabled:t.disabled||c.value||r.value.length===0,loading:c.value},null,8,["model-value","options","disabled","loading"]),s[5]||(s[5]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400"}," Select which argument property should be used as the most recent user message for this sub-prompt. If not set no additional user message will be injected. ",-1))])]),e("div",np,[s[7]||(s[7]=e("p",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"}," Sub-Prompt Response Options: ",-1)),E(Te,{"model-value":t.toolConfig.include_text_response,"onUpdate:modelValue":s[1]||(s[1]=d=>f("include_text_response",d)),label:"Include text response","help-text":"Include the final text content from the sub-prompt",disabled:t.disabled},null,8,["model-value","disabled"]),E(Te,{"model-value":t.toolConfig.include_tool_calls,"onUpdate:modelValue":s[2]||(s[2]=d=>f("include_tool_calls",d)),label:"Include tool calls and responses","help-text":"Include tool calls executed by the sub-prompt and their responses",disabled:t.disabled},null,8,["model-value","disabled"]),E(Te,{"model-value":t.toolConfig.include_errors,"onUpdate:modelValue":s[3]||(s[3]=d=>f("include_errors",d)),label:"Include errors","help-text":"Include error information if the sub-prompt fails",disabled:t.disabled},null,8,["model-value","disabled"])])]))}});async function qe(t,i={}){const n=localStorage.getItem("auth_token"),u={"Content-Type":"application/json",...i.headers};n&&(u.Authorization=`Bearer ${n}`);const l=t.startsWith("/")?t:`/${t}`,c=await fetch(ae(`/api${l}`),{...i,headers:u});if(c.status===401)throw localStorage.removeItem("auth_token"),window.location.href=ae("/login"),new Error("Unauthorized");return c}const ip={class:"space-y-4"},dp={class:"block text-sm font-medium mb-2"},up={key:0,class:"text-red-500"},cp={class:"flex items-start justify-between"},pp={class:"flex items-center gap-2 flex-1"},mp={class:"flex-1"},vp={class:"font-medium text-sm"},fp={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mt-1"},hp=["onClick","disabled","aria-label"],gp={key:1,class:"text-xs text-red-500 dark:text-red-400 mt-1"},bp={key:0,class:"text-center py-8 text-sm text-neutral-500 dark:text-neutral-400 border border-dashed border-neutral-300 dark:border-neutral-600 rounded-lg"},xp=se({__name:"ToolSelectorWithOptions",props:Ne({label:{default:"Available Tools"},placeholder:{default:"Select a tool"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const i=Je(t,"modelValue"),n=v([]),u=v(!1),l=v();Ht(async()=>{l.value,await ge(),l.value&&i.value.length>0&&await Wt({parent:l,values:i,dragHandle:".drag-handle"})});const c=K(()=>{const d=new Set(i.value.map(h=>h.name));return n.value.filter(h=>!d.has(h.name)).map(h=>{let $=h.name;return h.type==="prompt"?$=`${h.name} (prompt)`:h.type==="mcp"&&($=`${h.name} (mcp)`),{value:h.name,label:$,description:h.description}})}),r=async()=>{u.value=!0;try{const d=await qe("/tools");if(d.ok){const h=await d.json();n.value=Object.entries(h).map(([$,g])=>({name:$,description:g.description||"",type:g.type,model:g.model}))}}catch(d){console.error("Error fetching tools:",d)}finally{u.value=!1}},p=d=>{d&&(i.value.find(h=>h.name===d)||(i.value=[...i.value,{name:d,include_text_response:!0,include_tool_calls:!0,include_errors:!0,init_user_message_property:null}]))},f=d=>{i.value=i.value.filter(h=>h.name!==d)},b=d=>n.value.find(h=>h.name===d),s=(d,h,$)=>{i.value=i.value.map(g=>g.name===d?{...g,[h]:$}:g)};return xe(()=>{r()}),(d,h)=>(o(),a("div",ip,[e("div",null,[e("label",dp,[ye(C(t.label)+" ",1),t.required?(o(),a("span",up,"*")):L("",!0)]),i.value.length>0?(o(),a("div",{key:0,class:"space-y-3 mb-4",ref_key:"dragAreaRef",ref:l},[(o(!0),a(pe,null,fe(i.value,$=>(o(),a("div",{key:$.name,class:"border border-neutral-300 dark:border-neutral-600 rounded-lg p-4"},[e("div",cp,[e("div",pp,[h[0]||(h[0]=e("div",{class:"drag-handle cursor-move text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})])],-1)),e("div",mp,[e("h4",vp,C($.name),1),b($.name)?.description?(o(),a("p",fp,C(b($.name)?.description),1)):L("",!0)])]),e("button",{onClick:g=>f($.name),type:"button",disabled:t.disabled,class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors text-neutral-500 hover:text-red-500","aria-label":`Remove ${$.name}`},[...h[1]||(h[1]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,hp)]),b($.name)?.type==="prompt"?(o(),ee(rp,{key:0,"tool-name":$.name,"tool-config":$,disabled:t.disabled,"onUpdate:option":(g,m)=>s($.name,g,m)},null,8,["tool-name","tool-config","disabled","onUpdate:option"])):L("",!0)]))),128))],512)):L("",!0),E(he,{"model-value":"","onUpdate:modelValue":p,placeholder:i.value.length>0?"Add another tool...":t.placeholder,"search-placeholder":"Search tools...",options:c.value,disabled:t.disabled||u.value||c.value.length===0,loading:u.value},null,8,["placeholder","options","disabled","loading"]),t.error?(o(),a("p",gp,C(t.error),1)):L("",!0)]),i.value.length===0&&!u.value&&c.value.length===0?(o(),a("div",bp," No tools available. Create tools in your agentbuilder/tools directory. ")):L("",!0)]))}}),yp={class:"space-y-2"},kp={key:0,class:"space-y-2"},wp={key:0,class:"block text-sm font-medium"},_p={key:0,class:"text-red-500"},$p=["src","alt"],Cp={class:"flex-1 text-sm"},Vp={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 ml-1"},Sp=["onClick","aria-label"],Tp={key:1,class:"text-xs text-red-500 dark:text-red-400"},ct=se({__name:"MultipleSelectionsInput",props:Ne({label:{},placeholder:{default:"Select an option"},searchPlaceholder:{default:"Search..."},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},options:{},addLabel:{default:"Add another"},loading:{type:Boolean,default:!1}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:Ne(["removeItem"],["update:modelValue"]),setup(t,{emit:i}){const n=t,u=i,l=Je(t,"modelValue"),c=v();Ht(async()=>{c.value,await ge(),await Wt({parent:c,values:l,dragHandle:".drag-handle"})});const r=K(()=>Array.isArray(l.value)?l.value.length>0&&typeof l.value[0]=="object"?l.value:l.value.map(s=>{const d=n.options.find(h=>h.value===s);return{id:s,label:d?.label||s,description:d?.description,icon:d?.icon}}):[]),p=K(()=>{const s=r.value.map(d=>d.id);return n.options.filter(d=>!s.includes(d.value))}),f=s=>{if(!s)return;const d=n.options.find(h=>h.value===s);if(d)if(l.value.length===0||typeof l.value[0]=="string")l.value=[...l.value,s];else{const h={id:s,label:d.label,description:d.description,icon:d.icon};l.value=[...l.value,h]}},b=s=>{typeof l.value[0]=="string"?l.value=l.value.filter(d=>d!==s):l.value=l.value.filter(d=>d.id!==s),u("removeItem",s)};return(s,d)=>(o(),a("div",yp,[r.value.length>0?(o(),a("div",kp,[t.label?(o(),a("label",wp,[ye(C(t.label)+" ",1),t.required?(o(),a("span",_p,"*")):L("",!0)])):L("",!0),e("div",{class:"space-y-1",ref_key:"dragAreaRef",ref:c},[(o(!0),a(pe,null,fe(r.value,h=>(o(),a("div",{key:h.id,class:le(["flex items-center gap-2 px-3 py-2 bg-neutral-50 dark:bg-neutral-900 rounded border","border-neutral-200 dark:border-neutral-800",t.disabled?"opacity-50":""])},[d[1]||(d[1]=e("div",{class:"drag-handle cursor-move text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})])],-1)),h.icon?(o(),a("img",{key:0,src:h.icon,alt:h.label,class:"w-4 h-4 flex-shrink-0"},null,8,$p)):L("",!0),e("span",Cp,[ye(C(h.label)+" ",1),h.description?(o(),a("span",Vp," ("+C(h.description)+") ",1)):L("",!0)]),t.disabled?L("",!0):(o(),a("button",{key:1,onClick:$=>b(h.id),type:"button",class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors","aria-label":`Remove ${h.label}`},[...d[0]||(d[0]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Sp))],2))),128))],512)])):L("",!0),E(he,{"model-value":"","onUpdate:modelValue":f,label:r.value.length>0?t.addLabel:t.label,options:p.value,placeholder:t.placeholder,"search-placeholder":t.searchPlaceholder,disabled:t.disabled||p.value.length===0,loading:t.loading},null,8,["label","options","placeholder","search-placeholder","disabled","loading"]),t.error?(o(),a("p",Tp,C(t.error),1)):L("",!0)]))}}),Mp={key:2,class:"text-xs text-red-500 dark:text-red-400 mt-1"},Lp=se({__name:"AgentSelectorInput",props:Ne({label:{default:"Handoff Agents"},placeholder:{default:"Select an agent"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},allowMultiple:{type:Boolean,default:!0},agentType:{default:"ai_human"}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const i=t,n=Je(t,"modelValue"),u=v([]),l=v(!1),c=K(()=>u.value.map(f=>({value:f.id,label:f.title,description:f.tool_description||`Handoff to ${f.title} agent`}))),r=async()=>{l.value=!0;try{const f=ae(`/api/agents${i.agentType?`?type=${i.agentType}`:""}`),b=await fetch(f);if(b.ok){const s=await b.json();u.value=s.agents||[]}}catch(f){console.error("Error fetching agents:",f)}finally{l.value=!1}},p=f=>{};return xe(()=>{r()}),ue(()=>i.allowMultiple,()=>{i.allowMultiple&&typeof n.value=="string"?n.value=n.value?[n.value]:[]:!i.allowMultiple&&Array.isArray(n.value)&&(n.value=n.value[0]||"")},{immediate:!0}),(f,b)=>(o(),a(pe,null,[t.allowMultiple?(o(),ee(ct,{key:0,modelValue:n.value,"onUpdate:modelValue":b[0]||(b[0]=s=>n.value=s),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search agents...",error:t.error,required:t.required,disabled:t.disabled,options:c.value,loading:l.value,"add-label":"Add another agent",onRemoveItem:p},null,8,["modelValue","label","placeholder","error","required","disabled","options","loading"])):(o(),ee(he,{key:1,modelValue:n.value,"onUpdate:modelValue":b[1]||(b[1]=s=>n.value=s),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search agents...",options:c.value,disabled:t.disabled,loading:l.value},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!t.allowMultiple&&t.error?(o(),a("p",Mp,C(t.error),1)):L("",!0)],64))}}),Ip={key:0,class:"min-h-[400px] flex items-center justify-center"},Ep={key:1,class:"space-y-6 pr-2 pb-4"},Ap={class:"space-y-4"},Pp={class:"space-y-4"},Op={class:"flex justify-between"},jp={class:"flex gap-2"},Dp=["disabled"],so=se({__name:"PromptModal",props:{modelValue:{type:Boolean},editPrompt:{},mode:{}},emits:["update:modelValue","save"],setup(t,{emit:i}){const n=t,u=i,l=K(()=>n.mode==="edit"),c=v(!1),r=K(()=>k.value.length===1),p=v(""),f=v(""),b=v(""),s=v(""),d=v({type:"object",properties:{},required:[],additionalProperties:!1}),h=v(""),$=v(!1),g=v(!1),m=v(""),w=v(""),k=v([]),O=v([]),D=v(!1),F=v("auto"),X=v(null),te=v(null),R=v(!1),j=v(!1),W=K({get:()=>X.value||"",set:V=>X.value=V||null}),B=K({get:()=>F.value,set:V=>F.value=V}),N=()=>{f.value="",p.value="",b.value="",s.value="",d.value={type:"object",properties:{},required:[],additionalProperties:!1},h.value="",$.value=!1,g.value=!1,m.value="",w.value="",k.value=[],O.value=[],D.value=!1,F.value="auto",X.value=null,te.value=null,R.value=!1,j.value=!1},U=async()=>{if(n.editPrompt?.id){c.value=!0;try{const V=await qe(`/prompts/${n.editPrompt.id}`);if(V.ok){const _=await V.json(),T=_.prompt||_;f.value=T.name||"",p.value=T.name||"",b.value=T.tool_description||"",s.value=T.model_id||"";let S=T.required_schema;if(typeof S=="string")try{S=JSON.parse(S)}catch{S=null}d.value=S||{type:"object",properties:{},required:[],additionalProperties:!1},h.value=T.prompt||"",$.value=T.include_chat||!1,g.value=T.include_past_tools||!1,m.value=T.before_tool||"",w.value=T.after_tool||"";const P=T.tools||[];k.value=P.map(re=>typeof re=="string"?{name:re,include_text_response:!0,include_tool_calls:!0,include_errors:!0,init_user_message_property:null}:re),O.value=T.prompts||T.handoff_agents||[],D.value=T.parallel_tool_calls||!1,F.value=T.tool_choice||"auto";const J=T.reasoning||{};X.value=J.effort||T.reasoning_effort||null,te.value=J.maxTokens||T.reasoning_max_tokens||null,R.value=J.exclude||T.reasoning_exclude||!1,j.value=T.include_reasoning||!1}}catch(V){console.error("Error loading prompt data:",V)}finally{c.value=!1}}},y=async()=>{const V=/^[a-z][a-z0-9_]*$/;if(!f.value||!V.test(f.value)){alert("Please enter a valid name (lowercase letters, numbers, and underscores only, must start with a letter)");return}if(!b.value){alert("Please enter a description");return}if(!s.value){alert("Please select a model");return}if(!h.value){alert("Please enter the prompt template");return}const _={name:f.value,tool_description:b.value,prompt:h.value,required_schema:d.value,model_id:s.value,include_chat:$.value,include_past_tools:g.value,before_tool:m.value||null,after_tool:w.value||null,parallel_tool_calls:D.value,tool_choice:F.value,tools:k.value,handoff_agents:O.value,reasoning_effort:X.value,reasoning_max_tokens:te.value,reasoning_exclude:R.value,include_reasoning:j.value};l.value&&n.editPrompt?.id&&(_.id=n.editPrompt.id,p.value&&p.value!==f.value&&(_.originalName=p.value)),u("save",_),N(),u("update:modelValue",!1)},x=()=>{N(),u("update:modelValue",!1)};return ue(()=>k.value.length,V=>{F.value==="function"&&V!==1&&(F.value="auto")}),ue(()=>n.modelValue,async V=>{V&&(l.value?(N(),await ge(),await U()):N())}),ue(()=>n.editPrompt,async V=>{V&&l.value&&n.modelValue&&(await ge(),await U())},{immediate:!0}),(V,_)=>(o(),ee(je,{"model-value":t.modelValue,"onUpdate:modelValue":_[17]||(_[17]=T=>V.$emit("update:modelValue",T)),title:l.value?"Edit Prompt":"Add Prompt",width:"max-w-4xl"},{footer:de(()=>[e("div",Op,[e("button",{onClick:x,type:"button",class:"px-3 py-1.5 text-sm border border-black dark:border-white rounded font-medium hover:bg-black/5 dark:hover:bg-white/10 transition-colors"}," Cancel "),e("div",jp,[e("button",{onClick:y,type:"button",class:"px-3 py-1.5 text-sm bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity",disabled:c.value},C(l.value?"Update Prompt":"Create Prompt"),9,Dp)])])]),default:de(()=>[c.value?(o(),a("div",Ip,[..._[18]||(_[18]=[e("span",{class:"text-neutral-500"},"Loading prompt data...",-1)])])):(o(),a("div",Ep,[e("div",null,[E(D0,{name:f.value,"onUpdate:name":_[0]||(_[0]=T=>f.value=T),"tool-description":b.value,"onUpdate:toolDescription":_[1]||(_[1]=T=>b.value=T)},null,8,["name","tool-description"])]),e("div",null,[E(t2,{modelValue:s.value,"onUpdate:modelValue":_[2]||(_[2]=T=>s.value=T)},null,8,["modelValue"])]),e("div",null,[E(lo,{modelValue:d.value,"onUpdate:modelValue":_[3]||(_[3]=T=>d.value=T),label:"Required Schema (Optional)"},null,8,["modelValue"])]),e("div",null,[E(op,{"prompt-text":h.value,"onUpdate:promptText":_[4]||(_[4]=T=>h.value=T),"before-tool":m.value,"onUpdate:beforeTool":_[5]||(_[5]=T=>m.value=T),"after-tool":w.value,"onUpdate:afterTool":_[6]||(_[6]=T=>w.value=T),"required-schema":JSON.stringify(d.value,null,2),"current-prompt-name":l.value?f.value:void 0},null,8,["prompt-text","before-tool","after-tool","required-schema","current-prompt-name"])]),e("div",null,[E(xp,{modelValue:k.value,"onUpdate:modelValue":_[7]||(_[7]=T=>k.value=T)},null,8,["modelValue"])]),e("div",Ap,[_[20]||(_[20]=e("h3",{class:"text-sm font-medium text-neutral-900 dark:text-neutral-100"}," Tool Configuration ",-1)),e("div",null,[E(Te,{modelValue:D.value,"onUpdate:modelValue":_[8]||(_[8]=T=>D.value=T),label:"Allow parallel tool calls","help-text":"Allow the model to call multiple tools simultaneously in a single turn"},null,8,["modelValue"])]),e("div",null,[E(he,{modelValue:B.value,"onUpdate:modelValue":_[9]||(_[9]=T=>B.value=T),label:"Tool Choice",options:[{value:"auto",label:"Auto",description:"Model decides"},{value:"none",label:"None",description:"No tools allowed"},{value:"required",label:"Required",description:"Must call a tool"},{value:"function",label:"Function",description:r.value?"Call specific tool":"Requires exactly 1 tool"}].filter(T=>T.value!=="function"||r.value),placeholder:"Select tool choice"},null,8,["modelValue","options"]),_[19]||(_[19]=e("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Controls whether and how the model can call tools ",-1))])]),e("div",null,[E(Lp,{modelValue:O.value,"onUpdate:modelValue":_[10]||(_[10]=T=>O.value=T),"allow-multiple":!0,label:"Handoff Agents (Optional)",placeholder:"Select AI + Human agents to hand off to","agent-type":"ai_human"},null,8,["modelValue"]),_[21]||(_[21]=e("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," AI + Human agents that this prompt can hand off conversations to. These will be exposed as tools. ",-1))]),e("div",Pp,[_[25]||(_[25]=e("h3",{class:"text-sm font-medium text-neutral-900 dark:text-neutral-100"}," Context & Reasoning Configuration ",-1)),e("div",null,[E(Te,{modelValue:$.value,"onUpdate:modelValue":_[11]||(_[11]=T=>$.value=T),label:"Include chat history","help-text":"Expose chat history to the LLM when this prompt is used as a full prompt (not a partial in another prompt)"},null,8,["modelValue"])]),e("div",null,[E(Te,{modelValue:g.value,"onUpdate:modelValue":_[12]||(_[12]=T=>g.value=T),label:"Include past tool calls","help-text":"Include prior tool call history in this prompt. Uncheck to remove past tool calls"},null,8,["modelValue"])]),e("div",null,[E(Te,{modelValue:j.value,"onUpdate:modelValue":_[13]||(_[13]=T=>j.value=T),label:"Include reasoning in message history","help-text":"When loading message history, include reasoning_details from previous responses. Required for multi-turn reasoning continuity."},null,8,["modelValue"])]),_[26]||(_[26]=e("hr",{class:"border-neutral-300 dark:border-neutral-600"},null,-1)),_[27]||(_[27]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400"}," Configure extended reasoning for models like o1, o3, Gemini Thinking, and others. Reasoning is enabled automatically when either field is set. ",-1)),e("div",null,[E(he,{modelValue:W.value,"onUpdate:modelValue":_[14]||(_[14]=T=>W.value=T),label:"Reasoning Effort",options:[{value:"",label:"None",description:"Disabled"},{value:"low",label:"Low",description:"~20% of max_tokens"},{value:"medium",label:"Medium",description:"~50% of max_tokens"},{value:"high",label:"High",description:"~80% of max_tokens"}],placeholder:"Select reasoning effort"},null,8,["modelValue"]),_[22]||(_[22]=e("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Controls reasoning capacity allocation. Supported by OpenAI o-series and Grok models. ",-1))]),e("div",null,[_[23]||(_[23]=e("label",{class:"block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2"}," Max Reasoning Tokens ",-1)),Se(e("input",{"onUpdate:modelValue":_[15]||(_[15]=T=>te.value=T),type:"number",min:"1024",max:"32000",step:"1024",placeholder:"Leave empty to disable or use effort level",class:"w-full px-3 py-2 text-sm border border-neutral-300 dark:border-neutral-600 rounded bg-white dark:bg-neutral-800 text-neutral-900 dark:text-neutral-100 focus:ring-2 focus:ring-accent-500 focus:border-transparent"},null,512),[[Oe,te.value,void 0,{number:!0}]]),_[24]||(_[24]=e("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Directly specify reasoning token limit (1024-32000). Supported by Anthropic, Gemini Thinking, and some Qwen models. ",-1))]),e("div",null,[E(Te,{modelValue:R.value,"onUpdate:modelValue":_[16]||(_[16]=T=>R.value=T),label:"Exclude reasoning from response","help-text":"Use reasoning internally but don't return it in the response (saves tokens and cost)"},null,8,["modelValue"])])])]))]),_:1},8,["model-value","title"]))}}),Up=se({__name:"PromptsView",setup(t){const i=et(),n=ze(),u=v(!1),l=v(null);ue(()=>n.query.refresh,()=>{n.query.refresh&&(l.value?.refresh(),i.replace({path:"/prompts",query:{}}))});const c=()=>{u.value=!0},r=f=>{i.push(`/prompts/${f.id}`)},p=async f=>{try{const b=await fetch(ae("/api/prompts"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(b.ok)u.value=!1,await new Promise(s=>setTimeout(s,100)),await l.value?.refresh();else{const s=await b.json();alert(s.error||"Failed to create prompt")}}catch(b){console.error("Error creating prompt:",b),alert("Failed to create prompt")}};return(f,b)=>(o(),ee(Ke,null,{default:de(()=>[e("div",{class:"flex justify-between items-center mb-6"},[b[1]||(b[1]=e("h1",{class:"text-3xl font-bold"},"Prompts",-1)),e("button",{onClick:c,class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"}," Create Prompt ")]),b[2]||(b[2]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-6"}," Define and manage prompt templates for your agents. ",-1)),E(I0,{ref_key:"dataTableRef",ref:l,onAdd:c,onEdit:r},null,512),E(so,{modelValue:u.value,"onUpdate:modelValue":b[0]||(b[0]=s=>u.value=s),mode:"add",onSave:p},null,8,["modelValue"])]),_:1}))}}),Rp={class:"p-8"},Np={key:0,class:"flex items-center justify-center min-h-[400px]"},Bp={key:2,class:"flex items-center justify-center min-h-[400px]"},qp=se({__name:"PromptEditView",setup(t){const i=et(),n=ze(),u=v(!0),l=v(null),c=v(!0),r=async()=>{const b=n.params.id;if(!b){i.push("/prompts");return}c.value=!0;try{const s=await fetch(ae(`/api/prompts/${b}`));if(s.ok){const d=await s.json();l.value=d.prompt||d}else alert("Prompt not found"),i.push("/prompts")}catch(s){console.error("Error loading prompt:",s),alert("Failed to load prompt"),i.push("/prompts")}finally{c.value=!1}},p=async b=>{try{const{originalName:s,...d}=b,h=s||d.id,$=await fetch(ae(`/api/prompts/${h}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if($.ok)i.push({path:"/prompts",query:{refresh:Date.now().toString()}});else{const g=await $.json();alert(g.error||"Failed to update prompt")}}catch(s){console.error("Error updating prompt:",s),alert("Failed to update prompt")}},f=b=>{b||i.push("/prompts")};return xe(()=>{r()}),ue(u,b=>{b||i.push("/prompts")}),(b,s)=>(o(),a("div",Rp,[c.value?(o(),a("div",Np,[...s[1]||(s[1]=[e("span",{class:"text-neutral-500"},"Loading prompt...",-1)])])):l.value?(o(),ee(so,{key:1,modelValue:u.value,"onUpdate:modelValue":[s[0]||(s[0]=d=>u.value=d),f],mode:"edit","edit-prompt":l.value,onSave:p},null,8,["modelValue","edit-prompt"])):(o(),a("div",Bp,[...s[2]||(s[2]=[e("span",{class:"text-neutral-500"},"Prompt not found",-1)])]))]))}}),Fp={class:"border-2 border-black dark:border-neutral-300 rounded-lg overflow-hidden"},zp={key:0,class:"px-4 py-2 border-b-2 border-black dark:border-neutral-300 bg-neutral-50 dark:bg-neutral-900"},Hp={class:"flex items-center justify-between"},Wp={class:"text-sm font-medium"},Jp={class:"flex items-center gap-2"},Zp={key:1,class:"px-4 py-8 flex items-center justify-center"},Kp={key:2,class:"px-4 py-8 text-center text-neutral-500"},Gp={key:3,class:"divide-y divide-neutral-200 dark:divide-neutral-700"},Xp=["onClick"],Yp={class:"flex items-start gap-3"},Qp={class:"flex-shrink-0 mt-0.5"},e1=["checked","onClick"],t1={class:"flex-1 min-w-0"},o1={class:"flex items-center gap-2"},l1={class:"text-sm font-medium"},a1={key:0,class:"text-xs px-1.5 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},s1={class:"mt-1 text-xs text-neutral-600 dark:text-neutral-400 space-y-0.5"},n1={key:0},r1={key:0},i1={key:1},d1={key:2},u1=se({__name:"ExposedSelectList",props:{providers:{default:()=>[]},modelValue:{default:()=>[]},label:{},loading:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:i}){function n(s){if(s===0)return"$0.00";const d=Math.abs(s);let h;return d<1e-4?h=d.toExponential(3):d<.001||d<.01||d<.1?h=d.toFixed(4):d<1?h=d.toFixed(3):d<10||d<100?h=d.toFixed(2):d<1e3?h=d.toFixed(1):h=d.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0}),h.includes(".")&&(h=h.replace(/\.?0+$/,""),!h.includes(".")&&d<100&&(h=d.toFixed(2))),s<0?`-$${h}`:`$${h}`}const u=t,l=i,c=s=>u.modelValue.includes(s),r=s=>{const d=[...u.modelValue],h=d.indexOf(s);h>-1?d.splice(h,1):d.push(s),l("update:modelValue",d)},p=()=>{l("update:modelValue",u.providers.map(s=>s.id))},f=()=>{l("update:modelValue",[])},b=K(()=>u.providers.length>0&&u.modelValue.length===u.providers.length);return K(()=>u.modelValue.length>0&&u.modelValue.length<u.providers.length),(s,d)=>(o(),a("div",Fp,[t.label?(o(),a("div",zp,[e("div",Hp,[e("span",Wp,C(t.label),1),e("div",Jp,[e("button",{type:"button",onClick:d[0]||(d[0]=h=>b.value?f():p()),class:"text-xs px-2 py-1 border border-neutral-400 dark:border-neutral-600 rounded hover:bg-neutral-100 dark:hover:bg-neutral-800"},C(b.value?"Deselect All":"Select All"),1)])])])):L("",!0),t.loading?(o(),a("div",Zp,[...d[1]||(d[1]=[e("div",{class:"flex items-center gap-2 text-neutral-500"},[e("svg",{class:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]),e("span",null,"Loading providers...")],-1)])])):t.providers.length===0?(o(),a("div",Kp," No providers available ")):(o(),a("div",Gp,[(o(!0),a(pe,null,fe(t.providers,h=>(o(),a("div",{key:h.id,class:"px-4 py-3 hover:bg-neutral-50 dark:hover:bg-neutral-900 cursor-pointer",onClick:$=>r(h.id)},[e("div",Yp,[e("div",Qp,[e("input",{type:"checkbox",checked:c(h.id),onClick:we($=>r(h.id),["stop"]),class:"w-4 h-4 border-2 border-black dark:border-neutral-300 rounded focus:ring-2 focus:ring-black dark:focus:ring-white"},null,8,e1)]),e("div",t1,[e("div",o1,[e("span",l1,C(h.name),1),h.quantization?(o(),a("span",a1,C(h.quantization),1)):L("",!0)]),e("div",s1,[e("div",null,C(n(h.pricing.prompt*1e6))+"/M input • "+C(n(h.pricing.completion*1e6))+"/M output ",1),h.maxPromptTokens||h.maxCompletionTokens?(o(),a("div",n1,[h.maxPromptTokens?(o(),a("span",r1," Max prompt: "+C(h.maxPromptTokens.toLocaleString())+" tokens ",1)):L("",!0),h.maxPromptTokens&&h.maxCompletionTokens?(o(),a("span",i1," • ")):L("",!0),h.maxCompletionTokens?(o(),a("span",d1," Max completion: "+C(h.maxCompletionTokens.toLocaleString())+" tokens ",1)):L("",!0)])):L("",!0)])])])],8,Xp))),128))]))]))}}),c1={key:2,class:"text-xs text-red-500 dark:text-red-400 mt-1"},p1=se({__name:"ModelSelectorInput",props:Ne({label:{},placeholder:{default:"Select a model"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},allowMultiple:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const i=t,n=Je(t,"modelValue"),u=v([]),l=v(!1),c=K(()=>u.value.map(f=>({value:f.id,label:f.name,description:f.provider_id||f.provider,icon:Qe(f.model||f.name,f.provider_id||f.provider)}))),r=async()=>{l.value=!0;try{const f=await fetch(ae("/api/models"));if(f.ok){const b=await f.json();u.value=b.models||[]}}catch(f){console.error("Error fetching models:",f)}finally{l.value=!1}},p=f=>{};return xe(()=>{r()}),ue(()=>i.allowMultiple,()=>{i.allowMultiple&&typeof n.value=="string"?n.value=n.value?[n.value]:[]:!i.allowMultiple&&Array.isArray(n.value)&&(n.value=n.value[0]||"")}),(f,b)=>(o(),a(pe,null,[t.allowMultiple?(o(),ee(ct,{key:0,modelValue:n.value,"onUpdate:modelValue":b[0]||(b[0]=s=>n.value=s),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search models...",error:t.error,required:t.required,disabled:t.disabled,options:c.value,loading:l.value,"add-label":"Add another model",onRemoveItem:p},null,8,["modelValue","label","placeholder","error","required","disabled","options","loading"])):(o(),ee(he,{key:1,modelValue:n.value,"onUpdate:modelValue":b[1]||(b[1]=s=>n.value=s),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search models...",options:c.value,disabled:t.disabled,loading:l.value},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!t.allowMultiple&&t.error?(o(),a("p",c1,C(t.error),1)):L("",!0)],64))}}),m1={class:"space-y-4"},v1={key:0},f1={key:1},h1=["value"],g1={key:0,class:"mt-1 text-xs text-red-500"},b1={key:1,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},x1={class:"px-1 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},y1={key:2,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},k1={key:2},w1={key:3},_1={class:"flex justify-end gap-2"},$1=["disabled"],C1=se({__name:"ModelModal",props:{modelValue:{type:Boolean},editModel:{},mode:{default:"add"}},emits:["update:modelValue","save"],setup(t,{emit:i}){const n=t,u=i,l=v([]),c=v(""),r=v(""),p=v([]),f=v(!1),b=v(!1),s=v([]),d=v([]),h=v(!1),$=v([]),g=K(()=>n.mode==="edit"),m=v(""),w=v(""),k=v(""),O=S=>{let P=S.replace(/[^a-zA-Z0-9\s_-]/g,"");return P=P.trim().toLowerCase().replace(/[\s-]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),P?/^[a-z][a-z0-9_]*$/.test(P)?k.value="":k.value="Name must start with a letter and contain only lowercase letters, numbers, and underscores":k.value="Name is required",P},D=S=>{const P=S.target.value;w.value=O(P)},F=v(!1),X=v(null),te=K(()=>l.value.filter(S=>S.hasApiKey).map(S=>({value:S.name,label:S.name,description:S.sdk==="openai-sdk"?"OpenAI SDK":S.sdk==="openrouter"?"OpenRouter":S.sdk,icon:ut(S.sdk)}))),R=K(()=>p.value.map(S=>({...S,icon:S.iconId?ut(S.iconId):void 0}))),j=K(()=>!g.value||!X.value||F.value?!1:w.value!==X.value.name||c.value!==X.value.provider||r.value!==X.value.model||JSON.stringify(d.value.sort())!==JSON.stringify(X.value.endpoints.sort())||JSON.stringify($.value)!==JSON.stringify(X.value.fallbacks)),W=K(()=>l.value.find(P=>P.name===c.value)?.sdk==="openrouter"),B=async()=>{f.value=!0;try{const S=await fetch(ae("/api/providers"));if(S.ok){const P=await S.json();l.value=P.providers||[]}}catch(S){console.error("Error fetching providers:",S)}finally{f.value=!1}},N=async()=>{if(!c.value){p.value=[];return}b.value=!0;try{const S=await fetch(ae("/api/models/available"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:c.value})});if(S.ok){const P=await S.json();p.value=P.models||[]}else{const P=await S.json();console.error("Error fetching models:",P),p.value=[],alert(P.error||"Failed to fetch available models")}}catch(S){console.error("Error fetching models:",S),p.value=[]}finally{b.value=!1}},U=()=>{w.value="",m.value="",c.value="",r.value="",p.value=[],$.value=[],s.value=[],d.value=[],X.value=null,F.value=!1},y=async()=>{if(n.editModel){F.value=!0;try{await B(),w.value=n.editModel.name||"",m.value=n.editModel.name||"",c.value=n.editModel.provider_id||n.editModel.provider,await N(),r.value=n.editModel.model,await V(),n.editModel.included_providers&&n.editModel.included_providers.length>0&&(d.value=n.editModel.included_providers),await x(),X.value={name:w.value,provider:c.value,model:r.value,endpoints:[...d.value],fallbacks:[...$.value]}}finally{F.value=!1}}};ue(()=>n.modelValue,async S=>{S?g.value&&n.editModel?await y():(await B(),U()):U()});const x=async()=>{if(n.editModel?.id){if(n.editModel.fallbacks&&Array.isArray(n.editModel.fallbacks)){$.value=n.editModel.fallbacks.map(S=>typeof S=="string"?S:S.id);return}try{const S=await fetch(ae(`/api/models/${n.editModel.id}/fallbacks`));if(S.ok){const P=await S.json();$.value=P.fallbacks.map(J=>J.fallback_model_id)}}catch(S){console.error("Error loading fallbacks:",S)}}};ue(c,async(S,P)=>{F.value||g.value&&!P&&S===(n.editModel?.provider_id||n.editModel?.provider)||(r.value="",s.value=[],d.value=[],c.value&&await N())});const V=async()=>{if(!r.value||!c.value){s.value=[];return}const S=l.value.find(J=>J.name===c.value);if(!S||S.sdk!=="openrouter"){s.value=[];return}const P=R.value.find(J=>J.value===r.value);if(!P?.slug){console.error("Model slug not found"),s.value=[];return}h.value=!0;try{const J=await fetch(ae("/api/models/endpoints"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:c.value,modelSlug:P.slug})});if(J.ok){const re=await J.json();s.value=re.endpoints||[],g.value||(d.value=s.value.map(A=>A.id))}else{const re=await J.json();console.error("Error fetching endpoints:",re),s.value=[]}}catch(J){console.error("Error fetching endpoints:",J),s.value=[]}finally{h.value=!1}};ue(r,async(S,P)=>{F.value||g.value&&!P&&S===n.editModel?.model||(r.value?(await V(),P&&S!==P&&(d.value=s.value.map(J=>J.id))):(s.value=[],d.value=[]))});const _=()=>{if(!c.value||!r.value){alert("Please select a provider and model");return}if(!w.value){alert("Please enter a name for the model");return}if(k.value){alert(k.value);return}const S=W.value?d.value:[],P={name:w.value,model:r.value,provider:c.value,included_providers:S,fallbacks:$.value};g.value&&n.editModel?.id&&(P.id=n.editModel.id,m.value&&m.value!==w.value&&(P.originalName=m.value)),u("save",P)},T=()=>{U(),u("update:modelValue",!1)};return(S,P)=>(o(),ee(je,{"model-value":t.modelValue,"onUpdate:modelValue":P[4]||(P[4]=J=>S.$emit("update:modelValue",J)),title:g.value?"Edit Model":"Add Model",width:"max-w-2xl","min-height":"min-h-[36rem]","has-changes":j.value},{footer:de(()=>[e("div",_1,[e("button",{onClick:T,type:"button",class:"px-3 py-1.5 text-sm border border-black dark:border-white rounded font-medium hover:bg-black/5 dark:hover:bg-white/10 transition-colors"}," Cancel "),e("button",{onClick:_,type:"button",class:"px-3 py-1.5 text-sm bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity",disabled:!c.value||!r.value},C(g.value?"Update Model":"Add Model"),9,$1)])]),default:de(()=>[e("div",m1,[E(he,{modelValue:c.value,"onUpdate:modelValue":P[0]||(P[0]=J=>c.value=J),options:te.value,label:"Provider",placeholder:"Select a provider",disabled:f.value||g.value&&!!n.editModel},null,8,["modelValue","options","disabled"]),c.value?(o(),a("div",v1,[E(he,{modelValue:r.value,"onUpdate:modelValue":P[1]||(P[1]=J=>r.value=J),options:R.value,label:"Model",placeholder:"Select a model","search-placeholder":"Search models...",loading:b.value},null,8,["modelValue","options","loading"])])):L("",!0),r.value?(o(),a("div",f1,[P[6]||(P[6]=e("label",{class:"block text-sm font-medium mb-2"},"Name",-1)),e("input",{value:w.value,onInput:D,type:"text",class:le(["w-full px-3 py-2 text-sm border rounded bg-white dark:bg-neutral-800 text-neutral-900 dark:text-neutral-100 focus:ring-2 focus:ring-accent-500 focus:border-transparent",k.value?"border-red-500":"border-neutral-300 dark:border-neutral-600"]),placeholder:"e.g., coding_model, planning_model, fast_response"},null,42,h1),k.value?(o(),a("p",g1,C(k.value),1)):w.value?(o(),a("p",b1,[P[5]||(P[5]=ye(" Will be saved as: ",-1)),e("code",x1,C(w.value),1)])):(o(),a("p",y1," A descriptive name for this model (e.g., coding_model, planning_model). This becomes the filename and reference ID. "))])):L("",!0),r.value&&W.value?(o(),a("div",k1,[P[7]||(P[7]=e("label",{class:"block text-sm font-medium mb-2"}," Available Providers ",-1)),E(u1,{modelValue:d.value,"onUpdate:modelValue":P[2]||(P[2]=J=>d.value=J),providers:s.value,loading:h.value},null,8,["modelValue","providers","loading"]),P[8]||(P[8]=e("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Select which providers can be used for this model ",-1))])):L("",!0),r.value?(o(),a("div",w1,[E(p1,{modelValue:$.value,"onUpdate:modelValue":P[3]||(P[3]=J=>$.value=J),label:"Fallback Models",placeholder:"Add fallback model...","allow-multiple":!0},null,8,["modelValue"]),P[9]||(P[9]=e("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Fallback models will be used in order if the primary model fails ",-1))])):L("",!0)])]),_:1},8,["model-value","title","has-changes"]))}}),V1={class:"flex justify-between items-center mb-6"},S1={class:"flex items-center gap-2"},T1=["src","alt"],M1={class:"text-sm text-neutral-600 dark:text-neutral-400 font-mono"},L1={key:0,class:"space-y-0.5"},I1=["title"],E1={class:"shrink-0 font-mono pr-2"},A1=["src","alt"],P1={class:"truncate"},O1={key:1,class:"text-neutral-400 dark:text-neutral-600 text-sm"},j1=se({__name:"ModelsView",setup(t){const i=v(!1),n=v([]),u=v(!1),l=v(null),c=v("add"),r=[{key:"name",label:"Name",width:"w-1/4"},{key:"model",label:"Model",width:"w-1/4"},{key:"provider",label:"Provider",width:"w-1/4"},{key:"fallbacks",label:"Fallbacks",width:"w-1/4"}],p=[{icon:"edit",label:"Edit",handler:d=>{l.value=d,c.value="edit",i.value=!0}},{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this model? This action cannot be undone.",handler:async d=>{await s(d.id)}}],f=async()=>{u.value=!0;try{const d=await fetch(ae("/api/models"));if(!d.ok)throw new Error("Failed to fetch models");const h=await d.json();n.value=h.models||[]}catch(d){console.error("Error fetching models:",d),n.value=[]}finally{u.value=!1}},b=async d=>{try{if(l.value){const{originalName:h,...$}=d,g=h||l.value.id,m=await fetch(ae(`/api/models/${g}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});if(!m.ok){const w=await m.json();alert(w.error||"Failed to update model");return}}else{const h=await fetch(ae("/api/models"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!h.ok){const $=await h.json();alert($.error||"Failed to add model");return}}await f(),i.value=!1,l.value=null,c.value="add"}catch(h){console.error("Error saving model:",h),alert("Failed to save model")}},s=async d=>{try{const h=await fetch(ae(`/api/models/${d}`),{method:"DELETE"});if(!h.ok){const $=await h.json();alert($.error||"Failed to delete model");return}await f()}catch(h){console.error("Error deleting model:",h),alert("Failed to delete model")}};return xe(()=>{f()}),(d,h)=>(o(),ee(Ke,null,{default:de(()=>[e("div",V1,[h[3]||(h[3]=e("h1",{class:"text-3xl font-bold"},"Models",-1)),e("button",{onClick:h[0]||(h[0]=()=>{c.value="add",l.value=null,i.value=!0}),class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"}," Add Model ")]),h[4]||(h[4]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-8"}," Configure AI models from your connected providers. Models define which AI capabilities are available to your agents. ",-1)),E(Fe,{columns:r,data:n.value,actions:p,loading:u.value,"empty-message":"No models configured yet. Add your first model to get started."},{"cell-name":de(({value:$,row:g})=>[e("div",S1,[Z(Qe)(g.model,g.provider)?(o(),a("img",{key:0,src:Z(Qe)(g.model,g.provider),class:"w-5 h-5 shrink-0",alt:g.provider},null,8,T1)):L("",!0),e("span",null,C($),1)])]),"cell-model":de(({value:$})=>[e("span",M1,C($||"—"),1)]),"cell-fallbacks":de(({value:$})=>[$&&$.length>0?(o(),a("div",L1,[(o(!0),a(pe,null,fe($,(g,m)=>(o(),a("div",{key:g.id,class:"text-sm text-neutral-600 dark:text-neutral-400 flex items-center",title:g.name},[e("span",E1,C(m===$.length-1?"└─":"├─"),1),Z(Qe)(g.model,g.provider)?(o(),a("img",{key:0,src:Z(Qe)(g.model,g.provider),class:"w-4 h-4 shrink-0 mr-1.5",alt:g.provider},null,8,A1)):L("",!0),e("span",P1,C(g.name),1)],8,I1))),128))])):(o(),a("span",O1," None "))]),_:1},8,["data","loading"]),E(C1,{modelValue:i.value,"onUpdate:modelValue":[h[1]||(h[1]=$=>i.value=$),h[2]||(h[2]=$=>{i.value=$,$||(l.value=null,c.value="add")})],"edit-model":l.value,mode:c.value,onSave:b},null,8,["modelValue","edit-model","mode"])]),_:1}))}}),D1={class:"space-y-4"},U1={class:"space-y-1"},R1={class:"relative"},N1={key:0,class:"flex items-center gap-2"},B1=["src","alt"],q1={key:1,class:"text-neutral-500"},F1={key:0,class:"absolute z-10 w-full mt-1 bg-white dark:bg-black border-2 border-black dark:border-neutral-300 rounded shadow-lg"},z1=["onClick"],H1=["src","alt"],W1={key:0,class:"text-xs text-red-500 dark:text-red-400"},J1=se({__name:"AddProviderModal",props:{modelValue:{type:Boolean}},emits:["update:modelValue","save"],setup(t,{emit:i}){const n=i,u=v({name:"",type:"",apiKey:"",baseUrl:""}),l=[{value:"openai",label:"OpenAI",icon:wt,sdk:"openai-sdk"},{value:"openrouter",label:"OpenRouter",icon:oo,sdk:"openrouter"}],c=v(!1),r=K(()=>l.find(g=>g.value===u.value.type)),p=()=>{setTimeout(()=>{c.value=!1},200)},f=v({});ue(()=>u.value.type,g=>{if(g&&!u.value.name){const m=l.find(w=>w.value===g);m&&(u.value.name=m.label)}});const b=K(()=>u.value.type==="custom"||u.value.type==="openai"),s=()=>{f.value={};let g=!0;return u.value.name||(f.value.name="Provider name is required",g=!1),u.value.type||(f.value.type="Provider type is required",g=!1),u.value.apiKey||(f.value.apiKey="API key is required",g=!1),b.value&&u.value.type==="custom"&&!u.value.baseUrl&&(f.value.baseUrl="Base URL is required for custom providers",g=!1),g},d=()=>{s()&&(n("save",{...u.value}),$(),n("update:modelValue",!1))},h=()=>{$(),n("update:modelValue",!1)},$=()=>{u.value={name:"",type:"",apiKey:""},f.value={}};return(g,m)=>(o(),ee(je,{"model-value":t.modelValue,"onUpdate:modelValue":m[4]||(m[4]=w=>g.$emit("update:modelValue",w)),title:"Add Provider",width:"max-w-md"},{footer:de(()=>[e("div",{class:"flex gap-2 justify-end"},[e("button",{onClick:h,class:"px-3 py-1.5 text-sm border border-black dark:border-white rounded font-medium hover:bg-black/5 dark:hover:bg-white/10 transition-colors"}," Cancel "),e("button",{onClick:d,class:"px-3 py-1.5 text-sm bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"}," Add Provider ")])]),default:de(()=>[e("div",D1,[e("div",U1,[m[6]||(m[6]=e("label",{class:"block text-sm font-medium"},[ye(" Provider Type "),e("span",{class:"text-red-500"},"*")],-1)),e("div",R1,[e("button",{type:"button",onClick:m[0]||(m[0]=w=>c.value=!c.value),onBlur:p,class:le(["w-full px-3 py-2 bg-white dark:bg-black border rounded font-mono text-sm text-left focus:outline-none focus:ring-2 focus:ring-black dark:focus:ring-white transition-colors",[f.value.type?"border-red-500 dark:border-red-400":"border-black dark:border-neutral-300"]])},[r.value?(o(),a("div",N1,[e("img",{src:r.value.icon,alt:r.value.label,class:"w-5 h-5"},null,8,B1),e("span",null,C(r.value.label),1)])):(o(),a("span",q1,"Select a provider")),m[5]||(m[5]=e("div",{class:"absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"})])],-1))],34),c.value?(o(),a("div",F1,[(o(),a(pe,null,fe(l,w=>e("button",{key:w.value,type:"button",onClick:k=>{u.value.type=w.value,c.value=!1},class:"w-full px-3 py-2 text-left hover:bg-black/5 dark:hover:bg-white/10 transition-colors flex items-center gap-2"},[e("img",{src:w.icon,alt:w.label,class:"w-5 h-5"},null,8,H1),e("span",null,C(w.label),1)],8,z1)),64))])):L("",!0)]),f.value.type?(o(),a("p",W1,C(f.value.type),1)):L("",!0)]),E(Ce,{modelValue:u.value.name,"onUpdate:modelValue":m[1]||(m[1]=w=>u.value.name=w),label:"Provider Name",placeholder:"e.g., My OpenAI Provider",error:f.value.name,required:""},null,8,["modelValue","error"]),E(Ce,{modelValue:u.value.apiKey,"onUpdate:modelValue":m[2]||(m[2]=w=>u.value.apiKey=w),label:"API Key",type:"password",placeholder:"sk-...",error:f.value.apiKey,required:""},null,8,["modelValue","error"]),b.value?(o(),ee(Ce,{key:0,modelValue:u.value.baseUrl,"onUpdate:modelValue":m[3]||(m[3]=w=>u.value.baseUrl=w),label:"Base URL",placeholder:"https://api.example.com",error:f.value.baseUrl,required:u.value.type==="custom"},null,8,["modelValue","error","required"])):L("",!0)])]),_:1},8,["model-value"]))}}),Z1={class:"flex justify-between items-center mb-6"},K1=se({__name:"ProvidersView",setup(t){const i=v(!1),n=v([]),u=v(!1),l=[{key:"name",label:"Name",width:"w-1/3"},{key:"sdk",label:"SDK Type",width:"w-1/3",formatter:b=>({"openai-sdk":"OpenAI SDK",openrouter:"OpenRouter",openai:"OpenAI"})[b]||b},{key:"hasApiKey",label:"API Key",width:"w-1/3",formatter:b=>b?"✓ Configured":"✗ Not configured"}],c=[{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this provider? This action cannot be undone.",handler:async b=>{await f(b.name)}}],r=async()=>{u.value=!0;try{const b=await fetch(ae("/api/providers"));if(!b.ok)throw new Error("Failed to fetch providers");const s=await b.json();n.value=s.providers||[]}catch(b){console.error("Error fetching providers:",b),n.value=[]}finally{u.value=!1}},p=async b=>{try{const s=await fetch(ae("/api/providers"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!s.ok){const d=await s.json();alert(d.error||"Failed to add provider");return}await r(),i.value=!1}catch(s){console.error("Error adding provider:",s),alert("Failed to add provider")}},f=async b=>{try{const s=await fetch(ae(`/api/providers/${encodeURIComponent(b)}`),{method:"DELETE"});if(!s.ok){const d=await s.json();d.modelCount?alert(`${d.error}
|
|
1
|
+
import{m as Se,c as s,o as a,a as o,r as m,d as ae,b as xe,e as Be,w as ce,n as be,f as He,g as it,u as Fe,h as Xe,i as z,j as l,k as $,l as ee,F as X,p as ve,q as C,s as Ce,t as de,v as at,x as k,R as uo,y as ke,T as ze,z as ht,A as Me,B as Oe,C as po,D as Ve,E as vt,L as qt,G as mo,H as go,I as fo,J as ho,P as Ut,K as vo,M as bo,N as yo,O as Bt,Q as Ge,S as xo,U as Rt,V as ko,W as mt,X as Ue,Y as We,Z as _o,_ as wo,$ as Nt,a0 as Ft,a1 as Co,a2 as Tt,a3 as So,a4 as To,a5 as Mo}from"./vue.js";import{f as Io}from"./vendor.js";import{W as Vo,a as Lo,e as Mt}from"./monaco.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))e(c);new MutationObserver(c=>{for(const i of c)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&e(r)}).observe(document,{childList:!0,subtree:!0});function n(c){const i={};return c.integrity&&(i.integrity=c.integrity),c.referrerPolicy&&(i.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?i.credentials="include":c.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function e(c){if(c.ep)return;c.ep=!0;const i=n(c);fetch(c.href,i)}})();const Po={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ao(p,t){return a(),s("svg",Po,[...t[0]||(t[0]=[o("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o("path",{d:"M12 8V4H8"}),o("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),o("path",{d:"M2 14h2m16 0h2m-7-1v2m-6-2v2"})],-1)])])}const It=Se({name:"lucide-bot",render:Ao}),Eo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Oo(p,t){return a(),s("svg",Eo,[...t[0]||(t[0]=[o("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"},null,-1)])])}const Vt=Se({name:"lucide-message-square",render:Oo}),jo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Do(p,t){return a(),s("svg",jo,[...t[0]||(t[0]=[o("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o("path",{d:"M12 20v2m0-20v2m5 16v2m0-20v2M2 12h2m-2 5h2M2 7h2m16 5h2m-2 5h2M20 7h2M7 20v2M7 2v2"}),o("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),o("rect",{width:"8",height:"8",x:"8",y:"8",rx:"1"})],-1)])])}const qo=Se({name:"lucide-cpu",render:Do}),Uo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Bo(p,t){return a(),s("svg",Uo,[...t[0]||(t[0]=[o("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),o("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),o("path",{d:"M6 6h.01M6 18h.01"})],-1)])])}const Ro=Se({name:"lucide-server",render:Bo}),No={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fo(p,t){return a(),s("svg",No,[...t[0]||(t[0]=[o("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"},null,-1)])])}const Ho=Se({name:"lucide-wrench",render:Fo}),zo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Wo(p,t){return a(),s("svg",zo,[...t[0]||(t[0]=[o("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o("path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0a2.34 2.34 0 0 0 3.319 1.915a2.34 2.34 0 0 1 2.33 4.033a2.34 2.34 0 0 0 0 3.831a2.34 2.34 0 0 1-2.33 4.033a2.34 2.34 0 0 0-3.319 1.915a2.34 2.34 0 0 1-4.659 0a2.34 2.34 0 0 0-3.32-1.915a2.34 2.34 0 0 1-2.33-4.033a2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}),o("circle",{cx:"12",cy:"12",r:"3"})],-1)])])}const Jo=Se({name:"lucide-settings",render:Wo}),Ko={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Zo(p,t){return a(),s("svg",Ko,[...t[0]||(t[0]=[o("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 18l-6-6l6-6"},null,-1)])])}const Go=Se({name:"lucide-chevron-left",render:Zo}),Xo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Yo(p,t){return a(),s("svg",Xo,[...t[0]||(t[0]=[o("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o("circle",{cx:"12",cy:"12",r:"4"}),o("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})],-1)])])}const Qo=Se({name:"lucide-sun",render:Yo}),$o={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function er(p,t){return a(),s("svg",$o,[...t[0]||(t[0]=[o("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"},null,-1)])])}const tr=Se({name:"lucide-moon",render:er}),or={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function rr(p,t){return a(),s("svg",or,[...t[0]||(t[0]=[o("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"},null,-1)])])}const nr=Se({name:"lucide-activity",render:rr}),ar={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function lr(p,t){return a(),s("svg",ar,[...t[0]||(t[0]=[o("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),o("path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3m-6 4.2h5.7"})],-1)])])}const sr=Se({name:"lucide-function-square",render:lr}),ir={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function dr(p,t){return a(),s("svg",ir,[...t[0]||(t[0]=[o("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 17l5-5l-5-5m5 5H9m0 9H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"},null,-1)])])}const cr=Se({name:"lucide-log-out",render:dr}),ur={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function pr(p,t){return a(),s("svg",ur,[...t[0]||(t[0]=[o("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M16 3.128a4 4 0 0 1 0 7.744M22 21v-2a4 4 0 0 0-3-3.87"}),o("circle",{cx:"9",cy:"7",r:"4"})],-1)])])}const mr=Se({name:"lucide-users",render:pr}),gr={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function fr(p,t){return a(),s("svg",gr,[...t[0]||(t[0]=[o("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o("path",{d:"m15.5 7.5l2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4m2-2l-9.6 9.6"}),o("circle",{cx:"7.5",cy:"15.5",r:"5.5"})],-1)])])}const hr=Se({name:"lucide-key",render:fr}),vr={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function br(p,t){return a(),s("svg",vr,[...t[0]||(t[0]=[o("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 7v14m-9-3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4a4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3a3 3 0 0 0-3-3z"},null,-1)])])}const yr=Se({name:"lucide-book-open",render:br}),xr={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function kr(p,t){return a(),s("svg",xr,[...t[0]||(t[0]=[o("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m-11 5L21 3m-3 10v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"},null,-1)])])}const _r=Se({name:"lucide-external-link",render:kr}),Ht="agentbuilder-accent-theme",zt=["amber","lime","emerald","sky","blue","indigo","purple","fuchsia","pink","white"],gt=m("purple");let Lt=!1;function Wt(p){typeof document>"u"||(p==="purple"?delete document.documentElement.dataset.accent:document.documentElement.dataset.accent=p)}function wr(p){try{localStorage.setItem(Ht,p)}catch{}}function Cr(){try{const p=localStorage.getItem(Ht);if(p&&zt.includes(p))return p}catch{}return"purple"}function Jt(){if(Lt)return;Lt=!0;const p=Cr();gt.value=p,Wt(p)}function Sr(){Jt();function p(t){gt.value=t,Wt(t),wr(t)}return{theme:gt,themes:zt,setTheme:p}}const Tr=ae({__name:"DropShadow",props:{offsetX:{type:Number,required:!1,default:8},offsetY:{type:Number,required:!1,default:8},intensity:{type:Number,required:!1,default:.5},pattern:{type:String,required:!1,default:"crosshatch"}},setup(p,{expose:t}){t();const n=p,e=m(),c=m(),i=m(),r=m(0),d=(g,x,y,_,T,b)=>{g.beginPath(),g.moveTo(x+b,y),g.lineTo(x+_-b,y),g.quadraticCurveTo(x+_,y,x+_,y+b),g.lineTo(x+_,y+T-b),g.quadraticCurveTo(x+_,y+T,x+_-b,y+T),g.lineTo(x+b,y+T),g.quadraticCurveTo(x,y+T,x,y+T-b),g.lineTo(x,y+b),g.quadraticCurveTo(x,y,x+b,y),g.closePath()},u=async()=>{if(await be(),!e.value||!c.value||!i.value)return;const g=e.value.getContext("2d");if(!g)return;const x=i.value.getBoundingClientRect(),y=i.value.firstElementChild;if(y){const S=getComputedStyle(y);r.value=parseFloat(S.borderRadius)||0}const _=x.width+n.offsetX+4,T=x.height+n.offsetY+4;e.value.width=_,e.value.height=T,e.value.style.width=`${_}px`,e.value.style.height=`${T}px`,g.clearRect(0,0,e.value.width,e.value.height);const b=document.documentElement.classList.contains("dark");if(g.fillStyle=b?"#6b7280":"black",g.globalAlpha=n.intensity,g.save(),d(g,n.offsetX,n.offsetY,x.width,x.height,r.value),g.clip(),n.pattern==="crosshatch"){const S=b?4:3;g.lineWidth=1,g.strokeStyle=b?"#6b7280":"black";for(let M=-x.height;M<x.width;M+=S)g.beginPath(),g.moveTo(n.offsetX+M,n.offsetY),g.lineTo(n.offsetX+M+x.height,n.offsetY+x.height),g.stroke();for(let M=0;M<x.width+x.height;M+=S)g.beginPath(),g.moveTo(n.offsetX+M,n.offsetY+x.height),g.lineTo(n.offsetX+M-x.height,n.offsetY),g.stroke()}else if(n.pattern==="dots"){const M=b?3:2,L=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]];for(let O=0;O<x.width;O+=M)for(let B=0;B<x.height;B+=M){const H=Math.floor(O/M)%4,re=Math.floor(B/M)%4;L[re][H]/16<n.intensity&&g.fillRect(n.offsetX+O,n.offsetY+B,1,1)}}else if(n.pattern==="diagonal"){const S=b?5:4;g.lineWidth=1,g.strokeStyle=b?"#6b7280":"black";for(let M=-x.height;M<x.width;M+=S)g.beginPath(),g.moveTo(n.offsetX+M,n.offsetY),g.lineTo(n.offsetX+M+x.height,n.offsetY+x.height),g.stroke()}g.restore()};let h=null,f=null;xe(()=>{h=new ResizeObserver(()=>{u()}),i.value&&h.observe(i.value),u(),f=new MutationObserver(()=>{u()}),f.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})}),Be(()=>{i.value&&h&&h.unobserve(i.value),f&&f.disconnect()}),ce(()=>[n.offsetX,n.offsetY,n.intensity,n.pattern],()=>{u()});const v={props:n,canvas:e,container:c,contentEl:i,borderRadius:r,roundedRectPath:d,drawDitheredShadow:u,get resizeObserver(){return h},set resizeObserver(g){h=g},get mutationObserver(){return f},set mutationObserver(g){f=g}};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),ne=(p,t)=>{const n=p.__vccOpts||p;for(const[e,c]of t)n[e]=c;return n},Mr={ref:"canvas",class:"absolute top-0 left-0 pointer-events-none"},Ir={ref:"contentEl",class:"relative"};function Vr(p,t,n,e,c,i){return a(),s("div",{ref:"container",class:"relative",style:it({paddingRight:`${n.offsetX}px`,paddingBottom:`${n.offsetY}px`})},[o("canvas",Mr,null,512),o("div",Ir,[He(p.$slots,"default")],512)],4)}const Ye=ne(Tr,[["render",Vr],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/DropShadow.vue"]]),Kt="/agents/assets/img/agent-builder-logo-light.svg",Zt="/agents/assets/img/agent-builder-logo-dark.svg",Lr="data:image/svg+xml,%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20150%20150'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%20id='Artboard1'%20transform='matrix(1,0,0,1,1,1)'%3e%3crect%20x='-1'%20y='-1'%20width='150'%20height='150'%20style='fill:none;'/%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.816,92.912L108.064,59.193C103.573,53.307%20101.473,45.937%20102.197,38.566L105.475,5.046L99.553,4.466L96.312,37.643C95.895,41.808%2091.44,44.27%2087.71,42.369L30.34,13.394L27.659,18.7L84.686,47.494C87.184,48.762%2087.076,52.347%2084.504,53.452L0.387,89.671L2.741,95.139L86.189,59.211C88.76,58.106%2091.422,60.587%2090.48,63.231L62.918,141.119L68.532,143.111L96.384,64.408C97.507,61.257%20101.672,60.605%20103.7,63.249L129.107,96.498L133.834,92.876L133.816,92.912Z'%20style='fill:rgb(31,41,55);fill-opacity:0.5;fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.925,90.214L107.648,7.346C106.036,2.257%20100.875,-0.821%2095.624,0.193L32.64,12.344C29.959,12.869%2027.605,14.408%2026.066,16.6C25.523,17.36%2025.07,18.211%2024.744,19.117L0.622,86.284C-0.917,90.594%200.459,95.375%204.081,98.164L59.568,141.137C61.469,142.604%2063.733,143.346%2066.015,143.346C68.079,143.346%2070.144,142.731%2071.937,141.517L129.832,102.111C133.707,99.468%20135.355,94.687%20133.943,90.232L133.925,90.214ZM116.92,85.922L47.127,53.923C44.374,52.673%2043.994,48.925%2046.421,47.132L94.175,11.873C97.416,9.483%20102.034,10.95%20103.284,14.771C108.173,29.548%20118.64,62.054%20124.218,79.457C125.631,83.876%20121.121,87.859%20116.902,85.94L116.92,85.922ZM79.162,15.567L42.455,42.659C40.083,44.415%2036.696,43.057%2036.189,40.16L33.781,26.342C33.038,22.05%2035.845,17.94%2040.119,17.089C49.409,15.241%2065.254,12.145%2076.681,9.917C79.995,9.265%2081.879,13.557%2079.162,15.567ZM29.126,34.238L31.716,49.069C31.915,50.21%2031.607,51.388%2030.865,52.275L16.559,69.587C15.291,71.127%2012.846,69.732%2013.516,67.849L25.704,33.93C26.32,32.21%2028.8,32.427%2029.126,34.22L29.126,34.238ZM12.882,83.386L29.543,63.231C31.517,60.84%2035.356,61.547%2036.352,64.499L56.308,123.661C57.322,126.668%2053.809,129.149%2051.31,127.193C41.223,119.297%2024.4,106.132%2014.404,98.164C9.84,94.542%209.152,87.878%2012.864,83.386L12.882,83.386ZM63.498,126.305L43.161,66.002C42.056,62.706%2045.407,59.681%2048.576,61.13L117.337,92.677C121.375,94.524%20121.864,100.083%20118.206,102.6C107.358,110.061%2088.326,123.064%2076.826,130.815C71.991,134.074%2065.381,131.829%2063.516,126.305L63.498,126.305Z'%20style='fill:rgb(31,41,55);fill-rule:nonzero;'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Pr="data:image/svg+xml,%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20150%20150'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%20id='Artboard1'%20transform='matrix(1,0,0,1,1,1)'%3e%3crect%20x='-1'%20y='-1'%20width='150'%20height='150'%20style='fill:none;'/%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.816,92.912L108.064,59.193C103.573,53.307%20101.473,45.937%20102.197,38.566L105.475,5.046L99.553,4.466L96.312,37.643C95.895,41.808%2091.44,44.27%2087.71,42.369L30.34,13.394L27.659,18.7L84.686,47.494C87.184,48.762%2087.076,52.347%2084.504,53.452L0.387,89.671L2.741,95.139L86.189,59.211C88.76,58.106%2091.422,60.587%2090.48,63.231L62.918,141.119L68.532,143.111L96.384,64.408C97.507,61.257%20101.672,60.605%20103.7,63.249L129.107,96.498L133.834,92.876L133.816,92.912Z'%20style='fill:rgb(249,250,251);fill-opacity:0.5;fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.925,90.214L107.648,7.346C106.036,2.257%20100.875,-0.821%2095.624,0.193L32.64,12.344C29.959,12.869%2027.605,14.408%2026.066,16.6C25.523,17.36%2025.07,18.211%2024.744,19.117L0.622,86.284C-0.917,90.594%200.459,95.375%204.081,98.164L59.568,141.137C61.469,142.604%2063.733,143.346%2066.015,143.346C68.079,143.346%2070.144,142.731%2071.937,141.517L129.832,102.111C133.707,99.468%20135.355,94.687%20133.943,90.232L133.925,90.214ZM116.92,85.922L47.127,53.923C44.374,52.673%2043.994,48.925%2046.421,47.132L94.175,11.873C97.416,9.483%20102.034,10.95%20103.284,14.771C108.173,29.548%20118.64,62.054%20124.218,79.457C125.631,83.876%20121.121,87.859%20116.902,85.94L116.92,85.922ZM79.162,15.567L42.455,42.659C40.083,44.415%2036.696,43.057%2036.189,40.16L33.781,26.342C33.038,22.05%2035.845,17.94%2040.119,17.089C49.409,15.241%2065.254,12.145%2076.681,9.917C79.995,9.265%2081.879,13.557%2079.162,15.567ZM29.126,34.238L31.716,49.069C31.915,50.21%2031.607,51.388%2030.865,52.275L16.559,69.587C15.291,71.127%2012.846,69.732%2013.516,67.849L25.704,33.93C26.32,32.21%2028.8,32.427%2029.126,34.22L29.126,34.238ZM12.882,83.386L29.543,63.231C31.517,60.84%2035.356,61.547%2036.352,64.499L56.308,123.661C57.322,126.668%2053.809,129.149%2051.31,127.193C41.223,119.297%2024.4,106.132%2014.404,98.164C9.84,94.542%209.152,87.878%2012.864,83.386L12.882,83.386ZM63.498,126.305L43.161,66.002C42.056,62.706%2045.407,59.681%2048.576,61.13L117.337,92.677C121.375,94.524%20121.864,100.083%20118.206,102.6C107.358,110.061%2088.326,123.064%2076.826,130.815C71.991,134.074%2065.381,131.829%2063.516,126.305L63.498,126.305Z'%20style='fill:rgb(249,250,251);fill-rule:nonzero;'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";function Ar(){return window.__AGENTBUILDER_CONFIG__||{mountPoint:"/agentbuilder"}}function Qe(){return Ar().mountPoint}function te(p){const t=Qe(),n=p.startsWith("/")?p:`/${p}`;return t==="/"?n:`${t}${n}`}const Er=ae({__name:"Sidebar",props:{isCollapsed:{type:Boolean,required:!0},isDark:{type:Boolean,required:!0}},emits:["toggle-sidebar","toggle-theme"],setup(p,{expose:t,emit:n}){t();function e(E){if(E.startsWith("/src/")||E.startsWith("data:"))return E;const N=Qe();return N==="/"?E.replace("/agents/","/"):E.replace("/agents/",`${N}/`)}const c=e(Kt),i=e(Zt),r=e(Lr),d=e(Pr),u=p,h=n,f=Fe(),v=Xe(),g=z(()=>f.name);function x(E){const N=f.path;return N===E.path||N.startsWith(E.path+"/")}const y=z(()=>u.isDark?i:c),_=z(()=>u.isDark?d:r),T=[{id:"threads",label:"Threads",icon:nr,path:"/threads"},{id:"agents",label:"Agents",icon:It,path:"/agents"},{id:"prompts",label:"Prompts",icon:Vt,path:"/prompts"},{id:"tools",label:"Tools",icon:Ho,path:"/tools",hasSubnav:!0,subnav:[{id:"tools-functions",label:"Functions",icon:sr,path:"/tools#functions"},{id:"tools-prompts",label:"Prompts",icon:Vt,path:"/tools#prompts"},{id:"tools-agents",label:"Agents",icon:It,path:"/tools#agents"}]},{id:"models",label:"Models",icon:qo,path:"/models"},{id:"providers",label:"Providers",icon:Ro,path:"/providers"}],b=E=>{v.push(E)},S=E=>{v.push(E),L.value=!1},M=z(()=>typeof g.value=="string"&&(g.value==="tools"||g.value.startsWith("tools-"))),L=m(!1),{theme:O,themes:B,setTheme:H}=Sr(),re={amber:"bg-amber-500",lime:"bg-lime-500",emerald:"bg-emerald-500",sky:"bg-sky-500",blue:"bg-blue-500",indigo:"bg-indigo-500",purple:"bg-purple-500",fuchsia:"bg-fuchsia-500",pink:"bg-pink-500",white:"bg-neutral-400 dark:bg-neutral-500"},Q=z(()=>g.value==="users"||g.value==="api-keys"),q=()=>{L.value=!L.value},K=()=>{localStorage.removeItem("auth_token"),v.push("/login")},R=E=>{const N=E.target;L.value&&!N.closest(".settings-menu-container")&&(L.value=!1)};xe(()=>{document.addEventListener("click",R)}),Be(()=>{document.removeEventListener("click",R)});const Y={transformAssetPath:e,logoLight:c,logoDark:i,logoMarkLight:r,logoMarkDark:d,props:u,emit:h,route:f,router:v,activeRoute:g,isNavItemActive:x,currentLogo:y,currentLogoMark:_,navItems:T,navigateTo:b,navigateToSetting:S,isToolsActive:M,showSettingsMenu:L,accentTheme:O,accentThemes:B,setAccentTheme:H,themeColors:re,isSettingsActive:Q,toggleSettingsMenu:q,handleLogout:K,handleClickOutside:R,get IconSettings(){return Jo},get IconChevronLeft(){return Go},get IconSun(){return Qo},get IconMoon(){return tr},get IconLogOut(){return cr},get IconUsers(){return mr},get IconKey(){return hr},get IconBookOpen(){return yr},get IconExternalLink(){return _r},DropShadow:Ye};return Object.defineProperty(Y,"__isScriptSetup",{enumerable:!1,value:!0}),Y}}),Or=["src"],jr=["src"],Dr={class:"flex-1 flex flex-col justify-between pt-2 pb-4"},qr={class:"flex flex-col gap-1 px-2"},Ur={key:0},Br=["onClick","title"],Rr={key:0,class:"flex-1 whitespace-nowrap overflow-hidden text-ellipsis text-left"},Nr={key:0,class:"ml-4 space-y-0.5"},Fr=["onClick"],Hr={class:"whitespace-nowrap overflow-hidden text-ellipsis"},zr=["onClick","title"],Wr={key:0,class:"whitespace-nowrap overflow-hidden text-ellipsis"},Jr={class:"flex flex-col gap-1 px-2"},Kr=["title"],Zr={key:0,class:"flex-1 whitespace-nowrap overflow-hidden text-ellipsis"},Gr={class:"relative settings-menu-container"},Xr={key:0,class:"absolute bottom-full mb-2 left-0 z-50"},Yr={class:"bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-600 rounded-lg py-2 min-w-[200px]"},Qr={class:"px-4 py-3 border-b border-neutral-200 dark:border-neutral-700"},$r=["title"],en={class:"relative z-10 flex items-center justify-center w-8 h-full"},tn={class:"relative z-10 flex items-center justify-center w-8 h-full"},on={class:"px-4 pt-3 pb-4 border-b border-neutral-200 dark:border-neutral-700"},rn={class:"grid grid-cols-5 gap-3"},nn=["onClick","title"],an={key:0,class:"w-2 h-2 rounded-full bg-white shadow-sm"},ln={key:0,class:"text-sm overflow-hidden whitespace-nowrap max-w-0 group-hover:max-w-[60px] group-hover:ml-2 transition-all duration-200"};function sn(p,t,n,e,c,i){return a(),s("aside",{class:$(["flex flex-col transition-all duration-300 pt-2.5",n.isCollapsed?"w-16":"w-60"])},[o("div",{class:$(`flex items-center justify-between ${n.isCollapsed?"px-2 py-4":"p-4"}`)},[n.isCollapsed?l("v-if",!0):(a(),s("img",{key:0,src:e.currentLogo,alt:"AgentBuilder",class:"h-8 mr-2 mt-0.5"},null,8,Or)),o("button",{onClick:t[0]||(t[0]=r=>p.$emit("toggle-sidebar")),class:$(`p-1 rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors ${n.isCollapsed?"m-auto":"border border-black/20 dark:border-white/20 opacity-50 hover:opacity-100"}`),"aria-label":"Toggle sidebar"},[n.isCollapsed?(a(),s("img",{key:1,src:e.currentLogoMark,alt:"AgentBuilder",class:"w-7 h-7 m-auto"},null,8,jr)):(a(),ee(e.IconChevronLeft,{key:0,class:"w-5 h-5"}))],2)],2),o("nav",Dr,[o("div",qr,[(a(),s(X,null,ve(e.navItems,r=>(a(),s(X,{key:r.id},[r.hasSubnav?(a(),s("div",Ur,[l(" Main Tools button "),o("button",{onClick:d=>e.navigateTo(r.path),class:$(["flex items-center gap-3 px-3 py-3 rounded text-sm font-medium transition-all w-full",e.isToolsActive?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10",n.isCollapsed&&"justify-center"]),title:n.isCollapsed?r.label:void 0},[(a(),ee(at(r.icon),{class:"w-5 h-5 flex-shrink-0"})),n.isCollapsed?l("v-if",!0):(a(),s("span",Rr,k(r.label),1))],10,Br),l(" Tools subnav "),!n.isCollapsed&&r.subnav?(a(),s("div",Nr,[(a(!0),s(X,null,ve(r.subnav,d=>(a(),s("button",{key:d.id,onClick:u=>e.navigateTo(d.path),class:$(["flex items-center gap-3 px-3 py-1.5 text-sm transition-all w-full",e.activeRoute===d.id?"bg-black text-white dark:bg-white dark:text-black rounded":"hover:underline"])},[(a(),ee(at(d.icon),{class:"w-4 h-4 flex-shrink-0"})),o("span",Hr,k(d.label),1)],10,Fr))),128))])):l("v-if",!0)])):(a(),s("button",{key:1,onClick:d=>e.navigateTo(r.path),class:$(["flex items-center gap-3 px-3 py-3 rounded text-sm font-medium transition-all",e.isNavItemActive(r)?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10",n.isCollapsed&&"justify-center"]),title:n.isCollapsed?r.label:void 0},[(a(),ee(at(r.icon),{class:"w-5 h-5 flex-shrink-0"})),n.isCollapsed?l("v-if",!0):(a(),s("span",Wr,k(r.label),1))],10,zr))],64))),64))]),o("div",Jr,[l(" Documentation Link "),o("a",{href:"https://docs.standardagentbuilder.com/",target:"_blank",rel:"noopener noreferrer",class:$(["flex items-center gap-3 px-3 py-2 rounded text-sm transition-all","hover:bg-black/5 dark:hover:bg-white/10 text-neutral-600 dark:text-neutral-400 hover:text-black dark:hover:text-white",n.isCollapsed&&"justify-center"]),title:n.isCollapsed?"Documentation":void 0},[C(e.IconBookOpen,{class:"w-5 h-5 flex-shrink-0"}),n.isCollapsed?l("v-if",!0):(a(),s("span",Zr," Docs ")),n.isCollapsed?l("v-if",!0):(a(),ee(e.IconExternalLink,{key:1,class:"w-3 h-3 flex-shrink-0 opacity-50"}))],10,Kr),l(" Bottom icon bar "),o("div",{class:$(["flex items-center gap-1 pt-2 mt-1 border-t border-black/10 dark:border-white/10",n.isCollapsed?"flex-col":"justify-between"])},[l(" Settings Menu "),o("div",Gr,[o("button",{onClick:Ce(e.toggleSettingsMenu,["stop"]),class:$(["p-2 rounded transition-colors flex items-center",e.showSettingsMenu||e.isSettingsActive?"bg-black/10 dark:bg-white/10 text-black dark:text-white":"hover:bg-black/5 dark:hover:bg-white/10 text-neutral-600 dark:text-neutral-400 hover:text-black dark:hover:text-white"]),title:"Settings"},[C(e.IconSettings,{class:"w-5 h-5 flex-shrink-0"})],2),l(" Settings Popover Menu "),e.showSettingsMenu?(a(),s("div",Xr,[C(e.DropShadow,{"offset-x":6,"offset-y":6,intensity:.4},{default:de(()=>[o("div",Yr,[l(" Light/Dark Theme Toggle "),o("div",Qr,[t[4]||(t[4]=o("div",{class:"text-xs font-bold text-neutral-600 dark:text-neutral-400 pb-3"}," Appearance ",-1)),o("button",{onClick:t[1]||(t[1]=Ce(r=>p.$emit("toggle-theme"),["stop"])),class:"relative flex items-center h-7 rounded-full bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 transition-colors",title:n.isDark?"Switch to light mode":"Switch to dark mode"},[l(" Sliding indicator "),o("span",{class:$(["absolute top-0.5 h-6 w-8 rounded-full bg-white dark:bg-black shadow-sm transition-transform duration-200",n.isDark?"translate-x-[calc(100%-2px)]":"translate-x-0.5"])},null,2),l(" Icons "),o("span",en,[C(e.IconSun,{class:$(["w-4 h-4",n.isDark?"text-neutral-500":"text-black"])},null,8,["class"])]),o("span",tn,[C(e.IconMoon,{class:$(["w-4 h-4",n.isDark?"text-white":"text-neutral-400"])},null,8,["class"])])],8,$r)]),l(" Accent Color Picker "),o("div",on,[t[5]||(t[5]=o("div",{class:"text-xs font-bold text-neutral-600 dark:text-neutral-400 pb-3"}," Accent Color ",-1)),o("div",rn,[(a(!0),s(X,null,ve(e.accentThemes,r=>(a(),s("button",{key:r,onClick:Ce(d=>e.setAccentTheme(r),["stop"]),class:$(["w-6 h-6 rounded-full transition-all flex items-center justify-center ring-1 ring-black/10 dark:ring-white/10",[e.themeColors[r],e.accentTheme===r?"ring-2 ring-black/50 dark:ring-white/50":"hover:scale-110"]]),title:r.charAt(0).toUpperCase()+r.slice(1)},[e.accentTheme===r?(a(),s("span",an)):l("v-if",!0)],10,nn))),128))])]),o("button",{onClick:t[2]||(t[2]=r=>e.navigateToSetting("/settings/users")),class:$(["flex items-center gap-3 px-4 py-2 text-sm transition-all w-full text-left",e.activeRoute==="users"?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10"])},[C(e.IconUsers,{class:"w-4 h-4 flex-shrink-0"}),t[6]||(t[6]=o("span",{class:"whitespace-nowrap"},"Users",-1))],2),o("button",{onClick:t[3]||(t[3]=r=>e.navigateToSetting("/settings/api-keys")),class:$(["flex items-center gap-3 px-4 py-2 text-sm transition-all w-full text-left",e.activeRoute==="api-keys"?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10"])},[C(e.IconKey,{class:"w-4 h-4 flex-shrink-0"}),t[7]||(t[7]=o("span",{class:"whitespace-nowrap"},"API Keys",-1))],2)])]),_:1})])):l("v-if",!0)]),l(" Logout "),o("button",{onClick:e.handleLogout,class:"group p-2 rounded hover:bg-red-500/10 transition-colors text-neutral-600 dark:text-neutral-400 hover:text-red-600 dark:hover:text-red-400 flex items-center",title:"Logout"},[C(e.IconLogOut,{class:"w-5 h-5 flex-shrink-0"}),n.isCollapsed?l("v-if",!0):(a(),s("span",ln,"Logout"))])],2)])])],2)}const dn=ne(Er,[["render",sn],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/Sidebar.vue"]]),cn=ae({__name:"WarningBanner",setup(p,{expose:t}){t();const n=m([]),e=m(new Set),c=async()=>{if(localStorage.getItem("auth_token"))try{const f=await fetch(te("/api/diagnostics"));if(f.ok){const v=await f.json();n.value=v.warnings||[]}}catch{}},i=h=>{const f=`${h.type}:${h.details?.name||h.message}`;e.value.add(f)},r=h=>{const f=`${h.type}:${h.details?.name||h.message}`;return!e.value.has(f)},d=h=>{if(h.type==="duplicate_tool_name"){const f=h.details?.sources?.join(" and ")||"multiple sources";return`Duplicate tool name "${h.details?.name}" (defined as both ${f}). This may cause unexpected behavior.`}return h.message};xe(()=>{c()});const u={warnings:n,dismissed:e,fetchWarnings:c,dismiss:i,isVisible:r,formatWarning:d};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),un={class:"warning-banner-container"},pn={key:0,class:"warning-banner flex items-center justify-between gap-3 px-4 py-2 bg-amber-50 dark:bg-amber-900/30 border-b border-amber-200 dark:border-amber-800 text-amber-800 dark:text-amber-200 text-sm"},mn={class:"flex items-center gap-2"},gn=["onClick"];function fn(p,t,n,e,c,i){return a(),s("div",un,[(a(!0),s(X,null,ve(e.warnings,r=>(a(),s(X,{key:`${r.type}:${r.details?.name}`},[e.isVisible(r)?(a(),s("div",pn,[o("div",mn,[t[0]||(t[0]=o("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 flex-shrink-0",viewBox:"0 0 20 20",fill:"currentColor"},[o("path",{"fill-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})],-1)),o("span",null,k(e.formatWarning(r)),1)]),o("button",{onClick:d=>e.dismiss(r),class:"text-amber-600 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-200 p-1",title:"Dismiss"},[...t[1]||(t[1]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor"},[o("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)])],8,gn)])):l("v-if",!0)],64))),128))])}const hn=ne(cn,[["render",fn],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/WarningBanner.vue"]]),vn=ae({__name:"App",setup(p,{expose:t}){t(),Jt();const n=Fe(),e=m(!1),c=m(!1),i=z(()=>n.name!=="login"),r=()=>{e.value=!e.value},d=()=>{c.value=!c.value,c.value?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))};xe(()=>{const h=localStorage.getItem("theme");(h==="dark"||!h&&window.matchMedia("(prefers-color-scheme: dark)").matches)&&(c.value=!0,document.documentElement.classList.add("dark"))});const u={route:n,isCollapsed:e,isDark:c,showSidebar:i,toggleSidebar:r,toggleTheme:d,get RouterView(){return uo},Sidebar:dn,WarningBanner:hn};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),bn={class:"flex-1 overflow-auto my-3 mr-4 border border-neutral-300 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 flex flex-col"},yn={class:"flex-1 overflow-auto"};function xn(p,t,n,e,c,i){return a(),s("div",{class:$(["app-container relative flex h-screen font-sans bg-neutral-50/80 text-black dark:bg-black dark:text-white",{"is-dark":e.isDark}])},[e.showSidebar?(a(),ee(e.Sidebar,{key:0,"is-collapsed":e.isCollapsed,"is-dark":e.isDark,onToggleSidebar:e.toggleSidebar,onToggleTheme:e.toggleTheme},null,8,["is-collapsed","is-dark"])):l("v-if",!0),l(" Login page renders directly on textured background "),e.showSidebar?(a(),s(X,{key:2},[l(" Main content area for authenticated pages "),o("main",bn,[C(e.WarningBanner),o("div",yn,[C(e.RouterView)])])],2112)):(a(),ee(e.RouterView,{key:1}))],2)}const kn=ne(vn,[["render",xn],["__scopeId","data-v-7a7a37b1"],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/App.vue"]]),_n={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function wn(p,t){return a(),s("svg",_n,[...t[0]||(t[0]=[o("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"},null,-1)])])}const Cn=Se({name:"lucide-trash-2",render:wn}),Sn={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Tn(p,t){return a(),s("svg",Sn,[...t[0]||(t[0]=[o("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o("path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),o("path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"})],-1)])])}const Mn=Se({name:"lucide-edit",render:Tn}),In={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Vn(p,t){return a(),s("svg",In,[...t[0]||(t[0]=[o("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),o("circle",{cx:"12",cy:"12",r:"3"})],-1)])])}const Gt=Se({name:"lucide-eye",render:Vn}),Ln=ae({__name:"DataTable",props:{columns:{type:Array,required:!0},data:{type:Array,required:!0},actions:{type:Array,required:!1},emptyMessage:{type:String,required:!1,default:"No data available"},loading:{type:Boolean,required:!1,default:!1}},setup(p,{expose:t}){t();const d={props:p,getIcon:u=>{switch(u){case"edit":return Mn;case"delete":return Cn;case"view":return Gt;default:return null}},getCellValue:(u,h)=>{const f=u[h.key];return h.formatter?h.formatter(f):f??"-"},getCellAlignment:u=>{switch(u){case"center":return"text-center";case"right":return"text-right";default:return"text-left"}},handleAction:(u,h)=>{if(u.confirm){const f=u.confirmMessage||`Are you sure you want to ${u.label.toLowerCase()}?`;confirm(f)&&u.handler(h)}else u.handler(h)}};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}}),Pn={class:"w-full"},An={class:"border border-black dark:border-neutral-300 rounded overflow-hidden"},En={class:"overflow-x-auto"},On={class:"w-full"},jn={class:"border-b border-black dark:border-neutral-300"},Dn={key:0,class:"px-4 py-3 text-right font-medium text-sm"},qn={key:0},Un=["colspan"],Bn=["colspan"],Rn=["innerHTML"],Nn={key:0,class:"px-4 py-3 text-right"},Fn={class:"inline-flex gap-1"},Hn=["onClick","title"];function zn(p,t,n,e,c,i){return a(),s("div",Pn,[o("div",An,[o("div",En,[o("table",On,[o("thead",jn,[o("tr",null,[(a(!0),s(X,null,ve(n.columns,r=>(a(),s("th",{key:r.key,class:$(["px-4 py-3 font-medium text-sm",e.getCellAlignment(r.align),r.width||""])},k(r.label),3))),128)),n.actions&&n.actions.length>0?(a(),s("th",Dn," Actions ")):l("v-if",!0)])]),o("tbody",null,[l(" Loading state "),n.loading?(a(),s("tr",qn,[o("td",{colspan:n.columns.length+(n.actions?1:0),class:"px-4 py-8 text-center text-neutral-500"},[...t[0]||(t[0]=[o("div",{class:"inline-flex items-center gap-2"},[o("svg",{class:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[o("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),o("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]),ke(" Loading... ")],-1)])],8,Un)])):n.data.length===0?(a(),s(X,{key:1},[l(" Empty state "),o("tr",null,[o("td",{colspan:n.columns.length+(n.actions?1:0),class:"px-4 py-8 text-center text-neutral-500"},k(n.emptyMessage),9,Bn)])],2112)):(a(),s(X,{key:2},[l(" Data rows "),(a(!0),s(X,null,ve(n.data,(r,d)=>(a(),s("tr",{key:d,class:"border-t border-neutral-200 dark:border-neutral-800 hover:bg-black/5 dark:hover:bg-white/5 transition-colors"},[(a(!0),s(X,null,ve(n.columns,u=>(a(),s("td",{key:u.key,class:$(["px-4 py-3 text-sm",e.getCellAlignment(u.align)])},[He(p.$slots,`cell-${u.key}`,{value:r[u.key],row:r,column:u},()=>[u.html?(a(),s("span",{key:0,innerHTML:e.getCellValue(r,u)},null,8,Rn)):(a(),s(X,{key:1},[ke(k(e.getCellValue(r,u)),1)],64))])],2))),128)),n.actions&&n.actions.length>0?(a(),s("td",Nn,[o("div",Fn,[(a(!0),s(X,null,ve(n.actions,(u,h)=>(a(),s("button",{key:h,onClick:f=>e.handleAction(u,r),class:"p-1.5 rounded hover:bg-black/10 dark:hover:bg-white/10 transition-colors",title:u.label},[(a(),ee(at(e.getIcon(u.icon)),{class:"w-4 h-4"}))],8,Hn))),128))])])):l("v-if",!0)]))),128))],2112))])])])])])}const Je=ne(Ln,[["render",zn],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/DataTable.vue"]]),Wn=ae({__name:"AgentsDataTable",emits:["add","edit","delete"],setup(p,{expose:t,emit:n}){const e=n,c=m([]),i=m(!1),r=[{key:"title",label:"Title",width:"w-1/5"},{key:"type",label:"Type",width:"w-1/12",formatter:v=>v==="dual_ai"?"Dual AI":"AI+Human"},{key:"side_a_agent_prompt_name",label:"Side A",width:"w-1/5",formatter:v=>v||"-"},{key:"side_b_agent_prompt_name",label:"Side B",width:"w-1/5",formatter:v=>v||"Human"},{key:"created_at",label:"Created",width:"w-1/6",formatter:v=>v?new Date(v*1e3).toLocaleDateString():"-"}],d=[{icon:"edit",label:"Edit",handler:v=>e("edit",v)},{icon:"delete",label:"Delete",handler:async v=>{await h(v)},confirm:!0,confirmMessage:"Are you sure you want to delete this agent?"}],u=async()=>{i.value=!0;try{const v=await fetch(te("/api/agents"));if(v.ok){const g=await v.json();c.value=g.agents||[]}}catch(v){console.error("Error fetching agents:",v)}finally{i.value=!1}},h=async v=>{try{const g=await fetch(te(`/api/agents/${v.id}`),{method:"DELETE"});if(g.ok)await u();else{const x=await g.json();alert(x.error||"Failed to delete agent")}}catch(g){console.error("Error deleting agent:",g),alert("Failed to delete agent")}};xe(()=>{u()}),t({refresh:u});const f={emit:e,agents:c,loading:i,columns:r,actions:d,fetchAgents:u,deleteAgent:h,DataTable:Je};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}});function Jn(p,t,n,e,c,i){return a(),s("div",null,[C(e.DataTable,{columns:e.columns,data:e.agents,actions:e.actions,loading:e.loading,"empty-message":"No agents available. Create your first agent to get started."},null,8,["data","loading"])])}const Kn=ne(Wn,[["render",Jn],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/AgentsDataTable.vue"]]),Zn={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Gn(p,t){return a(),s("svg",Zn,[...t[0]||(t[0]=[o("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Xt=Se({name:"lucide-x",render:Gn}),Xn=ae({__name:"ConfirmDialog",props:{modelValue:{type:Boolean,required:!0},title:{type:String,required:!1,default:"Confirm Action"},message:{type:String,required:!1,default:"Are you sure you want to continue? You will lose any unsaved changes."},confirmText:{type:String,required:!1,default:"Continue"},cancelText:{type:String,required:!1,default:"Cancel"}},emits:["update:modelValue","confirm","cancel"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=()=>{c("update:modelValue",!1)},r=()=>{c("confirm"),i()},d=()=>{c("cancel"),i()},u=f=>{f.key==="Escape"&&e.modelValue&&d()};ce(()=>e.modelValue,f=>{f?(document.addEventListener("keydown",u),document.body.style.overflow="hidden"):(document.removeEventListener("keydown",u),document.body.style.overflow="")});const h={props:e,emit:c,close:i,handleConfirm:r,handleCancel:d,handleKeydown:u,DropShadow:Ye,get IconX(){return Xt}};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}}),Yn={key:0,class:"w-full max-w-md"},Qn={class:"flex items-center justify-between p-4 border-b-2 border-red-600 flex-shrink-0"},$n={class:"text-xl font-bold text-red-600"},ea={class:"p-6"},ta={class:"text-neutral-700 dark:text-neutral-300 mb-6"},oa={class:"flex justify-end gap-3"};function ra(p,t,n,e,c,i){return a(),ee(ht,{to:"body"},[C(ze,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:de(()=>[n.modelValue?(a(),s("div",{key:0,class:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-white/80 dark:bg-black/80 backdrop-blur-sm dark:text-white",onClick:e.handleCancel},[C(ze,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:de(()=>[n.modelValue?(a(),s("div",Yn,[C(e.DropShadow,{"offset-x":12,"offset-y":12,intensity:.4},{default:de(()=>[o("div",{class:"bg-white dark:bg-black border-2 border-red-600 flex flex-col",onClick:t[0]||(t[0]=Ce(()=>{},["stop"]))},[l(" Header "),o("div",Qn,[o("h2",$n,k(n.title),1),o("button",{onClick:e.handleCancel,class:"p-1 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors","aria-label":"Close dialog"},[C(e.IconX,{class:"w-5 h-5 text-red-600"})])]),l(" Content "),o("div",ea,[o("p",ta,k(n.message),1),o("div",oa,[o("button",{onClick:e.handleCancel,class:"px-4 py-2 border-2 border-black dark:border-white bg-white dark:bg-black text-black dark:text-white hover:bg-neutral-50 dark:hover:bg-neutral-900 transition-colors"},k(n.cancelText),1),o("button",{onClick:e.handleConfirm,class:"px-4 py-2 border-2 border-red-600 bg-red-600 text-white hover:bg-red-700 hover:border-red-700 transition-colors"},k(n.confirmText),1)])])])]),_:1})])):l("v-if",!0)]),_:1})])):l("v-if",!0)]),_:1})])}const Yt=ne(Xn,[["render",ra],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/ConfirmDialog.vue"]]),na=ae({__name:"Modal",props:{modelValue:{type:Boolean,required:!0},title:{type:String,required:!1},width:{type:String,required:!1,default:"max-w-lg"},minHeight:{type:String,required:!1,default:"min-h-[24rem]"},hasChanges:{type:Boolean,required:!1,default:void 0}},emits:["update:modelValue","close"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=m(),r=m(!1),d=m(new Map),u=()=>i.value&&(i.value.querySelector("input")||i.value.querySelector("textarea")||i.value.querySelector("select")||i.value.querySelector("[contenteditable]")||i.value.querySelector(".monaco-editor")),h=()=>{if(!i.value)return;i.value.querySelectorAll(".monaco-editor-container").forEach(B=>{const H=B.__monacoEditor;if(H&&typeof H.getValue=="function"){const re=H.getValue();d.value.set(B,re)}})},f=()=>{if(!i.value)return!1;const O=i.value.querySelectorAll(".monaco-editor-container");for(const B of O){const H=B.__monacoEditor;if(H&&typeof H.getValue=="function"){const re=H.getValue(),Q=d.value.get(B);if(Q===void 0||(H.getRawOptions?.()||{}).readOnly===!0)continue;if(re!==Q)return!0}}return!1},v=()=>{if(e.hasChanges!==void 0)return e.hasChanges;if(!i.value)return!1;if(f())return!0;const O=i.value.querySelectorAll("form");for(const H of O){const Q=H.querySelectorAll("input, textarea, select");for(const q of Q){const K=q;if(K.type==="checkbox"||K.type==="radio"){const R=K;if(R.checked!==R.defaultChecked)return!0}else if(K.tagName==="SELECT"){const R=K;if(R.value!==R.defaultValue)return!0}else if(K.value!==K.defaultValue)return!0}}const B=i.value.querySelectorAll("input:not(form input), textarea:not(form textarea), select:not(form select)");for(const H of B){const re=H;if(re.type==="checkbox"||re.type==="radio"){const Q=re;if(Q.checked!==Q.defaultChecked)return!0}else if(re.tagName==="SELECT"){const Q=re;if(Q.value!==Q.defaultValue)return!0}else if(re.value!==re.defaultValue)return!0}return!1},g=()=>{u()&&v()?r.value=!0:x()},x=()=>{c("update:modelValue",!1),c("close")},y=()=>{r.value=!1,x()},_=()=>{r.value=!1},T=O=>{O.key==="Escape"&&e.modelValue&&(u()||x())};ce(()=>e.modelValue,async O=>{O?(document.addEventListener("keydown",T),document.body.style.overflow="hidden",await be(),setTimeout(()=>{h()},100)):(document.removeEventListener("keydown",T),document.body.style.overflow="",d.value.clear())});const b=m(!1),L={props:e,emit:c,modalRef:i,showConfirmDialog:r,monacoInitialValues:d,hasFormFields:u,captureMonacoInitialValues:h,hasMonacoChanges:f,hasUnsavedChanges:v,attemptClose:g,close:x,handleConfirmClose:y,handleCancelClose:_,handleKeydown:T,mouseDownOnBackdrop:b,handleBackdropMouseDown:O=>{b.value=O.target===O.currentTarget},handleBackdropClick:O=>{O.target===O.currentTarget&&b.value&&(u()||x()),b.value=!1},DropShadow:Ye,ConfirmDialog:Yt,get IconX(){return Xt}};return Object.defineProperty(L,"__isScriptSetup",{enumerable:!1,value:!0}),L}}),aa={class:"flex items-center justify-between p-4 border-b-2 border-black dark:border-neutral-300 flex-shrink-0"},la={class:"text-xl font-bold"},sa={class:"overflow-y-auto flex-1"},ia={class:"p-6"},da={key:0,class:"p-6 border-t-2 border-black dark:border-neutral-300 flex-shrink-0"};function ca(p,t,n,e,c,i){return a(),ee(ht,{to:"body"},[C(ze,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:de(()=>[n.modelValue?(a(),s("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-white/80 dark:bg-black/80 backdrop-blur-sm dark:text-white",onMousedown:e.handleBackdropMouseDown,onClick:e.handleBackdropClick},[C(ze,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:de(()=>[n.modelValue?(a(),s("div",{key:0,class:$(["w-full",n.width,"max-h-[85vh] flex flex-col"])},[C(e.DropShadow,{"offset-x":12,"offset-y":12,intensity:.4},{default:de(()=>[o("div",{ref:"modalRef",class:$(["bg-white dark:bg-black border-2 border-black dark:border-neutral-300 flex flex-col max-h-[85vh]",n.minHeight])},[l(" Header (fixed) "),o("div",aa,[o("h2",la,k(n.title),1),o("button",{onClick:e.attemptClose,class:"p-1 hover:bg-black/5 dark:hover:bg-white/10 rounded transition-colors","aria-label":"Close modal"},[C(e.IconX,{class:"w-5 h-5"})])]),l(" Content (scrollable) "),o("div",sa,[o("div",ia,[He(p.$slots,"default")])]),l(" Footer (fixed, optional) "),p.$slots.footer?(a(),s("div",da,[He(p.$slots,"footer")])):l("v-if",!0)],2)]),_:3})],2)):l("v-if",!0)]),_:3})],32)):l("v-if",!0)]),_:3}),l(" Confirmation dialog for unsaved changes "),C(e.ConfirmDialog,{modelValue:e.showConfirmDialog,"onUpdate:modelValue":t[0]||(t[0]=r=>e.showConfirmDialog=r),title:"Unsaved Changes",message:"You have unsaved changes that will be lost. Are you sure you want to close?","confirm-text":"Close Anyway","cancel-text":"Keep Editing",onConfirm:e.handleConfirmClose,onCancel:e.handleCancelClose},null,8,["modelValue"])])}const Ne=ne(na,[["render",ca],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/Modal.vue"]]),ua=ae({__name:"TextInput",props:{modelValue:{type:String,required:!1},label:{type:String,required:!1},placeholder:{type:String,required:!1},type:{type:String,required:!1,default:"text"},error:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1}},emits:["update:modelValue","focus","click"],setup(p,{expose:t,emit:n}){const e=p,c=n,i=m(null),r=z(()=>["w-full px-3 py-2.5 bg-neutral-50 dark:bg-neutral-950 border rounded-md text-sm","focus:outline-none focus:ring-2 focus:ring-neutral-400 dark:focus:ring-neutral-500 focus:border-transparent","transition-colors placeholder:text-neutral-400 dark:placeholder:text-neutral-500",e.error?"border-red-500 dark:border-red-400":"border-neutral-300 dark:border-neutral-800",e.disabled?"opacity-50 cursor-not-allowed":""]),d=v=>{const g=v.target;c("update:modelValue",g.value)},u=v=>{c("focus",v)},h=v=>{c("click",v)};t({inputRef:i});const f={props:e,emit:c,inputRef:i,inputClasses:r,handleInput:d,handleFocus:u,handleClick:h};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),pa={class:"space-y-1.5"},ma={key:0,class:"block text-sm font-medium text-neutral-700 dark:text-neutral-300"},ga={key:0,class:"text-red-500"},fa=["type","value","placeholder","disabled"],ha={key:1,class:"text-xs text-red-500 dark:text-red-400"};function va(p,t,n,e,c,i){return a(),s("div",pa,[n.label?(a(),s("label",ma,[ke(k(n.label)+" ",1),n.required?(a(),s("span",ga,"*")):l("v-if",!0)])):l("v-if",!0),o("input",{ref:"inputRef",type:n.type,value:n.modelValue,placeholder:n.placeholder,disabled:n.disabled,class:$(e.inputClasses),onInput:e.handleInput,onFocus:e.handleFocus,onClick:e.handleClick},null,42,fa),n.error?(a(),s("p",ha,k(n.error),1)):l("v-if",!0)])}const Ke=ne(ua,[["render",va],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/TextInput.vue"]]),ba=ae({__name:"TextareaInput",props:{modelValue:{type:String,required:!1},label:{type:String,required:!1},placeholder:{type:String,required:!1},error:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},rows:{type:Number,required:!1,default:4}},emits:["update:modelValue"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=z(()=>["w-full px-3 py-2 bg-white dark:bg-black border rounded font-mono text-sm","focus:outline-none focus:ring-2 focus:ring-black dark:focus:ring-white","transition-colors resize-y",e.error?"border-red-500 dark:border-red-400":"border-black dark:border-neutral-300",e.disabled?"opacity-50 cursor-not-allowed":""]),d={props:e,emit:c,textareaClasses:i,handleInput:u=>{const h=u.target;c("update:modelValue",h.value)}};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}}),ya={class:"space-y-1"},xa={key:0,class:"block text-sm font-medium"},ka={key:0,class:"text-red-500"},_a=["value","placeholder","disabled","rows"],wa={key:1,class:"text-xs text-red-500 dark:text-red-400"};function Ca(p,t,n,e,c,i){return a(),s("div",ya,[n.label?(a(),s("label",xa,[ke(k(n.label)+" ",1),n.required?(a(),s("span",ka,"*")):l("v-if",!0)])):l("v-if",!0),o("textarea",{value:n.modelValue,placeholder:n.placeholder,disabled:n.disabled,rows:n.rows,class:$(e.textareaClasses),onInput:e.handleInput},null,42,_a),n.error?(a(),s("p",wa,k(n.error),1)):l("v-if",!0)])}const Qt=ne(ba,[["render",Ca],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/TextareaInput.vue"]]),Sa=ae({__name:"SelectInput",props:{modelValue:{type:String,required:!1},options:{type:Array,required:!0},placeholder:{type:String,required:!1,default:"Select an option"},searchPlaceholder:{type:String,required:!1,default:"Search..."},label:{type:String,required:!1},disabled:{type:Boolean,required:!1,default:!1},loading:{type:Boolean,required:!1,default:!1},error:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1}},emits:["update:modelValue"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=m(!1),r=m(""),d=m(),u=m(),h=m(),f=m(),v=m(-1),g=z(()=>e.options.find(q=>q.value===e.modelValue)),x=z(()=>["w-full px-3 py-2 text-left rounded focus:outline-none focus:ring-2 bg-white dark:bg-black disabled:opacity-50 disabled:cursor-not-allowed font-mono text-sm overflow-hidden",e.error?"border border-red-500 dark:border-red-400 focus:ring-red-500 dark:focus:ring-red-400":"border border-black dark:border-neutral-300 focus:ring-black dark:focus:ring-white"]),y=z(()=>{if(!r.value)return e.options;const q=r.value.toLowerCase();return e.options.filter(K=>K.label.toLowerCase().includes(q)||K.value.toLowerCase().includes(q)||K.description&&K.description.toLowerCase().includes(q))});ce(y,()=>{v.value=-1});const _=()=>{e.disabled||(i.value?S():(i.value=!0,r.value="",v.value=-1,be(()=>{if(f.value&&(f.value.setAttribute("popover","auto"),f.value.addEventListener("toggle",re),"showPopover"in f.value))try{f.value.showPopover()}catch{}M(),setTimeout(()=>d.value?.focus(),0)})))},T=q=>{c("update:modelValue",q.value),S(),r.value="",v.value=-1},b=q=>{q.stopPropagation(),c("update:modelValue","")},S=()=>{if(f.value){if("hidePopover"in f.value)try{f.value.hidePopover()}catch{}f.value.removeEventListener("toggle",re)}i.value=!1,v.value=-1},M=()=>{if(!h.value||!f.value)return;const q=h.value.getBoundingClientRect();f.value.offsetWidth||q.width,f.value.style.position="fixed",f.value.style.top=`${q.bottom+8}px`,f.value.style.left=`${q.left}px`,f.value.style.width=`${q.width}px`,f.value.style.margin="0"},L=q=>{u.value&&!u.value.contains(q.target)&&f.value&&!f.value.contains(q.target)&&S()},O=q=>{q.key==="Escape"&&i.value&&(S(),h.value?.focus())},B=q=>{if(!i.value)return;const K=y.value;if(K.length!==0)switch(q.key){case"ArrowDown":q.preventDefault(),v.value=v.value<K.length-1?v.value+1:0,H();break;case"ArrowUp":q.preventDefault(),v.value=v.value>0?v.value-1:K.length-1,H();break;case"Enter":q.preventDefault(),v.value>=0&&v.value<K.length&&T(K[v.value]);break}},H=()=>{be(()=>{const q=f.value?.querySelector(".highlighted-option");q&&q.scrollIntoView({block:"nearest",behavior:"smooth"})})},re=q=>{q.target===f.value&&(i.value=q.newState==="open",i.value&&M())};xe(()=>{document.addEventListener("click",L),document.addEventListener("keydown",O);const q=()=>{i.value&&M()};window.addEventListener("resize",q),window.addEventListener("scroll",q,!0)}),Be(()=>{document.removeEventListener("click",L),document.removeEventListener("keydown",O),window.removeEventListener("resize",M),window.removeEventListener("scroll",M,!0)});const Q={props:e,emit:c,isOpen:i,searchQuery:r,searchInput:d,dropdownRef:u,buttonRef:h,popoverRef:f,highlightedIndex:v,selectedOption:g,buttonClasses:x,filteredOptions:y,toggleDropdown:_,selectOption:T,clearValue:b,closePopover:S,positionPopover:M,handleClickOutside:L,handleEscape:O,handleKeyDown:B,scrollToHighlighted:H,handlePopoverToggle:re,DropShadow:Ye};return Object.defineProperty(Q,"__isScriptSetup",{enumerable:!1,value:!0}),Q}}),Ta={ref:"dropdownRef",class:"relative"},Ma={key:0,class:"block text-sm font-medium mb-2"},Ia={key:0,class:"text-red-500"},Va=["disabled","aria-expanded"],La={class:"flex items-center justify-between gap-1"},Pa={key:0,class:"flex items-center gap-2 text-neutral-400 flex-1 min-w-0"},Aa={key:1,class:"flex items-center gap-2 flex-1 min-w-0"},Ea=["src","alt"],Oa={class:"block truncate"},ja={key:2,class:"block truncate text-neutral-400 flex-1 min-w-0"},Da={key:1,ref:"popoverRef",class:"dropdown-popover"},qa={class:"bg-white dark:bg-black border-2 border-black dark:border-neutral-300 rounded-lg overflow-hidden"},Ua={class:"p-2 border-b border-neutral-200 dark:border-neutral-700"},Ba=["placeholder"],Ra={class:"max-h-60 overflow-y-auto"},Na={key:0,class:"px-4 py-3 text-sm text-neutral-500 dark:text-neutral-400"},Fa=["onClick","onMouseenter"],Ha={class:"flex-shrink-0 w-5 h-5 mt-0.5"},za=["src","alt"],Wa={key:1,class:"w-full h-full bg-neutral-200 dark:bg-neutral-700 rounded"},Ja={class:"flex-1 min-w-0"},Ka={class:"text-sm font-medium text-black dark:text-white"},Za={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},Ga={key:2,class:"mt-1 text-xs text-red-500 dark:text-red-400"};function Xa(p,t,n,e,c,i){return a(),s("div",Ta,[n.label?(a(),s("label",Ma,[ke(k(n.label)+" ",1),n.required?(a(),s("span",Ia,"*")):l("v-if",!0)])):l("v-if",!0),o("button",{ref:"buttonRef",type:"button",onClick:e.toggleDropdown,disabled:n.disabled,"aria-expanded":e.isOpen,"aria-haspopup":!0,class:$(e.buttonClasses)},[o("div",La,[n.loading?(a(),s("span",Pa,[...t[1]||(t[1]=[o("svg",{class:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[o("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),o("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1),ke(" Loading... ",-1)])])):e.selectedOption?(a(),s("span",Aa,[e.selectedOption.icon?(a(),s("img",{key:0,src:e.selectedOption.icon,alt:e.selectedOption.label,class:"w-5 h-5 flex-shrink-0"},null,8,Ea)):l("v-if",!0),o("span",Oa,k(e.selectedOption.label),1)])):(a(),s("span",ja,k(n.placeholder),1)),l(" Clear button (only shown when value is selected) "),e.selectedOption&&!n.disabled?(a(),s("button",{key:3,type:"button",onClick:e.clearValue,class:"flex-shrink-0 p-0.5 hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded transition-colors","aria-label":"Clear selection"},[...t[2]||(t[2]=[o("svg",{class:"h-4 w-4 text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[o("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)])])):l("v-if",!0),l(" Dropdown chevron "),t[3]||(t[3]=o("svg",{class:"h-5 w-5 text-neutral-400 flex-shrink-0",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[o("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1))])],10,Va),l(" Popover dropdown "),e.isOpen?(a(),s("div",Da,[C(e.DropShadow,{"offset-x":4,"offset-y":4,intensity:.3},{default:de(()=>[o("div",qa,[o("div",Ua,[Me(o("input",{ref:"searchInput","onUpdate:modelValue":t[0]||(t[0]=r=>e.searchQuery=r),type:"text",placeholder:n.searchPlaceholder,onKeydown:e.handleKeyDown,class:"w-full px-3 py-1.5 text-sm border border-neutral-300 dark:border-neutral-600 rounded focus:outline-none focus:ring-1 focus:ring-black dark:focus:ring-white bg-white dark:bg-black text-black dark:text-white placeholder:text-neutral-400 dark:placeholder:text-neutral-500"},null,40,Ba),[[Oe,e.searchQuery]])]),o("div",Ra,[e.filteredOptions.length===0?(a(),s("div",Na," No options found ")):l("v-if",!0),(a(!0),s(X,null,ve(e.filteredOptions,(r,d)=>(a(),s("button",{key:r.value,type:"button",onClick:u=>e.selectOption(r),onMouseenter:u=>e.highlightedIndex=d,class:$(["w-full px-4 py-2 text-left hover:bg-neutral-100 dark:hover:bg-neutral-900 focus:bg-neutral-100 dark:focus:bg-neutral-900 focus:outline-none flex items-start gap-3",{"bg-neutral-50 dark:bg-neutral-900":r.value===n.modelValue,"bg-neutral-100 dark:bg-neutral-800 highlighted-option":d===e.highlightedIndex}])},[o("div",Ha,[r.icon?(a(),s("img",{key:0,src:r.icon,alt:r.label,class:"w-full h-full"},null,8,za)):(a(),s("div",Wa))]),o("div",Ja,[o("div",Ka,k(r.label),1),r.description?(a(),s("div",Za,k(r.description),1)):l("v-if",!0)])],42,Fa))),128))])])]),_:1})],512)):l("v-if",!0),n.error?(a(),s("p",Ga,k(n.error),1)):l("v-if",!0)],512)}const Ae=ne(Sa,[["render",Xa],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/SelectInput.vue"]]),Ya=ae({__name:"CheckboxInput",props:{modelValue:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1},helpText:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},error:{type:String,required:!1}},emits:["update:modelValue"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=po(),r=z(()=>["w-5 h-5 border-2 rounded relative flex-shrink-0","transition-all duration-150",e.error?"border-red-500 dark:border-red-400":"border-black dark:border-neutral-300",e.disabled?"opacity-50":"hover:scale-110",e.modelValue?"bg-black dark:bg-white":"bg-white dark:bg-black","before:content-[''] before:absolute before:inset-0 before:m-auto before:w-2.5 before:h-1.5 before:border-white dark:before:border-black before:border-b-2 before:border-l-2 before:rotate-[-45deg]",e.modelValue?"before:block":"before:hidden"]),u={props:e,emit:c,checkboxId:i,decoratorClasses:r,handleChange:h=>{if(!e.disabled){const f=h.target;c("update:modelValue",f.checked)}}};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),Qa={class:"flex items-start"},$a=["for"],el=["id","checked","disabled"],tl={class:"flex items-center h-5"},ol={class:"flex-1"},rl={key:0,class:"text-red-500"},nl={key:1,class:"text-xs text-neutral-600 dark:text-neutral-400 mt-1"},al={key:2,class:"text-xs text-red-500 dark:text-red-400 mt-1"};function ll(p,t,n,e,c,i){return a(),s("div",Qa,[o("label",{for:e.checkboxId,class:$(["flex items-start space-x-3 cursor-pointer select-none",{"cursor-not-allowed":n.disabled}])},[o("input",{id:e.checkboxId,type:"checkbox",checked:n.modelValue,disabled:n.disabled,onChange:e.handleChange,class:"absolute left-[-9999px]"},null,40,el),o("div",tl,[o("span",{class:$(e.decoratorClasses)},null,2)]),o("div",ol,[n.label?(a(),s("span",{key:0,class:$(["block text-sm font-medium",{"opacity-50":n.disabled}])},[ke(k(n.label)+" ",1),n.required?(a(),s("span",rl,"*")):l("v-if",!0)],2)):l("v-if",!0),n.helpText?(a(),s("p",nl,k(n.helpText),1)):l("v-if",!0),n.error?(a(),s("p",al,k(n.error),1)):l("v-if",!0)])],10,$a)])}const dt=ne(Ya,[["render",ll],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/CheckboxInput.vue"]]),sl=ae({__name:"AgentModal",props:{modelValue:{type:Boolean,required:!0},editAgent:{type:null,required:!1},mode:{type:String,required:!1}},emits:["update:modelValue","save"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=z(()=>e.mode==="edit"),r=m(!1),d=m(""),u=m(""),h=m(""),f=m(null),v=m(""),g=m("dual_ai"),x=m(!1),y=m(""),_=m(""),T=m(null),b=m(""),S=m(""),M=m(""),L=m(""),O=m(!0),B=m(!1),H=m(""),re=m(""),Q=m(""),q=m(""),K=m(!1),R=m(null),Y=m(""),E=m(""),N=m(""),w=m(""),I=m(""),A=m(""),V=m(!0),P=m(!1),U=m(""),D=m(""),W=m(""),G=m(""),se=m(null),he=m(""),me=m(""),j=m(""),{data:F,execute:oe}=Ve(te("/api/prompts"),{immediate:!1}).json(),{data:pe,execute:Ie}=Ve(te("/api/tools?schema=true"),{immediate:!1}).json(),Te=m(null),Le=m(!1),_e=m(null),je=m(!1),Z=m(!1),ge=z(()=>{if(!F.value)return[{value:"",label:"Select a prompt..."}];const le=F.value?.prompts||[];return[{value:"",label:"None"},...le.map(fe=>({value:fe.id,label:fe.name}))]}),J=le=>pe.value?pe.value[le]:null,ie=z(()=>!Te.value||!Te.value.tools?[{value:"",label:"None"}]:[{value:"",label:"None"},...Te.value.tools.map(le=>{const fe=typeof le=="string"?le:le.name;return{value:fe,label:fe}})]),ue=z(()=>!_e.value||!_e.value.tools?[{value:"",label:"None"}]:[{value:"",label:"None"},..._e.value.tools.map(le=>{const fe=typeof le=="string"?le:le.name;return{value:fe,label:fe}})]),we=z(()=>{if(!H.value)return[];const le=J(H.value);return!le||!le.schema||!le.schema.properties?[]:Object.keys(le.schema.properties).map(fe=>({value:fe,label:fe}))}),Ee=z(()=>{if(!U.value)return[];const le=J(U.value);return!le||!le.schema||!le.schema.properties?[]:Object.keys(le.schema.properties).map(fe=>({value:fe,label:fe}))}),De=[{value:"dual_ai",label:"AI + AI (Subagent)"},{value:"ai_human",label:"AI + Human"}],et=z({get(){return u.value},set(le){const fe=f.value?.inputRef,ye=fe?.selectionStart??le.length;let qe=le.toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"");if(qe.endsWith("_agent")||(qe=qe+"_agent"),u.value=qe,fe){fe.value=qe;const Pe=Math.min(ye,qe.length-6);fe.setSelectionRange(Pe,Pe)}}}),tt=async()=>{await be();const le=f.value?.inputRef;if(le&&u.value.endsWith("_agent")){const fe=u.value.length-6;le.setSelectionRange(fe,fe)}},wt=le=>!le||le==="_agent"?(h.value="Name is required",!1):/^[a-z][a-z0-9_]*_agent$/.test(le)?(h.value="",!0):(h.value="Name must start with a letter",!1),ot=()=>{u.value="",d.value="",h.value="",v.value="",g.value="dual_ai",x.value=!1,y.value="",_.value="",T.value=null,b.value="",M.value="",L.value="",O.value=!0,B.value=!1,H.value="",re.value="",Q.value="",q.value="",K.value=!1,R.value=null,Y.value="",E.value="",N.value="",Te.value=null,I.value="",A.value="",V.value=!0,P.value=!1,U.value="",D.value="",W.value="",G.value="",se.value=null,he.value="",me.value="",j.value="",_e.value=null},Ct=async()=>{if(e.editAgent?.id){r.value=!0,Z.value=!0;try{const le=await fetch(te(`/api/agents/${e.editAgent.id}`));if(le.ok){const fe=await le.json(),ye=fe.agent||fe;u.value=ye.name||"",d.value=ye.name||"",v.value=ye.title||"",g.value=ye.type||"dual_ai",x.value=ye.expose_as_tool||!1,y.value=ye.tool_description||"",T.value=ye.max_session_turns;const qe=ye.side_a_stop_tool||"",Pe=ye.side_a_stop_tool_response_property||"",lo=ye.side_b_stop_tool||"",so=ye.side_b_stop_tool_response_property||"",io=ye.side_a_end_conversation_tool||"",co=ye.side_b_end_conversation_tool||"";S.value=ye.side_a_label||"",w.value=ye.side_b_label||"",M.value=ye.side_a_agent_prompt||"",I.value=ye.side_b_agent_prompt||"",O.value=!!ye.side_a_stop_on_response,B.value=!!ye.side_a_stop_tool,K.value=!!ye.side_a_manual_stop_condition,R.value=ye.side_a_max_turns,V.value=!!ye.side_b_stop_on_response,P.value=!!ye.side_b_stop_tool,se.value=ye.side_b_max_turns,await be(),H.value=qe,Q.value=Pe,U.value=lo,W.value=so,E.value=io,me.value=co}}catch(le){console.error("Error loading agent data:",le)}finally{r.value=!1,Z.value=!1}}},no=async()=>{h.value="",b.value="",L.value="",re.value="",q.value="",Y.value="",N.value="",A.value="",D.value="",G.value="",he.value="",j.value="";let le=!1;wt(u.value)||(le=!0);const fe=u.value;g.value==="dual_ai"&&T.value!==null&&T.value!==void 0&&T.value<=0&&(b.value="Max session turns must be a positive number",le=!0),M.value||(L.value="Please select an agent prompt",le=!0);const ye=O.value||H.value,qe=g.value==="ai_human"&&K.value;if(!ye&&!qe&&(L.value="At least one stop condition is required (or check manual stop condition for ai_human agents)",le=!0),H.value&&!Q.value&&(q.value="Response property required when using stop tool",le=!0),R.value!==null&&R.value<=0&&(Y.value="Max turns must be a positive number",le=!0),g.value==="dual_ai"&&!E.value&&!me.value&&(N.value="At least one side must have an end conversation tool",j.value="At least one side must have an end conversation tool",le=!0),g.value==="dual_ai"&&(I.value||(A.value="Please select an agent prompt",le=!0),U.value&&!W.value&&(G.value="Response property required when using stop tool",le=!0),se.value!==null&&se.value<=0&&(he.value="Max turns must be a positive number",le=!0)),le)return;const Pe={name:fe,title:v.value||null,type:g.value,expose_as_tool:x.value,tool_description:x.value?y.value:null,max_session_turns:g.value==="dual_ai"?T.value:null,side_a_label:S.value||null,side_a_agent_prompt:M.value,side_a_stop_on_response:O.value,side_a_stop_tool:H.value||null,side_a_stop_tool_response_property:Q.value||null,side_a_manual_stop_condition:K.value,side_a_max_turns:R.value,side_a_end_conversation_tool:E.value||null};g.value==="dual_ai"&&(Pe.side_b_label=w.value||null,Pe.side_b_agent_prompt=I.value,Pe.side_b_stop_on_response=V.value,Pe.side_b_stop_tool=U.value||null,Pe.side_b_stop_tool_response_property=W.value||null,Pe.side_b_max_turns=se.value,Pe.side_b_end_conversation_tool=me.value||null),i.value&&e.editAgent?.id&&(Pe.id=e.editAgent.id),c("save",Pe),ot(),c("update:modelValue",!1)},ao=()=>{ot(),c("update:modelValue",!1)};ce(M,async le=>{if(Z.value||(H.value="",Q.value=""),!le){Te.value=null;return}Le.value=!0;try{const fe=await fetch(te(`/api/prompts/${le}`));fe.ok&&(Te.value=await fe.json())}catch(fe){console.error("Error fetching Side A prompt:",fe)}finally{Le.value=!1}}),ce(I,async le=>{if(Z.value||(U.value="",W.value=""),!le){_e.value=null;return}je.value=!0;try{const fe=await fetch(te(`/api/prompts/${le}`));fe.ok&&(_e.value=await fe.json())}catch(fe){console.error("Error fetching Side B prompt:",fe)}finally{je.value=!1}}),ce(B,le=>{le||(H.value="",Q.value="")}),ce(P,le=>{le||(U.value="",W.value="")}),ce(()=>e.modelValue,async le=>{le&&(await Promise.all([oe(),Ie()]),i.value?(ot(),await Ct()):ot())});const St={props:e,emit:c,isEditMode:i,isLoading:r,originalName:d,name:u,nameError:h,nameInputRef:f,title:v,agentType:g,exposeAsTool:x,toolDescription:y,toolDescriptionError:_,maxSessionTurns:T,maxSessionTurnsError:b,sideALabel:S,sideAAgentPrompt:M,sideAAgentPromptError:L,sideAStopOnResponse:O,sideAStopOnToolCall:B,sideAStopTool:H,sideAStopToolError:re,sideAStopToolResponseProperty:Q,sideAStopToolResponsePropertyError:q,sideAManualStopCondition:K,sideAMaxTurns:R,sideAMaxTurnsError:Y,sideAEndConversationTool:E,sideAEndConversationToolError:N,sideBLabel:w,sideBAgentPrompt:I,sideBAgentPromptError:A,sideBStopOnResponse:V,sideBStopOnToolCall:P,sideBStopTool:U,sideBStopToolError:D,sideBStopToolResponseProperty:W,sideBStopToolResponsePropertyError:G,sideBMaxTurns:se,sideBMaxTurnsError:he,sideBEndConversationTool:me,sideBEndConversationToolError:j,promptsData:F,fetchPrompts:oe,toolsData:pe,fetchTools:Ie,sideAPromptData:Te,sideAPromptLoading:Le,sideBPromptData:_e,sideBPromptLoading:je,isLoadingAgentData:Z,promptOptions:ge,getToolByName:J,sideAToolOptions:ie,sideBToolOptions:ue,sideAResponsePropertyOptions:we,sideBResponsePropertyOptions:Ee,agentTypeOptions:De,agentName:et,handleNameFocus:tt,validateAgentName:wt,resetForm:ot,loadAgentData:Ct,handleSubmit:no,handleCancel:ao,Modal:Ne,TextInput:Ke,TextareaInput:Qt,SelectInput:Ae,CheckboxInput:dt};return Object.defineProperty(St,"__isScriptSetup",{enumerable:!1,value:!0}),St}}),il={key:0,class:"min-h-[400px] flex items-center justify-center"},dl={key:1,class:"space-y-6 pr-2 pb-4"},cl={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},ul={key:1,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},pl={key:0},ml={key:1},gl={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},fl={key:2},hl={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},vl={class:"grid grid-cols-2 gap-6"},bl={class:"space-y-4 p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},yl={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},xl={class:"space-y-3"},kl={class:"flex items-start"},_l={key:0,class:"ml-8 mt-2 space-y-2"},wl={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-1"},Cl={key:1},Sl={key:0,class:"mt-3 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded"},Tl={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Ml={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Il={class:"space-y-4 p-4 bg-neutral-100 dark:bg-neutral-800 rounded-lg"},Vl={class:"font-semibold text-base mb-4 text-neutral-800 dark:text-neutral-200"},Ll={key:0,class:"flex flex-col items-center justify-center py-8"},Pl={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Al={class:"space-y-3"},El={class:"flex items-start"},Ol={key:0,class:"ml-8 mt-2 space-y-2"},jl={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-1"},Dl={key:1},ql={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Ul={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Bl={class:"flex justify-between"},Rl=["disabled"];function Nl(p,t,n,e,c,i){return a(),ee(e.Modal,{"model-value":n.modelValue,"onUpdate:modelValue":t[23]||(t[23]=r=>p.$emit("update:modelValue",r)),title:e.isEditMode?"Edit Agent":"Create Agent",width:"max-w-6xl"},{footer:de(()=>[o("div",Bl,[o("button",{onClick:e.handleCancel,type:"button",class:"px-3 py-1.5 text-sm border border-black dark:border-white rounded font-medium hover:bg-black/5 dark:hover:bg-white/10 transition-colors"}," Cancel "),o("button",{onClick:e.handleSubmit,type:"button",class:"px-3 py-1.5 text-sm bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity",disabled:e.isLoading},k(e.isEditMode?"Update Agent":"Create Agent"),9,Rl)])]),default:de(()=>[e.isLoading?(a(),s("div",il,[...t[24]||(t[24]=[o("span",{class:"text-neutral-500"},"Loading agent data...",-1)])])):(a(),s("div",dl,[l(" Agent Name "),o("div",null,[C(e.TextInput,{ref:"nameInputRef",modelValue:e.agentName,"onUpdate:modelValue":t[0]||(t[0]=r=>e.agentName=r),label:"Agent Name",placeholder:"research_agent",error:e.nameError,required:"",disabled:e.isEditMode,onFocus:e.handleNameFocus,onClick:e.handleNameFocus},null,8,["modelValue","error","disabled"]),!e.nameError&&!e.isEditMode?(a(),s("p",cl," Names are automatically formatted to snake_case with the _agent suffix ")):l("v-if",!0),e.isEditMode?(a(),s("p",ul," Agent names cannot be changed after creation (used as foreign key for threads) ")):l("v-if",!0)]),l(" Agent Title "),o("div",null,[C(e.TextInput,{modelValue:e.title,"onUpdate:modelValue":t[1]||(t[1]=r=>e.title=r),label:"Display Title (Optional)",placeholder:"Research Assistant"},null,8,["modelValue"]),t[25]||(t[25]=o("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Human-readable title shown in the UI. If not set, the name will be used. ",-1))]),l(" Agent Type "),o("div",null,[C(e.SelectInput,{modelValue:e.agentType,"onUpdate:modelValue":t[2]||(t[2]=r=>e.agentType=r),label:"Agent Type",options:e.agentTypeOptions},null,8,["modelValue"]),t[26]||(t[26]=o("p",{class:"mt-1 text-sm text-neutral-500 dark:text-neutral-400"}," Choose between two AI agents conversing, or an AI agent conversing with a human ",-1))]),l(" Expose as Tool (only for dual_ai agents) "),e.agentType==="dual_ai"?(a(),s("div",pl,[C(e.CheckboxInput,{modelValue:e.exposeAsTool,"onUpdate:modelValue":t[3]||(t[3]=r=>e.exposeAsTool=r),label:"Expose as Tool"},null,8,["modelValue"]),t[27]||(t[27]=o("p",{class:"mt-1 text-sm text-neutral-500 dark:text-neutral-400"}," Make this subagent available as a tool that can be called by other prompts or agents. When called, it will execute as a subagent. ",-1))])):l("v-if",!0),l(" Tool Description (only show if expose_as_tool is checked and agent is dual_ai) "),e.exposeAsTool&&e.agentType==="dual_ai"?(a(),s("div",ml,[C(e.TextareaInput,{modelValue:e.toolDescription,"onUpdate:modelValue":t[4]||(t[4]=r=>e.toolDescription=r),label:"Tool Description",placeholder:"Describe what this agent does when called as a tool",error:e.toolDescriptionError,rows:3},null,8,["modelValue","error"]),e.toolDescriptionError?l("v-if",!0):(a(),s("p",gl," This description helps other agents understand when to use this agent "))])):l("v-if",!0),l(" Max Session Turns (only show for dual_ai) "),e.agentType==="dual_ai"?(a(),s("div",fl,[C(e.TextInput,{"model-value":e.maxSessionTurns?.toString()||"","onUpdate:modelValue":t[5]||(t[5]=r=>e.maxSessionTurns=r?parseInt(r):null),label:"Max Session Turns",type:"number",error:e.maxSessionTurnsError,placeholder:"Unlimited"},null,8,["model-value","error"]),e.maxSessionTurnsError?l("v-if",!0):(a(),s("p",hl," Maximum number of back-and-forth exchanges between the two agents before the conversation ends "))])):l("v-if",!0),l(" Two Column Layout for both sides "),o("div",vl,[l(" Side A (AI) "),o("div",bl,[t[34]||(t[34]=o("h4",{class:"font-semibold text-base mb-4 text-neutral-800 dark:text-neutral-200"}," Side A (AI) ",-1)),l(" Label (Optional) "),o("div",null,[C(e.TextInput,{modelValue:e.sideALabel,"onUpdate:modelValue":t[6]||(t[6]=r=>e.sideALabel=r),label:"Side Label (Optional)",placeholder:"e.g., ATC, Pilot, Customer, Support"},null,8,["modelValue"]),t[28]||(t[28]=o("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Custom label for this side (shows in message bubbles and toggle) ",-1))]),l(" Agent Prompt "),o("div",null,[C(e.SelectInput,{modelValue:e.sideAAgentPrompt,"onUpdate:modelValue":t[7]||(t[7]=r=>e.sideAAgentPrompt=r),label:"Agent Prompt",options:e.promptOptions,error:e.sideAAgentPromptError,required:""},null,8,["modelValue","options","error"]),e.sideAAgentPromptError?l("v-if",!0):(a(),s("p",yl," The prompt that defines this agent's behavior "))]),l(" Stop Conditions "),o("div",xl,[t[31]||(t[31]=o("label",{class:"block text-sm font-medium"}," Stop Conditions ",-1)),t[32]||(t[32]=o("p",{class:"text-xs text-neutral-500 dark:text-neutral-400"}," Optional. If no stop conditions are set, the agent will continue until programmatically stopped or end conversation tool is called. ",-1)),l(" Stop on Response "),o("div",kl,[C(e.CheckboxInput,{modelValue:e.sideAStopOnResponse,"onUpdate:modelValue":t[8]||(t[8]=r=>e.sideAStopOnResponse=r),label:"Stop when agent returns content"},null,8,["modelValue"])]),t[33]||(t[33]=o("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-2 ml-6"}," Agent stops when it returns a response without calling tools ",-1)),l(" Stop on Tool Call "),o("div",null,[C(e.CheckboxInput,{modelValue:e.sideAStopOnToolCall,"onUpdate:modelValue":t[9]||(t[9]=r=>e.sideAStopOnToolCall=r),label:"Stop on specific tool call"},null,8,["modelValue"]),e.sideAStopOnToolCall?(a(),s("div",_l,[C(e.SelectInput,{modelValue:e.sideAStopTool,"onUpdate:modelValue":t[10]||(t[10]=r=>e.sideAStopTool=r),label:"Stop Tool",options:e.sideAToolOptions,error:e.sideAStopToolError,placeholder:"Select a tool...",disabled:e.sideAPromptLoading||!e.sideAAgentPrompt},null,8,["modelValue","options","error","disabled"]),e.sideAStopToolError?l("v-if",!0):(a(),s("p",wl," Agent stops when this tool is called ")),e.sideAStopTool?(a(),s("div",Cl,[C(e.SelectInput,{modelValue:e.sideAStopToolResponseProperty,"onUpdate:modelValue":t[11]||(t[11]=r=>e.sideAStopToolResponseProperty=r),label:"Response Property",options:e.sideAResponsePropertyOptions,error:e.sideAStopToolResponsePropertyError,placeholder:"Select property..."},null,8,["modelValue","options","error"]),t[29]||(t[29]=o("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Property from tool arguments to return as final response ",-1))])):l("v-if",!0)])):l("v-if",!0)]),l(" Manual Stop Condition (only for ai_human when both stop conditions are unchecked) "),e.agentType==="ai_human"&&!e.sideAStopOnResponse&&!e.sideAStopOnToolCall?(a(),s("div",Sl,[C(e.CheckboxInput,{modelValue:e.sideAManualStopCondition,"onUpdate:modelValue":t[12]||(t[12]=r=>e.sideAManualStopCondition=r),label:"I have manually implemented a stop condition"},null,8,["modelValue"]),t[30]||(t[30]=o("p",{class:"mt-2 text-xs text-yellow-800 dark:text-yellow-200"}," ⚠️ Warning: Only check this if you have implemented a custom stop condition in your code (e.g., via hooks or custom logic). Without a stop condition, the agent may run indefinitely. ",-1))])):l("v-if",!0)]),l(" Max Turns "),o("div",null,[C(e.TextInput,{"model-value":e.sideAMaxTurns?.toString()||"","onUpdate:modelValue":t[13]||(t[13]=r=>e.sideAMaxTurns=r?parseInt(r):null),label:"Max Turns",type:"number",error:e.sideAMaxTurnsError,placeholder:"Unlimited"},null,8,["model-value","error"]),e.sideAMaxTurnsError?l("v-if",!0):(a(),s("p",Tl," Maximum turns this side can take before yielding (safety limit) "))]),l(" End Conversation Tool "),o("div",null,[C(e.SelectInput,{modelValue:e.sideAEndConversationTool,"onUpdate:modelValue":t[14]||(t[14]=r=>e.sideAEndConversationTool=r),label:"End Conversation Tool",options:e.sideAToolOptions,error:e.sideAEndConversationToolError,placeholder:"Select a tool...",disabled:e.sideAPromptLoading||!e.sideAAgentPrompt},null,8,["modelValue","options","error","disabled"]),e.sideAEndConversationToolError?l("v-if",!0):(a(),s("p",Ml," Tool that ends the entire conversation when called "))])]),l(" Side B (AI or Human) "),o("div",Il,[o("h4",Vl," Side B ("+k(e.agentType==="ai_human"?"Human":"AI")+") ",1),l(" Label (Optional) - Available for both AI and Human "),o("div",null,[C(e.TextInput,{modelValue:e.sideBLabel,"onUpdate:modelValue":t[15]||(t[15]=r=>e.sideBLabel=r),label:"Side Label (Optional)",placeholder:"e.g., ATC, Pilot, Customer, Support"},null,8,["modelValue"]),t[35]||(t[35]=o("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Custom label for this side (shows in message bubbles and toggle) ",-1))]),e.agentType==="ai_human"?(a(),s("div",Ll,[...t[36]||(t[36]=[o("svg",{class:"w-20 h-20 mb-4 text-neutral-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})],-1),o("h5",{class:"font-medium text-lg mb-2"},"Human User",-1),o("p",{class:"text-sm text-neutral-500 dark:text-neutral-400 text-center max-w-xs"}," This side of the conversation will be handled by a human user through the interface ",-1)])])):(a(),s(X,{key:1},[l(" Agent Prompt "),o("div",null,[C(e.SelectInput,{modelValue:e.sideBAgentPrompt,"onUpdate:modelValue":t[16]||(t[16]=r=>e.sideBAgentPrompt=r),label:"Agent Prompt",options:e.promptOptions,error:e.sideBAgentPromptError,required:""},null,8,["modelValue","options","error"]),e.sideBAgentPromptError?l("v-if",!0):(a(),s("p",Pl," The prompt that defines this agent's behavior "))]),l(" Stop Conditions "),o("div",Al,[t[38]||(t[38]=o("label",{class:"block text-sm font-medium"}," Stop Conditions ",-1)),t[39]||(t[39]=o("p",{class:"text-xs text-neutral-500 dark:text-neutral-400"}," Optional. If no stop conditions are set, the agent will continue until programmatically stopped or end conversation tool is called. ",-1)),l(" Stop on Response "),o("div",El,[C(e.CheckboxInput,{modelValue:e.sideBStopOnResponse,"onUpdate:modelValue":t[17]||(t[17]=r=>e.sideBStopOnResponse=r),label:"Stop when agent returns content"},null,8,["modelValue"])]),t[40]||(t[40]=o("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-2 ml-6"}," Agent stops when it returns a response without calling tools ",-1)),l(" Stop on Tool Call "),o("div",null,[C(e.CheckboxInput,{modelValue:e.sideBStopOnToolCall,"onUpdate:modelValue":t[18]||(t[18]=r=>e.sideBStopOnToolCall=r),label:"Stop on specific tool call"},null,8,["modelValue"]),e.sideBStopOnToolCall?(a(),s("div",Ol,[C(e.SelectInput,{modelValue:e.sideBStopTool,"onUpdate:modelValue":t[19]||(t[19]=r=>e.sideBStopTool=r),label:"Stop Tool",options:e.sideBToolOptions,error:e.sideBStopToolError,placeholder:"Select a tool...",disabled:e.sideBPromptLoading||!e.sideBAgentPrompt},null,8,["modelValue","options","error","disabled"]),e.sideBStopToolError?l("v-if",!0):(a(),s("p",jl," Agent stops when this tool is called ")),e.sideBStopTool?(a(),s("div",Dl,[C(e.SelectInput,{modelValue:e.sideBStopToolResponseProperty,"onUpdate:modelValue":t[20]||(t[20]=r=>e.sideBStopToolResponseProperty=r),label:"Response Property",options:e.sideBResponsePropertyOptions,error:e.sideBStopToolResponsePropertyError,placeholder:"Select property..."},null,8,["modelValue","options","error"]),t[37]||(t[37]=o("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Property from tool arguments to return as final response ",-1))])):l("v-if",!0)])):l("v-if",!0)])]),l(" Max Turns "),o("div",null,[C(e.TextInput,{"model-value":e.sideBMaxTurns?.toString()||"","onUpdate:modelValue":t[21]||(t[21]=r=>e.sideBMaxTurns=r?parseInt(r):null),label:"Max Turns",type:"number",error:e.sideBMaxTurnsError,placeholder:"Unlimited"},null,8,["model-value","error"]),e.sideBMaxTurnsError?l("v-if",!0):(a(),s("p",ql," Maximum turns this side can take before yielding (safety limit) "))]),l(" End Conversation Tool "),o("div",null,[C(e.SelectInput,{modelValue:e.sideBEndConversationTool,"onUpdate:modelValue":t[22]||(t[22]=r=>e.sideBEndConversationTool=r),label:"End Conversation Tool",options:e.sideBToolOptions,error:e.sideBEndConversationToolError,placeholder:"Select a tool...",disabled:e.sideBPromptLoading||!e.sideBAgentPrompt},null,8,["modelValue","options","error","disabled"]),e.sideBEndConversationToolError?l("v-if",!0):(a(),s("p",Ul," Tool that ends the entire conversation when called "))])],64))])])]))]),_:1},8,["model-value","title"])}const Fl=ne(sl,[["render",Nl],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/AgentModal.vue"]]),Hl={},zl={class:"p-8 w-full max-w-7xl mx-auto"};function Wl(p,t){return a(),s("div",zl,[He(p.$slots,"default")])}const Ze=ne(Hl,[["render",Wl],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/CenteredContentView.vue"]]),Jl=ae({__name:"AgentsView",setup(p,{expose:t}){t();const n=Xe(),e=Fe(),c=m(!1),i=m("add"),r=m(null),d=m(null);ce(()=>e.query.refresh,()=>{e.query.refresh&&(d.value?.refresh(),n.replace({path:"/agents",query:{}}))});const v={router:n,route:e,showModal:c,modalMode:i,editingAgent:r,dataTableRef:d,handleAdd:()=>{i.value="add",r.value=null,c.value=!0},handleEdit:g=>{i.value="edit",r.value=g,c.value=!0},handleSave:async g=>{try{const x=i.value==="edit"&&r.value?.id,{originalName:y,..._}=g,T=te(x?`/api/agents/${r.value.id}`:"/api/agents"),S=await fetch(T,{method:x?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)});if(S.ok)d.value?.refresh(),c.value=!1,r.value=null;else{const M=await S.json();alert(M.error||`Failed to ${x?"update":"create"} agent`)}}catch(x){console.error(`Error ${i.value==="edit"?"updating":"creating"} agent:`,x),alert(`Failed to ${i.value==="edit"?"update":"create"} agent`)}},AgentsDataTable:Kn,AgentModal:Fl,CenteredContentView:Ze};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}});function Kl(p,t,n,e,c,i){return a(),ee(e.CenteredContentView,null,{default:de(()=>[o("div",{class:"flex justify-between items-center mb-6"},[t[1]||(t[1]=o("h1",{class:"text-3xl font-bold"},"Agents",-1)),o("button",{onClick:e.handleAdd,class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"}," Create Agent ")]),t[2]||(t[2]=o("p",{class:"text-neutral-600 dark:text-neutral-400 mb-6"}," Configure and manage your AI agents. ",-1)),C(e.AgentsDataTable,{ref:"dataTableRef",onAdd:e.handleAdd,onEdit:e.handleEdit},null,512),C(e.AgentModal,{modelValue:e.showModal,"onUpdate:modelValue":t[0]||(t[0]=r=>e.showModal=r),mode:e.modalMode,editAgent:e.editingAgent,onSave:e.handleSave},null,8,["modelValue","mode","editAgent"])]),_:1})}const Zl=ne(Jl,[["render",Kl],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/AgentsView.vue"]]);function Gl(p){const{limit:t=50,offset:n=0,agentId:e=null,userId:c=null,autoFetch:i=!0}={},r=z(()=>{const T=new URLSearchParams,b=typeof t=="number"?t:t.value,S=typeof n=="number"?n:n.value,M=typeof e=="string"?e:e?.value,L=typeof c=="string"?c:c?.value;return T.append("limit",b.toString()),T.append("offset",S.toString()),M&&T.append("agent_id",M),L&&T.append("user_id",L),te(`/api/threads?${T.toString()}`)}),{data:d,error:u,isFetching:h,isFinished:f,execute:v,abort:g}=Ve(r,{immediate:i}).get().json(),x=z(()=>d.value?.threads||[]),y=z(()=>d.value?.total||0),_=z(()=>d.value?.hasMore||!1);return{threads:x,total:y,hasMore:_,error:u,isFetching:h,isFinished:f,refetch:v,abort:g}}function bt(p){const t=z(()=>!!(typeof p=="string"?p:p?.value)),n=z(()=>{const f=typeof p=="string"?p:p?.value;return te(f?`/api/threads/${f}`:"/api/threads/placeholder")}),{data:e,error:c,isFetching:i,isFinished:r,execute:d,abort:u}=Ve(n,{immediate:!1}).get().json();return ce(t,f=>{f&&d()},{immediate:!0}),{thread:z(()=>e.value?{id:e.value.thread.id,agent_id:e.value.thread.agent_id,user_id:e.value.thread.user_id,tags:e.value.thread.tags||[],created_at:e.value.thread.created_at,agent:e.value.agent||{id:"",title:"Unknown",type:"unknown"},stats:e.value.stats}:null),error:c,isFetching:i,isFinished:r,refetch:d,abort:u}}function Xl(p){const{autoConnect:t=!0,onEvent:n}=p||{},e=m(null),c=m(!1),i=m(null),r=()=>{e.value&&e.value.close();const u=window.location.protocol==="https:"?"wss:":"ws:",h=window.location.host;let f=`${u}//${h}${te("/api/events")}`;const v=localStorage.getItem("auth_token");v&&(f+=`?token=${encodeURIComponent(v)}`);try{e.value=new WebSocket(f),e.value.onopen=()=>{c.value=!0,i.value=null,console.log("[AgentBuilderEvents] WebSocket connected")},e.value.onmessage=g=>{try{const x=JSON.parse(g.data);console.log("[AgentBuilderEvents] Received event:",x.type),n&&n(x)}catch(x){console.error("[AgentBuilderEvents] Failed to parse WebSocket message:",x)}},e.value.onerror=g=>{i.value="WebSocket connection error",c.value=!1,console.error("[AgentBuilderEvents] WebSocket error:",g)},e.value.onclose=()=>{c.value=!1,console.log("[AgentBuilderEvents] WebSocket disconnected")}}catch(g){i.value=g.message||"Failed to create WebSocket",console.error("[AgentBuilderEvents] WebSocket creation error:",g)}},d=()=>{e.value&&(e.value.close(),e.value=null,c.value=!1)};return t&&r(),Be(()=>{d()}),{wsConnected:c,wsError:i,connect:r,disconnect:d}}const Yl=ae({__name:"Loader",props:{size:{type:String,required:!1,default:"md"}},setup(p,{expose:t}){t();const n=p,e=z(()=>{switch(n.size){case"xs":return"w-3 h-3 border";case"sm":return"w-3.5 h-3.5 border";case"md":default:return"w-4 h-4 border-2"}}),c={props:n,sizeClasses:e};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}}),Ql={class:"inline-flex items-center justify-center"};function $l(p,t,n,e,c,i){return a(),s("div",Ql,[o("div",{class:$([e.sizeClasses,"border-black/20 dark:border-white/20 border-t-black dark:border-t-white rounded-full animate-spin"])},null,2)])}const $e=ne(Yl,[["render",$l],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/Loader.vue"]]);function es(p){const n=Date.now()*1e3-p,e=Math.floor(n/1e6);if(e<60)return e===1?"1 second ago":`${e} seconds ago`;const c=Math.floor(e/60);if(c<60)return c===1?"1 minute ago":`${c} minutes ago`;const i=Math.floor(c/60);if(i<24)return i===1?"1 hour ago":`${i} hours ago`;const r=Math.floor(i/24);if(r<30)return r===1?"1 day ago":`${r} days ago`;const d=Math.floor(r/30);if(d<12)return d===1?"1 month ago":`${d} months ago`;const u=Math.floor(d/12);return u===1?"1 year ago":`${u} years ago`}function ts(p){const t=m("");let n=null;const e=()=>typeof p=="function"?p():typeof p=="number"?p:p.value,c=()=>{const i=e();t.value=es(i);const d=Date.now()*1e3-i,u=Math.floor(d/1e6);n!==null&&(clearInterval(n),n=null),u<60?n=setInterval(c,1e3):u<3600?n=setInterval(c,6e4):u<86400&&(n=setInterval(c,6e5))};return c(),Be(()=>{n!==null&&clearInterval(n)}),t}const os=ae({__name:"TimeAgo",props:{timestamp:{type:Number,required:!0}},setup(p,{expose:t}){t();const n=p,e=ts(()=>n.timestamp),c={props:n,timeString:e};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}});function rs(p,t,n,e,c,i){return a(),s("span",null,k(e.timeString),1)}const yt=ne(os,[["render",rs],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/TimeAgo.vue"]]),ns=ae({__name:"StatusDot",props:{connected:{type:Boolean,required:!0},error:{type:Boolean,required:!1}},setup(p,{expose:t}){t();const n=m(!1),e=m(null),c={showPopover:n,popoverRef:e};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}}),as={class:"relative inline-flex items-center"},ls={key:0,class:"inline-block w-2 h-2 rounded-full bg-green-500 dark:bg-green-400"},ss={key:1,class:"inline-block w-2 h-2 rounded-full bg-red-500 dark:bg-red-400"},is={key:2,class:"inline-block w-2 h-2 rounded-full bg-neutral-400 dark:bg-neutral-600"},ds={key:0},cs={key:1},us={key:2};function ps(p,t,n,e,c,i){return a(),s("div",as,[o("span",{class:"p-0.5 cursor-default outline-none",tabindex:"-1",onMouseenter:t[0]||(t[0]=r=>e.showPopover=!0),onMouseleave:t[1]||(t[1]=r=>e.showPopover=!1)},[n.connected?(a(),s("span",ls)):n.error?(a(),s("span",ss)):(a(),s("span",is))],32),l(" Popover "),C(ze,{"enter-active-class":"transition-opacity duration-150","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:de(()=>[e.showPopover?(a(),s("div",{key:0,ref:"popoverRef",class:$(["absolute top-full left-1/2 -translate-x-1/2 mt-1 px-2 py-1 text-xs rounded shadow-lg whitespace-nowrap z-50 border",{"bg-green-50 dark:bg-green-950 border-green-200 dark:border-green-800 text-green-700 dark:text-green-300":n.connected,"bg-red-50 dark:bg-red-950 border-red-200 dark:border-red-800 text-red-700 dark:text-red-300":!n.connected&&n.error,"bg-neutral-50 dark:bg-neutral-900 border-neutral-200 dark:border-neutral-700 text-neutral-600 dark:text-neutral-400":!n.connected&&!n.error}])},[n.connected?(a(),s("span",ds,"Live - Connected")):n.error?(a(),s("span",cs,"Connection Error")):(a(),s("span",us,"Offline"))],2)):l("v-if",!0)]),_:1})])}const xt=ne(ns,[["render",ps],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/StatusDot.vue"]]),ms=ae({__name:"ThreadListPane",props:{selectedThreadId:{type:[String,null],required:!0}},emits:["selectThread","collapse","createThread","threadsLoaded"],setup(p,{expose:t,emit:n}){const e=p,c=n,i=m(""),{threads:r,isFetching:d,isFinished:u,error:h,refetch:f}=Gl(),v=m([]),g=m(new Set),x=z(()=>{const L=r.value.filter(H=>!g.value.has(H.id)),O=new Set(L.map(H=>H.id));return[...v.value.filter(H=>!O.has(H.id)&&!g.value.has(H.id)),...L].sort((H,re)=>re.created_at-H.created_at)}),y=async L=>{if(L.type==="thread_created"){const O={id:L.thread.id,agent_id:L.thread.agent_name,user_id:L.thread.user_id,tags:L.thread.tags||[],created_at:L.thread.created_at,agent:{title:L.thread.agent_name,type:"ai_human"}};v.value.unshift(O)}else L.type==="thread_deleted"&&(g.value.add(L.threadId),v.value=v.value.filter(O=>O.id!==L.threadId))},{wsConnected:_,wsError:T}=Xl({onEvent:y});ce(r,()=>{v.value=[]});const b=m(!1);ce(()=>({threads:r.value,finished:u.value}),({threads:L,finished:O})=>{O&&!b.value&&(b.value=!0,c("threadsLoaded",L[0]?.id??null))},{immediate:!0}),t({refetch:f});const M={props:e,emit:c,searchQuery:i,fetchedThreads:r,isFetching:d,isFinished:u,error:h,refetch:f,wsAddedThreads:v,wsRemovedThreadIds:g,threads:x,handleEvent:y,wsConnected:_,wsError:T,hasEmittedLoaded:b,handleThreadClick:L=>{c("selectThread",L)},Loader:$e,TimeAgo:yt,StatusDot:xt,get ListIcon(){return qt},get ChevronLeftIcon(){return vt}};return Object.defineProperty(M,"__isScriptSetup",{enumerable:!1,value:!0}),M}}),gs={class:"flex flex-col flex-1"},fs={class:"px-4 py-3 border-b border-neutral-300 dark:border-neutral-700"},hs={class:"flex items-center justify-between"},vs={class:"flex items-center gap-2"},bs={class:"flex items-center gap-2"},ys={class:"flex-1 overflow-y-auto text-xs"},xs={key:0,class:"p-2 flex justify-center"},ks={class:"p-2 text-red-600 dark:text-red-400"},_s=["id","onClick"],ws={class:"flex items-center gap-2 mb-1"},Cs={class:"font-medium truncate flex-1 min-w-0"},Ss={class:"flex-shrink-0 text-neutral-500 dark:text-neutral-400"},Ts={key:0,class:"flex flex-wrap gap-1"};function Ms(p,t,n,e,c,i){return a(),s("div",gs,[l(" Header (matches MessagesPane style) "),o("div",fs,[o("div",hs,[o("div",vs,[C(e.ListIcon,{size:18,class:"shrink-0"}),t[2]||(t[2]=o("h2",{class:"text-base font-bold"},"Threads",-1)),C(e.StatusDot,{connected:e.wsConnected,error:e.wsError},null,8,["connected","error"])]),o("div",bs,[o("button",{onClick:t[0]||(t[0]=r=>e.emit("createThread")),type:"button",class:"px-2 py-1 text-xs bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity whitespace-nowrap"}," + New "),o("button",{onClick:t[1]||(t[1]=r=>e.emit("collapse")),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Collapse pane"},[C(e.ChevronLeftIcon,{size:20})])])])]),l(" Thread list "),o("div",ys,[l(" Loading state "),e.isFetching?(a(),s("div",xs,[C(e.Loader)])):e.error?(a(),s(X,{key:1},[l(" Error state "),o("div",ks," Error: "+k(e.error),1)],2112)):e.threads.length===0?(a(),s(X,{key:2},[l(" Empty state "),t[3]||(t[3]=o("div",{class:"text-neutral-500 dark:text-neutral-400 text-center py-12 text-base"}," No threads found ",-1))],2112)):(a(),s(X,{key:3},[l(" Thread items - two line layout "),o("div",null,[(a(!0),s(X,null,ve(e.threads,r=>(a(),s("button",{key:r.id,id:`thread-${r.id}`,class:$(["w-full text-left px-2 py-2 border-b border-neutral-200 dark:border-neutral-800 cursor-pointer transition-colors relative hover:ring-2 hover:ring-inset hover:ring-accent-400 dark:hover:ring-accent-400",{"bg-accent-100 dark:bg-accent-900 dark:text-white ring-2 ring-inset ring-accent-400 dark:ring-accent-400":n.selectedThreadId===r.id}]),onClick:d=>e.handleThreadClick(r.id)},[l(" First line: Title and time "),o("div",ws,[o("span",Cs,k(r.agent.title),1),o("span",Ss,[C(e.TimeAgo,{timestamp:r.created_at*1e6},null,8,["timestamp"])])]),l(" Second line: Tags "),r.tags.length>0?(a(),s("div",Ts,[(a(!0),s(X,null,ve(r.tags,d=>(a(),s("span",{key:d,class:$(["inline-block px-1.5 py-0.5 rounded text-[10px]",n.selectedThreadId===r.id?"bg-accent-400 dark:bg-accent-950 text-accent-950 dark:text-accent-200":"bg-neutral-200 dark:bg-neutral-800 text-neutral-700 dark:text-neutral-300"])},k(d),3))),128))])):l("v-if",!0)],10,_s))),128))])],2112))])])}const Is=ne(ms,[["render",Ms],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/threads/ThreadListPane.vue"]]),rt=150;function Vs(p,t={}){const{enableWebSocket:n=!0,autoConnect:e=!0}=t,c=m([]),i=m(null),r=m(!1),d=m(!1),u=m(null),h=m(!1),f=m(null),v=m(!1),g=m(!1),x=m(0),y=m(0);let _=null,T=null;function b(E){if(!i.value?.agent)return null;const N=i.value.agent,w=E==="assistant"?"A":"B";return w==="A"&&N.side_a_label?N.side_a_label:w==="B"&&N.side_b_label?N.side_b_label:null}function S(E,N){return E==="system"||N==="system"?!1:E!==N}const M=z(()=>{const E=[],N=c.value.filter(A=>(A.depth??0)===0),w=new Map;for(let A=0;A<N.length;A++){const V=N[A],P=V.role;if(P==="tool"){const me=V.tool_call_id;if(me&&w.has(me)){const j=w.get(me),F=E[j],oe=F.items.find(pe=>pe.type==="tool_call"&&pe.tool_call_id===me);if(oe){oe.response=V.content||"",oe.response_log_id=V.log_id;const pe=(V.content||"").toLowerCase(),Ie=pe.length,Te=pe.includes("failed")||pe.includes("error"),Le=Ie<500;Te&&Le?oe.response_status="failed":oe.response_status="success"}F.updated_at=V.created_at,w.delete(me)}continue}const U=b(P==="tool"?"assistant":P),D=E[E.length-1],W=D?.role;D&&S(P,W)&&D.type==="work"&&!D.isComplete&&(D.isComplete=!0);let G=null;if(V.tool_calls)if(typeof V.tool_calls=="string")try{G=JSON.parse(V.tool_calls)}catch(me){console.error("Failed to parse tool_calls:",me)}else Array.isArray(V.tool_calls)&&(G=V.tool_calls);const se=G&&G.length>0,he=D?.type==="work"&&D.role===P&&!D.isComplete;if(se){let me,j;he?(me=D,j=E.length-1):(me={type:"work",id:V.id,role:P,items:[],created_at:V.created_at,updated_at:V.created_at,isComplete:!1,sideLabel:U,isExpanded:!1,request_sent_at:V.request_sent_at,response_completed_at:V.response_completed_at,status:V.status||"completed"},E.push(me),j=E.length-1),V.reasoning_content&&me.items.push({id:`${V.id}-reasoning`,type:"reasoning",content:V.reasoning_content,created_at:V.created_at,log_id:V.log_id}),V.content&&me.items.push({id:`${V.id}-content`,type:"content",content:V.content,created_at:V.created_at,log_id:V.log_id}),G.forEach(F=>{me.items.push({id:F.id,type:"tool_call",content:F.function.name,created_at:V.created_at,tool_name:F.function.name,tool_call_id:F.id,tool_arguments:F.function.arguments,log_id:V.log_id,response:null,response_status:"pending",response_log_id:null}),w.set(F.id,j)}),me.updated_at=V.created_at,V.response_completed_at&&(me.response_completed_at=V.response_completed_at),V.status&&V.status!=="completed"?me.status=V.status:V.status==="completed"&&me.status==="pending"&&(me.status="completed")}else he&&V.status!=="pending"&&(D.isComplete=!0),(V.content||P==="system"||V.status==="pending")&&E.push({type:"text",id:V.id,role:P,content:V.content||"",created_at:V.created_at,log_id:V.log_id,sideLabel:U,isOptimistic:V.isOptimistic,status:V.status})}const I=E[E.length-1];return I?.type==="work"&&!I.isComplete&&(I.isComplete=!0),E});async function L(){if(!p.value){c.value=[],i.value=null,g.value=!1,x.value=0,y.value=0;return}r.value=!0,u.value=null;try{const E=await fetch(te(`/api/threads/${p.value}/messages?limit=${rt}&includeSilent=true`));if(!E.ok)throw new Error(`Failed to fetch messages: ${E.statusText}`);const N=await E.json();c.value=N.messages||[],g.value=N.hasMore||!1,x.value=N.total||0,y.value=rt,console.log(`Loaded ${c.value.length} messages, total: ${x.value}, hasMore: ${g.value}`);const w=await fetch(te(`/api/threads/${p.value}`));if(w.ok){const I=await w.json();i.value=I}}catch(E){u.value=E instanceof Error?E.message:"Unknown error",console.error("Error fetching messages:",E)}finally{r.value=!1}}async function O(){if(!(!p.value||d.value||!g.value)){d.value=!0;try{const E=await fetch(te(`/api/threads/${p.value}/messages?limit=${rt}&offset=${y.value}`));if(!E.ok)throw new Error(`Failed to fetch more messages: ${E.statusText}`);const N=await E.json(),w=N.messages||[];c.value=[...w,...c.value],g.value=N.hasMore||!1,y.value+=rt,console.log(`Loaded ${w.length} more messages, offset now: ${y.value}, hasMore: ${g.value}`)}catch(E){u.value=E instanceof Error?E.message:"Unknown error",console.error("Error loading more messages:",E)}finally{d.value=!1}}}function B(){if(!(!n||!p.value||_))try{let N=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${te(`/api/threads/${p.value}/stream?includeSilent=true`)}`;const w=localStorage.getItem("auth_token");w&&(N+=`&token=${encodeURIComponent(w)}`),_=new WebSocket(N),_.onopen=()=>{h.value=!0,f.value=null,console.log("WebSocket connected")},_.onmessage=I=>{try{if(I.data==="pong")return;const A=JSON.parse(I.data);if(A.type==="message_data"&&A.message_id){const V=A.message_id,P=A.data,U=c.value.findIndex(D=>D.id===V);if(U>=0)c.value[U]={...c.value[U],...P,id:V};else{const D={id:V,...P},W=c.value.filter(G=>{if(!G.isOptimistic)return!0;if(G.id===V)return!1;const se=G.content===D.content,he=G.role===D.role,me=Math.abs(G.created_at-D.created_at)<5e6;return!(se&&he&&me)});W.push(D),c.value=W.sort((G,se)=>G.created_at-se.created_at)}if(P.status==="pending")v.value=!0;else if(P.status==="completed"||P.status==="failed"){const D=c.value.some(W=>{if((W.depth??0)>0)return!1;if(W.status==="pending"||W.role==="tool"&&W.tool_call_id&&!W.tool_status)return!0;if(W.tool_calls)try{const se=JSON.parse(W.tool_calls);if(Array.isArray(se)&&se.length>0&&!se.every(me=>c.value.some(j=>(j.depth??0)===0&&j.role==="tool"&&j.tool_call_id===me.id&&j.tool_status)))return!0}catch{}return!1});v.value=D}}else if(A.type==="message_chunk"){const V=A.message_id,P=A.chunk,U=c.value.findIndex(D=>D.id===V);if(U>=0){const D=c.value[U].content||"",W={...c.value[U],content:D+P};c.value.splice(U,1,W)}else{const D={id:V,role:"assistant",content:P,created_at:Date.now()*1e3,status:"pending"};c.value.push(D),c.value=c.value.sort((W,G)=>W.created_at-G.created_at)}}else A.type==="event"?console.log("📡",A.eventType,A.data):A.type==="error"&&(f.value=A.error||"WebSocket error",console.error("WebSocket error:",A.error))}catch(A){console.error("Error parsing WebSocket message:",A)}},_.onerror=I=>{f.value="WebSocket connection error",console.error("WebSocket error:",I)},_.onclose=()=>{h.value=!1,_=null,p.value&&n&&(T=setTimeout(()=>{console.log("Attempting WebSocket reconnect..."),B()},3e3))}}catch(E){f.value=E instanceof Error?E.message:"Unknown error",console.error("Error connecting WebSocket:",E)}}function H(){T&&(clearTimeout(T),T=null),_&&(_.close(),_=null,h.value=!1)}async function re(){await L()}function Q(E){c.value.push({...E,isOptimistic:!0})}function q(E){c.value=c.value.filter(N=>N.id!==E)}async function K(E){if(!p.value)return;const N=[...c.value];c.value=c.value.filter(w=>w.id!==E);try{if(!(await fetch(te(`/api/threads/${p.value}/messages/${E}`),{method:"DELETE"})).ok)throw c.value=N,new Error("Failed to delete message")}catch(w){throw c.value=N,w}}async function R(E,N){if(!p.value)return;const w=[...c.value];c.value=c.value.map(I=>I.id===E?{...I,content:N}:I);try{if(!(await fetch(te(`/api/threads/${p.value}/messages/${E}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:N})})).ok)throw c.value=w,new Error("Failed to update message")}catch(I){throw c.value=w,I}}async function Y(){if(p.value){v.value=!1;try{if(!(await fetch(te(`/api/threads/${p.value}/stop`),{method:"POST"})).ok)throw new Error("Failed to stop thread")}catch(E){throw console.error("Error stopping thread:",E),E}}}return ce(p,async(E,N)=>{E!==N&&(H(),E?(await L(),e&&n&&B()):(c.value=[],i.value=null))},{immediate:e}),Be(()=>{H()}),{messages:M,threadInfo:i,isFetching:r,isLoadingMore:d,error:u,wsConnected:h,wsError:f,isExecuting:v,hasMore:g,totalMessages:x,refetch:re,loadMoreMessages:O,connectWebSocket:B,disconnectWebSocket:H,addOptimisticMessage:Q,removeOptimisticMessage:q,deleteMessageById:K,updateMessageContent:R,stopThread:Y}}const Ls=ae({__name:"AgentMessages",props:{messages:{type:Array,required:!0},selectedMessageId:{type:[String,null],required:!1},selectedLogId:{type:[String,null],required:!1},hoveredLogId:{type:[String,null],required:!1},isEditMode:{type:Boolean,required:!1},selectedForDelete:{type:Set,required:!1},editedMessages:{type:Map,required:!1}},emits:["messageClick","messageHover","selectionChange","messageEdit"],setup(p,{expose:t,emit:n}){const e=p,c=n;function i(j){const F=e.selectedForDelete?.has(j)??!1;c("selectionChange",j,!F)}function r(j,F){const pe=j.target.innerText;c("messageEdit",F,pe)}function d(j){return e.editedMessages?.has(j.id)?e.editedMessages.get(j.id)||"":j.content||""}function u(j){return e.editedMessages?.has(j)??!1}const h=m(new Map);function f(j,F){F?h.value.set(j,F):h.value.delete(j)}function v(j){for(let F=0;F<e.messages.length;F++)if(T(F)===j)return F;return-1}function g(j){const F=e.messages.findIndex(oe=>oe.log_id===j);if(F<=0)return-1;for(let oe=F-1;oe>=0;oe--){const pe=e.messages[oe];if(pe.role==="user")return oe;if(pe.role==="assistant"&&pe.log_id)break}return-1}function x(j){for(let F=0;F<e.messages.length;F++){const oe=e.messages[F];if(oe.log_id===j||oe.type==="work"&&oe.items&&oe.items.some(Te=>Te.log_id===j||Te.response_log_id===j))return F}return-1}function y(j,F){const pe=x(j);if(pe===-1)return!1;const Ie=h.value.get(pe);if(!Ie)return!1;const Te=e.messages[pe];let Le=null;if(Te.role==="assistant"&&Te.log_id){const Z=g(Te.log_id);Le=Z!==-1?h.value.get(Z):null}const _e=F.getBoundingClientRect(),je=Ie.getBoundingClientRect();if(je.top<_e.top){const J=(Le||Ie).getBoundingClientRect().top-_e.top-10;F.scrollBy({top:J,behavior:"smooth"})}else if(je.bottom>_e.bottom){const Z=je.bottom-_e.bottom+10;F.scrollBy({top:Z,behavior:"smooth"})}else if(Le){const Z=Le.getBoundingClientRect();if(Z.top<_e.top){const ge=Z.top-_e.top-10;F.scrollBy({top:ge,behavior:"smooth"})}}return!0}function _(j){for(const F of e.messages){if(F.type!=="work")continue;if(F.items.some(Ie=>Ie.log_id===j||Ie.response_log_id===j))return!0}return!1}t({scrollToLogId:y,hasWorkblockForLogId:_});function T(j){const F=e.messages[j];if(F.log_id)return F.log_id;if(F.role==="user")for(let oe=j+1;oe<e.messages.length;oe++){const pe=e.messages[oe];if(pe.log_id)return pe.log_id;if(pe.role==="user")break}return null}function b(j,F){return F?T(j)===F:!1}function S(j){const F=T(j);F&&c("messageHover",F)}function M(j){T(j)&&c("messageHover",null)}function L(j){const F=e.messages[j],oe=T(j);oe&&c("messageClick",F.id,oe)}const O=m(new Set),B=m(new Set),H=m(new Set);function re(j){O.value.has(j)?O.value.delete(j):O.value.add(j)}function Q(j){B.value.has(j)?B.value.delete(j):B.value.add(j)}function q(j){H.value.has(j)?H.value.delete(j):H.value.add(j)}function K(j){if(!j)return{};try{return JSON.parse(j)}catch{return{raw:j}}}function R(j){if(!j)return null;const F=K(j),oe=Object.keys(F);if(oe.length===0)return null;const pe=F[oe[0]];return typeof pe=="string"?pe:JSON.stringify(pe)}function Y(j){return new Date(j/1e3).toLocaleTimeString()}function E(j){const F=Math.round(j/1e6);if(F<1)return"< 1s";if(F<60)return`${F}s`;const oe=Math.floor(F/60),pe=F%60;return`${oe}m ${pe}s`}function N(j){if(j.status==="pending")return"...";if(!j.isComplete)return"Working...";let F;return j.request_sent_at&&j.response_completed_at?F=j.response_completed_at-j.request_sent_at:F=j.updated_at-j.created_at,`Worked for ${E(F)}`}function w(j){const F=j.filter(oe=>oe.type==="content");if(F.length===0){const oe=j.filter(pe=>pe.type==="reasoning");return oe.length>0?oe[oe.length-1].content:null}return F[F.length-1].content}function I(j){const oe=j.trim().split(`
|
|
2
|
+
`)[0];return oe.length>60?oe.substring(0,60):oe}function A(j){const F=j.filter(oe=>oe.type==="tool_call");return F.length===0?null:F[F.length-1].tool_name||null}function V(j){return e.selectedMessageId===j.id?!0:e.selectedLogId?j.items.some(F=>F.log_id===e.selectedLogId||F.response_log_id===e.selectedLogId):!1}function P(j){return!!(e.selectedLogId&&(j.log_id===e.selectedLogId||j.response_log_id===e.selectedLogId))}function U(j){return e.hoveredLogId?j.items.some(F=>F.log_id===e.hoveredLogId||F.response_log_id===e.hoveredLogId):!1}function D(j){return!!(e.hoveredLogId&&(j.log_id===e.hoveredLogId||j.response_log_id===e.hoveredLogId))}function W(j){const F=[];for(const oe of j.items)oe.log_id&&F.push(oe.log_id),oe.response_log_id&&F.push(oe.response_log_id);return F}function G(){return e.messages.some(j=>j.type==="work"&&!j.isComplete)}function se(j){return!j.isComplete}function he(j){return j?j.trim():""}const me={props:e,emit:c,toggleSelection:i,handleContentEdit:r,getDisplayContent:d,isMessageEdited:u,messageRowRefs:h,setMessageRowRef:f,findMessageIndexByLogId:v,findUserMessageIndexForLogId:g,findMessageIndexContainingLogId:x,scrollToLogId:y,hasWorkblockForLogId:_,getEffectiveLogId:T,isMessageHighlighted:b,handleMessageEnter:S,handleMessageLeave:M,handleMessageClick:L,expandedMessages:O,expandedToolCalls:B,expandedReasoning:H,toggleWorkMessage:re,toggleToolCall:Q,toggleReasoning:q,parseArguments:K,getArgumentsPreview:R,formatTime:Y,formatDuration:E,getWorkStatus:N,getLatestContent:w,getFirstLine:I,getLatestToolName:A,isWorkMessageSelected:V,isWorkItemSelected:P,isWorkMessageHovered:U,isWorkItemHovered:D,getWorkMessageLogIds:W,hasActiveWorkMessage:G,isWorkMessageActive:se,trimContent:he,get ChevronDownIcon(){return fo},get ChevronRightIcon(){return go},get AlertTriangleIcon(){return mo}};return Object.defineProperty(me,"__isScriptSetup",{enumerable:!1,value:!0}),me}}),Ps=["onMouseenter","onMouseleave","onClick"],As=["onClick"],Es={key:0,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"3",stroke:"currentColor",class:"w-3 h-3 text-white"},Os={key:0,class:"w-full text-center text-xs text-neutral-400 dark:text-neutral-500 py-1"},js=["contenteditable","onInput"],Ds={key:0,class:"opacity-50"},qs={key:1,class:"opacity-50 italic text-neutral-500 dark:text-neutral-400"},Us=["onClick","onMouseenter"],Bs={key:0,class:"space-y-1"},Rs={class:"flex items-start gap-2"},Ns={class:"flex-1 min-w-0"},Fs={key:0,class:"truncate opacity-80"},Hs={key:1,class:"italic opacity-60"},zs={class:"flex items-center gap-2 pl-5 opacity-60"},Ws={class:"text-[10px]"},Js={class:"text-[10px]"},Ks={class:"space-y-2"},Zs={class:"flex items-center gap-2 pb-1 border-b border-current opacity-70"},Gs={class:"text-[10px] italic"},Xs={class:"text-[10px] ml-auto"},Ys={key:0,class:"space-y-1"},Qs=["onClick","onMouseenter"],$s={class:"font-mono text-[11px] flex-shrink-0"},ei={key:2,class:"text-[10px] opacity-60 px-2 truncate flex-1 min-w-0"},ti={key:3,class:"text-[10px] text-green-600 dark:text-green-400 ml-auto flex-shrink-0"},oi={key:0,class:"pl-4 space-y-2 text-[10px]"},ri={key:0},ni={class:"w-full border-collapse"},ai={class:"py-0.5 pr-2 opacity-65 align-top"},li={class:"py-0.5 opacity-85 break-all"},si={key:1},ii=["onClick","onMouseenter"],di={class:"whitespace-pre-wrap break-all"},ci={class:"text-[10px]"},ui=["onClick"],pi={key:0,class:"mt-1 pl-4 whitespace-pre-wrap break-words opacity-80"},mi={class:"text-[10px] opacity-80 pl-4 pb-2 break-words"};function gi(p,t,n,e,c,i){return a(),s("div",null,[(a(!0),s(X,null,ve(n.messages,(r,d)=>(a(),s("div",{key:r.id,ref_for:!0,ref:u=>e.setMessageRowRef(d,u),class:"flex items-center gap-2 pb-3",onMouseenter:u=>e.handleMessageEnter(d),onMouseleave:u=>e.handleMessageLeave(d),onClick:u=>n.isEditMode?e.toggleSelection(r.id):e.handleMessageClick(d)},[l(" Edit mode status indicator (always on left edge) "),n.isEditMode&&r.role!=="system"?(a(),s("button",{key:0,onClick:Ce(u=>e.toggleSelection(r.id),["stop"]),class:$(["flex-shrink-0 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",{"border-red-500 bg-red-500":n.selectedForDelete?.has(r.id),"border-green-500 bg-green-500":!n.selectedForDelete?.has(r.id)&&e.isMessageEdited(r.id),"border-neutral-400 dark:border-neutral-500 bg-transparent hover:border-neutral-500 dark:hover:border-neutral-400":!n.selectedForDelete?.has(r.id)&&!e.isMessageEdited(r.id)}])},[l(" Red check for delete "),n.selectedForDelete?.has(r.id)?(a(),s("svg",Es,[...t[4]||(t[4]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 12.75l6 6 9-13.5"},null,-1)])])):e.isMessageEdited(r.id)?(a(),s(X,{key:1},[l(" Green pencil for edited "),t[5]||(t[5]=o("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2.5",stroke:"currentColor",class:"w-3 h-3 text-white"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"})],-1))],2112)):l("v-if",!0)],10,As)):l("v-if",!0),l(" Message content wrapper - handles alignment "),o("div",{class:$(["flex-1 flex items-center gap-2 min-w-0",{"justify-start":r.role==="assistant","justify-end":r.role==="user","justify-center":r.role==="system","cursor-pointer":e.getEffectiveLogId(d)&&!n.isEditMode}])},[l(" Interruption message (iOS style) "),r.type==="text"&&r.role==="system"&&r.content?.includes("Execution stopped")?(a(),s("div",Os,k(r.content),1)):r.type==="text"?(a(),s(X,{key:1},[l(" Text Message "),o("div",{class:$(["max-w-[80%] rounded-2xl px-4 py-2 text-sm transition-all min-h-[2.5rem]",[r.silent?"bg-neutral-300 text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400 opacity-70 border-2 border-dashed border-neutral-400 dark:border-neutral-500":!n.isEditMode&&r.role!=="user"&&e.isMessageHighlighted(d,n.selectedLogId)?"bg-accent-200 text-accent-950 dark:bg-accent-200 dark:text-accent-950 ring-2 ring-accent-400 dark:ring-accent-400":r.role==="assistant"?"bg-neutral-800 text-white dark:bg-neutral-300 dark:text-black":r.role==="user"?"bg-neutral-200 text-black dark:bg-neutral-800 dark:text-white":"bg-neutral-100 text-neutral-600 dark:bg-neutral-900 dark:text-neutral-400 text-xs",{"opacity-60":r.isOptimistic},{"ring-2 ring-accent-400 dark:ring-accent-400 !bg-accent-200 !text-accent-950 dark:!bg-accent-200 dark:!text-accent-950":!n.isEditMode&&r.role!=="user"&&e.getEffectiveLogId(d)&&!r.silent&&!e.isMessageHighlighted(d,n.selectedLogId)&&e.isMessageHighlighted(d,n.hoveredLogId)},{"ring-2 ring-green-500 dark:ring-green-400":n.isEditMode&&e.isMessageEdited(r.id),"border border-dashed border-neutral-400 dark:border-neutral-500":n.isEditMode&&r.role!=="system"&&!e.isMessageEdited(r.id)}]])},[l(" Message content or typing indicator "),r.content||n.isEditMode?(a(),s("div",{key:0,class:"whitespace-pre-wrap break-words text-sm outline-none",contenteditable:n.isEditMode&&r.role!=="system",onInput:u=>e.handleContentEdit(u,r.id),onClick:t[0]||(t[0]=u=>n.isEditMode&&u.stopPropagation())},k(e.trimContent(r.content)),41,js)):r.status==="pending"?(a(),s(X,{key:1},[l(" Typing indicator for pending messages with no content "),t[6]||(t[6]=o("div",{class:"flex gap-1 items-center min-h-[1.5rem]"},[o("span",{class:"typing-dot",style:{"animation-delay":"0ms"}}),o("span",{class:"typing-dot",style:{"animation-delay":"150ms"}}),o("span",{class:"typing-dot",style:{"animation-delay":"300ms"}})],-1))],2112)):l("v-if",!0),l(" Label and Timestamp (hide when pending) "),r.status!=="pending"?(a(),s("div",{key:2,class:$(["text-[10px] mt-1 opacity-50 flex gap-2",{"justify-start":r.role==="assistant","justify-end":r.role!=="assistant"}])},[r.sideLabel?(a(),s("span",Ds,k(r.sideLabel),1)):l("v-if",!0),o("span",null,k(e.formatTime(r.created_at)),1),r.silent?(a(),s("span",qs," silent ")):l("v-if",!0)],2)):l("v-if",!0)],2)],2112)):r.type==="work"?(a(),s(X,{key:2},[l(" Work Message "),o("div",{class:$(["w-full rounded-lg px-3 py-2 text-xs transition-all border overflow-hidden",{"cursor-pointer":!n.isEditMode,"bg-neutral-50 text-neutral-700 border-neutral-200 dark:bg-neutral-900 dark:text-neutral-300 dark:border-neutral-700":r.role==="assistant"&&!r.silent,"bg-accent-50 text-accent-700 border-accent-200 dark:bg-accent-50 dark:text-accent-700 dark:border-accent-200":r.role==="user"&&!r.silent,"bg-neutral-200 text-neutral-500 border-neutral-400 dark:bg-neutral-800 dark:text-neutral-400 dark:border-neutral-600 opacity-70 border-dashed":r.silent,"ring-2 ring-accent-500":!n.isEditMode&&e.isWorkMessageSelected(r),"ring-2 ring-accent-400":!n.isEditMode&&!e.isWorkMessageSelected(r)&&e.isWorkMessageHovered(r)}]),onClick:u=>!n.isEditMode&&(e.toggleWorkMessage(r.id),e.getWorkMessageLogIds(r)[0]&&e.emit("messageClick",r.id,e.getWorkMessageLogIds(r)[0])),onMouseenter:u=>!n.isEditMode&&e.getWorkMessageLogIds(r)[0]&&e.emit("messageHover",e.getWorkMessageLogIds(r)[0]),onMouseleave:t[3]||(t[3]=u=>!n.isEditMode&&e.emit("messageHover",null))},[l(" Collapsed state "),e.expandedMessages.has(r.id)?(a(),s(X,{key:1},[l(" Expanded state "),o("div",Ks,[l(" Status header "),o("div",Zs,[C(e.ChevronDownIcon,{size:14,class:"flex-shrink-0"}),o("span",Gs,k(e.getWorkStatus(r)),1),o("span",Xs,k(r.items.length)+" operation"+k(r.items.length!==1?"s":""),1)]),(a(!0),s(X,null,ve(r.items,u=>(a(),s("div",{key:u.id,class:"mb-1"},[l(" Tool Call (with merged response) "),u.type==="tool_call"?(a(),s("div",Ys,[l(" Collapsed: Single row with tool name and status "),o("div",{onClick:Ce(h=>{e.toggleToolCall(u.id),u.log_id&&e.emit("messageClick",r.id,u.log_id)},["stop"]),onMouseenter:Ce(h=>u.log_id&&e.emit("messageHover",u.log_id),["stop"]),onMouseleave:t[1]||(t[1]=Ce(h=>e.emit("messageHover",null),["stop"])),class:$(["flex items-center gap-2 cursor-pointer hover:opacity-70 transition-opacity min-w-0",{"ring-1 ring-accent-500":e.isWorkItemSelected(u),"ring-1 ring-accent-400":!e.isWorkItemSelected(u)&&e.isWorkItemHovered(u)}])},[e.expandedToolCalls.has(u.id)?(a(),ee(e.ChevronDownIcon,{key:1,size:12,class:"flex-shrink-0 opacity-50"})):(a(),ee(e.ChevronRightIcon,{key:0,size:12,class:"flex-shrink-0 opacity-50"})),o("span",$s,k(u.tool_name),1),e.getArgumentsPreview(u.tool_arguments)?(a(),s("span",ei,k(e.getArgumentsPreview(u.tool_arguments)),1)):l("v-if",!0),u.response_status==="success"?(a(),s("span",ti,"✓")):u.response_status==="failed"?(a(),ee(e.AlertTriangleIcon,{key:4,size:12,class:"ml-auto text-red-600 dark:text-red-400"})):l("v-if",!0)],42,Qs),l(" Expanded: Arguments and Response as tables "),e.expandedToolCalls.has(u.id)?(a(),s("div",oi,[l(" Arguments table "),u.tool_arguments?(a(),s("div",ri,[t[7]||(t[7]=o("div",{class:"font-semibold mb-1 opacity-70"},"Arguments:",-1)),o("table",ni,[o("tbody",null,[(a(!0),s(X,null,ve(e.parseArguments(u.tool_arguments),(h,f)=>(a(),s("tr",{key:f,class:"border-b border-current border-opacity-10"},[o("td",ai,k(f),1),o("td",li,k(typeof h=="object"?JSON.stringify(h):h),1)]))),128))])])])):l("v-if",!0),l(" Response "),u.response?(a(),s("div",si,[t[8]||(t[8]=o("div",{class:"font-semibold mb-1 opacity-70"},"Response:",-1)),o("div",{class:$(["opacity-80 cursor-pointer hover:opacity-100",{"ring-1 ring-accent-500":n.selectedLogId&&u.response_log_id===n.selectedLogId,"ring-1 ring-accent-400":n.hoveredLogId&&u.response_log_id===n.hoveredLogId&&u.response_log_id!==n.selectedLogId}]),onClick:Ce(h=>u.response_log_id&&e.emit("messageClick",r.id,u.response_log_id),["stop"]),onMouseenter:Ce(h=>u.response_log_id&&e.emit("messageHover",u.response_log_id),["stop"]),onMouseleave:t[2]||(t[2]=Ce(h=>e.emit("messageHover",null),["stop"]))},[o("div",di,k(e.trimContent(u.response)),1)],42,ii)])):l("v-if",!0)])):l("v-if",!0)])):u.type==="reasoning"?(a(),s(X,{key:1},[l(" Reasoning (nested expandable) "),o("div",ci,[o("button",{onClick:Ce(h=>e.toggleReasoning(u.id),["stop"]),class:"flex items-center gap-1 opacity-70 hover:opacity-100 transition-opacity"},[e.expandedReasoning.has(u.id)?(a(),ee(e.ChevronDownIcon,{key:1,size:12,class:"flex-shrink-0"})):(a(),ee(e.ChevronRightIcon,{key:0,size:12,class:"flex-shrink-0"})),t[9]||(t[9]=o("span",{class:"font-semibold"},"Reasoning",-1))],8,ui),e.expandedReasoning.has(u.id)?(a(),s("div",pi,k(e.trimContent(u.content)),1)):l("v-if",!0)])],2112)):u.type==="content"?(a(),s(X,{key:2},[l(" Content "),o("div",mi,k(e.trimContent(u.content)),1)],2112)):l("v-if",!0)]))),128))])],2112)):(a(),s("div",Bs,[l(" Preview text or status "),o("div",Rs,[C(e.ChevronRightIcon,{size:14,class:"flex-shrink-0 mt-0.5 opacity-50"}),o("div",Ns,[e.getLatestContent(r.items)?(a(),s("div",Fs,k(e.getFirstLine(e.getLatestContent(r.items)))+"... ",1)):(a(),s("div",Hs,k(e.getWorkStatus(r)),1))])]),l(" Status line "),o("div",zs,[o("span",Ws,k(r.items.length)+" operation"+k(r.items.length!==1?"s":""),1),o("span",Js,"• "+k(e.getWorkStatus(r)),1)])]))],42,Us)],2112)):l("v-if",!0)],2)],40,Ps))),128))])}const fi=ne(Ls,[["render",gi],["__scopeId","data-v-9082ef4d"],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/threads/AgentMessages.vue"]]),hi=ae({__name:"MetadataSlidePane",props:{threadId:{type:[String,null],required:!0},show:{type:Boolean,required:!0}},emits:["close","threadDeleted","editThread"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,{thread:i,isFetching:r,error:d}=bt(z(()=>e.threadId)),u=m(!1),h=m(!1),f=m(!1),v=m(!1),g=m(""),x=m(!1),y=m(!1),_=m(null),{data:T,isFetching:b}=Ve(te("/api/agents"),{refetch:!0}).json(),S=z(()=>T.value?.agents?T.value.agents.filter(R=>R.type==="ai_human").map(R=>({value:R.id,label:R.title,description:`Type: ${R.type}`})):[]),M=z(()=>i.value?.agent.type==="ai_human"),L=R=>new Date(R*1e3).toLocaleString(),O=()=>{i.value&&(g.value=i.value.agent.id,f.value=!0)},B=()=>{f.value=!1,g.value=""},H=async()=>{if(!(!e.threadId||!g.value)){v.value=!0;try{const R=await fetch(te(`/api/threads/${e.threadId}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent_id:g.value})});if(!R.ok){const Y=await R.json();throw new Error(Y.error||"Failed to update agent")}window.location.reload()}catch(R){console.error("Error updating agent:",R),alert(`Failed to update agent: ${R.message}`)}finally{v.value=!1}}},re=async()=>{if(e.threadId){y.value=!0,x.value=!0;try{const R=await fetch(te(`/api/threads/${e.threadId}/cost`));if(!R.ok){const Y=await R.json();throw new Error(Y.error||"Failed to fetch cost breakdown")}_.value=await R.json()}catch(R){console.error("Error fetching cost breakdown:",R),alert(`Failed to fetch cost breakdown: ${R.message}`),x.value=!1}finally{y.value=!1}}},Q=R=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(R),q=async()=>{if(e.threadId){h.value=!0;try{const R=await fetch(te(`/api/threads/${e.threadId}`),{method:"DELETE"});if(!R.ok){const Y=await R.json();throw new Error(Y.error||"Failed to delete thread")}c("threadDeleted",e.threadId)}catch(R){console.error("Error deleting thread:",R),alert(`Failed to delete thread: ${R.message}`)}finally{h.value=!1}}};ce(()=>e.show,R=>{R||(f.value=!1,g.value="")});const K={props:e,emit:c,thread:i,isFetching:r,error:d,showDeleteConfirm:u,isDeleting:h,isEditingAgent:f,isSavingAgent:v,selectedAgentId:g,showCostBreakdown:x,isFetchingCost:y,costData:_,agentsData:T,isFetchingAgents:b,aiHumanAgents:S,isAiHumanAgent:M,formatDate:L,startEditingAgent:O,cancelEditingAgent:B,saveAgent:H,fetchCostBreakdown:re,formatCurrency:Q,handleDeleteThread:q,Loader:$e,ConfirmDialog:Yt,SelectInput:Ae,get ChevronUpIcon(){return bo},get Trash2Icon(){return vo},get PencilIcon(){return Ut},get DollarSignIcon(){return ho}};return Object.defineProperty(K,"__isScriptSetup",{enumerable:!1,value:!0}),K}}),vi={key:0,class:"overflow-hidden border-b border-neutral-300 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-900"},bi={class:"max-h-[400px] overflow-y-auto"},yi={class:"flex items-center justify-between px-4 py-2 border-b border-neutral-200 dark:border-neutral-800 sticky top-0 bg-neutral-50 dark:bg-neutral-900"},xi={class:"p-4"},ki={key:0,class:"flex justify-center py-4"},_i={class:"text-red-600 dark:text-red-400 text-center py-4 text-sm"},wi={class:"space-y-3 text-sm"},Ci={class:"flex items-start gap-2"},Si={class:"font-mono text-xs break-all"},Ti={class:"flex items-start gap-2"},Mi={class:"flex-1"},Ii={key:0,class:"flex items-center gap-2"},Vi={class:"text-xs text-neutral-500"},Li={key:1,class:"space-y-2"},Pi={class:"flex gap-2"},Ai=["disabled"],Ei=["disabled"],Oi={class:"flex items-start gap-2"},ji={key:0,class:"flex items-start gap-2"},Di={class:"font-mono text-xs"},qi={class:"flex items-start gap-2"},Ui={class:"flex-1 flex items-center gap-2 flex-wrap"},Bi={key:1,class:"text-neutral-500 dark:text-neutral-500 italic text-xs"},Ri={class:"flex items-start gap-2"},Ni=["disabled"],Fi={key:1,class:"flex justify-center py-2"},Hi={key:1,class:"p-3 rounded border border-neutral-200 dark:border-neutral-700 bg-neutral-100 dark:bg-neutral-800 space-y-2"},zi={class:"flex items-center gap-4 text-xs"},Wi={class:"font-mono font-bold ml-1"},Ji={class:"font-mono font-bold ml-1"},Ki={key:0,class:"text-xs"},Zi={class:"w-full"},Gi={class:"py-1"},Xi={class:"text-right py-1 font-mono"},Yi={class:"text-right py-1 font-mono"},Qi={class:"pt-2 border-t border-neutral-200 dark:border-neutral-800 flex justify-end"},$i=["disabled"],ed={key:0},td={key:1};function od(p,t,n,e,c,i){return a(),ee(ze,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"max-h-0 opacity-0","enter-to-class":"max-h-[400px] opacity-100","leave-active-class":"transition-all duration-200 ease-in","leave-from-class":"max-h-[400px] opacity-100","leave-to-class":"max-h-0 opacity-0"},{default:de(()=>[n.show&&n.threadId?(a(),s("div",vi,[o("div",bi,[l(" Header with close button "),o("div",yi,[t[6]||(t[6]=o("span",{class:"text-sm font-medium text-neutral-600 dark:text-neutral-400"},"Thread Info",-1)),o("button",{onClick:t[0]||(t[0]=r=>e.emit("close")),type:"button",class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors",title:"Close metadata"},[C(e.ChevronUpIcon,{size:16})])]),l(" Content "),o("div",xi,[l(" Loading state "),e.isFetching?(a(),s("div",ki,[C(e.Loader)])):e.error?(a(),s(X,{key:1},[l(" Error state "),o("div",_i," Error loading metadata: "+k(e.error),1)],2112)):e.thread?(a(),s(X,{key:2},[l(" Metadata display "),o("div",wi,[l(" Thread ID "),o("div",Ci,[t[7]||(t[7]=o("span",{class:"font-medium text-neutral-600 dark:text-neutral-400 w-14 flex-shrink-0 text-left"},"ID",-1)),o("span",Si,k(e.thread.id),1)]),l(" Agent "),o("div",Ti,[t[8]||(t[8]=o("span",{class:"font-medium text-neutral-600 dark:text-neutral-400 w-14 flex-shrink-0 text-left"},"Agent",-1)),o("div",Mi,[e.isEditingAgent?(a(),s("div",Li,[C(e.SelectInput,{modelValue:e.selectedAgentId,"onUpdate:modelValue":t[1]||(t[1]=r=>e.selectedAgentId=r),options:e.aiHumanAgents,loading:e.isFetchingAgents,placeholder:"Select an agent"},null,8,["modelValue","options","loading"]),o("div",Pi,[o("button",{onClick:e.saveAgent,disabled:e.isSavingAgent||!e.selectedAgentId,class:"px-2 py-1 text-xs bg-black dark:bg-white text-white dark:text-black hover:bg-black/80 dark:hover:bg-white/80 transition-colors disabled:opacity-50 disabled:cursor-not-allowed rounded"},k(e.isSavingAgent?"Saving...":"Save"),9,Ai),o("button",{onClick:e.cancelEditingAgent,disabled:e.isSavingAgent,class:"px-2 py-1 text-xs border border-black dark:border-neutral-300 hover:bg-black/5 dark:hover:bg-white/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed rounded"}," Cancel ",8,Ei)])])):(a(),s("div",Ii,[o("span",null,k(e.thread.agent.title),1),o("span",Vi,"("+k(e.thread.agent.type)+")",1),e.isAiHumanAgent?(a(),s("button",{key:0,onClick:e.startEditingAgent,type:"button",class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors",title:"Change agent"},[C(e.PencilIcon,{size:12})])):l("v-if",!0)]))])]),l(" Created At "),o("div",Oi,[t[9]||(t[9]=o("span",{class:"font-medium text-neutral-600 dark:text-neutral-400 w-14 flex-shrink-0 text-left"},"Created",-1)),o("span",null,k(e.formatDate(e.thread.created_at)),1)]),l(" User ID "),e.thread.user_id?(a(),s("div",ji,[t[10]||(t[10]=o("span",{class:"font-medium text-neutral-600 dark:text-neutral-400 w-14 flex-shrink-0 text-left"},"User",-1)),o("span",Di,k(e.thread.user_id),1)])):l("v-if",!0),l(" Tags "),o("div",qi,[t[11]||(t[11]=o("span",{class:"font-medium text-neutral-600 dark:text-neutral-400 w-14 flex-shrink-0 text-left"},"Tags",-1)),o("div",Ui,[e.thread.tags?.length>0?(a(!0),s(X,{key:0},ve(e.thread.tags,r=>(a(),s("span",{key:r,class:"inline-block px-2 py-0.5 text-xs rounded bg-black text-white dark:bg-white dark:text-black"},k(r),1))),128)):(a(),s("span",Bi,"No tags")),o("button",{onClick:t[2]||(t[2]=r=>e.emit("editThread")),type:"button",class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors",title:"Edit tags"},[C(e.PencilIcon,{size:12})])])]),l(" Cost Analysis Section "),o("div",Ri,[t[14]||(t[14]=o("span",{class:"font-medium text-neutral-600 dark:text-neutral-400 w-14 shrink-0 text-left"},"Cost",-1)),!e.showCostBreakdown&&!e.isFetchingCost?(a(),s("button",{key:0,onClick:e.fetchCostBreakdown,disabled:e.isFetchingCost,type:"button",class:"flex items-center gap-1 px-2 py-1 text-xs border border-black dark:border-white rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},[C(e.DollarSignIcon,{size:12}),t[12]||(t[12]=o("span",null,"View Costs",-1))],8,Ni)):l("v-if",!0),e.isFetchingCost?(a(),s("div",Fi,[C(e.Loader)])):l("v-if",!0),e.showCostBreakdown?(a(),s("button",{key:2,onClick:t[3]||(t[3]=r=>e.showCostBreakdown=!1),type:"button",class:"flex items-center gap-1 px-2 py-1 text-xs border border-black dark:border-white rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors"},[C(e.DollarSignIcon,{size:12}),t[13]||(t[13]=o("span",null,"Hide Costs",-1))])):l("v-if",!0)]),l(" Cost Breakdown Panel (full width below) "),e.showCostBreakdown&&e.costData?(a(),s("div",Hi,[o("div",zi,[o("div",null,[t[15]||(t[15]=o("span",{class:"text-neutral-500"},"Total:",-1)),o("span",Wi,k(e.formatCurrency(e.costData.totalCost)),1)]),o("div",null,[t[16]||(t[16]=o("span",{class:"text-neutral-500"},"Avg/msg:",-1)),o("span",Ji,k(e.formatCurrency(e.costData.avgCostPerMessage)),1)])]),l(" Model Breakdown "),e.costData.modelBreakdown.length>0?(a(),s("div",Ki,[o("table",Zi,[t[17]||(t[17]=o("thead",null,[o("tr",{class:"border-b border-neutral-300 dark:border-neutral-600"},[o("th",{class:"text-left py-1 font-medium text-neutral-500"}," Model "),o("th",{class:"text-right py-1 font-medium text-neutral-500"}," Reqs "),o("th",{class:"text-right py-1 font-medium text-neutral-500"}," Cost ")])],-1)),o("tbody",null,[(a(!0),s(X,null,ve(e.costData.modelBreakdown,r=>(a(),s("tr",{key:r.modelName},[o("td",Gi,k(r.modelName),1),o("td",Xi,k(r.requestCount),1),o("td",Yi,k(e.formatCurrency(r.totalCost)),1)]))),128))])])])):l("v-if",!0)])):l("v-if",!0),l(" Delete Button "),o("div",Qi,[o("button",{onClick:t[4]||(t[4]=r=>e.showDeleteConfirm=!0),disabled:e.isDeleting,class:"flex items-center gap-1 px-2 py-1 text-xs text-red-600 border border-red-600 rounded hover:bg-red-50 dark:hover:bg-red-950/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},[C(e.Trash2Icon,{size:12}),e.isDeleting?(a(),s("span",ed,"Deleting...")):(a(),s("span",td,"Delete Thread"))],8,$i)])])],2112)):l("v-if",!0)])]),l(" Delete Confirmation Dialog "),C(e.ConfirmDialog,{modelValue:e.showDeleteConfirm,"onUpdate:modelValue":t[5]||(t[5]=r=>e.showDeleteConfirm=r),title:"Delete Thread?",message:"Are you sure you want to delete this thread? This will permanently delete all messages, logs, and associated data. This action cannot be undone.","confirm-text":"Delete Thread","cancel-text":"Cancel",onConfirm:e.handleDeleteThread},null,8,["modelValue"])])):l("v-if",!0)]),_:1})}const rd=ne(hi,[["render",od],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/threads/MetadataSlidePane.vue"]]),nd=ae({__name:"MessagesPane",props:{threadId:{type:[String,null],required:!0},selectedMessageId:{type:[String,null],required:!1},selectedLogId:{type:[String,null],required:!1},hoveredLogId:{type:[String,null],required:!1}},emits:["collapse","messageClick","messageHover","threadDeleted","editThread","logsDeleted"],setup(p,{expose:t,emit:n}){const e=p,c=n,i=m(!1),r=()=>{i.value=!i.value},d=m(!1),u=m(new Set),h=m(new Map),f=()=>{d.value=!d.value,d.value||(u.value=new Set,h.value=new Map)},v=(J,ie)=>{const ue=new Set(u.value);ie?ue.add(J):ue.delete(J),u.value=ue},g=(J,ie)=>{const ue=new Map(h.value);ue.set(J,ie),h.value=ue},x=()=>{d.value=!1,u.value=new Set,h.value=new Map},y=z(()=>u.value.size),_=z(()=>{let J=0;for(const[ie]of h.value)u.value.has(ie)||J++;return J}),T=z(()=>{const J=y.value,ie=_.value;return J>0&&ie>0?`Delete (${J}), Update (${ie})`:J>0?`Delete (${J})`:ie>0?`Save changes (${ie})`:"Delete"}),b=z(()=>y.value>0||_.value>0),S=async()=>{if(!e.threadId||!b.value)return;const J=[];for(const ie of u.value){const ue=M.value.find(we=>we.id===ie);ue&&"log_id"in ue&&ue.log_id&&J.push(ue.log_id)}try{for(const[ie,ue]of h.value)u.value.has(ie)||await V(ie,ue);for(const ie of u.value)await A(ie);J.length>0&&c("logsDeleted",J)}catch(ie){console.error("Error applying changes:",ie)}finally{x()}},{messages:M,threadInfo:L,isFetching:O,isLoadingMore:B,error:H,wsConnected:re,wsError:Q,isExecuting:q,hasMore:K,totalMessages:R,loadMoreMessages:Y,connectWebSocket:E,disconnectWebSocket:N,addOptimisticMessage:w,removeOptimisticMessage:I,deleteMessageById:A,updateMessageContent:V,stopThread:P}=Vs(z(()=>e.threadId),{enableWebSocket:!0}),{thread:U}=bt(z(()=>e.threadId)),D=m(null),W=m(null),G=J=>W.value&&D.value?W.value.scrollToLogId(J,D.value):!1,se=J=>W.value?W.value.hasWorkblockForLogId(J):!1;t({scrollToLogId:G,hasWorkblockForLogId:se}),typeof window<"u"&&(window.__testLoadMoreMessages=Y);const he=m(""),me=m(null),j=m("B"),F=m(!1),oe=m(!1),pe=async()=>{await be(),D.value&&(D.value.scrollTop=D.value.scrollHeight)},Ie=async J=>{J.target.scrollTop<100&&K.value&&!B.value&&!oe.value&&(oe.value=!0,await Y(),oe.value=!1)};ce(()=>M.value.length,async()=>{!B.value&&!oe.value&&await pe()}),ce(()=>e.threadId,async J=>{J&&await pe()}),ce(O,async(J,ie)=>{ie&&!J&&await pe()});const Te=z(()=>{const J=L.value?.agent||U.value?.agent;if(!J)return"ai A";const ie=J.type;return j.value==="A"&&J.side_a_label?J.side_a_label:j.value==="B"&&J.side_b_label?J.side_b_label:ie==="ai_human"?j.value==="A"?"ai":"human":j.value==="A"?"ai A":"ai B"}),Le=()=>{j.value=j.value==="A"?"B":"A"},_e=async()=>{if(!he.value.trim()||!e.threadId||F.value)return;const J=he.value,ie=j.value==="A"?"assistant":"user",ue=`optimistic-${Date.now()}`,we={id:ue,role:ie,content:J,created_at:Date.now()*1e3,isOptimistic:!0};w(we),he.value="",me.value&&(me.value.style.height="auto",me.value.style.height="24px"),F.value=!0;try{if(!(await fetch(te(`/api/threads/${e.threadId}/message`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:J,role:ie})})).ok)throw new Error("Failed to send message");await pe()}catch(Ee){console.error("Error sending message:",Ee),I(ue)}finally{F.value=!1,await be(),me.value&&me.value.focus()}},ge={props:e,emit:c,showMetadataPanel:i,toggleMetadataPanel:r,isEditMode:d,selectedMessageIds:u,editedMessages:h,toggleEditMode:f,handleMessageSelection:v,handleMessageEdit:g,cancelEditMode:x,deleteCount:y,updateCount:_,actionButtonText:T,hasChanges:b,applyChanges:S,messages:M,threadInfo:L,isFetching:O,isLoadingMore:B,error:H,wsConnected:re,wsError:Q,isExecuting:q,hasMore:K,totalMessages:R,loadMoreMessages:Y,connectWebSocket:E,disconnectWebSocket:N,addOptimisticMessage:w,removeOptimisticMessage:I,deleteMessageById:A,updateMessageContent:V,stopThread:P,thread:U,messagesContainer:D,agentMessagesRef:W,scrollToLogId:G,hasWorkblockForLogId:se,messageInput:he,messageTextarea:me,currentSide:j,isSending:F,isLoadingOlder:oe,scrollToBottom:pe,handleScroll:Ie,sideLabel:Te,toggleSide:Le,sendMessage:_e,handleKeyDown:J=>{J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),_e())},handleStopThread:async()=>{if(e.threadId)try{await P()}catch(J){console.error("Error stopping thread:",J)}},AgentMessages:fi,MetadataSlidePane:rd,Loader:$e,StatusDot:xt,get MessageSquareIcon(){return Bt},get ChevronLeftIcon(){return vt},get InfoIcon(){return yo},get PencilIcon(){return Ut}};return Object.defineProperty(ge,"__isScriptSetup",{enumerable:!1,value:!0}),ge}}),ad={class:"flex flex-col h-full"},ld={class:"px-4 py-3 border-b border-neutral-300 dark:border-neutral-700"},sd={class:"flex items-center justify-between"},id={class:"flex items-center gap-2"},dd={class:"flex items-center gap-2"},cd={class:"flex-1 flex flex-col overflow-hidden relative"},ud={key:0,class:"text-neutral-500 dark:text-neutral-400 text-center py-8"},pd={key:1,class:"flex justify-center py-2"},md={class:"flex justify-center py-8"},gd={class:"text-red-600 dark:text-red-400 text-center py-8"},fd={key:0,class:"p-3 bg-white dark:bg-neutral-900 border-t border-neutral-300 dark:border-neutral-700"},hd={class:"flex items-center justify-end gap-2"},vd=["disabled"],bd={class:"p-3 bg-white dark:bg-neutral-900 border-t border-neutral-300 dark:border-neutral-700"},yd={class:"flex items-start gap-2"},xd={class:"flex-1 flex items-start gap-2 p-2 rounded-2xl border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-900"},kd=["disabled"],_d=["disabled"],wd={key:0,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",class:"w-4 h-4"},Cd={key:1,class:"w-4 h-4"};function Sd(p,t,n,e,c,i){return a(),s("div",ad,[l(" Header "),o("div",ld,[o("div",sd,[o("div",id,[C(e.MessageSquareIcon,{size:18,class:"shrink-0"}),t[8]||(t[8]=o("h2",{class:"text-base font-bold"},"Messages",-1)),n.threadId?(a(),ee(e.StatusDot,{key:0,connected:e.wsConnected,error:e.wsError},null,8,["connected","error"])):l("v-if",!0)]),o("div",dd,[l(" Metadata toggle button "),n.threadId?(a(),s("button",{key:0,onClick:e.toggleMetadataPanel,type:"button",class:$(["p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",{"bg-neutral-200 dark:bg-neutral-800":e.showMetadataPanel}]),title:"Toggle metadata"},[C(e.InfoIcon,{size:20})],2)):l("v-if",!0),l(" Edit mode toggle button "),n.threadId&&e.messages.length>0?(a(),s("button",{key:1,onClick:e.toggleEditMode,type:"button",class:$(["p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",{"bg-neutral-200 dark:bg-neutral-800":e.isEditMode}]),title:"Edit messages"},[C(e.PencilIcon,{size:20})],2)):l("v-if",!0),o("button",{onClick:t[0]||(t[0]=r=>e.emit("collapse")),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Collapse pane"},[C(e.ChevronLeftIcon,{size:20})])])])]),l(" Content area with sliding metadata panel "),o("div",cd,[l(" Sliding metadata panel "),C(e.MetadataSlidePane,{"thread-id":n.threadId,show:e.showMetadataPanel,onClose:t[1]||(t[1]=r=>e.showMetadataPanel=!1),onThreadDeleted:t[2]||(t[2]=r=>e.emit("threadDeleted",r)),onEditThread:t[3]||(t[3]=r=>e.emit("editThread"))},null,8,["thread-id","show"]),l(" Messages content "),o("div",{ref:"messagesContainer",class:"flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-4",onScroll:e.handleScroll},[l(" No thread selected "),n.threadId?l("v-if",!0):(a(),s("div",ud," Select a thread to view messages ")),l(" Loading older messages indicator "),e.isLoadingMore?(a(),s("div",pd,[C(e.Loader,{size:"sm"}),t[9]||(t[9]=o("span",{class:"ml-2 text-xs text-neutral-500"},"Loading older messages...",-1))])):e.isFetching?(a(),s(X,{key:2},[l(" Loading state "),o("div",md,[C(e.Loader)])],2112)):e.error?(a(),s(X,{key:3},[l(" Error state "),o("div",gd," Error loading messages: "+k(e.error),1)],2112)):n.threadId&&e.messages.length===0?(a(),s(X,{key:4},[l(" Empty state (only show if thread is selected) "),t[10]||(t[10]=o("div",{class:"text-neutral-500 dark:text-neutral-400 text-center py-8"}," No messages yet ",-1))],2112)):(a(),s(X,{key:5},[l(" Message bubbles (using AgentMessages component) "),C(e.AgentMessages,{ref:"agentMessagesRef",messages:e.messages,selectedMessageId:n.selectedMessageId,selectedLogId:n.selectedLogId,hoveredLogId:n.hoveredLogId,isEditMode:e.isEditMode,selectedForDelete:e.selectedMessageIds,editedMessages:e.editedMessages,onMessageClick:t[4]||(t[4]=(r,d)=>e.emit("messageClick",r,d)),onMessageHover:t[5]||(t[5]=r=>e.emit("messageHover",r)),onSelectionChange:e.handleMessageSelection,onMessageEdit:e.handleMessageEdit},null,8,["messages","selectedMessageId","selectedLogId","hoveredLogId","isEditMode","selectedForDelete","editedMessages"])],2112))],544),l(" Edit mode action bar "),n.threadId&&e.isEditMode?(a(),s("div",fd,[o("div",hd,[o("button",{onClick:e.cancelEditMode,class:"px-4 py-2 rounded-lg font-medium text-sm transition-colors bg-neutral-200 text-black hover:bg-neutral-300 dark:bg-neutral-700 dark:text-white dark:hover:bg-neutral-600"}," Cancel "),o("button",{onClick:e.applyChanges,disabled:!e.hasChanges,class:$(["px-4 py-2 rounded-lg font-medium text-sm transition-colors",{"bg-red-600 text-white hover:bg-red-700":e.hasChanges&&e.deleteCount>0,"bg-black text-white hover:bg-neutral-800 dark:bg-white dark:text-black dark:hover:bg-neutral-200":e.hasChanges&&e.deleteCount===0,"bg-neutral-200 text-neutral-400 dark:bg-neutral-700 dark:text-neutral-500 cursor-not-allowed":!e.hasChanges}])},k(e.actionButtonText),11,vd)])])):n.threadId?(a(),s(X,{key:1},[l(" Message input section (iOS-style single bubble) "),o("div",bd,[o("div",yd,[l(" Side toggle tag (outside bubble) "),o("button",{onClick:e.toggleSide,class:$(["flex-shrink-0 px-2 h-7 rounded-md flex items-center justify-center font-medium text-xs transition-colors mt-2.5",{"bg-black text-white dark:bg-white dark:text-black":e.currentSide==="A","bg-neutral-300 text-black dark:bg-neutral-600 dark:text-white":e.currentSide==="B"}]),title:"Toggle between sides"},k(e.sideLabel),3),l(" Input bubble "),o("div",xd,[l(" Message input (no border, transparent) "),Me(o("textarea",{ref:"messageTextarea","onUpdate:modelValue":t[6]||(t[6]=r=>e.messageInput=r),onKeydown:e.handleKeyDown,disabled:e.isSending,placeholder:"Type a message...",rows:"1",class:"flex-1 bg-transparent text-black dark:text-white resize-none focus:outline-none disabled:opacity-50 mt-0.5",style:{"max-height":"120px","min-height":"24px"},onInput:t[7]||(t[7]=r=>{const d=r.target;d.style.height="auto",d.style.height=Math.min(d.scrollHeight,120)+"px"})},null,40,kd),[[Oe,e.messageInput]]),l(" Send/Stop button (inside bubble) "),e.isExecuting?(a(),s(X,{key:1},[l(" Stop button (shown when thread is executing) "),o("button",{id:"stop-thread-button",onClick:e.handleStopThread,class:"flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center transition-all bg-red-600 text-white dark:bg-red-500 hover:bg-red-700 dark:hover:bg-red-600",title:"Stop execution"},[...t[12]||(t[12]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",class:"w-4 h-4"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})],-1)])])],2112)):(a(),s("button",{key:0,id:"send-message-button",onClick:e.sendMessage,disabled:!e.messageInput.trim()||e.isSending,class:$(["flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center transition-all",{"bg-black text-white dark:bg-white dark:text-black":e.messageInput.trim()&&!e.isSending,"bg-neutral-200 text-neutral-400 dark:bg-neutral-700 dark:text-neutral-600":!e.messageInput.trim()||e.isSending}]),title:"Send message (Enter)"},[e.isSending?(a(),s("div",Cd,[C(e.Loader)])):(a(),s("svg",wd,[...t[11]||(t[11]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"},null,-1)])]))],10,_d))])])])],2112)):l("v-if",!0)])])}const Td=ne(nd,[["render",Sd],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/threads/MessagesPane.vue"]]);function Md(p,t){const{limit:n=100,offset:e=0,order:c="desc",autoFetch:i=!0,enableWebSocket:r=!1}=t||{};z(()=>!!(typeof p=="string"?p:p?.value));const d=z(()=>{const Q=typeof p=="string"?p:p?.value;if(!Q)return te("/api/threads/placeholder/logs");const q=new URLSearchParams,K=typeof n=="number"?n:n.value,R=typeof e=="number"?e:e.value,Y=typeof c=="string"?c:c.value;return q.append("limit",K.toString()),q.append("offset",R.toString()),q.append("order",Y),te(`/api/threads/${Q}/logs?${q.toString()}`)}),{data:u,error:h,isFetching:f,isFinished:v,execute:g,abort:x}=Ve(d,{immediate:!1}).get().json();ce([d,()=>i],([Q,q])=>{Q&&!Q.includes("placeholder")&&q&&g()},{immediate:!0});const y=z(()=>!h.value||h.value.toString().includes("aborted")||h.value.toString().includes("abort")?null:h.value),_=z(()=>u.value?.logs||[]),T=z(()=>u.value?.total||0),b=z(()=>u.value?.hasMore||!1),S=m(null),M=m(!1),L=m(null),O=m([]),B=()=>{const Q=typeof p=="string"?p:p?.value;if(!Q||!r)return;S.value&&S.value.close(),O.value=[];const q=window.location.protocol==="https:"?"wss:":"ws:",K=window.location.host;let R=`${q}//${K}${te(`/api/threads/${Q}/logs`)}`;const Y=localStorage.getItem("auth_token");Y&&(R+=`?token=${encodeURIComponent(Y)}`);try{S.value=new WebSocket(R),S.value.onopen=()=>{M.value=!0,L.value=null,console.log("WebSocket connected for logs")},S.value.onmessage=E=>{try{const N=JSON.parse(E.data);if(N.type==="log_data"){const w=O.value.findIndex(A=>A.id===N.log_id),I=_.value.find(A=>A.id===N.log_id);w>=0?(O.value[w]={...O.value[w],...N.data},console.log("[WebSocket] Updated existing realtime log:",N.log_id)):I?(O.value.push({...I,...N.data}),console.log("[WebSocket] Updated HTTP log:",N.log_id)):(O.value.push({id:N.log_id,...N.data}),console.log("[WebSocket] Added new log:",N.log_id))}}catch(N){console.error("Failed to parse WebSocket message:",N)}},S.value.onerror=E=>{L.value="WebSocket connection error",M.value=!1,console.error("WebSocket error:",E)},S.value.onclose=()=>{M.value=!1,console.log("WebSocket disconnected")}}catch(E){L.value=E.message||"Failed to create WebSocket",console.error("WebSocket creation error:",E)}},H=()=>{S.value&&(S.value.close(),S.value=null,M.value=!1),O.value=[]};return Be(()=>{H()}),{logs:z(()=>{if(!r)return _.value;const Q=new Map;_.value.forEach(R=>Q.set(R.id,R)),O.value.forEach(R=>Q.set(R.id,R));const q=typeof c=="string"?c:c.value;return Array.from(Q.values()).sort((R,Y)=>q==="desc"?Y.created_at-R.created_at:R.created_at-Y.created_at)}),total:T,hasMore:b,error:y,isFetching:f,isFinished:v,refetch:g,abort:x,wsConnected:M,wsError:L,connectWebSocket:B,disconnectWebSocket:H}}function Id(p,t){const n=z(()=>{const d=p.value,u=t.value;return!d||!u?null:te(`/api/threads/${d}/logs/${u}`)}),{data:e,error:c,isFetching:i,execute:r}=Ve(n,{immediate:!1}).get().json();return ce([p,t],([d,u])=>{d&&u&&r()},{immediate:!0}),{logDetails:e,error:c,isFetching:i,refetch:r}}const Vd=ae({__name:"CopyButton",props:{content:{type:String,required:!0},variant:{type:String,required:!1},size:{type:String,required:!1},disabled:{type:Boolean,required:!1}},setup(p,{expose:t}){t();const n=p,e=m(!1),c=m(!1),u={props:n,copying:e,copied:c,copyToClipboard:async()=>{e.value=!0;try{await navigator.clipboard.writeText(n.content),c.value=!0,setTimeout(()=>{c.value=!1},2e3)}catch(h){console.error("Failed to copy:",h),alert(`Failed to copy: ${h instanceof Error?h.message:"Unknown error"}`)}finally{e.value=!1}},sizeClasses:{xs:"p-1 text-xs",sm:"px-2 py-1 text-xs"},variantClasses:{solid:"bg-black text-white dark:bg-white dark:text-black",ghost:"bg-white dark:bg-neutral-950 border border-neutral-300 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-900"},Loader:$e};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),Ld=["disabled","title"],Pd={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Ad={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Ed={key:3};function Od(p,t,n,e,c,i){return a(),s("button",{onClick:e.copyToClipboard,disabled:e.copying||n.disabled,class:$([e.sizeClasses[n.size||"sm"],e.variantClasses[n.variant||"solid"],"font-medium rounded hover:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed transition-all"]),title:n.disabled?"No content to copy":e.copied?"Copied!":"Copy to clipboard"},[e.copying?(a(),ee(e.Loader,{key:0,size:"xs"})):n.variant==="ghost"&&!e.copied?(a(),s("svg",Pd,[...t[0]||(t[0]=[o("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),o("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},null,-1)])])):n.variant==="ghost"&&e.copied?(a(),s("svg",Ad,[...t[1]||(t[1]=[o("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(a(),s("span",Ed,k(e.copied?"Copied!":"Copy"),1))],10,Ld)}const jd=ne(Vd,[["render",Od],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/CopyButton.vue"]]),ct="__shiki_highlighter__";let nt=null;async function Dd(){return typeof window<"u"&&window[ct]?window[ct]:nt||(nt=Io({themes:["min-light","github-dark-high-contrast"],langs:["json","markdown"]}).then(p=>(typeof window<"u"&&(window[ct]=p),p)),nt)}const qd=ae({__name:"CodeBlock",props:{code:{type:String,required:!0},language:{type:String,required:!0}},setup(p,{expose:t}){t();const n=p,e=m(""),c=m(!0),i=async()=>{const d=n.code??"";if(!d){e.value='<pre class="shiki"><code></code></pre>',c.value=!1;return}try{const u=await Dd();if(n.language==="json"||n.language==="markdown")e.value=u.codeToHtml(d,{lang:n.language,themes:{light:"min-light",dark:"github-dark-high-contrast"}});else{const h=d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");e.value=`<pre class="shiki shiki-text"><code>${h}</code></pre>`}}catch{const h=d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");e.value=`<pre class="shiki"><code>${h}</code></pre>`}finally{c.value=!1}};xe(()=>{i()}),ce(()=>n.code,()=>{i()});const r={props:n,highlightedHtml:e,isLoading:c,highlight:i};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),Ud={class:"code-block"},Bd={key:0,class:"text-xs text-neutral-500 p-2"},Rd=["innerHTML"];function Nd(p,t,n,e,c,i){return a(),s("div",Ud,[e.isLoading?(a(),s("div",Bd,"Loading...")):(a(),s("div",{key:1,innerHTML:e.highlightedHtml,class:"code-content"},null,8,Rd))])}const Fd=ne(qd,[["render",Nd],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/CodeBlock.vue"]]),Hd=ae({__name:"CollapsibleSection",props:{title:{type:String,required:!0},sectionId:{type:String,required:!0},expanded:{type:Boolean,required:!0},scrollContainer:{type:null,required:!1}},emits:["toggle"],setup(p,{expose:t,emit:n}){const e=p,c=n,i=m(null),r=m(!1),d=()=>{be(()=>{if(!i.value||!e.scrollContainer){r.value=!1;return}const v=e.scrollContainer.clientHeight;r.value=i.value.scrollHeight>v*2})};ce(()=>e.expanded,v=>{v?d():r.value=!1});const u=()=>{if(i.value&&e.scrollContainer){const x=i.value.offsetTop-88;e.scrollContainer.scrollTo({top:Math.max(0,x),behavior:"smooth"})}},h=()=>{if(i.value&&e.scrollContainer){const v=i.value.offsetTop+i.value.offsetHeight,g=e.scrollContainer.clientHeight,x=v-g+10;e.scrollContainer.scrollTo({top:Math.max(0,x),behavior:"smooth"})}};t({checkHeight:d,contentRef:i});const f={props:e,emit:c,contentRef:i,isTall:r,checkHeight:d,scrollToTop:u,scrollToBottom:h};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),zd={class:"text-xs font-semibold"},Wd={class:"flex items-center gap-2"},Jd={class:"text-neutral-500 text-xs"},Kd={ref:"contentRef",class:"border-x border-b border-neutral-300 dark:border-neutral-700 rounded-b"};function Zd(p,t,n,e,c,i){return a(),s("div",null,[l(" Sticky Header "),o("div",{class:"sticky top-[27px] z-5 w-full px-3 py-2 bg-neutral-50 dark:bg-neutral-950 flex items-center justify-between border border-neutral-300 dark:border-neutral-700 rounded cursor-pointer hover:bg-neutral-100 dark:hover:bg-neutral-950 transition-colors",onClick:t[0]||(t[0]=r=>e.emit("toggle"))},[o("span",zd,k(n.title),1),o("div",Wd,[e.isTall&&n.expanded?(a(),s(X,{key:0},[o("button",{onClick:Ce(e.scrollToTop,["stop"]),class:"text-[10px] text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300"},"↑ Top"),o("button",{onClick:Ce(e.scrollToBottom,["stop"]),class:"text-[10px] text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300"},"↓ Bottom")],64)):l("v-if",!0),o("span",Jd,k(n.expanded?"▼":"▶"),1)])]),l(" Content "),Me(o("div",Kd,[He(p.$slots,"default")],512),[[Ge,n.expanded]])])}const Gd=ne(Hd,[["render",Zd],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/threads/CollapsibleSection.vue"]]),Xd=ae({__name:"LogDetails",props:{log:{type:null,required:!0},hasPrevious:{type:Boolean,required:!1},hasNext:{type:Boolean,required:!1}},emits:["close","previous","next"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=m("request"),r=m(new Set),d=m(new Set),u=m(!1),h=m(!1),f=m(null),v=m(null),g=m(null),x=m(null),y=m(null),_=m(null),T=m(new Set(["system_prompt","request_body","tools"])),b=E=>{if(!E)return"N/A";try{return JSON.stringify(JSON.parse(E),null,2)}catch{return E}},S=z(()=>{if(!e.log.tools_schema)return[];try{const E=JSON.parse(e.log.tools_schema);return Array.isArray(E)?E:[]}catch{return[]}}),M=z(()=>{if(!e.log.response_body)return[];try{const N=JSON.parse(e.log.response_body)?.choices?.[0]?.message?.tool_calls;return Array.isArray(N)?N:[]}catch{return[]}}),L=z(()=>{if(!e.log.tool_results)return new Map;try{const E=JSON.parse(e.log.tool_results),N=new Map;return Array.isArray(E)&&E.forEach(w=>{w.tool_call_id&&N.set(w.tool_call_id,{content:w.content,status:w.status,tool_name:w.tool_name,timestamp:w.timestamp})}),N}catch{return new Map}}),O=z(()=>{if(!e.log.response_body)return[];try{const N=JSON.parse(e.log.response_body)?.choices?.[0]?.message?.reasoning_details;return Array.isArray(N)?N:[]}catch{return[]}}),B=E=>{r.value.has(E)?r.value.delete(E):r.value.add(E)},H=E=>{d.value.has(E)?d.value.delete(E):d.value.add(E)},re=E=>{T.value.has(E)?T.value.delete(E):T.value.add(E)},Q=E=>!T.value.has(E),q=z(()=>{if(!e.log.errors)return[];try{const E=JSON.parse(e.log.errors);return Array.isArray(E)?E:[]}catch{return[]}}),K=()=>{be(()=>{f.value&&(f.value.scrollTop=f.value.scrollHeight)})};ce(()=>e.log.message_history,()=>{K()},{immediate:!0}),ce(()=>e.log,()=>{be(()=>{g.value?.checkHeight(),x.value?.checkHeight(),y.value?.checkHeight(),_.value?.checkHeight()})});const Y={props:e,emit:c,activeTab:i,expandedTools:r,expandedToolCalls:d,copyingCurl:u,copiedCurl:h,messagesContainer:f,scrollContainer:v,toolsSectionRef:g,messagesSectionRef:x,systemPromptSectionRef:y,requestBodySectionRef:_,collapsedSections:T,formatJson:b,tools:S,toolCallsDetailed:M,toolResults:L,reasoningDetails:O,toggleTool:B,toggleToolCall:H,toggleSection:re,isSectionExpanded:Q,errorsArray:q,scrollMessagesToBottom:K,copyCurlCommand:async()=>{u.value=!0;try{if(!e.log.request_body||!e.log.model)throw new Error("Missing request data");const E=await fetch(te(`/api/models/${e.log.model}/curl-data`));if(!E.ok)throw new Error("Failed to fetch model data");const N=await E.json(),w=b(e.log.request_body);let I=`curl -X POST '${N.endpoint}' \\
|
|
3
|
+
`;I+=` -H 'Content-Type: application/json' \\
|
|
4
|
+
`,N.sdk?.toLowerCase()==="openrouter"?(I+=` -H 'Authorization: Bearer ${N.api_key}' \\
|
|
5
|
+
`,I+=` -H 'HTTP-Referer: https://agentkit.local' \\
|
|
6
|
+
`,I+=` -H 'X-Title: AgentKit' \\
|
|
7
|
+
`):N.sdk?.toLowerCase()==="openai"&&(I+=` -H 'Authorization: Bearer ${N.api_key}' \\
|
|
8
|
+
`),I+=` -d '${w.replace(/'/g,"'\\''")}'`,await navigator.clipboard.writeText(I),h.value=!0,setTimeout(()=>{h.value=!1},2e3)}catch(E){console.error("Failed to copy cURL command:",E),alert(`Failed to copy cURL: ${E instanceof Error?E.message:"Unknown error"}`)}finally{u.value=!1}},Loader:$e,TimeAgo:yt,CopyButton:jd,CodeBlock:Fd,CollapsibleSection:Gd};return Object.defineProperty(Y,"__isScriptSetup",{enumerable:!1,value:!0}),Y}}),Yd={ref:"scrollContainer",class:"p-4 h-full overflow-y-auto"},Qd={class:"flex items-center justify-between mb-3"},$d={class:"flex items-center gap-2"},ec={class:"flex items-center gap-1"},tc=["disabled"],oc=["disabled"],rc={class:"text-lg font-bold"},nc={class:"flex items-center gap-2"},ac=["disabled","title"],lc={key:1},sc={class:"@container border-b border-neutral-300 dark:border-neutral-700 pb-3"},ic={class:"hidden @[600px]:block"},dc={class:"w-full text-xs"},cc={class:"py-1 font-mono"},uc={class:"py-1 font-mono"},pc={key:1},mc={class:"py-1 font-mono"},gc={key:1},fc={class:"py-1 font-mono"},hc={key:1},vc={class:"py-1 font-mono"},bc={key:1},yc={class:"py-1 font-mono text-xs"},xc={class:"@[600px]:hidden space-y-2"},kc={class:"w-full text-xs"},_c={class:"py-1 font-mono"},wc={class:"py-1 font-mono"},Cc={key:1},Sc={class:"w-full text-xs"},Tc={class:"py-1 font-mono"},Mc={key:1},Ic={class:"py-1 font-mono"},Vc={key:1},Lc={class:"py-1 font-mono"},Pc={key:1},Ac={class:"py-1 font-mono text-xs"},Ec={class:"sticky -top-4 z-10 bg-white dark:bg-neutral-900 border-b border-neutral-300 dark:border-neutral-700 mb-3 pt-3 -mx-4 px-4"},Oc={class:"flex gap-4"},jc={key:0,class:"text-red-600 dark:text-red-400"},Dc={class:"space-y-3"},qc={class:"space-y-2"},Uc=["onClick"],Bc={class:"font-mono"},Rc={class:"text-neutral-500"},Nc={class:"px-2 py-2 bg-white dark:bg-neutral-950 border-t border-neutral-200 dark:border-neutral-800"},Fc={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mb-2"},Hc={class:"relative bg-white dark:bg-neutral-900"},zc={class:"absolute top-[5px] right-[5px]"},Wc={class:"relative bg-white dark:bg-neutral-900"},Jc={class:"absolute top-[5px] right-[5px]"},Kc={class:"relative bg-white dark:bg-neutral-900"},Zc={class:"absolute top-[5px] right-[5px]"},Gc={key:0,class:"mb-4"},Xc={class:"text-xs font-semibold text-red-600 dark:text-red-400 mb-1"},Yc={class:"space-y-2"},Qc={class:"px-2 py-1 bg-red-100 dark:bg-red-900/30 text-xs font-medium text-red-800 dark:text-red-200"},$c={class:"text-xs bg-red-50 dark:bg-red-950 p-2 overflow-x-auto text-red-900 dark:text-red-100"},eu={class:"mb-4"},tu={class:"text-xs font-semibold text-red-600 dark:text-red-400 mb-1"},ou={class:"text-xs bg-red-50 dark:bg-red-950 p-2 rounded overflow-x-auto text-red-900 dark:text-red-100 border border-red-300 dark:border-red-700"},ru={key:2,class:"mb-4"},nu={class:"w-full text-xs border border-neutral-300 dark:border-neutral-700 rounded"},au={class:"border-b border-neutral-200 dark:border-neutral-800"},lu={class:"py-1 px-2 font-mono"},su={key:1},iu={class:"border-b border-neutral-200 dark:border-neutral-800"},du={class:"py-1 px-2 font-mono"},cu={key:1},uu={key:0,class:"border-b border-neutral-200 dark:border-neutral-800"},pu={class:"py-1 px-2 font-mono"},mu={key:1},gu={class:"border-b border-neutral-200 dark:border-neutral-800"},fu={class:"py-1 px-2 font-mono"},hu={key:1},vu={key:1,class:"border-b border-neutral-200 dark:border-neutral-800"},bu={class:"py-1 px-2 font-mono text-accent-600 dark:text-accent-400"},yu={class:"border-b border-neutral-200 dark:border-neutral-800"},xu={class:"py-1 px-2 font-mono font-semibold"},ku={key:1},_u={class:"py-1 px-2 font-mono font-semibold"},wu={key:1},Cu={key:3,class:"mb-4"},Su={class:"text-xs font-semibold mb-1"},Tu={class:"border border-neutral-300 dark:border-neutral-700 rounded overflow-hidden"},Mu=["onClick"],Iu={class:"font-mono"},Vu={class:"text-neutral-500"},Lu={class:"px-2 py-2 bg-white dark:bg-neutral-950 border-t border-neutral-200 dark:border-neutral-800"},Pu={class:"text-xs mb-2"},Au={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-neutral-200 dark:border-neutral-800"},Eu={class:"text-xs mb-2"},Ou={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-neutral-200 dark:border-neutral-800"},ju={class:"text-xs mb-2"},Du={class:"rounded overflow-hidden border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-black"},qu={key:0,class:"text-xs"},Uu={class:"text-xs overflow-x-auto bg-green-50 dark:bg-green-950/20 p-2 rounded border border-green-300 dark:border-green-700 whitespace-pre-wrap"},Bu={key:1,class:"text-xs"},Ru={key:4,class:"mb-4"},Nu={class:"border border-accent-300 dark:border-accent-700 rounded overflow-hidden bg-accent-50 dark:bg-accent-950/20"},Fu={class:"text-xs p-2 overflow-x-auto whitespace-pre-wrap max-h-96 text-accent-900 dark:text-accent-100"},Hu={key:5,class:"mb-4"},zu={class:"text-xs font-semibold mb-1"},Wu={class:"border border-purple-300 dark:border-purple-700 rounded overflow-hidden bg-purple-50 dark:bg-purple-950/20"},Ju={class:"divide-y divide-purple-200 dark:divide-purple-800"},Ku={class:"flex items-center gap-2 mb-1"},Zu={class:"text-xs font-semibold text-purple-700 dark:text-purple-300"},Gu={key:0,class:"text-xs font-mono text-purple-600 dark:text-purple-400"},Xu={key:1,class:"text-xs text-purple-500 dark:text-purple-500"},Yu={key:2,class:"text-xs text-purple-500 dark:text-purple-500"},Qu={key:0,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},$u={class:"text-purple-900 dark:text-purple-100 whitespace-pre-wrap"},e0={key:1,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},t0={class:"font-mono text-purple-700 dark:text-purple-300 break-all"},o0={key:2,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},r0={class:"text-purple-900 dark:text-purple-100 whitespace-pre-wrap"},n0={key:0,class:"mt-2 pt-2 border-t border-purple-200 dark:border-purple-800"},a0={class:"font-mono text-purple-700 dark:text-purple-300 text-xs break-all"},l0={key:3,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},s0={class:"text-purple-900 dark:text-purple-100 overflow-x-auto"},i0={key:6,class:"mb-4"},d0={class:"bg-white dark:bg-neutral-900 rounded overflow-hidden border border-neutral-300 dark:border-neutral-700"};function c0(p,t,n,e,c,i){return a(),s("div",Yd,[l(" Header "),o("div",Qd,[o("div",$d,[l(" Navigation Buttons "),o("div",ec,[o("button",{onClick:t[0]||(t[0]=r=>e.emit("previous")),disabled:!n.hasPrevious,class:"w-7 h-7 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent dark:disabled:hover:bg-transparent transition-all","aria-label":"Previous log",title:"Previous log"},[...t[9]||(t[9]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("polyline",{points:"15 18 9 12 15 6"})],-1)])],8,tc),o("button",{onClick:t[1]||(t[1]=r=>e.emit("next")),disabled:!n.hasNext,class:"w-7 h-7 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent dark:disabled:hover:bg-transparent transition-all","aria-label":"Next log",title:"Next log"},[...t[10]||(t[10]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("polyline",{points:"9 18 15 12 9 6"})],-1)])],8,oc)]),o("h3",rc,k(n.log.prompt_name||n.log.model_name||n.log.model),1)]),o("div",nc,[o("button",{onClick:e.copyCurlCommand,disabled:e.copyingCurl||!n.log.request_body,class:"px-3 py-1 text-xs font-medium bg-black text-white dark:bg-white dark:text-black rounded hover:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed transition-opacity",title:n.log.request_body?"Copy cURL command":"No request data available"},[e.copyingCurl?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",lc,k(e.copiedCurl?"Copied!":"Copy cURL"),1))],8,ac),o("button",{onClick:t[2]||(t[2]=r=>e.emit("close")),class:"w-7 h-7 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 transition-all","aria-label":"Close details",title:"Close"},[...t[11]||(t[11]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])]),l(" Summary Table "),o("div",sc,[l(" Single table for wider containers "),o("div",ic,[o("table",dc,[t[12]||(t[12]=o("thead",null,[o("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Status "),o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Provider "),o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Prompt "),o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Latency "),o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Tokens "),o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Cost "),o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Created ")])],-1)),o("tbody",null,[o("tr",null,[o("td",{class:$(["py-1 font-mono",n.log.error?"text-red-600 dark:text-red-400":n.log.is_complete?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"])},k(n.log.error?"ERROR":n.log.is_complete?"SUCCESS":"LOADING"),3),o("td",cc,k(n.log.provider),1),o("td",uc,[!n.log.is_complete&&!n.log.prompt_name?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",pc,k(n.log.prompt_name||"—"),1))]),o("td",mc,[!n.log.is_complete&&!n.log.latency_ms?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",gc,k(n.log.latency_ms?`${n.log.latency_ms}ms`:"—"),1))]),o("td",fc,[!n.log.is_complete&&!n.log.total_tokens?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",hc,k(n.log.total_tokens?`${n.log.input_tokens}/${n.log.output_tokens} (${n.log.total_tokens})`:"—"),1))]),o("td",vc,[!n.log.is_complete&&!n.log.cost_total?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",bc,k(n.log.cost_total?`$${n.log.cost_total.toFixed(6)}`:"—"),1))]),o("td",yc,[C(e.TimeAgo,{timestamp:n.log.created_at},null,8,["timestamp"])])])])])]),l(" Two stacked tables for narrow containers "),o("div",xc,[l(" First table: Status, Provider, Prompt "),o("table",kc,[t[13]||(t[13]=o("thead",null,[o("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Status "),o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Provider "),o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Prompt ")])],-1)),o("tbody",null,[o("tr",null,[o("td",{class:$(["py-1 font-mono",n.log.error?"text-red-600 dark:text-red-400":n.log.is_complete?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"])},k(n.log.error?"ERROR":n.log.is_complete?"SUCCESS":"LOADING"),3),o("td",_c,k(n.log.provider),1),o("td",wc,[!n.log.is_complete&&!n.log.prompt_name?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",Cc,k(n.log.prompt_name||"—"),1))])])])]),l(" Second table: Latency, Tokens, Cost, Created "),o("table",Sc,[t[14]||(t[14]=o("thead",null,[o("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Latency "),o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Tokens "),o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Cost "),o("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Created ")])],-1)),o("tbody",null,[o("tr",null,[o("td",Tc,[!n.log.is_complete&&!n.log.latency_ms?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",Mc,k(n.log.latency_ms?`${n.log.latency_ms}ms`:"—"),1))]),o("td",Ic,[!n.log.is_complete&&!n.log.total_tokens?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",Vc,k(n.log.total_tokens?`${n.log.input_tokens}/${n.log.output_tokens} (${n.log.total_tokens})`:"—"),1))]),o("td",Lc,[!n.log.is_complete&&!n.log.cost_total?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",Pc,k(n.log.cost_total?`$${n.log.cost_total.toFixed(6)}`:"—"),1))]),o("td",Ac,[C(e.TimeAgo,{timestamp:n.log.created_at},null,8,["timestamp"])])])])])])]),l(" Tabs (Sticky) "),o("div",Ec,[o("div",Oc,[o("button",{onClick:t[3]||(t[3]=r=>e.activeTab="request"),class:$(["pb-2 px-1 text-sm font-medium border-b-2 transition-colors",e.activeTab==="request"?"border-black dark:border-white text-black dark:text-white":"border-transparent text-neutral-500 dark:text-neutral-400 hover:text-black dark:hover:text-white"])}," Request ",2),o("button",{onClick:t[4]||(t[4]=r=>e.activeTab="response"),class:$(["pb-2 px-1 text-sm font-medium border-b-2 transition-colors flex items-center gap-1",e.activeTab==="response"?"border-black dark:border-white text-black dark:text-white":"border-transparent text-neutral-500 dark:text-neutral-400 hover:text-black dark:hover:text-white"])},[t[15]||(t[15]=ke(" Response ",-1)),n.log.error||e.errorsArray.length>0?(a(),s("span",jc,"⚠")):l("v-if",!0)],2)])]),l(" Tab Content "),o("div",Dc,[l(" Request Tab "),Me(o("div",qc,[l(" Available Tools (Collapsible) "),e.tools.length>0?(a(),ee(e.CollapsibleSection,{key:0,ref:"toolsSectionRef",title:`Available Tools (${e.tools.length})`,"section-id":"tools",expanded:e.isSectionExpanded("tools"),"scroll-container":e.scrollContainer,onToggle:t[5]||(t[5]=r=>e.toggleSection("tools"))},{default:de(()=>[(a(!0),s(X,null,ve(e.tools,(r,d)=>(a(),s("div",{key:d,class:"border-b border-neutral-200 dark:border-neutral-800 last:border-b-0"},[o("button",{onClick:u=>e.toggleTool(d),class:"w-full px-2 py-1.5 text-left hover:bg-neutral-50 dark:hover:bg-neutral-900 transition-colors flex items-center justify-between text-xs"},[o("span",Bc,k(r.function?.name||r.name||"Unknown"),1),o("span",Rc,k(e.expandedTools.has(d)?"▼":"▶"),1)],8,Uc),Me(o("div",Nc,[r.function?.description||r.description?(a(),s("div",Fc,k(r.function?.description||r.description),1)):l("v-if",!0),C(e.CodeBlock,{code:JSON.stringify(r,null,2),language:"json"},null,8,["code"])],512),[[Ge,e.expandedTools.has(d)]])]))),128))]),_:1},8,["title","expanded","scroll-container"])):l("v-if",!0),l(" Messages (Collapsible) "),n.log.message_history?(a(),ee(e.CollapsibleSection,{key:1,ref:"messagesSectionRef",title:`Messages (${n.log.message_history_length||0} messages)`,"section-id":"messages",expanded:e.isSectionExpanded("messages"),"scroll-container":e.scrollContainer,onToggle:t[6]||(t[6]=r=>e.toggleSection("messages"))},{default:de(()=>[o("div",Hc,[C(e.CodeBlock,{code:e.formatJson(n.log.message_history),language:"json"},null,8,["code"]),o("div",zc,[C(e.CopyButton,{content:e.formatJson(n.log.message_history),variant:"ghost",size:"xs"},null,8,["content"])])])]),_:1},8,["title","expanded","scroll-container"])):l("v-if",!0),l(" System Prompt (Collapsible) "),n.log.system_prompt?(a(),ee(e.CollapsibleSection,{key:2,ref:"systemPromptSectionRef",title:"System Prompt","section-id":"system_prompt",expanded:e.isSectionExpanded("system_prompt"),"scroll-container":e.scrollContainer,onToggle:t[7]||(t[7]=r=>e.toggleSection("system_prompt"))},{default:de(()=>[o("div",Wc,[C(e.CodeBlock,{code:n.log.system_prompt,language:"markdown"},null,8,["code"]),o("div",Jc,[C(e.CopyButton,{content:n.log.system_prompt,variant:"ghost",size:"xs"},null,8,["content"])])])]),_:1},8,["expanded","scroll-container"])):l("v-if",!0),l(" Full Request Body (Collapsible) "),n.log.request_body?(a(),ee(e.CollapsibleSection,{key:3,ref:"requestBodySectionRef",title:"Full Request Body","section-id":"request_body",expanded:e.isSectionExpanded("request_body"),"scroll-container":e.scrollContainer,onToggle:t[8]||(t[8]=r=>e.toggleSection("request_body"))},{default:de(()=>[o("div",Kc,[C(e.CodeBlock,{code:e.formatJson(n.log.request_body),language:"json"},null,8,["code"]),o("div",Zc,[C(e.CopyButton,{content:e.formatJson(n.log.request_body),variant:"ghost",size:"xs"},null,8,["content"])])])]),_:1},8,["expanded","scroll-container"])):l("v-if",!0)],512),[[Ge,e.activeTab==="request"]]),l(" Response Tab "),Me(o("div",null,[l(" Errors (Multiple errors from errors array) "),e.errorsArray.length>0?(a(),s("div",Gc,[o("div",Xc,k(e.errorsArray.length>1?`Errors (${e.errorsArray.length})`:"Error"),1),o("div",Yc,[(a(!0),s(X,null,ve(e.errorsArray,(r,d)=>(a(),s("div",{key:d,class:"border border-red-300 dark:border-red-700 rounded overflow-hidden"},[o("div",Qc,k(r.type||"error"),1),o("pre",$c,k(r.message),1)]))),128))])])):n.log.error?(a(),s(X,{key:1},[l(" Fallback: Single error (for backwards compatibility) "),o("div",eu,[o("div",tu," Error "+k(n.log.error_type?`(${n.log.error_type})`:""),1),o("pre",ou,k(n.log.error),1)])],2112)):l("v-if",!0),l(" Response Stats "),n.log.is_complete||!n.log.error?(a(),s("div",ru,[t[23]||(t[23]=o("div",{class:"text-xs font-semibold mb-1"},"Response Stats",-1)),o("table",nu,[o("tbody",null,[o("tr",au,[t[16]||(t[16]=o("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Finish Reason ",-1)),o("td",lu,[!n.log.is_complete&&!n.log.finish_reason?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",su,k(n.log.finish_reason||"—"),1))])]),o("tr",iu,[t[17]||(t[17]=o("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Input Tokens ",-1)),o("td",du,[!n.log.is_complete&&!n.log.input_tokens?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",cu,k(n.log.input_tokens||"—"),1))])]),n.log.cached_tokens||!n.log.is_complete?(a(),s("tr",uu,[t[18]||(t[18]=o("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Cached Tokens ",-1)),o("td",pu,[!n.log.is_complete&&!n.log.cached_tokens?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",mu,k(n.log.cached_tokens||0),1))])])):l("v-if",!0),o("tr",gu,[t[19]||(t[19]=o("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Output Tokens ",-1)),o("td",fu,[!n.log.is_complete&&!n.log.output_tokens?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",hu,k(n.log.output_tokens||"—"),1))])]),n.log.reasoning_tokens&&n.log.reasoning_tokens>0?(a(),s("tr",vu,[t[20]||(t[20]=o("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Reasoning Tokens ",-1)),o("td",bu,k(n.log.reasoning_tokens),1)])):l("v-if",!0),o("tr",yu,[t[21]||(t[21]=o("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Total Tokens ",-1)),o("td",xu,[!n.log.is_complete&&!n.log.total_tokens?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",ku,k(n.log.total_tokens||"—"),1))])]),o("tr",null,[t[22]||(t[22]=o("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Total Cost ",-1)),o("td",_u,[!n.log.is_complete&&!n.log.cost_total?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",wu,k(n.log.cost_total?`$${n.log.cost_total.toFixed(6)}`:"—"),1))])])])])])):l("v-if",!0),l(" Tools Called "),e.toolCallsDetailed.length>0?(a(),s("div",Cu,[o("div",Su," Tools Called ("+k(e.toolCallsDetailed.length)+") ",1),o("div",Tu,[(a(!0),s(X,null,ve(e.toolCallsDetailed,(r,d)=>(a(),s("div",{key:d,class:"border-b border-neutral-200 dark:border-neutral-800 last:border-b-0"},[o("button",{onClick:u=>e.toggleToolCall(d),class:"w-full px-2 py-1.5 text-left hover:bg-neutral-50 dark:hover:bg-neutral-900 transition-colors flex items-center justify-between text-xs"},[o("span",Iu,k(r.function?.name||"Unknown"),1),o("span",Vu,k(e.expandedToolCalls.has(d)?"▼":"▶"),1)],8,Mu),Me(o("div",Lu,[o("div",Pu,[t[24]||(t[24]=o("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Tool Call ID ",-1)),o("div",Au,k(r.id),1)]),o("div",Eu,[t[25]||(t[25]=o("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Function Name ",-1)),o("div",Ou,k(r.function?.name),1)]),o("div",ju,[t[26]||(t[26]=o("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Arguments ",-1)),o("div",Du,[C(e.CodeBlock,{code:e.formatJson(r.function?.arguments||"{}"),language:"json"},null,8,["code"])])]),l(" Tool Result "),e.toolResults.has(r.id)?(a(),s("div",qu,[t[27]||(t[27]=o("div",{class:"font-semibold text-green-600 dark:text-green-400 mb-1"}," Result ",-1)),o("pre",Uu,k(e.toolResults.get(r.id)?.content||"No content"),1)])):(a(),s("div",Bu,[...t[28]||(t[28]=[o("div",{class:"font-semibold text-neutral-500 dark:text-neutral-500 mb-1"}," Result ",-1),o("div",{class:"text-xs text-neutral-500 dark:text-neutral-500 italic"}," No result available ",-1)])]))],512),[[Ge,e.expandedToolCalls.has(d)]])]))),128))])])):l("v-if",!0),l(" Reasoning Content (from models like o1) "),n.log.reasoning_content?(a(),s("div",Ru,[t[30]||(t[30]=o("div",{class:"text-xs font-semibold mb-1"},"Reasoning Content",-1)),o("div",Nu,[t[29]||(t[29]=o("div",{class:"px-2 py-1.5 bg-accent-100 dark:bg-accent-900/30 text-xs text-accent-800 dark:text-accent-200 border-b border-accent-300 dark:border-accent-700"}," Internal reasoning output (not displayed to users) ",-1)),o("pre",Fu,k(n.log.reasoning_content),1)])])):l("v-if",!0),l(" Reasoning Details (OpenRouter structured reasoning blocks) "),e.reasoningDetails.length>0?(a(),s("div",Hu,[o("div",zu," Reasoning Details ("+k(e.reasoningDetails.length)+" blocks) ",1),o("div",Wu,[t[35]||(t[35]=o("div",{class:"px-2 py-1.5 bg-purple-100 dark:bg-purple-900/30 text-xs text-purple-800 dark:text-purple-200 border-b border-purple-300 dark:border-purple-700"}," Structured reasoning blocks from OpenRouter (preserved for multi-turn continuity) ",-1)),o("div",Ju,[(a(!0),s(X,null,ve(e.reasoningDetails,(r,d)=>(a(),s("div",{key:d,class:"p-2"},[o("div",Ku,[o("span",Zu,k(r.type||"unknown"),1),r.id?(a(),s("span",Gu," ID: "+k(r.id),1)):l("v-if",!0),r.format?(a(),s("span",Xu," Format: "+k(r.format),1)):l("v-if",!0),r.index!==void 0?(a(),s("span",Yu," Index: "+k(r.index),1)):l("v-if",!0)]),l(" Summary type "),r.type==="reasoning.summary"&&r.summary?(a(),s("div",Qu,[t[31]||(t[31]=o("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Summary: ",-1)),o("div",$u,k(r.summary),1)])):l("v-if",!0),l(" Encrypted type "),r.type==="reasoning.encrypted"&&r.data?(a(),s("div",e0,[t[32]||(t[32]=o("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Encrypted Data: ",-1)),o("div",t0,k(r.data),1)])):l("v-if",!0),l(" Text type "),r.type==="reasoning.text"&&r.text?(a(),s("div",o0,[t[34]||(t[34]=o("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Reasoning Text: ",-1)),o("div",r0,k(r.text),1),r.signature?(a(),s("div",n0,[t[33]||(t[33]=o("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Signature: ",-1)),o("div",a0,k(r.signature),1)])):l("v-if",!0)])):l("v-if",!0),l(" Unknown type - show raw JSON "),["reasoning.summary","reasoning.encrypted","reasoning.text"].includes(r.type)?l("v-if",!0):(a(),s("div",l0,[o("pre",s0,k(JSON.stringify(r,null,2)),1)]))]))),128))])])])):l("v-if",!0),l(" Response Body "),n.log.response_body?(a(),s("div",i0,[t[36]||(t[36]=o("div",{class:"text-xs font-semibold mb-1"},"Full Response Body",-1)),o("div",d0,[C(e.CodeBlock,{code:e.formatJson(n.log.response_body),language:"json"},null,8,["code"])])])):l("v-if",!0)],512),[[Ge,e.activeTab==="response"]])])],512)}const u0=ne(Xd,[["render",c0],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/threads/LogDetails.vue"]]),ut=20,Pt=20,p0=ae({__name:"LogsPane",props:{threadId:{type:[String,null],required:!0},selectedLogId:{type:[String,null],required:!1},hoveredLogId:{type:[String,null],required:!1}},emits:["collapse","logClick","logHover","logsLoaded"],setup(p,{expose:t,emit:n}){const e=p,c=n,i=m(0),r=m(ut),{logs:d,total:u,hasMore:h,isFetching:f,error:v,wsConnected:g,wsError:x,connectWebSocket:y,disconnectWebSocket:_,refetch:T}=Md(z(()=>e.threadId),{limit:z(()=>r.value),offset:z(()=>i.value),enableWebSocket:!0,order:"desc"}),b=m([]),S=m(!0),M=m(null),L=m(null),O=m(!1),B=m(!1),H=m(new Map),re=async()=>{await be(),L.value&&(L.value.scrollTop=L.value.scrollHeight)},Q=m(null);ce(d,async Z=>{if(i.value===0)b.value=[...Z].reverse(),S.value&&b.value.length>0&&(await re(),S.value=!1);else{const ge=[...Z].reverse(),J=new Map;b.value.forEach(ie=>J.set(ie.id,ie)),ge.forEach(ie=>J.set(ie.id,ie)),b.value=Array.from(J.values()).sort((ie,ue)=>ie.created_at-ue.created_at)}},{deep:!0,immediate:!0}),ce(f,(Z,ge)=>{if(ge&&!Z&&i.value===0&&e.threadId&&Q.value!==e.threadId&&b.value.length>0){Q.value=e.threadId;const J=b.value[b.value.length-1];c("logsLoaded",J?.id??null)}});const{logDetails:q,isFetching:K}=Id(z(()=>e.threadId),z(()=>M.value)),R=z(()=>{if(!M.value)return null;const ge=b.value.find(J=>J.id===M.value);return ge?q.value?{...q.value,...ge}:ge:null}),Y=z(()=>M.value?_e.value.findIndex(Z=>Z.id===M.value):-1),E=z(()=>Y.value>0),N=z(()=>Y.value>=0&&Y.value<_e.value.length-1),w=()=>{if(E.value){const Z=_e.value[Y.value-1];V(Z)}},I=()=>{if(N.value){const Z=_e.value[Y.value+1];V(Z)}},A=Z=>{if(!L.value)return;const ge=H.value.get(Z);if(!ge)return;const J=L.value,ie=ge.getBoundingClientRect(),ue=J.getBoundingClientRect(),we=J.querySelectorAll(".sticky");let Ee=0;we.forEach(tt=>{Ee+=tt.getBoundingClientRect().height}),Ee+=16;const De=ie.top<ue.top+Ee,et=ie.bottom>ue.bottom;De?J.scrollBy({top:ie.top-ue.top-Ee,behavior:"smooth"}):et&&J.scrollBy({top:ie.bottom-ue.bottom,behavior:"smooth"})},V=Z=>{c("logClick",Z.id),M.value=Z.id},P=(Z,ge)=>{ge?H.value.set(Z,ge):H.value.delete(Z)};ce(M,async Z=>{Z&&(await be(),A(Z))}),ce(()=>e.selectedLogId,Z=>{Z&&(M.value=Z)},{immediate:!0});const U=Z=>{M.value=Z},D=async Z=>{await be();const ge=H.value.get(Z);if(ge&&L.value){const J=L.value,ie=ge.getBoundingClientRect(),ue=J.getBoundingClientRect(),we=J.querySelector("thead"),Ee=J.querySelector(":scope > div > div.sticky");let De=0;we&&(De+=we.getBoundingClientRect().height),Ee&&(De+=Ee.getBoundingClientRect().height),De+=40;const et=ie.top<ue.top+De,tt=ie.bottom>ue.bottom;et?J.scrollBy({top:ie.top-ue.top-De,behavior:"smooth"}):tt&&J.scrollBy({top:ie.bottom-ue.bottom,behavior:"smooth"})}},W=Z=>{if(Z.length===0)return;const ge=new Set(Z);b.value=b.value.filter(J=>!ge.has(J.id))},G=m(!1),se=Z=>b.value.some(ge=>ge.id===Z),he=Z=>b.value.find(ge=>ge.id===Z)??null,me=(Z,ge=3e3)=>new Promise(J=>{const ie=Date.now(),ue=ce(b,()=>{b.value.length!==Z&&(ue(),J(!0))},{deep:!0}),we=setInterval(()=>{b.value.length!==Z?(clearInterval(we),ue(),J(!0)):Date.now()-ie>ge&&(clearInterval(we),ue(),J(!1))},50)}),j=async Z=>{if(se(Z))return!0;if(!h.value)return!1;G.value=!0;const ge=100,J=50;try{let ie=0;for(;h.value&&!se(Z)&&ie<J;){ie++;const ue=b.value.length;if(i.value+=r.value,r.value=ge,await T(),!await me(ue))break}return se(Z)}finally{G.value=!1}},F=async(Z,ge=2e3)=>{const J=Date.now();for(;Date.now()-J<ge;){if(H.value.has(Z))return!0;if(!_e.value.some(ue=>ue.id===Z)){await be(),await new Promise(ue=>setTimeout(ue,16));continue}await be(),await new Promise(ue=>setTimeout(ue,16))}return!1},oe=Z=>{G.value=Z};t({scrollToLog:D,selectLogById:U,removeLogsByIds:W,loadUntilLogId:j,hasLog:se,getLog:he,setLoadingForLog:oe,waitForLogRow:F});const pe=async()=>{if(B.value||!h.value||f.value)return;B.value=!0;const Z=L.value?.scrollHeight||0;if(i.value+=r.value,r.value=Pt,await T(),await be(),L.value){const ge=L.value.scrollHeight;L.value.scrollTop+=ge-Z}B.value=!1};ce(()=>e.threadId,async Z=>{Z?(_(),y()):_(),i.value=0,r.value=ut,b.value=[],M.value=null,O.value=!1,S.value=!0},{immediate:!0}),ce(b,async()=>{O.value||await re()},{deep:!0});const Ie=()=>{if(!L.value)return;const{scrollTop:Z,scrollHeight:ge,clientHeight:J}=L.value,ie=ge-Z-J<50;O.value=!ie},Te=Z=>{if(!Z.tools_called)return"—";try{const ge=JSON.parse(Z.tools_called);return Array.isArray(ge)?ge.join(", "):Z.tools_called}catch{return Z.tools_called}},Le=Z=>Z==null?"—":`$${Z.toFixed(6)}`,_e=z(()=>{const Z=new Map,ge=new Map;b.value.forEach(ue=>{Z.set(ue.id,ue);const we=ue.parent_log_id;we&&(ge.has(we)||ge.set(we,[]),ge.get(we).push(ue))});const J=[],ie=(ue,we)=>{J.push({...ue,depth:we}),(ge.get(ue.id)||[]).forEach(De=>{ie(De,we+1)})};return b.value.forEach(ue=>{ue.parent_log_id||ie(ue,0)}),J}),je={props:e,emit:c,INITIAL_LOAD_LIMIT:ut,LOAD_MORE_LIMIT:Pt,offset:i,limit:r,fetchedLogs:d,total:u,hasMore:h,isFetching:f,error:v,wsConnected:g,wsError:x,connectWebSocket:y,disconnectWebSocket:_,refetch:T,allLoadedLogs:b,isFirstLoad:S,selectedLogIdForDetails:M,logsScrollContainer:L,userHasScrolledUp:O,isLoadingMore:B,logRowRefs:H,scrollToBottom:re,emittedLogsLoadedForThreadId:Q,logDetails:q,isFetchingDetails:K,selectedLog:R,selectedLogIndex:Y,hasPreviousLog:E,hasNextLog:N,navigateToPreviousLog:w,navigateToNextLog:I,scrollLogIntoView:A,selectLog:V,setLogRowRef:P,selectLogById:U,scrollToLog:D,removeLogsByIds:W,isLoadingForLog:G,hasLog:se,getLog:he,waitForLogsToUpdate:me,loadUntilLogId:j,waitForLogRow:F,setLoadingForLog:oe,loadMoreLogs:pe,handleScroll:Ie,getToolsCalled:Te,formatCost:Le,logsWithDepth:_e,LogDetailsComponent:u0,Loader:$e,TimeAgo:yt,StatusDot:xt,get ScrollTextIcon(){return Rt},get ChevronLeftIcon(){return vt},get RotateCwIcon(){return xo}};return Object.defineProperty(je,"__isScriptSetup",{enumerable:!1,value:!0}),je}}),m0={class:"flex flex-col h-full"},g0={class:"px-4 py-3 border-b border-neutral-300 dark:border-neutral-700"},f0={class:"flex items-center justify-between"},h0={class:"flex items-center gap-2"},v0={class:"flex items-center gap-2"},b0={key:0,class:"text-neutral-500 dark:text-neutral-400 text-center py-12"},y0={class:"flex justify-center py-12"},x0={class:"text-red-600 dark:text-red-400 text-center py-12"},k0={key:0,class:"border-b border-neutral-300 dark:border-neutral-700 bg-white dark:bg-black sticky top-0 z-10"},_0=["disabled"],w0={key:1},C0={key:2},S0={key:3},T0={class:"w-full text-sm"},M0=["onClick","onMouseenter"],I0={class:"px-3 py-2 text-xs"},V0={class:"flex items-center gap-1"},L0={key:0,class:"text-neutral-400 dark:text-neutral-600 mr-1"},P0={key:3},A0={class:"px-3 py-2"},E0={class:"flex items-center gap-2"},O0={key:0,class:"text-red-600 dark:text-red-400",title:"Error"},j0={class:"font-mono text-xs"},D0={class:"px-3 py-2 font-mono text-xs"},q0={key:1},U0={key:1},B0={key:0,class:"log-details-panel relative shrink-0 bg-neutral-100 dark:bg-neutral-950 border-t border-neutral-300 dark:border-neutral-700 overflow-hidden"},R0={class:"m-2 border h-[calc(100%-1rem)] border-neutral-300 shrink-0 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 overflow-auto"},N0={key:0,class:"flex flex-col items-center justify-center h-full gap-3 text-neutral-500 dark:text-neutral-400"},F0={key:2,class:"absolute inset-0 bg-white/50 dark:bg-black/50 flex items-center justify-center"};function H0(p,t,n,e,c,i){return a(),s("div",m0,[l(" Header "),o("div",g0,[o("div",f0,[o("div",h0,[C(e.ScrollTextIcon,{size:18,class:"shrink-0"}),t[4]||(t[4]=o("h2",{class:"text-base font-bold"},"Logs",-1)),n.threadId?(a(),ee(e.StatusDot,{key:0,connected:e.wsConnected,error:e.wsError},null,8,["connected","error"])):l("v-if",!0)]),o("div",v0,[o("button",{onClick:t[0]||(t[0]=r=>e.emit("collapse")),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Collapse pane"},[C(e.ChevronLeftIcon,{size:20})])])])]),l(" Top half: Scrollable logs list "),o("div",{ref:"logsScrollContainer",class:"logs-list-container flex-1 overflow-y-auto overflow-x-auto",onScroll:e.handleScroll},[l(" No thread selected "),n.threadId?e.isFetching&&e.offset===0?(a(),s(X,{key:1},[l(" Loading state (initial load only) "),o("div",y0,[C(e.Loader)])],2112)):e.error?(a(),s(X,{key:2},[l(" Error state "),o("div",x0," Error loading logs: "+k(e.error),1)],2112)):e.allLoadedLogs.length===0?(a(),s(X,{key:3},[l(" Empty state "),t[5]||(t[5]=o("div",{class:"text-neutral-500 dark:text-neutral-400 text-center py-12"}," No logs yet ",-1))],2112)):(a(),s(X,{key:4},[l(" Logs table "),o("div",null,[l(" Load previous logs button "),e.hasMore?(a(),s("div",k0,[o("button",{onClick:e.loadMoreLogs,disabled:e.isLoadingMore||e.isLoadingForLog,type:"button",class:"w-full px-3 py-2 text-xs font-medium text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-900 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"},[e.isLoadingMore||e.isLoadingForLog?(a(),ee(e.Loader,{key:0,size:"xs"})):l("v-if",!0),e.isLoadingForLog?(a(),s("span",w0,"Loading to find log...")):e.isLoadingMore?(a(),s("span",C0,"Loading older logs...")):(a(),s("span",S0,"Load previous logs"))],8,_0)])):l("v-if",!0),o("table",T0,[o("thead",{class:$(["border-b border-neutral-300 dark:border-neutral-700 sticky bg-white z-[10] dark:bg-black",{"top-0":!e.hasMore,"top-[34px]":e.hasMore}])},[...t[6]||(t[6]=[o("tr",null,[o("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Prompt"),o("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Model"),o("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Cost"),o("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Tools Called"),o("th",{class:"text-right px-3 py-1.5 text-xs font-semibold"},"Called At")],-1)])],2),o("tbody",null,[(a(!0),s(X,null,ve(e.logsWithDepth,r=>(a(),s("tr",{key:r.id,ref_for:!0,ref:d=>e.setLogRowRef(r.id,d),class:$(["border-b border-neutral-200 dark:border-neutral-800 cursor-pointer transition-colors relative",{"last:border-b-0":e.selectedLog,"bg-red-50 dark:bg-red-950/20":r.error,"bg-accent-100 dark:bg-accent-900 dark:text-white":e.selectedLogIdForDetails===r.id,"ring-2 ring-inset ring-accent-400 dark:ring-accent-400":r.id===e.props.selectedLogId||r.id!==e.props.selectedLogId&&r.id===e.props.hoveredLogId}]),onClick:d=>e.selectLog(r),onMouseenter:d=>e.emit("logHover",r.id),onMouseleave:t[1]||(t[1]=d=>e.emit("logHover",null))},[o("td",I0,[o("div",V0,[r.depth>0?(a(),s("span",L0,"└─")):l("v-if",!0),r.retry_of_log_id?(a(),ee(e.RotateCwIcon,{key:1,size:14,class:"text-neutral-500 dark:text-neutral-400 flex-shrink-0"})):l("v-if",!0),!r.is_complete&&!r.prompt_name?(a(),ee(e.Loader,{key:2,size:"xs"})):(a(),s("span",P0,k(r.prompt_name||"—"),1))])]),o("td",A0,[o("div",E0,[r.error?(a(),s("span",O0," ✕ ")):l("v-if",!0),o("span",j0,k(r.model_name||r.model),1)])]),o("td",D0,[!r.is_complete&&!r.cost_total?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",q0,k(e.formatCost(r.cost_total)),1))]),o("td",{class:$(["px-3 py-2 text-xs",e.selectedLogIdForDetails===r.id?"text-neutral-800 dark:text-neutral-100":"text-neutral-600 dark:text-neutral-400"])},[!r.is_complete&&e.getToolsCalled(r)==="—"?(a(),ee(e.Loader,{key:0,size:"xs"})):(a(),s("span",U0,k(e.getToolsCalled(r)),1))],2),o("td",{class:$(["px-3 py-2 text-right text-xs",e.selectedLogIdForDetails===r.id?"text-neutral-800 dark:text-neutral-100":"text-neutral-500 dark:text-neutral-500"])},[C(e.TimeAgo,{timestamp:r.created_at},null,8,["timestamp"])],2)],42,M0))),128))])])])],2112)):(a(),s("div",b0," Select a thread to view logs "))],544),l(" Bottom half: Log details "),C(ze,{name:"slide-up",onAfterEnter:t[3]||(t[3]=()=>e.selectedLogIdForDetails&&e.scrollLogIntoView(e.selectedLogIdForDetails))},{default:de(()=>[e.selectedLog||e.isLoadingForLog&&e.selectedLogIdForDetails?(a(),s("div",B0,[o("div",R0,[l(" Loading state while loading logs to find target "),e.isLoadingForLog&&!e.selectedLog?(a(),s("div",N0,[C(e.Loader),t[7]||(t[7]=o("span",{class:"text-sm"},"Loading log...",-1))])):e.selectedLog?(a(),s(X,{key:1},[l(" Log details when available "),C(e.LogDetailsComponent,{log:e.selectedLog,"has-previous":e.hasPreviousLog,"has-next":e.hasNextLog,onClose:t[2]||(t[2]=r=>e.selectedLogIdForDetails=null),onPrevious:e.navigateToPreviousLog,onNext:e.navigateToNextLog},null,8,["log","has-previous","has-next"])],2112)):l("v-if",!0),l(" Loading overlay for log details fetch "),e.isFetchingDetails&&e.selectedLog?(a(),s("div",F0,[C(e.Loader)])):l("v-if",!0)])])):l("v-if",!0)]),_:1})])}const z0=ne(p0,[["render",H0],["__scopeId","data-v-607bd0a4"],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/threads/LogsPane.vue"]]),W0=ae({__name:"CreateThreadModal",props:{modelValue:{type:Boolean,required:!0},editThread:{type:null,required:!1}},emits:["update:modelValue","thread-created","thread-updated"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=z(()=>!!e.editThread),r=m(""),d=m(""),u=m({}),h=m([]),f=m(""),v=m(!1),g=m(""),x=m(null),{data:y,isFetching:_,execute:T}=Ve(te("/api/agents"),{immediate:!1}).json(),b=z(()=>y.value?(y.value?.agents||[]).map(V=>({value:V.id,label:V.title})):[]),S=z(()=>!r.value||!y.value?null:(y.value?.agents||[]).find(V=>V.id===r.value)),M=z(()=>S.value&&S.value.type==="ai_human"?"AI":"Side A"),L=z(()=>S.value&&S.value.type==="ai_human"?"Human":"Side B"),{data:O,isFetching:B,execute:H}=Ve(z(()=>S.value?.side_a_system_prompt?te(`/api/prompts/${S.value.side_a_system_prompt}`):""),{immediate:!1}).json(),re=z(()=>{if(!O.value)return null;const A=O.value?.required_schema;if(!A)return null;try{return typeof A=="string"?JSON.parse(A):A}catch{return null}}),Q=z(()=>{const A=re.value;return!A||!A.properties?[]:Object.entries(A.properties).map(([V,P])=>({name:V,type:P.type||"string",description:P.description||"",required:A.required?.includes(V)||!1,enum:P.enum}))});ce(r,async A=>{A&&S.value?.side_a_system_prompt?(await H(),u.value={}):u.value={}});const q=()=>{const A=x.value;A&&(A.style.height="auto",A.style.height=`${A.scrollHeight}px`)},K=A=>{f.value.trim()&&(h.value.push({id:crypto.randomUUID(),role:A,content:f.value.trim()}),f.value="",setTimeout(()=>q(),0))},R=A=>{h.value=h.value.filter(V=>V.id!==A)},Y=()=>{r.value="",d.value="",u.value={},h.value=[],f.value="",g.value=""},E=()=>{e.editThread&&(r.value=e.editThread.agent_id,d.value=e.editThread.tags?.join(", ")||"")},N=async()=>{if(!r.value){g.value="Please select an agent";return}if(!i.value&&Q.value.length>0){for(const A of Q.value)if(A.required&&!u.value[A.name]){g.value=`Please provide ${A.name}`;return}}v.value=!0,g.value="";try{const A=d.value.split(",").map(V=>V.trim()).filter(V=>V.length>0);if(i.value){const V=await fetch(te(`/api/threads/${e.editThread.id}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tags:A})});if(!V.ok){const P=await V.json();throw new Error(P.error||"Failed to update thread")}c("thread-updated"),Y(),c("update:modelValue",!1)}else{const V={agent_id:r.value,tags:A.length>0?A:void 0};h.value.length>0&&(V.initial_messages=h.value.map(W=>({role:W.role,content:W.content}))),Object.keys(u.value).length>0&&(V.data=u.value);const P=await fetch(te("/api/threads"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)});if(!P.ok){const W=await P.json();throw new Error(W.error||"Failed to create thread")}const D=(await P.json()).threadId;if(!D)throw new Error("Thread created but ID not found in response");c("thread-created",D),Y(),c("update:modelValue",!1)}}catch(A){console.error(`Error ${i.value?"updating":"creating"} thread:`,A),g.value=A.message||`Failed to ${i.value?"update":"create"} thread`}finally{v.value=!1}},w=()=>{Y(),c("update:modelValue",!1)};ce(()=>e.modelValue,async A=>{A&&(await T(),Y(),i.value&&E())});const I={props:e,emit:c,isEditMode:i,selectedAgentId:r,tags:d,requiredData:u,messages:h,newMessageContent:f,isSubmitting:v,errorMessage:g,textareaRef:x,agentsData:y,isFetchingAgents:_,fetchAgents:T,agentOptions:b,selectedAgent:S,sideALabel:M,sideBLabel:L,promptData:O,isFetchingPrompt:B,fetchPrompt:H,requiredSchema:re,schemaFields:Q,adjustHeight:q,addMessage:K,removeMessage:R,resetForm:Y,populateEditForm:E,handleSubmit:N,handleCancel:w,Modal:Ne,SelectInput:Ae,TextInput:Ke,TextareaInput:Qt};return Object.defineProperty(I,"__isScriptSetup",{enumerable:!1,value:!0}),I}}),J0={class:"space-y-4"},K0={key:0,class:"p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded text-sm text-red-800 dark:text-red-200"},Z0={class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},G0={key:0},X0={key:1},Y0={key:1,class:"space-y-4 p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},Q0={class:"flex items-center gap-2"},$0=["onUpdate:modelValue","id"],e2=["for"],t2={key:0,class:"text-red-500"},o2={key:5,class:"text-xs text-neutral-500 dark:text-neutral-400 mt-1"},r2={key:2,class:"p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg text-center text-sm text-neutral-500"},n2={key:3},a2={key:0,class:"space-y-3 mb-4 max-h-64 overflow-y-auto p-2"},l2={class:"text-xs font-medium mb-1 opacity-70"},s2={class:"text-sm whitespace-pre-wrap"},i2=["onClick"],d2={class:"space-y-2"},c2={class:"flex items-stretch border border-black dark:border-neutral-300 rounded overflow-hidden bg-white dark:bg-neutral-900"},u2=["disabled","title"],p2={class:"flex-1 relative"},m2=["disabled","title"],g2={class:"text-xs text-neutral-500 dark:text-neutral-400"},f2={class:"flex justify-between"},h2=["disabled"],v2=["disabled"];function b2(p,t,n,e,c,i){return a(),ee(e.Modal,{"model-value":n.modelValue,"onUpdate:modelValue":t[7]||(t[7]=r=>p.$emit("update:modelValue",r)),title:e.isEditMode?"Edit Thread":"Create New Thread",width:"max-w-3xl"},{footer:de(()=>[o("div",f2,[o("button",{onClick:e.handleCancel,type:"button",disabled:e.isSubmitting,class:"px-3 py-1.5 text-sm border border-black dark:border-white rounded font-medium hover:bg-black/5 dark:hover:bg-white/10 transition-colors disabled:opacity-50"}," Cancel ",8,h2),o("button",{onClick:e.handleSubmit,type:"button",disabled:e.isSubmitting||e.isFetchingAgents,class:"px-3 py-1.5 text-sm bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity disabled:opacity-50"},[e.isEditMode?(a(),s(X,{key:0},[ke(k(e.isSubmitting?"Updating...":"Update Thread"),1)],64)):(a(),s(X,{key:1},[ke(k(e.isSubmitting?"Creating...":"Create Thread"),1)],64))],8,v2)])]),default:de(()=>[o("div",J0,[l(" Error Message "),e.errorMessage?(a(),s("div",K0,k(e.errorMessage),1)):l("v-if",!0),l(" Agent Selection (disabled in edit mode) "),o("div",null,[C(e.SelectInput,{modelValue:e.selectedAgentId,"onUpdate:modelValue":t[0]||(t[0]=r=>e.selectedAgentId=r),label:"Agent",options:e.agentOptions,disabled:e.isFetchingAgents||e.isEditMode,placeholder:"Select an agent...",required:""},null,8,["modelValue","options","disabled"]),o("p",Z0,[e.isEditMode?(a(),s("span",G0,"Agent cannot be changed after thread creation")):(a(),s("span",X0,"Choose which agent will handle this conversation"))])]),l(" Dynamic schema fields (only in create mode) "),!e.isEditMode&&e.schemaFields.length>0&&!e.isFetchingPrompt?(a(),s("div",Y0,[t[8]||(t[8]=o("h4",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"}," Required Information ",-1)),(a(!0),s(X,null,ve(e.schemaFields,r=>(a(),s("div",{key:r.name,class:"space-y-2"},[l(" Enum field (dropdown) "),r.enum?(a(),ee(e.SelectInput,{key:0,modelValue:e.requiredData[r.name],"onUpdate:modelValue":d=>e.requiredData[r.name]=d,label:r.name,options:[{value:"",label:"Select..."},...r.enum.map(d=>({value:d,label:d}))],required:r.required},null,8,["modelValue","onUpdate:modelValue","label","options","required"])):r.type==="string"?(a(),s(X,{key:1},[l(" Text field "),C(e.TextInput,{modelValue:e.requiredData[r.name],"onUpdate:modelValue":d=>e.requiredData[r.name]=d,label:r.name,placeholder:r.description,required:r.required},null,8,["modelValue","onUpdate:modelValue","label","placeholder","required"])],2112)):r.type==="number"||r.type==="integer"?(a(),s(X,{key:2},[l(" Number field "),C(e.TextInput,{modelValue:e.requiredData[r.name],"onUpdate:modelValue":d=>e.requiredData[r.name]=d,modelModifiers:{number:!0},label:r.name,placeholder:r.description,type:"number",required:r.required},null,8,["modelValue","onUpdate:modelValue","label","placeholder","required"])],2112)):r.type==="boolean"?(a(),s(X,{key:3},[l(" Boolean field "),o("div",Q0,[Me(o("input",{"onUpdate:modelValue":d=>e.requiredData[r.name]=d,type:"checkbox",id:`field-${r.name}`,class:"w-4 h-4"},null,8,$0),[[ko,e.requiredData[r.name]]]),o("label",{for:`field-${r.name}`,class:"text-sm"},[ke(k(r.name)+" ",1),r.required?(a(),s("span",t2,"*")):l("v-if",!0)],8,e2)])],2112)):(a(),s(X,{key:4},[l(" Fallback: textarea for complex types "),C(e.TextareaInput,{modelValue:e.requiredData[r.name],"onUpdate:modelValue":d=>e.requiredData[r.name]=d,label:r.name,placeholder:r.description||`Enter ${r.name} (JSON format)`,required:r.required,rows:3},null,8,["modelValue","onUpdate:modelValue","label","placeholder","required"])],2112)),r.description?(a(),s("p",o2,k(r.description),1)):l("v-if",!0)]))),128))])):l("v-if",!0),l(" Loading prompt schema (only in create mode) "),!e.isEditMode&&e.isFetchingPrompt?(a(),s("div",r2," Loading agent requirements... ")):l("v-if",!0),l(" Conversation Builder (only in create mode) "),e.isEditMode?l("v-if",!0):(a(),s("div",n2,[t[12]||(t[12]=o("h4",{class:"text-sm font-medium mb-3"},"Initial Conversation",-1)),l(" Messages List (iOS style) "),e.messages.length>0?(a(),s("div",a2,[(a(!0),s(X,null,ve(e.messages,r=>(a(),s("div",{key:r.id,class:$(["flex items-start gap-2",{"justify-start":r.role==="assistant","justify-end":r.role==="user"}])},[o("div",{class:$(["max-w-[80%] rounded-2xl px-4 py-2 break-words",{"bg-black text-white dark:bg-white dark:text-black":r.role==="assistant","bg-neutral-200 text-black dark:bg-neutral-800 dark:text-white":r.role==="user"}])},[o("div",l2,k(r.role==="assistant"?e.sideALabel:e.sideBLabel),1),o("div",s2,k(r.content),1)],2),o("button",{onClick:d=>e.removeMessage(r.id),type:"button",class:"text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-200 text-xs mt-2"}," ✕ ",8,i2)],2))),128))])):(a(),s(X,{key:1},[l(" Empty state "),t[9]||(t[9]=o("div",{class:"text-center py-8 text-neutral-500 dark:text-neutral-400 text-sm"}," No messages yet. Add messages to start the conversation. ",-1))],2112)),l(" Add Message Form "),o("div",d2,[l(" Unified Input Container "),o("div",c2,[l(" Agent/Side A Button (LEFT) "),o("button",{onClick:t[1]||(t[1]=r=>e.addMessage("assistant")),type:"button",disabled:!e.newMessageContent.trim(),title:`Add as ${e.sideALabel}`,class:"px-3 py-2 bg-black text-white dark:bg-white dark:text-black text-sm hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap inline-flex items-center gap-1 border-r border-black dark:border-neutral-300 flex-shrink-0"},[t[10]||(t[10]=o("svg",{class:"w-[1em] h-[1em]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 10l7-7m0 0l7 7m-7-7v18"})],-1)),o("span",null,k(e.sideALabel),1)],8,u2),l(" Multiline Input (no border, no padding adjustments needed) "),o("div",p2,[Me(o("textarea",{"onUpdate:modelValue":t[2]||(t[2]=r=>e.newMessageContent=r),placeholder:"Type a message...",class:"w-full px-3 py-2 bg-transparent border-0 font-mono text-sm focus:outline-none resize-none overflow-hidden",rows:"1",ref:"textareaRef",onInput:e.adjustHeight,onKeydown:[t[3]||(t[3]=mt(Ce(r=>e.addMessage("user"),["meta"]),["enter"])),t[4]||(t[4]=mt(Ce(r=>e.addMessage("user"),["ctrl"]),["enter"]))]},null,544),[[Oe,e.newMessageContent]])]),l(" Human/Side B Button (RIGHT) "),o("button",{onClick:t[5]||(t[5]=r=>e.addMessage("user")),type:"button",disabled:!e.newMessageContent.trim(),title:`Add as ${e.sideBLabel}`,class:"px-3 py-2 bg-black text-white dark:bg-white dark:text-black text-sm hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap inline-flex items-center gap-1 border-l border-black dark:border-neutral-300 flex-shrink-0"},[t[11]||(t[11]=o("svg",{class:"w-[1em] h-[1em]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 10l7-7m0 0l7 7m-7-7v18"})],-1)),o("span",null,k(e.sideBLabel),1)],8,m2)]),o("p",g2," Type a message and click "+k(e.sideALabel)+" (left) or "+k(e.sideBLabel)+" (right) to add. Or press Cmd+Enter (Mac) / Ctrl+Enter (Windows) to add as "+k(e.sideBLabel)+". ",1)])])),l(" Tags "),o("div",null,[C(e.TextInput,{modelValue:e.tags,"onUpdate:modelValue":t[6]||(t[6]=r=>e.tags=r),label:"Tags",placeholder:"research, urgent, production"},null,8,["modelValue"]),t[13]||(t[13]=o("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Comma-separated tags to help organize and search threads ",-1))])])]),_:1},8,["model-value","title"])}const y2=ne(W0,[["render",b2],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/threads/CreateThreadModal.vue"]]),x2=ae({__name:"ThreadsView",setup(p,{expose:t}){t();const n=Fe(),e=Xe(),c=m(typeof n.params.id=="string"?n.params.id:null),i=m({threadList:!1,messages:!1,logs:!1}),r=m(!1),d=m(null),u=m(null),{thread:h}=bt(z(()=>c.value)),f=m(null),v=m(null),g=m(null),x=m(null),y=m(null),_=w=>{x.value=w,y.value=w},T=w=>{if(x.value=w,!w){y.value=null;return}y.value=w;const I=b.value,A=S.value;if(!I||!A||I.hasWorkblockForLogId(w))return;let V=w;const P=10;for(let U=0;U<P&&V;U++){const D=A.getLog(V);if(!D)break;const W=D.parent_log_id;if(!W)break;if(I.hasWorkblockForLogId(W)){y.value=W;return}V=W}},b=m(null),S=m(null);ce(()=>n.params.id,w=>{c.value=typeof w=="string"?w:null,f.value=null,v.value=null,g.value=null});const N={route:n,router:e,selectedThreadId:c,collapsedPanes:i,showThreadModal:r,editingThread:d,threadListPaneRef:u,thread:h,selectedMessageId:f,selectedLogId:v,highlightedWorkblockLogId:g,hoveredLogId:x,hoveredWorkblockLogId:y,handleMessageHover:_,handleLogHover:T,messagesPaneRef:b,logsPaneRef:S,handleThreadSelect:w=>{e.push(`/threads/${w}`)},handleThreadDeleted:w=>{window.location.href="/threads"},handleEditThread:()=>{h.value&&(d.value=h.value,r.value=!0)},handleCreateThread:()=>{d.value=null,r.value=!0},handleThreadCreated:w=>{u.value?.refetch(),e.push(`/threads/${w}`)},handleThreadUpdated:()=>{window.location.reload()},togglePane:w=>{i.value[w]=!i.value[w]},handleMessageClick:async(w,I)=>{if(f.value=w,!I){v.value=null,g.value=null;return}const A=S.value;if(!A){v.value=I,g.value=I;return}const V=!A.hasLog(I);if(V&&A.setLoadingForLog(!0),v.value=I,g.value=I,V&&!await A.loadUntilLogId(I)){console.warn(`Could not find log ${I} after loading all available logs`),A.setLoadingForLog(!1);return}if(!await A.waitForLogRow(I)){console.warn(`Log row ${I} not rendered in time`);return}A.scrollToLog(I),A.selectLogById(I)},handleLogClick:w=>{v.value=w,g.value=w,f.value=null;const I=b.value,A=S.value;if(!I||!A)return;let V=I.scrollToLogId(w);if(V)return;let P=w;const U=10;for(let D=0;D<U&&P;D++){const W=A.getLog(P);if(!W)break;const G=W.parent_log_id;if(!G)break;if(V=I.scrollToLogId(G),V){g.value=G;return}P=G}},handleLogsLoaded:w=>{w&&(v.value=w)},handleLogsDeleted:w=>{S.value?.removeLogsByIds(w)},handleThreadsLoaded:w=>{w&&!c.value&&e.push(`/threads/${w}`)},ThreadListPane:Is,MessagesPane:Td,LogsPane:z0,CreateThreadModal:y2,get ListIcon(){return qt},get MessageSquareIcon(){return Bt},get ScrollTextIcon(){return Rt}};return Object.defineProperty(N,"__isScriptSetup",{enumerable:!1,value:!0}),N}}),k2={class:"flex h-full overflow-hidden"},_2={key:0,class:"flex flex-col items-center p-4"},w2={key:0,class:"flex flex-col items-center p-4"},C2={key:0,class:"flex flex-col items-center p-4"};function S2(p,t,n,e,c,i){return a(),s("div",k2,[l(" Pane 1: Thread List "),o("div",{class:$([e.collapsedPanes.threadList?"w-[60px]":"w-[320px]","border-r border-neutral-300 dark:border-neutral-700 flex-shrink-0 overflow-hidden transition-all duration-200"])},[e.collapsedPanes.threadList?(a(),s("div",_2,[o("button",{onClick:t[0]||(t[0]=r=>e.togglePane("threadList")),class:"p-2 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Expand Threads pane"},[C(e.ListIcon,{size:20})])])):(a(),ee(e.ThreadListPane,{key:1,ref:"threadListPaneRef","selected-thread-id":e.selectedThreadId,onSelectThread:e.handleThreadSelect,onCollapse:t[1]||(t[1]=r=>e.togglePane("threadList")),onCreateThread:e.handleCreateThread,onThreadsLoaded:e.handleThreadsLoaded},null,8,["selected-thread-id"]))],2),l(" Pane 2: Messages "),o("div",{class:$([e.collapsedPanes.messages?"w-[60px]":"w-[380px]","border-r border-neutral-300 dark:border-neutral-700 flex-shrink-0 overflow-hidden transition-all duration-200"])},[e.collapsedPanes.messages?(a(),s("div",w2,[o("button",{onClick:t[2]||(t[2]=r=>e.togglePane("messages")),class:"p-2 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Expand Messages pane"},[C(e.MessageSquareIcon,{size:20})])])):(a(),ee(e.MessagesPane,{key:1,ref:"messagesPaneRef","thread-id":e.selectedThreadId,"selected-message-id":e.selectedMessageId,"selected-log-id":e.highlightedWorkblockLogId,"hovered-log-id":e.hoveredWorkblockLogId,onCollapse:t[3]||(t[3]=r=>e.togglePane("messages")),onMessageClick:e.handleMessageClick,onMessageHover:e.handleMessageHover,onThreadDeleted:e.handleThreadDeleted,onEditThread:e.handleEditThread,onLogsDeleted:e.handleLogsDeleted},null,8,["thread-id","selected-message-id","selected-log-id","hovered-log-id"]))],2),l(" Pane 3: Logs (flexible width) "),o("div",{class:$([e.collapsedPanes.logs?"w-[60px]":"flex-1","overflow-hidden transition-all duration-200"])},[e.collapsedPanes.logs?(a(),s("div",C2,[o("button",{onClick:t[4]||(t[4]=r=>e.togglePane("logs")),class:"p-2 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Expand Logs pane"},[C(e.ScrollTextIcon,{size:20})])])):(a(),ee(e.LogsPane,{key:1,ref:"logsPaneRef","thread-id":e.selectedThreadId,"selected-log-id":e.selectedLogId,"hovered-log-id":e.hoveredLogId,onCollapse:t[5]||(t[5]=r=>e.togglePane("logs")),onLogClick:e.handleLogClick,onLogHover:e.handleLogHover,onLogsLoaded:e.handleLogsLoaded},null,8,["thread-id","selected-log-id","hovered-log-id"]))],2),l(" Thread Modal (Create/Edit) "),C(e.CreateThreadModal,{modelValue:e.showThreadModal,"onUpdate:modelValue":t[6]||(t[6]=r=>e.showThreadModal=r),"edit-thread":e.editingThread,onThreadCreated:e.handleThreadCreated,onThreadUpdated:e.handleThreadUpdated},null,8,["modelValue","edit-thread"])])}const At=ne(x2,[["render",S2],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/ThreadsView.vue"]]),T2=ae({__name:"PromptsDataTable",emits:["add","edit","delete"],setup(p,{expose:t,emit:n}){const e=n,c=m([]),i=m(!1),r=[{key:"name",label:"Name",width:"w-1/4"},{key:"tool_description",label:"Description",width:"w-2/5"},{key:"model_name",label:"Model",width:"w-1/5",formatter:(v,g)=>v||g.model_id||"-"},{key:"created_at",label:"Created",width:"w-1/6",formatter:v=>v?new Date(v*1e3).toLocaleDateString():"-"}],d=[{icon:"edit",label:"Edit",handler:v=>e("edit",v)},{icon:"delete",label:"Delete",handler:async v=>{await h(v)},confirm:!0,confirmMessage:"Are you sure you want to delete this prompt?"}],u=async()=>{i.value=!0;try{const v=await fetch(te("/api/prompts"));if(v.ok){const g=await v.json();c.value=g.prompts||[]}}catch(v){console.error("Error fetching prompts:",v)}finally{i.value=!1}},h=async v=>{try{const g=await fetch(te(`/api/prompts/${v.id}`),{method:"DELETE"});if(g.ok)await u();else{const x=await g.json();alert(x.error||"Failed to delete prompt")}}catch(g){console.error("Error deleting prompt:",g),alert("Failed to delete prompt")}};xe(()=>{u()}),t({refresh:u});const f={emit:e,prompts:c,loading:i,columns:r,actions:d,fetchPrompts:u,deletePrompt:h,DataTable:Je};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}});function M2(p,t,n,e,c,i){return a(),s("div",null,[C(e.DataTable,{columns:e.columns,data:e.prompts,actions:e.actions,loading:e.loading,"empty-message":"No prompts available. Create your first prompt to get started."},null,8,["data","loading"])])}const I2=ne(T2,[["render",M2],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/PromptsDataTable.vue"]]),V2=ae({__name:"PromptBasicInfo",props:{name:{type:String,required:!0},toolDescription:{type:String,required:!0}},emits:["update:name","update:toolDescription"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=m(""),r=h=>{let f=h.replace(/[^a-zA-Z0-9\s_]/g,"");return f=f.trim().toLowerCase().replace(/\s+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),f?/^[a-z][a-z0-9_]*$/.test(f)?i.value="":i.value="Name must start with a letter and contain only lowercase letters, numbers, and underscores":i.value="Name is required",f},d=h=>{const f=r(h);c("update:name",f)};ce(()=>e.name,h=>{h&&r(h)},{immediate:!0});const u={props:e,emit:c,nameError:i,validateAndFormatName:r,handleNameInput:d,TextInput:Ke};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),L2={class:"space-y-4"},P2={key:0,class:"mt-1 text-sm text-red-500"},A2={key:1,class:"mt-1 text-sm text-neutral-500 dark:text-neutral-400"},E2={class:"px-1 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},O2=["value"];function j2(p,t,n,e,c,i){return a(),s("div",L2,[o("div",null,[C(e.TextInput,{"model-value":n.name,"onUpdate:modelValue":e.handleNameInput,label:"Prompt Name",placeholder:"Enter a unique name (will be converted to snake_case)"},null,8,["model-value"]),e.nameError?(a(),s("p",P2,k(e.nameError),1)):n.name?(a(),s("p",A2,[t[1]||(t[1]=ke(" Will be saved as: ",-1)),o("code",E2,k(n.name),1)])):l("v-if",!0)]),o("div",null,[t[2]||(t[2]=o("label",{class:"block text-sm font-medium mb-2"},"Tool Description",-1)),o("textarea",{value:n.toolDescription,onInput:t[0]||(t[0]=r=>e.emit("update:toolDescription",r.target.value)),placeholder:"Describe what this prompt does (shown when used as a tool)",class:"w-full px-3 py-2 border border-black dark:border-white rounded bg-transparent resize-none",rows:"3"},null,40,O2)])])}const D2=ne(V2,[["render",j2],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/prompt-form/PromptBasicInfo.vue"]]),q2="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%3e%3crect%20width='48'%20height='48'%20fill='%23F0EFEA'/%3e%3cpath%20d='M32.84%2010H26.72L37.88%2038H44L32.84%2010Z'%20fill='black'/%3e%3cpath%20d='M15.16%2010L4%2038H10.24L12.5224%2032.12H24.1976L26.48%2038H32.72L21.56%2010H15.16ZM14.5408%2026.92L18.36%2017.08L22.1793%2026.92H14.5408Z'%20fill='black'/%3e%3c/svg%3e",lt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%3e%3crect%20width='48'%20height='48'%20rx='24'%20fill='white'/%3e%3cpath%20d='M19.3418%2018.5599V14.7599C19.3418%2014.4399%2019.4608%2014.1998%2019.7382%2014.04L27.3102%209.63997C28.3409%209.03999%2029.5699%208.76014%2030.8383%208.76014C35.5954%208.76014%2038.6085%2012.4802%2038.6085%2016.4401C38.6085%2016.72%2038.6085%2017.04%2038.5687%2017.3601L30.7194%2012.72C30.2437%2012.4401%2029.7678%2012.4401%2029.2922%2012.72L19.3418%2018.5599ZM37.0226%2033.36V24.2799C37.0226%2023.7197%2036.7846%2023.3197%2036.309%2023.0398L26.3586%2017.1998L29.6093%2015.3197C29.8868%2015.1599%2030.1247%2015.1599%2030.4022%2015.3197L37.9741%2019.7197C40.1547%2020.9999%2041.6213%2023.7197%2041.6213%2026.3596C41.6213%2029.3995%2039.8375%2032.1999%2037.0226%2033.36ZM17.0029%2025.3601L13.7522%2023.4402C13.4748%2023.2804%2013.3557%2023.0402%2013.3557%2022.7202V13.9203C13.3557%209.64039%2016.6065%206.40016%2021.0069%206.40016C22.6722%206.40016%2024.2179%206.96029%2025.5265%207.96025L17.7168%2012.5204C17.2412%2012.8003%2017.0033%2013.2002%2017.0033%2013.7605L17.0029%2025.3601ZM24%2029.44L19.3418%2026.8001V21.2003L24%2018.5604L28.6578%2021.2003V26.8001L24%2029.44ZM26.993%2041.6002C25.3278%2041.6002%2023.7821%2041.04%2022.4735%2040.0402L30.2831%2035.4799C30.7588%2035.2001%2030.9967%2034.8001%2030.9967%2034.2399V22.6399L34.2873%2024.5598C34.5646%2024.7196%2034.6837%2024.9597%2034.6837%2025.2798V34.0797C34.6837%2038.3596%2031.3931%2041.6002%2026.993%2041.6002ZM17.5975%2032.6802L10.0255%2028.2803C7.84493%2027.0001%206.37833%2024.2803%206.37833%2021.6404C6.37833%2018.5604%208.20193%2015.8004%2011.0164%2014.6403V23.7602C11.0164%2024.3204%2011.2544%2024.7204%2011.73%2025.0003L21.641%2030.8001L18.3902%2032.6802C18.1129%2032.84%2017.8749%2032.84%2017.5975%2032.6802ZM17.1617%2039.2402C12.682%2039.2402%209.39151%2035.8402%209.39151%2031.6401C9.39151%2031.3201%209.43125%2031.0001%209.47066%2030.68L17.2803%2035.2402C17.7559%2035.5201%2018.2319%2035.5201%2018.7074%2035.2402L28.6578%2029.4404V33.2404C28.6578%2033.5605%2028.5388%2033.8005%2028.2614%2033.9604L20.6894%2038.3604C19.6586%2038.9603%2018.4301%2039.2402%2017.1617%2039.2402ZM26.993%2044C31.7899%2044%2035.7936%2040.5601%2036.7057%2036C41.1457%2034.8399%2044%2030.6399%2044%2026.36C44%2023.5598%2042.8108%2020.8401%2040.6701%2018.88C40.8683%2018.0399%2040.9872%2017.1998%2040.9872%2016.3602C40.9872%2010.6403%2036.3885%206.35998%2031.0763%206.35998C30.0062%206.35998%2028.9754%206.51979%2027.9446%206.88001C26.1604%205.11992%2023.7025%204%2021.0069%204C16.2101%204%2012.2064%207.4398%2011.2943%2012C6.8543%2013.1601%204%2017.3601%204%2021.6399C4%2024.4401%205.18916%2027.1599%207.32995%2029.1199C7.13174%2029.96%207.01277%2030.8001%207.01277%2031.6398C7.01277%2037.3597%2011.6114%2041.6399%2016.9236%2041.6399C17.9938%2041.6399%2019.0246%2041.4801%2020.0554%2041.1199C21.8392%2042.88%2024.2971%2044%2026.993%2044Z'%20fill='black'/%3e%3c/svg%3e",U2="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%3e%3cpath%20fill='%234285F4'%20d='M14.9%208.161c0-.476-.039-.954-.121-1.422h-6.64v2.695h3.802a3.24%203.24%200%2001-1.407%202.127v1.75h2.269c1.332-1.22%202.097-3.02%202.097-5.15z'/%3e%3cpath%20fill='%2334A853'%20d='M8.14%2015c1.898%200%203.499-.62%204.665-1.69l-2.268-1.749c-.631.427-1.446.669-2.395.669-1.836%200-3.393-1.232-3.952-2.888H1.85v1.803A7.044%207.044%200%20008.14%2015z'/%3e%3cpath%20fill='%23FBBC04'%20d='M4.187%209.342a4.17%204.17%200%20010-2.68V4.859H1.849a6.97%206.97%200%20000%206.286l2.338-1.803z'/%3e%3cpath%20fill='%23EA4335'%20d='M8.14%203.77a3.837%203.837%200%20012.7%201.05l2.01-1.999a6.786%206.786%200%2000-4.71-1.82%207.042%207.042%200%2000-6.29%203.858L4.186%206.66c.556-1.658%202.116-2.89%203.952-2.89z'/%3e%3c/svg%3e",Et="/agents/assets/img/meta.svg",B2="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%3e%3cpath%20d='M17.8962%2017.7465V14.9519C18.1789%2014.9346%2018.4615%2014.9174%2018.7442%2014.9174C26.5881%2014.6758%2031.7291%2021.5072%2031.7291%2021.5072C31.7291%2021.5072%2026.1818%2029.0287%2020.2282%2029.0287C19.4332%2029.0287%2018.6559%2028.9079%2017.9139%2028.6664V20.1789C20.9702%2020.5412%2021.5885%2021.8523%2023.4082%2024.8367L27.4891%2021.49C27.4891%2021.49%2024.5035%2017.6775%2019.4862%2017.6775C18.9562%2017.6603%2018.4262%2017.6948%2017.8962%2017.7465ZM17.8962%208.5V12.6747L18.7442%2012.623C29.6445%2012.2607%2036.7641%2021.352%2036.7641%2021.352C36.7641%2021.352%2028.6021%2031.047%2020.1045%2031.047C19.3625%2031.047%2018.6382%2030.978%2017.9139%2030.8573V33.4449C18.5145%2033.5139%2019.1329%2033.5657%2019.7335%2033.5657C27.6481%2033.5657%2033.3721%2029.6152%2038.9194%2024.9574C39.8381%2025.682%2043.601%2027.4243%2044.3784%2028.1834C39.1137%2032.4961%2026.8355%2035.9636%2019.8749%2035.9636C19.2035%2035.9636%2018.5675%2035.9291%2017.9315%2035.86V39.5H48V8.5L17.8962%208.5ZM17.8962%2028.6664V30.8745C10.5823%2029.5979%208.55061%2022.1628%208.55061%2022.1628C8.55061%2022.1628%2012.0662%2018.3676%2017.8962%2017.7465V20.1617H17.8785C14.8222%2019.7994%2012.4196%2022.594%2012.4196%2022.594C12.4196%2022.594%2013.7799%2027.3036%2017.8962%2028.6664ZM4.9113%2021.8523C4.9113%2021.8523%209.2396%2015.6074%2017.9139%2014.9519V12.6747C8.30327%2013.4338%200%2021.3692%200%2021.3692C0%2021.3692%204.6993%2034.6525%2017.8962%2035.86V33.4449C8.21494%2032.2718%204.9113%2021.8523%204.9113%2021.8523Z'%20fill='%2376B900'/%3e%3c/svg%3e",R2="data:image/svg+xml,%3csvg%20version='1.2'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201513%20975'%20width='1513'%20height='975'%3e%3ctitle%3eae99cd49-2667-464e-b9db-b39cee0126e1-svg%3c/title%3e%3cstyle%3e%20.s0%20{%20fill:%20%23ff5a00%20}%20%3c/style%3e%3cg%20id='%23ff5a00ff'%3e%3cpath%20id='Layer'%20class='s0'%20d='m989.5%200h67.8c95.3%205.4%20196.5%2023.1%20272.4%2085.5%2060.6%2049.1%2086.3%20133%2071.4%20208.6-11.4%2056.4-37.4%20108.4-65.4%20158.1-56.8%2098.4-126.6%20188.2-193%20280.1-11.9%2015.2-21.2%2033.8-20%2053.6%201.1%2015.7%2013.1%2028.4%2027.2%2034%2027.3%2011.1%2057.5%208.9%2086.2%207.3%2090.7-9.5%20178.1-37%20264.6-64.6%206.6-4.1%208.8%202.6%2011.3%207.4-91.9%2061.3-190.8%20112.4-294.8%20150-57.5%2019.3-118.3%2037.6-179.6%2030.4-32.2-3.2-64.5-22.4-74.6-54.5-12.5-41.8-7.9-88.1%2010.2-127.6%2027.5-61.7%2070.2-114.7%20110.7-168.2%2067.1-88%20136.4-175.5%20189.1-273.3%2017.4-34.7%2036-76.8%2018.7-115.1-16.3-35.3-51.7-56.1-85.6-71.8-60.2-26.9-124.4-43.1-187.7-61.1q-14.3%209.4-28.5%2019c22%2016.8%2044%2033.6%2065.8%2050.7-83.3%2015-166.3%2031.8-248.3%2052.7-124.9%2031-246.8%2072.5-367.6%20116.5%2011.8%2023.5%2023.5%2047.1%2034.7%2070.9-27.3%2030.2-54.4%2060.7-81.7%2090.9%2065.6%2019.6%20136.3%2022.3%20203.2%207.5%2057.2-12.8%20111-40.2%20154.7-79.3-11.9-14.8-26.9-26.7-43.1-36.5%2053.1%201.1%20101.4%2047.4%20101.5%20101.1q-15.6%200.1-31%200.2c-2.2-11.7-5.3-23-9.4-34.1-60.3%2054.5-138.2%2088.6-218.9%2097.4-71.1%208.2-143.8-1.6-210.7-26.6%204.5%2041.4%209%2082.6%2013.2%20124-38%2014.8-73.3%2036.2-104.9%2062-25.1%2021.9-50%2047.1-59.6%2079.9-9.2%2028.9%205.8%2061.7%2031.1%2077.2%2030.7%2019%2066.5%2027.8%20101.9%2032.9%2046.7%206.1%2093.9%205.6%20140.8%202.3%2092.1-6.8%20183.1-24.1%20272.7-45.8%208.9-3.6%2013.1%2011.1%204%2013.4-71.5%2036.8-146.3%2067.8-224.3%2087.8-73.3%2018.9-148.8%2028.6-224.4%2031.2-77.1-2.4-159-17.3-220.1-67.8-45.4-36.8-69.3-95.2-69.5-153.1v-3.1c1.5-61.2%2022.2-120.4%2052-173.4%2039.2-74.8%2087.5-145%20144.6-207.3%2098.7-108.7%20222.5-192.8%20355.6-253.7%20137.9-62.5%20285.5-107.4%20437.3-115.7z'/%3e%3c/g%3e%3c/svg%3e",N2="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%3e%3cpath%20d='M47.4964%209.43757C46.988%209.19072%2046.769%209.66115%2046.4717%209.90013C46.37%209.97722%2046.284%2010.0774%2046.1979%2010.1699C45.4548%2010.9562%2044.5866%2011.4729%2043.4523%2011.4112C41.794%2011.3186%2040.3781%2011.8353%2039.1265%2013.092C38.8605%2011.5423%2037.9767%2010.617%2036.6312%2010.0234C35.9273%209.71497%2035.2154%209.40651%2034.7226%208.7357C34.3784%208.25783%2034.2845%207.7258%2034.1124%207.20147C34.0029%206.8854%2033.8934%206.56146%2033.5257%206.50747C33.1268%206.44587%2032.9703%206.77725%2032.8138%207.05499C32.1881%208.18844%2031.9456%209.43749%2031.969%2010.7019C32.0237%2013.5471%2033.2363%2015.8137%2035.6455%2017.4252C35.9193%2017.6103%2035.9896%2017.7952%2035.9036%2018.0652C35.7393%2018.6204%2035.5437%2019.16%2035.3717%2019.7151C35.2622%2020.0699%2035.0978%2020.147%2034.7146%2019.9926C33.3926%2019.4453%2032.2505%2018.6357%2031.2414%2017.6566C29.5284%2016.0143%2027.9795%2014.2024%2026.0475%2012.7837C25.5938%2012.4521%2025.1401%2012.1438%2024.6707%2011.8507C22.6994%209.95412%2024.9289%208.39653%2025.4451%208.21163C25.9848%208.01885%2025.6329%207.35566%2023.8884%207.36353C22.144%207.37114%2020.5483%207.94946%2018.5146%208.72047C18.2173%208.83615%2017.9043%208.92086%2017.5836%208.99025C15.7376%208.64338%2013.8211%208.56612%2011.8186%208.78986C8.04819%209.20613%205.03671%2010.9718%202.823%2013.9865C0.16347%2017.6103%20-0.462297%2021.7274%200.304303%2026.0221C1.11002%2030.5478%203.44099%2034.295%207.02367%2037.225C10.7393%2040.2626%2015.0181%2041.7507%2019.8992%2041.4655C22.8639%2041.2959%2026.1649%2040.9027%2029.8884%2037.7801C30.827%2038.2427%2031.8126%2038.4276%2033.4475%2038.5664C34.7069%2038.6821%2035.9194%2038.5048%2036.858%2038.3121C38.3286%2038.0037%2038.227%2036.6544%2037.6951%2036.4077C33.385%2034.4185%2034.3314%2035.228%2033.471%2034.5726C35.6613%2032.0052%2038.9624%2029.3374%2040.253%2020.6942C40.3546%2020.0081%2040.2686%2019.5763%2040.253%2019.0211C40.2451%2018.682%2040.3234%2018.551%2040.7145%2018.5123C41.794%2018.3889%2042.8422%2018.096%2043.8043%2017.5717C46.5969%2016.0606%2047.7233%2013.5779%2047.9892%2010.6017C48.0284%2010.1468%2047.9814%209.67638%2047.4964%209.43757ZM23.1611%2036.2225C18.984%2032.969%2016.9581%2031.8971%2016.1211%2031.9434C15.3388%2031.9897%2015.4797%2032.8764%2015.6517%2033.4547C15.8316%2034.0252%2016.0663%2034.4185%2016.3948%2034.9196C16.6216%2035.2511%2016.7782%2035.7445%2016.168%2036.1147C14.8226%2036.9397%2012.4836%2035.8371%2012.3741%2035.7832C9.65202%2034.1948%207.37571%2032.0975%205.77205%2029.2295C4.22322%2026.4691%203.32373%2023.5086%203.17504%2020.3474C3.13592%2019.5841%203.36276%2019.3141%204.12936%2019.1755C5.13843%2018.9904%206.17884%2018.9517%207.1879%2019.0982C11.4512%2019.7151%2015.0807%2021.6041%2018.1235%2024.5956C19.86%2026.2995%2021.1742%2028.3352%2022.5275%2030.3243C23.9668%2032.4368%2025.5156%2034.4493%2027.4868%2036.0992C28.183%2036.6775%2028.7384%2037.1169%2029.2703%2037.4408C27.6668%2037.6181%2024.9915%2037.6568%2023.1611%2036.2225ZM25.1636%2023.4623C25.1636%2023.123%2025.4374%2022.8532%2025.7817%2022.8532C25.8599%2022.8532%2025.9303%2022.8685%2025.9929%2022.8916C26.079%2022.9225%2026.1572%2022.9688%2026.2198%2023.038C26.3293%2023.1461%2026.3919%2023.3002%2026.3919%2023.4622C26.3919%2023.8014%2026.1181%2024.0712%2025.774%2024.0712C25.4299%2024.0712%2025.1636%2023.8015%2025.1636%2023.4623ZM31.3824%2026.6235C30.9835%2026.7854%2030.5846%2026.9241%2030.2013%2026.9395C29.6068%2026.9703%2028.9575%2026.7313%2028.6056%2026.4383C28.058%2025.9834%2027.6669%2025.7291%2027.5026%2024.9349C27.4322%2024.5956%2027.4713%2024.0713%2027.534%2023.7707C27.6747%2023.123%2027.5183%2022.7067%2027.0568%2022.3288C26.6813%2022.0204%2026.2041%2021.9357%2025.68%2021.9357C25.4844%2021.9357%2025.3046%2021.8508%2025.1716%2021.7814C24.9525%2021.6735%2024.7727%2021.4036%2024.9447%2021.0721C24.9995%2020.9643%2025.2655%2020.702%2025.3281%2020.6558C26.04%2020.2548%2026.8613%2020.3859%2027.6201%2020.6866C28.3242%2020.9719%2028.8561%2021.4962%2029.6226%2022.2363C30.4048%2023.1306%2030.5456%2023.3776%2030.9915%2024.0482C31.3436%2024.5725%2031.6643%2025.1122%2031.8833%2025.7291C32.0162%2026.1146%2031.844%2026.4307%2031.3824%2026.6235Z'%20fill='%234D6BFE'/%3e%3c/svg%3e",F2="data:image/svg+xml,%3csvg%20version='1.2'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201513%20975'%20width='1513'%20height='975'%3e%3ctitle%3eae99cd49-2667-464e-b9db-b39cee0126e1-svg%3c/title%3e%3cstyle%3e%20.s0%20{%20fill:%20%23ff5a00%20}%20%3c/style%3e%3cg%20id='%23ff5a00ff'%3e%3cpath%20id='Layer'%20class='s0'%20d='m989.5%200h67.8c95.3%205.4%20196.5%2023.1%20272.4%2085.5%2060.6%2049.1%2086.3%20133%2071.4%20208.6-11.4%2056.4-37.4%20108.4-65.4%20158.1-56.8%2098.4-126.6%20188.2-193%20280.1-11.9%2015.2-21.2%2033.8-20%2053.6%201.1%2015.7%2013.1%2028.4%2027.2%2034%2027.3%2011.1%2057.5%208.9%2086.2%207.3%2090.7-9.5%20178.1-37%20264.6-64.6%206.6-4.1%208.8%202.6%2011.3%207.4-91.9%2061.3-190.8%20112.4-294.8%20150-57.5%2019.3-118.3%2037.6-179.6%2030.4-32.2-3.2-64.5-22.4-74.6-54.5-12.5-41.8-7.9-88.1%2010.2-127.6%2027.5-61.7%2070.2-114.7%20110.7-168.2%2067.1-88%20136.4-175.5%20189.1-273.3%2017.4-34.7%2036-76.8%2018.7-115.1-16.3-35.3-51.7-56.1-85.6-71.8-60.2-26.9-124.4-43.1-187.7-61.1q-14.3%209.4-28.5%2019c22%2016.8%2044%2033.6%2065.8%2050.7-83.3%2015-166.3%2031.8-248.3%2052.7-124.9%2031-246.8%2072.5-367.6%20116.5%2011.8%2023.5%2023.5%2047.1%2034.7%2070.9-27.3%2030.2-54.4%2060.7-81.7%2090.9%2065.6%2019.6%20136.3%2022.3%20203.2%207.5%2057.2-12.8%20111-40.2%20154.7-79.3-11.9-14.8-26.9-26.7-43.1-36.5%2053.1%201.1%20101.4%2047.4%20101.5%20101.1q-15.6%200.1-31%200.2c-2.2-11.7-5.3-23-9.4-34.1-60.3%2054.5-138.2%2088.6-218.9%2097.4-71.1%208.2-143.8-1.6-210.7-26.6%204.5%2041.4%209%2082.6%2013.2%20124-38%2014.8-73.3%2036.2-104.9%2062-25.1%2021.9-50%2047.1-59.6%2079.9-9.2%2028.9%205.8%2061.7%2031.1%2077.2%2030.7%2019%2066.5%2027.8%20101.9%2032.9%2046.7%206.1%2093.9%205.6%20140.8%202.3%2092.1-6.8%20183.1-24.1%20272.7-45.8%208.9-3.6%2013.1%2011.1%204%2013.4-71.5%2036.8-146.3%2067.8-224.3%2087.8-73.3%2018.9-148.8%2028.6-224.4%2031.2-77.1-2.4-159-17.3-220.1-67.8-45.4-36.8-69.3-95.2-69.5-153.1v-3.1c1.5-61.2%2022.2-120.4%2052-173.4%2039.2-74.8%2087.5-145%20144.6-207.3%2098.7-108.7%20222.5-192.8%20355.6-253.7%20137.9-62.5%20285.5-107.4%20437.3-115.7z'/%3e%3c/g%3e%3c/svg%3e",H2="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBmaWxsPSJub25lIj4KICA8cmVjdCB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIGZpbGw9IiNGRjZCNkIiLz4KICA8dGV4dCB4PSI1MCUiIHk9IjUwJSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZmlsbD0id2hpdGUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZm9udC13ZWlnaHQ9ImJvbGQiPk1NPC90ZXh0Pgo8L3N2Zz4=",z2="/agents/assets/img/moonshotai.svg",W2="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='48'%20viewBox='0%200%2048%2048'%20fill='none'%3e%3crect%20width='48'%20height='48'%20fill='black'/%3e%3cpath%20d='M10.008%2019.311L24.0672%2040H30.3165L16.2557%2019.311H10.008ZM16.2509%2030.8017L10%2040H16.2541L19.3771%2035.4017L16.2509%2030.8017ZM31.7459%208L20.941%2023.8993L24.0672%2028.5009L38%208H31.7459ZM32.8777%2017.8382V40H38V10.3008L32.8777%2017.8382Z'%20fill='white'/%3e%3c/svg%3e",J2="/agents/assets/img/zai.svg",K2="/agents/assets/img/zai.svg",Z2="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBmaWxsPSJub25lIj4KICA8cmVjdCB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIGZpbGw9IiNBOEU2QTMiLz4KICA8dGV4dCB4PSI1MCUiIHk9IjUwJSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZmlsbD0iIzJDM0U1MCIgZm9udC1mYW1pbHk9IkFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE0IiBmb250LXdlaWdodD0iYm9sZCI+RVhBPC90ZXh0Pgo8L3N2Zz4=",ft="data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eOpenRouter%3c/title%3e%3cpath%20d='M16.804%201.957l7.22%204.105v.087L16.73%2010.21l.017-2.117-.821-.03c-1.059-.028-1.611.002-2.268.11-1.064.175-2.038.577-3.147%201.352L8.345%2011.03c-.284.195-.495.336-.68.455l-.515.322-.397.234.385.23.53.338c.476.314%201.17.796%202.701%201.866%201.11.775%202.083%201.177%203.147%201.352l.3.045c.694.091%201.375.094%202.825.033l.022-2.159%207.22%204.105v.087L16.589%2022l.014-1.862-.635.022c-1.386.042-2.137.002-3.138-.162-1.694-.28-3.26-.926-4.881-2.059l-2.158-1.5a21.997%2021.997%200%2000-.755-.498l-.467-.28a55.927%2055.927%200%2000-.76-.43C2.908%2014.73.563%2014.116%200%2014.116V9.888l.14.004c.564-.007%202.91-.622%203.809-1.124l1.016-.58.438-.274c.428-.28%201.072-.726%202.686-1.853%201.621-1.133%203.186-1.78%204.881-2.059%201.152-.19%201.974-.213%203.814-.138l.02-1.907z'%3e%3c/path%3e%3c/svg%3e";function G2(p){const t=Qe();return t==="/"?p.replace("/agents/","/"):p.replace("/agents/",`${t}/`)}const X2={anthropic:q2,openai:lt,"openai-sdk":lt,google:U2,meta:Et,"meta-llama":Et,nvidia:B2,alibaba:R2,deepseek:N2,qwen:F2,minimax:H2,moonshotai:z2,"x-ai":W2,"z-ai":J2,zai:K2,exaone:Z2,openrouter:ft},Y2=new Proxy(X2,{get(p,t){const n=p[t];return n?G2(n):void 0}});function Q2(p){if(p&&p.includes("/"))return p.split("/")[0].toLowerCase()}function st(p){return Y2[p.toLowerCase()]}function kt(p,t){const n=Q2(p);if(n){const e=st(n);if(e)return e}if(t)return st(t)}const $2=ae({__name:"PromptModelSelect",props:{modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=m([]),r=m(!1),d=z(()=>i.value.map(f=>({value:f.id,label:f.name,description:f.model||f.provider,icon:kt(f.model||f.name,f.provider_id||f.provider)}))),u=async()=>{r.value=!0;try{const f=await fetch(te("/api/models"));if(f.ok){const v=await f.json();i.value=v.models||[]}}catch(f){console.error("Error fetching models:",f)}finally{r.value=!1}};xe(()=>{u()});const h={props:e,emit:c,models:i,loadingModels:r,modelOptions:d,fetchModels:u,SelectInput:Ae};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}}),ep={class:"space-y-4"};function tp(p,t,n,e,c,i){return a(),s("div",ep,[C(e.SelectInput,{"model-value":n.modelValue,"onUpdate:modelValue":t[0]||(t[0]=r=>e.emit("update:modelValue",r)),options:e.modelOptions,label:"Model",placeholder:"Select a model for this prompt","search-placeholder":"Search models...",loading:e.loadingModels},null,8,["model-value","options","loading"])])}const op=ne($2,[["render",tp],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/prompt-form/PromptModelSelect.vue"]]),rp=ae({__name:"PropertyEditor",props:Ue({propertyId:{type:String,required:!0},isNested:{type:Boolean,required:!1,default:!1},parentId:{type:String,required:!1},disabled:{type:Boolean,required:!1,default:!1},enableDrag:{type:Boolean,required:!1,default:!0}},{modelValue:{type:Object,required:!0},modelModifiers:{}}),emits:Ue(["remove","description-keydown","add-top-level"],["update:modelValue"]),setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=We(p,"modelValue"),r=m(!1),d=m(),u={string:'<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/></svg>',number:'<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 20l4-16m2 16l4-16M6 9h14M4 15h14"/></svg>',boolean:'<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>',object:'<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"/></svg>',array:'<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 10h16M4 14h16M4 18h16"/></svg>',enum:'<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"/></svg>',anyOf:'<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>'},h=[{value:"string",label:"String",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z'/%3E%3C/svg%3E"},{value:"number",label:"Number",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 20l4-16m2 16l4-16M6 9h14M4 15h14'/%3E%3C/svg%3E"},{value:"boolean",label:"Boolean",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E"},{value:"object",label:"Object",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10'/%3E%3C/svg%3E"},{value:"array",label:"Array",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6h16M4 10h16M4 14h16M4 18h16'/%3E%3C/svg%3E"},{value:"enum",label:"Enum",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4'/%3E%3C/svg%3E"},{value:"anyOf",label:"Any Of (Multiple Types)",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E"}],f=z(()=>["object","array","enum","anyOf"].includes(i.value.type));ce(()=>i.value.type,async(M,L)=>{if(["object","array","enum","anyOf"].includes(M)&&(r.value=!0,M==="anyOf"&&!i.value.anyOf&&(i.value.anyOf=[]),M==="object"&&!i.value.properties&&(i.value.properties=[{id:crypto.randomUUID(),name:"property1",type:"string",description:""}]),M==="array"&&!i.value.items&&(i.value.items={id:crypto.randomUUID(),name:"",type:"string",description:""}),M==="enum"&&!i.value.enum&&(i.value.enum=["value1"])),L!==void 0){await be();const O=e.isNested?`[data-nested-property-id="${e.propertyId}"] input[placeholder="Description"]`:`[data-property-id="${e.propertyId}"] input[placeholder="Description"]`,B=document.querySelector(O);B&&B.focus()}});const v=M=>{M.shiftKey&&i.value.type==="object"&&i.value.properties?_():c("add-top-level")},g=()=>{i.value.items||(i.value.items={id:crypto.randomUUID(),name:"",type:"string",description:""})},x=()=>{i.value.enum||(i.value.enum=[]),i.value.enum.push(`value${i.value.enum.length+1}`)},y=M=>{i.value.enum&&i.value.enum.splice(M,1)},_=async()=>{const M={id:crypto.randomUUID(),name:i.value.type==="anyOf"?"":`property${(i.value.properties?.length||i.value.anyOf?.length||0)+1}`,type:"string",description:""};i.value.type==="anyOf"?(i.value.anyOf||(i.value.anyOf=[]),i.value.anyOf.push(M)):(i.value.properties||(i.value.properties=[]),i.value.properties.push(M)),await be();const L=document.querySelector(`[data-nested-property-id="${M.id}"] input[placeholder="Property name"]`);L&&(L.focus(),L.select())},S={props:e,emit:c,modelValue:i,expanded:r,propertyListRef:d,typeIcons:u,typeOptions:h,isExpandable:f,handleEnterKey:v,initArrayItems:g,addEnumValue:x,removeEnumValue:y,addNestedProperty:_,removeNestedProperty:M=>{i.value.type==="anyOf"&&i.value.anyOf?i.value.anyOf=i.value.anyOf.filter(L=>L.id!==M):i.value.properties&&(i.value.properties=i.value.properties.filter(L=>L.id!==M))},handleNestedDescriptionKeydown:M=>{},SelectInput:Ae,TextInput:Ke};return Object.defineProperty(S,"__isScriptSetup",{enumerable:!1,value:!0}),S}}),np=["data-property-id","data-nested-property-id"],ap={class:"p-3 space-y-3"},lp={class:"flex items-start gap-2"},sp={key:0,class:"drag-handle cursor-move text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400 mt-2"},ip={class:"flex-1 grid grid-cols-1 md:grid-cols-3 gap-2"},dp={class:"flex items-center gap-2 mt-2"},cp=["disabled"],up={key:0,class:"ml-6"},pp={key:0,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg space-y-2"},mp={class:"flex items-center justify-between mb-2"},gp=["disabled"],fp={key:0,class:"space-y-1"},hp=["onClick","disabled"],vp={key:1,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},bp={class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"},yp={class:"space-y-2"},xp={class:"flex items-center justify-between"},kp=["disabled"],_p={class:"space-y-2"},wp={key:2,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},Cp={key:0,class:"mb-2"},Sp=["disabled"],Tp={key:1,class:"space-y-2"};function Mp(p,t,n,e,c,i){const r=_o("PropertyEditor",!0);return a(),s("div",{"data-property-id":n.isNested?void 0:n.propertyId,"data-nested-property-id":n.isNested?n.propertyId:void 0,class:$(["border rounded-lg",n.isNested?"border-neutral-100 dark:border-neutral-900":"border-neutral-200 dark:border-neutral-800"])},[o("div",ap,[o("div",lp,[l(" Drag handle "),n.enableDrag?(a(),s("div",sp,[...t[10]||(t[10]=[o("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})],-1)])])):l("v-if",!0),l(" Property fields "),o("div",ip,[C(e.TextInput,{modelValue:e.modelValue.name,"onUpdate:modelValue":t[0]||(t[0]=d=>e.modelValue.name=d),placeholder:"Property name",disabled:n.disabled},null,8,["modelValue","disabled"]),C(e.SelectInput,{modelValue:e.modelValue.type,"onUpdate:modelValue":t[1]||(t[1]=d=>e.modelValue.type=d),options:e.typeOptions,disabled:n.disabled},null,8,["modelValue","disabled"]),C(e.TextInput,{modelValue:e.modelValue.description,"onUpdate:modelValue":t[2]||(t[2]=d=>e.modelValue.description=d),placeholder:"Description",disabled:n.disabled,onKeydown:t[3]||(t[3]=mt(Ce(d=>e.handleEnterKey(d),["prevent"]),["enter"]))},null,8,["modelValue","disabled"])]),l(" Controls "),o("div",dp,[e.isExpandable?(a(),s("button",{key:0,onClick:t[4]||(t[4]=d=>e.expanded=!e.expanded),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded transition-colors"},[(a(),s("svg",{class:$(["w-4 h-4 transition-transform",e.expanded?"rotate-90":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...t[11]||(t[11]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))])):l("v-if",!0),o("button",{onClick:t[5]||(t[5]=d=>p.$emit("remove")),type:"button",disabled:n.disabled,class:"p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors disabled:opacity-50"},[...t[12]||(t[12]=[o("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,cp)])]),l(" Expandable content "),e.expanded&&e.isExpandable?(a(),s("div",up,[l(" Enum values "),e.modelValue.type==="enum"?(a(),s("div",pp,[o("div",mp,[t[13]||(t[13]=o("h4",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400"}," Enum Values ",-1)),o("button",{onClick:e.addEnumValue,type:"button",disabled:n.disabled,class:"px-2 py-0.5 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"}," Add Value ",8,gp)]),e.modelValue.enum?(a(),s("div",fp,[(a(!0),s(X,null,ve(e.modelValue.enum,(d,u)=>(a(),s("div",{key:u,class:"flex items-center gap-2"},[C(e.TextInput,{modelValue:e.modelValue.enum[u],"onUpdate:modelValue":h=>e.modelValue.enum[u]=h,placeholder:"Enum value",disabled:n.disabled,class:"flex-1"},null,8,["modelValue","onUpdate:modelValue","disabled"]),o("button",{onClick:h=>e.removeEnumValue(u),type:"button",disabled:n.disabled,class:"p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors disabled:opacity-50"},[...t[14]||(t[14]=[o("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,hp)]))),128))])):l("v-if",!0)])):l("v-if",!0),l(" Object properties / anyOf types "),e.modelValue.type==="object"||e.modelValue.type==="anyOf"?(a(),s("div",vp,[o("h4",bp,k(e.modelValue.type==="anyOf"?"Type Options":"Nested Properties"),1),o("div",yp,[l(" Add nested properties buttons "),o("div",xp,[o("button",{onClick:e.addNestedProperty,type:"button",disabled:n.disabled,class:"px-2 py-0.5 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"}," Add "+k(e.modelValue.type==="anyOf"?"Type Option":"Property"),9,kp)]),l(" Render nested properties "),o("div",_p,[(a(!0),s(X,null,ve(e.modelValue.type==="anyOf"?e.modelValue.anyOf:e.modelValue.properties,(d,u)=>(a(),ee(r,{key:d.id,modelValue:(e.modelValue.type==="anyOf"?e.modelValue.anyOf:e.modelValue.properties)[u],"onUpdate:modelValue":h=>(e.modelValue.type==="anyOf"?e.modelValue.anyOf:e.modelValue.properties)[u]=h,"property-id":d.id,"is-nested":!0,"parent-id":n.propertyId,disabled:n.disabled,"enable-drag":!1,onRemove:h=>e.removeNestedProperty(d.id),onAddTopLevel:t[6]||(t[6]=h=>e.emit("add-top-level"))},null,8,["modelValue","onUpdate:modelValue","property-id","parent-id","disabled","onRemove"]))),128))])])])):l("v-if",!0),l(" Array items "),e.modelValue.type==="array"?(a(),s("div",wp,[t[15]||(t[15]=o("h4",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"}," Array Item Type ",-1)),e.modelValue.items?l("v-if",!0):(a(),s("div",Cp,[o("button",{onClick:e.initArrayItems,type:"button",disabled:n.disabled,class:"px-2 py-0.5 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"}," Define Item Type ",8,Sp)])),e.modelValue.items?(a(),s("div",Tp,[C(r,{modelValue:e.modelValue.items,"onUpdate:modelValue":t[7]||(t[7]=d=>e.modelValue.items=d),"property-id":e.modelValue.items.id,"is-nested":!0,"parent-id":n.propertyId,disabled:n.disabled,"enable-drag":!1,onRemove:t[8]||(t[8]=d=>e.modelValue.items=null),onAddTopLevel:t[9]||(t[9]=d=>e.emit("add-top-level"))},null,8,["modelValue","property-id","parent-id","disabled"])])):l("v-if",!0)])):l("v-if",!0)])):l("v-if",!0)])],10,np)}const Ip=ne(rp,[["render",Mp],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/PropertyEditor.vue"]]),Vp=ae({__name:"PropertyList",props:Ue({disabled:{type:Boolean,required:!1,default:!1},parentId:{type:String,required:!1},isNested:{type:Boolean,required:!1,default:!1}},{modelValue:{type:Array,required:!0,default:()=>[]},modelModifiers:{}}),emits:Ue(["add-property","description-keydown"],["update:modelValue"]),setup(p,{expose:t,emit:n}){const e=p,c=n,i=We(p,"modelValue"),r=m();let d=!1;xe(async()=>{}),Be(()=>{});const u=async()=>{if(d)return;d=!0;const g={id:crypto.randomUUID(),name:`property${i.value.length+1}`,type:"string",description:"",required:!1};i.value=[...i.value,g],await be();const x=e.parentId?`[data-nested-property-id="${g.id}"]`:`[data-property-id="${g.id}"]`,y=document.querySelector(`${x} input[placeholder="Property name"]`);y&&(y.focus(),y.select()),c("add-property"),d=!1},h=g=>{i.value=i.value.filter(x=>x.id!==g)},f=g=>{};t({addProperty:u});const v={props:e,emit:c,modelValue:i,dragAreaRef:r,get isAddingProperty(){return d},set isAddingProperty(g){d=g},addProperty:u,removeProperty:h,handleDescriptionKeydown:f,PropertyEditor:Ip};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),Lp={class:"space-y-2"},Pp={ref:"dragAreaRef",class:"space-y-2"},Ap=["disabled"];function Ep(p,t,n,e,c,i){return a(),s("div",Lp,[o("div",Pp,[(a(!0),s(X,null,ve(e.modelValue,r=>(a(),ee(e.PropertyEditor,{key:r.id,modelValue:e.modelValue[e.modelValue.indexOf(r)],"onUpdate:modelValue":d=>e.modelValue[e.modelValue.indexOf(r)]=d,"property-id":r.id,"is-nested":n.isNested,"parent-id":n.parentId,disabled:n.disabled,"enable-drag":!n.isNested,onRemove:d=>e.removeProperty(r.id),onAddTopLevel:t[0]||(t[0]=d=>p.$emit("add-property"))},null,8,["modelValue","onUpdate:modelValue","property-id","is-nested","parent-id","disabled","enable-drag","onRemove"]))),128))],512),l(" Add Property button at the bottom for both nested and non-nested "),o("div",{class:$(n.isNested?"mt-2":"mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-800")},[o("button",{onClick:e.addProperty,type:"button",disabled:n.disabled,class:$(n.isNested?"px-2 py-1 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50":"w-full px-3 py-2 text-sm bg-neutral-50 dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800 text-neutral-700 dark:text-neutral-300 rounded transition-colors disabled:opacity-50 border border-dashed border-neutral-300 dark:border-neutral-700")},[...t[1]||(t[1]=[o("span",{class:"flex items-center justify-center gap-2"},[o("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),ke(" Add Property ")],-1)])],10,Ap)],2)])}const Op=ne(Vp,[["render",Ep],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/PropertyList.vue"]]),jp=ae({__name:"JSONSchemaInput",props:Ue({label:{type:String,required:!1},disabled:{type:Boolean,required:!1,default:!1},required:{type:Boolean,required:!1,default:!1}},{modelValue:{type:null,required:!0,default:()=>({type:"object",properties:{},required:[]})},modelModifiers:{}}),emits:["update:modelValue"],setup(p,{expose:t}){t();const n=p,e=We(p,"modelValue"),c=m([]),i=m(),r=m(!1),d=()=>{if(e.value?.properties){const b=[];e.value.required;for(const[S,M]of Object.entries(e.value.properties)){const L=M,O={id:crypto.randomUUID(),name:S,type:L.type||"string",description:L.description||""};L.enum&&(O.enum=L.enum),L.anyOf&&(O.type="anyOf",O.anyOf=u(L.anyOf)),L.type==="array"&&L.items&&(O.items=h(L.items)),L.type==="object"&&L.properties&&(O.properties=f(L.properties,L.required||[])),b.push(O)}c.value=b}},u=b=>b.map(S=>typeof S=="object"&&S.type?{id:crypto.randomUUID(),name:"",type:S.type,description:S.description||"",properties:S.properties?f(S.properties,S.required||[]):void 0,items:S.items?h(S.items):void 0,enum:S.enum}:{id:crypto.randomUUID(),name:"",type:"string",description:""}),h=b=>{const S={id:crypto.randomUUID(),name:"",type:b.type||"string",description:b.description||""};return b.enum&&(S.enum=b.enum),b.anyOf&&(S.type="anyOf",S.anyOf=u(b.anyOf)),b.type==="array"&&b.items&&(S.items=h(b.items)),b.type==="object"&&b.properties&&(S.properties=f(b.properties,b.required||[])),S},f=(b,S)=>{const M=[];for(const[L,O]of Object.entries(b)){const B=O,H={id:crypto.randomUUID(),name:L,type:B.type||"string",description:B.description||""};B.enum&&(H.enum=B.enum),B.anyOf&&(H.type="anyOf",H.anyOf=u(B.anyOf)),B.type==="array"&&B.items&&(H.items=h(B.items)),B.type==="object"&&B.properties&&(H.properties=f(B.properties,B.required||[])),M.push(H)}return M};d();const v=()=>{const b={type:"object",properties:{},required:[],additionalProperties:!1},{properties:S,required:M}=x(c.value);b.properties=S,b.required=Object.keys(S),e.value=b},g=b=>{const S={type:b.type==="anyOf"?void 0:b.type,description:b.description};if(b.type==="enum"&&b.enum&&(S.enum=b.enum,S.type="string"),b.type==="anyOf"&&b.anyOf&&(delete S.type,S.anyOf=b.anyOf.map(g)),b.type==="object"&&b.properties){const{properties:M,required:L}=x(b.properties);S.properties=M,S.required=Object.keys(M),S.additionalProperties=!1}return b.type==="array"&&b.items&&(S.items=g(b.items)),S},x=b=>{const S={},M=[];for(const L of b){const O={type:L.type==="anyOf"?void 0:L.type,description:L.description};if(M.push(L.name),L.type==="enum"&&L.enum&&(O.enum=L.enum,O.type="string"),L.type==="anyOf"&&L.anyOf&&L.anyOf.length>0&&(delete O.type,O.anyOf=L.anyOf.map(g)),L.type==="array"&&L.items&&(O.items=g(L.items)),L.type==="object"&&L.properties){const{properties:B,required:H}=x(L.properties);O.properties=B,O.required=Object.keys(B),O.additionalProperties=!1}S[L.name]=O}return{properties:S,required:M}};ce(c,()=>{v()},{deep:!0}),v();const y=z(()=>JSON.stringify(e.value,null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"]+)":/g,'<span class="text-blue-600 dark:text-blue-400">"$1"</span>:').replace(/:"([^"]*)"/g,':<span class="text-green-600 dark:text-green-400">"$1"</span>').replace(/:(\d+)/g,':<span class="text-yellow-600 dark:text-yellow-400">$1</span>').replace(/:(true|false)/g,':<span class="text-purple-600 dark:text-purple-400">$1</span>').replace(/:(null)/g,':<span class="text-red-600 dark:text-red-400">$1</span>')),T={props:n,modelValue:e,properties:c,propertyListRef:i,showSchema:r,initializeProperties:d,convertAnyOfToProperties:u,convertSchemaToProperty:h,convertSchemaToProperties:f,updateSchema:v,convertPropertyToSchema:g,convertPropertiesToSchema:x,highlightedSchema:y,addProperty:async()=>{if(c.value.length===0){const b={id:crypto.randomUUID(),name:"property1",type:"string",description:""};c.value.push(b),await be();const S=document.querySelector(`[data-property-id="${b.id}"] input[placeholder="Property name"]`);S&&(S.focus(),S.select())}else i.value&&i.value.addProperty()},PropertyList:Op};return Object.defineProperty(T,"__isScriptSetup",{enumerable:!1,value:!0}),T}}),Dp={class:"space-y-4"},qp={key:0,class:"flex items-center justify-between"},Up={class:"text-sm font-medium"},Bp={key:0,class:"text-red-500"},Rp={class:"space-y-2 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4"},Np={key:0,class:"flex items-center justify-between mb-2"},Fp={key:1,class:"text-center py-12"},Hp=["disabled"],zp={class:"mt-4 text-center"},Wp={key:3,class:"mt-4"},Jp={class:"bg-neutral-50 dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4 overflow-x-auto"},Kp={class:"text-xs leading-relaxed"},Zp=["innerHTML"];function Gp(p,t,n,e,c,i){return a(),s("div",Dp,[n.label?(a(),s("div",qp,[o("label",Up,[ke(k(n.label)+" ",1),n.required?(a(),s("span",Bp,"*")):l("v-if",!0)])])):l("v-if",!0),o("div",Rp,[e.properties.length>0?(a(),s("div",Np,[...t[2]||(t[2]=[o("h3",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"}," Properties ",-1)])])):l("v-if",!0),e.properties.length===0?(a(),s("div",Fp,[t[4]||(t[4]=o("div",{class:"mb-4"},[o("svg",{class:"w-12 h-12 mx-auto text-neutral-400 dark:text-neutral-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})])],-1)),t[5]||(t[5]=o("p",{class:"text-neutral-500 dark:text-neutral-400 text-sm mb-4"}," No properties defined ",-1)),o("button",{onClick:e.addProperty,type:"button",disabled:n.disabled,class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black rounded hover:bg-neutral-800 dark:hover:bg-neutral-200 transition-colors disabled:opacity-50 font-medium text-sm"},[...t[3]||(t[3]=[o("span",{class:"flex items-center gap-2"},[o("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),ke(" Add Property ")],-1)])],8,Hp)])):l("v-if",!0),e.properties.length>0?(a(),ee(e.PropertyList,{key:2,ref:"propertyListRef",modelValue:e.properties,"onUpdate:modelValue":t[0]||(t[0]=r=>e.properties=r),disabled:n.disabled,onAddProperty:e.addProperty},null,8,["modelValue","disabled"])):l("v-if",!0),l(" Show JSON Schema link "),o("div",zp,[o("button",{onClick:t[1]||(t[1]=r=>e.showSchema=!e.showSchema),type:"button",class:"text-xs text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 hover:underline transition-colors"},k(e.showSchema?"Hide":"Show")+" JSON Schema ",1)]),l(" JSON Schema Display "),e.showSchema?(a(),s("div",Wp,[o("div",Jp,[o("pre",Kp,[o("code",{class:"font-mono",innerHTML:e.highlightedSchema},null,8,Zp)])])])):l("v-if",!0)])])}const $t=ne(jp,[["render",Gp],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/JSONSchemaInput.vue"]]),Xp=ae({__name:"PromptInput",props:{modelValue:{type:Array,required:!1},search:{type:Function,required:!1},placeholder:{type:String,required:!1,default:"Type @ to insert variables or prompts..."},disabled:{type:Boolean,required:!1,default:!1},maxLength:{type:Number,required:!1},allowedTypes:{type:Array,required:!1,default:()=>["variable","prompt"]}},emits:["update:modelValue","segment-click"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=m(),r=m(),d=wo({segments:e.modelValue&&e.modelValue.length?e.modelValue:[{type:"string",value:""}],dialogOpen:!1,dialogPosition:{x:0,y:0},searchQuery:"",searchResults:[],selectedIndex:0,isSearching:!1,atTriggerIndex:-1,isComposing:!1,ignoreNextWatch:!1}),u=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),h=w=>w.type==="string"?"":`@${w.type==="variable"?w.label||w.value:w.label||w.id}`,f=()=>{const w=window.getSelection();if(!w||!w.rangeCount||!i.value)return null;const I=w.getRangeAt(0);let A=0;const V=Array.from(i.value.childNodes);for(let P=0;P<V.length;P++){const U=V[P];if(U===I.startContainer||U.contains?.(I.startContainer)){if(U.nodeType===Node.TEXT_NODE)return{segmentIndex:A,offset:I.startOffset};if(U.nodeType===Node.ELEMENT_NODE&&U.classList?.contains("prompt-tag"))return{segmentIndex:A,offset:0}}(U.nodeType===Node.TEXT_NODE||U.nodeType===Node.ELEMENT_NODE&&U.classList?.contains("prompt-tag"))&&A++}return{segmentIndex:0,offset:0}},v=w=>{if(!i.value)return;const I=window.getSelection();if(!I)return;const A=Array.from(i.value.childNodes);let V=0,P=null,U=0;for(const D of A){if(V===w.segmentIndex){if(D.nodeType===Node.TEXT_NODE)P=D,U=Math.min(w.offset,D.textContent?.length||0);else if(D.nodeType===Node.ELEMENT_NODE&&D.classList?.contains("prompt-tag")){const W=D.nextSibling;if(W&&W.nodeType===Node.TEXT_NODE)P=W,U=0;else{const G=document.createTextNode("");D.parentNode?.insertBefore(G,D.nextSibling),P=G,U=0}}break}(D.nodeType===Node.TEXT_NODE||D.nodeType===Node.ELEMENT_NODE&&D.classList?.contains("prompt-tag"))&&V++}if(!P&&A.length){const D=A[A.length-1];if(D.nodeType===Node.TEXT_NODE)P=D,U=D.textContent?.length||0;else if(D.nodeType===Node.ELEMENT_NODE&&D.classList?.contains("prompt-tag")){const W=document.createTextNode("");D.parentNode?.insertBefore(W,D.nextSibling),P=W,U=0}}if(P){const D=document.createRange();D.setStart(P,U),D.collapse(!0),I.removeAllRanges(),I.addRange(D)}},g=()=>{if(!i.value)return;const w=d.segments.map(I=>{if(I.type==="string")return(I.value||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>")||"";{const A=I._uid||(I._uid=u()),V=h(I),P=I.type==="variable"?{type:"variable",value:I.value,label:I.label,schema:I.schema,meta:I.meta}:{type:"prompt",id:I.id,label:I.label,schema:I.schema,meta:I.meta},U=encodeURIComponent(JSON.stringify(P)),D=I.type==="prompt"&&I.meta&&!I.meta.isValid,W=D?'<span class="prompt-tag-warning" title="'+(I.meta.validationMessage||"").replace(/"/g,""")+'">⚠️</span>':"";return`<span class="prompt-tag prompt-tag-clickable${D?" prompt-tag-invalid":""}" contenteditable="false" data-segment-uid="${A}" data-segment="${U}">${V}${W}</span>`}}).join("");i.value.innerHTML=w||"<br>"},x=()=>{const w=[];for(const I of d.segments)I.type==="string"&&w.length>0&&w[w.length-1].type==="string"?w[w.length-1].value+=I.value:w.push(I);d.segments=w.length?w:[{type:"string",value:""}]},y=w=>{const I=w.dataset.segmentUid;let A=d.segments.find(V=>V._uid===I);if(!A){const V=w.dataset.segment;if(V)try{const P=JSON.parse(decodeURIComponent(V));P&&(P.type==="variable"||P.type==="prompt")&&(A=P.type==="variable"?{type:"variable",value:P.value,label:P.label,schema:P.schema,meta:P.meta,_uid:I}:{type:"prompt",id:P.id,label:P.label,schema:P.schema,meta:P.meta,_uid:I})}catch{}}return A||null},_=w=>{const I=w.target;if(I.classList?.contains("prompt-tag")){const A=y(I);A&&c("segment-click",A,w)}},T=w=>{if(d.isComposing)return;const I=w.target,A=[];let V="";const P=()=>{V.length>0&&(A.push({type:"string",value:V}),V="")},U=se=>{if(se.nodeType===Node.TEXT_NODE){const he=(se.textContent||"").replace(/\u00A0/g," ");V+=he;return}if(se.nodeType===Node.ELEMENT_NODE){const he=se;if(he.classList?.contains("prompt-tag")){P();const j=y(he);j&&A.push(j);return}if(he.tagName==="BR"){V+=`
|
|
9
|
+
`;return}const me=Array.from(he.childNodes);for(const j of me)U(j);(he.tagName==="DIV"||he.tagName==="P"||he.tagName==="LI")&&he.nextSibling&&(V+=`
|
|
10
|
+
`);return}},D=Array.from(I.childNodes);for(const se of D)U(se);P();const G=A.some(se=>se.type!=="string")?A:[{type:"string",value:(I.innerText||"").replace(/\r\n/g,`
|
|
11
|
+
`)}];d.segments=G.length?G:[{type:"string",value:""}],x(),b(),R()},b=()=>{const w=window.getSelection();if(!w||!w.rangeCount||!i.value)return;const I=w.getRangeAt(0);if(I.startContainer.nodeType!==Node.TEXT_NODE){d.dialogOpen&&M();return}const V=I.startContainer.textContent||"",P=I.startOffset;if(P>0&&V[P-1]==="@")d.atTriggerIndex=P-1,d.searchQuery="",S(),B("");else if(d.dialogOpen&&d.atTriggerIndex>=0)if(I.startContainer.nodeType===Node.TEXT_NODE){const U=I.startContainer.textContent||"",D=I.startOffset;if(D<=d.atTriggerIndex){M();return}const W=U.substring(0,D);if(W.length>d.atTriggerIndex&&W[d.atTriggerIndex]==="@"){const G=W.substring(d.atTriggerIndex+1);G.includes(" ")||G.includes(`
|
|
12
|
+
`)||G.length>d.searchQuery.length+5?M():(d.searchQuery=G,B(G))}else M()}else M()},S=async()=>{d.dialogOpen=!0,d.selectedIndex=0,await be(),L()},M=()=>{d.dialogOpen=!1,d.searchResults=[],d.searchQuery="",d.atTriggerIndex=-1,d.isSearching=!1},L=()=>{if(!r.value||!i.value)return;const w=window.getSelection();if(!w||!w.rangeCount)return;const A=w.getRangeAt(0).getBoundingClientRect(),V=i.value.getBoundingClientRect();d.dialogPosition={x:A.left-V.left,y:A.bottom-V.top+4}};let O=null;const B=async w=>{if(!e.search){d.searchResults=[];return}O&&clearTimeout(O),d.isSearching=!0,O=setTimeout(async()=>{try{const I=await e.search(w);d.searchResults=(I||[]).filter(A=>e.allowedTypes?.includes(A.type))}catch(I){console.error("Search error:",I),d.searchResults=[]}finally{d.isSearching=!1}},200)},H=w=>w.type==="variable"?{type:"variable",value:w.value??w.id??"",label:w.label,schema:w.schema,_uid:u(),meta:w.meta}:{type:"prompt",id:w.id??w.value??"",label:w.label,schema:w.schema,_uid:u(),meta:w.meta},re=w=>{if(d.atTriggerIndex<0||!i.value)return;const I=window.getSelection();if(!I||!I.rangeCount)return;const A=I.getRangeAt(0);if(A.startContainer.nodeType!==Node.TEXT_NODE)return;const V=A.startContainer,P=V.data.slice(0,d.atTriggerIndex),U=V.data.slice(A.startOffset),D=document.createElement("span"),W=H(w),G=W.type==="prompt"&&W.meta&&!W.meta.isValid;D.className=`prompt-tag${G?" prompt-tag-invalid":""}`,D.setAttribute("contenteditable","false");const se=W._uid||(W._uid=u());D.dataset.segmentUid=se;const he=W.type==="variable"?{type:"variable",value:W.value,label:W.label,schema:W.schema}:{type:"prompt",id:W.id,label:W.label,schema:W.schema};if(D.dataset.segment=encodeURIComponent(JSON.stringify(he)),D.textContent=h(W),G){const pe=document.createElement("span");pe.className="prompt-tag-warning",pe.textContent="⚠️",pe.setAttribute("title",W.meta.validationMessage||"Validation error"),D.appendChild(pe)}const me=V.parentNode,j=document.createTextNode(U),F=document.createTextNode(P);me.insertBefore(F,V),me.insertBefore(D,V),me.insertBefore(j,V),me.removeChild(V),M(),T({target:i.value});const oe=window.getSelection();if(oe){const pe=document.createRange();pe.setStart(j,0),pe.collapse(!0),oe.removeAllRanges(),oe.addRange(pe)}i.value.focus()},Q=w=>{if((w.key==="ArrowLeft"||w.key==="ArrowRight")&&setTimeout(()=>b(),0),d.dialogOpen)w.key==="ArrowDown"?(w.preventDefault(),d.selectedIndex=Math.min(d.selectedIndex+1,d.searchResults.length-1)):w.key==="ArrowUp"?(w.preventDefault(),d.selectedIndex=Math.max(d.selectedIndex-1,0)):w.key==="Enter"?(w.preventDefault(),d.searchResults[d.selectedIndex]&&re(d.searchResults[d.selectedIndex])):(w.key==="Escape"||w.key==="Esc")&&(w.preventDefault(),M());else if(w.key==="Backspace"||w.key==="Delete"){const I=f();if(w.key==="Backspace"){const A=window.getSelection();if(A&&A.rangeCount){const V=A.getRangeAt(0);if(V.collapsed&&V.startContainer.nodeType===Node.TEXT_NODE&&V.startOffset===0){let P=V.startContainer;for(;P&&P!==i.value;){const U=P.previousSibling;if(U&&U.nodeType===Node.ELEMENT_NODE&&U.classList?.contains("prompt-tag")){w.preventDefault(),U.parentNode?.removeChild(U),T({target:i.value});return}P=P.parentNode}}}}if(!I)return;if(w.key==="Backspace"&&I.offset===0&&I.segmentIndex>0)d.segments[I.segmentIndex-1].type!=="string"&&(w.preventDefault(),d.segments.splice(I.segmentIndex-1,1),x(),R(),g());else if(w.key==="Delete"&&I.segmentIndex<d.segments.length-1){const A=d.segments[I.segmentIndex];A.type==="string"&&(A.value?.length??0)===I.offset&&d.segments[I.segmentIndex+1].type!=="string"&&(w.preventDefault(),d.segments.splice(I.segmentIndex+1,1),x(),R(),g())}}},q=w=>{w.preventDefault();const I=w.clipboardData?.getData("text/plain")||"";document.execCommand("insertText",!1,I)},K=w=>{if(!d.dialogOpen)return;const I=r.value;I&&(I.contains(w.target)||M())},R=()=>{d.ignoreNextWatch=!0;const w=d.segments.map(I=>{const{_uid:A,...V}=I||{};return V});c("update:modelValue",w)},Y=()=>{const w=window.getSelection();if(!w||!i.value)return;const I=w.anchorNode;I&&i.value.contains(I)&&b()},E=w=>{(w.key==="Escape"||w.key==="Esc")&&d.dialogOpen&&(w.preventDefault(),M())};xe(()=>{e.modelValue&&e.modelValue.length&&(d.segments=JSON.parse(JSON.stringify(e.modelValue))),g(),document.addEventListener("mousedown",K),document.addEventListener("selectionchange",Y),document.addEventListener("keydown",E,!0)}),Be(()=>{document.removeEventListener("mousedown",K),document.removeEventListener("selectionchange",Y),document.removeEventListener("keydown",E,!0)}),ce(()=>e.modelValue,w=>{if(d.ignoreNextWatch){d.ignoreNextWatch=!1;return}w&&(d.segments=JSON.parse(JSON.stringify(w)),g())},{deep:!0});const N={props:e,emit:c,editorRef:i,dialogRef:r,state:d,createUid:u,segmentDisplay:h,getLogicalCursorPosition:f,setLogicalCursorPosition:v,renderContent:g,mergeAdjacentTextSegments:x,readTagSegment:y,handleSegmentClick:_,handleInput:T,checkForAtTrigger:b,openDialog:S,closeDialog:M,positionDialog:L,get searchTimeout(){return O},set searchTimeout(w){O=w},performSearch:B,toSegmentFromResult:H,selectResult:re,handleKeyDown:Q,handlePaste:q,onDocumentMouseDown:K,emitUpdate:R,onSelectionChange:Y,onDocKeyDown:E,DropShadow:Ye};return Object.defineProperty(N,"__isScriptSetup",{enumerable:!1,value:!0}),N}}),Yp={class:"prompt-input-container relative"},Qp=["contenteditable","data-placeholder"],$p={class:"bg-white dark:bg-black border-2 border-black dark:border-neutral-300 rounded-lg overflow-hidden min-w-[240px] max-w-[320px]"},em={key:0,class:"p-3 text-sm text-neutral-500"},tm={key:1,class:"p-3 text-sm text-neutral-500"},om={key:2,class:"max-h-[220px] overflow-y-auto"},rm=["onClick"],nm={class:"font-medium flex items-center gap-2"},am=["title"],lm={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},sm={key:1,class:"text-xs text-red-600 dark:text-red-400 mt-1"},im={class:"text-xs mt-1"};function dm(p,t,n,e,c,i){return a(),s("div",Yp,[o("div",{ref:"editorRef",contenteditable:!n.disabled,onInput:e.handleInput,onKeydown:e.handleKeyDown,onPaste:e.handlePaste,onClick:e.handleSegmentClick,onKeyup:t[0]||(t[0]=r=>{r.key==="Escape"?(r.preventDefault(),e.closeDialog()):(r.key==="ArrowLeft"||r.key==="ArrowRight")&&e.checkForAtTrigger()}),onCompositionstart:t[1]||(t[1]=r=>e.state.isComposing=!0),onCompositionend:t[2]||(t[2]=r=>e.state.isComposing=!1),class:$(["prompt-input-editor","min-h-[100px] p-3 border-2 rounded-lg","border-black dark:border-neutral-300","bg-white dark:bg-black","focus:outline-none focus:ring-2 focus:ring-black dark:focus:ring-white",n.disabled?"opacity-50 cursor-not-allowed":""]),"data-placeholder":n.placeholder},[l(" Slot for custom segment rendering - hidden but provides slot content "),Me(o("div",null,[He(p.$slots,"segment",{segment:null},void 0,!0)],512),[[Ge,!1]])],42,Qp),l(" Mention Dialog "),e.state.dialogOpen?(a(),s("div",{key:0,ref:"dialogRef",class:"absolute z-50",style:it({left:`${e.state.dialogPosition.x}px`,top:`${e.state.dialogPosition.y}px`})},[C(e.DropShadow,{"offset-x":2,"offset-y":2,intensity:.3},{default:de(()=>[o("div",$p,[e.state.isSearching?(a(),s("div",em," Searching... ")):e.state.searchResults.length===0?(a(),s("div",tm," No results found ")):(a(),s("div",om,[(a(!0),s(X,null,ve(e.state.searchResults,(r,d)=>(a(),s("button",{key:r.id||r.value||d,type:"button",onClick:u=>e.selectResult(r),class:$(["w-full px-3 py-2 text-left text-sm","hover:bg-neutral-100 dark:hover:bg-neutral-900","focus:bg-neutral-100 dark:focus:bg-neutral-900 focus:outline-none",e.state.selectedIndex===d?"bg-neutral-100 dark:bg-neutral-900":""])},[o("div",nm,[ke(k(r.label||r.id||r.value)+" ",1),r.type==="prompt"&&r.meta&&!r.meta.isValid?(a(),s("span",{key:0,title:r.meta.validationMessage,class:"text-red-500"},"⚠️",8,am)):l("v-if",!0)]),r.description?(a(),s("div",lm,k(r.description),1)):l("v-if",!0),r.type==="prompt"&&r.meta&&!r.meta.isValid?(a(),s("div",sm,k(r.meta.validationMessage),1)):l("v-if",!0),o("div",im,[o("span",{class:$(["inline-block px-1.5 py-0.5 rounded",r.type==="variable"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-purple-100 dark:bg-purple-900 text-purple-700 dark:text-purple-300"])},k(r.type),3)])],10,rm))),128))]))])]),_:1})],4)):l("v-if",!0)])}const eo=ne(Xp,[["render",dm],["__scopeId","data-v-5b9dcb11"],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/PromptInput.vue"]]);function Ot(p,t){if(!t||!t.properties||Object.keys(t.properties).length===0)return!0;if(!p||!p.properties)return Object.keys(t.properties);const n=[],e=p.properties||{},c=t.properties||{};return(t.required||[]).forEach(r=>{r in e||n.push(r)}),Object.keys(c).forEach(r=>{!(r in e)&&!n.includes(r)&&n.push(r)}),n.length>0?n:!0}function jt(p){return p.length===0?"":p.length===1?`Missing required field: ${p[0]}`:`Missing required fields: ${p.join(", ")}`}const cm=ae({__name:"PromptTemplate",props:{promptText:{type:String,required:!0},beforeTool:{type:String,required:!0},afterTool:{type:String,required:!0},requiredSchema:{type:String,required:!0},currentPromptName:{type:String,required:!1}},emits:["update:promptText","update:beforeTool","update:afterTool"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=m([]),r=m(!1),d=y=>y.type==="text"?{type:"string",value:y.content||""}:y.type==="include"?{type:"prompt",id:y.prompt||"",label:y.prompt||""}:y.type==="string"?{type:"string",value:y.value||""}:y.type==="prompt"?{type:"prompt",id:y.id||"",label:y.label||y.id||""}:y.type==="variable"?{type:"variable",value:y.value||"",label:y.label||y.value||""}:{type:"string",value:""},u=z(()=>{if(!e.promptText)return[{type:"string",value:""}];let y=[];try{const T=JSON.parse(e.promptText);Array.isArray(T)?y=T.map(d):y=[{type:"string",value:e.promptText}]}catch{y=[{type:"string",value:e.promptText}]}const _=e.requiredSchema?JSON.parse(e.requiredSchema):{};return y.map(T=>{if(T.type==="prompt"&&T.schema){const b=Ot(_,T.schema),S=b===!0,M=S?[]:b;return{...T,meta:{isValid:S,missingFields:M,validationMessage:S?"":jt(M)}}}return T})}),h=z(()=>{try{const y=JSON.parse(e.requiredSchema);if(y.properties&&typeof y.properties=="object")return Object.keys(y.properties)}catch{return[]}return[]}),f=async y=>{r.value=!0;try{const _=new URLSearchParams;y&&_.set("search",y);const T=await fetch(te(`/api/prompts${_.toString()?"?"+_.toString():""}`));if(T.ok){const b=await T.json();i.value=b.prompts||[]}}catch(_){console.error("Error fetching prompts:",_)}finally{r.value=!1}},v=async y=>{const _=[];return h.value.forEach(T=>{(!y||T.toLowerCase().includes(y.toLowerCase()))&&_.push({type:"variable",value:T,label:T,description:"Schema property"})}),y!==void 0&&await f(y),i.value.forEach(T=>{if(!(e.currentPromptName&&T.name===e.currentPromptName)&&(!y||T.name.toLowerCase().includes(y.toLowerCase()))){const b=e.requiredSchema?JSON.parse(e.requiredSchema):{},S=Ot(b,T.required_schema),M=S===!0,L=M?[]:S;_.push({type:"prompt",id:T.name,label:T.name,description:T.tool_description||"Available prompt",schema:T.required_schema,meta:{isValid:M,missingFields:L,validationMessage:M?"":jt(L)}})}}),_},g=y=>{const _=y.map(T=>{const{type:b,value:S,label:M,id:L,schema:O}=T;return b==="string"?{type:b,value:S||""}:b==="variable"?{type:b,value:S||"",label:M}:b==="prompt"?{type:b,id:L||"",label:M,schema:O}:T});c("update:promptText",JSON.stringify(_))};xe(()=>{f()});const x={props:e,emit:c,availablePrompts:i,loadingPrompts:r,normalizeSegment:d,promptSegments:u,schemaProperties:h,fetchPrompts:f,searchReferences:v,handleSegmentsUpdate:g,PromptInput:eo};return Object.defineProperty(x,"__isScriptSetup",{enumerable:!1,value:!0}),x}}),um={class:"space-y-4"};function pm(p,t,n,e,c,i){return a(),s("div",um,[o("div",null,[t[0]||(t[0]=o("label",{class:"block text-sm font-medium mb-2"},"Prompt Template",-1)),t[1]||(t[1]=o("p",{class:"text-sm text-neutral-600 dark:text-neutral-400 mb-2"}," Type @ to insert schema properties or other prompts ",-1)),C(e.PromptInput,{"model-value":e.promptSegments,"onUpdate:modelValue":e.handleSegmentsUpdate,search:e.searchReferences,placeholder:"Enter your prompt template... Type @ to insert variables or prompts"},null,8,["model-value"])])])}const mm=ne(cm,[["render",pm],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/prompt-form/PromptTemplate.vue"]]),gm=ae({__name:"PromptToolOptions",props:{toolName:{type:String,required:!0},toolConfig:{type:Object,required:!0},disabled:{type:Boolean,required:!1}},emits:["update:option"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=m(null),r=m(!0),d=z(()=>i.value?.properties?Object.entries(i.value.properties).map(([v,g])=>({value:v,label:v,description:g.description||g.type||""})):[]),u=async()=>{try{const v=await fetch(te(`/api/prompts/${encodeURIComponent(e.toolName)}`));if(v.ok){const g=await v.json();g?.prompt?.required_schema&&(i.value=g.prompt.required_schema)}}catch(v){console.error("Error fetching prompt schema:",v)}finally{r.value=!1}};xe(()=>{u()});const f={props:e,emit:c,schema:i,loading:r,propertyOptions:d,fetchSchema:u,updateOption:(v,g)=>{c("update:option",v,g)},SelectInput:Ae,CheckboxInput:dt};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),fm={class:"space-y-3"},hm={class:"space-y-2 pl-4 border-l-2 border-accent-200 dark:border-accent-700"},vm={class:"space-y-1"},bm={class:"space-y-2 pl-4 border-l-2 border-neutral-200 dark:border-neutral-700"};function ym(p,t,n,e,c,i){return a(),s("div",fm,[l(" Initialization Options "),o("div",hm,[t[6]||(t[6]=o("p",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"}," Initialization Options: ",-1)),o("div",vm,[t[4]||(t[4]=o("label",{class:"block text-xs font-medium text-neutral-700 dark:text-neutral-300"}," User message property ",-1)),C(e.SelectInput,{"model-value":n.toolConfig.init_user_message_property||"","onUpdate:modelValue":t[0]||(t[0]=r=>e.updateOption("init_user_message_property",r||null)),placeholder:"Don't inject a user message",options:e.propertyOptions,disabled:n.disabled||e.loading||e.propertyOptions.length===0,loading:e.loading},null,8,["model-value","options","disabled","loading"]),t[5]||(t[5]=o("p",{class:"text-xs text-neutral-500 dark:text-neutral-400"}," Select which argument property should be used as the most recent user message for this sub-prompt. If not set no additional user message will be injected. ",-1))])]),l(" Response Options "),o("div",bm,[t[7]||(t[7]=o("p",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"}," Sub-Prompt Response Options: ",-1)),C(e.CheckboxInput,{"model-value":n.toolConfig.include_text_response,"onUpdate:modelValue":t[1]||(t[1]=r=>e.updateOption("include_text_response",r)),label:"Include text response","help-text":"Include the final text content from the sub-prompt",disabled:n.disabled},null,8,["model-value","disabled"]),C(e.CheckboxInput,{"model-value":n.toolConfig.include_tool_calls,"onUpdate:modelValue":t[2]||(t[2]=r=>e.updateOption("include_tool_calls",r)),label:"Include tool calls and responses","help-text":"Include tool calls executed by the sub-prompt and their responses",disabled:n.disabled},null,8,["model-value","disabled"]),C(e.CheckboxInput,{"model-value":n.toolConfig.include_errors,"onUpdate:modelValue":t[3]||(t[3]=r=>e.updateOption("include_errors",r)),label:"Include errors","help-text":"Include error information if the sub-prompt fails",disabled:n.disabled},null,8,["model-value","disabled"])])])}const xm=ne(gm,[["render",ym],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/PromptToolOptions.vue"]]);async function Re(p,t={}){const n=localStorage.getItem("auth_token"),e={"Content-Type":"application/json",...t.headers};n&&(e.Authorization=`Bearer ${n}`);const c=p.startsWith("/")?p:`/${p}`,i=await fetch(te(`/api${c}`),{...t,headers:e});if(i.status===401)throw localStorage.removeItem("auth_token"),window.location.href=te("/login"),new Error("Unauthorized");return i}const km=ae({__name:"ToolSelectorWithOptions",props:Ue({label:{type:String,required:!1,default:"Available Tools"},placeholder:{type:String,required:!1,default:"Select a tool"},error:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1}},{modelValue:{type:Array,required:!0,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(p,{expose:t}){t();const n=p,e=We(p,"modelValue"),c=m([]),i=m(!1),r=m();Nt(async()=>{r.value,await be(),r.value&&e.value.length>0&&await Ft({parent:r,values:e,dragHandle:".drag-handle"})});const d=z(()=>{const y=new Set(e.value.map(_=>_.name));return c.value.filter(_=>!y.has(_.name)).map(_=>{let T=_.name;return _.type==="prompt"?T=`${_.name} (prompt)`:_.type==="mcp"&&(T=`${_.name} (mcp)`),{value:_.name,label:T,description:_.description}})}),u=async()=>{i.value=!0;try{const y=await Re("/tools");if(y.ok){const _=await y.json();c.value=Object.entries(_).map(([T,b])=>({name:T,description:b.description||"",type:b.type,model:b.model}))}}catch(y){console.error("Error fetching tools:",y)}finally{i.value=!1}},h=y=>{y&&(e.value.find(_=>_.name===y)||(e.value=[...e.value,{name:y,include_text_response:!0,include_tool_calls:!0,include_errors:!0,init_user_message_property:null}]))},f=y=>{e.value=e.value.filter(_=>_.name!==y)},v=y=>c.value.find(_=>_.name===y),g=(y,_,T)=>{e.value=e.value.map(b=>b.name===y?{...b,[_]:T}:b)};xe(()=>{u()});const x={props:n,modelValue:e,tools:c,loadingTools:i,dragAreaRef:r,toolOptions:d,fetchTools:u,handleSelect:h,removeTool:f,getToolInfo:v,updateToolOption:g,SelectInput:Ae,PromptToolOptions:xm};return Object.defineProperty(x,"__isScriptSetup",{enumerable:!1,value:!0}),x}}),_m={class:"space-y-4"},wm={class:"block text-sm font-medium mb-2"},Cm={key:0,class:"text-red-500"},Sm={key:0,class:"space-y-3 mb-4",ref:"dragAreaRef"},Tm={class:"flex items-start justify-between"},Mm={class:"flex items-center gap-2 flex-1"},Im={class:"flex-1"},Vm={class:"font-medium text-sm"},Lm={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mt-1"},Pm=["onClick","disabled","aria-label"],Am={key:1,class:"text-xs text-red-500 dark:text-red-400 mt-1"},Em={key:0,class:"text-center py-8 text-sm text-neutral-500 dark:text-neutral-400 border border-dashed border-neutral-300 dark:border-neutral-600 rounded-lg"};function Om(p,t,n,e,c,i){return a(),s("div",_m,[o("div",null,[o("label",wm,[ke(k(n.label)+" ",1),n.required?(a(),s("span",Cm,"*")):l("v-if",!0)]),l(" Selected tools list (above dropdown) "),e.modelValue.length>0?(a(),s("div",Sm,[(a(!0),s(X,null,ve(e.modelValue,r=>(a(),s("div",{key:r.name,class:"border border-neutral-300 dark:border-neutral-600 rounded-lg p-4"},[o("div",Tm,[o("div",Mm,[l(" Drag handle "),t[0]||(t[0]=o("div",{class:"drag-handle cursor-move text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400"},[o("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})])],-1)),o("div",Im,[o("h4",Vm,k(r.name),1),e.getToolInfo(r.name)?.description?(a(),s("p",Lm,k(e.getToolInfo(r.name)?.description),1)):l("v-if",!0)])]),o("button",{onClick:d=>e.removeTool(r.name),type:"button",disabled:n.disabled,class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors text-neutral-500 hover:text-red-500","aria-label":`Remove ${r.name}`},[...t[1]||(t[1]=[o("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Pm)]),l(" Prompt tool options (fetches schema on mount) "),e.getToolInfo(r.name)?.type==="prompt"?(a(),ee(e.PromptToolOptions,{key:0,"tool-name":r.name,"tool-config":r,disabled:n.disabled,"onUpdate:option":(d,u)=>e.updateToolOption(r.name,d,u)},null,8,["tool-name","tool-config","disabled","onUpdate:option"])):l("v-if",!0)]))),128))],512)):l("v-if",!0),l(" Tool selector dropdown "),C(e.SelectInput,{"model-value":"","onUpdate:modelValue":e.handleSelect,placeholder:e.modelValue.length>0?"Add another tool...":n.placeholder,"search-placeholder":"Search tools...",options:e.toolOptions,disabled:n.disabled||e.loadingTools||e.toolOptions.length===0,loading:e.loadingTools},null,8,["placeholder","options","disabled","loading"]),n.error?(a(),s("p",Am,k(n.error),1)):l("v-if",!0)]),l(" Empty state (only when no tools are available at all) "),e.modelValue.length===0&&!e.loadingTools&&e.toolOptions.length===0?(a(),s("div",Em," No tools available. Create tools in your agentbuilder/tools directory. ")):l("v-if",!0)])}const jm=ne(km,[["render",Om],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/ToolSelectorWithOptions.vue"]]),Dm=ae({__name:"MultipleSelectionsInput",props:Ue({label:{type:String,required:!1},placeholder:{type:String,required:!1,default:"Select an option"},searchPlaceholder:{type:String,required:!1,default:"Search..."},error:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},options:{type:Array,required:!0},addLabel:{type:String,required:!1,default:"Add another"},loading:{type:Boolean,required:!1,default:!1}},{modelValue:{type:Array,required:!0,default:()=>[]},modelModifiers:{}}),emits:Ue(["removeItem"],["update:modelValue"]),setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=We(p,"modelValue"),r=m();Nt(async()=>{r.value,await be(),await Ft({parent:r,values:i,dragHandle:".drag-handle"})});const d=z(()=>Array.isArray(i.value)?i.value.length>0&&typeof i.value[0]=="object"?i.value:i.value.map(g=>{const x=e.options.find(y=>y.value===g);return{id:g,label:x?.label||g,description:x?.description,icon:x?.icon}}):[]),u=z(()=>{const g=d.value.map(x=>x.id);return e.options.filter(x=>!g.includes(x.value))}),v={props:e,emit:c,modelValue:i,dragAreaRef:r,selectedItems:d,availableOptions:u,handleSelect:g=>{if(!g)return;const x=e.options.find(y=>y.value===g);if(x)if(i.value.length===0||typeof i.value[0]=="string")i.value=[...i.value,g];else{const y={id:g,label:x.label,description:x.description,icon:x.icon};i.value=[...i.value,y]}},removeItem:g=>{typeof i.value[0]=="string"?i.value=i.value.filter(x=>x!==g):i.value=i.value.filter(x=>x.id!==g),c("removeItem",g)},SelectInput:Ae};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),qm={class:"space-y-2"},Um={key:0,class:"space-y-2"},Bm={key:0,class:"block text-sm font-medium"},Rm={key:0,class:"text-red-500"},Nm={class:"space-y-1",ref:"dragAreaRef"},Fm=["src","alt"],Hm={class:"flex-1 text-sm"},zm={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 ml-1"},Wm=["onClick","aria-label"],Jm={key:1,class:"text-xs text-red-500 dark:text-red-400"};function Km(p,t,n,e,c,i){return a(),s("div",qm,[e.selectedItems.length>0?(a(),s("div",Um,[n.label?(a(),s("label",Bm,[ke(k(n.label)+" ",1),n.required?(a(),s("span",Rm,"*")):l("v-if",!0)])):l("v-if",!0),o("div",Nm,[(a(!0),s(X,null,ve(e.selectedItems,r=>(a(),s("div",{key:r.id,class:$(["flex items-center gap-2 px-3 py-2 bg-neutral-50 dark:bg-neutral-900 rounded border","border-neutral-200 dark:border-neutral-800",n.disabled?"opacity-50":""])},[l(" Drag handle "),t[1]||(t[1]=o("div",{class:"drag-handle cursor-move text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400"},[o("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})])],-1)),l(" Icon "),r.icon?(a(),s("img",{key:0,src:r.icon,alt:r.label,class:"w-4 h-4 flex-shrink-0"},null,8,Fm)):l("v-if",!0),l(" Label and description "),o("span",Hm,[ke(k(r.label)+" ",1),r.description?(a(),s("span",zm," ("+k(r.description)+") ",1)):l("v-if",!0)]),l(" Remove button "),n.disabled?l("v-if",!0):(a(),s("button",{key:1,onClick:d=>e.removeItem(r.id),type:"button",class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors","aria-label":`Remove ${r.label}`},[...t[0]||(t[0]=[o("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Wm))],2))),128))],512)])):l("v-if",!0),l(" Select input for adding new items "),C(e.SelectInput,{"model-value":"","onUpdate:modelValue":e.handleSelect,label:e.selectedItems.length>0?n.addLabel:n.label,options:e.availableOptions,placeholder:n.placeholder,"search-placeholder":n.searchPlaceholder,disabled:n.disabled||e.availableOptions.length===0,loading:n.loading},null,8,["label","options","placeholder","search-placeholder","disabled","loading"]),n.error?(a(),s("p",Jm,k(n.error),1)):l("v-if",!0)])}const _t=ne(Dm,[["render",Km],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/MultipleSelectionsInput.vue"]]),Zm=ae({__name:"AgentSelectorInput",props:Ue({label:{type:String,required:!1,default:"Handoff Agents"},placeholder:{type:String,required:!1,default:"Select an agent"},error:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},allowMultiple:{type:Boolean,required:!1,default:!0},agentType:{type:String,required:!1,default:"ai_human"}},{modelValue:{type:[String,Array],required:!0,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(p,{expose:t}){t();const n=p,e=We(p,"modelValue"),c=m([]),i=m(!1),r=z(()=>c.value.map(f=>({value:f.id,label:f.title,description:f.tool_description||`Handoff to ${f.title} agent`}))),d=async()=>{i.value=!0;try{const f=te(`/api/agents${n.agentType?`?type=${n.agentType}`:""}`),v=await fetch(f);if(v.ok){const g=await v.json();c.value=g.agents||[]}}catch(f){console.error("Error fetching agents:",f)}finally{i.value=!1}},u=f=>{};xe(()=>{d()}),ce(()=>n.allowMultiple,()=>{n.allowMultiple&&typeof e.value=="string"?e.value=e.value?[e.value]:[]:!n.allowMultiple&&Array.isArray(e.value)&&(e.value=e.value[0]||"")},{immediate:!0});const h={props:n,modelValue:e,agents:c,loadingAgents:i,agentOptions:r,fetchAgents:d,handleRemoveItem:u,SelectInput:Ae,MultipleSelectionsInput:_t};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}}),Gm={key:2,class:"text-xs text-red-500 dark:text-red-400 mt-1"};function Xm(p,t,n,e,c,i){return a(),s(X,null,[n.allowMultiple?(a(),ee(e.MultipleSelectionsInput,{key:0,modelValue:e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=r=>e.modelValue=r),label:n.label,placeholder:n.placeholder,"search-placeholder":"Search agents...",error:n.error,required:n.required,disabled:n.disabled,options:e.agentOptions,loading:e.loadingAgents,"add-label":"Add another agent",onRemoveItem:e.handleRemoveItem},null,8,["modelValue","label","placeholder","error","required","disabled","options","loading"])):(a(),ee(e.SelectInput,{key:1,modelValue:e.modelValue,"onUpdate:modelValue":t[1]||(t[1]=r=>e.modelValue=r),label:n.label,placeholder:n.placeholder,"search-placeholder":"Search agents...",options:e.agentOptions,disabled:n.disabled,loading:e.loadingAgents},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!n.allowMultiple&&n.error?(a(),s("p",Gm,k(n.error),1)):l("v-if",!0)],64)}const Ym=ne(Zm,[["render",Xm],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/AgentSelectorInput.vue"]]),Qm=ae({__name:"PromptModal",props:{modelValue:{type:Boolean,required:!0},editPrompt:{type:null,required:!1},mode:{type:String,required:!1}},emits:["update:modelValue","save"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=z(()=>e.mode==="edit"),r=m(!1),d=z(()=>S.value.length===1),u=m(""),h=m(""),f=m(""),v=m(""),g=m({type:"object",properties:{},required:[],additionalProperties:!1}),x=m(""),y=m(!1),_=m(!1),T=m(""),b=m(""),S=m([]),M=m([]),L=m(!1),O=m("auto"),B=m(null),H=m(null),re=m(!1),Q=m(!1),q=z({get:()=>B.value||"",set:I=>B.value=I||null}),K=z({get:()=>O.value,set:I=>O.value=I}),R=()=>{h.value="",u.value="",f.value="",v.value="",g.value={type:"object",properties:{},required:[],additionalProperties:!1},x.value="",y.value=!1,_.value=!1,T.value="",b.value="",S.value=[],M.value=[],L.value=!1,O.value="auto",B.value=null,H.value=null,re.value=!1,Q.value=!1},Y=async()=>{if(e.editPrompt?.id){r.value=!0;try{const I=await Re(`/prompts/${e.editPrompt.id}`);if(I.ok){const A=await I.json(),V=A.prompt||A;h.value=V.name||"",u.value=V.name||"",f.value=V.tool_description||"",v.value=V.model_id||"";let P=V.required_schema;if(typeof P=="string")try{P=JSON.parse(P)}catch{P=null}g.value=P||{type:"object",properties:{},required:[],additionalProperties:!1},x.value=V.prompt||"",y.value=V.include_chat||!1,_.value=V.include_past_tools||!1,T.value=V.before_tool||"",b.value=V.after_tool||"";const U=V.tools||[];S.value=U.map(W=>typeof W=="string"?{name:W,include_text_response:!0,include_tool_calls:!0,include_errors:!0,init_user_message_property:null}:W),M.value=V.prompts||V.handoff_agents||[],L.value=V.parallel_tool_calls||!1,O.value=V.tool_choice||"auto";const D=V.reasoning||{};B.value=D.effort||V.reasoning_effort||null,H.value=D.maxTokens||V.reasoning_max_tokens||null,re.value=D.exclude||V.reasoning_exclude||!1,Q.value=V.include_reasoning||!1}}catch(I){console.error("Error loading prompt data:",I)}finally{r.value=!1}}},E=async()=>{const I=/^[a-z][a-z0-9_]*$/;if(!h.value||!I.test(h.value)){alert("Please enter a valid name (lowercase letters, numbers, and underscores only, must start with a letter)");return}if(!f.value){alert("Please enter a description");return}if(!v.value){alert("Please select a model");return}if(!x.value){alert("Please enter the prompt template");return}const A={name:h.value,tool_description:f.value,prompt:x.value,required_schema:g.value,model_id:v.value,include_chat:y.value,include_past_tools:_.value,before_tool:T.value||null,after_tool:b.value||null,parallel_tool_calls:L.value,tool_choice:O.value,tools:S.value,handoff_agents:M.value,reasoning_effort:B.value,reasoning_max_tokens:H.value,reasoning_exclude:re.value,include_reasoning:Q.value};i.value&&e.editPrompt?.id&&(A.id=e.editPrompt.id,u.value&&u.value!==h.value&&(A.originalName=u.value)),c("save",A),R(),c("update:modelValue",!1)},N=()=>{R(),c("update:modelValue",!1)};ce(()=>S.value.length,I=>{O.value==="function"&&I!==1&&(O.value="auto")}),ce(()=>e.modelValue,async I=>{I&&(i.value?(R(),await be(),await Y()):R())}),ce(()=>e.editPrompt,async I=>{I&&i.value&&e.modelValue&&(await be(),await Y())},{immediate:!0});const w={props:e,emit:c,isEditMode:i,isLoading:r,isFunctionChoiceAvailable:d,originalName:u,name:h,toolDescription:f,selectedModel:v,requiredSchema:g,promptText:x,includeChat:y,includePastTools:_,beforeTool:T,afterTool:b,selectedTools:S,handoffAgents:M,parallelToolCalls:L,toolChoice:O,reasoningEffort:B,reasoningMaxTokens:H,reasoningExclude:re,includeReasoning:Q,reasoningEffortValue:q,toolChoiceValue:K,resetForm:R,loadPromptData:Y,handleSubmit:E,handleCancel:N,Modal:Ne,PromptBasicInfo:D2,PromptModelSelect:op,JSONSchemaInput:$t,PromptTemplate:mm,CheckboxInput:dt,ToolSelectorWithOptions:jm,AgentSelectorInput:Ym,SelectInput:Ae};return Object.defineProperty(w,"__isScriptSetup",{enumerable:!1,value:!0}),w}}),$m={key:0,class:"min-h-[400px] flex items-center justify-center"},e1={class:"space-y-6 pr-2 pb-4"},t1={class:"space-y-4"},o1={class:"space-y-4"},r1={class:"flex justify-between"},n1={class:"flex gap-2"},a1=["disabled"];function l1(p,t,n,e,c,i){return a(),ee(e.Modal,{"model-value":n.modelValue,"onUpdate:modelValue":t[17]||(t[17]=r=>p.$emit("update:modelValue",r)),title:e.isEditMode?"Edit Prompt":"Add Prompt",width:"max-w-4xl"},{footer:de(()=>[o("div",r1,[o("button",{onClick:e.handleCancel,type:"button",class:"px-3 py-1.5 text-sm border border-black dark:border-white rounded font-medium hover:bg-black/5 dark:hover:bg-white/10 transition-colors"}," Cancel "),o("div",n1,[o("button",{onClick:e.handleSubmit,type:"button",class:"px-3 py-1.5 text-sm bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity",disabled:e.isLoading},k(e.isEditMode?"Update Prompt":"Create Prompt"),9,a1)])])]),default:de(()=>[e.isLoading?(a(),s("div",$m,[...t[18]||(t[18]=[o("span",{class:"text-neutral-500"},"Loading prompt data...",-1)])])):(a(),s(X,{key:1},[l(" Single long form for both edit and add modes "),o("div",e1,[o("div",null,[C(e.PromptBasicInfo,{name:e.name,"onUpdate:name":t[0]||(t[0]=r=>e.name=r),"tool-description":e.toolDescription,"onUpdate:toolDescription":t[1]||(t[1]=r=>e.toolDescription=r)},null,8,["name","tool-description"])]),o("div",null,[C(e.PromptModelSelect,{modelValue:e.selectedModel,"onUpdate:modelValue":t[2]||(t[2]=r=>e.selectedModel=r)},null,8,["modelValue"])]),o("div",null,[C(e.JSONSchemaInput,{modelValue:e.requiredSchema,"onUpdate:modelValue":t[3]||(t[3]=r=>e.requiredSchema=r),label:"Required Schema (Optional)"},null,8,["modelValue"])]),o("div",null,[C(e.PromptTemplate,{"prompt-text":e.promptText,"onUpdate:promptText":t[4]||(t[4]=r=>e.promptText=r),"before-tool":e.beforeTool,"onUpdate:beforeTool":t[5]||(t[5]=r=>e.beforeTool=r),"after-tool":e.afterTool,"onUpdate:afterTool":t[6]||(t[6]=r=>e.afterTool=r),"required-schema":JSON.stringify(e.requiredSchema,null,2),"current-prompt-name":e.isEditMode?e.name:void 0},null,8,["prompt-text","before-tool","after-tool","required-schema","current-prompt-name"])]),o("div",null,[C(e.ToolSelectorWithOptions,{modelValue:e.selectedTools,"onUpdate:modelValue":t[7]||(t[7]=r=>e.selectedTools=r)},null,8,["modelValue"])]),o("div",t1,[t[20]||(t[20]=o("h3",{class:"text-sm font-medium text-neutral-900 dark:text-neutral-100"}," Tool Configuration ",-1)),l(" Parallel Tool Calls "),o("div",null,[C(e.CheckboxInput,{modelValue:e.parallelToolCalls,"onUpdate:modelValue":t[8]||(t[8]=r=>e.parallelToolCalls=r),label:"Allow parallel tool calls","help-text":"Allow the model to call multiple tools simultaneously in a single turn"},null,8,["modelValue"])]),l(" Tool Choice "),o("div",null,[C(e.SelectInput,{modelValue:e.toolChoiceValue,"onUpdate:modelValue":t[9]||(t[9]=r=>e.toolChoiceValue=r),label:"Tool Choice",options:[{value:"auto",label:"Auto",description:"Model decides"},{value:"none",label:"None",description:"No tools allowed"},{value:"required",label:"Required",description:"Must call a tool"},{value:"function",label:"Function",description:e.isFunctionChoiceAvailable?"Call specific tool":"Requires exactly 1 tool"}].filter(r=>r.value!=="function"||e.isFunctionChoiceAvailable),placeholder:"Select tool choice"},null,8,["modelValue","options"]),t[19]||(t[19]=o("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Controls whether and how the model can call tools ",-1))])]),o("div",null,[C(e.AgentSelectorInput,{modelValue:e.handoffAgents,"onUpdate:modelValue":t[10]||(t[10]=r=>e.handoffAgents=r),"allow-multiple":!0,label:"Handoff Agents (Optional)",placeholder:"Select AI + Human agents to hand off to","agent-type":"ai_human"},null,8,["modelValue"]),t[21]||(t[21]=o("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," AI + Human agents that this prompt can hand off conversations to. These will be exposed as tools. ",-1))]),l(" Reasoning Tokens Configuration "),o("div",o1,[t[25]||(t[25]=o("h3",{class:"text-sm font-medium text-neutral-900 dark:text-neutral-100"}," Context & Reasoning Configuration ",-1)),l(" Include Chat History "),o("div",null,[C(e.CheckboxInput,{modelValue:e.includeChat,"onUpdate:modelValue":t[11]||(t[11]=r=>e.includeChat=r),label:"Include chat history","help-text":"Expose chat history to the LLM when this prompt is used as a full prompt (not a partial in another prompt)"},null,8,["modelValue"])]),l(" Include Past Tool Calls "),o("div",null,[C(e.CheckboxInput,{modelValue:e.includePastTools,"onUpdate:modelValue":t[12]||(t[12]=r=>e.includePastTools=r),label:"Include past tool calls","help-text":"Include prior tool call history in this prompt. Uncheck to remove past tool calls"},null,8,["modelValue"])]),l(" Include Reasoning in Message History "),o("div",null,[C(e.CheckboxInput,{modelValue:e.includeReasoning,"onUpdate:modelValue":t[13]||(t[13]=r=>e.includeReasoning=r),label:"Include reasoning in message history","help-text":"When loading message history, include reasoning_details from previous responses. Required for multi-turn reasoning continuity."},null,8,["modelValue"])]),t[26]||(t[26]=o("hr",{class:"border-neutral-300 dark:border-neutral-600"},null,-1)),t[27]||(t[27]=o("p",{class:"text-xs text-neutral-500 dark:text-neutral-400"}," Configure extended reasoning for models like o1, o3, Gemini Thinking, and others. Reasoning is enabled automatically when either field is set. ",-1)),l(" Reasoning Effort "),o("div",null,[C(e.SelectInput,{modelValue:e.reasoningEffortValue,"onUpdate:modelValue":t[14]||(t[14]=r=>e.reasoningEffortValue=r),label:"Reasoning Effort",options:[{value:"",label:"None",description:"Disabled"},{value:"low",label:"Low",description:"~20% of max_tokens"},{value:"medium",label:"Medium",description:"~50% of max_tokens"},{value:"high",label:"High",description:"~80% of max_tokens"}],placeholder:"Select reasoning effort"},null,8,["modelValue"]),t[22]||(t[22]=o("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Controls reasoning capacity allocation. Supported by OpenAI o-series and Grok models. ",-1))]),l(" Max Reasoning Tokens "),o("div",null,[t[23]||(t[23]=o("label",{class:"block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2"}," Max Reasoning Tokens ",-1)),Me(o("input",{"onUpdate:modelValue":t[15]||(t[15]=r=>e.reasoningMaxTokens=r),type:"number",min:"1024",max:"32000",step:"1024",placeholder:"Leave empty to disable or use effort level",class:"w-full px-3 py-2 text-sm border border-neutral-300 dark:border-neutral-600 rounded bg-white dark:bg-neutral-800 text-neutral-900 dark:text-neutral-100 focus:ring-2 focus:ring-accent-500 focus:border-transparent"},null,512),[[Oe,e.reasoningMaxTokens,void 0,{number:!0}]]),t[24]||(t[24]=o("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Directly specify reasoning token limit (1024-32000). Supported by Anthropic, Gemini Thinking, and some Qwen models. ",-1))]),l(" Exclude Reasoning from Response "),o("div",null,[C(e.CheckboxInput,{modelValue:e.reasoningExclude,"onUpdate:modelValue":t[16]||(t[16]=r=>e.reasoningExclude=r),label:"Exclude reasoning from response","help-text":"Use reasoning internally but don't return it in the response (saves tokens and cost)"},null,8,["modelValue"])])])])],2112))]),_:1},8,["model-value","title"])}const to=ne(Qm,[["render",l1],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/PromptModal.vue"]]),s1=ae({__name:"PromptsView",setup(p,{expose:t}){t();const n=Xe(),e=Fe(),c=m(!1),i=m(null);ce(()=>e.query.refresh,()=>{e.query.refresh&&(i.value?.refresh(),n.replace({path:"/prompts",query:{}}))});const h={router:n,route:e,showModal:c,dataTableRef:i,handleAdd:()=>{c.value=!0},handleEdit:f=>{n.push(`/prompts/${f.id}`)},handleSave:async f=>{try{const v=await fetch(te("/api/prompts"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(v.ok)c.value=!1,await new Promise(g=>setTimeout(g,100)),await i.value?.refresh();else{const g=await v.json();alert(g.error||"Failed to create prompt")}}catch(v){console.error("Error creating prompt:",v),alert("Failed to create prompt")}},PromptsDataTable:I2,PromptModal:to,CenteredContentView:Ze};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}});function i1(p,t,n,e,c,i){return a(),ee(e.CenteredContentView,null,{default:de(()=>[o("div",{class:"flex justify-between items-center mb-6"},[t[1]||(t[1]=o("h1",{class:"text-3xl font-bold"},"Prompts",-1)),o("button",{onClick:e.handleAdd,class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"}," Create Prompt ")]),t[2]||(t[2]=o("p",{class:"text-neutral-600 dark:text-neutral-400 mb-6"}," Define and manage prompt templates for your agents. ",-1)),C(e.PromptsDataTable,{ref:"dataTableRef",onAdd:e.handleAdd,onEdit:e.handleEdit},null,512),C(e.PromptModal,{modelValue:e.showModal,"onUpdate:modelValue":t[0]||(t[0]=r=>e.showModal=r),mode:"add",onSave:e.handleSave},null,8,["modelValue"])]),_:1})}const d1=ne(s1,[["render",i1],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/PromptsView.vue"]]),c1=ae({__name:"PromptEditView",setup(p,{expose:t}){t();const n=Xe(),e=Fe(),c=m(!0),i=m(null),r=m(!0),d=async()=>{const v=e.params.id;if(!v){n.push("/prompts");return}r.value=!0;try{const g=await fetch(te(`/api/prompts/${v}`));if(g.ok){const x=await g.json();i.value=x.prompt||x}else alert("Prompt not found"),n.push("/prompts")}catch(g){console.error("Error loading prompt:",g),alert("Failed to load prompt"),n.push("/prompts")}finally{r.value=!1}},u=async v=>{try{const{originalName:g,...x}=v,y=g||x.id,_=await fetch(te(`/api/prompts/${y}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(_.ok)n.push({path:"/prompts",query:{refresh:Date.now().toString()}});else{const T=await _.json();alert(T.error||"Failed to update prompt")}}catch(g){console.error("Error updating prompt:",g),alert("Failed to update prompt")}},h=v=>{v||n.push("/prompts")};xe(()=>{d()}),ce(c,v=>{v||n.push("/prompts")});const f={router:n,route:e,showModal:c,editingPrompt:i,isLoading:r,loadPrompt:d,handleSave:u,handleClose:h,PromptModal:to};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),u1={class:"p-8"},p1={key:0,class:"flex items-center justify-center min-h-[400px]"},m1={key:2,class:"flex items-center justify-center min-h-[400px]"};function g1(p,t,n,e,c,i){return a(),s("div",u1,[e.isLoading?(a(),s("div",p1,[...t[1]||(t[1]=[o("span",{class:"text-neutral-500"},"Loading prompt...",-1)])])):e.editingPrompt?(a(),ee(e.PromptModal,{key:1,modelValue:e.showModal,"onUpdate:modelValue":[t[0]||(t[0]=r=>e.showModal=r),e.handleClose],mode:"edit","edit-prompt":e.editingPrompt,onSave:e.handleSave},null,8,["modelValue","edit-prompt"])):(a(),s("div",m1,[...t[2]||(t[2]=[o("span",{class:"text-neutral-500"},"Prompt not found",-1)])]))])}const f1=ne(c1,[["render",g1],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/PromptEditView.vue"]]),h1=ae({__name:"ExposedSelectList",props:{providers:{type:Array,required:!0,default:()=>[]},modelValue:{type:Array,required:!0,default:()=>[]},label:{type:String,required:!1},loading:{type:Boolean,required:!1}},emits:["update:modelValue"],setup(p,{expose:t,emit:n}){t();function e(x){if(x===0)return"$0.00";const y=Math.abs(x);let _;return y<1e-4?_=y.toExponential(3):y<.001||y<.01||y<.1?_=y.toFixed(4):y<1?_=y.toFixed(3):y<10||y<100?_=y.toFixed(2):y<1e3?_=y.toFixed(1):_=y.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0}),_.includes(".")&&(_=_.replace(/\.?0+$/,""),!_.includes(".")&&y<100&&(_=y.toFixed(2))),x<0?`-$${_}`:`$${_}`}const c=p,i=n,r=x=>c.modelValue.includes(x),d=x=>{const y=[...c.modelValue],_=y.indexOf(x);_>-1?y.splice(_,1):y.push(x),i("update:modelValue",y)},u=()=>{i("update:modelValue",c.providers.map(x=>x.id))},h=()=>{i("update:modelValue",[])},f=z(()=>c.providers.length>0&&c.modelValue.length===c.providers.length),v=z(()=>c.modelValue.length>0&&c.modelValue.length<c.providers.length),g={dollars:e,props:c,emit:i,isSelected:r,toggleProvider:d,selectAll:u,deselectAll:h,allSelected:f,someSelected:v};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}}),v1={class:"border-2 border-black dark:border-neutral-300 rounded-lg overflow-hidden"},b1={key:0,class:"px-4 py-2 border-b-2 border-black dark:border-neutral-300 bg-neutral-50 dark:bg-neutral-900"},y1={class:"flex items-center justify-between"},x1={class:"text-sm font-medium"},k1={class:"flex items-center gap-2"},_1={key:1,class:"px-4 py-8 flex items-center justify-center"},w1={key:2,class:"px-4 py-8 text-center text-neutral-500"},C1={key:3,class:"divide-y divide-neutral-200 dark:divide-neutral-700"},S1=["onClick"],T1={class:"flex items-start gap-3"},M1={class:"flex-shrink-0 mt-0.5"},I1=["checked","onClick"],V1={class:"flex-1 min-w-0"},L1={class:"flex items-center gap-2"},P1={class:"text-sm font-medium"},A1={key:0,class:"text-xs px-1.5 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},E1={class:"mt-1 text-xs text-neutral-600 dark:text-neutral-400 space-y-0.5"},O1={key:0},j1={key:0},D1={key:1},q1={key:2};function U1(p,t,n,e,c,i){return a(),s("div",v1,[n.label?(a(),s("div",b1,[o("div",y1,[o("span",x1,k(n.label),1),o("div",k1,[o("button",{type:"button",onClick:t[0]||(t[0]=r=>e.allSelected?e.deselectAll():e.selectAll()),class:"text-xs px-2 py-1 border border-neutral-400 dark:border-neutral-600 rounded hover:bg-neutral-100 dark:hover:bg-neutral-800"},k(e.allSelected?"Deselect All":"Select All"),1)])])])):l("v-if",!0),n.loading?(a(),s("div",_1,[...t[1]||(t[1]=[o("div",{class:"flex items-center gap-2 text-neutral-500"},[o("svg",{class:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[o("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),o("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]),o("span",null,"Loading providers...")],-1)])])):n.providers.length===0?(a(),s("div",w1," No providers available ")):(a(),s("div",C1,[(a(!0),s(X,null,ve(n.providers,r=>(a(),s("div",{key:r.id,class:"px-4 py-3 hover:bg-neutral-50 dark:hover:bg-neutral-900 cursor-pointer",onClick:d=>e.toggleProvider(r.id)},[o("div",T1,[o("div",M1,[o("input",{type:"checkbox",checked:e.isSelected(r.id),onClick:Ce(d=>e.toggleProvider(r.id),["stop"]),class:"w-4 h-4 border-2 border-black dark:border-neutral-300 rounded focus:ring-2 focus:ring-black dark:focus:ring-white"},null,8,I1)]),o("div",V1,[o("div",L1,[o("span",P1,k(r.name),1),r.quantization?(a(),s("span",A1,k(r.quantization),1)):l("v-if",!0)]),o("div",E1,[o("div",null,k(e.dollars(r.pricing.prompt*1e6))+"/M input • "+k(e.dollars(r.pricing.completion*1e6))+"/M output ",1),r.maxPromptTokens||r.maxCompletionTokens?(a(),s("div",O1,[r.maxPromptTokens?(a(),s("span",j1," Max prompt: "+k(r.maxPromptTokens.toLocaleString())+" tokens ",1)):l("v-if",!0),r.maxPromptTokens&&r.maxCompletionTokens?(a(),s("span",D1," • ")):l("v-if",!0),r.maxCompletionTokens?(a(),s("span",q1," Max completion: "+k(r.maxCompletionTokens.toLocaleString())+" tokens ",1)):l("v-if",!0)])):l("v-if",!0)])])])],8,S1))),128))]))])}const B1=ne(h1,[["render",U1],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/ExposedSelectList.vue"]]),R1=ae({__name:"ModelSelectorInput",props:Ue({label:{type:String,required:!1},placeholder:{type:String,required:!1,default:"Select a model"},error:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},allowMultiple:{type:Boolean,required:!1,default:!1}},{modelValue:{type:[String,Array],required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(p,{expose:t}){t();const n=p,e=We(p,"modelValue"),c=m([]),i=m(!1),r=z(()=>c.value.map(f=>({value:f.id,label:f.name,description:f.provider_id||f.provider,icon:kt(f.model||f.name,f.provider_id||f.provider)}))),d=async()=>{i.value=!0;try{const f=await fetch(te("/api/models"));if(f.ok){const v=await f.json();c.value=v.models||[]}}catch(f){console.error("Error fetching models:",f)}finally{i.value=!1}},u=f=>{};xe(()=>{d()}),ce(()=>n.allowMultiple,()=>{n.allowMultiple&&typeof e.value=="string"?e.value=e.value?[e.value]:[]:!n.allowMultiple&&Array.isArray(e.value)&&(e.value=e.value[0]||"")});const h={props:n,modelValue:e,models:c,loadingModels:i,modelOptions:r,fetchModels:d,handleRemoveItem:u,SelectInput:Ae,MultipleSelectionsInput:_t};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}}),N1={key:2,class:"text-xs text-red-500 dark:text-red-400 mt-1"};function F1(p,t,n,e,c,i){return a(),s(X,null,[n.allowMultiple?(a(),ee(e.MultipleSelectionsInput,{key:0,modelValue:e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=r=>e.modelValue=r),label:n.label,placeholder:n.placeholder,"search-placeholder":"Search models...",error:n.error,required:n.required,disabled:n.disabled,options:e.modelOptions,loading:e.loadingModels,"add-label":"Add another model",onRemoveItem:e.handleRemoveItem},null,8,["modelValue","label","placeholder","error","required","disabled","options","loading"])):(a(),ee(e.SelectInput,{key:1,modelValue:e.modelValue,"onUpdate:modelValue":t[1]||(t[1]=r=>e.modelValue=r),label:n.label,placeholder:n.placeholder,"search-placeholder":"Search models...",options:e.modelOptions,disabled:n.disabled,loading:e.loadingModels},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!n.allowMultiple&&n.error?(a(),s("p",N1,k(n.error),1)):l("v-if",!0)],64)}const H1=ne(R1,[["render",F1],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/ModelSelectorInput.vue"]]),z1=ae({__name:"ModelModal",props:{modelValue:{type:Boolean,required:!0},editModel:{type:null,required:!1},mode:{type:String,required:!1,default:"add"}},emits:["update:modelValue","save"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=m([]),r=m(""),d=m(""),u=m([]),h=m(!1),f=m(!1),v=m([]),g=m([]),x=m(!1),y=m([]),_=z(()=>e.mode==="edit"),T=m(""),b=m(""),S=m(""),M=P=>{let U=P.replace(/[^a-zA-Z0-9\s_-]/g,"");return U=U.trim().toLowerCase().replace(/[\s-]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),U?/^[a-z][a-z0-9_]*$/.test(U)?S.value="":S.value="Name must start with a letter and contain only lowercase letters, numbers, and underscores":S.value="Name is required",U},L=P=>{const U=P.target.value;b.value=M(U)},O=m(!1),B=m(null),H=z(()=>i.value.filter(P=>P.hasApiKey).map(P=>({value:P.name,label:P.name,description:P.sdk==="openai-sdk"?"OpenAI SDK":P.sdk==="openrouter"?"OpenRouter":P.sdk,icon:st(P.sdk)}))),re=z(()=>u.value.map(P=>({...P,icon:P.iconId?st(P.iconId):void 0}))),Q=z(()=>!_.value||!B.value||O.value?!1:b.value!==B.value.name||r.value!==B.value.provider||d.value!==B.value.model||JSON.stringify(g.value.sort())!==JSON.stringify(B.value.endpoints.sort())||JSON.stringify(y.value)!==JSON.stringify(B.value.fallbacks)),q=z(()=>i.value.find(U=>U.name===r.value)?.sdk==="openrouter"),K=async()=>{h.value=!0;try{const P=await fetch(te("/api/providers"));if(P.ok){const U=await P.json();i.value=U.providers||[]}}catch(P){console.error("Error fetching providers:",P)}finally{h.value=!1}},R=async()=>{if(!r.value){u.value=[];return}f.value=!0;try{const P=await fetch(te("/api/models/available"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r.value})});if(P.ok){const U=await P.json();u.value=U.models||[]}else{const U=await P.json();console.error("Error fetching models:",U),u.value=[],alert(U.error||"Failed to fetch available models")}}catch(P){console.error("Error fetching models:",P),u.value=[]}finally{f.value=!1}},Y=()=>{b.value="",T.value="",r.value="",d.value="",u.value=[],y.value=[],v.value=[],g.value=[],B.value=null,O.value=!1},E=async()=>{if(e.editModel){O.value=!0;try{await K(),b.value=e.editModel.name||"",T.value=e.editModel.name||"",r.value=e.editModel.provider_id||e.editModel.provider,await R(),d.value=e.editModel.model,await w(),e.editModel.included_providers&&e.editModel.included_providers.length>0&&(g.value=e.editModel.included_providers),await N(),B.value={name:b.value,provider:r.value,model:d.value,endpoints:[...g.value],fallbacks:[...y.value]}}finally{O.value=!1}}};ce(()=>e.modelValue,async P=>{P?_.value&&e.editModel?await E():(await K(),Y()):Y()});const N=async()=>{if(e.editModel?.id){if(e.editModel.fallbacks&&Array.isArray(e.editModel.fallbacks)){y.value=e.editModel.fallbacks.map(P=>typeof P=="string"?P:P.id);return}try{const P=await fetch(te(`/api/models/${e.editModel.id}/fallbacks`));if(P.ok){const U=await P.json();y.value=U.fallbacks.map(D=>D.fallback_model_id)}}catch(P){console.error("Error loading fallbacks:",P)}}};ce(r,async(P,U)=>{O.value||_.value&&!U&&P===(e.editModel?.provider_id||e.editModel?.provider)||(d.value="",v.value=[],g.value=[],r.value&&await R())});const w=async()=>{if(!d.value||!r.value){v.value=[];return}const P=i.value.find(D=>D.name===r.value);if(!P||P.sdk!=="openrouter"){v.value=[];return}const U=re.value.find(D=>D.value===d.value);if(!U?.slug){console.error("Model slug not found"),v.value=[];return}x.value=!0;try{const D=await fetch(te("/api/models/endpoints"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r.value,modelSlug:U.slug})});if(D.ok){const W=await D.json();v.value=W.endpoints||[],_.value||(g.value=v.value.map(G=>G.id))}else{const W=await D.json();console.error("Error fetching endpoints:",W),v.value=[]}}catch(D){console.error("Error fetching endpoints:",D),v.value=[]}finally{x.value=!1}};ce(d,async(P,U)=>{O.value||_.value&&!U&&P===e.editModel?.model||(d.value?(await w(),U&&P!==U&&(g.value=v.value.map(D=>D.id))):(v.value=[],g.value=[]))});const V={props:e,emit:c,providers:i,selectedProvider:r,selectedModel:d,availableModels:u,loadingProviders:h,loadingModels:f,endpoints:v,selectedEndpoints:g,loadingEndpoints:x,fallbackModels:y,isEditMode:_,originalName:T,modelName:b,nameError:S,validateAndFormatName:M,handleNameInput:L,isLoading:O,initialState:B,providerOptions:H,modelOptions:re,hasChanges:Q,isOpenRouter:q,fetchProviders:K,fetchAvailableModels:R,resetForm:Y,loadEditData:E,loadModelFallbacks:N,fetchEndpoints:w,handleSubmit:()=>{if(!r.value||!d.value){alert("Please select a provider and model");return}if(!b.value){alert("Please enter a name for the model");return}if(S.value){alert(S.value);return}const P=q.value?g.value:[],U={name:b.value,model:d.value,provider:r.value,included_providers:P,fallbacks:y.value};_.value&&e.editModel?.id&&(U.id=e.editModel.id,T.value&&T.value!==b.value&&(U.originalName=T.value)),c("save",U)},handleCancel:()=>{Y(),c("update:modelValue",!1)},Modal:Ne,SelectInput:Ae,ExposedSelectList:B1,ModelSelectorInput:H1};return Object.defineProperty(V,"__isScriptSetup",{enumerable:!1,value:!0}),V}}),W1={class:"space-y-4"},J1={key:0},K1={key:1},Z1=["value"],G1={key:0,class:"mt-1 text-xs text-red-500"},X1={key:1,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Y1={class:"px-1 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},Q1={key:2,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},$1={key:2},eg={key:3},tg={class:"flex justify-end gap-2"},og=["disabled"];function rg(p,t,n,e,c,i){return a(),ee(e.Modal,{"model-value":n.modelValue,"onUpdate:modelValue":t[4]||(t[4]=r=>p.$emit("update:modelValue",r)),title:e.isEditMode?"Edit Model":"Add Model",width:"max-w-2xl","min-height":"min-h-[36rem]","has-changes":e.hasChanges},{footer:de(()=>[o("div",tg,[o("button",{onClick:e.handleCancel,type:"button",class:"px-3 py-1.5 text-sm border border-black dark:border-white rounded font-medium hover:bg-black/5 dark:hover:bg-white/10 transition-colors"}," Cancel "),o("button",{onClick:e.handleSubmit,type:"button",class:"px-3 py-1.5 text-sm bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity",disabled:!e.selectedProvider||!e.selectedModel},k(e.isEditMode?"Update Model":"Add Model"),9,og)])]),default:de(()=>[o("div",W1,[C(e.SelectInput,{modelValue:e.selectedProvider,"onUpdate:modelValue":t[0]||(t[0]=r=>e.selectedProvider=r),options:e.providerOptions,label:"Provider",placeholder:"Select a provider",disabled:e.loadingProviders||e.isEditMode&&!!e.props.editModel},null,8,["modelValue","options","disabled"]),e.selectedProvider?(a(),s("div",J1,[C(e.SelectInput,{modelValue:e.selectedModel,"onUpdate:modelValue":t[1]||(t[1]=r=>e.selectedModel=r),options:e.modelOptions,label:"Model",placeholder:"Select a model","search-placeholder":"Search models...",loading:e.loadingModels},null,8,["modelValue","options","loading"])])):l("v-if",!0),l(" Name field (shown after model selection) "),e.selectedModel?(a(),s("div",K1,[t[6]||(t[6]=o("label",{class:"block text-sm font-medium mb-2"},"Name",-1)),o("input",{value:e.modelName,onInput:e.handleNameInput,type:"text",class:$(["w-full px-3 py-2 text-sm border rounded bg-white dark:bg-neutral-800 text-neutral-900 dark:text-neutral-100 focus:ring-2 focus:ring-accent-500 focus:border-transparent",e.nameError?"border-red-500":"border-neutral-300 dark:border-neutral-600"]),placeholder:"e.g., coding_model, planning_model, fast_response"},null,42,Z1),e.nameError?(a(),s("p",G1,k(e.nameError),1)):e.modelName?(a(),s("p",X1,[t[5]||(t[5]=ke(" Will be saved as: ",-1)),o("code",Y1,k(e.modelName),1)])):(a(),s("p",Q1," A descriptive name for this model (e.g., coding_model, planning_model). This becomes the filename and reference ID. "))])):l("v-if",!0),e.selectedModel&&e.isOpenRouter?(a(),s("div",$1,[t[7]||(t[7]=o("label",{class:"block text-sm font-medium mb-2"}," Available Providers ",-1)),C(e.ExposedSelectList,{modelValue:e.selectedEndpoints,"onUpdate:modelValue":t[2]||(t[2]=r=>e.selectedEndpoints=r),providers:e.endpoints,loading:e.loadingEndpoints},null,8,["modelValue","providers","loading"]),t[8]||(t[8]=o("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Select which providers can be used for this model ",-1))])):l("v-if",!0),l(" Fallback Models Section "),e.selectedModel?(a(),s("div",eg,[C(e.ModelSelectorInput,{modelValue:e.fallbackModels,"onUpdate:modelValue":t[3]||(t[3]=r=>e.fallbackModels=r),label:"Fallback Models",placeholder:"Add fallback model...","allow-multiple":!0},null,8,["modelValue"]),t[9]||(t[9]=o("p",{class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"}," Fallback models will be used in order if the primary model fails ",-1))])):l("v-if",!0)])]),_:1},8,["model-value","title","has-changes"])}const ng=ne(z1,[["render",rg],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/ModelModal.vue"]]),ag=ae({__name:"ModelsView",setup(p,{expose:t}){t();const n=m(!1),e=m([]),c=m(!1),i=m(null),r=m("add"),d=[{key:"name",label:"Name",width:"w-1/4"},{key:"model",label:"Model",width:"w-1/4"},{key:"provider",label:"Provider",width:"w-1/4"},{key:"fallbacks",label:"Fallbacks",width:"w-1/4"}],u=[{icon:"edit",label:"Edit",handler:x=>{i.value=x,r.value="edit",n.value=!0}},{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this model? This action cannot be undone.",handler:async x=>{await v(x.id)}}],h=async()=>{c.value=!0;try{const x=await fetch(te("/api/models"));if(!x.ok)throw new Error("Failed to fetch models");const y=await x.json();e.value=y.models||[]}catch(x){console.error("Error fetching models:",x),e.value=[]}finally{c.value=!1}},f=async x=>{try{if(i.value){const{originalName:y,..._}=x,T=y||i.value.id,b=await fetch(te(`/api/models/${T}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)});if(!b.ok){const S=await b.json();alert(S.error||"Failed to update model");return}}else{const y=await fetch(te("/api/models"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!y.ok){const _=await y.json();alert(_.error||"Failed to add model");return}}await h(),n.value=!1,i.value=null,r.value="add"}catch(y){console.error("Error saving model:",y),alert("Failed to save model")}},v=async x=>{try{const y=await fetch(te(`/api/models/${x}`),{method:"DELETE"});if(!y.ok){const _=await y.json();alert(_.error||"Failed to delete model");return}await h()}catch(y){console.error("Error deleting model:",y),alert("Failed to delete model")}};xe(()=>{h()});const g={showModal:n,models:e,loading:c,editingModel:i,modalMode:r,columns:d,actions:u,fetchModels:h,handleAddModel:f,deleteModel:v,ModelModal:ng,DataTable:Je,get getModelIcon(){return kt},CenteredContentView:Ze};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}}),lg={class:"flex justify-between items-center mb-6"},sg={class:"flex items-center gap-2"},ig=["src","alt"],dg={class:"text-sm text-neutral-600 dark:text-neutral-400 font-mono"},cg={key:0,class:"space-y-0.5"},ug=["title"],pg={class:"shrink-0 font-mono pr-2"},mg=["src","alt"],gg={class:"truncate"},fg={key:1,class:"text-neutral-400 dark:text-neutral-600 text-sm"};function hg(p,t,n,e,c,i){return a(),ee(e.CenteredContentView,null,{default:de(()=>[o("div",lg,[t[3]||(t[3]=o("h1",{class:"text-3xl font-bold"},"Models",-1)),o("button",{onClick:t[0]||(t[0]=()=>{e.modalMode="add",e.editingModel=null,e.showModal=!0}),class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"}," Add Model ")]),t[4]||(t[4]=o("p",{class:"text-neutral-600 dark:text-neutral-400 mb-8"}," Configure AI models from your connected providers. Models define which AI capabilities are available to your agents. ",-1)),C(e.DataTable,{columns:e.columns,data:e.models,actions:e.actions,loading:e.loading,"empty-message":"No models configured yet. Add your first model to get started."},{"cell-name":de(({value:r,row:d})=>[o("div",sg,[e.getModelIcon(d.model,d.provider)?(a(),s("img",{key:0,src:e.getModelIcon(d.model,d.provider),class:"w-5 h-5 shrink-0",alt:d.provider},null,8,ig)):l("v-if",!0),o("span",null,k(r),1)])]),"cell-model":de(({value:r})=>[o("span",dg,k(r||"—"),1)]),"cell-fallbacks":de(({value:r})=>[r&&r.length>0?(a(),s("div",cg,[(a(!0),s(X,null,ve(r,(d,u)=>(a(),s("div",{key:d.id,class:"text-sm text-neutral-600 dark:text-neutral-400 flex items-center",title:d.name},[o("span",pg,k(u===r.length-1?"└─":"├─"),1),e.getModelIcon(d.model,d.provider)?(a(),s("img",{key:0,src:e.getModelIcon(d.model,d.provider),class:"w-4 h-4 shrink-0 mr-1.5",alt:d.provider},null,8,mg)):l("v-if",!0),o("span",gg,k(d.name),1)],8,ug))),128))])):(a(),s("span",fg," None "))]),_:1},8,["data","loading"]),l(" Model Modal "),C(e.ModelModal,{modelValue:e.showModal,"onUpdate:modelValue":[t[1]||(t[1]=r=>e.showModal=r),t[2]||(t[2]=r=>{e.showModal=r,r||(e.editingModel=null,e.modalMode="add")})],"edit-model":e.editingModel,mode:e.modalMode,onSave:e.handleAddModel},null,8,["modelValue","edit-model","mode"])]),_:1})}const vg=ne(ag,[["render",hg],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/ModelsView.vue"]]),bg=ae({__name:"AddProviderModal",props:{modelValue:{type:Boolean,required:!0}},emits:["update:modelValue","save"],setup(p,{expose:t,emit:n}){t();const e=n,c=m({name:"",type:"",apiKey:"",baseUrl:""}),i=[{value:"openai",label:"OpenAI",icon:lt,sdk:"openai-sdk"},{value:"openrouter",label:"OpenRouter",icon:ft,sdk:"openrouter"}],r=b=>b==="openai-sdk"||b==="openai"?lt:b==="openrouter"?ft:null,d=m(!1),u=z(()=>i.find(b=>b.value===c.value.type)),h=()=>{setTimeout(()=>{d.value=!1},200)},f=m({});ce(()=>c.value.type,b=>{if(b&&!c.value.name){const S=i.find(M=>M.value===b);S&&(c.value.name=S.label)}});const v=z(()=>c.value.type==="custom"||c.value.type==="openai"),g=()=>{f.value={};let b=!0;return c.value.name||(f.value.name="Provider name is required",b=!1),c.value.type||(f.value.type="Provider type is required",b=!1),c.value.apiKey||(f.value.apiKey="API key is required",b=!1),v.value&&c.value.type==="custom"&&!c.value.baseUrl&&(f.value.baseUrl="Base URL is required for custom providers",b=!1),b},x=()=>{g()&&(e("save",{...c.value}),_(),e("update:modelValue",!1))},y=()=>{_(),e("update:modelValue",!1)},_=()=>{c.value={name:"",type:"",apiKey:""},f.value={}},T={emit:e,formData:c,providerTypes:i,getProviderIcon:r,isDropdownOpen:d,selectedProvider:u,handleDropdownBlur:h,errors:f,showBaseUrl:v,validateForm:g,handleSave:x,handleCancel:y,resetForm:_,Modal:Ne,TextInput:Ke};return Object.defineProperty(T,"__isScriptSetup",{enumerable:!1,value:!0}),T}}),yg={class:"space-y-4"},xg={class:"space-y-1"},kg={class:"relative"},_g={key:0,class:"flex items-center gap-2"},wg=["src","alt"],Cg={key:1,class:"text-neutral-500"},Sg={key:0,class:"absolute z-10 w-full mt-1 bg-white dark:bg-black border-2 border-black dark:border-neutral-300 rounded shadow-lg"},Tg=["onClick"],Mg=["src","alt"],Ig={key:0,class:"text-xs text-red-500 dark:text-red-400"};function Vg(p,t,n,e,c,i){return a(),ee(e.Modal,{"model-value":n.modelValue,"onUpdate:modelValue":t[4]||(t[4]=r=>p.$emit("update:modelValue",r)),title:"Add Provider",width:"max-w-md"},{footer:de(()=>[o("div",{class:"flex gap-2 justify-end"},[o("button",{onClick:e.handleCancel,class:"px-3 py-1.5 text-sm border border-black dark:border-white rounded font-medium hover:bg-black/5 dark:hover:bg-white/10 transition-colors"}," Cancel "),o("button",{onClick:e.handleSave,class:"px-3 py-1.5 text-sm bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"}," Add Provider ")])]),default:de(()=>[o("div",yg,[o("div",xg,[t[6]||(t[6]=o("label",{class:"block text-sm font-medium"},[ke(" Provider Type "),o("span",{class:"text-red-500"},"*")],-1)),o("div",kg,[o("button",{type:"button",onClick:t[0]||(t[0]=r=>e.isDropdownOpen=!e.isDropdownOpen),onBlur:e.handleDropdownBlur,class:$(["w-full px-3 py-2 bg-white dark:bg-black border rounded font-mono text-sm text-left focus:outline-none focus:ring-2 focus:ring-black dark:focus:ring-white transition-colors",[e.errors.type?"border-red-500 dark:border-red-400":"border-black dark:border-neutral-300"]])},[e.selectedProvider?(a(),s("div",_g,[o("img",{src:e.selectedProvider.icon,alt:e.selectedProvider.label,class:"w-5 h-5"},null,8,wg),o("span",null,k(e.selectedProvider.label),1)])):(a(),s("span",Cg,"Select a provider")),t[5]||(t[5]=o("div",{class:"absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none"},[o("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"})])],-1))],34),e.isDropdownOpen?(a(),s("div",Sg,[(a(),s(X,null,ve(e.providerTypes,r=>o("button",{key:r.value,type:"button",onClick:d=>{e.formData.type=r.value,e.isDropdownOpen=!1},class:"w-full px-3 py-2 text-left hover:bg-black/5 dark:hover:bg-white/10 transition-colors flex items-center gap-2"},[o("img",{src:r.icon,alt:r.label,class:"w-5 h-5"},null,8,Mg),o("span",null,k(r.label),1)],8,Tg)),64))])):l("v-if",!0)]),e.errors.type?(a(),s("p",Ig,k(e.errors.type),1)):l("v-if",!0)]),C(e.TextInput,{modelValue:e.formData.name,"onUpdate:modelValue":t[1]||(t[1]=r=>e.formData.name=r),label:"Provider Name",placeholder:"e.g., My OpenAI Provider",error:e.errors.name,required:""},null,8,["modelValue","error"]),C(e.TextInput,{modelValue:e.formData.apiKey,"onUpdate:modelValue":t[2]||(t[2]=r=>e.formData.apiKey=r),label:"API Key",type:"password",placeholder:"sk-...",error:e.errors.apiKey,required:""},null,8,["modelValue","error"]),e.showBaseUrl?(a(),ee(e.TextInput,{key:0,modelValue:e.formData.baseUrl,"onUpdate:modelValue":t[3]||(t[3]=r=>e.formData.baseUrl=r),label:"Base URL",placeholder:"https://api.example.com",error:e.errors.baseUrl,required:e.formData.type==="custom"},null,8,["modelValue","error","required"])):l("v-if",!0)])]),_:1},8,["model-value"])}const Lg=ne(bg,[["render",Vg],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/AddProviderModal.vue"]]),Pg=ae({__name:"ProvidersView",setup(p,{expose:t}){t();const n=m(!1),e=m([]),c=m(!1),i=[{key:"name",label:"Name",width:"w-1/3"},{key:"sdk",label:"SDK Type",width:"w-1/3",formatter:v=>({"openai-sdk":"OpenAI SDK",openrouter:"OpenRouter",openai:"OpenAI"})[v]||v},{key:"hasApiKey",label:"API Key",width:"w-1/3",formatter:v=>v?"✓ Configured":"✗ Not configured"}],r=[{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this provider? This action cannot be undone.",handler:async v=>{await h(v.name)}}],d=async()=>{c.value=!0;try{const v=await fetch(te("/api/providers"));if(!v.ok)throw new Error("Failed to fetch providers");const g=await v.json();e.value=g.providers||[]}catch(v){console.error("Error fetching providers:",v),e.value=[]}finally{c.value=!1}},u=async v=>{try{const g=await fetch(te("/api/providers"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)});if(!g.ok){const x=await g.json();alert(x.error||"Failed to add provider");return}await d(),n.value=!1}catch(g){console.error("Error adding provider:",g),alert("Failed to add provider")}},h=async v=>{try{const g=await fetch(te(`/api/providers/${encodeURIComponent(v)}`),{method:"DELETE"});if(!g.ok){const x=await g.json();x.modelCount?alert(`${x.error}
|
|
13
13
|
|
|
14
|
-
This provider has ${d.modelCount} associated model(s).`):alert(d.error||"Failed to delete provider");return}await r()}catch(s){console.error("Error deleting provider:",s),alert("Failed to delete provider")}};return xe(()=>{r()}),(b,s)=>(o(),ee(Ke,null,{default:de(()=>[e("div",Z1,[s[2]||(s[2]=e("h1",{class:"text-3xl font-bold"},"Providers",-1)),e("button",{onClick:s[0]||(s[0]=d=>i.value=!0),class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"}," Add Provider ")]),s[3]||(s[3]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-8"}," Manage API providers and authentication keys. All API keys are encrypted at rest. ",-1)),E(Fe,{columns:l,data:n.value,actions:c,loading:u.value,"empty-message":"No providers configured yet. Add your first provider to get started."},null,8,["data","loading"]),E(J1,{modelValue:i.value,"onUpdate:modelValue":s[1]||(s[1]=d=>i.value=d),onSave:p},null,8,["modelValue"])]),_:1}))}}),G1={class:"json-viewer overflow-auto"},X1=["innerHTML"],Y1=se({__name:"JsonViewer",props:{value:{}},setup(t){const i=t;function n(c){return c.replace(/"([^"\\]|\\.)*"/g,r=>`<span class="json-string">${u(r)}</span>`).replace(/\b(-?\d+\.?\d*)\b/g,'<span class="json-number">$1</span>').replace(/\b(true|false|null)\b/g,'<span class="json-boolean">$1</span>')}function u(c){return c.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const l=K(()=>{try{const c=JSON.stringify(i.value,null,2);return n(c)}catch{return u(String(i.value))}});return(c,r)=>(o(),a("div",G1,[e("pre",{class:"p-4 text-sm font-mono leading-relaxed",innerHTML:l.value},null,8,X1)]))}}),Q1=Ze(Y1,[["__scopeId","data-v-5118293b"]]),em={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function tm(t,i){return o(),a("svg",em,[...i[0]||(i[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"M12 16v-4m0-4h.01"})],-1)])])}const om=_e({name:"lucide-info",render:tm}),lm={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function am(t,i){return o(),a("svg",lm,[...i[0]||(i[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4m0 4h.01"},null,-1)])])}const Rt=_e({name:"lucide-triangle-alert",render:am}),sm={class:"mb-6 p-4 border border-black/20 dark:border-white/20 rounded bg-black/5 dark:bg-white/5"},nm={class:"flex items-start gap-3"},rm={class:"text-sm"},im={class:"font-medium mb-1"},dm={class:"px-1.5 py-0.5 bg-black/10 dark:bg-white/10 rounded font-mono text-xs"},um={id:"functions"},cm=["onClick"],pm={key:1,class:"text-left font-medium text-red-600 dark:text-red-400"},mm={key:2,class:"relative group"},vm={key:3,class:"relative group"},fm={class:"flex justify-end"},hm=["onClick"],gm={key:1,class:"text-neutral-400 text-sm"},bm={id:"prompts",class:"mt-12"},xm=["onClick"],ym={class:"text-neutral-600 dark:text-neutral-400"},km={class:"text-sm text-neutral-500 dark:text-neutral-400"},wm={id:"agents",class:"mt-12"},_m=["onClick"],$m={class:"text-neutral-600 dark:text-neutral-400"},Cm={class:"text-sm text-neutral-500 dark:text-neutral-400"},Vm={class:"flex items-center gap-2"},Sm={key:0,class:"space-y-4"},Tm={class:"text-lg font-medium mb-2"},Mm={class:"text-sm text-neutral-600 dark:text-neutral-400 mb-4"},Lm={key:0,class:"h-96 flex items-center justify-center border border-black/20 dark:border-white/20 rounded bg-black/5 dark:bg-white/5"},Im=se({__name:"ToolsView",setup(t){const i=v(null),n=v(!1),{data:u}=Ee(ae("/api/config")).json(),{data:l,error:c,isFetching:r,execute:p}=Ee(ae("/api/tools?type=tools"),{immediate:!1}).json(),{data:f,error:b,isFetching:s,execute:d}=Ee(ae("/api/tools?type=prompts&schema=true"),{immediate:!1}).json(),{data:h,error:$,isFetching:g,execute:m}=Ee(ae("/api/tools?type=agents&schema=true"),{immediate:!1}).json(),{data:w,error:k,isFetching:O,execute:D}=Ee(()=>i.value?ae(`/api/tools/${i.value.name}`):null,{immediate:!1}).json(),F=v([]),X=v([]),te=v([]),R=ze(),j=async()=>{const A=R.hash;if(A){await ge();const I=document.getElementById(A.slice(1));I&&I.scrollIntoView({behavior:"smooth"})}};ue(()=>R.hash,j);const W=async A=>{i.value=A,await D(),w.value?i.value={...A,schema:w.value.schema||null}:k.value&&console.error("Error fetching tool schema:",k.value),n.value=!0},B=async A=>{if(i.value=A,n.value=!0,!A.schema&&A.type==="prompt"){const I=await fetch(ae("/api/tools?type=prompts&schema=true"));if(I.ok){const M=await I.json();M[A.name]&&(i.value={...A,schema:M[A.name].schema||null})}}},N=[{key:"name",label:"Prompt Name",width:"w-1/3"},{key:"description",label:"Description",width:"w-1/2"},{key:"model",label:"Model",width:"w-1/6"}],U=[{key:"name",label:"Tool Name",width:"w-1/3"},{key:"description",label:"Description",width:"w-1/2"},{key:"actions",label:"Actions",width:"w-1/6"}],y=A=>/^[a-z][a-z0-9_]*[a-z0-9]$/.test(A)||/^[a-z]$/.test(A),x=A=>A.hasError&&A.error?A.error:A.description||"No description available",V=()=>{l.value&&(F.value=Object.entries(l.value).map(([A,I])=>({name:A,description:I.description||"No description available",schema:null,hasError:I.hasError||!1,error:I.error,type:I.type||"tool"})))},_=()=>{f.value&&(X.value=Object.entries(f.value).map(([A,I])=>({name:A,description:I.description||"No description available",schema:I.schema||null,hasError:!1,type:"prompt",model:I.model})))},T=()=>{h.value&&(te.value=Object.entries(h.value).map(([A,I])=>({name:A,description:I.description||"No description available",schema:I.schema||null,hasError:!1,type:"agent",model:I.model})))},S=async()=>{await p(),V()},P=async()=>{await d(),_()},J=async()=>{await m(),T()},re=()=>{n.value=!1,i.value=null};return xe(()=>{S(),P(),J(),j()}),(A,I)=>(o(),ee(Ke,null,{default:de(()=>[I[11]||(I[11]=e("div",{class:"flex justify-between items-center mb-6"},[e("h1",{class:"text-3xl font-bold"},"Tools")],-1)),I[12]||(I[12]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-6"}," Tools are the fundamental building blocks of how your business logic is exposed to your agents. Your prompts can expose tools for the agents to call. There are 3 types of tools: functions, prompts, and agents. Functions are actual code in your AgentKit codebase. Prompts are any prompts created in the prompts table (which can themselves expose tools). Agents are multi-turn conversations that can be invoked as tools. ",-1)),e("div",sm,[e("div",nm,[E(Z(om),{class:"w-5 h-5 mt-0.5 text-black/60 dark:text-white/60 flex-shrink-0"}),e("div",rm,[e("p",im,[I[1]||(I[1]=ye(" To create or modify tools, edit the ",-1)),e("code",dm,C(Z(u)?.toolsDir||"agentbuilder/tools")+"/",1),I[2]||(I[2]=ye(" directory of your codebase. ",-1))]),I[3]||(I[3]=e("p",{class:"text-black/70 dark:text-white/70"}," Changes will be automatically detected. ",-1))])])]),e("div",um,[E(Fe,{columns:U,data:F.value,loading:Z(r),"empty-message":`No tools found. Add tool files to the ${Z(u)?.toolsDir||"agentbuilder/tools"}/ directory.`},{"cell-name":de(({row:M})=>[e("div",{class:le(["flex items-center gap-2",{"text-red-600 dark:text-red-400":M.hasError}])},[M.hasError?(o(),a("span",pm,C(M.name),1)):(o(),a("button",{key:0,onClick:oe=>W(M),class:"text-left font-medium hover:text-black/70 dark:hover:text-white/70 transition-colors underline decoration-transparent hover:decoration-current"},C(M.name),9,cm)),M.hasError?(o(),a("div",mm,[E(Z(Rt),{class:"w-4 h-4 text-red-500"}),I[4]||(I[4]=e("div",{class:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-3 py-2 bg-black dark:bg-white text-white dark:text-black text-xs rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10"},[ye(" This tool has validation errors "),e("div",{class:"absolute top-full left-1/2 transform -translate-x-1/2 border-4 border-transparent border-t-black dark:border-t-white"})],-1))])):y(M.name)?L("",!0):(o(),a("div",vm,[E(Z(Rt),{class:"w-4 h-4 text-amber-500"}),I[5]||(I[5]=e("div",{class:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-3 py-2 bg-black dark:bg-white text-white dark:text-black text-xs rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10"},[ye(" Tool name should be in snake_case format (e.g., 'log_name', 'send_email') "),e("div",{class:"absolute top-full left-1/2 transform -translate-x-1/2 border-4 border-transparent border-t-black dark:border-t-white"})],-1))]))],2)]),"cell-description":de(({row:M})=>[e("span",{class:le({"text-red-600 dark:text-red-400":M.hasError,"text-neutral-600 dark:text-neutral-400":!M.hasError})},C(x(M)),3)]),"cell-actions":de(({row:M})=>[e("div",fm,[M.hasError?(o(),a("span",gm,"—")):(o(),a("button",{key:0,onClick:oe=>W(M),class:"p-1.5 rounded hover:bg-black/10 dark:hover:bg-white/10 transition-colors",title:"View Schema"},[E(Z(kt),{class:"w-4 h-4"})],8,hm))])]),_:1},8,["data","loading","empty-message"])]),e("div",bm,[I[6]||(I[6]=e("h2",{class:"text-2xl font-bold mb-4"},"Prompts",-1)),I[7]||(I[7]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-6"}," Prompts that are exposed as tools can be called by other prompts and agents. These allow you to create reusable, composable prompt chains. ",-1)),E(Fe,{columns:N,data:X.value,loading:Z(s),"empty-message":"No prompts are currently exposed as tools. Mark a prompt as 'Expose as tool' to see it here."},{"cell-name":de(({row:M})=>[e("button",{onClick:oe=>B(M),class:"text-left font-medium hover:text-black/70 dark:hover:text-white/70 transition-colors underline decoration-transparent hover:decoration-current"},C(M.name),9,xm)]),"cell-description":de(({row:M})=>[e("span",ym,C(M.description),1)]),"cell-model":de(({row:M})=>[e("span",km,C(M.model||"-"),1)]),_:1},8,["data","loading"])]),e("div",wm,[I[8]||(I[8]=e("h2",{class:"text-2xl font-bold mb-4"},"Agents",-1)),I[9]||(I[9]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-6"}," Agents that are exposed as tools can be called by other prompts and agents. When an agent is called as a tool, it uses the Side A system prompt's requirements as the tool's input schema. ",-1)),E(Fe,{columns:N,data:te.value,loading:Z(g),"empty-message":"No agents are currently exposed as tools. Mark an agent as 'Expose as tool' to see it here."},{"cell-name":de(({row:M})=>[e("button",{onClick:oe=>B(M),class:"text-left font-medium hover:text-black/70 dark:hover:text-white/70 transition-colors underline decoration-transparent hover:decoration-current"},C(M.name),9,_m)]),"cell-description":de(({row:M})=>[e("span",$m,C(M.description),1)]),"cell-model":de(({row:M})=>[e("span",Cm,C(M.model||"-"),1)]),_:1},8,["data","loading"])]),E(je,{modelValue:n.value,"onUpdate:modelValue":I[0]||(I[0]=M=>n.value=M),onClose:re,width:"max-w-4xl"},{header:de(()=>[e("div",Vm,[E(Z(kt),{class:"w-5 h-5"}),e("span",null,C(i.value?.name)+" Schema",1)])]),footer:de(()=>[e("button",{onClick:re,class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"}," Close ")]),default:de(()=>[i.value?(o(),a("div",Sm,[e("div",null,[e("h3",Tm,C(i.value.type==="prompt"?"Required Schema":"JSON Schema"),1),e("p",Mm,C(i.value.type==="prompt"?"This is the JSON schema that defines the input parameters for this prompt.":"This is the automatically generated JSON schema for the tool's arguments."),1)]),i.value.schema===null?(o(),a("div",Lm,[...I[10]||(I[10]=[e("p",{class:"text-neutral-500 dark:text-neutral-400"}," No parameters required ",-1)])])):(o(),ee(Q1,{key:1,value:i.value.schema,class:"h-96 border border-black/20 dark:border-white/20 rounded"},null,8,["value"]))])):L("",!0)]),_:1},8,["modelValue"])]),_:1}))}}),Em={class:"flex justify-between items-center mb-6"},Am={class:"flex justify-end gap-2 mt-4"},Pm={class:"flex justify-end gap-2 mt-4"},Om=se({__name:"UsersView",setup(t){const i=v(!1),n=v(!1),u=v([]),l=v(!1),c=v(null),r=v({username:"",password:"",role:"admin"}),p=v({username:"",password:"",role:"admin"}),f=[{value:"admin",label:"Admin"}],b=[{key:"username",label:"Username",width:"w-1/3"},{key:"role",label:"Role",width:"w-1/4"},{key:"created_at",label:"Created",width:"w-1/3",formatter:m=>new Date(m*1e3).toLocaleString()}],s=[{icon:"edit",label:"Edit",handler:async m=>{c.value=m,p.value={username:m.username,password:"",role:m.role},n.value=!0}},{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this user? This action cannot be undone.",handler:async m=>{await g(m.id)}}],d=async()=>{l.value=!0;try{const m=await qe("/users");if(!m.ok)throw new Error("Failed to fetch users");const w=await m.json();u.value=w.users||[]}catch(m){console.error("Error fetching users:",m),u.value=[]}finally{l.value=!1}},h=async()=>{if(!r.value.username||!r.value.password){alert("Username and password are required");return}try{const m=await qe("/users",{method:"POST",body:JSON.stringify(r.value)});if(!m.ok){const w=await m.json();alert(w.error||"Failed to add user");return}await d(),i.value=!1,r.value={username:"",password:"",role:"admin"}}catch(m){console.error("Error adding user:",m),alert("Failed to add user")}},$=async()=>{if(!p.value.username){alert("Username is required");return}try{const m={username:p.value.username,role:p.value.role};p.value.password&&(m.password=p.value.password);const w=await qe(`/users/${c.value.id}`,{method:"PUT",body:JSON.stringify(m)});if(!w.ok){const k=await w.json();alert(k.error||"Failed to update user");return}await d(),n.value=!1,c.value=null}catch(m){console.error("Error updating user:",m),alert("Failed to update user")}},g=async m=>{try{const w=await qe(`/users/${m}`,{method:"DELETE"});if(!w.ok){const k=await w.json();alert(k.error||"Failed to delete user");return}await d()}catch(w){console.error("Error deleting user:",w),alert("Failed to delete user")}};return xe(()=>{d()}),(m,w)=>(o(),ee(Ke,null,{default:de(()=>[e("div",Em,[w[13]||(w[13]=e("div",null,[e("h1",{class:"text-3xl font-bold"},"Users"),e("p",{class:"text-neutral-600 dark:text-neutral-400 mt-2"}," Manage user accounts and permissions ")],-1)),e("button",{onClick:w[0]||(w[0]=k=>i.value=!0),class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded hover:bg-black/80 dark:hover:bg-white/80 font-medium"}," Add User ")]),E(Fe,{columns:b,data:u.value,actions:s,loading:l.value,"empty-message":"No users found"},null,8,["data","loading"]),E(je,{modelValue:i.value,"onUpdate:modelValue":w[5]||(w[5]=k=>i.value=k),title:"Add User",onClose:w[6]||(w[6]=k=>i.value=!1)},{default:de(()=>[e("form",{onSubmit:we(h,["prevent"]),class:"space-y-4"},[e("div",null,[w[14]||(w[14]=e("label",{class:"block text-sm font-medium mb-1"},"Username",-1)),Se(e("input",{"onUpdate:modelValue":w[1]||(w[1]=k=>r.value.username=k),type:"text",required:"",class:"w-full px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700"},null,512),[[Oe,r.value.username]])]),e("div",null,[w[15]||(w[15]=e("label",{class:"block text-sm font-medium mb-1"},"Password",-1)),Se(e("input",{"onUpdate:modelValue":w[2]||(w[2]=k=>r.value.password=k),type:"password",required:"",class:"w-full px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700"},null,512),[[Oe,r.value.password]])]),e("div",null,[E(he,{modelValue:r.value.role,"onUpdate:modelValue":w[3]||(w[3]=k=>r.value.role=k),options:f,label:"Role",placeholder:"Select role"},null,8,["modelValue"])]),e("div",Am,[e("button",{type:"button",onClick:w[4]||(w[4]=k=>i.value=!1),class:"px-4 py-2 border border-neutral-300 dark:border-neutral-600 rounded hover:bg-neutral-50 dark:hover:bg-neutral-700"}," Cancel "),w[16]||(w[16]=e("button",{type:"submit",class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded hover:bg-black/80 dark:hover:bg-white/80 font-medium"}," Add User ",-1))])],32)]),_:1},8,["modelValue"]),E(je,{modelValue:n.value,"onUpdate:modelValue":w[11]||(w[11]=k=>n.value=k),title:"Edit User",onClose:w[12]||(w[12]=k=>n.value=!1)},{default:de(()=>[e("form",{onSubmit:we($,["prevent"]),class:"space-y-4"},[e("div",null,[w[17]||(w[17]=e("label",{class:"block text-sm font-medium mb-1"},"Username",-1)),Se(e("input",{"onUpdate:modelValue":w[7]||(w[7]=k=>p.value.username=k),type:"text",required:"",class:"w-full px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700"},null,512),[[Oe,p.value.username]])]),e("div",null,[w[18]||(w[18]=e("label",{class:"block text-sm font-medium mb-1"},"Password (leave blank to keep current)",-1)),Se(e("input",{"onUpdate:modelValue":w[8]||(w[8]=k=>p.value.password=k),type:"password",class:"w-full px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700"},null,512),[[Oe,p.value.password]])]),e("div",null,[E(he,{modelValue:p.value.role,"onUpdate:modelValue":w[9]||(w[9]=k=>p.value.role=k),options:f,label:"Role",placeholder:"Select role"},null,8,["modelValue"])]),e("div",Pm,[e("button",{type:"button",onClick:w[10]||(w[10]=k=>n.value=!1),class:"px-4 py-2 border border-neutral-300 dark:border-neutral-600 rounded hover:bg-neutral-50 dark:hover:bg-neutral-700"}," Cancel "),w[19]||(w[19]=e("button",{type:"submit",class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded hover:bg-black/80 dark:hover:bg-white/80 font-medium"}," Update User ",-1))])],32)]),_:1},8,["modelValue"])]),_:1}))}}),jm={class:"flex justify-between items-center mb-6"},Dm={class:"flex justify-end gap-2 mt-4"},Um={class:"space-y-4"},Rm={class:"flex gap-2"},Nm=["value"],Bm={class:"bg-accent-50 dark:bg-accent-900/30 border border-accent-200 dark:border-accent-800 text-accent-800 dark:text-accent-400 px-4 py-3 rounded"},qm={class:"block mt-2 bg-white dark:bg-neutral-800 px-3 py-2 rounded text-xs"},Fm={class:"flex justify-end mt-4"},zm=se({__name:"ApiKeysView",setup(t){const i=v(!1),n=v(!1),u=v([]),l=v(!1),c=v(""),r=v({name:""}),p=[{key:"name",label:"Name",width:"w-1/3"},{key:"keyPreview",label:"API Key",width:"w-1/3",html:!0,formatter:$=>`<code class="bg-neutral-100 dark:bg-neutral-800 px-2 py-1 rounded text-sm">${$}</code>`},{key:"createdAt",label:"Created",width:"w-1/6",formatter:$=>new Date($*1e3).toLocaleDateString()},{key:"lastUsedAt",label:"Last Used",width:"w-1/6",formatter:$=>$?new Date($*1e3).toLocaleDateString():"Never"}],f=[{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this API key? This action cannot be undone.",handler:async $=>{await d($.id)}}],b=async()=>{l.value=!0;try{const $=await qe("/api-keys");if(!$.ok)throw new Error("Failed to fetch API keys");const g=await $.json();u.value=(g.keys||[]).map(m=>({...m,keyPreview:`${m.key_prefix}...${m.last_five}`,createdAt:m.created_at,lastUsedAt:m.last_used_at}))}catch($){console.error("Error fetching API keys:",$),u.value=[]}finally{l.value=!1}},s=async()=>{if(!r.value.name){alert("Name is required");return}try{const $=await qe("/api-keys",{method:"POST",body:JSON.stringify(r.value)}),g=await $.json();if(!$.ok){alert(g.error||"Failed to create API key");return}c.value=g.key,i.value=!1,n.value=!0,await b(),r.value={name:""}}catch($){console.error("Error creating API key:",$),alert("Failed to create API key")}},d=async $=>{try{const g=await qe(`/api-keys/${$}`,{method:"DELETE"});if(!g.ok){const m=await g.json();alert(m.error||"Failed to delete API key");return}await b()}catch(g){console.error("Error deleting API key:",g),alert("Failed to delete API key")}},h=async $=>{try{await navigator.clipboard.writeText($),alert("API key copied to clipboard!")}catch(g){console.error("Failed to copy:",g)}};return xe(()=>{b()}),($,g)=>(o(),ee(Ke,null,{default:de(()=>[e("div",jm,[g[9]||(g[9]=e("div",null,[e("h1",{class:"text-3xl font-bold"},"API Keys"),e("p",{class:"text-neutral-600 dark:text-neutral-400 mt-2"}," Manage API keys for programmatic access ")],-1)),e("button",{onClick:g[0]||(g[0]=m=>i.value=!0),class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded hover:bg-black/80 dark:hover:bg-white/80 font-medium"}," Create API Key ")]),E(Fe,{columns:p,data:u.value,actions:f,loading:l.value,"empty-message":"No API keys found"},null,8,["data","loading"]),E(je,{modelValue:i.value,"onUpdate:modelValue":g[3]||(g[3]=m=>i.value=m),title:"Create API Key",onClose:g[4]||(g[4]=m=>i.value=!1)},{default:de(()=>[e("form",{onSubmit:we(s,["prevent"]),class:"space-y-4"},[e("div",null,[g[10]||(g[10]=e("label",{class:"block text-sm font-medium mb-1"},"Name",-1)),Se(e("input",{"onUpdate:modelValue":g[1]||(g[1]=m=>r.value.name=m),type:"text",required:"",placeholder:"e.g., Production API Key",class:"w-full px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700"},null,512),[[Oe,r.value.name]]),g[11]||(g[11]=e("p",{class:"text-sm text-neutral-500 dark:text-neutral-400 mt-1"}," A descriptive name to help you identify this key ",-1))]),e("div",Dm,[e("button",{type:"button",onClick:g[2]||(g[2]=m=>i.value=!1),class:"px-4 py-2 border border-neutral-300 dark:border-neutral-600 rounded hover:bg-neutral-50 dark:hover:bg-neutral-700"}," Cancel "),g[12]||(g[12]=e("button",{type:"submit",class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded hover:bg-black/80 dark:hover:bg-white/80 font-medium"}," Create Key ",-1))])],32)]),_:1},8,["modelValue"]),E(je,{modelValue:n.value,"onUpdate:modelValue":g[7]||(g[7]=m=>n.value=m),title:"API Key Created",onClose:g[8]||(g[8]=m=>n.value=!1)},{default:de(()=>[e("div",Um,[g[15]||(g[15]=e("div",{class:"bg-yellow-50 dark:bg-yellow-900/30 border border-yellow-200 dark:border-yellow-800 text-yellow-800 dark:text-yellow-400 px-4 py-3 rounded"},[e("p",{class:"font-semibold"},"Important: Save this key now!"),e("p",{class:"text-sm mt-1"}," You won't be able to see it again. If you lose this key, you'll need to create a new one. ")],-1)),e("div",null,[g[13]||(g[13]=e("label",{class:"block text-sm font-medium mb-2"},"Your new API key:",-1)),e("div",Rm,[e("input",{value:c.value,type:"text",readonly:"",class:"flex-1 px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700 font-mono text-sm"},null,8,Nm),e("button",{onClick:g[5]||(g[5]=m=>h(c.value)),class:"px-4 py-2 bg-neutral-200 dark:bg-neutral-700 rounded hover:bg-neutral-300 dark:hover:bg-neutral-600"}," Copy ")])]),e("div",Bm,[g[14]||(g[14]=e("p",{class:"text-sm"}," Use this key in the Authorization header of your API requests: ",-1)),e("code",qm," Authorization: Bearer "+C(c.value),1)]),e("div",Fm,[e("button",{onClick:g[6]||(g[6]=m=>n.value=!1),class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded hover:bg-black/80 dark:hover:bg-white/80 font-medium"}," Done ")])])]),_:1},8,["modelValue"])]),_:1}))}}),Hm={class:"login-container flex-1 flex items-center justify-center px-4"},Wm={class:"max-w-md w-full space-y-8"},Jm={class:"flex justify-center"},Zm=["src"],Km={class:"bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-700 py-8 px-6 rounded-lg"},Gm={key:0,class:"bg-red-50 dark:bg-red-950 border border-red-500 text-red-700 dark:text-red-400 px-4 py-3"},Xm=["disabled"],Ym={key:0,class:"mt-6"},Qm=se({__name:"LoginView",setup(t){function i(k){if(k.startsWith("/src/")||k.startsWith("data:"))return k;const O=ot();return O==="/"?k.replace("/agents/","/"):k.replace("/agents/",`${O}/`)}const n=i(Xt),u=i(Yt),l=et(),c=ze(),r=v(""),p=v(""),f=v(""),b=v(!1),s=v(!1),d=v(!1),h=v(!1),$=K(()=>h.value?u:n);xe(async()=>{const k=localStorage.getItem("theme");h.value=k==="dark"||!k&&window.matchMedia("(prefers-color-scheme: dark)").matches;const O=c.query.token,D=c.query.error;if(O){localStorage.setItem("auth_token",O),l.push("/");return}D&&(D==="oauth_failed"?f.value="OAuth authentication failed. Please try again.":D==="oauth_not_configured"&&(f.value="OAuth provider is not configured."));try{const F=await fetch(ae("/api/auth/config"));if(F.ok){const X=await F.json();s.value=X.github||!1,d.value=X.google||!1}}catch(F){console.error("Failed to fetch auth config:",F)}});async function g(){f.value="",b.value=!0;try{const k=await fetch(ae("/api/auth/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r.value,password:p.value})}),O=await k.json();k.ok?(localStorage.setItem("auth_token",O.token),l.push("/")):f.value=O.error||"Login failed"}catch{f.value="Network error. Please try again."}finally{b.value=!1}}function m(){window.location.href=ae("/api/auth/oauth/github")}function w(){window.location.href=ae("/api/auth/oauth/google")}return(k,O)=>(o(),a("div",Hm,[e("div",Wm,[e("div",Jm,[e("img",{src:$.value,alt:"AgentBuilder",class:"h-16 pointer-events-none select-none"},null,8,Zm)]),E(tt,{offsetX:8,offsetY:8,intensity:.2,pattern:"crosshatch"},{default:de(()=>[e("div",Km,[e("form",{class:"space-y-6",onSubmit:we(g,["prevent"])},[f.value?(o(),a("div",Gm,C(f.value),1)):L("",!0),E(Ce,{modelValue:r.value,"onUpdate:modelValue":O[0]||(O[0]=D=>r.value=D),label:"Username",type:"text",disabled:b.value,placeholder:"Enter your username"},null,8,["modelValue","disabled"]),E(Ce,{modelValue:p.value,"onUpdate:modelValue":O[1]||(O[1]=D=>p.value=D),label:"Password",type:"password",disabled:b.value,placeholder:"Enter your password"},null,8,["modelValue","disabled"]),e("div",null,[e("button",{type:"submit",disabled:b.value,class:"w-full px-4 py-2.5 bg-neutral-900 text-white dark:bg-neutral-100 dark:text-neutral-900 rounded-md font-medium hover:bg-neutral-800 dark:hover:bg-neutral-200 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},C(b.value?"Signing in...":"Sign in"),9,Xm)])],32),s.value||d.value?(o(),a("div",Ym,[O[4]||(O[4]=e("div",{class:"relative"},[e("div",{class:"absolute inset-0 flex items-center"},[e("div",{class:"w-full border-t border-neutral-300 dark:border-neutral-600"})]),e("div",{class:"relative flex justify-center text-sm"},[e("span",{class:"px-2 bg-white dark:bg-neutral-900 text-neutral-500 dark:text-neutral-400"},"Or continue with")])],-1)),e("div",{class:le(["mt-6 grid gap-3",s.value&&d.value?"grid-cols-2":"grid-cols-1"])},[s.value?(o(),a("button",{key:0,onClick:m,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2.5 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 rounded-md font-medium hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors"},[...O[2]||(O[2]=[e("svg",{class:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"fill-rule":"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z","clip-rule":"evenodd"})],-1),e("span",{class:"ml-2"},"GitHub",-1)])])):L("",!0),d.value?(o(),a("button",{key:1,onClick:w,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2.5 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 rounded-md font-medium hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors"},[...O[3]||(O[3]=[e("svg",{class:"h-5 w-5",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),e("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e("path",{fill:"currentColor",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})],-1),e("span",{class:"ml-2"},"Google",-1)])])):L("",!0)],2)])):L("",!0)])]),_:1})])]))}}),ev={class:"space-y-1"},tv={key:0,class:"block text-sm font-medium"},ov={key:0,class:"text-red-500"},lv=["value","placeholder","disabled"],av={key:1,class:"text-xs text-red-500 dark:text-red-400"},gt=se({__name:"MultilineInput",props:{modelValue:{},label:{},placeholder:{},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","focus","blur"],setup(t,{expose:i,emit:n}){const u=t,l=n,c=v(null),r=K(()=>["w-full px-3 py-2 bg-white dark:bg-black border rounded font-mono text-sm","focus:outline-none focus:ring-2 focus:ring-black dark:focus:ring-white","transition-colors resize-none overflow-hidden",u.error?"border-red-500 dark:border-red-400":"border-black dark:border-neutral-300",u.disabled?"opacity-50 cursor-not-allowed":""]),p=()=>{const d=c.value;d&&(d.style.height="auto",d.style.height=`${d.scrollHeight+2}px`)},f=d=>{const h=d.target;l("update:modelValue",h.value),p()},b=d=>{l("focus",d)},s=d=>{l("blur",d)};return xe(()=>{p()}),ue(()=>u.modelValue,async()=>{await ge(),p()}),i({textareaRef:c,adjustHeight:p}),(d,h)=>(o(),a("div",ev,[t.label?(o(),a("label",tv,[ye(C(t.label)+" ",1),t.required?(o(),a("span",ov,"*")):L("",!0)])):L("",!0),e("textarea",{ref_key:"textareaRef",ref:c,value:t.modelValue,placeholder:t.placeholder,disabled:t.disabled,class:le(r.value),rows:"1",onInput:f,onFocus:b,onBlur:s},null,42,lv),t.error?(o(),a("p",av,C(t.error),1)):L("",!0)]))}}),sv={class:"p-8 space-y-6"},nv={class:"mt-12"},rv={class:"mb-6"},iv={class:"mb-6"},dv={class:"mb-6"},uv={class:"mt-8"},cv={class:"border-2 border-red-500 p-4 h-32 overflow-hidden relative"},pv={class:"mt-12"},mv={class:"mb-6"},vv={class:"border-2 border-accent-500 p-4 h-32 overflow-hidden relative"},fv={class:"mt-12"},hv={class:"mb-6"},gv={class:"mb-6"},bv={class:"mt-12"},xv={class:"mb-6"},yv={class:"mt-2 text-sm"},kv={class:"mb-6"},wv={class:"mt-2 text-sm"},_v={class:"mb-6"},$v={class:"mb-6"},Cv={class:"mt-12"},Vv={class:"mb-6"},Sv={class:"mt-4 p-4 bg-neutral-100 dark:bg-neutral-900 rounded"},Tv={class:"text-xs overflow-x-auto"},Mv=se({__name:"TestView",setup(t){const i=v(""),n=v(""),u=v(""),l=v(`Line 1
|
|
14
|
+
This provider has ${x.modelCount} associated model(s).`):alert(x.error||"Failed to delete provider");return}await d()}catch(g){console.error("Error deleting provider:",g),alert("Failed to delete provider")}};xe(()=>{d()});const f={showAddModal:n,providers:e,loading:c,columns:i,actions:r,fetchProviders:d,handleAddProvider:u,deleteProvider:h,AddProviderModal:Lg,DataTable:Je,CenteredContentView:Ze};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),Ag={class:"flex justify-between items-center mb-6"};function Eg(p,t,n,e,c,i){return a(),ee(e.CenteredContentView,null,{default:de(()=>[o("div",Ag,[t[2]||(t[2]=o("h1",{class:"text-3xl font-bold"},"Providers",-1)),o("button",{onClick:t[0]||(t[0]=r=>e.showAddModal=!0),class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"}," Add Provider ")]),t[3]||(t[3]=o("p",{class:"text-neutral-600 dark:text-neutral-400 mb-8"}," Manage API providers and authentication keys. All API keys are encrypted at rest. ",-1)),C(e.DataTable,{columns:e.columns,data:e.providers,actions:e.actions,loading:e.loading,"empty-message":"No providers configured yet. Add your first provider to get started."},null,8,["data","loading"]),l(" Add Provider Modal "),C(e.AddProviderModal,{modelValue:e.showAddModal,"onUpdate:modelValue":t[1]||(t[1]=r=>e.showAddModal=r),onSave:e.handleAddProvider},null,8,["modelValue"])]),_:1})}const Og=ne(Pg,[["render",Eg],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/ProvidersView.vue"]]),jg=ae({__name:"JsonViewer",props:{value:{type:null,required:!0}},setup(p,{expose:t}){t();const n=p;function e(d){return d.replace(/"([^"\\]|\\.)*"/g,u=>`<span class="json-string">${c(u)}</span>`).replace(/\b(-?\d+\.?\d*)\b/g,'<span class="json-number">$1</span>').replace(/\b(true|false|null)\b/g,'<span class="json-boolean">$1</span>')}function c(d){return d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const i=z(()=>{try{const d=JSON.stringify(n.value,null,2);return e(d)}catch{return c(String(n.value))}}),r={props:n,highlightJson:e,escapeHtml:c,formattedJson:i};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),Dg={class:"json-viewer overflow-auto"},qg=["innerHTML"];function Ug(p,t,n,e,c,i){return a(),s("div",Dg,[o("pre",{class:"p-4 text-sm font-mono leading-relaxed",innerHTML:e.formattedJson},null,8,qg)])}const Bg=ne(jg,[["render",Ug],["__scopeId","data-v-01a533a8"],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/JsonViewer.vue"]]),Rg={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ng(p,t){return a(),s("svg",Rg,[...t[0]||(t[0]=[o("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o("circle",{cx:"12",cy:"12",r:"10"}),o("path",{d:"M12 16v-4m0-4h.01"})],-1)])])}const Fg=Se({name:"lucide-info",render:Ng}),Hg={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zg(p,t){return a(),s("svg",Hg,[...t[0]||(t[0]=[o("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4m0 4h.01"},null,-1)])])}const Wg=Se({name:"lucide-triangle-alert",render:zg}),Jg=ae({__name:"ToolsView",setup(p,{expose:t}){t();const n=m(null),e=m(!1),{data:c}=Ve(te("/api/config")).json(),{data:i,error:r,isFetching:d,execute:u}=Ve(te("/api/tools?type=tools"),{immediate:!1}).json(),{data:h,error:f,isFetching:v,execute:g}=Ve(te("/api/tools?type=prompts&schema=true"),{immediate:!1}).json(),{data:x,error:y,isFetching:_,execute:T}=Ve(te("/api/tools?type=agents&schema=true"),{immediate:!1}).json(),{data:b,error:S,isFetching:M,execute:L}=Ve(()=>n.value?te(`/api/tools/${n.value.name}`):null,{immediate:!1}).json(),O=m([]),B=m([]),H=m([]),re=Fe(),Q=async()=>{const G=re.hash;if(G){await be();const se=document.getElementById(G.slice(1));se&&se.scrollIntoView({behavior:"smooth"})}};ce(()=>re.hash,Q);const q=async G=>{n.value=G,await L(),b.value?n.value={...G,schema:b.value.schema||null}:S.value&&console.error("Error fetching tool schema:",S.value),e.value=!0},K=async G=>{if(n.value=G,e.value=!0,!G.schema&&G.type==="prompt"){const se=await fetch(te("/api/tools?type=prompts&schema=true"));if(se.ok){const he=await se.json();he[G.name]&&(n.value={...G,schema:he[G.name].schema||null})}}},R=[{key:"name",label:"Prompt Name",width:"w-1/3"},{key:"description",label:"Description",width:"w-1/2"},{key:"model",label:"Model",width:"w-1/6"}],Y=[{key:"name",label:"Tool Name",width:"w-1/3"},{key:"description",label:"Description",width:"w-1/2"},{key:"actions",label:"Actions",width:"w-1/6"}],E=G=>/^[a-z][a-z0-9_]*[a-z0-9]$/.test(G)||/^[a-z]$/.test(G),N=G=>G.hasError&&G.error?G.error:G.description||"No description available",w=()=>{i.value&&(O.value=Object.entries(i.value).map(([G,se])=>({name:G,description:se.description||"No description available",schema:null,hasError:se.hasError||!1,error:se.error,type:se.type||"tool"})))},I=()=>{h.value&&(B.value=Object.entries(h.value).map(([G,se])=>({name:G,description:se.description||"No description available",schema:se.schema||null,hasError:!1,type:"prompt",model:se.model})))},A=()=>{x.value&&(H.value=Object.entries(x.value).map(([G,se])=>({name:G,description:se.description||"No description available",schema:se.schema||null,hasError:!1,type:"agent",model:se.model})))},V=async()=>{await u(),w()},P=async()=>{await g(),I()},U=async()=>{await T(),A()},D=()=>{e.value=!1,n.value=null};xe(()=>{V(),P(),U(),Q()});const W={selectedTool:n,showSchemaModal:e,configData:c,toolsData:i,error:r,isFetching:d,execute:u,promptsData:h,promptsError:f,isFetchingPrompts:v,executePrompts:g,agentsData:x,agentsError:y,isFetchingAgents:_,executeAgents:T,toolSchemaData:b,toolSchemaError:S,isFetchingSchema:M,executeToolSchema:L,tools:O,prompts:B,agents:H,route:re,scrollToHash:Q,openSchema:q,openPromptSchema:K,promptColumns:R,columns:Y,isSnakeCase:E,getDescription:N,processToolsData:w,processPromptsData:I,processAgentsData:A,fetchTools:V,fetchPrompts:P,fetchAgents:U,closeModal:D,DataTable:Je,Modal:Ne,JsonViewer:Bg,get IconInfo(){return Fg},get IconEye(){return Gt},get IconTriangleAlert(){return Wg},CenteredContentView:Ze};return Object.defineProperty(W,"__isScriptSetup",{enumerable:!1,value:!0}),W}}),Kg={class:"mb-6 p-4 border border-black/20 dark:border-white/20 rounded bg-black/5 dark:bg-white/5"},Zg={class:"flex items-start gap-3"},Gg={class:"text-sm"},Xg={class:"font-medium mb-1"},Yg={class:"px-1.5 py-0.5 bg-black/10 dark:bg-white/10 rounded font-mono text-xs"},Qg={id:"functions"},$g=["onClick"],ef={key:1,class:"text-left font-medium text-red-600 dark:text-red-400"},tf={key:2,class:"relative group"},of={key:3,class:"relative group"},rf={class:"flex justify-end"},nf=["onClick"],af={key:1,class:"text-neutral-400 text-sm"},lf={id:"prompts",class:"mt-12"},sf=["onClick"],df={class:"text-neutral-600 dark:text-neutral-400"},cf={class:"text-sm text-neutral-500 dark:text-neutral-400"},uf={id:"agents",class:"mt-12"},pf=["onClick"],mf={class:"text-neutral-600 dark:text-neutral-400"},gf={class:"text-sm text-neutral-500 dark:text-neutral-400"},ff={class:"flex items-center gap-2"},hf={key:0,class:"space-y-4"},vf={class:"text-lg font-medium mb-2"},bf={class:"text-sm text-neutral-600 dark:text-neutral-400 mb-4"},yf={key:0,class:"h-96 flex items-center justify-center border border-black/20 dark:border-white/20 rounded bg-black/5 dark:bg-white/5"};function xf(p,t,n,e,c,i){return a(),ee(e.CenteredContentView,null,{default:de(()=>[t[11]||(t[11]=o("div",{class:"flex justify-between items-center mb-6"},[o("h1",{class:"text-3xl font-bold"},"Tools")],-1)),t[12]||(t[12]=o("p",{class:"text-neutral-600 dark:text-neutral-400 mb-6"}," Tools are the fundamental building blocks of how your business logic is exposed to your agents. Your prompts can expose tools for the agents to call. There are 3 types of tools: functions, prompts, and agents. Functions are actual code in your AgentKit codebase. Prompts are any prompts created in the prompts table (which can themselves expose tools). Agents are multi-turn conversations that can be invoked as tools. ",-1)),l(" Info banner "),o("div",Kg,[o("div",Zg,[C(e.IconInfo,{class:"w-5 h-5 mt-0.5 text-black/60 dark:text-white/60 flex-shrink-0"}),o("div",Gg,[o("p",Xg,[t[1]||(t[1]=ke(" To create or modify tools, edit the ",-1)),o("code",Yg,k(e.configData?.toolsDir||"agentbuilder/tools")+"/",1),t[2]||(t[2]=ke(" directory of your codebase. ",-1))]),t[3]||(t[3]=o("p",{class:"text-black/70 dark:text-white/70"}," Changes will be automatically detected. ",-1))])])]),l(" Functions Section "),o("div",Qg,[C(e.DataTable,{columns:e.columns,data:e.tools,loading:e.isFetching,"empty-message":`No tools found. Add tool files to the ${e.configData?.toolsDir||"agentbuilder/tools"}/ directory.`},{"cell-name":de(({row:r})=>[o("div",{class:$(["flex items-center gap-2",{"text-red-600 dark:text-red-400":r.hasError}])},[r.hasError?(a(),s("span",ef,k(r.name),1)):(a(),s("button",{key:0,onClick:d=>e.openSchema(r),class:"text-left font-medium hover:text-black/70 dark:hover:text-white/70 transition-colors underline decoration-transparent hover:decoration-current"},k(r.name),9,$g)),r.hasError?(a(),s("div",tf,[C(e.IconTriangleAlert,{class:"w-4 h-4 text-red-500"}),t[4]||(t[4]=o("div",{class:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-3 py-2 bg-black dark:bg-white text-white dark:text-black text-xs rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10"},[ke(" This tool has validation errors "),o("div",{class:"absolute top-full left-1/2 transform -translate-x-1/2 border-4 border-transparent border-t-black dark:border-t-white"})],-1))])):e.isSnakeCase(r.name)?l("v-if",!0):(a(),s("div",of,[C(e.IconTriangleAlert,{class:"w-4 h-4 text-amber-500"}),t[5]||(t[5]=o("div",{class:"absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-3 py-2 bg-black dark:bg-white text-white dark:text-black text-xs rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10"},[ke(" Tool name should be in snake_case format (e.g., 'log_name', 'send_email') "),o("div",{class:"absolute top-full left-1/2 transform -translate-x-1/2 border-4 border-transparent border-t-black dark:border-t-white"})],-1))]))],2)]),"cell-description":de(({row:r})=>[o("span",{class:$({"text-red-600 dark:text-red-400":r.hasError,"text-neutral-600 dark:text-neutral-400":!r.hasError})},k(e.getDescription(r)),3)]),"cell-actions":de(({row:r})=>[o("div",rf,[r.hasError?(a(),s("span",af,"—")):(a(),s("button",{key:0,onClick:d=>e.openSchema(r),class:"p-1.5 rounded hover:bg-black/10 dark:hover:bg-white/10 transition-colors",title:"View Schema"},[C(e.IconEye,{class:"w-4 h-4"})],8,nf))])]),_:1},8,["data","loading","empty-message"])]),l(" Prompts Section "),o("div",lf,[t[6]||(t[6]=o("h2",{class:"text-2xl font-bold mb-4"},"Prompts",-1)),t[7]||(t[7]=o("p",{class:"text-neutral-600 dark:text-neutral-400 mb-6"}," Prompts that are exposed as tools can be called by other prompts and agents. These allow you to create reusable, composable prompt chains. ",-1)),C(e.DataTable,{columns:e.promptColumns,data:e.prompts,loading:e.isFetchingPrompts,"empty-message":"No prompts are currently exposed as tools. Mark a prompt as 'Expose as tool' to see it here."},{"cell-name":de(({row:r})=>[o("button",{onClick:d=>e.openPromptSchema(r),class:"text-left font-medium hover:text-black/70 dark:hover:text-white/70 transition-colors underline decoration-transparent hover:decoration-current"},k(r.name),9,sf)]),"cell-description":de(({row:r})=>[o("span",df,k(r.description),1)]),"cell-model":de(({row:r})=>[o("span",cf,k(r.model||"-"),1)]),_:1},8,["data","loading"])]),l(" Agents Section "),o("div",uf,[t[8]||(t[8]=o("h2",{class:"text-2xl font-bold mb-4"},"Agents",-1)),t[9]||(t[9]=o("p",{class:"text-neutral-600 dark:text-neutral-400 mb-6"}," Agents that are exposed as tools can be called by other prompts and agents. When an agent is called as a tool, it uses the Side A system prompt's requirements as the tool's input schema. ",-1)),C(e.DataTable,{columns:e.promptColumns,data:e.agents,loading:e.isFetchingAgents,"empty-message":"No agents are currently exposed as tools. Mark an agent as 'Expose as tool' to see it here."},{"cell-name":de(({row:r})=>[o("button",{onClick:d=>e.openPromptSchema(r),class:"text-left font-medium hover:text-black/70 dark:hover:text-white/70 transition-colors underline decoration-transparent hover:decoration-current"},k(r.name),9,pf)]),"cell-description":de(({row:r})=>[o("span",mf,k(r.description),1)]),"cell-model":de(({row:r})=>[o("span",gf,k(r.model||"-"),1)]),_:1},8,["data","loading"])]),l(" Schema Modal "),C(e.Modal,{modelValue:e.showSchemaModal,"onUpdate:modelValue":t[0]||(t[0]=r=>e.showSchemaModal=r),onClose:e.closeModal,width:"max-w-4xl"},{header:de(()=>[o("div",ff,[C(e.IconEye,{class:"w-5 h-5"}),o("span",null,k(e.selectedTool?.name)+" Schema",1)])]),footer:de(()=>[o("button",{onClick:e.closeModal,class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"}," Close ")]),default:de(()=>[e.selectedTool?(a(),s("div",hf,[o("div",null,[o("h3",vf,k(e.selectedTool.type==="prompt"?"Required Schema":"JSON Schema"),1),o("p",bf,k(e.selectedTool.type==="prompt"?"This is the JSON schema that defines the input parameters for this prompt.":"This is the automatically generated JSON schema for the tool's arguments."),1)]),e.selectedTool.schema===null?(a(),s("div",yf,[...t[10]||(t[10]=[o("p",{class:"text-neutral-500 dark:text-neutral-400"}," No parameters required ",-1)])])):(a(),ee(e.JsonViewer,{key:1,value:e.selectedTool.schema,class:"h-96 border border-black/20 dark:border-white/20 rounded"},null,8,["value"]))])):l("v-if",!0)]),_:1},8,["modelValue"])]),_:1})}const kf=ne(Jg,[["render",xf],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/ToolsView.vue"]]),_f=ae({__name:"UsersView",setup(p,{expose:t}){t();const n=m(!1),e=m(!1),c=m([]),i=m(!1),r=m(null),d=m({username:"",password:"",role:"admin"}),u=m({username:"",password:"",role:"admin"}),h=[{value:"admin",label:"Admin"}],f=[{key:"username",label:"Username",width:"w-1/3"},{key:"role",label:"Role",width:"w-1/4"},{key:"created_at",label:"Created",width:"w-1/3",formatter:b=>new Date(b*1e3).toLocaleString()}],v=[{icon:"edit",label:"Edit",handler:async b=>{r.value=b,u.value={username:b.username,password:"",role:b.role},e.value=!0}},{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this user? This action cannot be undone.",handler:async b=>{await _(b.id)}}],g=async()=>{i.value=!0;try{const b=await Re("/users");if(!b.ok)throw new Error("Failed to fetch users");const S=await b.json();c.value=S.users||[]}catch(b){console.error("Error fetching users:",b),c.value=[]}finally{i.value=!1}},x=async()=>{if(!d.value.username||!d.value.password){alert("Username and password are required");return}try{const b=await Re("/users",{method:"POST",body:JSON.stringify(d.value)});if(!b.ok){const S=await b.json();alert(S.error||"Failed to add user");return}await g(),n.value=!1,d.value={username:"",password:"",role:"admin"}}catch(b){console.error("Error adding user:",b),alert("Failed to add user")}},y=async()=>{if(!u.value.username){alert("Username is required");return}try{const b={username:u.value.username,role:u.value.role};u.value.password&&(b.password=u.value.password);const S=await Re(`/users/${r.value.id}`,{method:"PUT",body:JSON.stringify(b)});if(!S.ok){const M=await S.json();alert(M.error||"Failed to update user");return}await g(),e.value=!1,r.value=null}catch(b){console.error("Error updating user:",b),alert("Failed to update user")}},_=async b=>{try{const S=await Re(`/users/${b}`,{method:"DELETE"});if(!S.ok){const M=await S.json();alert(M.error||"Failed to delete user");return}await g()}catch(S){console.error("Error deleting user:",S),alert("Failed to delete user")}};xe(()=>{g()});const T={showAddModal:n,showEditModal:e,users:c,loading:i,editingUser:r,newUser:d,editUser:u,roleOptions:h,columns:f,actions:v,fetchUsers:g,handleAddUser:x,handleEditUser:y,deleteUser:_,DataTable:Je,Modal:Ne,SelectInput:Ae,CenteredContentView:Ze};return Object.defineProperty(T,"__isScriptSetup",{enumerable:!1,value:!0}),T}}),wf={class:"flex justify-between items-center mb-6"},Cf={class:"flex justify-end gap-2 mt-4"},Sf={class:"flex justify-end gap-2 mt-4"};function Tf(p,t,n,e,c,i){return a(),ee(e.CenteredContentView,null,{default:de(()=>[o("div",wf,[t[13]||(t[13]=o("div",null,[o("h1",{class:"text-3xl font-bold"},"Users"),o("p",{class:"text-neutral-600 dark:text-neutral-400 mt-2"}," Manage user accounts and permissions ")],-1)),o("button",{onClick:t[0]||(t[0]=r=>e.showAddModal=!0),class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded hover:bg-black/80 dark:hover:bg-white/80 font-medium"}," Add User ")]),C(e.DataTable,{columns:e.columns,data:e.users,actions:e.actions,loading:e.loading,"empty-message":"No users found"},null,8,["data","loading"]),l(" Add User Modal "),C(e.Modal,{modelValue:e.showAddModal,"onUpdate:modelValue":t[5]||(t[5]=r=>e.showAddModal=r),title:"Add User",onClose:t[6]||(t[6]=r=>e.showAddModal=!1)},{default:de(()=>[o("form",{onSubmit:Ce(e.handleAddUser,["prevent"]),class:"space-y-4"},[o("div",null,[t[14]||(t[14]=o("label",{class:"block text-sm font-medium mb-1"},"Username",-1)),Me(o("input",{"onUpdate:modelValue":t[1]||(t[1]=r=>e.newUser.username=r),type:"text",required:"",class:"w-full px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700"},null,512),[[Oe,e.newUser.username]])]),o("div",null,[t[15]||(t[15]=o("label",{class:"block text-sm font-medium mb-1"},"Password",-1)),Me(o("input",{"onUpdate:modelValue":t[2]||(t[2]=r=>e.newUser.password=r),type:"password",required:"",class:"w-full px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700"},null,512),[[Oe,e.newUser.password]])]),o("div",null,[C(e.SelectInput,{modelValue:e.newUser.role,"onUpdate:modelValue":t[3]||(t[3]=r=>e.newUser.role=r),options:e.roleOptions,label:"Role",placeholder:"Select role"},null,8,["modelValue"])]),o("div",Cf,[o("button",{type:"button",onClick:t[4]||(t[4]=r=>e.showAddModal=!1),class:"px-4 py-2 border border-neutral-300 dark:border-neutral-600 rounded hover:bg-neutral-50 dark:hover:bg-neutral-700"}," Cancel "),t[16]||(t[16]=o("button",{type:"submit",class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded hover:bg-black/80 dark:hover:bg-white/80 font-medium"}," Add User ",-1))])],32)]),_:1},8,["modelValue"]),l(" Edit User Modal "),C(e.Modal,{modelValue:e.showEditModal,"onUpdate:modelValue":t[11]||(t[11]=r=>e.showEditModal=r),title:"Edit User",onClose:t[12]||(t[12]=r=>e.showEditModal=!1)},{default:de(()=>[o("form",{onSubmit:Ce(e.handleEditUser,["prevent"]),class:"space-y-4"},[o("div",null,[t[17]||(t[17]=o("label",{class:"block text-sm font-medium mb-1"},"Username",-1)),Me(o("input",{"onUpdate:modelValue":t[7]||(t[7]=r=>e.editUser.username=r),type:"text",required:"",class:"w-full px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700"},null,512),[[Oe,e.editUser.username]])]),o("div",null,[t[18]||(t[18]=o("label",{class:"block text-sm font-medium mb-1"},"Password (leave blank to keep current)",-1)),Me(o("input",{"onUpdate:modelValue":t[8]||(t[8]=r=>e.editUser.password=r),type:"password",class:"w-full px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700"},null,512),[[Oe,e.editUser.password]])]),o("div",null,[C(e.SelectInput,{modelValue:e.editUser.role,"onUpdate:modelValue":t[9]||(t[9]=r=>e.editUser.role=r),options:e.roleOptions,label:"Role",placeholder:"Select role"},null,8,["modelValue"])]),o("div",Sf,[o("button",{type:"button",onClick:t[10]||(t[10]=r=>e.showEditModal=!1),class:"px-4 py-2 border border-neutral-300 dark:border-neutral-600 rounded hover:bg-neutral-50 dark:hover:bg-neutral-700"}," Cancel "),t[19]||(t[19]=o("button",{type:"submit",class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded hover:bg-black/80 dark:hover:bg-white/80 font-medium"}," Update User ",-1))])],32)]),_:1},8,["modelValue"])]),_:1})}const Mf=ne(_f,[["render",Tf],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/UsersView.vue"]]),If=ae({__name:"ApiKeysView",setup(p,{expose:t}){t();const n=m(!1),e=m(!1),c=m([]),i=m(!1),r=m(""),d=m({name:""}),u=[{key:"name",label:"Name",width:"w-1/3"},{key:"keyPreview",label:"API Key",width:"w-1/3",html:!0,formatter:_=>`<code class="bg-neutral-100 dark:bg-neutral-800 px-2 py-1 rounded text-sm">${_}</code>`},{key:"createdAt",label:"Created",width:"w-1/6",formatter:_=>new Date(_*1e3).toLocaleDateString()},{key:"lastUsedAt",label:"Last Used",width:"w-1/6",formatter:_=>_?new Date(_*1e3).toLocaleDateString():"Never"}],h=[{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this API key? This action cannot be undone.",handler:async _=>{await g(_.id)}}],f=async()=>{i.value=!0;try{const _=await Re("/api-keys");if(!_.ok)throw new Error("Failed to fetch API keys");const T=await _.json();c.value=(T.keys||[]).map(b=>({...b,keyPreview:`${b.key_prefix}...${b.last_five}`,createdAt:b.created_at,lastUsedAt:b.last_used_at}))}catch(_){console.error("Error fetching API keys:",_),c.value=[]}finally{i.value=!1}},v=async()=>{if(!d.value.name){alert("Name is required");return}try{const _=await Re("/api-keys",{method:"POST",body:JSON.stringify(d.value)}),T=await _.json();if(!_.ok){alert(T.error||"Failed to create API key");return}r.value=T.key,n.value=!1,e.value=!0,await f(),d.value={name:""}}catch(_){console.error("Error creating API key:",_),alert("Failed to create API key")}},g=async _=>{try{const T=await Re(`/api-keys/${_}`,{method:"DELETE"});if(!T.ok){const b=await T.json();alert(b.error||"Failed to delete API key");return}await f()}catch(T){console.error("Error deleting API key:",T),alert("Failed to delete API key")}},x=async _=>{try{await navigator.clipboard.writeText(_),alert("API key copied to clipboard!")}catch(T){console.error("Failed to copy:",T)}};xe(()=>{f()});const y={showAddModal:n,showKeyModal:e,apiKeys:c,loading:i,newApiKey:r,newKeyData:d,columns:u,actions:h,fetchApiKeys:f,handleAddApiKey:v,deleteApiKey:g,copyToClipboard:x,DataTable:Je,Modal:Ne,CenteredContentView:Ze};return Object.defineProperty(y,"__isScriptSetup",{enumerable:!1,value:!0}),y}}),Vf={class:"flex justify-between items-center mb-6"},Lf={class:"flex justify-end gap-2 mt-4"},Pf={class:"space-y-4"},Af={class:"flex gap-2"},Ef=["value"],Of={class:"bg-accent-50 dark:bg-accent-900/30 border border-accent-200 dark:border-accent-800 text-accent-800 dark:text-accent-400 px-4 py-3 rounded"},jf={class:"block mt-2 bg-white dark:bg-neutral-800 px-3 py-2 rounded text-xs"},Df={class:"flex justify-end mt-4"};function qf(p,t,n,e,c,i){return a(),ee(e.CenteredContentView,null,{default:de(()=>[o("div",Vf,[t[9]||(t[9]=o("div",null,[o("h1",{class:"text-3xl font-bold"},"API Keys"),o("p",{class:"text-neutral-600 dark:text-neutral-400 mt-2"}," Manage API keys for programmatic access ")],-1)),o("button",{onClick:t[0]||(t[0]=r=>e.showAddModal=!0),class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded hover:bg-black/80 dark:hover:bg-white/80 font-medium"}," Create API Key ")]),C(e.DataTable,{columns:e.columns,data:e.apiKeys,actions:e.actions,loading:e.loading,"empty-message":"No API keys found"},null,8,["data","loading"]),l(" Add API Key Modal "),C(e.Modal,{modelValue:e.showAddModal,"onUpdate:modelValue":t[3]||(t[3]=r=>e.showAddModal=r),title:"Create API Key",onClose:t[4]||(t[4]=r=>e.showAddModal=!1)},{default:de(()=>[o("form",{onSubmit:Ce(e.handleAddApiKey,["prevent"]),class:"space-y-4"},[o("div",null,[t[10]||(t[10]=o("label",{class:"block text-sm font-medium mb-1"},"Name",-1)),Me(o("input",{"onUpdate:modelValue":t[1]||(t[1]=r=>e.newKeyData.name=r),type:"text",required:"",placeholder:"e.g., Production API Key",class:"w-full px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700"},null,512),[[Oe,e.newKeyData.name]]),t[11]||(t[11]=o("p",{class:"text-sm text-neutral-500 dark:text-neutral-400 mt-1"}," A descriptive name to help you identify this key ",-1))]),o("div",Lf,[o("button",{type:"button",onClick:t[2]||(t[2]=r=>e.showAddModal=!1),class:"px-4 py-2 border border-neutral-300 dark:border-neutral-600 rounded hover:bg-neutral-50 dark:hover:bg-neutral-700"}," Cancel "),t[12]||(t[12]=o("button",{type:"submit",class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded hover:bg-black/80 dark:hover:bg-white/80 font-medium"}," Create Key ",-1))])],32)]),_:1},8,["modelValue"]),l(" Show New API Key Modal "),C(e.Modal,{modelValue:e.showKeyModal,"onUpdate:modelValue":t[7]||(t[7]=r=>e.showKeyModal=r),title:"API Key Created",onClose:t[8]||(t[8]=r=>e.showKeyModal=!1)},{default:de(()=>[o("div",Pf,[t[15]||(t[15]=o("div",{class:"bg-yellow-50 dark:bg-yellow-900/30 border border-yellow-200 dark:border-yellow-800 text-yellow-800 dark:text-yellow-400 px-4 py-3 rounded"},[o("p",{class:"font-semibold"},"Important: Save this key now!"),o("p",{class:"text-sm mt-1"}," You won't be able to see it again. If you lose this key, you'll need to create a new one. ")],-1)),o("div",null,[t[13]||(t[13]=o("label",{class:"block text-sm font-medium mb-2"},"Your new API key:",-1)),o("div",Af,[o("input",{value:e.newApiKey,type:"text",readonly:"",class:"flex-1 px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700 font-mono text-sm"},null,8,Ef),o("button",{onClick:t[5]||(t[5]=r=>e.copyToClipboard(e.newApiKey)),class:"px-4 py-2 bg-neutral-200 dark:bg-neutral-700 rounded hover:bg-neutral-300 dark:hover:bg-neutral-600"}," Copy ")])]),o("div",Of,[t[14]||(t[14]=o("p",{class:"text-sm"}," Use this key in the Authorization header of your API requests: ",-1)),o("code",jf," Authorization: Bearer "+k(e.newApiKey),1)]),o("div",Df,[o("button",{onClick:t[6]||(t[6]=r=>e.showKeyModal=!1),class:"px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded hover:bg-black/80 dark:hover:bg-white/80 font-medium"}," Done ")])])]),_:1},8,["modelValue"])]),_:1})}const Uf=ne(If,[["render",qf],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/ApiKeysView.vue"]]),Bf=ae({__name:"LoginView",setup(p,{expose:t}){t();function n(M){if(M.startsWith("/src/")||M.startsWith("data:"))return M;const L=Qe();return L==="/"?M.replace("/agents/","/"):M.replace("/agents/",`${L}/`)}const e=n(Kt),c=n(Zt),i=Xe(),r=Fe(),d=m(""),u=m(""),h=m(""),f=m(!1),v=m(!1),g=m(!1),x=m(!1),y=z(()=>x.value?c:e);xe(async()=>{const M=localStorage.getItem("theme");x.value=M==="dark"||!M&&window.matchMedia("(prefers-color-scheme: dark)").matches;const L=r.query.token,O=r.query.error;if(L){localStorage.setItem("auth_token",L),i.push("/");return}O&&(O==="oauth_failed"?h.value="OAuth authentication failed. Please try again.":O==="oauth_not_configured"&&(h.value="OAuth provider is not configured."));try{const B=await fetch(te("/api/auth/config"));if(B.ok){const H=await B.json();v.value=H.github||!1,g.value=H.google||!1}}catch(B){console.error("Failed to fetch auth config:",B)}});async function _(){h.value="",f.value=!0;try{const M=await fetch(te("/api/auth/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:d.value,password:u.value})}),L=await M.json();M.ok?(localStorage.setItem("auth_token",L.token),i.push("/")):h.value=L.error||"Login failed"}catch{h.value="Network error. Please try again."}finally{f.value=!1}}function T(){window.location.href=te("/api/auth/oauth/github")}function b(){window.location.href=te("/api/auth/oauth/google")}const S={transformAssetPath:n,logoLight:e,logoDark:c,router:i,route:r,username:d,password:u,error:h,loading:f,showGithubLogin:v,showGoogleLogin:g,isDark:x,currentLogo:y,handleLogin:_,handleGithubLogin:T,handleGoogleLogin:b,TextInput:Ke,DropShadow:Ye};return Object.defineProperty(S,"__isScriptSetup",{enumerable:!1,value:!0}),S}}),Rf={class:"login-container flex-1 flex items-center justify-center px-4"},Nf={class:"max-w-md w-full space-y-8"},Ff={class:"flex justify-center"},Hf=["src"],zf={class:"bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-700 py-8 px-6 rounded-lg"},Wf={key:0,class:"bg-red-50 dark:bg-red-950 border border-red-500 text-red-700 dark:text-red-400 px-4 py-3"},Jf=["disabled"],Kf={key:0,class:"mt-6"};function Zf(p,t,n,e,c,i){return a(),s("div",Rf,[o("div",Nf,[o("div",Ff,[o("img",{src:e.currentLogo,alt:"AgentBuilder",class:"h-16 pointer-events-none select-none"},null,8,Hf)]),C(e.DropShadow,{offsetX:8,offsetY:8,intensity:.2,pattern:"crosshatch"},{default:de(()=>[o("div",zf,[o("form",{class:"space-y-6",onSubmit:Ce(e.handleLogin,["prevent"])},[e.error?(a(),s("div",Wf,k(e.error),1)):l("v-if",!0),C(e.TextInput,{modelValue:e.username,"onUpdate:modelValue":t[0]||(t[0]=r=>e.username=r),label:"Username",type:"text",disabled:e.loading,placeholder:"Enter your username"},null,8,["modelValue","disabled"]),C(e.TextInput,{modelValue:e.password,"onUpdate:modelValue":t[1]||(t[1]=r=>e.password=r),label:"Password",type:"password",disabled:e.loading,placeholder:"Enter your password"},null,8,["modelValue","disabled"]),o("div",null,[o("button",{type:"submit",disabled:e.loading,class:"w-full px-4 py-2.5 bg-neutral-900 text-white dark:bg-neutral-100 dark:text-neutral-900 rounded-md font-medium hover:bg-neutral-800 dark:hover:bg-neutral-200 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},k(e.loading?"Signing in...":"Sign in"),9,Jf)])],32),e.showGithubLogin||e.showGoogleLogin?(a(),s("div",Kf,[t[4]||(t[4]=o("div",{class:"relative"},[o("div",{class:"absolute inset-0 flex items-center"},[o("div",{class:"w-full border-t border-neutral-300 dark:border-neutral-600"})]),o("div",{class:"relative flex justify-center text-sm"},[o("span",{class:"px-2 bg-white dark:bg-neutral-900 text-neutral-500 dark:text-neutral-400"},"Or continue with")])],-1)),o("div",{class:$(["mt-6 grid gap-3",e.showGithubLogin&&e.showGoogleLogin?"grid-cols-2":"grid-cols-1"])},[e.showGithubLogin?(a(),s("button",{key:0,onClick:e.handleGithubLogin,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2.5 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 rounded-md font-medium hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors"},[...t[2]||(t[2]=[o("svg",{class:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20"},[o("path",{"fill-rule":"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z","clip-rule":"evenodd"})],-1),o("span",{class:"ml-2"},"GitHub",-1)])])):l("v-if",!0),e.showGoogleLogin?(a(),s("button",{key:1,onClick:e.handleGoogleLogin,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2.5 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 rounded-md font-medium hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors"},[...t[3]||(t[3]=[o("svg",{class:"h-5 w-5",viewBox:"0 0 24 24"},[o("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),o("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),o("path",{fill:"currentColor",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),o("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})],-1),o("span",{class:"ml-2"},"Google",-1)])])):l("v-if",!0)],2)])):l("v-if",!0)])]),_:1})])])}const Gf=ne(Bf,[["render",Zf],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/LoginView.vue"]]),Xf=ae({__name:"MultilineInput",props:{modelValue:{type:String,required:!1},label:{type:String,required:!1},placeholder:{type:String,required:!1},error:{type:String,required:!1},required:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1}},emits:["update:modelValue","focus","blur"],setup(p,{expose:t,emit:n}){const e=p,c=n,i=m(null),r=z(()=>["w-full px-3 py-2 bg-white dark:bg-black border rounded font-mono text-sm","focus:outline-none focus:ring-2 focus:ring-black dark:focus:ring-white","transition-colors resize-none overflow-hidden",e.error?"border-red-500 dark:border-red-400":"border-black dark:border-neutral-300",e.disabled?"opacity-50 cursor-not-allowed":""]),d=()=>{const g=i.value;g&&(g.style.height="auto",g.style.height=`${g.scrollHeight+2}px`)},u=g=>{const x=g.target;c("update:modelValue",x.value),d()},h=g=>{c("focus",g)},f=g=>{c("blur",g)};xe(()=>{d()}),ce(()=>e.modelValue,async()=>{await be(),d()}),t({textareaRef:i,adjustHeight:d});const v={props:e,emit:c,textareaRef:i,inputClasses:r,adjustHeight:d,handleInput:u,handleFocus:h,handleBlur:f};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),Yf={class:"space-y-1"},Qf={key:0,class:"block text-sm font-medium"},$f={key:0,class:"text-red-500"},eh=["value","placeholder","disabled"],th={key:1,class:"text-xs text-red-500 dark:text-red-400"};function oh(p,t,n,e,c,i){return a(),s("div",Yf,[n.label?(a(),s("label",Qf,[ke(k(n.label)+" ",1),n.required?(a(),s("span",$f,"*")):l("v-if",!0)])):l("v-if",!0),o("textarea",{ref:"textareaRef",value:n.modelValue,placeholder:n.placeholder,disabled:n.disabled,class:$(e.inputClasses),rows:"1",onInput:e.handleInput,onFocus:e.handleFocus,onBlur:e.handleBlur},null,42,eh),n.error?(a(),s("p",th,k(n.error),1)):l("v-if",!0)])}const rh=ne(Xf,[["render",oh],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/inputs/MultilineInput.vue"]]),nh=ae({__name:"TestView",setup(p,{expose:t}){t();const n=m(""),e=m(""),c=m(""),i=m(`Line 1
|
|
15
15
|
Line 2
|
|
16
|
-
Line 3`),
|
|
17
|
-
`),
|
|
16
|
+
Line 3`),r=m(""),d=m(""),u=m("option2"),h=m(""),f=m(""),v=m(""),g=m([]),x=m(["test1","test2"]),y=m(!1),_=m(!0),T=m(!1),b=m(!1),S=m({type:"object",properties:{},required:[]}),M=m(0);xe(()=>{window.resetJSONSchema=()=>{S.value={type:"object",properties:{},required:[]},M.value++}});const H={textValue:n,emailValue:e,multilineValue:c,multilineWithNewlines:i,multilineError:r,selectValue:d,disabledSelectValue:u,overflowSelectValue:h,dropdownValue:f,overflowDropdownValue:v,multipleSelectValue:g,multipleSelectDisabled:x,checkboxValue:y,checkboxWithHelp:_,checkboxDisabled:T,checkboxError:b,jsonSchemaValue:S,jsonSchemaKey:M,selectOptions:[{value:"option1",label:"Option One"},{value:"option2",label:"Option Two"},{value:"option3",label:"Option Three"},{value:"option4",label:"Option Four"}],dropdownOptions:[{value:"item1",label:"Item One",description:"First item description"},{value:"item2",label:"Item Two",description:"Second item description"},{value:"item3",label:"Item Three",description:"Third item description"},{value:"item4",label:"Item Four",description:"Fourth item description"}],multipleTestOptions:[{value:"test1",label:"Test Item 1",description:"First test item"},{value:"test2",label:"Test Item 2",description:"Second test item"},{value:"test3",label:"Test Item 3",description:"Third test item"},{value:"test4",label:"Test Item 4",description:"Fourth test item"},{value:"test5",label:"Test Item 5",description:"Fifth test item"}],TextInput:Ke,MultilineInput:rh,SelectInput:Ae,MultipleSelectionsInput:_t,CheckboxInput:dt,JSONSchemaInput:$t};return Object.defineProperty(H,"__isScriptSetup",{enumerable:!1,value:!0}),H}}),ah={class:"p-8 space-y-6"},lh={class:"mt-12"},sh={class:"mb-6"},ih={class:"mb-6"},dh={class:"mb-6"},ch={class:"mt-8"},uh={class:"border-2 border-red-500 p-4 h-32 overflow-hidden relative"},ph={class:"mt-12"},mh={class:"mb-6"},gh={class:"border-2 border-accent-500 p-4 h-32 overflow-hidden relative"},fh={class:"mt-12"},hh={class:"mb-6"},vh={class:"mb-6"},bh={class:"mt-12"},yh={class:"mb-6"},xh={class:"mt-2 text-sm"},kh={class:"mb-6"},_h={class:"mt-2 text-sm"},wh={class:"mb-6"},Ch={class:"mb-6"},Sh={class:"mt-12"},Th={class:"mb-6"},Mh={class:"mt-4 p-4 bg-neutral-100 dark:bg-neutral-900 rounded"},Ih={class:"text-xs overflow-x-auto"};function Vh(p,t,n,e,c,i){return a(),s("div",ah,[t[30]||(t[30]=o("h1",{class:"text-2xl font-bold"},"Component Test Page",-1)),l(" Basic TextInput "),o("div",null,[C(e.TextInput,{modelValue:e.textValue,"onUpdate:modelValue":t[0]||(t[0]=r=>e.textValue=r),label:"Test Label",placeholder:"Enter text..."},null,8,["modelValue"]),o("p",null,k(e.textValue),1)]),l(" TextInput with Error "),o("div",null,[C(e.TextInput,{modelValue:e.emailValue,"onUpdate:modelValue":t[1]||(t[1]=r=>e.emailValue=r),label:"Email",error:"Invalid email address",required:""},null,8,["modelValue"])]),l(" MultilineInput Tests "),o("div",lh,[t[18]||(t[18]=o("h2",{class:"text-xl font-bold mb-4"},"MultilineInput Tests",-1)),l(" Basic MultilineInput "),o("div",sh,[C(e.MultilineInput,{modelValue:e.multilineValue,"onUpdate:modelValue":t[2]||(t[2]=r=>e.multilineValue=r),label:"Multiline Text",placeholder:"Type multiple lines..."},null,8,["modelValue"]),o("p",null,k(e.multilineValue),1)]),l(" MultilineInput with pre-filled newlines "),o("div",ih,[C(e.MultilineInput,{modelValue:e.multilineWithNewlines,"onUpdate:modelValue":t[3]||(t[3]=r=>e.multilineWithNewlines=r),label:"Pre-filled Multiline",placeholder:"Already has content..."},null,8,["modelValue"]),o("pre",null,k(e.multilineWithNewlines),1)]),l(" MultilineInput with Error "),o("div",dh,[C(e.MultilineInput,{modelValue:e.multilineError,"onUpdate:modelValue":t[4]||(t[4]=r=>e.multilineError=r),label:"Required Field",error:"This field is required",required:""},null,8,["modelValue"])])]),l(" Basic SelectInput "),o("div",null,[C(e.SelectInput,{modelValue:e.selectValue,"onUpdate:modelValue":t[5]||(t[5]=r=>e.selectValue=r),options:e.selectOptions,label:"Select Option",placeholder:"Choose an option..."},null,8,["modelValue"]),o("p",null,k(e.selectValue),1)]),l(" SelectInput with Error "),o("div",null,[l(" Note: SelectInput doesn't support error prop yet "),C(e.SelectInput,{modelValue:e.selectValue,"onUpdate:modelValue":t[6]||(t[6]=r=>e.selectValue=r),options:e.selectOptions,label:"Required Select",placeholder:"Please select an option"},null,8,["modelValue"])]),l(" Disabled SelectInput "),o("div",null,[C(e.SelectInput,{modelValue:e.disabledSelectValue,"onUpdate:modelValue":t[7]||(t[7]=r=>e.disabledSelectValue=r),options:e.selectOptions,label:"Disabled Select",disabled:""},null,8,["modelValue"])]),l(" SelectInput in overflow:hidden container "),o("div",ch,[t[20]||(t[20]=o("h2",{class:"text-lg font-semibold mb-2"},"Overflow Test",-1)),o("div",uh,[t[19]||(t[19]=o("p",{class:"text-sm text-neutral-600 mb-2"}," This container has overflow:hidden and limited height ",-1)),C(e.SelectInput,{modelValue:e.overflowSelectValue,"onUpdate:modelValue":t[8]||(t[8]=r=>e.overflowSelectValue=r),options:e.selectOptions,label:"Select in Overflow Container",placeholder:"Should break out of container..."},null,8,["modelValue"])]),t[21]||(t[21]=o("p",{class:"mt-2 text-sm text-neutral-500"}," The dropdown should appear above the red border (in top layer) ",-1))]),l(" DropdownList Tests "),o("div",ph,[t[25]||(t[25]=o("h2",{class:"text-xl font-bold mb-4"},"DropdownList Tests",-1)),l(" Basic DropdownList "),o("div",mh,[C(e.SelectInput,{modelValue:e.dropdownValue,"onUpdate:modelValue":t[9]||(t[9]=r=>e.dropdownValue=r),options:e.dropdownOptions,label:"Select Item",placeholder:"Choose an item..."},null,8,["modelValue"]),o("p",null,k(e.dropdownValue),1)]),l(" DropdownList in overflow:hidden container "),o("div",null,[t[23]||(t[23]=o("h3",{class:"text-lg font-semibold mb-2"},"DropdownList Overflow Test",-1)),o("div",gh,[t[22]||(t[22]=o("p",{class:"text-sm text-neutral-600 mb-2"}," This container has overflow:hidden and limited height ",-1)),C(e.SelectInput,{modelValue:e.overflowDropdownValue,"onUpdate:modelValue":t[10]||(t[10]=r=>e.overflowDropdownValue=r),options:e.dropdownOptions,label:"Dropdown in Overflow Container",placeholder:"Should use popover API..."},null,8,["modelValue"])]),t[24]||(t[24]=o("p",{class:"mt-2 text-sm text-neutral-500"}," The dropdown should appear above the blue border (using Popover API) ",-1))])]),l(" MultipleSelectionsInput Tests "),o("div",fh,[t[26]||(t[26]=o("h2",{class:"text-xl font-bold mb-4"},"MultipleSelectionsInput Tests",-1)),l(" Basic MultipleSelectionsInput "),o("div",hh,[C(e.MultipleSelectionsInput,{modelValue:e.multipleSelectValue,"onUpdate:modelValue":t[11]||(t[11]=r=>e.multipleSelectValue=r),options:e.multipleTestOptions,label:"Select Multiple Items",placeholder:"Choose items...","add-label":"Add another"},null,8,["modelValue"]),o("p",null,k(e.multipleSelectValue),1)]),l(" Disabled MultipleSelectionsInput "),o("div",vh,[C(e.MultipleSelectionsInput,{modelValue:e.multipleSelectDisabled,"onUpdate:modelValue":t[12]||(t[12]=r=>e.multipleSelectDisabled=r),options:e.multipleTestOptions,label:"Disabled Multiple Select",placeholder:"Cannot select...",disabled:""},null,8,["modelValue"])])]),l(" CheckboxInput Tests "),o("div",bh,[t[27]||(t[27]=o("h2",{class:"text-xl font-bold mb-4"},"CheckboxInput Tests",-1)),l(" Basic CheckboxInput "),o("div",yh,[C(e.CheckboxInput,{modelValue:e.checkboxValue,"onUpdate:modelValue":t[13]||(t[13]=r=>e.checkboxValue=r),label:"Basic Checkbox"},null,8,["modelValue"]),o("p",xh," Value: "+k(e.checkboxValue),1)]),l(" CheckboxInput with Help Text "),o("div",kh,[C(e.CheckboxInput,{modelValue:e.checkboxWithHelp,"onUpdate:modelValue":t[14]||(t[14]=r=>e.checkboxWithHelp=r),label:"Checkbox with Help Text",helpText:"This is helpful information about what this checkbox does. Notice how the checkbox stays aligned with the label.",required:""},null,8,["modelValue"]),o("p",_h," Value: "+k(e.checkboxWithHelp),1)]),l(" Disabled CheckboxInput "),o("div",wh,[C(e.CheckboxInput,{modelValue:e.checkboxDisabled,"onUpdate:modelValue":t[15]||(t[15]=r=>e.checkboxDisabled=r),label:"Disabled Checkbox",helpText:"This checkbox is disabled and cannot be changed.",disabled:""},null,8,["modelValue"])]),l(" CheckboxInput with Error "),o("div",Ch,[C(e.CheckboxInput,{modelValue:e.checkboxError,"onUpdate:modelValue":t[16]||(t[16]=r=>e.checkboxError=r),label:"Checkbox with Error",error:"You must accept the terms and conditions",required:""},null,8,["modelValue"])])]),l(" JSONSchemaInput Tests "),o("div",Sh,[t[29]||(t[29]=o("h2",{class:"text-xl font-bold mb-4"},"JSONSchemaInput Tests",-1)),l(" Basic JSONSchemaInput "),o("div",Th,[(a(),ee(e.JSONSchemaInput,{key:e.jsonSchemaKey,modelValue:e.jsonSchemaValue,"onUpdate:modelValue":t[17]||(t[17]=r=>e.jsonSchemaValue=r),label:"JSON Schema Builder"},null,8,["modelValue"])),o("div",Mh,[t[28]||(t[28]=o("p",{class:"text-sm font-mono mb-2"},"Generated Schema:",-1)),o("pre",Ih,k(JSON.stringify(e.jsonSchemaValue,null,2)),1)])])])])}const Lh=ne(nh,[["render",Vh],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/TestView.vue"]]),Ph=ae({__name:"ReferenceInput",props:{modelValue:{type:String,required:!0},search:{type:Function,required:!1},placeholder:{type:String,required:!1},rows:{type:Number,required:!1}},emits:["update:modelValue"],setup(p,{expose:t,emit:n}){t();const e=p,c=n,i=m(null),r=m(null),d=m(!1),u=m(""),h=m([]),f=m(0),v=m(-1),g=m(-1),x=m(0),y=m({top:0,left:0}),_=async q=>{const K=q.target,R=K.value,Y=K.selectionStart;c("update:modelValue",R),R[Y-1]==="@"&&!d.value?T(Y):d.value&&await S(R,Y)},T=async q=>{v.value=q-1,g.value=q,u.value="",x.value=0,d.value=!0,f.value=0,await b(),await M("")},b=async()=>{if(!i.value)return;await be();const q=i.value.getBoundingClientRect(),K=window.getComputedStyle(i.value),R=parseInt(K.lineHeight||"20"),Y=parseInt(K.paddingTop||"8"),N=e.modelValue.substring(0,g.value).split(`
|
|
17
|
+
`),w=N.length,I=N[N.length-1],V=Math.min(I.length*8,200);y.value={top:q.top+Y+w*R+4,left:q.left+Y+V}},S=async(q,K)=>{if(K<=v.value){O();return}const R=v.value+1,Y=q.substring(R,K);if(h.value.length===0?x.value++:x.value=0,h.value.length===0&&x.value>=5){O();return}u.value=Y,await M(Y)},M=async q=>{if(!e.search){h.value=[];return}const K=await e.search(q);h.value=Array.isArray(K)?K:[],f.value>=h.value.length&&(f.value=0)},L=q=>{if(!i.value)return;const K=e.modelValue,R=K.substring(0,v.value),Y=K.substring(g.value+u.value.length),E=`@${q.value}`,N=R+E+Y;c("update:modelValue",N),be(()=>{if(!i.value)return;const w=R.length+E.length;i.value.focus(),i.value.setSelectionRange(w,w)}),O()},O=()=>{d.value=!1,u.value="",h.value=[],f.value=0,v.value=-1,g.value=-1,x.value=0},B=q=>{if(d.value)switch(q.key){case"Escape":q.preventDefault(),O();break;case"ArrowDown":q.preventDefault(),f.value=Math.min(f.value+1,h.value.length-1);break;case"ArrowUp":q.preventDefault(),f.value=Math.max(f.value-1,0);break;case"Enter":h.value.length>0&&(q.preventDefault(),L(h.value[f.value]));break;case"Tab":h.value.length>0&&(q.preventDefault(),L(h.value[f.value]));break}},H=()=>{if(!d.value||!i.value)return;i.value.selectionStart<=v.value&&O()},re=q=>{if(!r.value||!d.value)return;const K=q.target;!r.value.contains(K)&&K!==i.value&&O()};ce(d,q=>{q?document.addEventListener("click",re):document.removeEventListener("click",re)});const Q={props:e,emit:c,textarea:i,searchDialog:r,isSearchMode:d,searchQuery:u,searchResults:h,selectedIndex:f,atSymbolPosition:v,searchStartCursorPosition:g,charactersTypedSinceSearch:x,dialogPosition:y,handleInput:_,startSearchMode:T,positionDialog:b,handleSearchModeInput:S,performSearch:M,insertResult:L,exitSearchMode:O,handleKeyDown:B,handleSelectionChange:H,handleClickOutside:re};return Object.defineProperty(Q,"__isScriptSetup",{enumerable:!1,value:!0}),Q}}),Ah={class:"relative"},Eh=["value","placeholder","rows"],Oh={class:"bg-white dark:bg-black rounded-lg"},jh={class:"px-3 py-2 border-b border-black dark:border-neutral-300"},Dh={class:"text-xs font-medium text-neutral-600 dark:text-neutral-400"},qh={key:0,class:"max-h-[200px] overflow-y-auto"},Uh=["onClick"],Bh={class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},Rh={class:"flex-1"},Nh={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mt-0.5"};function Fh(p,t,n,e,c,i){return a(),s("div",Ah,[o("textarea",{ref:"textarea",value:n.modelValue,onInput:e.handleInput,onKeydown:e.handleKeyDown,onSelect:e.handleSelectionChange,placeholder:n.placeholder||"Type @ to insert references...",rows:n.rows||10,class:"w-full px-3 py-2 border border-black dark:border-neutral-300 rounded bg-transparent font-mono text-sm resize-none focus:outline-none focus:ring-1 focus:ring-black dark:focus:ring-white"},null,40,Eh),l(" Search Dialog with 1-bit dither shadow "),(a(),ee(ht,{to:"body"},[e.isSearchMode?(a(),s("div",{key:0,ref:"searchDialog",class:"fixed z-50 min-w-[200px] max-w-[400px] bg-white dark:bg-black border-2 border-black dark:border-neutral-300 rounded-lg",style:it({top:`${e.dialogPosition.top}px`,left:`${e.dialogPosition.left}px`,boxShadow:"4px 4px 0 0 rgba(0, 0, 0, 0.25)",backgroundImage:`
|
|
18
18
|
repeating-linear-gradient(
|
|
19
19
|
45deg,
|
|
20
20
|
transparent,
|
|
@@ -22,18 +22,18 @@ Line 3`),c=v(""),r=v(""),p=v("option2"),f=v(""),b=v(""),s=v(""),d=v([]),h=v(["te
|
|
|
22
22
|
rgba(0, 0, 0, 0.03) 2px,
|
|
23
23
|
rgba(0, 0, 0, 0.03) 4px
|
|
24
24
|
)
|
|
25
|
-
`})},[
|
|
25
|
+
`})},[o("div",Oh,[l(" Search header "),o("div",jh,[o("div",Dh," Search: "+k(e.searchQuery||"..."),1)]),l(" Results "),e.searchResults.length>0?(a(),s("div",qh,[(a(!0),s(X,null,ve(e.searchResults,(r,d)=>(a(),s("button",{key:`${r.type}-${r.value}`,onClick:u=>e.insertResult(r),class:$(["w-full px-3 py-2 text-left hover:bg-black/5 dark:hover:bg-white/10 transition-colors flex items-start gap-2 text-sm",{"bg-black/10 dark:bg-white/10":d===e.selectedIndex}])},[o("span",Bh,k(r.type),1),o("div",Rh,[o("div",null,k(r.label),1),r.description?(a(),s("div",Nh,k(r.description),1)):l("v-if",!0)])],10,Uh))),128))])):(a(),s(X,{key:1},[l(" No results message "),t[0]||(t[0]=o("div",{class:"px-3 py-4 text-sm text-neutral-500 dark:text-neutral-400 text-center"}," No results found ",-1))],2112)),l(" Help text "),t[1]||(t[1]=o("div",{class:"px-3 py-2 border-t border-neutral-200 dark:border-neutral-700 text-xs text-neutral-500 dark:text-neutral-400"},[o("div",null,"↑↓ Navigate • Enter/Tab Select • Esc Cancel")],-1))])],4)):l("v-if",!0)]))])}const Hh=ne(Ph,[["render",Fh],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/ReferenceInput.vue"]]),zh=ae({__name:"TestReferenceInput",setup(p,{expose:t}){t();const c={testText:m("Hello, type @ to see search suggestions"),testSearch:async i=>{await new Promise(d=>setTimeout(d,100));const r=[{type:"variable",value:"userName",label:"userName",description:"Current user name"},{type:"variable",value:"userEmail",label:"userEmail",description:"Current user email"},{type:"function",value:"getCurrentDate()",label:"getCurrentDate",description:"Get current date"},{type:"prompt",value:"{{prompt:welcome}}",label:"welcome",description:"Welcome message prompt"},{type:"prompt",value:"{{prompt:goodbye}}",label:"goodbye",description:"Goodbye message prompt"}];return i?r.filter(d=>d.label.toLowerCase().includes(i.toLowerCase())):r},ReferenceInput:Hh};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}}),Wh={class:"min-h-screen bg-white dark:bg-black p-8"},Jh={class:"max-w-4xl mx-auto space-y-8"},Kh={class:"space-y-4"},Zh={class:"block"},Gh={class:"p-4 border border-neutral-300 dark:border-neutral-700 rounded"},Xh={class:"text-sm font-mono whitespace-pre-wrap"};function Yh(p,t,n,e,c,i){return a(),s("div",Wh,[o("div",Jh,[t[4]||(t[4]=o("div",null,[o("h1",{class:"text-2xl font-bold mb-2"},"ReferenceInput Component Test"),o("p",{class:"text-neutral-600 dark:text-neutral-400"}," Type @ to trigger search mode and test the reference input functionality ")],-1)),o("div",Kh,[o("label",Zh,[t[1]||(t[1]=o("span",{class:"text-sm font-medium mb-2 block"},"Test Reference Input",-1)),C(e.ReferenceInput,{modelValue:e.testText,"onUpdate:modelValue":t[0]||(t[0]=r=>e.testText=r),search:e.testSearch,placeholder:"Type @ to insert references...",rows:10},null,8,["modelValue"])]),o("div",Gh,[t[2]||(t[2]=o("h3",{class:"text-sm font-medium mb-2"},"Current Value:",-1)),o("pre",Xh,k(e.testText),1)]),t[3]||(t[3]=o("div",{class:"p-4 bg-neutral-100 dark:bg-neutral-900 rounded"},[o("h3",{class:"text-sm font-medium mb-2"},"Test Instructions:"),o("ul",{class:"text-sm space-y-1 list-disc list-inside"},[o("li",null,"Type @ anywhere in the textarea to trigger search mode"),o("li",null,"Type characters after @ to filter results"),o("li",null,"Use arrow keys to navigate results"),o("li",null,"Press Enter or Tab to select a result"),o("li",null,"Press Escape to cancel search mode"),o("li",null,"Search exits if no results and you type 5+ more characters"),o("li",null,"Moving cursor before @ also exits search mode")])],-1))])])])}const Qh=ne(zh,[["render",Yh],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/TestReferenceInput.vue"]]),$h=ae({__name:"DebugView",setup(p,{expose:t}){t();const n=m([{id:"1",name:"Item 1"}]),e=()=>{console.log("Adding item...");const d={id:crypto.randomUUID(),name:`Item ${n.value.length+1}`};n.value.push(d),console.log("Item added, total:",n.value.length)};ce(n,()=>{console.log("Items changed:",n.value.length)},{deep:!0});const c={props:["modelValue"],emits:["update:modelValue"],template:`
|
|
26
26
|
<div>
|
|
27
27
|
<div v-for="item in modelValue" :key="item.id">
|
|
28
28
|
{{ item.name }}
|
|
29
29
|
</div>
|
|
30
30
|
<button @click="addChild">Add in Child</button>
|
|
31
31
|
</div>
|
|
32
|
-
`,setup(
|
|
32
|
+
`,setup(d,{emit:u}){return{addChild:()=>{console.log("Child adding item...");const f={id:crypto.randomUUID(),name:`Child Item ${d.modelValue.length+1}`};u("update:modelValue",[...d.modelValue,f])}}}},i=m([{id:"1",name:"Parent Item 1"}]),r={items:n,addItem:e,Child:c,parentItems:i};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),ev={class:"p-8 space-y-8"},tv={class:"space-y-2 mb-4"},ov={class:"mt-4 p-2 bg-neutral-100 rounded"};function rv(p,t,n,e,c,i){return a(),s("div",ev,[o("div",null,[t[1]||(t[1]=o("h2",{class:"text-xl font-bold mb-4"},"Direct Array Test",-1)),o("div",tv,[(a(!0),s(X,null,ve(e.items,r=>(a(),s("div",{key:r.id,class:"p-2 border"},k(r.name),1))),128))]),o("button",{onClick:e.addItem,class:"px-4 py-2 bg-black text-white rounded"}," Add Item ")]),o("div",null,[t[2]||(t[2]=o("h2",{class:"text-xl font-bold mb-4"},"Parent-Child Test",-1)),C(e.Child,{modelValue:e.parentItems,"onUpdate:modelValue":t[0]||(t[0]=r=>e.parentItems=r)},null,8,["modelValue"]),o("pre",ov,k(JSON.stringify(e.parentItems,null,2)),1)])])}const nv=ne($h,[["render",rv],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/DebugView.vue"]]),av=ae({__name:"TestPromptInput",setup(p,{expose:t}){t();const n=m([{type:"string",value:""}]),e=u=>{n.value=u};xe(()=>{window.setPromptSegments=e}),Co(()=>{delete window.setPromptSegments});const d={promptValue:n,setPromptSegments:e,searchPrompts:async u=>{await new Promise(v=>setTimeout(v,300));const h=(u||"").toLowerCase();return[{type:"variable",value:"first_name",label:"First Name",description:"The user's first name"},{type:"variable",value:"current_date",label:"current_date",description:"Today's date in ISO format"},{type:"variable",value:"system_time",label:"system_time",description:"Current system time"},{type:"variable",value:"api_key",label:"api_key",description:"API key for external services"},{type:"variable",value:"workspace_id",label:"workspace_id",description:"Current workspace identifier"},{type:"prompt",id:"7102973",label:"Onboarding Prompt",schema:{type:"object",properties:{first_name:{type:"string",description:"the first name of the user"}},required:["first_name"],additionalProperties:!1}},{type:"prompt",id:"error_handler",label:"Error Handler",description:"Error handling prompt",schema:{type:"object",properties:{error_message:{type:"string"}},required:["error_message"]}},{type:"prompt",id:"code_review",label:"Code Review",description:"Code review assistant prompt"},{type:"prompt",id:"data_analysis",label:"Data Analysis",description:"Data analysis insights generator"},{type:"prompt",id:"summary_generator",label:"Summary Generator",description:"Creates concise summaries of long text"}].filter(v=>(v.label||v.id||v.value||"").toLowerCase().includes(h)).slice(0,8)},handleUpdate:u=>{n.value=u,console.log("Updated:",u)},handleSegmentClick:(u,h)=>{console.log("Segment clicked:",u),u.type==="prompt"?alert(`Prompt clicked: ${u.label||u.id}
|
|
33
33
|
|
|
34
34
|
In a real app, this could:
|
|
35
35
|
- Show a modal with prompt details
|
|
36
36
|
- Expand inline to show the full prompt
|
|
37
|
-
- Navigate to the prompt editor`):
|
|
37
|
+
- Navigate to the prompt editor`):u.type==="variable"&&alert(`Variable clicked: ${u.label||u.value}
|
|
38
38
|
|
|
39
|
-
Description: ${r.meta?.description||"No description"}`)};return(r,p)=>(o(),a("div",Qv,[e("div",ef,[p[5]||(p[5]=e("h1",{class:"text-3xl font-bold mb-8 text-black dark:text-white"}," PromptInput Component Test ",-1)),e("div",tf,[e("div",of,[p[0]||(p[0]=e("h2",{class:"text-xl font-semibold text-black dark:text-white"}," Basic Usage ",-1)),p[1]||(p[1]=e("p",{class:"text-neutral-600 dark:text-neutral-400"}," Type @ to trigger the autocomplete menu. Use arrow keys to navigate and Enter to select. ",-1)),e("div",null,[E(ao,{"model-value":i.value,search:u,placeholder:"Type @ to insert variables or prompts...","onUpdate:modelValue":l,onSegmentClick:c},null,8,["model-value"])])]),e("div",lf,[p[3]||(p[3]=e("h2",{class:"text-xl font-semibold text-black dark:text-white"}," Current Value ",-1)),e("div",af,[p[2]||(p[2]=e("h3",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2"}," Segments (value): ",-1)),e("pre",sf,C(JSON.stringify(i.value,null,2)),1)])]),p[4]||(p[4]=So('<div class="space-y-4"><h2 class="text-xl font-semibold text-black dark:text-white"> Testing Instructions </h2><ul class="list-disc list-inside space-y-2 text-neutral-600 dark:text-neutral-400"><li>Type @ anywhere in the text to open the search dialog</li><li>Continue typing to search for variables or prompts</li><li>Use arrow keys (↑↓) to navigate results</li><li>Press Enter to select a result or click with mouse</li><li>Press Escape to close the dialog</li><li>Click outside the dialog to close it</li><li>Use Backspace/Delete to remove tags</li><li> The dialog will auto-close after typing 5+ characters without selection </li><li><strong>NEW: Click on any tag to see action handling!</strong></li></ul></div><div class="space-y-4"><h2 class="text-xl font-semibold text-black dark:text-white"> Test Scenarios </h2><div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Variables </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Try: @user, @date, @time, @api, @work </p></div><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Prompts </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Try: @greet, @error, @code, @data, @summ </p></div><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Mixed Content </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Mix text with multiple tags and test editing </p></div><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Edge Cases </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Test @ at start/end, multiple @@ symbols, etc. </p></div></div></div>',2))])])]))}}),rf={class:"relative"},df={key:0,class:"mt-1 text-sm text-red-500"},uf=se({__name:"JsonEditor",props:{modelValue:{},placeholder:{},error:{},rows:{},readonly:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){self.MonacoEnvironment={getWorker($,g){return g==="json"?new Eo:new Ao}};const n=t,u=i,l=v(null);let c=null,r=!1;const p=v(!1),f={minimap:{enabled:!1},fontSize:14,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',lineHeight:24,padding:{top:12,bottom:12},scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,formatOnPaste:!0,formatOnType:!0,readOnly:n.readonly,quickSuggestions:{other:"on",comments:"off",strings:"on"},suggestOnTriggerCharacters:!0,acceptSuggestionOnCommitCharacter:!0,tabSize:2,detectIndentation:!1,renderLineHighlight:"none",scrollbar:{vertical:"auto",horizontal:"hidden",verticalScrollbarSize:10}},b=()=>{if(!(!c||n.readonly))try{const $=c.getValue(),g=JSON.parse($),m=JSON.stringify(g,null,2);m!==$&&(r=!0,c.setValue(m),r=!1)}catch{}},s=()=>{p.value=document.documentElement.classList.contains("dark"),c&&Lt.setTheme(p.value?"vs-dark":"vs")},d=()=>{l.value&&(c=Lt.create(l.value,{value:n.modelValue||"{}",language:"json",theme:p.value?"vs-dark":"vs",...f})(l.value).__monacoEditor=c,c.onDidChangeModelContent(()=>{if(!r){const $=c.getValue();u("update:modelValue",$)}}),c.onDidBlurEditorText(()=>{u("blur"),b()}))};xe(async()=>{s(),await ge(),d();const $=new MutationObserver(s);$.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),Be(()=>{$.disconnect(),c&&c.dispose()})}),ue(()=>n.modelValue,$=>{c&&c.getValue()!==$&&(r=!0,c.setValue($||""),r=!1)}),ue(()=>n.readonly,$=>{c&&c.updateOptions({readOnly:$})});const h=n.rows?`${n.rows*1.5}rem`:"18rem";return($,g)=>(o(),a("div",rf,[e("div",{class:le(["border rounded overflow-hidden bg-white dark:bg-black",[t.error?"border-red-500":"border-black dark:border-neutral-300"]])},[e("div",{ref_key:"containerRef",ref:l,class:"monaco-editor-container",style:pt({height:Z(h)})},null,4)],2),t.error?(o(),a("div",df,C(t.error),1)):L("",!0)]))}}),Nt=Ze(uf,[["__scopeId","data-v-1393c576"]]),cf={class:"p-8"},pf={class:"space-y-4"},mf={class:"space-y-4"},vf={class:"space-y-4"},ff=se({__name:"TestJsonEditorModal",setup(t){const i=v(!1),n=v(JSON.stringify({name:"Test",value:123},null,2)),u=v(!1),l=v(JSON.stringify({editable:!0,count:0},null,2));return(c,r)=>(o(),a("div",cf,[r[13]||(r[13]=e("h1",{class:"text-3xl font-bold mb-6"},"JsonEditor in Modal Test",-1)),e("div",pf,[e("div",null,[r[7]||(r[7]=e("h2",{class:"text-xl font-semibold mb-2"}," Read-only JsonEditor in Modal ",-1)),r[8]||(r[8]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-4"}," This should NOT show unsaved changes warning when closing ",-1)),e("button",{onClick:r[0]||(r[0]=p=>i.value=!0),class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black border-2 border-black dark:border-white"}," Open Read-only Modal ")]),e("div",null,[r[9]||(r[9]=e("h2",{class:"text-xl font-semibold mb-2"},"Editable JsonEditor in Modal",-1)),r[10]||(r[10]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-4"}," This should NOT show unsaved changes warning on initial close, but SHOULD show it after editing ",-1)),e("button",{onClick:r[1]||(r[1]=p=>u.value=!0),class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black border-2 border-black dark:border-white"}," Open Editable Modal ")])]),E(je,{modelValue:i.value,"onUpdate:modelValue":r[3]||(r[3]=p=>i.value=p),title:"Read-only JSON Schema",width:"max-w-4xl"},{footer:de(()=>[e("button",{onClick:r[2]||(r[2]=p=>i.value=!1),class:"px-4 py-2 border-2 border-black dark:border-white bg-white dark:bg-black text-black dark:text-white"}," Close ")]),default:de(()=>[e("div",mf,[r[11]||(r[11]=e("p",{class:"text-sm text-neutral-600 dark:text-neutral-400"}," This is a read-only JSON editor. No changes can be made. ",-1)),E(Nt,{"model-value":n.value,readonly:!0},null,8,["model-value"])])]),_:1},8,["modelValue"]),E(je,{modelValue:u.value,"onUpdate:modelValue":r[6]||(r[6]=p=>u.value=p),title:"Editable JSON Schema",width:"max-w-4xl"},{footer:de(()=>[e("button",{onClick:r[5]||(r[5]=p=>u.value=!1),class:"px-4 py-2 border-2 border-black dark:border-white bg-white dark:bg-black text-black dark:text-white"}," Close ")]),default:de(()=>[e("div",vf,[r[12]||(r[12]=e("p",{class:"text-sm text-neutral-600 dark:text-neutral-400"}," This is an editable JSON editor. Changes will be tracked. ",-1)),E(Nt,{modelValue:l.value,"onUpdate:modelValue":r[4]||(r[4]=p=>l.value=p)},null,8,["modelValue"])])]),_:1},8,["modelValue"])]))}}),hf={class:"p-8 max-w-2xl mx-auto"},gf={class:"mb-6"},bf={class:"p-4 bg-neutral-100 dark:bg-neutral-800 rounded font-mono text-sm"},xf={key:0},yf={class:"whitespace-pre-wrap"},kf={key:1,class:"text-neutral-500"},wf={class:"mb-6"},_f={class:"space-y-2"},$f={class:"mt-6"},Cf={class:"p-4 bg-green-50 dark:bg-green-900 rounded min-h-[100px]"},Vf={key:0,class:"font-mono"},Sf={key:1,class:"text-neutral-500"},Tf="10000000-0000-0000-0000-000000000101",Bt="10000000-0000-0000-0000-000000000102",Mf=se({__name:"TestPromptInterpolation",setup(t){const i=v([]),n=v(null),u=v(null),l=v(""),c=v("Alice Johnson"),r=v("alice@example.com"),p=v("28"),{data:f,error:b}=Ee(ae(`/api/prompts/${Tf}`)).json(),{data:s,error:d}=Ee(ae(`/api/prompts/${Bt}`)).json();ue(f,g=>{if(g){n.value=g;try{i.value=JSON.parse(g.prompt)}catch(m){console.error("Failed to parse prompt A:",m)}}},{immediate:!0}),ue(s,g=>{g&&(u.value=g)},{immediate:!0});function h(g,m){return g.map(w=>{if(w.type==="string")return w.value||"";if(w.type==="variable"){const k=m[w.value];return k===void 0?`{{${w.value}}}`:typeof k=="string"?k:JSON.stringify(k)}else if(w.type==="prompt"){if(w.id===Bt&&u.value)try{const k=JSON.parse(u.value.prompt);return h(k,m)}catch{return`[Error loading prompt: ${w.label}]`}return""}return""}).join("")}function $(){const g={name:c.value,email:r.value,age:p.value};l.value=h(i.value,g)}return(g,m)=>(o(),a("div",hf,[m[11]||(m[11]=e("h1",{class:"text-2xl font-bold mb-6"},"Prompt Interpolation Test",-1)),e("div",gf,[m[4]||(m[4]=e("h2",{class:"text-lg font-semibold mb-2"},"Prompt Template",-1)),e("div",bf,[n.value?(o(),a("div",xf,[m[3]||(m[3]=e("div",{class:"font-bold mb-2"},"Prompt A:",-1)),e("pre",yf,C(JSON.stringify(i.value,null,2)),1)])):(o(),a("div",kf,"Loading..."))])]),e("div",wf,[m[8]||(m[8]=e("h2",{class:"text-lg font-semibold mb-2"},"Context Values",-1)),e("div",_f,[e("div",null,[m[5]||(m[5]=e("label",{class:"block text-sm mb-1"},"Name:",-1)),Se(e("input",{"onUpdate:modelValue":m[0]||(m[0]=w=>c.value=w),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Oe,c.value]])]),e("div",null,[m[6]||(m[6]=e("label",{class:"block text-sm mb-1"},"Email:",-1)),Se(e("input",{"onUpdate:modelValue":m[1]||(m[1]=w=>r.value=w),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Oe,r.value]])]),e("div",null,[m[7]||(m[7]=e("label",{class:"block text-sm mb-1"},"Age:",-1)),Se(e("input",{"onUpdate:modelValue":m[2]||(m[2]=w=>p.value=w),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Oe,p.value]])])])]),e("button",{onClick:$,class:"px-4 py-2 bg-black text-white rounded hover:bg-neutral-800"}," Render Prompt "),e("div",$f,[m[9]||(m[9]=e("h2",{class:"text-lg font-semibold mb-2"},"Rendered Output",-1)),e("div",Cf,[l.value?(o(),a("div",Vf,C(l.value),1)):(o(),a("div",Sf,' Click "Render Prompt" to see output '))]),m[10]||(m[10]=e("div",{class:"mt-4 p-4 bg-accent-50 dark:bg-accent-900 rounded text-sm"},[e("div",{class:"font-semibold mb-1"}," Expected Output (when feature is implemented): "),e("div",{class:"font-mono"}," User Profile: Alice Johnson <alice@example.com> (Age: 28) ")],-1))])]))}}),no=To({history:Mo(ot()),routes:[{path:"/login",name:"login",component:Qm,meta:{public:!0}},{path:"/",redirect:"/threads"},{path:"/agents",name:"agents",component:kn},{path:"/threads",name:"threads",component:Ot},{path:"/threads/:id",name:"thread-detail",component:Ot},{path:"/prompts",name:"prompts",component:Up},{path:"/prompts/:id",name:"prompt-edit",component:qp},{path:"/models",name:"models",component:j1},{path:"/providers",name:"providers",component:K1},{path:"/tools",name:"tools",component:Im},{path:"/settings/users",name:"users",component:Om},{path:"/settings/api-keys",name:"api-keys",component:zm},{path:"/test",name:"test",component:Mv},{path:"/test-reference-input",name:"test-reference-input",component:Zv},{path:"/debug",name:"debug",component:Yv},{path:"/test-prompt-input",name:"test-prompt-input",component:nf},{path:"/test-json-editor-modal",name:"test-json-editor-modal",component:ff},{path:"/test-prompt-interpolation",name:"test-prompt-interpolation",component:Mf}]});no.beforeEach(async(t,i,n)=>{const u=t.meta.public===!0,l=localStorage.getItem("auth_token");!u&&!l?n({name:"login"}):u&&l&&t.name==="login"?n({name:"threads"}):n()});const Lf=window.fetch;window.fetch=async function(t,i){const n=typeof t=="string"?t:t instanceof URL?t.toString():t.url,u=ot(),l=u==="/"?"/api/":`${u}/api/`,c=n.includes(l)||u==="/"&&n.startsWith("/api/");if(c){const f=localStorage.getItem("auth_token");f&&i?i.headers={...i.headers,Authorization:`Bearer ${f}`}:f&&(i={...i,headers:{Authorization:`Bearer ${f}`}})}const r=await Lf(t,i),p=n.includes("/api/auth/");return r.status===401&&c&&!p&&(localStorage.removeItem("auth_token"),window.location.href=ae("/login")),r};const ro=Lo(va);ro.use(no);ro.mount("#app");
|
|
39
|
+
Description: ${u.meta?.description||"No description"}`)},PromptInput:eo};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}}),lv={class:"min-h-screen bg-white dark:bg-black p-8"},sv={class:"max-w-4xl mx-auto"},iv={class:"space-y-8"},dv={class:"space-y-4"},cv={class:"space-y-4"},uv={class:"p-4 bg-neutral-100 dark:bg-neutral-900 rounded-lg"},pv={class:"text-sm text-black dark:text-white"};function mv(p,t,n,e,c,i){return a(),s("div",lv,[o("div",sv,[t[6]||(t[6]=o("h1",{class:"text-3xl font-bold mb-8 text-black dark:text-white"}," PromptInput Component Test ",-1)),o("div",iv,[l(" Basic Example "),o("div",dv,[t[0]||(t[0]=o("h2",{class:"text-xl font-semibold text-black dark:text-white"}," Basic Usage ",-1)),t[1]||(t[1]=o("p",{class:"text-neutral-600 dark:text-neutral-400"}," Type @ to trigger the autocomplete menu. Use arrow keys to navigate and Enter to select. ",-1)),o("div",null,[C(e.PromptInput,{"model-value":e.promptValue,search:e.searchPrompts,placeholder:"Type @ to insert variables or prompts...","onUpdate:modelValue":e.handleUpdate,onSegmentClick:e.handleSegmentClick},null,8,["model-value"])])]),l(" Output Display "),o("div",cv,[t[3]||(t[3]=o("h2",{class:"text-xl font-semibold text-black dark:text-white"}," Current Value ",-1)),o("div",uv,[t[2]||(t[2]=o("h3",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2"}," Segments (value): ",-1)),o("pre",pv,k(JSON.stringify(e.promptValue,null,2)),1)])]),l(" Instructions "),t[4]||(t[4]=Tt('<div class="space-y-4"><h2 class="text-xl font-semibold text-black dark:text-white"> Testing Instructions </h2><ul class="list-disc list-inside space-y-2 text-neutral-600 dark:text-neutral-400"><li>Type @ anywhere in the text to open the search dialog</li><li>Continue typing to search for variables or prompts</li><li>Use arrow keys (↑↓) to navigate results</li><li>Press Enter to select a result or click with mouse</li><li>Press Escape to close the dialog</li><li>Click outside the dialog to close it</li><li>Use Backspace/Delete to remove tags</li><li> The dialog will auto-close after typing 5+ characters without selection </li><li><strong>NEW: Click on any tag to see action handling!</strong></li></ul></div>',1)),l(" Test Scenarios "),t[5]||(t[5]=Tt('<div class="space-y-4"><h2 class="text-xl font-semibold text-black dark:text-white"> Test Scenarios </h2><div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Variables </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Try: @user, @date, @time, @api, @work </p></div><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Prompts </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Try: @greet, @error, @code, @data, @summ </p></div><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Mixed Content </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Mix text with multiple tags and test editing </p></div><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Edge Cases </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Test @ at start/end, multiple @@ symbols, etc. </p></div></div></div>',1))])])])}const gv=ne(av,[["render",mv],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/TestPromptInput.vue"]]),fv=ae({__name:"JsonEditor",props:{modelValue:{type:String,required:!0},placeholder:{type:String,required:!1},error:{type:String,required:!1},rows:{type:Number,required:!1},readonly:{type:Boolean,required:!1}},emits:["update:modelValue","blur"],setup(p,{expose:t,emit:n}){t(),self.MonacoEnvironment={getWorker(_,T){return T==="json"?new Vo:new Lo}};const e=p,c=n,i=m(null);let r=null,d=!1;const u=m(!1),h={minimap:{enabled:!1},fontSize:14,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',lineHeight:24,padding:{top:12,bottom:12},scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,formatOnPaste:!0,formatOnType:!0,readOnly:e.readonly,quickSuggestions:{other:"on",comments:"off",strings:"on"},suggestOnTriggerCharacters:!0,acceptSuggestionOnCommitCharacter:!0,tabSize:2,detectIndentation:!1,renderLineHighlight:"none",scrollbar:{vertical:"auto",horizontal:"hidden",verticalScrollbarSize:10}},f=()=>{if(!(!r||e.readonly))try{const _=r.getValue(),T=JSON.parse(_),b=JSON.stringify(T,null,2);b!==_&&(d=!0,r.setValue(b),d=!1)}catch{}},v=()=>{u.value=document.documentElement.classList.contains("dark"),r&&Mt.setTheme(u.value?"vs-dark":"vs")},g=()=>{i.value&&(r=Mt.create(i.value,{value:e.modelValue||"{}",language:"json",theme:u.value?"vs-dark":"vs",...h})(i.value).__monacoEditor=r,r.onDidChangeModelContent(()=>{if(!d){const _=r.getValue();c("update:modelValue",_)}}),r.onDidBlurEditorText(()=>{c("blur"),f()}))};xe(async()=>{v(),await be(),g();const _=new MutationObserver(v);_.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),Be(()=>{_.disconnect(),r&&r.dispose()})}),ce(()=>e.modelValue,_=>{r&&r.getValue()!==_&&(d=!0,r.setValue(_||""),d=!1)}),ce(()=>e.readonly,_=>{r&&r.updateOptions({readOnly:_})});const x=e.rows?`${e.rows*1.5}rem`:"18rem",y={props:e,emit:c,containerRef:i,get monacoEditor(){return r},set monacoEditor(_){r=_},get isUpdatingFromProp(){return d},set isUpdatingFromProp(_){d=_},isDark:u,editorOptions:h,formatJson:f,updateTheme:v,initEditor:g,editorHeight:x};return Object.defineProperty(y,"__isScriptSetup",{enumerable:!1,value:!0}),y}}),hv={class:"relative"},vv={key:0,class:"mt-1 text-sm text-red-500"};function bv(p,t,n,e,c,i){return a(),s("div",hv,[o("div",{class:$(["border rounded overflow-hidden bg-white dark:bg-black",[n.error?"border-red-500":"border-black dark:border-neutral-300"]])},[o("div",{ref:"containerRef",class:"monaco-editor-container",style:it({height:e.editorHeight})},null,4)],2),n.error?(a(),s("div",vv,k(n.error),1)):l("v-if",!0)])}const yv=ne(fv,[["render",bv],["__scopeId","data-v-903708b4"],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/components/JsonEditor.vue"]]),xv=ae({__name:"TestJsonEditorModal",setup(p,{expose:t}){t();const n=m(!1),e=m(JSON.stringify({name:"Test",value:123},null,2)),c=m(!1),i=m(JSON.stringify({editable:!0,count:0},null,2)),r={showModal:n,jsonValue:e,showEditableModal:c,editableJsonValue:i,Modal:Ne,JsonEditor:yv};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),kv={class:"p-8"},_v={class:"space-y-4"},wv={class:"space-y-4"},Cv={class:"space-y-4"};function Sv(p,t,n,e,c,i){return a(),s("div",kv,[t[13]||(t[13]=o("h1",{class:"text-3xl font-bold mb-6"},"JsonEditor in Modal Test",-1)),o("div",_v,[o("div",null,[t[7]||(t[7]=o("h2",{class:"text-xl font-semibold mb-2"}," Read-only JsonEditor in Modal ",-1)),t[8]||(t[8]=o("p",{class:"text-neutral-600 dark:text-neutral-400 mb-4"}," This should NOT show unsaved changes warning when closing ",-1)),o("button",{onClick:t[0]||(t[0]=r=>e.showModal=!0),class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black border-2 border-black dark:border-white"}," Open Read-only Modal ")]),o("div",null,[t[9]||(t[9]=o("h2",{class:"text-xl font-semibold mb-2"},"Editable JsonEditor in Modal",-1)),t[10]||(t[10]=o("p",{class:"text-neutral-600 dark:text-neutral-400 mb-4"}," This should NOT show unsaved changes warning on initial close, but SHOULD show it after editing ",-1)),o("button",{onClick:t[1]||(t[1]=r=>e.showEditableModal=!0),class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black border-2 border-black dark:border-white"}," Open Editable Modal ")])]),l(" Read-only Modal "),C(e.Modal,{modelValue:e.showModal,"onUpdate:modelValue":t[3]||(t[3]=r=>e.showModal=r),title:"Read-only JSON Schema",width:"max-w-4xl"},{footer:de(()=>[o("button",{onClick:t[2]||(t[2]=r=>e.showModal=!1),class:"px-4 py-2 border-2 border-black dark:border-white bg-white dark:bg-black text-black dark:text-white"}," Close ")]),default:de(()=>[o("div",wv,[t[11]||(t[11]=o("p",{class:"text-sm text-neutral-600 dark:text-neutral-400"}," This is a read-only JSON editor. No changes can be made. ",-1)),C(e.JsonEditor,{"model-value":e.jsonValue,readonly:!0},null,8,["model-value"])])]),_:1},8,["modelValue"]),l(" Editable Modal "),C(e.Modal,{modelValue:e.showEditableModal,"onUpdate:modelValue":t[6]||(t[6]=r=>e.showEditableModal=r),title:"Editable JSON Schema",width:"max-w-4xl"},{footer:de(()=>[o("button",{onClick:t[5]||(t[5]=r=>e.showEditableModal=!1),class:"px-4 py-2 border-2 border-black dark:border-white bg-white dark:bg-black text-black dark:text-white"}," Close ")]),default:de(()=>[o("div",Cv,[t[12]||(t[12]=o("p",{class:"text-sm text-neutral-600 dark:text-neutral-400"}," This is an editable JSON editor. Changes will be tracked. ",-1)),C(e.JsonEditor,{modelValue:e.editableJsonValue,"onUpdate:modelValue":t[4]||(t[4]=r=>e.editableJsonValue=r)},null,8,["modelValue"])])]),_:1},8,["modelValue"])])}const Tv=ne(xv,[["render",Sv],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/TestJsonEditorModal.vue"]]),Dt="10000000-0000-0000-0000-000000000101",pt="10000000-0000-0000-0000-000000000102",Mv=ae({__name:"TestPromptInterpolation",setup(p,{expose:t}){t();const n=m([]),e=m(null),c=m(null),i=m(""),r=m("Alice Johnson"),d=m("alice@example.com"),u=m("28"),{data:h,error:f}=Ve(te(`/api/prompts/${Dt}`)).json(),{data:v,error:g}=Ve(te(`/api/prompts/${pt}`)).json();ce(h,T=>{if(T){e.value=T;try{n.value=JSON.parse(T.prompt)}catch(b){console.error("Failed to parse prompt A:",b)}}},{immediate:!0}),ce(v,T=>{T&&(c.value=T)},{immediate:!0});function x(T,b){return T.map(S=>{if(S.type==="string")return S.value||"";if(S.type==="variable"){const M=b[S.value];return M===void 0?`{{${S.value}}}`:typeof M=="string"?M:JSON.stringify(M)}else if(S.type==="prompt"){if(S.id===pt&&c.value)try{const M=JSON.parse(c.value.prompt);return x(M,b)}catch{return`[Error loading prompt: ${S.label}]`}return""}return""}).join("")}function y(){const T={name:r.value,email:d.value,age:u.value};i.value=x(n.value,T)}const _={PROMPT_A_ID:Dt,PROMPT_B_ID:pt,promptTemplate:n,promptAData:e,promptBData:c,renderedOutput:i,inputName:r,inputEmail:d,inputAge:u,promptA:h,errorA:f,promptB:v,errorB:g,interpolatePrompt:x,renderPrompt:y};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}}),Iv={class:"p-8 max-w-2xl mx-auto"},Vv={class:"mb-6"},Lv={class:"p-4 bg-neutral-100 dark:bg-neutral-800 rounded font-mono text-sm"},Pv={key:0},Av={class:"whitespace-pre-wrap"},Ev={key:1,class:"text-neutral-500"},Ov={class:"mb-6"},jv={class:"space-y-2"},Dv={class:"mt-6"},qv={class:"p-4 bg-green-50 dark:bg-green-900 rounded min-h-[100px]"},Uv={key:0,class:"font-mono"},Bv={key:1,class:"text-neutral-500"};function Rv(p,t,n,e,c,i){return a(),s("div",Iv,[t[11]||(t[11]=o("h1",{class:"text-2xl font-bold mb-6"},"Prompt Interpolation Test",-1)),o("div",Vv,[t[4]||(t[4]=o("h2",{class:"text-lg font-semibold mb-2"},"Prompt Template",-1)),o("div",Lv,[e.promptAData?(a(),s("div",Pv,[t[3]||(t[3]=o("div",{class:"font-bold mb-2"},"Prompt A:",-1)),o("pre",Av,k(JSON.stringify(e.promptTemplate,null,2)),1)])):(a(),s("div",Ev,"Loading..."))])]),o("div",Ov,[t[8]||(t[8]=o("h2",{class:"text-lg font-semibold mb-2"},"Context Values",-1)),o("div",jv,[o("div",null,[t[5]||(t[5]=o("label",{class:"block text-sm mb-1"},"Name:",-1)),Me(o("input",{"onUpdate:modelValue":t[0]||(t[0]=r=>e.inputName=r),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Oe,e.inputName]])]),o("div",null,[t[6]||(t[6]=o("label",{class:"block text-sm mb-1"},"Email:",-1)),Me(o("input",{"onUpdate:modelValue":t[1]||(t[1]=r=>e.inputEmail=r),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Oe,e.inputEmail]])]),o("div",null,[t[7]||(t[7]=o("label",{class:"block text-sm mb-1"},"Age:",-1)),Me(o("input",{"onUpdate:modelValue":t[2]||(t[2]=r=>e.inputAge=r),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Oe,e.inputAge]])])])]),o("button",{onClick:e.renderPrompt,class:"px-4 py-2 bg-black text-white rounded hover:bg-neutral-800"}," Render Prompt "),o("div",Dv,[t[9]||(t[9]=o("h2",{class:"text-lg font-semibold mb-2"},"Rendered Output",-1)),o("div",qv,[e.renderedOutput?(a(),s("div",Uv,k(e.renderedOutput),1)):(a(),s("div",Bv,' Click "Render Prompt" to see output '))]),t[10]||(t[10]=o("div",{class:"mt-4 p-4 bg-accent-50 dark:bg-accent-900 rounded text-sm"},[o("div",{class:"font-semibold mb-1"}," Expected Output (when feature is implemented): "),o("div",{class:"font-mono"}," User Profile: Alice Johnson <alice@example.com> (Age: 28) ")],-1))])])}const Nv=ne(Mv,[["render",Rv],["__file","/Users/justinschroeder/Projects/standardagents/packages/builder/ui/src/views/TestPromptInterpolation.vue"]]),oo=So({history:To(Qe()),routes:[{path:"/login",name:"login",component:Gf,meta:{public:!0}},{path:"/",redirect:"/threads"},{path:"/agents",name:"agents",component:Zl},{path:"/threads",name:"threads",component:At},{path:"/threads/:id",name:"thread-detail",component:At},{path:"/prompts",name:"prompts",component:d1},{path:"/prompts/:id",name:"prompt-edit",component:f1},{path:"/models",name:"models",component:vg},{path:"/providers",name:"providers",component:Og},{path:"/tools",name:"tools",component:kf},{path:"/settings/users",name:"users",component:Mf},{path:"/settings/api-keys",name:"api-keys",component:Uf},{path:"/test",name:"test",component:Lh},{path:"/test-reference-input",name:"test-reference-input",component:Qh},{path:"/debug",name:"debug",component:nv},{path:"/test-prompt-input",name:"test-prompt-input",component:gv},{path:"/test-json-editor-modal",name:"test-json-editor-modal",component:Tv},{path:"/test-prompt-interpolation",name:"test-prompt-interpolation",component:Nv}]});oo.beforeEach(async(p,t,n)=>{const e=p.meta.public===!0,c=localStorage.getItem("auth_token");!e&&!c?n({name:"login"}):e&&c&&p.name==="login"?n({name:"threads"}):n()});const Fv=window.fetch;window.fetch=async function(p,t){const n=typeof p=="string"?p:p instanceof URL?p.toString():p.url,e=Qe(),c=e==="/"?"/api/":`${e}/api/`,i=n.includes(c)||e==="/"&&n.startsWith("/api/");if(i){const u=localStorage.getItem("auth_token");u&&t?t.headers={...t.headers,Authorization:`Bearer ${u}`}:u&&(t={...t,headers:{Authorization:`Bearer ${u}`}})}const r=await Fv(p,t),d=n.includes("/api/auth/");return r.status===401&&i&&!d&&(localStorage.removeItem("auth_token"),window.location.href=te("/login")),r};const ro=Mo(kn);ro.use(oo);ro.mount("#app");
|