@standardagents/builder 0.9.3 → 0.9.6
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/built-in-routes.js +1 -1
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/assets/index.css +1 -1
- package/dist/client/assets/{json.worker-C21G4-GD.js → json.worker-B3O9ZXir.js} +1 -6
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +19 -19
- package/dist/client/monaco.js +52 -504
- package/dist/client/vendor.js +12 -1
- package/dist/client/vue.js +23 -131
- package/dist/index.js +29 -6
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +29 -6
- package/dist/plugin.js.map +1 -1
- package/dist/rou3.js +1 -1
- package/dist/rou3.js.map +1 -1
- package/package.json +2 -1
package/dist/client/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import{m as ge,c as l,o as s,a as rt,b as o,d as ee,u as Pe,e as Ue,f as z,r as m,g as ce,h as Te,i,n as G,j as Z,F as W,k as ne,w as he,l as S,p as Je,t as b,R as eo,q as ie,s as De,v as re,x as pe,y as oe,T as Ke,z as lt,A as fe,B as _e,C as to,D as ve,E as Xe,L as Ct,G as St,H as oo,I as ro,J as ao,M as Tt,K as so,P as lo,N as Mt,O as Re,Q as no,S as Vt,U as io,V as at,W as Se,X as Ee,Y as co,Z as uo,_ as nt,$ as It,a0 as At,a1 as po,a2 as mo,a3 as go,a4 as fo}from"./vue.js";import{W as ho,a as vo,e as ft}from"./monaco.js";import"./vendor.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 d of c)if(d.type==="childList")for(const r of d.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&e(r)}).observe(document,{childList:!0,subtree:!0});function a(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function e(c){if(c.ep)return;c.ep=!0;const d=a(c);fetch(c.href,d)}})();const bo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function yo(u,t){return s(),l("svg",bo,[...t[0]||(t[0]=[rt('<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="7" height="9" x="3" y="3" rx="1"></rect><rect width="7" height="5" x="14" y="3" rx="1"></rect><rect width="7" height="9" x="14" y="12" rx="1"></rect><rect width="7" height="5" x="3" y="16" rx="1"></rect></g>',1)])])}const xo=ge({name:"lucide-layout-dashboard",render:yo}),ko={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function _o(u,t){return s(),l("svg",ko,[...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 ht=ge({name:"lucide-bot",render:_o}),wo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Co(u,t){return s(),l("svg",wo,[...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=ge({name:"lucide-message-square",render:Co}),So={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function To(u,t){return s(),l("svg",So,[...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 Mo=ge({name:"lucide-cpu",render:To}),Vo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Io(u,t){return s(),l("svg",Vo,[...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 Ao=ge({name:"lucide-server",render:Io}),Po={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Eo(u,t){return s(),l("svg",Po,[...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 Lo=ge({name:"lucide-wrench",render:Eo}),Oo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function jo(u,t){return s(),l("svg",Oo,[...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 Do=ge({name:"lucide-settings",render:jo}),Uo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function qo(u,t){return s(),l("svg",Uo,[...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 No=ge({name:"lucide-chevron-left",render:qo}),Bo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ro(u,t){return s(),l("svg",Bo,[...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 Fo=ge({name:"lucide-sun",render:Ro}),zo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ho(u,t){return s(),l("svg",zo,[...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 Wo=ge({name:"lucide-moon",render:Ho}),Jo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ko(u,t){return s(),l("svg",Jo,[...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 Zo=ge({name:"lucide-activity",render:Ko}),Go={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xo(u,t){return s(),l("svg",Go,[...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 Qo=ge({name:"lucide-function-square",render:Xo}),Yo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function $o(u,t){return s(),l("svg",Yo,[...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 er=ge({name:"lucide-log-out",render:$o}),tr={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function or(u,t){return s(),l("svg",tr,[...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 rr=ge({name:"lucide-users",render:or}),ar={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function sr(u,t){return s(),l("svg",ar,[...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 lr=ge({name:"lucide-key",render:sr}),nr="/agents/assets/img/agent-builder-logo-light.svg",ir="/agents/assets/img/agent-builder-logo-dark.svg",dr="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",cr="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 ur(){return window.__AGENTBUILDER_CONFIG__||{mountPoint:"/agentbuilder"}}function Fe(){return ur().mountPoint}function J(u){const t=Fe(),a=u.startsWith("/")?u:`/${u}`;return t==="/"?a:`${t}${a}`}const pr=ee({__name:"Sidebar",props:{isCollapsed:{type:Boolean,required:!0},isDark:{type:Boolean,required:!0}},emits:["toggle-sidebar","toggle-theme"],setup(u,{expose:t,emit:a}){t();function e(E){if(E.startsWith("/src/")||E.startsWith("data:"))return E;const P=Fe();return P==="/"?E.replace("/agents/","/"):E.replace("/agents/",`${P}/`)}const c=e(nr),d=e(ir),r=e(dr),n=e(cr),p=u,v=a,g=Pe(),f=Ue(),h=z(()=>g.name),w=z(()=>p.isDark?d:c),x=z(()=>p.isDark?n:r),k=[{id:"dashboard",label:"Dashboard",icon:xo,path:"/"},{id:"threads",label:"Threads",icon:Zo,path:"/threads"},{id:"agents",label:"Agents",icon:ht,path:"/agents"},{id:"prompts",label:"Prompts",icon:vt,path:"/prompts"},{id:"tools",label:"Tools",icon:Lo,path:"/tools",hasSubnav:!0,subnav:[{id:"tools-functions",label:"Functions",icon:Qo,path:"/tools#functions"},{id:"tools-prompts",label:"Prompts",icon:vt,path:"/tools#prompts"},{id:"tools-agents",label:"Agents",icon:ht,path:"/tools#agents"}]},{id:"models",label:"Models",icon:Mo,path:"/models"},{id:"providers",label:"Providers",icon:Ao,path:"/providers"}],C=E=>{f.push(E)},y=E=>{f.push(E),V.value=!1},_=z(()=>typeof h.value=="string"&&(h.value==="tools"||h.value.startsWith("tools-"))),V=m(!1),U=z(()=>h.value==="users"||h.value==="api-keys"),D=()=>{V.value=!V.value},j=()=>{localStorage.removeItem("auth_token"),f.push("/login")},F=E=>{const P=E.target;V.value&&!P.closest(".settings-menu-container")&&(V.value=!1)};ce(()=>{document.addEventListener("click",F)}),Te(()=>{document.removeEventListener("click",F)});const K={transformAssetPath:e,logoLight:c,logoDark:d,logoMarkLight:r,logoMarkDark:n,props:p,emit:v,route:g,router:f,activeRoute:h,currentLogo:w,currentLogoMark:x,navItems:k,navigateTo:C,navigateToSetting:y,isToolsActive:_,showSettingsMenu:V,isSettingsActive:U,toggleSettingsMenu:D,handleLogout:j,handleClickOutside:F,get IconSettings(){return Do},get IconChevronLeft(){return No},get IconSun(){return Fo},get IconMoon(){return Wo},get IconLogOut(){return er},get IconUsers(){return rr},get IconKey(){return lr}};return Object.defineProperty(K,"__isScriptSetup",{enumerable:!1,value:!0}),K}}),Y=(u,t)=>{const a=u.__vccOpts||u;for(const[e,c]of t)a[e]=c;return a},mr=["src"],gr=["src"],fr={class:"flex-1 flex flex-col justify-between pt-2 pb-4"},hr={class:"flex flex-col gap-1 px-2"},vr={key:0},br=["onClick","title"],yr={key:0,class:"flex-1 whitespace-nowrap overflow-hidden text-ellipsis text-left"},xr={key:0,class:"ml-4 space-y-0.5"},kr=["onClick"],_r={class:"whitespace-nowrap overflow-hidden text-ellipsis"},wr=["onClick","title"],Cr={key:0,class:"whitespace-nowrap overflow-hidden text-ellipsis"},Sr={class:"flex flex-col gap-1 px-2"},Tr={class:"relative settings-menu-container"},Mr=["title"],Vr={key:0,class:"flex-1 text-left whitespace-nowrap overflow-hidden text-ellipsis"},Ir={key:0,class:"absolute left-full ml-2 bottom-0 bg-white dark:bg-black border border-black dark:border-neutral-300 rounded shadow-lg py-2 min-w-[160px] z-50"},Ar={key:0,class:"flex items-center"},Pr=["title"],Er=["title"],Lr={class:"relative z-10 flex items-center justify-center w-8 h-full"},Or={class:"relative z-10 flex items-center justify-center w-8 h-full"},jr={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 Dr(u,t,a,e,c,d){return s(),l("aside",{class:G(["flex flex-col transition-all duration-300 pt-2.5",a.isCollapsed?"w-16":"w-60"])},[o("div",{class:G(`flex items-center justify-between ${a.isCollapsed?"px-2 py-4":"p-4"}`)},[a.isCollapsed?i("v-if",!0):(s(),l("img",{key:0,src:e.currentLogo,alt:"AgentBuilder",class:"h-8 mr-2 mt-0.5"},null,8,mr)),o("button",{onClick:t[0]||(t[0]=r=>u.$emit("toggle-sidebar")),class:G(`p-1 rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors ${a.isCollapsed?"m-auto":"border border-black/20 dark:border-white/20 opacity-50 hover:opacity-100"}`),"aria-label":"Toggle sidebar"},[a.isCollapsed?(s(),l("img",{key:1,src:e.currentLogoMark,alt:"AgentBuilder",class:"w-7 h-7 m-auto"},null,8,gr)):(s(),Z(e.IconChevronLeft,{key:0,class:"w-5 h-5"}))],2)],2),o("nav",fr,[o("div",hr,[(s(),l(W,null,ne(e.navItems,r=>(s(),l(W,{key:r.id},[r.hasSubnav?(s(),l("div",vr,[i(" Main Tools button "),o("button",{onClick:n=>e.navigateTo(r.path),class:G(["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",a.isCollapsed&&"justify-center"]),title:a.isCollapsed?r.label:void 0},[(s(),Z(Je(r.icon),{class:"w-5 h-5 flex-shrink-0"})),a.isCollapsed?i("v-if",!0):(s(),l("span",yr,b(r.label),1))],10,br),i(" Tools subnav "),!a.isCollapsed&&r.subnav?(s(),l("div",xr,[(s(!0),l(W,null,ne(r.subnav,n=>(s(),l("button",{key:n.id,onClick:p=>e.navigateTo(n.path),class:G(["flex items-center gap-3 px-3 py-1.5 text-sm transition-all w-full",e.activeRoute===n.id?"bg-black text-white dark:bg-white dark:text-black rounded":"hover:underline"])},[(s(),Z(Je(n.icon),{class:"w-4 h-4 flex-shrink-0"})),o("span",_r,b(n.label),1)],10,kr))),128))])):i("v-if",!0)])):(s(),l("button",{key:1,onClick:n=>e.navigateTo(r.path),class:G(["flex items-center gap-3 px-3 py-3 rounded text-sm font-medium transition-all",e.activeRoute===r.id?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10",a.isCollapsed&&"justify-center"]),title:a.isCollapsed?r.label:void 0},[(s(),Z(Je(r.icon),{class:"w-5 h-5 flex-shrink-0"})),a.isCollapsed?i("v-if",!0):(s(),l("span",Cr,b(r.label),1))],10,wr))],64))),64))]),o("div",Sr,[i(" Settings Menu "),o("div",Tr,[o("button",{onClick:he(e.toggleSettingsMenu,["stop"]),class:G(["flex items-center gap-3 px-3 py-3 rounded text-sm font-medium transition-all w-full",e.isSettingsActive?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10",a.isCollapsed&&"justify-center"]),title:a.isCollapsed?"Settings":void 0},[S(e.IconSettings,{class:"w-5 h-5 flex-shrink-0"}),a.isCollapsed?i("v-if",!0):(s(),l("span",Vr," Settings "))],10,Mr),i(" Settings Popover Menu "),e.showSettingsMenu?(s(),l("div",Ir,[o("button",{onClick:t[1]||(t[1]=r=>e.navigateToSetting("/settings/users")),class:G(["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"])},[S(e.IconUsers,{class:"w-4 h-4 flex-shrink-0"}),t[5]||(t[5]=o("span",{class:"whitespace-nowrap"},"Users",-1))],2),o("button",{onClick:t[2]||(t[2]=r=>e.navigateToSetting("/settings/api-keys")),class:G(["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"])},[S(e.IconKey,{class:"w-4 h-4 flex-shrink-0"}),t[6]||(t[6]=o("span",{class:"whitespace-nowrap"},"API Keys",-1))],2)])):i("v-if",!0)]),i(" Bottom icon bar "),o("div",{class:G(["flex items-center gap-1 pt-2 mt-1 border-t border-black/10 dark:border-white/10",a.isCollapsed?"flex-col":"justify-between"])},[i(" Theme toggle "),a.isCollapsed?(s(),l("div",Ar,[o("button",{onClick:t[3]||(t[3]=r=>u.$emit("toggle-theme")),class:"p-2 rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors text-gray-600 dark:text-gray-400 hover:text-black dark:hover:text-white",title:a.isDark?"Switch to light mode":"Switch to dark mode"},[a.isDark?(s(),Z(e.IconMoon,{key:1,class:"w-5 h-5"})):(s(),Z(e.IconSun,{key:0,class:"w-5 h-5"}))],8,Pr)])):(s(),l("button",{key:1,onClick:t[4]||(t[4]=r=>u.$emit("toggle-theme")),class:"relative flex items-center h-7 rounded-full bg-gray-200 dark:bg-neutral-800 hover:bg-gray-300 dark:hover:bg-neutral-700 transition-colors",title:a.isDark?"Switch to light mode":"Switch to dark mode"},[i(" Sliding indicator "),o("span",{class:G(["absolute top-0.5 h-6 w-8 rounded-full bg-white dark:bg-black shadow-sm transition-transform duration-200",a.isDark?"translate-x-[calc(100%-2px)]":"translate-x-0.5"])},null,2),i(" Icons "),o("span",Lr,[S(e.IconSun,{class:G(["w-4 h-4",a.isDark?"text-gray-500":"text-black"])},null,8,["class"])]),o("span",Or,[S(e.IconMoon,{class:G(["w-4 h-4",a.isDark?"text-white":"text-gray-400"])},null,8,["class"])])],8,Er)),i(" Logout "),o("button",{onClick:e.handleLogout,class:"group p-2 rounded hover:bg-red-500/10 transition-colors text-gray-600 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400 flex items-center",title:"Logout"},[S(e.IconLogOut,{class:"w-5 h-5 flex-shrink-0"}),a.isCollapsed?i("v-if",!0):(s(),l("span",jr,"Logout"))])],2)])])],2)}const Ur=Y(pr,[["render",Dr],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/Sidebar.vue"]]),qr=ee({__name:"WarningBanner",setup(u,{expose:t}){t();const a=m([]),e=m(new Set),c=async()=>{if(localStorage.getItem("auth_token"))try{const g=await fetch(J("/api/diagnostics"));if(g.ok){const f=await g.json();a.value=f.warnings||[]}}catch{}},d=v=>{const g=`${v.type}:${v.details?.name||v.message}`;e.value.add(g)},r=v=>{const g=`${v.type}:${v.details?.name||v.message}`;return!e.value.has(g)},n=v=>{if(v.type==="duplicate_tool_name"){const g=v.details?.sources?.join(" and ")||"multiple sources";return`Duplicate tool name "${v.details?.name}" (defined as both ${g}). This may cause unexpected behavior.`}return v.message};ce(()=>{c()});const p={warnings:a,dismissed:e,fetchWarnings:c,dismiss:d,isVisible:r,formatWarning:n};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}}),Nr={class:"warning-banner-container"},Br={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"},Rr={class:"flex items-center gap-2"},Fr=["onClick"];function zr(u,t,a,e,c,d){return s(),l("div",Nr,[(s(!0),l(W,null,ne(e.warnings,r=>(s(),l(W,{key:`${r.type}:${r.details?.name}`},[e.isVisible(r)?(s(),l("div",Br,[o("div",Rr,[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,b(e.formatWarning(r)),1)]),o("button",{onClick:n=>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,Fr)])):i("v-if",!0)],64))),128))])}const Hr=Y(qr,[["render",zr],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/WarningBanner.vue"]]),Wr=ee({__name:"App",setup(u,{expose:t}){t();const a=Pe(),e=m(!1),c=m(!1),d=z(()=>a.name!=="login"),r=()=>{e.value=!e.value},n=()=>{c.value=!c.value,c.value?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))};ce(()=>{const v=localStorage.getItem("theme");(v==="dark"||!v&&window.matchMedia("(prefers-color-scheme: dark)").matches)&&(c.value=!0,document.documentElement.classList.add("dark"))});const p={route:a,isCollapsed:e,isDark:c,showSidebar:d,toggleSidebar:r,toggleTheme:n,get RouterView(){return eo},Sidebar:Ur,WarningBanner:Hr};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}}),Jr={class:"flex-1 overflow-auto my-3 mr-4 border border-gray-200 dark:border-neutral-800 rounded-xl bg-white dark:bg-neutral-900 flex flex-col"},Kr={class:"flex-1 overflow-auto"};function Zr(u,t,a,e,c,d){return s(),l("div",{class:G(["app-container relative flex h-screen font-sans bg-gray-50/80 text-black dark:bg-black dark:text-white",{"is-dark":e.isDark}])},[e.showSidebar?(s(),Z(e.Sidebar,{key:0,"is-collapsed":e.isCollapsed,"is-dark":e.isDark,onToggleSidebar:e.toggleSidebar,onToggleTheme:e.toggleTheme},null,8,["is-collapsed","is-dark"])):i("v-if",!0),o("main",Jr,[e.showSidebar?(s(),Z(e.WarningBanner,{key:0})):i("v-if",!0),o("div",Kr,[S(e.RouterView)])])],2)}const Gr=Y(Wr,[["render",Zr],["__scopeId","data-v-7a7a37b1"],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/App.vue"]]),Xr={},Qr={class:"p-8"};function Yr(u,t){return s(),l("div",Qr,[...t[0]||(t[0]=[o("h1",{class:"text-3xl font-bold mb-4"},"Dashboard",-1),o("p",{class:"text-gray-600 dark:text-gray-400"},"Welcome to Agent Kit. Monitor and manage your AI agents from here.",-1)])])}const $r=Y(Xr,[["render",Yr],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/DashboardView.vue"]]),ea={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ta(u,t){return s(),l("svg",ea,[...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 oa=ge({name:"lucide-trash-2",render:ta}),ra={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function aa(u,t){return s(),l("svg",ra,[...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 sa=ge({name:"lucide-edit",render:aa}),la={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function na(u,t){return s(),l("svg",la,[...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 Pt=ge({name:"lucide-eye",render:na}),ia=ee({__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(u,{expose:t}){t();const n={props:u,getIcon:p=>{switch(p){case"edit":return sa;case"delete":return oa;case"view":return Pt;default:return null}},getCellValue:(p,v)=>{const g=p[v.key];return v.formatter?v.formatter(g):g??"-"},getCellAlignment:p=>{switch(p){case"center":return"text-center";case"right":return"text-right";default:return"text-left"}},handleAction:(p,v)=>{if(p.confirm){const g=p.confirmMessage||`Are you sure you want to ${p.label.toLowerCase()}?`;confirm(g)&&p.handler(v)}else p.handler(v)}};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),da={class:"w-full"},ca={class:"border border-black dark:border-neutral-300 rounded overflow-hidden"},ua={class:"overflow-x-auto"},pa={class:"w-full"},ma={class:"border-b border-black dark:border-neutral-300"},ga={key:0,class:"px-4 py-3 text-right font-medium text-sm"},fa={key:0},ha=["colspan"],va=["colspan"],ba=["innerHTML"],ya={key:0,class:"px-4 py-3 text-right"},xa={class:"inline-flex gap-1"},ka=["onClick","title"];function _a(u,t,a,e,c,d){return s(),l("div",da,[o("div",ca,[o("div",ua,[o("table",pa,[o("thead",ma,[o("tr",null,[(s(!0),l(W,null,ne(a.columns,r=>(s(),l("th",{key:r.key,class:G(["px-4 py-3 font-medium text-sm",e.getCellAlignment(r.align),r.width||""])},b(r.label),3))),128)),a.actions&&a.actions.length>0?(s(),l("th",ga," Actions ")):i("v-if",!0)])]),o("tbody",null,[i(" Loading state "),a.loading?(s(),l("tr",fa,[o("td",{colspan:a.columns.length+(a.actions?1:0),class:"px-4 py-8 text-center text-gray-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"})]),ie(" Loading... ")],-1)])],8,ha)])):a.data.length===0?(s(),l(W,{key:1},[i(" Empty state "),o("tr",null,[o("td",{colspan:a.columns.length+(a.actions?1:0),class:"px-4 py-8 text-center text-gray-500"},b(a.emptyMessage),9,va)])],2112)):(s(),l(W,{key:2},[i(" Data rows "),(s(!0),l(W,null,ne(a.data,(r,n)=>(s(),l("tr",{key:n,class:"border-t border-gray-200 dark:border-neutral-800 hover:bg-black/5 dark:hover:bg-white/5 transition-colors"},[(s(!0),l(W,null,ne(a.columns,p=>(s(),l("td",{key:p.key,class:G(["px-4 py-3 text-sm",e.getCellAlignment(p.align)])},[De(u.$slots,`cell-${p.key}`,{value:r[p.key],row:r,column:p},()=>[p.html?(s(),l("span",{key:0,innerHTML:e.getCellValue(r,p)},null,8,ba)):(s(),l(W,{key:1},[ie(b(e.getCellValue(r,p)),1)],64))])],2))),128)),a.actions&&a.actions.length>0?(s(),l("td",ya,[o("div",xa,[(s(!0),l(W,null,ne(a.actions,(p,v)=>(s(),l("button",{key:v,onClick:g=>e.handleAction(p,r),class:"p-1.5 rounded hover:bg-black/10 dark:hover:bg-white/10 transition-colors",title:p.label},[(s(),Z(Je(e.getIcon(p.icon)),{class:"w-4 h-4"}))],8,ka))),128))])])):i("v-if",!0)]))),128))],2112))])])])])])}const Le=Y(ia,[["render",_a],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/DataTable.vue"]]),wa=ee({__name:"AgentsDataTable",emits:["add","edit","delete"],setup(u,{expose:t,emit:a}){const e=a,c=m([]),d=m(!1),r=[{key:"title",label:"Title",width:"w-1/5"},{key:"type",label:"Type",width:"w-1/12",formatter:f=>f==="dual_ai"?"Dual AI":"AI+Human"},{key:"side_a_agent_prompt_name",label:"Side A",width:"w-1/5",formatter:f=>f||"-"},{key:"side_b_agent_prompt_name",label:"Side B",width:"w-1/5",formatter:f=>f||"Human"},{key:"created_at",label:"Created",width:"w-1/6",formatter:f=>f?new Date(f*1e3).toLocaleDateString():"-"}],n=[{icon:"edit",label:"Edit",handler:f=>e("edit",f)},{icon:"delete",label:"Delete",handler:async f=>{await v(f)},confirm:!0,confirmMessage:"Are you sure you want to delete this agent?"}],p=async()=>{d.value=!0;try{const f=await fetch(J("/api/agents"));if(f.ok){const h=await f.json();c.value=h.agents||[]}}catch(f){console.error("Error fetching agents:",f)}finally{d.value=!1}},v=async f=>{try{const h=await fetch(J(`/api/agents/${f.id}`),{method:"DELETE"});if(h.ok)await p();else{const w=await h.json();alert(w.error||"Failed to delete agent")}}catch(h){console.error("Error deleting agent:",h),alert("Failed to delete agent")}};ce(()=>{p()}),t({refresh:p});const g={emit:e,agents:c,loading:d,columns:r,actions:n,fetchAgents:p,deleteAgent:v,DataTable:Le};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}});function Ca(u,t,a,e,c,d){return s(),l("div",null,[S(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 Sa=Y(wa,[["render",Ca],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/AgentsDataTable.vue"]]),Ta=ee({__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(u,{expose:t}){t();const a=u,e=m(),c=m(),d=m(),r=async()=>{if(await pe(),!e.value||!c.value||!d.value)return;const g=e.value.getContext("2d");if(!g)return;const f=d.value.getBoundingClientRect(),h=f.width+a.offsetX+4,w=f.height+a.offsetY+4;e.value.width=h,e.value.height=w,e.value.style.width=`${h}px`,e.value.style.height=`${w}px`,g.clearRect(0,0,e.value.width,e.value.height);const x=document.documentElement.classList.contains("dark");if(g.fillStyle=x?"#6b7280":"black",g.globalAlpha=a.intensity,a.pattern==="crosshatch"){const k=x?4:3;g.lineWidth=1,g.strokeStyle=x?"#6b7280":"black";for(let C=-f.height;C<f.width;C+=k)g.beginPath(),g.moveTo(a.offsetX+C,a.offsetY),g.lineTo(a.offsetX+C+f.height,a.offsetY+f.height),g.stroke();for(let C=0;C<f.width+f.height;C+=k)g.beginPath(),g.moveTo(a.offsetX+C,a.offsetY+f.height),g.lineTo(a.offsetX+C-f.height,a.offsetY),g.stroke()}else if(a.pattern==="dots"){const C=x?3:2,y=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]];for(let _=0;_<f.width;_+=C)for(let V=0;V<f.height;V+=C){const U=Math.floor(_/C)%4,D=Math.floor(V/C)%4;y[D][U]/16<a.intensity&&g.fillRect(a.offsetX+_,a.offsetY+V,1,1)}}else if(a.pattern==="diagonal"){const k=x?5:4;g.lineWidth=1,g.strokeStyle=x?"#6b7280":"black";for(let C=-f.height;C<f.width;C+=k)g.beginPath(),g.moveTo(a.offsetX+C,a.offsetY),g.lineTo(a.offsetX+C+f.height,a.offsetY+f.height),g.stroke()}};let n=null,p=null;ce(()=>{n=new ResizeObserver(()=>{r()}),d.value&&n.observe(d.value),r(),p=new MutationObserver(()=>{r()}),p.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})}),Te(()=>{d.value&&n&&n.unobserve(d.value),p&&p.disconnect()}),re(()=>[a.offsetX,a.offsetY,a.intensity,a.pattern],()=>{r()});const v={props:a,canvas:e,container:c,contentEl:d,drawDitheredShadow:r,get resizeObserver(){return n},set resizeObserver(g){n=g},get mutationObserver(){return p},set mutationObserver(g){p=g}};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),Ma={ref:"container",class:"relative"},Va={ref:"canvas",class:"absolute top-0 left-0 pointer-events-none"},Ia={ref:"contentEl",class:"relative"};function Aa(u,t,a,e,c,d){return s(),l("div",Ma,[o("canvas",Va,null,512),o("div",Ia,[De(u.$slots,"default")],512)],512)}const ze=Y(Ta,[["render",Aa],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/DropShadow.vue"]]),Pa={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ea(u,t){return s(),l("svg",Pa,[...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 Et=ge({name:"lucide-x",render:Ea}),La=ee({__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(u,{expose:t,emit:a}){t();const e=u,c=a,d=()=>{c("update:modelValue",!1)},r=()=>{c("confirm"),d()},n=()=>{c("cancel"),d()},p=g=>{g.key==="Escape"&&e.modelValue&&n()};re(()=>e.modelValue,g=>{g?(document.addEventListener("keydown",p),document.body.style.overflow="hidden"):(document.removeEventListener("keydown",p),document.body.style.overflow="")});const v={props:e,emit:c,close:d,handleConfirm:r,handleCancel:n,handleKeydown:p,DropShadow:ze,get IconX(){return Et}};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),Oa={key:0,class:"w-full max-w-md"},ja={class:"flex items-center justify-between p-4 border-b-2 border-red-600 flex-shrink-0"},Da={class:"text-xl font-bold text-red-600"},Ua={class:"p-6"},qa={class:"text-gray-700 dark:text-gray-300 mb-6"},Na={class:"flex justify-end gap-3"};function Ba(u,t,a,e,c,d){return s(),Z(lt,{to:"body"},[S(Ke,{"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:oe(()=>[a.modelValue?(s(),l("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},[S(Ke,{"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:oe(()=>[a.modelValue?(s(),l("div",Oa,[S(e.DropShadow,{"offset-x":12,"offset-y":12,intensity:.4},{default:oe(()=>[o("div",{class:"bg-white dark:bg-black border-2 border-red-600 flex flex-col",onClick:t[0]||(t[0]=he(()=>{},["stop"]))},[i(" Header "),o("div",ja,[o("h2",Da,b(a.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"},[S(e.IconX,{class:"w-5 h-5 text-red-600"})])]),i(" Content "),o("div",Ua,[o("p",qa,b(a.message),1),o("div",Na,[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-gray-50 dark:hover:bg-gray-900 transition-colors"},b(a.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"},b(a.confirmText),1)])])])]),_:1})])):i("v-if",!0)]),_:1})])):i("v-if",!0)]),_:1})])}const Lt=Y(La,[["render",Ba],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/ConfirmDialog.vue"]]),Ra=ee({__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(u,{expose:t,emit:a}){t();const e=u,c=a,d=m(),r=m(!1),n=m(new Map),p=()=>d.value&&(d.value.querySelector("input")||d.value.querySelector("textarea")||d.value.querySelector("select")||d.value.querySelector("[contenteditable]")||d.value.querySelector(".monaco-editor")),v=()=>{if(!d.value)return;d.value.querySelectorAll(".monaco-editor-container").forEach(j=>{const F=j.__monacoEditor;if(F&&typeof F.getValue=="function"){const K=F.getValue();n.value.set(j,K)}})},g=()=>{if(!d.value)return!1;const D=d.value.querySelectorAll(".monaco-editor-container");for(const j of D){const F=j.__monacoEditor;if(F&&typeof F.getValue=="function"){const K=F.getValue(),E=n.value.get(j);if(E===void 0||(F.getRawOptions?.()||{}).readOnly===!0)continue;if(K!==E)return!0}}return!1},f=()=>{if(e.hasChanges!==void 0)return e.hasChanges;if(!d.value)return!1;if(g())return!0;const D=d.value.querySelectorAll("form");for(const F of D){const E=F.querySelectorAll("input, textarea, select");for(const P of E){const H=P;if(H.type==="checkbox"||H.type==="radio"){const R=H;if(R.checked!==R.defaultChecked)return!0}else if(H.tagName==="SELECT"){const R=H;if(R.value!==R.defaultValue)return!0}else if(H.value!==H.defaultValue)return!0}}const j=d.value.querySelectorAll("input:not(form input), textarea:not(form textarea), select:not(form select)");for(const F of j){const K=F;if(K.type==="checkbox"||K.type==="radio"){const E=K;if(E.checked!==E.defaultChecked)return!0}else if(K.tagName==="SELECT"){const E=K;if(E.value!==E.defaultValue)return!0}else if(K.value!==K.defaultValue)return!0}return!1},h=()=>{p()&&f()?r.value=!0:w()},w=()=>{c("update:modelValue",!1),c("close")},x=()=>{r.value=!1,w()},k=()=>{r.value=!1},C=D=>{D.key==="Escape"&&e.modelValue&&(p()||w())};re(()=>e.modelValue,async D=>{D?(document.addEventListener("keydown",C),document.body.style.overflow="hidden",await pe(),setTimeout(()=>{v()},100)):(document.removeEventListener("keydown",C),document.body.style.overflow="",n.value.clear())});const y=m(!1),U={props:e,emit:c,modalRef:d,showConfirmDialog:r,monacoInitialValues:n,hasFormFields:p,captureMonacoInitialValues:v,hasMonacoChanges:g,hasUnsavedChanges:f,attemptClose:h,close:w,handleConfirmClose:x,handleCancelClose:k,handleKeydown:C,mouseDownOnBackdrop:y,handleBackdropMouseDown:D=>{y.value=D.target===D.currentTarget},handleBackdropClick:D=>{D.target===D.currentTarget&&y.value&&(p()||w()),y.value=!1},DropShadow:ze,ConfirmDialog:Lt,get IconX(){return Et}};return Object.defineProperty(U,"__isScriptSetup",{enumerable:!1,value:!0}),U}}),Fa={class:"flex items-center justify-between p-4 border-b-2 border-black dark:border-neutral-300 flex-shrink-0"},za={class:"text-xl font-bold"},Ha={class:"overflow-y-auto flex-1"},Wa={class:"p-6"},Ja={key:0,class:"p-6 border-t-2 border-black dark:border-neutral-300 flex-shrink-0"};function Ka(u,t,a,e,c,d){return s(),Z(lt,{to:"body"},[S(Ke,{"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:oe(()=>[a.modelValue?(s(),l("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},[S(Ke,{"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:oe(()=>[a.modelValue?(s(),l("div",{key:0,class:G(["w-full",a.width,"max-h-[85vh] flex flex-col"])},[S(e.DropShadow,{"offset-x":12,"offset-y":12,intensity:.4},{default:oe(()=>[o("div",{ref:"modalRef",class:G(["bg-white dark:bg-black border-2 border-black dark:border-neutral-300 flex flex-col max-h-[85vh]",a.minHeight])},[i(" Header (fixed) "),o("div",Fa,[o("h2",za,b(a.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"},[S(e.IconX,{class:"w-5 h-5"})])]),i(" Content (scrollable) "),o("div",Ha,[o("div",Wa,[De(u.$slots,"default")])]),i(" Footer (fixed, optional) "),u.$slots.footer?(s(),l("div",Ja,[De(u.$slots,"footer")])):i("v-if",!0)],2)]),_:3})],2)):i("v-if",!0)]),_:3})],32)):i("v-if",!0)]),_:3}),i(" Confirmation dialog for unsaved changes "),S(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 Ie=Y(Ra,[["render",Ka],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/Modal.vue"]]),Za=ee({__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(u,{expose:t,emit:a}){const e=u,c=a,d=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",e.error?"border-red-500 dark:border-red-400":"border-black dark:border-neutral-300",e.disabled?"opacity-50 cursor-not-allowed":""]),n=f=>{const h=f.target;c("update:modelValue",h.value)},p=f=>{c("focus",f)},v=f=>{c("click",f)};t({inputRef:d});const g={props:e,emit:c,inputRef:d,inputClasses:r,handleInput:n,handleFocus:p,handleClick:v};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}}),Ga={class:"space-y-1"},Xa={key:0,class:"block text-sm font-medium"},Qa={key:0,class:"text-red-500"},Ya=["type","value","placeholder","disabled"],$a={key:1,class:"text-xs text-red-500 dark:text-red-400"};function es(u,t,a,e,c,d){return s(),l("div",Ga,[a.label?(s(),l("label",Xa,[ie(b(a.label)+" ",1),a.required?(s(),l("span",Qa,"*")):i("v-if",!0)])):i("v-if",!0),o("input",{ref:"inputRef",type:a.type,value:a.modelValue,placeholder:a.placeholder,disabled:a.disabled,class:G(e.inputClasses),onInput:e.handleInput,onFocus:e.handleFocus,onClick:e.handleClick},null,42,Ya),a.error?(s(),l("p",$a,b(a.error),1)):i("v-if",!0)])}const Oe=Y(Za,[["render",es],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/TextInput.vue"]]),ts=ee({__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(u,{expose:t,emit:a}){t();const e=u,c=a,d=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":""]),n={props:e,emit:c,textareaClasses:d,handleInput:p=>{const v=p.target;c("update:modelValue",v.value)}};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),os={class:"space-y-1"},rs={key:0,class:"block text-sm font-medium"},as={key:0,class:"text-red-500"},ss=["value","placeholder","disabled","rows"],ls={key:1,class:"text-xs text-red-500 dark:text-red-400"};function ns(u,t,a,e,c,d){return s(),l("div",os,[a.label?(s(),l("label",rs,[ie(b(a.label)+" ",1),a.required?(s(),l("span",as,"*")):i("v-if",!0)])):i("v-if",!0),o("textarea",{value:a.modelValue,placeholder:a.placeholder,disabled:a.disabled,rows:a.rows,class:G(e.textareaClasses),onInput:e.handleInput},null,42,ss),a.error?(s(),l("p",ls,b(a.error),1)):i("v-if",!0)])}const Ot=Y(ts,[["render",ns],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/TextareaInput.vue"]]),is=ee({__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(u,{expose:t,emit:a}){t();const e=u,c=a,d=m(!1),r=m(""),n=m(),p=m(),v=m(),g=m(),f=m(-1),h=z(()=>e.options.find(P=>P.value===e.modelValue)),w=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"]),x=z(()=>{if(!r.value)return e.options;const P=r.value.toLowerCase();return e.options.filter(H=>H.label.toLowerCase().includes(P)||H.value.toLowerCase().includes(P)||H.description&&H.description.toLowerCase().includes(P))});re(x,()=>{f.value=-1});const k=()=>{e.disabled||(d.value?_():(d.value=!0,r.value="",f.value=-1,pe(()=>{if(g.value&&(g.value.setAttribute("popover","auto"),g.value.addEventListener("toggle",K),"showPopover"in g.value))try{g.value.showPopover()}catch{}V(),setTimeout(()=>n.value?.focus(),0)})))},C=P=>{c("update:modelValue",P.value),_(),r.value="",f.value=-1},y=P=>{P.stopPropagation(),c("update:modelValue","")},_=()=>{if(g.value){if("hidePopover"in g.value)try{g.value.hidePopover()}catch{}g.value.removeEventListener("toggle",K)}d.value=!1,f.value=-1},V=()=>{if(!v.value||!g.value)return;const P=v.value.getBoundingClientRect();g.value.offsetWidth||P.width,g.value.style.position="fixed",g.value.style.top=`${P.bottom+8}px`,g.value.style.left=`${P.left}px`,g.value.style.width=`${P.width}px`,g.value.style.margin="0"},U=P=>{p.value&&!p.value.contains(P.target)&&g.value&&!g.value.contains(P.target)&&_()},D=P=>{P.key==="Escape"&&d.value&&(_(),v.value?.focus())},j=P=>{if(!d.value)return;const H=x.value;if(H.length!==0)switch(P.key){case"ArrowDown":P.preventDefault(),f.value=f.value<H.length-1?f.value+1:0,F();break;case"ArrowUp":P.preventDefault(),f.value=f.value>0?f.value-1:H.length-1,F();break;case"Enter":P.preventDefault(),f.value>=0&&f.value<H.length&&C(H[f.value]);break}},F=()=>{pe(()=>{const P=g.value?.querySelector(".highlighted-option");P&&P.scrollIntoView({block:"nearest",behavior:"smooth"})})},K=P=>{P.target===g.value&&(d.value=P.newState==="open",d.value&&V())};ce(()=>{document.addEventListener("click",U),document.addEventListener("keydown",D);const P=()=>{d.value&&V()};window.addEventListener("resize",P),window.addEventListener("scroll",P,!0)}),Te(()=>{document.removeEventListener("click",U),document.removeEventListener("keydown",D),window.removeEventListener("resize",V),window.removeEventListener("scroll",V,!0)});const E={props:e,emit:c,isOpen:d,searchQuery:r,searchInput:n,dropdownRef:p,buttonRef:v,popoverRef:g,highlightedIndex:f,selectedOption:h,buttonClasses:w,filteredOptions:x,toggleDropdown:k,selectOption:C,clearValue:y,closePopover:_,positionPopover:V,handleClickOutside:U,handleEscape:D,handleKeyDown:j,scrollToHighlighted:F,handlePopoverToggle:K,DropShadow:ze};return Object.defineProperty(E,"__isScriptSetup",{enumerable:!1,value:!0}),E}}),ds={ref:"dropdownRef",class:"relative"},cs={key:0,class:"block text-sm font-medium mb-2"},us={key:0,class:"text-red-500"},ps=["disabled","aria-expanded"],ms={class:"flex items-center justify-between gap-1"},gs={key:0,class:"flex items-center gap-2 text-gray-400 flex-1 min-w-0"},fs={key:1,class:"flex items-center gap-2 flex-1 min-w-0"},hs=["src","alt"],vs={class:"block truncate"},bs={key:2,class:"block truncate text-gray-400 flex-1 min-w-0"},ys={key:1,ref:"popoverRef",class:"dropdown-popover"},xs={class:"bg-white dark:bg-black border-2 border-black dark:border-neutral-300 rounded-lg overflow-hidden"},ks={class:"p-2 border-b border-gray-200 dark:border-neutral-700"},_s=["placeholder"],ws={class:"max-h-60 overflow-y-auto"},Cs={key:0,class:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400"},Ss=["onClick","onMouseenter"],Ts={class:"flex-shrink-0 w-5 h-5 mt-0.5"},Ms=["src","alt"],Vs={key:1,class:"w-full h-full bg-gray-200 dark:bg-gray-700 rounded"},Is={class:"flex-1 min-w-0"},As={class:"text-sm font-medium text-black dark:text-white"},Ps={key:0,class:"text-xs text-gray-500 dark:text-gray-400 mt-0.5"},Es={key:2,class:"mt-1 text-xs text-red-500 dark:text-red-400"};function Ls(u,t,a,e,c,d){return s(),l("div",ds,[a.label?(s(),l("label",cs,[ie(b(a.label)+" ",1),a.required?(s(),l("span",us,"*")):i("v-if",!0)])):i("v-if",!0),o("button",{ref:"buttonRef",type:"button",onClick:e.toggleDropdown,disabled:a.disabled,"aria-expanded":e.isOpen,"aria-haspopup":!0,class:G(e.buttonClasses)},[o("div",ms,[a.loading?(s(),l("span",gs,[...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),ie(" Loading... ",-1)])])):e.selectedOption?(s(),l("span",fs,[e.selectedOption.icon?(s(),l("img",{key:0,src:e.selectedOption.icon,alt:e.selectedOption.label,class:"w-5 h-5 flex-shrink-0"},null,8,hs)):i("v-if",!0),o("span",vs,b(e.selectedOption.label),1)])):(s(),l("span",bs,b(a.placeholder),1)),i(" Clear button (only shown when value is selected) "),e.selectedOption&&!a.disabled?(s(),l("button",{key:3,type:"button",onClick:e.clearValue,class:"flex-shrink-0 p-0.5 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors","aria-label":"Clear selection"},[...t[2]||(t[2]=[o("svg",{class:"h-4 w-4 text-gray-400 hover:text-gray-600 dark:hover:text-gray-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)])])):i("v-if",!0),i(" Dropdown chevron "),t[3]||(t[3]=o("svg",{class:"h-5 w-5 text-gray-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,ps),i(" Popover dropdown "),e.isOpen?(s(),l("div",ys,[S(e.DropShadow,{"offset-x":4,"offset-y":4,intensity:.3},{default:oe(()=>[o("div",xs,[o("div",ks,[fe(o("input",{ref:"searchInput","onUpdate:modelValue":t[0]||(t[0]=r=>e.searchQuery=r),type:"text",placeholder:a.searchPlaceholder,onKeydown:e.handleKeyDown,class:"w-full px-3 py-1.5 text-sm border border-gray-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-gray-400 dark:placeholder:text-gray-500"},null,40,_s),[[_e,e.searchQuery]])]),o("div",ws,[e.filteredOptions.length===0?(s(),l("div",Cs," No options found ")):i("v-if",!0),(s(!0),l(W,null,ne(e.filteredOptions,(r,n)=>(s(),l("button",{key:r.value,type:"button",onClick:p=>e.selectOption(r),onMouseenter:p=>e.highlightedIndex=n,class:G(["w-full px-4 py-2 text-left hover:bg-gray-100 dark:hover:bg-gray-900 focus:bg-gray-100 dark:focus:bg-gray-900 focus:outline-none flex items-start gap-3",{"bg-gray-50 dark:bg-gray-900":r.value===a.modelValue,"bg-gray-100 dark:bg-gray-800 highlighted-option":n===e.highlightedIndex}])},[o("div",Ts,[r.icon?(s(),l("img",{key:0,src:r.icon,alt:r.label,class:"w-full h-full"},null,8,Ms)):(s(),l("div",Vs))]),o("div",Is,[o("div",As,b(r.label),1),r.description?(s(),l("div",Ps,b(r.description),1)):i("v-if",!0)])],42,Ss))),128))])])]),_:1})],512)):i("v-if",!0),a.error?(s(),l("p",Es,b(a.error),1)):i("v-if",!0)],512)}const xe=Y(is,[["render",Ls],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/SelectInput.vue"]]),Os=ee({__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(u,{expose:t,emit:a}){t();const e=u,c=a,d=to(),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"]),p={props:e,emit:c,checkboxId:d,decoratorClasses:r,handleChange:v=>{if(!e.disabled){const g=v.target;c("update:modelValue",g.checked)}}};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}}),js={class:"flex items-start"},Ds=["for"],Us=["id","checked","disabled"],qs={class:"flex items-center h-5"},Ns={class:"flex-1"},Bs={key:0,class:"text-red-500"},Rs={key:1,class:"text-xs text-gray-600 dark:text-gray-400 mt-1"},Fs={key:2,class:"text-xs text-red-500 dark:text-red-400 mt-1"};function zs(u,t,a,e,c,d){return s(),l("div",js,[o("label",{for:e.checkboxId,class:G(["flex items-start space-x-3 cursor-pointer select-none",{"cursor-not-allowed":a.disabled}])},[o("input",{id:e.checkboxId,type:"checkbox",checked:a.modelValue,disabled:a.disabled,onChange:e.handleChange,class:"absolute left-[-9999px]"},null,40,Us),o("div",qs,[o("span",{class:G(e.decoratorClasses)},null,2)]),o("div",Ns,[a.label?(s(),l("span",{key:0,class:G(["block text-sm font-medium",{"opacity-50":a.disabled}])},[ie(b(a.label)+" ",1),a.required?(s(),l("span",Bs,"*")):i("v-if",!0)],2)):i("v-if",!0),a.helpText?(s(),l("p",Rs,b(a.helpText),1)):i("v-if",!0),a.error?(s(),l("p",Fs,b(a.error),1)):i("v-if",!0)])],10,Ds)])}const Qe=Y(Os,[["render",zs],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/CheckboxInput.vue"]]),Hs=ee({__name:"AgentModal",props:{modelValue:{type:Boolean,required:!0},editAgent:{type:null,required:!1},mode:{type:String,required:!1}},emits:["update:modelValue","save"],setup(u,{expose:t,emit:a}){t();const e=u,c=a,d=z(()=>e.mode==="edit"),r=m(!1),n=m(""),p=m(""),v=m(""),g=m(null),f=m(""),h=m("dual_ai"),w=m(!1),x=m(""),k=m(""),C=m(null),y=m(""),_=m(""),V=m(""),U=m(""),D=m(!0),j=m(!1),F=m(""),K=m(""),E=m(""),P=m(""),H=m(!1),R=m(null),N=m(""),X=m(""),Q=m(""),L=m(""),I=m(""),T=m(""),q=m(!0),M=m(!1),O=m(""),A=m(""),B=m(""),te=m(""),le=m(null),ae=m(""),ue=m(""),me=m(""),{data:we,execute:ke}=ve(J("/api/prompts"),{immediate:!1}).json(),{data:be,execute:He}=ve(J("/api/tools?schema=true"),{immediate:!1}).json(),Me=m(null),Ye=m(!1),Ae=m(null),$e=m(!1),Ne=m(!1),Bt=z(()=>{if(!we.value)return[{value:"",label:"Select a prompt..."}];const $=we.value?.prompts||[];return[{value:"",label:"None"},...$.map(se=>({value:se.id,label:se.name}))]}),et=$=>be.value?be.value[$]:null,Rt=z(()=>!Me.value||!Me.value.tools?[{value:"",label:"None"}]:[{value:"",label:"None"},...Me.value.tools.map($=>{const se=typeof $=="string"?$:$.name;return{value:se,label:se}})]),Ft=z(()=>!Ae.value||!Ae.value.tools?[{value:"",label:"None"}]:[{value:"",label:"None"},...Ae.value.tools.map($=>{const se=typeof $=="string"?$:$.name;return{value:se,label:se}})]),zt=z(()=>{if(!F.value)return[];const $=et(F.value);return!$||!$.schema||!$.schema.properties?[]:Object.keys($.schema.properties).map(se=>({value:se,label:se}))}),Ht=z(()=>{if(!O.value)return[];const $=et(O.value);return!$||!$.schema||!$.schema.properties?[]:Object.keys($.schema.properties).map(se=>({value:se,label:se}))}),Wt=[{value:"dual_ai",label:"AI + AI (Subagent)"},{value:"ai_human",label:"AI + Human"}],Jt=z({get(){return p.value},set($){const se=g.value?.inputRef,de=se?.selectionStart??$.length;let Ce=$.toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"");if(Ce.endsWith("_agent")||(Ce=Ce+"_agent"),p.value=Ce,se){se.value=Ce;const ye=Math.min(de,Ce.length-6);se.setSelectionRange(ye,ye)}}}),Kt=async()=>{await pe();const $=g.value?.inputRef;if($&&p.value.endsWith("_agent")){const se=p.value.length-6;$.setSelectionRange(se,se)}},pt=$=>!$||$==="_agent"?(v.value="Name is required",!1):/^[a-z][a-z0-9_]*_agent$/.test($)?(v.value="",!0):(v.value="Name must start with a letter",!1),Be=()=>{p.value="",n.value="",v.value="",f.value="",h.value="dual_ai",w.value=!1,x.value="",k.value="",C.value=null,y.value="",V.value="",U.value="",D.value=!0,j.value=!1,F.value="",K.value="",E.value="",P.value="",H.value=!1,R.value=null,N.value="",X.value="",Q.value="",Me.value=null,I.value="",T.value="",q.value=!0,M.value=!1,O.value="",A.value="",B.value="",te.value="",le.value=null,ae.value="",ue.value="",me.value="",Ae.value=null},mt=async()=>{if(e.editAgent?.id){r.value=!0,Ne.value=!0;try{const $=await fetch(J(`/api/agents/${e.editAgent.id}`));if($.ok){const se=await $.json(),de=se.agent||se;p.value=de.name||"",n.value=de.name||"",f.value=de.title||"",h.value=de.type||"dual_ai",w.value=de.expose_as_tool||!1,x.value=de.tool_description||"",C.value=de.max_session_turns;const Ce=de.side_a_stop_tool||"",ye=de.side_a_stop_tool_response_property||"",Xt=de.side_b_stop_tool||"",Qt=de.side_b_stop_tool_response_property||"",Yt=de.side_a_end_conversation_tool||"",$t=de.side_b_end_conversation_tool||"";_.value=de.side_a_label||"",L.value=de.side_b_label||"",V.value=de.side_a_agent_prompt||"",I.value=de.side_b_agent_prompt||"",D.value=!!de.side_a_stop_on_response,j.value=!!de.side_a_stop_tool,H.value=!!de.side_a_manual_stop_condition,R.value=de.side_a_max_turns,q.value=!!de.side_b_stop_on_response,M.value=!!de.side_b_stop_tool,le.value=de.side_b_max_turns,await pe(),F.value=Ce,E.value=ye,O.value=Xt,B.value=Qt,X.value=Yt,ue.value=$t}}catch($){console.error("Error loading agent data:",$)}finally{r.value=!1,Ne.value=!1}}},Zt=async()=>{v.value="",y.value="",U.value="",K.value="",P.value="",N.value="",Q.value="",T.value="",A.value="",te.value="",ae.value="",me.value="";let $=!1;pt(p.value)||($=!0);const se=p.value;h.value==="dual_ai"&&C.value!==null&&C.value!==void 0&&C.value<=0&&(y.value="Max session turns must be a positive number",$=!0),V.value||(U.value="Please select an agent prompt",$=!0);const de=D.value||F.value,Ce=h.value==="ai_human"&&H.value;if(!de&&!Ce&&(U.value="At least one stop condition is required (or check manual stop condition for ai_human agents)",$=!0),F.value&&!E.value&&(P.value="Response property required when using stop tool",$=!0),R.value!==null&&R.value<=0&&(N.value="Max turns must be a positive number",$=!0),h.value==="dual_ai"&&!X.value&&!ue.value&&(Q.value="At least one side must have an end conversation tool",me.value="At least one side must have an end conversation tool",$=!0),h.value==="dual_ai"&&(I.value||(T.value="Please select an agent prompt",$=!0),O.value&&!B.value&&(te.value="Response property required when using stop tool",$=!0),le.value!==null&&le.value<=0&&(ae.value="Max turns must be a positive number",$=!0)),$)return;const ye={name:se,title:f.value||null,type:h.value,expose_as_tool:w.value,tool_description:w.value?x.value:null,max_session_turns:h.value==="dual_ai"?C.value:null,side_a_label:_.value||null,side_a_agent_prompt:V.value,side_a_stop_on_response:D.value,side_a_stop_tool:F.value||null,side_a_stop_tool_response_property:E.value||null,side_a_manual_stop_condition:H.value,side_a_max_turns:R.value,side_a_end_conversation_tool:X.value||null};h.value==="dual_ai"&&(ye.side_b_label=L.value||null,ye.side_b_agent_prompt=I.value,ye.side_b_stop_on_response=q.value,ye.side_b_stop_tool=O.value||null,ye.side_b_stop_tool_response_property=B.value||null,ye.side_b_max_turns=le.value,ye.side_b_end_conversation_tool=ue.value||null),d.value&&e.editAgent?.id&&(ye.id=e.editAgent.id),c("save",ye),Be(),c("update:modelValue",!1)},Gt=()=>{Be(),c("update:modelValue",!1)};re(V,async $=>{if(Ne.value||(F.value="",E.value=""),!$){Me.value=null;return}Ye.value=!0;try{const se=await fetch(J(`/api/prompts/${$}`));se.ok&&(Me.value=await se.json())}catch(se){console.error("Error fetching Side A prompt:",se)}finally{Ye.value=!1}}),re(I,async $=>{if(Ne.value||(O.value="",B.value=""),!$){Ae.value=null;return}$e.value=!0;try{const se=await fetch(J(`/api/prompts/${$}`));se.ok&&(Ae.value=await se.json())}catch(se){console.error("Error fetching Side B prompt:",se)}finally{$e.value=!1}}),re(j,$=>{$||(F.value="",E.value="")}),re(M,$=>{$||(O.value="",B.value="")}),re(()=>e.modelValue,async $=>{$&&(await Promise.all([ke(),He()]),d.value?(Be(),await mt()):Be())});const gt={props:e,emit:c,isEditMode:d,isLoading:r,originalName:n,name:p,nameError:v,nameInputRef:g,title:f,agentType:h,exposeAsTool:w,toolDescription:x,toolDescriptionError:k,maxSessionTurns:C,maxSessionTurnsError:y,sideALabel:_,sideAAgentPrompt:V,sideAAgentPromptError:U,sideAStopOnResponse:D,sideAStopOnToolCall:j,sideAStopTool:F,sideAStopToolError:K,sideAStopToolResponseProperty:E,sideAStopToolResponsePropertyError:P,sideAManualStopCondition:H,sideAMaxTurns:R,sideAMaxTurnsError:N,sideAEndConversationTool:X,sideAEndConversationToolError:Q,sideBLabel:L,sideBAgentPrompt:I,sideBAgentPromptError:T,sideBStopOnResponse:q,sideBStopOnToolCall:M,sideBStopTool:O,sideBStopToolError:A,sideBStopToolResponseProperty:B,sideBStopToolResponsePropertyError:te,sideBMaxTurns:le,sideBMaxTurnsError:ae,sideBEndConversationTool:ue,sideBEndConversationToolError:me,promptsData:we,fetchPrompts:ke,toolsData:be,fetchTools:He,sideAPromptData:Me,sideAPromptLoading:Ye,sideBPromptData:Ae,sideBPromptLoading:$e,isLoadingAgentData:Ne,promptOptions:Bt,getToolByName:et,sideAToolOptions:Rt,sideBToolOptions:Ft,sideAResponsePropertyOptions:zt,sideBResponsePropertyOptions:Ht,agentTypeOptions:Wt,agentName:Jt,handleNameFocus:Kt,validateAgentName:pt,resetForm:Be,loadAgentData:mt,handleSubmit:Zt,handleCancel:Gt,Modal:Ie,TextInput:Oe,TextareaInput:Ot,SelectInput:xe,CheckboxInput:Qe};return Object.defineProperty(gt,"__isScriptSetup",{enumerable:!1,value:!0}),gt}}),Ws={key:0,class:"min-h-[400px] flex items-center justify-center"},Js={key:1,class:"space-y-6 pr-2 pb-4"},Ks={key:0,class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},Zs={key:1,class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},Gs={key:0},Xs={key:1},Qs={key:0,class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},Ys={key:2},$s={key:0,class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},el={class:"grid grid-cols-2 gap-6"},tl={"data-testid":"side-a-container",class:"space-y-4 p-4 bg-gray-50 dark:bg-gray-900 rounded-lg"},ol={key:0,class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},rl={class:"space-y-3"},al={class:"flex items-start"},sl={key:0,class:"ml-8 mt-2 space-y-2"},ll={key:0,class:"text-xs text-gray-500 dark:text-gray-400 -mt-1"},nl={key:1},il={key:0,class:"mt-3 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded"},dl={key:0,class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},cl={key:0,class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},ul={"data-testid":"side-b-container",class:"space-y-4 p-4 bg-gray-100 dark:bg-gray-800 rounded-lg"},pl={class:"font-semibold text-base mb-4 text-gray-800 dark:text-gray-200"},ml={key:0,class:"flex flex-col items-center justify-center py-8"},gl={key:0,class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},fl={class:"space-y-3"},hl={class:"flex items-start"},vl={key:0,class:"ml-8 mt-2 space-y-2"},bl={key:0,class:"text-xs text-gray-500 dark:text-gray-400 -mt-1"},yl={key:1},xl={key:0,class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},kl={key:0,class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},_l={class:"flex justify-between"},wl=["disabled"];function Cl(u,t,a,e,c,d){return s(),Z(e.Modal,{"model-value":a.modelValue,"onUpdate:modelValue":t[23]||(t[23]=r=>u.$emit("update:modelValue",r)),title:e.isEditMode?"Edit Agent":"Create Agent",width:"max-w-6xl"},{footer:oe(()=>[o("div",_l,[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},b(e.isEditMode?"Update Agent":"Create Agent"),9,wl)])]),default:oe(()=>[e.isLoading?(s(),l("div",Ws,[...t[24]||(t[24]=[o("span",{class:"text-gray-500"},"Loading agent data...",-1)])])):(s(),l("div",Js,[i(" Agent Name "),o("div",null,[S(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?(s(),l("p",Ks," Names are automatically formatted to snake_case with the _agent suffix ")):i("v-if",!0),e.isEditMode?(s(),l("p",Zs," Agent names cannot be changed after creation (used as foreign key for threads) ")):i("v-if",!0)]),i(" Agent Title "),o("div",null,[S(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-gray-500 dark:text-gray-400"}," Human-readable title shown in the UI. If not set, the name will be used. ",-1))]),i(" Agent Type "),o("div",null,[S(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-gray-500 dark:text-gray-400"}," Choose between two AI agents conversing, or an AI agent conversing with a human ",-1))]),i(" Expose as Tool (only for dual_ai agents) "),e.agentType==="dual_ai"?(s(),l("div",Gs,[S(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-gray-500 dark:text-gray-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))])):i("v-if",!0),i(" Tool Description (only show if expose_as_tool is checked and agent is dual_ai) "),e.exposeAsTool&&e.agentType==="dual_ai"?(s(),l("div",Xs,[S(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?i("v-if",!0):(s(),l("p",Qs," This description helps other agents understand when to use this agent "))])):i("v-if",!0),i(" Max Session Turns (only show for dual_ai) "),e.agentType==="dual_ai"?(s(),l("div",Ys,[S(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?i("v-if",!0):(s(),l("p",$s," Maximum number of back-and-forth exchanges between the two agents before the conversation ends "))])):i("v-if",!0),i(" Two Column Layout for both sides "),o("div",el,[i(" Side A (AI) "),o("div",tl,[t[34]||(t[34]=o("h4",{class:"font-semibold text-base mb-4 text-gray-800 dark:text-gray-200"}," Side A (AI) ",-1)),i(" Label (Optional) "),o("div",null,[S(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-gray-500 dark:text-gray-400"}," Custom label for this side (shows in message bubbles and toggle) ",-1))]),i(" Agent Prompt "),o("div",null,[S(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?i("v-if",!0):(s(),l("p",ol," The prompt that defines this agent's behavior "))]),i(" Stop Conditions "),o("div",rl,[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-gray-500 dark:text-gray-400"}," Optional. If no stop conditions are set, the agent will continue until programmatically stopped or end conversation tool is called. ",-1)),i(" Stop on Response "),o("div",al,[S(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-gray-500 dark:text-gray-400 -mt-2 ml-6"}," Agent stops when it returns a response without calling tools ",-1)),i(" Stop on Tool Call "),o("div",null,[S(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?(s(),l("div",sl,[S(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?i("v-if",!0):(s(),l("p",ll," Agent stops when this tool is called ")),e.sideAStopTool?(s(),l("div",nl,[S(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-gray-500 dark:text-gray-400"}," Property from tool arguments to return as final response ",-1))])):i("v-if",!0)])):i("v-if",!0)]),i(" Manual Stop Condition (only for ai_human when both stop conditions are unchecked) "),e.agentType==="ai_human"&&!e.sideAStopOnResponse&&!e.sideAStopOnToolCall?(s(),l("div",il,[S(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))])):i("v-if",!0)]),i(" Max Turns "),o("div",null,[S(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?i("v-if",!0):(s(),l("p",dl," Maximum turns this side can take before yielding (safety limit) "))]),i(" End Conversation Tool "),o("div",null,[S(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?i("v-if",!0):(s(),l("p",cl," Tool that ends the entire conversation when called "))])]),i(" Side B (AI or Human) "),o("div",ul,[o("h4",pl," Side B ("+b(e.agentType==="ai_human"?"Human":"AI")+") ",1),i(" Label (Optional) - Available for both AI and Human "),o("div",null,[S(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-gray-500 dark:text-gray-400"}," Custom label for this side (shows in message bubbles and toggle) ",-1))]),e.agentType==="ai_human"?(s(),l("div",ml,[...t[36]||(t[36]=[o("svg",{class:"w-20 h-20 mb-4 text-gray-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-gray-500 dark:text-gray-400 text-center max-w-xs"}," This side of the conversation will be handled by a human user through the interface ",-1)])])):(s(),l(W,{key:1},[i(" Agent Prompt "),o("div",null,[S(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?i("v-if",!0):(s(),l("p",gl," The prompt that defines this agent's behavior "))]),i(" Stop Conditions "),o("div",fl,[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-gray-500 dark:text-gray-400"}," Optional. If no stop conditions are set, the agent will continue until programmatically stopped or end conversation tool is called. ",-1)),i(" Stop on Response "),o("div",hl,[S(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-gray-500 dark:text-gray-400 -mt-2 ml-6"}," Agent stops when it returns a response without calling tools ",-1)),i(" Stop on Tool Call "),o("div",null,[S(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?(s(),l("div",vl,[S(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?i("v-if",!0):(s(),l("p",bl," Agent stops when this tool is called ")),e.sideBStopTool?(s(),l("div",yl,[S(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-gray-500 dark:text-gray-400"}," Property from tool arguments to return as final response ",-1))])):i("v-if",!0)])):i("v-if",!0)])]),i(" Max Turns "),o("div",null,[S(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?i("v-if",!0):(s(),l("p",xl," Maximum turns this side can take before yielding (safety limit) "))]),i(" End Conversation Tool "),o("div",null,[S(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?i("v-if",!0):(s(),l("p",kl," Tool that ends the entire conversation when called "))])],64))])])]))]),_:1},8,["model-value","title"])}const Sl=Y(Hs,[["render",Cl],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/AgentModal.vue"]]),Tl={},Ml={class:"p-8 w-full max-w-7xl mx-auto"};function Vl(u,t){return s(),l("div",Ml,[De(u.$slots,"default")])}const je=Y(Tl,[["render",Vl],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/CenteredContentView.vue"]]),Il=ee({__name:"AgentsView",setup(u,{expose:t}){t();const a=Ue(),e=Pe(),c=m(!1),d=m("add"),r=m(null),n=m(null);re(()=>e.query.refresh,()=>{e.query.refresh&&(n.value?.refresh(),a.replace({path:"/agents",query:{}}))});const f={router:a,route:e,showModal:c,modalMode:d,editingAgent:r,dataTableRef:n,handleAdd:()=>{d.value="add",r.value=null,c.value=!0},handleEdit:h=>{d.value="edit",r.value=h,c.value=!0},handleSave:async h=>{try{const w=d.value==="edit"&&r.value?.id,{originalName:x,...k}=h,C=J(w?`/api/agents/${r.value.id}`:"/api/agents"),_=await fetch(C,{method:w?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});if(_.ok)n.value?.refresh(),c.value=!1,r.value=null;else{const V=await _.json();alert(V.error||`Failed to ${w?"update":"create"} agent`)}}catch(w){console.error(`Error ${d.value==="edit"?"updating":"creating"} agent:`,w),alert(`Failed to ${d.value==="edit"?"update":"create"} agent`)}},AgentsDataTable:Sa,AgentModal:Sl,CenteredContentView:je};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}});function Al(u,t,a,e,c,d){return s(),Z(e.CenteredContentView,null,{default:oe(()=>[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-gray-600 dark:text-gray-400 mb-6"},"Configure and manage your AI agents.",-1)),S(e.AgentsDataTable,{ref:"dataTableRef",onAdd:e.handleAdd,onEdit:e.handleEdit},null,512),S(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 Pl=Y(Il,[["render",Al],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/AgentsView.vue"]]);function El(u){const{limit:t=50,offset:a=0,agentId:e=null,userId:c=null,autoFetch:d=!0}={},r=z(()=>{const C=new URLSearchParams,y=typeof t=="number"?t:t.value,_=typeof a=="number"?a:a.value,V=typeof e=="string"?e:e?.value,U=typeof c=="string"?c:c?.value;return C.append("limit",y.toString()),C.append("offset",_.toString()),V&&C.append("agent_id",V),U&&C.append("user_id",U),J(`/api/threads?${C.toString()}`)}),{data:n,error:p,isFetching:v,isFinished:g,execute:f,abort:h}=ve(r,{immediate:d}).get().json(),w=z(()=>n.value?.threads||[]),x=z(()=>n.value?.total||0),k=z(()=>n.value?.hasMore||!1);return{threads:w,total:x,hasMore:k,error:p,isFetching:v,isFinished:g,refetch:f,abort:h}}function it(u){const t=z(()=>!!(typeof u=="string"?u:u?.value)),a=z(()=>{const g=typeof u=="string"?u:u?.value;return J(g?`/api/threads/${g}`:"/api/threads/placeholder")}),{data:e,error:c,isFetching:d,isFinished:r,execute:n,abort:p}=ve(a,{immediate:!1}).get().json();return re(t,g=>{g&&n()},{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:d,isFinished:r,refetch:n,abort:p}}function Ll(u){const{autoConnect:t=!0,onEvent:a}=u||{},e=m(null),c=m(!1),d=m(null),r=()=>{e.value&&e.value.close();const p=window.location.protocol==="https:"?"wss:":"ws:",v=window.location.host;let g=`${p}//${v}${J("/api/events")}`;const f=localStorage.getItem("auth_token");f&&(g+=`?token=${encodeURIComponent(f)}`);try{e.value=new WebSocket(g),e.value.onopen=()=>{c.value=!0,d.value=null,console.log("[AgentBuilderEvents] WebSocket connected")},e.value.onmessage=h=>{try{const w=JSON.parse(h.data);console.log("[AgentBuilderEvents] Received event:",w.type),a&&a(w)}catch(w){console.error("[AgentBuilderEvents] Failed to parse WebSocket message:",w)}},e.value.onerror=h=>{d.value="WebSocket connection error",c.value=!1,console.error("[AgentBuilderEvents] WebSocket error:",h)},e.value.onclose=()=>{c.value=!1,console.log("[AgentBuilderEvents] WebSocket disconnected")}}catch(h){d.value=h.message||"Failed to create WebSocket",console.error("[AgentBuilderEvents] WebSocket creation error:",h)}},n=()=>{e.value&&(e.value.close(),e.value=null,c.value=!1)};return t&&r(),Te(()=>{n()}),{wsConnected:c,wsError:d,connect:r,disconnect:n}}const Ol=ee({__name:"Loader",props:{size:{type:String,required:!1,default:"md"}},setup(u,{expose:t}){t();const a=u,e=z(()=>{switch(a.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:a,sizeClasses:e};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}}),jl={class:"inline-flex items-center justify-center"};function Dl(u,t,a,e,c,d){return s(),l("div",jl,[o("div",{class:G([e.sizeClasses,"border-black/20 dark:border-white/20 border-t-black dark:border-t-white rounded-full animate-spin"])},null,2)])}const qe=Y(Ol,[["render",Dl],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/Loader.vue"]]);function Ul(u){const a=Date.now()*1e3-u,e=Math.floor(a/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 d=Math.floor(c/60);if(d<24)return d===1?"1 hour ago":`${d} hours ago`;const r=Math.floor(d/24);if(r<30)return r===1?"1 day ago":`${r} days ago`;const n=Math.floor(r/30);if(n<12)return n===1?"1 month ago":`${n} months ago`;const p=Math.floor(n/12);return p===1?"1 year ago":`${p} years ago`}function ql(u){const t=m("");let a=null;const e=()=>typeof u=="function"?u():typeof u=="number"?u:u.value,c=()=>{const d=e();t.value=Ul(d);const n=Date.now()*1e3-d,p=Math.floor(n/1e6);a!==null&&(clearInterval(a),a=null),p<60?a=setInterval(c,1e3):p<3600?a=setInterval(c,6e4):p<86400&&(a=setInterval(c,6e5))};return c(),Te(()=>{a!==null&&clearInterval(a)}),t}const Nl=ee({__name:"TimeAgo",props:{timestamp:{type:Number,required:!0}},setup(u,{expose:t}){t();const a=u,e=ql(()=>a.timestamp),c={props:a,timeString:e};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}});function Bl(u,t,a,e,c,d){return s(),l("span",null,b(e.timeString),1)}const dt=Y(Nl,[["render",Bl],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/TimeAgo.vue"]]),Rl=ee({__name:"ThreadListPane",props:{selectedThreadId:{type:[String,null],required:!0}},emits:["selectThread","collapse","createThread"],setup(u,{expose:t,emit:a}){const e=u,c=a,d=m(""),{threads:r,isFetching:n,error:p,refetch:v}=El(),g=m([]),f=m(new Set),h=z(()=>{const _=r.value.filter(D=>!f.value.has(D.id)),V=new Set(_.map(D=>D.id));return[...g.value.filter(D=>!V.has(D.id)&&!f.value.has(D.id)),..._].sort((D,j)=>j.created_at-D.created_at)}),w=async _=>{if(_.type==="thread_created"){const V={id:_.thread.id,agent_id:_.thread.agent_name,user_id:_.thread.user_id,tags:_.thread.tags||[],created_at:_.thread.created_at,agent:{title:_.thread.agent_name,type:"ai_human"}};g.value.unshift(V)}else _.type==="thread_deleted"&&(f.value.add(_.threadId),g.value=g.value.filter(V=>V.id!==_.threadId))},{wsConnected:x,wsError:k}=Ll({onEvent:w});re(r,()=>{g.value=[]}),t({refetch:v});const y={props:e,emit:c,searchQuery:d,fetchedThreads:r,isFetching:n,error:p,refetch:v,wsAddedThreads:g,wsRemovedThreadIds:f,threads:h,handleEvent:w,wsConnected:x,wsError:k,handleThreadClick:_=>{c("selectThread",_)},Loader:qe,TimeAgo:dt,get ListIcon(){return Ct},get ChevronLeftIcon(){return Xe}};return Object.defineProperty(y,"__isScriptSetup",{enumerable:!1,value:!0}),y}}),Fl={class:"flex flex-col flex-1"},zl={class:"p-4 border-b border-gray-300 dark:border-neutral-700"},Hl={class:"flex items-center justify-between"},Wl={class:"flex items-center gap-2"},Jl={class:"flex items-center gap-2"},Kl={class:"text-xs pr-5"},Zl={key:0,class:"text-green-600 dark:text-green-400 flex items-center gap-1"},Gl={key:1,class:"text-red-600 dark:text-red-400"},Xl={key:2,class:"text-gray-400 dark:text-gray-600"},Ql={class:"flex-1 overflow-y-auto text-xs"},Yl={key:0,class:"p-2 flex justify-center"},$l={class:"p-2 text-red-600 dark:text-red-400"},en=["id","onClick"],tn={class:"flex items-center gap-2 mb-1"},on={class:"font-medium truncate flex-1 min-w-0"},rn={class:"flex-shrink-0 text-gray-500 dark:text-gray-400"},an={key:0,class:"flex flex-wrap gap-1"};function sn(u,t,a,e,c,d){return s(),l("div",Fl,[i(" Header (matches MessagesPane style) "),o("div",zl,[o("div",Hl,[o("div",Wl,[S(e.ListIcon,{size:20,class:"flex-shrink-0"}),t[2]||(t[2]=o("h2",{class:"text-xl font-bold"},"Threads",-1))]),o("div",Jl,[i(" WebSocket status "),o("div",Kl,[e.wsConnected?(s(),l("span",Zl,[...t[3]||(t[3]=[o("span",{class:"inline-block w-2 h-2 rounded-full bg-green-600 dark:bg-green-400"},null,-1),ie(" Live ",-1)])])):e.wsError?(s(),l("span",Gl," ● Error ")):(s(),l("span",Xl," ○ Offline "))]),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-gray-100 dark:hover:bg-gray-900 rounded transition-colors",title:"Collapse pane"},[S(e.ChevronLeftIcon,{size:20})])])])]),i(" Thread list "),o("div",Ql,[i(" Loading state "),e.isFetching?(s(),l("div",Yl,[S(e.Loader)])):e.error?(s(),l(W,{key:1},[i(" Error state "),o("div",$l," Error: "+b(e.error),1)],2112)):e.threads.length===0?(s(),l(W,{key:2},[i(" Empty state "),t[4]||(t[4]=o("div",{class:"text-gray-500 dark:text-gray-400 text-center py-12 text-base"}," No threads found ",-1))],2112)):(s(),l(W,{key:3},[i(" Thread items - two line layout "),o("div",null,[(s(!0),l(W,null,ne(e.threads,r=>(s(),l("button",{key:r.id,id:`thread-${r.id}`,class:G(["w-full text-left px-2 py-2 border-b border-gray-200 dark:border-neutral-800 hover:bg-gray-100 dark:hover:bg-gray-900 transition-colors",{"bg-gray-100 dark:bg-gray-900":a.selectedThreadId===r.id}]),onClick:n=>e.handleThreadClick(r.id)},[i(" First line: Title and time "),o("div",tn,[o("span",on,b(r.agent.title),1),o("span",rn,[S(e.TimeAgo,{timestamp:r.created_at*1e6},null,8,["timestamp"])])]),i(" Second line: Tags "),r.tags.length>0?(s(),l("div",an,[(s(!0),l(W,null,ne(r.tags,n=>(s(),l("span",{key:n,class:"inline-block px-1.5 py-0.5 rounded text-[10px] bg-gray-200 dark:bg-gray-800 text-gray-700 dark:text-gray-300"},b(n),1))),128))])):i("v-if",!0)],10,en))),128))])],2112))])])}const ln=Y(Rl,[["render",sn],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/ThreadListPane.vue"]]),We=150;function nn(u,t={}){const{enableWebSocket:a=!0,autoConnect:e=!0}=t,c=m([]),d=m(null),r=m(!1),n=m(!1),p=m(null),v=m(!1),g=m(null),f=m(!1),h=m(!1),w=m(0),x=m(0);let k=null,C=null;function y(N){if(!d.value?.agent)return null;const X=d.value.agent,Q=N==="assistant"?"A":"B";return Q==="A"&&X.side_a_label?X.side_a_label:Q==="B"&&X.side_b_label?X.side_b_label:null}function _(N,X){return N==="system"||X==="system"?!1:N!==X}const V=z(()=>{const N=[],X=c.value.filter(I=>(I.depth??0)===0),Q=new Map;for(let I=0;I<X.length;I++){const T=X[I],q=T.role;if(q==="tool"){const ae=T.tool_call_id;if(ae&&Q.has(ae)){const ue=Q.get(ae),me=N[ue],we=me.items.find(ke=>ke.type==="tool_call"&&ke.tool_call_id===ae);if(we){we.response=T.content||"",we.response_log_id=T.log_id;const ke=(T.content||"").toLowerCase(),be=ke.length,He=ke.includes("failed")||ke.includes("error"),Me=be<500;He&&Me?we.response_status="failed":we.response_status="success"}me.updated_at=T.created_at,Q.delete(ae)}continue}const M=y(q==="tool"?"assistant":q),O=N[N.length-1],A=O?.role;O&&_(q,A)&&O.type==="work"&&!O.isComplete&&(O.isComplete=!0);let B=null;if(T.tool_calls)if(typeof T.tool_calls=="string")try{B=JSON.parse(T.tool_calls)}catch(ae){console.error("Failed to parse tool_calls:",ae)}else Array.isArray(T.tool_calls)&&(B=T.tool_calls);const te=B&&B.length>0,le=O?.type==="work"&&O.role===q&&!O.isComplete;if(te){let ae,ue;le?(ae=O,ue=N.length-1):(ae={type:"work",id:T.id,role:q,items:[],created_at:T.created_at,updated_at:T.created_at,isComplete:!1,sideLabel:M,isExpanded:!1,request_sent_at:T.request_sent_at,response_completed_at:T.response_completed_at,status:T.status||"completed"},N.push(ae),ue=N.length-1),T.reasoning_content&&ae.items.push({id:`${T.id}-reasoning`,type:"reasoning",content:T.reasoning_content,created_at:T.created_at,log_id:T.log_id}),T.content&&ae.items.push({id:`${T.id}-content`,type:"content",content:T.content,created_at:T.created_at,log_id:T.log_id}),B.forEach(me=>{ae.items.push({id:me.id,type:"tool_call",content:me.function.name,created_at:T.created_at,tool_name:me.function.name,tool_call_id:me.id,tool_arguments:me.function.arguments,log_id:T.log_id,response:null,response_status:"pending",response_log_id:null}),Q.set(me.id,ue)}),ae.updated_at=T.created_at,T.response_completed_at&&(ae.response_completed_at=T.response_completed_at),T.status&&T.status!=="completed"?ae.status=T.status:T.status==="completed"&&ae.status==="pending"&&(ae.status="completed")}else le&&T.status!=="pending"&&(O.isComplete=!0),(T.content||q==="system"||T.status==="pending")&&N.push({type:"text",id:T.id,role:q,content:T.content||"",created_at:T.created_at,log_id:T.log_id,sideLabel:M,isOptimistic:T.isOptimistic,status:T.status})}const L=N[N.length-1];return L?.type==="work"&&!L.isComplete&&(L.isComplete=!0),N});async function U(){if(!u.value){c.value=[],d.value=null,h.value=!1,w.value=0,x.value=0;return}r.value=!0,p.value=null;try{const N=await fetch(J(`/api/threads/${u.value}/messages?limit=${We}&includeSilent=true`));if(!N.ok)throw new Error(`Failed to fetch messages: ${N.statusText}`);const X=await N.json();c.value=X.messages||[],h.value=X.hasMore||!1,w.value=X.total||0,x.value=We,console.log(`Loaded ${c.value.length} messages, total: ${w.value}, hasMore: ${h.value}`);const Q=await fetch(J(`/api/threads/${u.value}`));if(Q.ok){const L=await Q.json();d.value=L}}catch(N){p.value=N instanceof Error?N.message:"Unknown error",console.error("Error fetching messages:",N)}finally{r.value=!1}}async function D(){if(!(!u.value||n.value||!h.value)){n.value=!0;try{const N=await fetch(J(`/api/threads/${u.value}/messages?limit=${We}&offset=${x.value}`));if(!N.ok)throw new Error(`Failed to fetch more messages: ${N.statusText}`);const X=await N.json(),Q=X.messages||[];c.value=[...Q,...c.value],h.value=X.hasMore||!1,x.value+=We,console.log(`Loaded ${Q.length} more messages, offset now: ${x.value}, hasMore: ${h.value}`)}catch(N){p.value=N instanceof Error?N.message:"Unknown error",console.error("Error loading more messages:",N)}finally{n.value=!1}}}function j(){if(!(!a||!u.value||k))try{let X=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${J(`/api/threads/${u.value}/stream?includeSilent=true`)}`;const Q=localStorage.getItem("auth_token");Q&&(X+=`&token=${encodeURIComponent(Q)}`),k=new WebSocket(X),k.onopen=()=>{v.value=!0,g.value=null,console.log("WebSocket connected")},k.onmessage=L=>{try{if(L.data==="pong")return;const I=JSON.parse(L.data);if(I.type==="message_data"&&I.message_id){const T=I.message_id,q=I.data,M=c.value.findIndex(O=>O.id===T);if(M>=0)c.value[M]={...c.value[M],...q,id:T};else{const O={id:T,...q},A=c.value.filter(B=>{if(!B.isOptimistic)return!0;if(B.id===T)return!1;const te=B.content===O.content,le=B.role===O.role,ae=Math.abs(B.created_at-O.created_at)<5e6;return!(te&&le&&ae)});A.push(O),c.value=A.sort((B,te)=>B.created_at-te.created_at)}if(q.status==="pending")f.value=!0;else if(q.status==="completed"||q.status==="failed"){const O=c.value.some(A=>{if((A.depth??0)>0)return!1;if(A.status==="pending"||A.role==="tool"&&A.tool_call_id&&!A.tool_status)return!0;if(A.tool_calls)try{const te=JSON.parse(A.tool_calls);if(Array.isArray(te)&&te.length>0&&!te.every(ae=>c.value.some(ue=>(ue.depth??0)===0&&ue.role==="tool"&&ue.tool_call_id===ae.id&&ue.tool_status)))return!0}catch{}return!1});f.value=O}}else if(I.type==="message_chunk"){const T=I.message_id,q=I.chunk,M=c.value.findIndex(O=>O.id===T);if(M>=0){const O=c.value[M].content||"",A={...c.value[M],content:O+q};c.value.splice(M,1,A)}else{const O={id:T,role:"assistant",content:q,created_at:Date.now()*1e3,status:"pending"};c.value.push(O),c.value=c.value.sort((A,B)=>A.created_at-B.created_at)}}else I.type==="event"?console.log("📡",I.eventType,I.data):I.type==="error"&&(g.value=I.error||"WebSocket error",console.error("WebSocket error:",I.error))}catch(I){console.error("Error parsing WebSocket message:",I)}},k.onerror=L=>{g.value="WebSocket connection error",console.error("WebSocket error:",L)},k.onclose=()=>{v.value=!1,k=null,u.value&&a&&(C=setTimeout(()=>{console.log("Attempting WebSocket reconnect..."),j()},3e3))}}catch(N){g.value=N instanceof Error?N.message:"Unknown error",console.error("Error connecting WebSocket:",N)}}function F(){C&&(clearTimeout(C),C=null),k&&(k.close(),k=null,v.value=!1)}async function K(){await U()}function E(N){c.value.push({...N,isOptimistic:!0})}function P(N){c.value=c.value.filter(X=>X.id!==N)}async function H(N){if(!u.value)return;const X=[...c.value];c.value=c.value.filter(Q=>Q.id!==N);try{if(!(await fetch(J(`/api/threads/${u.value}/messages/${N}`),{method:"DELETE"})).ok)throw c.value=X,new Error("Failed to delete message")}catch(Q){throw c.value=X,Q}}async function R(){if(u.value){f.value=!1;try{if(!(await fetch(J(`/api/threads/${u.value}/stop`),{method:"POST"})).ok)throw new Error("Failed to stop thread")}catch(N){throw console.error("Error stopping thread:",N),N}}}return re(u,async(N,X)=>{N!==X&&(F(),N?(await U(),e&&a&&j()):(c.value=[],d.value=null))},{immediate:e}),Te(()=>{F()}),{messages:V,threadInfo:d,isFetching:r,isLoadingMore:n,error:p,wsConnected:v,wsError:g,isExecuting:f,hasMore:h,totalMessages:w,refetch:K,loadMoreMessages:D,connectWebSocket:j,disconnectWebSocket:F,addOptimisticMessage:E,removeOptimisticMessage:P,deleteMessageById:H,stopThread:R}}const dn=ee({__name:"AgentMessages",props:{messages:{type:Array,required:!0},selectedMessageId:{type:[String,null],required:!1},selectedLogId:{type:[String,null],required:!1}},emits:["messageClick","deleteMessage"],setup(u,{expose:t,emit:a}){t();const e=u,c=a,d=m(null),r=m(new Set),n=m(new Set),p=m(new Set);function v(E){r.value.has(E)?r.value.delete(E):r.value.add(E)}function g(E){n.value.has(E)?n.value.delete(E):n.value.add(E)}function f(E){p.value.has(E)?p.value.delete(E):p.value.add(E)}function h(E){if(!E)return{};try{return JSON.parse(E)}catch{return{raw:E}}}function w(E){if(!E)return null;const P=h(E),H=Object.keys(P);if(H.length===0)return null;const R=P[H[0]];return typeof R=="string"?R:JSON.stringify(R)}function x(E){return new Date(E/1e3).toLocaleTimeString()}function k(E){const P=Math.round(E/1e6);if(P<1)return"< 1s";if(P<60)return`${P}s`;const H=Math.floor(P/60),R=P%60;return`${H}m ${R}s`}function C(E){if(E.status==="pending")return"...";if(!E.isComplete)return"Working...";let P;return E.request_sent_at&&E.response_completed_at?P=E.response_completed_at-E.request_sent_at:P=E.updated_at-E.created_at,`Worked for ${k(P)}`}function y(E){const P=E.filter(H=>H.type==="content");if(P.length===0){const H=E.filter(R=>R.type==="reasoning");return H.length>0?H[H.length-1].content:null}return P[P.length-1].content}function _(E){const P=E.split(`
|
|
2
|
-
`)[0];return P.length>60?P.substring(0,60):P}function V(E){const P=E.filter(H=>H.type==="tool_call");return P.length===0?null:P[P.length-1].tool_name||null}function U(E){return e.selectedMessageId===E.id?!0:e.selectedLogId?E.items.some(P=>P.log_id===e.selectedLogId):!1}function D(E){return!!(e.selectedLogId&&E.log_id===e.selectedLogId)}function j(){return e.messages.some(E=>E.type==="work"&&!E.isComplete)}function F(E){return!E.isComplete}const K={props:e,emit:c,hoveredMessageId:d,expandedMessages:r,expandedToolCalls:n,expandedReasoning:p,toggleWorkMessage:v,toggleToolCall:g,toggleReasoning:f,parseArguments:h,getArgumentsPreview:w,formatTime:x,formatDuration:k,getWorkStatus:C,getLatestContent:y,getFirstLine:_,getLatestToolName:V,isWorkMessageSelected:U,isWorkItemSelected:D,hasActiveWorkMessage:j,isWorkMessageActive:F,get ChevronDownIcon(){return ao},get ChevronRightIcon(){return ro},get AlertTriangleIcon(){return oo},get Trash2Icon(){return St}};return Object.defineProperty(K,"__isScriptSetup",{enumerable:!1,value:!0}),K}}),cn={class:"space-y-3"},un=["onMouseenter"],pn=["onClick"],mn={key:1,class:"w-full text-center text-xs text-gray-400 dark:text-gray-500 py-1"},gn=["onClick"],fn={key:0,class:"whitespace-pre-wrap text-sm"},hn={key:0,class:"opacity-50"},vn={key:1,class:"opacity-50 italic text-gray-500 dark:text-gray-400"},bn=["onClick"],yn=["onClick"],xn={key:0,class:"space-y-1"},kn={class:"flex items-start gap-2"},_n={class:"flex-1 min-w-0"},wn={key:0,class:"truncate opacity-80"},Cn={key:1,class:"italic opacity-60"},Sn={class:"flex items-center gap-2 pl-5 opacity-60"},Tn={class:"text-[10px]"},Mn={class:"text-[10px]"},Vn={class:"space-y-2"},In={class:"flex items-center gap-2 pb-1 border-b border-current opacity-70"},An={class:"text-[10px] italic"},Pn={class:"text-[10px] ml-auto"},En={key:0,class:"space-y-1"},Ln=["onClick"],On={class:"font-mono text-[11px] flex-shrink-0"},jn={key:2,class:"text-[10px] opacity-60 px-2 truncate flex-1 min-w-0"},Dn={key:3,class:"text-[10px] text-green-600 dark:text-green-400 ml-auto flex-shrink-0"},Un={key:0,class:"pl-4 space-y-2 text-[10px]"},qn={key:0},Nn={class:"w-full border-collapse"},Bn={class:"py-0.5 pr-2 opacity-65 align-top"},Rn={class:"py-0.5 opacity-85 break-all"},Fn={key:1},zn=["onClick"],Hn={class:"whitespace-pre-wrap break-all"},Wn={class:"text-[10px]"},Jn=["onClick"],Kn={key:0,class:"mt-1 pl-4 whitespace-pre-wrap opacity-80"},Zn={class:"text-[10px] opacity-80 pl-4 pb-2"},Gn=["onClick"];function Xn(u,t,a,e,c,d){return s(),l("div",cn,[(s(!0),l(W,null,ne(a.messages,r=>(s(),l("div",{key:r.id,class:G(["flex items-center gap-2",{"justify-start":r.role==="assistant","justify-end":r.role==="user","justify-center":r.role==="system"}]),onMouseenter:n=>e.hoveredMessageId=r.id,onMouseleave:t[0]||(t[0]=n=>e.hoveredMessageId=null)},[i(" Delete button for user messages (left side) "),r.role==="user"&&e.hoveredMessageId===r.id&&!r.isOptimistic?(s(),l("button",{key:0,onClick:he(n=>e.emit("deleteMessage",r.id),["stop"]),class:"flex-shrink-0 w-6 h-6 rounded-full bg-red-500 text-white hover:bg-red-600 flex items-center justify-center transition-all",title:"Delete message"},[S(e.Trash2Icon,{size:14})],8,pn)):i("v-if",!0),i(" Interruption message (iOS style) "),r.type==="text"&&r.role==="system"&&r.content?.includes("Execution stopped")?(s(),l("div",mn,b(r.content),1)):r.type==="text"?(s(),l(W,{key:2},[i(" Text Message "),o("div",{class:G(["max-w-[80%] rounded-2xl px-4 py-2 text-sm cursor-pointer transition-all min-h-[2.5rem]",{"bg-black text-white dark:bg-white dark:text-black":r.role==="assistant"&&!r.silent,"bg-gray-200 text-black dark:bg-gray-800 dark:text-white":r.role==="user"&&!r.silent,"bg-gray-100 text-gray-600 dark:bg-gray-900 dark:text-gray-400 text-xs":r.role==="system"&&!r.silent,"bg-gray-300 text-gray-500 dark:bg-gray-700 dark:text-gray-400 opacity-70 border-2 border-dashed border-gray-400 dark:border-neutral-500":r.silent,"ring-2 ring-blue-500":r.id===a.selectedMessageId||a.selectedLogId&&r.log_id===a.selectedLogId,"opacity-60":r.isOptimistic}]),onClick:n=>e.emit("messageClick",r.id,r.log_id||null)},[i(" Message content or typing indicator "),r.content?(s(),l("div",fn,b(r.content),1)):r.status==="pending"?(s(),l(W,{key:1},[i(" Typing indicator for pending messages with no content "),t[1]||(t[1]=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)):i("v-if",!0),i(" Label and Timestamp (hide when pending) "),r.status!=="pending"?(s(),l("div",{key:2,class:G(["text-xs mt-1 opacity-60 flex gap-2",{"justify-start":r.role==="assistant","justify-end":r.role!=="assistant"}])},[r.sideLabel?(s(),l("span",hn,b(r.sideLabel),1)):i("v-if",!0),o("span",null,b(e.formatTime(r.created_at)),1),r.silent?(s(),l("span",vn," silent ")):i("v-if",!0)],2)):i("v-if",!0)],10,gn)],2112)):i("v-if",!0),i(" Delete button for assistant messages (right side) "),r.type==="text"&&r.role==="assistant"&&e.hoveredMessageId===r.id&&!r.isOptimistic?(s(),l("button",{key:3,onClick:he(n=>e.emit("deleteMessage",r.id),["stop"]),class:"flex-shrink-0 w-6 h-6 rounded-full bg-red-500 text-white hover:bg-red-600 flex items-center justify-center transition-all",title:"Delete message"},[S(e.Trash2Icon,{size:14})],8,bn)):r.type==="work"?(s(),l(W,{key:4},[i(" Work Message "),o("div",{class:G(["max-w-[80%] min-w-[200px] rounded-lg px-3 py-2 text-xs cursor-pointer transition-all border",{"bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-900 dark:text-gray-300 dark:border-neutral-700":r.role==="assistant"&&!r.silent,"bg-blue-50 text-blue-700 border-blue-200 dark:bg-blue-950 dark:text-blue-300 dark:border-blue-800":r.role==="user"&&!r.silent,"bg-gray-200 text-gray-500 border-gray-400 dark:bg-gray-800 dark:text-gray-400 dark:border-neutral-600 opacity-70 border-dashed":r.silent,"ring-2 ring-blue-500":e.isWorkMessageSelected(r)}]),onClick:n=>e.toggleWorkMessage(r.id)},[i(" Collapsed state "),e.expandedMessages.has(r.id)?(s(),l(W,{key:1},[i(" Expanded state "),o("div",Vn,[i(" Status header "),o("div",In,[S(e.ChevronDownIcon,{size:14,class:"flex-shrink-0"}),o("span",An,b(e.getWorkStatus(r)),1),o("span",Pn,b(r.items.length)+" operation"+b(r.items.length!==1?"s":""),1)]),(s(!0),l(W,null,ne(r.items,n=>(s(),l("div",{key:n.id,class:"mb-1"},[i(" Tool Call (with merged response) "),n.type==="tool_call"?(s(),l("div",En,[i(" Collapsed: Single row with tool name and status "),o("div",{onClick:he(p=>e.toggleToolCall(n.id),["stop"]),class:G(["flex items-center gap-2 cursor-pointer hover:opacity-70 transition-opacity",{"ring-1 ring-blue-500":e.isWorkItemSelected(n)}])},[e.expandedToolCalls.has(n.id)?(s(),Z(e.ChevronDownIcon,{key:1,size:12,class:"flex-shrink-0 opacity-50"})):(s(),Z(e.ChevronRightIcon,{key:0,size:12,class:"flex-shrink-0 opacity-50"})),o("span",On,b(n.tool_name),1),e.getArgumentsPreview(n.tool_arguments)?(s(),l("span",jn,b(e.getArgumentsPreview(n.tool_arguments)),1)):i("v-if",!0),n.response_status==="success"?(s(),l("span",Dn,"✓")):n.response_status==="failed"?(s(),Z(e.AlertTriangleIcon,{key:4,size:12,class:"ml-auto text-red-600 dark:text-red-400"})):i("v-if",!0)],10,Ln),i(" Expanded: Arguments and Response as tables "),e.expandedToolCalls.has(n.id)?(s(),l("div",Un,[i(" Arguments table "),n.tool_arguments?(s(),l("div",qn,[t[2]||(t[2]=o("div",{class:"font-semibold mb-1 opacity-70"},"Arguments:",-1)),o("table",Nn,[o("tbody",null,[(s(!0),l(W,null,ne(e.parseArguments(n.tool_arguments),(p,v)=>(s(),l("tr",{key:v,class:"border-b border-current border-opacity-10"},[o("td",Bn,b(v),1),o("td",Rn,b(typeof p=="object"?JSON.stringify(p):p),1)]))),128))])])])):i("v-if",!0),i(" Response "),n.response?(s(),l("div",Fn,[t[3]||(t[3]=o("div",{class:"font-semibold mb-1 opacity-70"},"Response:",-1)),o("div",{class:G(["opacity-80 cursor-pointer hover:opacity-100",{"ring-1 ring-blue-500":a.selectedLogId&&n.response_log_id===a.selectedLogId}]),onClick:he(p=>n.response_log_id&&e.emit("messageClick",r.id,n.response_log_id),["stop"])},[o("div",Hn,b(n.response),1)],10,zn)])):i("v-if",!0)])):i("v-if",!0)])):n.type==="reasoning"?(s(),l(W,{key:1},[i(" Reasoning (nested expandable) "),o("div",Wn,[o("button",{onClick:he(p=>e.toggleReasoning(n.id),["stop"]),class:"flex items-center gap-1 opacity-70 hover:opacity-100 transition-opacity"},[e.expandedReasoning.has(n.id)?(s(),Z(e.ChevronDownIcon,{key:1,size:12,class:"flex-shrink-0"})):(s(),Z(e.ChevronRightIcon,{key:0,size:12,class:"flex-shrink-0"})),t[4]||(t[4]=o("span",{class:"font-semibold"},"Reasoning",-1))],8,Jn),e.expandedReasoning.has(n.id)?(s(),l("div",Kn,b(n.content),1)):i("v-if",!0)])],2112)):n.type==="content"?(s(),l(W,{key:2},[i(" Content "),o("div",Zn,b(n.content),1)],2112)):i("v-if",!0)]))),128))])],2112)):(s(),l("div",xn,[i(" Preview text or status "),o("div",kn,[S(e.ChevronRightIcon,{size:14,class:"flex-shrink-0 mt-0.5 opacity-50"}),o("div",_n,[e.getLatestContent(r.items)?(s(),l("div",wn,b(e.getFirstLine(e.getLatestContent(r.items)))+"... ",1)):(s(),l("div",Cn,b(e.getWorkStatus(r)),1))])]),i(" Status line "),o("div",Sn,[o("span",Tn,b(r.items.length)+" operation"+b(r.items.length!==1?"s":""),1),o("span",Mn,"• "+b(e.getWorkStatus(r)),1)])]))],10,yn)],2112)):i("v-if",!0),i(" Delete button for work messages on right side (assistant) "),r.type==="work"&&r.role==="assistant"&&e.hoveredMessageId===r.id?(s(),l("button",{key:5,onClick:he(n=>e.emit("deleteMessage",r.id),["stop"]),class:"flex-shrink-0 w-6 h-6 rounded-full bg-red-500 text-white hover:bg-red-600 flex items-center justify-center transition-all",title:"Delete message"},[S(e.Trash2Icon,{size:14})],8,Gn)):i("v-if",!0)],42,un))),128))])}const Qn=Y(dn,[["render",Xn],["__scopeId","data-v-9082ef4d"],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/AgentMessages.vue"]]),Yn=ee({__name:"MessagesPane",props:{threadId:{type:[String,null],required:!0},selectedMessageId:{type:[String,null],required:!1},selectedLogId:{type:[String,null],required:!1}},emits:["collapse","messageClick"],setup(u,{expose:t,emit:a}){t();const e=u,c=a,{messages:d,threadInfo:r,isFetching:n,isLoadingMore:p,error:v,wsConnected:g,wsError:f,isExecuting:h,hasMore:w,totalMessages:x,loadMoreMessages:k,connectWebSocket:C,disconnectWebSocket:y,addOptimisticMessage:_,removeOptimisticMessage:V,deleteMessageById:U,stopThread:D}=nn(z(()=>e.threadId),{enableWebSocket:!0}),{thread:j}=it(z(()=>e.threadId)),F=m(null);typeof window<"u"&&(window.__testLoadMoreMessages=k);const K=m(""),E=m(null),P=m("B"),H=m(!1),R=m(!1),N=async()=>{await pe(),F.value&&(F.value.scrollTop=F.value.scrollHeight)},X=async A=>{A.target.scrollTop<100&&w.value&&!p.value&&!R.value&&(R.value=!0,await k(),R.value=!1)};re(()=>d.value.length,async()=>{!p.value&&!R.value&&await N()}),re(()=>e.threadId,async A=>{A&&await N()}),re(n,async(A,B)=>{B&&!A&&await N()});const Q=z(()=>{const A=r.value?.agent||j.value?.agent;if(!A)return"ai A";const B=A.type;return P.value==="A"&&A.side_a_label?A.side_a_label:P.value==="B"&&A.side_b_label?A.side_b_label:B==="ai_human"?P.value==="A"?"ai":"human":P.value==="A"?"ai A":"ai B"}),L=()=>{P.value=P.value==="A"?"B":"A"},I=async()=>{if(!K.value.trim()||!e.threadId||H.value)return;const A=K.value,B=P.value==="A"?"assistant":"user",te=`optimistic-${Date.now()}`,le={id:te,role:B,content:A,created_at:Date.now()*1e3,isOptimistic:!0};_(le),K.value="",E.value&&(E.value.style.height="auto",E.value.style.height="24px"),H.value=!0;try{if(!(await fetch(J(`/api/threads/${e.threadId}/message`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:A,role:B})})).ok)throw new Error("Failed to send message");await N()}catch(ae){console.error("Error sending message:",ae),V(te)}finally{H.value=!1,await pe(),E.value&&E.value.focus()}},O={props:e,emit:c,messages:d,threadInfo:r,isFetching:n,isLoadingMore:p,error:v,wsConnected:g,wsError:f,isExecuting:h,hasMore:w,totalMessages:x,loadMoreMessages:k,connectWebSocket:C,disconnectWebSocket:y,addOptimisticMessage:_,removeOptimisticMessage:V,deleteMessageById:U,stopThread:D,thread:j,messagesContainer:F,messageInput:K,messageTextarea:E,currentSide:P,isSending:H,isLoadingOlder:R,scrollToBottom:N,handleScroll:X,sideLabel:Q,toggleSide:L,sendMessage:I,handleKeyDown:A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),I())},handleDeleteMessage:async A=>{if(e.threadId)try{await U(A)}catch(B){console.error("Error deleting message:",B)}},handleStopThread:async()=>{if(e.threadId)try{await D()}catch(A){console.error("Error stopping thread:",A)}},AgentMessages:Qn,Loader:qe,get MessageSquareIcon(){return Tt},get ChevronLeftIcon(){return Xe}};return Object.defineProperty(O,"__isScriptSetup",{enumerable:!1,value:!0}),O}}),$n={class:"flex flex-col h-full"},ei={class:"p-4 border-b border-gray-300 dark:border-neutral-700"},ti={class:"flex items-center justify-between"},oi={class:"flex items-center gap-2"},ri={class:"flex items-center gap-2"},ai={key:0,class:"text-xs"},si={key:0,class:"text-green-600 dark:text-green-400 flex items-center gap-1"},li={key:1,class:"text-red-600 dark:text-red-400"},ni={key:2,class:"text-gray-400 dark:text-gray-600"},ii={key:0,class:"text-gray-500 dark:text-gray-400 text-center py-8"},di={key:1,class:"flex justify-center py-2"},ci={class:"flex justify-center py-8"},ui={class:"text-red-600 dark:text-red-400 text-center py-8"},pi={key:0,class:"p-3 bg-white dark:bg-black"},mi={class:"flex items-start gap-2"},gi={class:"flex-1 flex items-start gap-2 p-2 rounded-2xl border border-gray-300 dark:border-neutral-700 bg-white dark:bg-gray-900"},fi=["disabled"],hi=["disabled"],vi={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"},bi={key:1,class:"w-4 h-4"};function yi(u,t,a,e,c,d){return s(),l("div",$n,[i(" Header "),o("div",ei,[o("div",ti,[o("div",oi,[S(e.MessageSquareIcon,{size:20,class:"flex-shrink-0"}),t[4]||(t[4]=o("h2",{class:"text-xl font-bold"},"Messages",-1))]),o("div",ri,[i(" WebSocket status "),a.threadId?(s(),l("div",ai,[e.wsConnected?(s(),l("span",si,[...t[5]||(t[5]=[o("span",{class:"inline-block w-2 h-2 rounded-full bg-green-600 dark:bg-green-400"},null,-1),ie(" Live ",-1)])])):e.wsError?(s(),l("span",li," ● Error ")):(s(),l("span",ni," ○ Offline "))])):i("v-if",!0),o("button",{onClick:t[0]||(t[0]=r=>e.emit("collapse")),type:"button",class:"p-1 hover:bg-gray-100 dark:hover:bg-gray-900 rounded transition-colors",title:"Collapse pane"},[S(e.ChevronLeftIcon,{size:20})])])])]),i(" Messages content "),o("div",{ref:"messagesContainer",class:"flex-1 overflow-y-auto p-4 space-y-4",onScroll:e.handleScroll},[i(" No thread selected "),a.threadId?i("v-if",!0):(s(),l("div",ii," Select a thread to view messages ")),i(" Loading older messages indicator "),e.isLoadingMore?(s(),l("div",di,[S(e.Loader,{size:"sm"}),t[6]||(t[6]=o("span",{class:"ml-2 text-xs text-gray-500"},"Loading older messages...",-1))])):e.isFetching?(s(),l(W,{key:2},[i(" Loading state "),o("div",ci,[S(e.Loader)])],2112)):e.error?(s(),l(W,{key:3},[i(" Error state "),o("div",ui," Error loading messages: "+b(e.error),1)],2112)):e.messages.length===0?(s(),l(W,{key:4},[i(" Empty state "),t[7]||(t[7]=o("div",{class:"text-gray-500 dark:text-gray-400 text-center py-8"}," No messages yet ",-1))],2112)):(s(),l(W,{key:5},[i(" Message bubbles (using AgentMessages component) "),S(e.AgentMessages,{messages:e.messages,selectedMessageId:a.selectedMessageId,selectedLogId:a.selectedLogId,onMessageClick:t[1]||(t[1]=(r,n)=>e.emit("messageClick",r,n)),onDeleteMessage:e.handleDeleteMessage},null,8,["messages","selectedMessageId","selectedLogId"])],2112))],544),i(" Message input section (iOS-style single bubble) "),a.threadId?(s(),l("div",pi,[o("div",mi,[i(" Side toggle tag (outside bubble) "),o("button",{onClick:e.toggleSide,class:G(["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-gray-300 text-black dark:bg-gray-600 dark:text-white":e.currentSide==="B"}]),title:"Toggle between sides"},b(e.sideLabel),3),i(" Input bubble "),o("div",gi,[i(" Message input (no border, transparent) "),fe(o("textarea",{ref:"messageTextarea","onUpdate:modelValue":t[2]||(t[2]=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[3]||(t[3]=r=>{const n=r.target;n.style.height="auto",n.style.height=Math.min(n.scrollHeight,120)+"px"})},null,40,fi),[[_e,e.messageInput]]),i(" Send/Stop button (inside bubble) "),e.isExecuting?(s(),l(W,{key:1},[i(" 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[9]||(t[9]=[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)):(s(),l("button",{key:0,id:"send-message-button",onClick:e.sendMessage,disabled:!e.messageInput.trim()||e.isSending,class:G(["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-gray-200 text-gray-400 dark:bg-gray-700 dark:text-gray-600":!e.messageInput.trim()||e.isSending}]),title:"Send message (Enter)"},[e.isSending?(s(),l("div",bi,[S(e.Loader)])):(s(),l("svg",vi,[...t[8]||(t[8]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"},null,-1)])]))],10,hi))])])])):i("v-if",!0)])}const xi=Y(Yn,[["render",yi],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/MessagesPane.vue"]]),ki=ee({__name:"MetaPane",props:{threadId:{type:[String,null],required:!0}},emits:["collapse","threadDeleted","editThread"],setup(u,{expose:t,emit:a}){t();const e=u,c=a,{thread:d,isFetching:r,error:n}=it(z(()=>e.threadId)),p=m(!1),v=m(!1),g=m(!1),f=m(!1),h=m(""),w=m(!1),x=m(!1),k=m(null),{data:C,isFetching:y}=ve(J("/api/agents"),{refetch:!0}).json(),_=z(()=>C.value?.agents?C.value.agents.filter(R=>R.type==="ai_human").map(R=>({value:R.id,label:R.title,description:`Type: ${R.type}`})):[]),V=z(()=>d.value?.agent.type==="ai_human"),H={props:e,emit:c,thread:d,isFetching:r,error:n,showDeleteConfirm:p,isDeleting:v,isEditingAgent:g,isSavingAgent:f,selectedAgentId:h,showCostBreakdown:w,isFetchingCost:x,costData:k,agentsData:C,isFetchingAgents:y,aiHumanAgents:_,isAiHumanAgent:V,formatDate:R=>new Date(R*1e3).toLocaleString(),startEditingAgent:()=>{d.value&&(h.value=d.value.agent.id,g.value=!0)},cancelEditingAgent:()=>{g.value=!1,h.value=""},saveAgent:async()=>{if(!(!e.threadId||!h.value)){f.value=!0;try{const R=await fetch(J(`/api/threads/${e.threadId}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent_id:h.value})});if(!R.ok){const N=await R.json();throw new Error(N.error||"Failed to update agent")}window.location.reload()}catch(R){console.error("Error updating agent:",R),alert(`Failed to update agent: ${R.message}`)}finally{f.value=!1}}},fetchCostBreakdown:async()=>{if(e.threadId){x.value=!0,w.value=!0;try{const R=await fetch(J(`/api/threads/${e.threadId}/cost`));if(!R.ok){const N=await R.json();throw new Error(N.error||"Failed to fetch cost breakdown")}k.value=await R.json()}catch(R){console.error("Error fetching cost breakdown:",R),alert(`Failed to fetch cost breakdown: ${R.message}`),w.value=!1}finally{x.value=!1}}},formatCurrency:R=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(R),handleDeleteThread:async()=>{if(e.threadId){v.value=!0;try{const R=await fetch(J(`/api/threads/${e.threadId}`),{method:"DELETE"});if(!R.ok){const N=await R.json();throw new Error(N.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{v.value=!1}}},Loader:qe,ConfirmDialog:Lt,SelectInput:xe,get InfoIcon(){return Mt},get ChevronLeftIcon(){return Xe},get Trash2Icon(){return St},get PencilIcon(){return lo},get DollarSignIcon(){return so}};return Object.defineProperty(H,"__isScriptSetup",{enumerable:!1,value:!0}),H}}),_i={class:"flex flex-col h-full"},wi={class:"p-4 border-b border-gray-300 dark:border-neutral-700"},Ci={class:"flex items-center justify-between"},Si={class:"flex items-center gap-2"},Ti={class:"flex-1 overflow-y-auto p-4"},Mi={key:0,class:"text-gray-500 dark:text-gray-400 text-center py-8"},Vi={class:"flex justify-center py-8"},Ii={class:"text-red-600 dark:text-red-400 text-center py-8"},Ai={class:"space-y-4"},Pi={class:"text-sm font-mono break-all"},Ei={class:"flex items-center justify-between mb-2"},Li={key:0},Oi={class:"text-sm"},ji={class:"text-xs text-gray-500 dark:text-gray-500 mt-1"},Di={key:1,class:"space-y-2"},Ui={class:"flex gap-2"},qi=["disabled"],Ni=["disabled"],Bi={class:"text-sm"},Ri={key:0},Fi={class:"text-sm font-mono"},zi={class:"flex items-center justify-between mb-2"},Hi={key:0,class:"flex flex-wrap gap-2"},Wi={key:1,class:"text-sm text-gray-500 dark:text-gray-500 italic"},Ji={class:"flex items-center justify-between mb-2"},Ki=["disabled"],Zi={key:0,class:"flex justify-center py-4"},Gi={key:1,class:"space-y-3"},Xi={class:"grid grid-cols-2 gap-2 text-xs"},Qi={class:"p-2 bg-gray-100 dark:bg-gray-900 rounded"},Yi={class:"font-mono font-bold"},$i={class:"p-2 bg-gray-100 dark:bg-gray-900 rounded"},ed={class:"font-mono font-bold"},td={key:0,class:"space-y-2"},od={class:"overflow-x-auto"},rd={class:"w-full text-xs"},ad={class:"py-2 pr-2 font-medium"},sd={class:"text-right py-2 px-2 font-mono"},ld={class:"text-right py-2 px-2 font-mono"},nd={class:"text-right py-2 pl-2 font-mono"},id={key:1,class:"text-xs text-gray-500 dark:text-gray-500 italic py-2"},dd={class:"pt-4 mt-4 border-t border-red-300 dark:border-red-700"},cd=["disabled"],ud={key:0},pd={key:1};function md(u,t,a,e,c,d){return s(),l("div",_i,[i(" Header "),o("div",wi,[o("div",Ci,[o("div",Si,[S(e.InfoIcon,{size:20,class:"flex-shrink-0"}),t[6]||(t[6]=o("h2",{class:"text-xl font-bold"},"Metadata",-1))]),o("button",{onClick:t[0]||(t[0]=r=>e.emit("collapse")),type:"button",class:"p-1 hover:bg-gray-100 dark:hover:bg-gray-900 rounded transition-colors",title:"Collapse pane"},[S(e.ChevronLeftIcon,{size:20})])])]),i(" Content "),o("div",Ti,[i(" No thread selected "),a.threadId?e.isFetching?(s(),l(W,{key:1},[i(" Loading state "),o("div",Vi,[S(e.Loader)])],2112)):e.error?(s(),l(W,{key:2},[i(" Error state "),o("div",Ii," Error loading metadata: "+b(e.error),1)],2112)):e.thread?(s(),l(W,{key:3},[i(" Metadata display "),o("div",Ai,[i(" Thread ID "),o("div",null,[t[7]||(t[7]=o("div",{class:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1"}," Thread ID ",-1)),o("div",Pi,b(e.thread.id),1)]),i(" Agent "),o("div",null,[o("div",Ei,[t[9]||(t[9]=o("div",{class:"text-sm font-medium text-gray-600 dark:text-gray-400"}," Agent ",-1)),e.isAiHumanAgent&&!e.isEditingAgent?(s(),l("button",{key:0,onClick:e.startEditingAgent,type:"button",class:"flex items-center gap-1 px-2 py-1 text-xs border border-black dark:border-neutral-300 rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors",title:"Change agent"},[S(e.PencilIcon,{size:12}),t[8]||(t[8]=o("span",null,"Change",-1))])):i("v-if",!0)]),e.isEditingAgent?(s(),l("div",Di,[S(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",Ui,[o("button",{onClick:e.saveAgent,disabled:e.isSavingAgent||!e.selectedAgentId,class:"flex-1 px-3 py-2 text-sm 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"},b(e.isSavingAgent?"Saving...":"Save"),9,qi),o("button",{onClick:e.cancelEditingAgent,disabled:e.isSavingAgent,class:"flex-1 px-3 py-2 text-sm 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"}," Cancel ",8,Ni)])])):(s(),l("div",Li,[o("div",Oi,b(e.thread.agent.title),1),o("div",ji," Type: "+b(e.thread.agent.type),1)]))]),i(" Created At "),o("div",null,[t[10]||(t[10]=o("div",{class:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1"}," Created ",-1)),o("div",Bi,b(e.formatDate(e.thread.created_at)),1)]),i(" User ID "),e.thread.user_id?(s(),l("div",Ri,[t[11]||(t[11]=o("div",{class:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1"}," User ID ",-1)),o("div",Fi,b(e.thread.user_id),1)])):i("v-if",!0),i(" Tags "),o("div",null,[o("div",zi,[t[13]||(t[13]=o("div",{class:"text-sm font-medium text-gray-600 dark:text-gray-400"}," Tags ",-1)),o("button",{onClick:t[2]||(t[2]=r=>e.emit("editThread")),type:"button",class:"flex items-center gap-1 px-2 py-1 text-xs border border-black dark:border-neutral-300 rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors",title:"Edit thread"},[S(e.PencilIcon,{size:12}),t[12]||(t[12]=o("span",null,"Edit",-1))])]),e.thread.tags?.length>0?(s(),l("div",Hi,[(s(!0),l(W,null,ne(e.thread.tags,r=>(s(),l("span",{key:r,class:"inline-block px-3 py-1 text-sm rounded bg-black text-white dark:bg-white dark:text-black"},b(r),1))),128))])):(s(),l("div",Wi," No tags "))]),i(" Cost Breakdown "),o("div",null,[o("div",Ji,[t[15]||(t[15]=o("div",{class:"text-sm font-medium text-gray-600 dark:text-gray-400"}," Cost Analysis ",-1)),e.showCostBreakdown?(s(),l("button",{key:1,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-neutral-300 rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors",title:"Hide cost breakdown"},[...t[14]||(t[14]=[o("span",null,"Hide",-1)])])):(s(),l("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",title:"View cost breakdown"},[S(e.DollarSignIcon,{size:12}),o("span",null,b(e.isFetchingCost?"Loading...":"View Costs"),1)],8,Ki))]),e.isFetchingCost?(s(),l("div",Zi,[S(e.Loader)])):e.showCostBreakdown&&e.costData?(s(),l("div",Gi,[i(" Summary Stats "),o("div",Xi,[o("div",Qi,[t[16]||(t[16]=o("div",{class:"text-gray-500 dark:text-gray-500 mb-1"}," Total Cost ",-1)),o("div",Yi,b(e.formatCurrency(e.costData.totalCost)),1)]),o("div",$i,[t[17]||(t[17]=o("div",{class:"text-gray-500 dark:text-gray-500 mb-1"}," Avg/Message ",-1)),o("div",ed,b(e.formatCurrency(e.costData.avgCostPerMessage)),1)])]),i(" Model Breakdown Table "),e.costData.modelBreakdown.length>0?(s(),l("div",td,[t[19]||(t[19]=o("div",{class:"text-xs font-medium text-gray-600 dark:text-gray-400"}," By Model ",-1)),o("div",od,[o("table",rd,[t[18]||(t[18]=o("thead",{class:"border-b border-gray-300 dark:border-neutral-700"},[o("tr",null,[o("th",{class:"text-left py-2 pr-2 font-medium text-gray-600 dark:text-gray-400"}," Model "),o("th",{class:"text-right py-2 px-2 font-medium text-gray-600 dark:text-gray-400"}," Requests "),o("th",{class:"text-right py-2 px-2 font-medium text-gray-600 dark:text-gray-400"}," Total "),o("th",{class:"text-right py-2 pl-2 font-medium text-gray-600 dark:text-gray-400"}," Avg/Req ")])],-1)),o("tbody",null,[(s(!0),l(W,null,ne(e.costData.modelBreakdown,r=>(s(),l("tr",{key:r.modelName,class:"border-b border-gray-200 dark:border-neutral-800 last:border-b-0"},[o("td",ad,b(r.modelName),1),o("td",sd,b(r.requestCount),1),o("td",ld,b(e.formatCurrency(r.totalCost)),1),o("td",nd,b(e.formatCurrency(r.avgCostPerRequest)),1)]))),128))])])])])):(s(),l("div",id," No cost data available for this thread "))])):i("v-if",!0)]),i(" Danger Zone "),o("div",dd,[t[20]||(t[20]=o("div",{class:"text-sm font-medium text-red-600 dark:text-red-400 mb-2"}," Danger Zone ",-1)),o("button",{onClick:t[4]||(t[4]=r=>e.showDeleteConfirm=!0),disabled:e.isDeleting,class:"flex items-center gap-2 px-3 py-2 text-sm bg-white dark:bg-black text-red-600 border-2 border-red-600 hover:bg-red-50 dark:hover:bg-red-950/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},[S(e.Trash2Icon,{size:16}),e.isDeleting?(s(),l("span",ud,"Deleting...")):(s(),l("span",pd,"Delete Thread"))],8,cd),t[21]||(t[21]=o("p",{class:"text-xs text-gray-500 dark:text-gray-500 mt-2"}," This will permanently delete the thread, all messages, and all logs. This action cannot be undone. ",-1))])])],2112)):i("v-if",!0):(s(),l("div",Mi," Select a thread to view metadata "))]),i(" Delete Confirmation Dialog "),S(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"])])}const gd=Y(ki,[["render",md],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/MetaPane.vue"]]);function fd(u,t){const{limit:a=100,offset:e=0,order:c="desc",autoFetch:d=!0,enableWebSocket:r=!1}=t||{};z(()=>!!(typeof u=="string"?u:u?.value));const n=z(()=>{const E=typeof u=="string"?u:u?.value;if(!E)return J("/api/threads/placeholder/logs");const P=new URLSearchParams,H=typeof a=="number"?a:a.value,R=typeof e=="number"?e:e.value,N=typeof c=="string"?c:c.value;return P.append("limit",H.toString()),P.append("offset",R.toString()),P.append("order",N),J(`/api/threads/${E}/logs?${P.toString()}`)}),{data:p,error:v,isFetching:g,isFinished:f,execute:h,abort:w}=ve(n,{immediate:!1}).get().json();re([n,()=>d],([E,P])=>{E&&!E.includes("placeholder")&&P&&h()},{immediate:!0});const x=z(()=>!v.value||v.value.toString().includes("aborted")||v.value.toString().includes("abort")?null:v.value),k=z(()=>p.value?.logs||[]),C=z(()=>p.value?.total||0),y=z(()=>p.value?.hasMore||!1),_=m(null),V=m(!1),U=m(null),D=m([]),j=()=>{const E=typeof u=="string"?u:u?.value;if(!E||!r)return;_.value&&_.value.close(),D.value=[];const P=window.location.protocol==="https:"?"wss:":"ws:",H=window.location.host;let R=`${P}//${H}${J(`/api/threads/${E}/logs`)}`;const N=localStorage.getItem("auth_token");N&&(R+=`?token=${encodeURIComponent(N)}`);try{_.value=new WebSocket(R),_.value.onopen=()=>{V.value=!0,U.value=null,console.log("WebSocket connected for logs")},_.value.onmessage=X=>{try{const Q=JSON.parse(X.data);if(Q.type==="log_data"){const L=D.value.findIndex(T=>T.id===Q.log_id),I=k.value.find(T=>T.id===Q.log_id);L>=0?(D.value[L]={...D.value[L],...Q.data},console.log("[WebSocket] Updated existing realtime log:",Q.log_id)):I?(D.value.push({...I,...Q.data}),console.log("[WebSocket] Updated HTTP log:",Q.log_id)):(D.value.push({id:Q.log_id,...Q.data}),console.log("[WebSocket] Added new log:",Q.log_id))}}catch(Q){console.error("Failed to parse WebSocket message:",Q)}},_.value.onerror=X=>{U.value="WebSocket connection error",V.value=!1,console.error("WebSocket error:",X)},_.value.onclose=()=>{V.value=!1,console.log("WebSocket disconnected")}}catch(X){U.value=X.message||"Failed to create WebSocket",console.error("WebSocket creation error:",X)}},F=()=>{_.value&&(_.value.close(),_.value=null,V.value=!1),D.value=[]};return Te(()=>{F()}),{logs:z(()=>{if(!r)return k.value;const E=new Map;k.value.forEach(R=>E.set(R.id,R)),D.value.forEach(R=>E.set(R.id,R));const P=typeof c=="string"?c:c.value;return Array.from(E.values()).sort((R,N)=>P==="desc"?N.created_at-R.created_at:R.created_at-N.created_at)}),total:C,hasMore:y,error:x,isFetching:g,isFinished:f,refetch:h,abort:w,wsConnected:V,wsError:U,connectWebSocket:j,disconnectWebSocket:F}}function hd(u,t){const a=z(()=>{const n=u.value,p=t.value;return!n||!p?null:J(`/api/threads/${n}/logs/${p}`)}),{data:e,error:c,isFetching:d,execute:r}=ve(a,{immediate:!1}).get().json();return re([u,t],([n,p])=>{n&&p&&r()},{immediate:!0}),{logDetails:e,error:c,isFetching:d,refetch:r}}const vd=ee({__name:"CopyButton",props:{content:{type:String,required:!0},variant:{type:String,required:!1},size:{type:String,required:!1},disabled:{type:Boolean,required:!1}},setup(u,{expose:t}){t();const a=u,e=m(!1),c=m(!1),p={props:a,copying:e,copied:c,copyToClipboard:async()=>{e.value=!0;try{await navigator.clipboard.writeText(a.content),c.value=!0,setTimeout(()=>{c.value=!1},2e3)}catch(v){console.error("Failed to copy:",v),alert(`Failed to copy: ${v instanceof Error?v.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-gray-950 border border-gray-300 dark:border-neutral-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-900"},Loader:qe};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}}),bd=["disabled","title"],yd={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"},xd={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"},kd={key:3};function _d(u,t,a,e,c,d){return s(),l("button",{onClick:e.copyToClipboard,disabled:e.copying||a.disabled,class:G([e.sizeClasses[a.size||"sm"],e.variantClasses[a.variant||"solid"],"font-medium rounded hover:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed transition-all"]),title:a.disabled?"No content to copy":e.copied?"Copied!":"Copy to clipboard"},[e.copying?(s(),Z(e.Loader,{key:0,size:"xs"})):a.variant==="ghost"&&!e.copied?(s(),l("svg",yd,[...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)])])):a.variant==="ghost"&&e.copied?(s(),l("svg",xd,[...t[1]||(t[1]=[o("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(s(),l("span",kd,b(e.copied?"Copied!":"Copy"),1))],10,bd)}const wd=Y(vd,[["render",_d],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/CopyButton.vue"]]),Cd=ee({__name:"LogDetails",props:{log:{type:null,required:!0}},emits:["close"],setup(u,{expose:t,emit:a}){t();const e=u,c=a,d=m("request"),r=m(new Set),n=m(new Set),p=m(!1),v=m(!1),g=m(null),f=j=>{if(!j)return"N/A";try{return JSON.stringify(JSON.parse(j),null,2)}catch{return j}},h=z(()=>{if(!e.log.tools_schema)return[];try{const j=JSON.parse(e.log.tools_schema);return Array.isArray(j)?j:[]}catch{return[]}}),w=z(()=>{if(!e.log.response_body)return[];try{const F=JSON.parse(e.log.response_body)?.choices?.[0]?.message?.tool_calls;return Array.isArray(F)?F:[]}catch{return[]}}),x=z(()=>{if(!e.log.tool_results)return new Map;try{const j=JSON.parse(e.log.tool_results),F=new Map;return Array.isArray(j)&&j.forEach(K=>{K.tool_call_id&&F.set(K.tool_call_id,{content:K.content,status:K.status,tool_name:K.tool_name,timestamp:K.timestamp})}),F}catch{return new Map}}),k=z(()=>{if(!e.log.response_body)return[];try{const F=JSON.parse(e.log.response_body)?.choices?.[0]?.message?.reasoning_details;return Array.isArray(F)?F:[]}catch{return[]}}),C=j=>{r.value.has(j)?r.value.delete(j):r.value.add(j)},y=j=>{n.value.has(j)?n.value.delete(j):n.value.add(j)},_=z(()=>{if(!e.log.errors)return[];try{const j=JSON.parse(e.log.errors);return Array.isArray(j)?j:[]}catch{return[]}}),V=()=>{pe(()=>{g.value&&(g.value.scrollTop=g.value.scrollHeight)})};re(()=>e.log.message_history,()=>{V()},{immediate:!0});const D={props:e,emit:c,activeTab:d,expandedTools:r,expandedToolCalls:n,copyingCurl:p,copiedCurl:v,messagesContainer:g,formatJson:f,tools:h,toolCallsDetailed:w,toolResults:x,reasoningDetails:k,toggleTool:C,toggleToolCall:y,errorsArray:_,scrollMessagesToBottom:V,copyCurlCommand:async()=>{p.value=!0;try{if(!e.log.request_body||!e.log.model)throw new Error("Missing request data");const j=await fetch(J(`/api/models/${e.log.model}/curl-data`));if(!j.ok)throw new Error("Failed to fetch model data");const F=await j.json(),K=f(e.log.request_body);let E=`curl -X POST '${F.endpoint}' \\
|
|
3
|
-
`;
|
|
4
|
-
`,
|
|
5
|
-
`,
|
|
6
|
-
`,
|
|
7
|
-
`):
|
|
8
|
-
`),E+=` -d '${K.replace(/'/g,"'\\''")}'`,await navigator.clipboard.writeText(E),v.value=!0,setTimeout(()=>{v.value=!1},2e3)}catch(j){console.error("Failed to copy cURL command:",j),alert(`Failed to copy cURL: ${j instanceof Error?j.message:"Unknown error"}`)}finally{p.value=!1}},Loader:qe,TimeAgo:dt,CopyButton:wd};return Object.defineProperty(D,"__isScriptSetup",{enumerable:!1,value:!0}),D}}),Sd={class:"p-4 h-full overflow-y-auto"},Td={class:"flex items-center justify-between mb-3"},Md={class:"text-lg font-bold"},Vd={class:"flex items-center gap-2"},Id=["disabled","title"],Ad={key:1},Pd={class:"@container border-b border-gray-300 dark:border-neutral-700 pb-3 mb-3"},Ed={class:"hidden @[600px]:block"},Ld={class:"w-full text-xs"},Od={class:"py-1 font-mono"},jd={class:"py-1 font-mono"},Dd={key:1},Ud={class:"py-1 font-mono"},qd={key:1},Nd={class:"py-1 font-mono"},Bd={key:1},Rd={class:"py-1 font-mono"},Fd={key:1},zd={class:"py-1 font-mono text-xs"},Hd={class:"@[600px]:hidden space-y-2"},Wd={class:"w-full text-xs"},Jd={class:"py-1 font-mono"},Kd={class:"py-1 font-mono"},Zd={key:1},Gd={class:"w-full text-xs"},Xd={class:"py-1 font-mono"},Qd={key:1},Yd={class:"py-1 font-mono"},$d={key:1},ec={class:"py-1 font-mono"},tc={key:1},oc={class:"py-1 font-mono text-xs"},rc={class:"border-b border-gray-300 dark:border-neutral-700 mb-3"},ac={class:"flex gap-4"},sc={key:0,class:"text-red-600 dark:text-red-400"},lc={class:"space-y-3"},nc={key:0,class:"mb-4"},ic={class:"text-xs font-semibold mb-1"},dc={class:"relative"},cc={class:"absolute top-[5px] right-[5px]"},uc={key:1,class:"mb-4"},pc={class:"relative"},mc={class:"text-xs bg-gray-50 dark:bg-gray-950 p-2 rounded overflow-x-auto border border-gray-300 dark:border-neutral-700 max-h-32"},gc={class:"absolute top-[5px] right-[5px]"},fc={key:2,class:"mb-4"},hc={class:"text-xs font-semibold mb-1"},vc={class:"border border-gray-300 dark:border-neutral-700 rounded overflow-hidden"},bc=["onClick"],yc={class:"font-mono"},xc={class:"text-gray-500"},kc={class:"px-2 py-2 bg-gray-50 dark:bg-gray-950 border-t border-gray-200 dark:border-neutral-800"},_c={key:0,class:"text-xs text-gray-600 dark:text-gray-400 mb-2"},wc={class:"text-xs overflow-x-auto"},Cc={key:3,class:"mb-4"},Sc={class:"relative"},Tc={class:"text-xs bg-gray-50 dark:bg-gray-950 p-2 rounded overflow-x-auto border border-gray-300 dark:border-neutral-700 max-h-64"},Mc={class:"absolute top-[5px] right-[5px]"},Vc={key:0,class:"mb-4"},Ic={class:"text-xs font-semibold text-red-600 dark:text-red-400 mb-1"},Ac={class:"space-y-2"},Pc={class:"px-2 py-1 bg-red-100 dark:bg-red-900/30 text-xs font-medium text-red-800 dark:text-red-200"},Ec={class:"text-xs bg-red-50 dark:bg-red-950 p-2 overflow-x-auto text-red-900 dark:text-red-100"},Lc={class:"mb-4"},Oc={class:"text-xs font-semibold text-red-600 dark:text-red-400 mb-1"},jc={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"},Dc={key:2,class:"mb-4"},Uc={class:"w-full text-xs border border-gray-300 dark:border-neutral-700 rounded"},qc={class:"border-b border-gray-200 dark:border-neutral-800"},Nc={class:"py-1 px-2 font-mono"},Bc={key:1},Rc={class:"border-b border-gray-200 dark:border-neutral-800"},Fc={class:"py-1 px-2 font-mono"},zc={key:1},Hc={key:0,class:"border-b border-gray-200 dark:border-neutral-800"},Wc={class:"py-1 px-2 font-mono"},Jc={key:1},Kc={class:"border-b border-gray-200 dark:border-neutral-800"},Zc={class:"py-1 px-2 font-mono"},Gc={key:1},Xc={key:1,class:"border-b border-gray-200 dark:border-neutral-800"},Qc={class:"py-1 px-2 font-mono text-blue-600 dark:text-blue-400"},Yc={class:"border-b border-gray-200 dark:border-neutral-800"},$c={class:"py-1 px-2 font-mono font-semibold"},eu={key:1},tu={class:"py-1 px-2 font-mono font-semibold"},ou={key:1},ru={key:3,class:"mb-4"},au={class:"text-xs font-semibold mb-1"},su={class:"border border-gray-300 dark:border-neutral-700 rounded overflow-hidden"},lu=["onClick"],nu={class:"font-mono"},iu={class:"text-gray-500"},du={class:"px-2 py-2 bg-gray-50 dark:bg-gray-950 border-t border-gray-200 dark:border-neutral-800"},cu={class:"text-xs mb-2"},uu={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-gray-200 dark:border-neutral-800"},pu={class:"text-xs mb-2"},mu={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-gray-200 dark:border-neutral-800"},gu={class:"text-xs mb-2"},fu={class:"text-xs overflow-x-auto bg-white dark:bg-black p-2 rounded border border-gray-200 dark:border-neutral-800"},hu={key:0,class:"text-xs"},vu={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"},yu={key:4,class:"mb-4"},xu={class:"border border-blue-300 dark:border-blue-700 rounded overflow-hidden bg-blue-50 dark:bg-blue-950/20"},ku={class:"text-xs p-2 overflow-x-auto whitespace-pre-wrap max-h-96 text-blue-900 dark:text-blue-100"},_u={key:5,class:"mb-4"},wu={class:"text-xs font-semibold mb-1"},Cu={class:"border border-purple-300 dark:border-purple-700 rounded overflow-hidden bg-purple-50 dark:bg-purple-950/20"},Su={class:"divide-y divide-purple-200 dark:divide-purple-800"},Tu={class:"flex items-center gap-2 mb-1"},Mu={class:"text-xs font-semibold text-purple-700 dark:text-purple-300"},Vu={key:0,class:"text-xs font-mono text-purple-600 dark:text-purple-400"},Iu={key:1,class:"text-xs text-purple-500 dark:text-purple-500"},Au={key:2,class:"text-xs text-purple-500 dark:text-purple-500"},Pu={key:0,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},Eu={class:"text-purple-900 dark:text-purple-100 whitespace-pre-wrap"},Lu={key:1,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},Ou={class:"font-mono text-purple-700 dark:text-purple-300 break-all"},ju={key:2,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},Du={class:"text-purple-900 dark:text-purple-100 whitespace-pre-wrap"},Uu={key:0,class:"mt-2 pt-2 border-t border-purple-200 dark:border-purple-800"},qu={class:"font-mono text-purple-700 dark:text-purple-300 text-xs break-all"},Nu={key:3,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},Bu={class:"text-purple-900 dark:text-purple-100 overflow-x-auto"},Ru={key:6,class:"mb-4"},Fu={class:"text-xs bg-gray-50 dark:bg-gray-950 p-2 rounded overflow-x-auto border border-gray-300 dark:border-neutral-700 max-h-96"};function zu(u,t,a,e,c,d){return s(),l("div",Sd,[i(" Header "),o("div",Td,[o("h3",Md,b(a.log.prompt_name||a.log.model_name||a.log.model),1),o("div",Vd,[o("button",{onClick:e.copyCurlCommand,disabled:e.copyingCurl||!a.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:a.log.request_body?"Copy cURL command":"No request data available"},[e.copyingCurl?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",Ad,b(e.copiedCurl?"Copied!":"Copy cURL"),1))],8,Id),o("button",{onClick:t[0]||(t[0]=r=>e.emit("close")),class:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","aria-label":"Close details"}," ✕ ")])]),i(" Summary Table "),o("div",Pd,[i(" Single table for wider containers "),o("div",Ed,[o("table",Ld,[t[3]||(t[3]=o("thead",null,[o("tr",{class:"border-b border-gray-200 dark:border-neutral-800"},[o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Status "),o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Provider "),o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Prompt "),o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Latency "),o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Tokens "),o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Cost "),o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Created ")])],-1)),o("tbody",null,[o("tr",null,[o("td",{class:G(["py-1 font-mono",a.log.error?"text-red-600 dark:text-red-400":a.log.is_complete?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"])},b(a.log.error?"ERROR":a.log.is_complete?"SUCCESS":"LOADING"),3),o("td",Od,b(a.log.provider),1),o("td",jd,[!a.log.is_complete&&!a.log.prompt_name?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",Dd,b(a.log.prompt_name||"—"),1))]),o("td",Ud,[!a.log.is_complete&&!a.log.latency_ms?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",qd,b(a.log.latency_ms?`${a.log.latency_ms}ms`:"—"),1))]),o("td",Nd,[!a.log.is_complete&&!a.log.total_tokens?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",Bd,b(a.log.total_tokens?`${a.log.input_tokens}/${a.log.output_tokens} (${a.log.total_tokens})`:"—"),1))]),o("td",Rd,[!a.log.is_complete&&!a.log.cost_total?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",Fd,b(a.log.cost_total?`$${a.log.cost_total.toFixed(6)}`:"—"),1))]),o("td",zd,[S(e.TimeAgo,{timestamp:a.log.created_at},null,8,["timestamp"])])])])])]),i(" Two stacked tables for narrow containers "),o("div",Hd,[i(" First table: Status, Provider, Prompt "),o("table",Wd,[t[4]||(t[4]=o("thead",null,[o("tr",{class:"border-b border-gray-200 dark:border-neutral-800"},[o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Status "),o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Provider "),o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Prompt ")])],-1)),o("tbody",null,[o("tr",null,[o("td",{class:G(["py-1 font-mono",a.log.error?"text-red-600 dark:text-red-400":a.log.is_complete?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"])},b(a.log.error?"ERROR":a.log.is_complete?"SUCCESS":"LOADING"),3),o("td",Jd,b(a.log.provider),1),o("td",Kd,[!a.log.is_complete&&!a.log.prompt_name?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",Zd,b(a.log.prompt_name||"—"),1))])])])]),i(" Second table: Latency, Tokens, Cost, Created "),o("table",Gd,[t[5]||(t[5]=o("thead",null,[o("tr",{class:"border-b border-gray-200 dark:border-neutral-800"},[o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Latency "),o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Tokens "),o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Cost "),o("th",{class:"text-left py-1 pr-4 text-gray-600 dark:text-gray-400 font-medium"}," Created ")])],-1)),o("tbody",null,[o("tr",null,[o("td",Xd,[!a.log.is_complete&&!a.log.latency_ms?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",Qd,b(a.log.latency_ms?`${a.log.latency_ms}ms`:"—"),1))]),o("td",Yd,[!a.log.is_complete&&!a.log.total_tokens?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",$d,b(a.log.total_tokens?`${a.log.input_tokens}/${a.log.output_tokens} (${a.log.total_tokens})`:"—"),1))]),o("td",ec,[!a.log.is_complete&&!a.log.cost_total?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",tc,b(a.log.cost_total?`$${a.log.cost_total.toFixed(6)}`:"—"),1))]),o("td",oc,[S(e.TimeAgo,{timestamp:a.log.created_at},null,8,["timestamp"])])])])])])]),i(" Tabs "),o("div",rc,[o("div",ac,[o("button",{onClick:t[1]||(t[1]=r=>e.activeTab="request"),class:G(["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-gray-500 dark:text-gray-400 hover:text-black dark:hover:text-white"])}," Request ",2),o("button",{onClick:t[2]||(t[2]=r=>e.activeTab="response"),class:G(["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-gray-500 dark:text-gray-400 hover:text-black dark:hover:text-white"])},[t[6]||(t[6]=ie(" Response ",-1)),a.log.error||e.errorsArray.length>0?(s(),l("span",sc,"⚠")):i("v-if",!0)],2)])]),i(" Tab Content "),o("div",lc,[i(" Request Tab "),fe(o("div",null,[i(" Messages (actual messages sent to LLM) - Moved to top, taller, auto-scroll to bottom "),a.log.message_history?(s(),l("div",nc,[o("div",ic," Messages ("+b(a.log.message_history_length||0)+" messages) ",1),o("div",dc,[o("pre",{ref:"messagesContainer",class:"text-xs bg-gray-50 dark:bg-gray-950 p-2 rounded overflow-x-auto border border-gray-300 dark:border-neutral-700 max-h-[600px] overflow-y-auto"},b(e.formatJson(a.log.message_history)),513),o("div",cc,[S(e.CopyButton,{content:e.formatJson(a.log.message_history),variant:"ghost",size:"xs"},null,8,["content"])])])])):i("v-if",!0),i(" System Prompt "),a.log.system_prompt?(s(),l("div",uc,[t[7]||(t[7]=o("div",{class:"text-xs font-semibold mb-1"},"System Prompt",-1)),o("div",pc,[o("pre",mc,b(a.log.system_prompt),1),o("div",gc,[S(e.CopyButton,{content:a.log.system_prompt,variant:"ghost",size:"xs"},null,8,["content"])])])])):i("v-if",!0),i(" Tools "),e.tools.length>0?(s(),l("div",fc,[o("div",hc," Available Tools ("+b(e.tools.length)+") ",1),o("div",vc,[(s(!0),l(W,null,ne(e.tools,(r,n)=>(s(),l("div",{key:n,class:"border-b border-gray-200 dark:border-neutral-800 last:border-b-0"},[o("button",{onClick:p=>e.toggleTool(n),class:"w-full px-2 py-1.5 text-left hover:bg-gray-50 dark:hover:bg-gray-900 transition-colors flex items-center justify-between text-xs"},[o("span",yc,b(r.function?.name||r.name||"Unknown"),1),o("span",xc,b(e.expandedTools.has(n)?"▼":"▶"),1)],8,bc),fe(o("div",kc,[r.function?.description||r.description?(s(),l("div",_c,b(r.function?.description||r.description),1)):i("v-if",!0),o("pre",wc,b(JSON.stringify(r,null,2)),1)],512),[[Re,e.expandedTools.has(n)]])]))),128))])])):i("v-if",!0),i(" Request Body "),a.log.request_body?(s(),l("div",Cc,[t[8]||(t[8]=o("div",{class:"text-xs font-semibold mb-1"},"Full Request Body",-1)),o("div",Sc,[o("pre",Tc,b(e.formatJson(a.log.request_body)),1),o("div",Mc,[S(e.CopyButton,{content:e.formatJson(a.log.request_body),variant:"ghost",size:"xs"},null,8,["content"])])])])):i("v-if",!0)],512),[[Re,e.activeTab==="request"]]),i(" Response Tab "),fe(o("div",null,[i(" Errors (Multiple errors from errors array) "),e.errorsArray.length>0?(s(),l("div",Vc,[o("div",Ic,b(e.errorsArray.length>1?`Errors (${e.errorsArray.length})`:"Error"),1),o("div",Ac,[(s(!0),l(W,null,ne(e.errorsArray,(r,n)=>(s(),l("div",{key:n,class:"border border-red-300 dark:border-red-700 rounded overflow-hidden"},[o("div",Pc,b(r.type||"error"),1),o("pre",Ec,b(r.message),1)]))),128))])])):a.log.error?(s(),l(W,{key:1},[i(" Fallback: Single error (for backwards compatibility) "),o("div",Lc,[o("div",Oc," Error "+b(a.log.error_type?`(${a.log.error_type})`:""),1),o("pre",jc,b(a.log.error),1)])],2112)):i("v-if",!0),i(" Response Stats "),a.log.is_complete||!a.log.error?(s(),l("div",Dc,[t[16]||(t[16]=o("div",{class:"text-xs font-semibold mb-1"},"Response Stats",-1)),o("table",Uc,[o("tbody",null,[o("tr",qc,[t[9]||(t[9]=o("td",{class:"py-1 px-2 text-gray-600 dark:text-gray-400 font-medium bg-gray-50 dark:bg-gray-950"}," Finish Reason ",-1)),o("td",Nc,[!a.log.is_complete&&!a.log.finish_reason?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",Bc,b(a.log.finish_reason||"—"),1))])]),o("tr",Rc,[t[10]||(t[10]=o("td",{class:"py-1 px-2 text-gray-600 dark:text-gray-400 font-medium bg-gray-50 dark:bg-gray-950"}," Input Tokens ",-1)),o("td",Fc,[!a.log.is_complete&&!a.log.input_tokens?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",zc,b(a.log.input_tokens||"—"),1))])]),a.log.cached_tokens||!a.log.is_complete?(s(),l("tr",Hc,[t[11]||(t[11]=o("td",{class:"py-1 px-2 text-gray-600 dark:text-gray-400 font-medium bg-gray-50 dark:bg-gray-950"}," Cached Tokens ",-1)),o("td",Wc,[!a.log.is_complete&&!a.log.cached_tokens?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",Jc,b(a.log.cached_tokens||0),1))])])):i("v-if",!0),o("tr",Kc,[t[12]||(t[12]=o("td",{class:"py-1 px-2 text-gray-600 dark:text-gray-400 font-medium bg-gray-50 dark:bg-gray-950"}," Output Tokens ",-1)),o("td",Zc,[!a.log.is_complete&&!a.log.output_tokens?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",Gc,b(a.log.output_tokens||"—"),1))])]),a.log.reasoning_tokens&&a.log.reasoning_tokens>0?(s(),l("tr",Xc,[t[13]||(t[13]=o("td",{class:"py-1 px-2 text-gray-600 dark:text-gray-400 font-medium bg-gray-50 dark:bg-gray-950"}," Reasoning Tokens ",-1)),o("td",Qc,b(a.log.reasoning_tokens),1)])):i("v-if",!0),o("tr",Yc,[t[14]||(t[14]=o("td",{class:"py-1 px-2 text-gray-600 dark:text-gray-400 font-medium bg-gray-50 dark:bg-gray-950"}," Total Tokens ",-1)),o("td",$c,[!a.log.is_complete&&!a.log.total_tokens?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",eu,b(a.log.total_tokens||"—"),1))])]),o("tr",null,[t[15]||(t[15]=o("td",{class:"py-1 px-2 text-gray-600 dark:text-gray-400 font-medium bg-gray-50 dark:bg-gray-950"}," Total Cost ",-1)),o("td",tu,[!a.log.is_complete&&!a.log.cost_total?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",ou,b(a.log.cost_total?`$${a.log.cost_total.toFixed(6)}`:"—"),1))])])])])])):i("v-if",!0),i(" Tools Called "),e.toolCallsDetailed.length>0?(s(),l("div",ru,[o("div",au," Tools Called ("+b(e.toolCallsDetailed.length)+") ",1),o("div",su,[(s(!0),l(W,null,ne(e.toolCallsDetailed,(r,n)=>(s(),l("div",{key:n,class:"border-b border-gray-200 dark:border-neutral-800 last:border-b-0"},[o("button",{onClick:p=>e.toggleToolCall(n),class:"w-full px-2 py-1.5 text-left hover:bg-gray-50 dark:hover:bg-gray-900 transition-colors flex items-center justify-between text-xs"},[o("span",nu,b(r.function?.name||"Unknown"),1),o("span",iu,b(e.expandedToolCalls.has(n)?"▼":"▶"),1)],8,lu),fe(o("div",du,[o("div",cu,[t[17]||(t[17]=o("div",{class:"font-semibold text-gray-600 dark:text-gray-400 mb-1"}," Tool Call ID ",-1)),o("div",uu,b(r.id),1)]),o("div",pu,[t[18]||(t[18]=o("div",{class:"font-semibold text-gray-600 dark:text-gray-400 mb-1"}," Function Name ",-1)),o("div",mu,b(r.function?.name),1)]),o("div",gu,[t[19]||(t[19]=o("div",{class:"font-semibold text-gray-600 dark:text-gray-400 mb-1"}," Arguments ",-1)),o("pre",fu,b(e.formatJson(r.function?.arguments||"{}")),1)]),i(" Tool Result "),e.toolResults.has(r.id)?(s(),l("div",hu,[t[20]||(t[20]=o("div",{class:"font-semibold text-green-600 dark:text-green-400 mb-1"}," Result ",-1)),o("pre",vu,b(e.toolResults.get(r.id)?.content||"No content"),1)])):(s(),l("div",bu,[...t[21]||(t[21]=[o("div",{class:"font-semibold text-gray-500 dark:text-gray-500 mb-1"}," Result ",-1),o("div",{class:"text-xs text-gray-500 dark:text-gray-500 italic"}," No result available ",-1)])]))],512),[[Re,e.expandedToolCalls.has(n)]])]))),128))])])):i("v-if",!0),i(" Reasoning Content (from models like o1) "),a.log.reasoning_content?(s(),l("div",yu,[t[23]||(t[23]=o("div",{class:"text-xs font-semibold mb-1"},"Reasoning Content",-1)),o("div",xu,[t[22]||(t[22]=o("div",{class:"px-2 py-1.5 bg-blue-100 dark:bg-blue-900/30 text-xs text-blue-800 dark:text-blue-200 border-b border-blue-300 dark:border-blue-700"}," Internal reasoning output (not displayed to users) ",-1)),o("pre",ku,b(a.log.reasoning_content),1)])])):i("v-if",!0),i(" Reasoning Details (OpenRouter structured reasoning blocks) "),e.reasoningDetails.length>0?(s(),l("div",_u,[o("div",wu," Reasoning Details ("+b(e.reasoningDetails.length)+" blocks) ",1),o("div",Cu,[t[28]||(t[28]=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",Su,[(s(!0),l(W,null,ne(e.reasoningDetails,(r,n)=>(s(),l("div",{key:n,class:"p-2"},[o("div",Tu,[o("span",Mu,b(r.type||"unknown"),1),r.id?(s(),l("span",Vu," ID: "+b(r.id),1)):i("v-if",!0),r.format?(s(),l("span",Iu," Format: "+b(r.format),1)):i("v-if",!0),r.index!==void 0?(s(),l("span",Au," Index: "+b(r.index),1)):i("v-if",!0)]),i(" Summary type "),r.type==="reasoning.summary"&&r.summary?(s(),l("div",Pu,[t[24]||(t[24]=o("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Summary: ",-1)),o("div",Eu,b(r.summary),1)])):i("v-if",!0),i(" Encrypted type "),r.type==="reasoning.encrypted"&&r.data?(s(),l("div",Lu,[t[25]||(t[25]=o("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Encrypted Data: ",-1)),o("div",Ou,b(r.data),1)])):i("v-if",!0),i(" Text type "),r.type==="reasoning.text"&&r.text?(s(),l("div",ju,[t[27]||(t[27]=o("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Reasoning Text: ",-1)),o("div",Du,b(r.text),1),r.signature?(s(),l("div",Uu,[t[26]||(t[26]=o("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Signature: ",-1)),o("div",qu,b(r.signature),1)])):i("v-if",!0)])):i("v-if",!0),i(" Unknown type - show raw JSON "),["reasoning.summary","reasoning.encrypted","reasoning.text"].includes(r.type)?i("v-if",!0):(s(),l("div",Nu,[o("pre",Bu,b(JSON.stringify(r,null,2)),1)]))]))),128))])])])):i("v-if",!0),i(" Response Body "),a.log.response_body?(s(),l("div",Ru,[t[29]||(t[29]=o("div",{class:"text-xs font-semibold mb-1"},"Full Response Body",-1)),o("pre",Fu,b(e.formatJson(a.log.response_body)),1)])):i("v-if",!0)],512),[[Re,e.activeTab==="response"]])])])}const Hu=Y(Cd,[["render",zu],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/LogDetails.vue"]]),tt=20,bt=20,Wu=ee({__name:"LogsPane",props:{threadId:{type:[String,null],required:!0},selectedLogId:{type:[String,null],required:!1}},emits:["collapse","logClick"],setup(u,{expose:t,emit:a}){t();const e=u,c=a,d=m(0),r=m(tt),{logs:n,total:p,hasMore:v,isFetching:g,error:f,wsConnected:h,wsError:w,connectWebSocket:x,disconnectWebSocket:k,refetch:C}=fd(z(()=>e.threadId),{limit:z(()=>r.value),offset:z(()=>d.value),enableWebSocket:!0,order:"desc"}),y=m([]),_=m(!0),V=m(null),U=m(null),D=m(!1),j=m(!1),F=m(new Map),K=async()=>{await pe(),U.value&&(U.value.scrollTop=U.value.scrollHeight)};re(n,async M=>{if(d.value===0)y.value=[...M].reverse(),_.value&&y.value.length>0&&(await K(),_.value=!1);else{const O=[...M].reverse(),A=new Map;y.value.forEach(B=>A.set(B.id,B)),O.forEach(B=>A.set(B.id,B)),y.value=Array.from(A.values()).sort((B,te)=>B.created_at-te.created_at)}},{deep:!0});const{logDetails:E,isFetching:P}=hd(z(()=>e.threadId),z(()=>V.value)),H=z(()=>{if(!V.value)return null;const O=y.value.find(A=>A.id===V.value);return O?E.value?{...E.value,...O}:O:null}),R=M=>{c("logClick",M.id),V.value=M.id},N=(M,O)=>{O?F.value.set(M,O):F.value.delete(M)};re(V,async M=>{if(M){await pe();const O=F.value.get(M);O&&U.value&&O.scrollIntoView({behavior:"smooth",block:"nearest"})}});const X=async()=>{if(j.value||!v.value||g.value)return;j.value=!0;const M=U.value?.scrollHeight||0;if(d.value+=r.value,r.value=bt,await C(),await pe(),U.value){const O=U.value.scrollHeight;U.value.scrollTop+=O-M}j.value=!1};re(()=>e.threadId,async M=>{M?(k(),x()):k(),d.value=0,r.value=tt,y.value=[],V.value=null,D.value=!1,_.value=!0},{immediate:!0}),re(y,async()=>{D.value||await K()},{deep:!0});const Q=()=>{if(!U.value)return;const{scrollTop:M,scrollHeight:O,clientHeight:A}=U.value,B=O-M-A<50;D.value=!B},L=M=>{if(!M.tools_called)return"—";try{const O=JSON.parse(M.tools_called);return Array.isArray(O)?O.join(", "):M.tools_called}catch{return M.tools_called}},I=M=>M==null?"—":`$${M.toFixed(6)}`,T=z(()=>{const M=new Map,O=new Map;y.value.forEach(te=>{M.set(te.id,te);const le=te.parent_log_id;le&&(O.has(le)||O.set(le,[]),O.get(le).push(te))});const A=[],B=(te,le)=>{A.push({...te,depth:le}),(O.get(te.id)||[]).forEach(ue=>{B(ue,le+1)})};return y.value.forEach(te=>{te.parent_log_id||B(te,0)}),A}),q={props:e,emit:c,INITIAL_LOAD_LIMIT:tt,LOAD_MORE_LIMIT:bt,offset:d,limit:r,fetchedLogs:n,total:p,hasMore:v,isFetching:g,error:f,wsConnected:h,wsError:w,connectWebSocket:x,disconnectWebSocket:k,refetch:C,allLoadedLogs:y,isFirstLoad:_,selectedLogIdForDetails:V,logsScrollContainer:U,userHasScrolledUp:D,isLoadingMore:j,logRowRefs:F,scrollToBottom:K,logDetails:E,isFetchingDetails:P,selectedLog:H,selectLog:R,setLogRowRef:N,loadMoreLogs:X,handleScroll:Q,getToolsCalled:L,formatCost:I,logsWithDepth:T,LogDetailsComponent:Hu,Loader:qe,TimeAgo:dt,get ScrollTextIcon(){return Vt},get ChevronLeftIcon(){return Xe},get RotateCwIcon(){return no}};return Object.defineProperty(q,"__isScriptSetup",{enumerable:!1,value:!0}),q}}),Ju={class:"flex flex-col h-full"},Ku={class:"p-4 border-b border-gray-300 dark:border-neutral-700"},Zu={class:"flex items-center justify-between"},Gu={class:"flex items-center gap-2"},Xu={class:"flex items-center gap-2"},Qu={key:0,class:"text-xs"},Yu={key:0,class:"text-green-600 dark:text-green-400 flex items-center gap-1"},$u={key:1,class:"text-red-600 dark:text-red-400"},e0={key:2,class:"text-gray-400 dark:text-gray-600"},t0={key:0,class:"text-gray-500 dark:text-gray-400 text-center py-12"},o0={class:"flex justify-center py-12"},r0={class:"text-red-600 dark:text-red-400 text-center py-12"},a0={key:0,class:"border-b border-gray-300 dark:border-neutral-700 bg-white dark:bg-black sticky top-0 z-10"},s0=["disabled"],l0={key:1},n0={key:2},i0={class:"w-full text-sm"},d0=["onClick"],c0={class:"px-3 py-2 text-xs"},u0={class:"flex items-center gap-1"},p0={key:0,class:"text-gray-400 dark:text-gray-600 mr-1"},m0={key:3},g0={class:"px-3 py-2"},f0={class:"flex items-center gap-2"},h0={key:0,class:"text-red-600 dark:text-red-400",title:"Error"},v0={class:"font-mono text-xs"},b0={class:"px-3 py-2 font-mono text-xs"},y0={key:1},x0={class:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400"},k0={key:1},_0={class:"px-3 py-2 text-right text-xs text-gray-500 dark:text-gray-500"},w0={key:0,class:"relative flex-shrink-0 border-t-2 border-gray-300 dark:border-neutral-700 overflow-y-auto",style:{height:"min(60%, calc(100vh - 400px))","min-height":"min(40%, 400px)"}},C0={key:0,class:"absolute inset-0 bg-white/50 dark:bg-black/50 flex items-center justify-center"};function S0(u,t,a,e,c,d){return s(),l("div",Ju,[i(" Header "),o("div",Ku,[o("div",Zu,[o("div",Gu,[S(e.ScrollTextIcon,{size:20,class:"flex-shrink-0"}),t[2]||(t[2]=o("h2",{class:"text-xl font-bold"},"Logs",-1))]),o("div",Xu,[i(" WebSocket status "),a.threadId?(s(),l("div",Qu,[e.wsConnected?(s(),l("span",Yu,[...t[3]||(t[3]=[o("span",{class:"inline-block w-2 h-2 rounded-full bg-green-600 dark:bg-green-400"},null,-1),ie(" Live ",-1)])])):e.wsError?(s(),l("span",$u," ● Error ")):(s(),l("span",e0," ○ Offline "))])):i("v-if",!0),o("button",{onClick:t[0]||(t[0]=r=>e.emit("collapse")),type:"button",class:"p-1 hover:bg-gray-100 dark:hover:bg-gray-900 rounded transition-colors",title:"Collapse pane"},[S(e.ChevronLeftIcon,{size:20})])])])]),i(" Top half: Scrollable logs list "),o("div",{ref:"logsScrollContainer",class:"flex-1 overflow-y-auto overflow-x-auto",onScroll:e.handleScroll},[i(" No thread selected "),a.threadId?e.isFetching&&e.offset===0?(s(),l(W,{key:1},[i(" Loading state (initial load only) "),o("div",o0,[S(e.Loader)])],2112)):e.error?(s(),l(W,{key:2},[i(" Error state "),o("div",r0," Error loading logs: "+b(e.error),1)],2112)):e.allLoadedLogs.length===0?(s(),l(W,{key:3},[i(" Empty state "),t[4]||(t[4]=o("div",{class:"text-gray-500 dark:text-gray-400 text-center py-12"}," No logs yet ",-1))],2112)):(s(),l(W,{key:4},[i(" Logs table "),o("div",null,[i(" Load previous logs button "),e.hasMore?(s(),l("div",a0,[o("button",{onClick:e.loadMoreLogs,disabled:e.isLoadingMore,type:"button",class:"w-full px-3 py-2 text-xs font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-900 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"},[e.isLoadingMore?(s(),Z(e.Loader,{key:0,size:"xs"})):i("v-if",!0),e.isLoadingMore?(s(),l("span",l0,"Loading older logs...")):(s(),l("span",n0,"Load previous logs"))],8,s0)])):i("v-if",!0),o("table",i0,[o("thead",{class:G(["border-b border-gray-300 dark:border-neutral-700 sticky bg-white dark:bg-black",{"top-0":!e.hasMore,"top-[34px]":e.hasMore}])},[...t[5]||(t[5]=[o("tr",null,[o("th",{class:"text-left px-3 py-2 font-semibold"},"Prompt"),o("th",{class:"text-left px-3 py-2 font-semibold"},"Model"),o("th",{class:"text-left px-3 py-2 font-semibold"},"Cost"),o("th",{class:"text-left px-3 py-2 font-semibold"},"Tools Called"),o("th",{class:"text-right px-3 py-2 font-semibold"},"Called At")],-1)])],2),o("tbody",null,[(s(!0),l(W,null,ne(e.logsWithDepth,r=>(s(),l("tr",{key:r.id,ref_for:!0,ref:n=>e.setLogRowRef(r.id,n),class:G(["border-b border-gray-200 dark:border-neutral-800 cursor-pointer transition-colors",{"bg-red-50 dark:bg-red-950/20":r.error,"bg-blue-50 dark:bg-blue-950/20":e.selectedLogIdForDetails===r.id,"ring-2 ring-blue-500":r.id===e.props.selectedLogId}]),onClick:n=>e.selectLog(r)},[o("td",c0,[o("div",u0,[r.depth>0?(s(),l("span",p0,"└─")):i("v-if",!0),r.retry_of_log_id?(s(),Z(e.RotateCwIcon,{key:1,size:14,class:"text-gray-500 dark:text-gray-400 flex-shrink-0"})):i("v-if",!0),!r.is_complete&&!r.prompt_name?(s(),Z(e.Loader,{key:2,size:"xs"})):(s(),l("span",m0,b(r.prompt_name||"—"),1))])]),o("td",g0,[o("div",f0,[r.error?(s(),l("span",h0," ✕ ")):i("v-if",!0),o("span",v0,b(r.model_name||r.model),1)])]),o("td",b0,[!r.is_complete&&!r.cost_total?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",y0,b(e.formatCost(r.cost_total)),1))]),o("td",x0,[!r.is_complete&&e.getToolsCalled(r)==="—"?(s(),Z(e.Loader,{key:0,size:"xs"})):(s(),l("span",k0,b(e.getToolsCalled(r)),1))]),o("td",_0,[S(e.TimeAgo,{timestamp:r.created_at},null,8,["timestamp"])])],10,d0))),128))])])])],2112)):(s(),l("div",t0," Select a thread to view logs "))],544),i(" Bottom half: Log details "),e.selectedLog?(s(),l("div",w0,[S(e.LogDetailsComponent,{log:e.selectedLog,onClose:t[1]||(t[1]=r=>e.selectedLogIdForDetails=null)},null,8,["log"]),i(" Loading overlay for log details "),e.isFetchingDetails?(s(),l("div",C0,[S(e.Loader)])):i("v-if",!0)])):i("v-if",!0)])}const T0=Y(Wu,[["render",S0],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/LogsPane.vue"]]),M0=ee({__name:"CreateThreadModal",props:{modelValue:{type:Boolean,required:!0},editThread:{type:null,required:!1}},emits:["update:modelValue","thread-created","thread-updated"],setup(u,{expose:t,emit:a}){t();const e=u,c=a,d=z(()=>!!e.editThread),r=m(""),n=m(""),p=m({}),v=m([]),g=m(""),f=m(!1),h=m(""),w=m(null),{data:x,isFetching:k,execute:C}=ve(J("/api/agents"),{immediate:!1}).json(),y=z(()=>x.value?(x.value?.agents||[]).map(q=>({value:q.id,label:q.title})):[]),_=z(()=>!r.value||!x.value?null:(x.value?.agents||[]).find(q=>q.id===r.value)),V=z(()=>_.value&&_.value.type==="ai_human"?"AI":"Side A"),U=z(()=>_.value&&_.value.type==="ai_human"?"Human":"Side B"),{data:D,isFetching:j,execute:F}=ve(z(()=>_.value?.side_a_system_prompt?J(`/api/prompts/${_.value.side_a_system_prompt}`):""),{immediate:!1}).json(),K=z(()=>{if(!D.value)return null;const T=D.value?.required_schema;if(!T)return null;try{return typeof T=="string"?JSON.parse(T):T}catch{return null}}),E=z(()=>{const T=K.value;return!T||!T.properties?[]:Object.entries(T.properties).map(([q,M])=>({name:q,type:M.type||"string",description:M.description||"",required:T.required?.includes(q)||!1,enum:M.enum}))});re(r,async T=>{T&&_.value?.side_a_system_prompt?(await F(),p.value={}):p.value={}});const P=()=>{const T=w.value;T&&(T.style.height="auto",T.style.height=`${T.scrollHeight}px`)},H=T=>{g.value.trim()&&(v.value.push({id:crypto.randomUUID(),role:T,content:g.value.trim()}),g.value="",setTimeout(()=>P(),0))},R=T=>{v.value=v.value.filter(q=>q.id!==T)},N=()=>{r.value="",n.value="",p.value={},v.value=[],g.value="",h.value=""},X=()=>{e.editThread&&(r.value=e.editThread.agent_id,n.value=e.editThread.tags?.join(", ")||"")},Q=async()=>{if(!r.value){h.value="Please select an agent";return}if(!d.value&&E.value.length>0){for(const T of E.value)if(T.required&&!p.value[T.name]){h.value=`Please provide ${T.name}`;return}}f.value=!0,h.value="";try{const T=n.value.split(",").map(q=>q.trim()).filter(q=>q.length>0);if(d.value){const q=await fetch(J(`/api/threads/${e.editThread.id}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tags:T})});if(!q.ok){const M=await q.json();throw new Error(M.error||"Failed to update thread")}c("thread-updated"),N(),c("update:modelValue",!1)}else{const q={agent_id:r.value,tags:T.length>0?T:void 0};v.value.length>0&&(q.initial_messages=v.value.map(B=>({role:B.role,content:B.content}))),Object.keys(p.value).length>0&&(q.data=p.value);const M=await fetch(J("/api/threads"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(q)});if(!M.ok){const B=await M.json();throw new Error(B.error||"Failed to create thread")}const A=(await M.json()).threadId;if(!A)throw new Error("Thread created but ID not found in response");c("thread-created",A),N(),c("update:modelValue",!1)}}catch(T){console.error(`Error ${d.value?"updating":"creating"} thread:`,T),h.value=T.message||`Failed to ${d.value?"update":"create"} thread`}finally{f.value=!1}},L=()=>{N(),c("update:modelValue",!1)};re(()=>e.modelValue,async T=>{T&&(await C(),N(),d.value&&X())});const I={props:e,emit:c,isEditMode:d,selectedAgentId:r,tags:n,requiredData:p,messages:v,newMessageContent:g,isSubmitting:f,errorMessage:h,textareaRef:w,agentsData:x,isFetchingAgents:k,fetchAgents:C,agentOptions:y,selectedAgent:_,sideALabel:V,sideBLabel:U,promptData:D,isFetchingPrompt:j,fetchPrompt:F,requiredSchema:K,schemaFields:E,adjustHeight:P,addMessage:H,removeMessage:R,resetForm:N,populateEditForm:X,handleSubmit:Q,handleCancel:L,Modal:Ie,SelectInput:xe,TextInput:Oe,TextareaInput:Ot};return Object.defineProperty(I,"__isScriptSetup",{enumerable:!1,value:!0}),I}}),V0={class:"space-y-4"},I0={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"},A0={class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},P0={key:0},E0={key:1},L0={key:1,class:"space-y-4 p-4 bg-gray-50 dark:bg-gray-900 rounded-lg"},O0={class:"flex items-center gap-2"},j0=["onUpdate:modelValue","id"],D0=["for"],U0={key:0,class:"text-red-500"},q0={key:5,class:"text-xs text-gray-500 dark:text-gray-400 mt-1"},N0={key:2,class:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg text-center text-sm text-gray-500"},B0={key:3},R0={key:0,class:"space-y-3 mb-4 max-h-64 overflow-y-auto p-2"},F0={class:"text-xs font-medium mb-1 opacity-70"},z0={class:"text-sm whitespace-pre-wrap"},H0=["onClick"],W0={class:"space-y-2"},J0={class:"flex items-stretch border border-black dark:border-neutral-300 rounded overflow-hidden bg-white dark:bg-black"},K0=["disabled","title"],Z0={class:"flex-1 relative"},G0=["disabled","title"],X0={class:"text-xs text-gray-500 dark:text-gray-400"},Q0={class:"flex justify-between"},Y0=["disabled"],$0=["disabled"];function e2(u,t,a,e,c,d){return s(),Z(e.Modal,{"model-value":a.modelValue,"onUpdate:modelValue":t[7]||(t[7]=r=>u.$emit("update:modelValue",r)),title:e.isEditMode?"Edit Thread":"Create New Thread",width:"max-w-3xl"},{footer:oe(()=>[o("div",Q0,[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,Y0),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?(s(),l(W,{key:0},[ie(b(e.isSubmitting?"Updating...":"Update Thread"),1)],64)):(s(),l(W,{key:1},[ie(b(e.isSubmitting?"Creating...":"Create Thread"),1)],64))],8,$0)])]),default:oe(()=>[o("div",V0,[i(" Error Message "),e.errorMessage?(s(),l("div",I0,b(e.errorMessage),1)):i("v-if",!0),i(" Agent Selection (disabled in edit mode) "),o("div",null,[S(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",A0,[e.isEditMode?(s(),l("span",P0,"Agent cannot be changed after thread creation")):(s(),l("span",E0,"Choose which agent will handle this conversation"))])]),i(" Dynamic schema fields (only in create mode) "),!e.isEditMode&&e.schemaFields.length>0&&!e.isFetchingPrompt?(s(),l("div",L0,[t[8]||(t[8]=o("h4",{class:"text-sm font-medium text-gray-700 dark:text-gray-300"}," Required Information ",-1)),(s(!0),l(W,null,ne(e.schemaFields,r=>(s(),l("div",{key:r.name,class:"space-y-2"},[i(" Enum field (dropdown) "),r.enum?(s(),Z(e.SelectInput,{key:0,modelValue:e.requiredData[r.name],"onUpdate:modelValue":n=>e.requiredData[r.name]=n,label:r.name,options:[{value:"",label:"Select..."},...r.enum.map(n=>({value:n,label:n}))],required:r.required},null,8,["modelValue","onUpdate:modelValue","label","options","required"])):r.type==="string"?(s(),l(W,{key:1},[i(" Text field "),S(e.TextInput,{modelValue:e.requiredData[r.name],"onUpdate:modelValue":n=>e.requiredData[r.name]=n,label:r.name,placeholder:r.description,required:r.required},null,8,["modelValue","onUpdate:modelValue","label","placeholder","required"])],2112)):r.type==="number"||r.type==="integer"?(s(),l(W,{key:2},[i(" Number field "),S(e.TextInput,{modelValue:e.requiredData[r.name],"onUpdate:modelValue":n=>e.requiredData[r.name]=n,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"?(s(),l(W,{key:3},[i(" Boolean field "),o("div",O0,[fe(o("input",{"onUpdate:modelValue":n=>e.requiredData[r.name]=n,type:"checkbox",id:`field-${r.name}`,class:"w-4 h-4"},null,8,j0),[[io,e.requiredData[r.name]]]),o("label",{for:`field-${r.name}`,class:"text-sm"},[ie(b(r.name)+" ",1),r.required?(s(),l("span",U0,"*")):i("v-if",!0)],8,D0)])],2112)):(s(),l(W,{key:4},[i(" Fallback: textarea for complex types "),S(e.TextareaInput,{modelValue:e.requiredData[r.name],"onUpdate:modelValue":n=>e.requiredData[r.name]=n,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?(s(),l("p",q0,b(r.description),1)):i("v-if",!0)]))),128))])):i("v-if",!0),i(" Loading prompt schema (only in create mode) "),!e.isEditMode&&e.isFetchingPrompt?(s(),l("div",N0," Loading agent requirements... ")):i("v-if",!0),i(" Conversation Builder (only in create mode) "),e.isEditMode?i("v-if",!0):(s(),l("div",B0,[t[12]||(t[12]=o("h4",{class:"text-sm font-medium mb-3"},"Initial Conversation",-1)),i(" Messages List (iOS style) "),e.messages.length>0?(s(),l("div",R0,[(s(!0),l(W,null,ne(e.messages,r=>(s(),l("div",{key:r.id,class:G(["flex items-start gap-2",{"justify-start":r.role==="assistant","justify-end":r.role==="user"}])},[o("div",{class:G(["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-gray-200 text-black dark:bg-gray-800 dark:text-white":r.role==="user"}])},[o("div",F0,b(r.role==="assistant"?e.sideALabel:e.sideBLabel),1),o("div",z0,b(r.content),1)],2),o("button",{onClick:n=>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,H0)],2))),128))])):(s(),l(W,{key:1},[i(" Empty state "),t[9]||(t[9]=o("div",{class:"text-center py-8 text-gray-500 dark:text-gray-400 text-sm"}," No messages yet. Add messages to start the conversation. ",-1))],2112)),i(" Add Message Form "),o("div",W0,[i(" Unified Input Container "),o("div",J0,[i(" 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,b(e.sideALabel),1)],8,K0),i(" Multiline Input (no border, no padding adjustments needed) "),o("div",Z0,[fe(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]=at(he(r=>e.addMessage("user"),["meta"]),["enter"])),t[4]||(t[4]=at(he(r=>e.addMessage("user"),["ctrl"]),["enter"]))]},null,544),[[_e,e.newMessageContent]])]),i(" 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,b(e.sideBLabel),1)],8,G0)]),o("p",X0," Type a message and click "+b(e.sideALabel)+" (left) or "+b(e.sideBLabel)+" (right) to add. Or press Cmd+Enter (Mac) / Ctrl+Enter (Windows) to add as "+b(e.sideBLabel)+". ",1)])])),i(" Tags "),o("div",null,[S(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-gray-500 dark:text-gray-400"}," Comma-separated tags to help organize and search threads ",-1))])])]),_:1},8,["model-value","title"])}const t2=Y(M0,[["render",e2],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/CreateThreadModal.vue"]]),o2=ee({__name:"ThreadsView",setup(u,{expose:t}){t();const a=Pe(),e=Ue(),c=m(typeof a.params.id=="string"?a.params.id:null),d=m({threadList:!1,messages:!1,meta:!0,logs:!1}),r=m(!1),n=m(null),p=m(null),{thread:v}=it(z(()=>c.value)),g=m(null),f=m(null);re(()=>a.params.id,j=>{c.value=typeof j=="string"?j:null,g.value=null,f.value=null});const D={route:a,router:e,selectedThreadId:c,collapsedPanes:d,showThreadModal:r,editingThread:n,threadListPaneRef:p,thread:v,selectedMessageId:g,selectedLogId:f,handleThreadSelect:j=>{e.push(`/threads/${j}`)},handleThreadDeleted:j=>{window.location.href="/threads"},handleEditThread:()=>{v.value&&(n.value=v.value,r.value=!0)},handleCreateThread:()=>{n.value=null,r.value=!0},handleThreadCreated:j=>{p.value?.refetch(),e.push(`/threads/${j}`)},handleThreadUpdated:()=>{window.location.reload()},togglePane:j=>{d.value[j]=!d.value[j]},handleMessageClick:(j,F)=>{g.value=j,f.value=F},handleLogClick:j=>{f.value=j,g.value=null},ThreadListPane:ln,MessagesPane:xi,MetaPane:gd,LogsPane:T0,CreateThreadModal:t2,get ListIcon(){return Ct},get MessageSquareIcon(){return Tt},get InfoIcon(){return Mt},get ScrollTextIcon(){return Vt}};return Object.defineProperty(D,"__isScriptSetup",{enumerable:!1,value:!0}),D}}),r2={class:"flex h-full overflow-hidden"},a2={key:0,class:"flex flex-col items-center p-4"},s2={key:0,class:"flex flex-col items-center p-4"},l2={key:0,class:"flex flex-col items-center p-4"},n2={key:0,class:"flex flex-col items-center p-4"};function i2(u,t,a,e,c,d){return s(),l("div",r2,[i(" Pane 1: Thread List "),o("div",{class:G([e.collapsedPanes.threadList?"w-[60px]":"w-[320px]","border-r border-gray-300 dark:border-neutral-700 flex-shrink-0 overflow-hidden transition-all duration-200"])},[e.collapsedPanes.threadList?(s(),l("div",a2,[o("button",{onClick:t[0]||(t[0]=r=>e.togglePane("threadList")),class:"p-2 hover:bg-gray-100 dark:hover:bg-gray-900 rounded transition-colors",title:"Expand Threads pane"},[S(e.ListIcon,{size:20})])])):(s(),Z(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},null,8,["selected-thread-id"]))],2),i(" Pane 2: Messages "),o("div",{class:G([e.collapsedPanes.messages?"w-[60px]":"w-[350px]","border-r border-gray-300 dark:border-neutral-700 flex-shrink-0 overflow-hidden transition-all duration-200"])},[e.collapsedPanes.messages?(s(),l("div",s2,[o("button",{onClick:t[2]||(t[2]=r=>e.togglePane("messages")),class:"p-2 hover:bg-gray-100 dark:hover:bg-gray-900 rounded transition-colors",title:"Expand Messages pane"},[S(e.MessageSquareIcon,{size:20})])])):(s(),Z(e.MessagesPane,{key:1,"thread-id":e.selectedThreadId,"selected-message-id":e.selectedMessageId,"selected-log-id":e.selectedLogId,onCollapse:t[3]||(t[3]=r=>e.togglePane("messages")),onMessageClick:e.handleMessageClick},null,8,["thread-id","selected-message-id","selected-log-id"]))],2),i(" Pane 3: Meta Info "),o("div",{class:G([e.collapsedPanes.meta?"w-[60px]":"w-[350px]","border-r border-gray-300 dark:border-neutral-700 flex-shrink-0 overflow-hidden transition-all duration-200"])},[e.collapsedPanes.meta?(s(),l("div",l2,[o("button",{onClick:t[4]||(t[4]=r=>e.togglePane("meta")),class:"p-2 hover:bg-gray-100 dark:hover:bg-gray-900 rounded transition-colors",title:"Expand Metadata pane"},[S(e.InfoIcon,{size:20})])])):(s(),Z(e.MetaPane,{key:1,"thread-id":e.selectedThreadId,onCollapse:t[5]||(t[5]=r=>e.togglePane("meta")),onThreadDeleted:e.handleThreadDeleted,onEditThread:e.handleEditThread},null,8,["thread-id"]))],2),i(" Pane 4: Logs (flexible width) "),o("div",{class:G([e.collapsedPanes.logs?"w-[60px]":"flex-1","overflow-hidden transition-all duration-200"])},[e.collapsedPanes.logs?(s(),l("div",n2,[o("button",{onClick:t[6]||(t[6]=r=>e.togglePane("logs")),class:"p-2 hover:bg-gray-100 dark:hover:bg-gray-900 rounded transition-colors",title:"Expand Logs pane"},[S(e.ScrollTextIcon,{size:20})])])):(s(),Z(e.LogsPane,{key:1,"thread-id":e.selectedThreadId,"selected-log-id":e.selectedLogId,onCollapse:t[7]||(t[7]=r=>e.togglePane("logs")),onLogClick:e.handleLogClick},null,8,["thread-id","selected-log-id"]))],2),i(" Thread Modal (Create/Edit) "),S(e.CreateThreadModal,{modelValue:e.showThreadModal,"onUpdate:modelValue":t[8]||(t[8]=r=>e.showThreadModal=r),"edit-thread":e.editingThread,onThreadCreated:e.handleThreadCreated,onThreadUpdated:e.handleThreadUpdated},null,8,["modelValue","edit-thread"])])}const yt=Y(o2,[["render",i2],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/ThreadsView.vue"]]),d2=ee({__name:"PromptsDataTable",emits:["add","edit","delete"],setup(u,{expose:t,emit:a}){const e=a,c=m([]),d=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:(f,h)=>f||h.model_id||"-"},{key:"created_at",label:"Created",width:"w-1/6",formatter:f=>f?new Date(f*1e3).toLocaleDateString():"-"}],n=[{icon:"edit",label:"Edit",handler:f=>e("edit",f)},{icon:"delete",label:"Delete",handler:async f=>{await v(f)},confirm:!0,confirmMessage:"Are you sure you want to delete this prompt?"}],p=async()=>{d.value=!0;try{const f=await fetch(J("/api/prompts"));if(f.ok){const h=await f.json();c.value=h.prompts||[]}}catch(f){console.error("Error fetching prompts:",f)}finally{d.value=!1}},v=async f=>{try{const h=await fetch(J(`/api/prompts/${f.id}`),{method:"DELETE"});if(h.ok)await p();else{const w=await h.json();alert(w.error||"Failed to delete prompt")}}catch(h){console.error("Error deleting prompt:",h),alert("Failed to delete prompt")}};ce(()=>{p()}),t({refresh:p});const g={emit:e,prompts:c,loading:d,columns:r,actions:n,fetchPrompts:p,deletePrompt:v,DataTable:Le};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}});function c2(u,t,a,e,c,d){return s(),l("div",null,[S(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 u2=Y(d2,[["render",c2],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/PromptsDataTable.vue"]]),p2=ee({__name:"PromptBasicInfo",props:{name:{type:String,required:!0},toolDescription:{type:String,required:!0}},emits:["update:name","update:toolDescription"],setup(u,{expose:t,emit:a}){t();const e=u,c=a,d=m(""),r=v=>{let g=v.replace(/[^a-zA-Z0-9\s_]/g,"");return g=g.trim().toLowerCase().replace(/\s+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),g?/^[a-z][a-z0-9_]*$/.test(g)?d.value="":d.value="Name must start with a letter and contain only lowercase letters, numbers, and underscores":d.value="Name is required",g},n=v=>{const g=r(v);c("update:name",g)};re(()=>e.name,v=>{v&&r(v)},{immediate:!0});const p={props:e,emit:c,nameError:d,validateAndFormatName:r,handleNameInput:n,TextInput:Oe};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}}),m2={class:"space-y-4"},g2={key:0,class:"mt-1 text-sm text-red-500"},f2={key:1,class:"mt-1 text-sm text-gray-500 dark:text-gray-400"},h2={class:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded"},v2=["value"];function b2(u,t,a,e,c,d){return s(),l("div",m2,[o("div",null,[S(e.TextInput,{"model-value":a.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?(s(),l("p",g2,b(e.nameError),1)):a.name?(s(),l("p",f2,[t[1]||(t[1]=ie(" Will be saved as: ",-1)),o("code",h2,b(a.name),1)])):i("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:a.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,v2)])])}const y2=Y(p2,[["render",b2],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/prompt-form/PromptBasicInfo.vue"]]),x2="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",Ze="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",k2="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",xt="/agents/assets/img/meta.svg",_2="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",w2="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",C2="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",S2="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",T2="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBmaWxsPSJub25lIj4KICA8cmVjdCB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIGZpbGw9IiNGRjZCNkIiLz4KICA8dGV4dCB4PSI1MCUiIHk9IjUwJSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZmlsbD0id2hpdGUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZm9udC13ZWlnaHQ9ImJvbGQiPk1NPC90ZXh0Pgo8L3N2Zz4=",M2="/agents/assets/img/moonshotai.svg",V2="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",I2="/agents/assets/img/zai.svg",A2="/agents/assets/img/zai.svg",P2="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBmaWxsPSJub25lIj4KICA8cmVjdCB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIGZpbGw9IiNBOEU2QTMiLz4KICA8dGV4dCB4PSI1MCUiIHk9IjUwJSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZmlsbD0iIzJDM0U1MCIgZm9udC1mYW1pbHk9IkFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE0IiBmb250LXdlaWdodD0iYm9sZCI+RVhBPC90ZXh0Pgo8L3N2Zz4=",st="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 E2(u){const t=Fe();return t==="/"?u.replace("/agents/","/"):u.replace("/agents/",`${t}/`)}const L2={anthropic:x2,openai:Ze,"openai-sdk":Ze,google:k2,meta:xt,"meta-llama":xt,nvidia:_2,alibaba:w2,deepseek:C2,qwen:S2,minimax:T2,moonshotai:M2,"x-ai":V2,"z-ai":I2,zai:A2,exaone:P2,openrouter:st},O2=new Proxy(L2,{get(u,t){const a=u[t];return a?E2(a):void 0}});function j2(u){if(u&&u.includes("/"))return u.split("/")[0].toLowerCase()}function Ge(u){return O2[u.toLowerCase()]}function ct(u,t){const a=j2(u);if(a){const e=Ge(a);if(e)return e}if(t)return Ge(t)}const D2=ee({__name:"PromptModelSelect",props:{modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(u,{expose:t,emit:a}){t();const e=u,c=a,d=m([]),r=m(!1),n=z(()=>d.value.map(g=>({value:g.id,label:g.name,description:g.model||g.provider,icon:ct(g.model||g.name,g.provider_id||g.provider)}))),p=async()=>{r.value=!0;try{const g=await fetch(J("/api/models"));if(g.ok){const f=await g.json();d.value=f.models||[]}}catch(g){console.error("Error fetching models:",g)}finally{r.value=!1}};ce(()=>{p()});const v={props:e,emit:c,models:d,loadingModels:r,modelOptions:n,fetchModels:p,SelectInput:xe};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),U2={class:"space-y-4"};function q2(u,t,a,e,c,d){return s(),l("div",U2,[S(e.SelectInput,{"model-value":a.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 N2=Y(D2,[["render",q2],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/prompt-form/PromptModelSelect.vue"]]),B2=ee({__name:"PropertyEditor",props:Se({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:Se(["remove","description-keydown","add-top-level"],["update:modelValue"]),setup(u,{expose:t,emit:a}){t();const e=u,c=a,d=Ee(u,"modelValue"),r=m(!1),n=m(),p={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>'},v=[{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"}],g=z(()=>["object","array","enum","anyOf"].includes(d.value.type));re(()=>d.value.type,async(V,U)=>{if(["object","array","enum","anyOf"].includes(V)&&(r.value=!0,V==="anyOf"&&!d.value.anyOf&&(d.value.anyOf=[]),V==="object"&&!d.value.properties&&(d.value.properties=[{id:crypto.randomUUID(),name:"property1",type:"string",description:""}]),V==="array"&&!d.value.items&&(d.value.items={id:crypto.randomUUID(),name:"",type:"string",description:""}),V==="enum"&&!d.value.enum&&(d.value.enum=["value1"])),U!==void 0){await pe();const D=e.isNested?`[data-nested-property-id="${e.propertyId}"] input[placeholder="Description"]`:`[data-property-id="${e.propertyId}"] input[placeholder="Description"]`,j=document.querySelector(D);j&&j.focus()}});const f=V=>{V.shiftKey&&d.value.type==="object"&&d.value.properties?k():c("add-top-level")},h=()=>{d.value.items||(d.value.items={id:crypto.randomUUID(),name:"",type:"string",description:""})},w=()=>{d.value.enum||(d.value.enum=[]),d.value.enum.push(`value${d.value.enum.length+1}`)},x=V=>{d.value.enum&&d.value.enum.splice(V,1)},k=async()=>{const V={id:crypto.randomUUID(),name:d.value.type==="anyOf"?"":`property${(d.value.properties?.length||d.value.anyOf?.length||0)+1}`,type:"string",description:""};d.value.type==="anyOf"?(d.value.anyOf||(d.value.anyOf=[]),d.value.anyOf.push(V)):(d.value.properties||(d.value.properties=[]),d.value.properties.push(V)),await pe();const U=document.querySelector(`[data-nested-property-id="${V.id}"] input[placeholder="Property name"]`);U&&(U.focus(),U.select())},_={props:e,emit:c,modelValue:d,expanded:r,propertyListRef:n,typeIcons:p,typeOptions:v,isExpandable:g,handleEnterKey:f,initArrayItems:h,addEnumValue:w,removeEnumValue:x,addNestedProperty:k,removeNestedProperty:V=>{d.value.type==="anyOf"&&d.value.anyOf?d.value.anyOf=d.value.anyOf.filter(U=>U.id!==V):d.value.properties&&(d.value.properties=d.value.properties.filter(U=>U.id!==V))},handleNestedDescriptionKeydown:V=>{},SelectInput:xe,TextInput:Oe};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}}),R2=["data-property-id","data-nested-property-id"],F2={class:"p-3 space-y-3"},z2={class:"flex items-start gap-2"},H2={key:0,class:"drag-handle cursor-move text-gray-400 hover:text-gray-600 dark:text-gray-600 dark:hover:text-gray-400 mt-2"},W2={class:"flex-1 grid grid-cols-1 md:grid-cols-3 gap-2"},J2={class:"flex items-center gap-2 mt-2"},K2=["disabled"],Z2={key:0,class:"ml-6"},G2={key:0,class:"p-3 bg-gray-50 dark:bg-gray-900 rounded-lg space-y-2"},X2={class:"flex items-center justify-between mb-2"},Q2=["disabled"],Y2={key:0,class:"space-y-1"},$2=["onClick","disabled"],ep={key:1,class:"p-3 bg-gray-50 dark:bg-gray-900 rounded-lg"},tp={class:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-2"},op={class:"space-y-2"},rp={class:"flex items-center justify-between"},ap=["disabled"],sp={class:"space-y-2"},lp={key:2,class:"p-3 bg-gray-50 dark:bg-gray-900 rounded-lg"},np={key:0,class:"mb-2"},ip=["disabled"],dp={key:1,class:"space-y-2"};function cp(u,t,a,e,c,d){const r=co("PropertyEditor",!0);return s(),l("div",{"data-property-id":a.isNested?void 0:a.propertyId,"data-nested-property-id":a.isNested?a.propertyId:void 0,class:G(["border rounded-lg",a.isNested?"border-gray-100 dark:border-neutral-900":"border-gray-200 dark:border-neutral-800"])},[o("div",F2,[o("div",z2,[i(" Drag handle "),a.enableDrag?(s(),l("div",H2,[...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)])])):i("v-if",!0),i(" Property fields "),o("div",W2,[S(e.TextInput,{modelValue:e.modelValue.name,"onUpdate:modelValue":t[0]||(t[0]=n=>e.modelValue.name=n),placeholder:"Property name",disabled:a.disabled},null,8,["modelValue","disabled"]),S(e.SelectInput,{modelValue:e.modelValue.type,"onUpdate:modelValue":t[1]||(t[1]=n=>e.modelValue.type=n),options:e.typeOptions,disabled:a.disabled},null,8,["modelValue","disabled"]),S(e.TextInput,{modelValue:e.modelValue.description,"onUpdate:modelValue":t[2]||(t[2]=n=>e.modelValue.description=n),placeholder:"Description",disabled:a.disabled,onKeydown:t[3]||(t[3]=at(he(n=>e.handleEnterKey(n),["prevent"]),["enter"]))},null,8,["modelValue","disabled"])]),i(" Controls "),o("div",J2,[e.isExpandable?(s(),l("button",{key:0,onClick:t[4]||(t[4]=n=>e.expanded=!e.expanded),type:"button",class:"p-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"},[(s(),l("svg",{class:G(["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))])):i("v-if",!0),o("button",{onClick:t[5]||(t[5]=n=>u.$emit("remove")),type:"button",disabled:a.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,K2)])]),i(" Expandable content "),e.expanded&&e.isExpandable?(s(),l("div",Z2,[i(" Enum values "),e.modelValue.type==="enum"?(s(),l("div",G2,[o("div",X2,[t[13]||(t[13]=o("h4",{class:"text-xs font-medium text-gray-600 dark:text-gray-400"}," Enum Values ",-1)),o("button",{onClick:e.addEnumValue,type:"button",disabled:a.disabled,class:"px-2 py-0.5 text-xs bg-gray-800 dark:bg-gray-200 text-white dark:text-black rounded hover:bg-gray-700 dark:hover:bg-gray-300 transition-colors disabled:opacity-50"}," Add Value ",8,Q2)]),e.modelValue.enum?(s(),l("div",Y2,[(s(!0),l(W,null,ne(e.modelValue.enum,(n,p)=>(s(),l("div",{key:p,class:"flex items-center gap-2"},[S(e.TextInput,{modelValue:e.modelValue.enum[p],"onUpdate:modelValue":v=>e.modelValue.enum[p]=v,placeholder:"Enum value",disabled:a.disabled,class:"flex-1"},null,8,["modelValue","onUpdate:modelValue","disabled"]),o("button",{onClick:v=>e.removeEnumValue(p),type:"button",disabled:a.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,$2)]))),128))])):i("v-if",!0)])):i("v-if",!0),i(" Object properties / anyOf types "),e.modelValue.type==="object"||e.modelValue.type==="anyOf"?(s(),l("div",ep,[o("h4",tp,b(e.modelValue.type==="anyOf"?"Type Options":"Nested Properties"),1),o("div",op,[i(" Add nested properties buttons "),o("div",rp,[o("button",{onClick:e.addNestedProperty,type:"button",disabled:a.disabled,class:"px-2 py-0.5 text-xs bg-gray-800 dark:bg-gray-200 text-white dark:text-black rounded hover:bg-gray-700 dark:hover:bg-gray-300 transition-colors disabled:opacity-50"}," Add "+b(e.modelValue.type==="anyOf"?"Type Option":"Property"),9,ap)]),i(" Render nested properties "),o("div",sp,[(s(!0),l(W,null,ne(e.modelValue.type==="anyOf"?e.modelValue.anyOf:e.modelValue.properties,(n,p)=>(s(),Z(r,{key:n.id,modelValue:(e.modelValue.type==="anyOf"?e.modelValue.anyOf:e.modelValue.properties)[p],"onUpdate:modelValue":v=>(e.modelValue.type==="anyOf"?e.modelValue.anyOf:e.modelValue.properties)[p]=v,"property-id":n.id,"is-nested":!0,"parent-id":a.propertyId,disabled:a.disabled,"enable-drag":!1,onRemove:v=>e.removeNestedProperty(n.id),onAddTopLevel:t[6]||(t[6]=v=>e.emit("add-top-level"))},null,8,["modelValue","onUpdate:modelValue","property-id","parent-id","disabled","onRemove"]))),128))])])])):i("v-if",!0),i(" Array items "),e.modelValue.type==="array"?(s(),l("div",lp,[t[15]||(t[15]=o("h4",{class:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-2"}," Array Item Type ",-1)),e.modelValue.items?i("v-if",!0):(s(),l("div",np,[o("button",{onClick:e.initArrayItems,type:"button",disabled:a.disabled,class:"px-2 py-0.5 text-xs bg-gray-800 dark:bg-gray-200 text-white dark:text-black rounded hover:bg-gray-700 dark:hover:bg-gray-300 transition-colors disabled:opacity-50"}," Define Item Type ",8,ip)])),e.modelValue.items?(s(),l("div",dp,[S(r,{modelValue:e.modelValue.items,"onUpdate:modelValue":t[7]||(t[7]=n=>e.modelValue.items=n),"property-id":e.modelValue.items.id,"is-nested":!0,"parent-id":a.propertyId,disabled:a.disabled,"enable-drag":!1,onRemove:t[8]||(t[8]=n=>e.modelValue.items=null),onAddTopLevel:t[9]||(t[9]=n=>e.emit("add-top-level"))},null,8,["modelValue","property-id","parent-id","disabled"])])):i("v-if",!0)])):i("v-if",!0)])):i("v-if",!0)])],10,R2)}const up=Y(B2,[["render",cp],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/PropertyEditor.vue"]]),pp=ee({__name:"PropertyList",props:Se({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:Se(["add-property","description-keydown"],["update:modelValue"]),setup(u,{expose:t,emit:a}){const e=u,c=a,d=Ee(u,"modelValue"),r=m();let n=!1;ce(async()=>{}),Te(()=>{});const p=async()=>{if(n)return;n=!0;const h={id:crypto.randomUUID(),name:`property${d.value.length+1}`,type:"string",description:"",required:!1};d.value=[...d.value,h],await pe();const w=e.parentId?`[data-nested-property-id="${h.id}"]`:`[data-property-id="${h.id}"]`,x=document.querySelector(`${w} input[placeholder="Property name"]`);x&&(x.focus(),x.select()),c("add-property"),n=!1},v=h=>{d.value=d.value.filter(w=>w.id!==h)},g=h=>{};t({addProperty:p});const f={props:e,emit:c,modelValue:d,dragAreaRef:r,get isAddingProperty(){return n},set isAddingProperty(h){n=h},addProperty:p,removeProperty:v,handleDescriptionKeydown:g,PropertyEditor:up};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),mp={class:"space-y-2"},gp={ref:"dragAreaRef",class:"space-y-2"},fp=["disabled"];function hp(u,t,a,e,c,d){return s(),l("div",mp,[o("div",gp,[(s(!0),l(W,null,ne(e.modelValue,r=>(s(),Z(e.PropertyEditor,{key:r.id,modelValue:e.modelValue[e.modelValue.indexOf(r)],"onUpdate:modelValue":n=>e.modelValue[e.modelValue.indexOf(r)]=n,"property-id":r.id,"is-nested":a.isNested,"parent-id":a.parentId,disabled:a.disabled,"enable-drag":!a.isNested,onRemove:n=>e.removeProperty(r.id),onAddTopLevel:t[0]||(t[0]=n=>u.$emit("add-property"))},null,8,["modelValue","onUpdate:modelValue","property-id","is-nested","parent-id","disabled","enable-drag","onRemove"]))),128))],512),i(" Add Property button at the bottom for both nested and non-nested "),o("div",{class:G(a.isNested?"mt-2":"mt-3 pt-3 border-t border-gray-200 dark:border-neutral-800")},[o("button",{onClick:e.addProperty,type:"button",disabled:a.disabled,class:G(a.isNested?"px-2 py-1 text-xs bg-gray-800 dark:bg-gray-200 text-white dark:text-black rounded hover:bg-gray-700 dark:hover:bg-gray-300 transition-colors disabled:opacity-50":"w-full px-3 py-2 text-sm bg-gray-50 dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300 rounded transition-colors disabled:opacity-50 border border-dashed border-gray-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"})]),ie(" Add Property ")],-1)])],10,fp)],2)])}const vp=Y(pp,[["render",hp],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/PropertyList.vue"]]),bp=ee({__name:"JSONSchemaInput",props:Se({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(u,{expose:t}){t();const a=u,e=Ee(u,"modelValue"),c=m([]),d=m(),r=m(!1),n=()=>{if(e.value?.properties){const y=[];e.value.required;for(const[_,V]of Object.entries(e.value.properties)){const U=V,D={id:crypto.randomUUID(),name:_,type:U.type||"string",description:U.description||""};U.enum&&(D.enum=U.enum),U.anyOf&&(D.type="anyOf",D.anyOf=p(U.anyOf)),U.type==="array"&&U.items&&(D.items=v(U.items)),U.type==="object"&&U.properties&&(D.properties=g(U.properties,U.required||[])),y.push(D)}c.value=y}},p=y=>y.map(_=>typeof _=="object"&&_.type?{id:crypto.randomUUID(),name:"",type:_.type,description:_.description||"",properties:_.properties?g(_.properties,_.required||[]):void 0,items:_.items?v(_.items):void 0,enum:_.enum}:{id:crypto.randomUUID(),name:"",type:"string",description:""}),v=y=>{const _={id:crypto.randomUUID(),name:"",type:y.type||"string",description:y.description||""};return y.enum&&(_.enum=y.enum),y.anyOf&&(_.type="anyOf",_.anyOf=p(y.anyOf)),y.type==="array"&&y.items&&(_.items=v(y.items)),y.type==="object"&&y.properties&&(_.properties=g(y.properties,y.required||[])),_},g=(y,_)=>{const V=[];for(const[U,D]of Object.entries(y)){const j=D,F={id:crypto.randomUUID(),name:U,type:j.type||"string",description:j.description||""};j.enum&&(F.enum=j.enum),j.anyOf&&(F.type="anyOf",F.anyOf=p(j.anyOf)),j.type==="array"&&j.items&&(F.items=v(j.items)),j.type==="object"&&j.properties&&(F.properties=g(j.properties,j.required||[])),V.push(F)}return V};n();const f=()=>{const y={type:"object",properties:{},required:[],additionalProperties:!1},{properties:_,required:V}=w(c.value);y.properties=_,y.required=Object.keys(_),e.value=y},h=y=>{const _={type:y.type==="anyOf"?void 0:y.type,description:y.description};if(y.type==="enum"&&y.enum&&(_.enum=y.enum,_.type="string"),y.type==="anyOf"&&y.anyOf&&(delete _.type,_.anyOf=y.anyOf.map(h)),y.type==="object"&&y.properties){const{properties:V,required:U}=w(y.properties);_.properties=V,_.required=Object.keys(V),_.additionalProperties=!1}return y.type==="array"&&y.items&&(_.items=h(y.items)),_},w=y=>{const _={},V=[];for(const U of y){const D={type:U.type==="anyOf"?void 0:U.type,description:U.description};if(V.push(U.name),U.type==="enum"&&U.enum&&(D.enum=U.enum,D.type="string"),U.type==="anyOf"&&U.anyOf&&U.anyOf.length>0&&(delete D.type,D.anyOf=U.anyOf.map(h)),U.type==="array"&&U.items&&(D.items=h(U.items)),U.type==="object"&&U.properties){const{properties:j,required:F}=w(U.properties);D.properties=j,D.required=Object.keys(j),D.additionalProperties=!1}_[U.name]=D}return{properties:_,required:V}};re(c,()=>{f()},{deep:!0}),f();const x=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>')),C={props:a,modelValue:e,properties:c,propertyListRef:d,showSchema:r,initializeProperties:n,convertAnyOfToProperties:p,convertSchemaToProperty:v,convertSchemaToProperties:g,updateSchema:f,convertPropertyToSchema:h,convertPropertiesToSchema:w,highlightedSchema:x,addProperty:async()=>{if(c.value.length===0){const y={id:crypto.randomUUID(),name:"property1",type:"string",description:""};c.value.push(y),await pe();const _=document.querySelector(`[data-property-id="${y.id}"] input[placeholder="Property name"]`);_&&(_.focus(),_.select())}else d.value&&d.value.addProperty()},PropertyList:vp};return Object.defineProperty(C,"__isScriptSetup",{enumerable:!1,value:!0}),C}}),yp={class:"space-y-4"},xp={key:0,class:"flex items-center justify-between"},kp={class:"text-sm font-medium"},_p={key:0,class:"text-red-500"},wp={class:"space-y-2 border border-gray-200 dark:border-neutral-800 rounded-lg p-4"},Cp={key:0,class:"flex items-center justify-between mb-2"},Sp={key:1,class:"text-center py-12"},Tp=["disabled"],Mp={class:"mt-4 text-center"},Vp={key:3,class:"mt-4"},Ip={class:"bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-neutral-800 rounded-lg p-4 overflow-x-auto"},Ap={class:"text-xs leading-relaxed"},Pp=["innerHTML"];function Ep(u,t,a,e,c,d){return s(),l("div",yp,[a.label?(s(),l("div",xp,[o("label",kp,[ie(b(a.label)+" ",1),a.required?(s(),l("span",_p,"*")):i("v-if",!0)])])):i("v-if",!0),o("div",wp,[e.properties.length>0?(s(),l("div",Cp,[...t[2]||(t[2]=[o("h3",{class:"text-sm font-medium text-gray-700 dark:text-gray-300"}," Properties ",-1)])])):i("v-if",!0),e.properties.length===0?(s(),l("div",Sp,[t[4]||(t[4]=o("div",{class:"mb-4"},[o("svg",{class:"w-12 h-12 mx-auto text-gray-400 dark:text-gray-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-gray-500 dark:text-gray-400 text-sm mb-4"}," No properties defined ",-1)),o("button",{onClick:e.addProperty,type:"button",disabled:a.disabled,class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black rounded hover:bg-gray-800 dark:hover:bg-gray-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"})]),ie(" Add Property ")],-1)])],8,Tp)])):i("v-if",!0),e.properties.length>0?(s(),Z(e.PropertyList,{key:2,ref:"propertyListRef",modelValue:e.properties,"onUpdate:modelValue":t[0]||(t[0]=r=>e.properties=r),disabled:a.disabled,onAddProperty:e.addProperty},null,8,["modelValue","disabled"])):i("v-if",!0),i(" Show JSON Schema link "),o("div",Mp,[o("button",{onClick:t[1]||(t[1]=r=>e.showSchema=!e.showSchema),type:"button",class:"text-xs text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 hover:underline transition-colors"},b(e.showSchema?"Hide":"Show")+" JSON Schema ",1)]),i(" JSON Schema Display "),e.showSchema?(s(),l("div",Vp,[o("div",Ip,[o("pre",Ap,[o("code",{class:"font-mono",innerHTML:e.highlightedSchema},null,8,Pp)])])])):i("v-if",!0)])])}const jt=Y(bp,[["render",Ep],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/JSONSchemaInput.vue"]]),Lp=ee({__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(u,{expose:t,emit:a}){t();const e=u,c=a,d=m(),r=m(),n=uo({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}),p=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),v=L=>L.type==="string"?"":`@${L.type==="variable"?L.label||L.value:L.label||L.id}`,g=()=>{const L=window.getSelection();if(!L||!L.rangeCount||!d.value)return null;const I=L.getRangeAt(0);let T=0;const q=Array.from(d.value.childNodes);for(let M=0;M<q.length;M++){const O=q[M];if(O===I.startContainer||O.contains?.(I.startContainer)){if(O.nodeType===Node.TEXT_NODE)return{segmentIndex:T,offset:I.startOffset};if(O.nodeType===Node.ELEMENT_NODE&&O.classList?.contains("prompt-tag"))return{segmentIndex:T,offset:0}}(O.nodeType===Node.TEXT_NODE||O.nodeType===Node.ELEMENT_NODE&&O.classList?.contains("prompt-tag"))&&T++}return{segmentIndex:0,offset:0}},f=L=>{if(!d.value)return;const I=window.getSelection();if(!I)return;const T=Array.from(d.value.childNodes);let q=0,M=null,O=0;for(const A of T){if(q===L.segmentIndex){if(A.nodeType===Node.TEXT_NODE)M=A,O=Math.min(L.offset,A.textContent?.length||0);else if(A.nodeType===Node.ELEMENT_NODE&&A.classList?.contains("prompt-tag")){const B=A.nextSibling;if(B&&B.nodeType===Node.TEXT_NODE)M=B,O=0;else{const te=document.createTextNode("");A.parentNode?.insertBefore(te,A.nextSibling),M=te,O=0}}break}(A.nodeType===Node.TEXT_NODE||A.nodeType===Node.ELEMENT_NODE&&A.classList?.contains("prompt-tag"))&&q++}if(!M&&T.length){const A=T[T.length-1];if(A.nodeType===Node.TEXT_NODE)M=A,O=A.textContent?.length||0;else if(A.nodeType===Node.ELEMENT_NODE&&A.classList?.contains("prompt-tag")){const B=document.createTextNode("");A.parentNode?.insertBefore(B,A.nextSibling),M=B,O=0}}if(M){const A=document.createRange();A.setStart(M,O),A.collapse(!0),I.removeAllRanges(),I.addRange(A)}},h=()=>{if(!d.value)return;const L=n.segments.map(I=>{if(I.type==="string")return(I.value||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>")||"";{const T=I._uid||(I._uid=p()),q=v(I),M=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},O=encodeURIComponent(JSON.stringify(M)),A=I.type==="prompt"&&I.meta&&!I.meta.isValid,B=A?'<span class="prompt-tag-warning" title="'+(I.meta.validationMessage||"").replace(/"/g,""")+'">⚠️</span>':"";return`<span class="prompt-tag prompt-tag-clickable${A?" prompt-tag-invalid":""}" contenteditable="false" data-segment-uid="${T}" data-segment="${O}">${q}${B}</span>`}}).join("");d.value.innerHTML=L||"<br>"},w=()=>{const L=[];for(const I of n.segments)I.type==="string"&&L.length>0&&L[L.length-1].type==="string"?L[L.length-1].value+=I.value:L.push(I);n.segments=L.length?L:[{type:"string",value:""}]},x=L=>{const I=L.dataset.segmentUid;let T=n.segments.find(q=>q._uid===I);if(!T){const q=L.dataset.segment;if(q)try{const M=JSON.parse(decodeURIComponent(q));M&&(M.type==="variable"||M.type==="prompt")&&(T=M.type==="variable"?{type:"variable",value:M.value,label:M.label,schema:M.schema,meta:M.meta,_uid:I}:{type:"prompt",id:M.id,label:M.label,schema:M.schema,meta:M.meta,_uid:I})}catch{}}return T||null},k=L=>{const I=L.target;if(I.classList?.contains("prompt-tag")){const T=x(I);T&&c("segment-click",T,L)}},C=L=>{if(n.isComposing)return;const I=L.target,T=[];let q="";const M=()=>{q.length>0&&(T.push({type:"string",value:q}),q="")},O=le=>{if(le.nodeType===Node.TEXT_NODE){const ae=(le.textContent||"").replace(/\u00A0/g," ");q+=ae;return}if(le.nodeType===Node.ELEMENT_NODE){const ae=le;if(ae.classList?.contains("prompt-tag")){M();const me=x(ae);me&&T.push(me);return}if(ae.tagName==="BR"){q+=`
|
|
9
|
-
`;return}const
|
|
10
|
-
`);return}},
|
|
11
|
-
`)}];
|
|
12
|
-
`)||te.length>n.searchQuery.length+5?V():(n.searchQuery=te,j(te))}else V()}else V()},_=async()=>{n.dialogOpen=!0,n.selectedIndex=0,await pe(),U()},V=()=>{n.dialogOpen=!1,n.searchResults=[],n.searchQuery="",n.atTriggerIndex=-1,n.isSearching=!1},U=()=>{if(!r.value||!d.value)return;const L=window.getSelection();if(!L||!L.rangeCount)return;const T=L.getRangeAt(0).getBoundingClientRect(),q=d.value.getBoundingClientRect();n.dialogPosition={x:T.left-q.left,y:T.bottom-q.top+4}};let D=null;const j=async L=>{if(!e.search){n.searchResults=[];return}D&&clearTimeout(D),n.isSearching=!0,D=setTimeout(async()=>{try{const I=await e.search(L);n.searchResults=(I||[]).filter(T=>e.allowedTypes?.includes(T.type))}catch(I){console.error("Search error:",I),n.searchResults=[]}finally{n.isSearching=!1}},200)},F=L=>L.type==="variable"?{type:"variable",value:L.value??L.id??"",label:L.label,schema:L.schema,_uid:p(),meta:L.meta}:{type:"prompt",id:L.id??L.value??"",label:L.label,schema:L.schema,_uid:p(),meta:L.meta},K=L=>{if(n.atTriggerIndex<0||!d.value)return;const I=window.getSelection();if(!I||!I.rangeCount)return;const T=I.getRangeAt(0);if(T.startContainer.nodeType!==Node.TEXT_NODE)return;const q=T.startContainer,M=q.data.slice(0,n.atTriggerIndex),O=q.data.slice(T.startOffset),A=document.createElement("span"),B=F(L),te=B.type==="prompt"&&B.meta&&!B.meta.isValid;A.className=`prompt-tag${te?" prompt-tag-invalid":""}`,A.setAttribute("contenteditable","false");const le=B._uid||(B._uid=p());A.dataset.segmentUid=le;const ae=B.type==="variable"?{type:"variable",value:B.value,label:B.label,schema:B.schema}:{type:"prompt",id:B.id,label:B.label,schema:B.schema};if(A.dataset.segment=encodeURIComponent(JSON.stringify(ae)),A.textContent=v(B),te){const be=document.createElement("span");be.className="prompt-tag-warning",be.textContent="⚠️",be.setAttribute("title",B.meta.validationMessage||"Validation error"),A.appendChild(be)}const ue=q.parentNode,me=document.createTextNode(O),we=document.createTextNode(M);ue.insertBefore(we,q),ue.insertBefore(A,q),ue.insertBefore(me,q),ue.removeChild(q),V(),C({target:d.value});const ke=window.getSelection();if(ke){const be=document.createRange();be.setStart(me,0),be.collapse(!0),ke.removeAllRanges(),ke.addRange(be)}d.value.focus()},E=L=>{if((L.key==="ArrowLeft"||L.key==="ArrowRight")&&setTimeout(()=>y(),0),n.dialogOpen)L.key==="ArrowDown"?(L.preventDefault(),n.selectedIndex=Math.min(n.selectedIndex+1,n.searchResults.length-1)):L.key==="ArrowUp"?(L.preventDefault(),n.selectedIndex=Math.max(n.selectedIndex-1,0)):L.key==="Enter"?(L.preventDefault(),n.searchResults[n.selectedIndex]&&K(n.searchResults[n.selectedIndex])):(L.key==="Escape"||L.key==="Esc")&&(L.preventDefault(),V());else if(L.key==="Backspace"||L.key==="Delete"){const I=g();if(L.key==="Backspace"){const T=window.getSelection();if(T&&T.rangeCount){const q=T.getRangeAt(0);if(q.collapsed&&q.startContainer.nodeType===Node.TEXT_NODE&&q.startOffset===0){let M=q.startContainer;for(;M&&M!==d.value;){const O=M.previousSibling;if(O&&O.nodeType===Node.ELEMENT_NODE&&O.classList?.contains("prompt-tag")){L.preventDefault(),O.parentNode?.removeChild(O),C({target:d.value});return}M=M.parentNode}}}}if(!I)return;if(L.key==="Backspace"&&I.offset===0&&I.segmentIndex>0)n.segments[I.segmentIndex-1].type!=="string"&&(L.preventDefault(),n.segments.splice(I.segmentIndex-1,1),w(),R(),h());else if(L.key==="Delete"&&I.segmentIndex<n.segments.length-1){const T=n.segments[I.segmentIndex];T.type==="string"&&(T.value?.length??0)===I.offset&&n.segments[I.segmentIndex+1].type!=="string"&&(L.preventDefault(),n.segments.splice(I.segmentIndex+1,1),w(),R(),h())}}},P=L=>{L.preventDefault();const I=L.clipboardData?.getData("text/plain")||"";document.execCommand("insertText",!1,I)},H=L=>{if(!n.dialogOpen)return;const I=r.value;I&&(I.contains(L.target)||V())},R=()=>{n.ignoreNextWatch=!0;const L=n.segments.map(I=>{const{_uid:T,...q}=I||{};return q});c("update:modelValue",L)},N=()=>{const L=window.getSelection();if(!L||!d.value)return;const I=L.anchorNode;I&&d.value.contains(I)&&y()},X=L=>{(L.key==="Escape"||L.key==="Esc")&&n.dialogOpen&&(L.preventDefault(),V())};ce(()=>{e.modelValue&&e.modelValue.length&&(n.segments=JSON.parse(JSON.stringify(e.modelValue))),h(),document.addEventListener("mousedown",H),document.addEventListener("selectionchange",N),document.addEventListener("keydown",X,!0)}),Te(()=>{document.removeEventListener("mousedown",H),document.removeEventListener("selectionchange",N),document.removeEventListener("keydown",X,!0)}),re(()=>e.modelValue,L=>{if(n.ignoreNextWatch){n.ignoreNextWatch=!1;return}L&&(n.segments=JSON.parse(JSON.stringify(L)),h())},{deep:!0});const Q={props:e,emit:c,editorRef:d,dialogRef:r,state:n,createUid:p,segmentDisplay:v,getLogicalCursorPosition:g,setLogicalCursorPosition:f,renderContent:h,mergeAdjacentTextSegments:w,readTagSegment:x,handleSegmentClick:k,handleInput:C,checkForAtTrigger:y,openDialog:_,closeDialog:V,positionDialog:U,get searchTimeout(){return D},set searchTimeout(L){D=L},performSearch:j,toSegmentFromResult:F,selectResult:K,handleKeyDown:E,handlePaste:P,onDocumentMouseDown:H,emitUpdate:R,onSelectionChange:N,onDocKeyDown:X,DropShadow:ze};return Object.defineProperty(Q,"__isScriptSetup",{enumerable:!1,value:!0}),Q}}),Op={class:"prompt-input-container relative"},jp=["contenteditable","data-placeholder"],Dp={class:"bg-white dark:bg-black border-2 border-black dark:border-neutral-300 rounded-lg overflow-hidden min-w-[240px] max-w-[320px]"},Up={key:0,class:"p-3 text-sm text-gray-500"},qp={key:1,class:"p-3 text-sm text-gray-500"},Np={key:2,class:"max-h-[220px] overflow-y-auto"},Bp=["onClick"],Rp={class:"font-medium flex items-center gap-2"},Fp=["title"],zp={key:0,class:"text-xs text-gray-500 dark:text-gray-400 mt-0.5"},Hp={key:1,class:"text-xs text-red-600 dark:text-red-400 mt-1"},Wp={class:"text-xs mt-1"};function Jp(u,t,a,e,c,d){return s(),l("div",Op,[o("div",{ref:"editorRef","data-testid":"prompt-editor",contenteditable:!a.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:G(["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",a.disabled?"opacity-50 cursor-not-allowed":""]),"data-placeholder":a.placeholder},[i(" Slot for custom segment rendering - hidden but provides slot content "),fe(o("div",null,[De(u.$slots,"segment",{segment:null},void 0,!0)],512),[[Re,!1]])],42,jp),i(" Mention Dialog "),e.state.dialogOpen?(s(),l("div",{key:0,ref:"dialogRef","data-testid":"mention-dialog",class:"absolute z-50",style:nt({left:`${e.state.dialogPosition.x}px`,top:`${e.state.dialogPosition.y}px`})},[S(e.DropShadow,{"offset-x":2,"offset-y":2,intensity:.3},{default:oe(()=>[o("div",Dp,[e.state.isSearching?(s(),l("div",Up,"Searching...")):e.state.searchResults.length===0?(s(),l("div",qp,"No results found")):(s(),l("div",Np,[(s(!0),l(W,null,ne(e.state.searchResults,(r,n)=>(s(),l("button",{key:r.id||r.value||n,type:"button",onClick:p=>e.selectResult(r),class:G(["w-full px-3 py-2 text-left text-sm","hover:bg-gray-100 dark:hover:bg-gray-900","focus:bg-gray-100 dark:focus:bg-gray-900 focus:outline-none",e.state.selectedIndex===n?"bg-gray-100 dark:bg-gray-900":""])},[o("div",Rp,[ie(b(r.label||r.id||r.value)+" ",1),r.type==="prompt"&&r.meta&&!r.meta.isValid?(s(),l("span",{key:0,title:r.meta.validationMessage,class:"text-red-500"},"⚠️",8,Fp)):i("v-if",!0)]),r.description?(s(),l("div",zp,b(r.description),1)):i("v-if",!0),r.type==="prompt"&&r.meta&&!r.meta.isValid?(s(),l("div",Hp,b(r.meta.validationMessage),1)):i("v-if",!0),o("div",Wp,[o("span",{class:G(["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"])},b(r.type),3)])],10,Bp))),128))]))])]),_:1})],4)):i("v-if",!0)])}const Dt=Y(Lp,[["render",Jp],["__scopeId","data-v-5b9dcb11"],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/PromptInput.vue"]]);function kt(u,t){if(!t||!t.properties||Object.keys(t.properties).length===0)return!0;if(!u||!u.properties)return Object.keys(t.properties);const a=[],e=u.properties||{},c=t.properties||{};return(t.required||[]).forEach(r=>{r in e||a.push(r)}),Object.keys(c).forEach(r=>{!(r in e)&&!a.includes(r)&&a.push(r)}),a.length>0?a:!0}function _t(u){return u.length===0?"":u.length===1?`Missing required field: ${u[0]}`:`Missing required fields: ${u.join(", ")}`}const Kp=ee({__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(u,{expose:t,emit:a}){t();const e=u,c=a,d=m([]),r=m(!1),n=x=>x.type==="text"?{type:"string",value:x.content||""}:x.type==="include"?{type:"prompt",id:x.prompt||"",label:x.prompt||""}:x.type==="string"?{type:"string",value:x.value||""}:x.type==="prompt"?{type:"prompt",id:x.id||"",label:x.label||x.id||""}:x.type==="variable"?{type:"variable",value:x.value||"",label:x.label||x.value||""}:{type:"string",value:""},p=z(()=>{if(!e.promptText)return[{type:"string",value:""}];let x=[];try{const C=JSON.parse(e.promptText);Array.isArray(C)?x=C.map(n):x=[{type:"string",value:e.promptText}]}catch{x=[{type:"string",value:e.promptText}]}const k=e.requiredSchema?JSON.parse(e.requiredSchema):{};return x.map(C=>{if(C.type==="prompt"&&C.schema){const y=kt(k,C.schema),_=y===!0,V=_?[]:y;return{...C,meta:{isValid:_,missingFields:V,validationMessage:_?"":_t(V)}}}return C})}),v=z(()=>{try{const x=JSON.parse(e.requiredSchema);if(x.properties&&typeof x.properties=="object")return Object.keys(x.properties)}catch{return[]}return[]}),g=async x=>{r.value=!0;try{const k=new URLSearchParams;x&&k.set("search",x);const C=await fetch(J(`/api/prompts${k.toString()?"?"+k.toString():""}`));if(C.ok){const y=await C.json();d.value=y.prompts||[]}}catch(k){console.error("Error fetching prompts:",k)}finally{r.value=!1}},f=async x=>{const k=[];return v.value.forEach(C=>{(!x||C.toLowerCase().includes(x.toLowerCase()))&&k.push({type:"variable",value:C,label:C,description:"Schema property"})}),x!==void 0&&await g(x),d.value.forEach(C=>{if(!(e.currentPromptName&&C.name===e.currentPromptName)&&(!x||C.name.toLowerCase().includes(x.toLowerCase()))){const y=e.requiredSchema?JSON.parse(e.requiredSchema):{},_=kt(y,C.required_schema),V=_===!0,U=V?[]:_;k.push({type:"prompt",id:C.name,label:C.name,description:C.tool_description||"Available prompt",schema:C.required_schema,meta:{isValid:V,missingFields:U,validationMessage:V?"":_t(U)}})}}),k},h=x=>{const k=x.map(C=>{const{type:y,value:_,label:V,id:U,schema:D}=C;return y==="string"?{type:y,value:_||""}:y==="variable"?{type:y,value:_||"",label:V}:y==="prompt"?{type:y,id:U||"",label:V,schema:D}:C});c("update:promptText",JSON.stringify(k))};ce(()=>{g()});const w={props:e,emit:c,availablePrompts:d,loadingPrompts:r,normalizeSegment:n,promptSegments:p,schemaProperties:v,fetchPrompts:g,searchReferences:f,handleSegmentsUpdate:h,PromptInput:Dt};return Object.defineProperty(w,"__isScriptSetup",{enumerable:!1,value:!0}),w}}),Zp={class:"space-y-4"};function Gp(u,t,a,e,c,d){return s(),l("div",Zp,[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-gray-600 dark:text-gray-400 mb-2"}," Type @ to insert schema properties or other prompts ",-1)),S(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 Xp=Y(Kp,[["render",Gp],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/prompt-form/PromptTemplate.vue"]]),Qp=ee({__name:"PromptToolOptions",props:{toolName:{type:String,required:!0},toolConfig:{type:Object,required:!0},disabled:{type:Boolean,required:!1}},emits:["update:option"],setup(u,{expose:t,emit:a}){t();const e=u,c=a,d=m(null),r=m(!0),n=z(()=>d.value?.properties?Object.entries(d.value.properties).map(([f,h])=>({value:f,label:f,description:h.description||h.type||""})):[]),p=async()=>{try{const f=await fetch(J(`/api/prompts/${encodeURIComponent(e.toolName)}`));if(f.ok){const h=await f.json();h?.prompt?.required_schema&&(d.value=h.prompt.required_schema)}}catch(f){console.error("Error fetching prompt schema:",f)}finally{r.value=!1}};ce(()=>{p()});const g={props:e,emit:c,schema:d,loading:r,propertyOptions:n,fetchSchema:p,updateOption:(f,h)=>{c("update:option",f,h)},SelectInput:xe,CheckboxInput:Qe};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}}),Yp={class:"space-y-3"},$p={class:"space-y-2 pl-4 border-l-2 border-blue-200 dark:border-blue-700"},em={class:"space-y-1"},tm={class:"space-y-2 pl-4 border-l-2 border-gray-200 dark:border-neutral-700"};function om(u,t,a,e,c,d){return s(),l("div",Yp,[i(" Initialization Options "),o("div",$p,[t[6]||(t[6]=o("p",{class:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-2"}," Initialization Options: ",-1)),o("div",em,[t[4]||(t[4]=o("label",{class:"block text-xs font-medium text-gray-700 dark:text-gray-300"}," User message property ",-1)),S(e.SelectInput,{"model-value":a.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:a.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-gray-500 dark:text-gray-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))])]),i(" Response Options "),o("div",tm,[t[7]||(t[7]=o("p",{class:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-2"}," Sub-Prompt Response Options: ",-1)),S(e.CheckboxInput,{"model-value":a.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:a.disabled},null,8,["model-value","disabled"]),S(e.CheckboxInput,{"model-value":a.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:a.disabled},null,8,["model-value","disabled"]),S(e.CheckboxInput,{"model-value":a.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:a.disabled},null,8,["model-value","disabled"])])])}const rm=Y(Qp,[["render",om],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/PromptToolOptions.vue"]]);async function Ve(u,t={}){const a=localStorage.getItem("auth_token"),e={"Content-Type":"application/json",...t.headers};a&&(e.Authorization=`Bearer ${a}`);const c=u.startsWith("/")?u:`/${u}`,d=await fetch(J(`/api${c}`),{...t,headers:e});if(d.status===401)throw localStorage.removeItem("auth_token"),window.location.href=J("/login"),new Error("Unauthorized");return d}const am=ee({__name:"ToolSelectorWithOptions",props:Se({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(u,{expose:t}){t();const a=u,e=Ee(u,"modelValue"),c=m([]),d=m(!1),r=m();It(async()=>{r.value,await pe(),r.value&&e.value.length>0&&await At({parent:r,values:e,dragHandle:".drag-handle"})});const n=z(()=>{const x=new Set(e.value.map(k=>k.name));return c.value.filter(k=>!x.has(k.name)).map(k=>{let C=k.name;return k.type==="prompt"?C=`${k.name} (prompt)`:k.type==="mcp"&&(C=`${k.name} (mcp)`),{value:k.name,label:C,description:k.description}})}),p=async()=>{d.value=!0;try{const x=await Ve("/tools");if(x.ok){const k=await x.json();c.value=Object.entries(k).map(([C,y])=>({name:C,description:y.description||"",type:y.type,model:y.model}))}}catch(x){console.error("Error fetching tools:",x)}finally{d.value=!1}},v=x=>{x&&(e.value.find(k=>k.name===x)||(e.value=[...e.value,{name:x,include_text_response:!0,include_tool_calls:!0,include_errors:!0,init_user_message_property:null}]))},g=x=>{e.value=e.value.filter(k=>k.name!==x)},f=x=>c.value.find(k=>k.name===x),h=(x,k,C)=>{e.value=e.value.map(y=>y.name===x?{...y,[k]:C}:y)};ce(()=>{p()});const w={props:a,modelValue:e,tools:c,loadingTools:d,dragAreaRef:r,toolOptions:n,fetchTools:p,handleSelect:v,removeTool:g,getToolInfo:f,updateToolOption:h,SelectInput:xe,PromptToolOptions:rm};return Object.defineProperty(w,"__isScriptSetup",{enumerable:!1,value:!0}),w}}),sm={class:"space-y-4"},lm={class:"block text-sm font-medium mb-2"},nm={key:0,class:"text-red-500"},im={key:0,class:"space-y-3 mb-4",ref:"dragAreaRef"},dm={class:"flex items-start justify-between"},cm={class:"flex items-center gap-2 flex-1"},um={class:"flex-1"},pm={class:"font-medium text-sm"},mm={key:0,class:"text-xs text-gray-600 dark:text-gray-400 mt-1"},gm=["onClick","disabled","aria-label"],fm={key:1,class:"text-xs text-red-500 dark:text-red-400 mt-1"},hm={key:0,class:"text-center py-8 text-sm text-gray-500 dark:text-gray-400 border border-dashed border-gray-300 dark:border-neutral-600 rounded-lg"};function vm(u,t,a,e,c,d){return s(),l("div",sm,[o("div",null,[o("label",lm,[ie(b(a.label)+" ",1),a.required?(s(),l("span",nm,"*")):i("v-if",!0)]),i(" Selected tools list (above dropdown) "),e.modelValue.length>0?(s(),l("div",im,[(s(!0),l(W,null,ne(e.modelValue,r=>(s(),l("div",{key:r.name,class:"border border-gray-300 dark:border-neutral-600 rounded-lg p-4"},[o("div",dm,[o("div",cm,[i(" Drag handle "),t[0]||(t[0]=o("div",{class:"drag-handle cursor-move text-gray-400 hover:text-gray-600 dark:text-gray-600 dark:hover:text-gray-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",um,[o("h4",pm,b(r.name),1),e.getToolInfo(r.name)?.description?(s(),l("p",mm,b(e.getToolInfo(r.name)?.description),1)):i("v-if",!0)])]),o("button",{onClick:n=>e.removeTool(r.name),type:"button",disabled:a.disabled,class:"p-1 hover:bg-gray-200 dark:hover:bg-gray-800 rounded transition-colors text-gray-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,gm)]),i(" Prompt tool options (fetches schema on mount) "),e.getToolInfo(r.name)?.type==="prompt"?(s(),Z(e.PromptToolOptions,{key:0,"tool-name":r.name,"tool-config":r,disabled:a.disabled,"onUpdate:option":(n,p)=>e.updateToolOption(r.name,n,p)},null,8,["tool-name","tool-config","disabled","onUpdate:option"])):i("v-if",!0)]))),128))],512)):i("v-if",!0),i(" Tool selector dropdown "),S(e.SelectInput,{"model-value":"","onUpdate:modelValue":e.handleSelect,placeholder:e.modelValue.length>0?"Add another tool...":a.placeholder,"search-placeholder":"Search tools...",options:e.toolOptions,disabled:a.disabled||e.loadingTools||e.toolOptions.length===0,loading:e.loadingTools},null,8,["placeholder","options","disabled","loading"]),a.error?(s(),l("p",fm,b(a.error),1)):i("v-if",!0)]),i(" Empty state (only when no tools are available at all) "),e.modelValue.length===0&&!e.loadingTools&&e.toolOptions.length===0?(s(),l("div",hm," No tools available. Create tools in your agentbuilder/tools directory. ")):i("v-if",!0)])}const bm=Y(am,[["render",vm],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/ToolSelectorWithOptions.vue"]]),ym=ee({__name:"MultipleSelectionsInput",props:Se({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:Se(["removeItem"],["update:modelValue"]),setup(u,{expose:t,emit:a}){t();const e=u,c=a,d=Ee(u,"modelValue"),r=m();It(async()=>{r.value,await pe(),await At({parent:r,values:d,dragHandle:".drag-handle"})});const n=z(()=>Array.isArray(d.value)?d.value.length>0&&typeof d.value[0]=="object"?d.value:d.value.map(h=>{const w=e.options.find(x=>x.value===h);return{id:h,label:w?.label||h,description:w?.description,icon:w?.icon}}):[]),p=z(()=>{const h=n.value.map(w=>w.id);return e.options.filter(w=>!h.includes(w.value))}),f={props:e,emit:c,modelValue:d,dragAreaRef:r,selectedItems:n,availableOptions:p,handleSelect:h=>{if(!h)return;const w=e.options.find(x=>x.value===h);if(w)if(d.value.length===0||typeof d.value[0]=="string")d.value=[...d.value,h];else{const x={id:h,label:w.label,description:w.description,icon:w.icon};d.value=[...d.value,x]}},removeItem:h=>{typeof d.value[0]=="string"?d.value=d.value.filter(w=>w!==h):d.value=d.value.filter(w=>w.id!==h),c("removeItem",h)},SelectInput:xe};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),xm={class:"space-y-2"},km={key:0,class:"space-y-2"},_m={key:0,class:"block text-sm font-medium"},wm={key:0,class:"text-red-500"},Cm={class:"space-y-1",ref:"dragAreaRef"},Sm=["src","alt"],Tm={class:"flex-1 text-sm"},Mm={key:0,class:"text-xs text-gray-500 dark:text-gray-400 ml-1"},Vm=["onClick","aria-label"],Im={key:1,class:"text-xs text-red-500 dark:text-red-400"};function Am(u,t,a,e,c,d){return s(),l("div",xm,[e.selectedItems.length>0?(s(),l("div",km,[a.label?(s(),l("label",_m,[ie(b(a.label)+" ",1),a.required?(s(),l("span",wm,"*")):i("v-if",!0)])):i("v-if",!0),o("div",Cm,[(s(!0),l(W,null,ne(e.selectedItems,r=>(s(),l("div",{key:r.id,class:G(["flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-900 rounded border","border-gray-200 dark:border-neutral-800",a.disabled?"opacity-50":""])},[i(" Drag handle "),t[1]||(t[1]=o("div",{class:"drag-handle cursor-move text-gray-400 hover:text-gray-600 dark:text-gray-600 dark:hover:text-gray-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)),i(" Icon "),r.icon?(s(),l("img",{key:0,src:r.icon,alt:r.label,class:"w-4 h-4 flex-shrink-0"},null,8,Sm)):i("v-if",!0),i(" Label and description "),o("span",Tm,[ie(b(r.label)+" ",1),r.description?(s(),l("span",Mm," ("+b(r.description)+") ",1)):i("v-if",!0)]),i(" Remove button "),a.disabled?i("v-if",!0):(s(),l("button",{key:1,onClick:n=>e.removeItem(r.id),type:"button",class:"p-1 hover:bg-gray-200 dark:hover:bg-gray-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,Vm))],2))),128))],512)])):i("v-if",!0),i(" Select input for adding new items "),S(e.SelectInput,{"model-value":"","onUpdate:modelValue":e.handleSelect,label:e.selectedItems.length>0?a.addLabel:a.label,options:e.availableOptions,placeholder:a.placeholder,"search-placeholder":a.searchPlaceholder,disabled:a.disabled||e.availableOptions.length===0,loading:a.loading},null,8,["label","options","placeholder","search-placeholder","disabled","loading"]),a.error?(s(),l("p",Im,b(a.error),1)):i("v-if",!0)])}const ut=Y(ym,[["render",Am],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/MultipleSelectionsInput.vue"]]),Pm=ee({__name:"AgentSelectorInput",props:Se({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(u,{expose:t}){t();const a=u,e=Ee(u,"modelValue"),c=m([]),d=m(!1),r=z(()=>c.value.map(g=>({value:g.id,label:g.title,description:g.tool_description||`Handoff to ${g.title} agent`}))),n=async()=>{d.value=!0;try{const g=J(`/api/agents${a.agentType?`?type=${a.agentType}`:""}`),f=await fetch(g);if(f.ok){const h=await f.json();c.value=h.agents||[]}}catch(g){console.error("Error fetching agents:",g)}finally{d.value=!1}},p=g=>{};ce(()=>{n()}),re(()=>a.allowMultiple,()=>{a.allowMultiple&&typeof e.value=="string"?e.value=e.value?[e.value]:[]:!a.allowMultiple&&Array.isArray(e.value)&&(e.value=e.value[0]||"")},{immediate:!0});const v={props:a,modelValue:e,agents:c,loadingAgents:d,agentOptions:r,fetchAgents:n,handleRemoveItem:p,SelectInput:xe,MultipleSelectionsInput:ut};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),Em={key:2,class:"text-xs text-red-500 dark:text-red-400 mt-1"};function Lm(u,t,a,e,c,d){return s(),l(W,null,[a.allowMultiple?(s(),Z(e.MultipleSelectionsInput,{key:0,modelValue:e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=r=>e.modelValue=r),label:a.label,placeholder:a.placeholder,"search-placeholder":"Search agents...",error:a.error,required:a.required,disabled:a.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"])):(s(),Z(e.SelectInput,{key:1,modelValue:e.modelValue,"onUpdate:modelValue":t[1]||(t[1]=r=>e.modelValue=r),label:a.label,placeholder:a.placeholder,"search-placeholder":"Search agents...",options:e.agentOptions,disabled:a.disabled,loading:e.loadingAgents},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!a.allowMultiple&&a.error?(s(),l("p",Em,b(a.error),1)):i("v-if",!0)],64)}const Om=Y(Pm,[["render",Lm],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/AgentSelectorInput.vue"]]),jm=ee({__name:"PromptModal",props:{modelValue:{type:Boolean,required:!0},editPrompt:{type:null,required:!1},mode:{type:String,required:!1}},emits:["update:modelValue","save"],setup(u,{expose:t,emit:a}){t();const e=u,c=a,d=z(()=>e.mode==="edit"),r=m(!1),n=z(()=>_.value.length===1),p=m(""),v=m(""),g=m(""),f=m(""),h=m({type:"object",properties:{},required:[],additionalProperties:!1}),w=m(""),x=m(!1),k=m(!1),C=m(""),y=m(""),_=m([]),V=m([]),U=m(!1),D=m("auto"),j=m(null),F=m(null),K=m(!1),E=m(!1),P=z({get:()=>j.value||"",set:I=>j.value=I||null}),H=z({get:()=>D.value,set:I=>D.value=I}),R=()=>{v.value="",p.value="",g.value="",f.value="",h.value={type:"object",properties:{},required:[],additionalProperties:!1},w.value="",x.value=!1,k.value=!1,C.value="",y.value="",_.value=[],V.value=[],U.value=!1,D.value="auto",j.value=null,F.value=null,K.value=!1,E.value=!1},N=async()=>{if(e.editPrompt?.id){r.value=!0;try{const I=await Ve(`/prompts/${e.editPrompt.id}`);if(I.ok){const T=await I.json(),q=T.prompt||T;v.value=q.name||"",p.value=q.name||"",g.value=q.tool_description||"",f.value=q.model_id||"";let M=q.required_schema;if(typeof M=="string")try{M=JSON.parse(M)}catch{M=null}h.value=M||{type:"object",properties:{},required:[],additionalProperties:!1},w.value=q.prompt||"",x.value=q.include_chat||!1,k.value=q.include_past_tools||!1,C.value=q.before_tool||"",y.value=q.after_tool||"";const O=q.tools||[];_.value=O.map(B=>typeof B=="string"?{name:B,include_text_response:!0,include_tool_calls:!0,include_errors:!0,init_user_message_property:null}:B),V.value=q.prompts||q.handoff_agents||[],U.value=q.parallel_tool_calls||!1,D.value=q.tool_choice||"auto";const A=q.reasoning||{};j.value=A.effort||q.reasoning_effort||null,F.value=A.maxTokens||q.reasoning_max_tokens||null,K.value=A.exclude||q.reasoning_exclude||!1,E.value=q.include_reasoning||!1}}catch(I){console.error("Error loading prompt data:",I)}finally{r.value=!1}}},X=async()=>{const I=/^[a-z][a-z0-9_]*$/;if(!v.value||!I.test(v.value)){alert("Please enter a valid name (lowercase letters, numbers, and underscores only, must start with a letter)");return}if(!g.value){alert("Please enter a description");return}if(!f.value){alert("Please select a model");return}if(!w.value){alert("Please enter the prompt template");return}const T={name:v.value,tool_description:g.value,prompt:w.value,required_schema:h.value,model_id:f.value,include_chat:x.value,include_past_tools:k.value,before_tool:C.value||null,after_tool:y.value||null,parallel_tool_calls:U.value,tool_choice:D.value,tools:_.value,handoff_agents:V.value,reasoning_effort:j.value,reasoning_max_tokens:F.value,reasoning_exclude:K.value,include_reasoning:E.value};d.value&&e.editPrompt?.id&&(T.id=e.editPrompt.id,p.value&&p.value!==v.value&&(T.originalName=p.value)),c("save",T),R(),c("update:modelValue",!1)},Q=()=>{R(),c("update:modelValue",!1)};re(()=>_.value.length,I=>{D.value==="function"&&I!==1&&(D.value="auto")}),re(()=>e.modelValue,async I=>{I&&(d.value?(R(),await pe(),await N()):R())}),re(()=>e.editPrompt,async I=>{I&&d.value&&e.modelValue&&(await pe(),await N())},{immediate:!0});const L={props:e,emit:c,isEditMode:d,isLoading:r,isFunctionChoiceAvailable:n,originalName:p,name:v,toolDescription:g,selectedModel:f,requiredSchema:h,promptText:w,includeChat:x,includePastTools:k,beforeTool:C,afterTool:y,selectedTools:_,handoffAgents:V,parallelToolCalls:U,toolChoice:D,reasoningEffort:j,reasoningMaxTokens:F,reasoningExclude:K,includeReasoning:E,reasoningEffortValue:P,toolChoiceValue:H,resetForm:R,loadPromptData:N,handleSubmit:X,handleCancel:Q,Modal:Ie,PromptBasicInfo:y2,PromptModelSelect:N2,JSONSchemaInput:jt,PromptTemplate:Xp,CheckboxInput:Qe,ToolSelectorWithOptions:bm,AgentSelectorInput:Om,SelectInput:xe};return Object.defineProperty(L,"__isScriptSetup",{enumerable:!1,value:!0}),L}}),Dm={key:0,class:"min-h-[400px] flex items-center justify-center"},Um={class:"space-y-6 pr-2 pb-4"},qm={class:"space-y-4"},Nm={class:"space-y-4"},Bm={class:"flex justify-between"},Rm={class:"flex gap-2"},Fm=["disabled"];function zm(u,t,a,e,c,d){return s(),Z(e.Modal,{"model-value":a.modelValue,"onUpdate:modelValue":t[17]||(t[17]=r=>u.$emit("update:modelValue",r)),title:e.isEditMode?"Edit Prompt":"Add Prompt",width:"max-w-4xl"},{footer:oe(()=>[o("div",Bm,[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",Rm,[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},b(e.isEditMode?"Update Prompt":"Create Prompt"),9,Fm)])])]),default:oe(()=>[e.isLoading?(s(),l("div",Dm,[...t[18]||(t[18]=[o("span",{class:"text-gray-500"},"Loading prompt data...",-1)])])):(s(),l(W,{key:1},[i(" Single long form for both edit and add modes "),o("div",Um,[o("div",null,[S(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,[S(e.PromptModelSelect,{modelValue:e.selectedModel,"onUpdate:modelValue":t[2]||(t[2]=r=>e.selectedModel=r)},null,8,["modelValue"])]),o("div",null,[S(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,[S(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,[S(e.ToolSelectorWithOptions,{modelValue:e.selectedTools,"onUpdate:modelValue":t[7]||(t[7]=r=>e.selectedTools=r)},null,8,["modelValue"])]),o("div",qm,[t[20]||(t[20]=o("h3",{class:"text-sm font-medium text-gray-900 dark:text-gray-100"}," Tool Configuration ",-1)),i(" Parallel Tool Calls "),o("div",null,[S(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"])]),i(" Tool Choice "),o("div",null,[S(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-gray-500 dark:text-gray-400"}," Controls whether and how the model can call tools ",-1))])]),o("div",null,[S(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-gray-500 dark:text-gray-400"}," AI + Human agents that this prompt can hand off conversations to. These will be exposed as tools. ",-1))]),i(" Reasoning Tokens Configuration "),o("div",Nm,[t[25]||(t[25]=o("h3",{class:"text-sm font-medium text-gray-900 dark:text-gray-100"}," Context & Reasoning Configuration ",-1)),i(" Include Chat History "),o("div",null,[S(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"])]),i(" Include Past Tool Calls "),o("div",null,[S(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"])]),i(" Include Reasoning in Message History "),o("div",null,[S(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-gray-300 dark:border-neutral-600"},null,-1)),t[27]||(t[27]=o("p",{class:"text-xs text-gray-500 dark:text-gray-400"}," Configure extended reasoning for models like o1, o3, Gemini Thinking, and others. Reasoning is enabled automatically when either field is set. ",-1)),i(" Reasoning Effort "),o("div",null,[S(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-gray-500 dark:text-gray-400"}," Controls reasoning capacity allocation. Supported by OpenAI o-series and Grok models. ",-1))]),i(" Max Reasoning Tokens "),o("div",null,[t[23]||(t[23]=o("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"}," Max Reasoning Tokens ",-1)),fe(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-gray-300 dark:border-neutral-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent"},null,512),[[_e,e.reasoningMaxTokens,void 0,{number:!0}]]),t[24]||(t[24]=o("p",{class:"mt-1 text-xs text-gray-500 dark:text-gray-400"}," Directly specify reasoning token limit (1024-32000). Supported by Anthropic, Gemini Thinking, and some Qwen models. ",-1))]),i(" Exclude Reasoning from Response "),o("div",null,[S(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 Ut=Y(jm,[["render",zm],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/PromptModal.vue"]]),Hm=ee({__name:"PromptsView",setup(u,{expose:t}){t();const a=Ue(),e=Pe(),c=m(!1),d=m(null);re(()=>e.query.refresh,()=>{e.query.refresh&&(d.value?.refresh(),a.replace({path:"/prompts",query:{}}))});const v={router:a,route:e,showModal:c,dataTableRef:d,handleAdd:()=>{c.value=!0},handleEdit:g=>{a.push(`/prompts/${g.id}`)},handleSave:async g=>{try{const f=await fetch(J("/api/prompts"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)});if(f.ok)c.value=!1,await new Promise(h=>setTimeout(h,100)),await d.value?.refresh();else{const h=await f.json();alert(h.error||"Failed to create prompt")}}catch(f){console.error("Error creating prompt:",f),alert("Failed to create prompt")}},PromptsDataTable:u2,PromptModal:Ut,CenteredContentView:je};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}});function Wm(u,t,a,e,c,d){return s(),Z(e.CenteredContentView,null,{default:oe(()=>[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-gray-600 dark:text-gray-400 mb-6"},"Define and manage prompt templates for your agents.",-1)),S(e.PromptsDataTable,{ref:"dataTableRef",onAdd:e.handleAdd,onEdit:e.handleEdit},null,512),S(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 Jm=Y(Hm,[["render",Wm],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/PromptsView.vue"]]),Km=ee({__name:"PromptEditView",setup(u,{expose:t}){t();const a=Ue(),e=Pe(),c=m(!0),d=m(null),r=m(!0),n=async()=>{const f=e.params.id;if(!f){a.push("/prompts");return}r.value=!0;try{const h=await fetch(J(`/api/prompts/${f}`));if(h.ok){const w=await h.json();d.value=w.prompt||w}else alert("Prompt not found"),a.push("/prompts")}catch(h){console.error("Error loading prompt:",h),alert("Failed to load prompt"),a.push("/prompts")}finally{r.value=!1}},p=async f=>{try{const{originalName:h,...w}=f,x=h||w.id,k=await fetch(J(`/api/prompts/${x}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(k.ok)a.push({path:"/prompts",query:{refresh:Date.now().toString()}});else{const C=await k.json();alert(C.error||"Failed to update prompt")}}catch(h){console.error("Error updating prompt:",h),alert("Failed to update prompt")}},v=f=>{f||a.push("/prompts")};ce(()=>{n()}),re(c,f=>{f||a.push("/prompts")});const g={router:a,route:e,showModal:c,editingPrompt:d,isLoading:r,loadPrompt:n,handleSave:p,handleClose:v,PromptModal:Ut};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}}),Zm={class:"p-8"},Gm={key:0,class:"flex items-center justify-center min-h-[400px]"},Xm={key:2,class:"flex items-center justify-center min-h-[400px]"};function Qm(u,t,a,e,c,d){return s(),l("div",Zm,[e.isLoading?(s(),l("div",Gm,[...t[1]||(t[1]=[o("span",{class:"text-gray-500"},"Loading prompt...",-1)])])):e.editingPrompt?(s(),Z(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"])):(s(),l("div",Xm,[...t[2]||(t[2]=[o("span",{class:"text-gray-500"},"Prompt not found",-1)])]))])}const Ym=Y(Km,[["render",Qm],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/PromptEditView.vue"]]),$m=ee({__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(u,{expose:t,emit:a}){t();function e(w){if(w===0)return"$0.00";const x=Math.abs(w);let k;return x<1e-4?k=x.toExponential(3):x<.001||x<.01||x<.1?k=x.toFixed(4):x<1?k=x.toFixed(3):x<10||x<100?k=x.toFixed(2):x<1e3?k=x.toFixed(1):k=x.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0}),k.includes(".")&&(k=k.replace(/\.?0+$/,""),!k.includes(".")&&x<100&&(k=x.toFixed(2))),w<0?`-$${k}`:`$${k}`}const c=u,d=a,r=w=>c.modelValue.includes(w),n=w=>{const x=[...c.modelValue],k=x.indexOf(w);k>-1?x.splice(k,1):x.push(w),d("update:modelValue",x)},p=()=>{d("update:modelValue",c.providers.map(w=>w.id))},v=()=>{d("update:modelValue",[])},g=z(()=>c.providers.length>0&&c.modelValue.length===c.providers.length),f=z(()=>c.modelValue.length>0&&c.modelValue.length<c.providers.length),h={dollars:e,props:c,emit:d,isSelected:r,toggleProvider:n,selectAll:p,deselectAll:v,allSelected:g,someSelected:f};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}}),e1={class:"border-2 border-black dark:border-neutral-300 rounded-lg overflow-hidden"},t1={key:0,class:"px-4 py-2 border-b-2 border-black dark:border-neutral-300 bg-gray-50 dark:bg-gray-900"},o1={class:"flex items-center justify-between"},r1={class:"text-sm font-medium"},a1={class:"flex items-center gap-2"},s1={key:1,class:"px-4 py-8 flex items-center justify-center"},l1={key:2,class:"px-4 py-8 text-center text-gray-500"},n1={key:3,class:"divide-y divide-gray-200 dark:divide-gray-700"},i1=["onClick"],d1={class:"flex items-start gap-3"},c1={class:"flex-shrink-0 mt-0.5"},u1=["checked","onClick"],p1={class:"flex-1 min-w-0"},m1={class:"flex items-center gap-2"},g1={class:"text-sm font-medium"},f1={key:0,class:"text-xs px-1.5 py-0.5 bg-gray-100 dark:bg-gray-800 rounded"},h1={class:"mt-1 text-xs text-gray-600 dark:text-gray-400 space-y-0.5"},v1={key:0},b1={key:0},y1={key:1},x1={key:2};function k1(u,t,a,e,c,d){return s(),l("div",e1,[a.label?(s(),l("div",t1,[o("div",o1,[o("span",r1,b(a.label),1),o("div",a1,[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-gray-400 dark:border-neutral-600 rounded hover:bg-gray-100 dark:hover:bg-gray-800"},b(e.allSelected?"Deselect All":"Select All"),1)])])])):i("v-if",!0),a.loading?(s(),l("div",s1,[...t[1]||(t[1]=[o("div",{class:"flex items-center gap-2 text-gray-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)])])):a.providers.length===0?(s(),l("div",l1," No providers available ")):(s(),l("div",n1,[(s(!0),l(W,null,ne(a.providers,r=>(s(),l("div",{key:r.id,class:"px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-900 cursor-pointer",onClick:n=>e.toggleProvider(r.id)},[o("div",d1,[o("div",c1,[o("input",{type:"checkbox",checked:e.isSelected(r.id),onClick:he(n=>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,u1)]),o("div",p1,[o("div",m1,[o("span",g1,b(r.name),1),r.quantization?(s(),l("span",f1,b(r.quantization),1)):i("v-if",!0)]),o("div",h1,[o("div",null,b(e.dollars(r.pricing.prompt*1e6))+"/M input • "+b(e.dollars(r.pricing.completion*1e6))+"/M output ",1),r.maxPromptTokens||r.maxCompletionTokens?(s(),l("div",v1,[r.maxPromptTokens?(s(),l("span",b1," Max prompt: "+b(r.maxPromptTokens.toLocaleString())+" tokens ",1)):i("v-if",!0),r.maxPromptTokens&&r.maxCompletionTokens?(s(),l("span",y1," • ")):i("v-if",!0),r.maxCompletionTokens?(s(),l("span",x1," Max completion: "+b(r.maxCompletionTokens.toLocaleString())+" tokens ",1)):i("v-if",!0)])):i("v-if",!0)])])])],8,i1))),128))]))])}const _1=Y($m,[["render",k1],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/ExposedSelectList.vue"]]),w1=ee({__name:"ModelSelectorInput",props:Se({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(u,{expose:t}){t();const a=u,e=Ee(u,"modelValue"),c=m([]),d=m(!1),r=z(()=>c.value.map(g=>({value:g.id,label:g.name,description:g.provider_id||g.provider,icon:ct(g.model||g.name,g.provider_id||g.provider)}))),n=async()=>{d.value=!0;try{const g=await fetch(J("/api/models"));if(g.ok){const f=await g.json();c.value=f.models||[]}}catch(g){console.error("Error fetching models:",g)}finally{d.value=!1}},p=g=>{};ce(()=>{n()}),re(()=>a.allowMultiple,()=>{a.allowMultiple&&typeof e.value=="string"?e.value=e.value?[e.value]:[]:!a.allowMultiple&&Array.isArray(e.value)&&(e.value=e.value[0]||"")});const v={props:a,modelValue:e,models:c,loadingModels:d,modelOptions:r,fetchModels:n,handleRemoveItem:p,SelectInput:xe,MultipleSelectionsInput:ut};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),C1={key:2,class:"text-xs text-red-500 dark:text-red-400 mt-1"};function S1(u,t,a,e,c,d){return s(),l(W,null,[a.allowMultiple?(s(),Z(e.MultipleSelectionsInput,{key:0,modelValue:e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=r=>e.modelValue=r),label:a.label,placeholder:a.placeholder,"search-placeholder":"Search models...",error:a.error,required:a.required,disabled:a.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"])):(s(),Z(e.SelectInput,{key:1,modelValue:e.modelValue,"onUpdate:modelValue":t[1]||(t[1]=r=>e.modelValue=r),label:a.label,placeholder:a.placeholder,"search-placeholder":"Search models...",options:e.modelOptions,disabled:a.disabled,loading:e.loadingModels},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!a.allowMultiple&&a.error?(s(),l("p",C1,b(a.error),1)):i("v-if",!0)],64)}const T1=Y(w1,[["render",S1],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/ModelSelectorInput.vue"]]),M1=ee({__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(u,{expose:t,emit:a}){t();const e=u,c=a,d=m([]),r=m(""),n=m(""),p=m([]),v=m(!1),g=m(!1),f=m([]),h=m([]),w=m(!1),x=m([]),k=z(()=>e.mode==="edit"),C=m(""),y=m(""),_=m(""),V=M=>{let O=M.replace(/[^a-zA-Z0-9\s_-]/g,"");return O=O.trim().toLowerCase().replace(/[\s-]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),O?/^[a-z][a-z0-9_]*$/.test(O)?_.value="":_.value="Name must start with a letter and contain only lowercase letters, numbers, and underscores":_.value="Name is required",O},U=M=>{const O=M.target.value;y.value=V(O)},D=m(!1),j=m(null),F=z(()=>d.value.filter(M=>M.hasApiKey).map(M=>({value:M.name,label:M.name,description:M.sdk==="openai-sdk"?"OpenAI SDK":M.sdk==="openrouter"?"OpenRouter":M.sdk,icon:Ge(M.sdk)}))),K=z(()=>p.value.map(M=>({...M,icon:M.iconId?Ge(M.iconId):void 0}))),E=z(()=>!k.value||!j.value||D.value?!1:y.value!==j.value.name||r.value!==j.value.provider||n.value!==j.value.model||JSON.stringify(h.value.sort())!==JSON.stringify(j.value.endpoints.sort())||JSON.stringify(x.value)!==JSON.stringify(j.value.fallbacks)),P=z(()=>d.value.find(O=>O.name===r.value)?.sdk==="openrouter"),H=async()=>{v.value=!0;try{const M=await fetch(J("/api/providers"));if(M.ok){const O=await M.json();d.value=O.providers||[]}}catch(M){console.error("Error fetching providers:",M)}finally{v.value=!1}},R=async()=>{if(!r.value){p.value=[];return}g.value=!0;try{const M=await fetch(J("/api/models/available"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r.value})});if(M.ok){const O=await M.json();p.value=O.models||[]}else{const O=await M.json();console.error("Error fetching models:",O),p.value=[],alert(O.error||"Failed to fetch available models")}}catch(M){console.error("Error fetching models:",M),p.value=[]}finally{g.value=!1}},N=()=>{y.value="",C.value="",r.value="",n.value="",p.value=[],x.value=[],f.value=[],h.value=[],j.value=null,D.value=!1},X=async()=>{if(e.editModel){D.value=!0;try{await H(),y.value=e.editModel.name||"",C.value=e.editModel.name||"",r.value=e.editModel.provider_id||e.editModel.provider,await R(),n.value=e.editModel.model,await L(),e.editModel.included_providers&&e.editModel.included_providers.length>0&&(h.value=e.editModel.included_providers),await Q(),j.value={name:y.value,provider:r.value,model:n.value,endpoints:[...h.value],fallbacks:[...x.value]}}finally{D.value=!1}}};re(()=>e.modelValue,async M=>{M?k.value&&e.editModel?await X():(await H(),N()):N()});const Q=async()=>{if(e.editModel?.id){if(e.editModel.fallbacks&&Array.isArray(e.editModel.fallbacks)){x.value=e.editModel.fallbacks.map(M=>typeof M=="string"?M:M.id);return}try{const M=await fetch(J(`/api/models/${e.editModel.id}/fallbacks`));if(M.ok){const O=await M.json();x.value=O.fallbacks.map(A=>A.fallback_model_id)}}catch(M){console.error("Error loading fallbacks:",M)}}};re(r,async(M,O)=>{D.value||k.value&&!O&&M===(e.editModel?.provider_id||e.editModel?.provider)||(n.value="",f.value=[],h.value=[],r.value&&await R())});const L=async()=>{if(!n.value||!r.value){f.value=[];return}const M=d.value.find(A=>A.name===r.value);if(!M||M.sdk!=="openrouter"){f.value=[];return}const O=K.value.find(A=>A.value===n.value);if(!O?.slug){console.error("Model slug not found"),f.value=[];return}w.value=!0;try{const A=await fetch(J("/api/models/endpoints"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r.value,modelSlug:O.slug})});if(A.ok){const B=await A.json();f.value=B.endpoints||[],k.value||(h.value=f.value.map(te=>te.id))}else{const B=await A.json();console.error("Error fetching endpoints:",B),f.value=[]}}catch(A){console.error("Error fetching endpoints:",A),f.value=[]}finally{w.value=!1}};re(n,async(M,O)=>{D.value||k.value&&!O&&M===e.editModel?.model||(n.value?(await L(),O&&M!==O&&(h.value=f.value.map(A=>A.id))):(f.value=[],h.value=[]))});const q={props:e,emit:c,providers:d,selectedProvider:r,selectedModel:n,availableModels:p,loadingProviders:v,loadingModels:g,endpoints:f,selectedEndpoints:h,loadingEndpoints:w,fallbackModels:x,isEditMode:k,originalName:C,modelName:y,nameError:_,validateAndFormatName:V,handleNameInput:U,isLoading:D,initialState:j,providerOptions:F,modelOptions:K,hasChanges:E,isOpenRouter:P,fetchProviders:H,fetchAvailableModels:R,resetForm:N,loadEditData:X,loadModelFallbacks:Q,fetchEndpoints:L,handleSubmit:()=>{if(!r.value||!n.value){alert("Please select a provider and model");return}if(!y.value){alert("Please enter a name for the model");return}if(_.value){alert(_.value);return}const M=P.value?h.value:[],O={name:y.value,model:n.value,provider:r.value,included_providers:M,fallbacks:x.value};k.value&&e.editModel?.id&&(O.id=e.editModel.id,C.value&&C.value!==y.value&&(O.originalName=C.value)),c("save",O)},handleCancel:()=>{N(),c("update:modelValue",!1)},Modal:Ie,SelectInput:xe,ExposedSelectList:_1,ModelSelectorInput:T1};return Object.defineProperty(q,"__isScriptSetup",{enumerable:!1,value:!0}),q}}),V1={class:"space-y-4"},I1={key:0},A1={key:1},P1=["value"],E1={key:0,class:"mt-1 text-xs text-red-500"},L1={key:1,class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},O1={class:"px-1 py-0.5 bg-gray-100 dark:bg-gray-800 rounded"},j1={key:2,class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},D1={key:2},U1={key:3},q1={class:"flex justify-end gap-2"},N1=["disabled"];function B1(u,t,a,e,c,d){return s(),Z(e.Modal,{"model-value":a.modelValue,"onUpdate:modelValue":t[4]||(t[4]=r=>u.$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:oe(()=>[o("div",q1,[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},b(e.isEditMode?"Update Model":"Add Model"),9,N1)])]),default:oe(()=>[o("div",V1,[S(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?(s(),l("div",I1,[S(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"])])):i("v-if",!0),i(" Name field (shown after model selection) "),e.selectedModel?(s(),l("div",A1,[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:G(["w-full px-3 py-2 text-sm border rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent",e.nameError?"border-red-500":"border-gray-300 dark:border-neutral-600"]),placeholder:"e.g., coding_model, planning_model, fast_response"},null,42,P1),e.nameError?(s(),l("p",E1,b(e.nameError),1)):e.modelName?(s(),l("p",L1,[t[5]||(t[5]=ie(" Will be saved as: ",-1)),o("code",O1,b(e.modelName),1)])):(s(),l("p",j1," A descriptive name for this model (e.g., coding_model, planning_model). This becomes the filename and reference ID. "))])):i("v-if",!0),e.selectedModel&&e.isOpenRouter?(s(),l("div",D1,[t[7]||(t[7]=o("label",{class:"block text-sm font-medium mb-2"}," Available Providers ",-1)),S(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-gray-500 dark:text-gray-400"}," Select which providers can be used for this model ",-1))])):i("v-if",!0),i(" Fallback Models Section "),e.selectedModel?(s(),l("div",U1,[S(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-gray-500 dark:text-gray-400"}," Fallback models will be used in order if the primary model fails ",-1))])):i("v-if",!0)])]),_:1},8,["model-value","title","has-changes"])}const R1=Y(M1,[["render",B1],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/ModelModal.vue"]]),F1=ee({__name:"ModelsView",setup(u,{expose:t}){t();const a=m(!1),e=m([]),c=m(!1),d=m(null),r=m("add"),n=[{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:w=>{d.value=w,r.value="edit",a.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 w=>{await f(w.id)}}],v=async()=>{c.value=!0;try{const w=await fetch(J("/api/models"));if(!w.ok)throw new Error("Failed to fetch models");const x=await w.json();e.value=x.models||[]}catch(w){console.error("Error fetching models:",w),e.value=[]}finally{c.value=!1}},g=async w=>{try{if(d.value){const{originalName:x,...k}=w,C=x||d.value.id,y=await fetch(J(`/api/models/${C}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});if(!y.ok){const _=await y.json();alert(_.error||"Failed to update model");return}}else{const x=await fetch(J("/api/models"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!x.ok){const k=await x.json();alert(k.error||"Failed to add model");return}}await v(),a.value=!1,d.value=null,r.value="add"}catch(x){console.error("Error saving model:",x),alert("Failed to save model")}},f=async w=>{try{const x=await fetch(J(`/api/models/${w}`),{method:"DELETE"});if(!x.ok){const k=await x.json();alert(k.error||"Failed to delete model");return}await v()}catch(x){console.error("Error deleting model:",x),alert("Failed to delete model")}};ce(()=>{v()});const h={showModal:a,models:e,loading:c,editingModel:d,modalMode:r,columns:n,actions:p,fetchModels:v,handleAddModel:g,deleteModel:f,ModelModal:R1,DataTable:Le,get getModelIcon(){return ct},CenteredContentView:je};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}}),z1={class:"flex justify-between items-center mb-6"},H1={class:"flex items-center gap-2"},W1=["src","alt"],J1={class:"text-sm text-gray-600 dark:text-gray-400 font-mono"},K1={key:0,class:"space-y-0.5"},Z1=["title"],G1={class:"shrink-0 font-mono pr-2"},X1=["src","alt"],Q1={class:"truncate"},Y1={key:1,class:"text-gray-400 dark:text-gray-600 text-sm"};function $1(u,t,a,e,c,d){return s(),Z(e.CenteredContentView,null,{default:oe(()=>[o("div",z1,[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-gray-600 dark:text-gray-400 mb-8"}," Configure AI models from your connected providers. Models define which AI capabilities are available to your agents. ",-1)),S(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":oe(({value:r,row:n})=>[o("div",H1,[e.getModelIcon(n.model,n.provider)?(s(),l("img",{key:0,src:e.getModelIcon(n.model,n.provider),class:"w-5 h-5 shrink-0",alt:n.provider},null,8,W1)):i("v-if",!0),o("span",null,b(r),1)])]),"cell-model":oe(({value:r})=>[o("span",J1,b(r||"—"),1)]),"cell-fallbacks":oe(({value:r})=>[r&&r.length>0?(s(),l("div",K1,[(s(!0),l(W,null,ne(r,(n,p)=>(s(),l("div",{key:n.id,class:"text-sm text-gray-600 dark:text-gray-400 flex items-center",title:n.name},[o("span",G1,b(p===r.length-1?"└─":"├─"),1),e.getModelIcon(n.model,n.provider)?(s(),l("img",{key:0,src:e.getModelIcon(n.model,n.provider),class:"w-4 h-4 shrink-0 mr-1.5",alt:n.provider},null,8,X1)):i("v-if",!0),o("span",Q1,b(n.name),1)],8,Z1))),128))])):(s(),l("span",Y1," None "))]),_:1},8,["data","loading"]),i(" Model Modal "),S(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 eg=Y(F1,[["render",$1],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/ModelsView.vue"]]),tg=ee({__name:"AddProviderModal",props:{modelValue:{type:Boolean,required:!0}},emits:["update:modelValue","save"],setup(u,{expose:t,emit:a}){t();const e=a,c=m({name:"",type:"",apiKey:"",baseUrl:""}),d=[{value:"openai",label:"OpenAI",icon:Ze,sdk:"openai-sdk"},{value:"openrouter",label:"OpenRouter",icon:st,sdk:"openrouter"}],r=y=>y==="openai-sdk"||y==="openai"?Ze:y==="openrouter"?st:null,n=m(!1),p=z(()=>d.find(y=>y.value===c.value.type)),v=()=>{setTimeout(()=>{n.value=!1},200)},g=m({});re(()=>c.value.type,y=>{if(y&&!c.value.name){const _=d.find(V=>V.value===y);_&&(c.value.name=_.label)}});const f=z(()=>c.value.type==="custom"||c.value.type==="openai"),h=()=>{g.value={};let y=!0;return c.value.name||(g.value.name="Provider name is required",y=!1),c.value.type||(g.value.type="Provider type is required",y=!1),c.value.apiKey||(g.value.apiKey="API key is required",y=!1),f.value&&c.value.type==="custom"&&!c.value.baseUrl&&(g.value.baseUrl="Base URL is required for custom providers",y=!1),y},w=()=>{h()&&(e("save",{...c.value}),k(),e("update:modelValue",!1))},x=()=>{k(),e("update:modelValue",!1)},k=()=>{c.value={name:"",type:"",apiKey:""},g.value={}},C={emit:e,formData:c,providerTypes:d,getProviderIcon:r,isDropdownOpen:n,selectedProvider:p,handleDropdownBlur:v,errors:g,showBaseUrl:f,validateForm:h,handleSave:w,handleCancel:x,resetForm:k,Modal:Ie,TextInput:Oe};return Object.defineProperty(C,"__isScriptSetup",{enumerable:!1,value:!0}),C}}),og={class:"space-y-4"},rg={class:"space-y-1"},ag={class:"relative"},sg={key:0,class:"flex items-center gap-2"},lg=["src","alt"],ng={key:1,class:"text-gray-500"},ig={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"},dg=["onClick"],cg=["src","alt"],ug={key:0,class:"text-xs text-red-500 dark:text-red-400"};function pg(u,t,a,e,c,d){return s(),Z(e.Modal,{"model-value":a.modelValue,"onUpdate:modelValue":t[4]||(t[4]=r=>u.$emit("update:modelValue",r)),title:"Add Provider",width:"max-w-md"},{footer:oe(()=>[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:oe(()=>[o("div",og,[o("div",rg,[t[6]||(t[6]=o("label",{class:"block text-sm font-medium"},[ie(" Provider Type "),o("span",{class:"text-red-500"},"*")],-1)),o("div",ag,[o("button",{type:"button",onClick:t[0]||(t[0]=r=>e.isDropdownOpen=!e.isDropdownOpen),onBlur:e.handleDropdownBlur,class:G(["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?(s(),l("div",sg,[o("img",{src:e.selectedProvider.icon,alt:e.selectedProvider.label,class:"w-5 h-5"},null,8,lg),o("span",null,b(e.selectedProvider.label),1)])):(s(),l("span",ng,"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?(s(),l("div",ig,[(s(),l(W,null,ne(e.providerTypes,r=>o("button",{key:r.value,type:"button",onClick:n=>{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,cg),o("span",null,b(r.label),1)],8,dg)),64))])):i("v-if",!0)]),e.errors.type?(s(),l("p",ug,b(e.errors.type),1)):i("v-if",!0)]),S(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"]),S(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?(s(),Z(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"])):i("v-if",!0)])]),_:1},8,["model-value"])}const mg=Y(tg,[["render",pg],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/AddProviderModal.vue"]]),gg=ee({__name:"ProvidersView",setup(u,{expose:t}){t();const a=m(!1),e=m([]),c=m(!1),d=[{key:"name",label:"Name",width:"w-1/3"},{key:"sdk",label:"SDK Type",width:"w-1/3",formatter:f=>({"openai-sdk":"OpenAI SDK",openrouter:"OpenRouter",openai:"OpenAI"})[f]||f},{key:"hasApiKey",label:"API Key",width:"w-1/3",formatter:f=>f?"✓ 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 f=>{await v(f.name)}}],n=async()=>{c.value=!0;try{const f=await fetch(J("/api/providers"));if(!f.ok)throw new Error("Failed to fetch providers");const h=await f.json();e.value=h.providers||[]}catch(f){console.error("Error fetching providers:",f),e.value=[]}finally{c.value=!1}},p=async f=>{try{const h=await fetch(J("/api/providers"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!h.ok){const w=await h.json();alert(w.error||"Failed to add provider");return}await n(),a.value=!1}catch(h){console.error("Error adding provider:",h),alert("Failed to add provider")}},v=async f=>{try{const h=await fetch(J(`/api/providers/${encodeURIComponent(f)}`),{method:"DELETE"});if(!h.ok){const w=await h.json();w.modelCount?alert(`${w.error}
|
|
1
|
+
import{m as xe,c as l,o as n,a as o,r as m,d as te,b as ge,e as Ae,w as ae,n as he,f as Fe,g as $e,u as qe,h as ze,i as z,j as s,k as Q,l as Y,F as G,p as ue,q as C,s as ke,t as re,v as Xe,x as y,R as uo,y as ve,T as De,z as it,A as ye,B as Me,C as po,D as we,E as dt,L as Vt,G as At,H as mo,I as fo,J as go,K as ho,P as vo,M as bo,N as yo,O as Pt,Q as Le,S as xo,U as Lt,V as ko,W as nt,X as Ve,Y as Ue,Z as _o,_ as wo,$ as Et,a0 as jt,a1 as Co,a2 as bt,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 Ao,e as yt}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 a(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=a(c);fetch(c.href,i)}})();const Po={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Lo(p,t){return n(),l("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 xt=xe({name:"lucide-bot",render:Lo}),Eo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function jo(p,t){return n(),l("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 kt=xe({name:"lucide-message-square",render:jo}),Oo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Do(p,t){return n(),l("svg",Oo,[...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=xe({name:"lucide-cpu",render:Do}),Uo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Bo(p,t){return n(),l("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 No=xe({name:"lucide-server",render:Bo}),Ro={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fo(p,t){return n(),l("svg",Ro,[...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 zo=xe({name:"lucide-wrench",render:Fo}),Ho={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Wo(p,t){return n(),l("svg",Ho,[...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=xe({name:"lucide-settings",render:Wo}),Ko={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Zo(p,t){return n(),l("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=xe({name:"lucide-chevron-left",render:Zo}),Xo={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Yo(p,t){return n(),l("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=xe({name:"lucide-sun",render:Yo}),$o={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function er(p,t){return n(),l("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=xe({name:"lucide-moon",render:er}),or={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function rr(p,t){return n(),l("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 ar=xe({name:"lucide-activity",render:rr}),nr={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function lr(p,t){return n(),l("svg",nr,[...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=xe({name:"lucide-function-square",render:lr}),ir={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function dr(p,t){return n(),l("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=xe({name:"lucide-log-out",render:dr}),ur={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function pr(p,t){return n(),l("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=xe({name:"lucide-users",render:pr}),fr={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function gr(p,t){return n(),l("svg",fr,[...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=xe({name:"lucide-key",render:gr}),vr={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function br(p,t){return n(),l("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=xe({name:"lucide-book-open",render:br}),xr={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function kr(p,t){return n(),l("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=xe({name:"lucide-external-link",render:kr}),Ot="agentbuilder-accent-theme",Dt=["amber","lime","emerald","sky","blue","indigo","purple","fuchsia","pink","white"],lt=m("purple");let _t=!1;function qt(p){typeof document>"u"||(p==="purple"?delete document.documentElement.dataset.accent:document.documentElement.dataset.accent=p)}function wr(p){try{localStorage.setItem(Ot,p)}catch{}}function Cr(){try{const p=localStorage.getItem(Ot);if(p&&Dt.includes(p))return p}catch{}return"purple"}function Ut(){if(_t)return;_t=!0;const p=Cr();lt.value=p,qt(p)}function Sr(){Ut();function p(t){lt.value=t,qt(t),wr(t)}return{theme:lt,themes:Dt,setTheme:p}}const Tr=te({__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 a=p,e=m(),c=m(),i=m(),r=m(0),d=(f,k,x,w,M,b)=>{f.beginPath(),f.moveTo(k+b,x),f.lineTo(k+w-b,x),f.quadraticCurveTo(k+w,x,k+w,x+b),f.lineTo(k+w,x+M-b),f.quadraticCurveTo(k+w,x+M,k+w-b,x+M),f.lineTo(k+b,x+M),f.quadraticCurveTo(k,x+M,k,x+M-b),f.lineTo(k,x+b),f.quadraticCurveTo(k,x,k+b,x),f.closePath()},u=async()=>{if(await he(),!e.value||!c.value||!i.value)return;const f=e.value.getContext("2d");if(!f)return;const k=i.value.getBoundingClientRect(),x=i.value.firstElementChild;if(x){const S=getComputedStyle(x);r.value=parseFloat(S.borderRadius)||0}const w=k.width+a.offsetX+4,M=k.height+a.offsetY+4;e.value.width=w,e.value.height=M,e.value.style.width=`${w}px`,e.value.style.height=`${M}px`,f.clearRect(0,0,e.value.width,e.value.height);const b=document.documentElement.classList.contains("dark");if(f.fillStyle=b?"#6b7280":"black",f.globalAlpha=a.intensity,f.save(),d(f,a.offsetX,a.offsetY,k.width,k.height,r.value),f.clip(),a.pattern==="crosshatch"){const S=b?4:3;f.lineWidth=1,f.strokeStyle=b?"#6b7280":"black";for(let T=-k.height;T<k.width;T+=S)f.beginPath(),f.moveTo(a.offsetX+T,a.offsetY),f.lineTo(a.offsetX+T+k.height,a.offsetY+k.height),f.stroke();for(let T=0;T<k.width+k.height;T+=S)f.beginPath(),f.moveTo(a.offsetX+T,a.offsetY+k.height),f.lineTo(a.offsetX+T-k.height,a.offsetY),f.stroke()}else if(a.pattern==="dots"){const T=b?3:2,A=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]];for(let O=0;O<k.width;O+=T)for(let R=0;R<k.height;R+=T){const F=Math.floor(O/T)%4,$=Math.floor(R/T)%4;A[$][F]/16<a.intensity&&f.fillRect(a.offsetX+O,a.offsetY+R,1,1)}}else if(a.pattern==="diagonal"){const S=b?5:4;f.lineWidth=1,f.strokeStyle=b?"#6b7280":"black";for(let T=-k.height;T<k.width;T+=S)f.beginPath(),f.moveTo(a.offsetX+T,a.offsetY),f.lineTo(a.offsetX+T+k.height,a.offsetY+k.height),f.stroke()}f.restore()};let v=null,g=null;ge(()=>{v=new ResizeObserver(()=>{u()}),i.value&&v.observe(i.value),u(),g=new MutationObserver(()=>{u()}),g.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})}),Ae(()=>{i.value&&v&&v.unobserve(i.value),g&&g.disconnect()}),ae(()=>[a.offsetX,a.offsetY,a.intensity,a.pattern],()=>{u()});const h={props:a,canvas:e,container:c,contentEl:i,borderRadius:r,roundedRectPath:d,drawDitheredShadow:u,get resizeObserver(){return v},set resizeObserver(f){v=f},get mutationObserver(){return g},set mutationObserver(f){g=f}};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}}),ee=(p,t)=>{const a=p.__vccOpts||p;for(const[e,c]of t)a[e]=c;return a},Mr={ref:"canvas",class:"absolute top-0 left-0 pointer-events-none"},Ir={ref:"contentEl",class:"relative"};function Vr(p,t,a,e,c,i){return n(),l("div",{ref:"container",class:"relative",style:$e({paddingRight:`${a.offsetX}px`,paddingBottom:`${a.offsetY}px`})},[o("canvas",Mr,null,512),o("div",Ir,[Fe(p.$slots,"default")],512)],4)}const He=ee(Tr,[["render",Vr],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/DropShadow.vue"]]),Bt="/agents/assets/img/agent-builder-logo-light.svg",Nt="/agents/assets/img/agent-builder-logo-dark.svg",Ar="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 Lr(){return window.__AGENTBUILDER_CONFIG__||{mountPoint:"/agentbuilder"}}function We(){return Lr().mountPoint}function X(p){const t=We(),a=p.startsWith("/")?p:`/${p}`;return t==="/"?a:`${t}${a}`}const Er=te({__name:"Sidebar",props:{isCollapsed:{type:Boolean,required:!0},isDark:{type:Boolean,required:!0}},emits:["toggle-sidebar","toggle-theme"],setup(p,{expose:t,emit:a}){t();function e(H){if(H.startsWith("/src/")||H.startsWith("data:"))return H;const K=We();return K==="/"?H.replace("/agents/","/"):H.replace("/agents/",`${K}/`)}const c=e(Bt),i=e(Nt),r=e(Ar),d=e(Pr),u=p,v=a,g=qe(),h=ze(),f=z(()=>g.name);function k(H){const K=g.path;return K===H.path||K.startsWith(H.path+"/")}const x=z(()=>u.isDark?i:c),w=z(()=>u.isDark?d:r),M=[{id:"threads",label:"Threads",icon:ar,path:"/threads"},{id:"agents",label:"Agents",icon:xt,path:"/agents"},{id:"prompts",label:"Prompts",icon:kt,path:"/prompts"},{id:"tools",label:"Tools",icon:zo,path:"/tools",hasSubnav:!0,subnav:[{id:"tools-functions",label:"Functions",icon:sr,path:"/tools#functions"},{id:"tools-prompts",label:"Prompts",icon:kt,path:"/tools#prompts"},{id:"tools-agents",label:"Agents",icon:xt,path:"/tools#agents"}]},{id:"models",label:"Models",icon:qo,path:"/models"},{id:"providers",label:"Providers",icon:No,path:"/providers"}],b=H=>{h.push(H)},S=H=>{h.push(H),A.value=!1},T=z(()=>typeof f.value=="string"&&(f.value==="tools"||f.value.startsWith("tools-"))),A=m(!1),{theme:O,themes:R,setTheme:F}=Sr(),$={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"},B=z(()=>f.value==="users"||f.value==="api-keys"),D=()=>{A.value=!A.value},W=()=>{localStorage.removeItem("auth_token"),h.push("/login")},U=H=>{const K=H.target;A.value&&!K.closest(".settings-menu-container")&&(A.value=!1)};ge(()=>{document.addEventListener("click",U)}),Ae(()=>{document.removeEventListener("click",U)});const P={transformAssetPath:e,logoLight:c,logoDark:i,logoMarkLight:r,logoMarkDark:d,props:u,emit:v,route:g,router:h,activeRoute:f,isNavItemActive:k,currentLogo:x,currentLogoMark:w,navItems:M,navigateTo:b,navigateToSetting:S,isToolsActive:T,showSettingsMenu:A,accentTheme:O,accentThemes:R,setAccentTheme:F,themeColors:$,isSettingsActive:B,toggleSettingsMenu:D,handleLogout:W,handleClickOutside:U,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:He};return Object.defineProperty(P,"__isScriptSetup",{enumerable:!1,value:!0}),P}}),jr=["src"],Or=["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"],Nr={key:0,class:"flex-1 whitespace-nowrap overflow-hidden text-ellipsis text-left"},Rr={key:0,class:"ml-4 space-y-0.5"},Fr=["onClick"],zr={class:"whitespace-nowrap overflow-hidden text-ellipsis"},Hr=["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"],ea={class:"relative z-10 flex items-center justify-center w-8 h-full"},ta={class:"relative z-10 flex items-center justify-center w-8 h-full"},oa={class:"px-4 pt-3 pb-4 border-b border-neutral-200 dark:border-neutral-700"},ra={class:"grid grid-cols-5 gap-3"},aa=["onClick","title"],na={key:0,class:"w-2 h-2 rounded-full bg-white shadow-sm"},la={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 sa(p,t,a,e,c,i){return n(),l("aside",{class:Q(["flex flex-col transition-all duration-300 pt-2.5",a.isCollapsed?"w-16":"w-60"])},[o("div",{class:Q(`flex items-center justify-between ${a.isCollapsed?"px-2 py-4":"p-4"}`)},[a.isCollapsed?s("v-if",!0):(n(),l("img",{key:0,src:e.currentLogo,alt:"AgentBuilder",class:"h-8 mr-2 mt-0.5"},null,8,jr)),o("button",{onClick:t[0]||(t[0]=r=>p.$emit("toggle-sidebar")),class:Q(`p-1 rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors ${a.isCollapsed?"m-auto":"border border-black/20 dark:border-white/20 opacity-50 hover:opacity-100"}`),"aria-label":"Toggle sidebar"},[a.isCollapsed?(n(),l("img",{key:1,src:e.currentLogoMark,alt:"AgentBuilder",class:"w-7 h-7 m-auto"},null,8,Or)):(n(),Y(e.IconChevronLeft,{key:0,class:"w-5 h-5"}))],2)],2),o("nav",Dr,[o("div",qr,[(n(),l(G,null,ue(e.navItems,r=>(n(),l(G,{key:r.id},[r.hasSubnav?(n(),l("div",Ur,[s(" Main Tools button "),o("button",{onClick:d=>e.navigateTo(r.path),class:Q(["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",a.isCollapsed&&"justify-center"]),title:a.isCollapsed?r.label:void 0},[(n(),Y(Xe(r.icon),{class:"w-5 h-5 flex-shrink-0"})),a.isCollapsed?s("v-if",!0):(n(),l("span",Nr,y(r.label),1))],10,Br),s(" Tools subnav "),!a.isCollapsed&&r.subnav?(n(),l("div",Rr,[(n(!0),l(G,null,ue(r.subnav,d=>(n(),l("button",{key:d.id,onClick:u=>e.navigateTo(d.path),class:Q(["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"])},[(n(),Y(Xe(d.icon),{class:"w-4 h-4 flex-shrink-0"})),o("span",zr,y(d.label),1)],10,Fr))),128))])):s("v-if",!0)])):(n(),l("button",{key:1,onClick:d=>e.navigateTo(r.path),class:Q(["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",a.isCollapsed&&"justify-center"]),title:a.isCollapsed?r.label:void 0},[(n(),Y(Xe(r.icon),{class:"w-5 h-5 flex-shrink-0"})),a.isCollapsed?s("v-if",!0):(n(),l("span",Wr,y(r.label),1))],10,Hr))],64))),64))]),o("div",Jr,[s(" Documentation Link "),o("a",{href:"https://docs.standardagentbuilder.com/",target:"_blank",rel:"noopener noreferrer",class:Q(["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",a.isCollapsed&&"justify-center"]),title:a.isCollapsed?"Documentation":void 0},[C(e.IconBookOpen,{class:"w-5 h-5 flex-shrink-0"}),a.isCollapsed?s("v-if",!0):(n(),l("span",Zr," Docs ")),a.isCollapsed?s("v-if",!0):(n(),Y(e.IconExternalLink,{key:1,class:"w-3 h-3 flex-shrink-0 opacity-50"}))],10,Kr),s(" Bottom icon bar "),o("div",{class:Q(["flex items-center gap-1 pt-2 mt-1 border-t border-black/10 dark:border-white/10",a.isCollapsed?"flex-col":"justify-between"])},[s(" Settings Menu "),o("div",Gr,[o("button",{onClick:ke(e.toggleSettingsMenu,["stop"]),class:Q(["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),s(" Settings Popover Menu "),e.showSettingsMenu?(n(),l("div",Xr,[C(e.DropShadow,{"offset-x":6,"offset-y":6,intensity:.4},{default:re(()=>[o("div",Yr,[s(" 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]=ke(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:a.isDark?"Switch to light mode":"Switch to dark mode"},[s(" Sliding indicator "),o("span",{class:Q(["absolute top-0.5 h-6 w-8 rounded-full bg-white dark:bg-black shadow-sm transition-transform duration-200",a.isDark?"translate-x-[calc(100%-2px)]":"translate-x-0.5"])},null,2),s(" Icons "),o("span",ea,[C(e.IconSun,{class:Q(["w-4 h-4",a.isDark?"text-neutral-500":"text-black"])},null,8,["class"])]),o("span",ta,[C(e.IconMoon,{class:Q(["w-4 h-4",a.isDark?"text-white":"text-neutral-400"])},null,8,["class"])])],8,$r)]),s(" Accent Color Picker "),o("div",oa,[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",ra,[(n(!0),l(G,null,ue(e.accentThemes,r=>(n(),l("button",{key:r,onClick:ke(d=>e.setAccentTheme(r),["stop"]),class:Q(["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?(n(),l("span",na)):s("v-if",!0)],10,aa))),128))])]),o("button",{onClick:t[2]||(t[2]=r=>e.navigateToSetting("/settings/users")),class:Q(["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:Q(["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})])):s("v-if",!0)]),s(" 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"}),a.isCollapsed?s("v-if",!0):(n(),l("span",la,"Logout"))])],2)])])],2)}const ia=ee(Er,[["render",sa],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/Sidebar.vue"]]),da=te({__name:"WarningBanner",setup(p,{expose:t}){t();const a=m([]),e=m(new Set),c=async()=>{if(localStorage.getItem("auth_token"))try{const g=await fetch(X("/api/diagnostics"));if(g.ok){const h=await g.json();a.value=h.warnings||[]}}catch{}},i=v=>{const g=`${v.type}:${v.details?.name||v.message}`;e.value.add(g)},r=v=>{const g=`${v.type}:${v.details?.name||v.message}`;return!e.value.has(g)},d=v=>{if(v.type==="duplicate_tool_name"){const g=v.details?.sources?.join(" and ")||"multiple sources";return`Duplicate tool name "${v.details?.name}" (defined as both ${g}). This may cause unexpected behavior.`}return v.message};ge(()=>{c()});const u={warnings:a,dismissed:e,fetchWarnings:c,dismiss:i,isVisible:r,formatWarning:d};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),ca={class:"warning-banner-container"},ua={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"},pa={class:"flex items-center gap-2"},ma=["onClick"];function fa(p,t,a,e,c,i){return n(),l("div",ca,[(n(!0),l(G,null,ue(e.warnings,r=>(n(),l(G,{key:`${r.type}:${r.details?.name}`},[e.isVisible(r)?(n(),l("div",ua,[o("div",pa,[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,y(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,ma)])):s("v-if",!0)],64))),128))])}const ga=ee(da,[["render",fa],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/WarningBanner.vue"]]),ha=te({__name:"App",setup(p,{expose:t}){t(),Ut();const a=qe(),e=m(!1),c=m(!1),i=z(()=>a.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"))};ge(()=>{const v=localStorage.getItem("theme");(v==="dark"||!v&&window.matchMedia("(prefers-color-scheme: dark)").matches)&&(c.value=!0,document.documentElement.classList.add("dark"))});const u={route:a,isCollapsed:e,isDark:c,showSidebar:i,toggleSidebar:r,toggleTheme:d,get RouterView(){return uo},Sidebar:ia,WarningBanner:ga};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),va={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"},ba={class:"flex-1 overflow-auto"};function ya(p,t,a,e,c,i){return n(),l("div",{class:Q(["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?(n(),Y(e.Sidebar,{key:0,"is-collapsed":e.isCollapsed,"is-dark":e.isDark,onToggleSidebar:e.toggleSidebar,onToggleTheme:e.toggleTheme},null,8,["is-collapsed","is-dark"])):s("v-if",!0),s(" Login page renders directly on textured background "),e.showSidebar?(n(),l(G,{key:2},[s(" Main content area for authenticated pages "),o("main",va,[C(e.WarningBanner),o("div",ba,[C(e.RouterView)])])],2112)):(n(),Y(e.RouterView,{key:1}))],2)}const xa=ee(ha,[["render",ya],["__scopeId","data-v-7a7a37b1"],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/App.vue"]]),ka={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function _a(p,t){return n(),l("svg",ka,[...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 wa=xe({name:"lucide-trash-2",render:_a}),Ca={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Sa(p,t){return n(),l("svg",Ca,[...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 Ta=xe({name:"lucide-edit",render:Sa}),Ma={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ia(p,t){return n(),l("svg",Ma,[...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 Rt=xe({name:"lucide-eye",render:Ia}),Va=te({__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 Ta;case"delete":return wa;case"view":return Rt;default:return null}},getCellValue:(u,v)=>{const g=u[v.key];return v.formatter?v.formatter(g):g??"-"},getCellAlignment:u=>{switch(u){case"center":return"text-center";case"right":return"text-right";default:return"text-left"}},handleAction:(u,v)=>{if(u.confirm){const g=u.confirmMessage||`Are you sure you want to ${u.label.toLowerCase()}?`;confirm(g)&&u.handler(v)}else u.handler(v)}};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}}),Aa={class:"w-full"},Pa={class:"border border-black dark:border-neutral-300 rounded overflow-hidden"},La={class:"overflow-x-auto"},Ea={class:"w-full"},ja={class:"border-b border-black dark:border-neutral-300"},Oa={key:0,class:"px-4 py-3 text-right font-medium text-sm"},Da={key:0},qa=["colspan"],Ua=["colspan"],Ba=["innerHTML"],Na={key:0,class:"px-4 py-3 text-right"},Ra={class:"inline-flex gap-1"},Fa=["onClick","title"];function za(p,t,a,e,c,i){return n(),l("div",Aa,[o("div",Pa,[o("div",La,[o("table",Ea,[o("thead",ja,[o("tr",null,[(n(!0),l(G,null,ue(a.columns,r=>(n(),l("th",{key:r.key,class:Q(["px-4 py-3 font-medium text-sm",e.getCellAlignment(r.align),r.width||""])},y(r.label),3))),128)),a.actions&&a.actions.length>0?(n(),l("th",Oa," Actions ")):s("v-if",!0)])]),o("tbody",null,[s(" Loading state "),a.loading?(n(),l("tr",Da,[o("td",{colspan:a.columns.length+(a.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"})]),ve(" Loading... ")],-1)])],8,qa)])):a.data.length===0?(n(),l(G,{key:1},[s(" Empty state "),o("tr",null,[o("td",{colspan:a.columns.length+(a.actions?1:0),class:"px-4 py-8 text-center text-neutral-500"},y(a.emptyMessage),9,Ua)])],2112)):(n(),l(G,{key:2},[s(" Data rows "),(n(!0),l(G,null,ue(a.data,(r,d)=>(n(),l("tr",{key:d,class:"border-t border-neutral-200 dark:border-neutral-800 hover:bg-black/5 dark:hover:bg-white/5 transition-colors"},[(n(!0),l(G,null,ue(a.columns,u=>(n(),l("td",{key:u.key,class:Q(["px-4 py-3 text-sm",e.getCellAlignment(u.align)])},[Fe(p.$slots,`cell-${u.key}`,{value:r[u.key],row:r,column:u},()=>[u.html?(n(),l("span",{key:0,innerHTML:e.getCellValue(r,u)},null,8,Ba)):(n(),l(G,{key:1},[ve(y(e.getCellValue(r,u)),1)],64))])],2))),128)),a.actions&&a.actions.length>0?(n(),l("td",Na,[o("div",Ra,[(n(!0),l(G,null,ue(a.actions,(u,v)=>(n(),l("button",{key:v,onClick:g=>e.handleAction(u,r),class:"p-1.5 rounded hover:bg-black/10 dark:hover:bg-white/10 transition-colors",title:u.label},[(n(),Y(Xe(e.getIcon(u.icon)),{class:"w-4 h-4"}))],8,Fa))),128))])])):s("v-if",!0)]))),128))],2112))])])])])])}const Be=ee(Va,[["render",za],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/DataTable.vue"]]),Ha=te({__name:"AgentsDataTable",emits:["add","edit","delete"],setup(p,{expose:t,emit:a}){const e=a,c=m([]),i=m(!1),r=[{key:"title",label:"Title",width:"w-1/5"},{key:"type",label:"Type",width:"w-1/12",formatter:h=>h==="dual_ai"?"Dual AI":"AI+Human"},{key:"side_a_agent_prompt_name",label:"Side A",width:"w-1/5",formatter:h=>h||"-"},{key:"side_b_agent_prompt_name",label:"Side B",width:"w-1/5",formatter:h=>h||"Human"},{key:"created_at",label:"Created",width:"w-1/6",formatter:h=>h?new Date(h*1e3).toLocaleDateString():"-"}],d=[{icon:"edit",label:"Edit",handler:h=>e("edit",h)},{icon:"delete",label:"Delete",handler:async h=>{await v(h)},confirm:!0,confirmMessage:"Are you sure you want to delete this agent?"}],u=async()=>{i.value=!0;try{const h=await fetch(X("/api/agents"));if(h.ok){const f=await h.json();c.value=f.agents||[]}}catch(h){console.error("Error fetching agents:",h)}finally{i.value=!1}},v=async h=>{try{const f=await fetch(X(`/api/agents/${h.id}`),{method:"DELETE"});if(f.ok)await u();else{const k=await f.json();alert(k.error||"Failed to delete agent")}}catch(f){console.error("Error deleting agent:",f),alert("Failed to delete agent")}};ge(()=>{u()}),t({refresh:u});const g={emit:e,agents:c,loading:i,columns:r,actions:d,fetchAgents:u,deleteAgent:v,DataTable:Be};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}});function Wa(p,t,a,e,c,i){return n(),l("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 Ja=ee(Ha,[["render",Wa],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/AgentsDataTable.vue"]]),Ka={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Za(p,t){return n(),l("svg",Ka,[...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 Ft=xe({name:"lucide-x",render:Za}),Ga=te({__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:a}){t();const e=p,c=a,i=()=>{c("update:modelValue",!1)},r=()=>{c("confirm"),i()},d=()=>{c("cancel"),i()},u=g=>{g.key==="Escape"&&e.modelValue&&d()};ae(()=>e.modelValue,g=>{g?(document.addEventListener("keydown",u),document.body.style.overflow="hidden"):(document.removeEventListener("keydown",u),document.body.style.overflow="")});const v={props:e,emit:c,close:i,handleConfirm:r,handleCancel:d,handleKeydown:u,DropShadow:He,get IconX(){return Ft}};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),Xa={key:0,class:"w-full max-w-md"},Ya={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"},$a={class:"p-6"},en={class:"text-neutral-700 dark:text-neutral-300 mb-6"},tn={class:"flex justify-end gap-3"};function on(p,t,a,e,c,i){return n(),Y(it,{to:"body"},[C(De,{"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:re(()=>[a.modelValue?(n(),l("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(De,{"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:re(()=>[a.modelValue?(n(),l("div",Xa,[C(e.DropShadow,{"offset-x":12,"offset-y":12,intensity:.4},{default:re(()=>[o("div",{class:"bg-white dark:bg-black border-2 border-red-600 flex flex-col",onClick:t[0]||(t[0]=ke(()=>{},["stop"]))},[s(" Header "),o("div",Ya,[o("h2",Qa,y(a.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"})])]),s(" Content "),o("div",$a,[o("p",en,y(a.message),1),o("div",tn,[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"},y(a.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"},y(a.confirmText),1)])])])]),_:1})])):s("v-if",!0)]),_:1})])):s("v-if",!0)]),_:1})])}const zt=ee(Ga,[["render",on],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/ConfirmDialog.vue"]]),rn=te({__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:a}){t();const e=p,c=a,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")),v=()=>{if(!i.value)return;i.value.querySelectorAll(".monaco-editor-container").forEach(R=>{const F=R.__monacoEditor;if(F&&typeof F.getValue=="function"){const $=F.getValue();d.value.set(R,$)}})},g=()=>{if(!i.value)return!1;const O=i.value.querySelectorAll(".monaco-editor-container");for(const R of O){const F=R.__monacoEditor;if(F&&typeof F.getValue=="function"){const $=F.getValue(),B=d.value.get(R);if(B===void 0||(F.getRawOptions?.()||{}).readOnly===!0)continue;if($!==B)return!0}}return!1},h=()=>{if(e.hasChanges!==void 0)return e.hasChanges;if(!i.value)return!1;if(g())return!0;const O=i.value.querySelectorAll("form");for(const F of O){const B=F.querySelectorAll("input, textarea, select");for(const D of B){const W=D;if(W.type==="checkbox"||W.type==="radio"){const U=W;if(U.checked!==U.defaultChecked)return!0}else if(W.tagName==="SELECT"){const U=W;if(U.value!==U.defaultValue)return!0}else if(W.value!==W.defaultValue)return!0}}const R=i.value.querySelectorAll("input:not(form input), textarea:not(form textarea), select:not(form select)");for(const F of R){const $=F;if($.type==="checkbox"||$.type==="radio"){const B=$;if(B.checked!==B.defaultChecked)return!0}else if($.tagName==="SELECT"){const B=$;if(B.value!==B.defaultValue)return!0}else if($.value!==$.defaultValue)return!0}return!1},f=()=>{u()&&h()?r.value=!0:k()},k=()=>{c("update:modelValue",!1),c("close")},x=()=>{r.value=!1,k()},w=()=>{r.value=!1},M=O=>{O.key==="Escape"&&e.modelValue&&(u()||k())};ae(()=>e.modelValue,async O=>{O?(document.addEventListener("keydown",M),document.body.style.overflow="hidden",await he(),setTimeout(()=>{v()},100)):(document.removeEventListener("keydown",M),document.body.style.overflow="",d.value.clear())});const b=m(!1),A={props:e,emit:c,modalRef:i,showConfirmDialog:r,monacoInitialValues:d,hasFormFields:u,captureMonacoInitialValues:v,hasMonacoChanges:g,hasUnsavedChanges:h,attemptClose:f,close:k,handleConfirmClose:x,handleCancelClose:w,handleKeydown:M,mouseDownOnBackdrop:b,handleBackdropMouseDown:O=>{b.value=O.target===O.currentTarget},handleBackdropClick:O=>{O.target===O.currentTarget&&b.value&&(u()||k()),b.value=!1},DropShadow:He,ConfirmDialog:zt,get IconX(){return Ft}};return Object.defineProperty(A,"__isScriptSetup",{enumerable:!1,value:!0}),A}}),an={class:"flex items-center justify-between p-4 border-b-2 border-black dark:border-neutral-300 flex-shrink-0"},nn={class:"text-xl font-bold"},ln={class:"overflow-y-auto flex-1"},sn={class:"p-6"},dn={key:0,class:"p-6 border-t-2 border-black dark:border-neutral-300 flex-shrink-0"};function cn(p,t,a,e,c,i){return n(),Y(it,{to:"body"},[C(De,{"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:re(()=>[a.modelValue?(n(),l("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(De,{"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:re(()=>[a.modelValue?(n(),l("div",{key:0,class:Q(["w-full",a.width,"max-h-[85vh] flex flex-col"])},[C(e.DropShadow,{"offset-x":12,"offset-y":12,intensity:.4},{default:re(()=>[o("div",{ref:"modalRef",class:Q(["bg-white dark:bg-black border-2 border-black dark:border-neutral-300 flex flex-col max-h-[85vh]",a.minHeight])},[s(" Header (fixed) "),o("div",an,[o("h2",nn,y(a.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"})])]),s(" Content (scrollable) "),o("div",ln,[o("div",sn,[Fe(p.$slots,"default")])]),s(" Footer (fixed, optional) "),p.$slots.footer?(n(),l("div",dn,[Fe(p.$slots,"footer")])):s("v-if",!0)],2)]),_:3})],2)):s("v-if",!0)]),_:3})],32)):s("v-if",!0)]),_:3}),s(" 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 je=ee(rn,[["render",cn],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/Modal.vue"]]),un=te({__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:a}){const e=p,c=a,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=h=>{const f=h.target;c("update:modelValue",f.value)},u=h=>{c("focus",h)},v=h=>{c("click",h)};t({inputRef:i});const g={props:e,emit:c,inputRef:i,inputClasses:r,handleInput:d,handleFocus:u,handleClick:v};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}}),pn={class:"space-y-1.5"},mn={key:0,class:"block text-sm font-medium text-neutral-700 dark:text-neutral-300"},fn={key:0,class:"text-red-500"},gn=["type","value","placeholder","disabled"],hn={key:1,class:"text-xs text-red-500 dark:text-red-400"};function vn(p,t,a,e,c,i){return n(),l("div",pn,[a.label?(n(),l("label",mn,[ve(y(a.label)+" ",1),a.required?(n(),l("span",fn,"*")):s("v-if",!0)])):s("v-if",!0),o("input",{ref:"inputRef",type:a.type,value:a.modelValue,placeholder:a.placeholder,disabled:a.disabled,class:Q(e.inputClasses),onInput:e.handleInput,onFocus:e.handleFocus,onClick:e.handleClick},null,42,gn),a.error?(n(),l("p",hn,y(a.error),1)):s("v-if",!0)])}const Ne=ee(un,[["render",vn],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/TextInput.vue"]]),bn=te({__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:a}){t();const e=p,c=a,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 v=u.target;c("update:modelValue",v.value)}};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}}),yn={class:"space-y-1"},xn={key:0,class:"block text-sm font-medium"},kn={key:0,class:"text-red-500"},_n=["value","placeholder","disabled","rows"],wn={key:1,class:"text-xs text-red-500 dark:text-red-400"};function Cn(p,t,a,e,c,i){return n(),l("div",yn,[a.label?(n(),l("label",xn,[ve(y(a.label)+" ",1),a.required?(n(),l("span",kn,"*")):s("v-if",!0)])):s("v-if",!0),o("textarea",{value:a.modelValue,placeholder:a.placeholder,disabled:a.disabled,rows:a.rows,class:Q(e.textareaClasses),onInput:e.handleInput},null,42,_n),a.error?(n(),l("p",wn,y(a.error),1)):s("v-if",!0)])}const Ht=ee(bn,[["render",Cn],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/TextareaInput.vue"]]),Sn=te({__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:a}){t();const e=p,c=a,i=m(!1),r=m(""),d=m(),u=m(),v=m(),g=m(),h=m(-1),f=z(()=>e.options.find(D=>D.value===e.modelValue)),k=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"]),x=z(()=>{if(!r.value)return e.options;const D=r.value.toLowerCase();return e.options.filter(W=>W.label.toLowerCase().includes(D)||W.value.toLowerCase().includes(D)||W.description&&W.description.toLowerCase().includes(D))});ae(x,()=>{h.value=-1});const w=()=>{e.disabled||(i.value?S():(i.value=!0,r.value="",h.value=-1,he(()=>{if(g.value&&(g.value.setAttribute("popover","auto"),g.value.addEventListener("toggle",$),"showPopover"in g.value))try{g.value.showPopover()}catch{}T(),setTimeout(()=>d.value?.focus(),0)})))},M=D=>{c("update:modelValue",D.value),S(),r.value="",h.value=-1},b=D=>{D.stopPropagation(),c("update:modelValue","")},S=()=>{if(g.value){if("hidePopover"in g.value)try{g.value.hidePopover()}catch{}g.value.removeEventListener("toggle",$)}i.value=!1,h.value=-1},T=()=>{if(!v.value||!g.value)return;const D=v.value.getBoundingClientRect();g.value.offsetWidth||D.width,g.value.style.position="fixed",g.value.style.top=`${D.bottom+8}px`,g.value.style.left=`${D.left}px`,g.value.style.width=`${D.width}px`,g.value.style.margin="0"},A=D=>{u.value&&!u.value.contains(D.target)&&g.value&&!g.value.contains(D.target)&&S()},O=D=>{D.key==="Escape"&&i.value&&(S(),v.value?.focus())},R=D=>{if(!i.value)return;const W=x.value;if(W.length!==0)switch(D.key){case"ArrowDown":D.preventDefault(),h.value=h.value<W.length-1?h.value+1:0,F();break;case"ArrowUp":D.preventDefault(),h.value=h.value>0?h.value-1:W.length-1,F();break;case"Enter":D.preventDefault(),h.value>=0&&h.value<W.length&&M(W[h.value]);break}},F=()=>{he(()=>{const D=g.value?.querySelector(".highlighted-option");D&&D.scrollIntoView({block:"nearest",behavior:"smooth"})})},$=D=>{D.target===g.value&&(i.value=D.newState==="open",i.value&&T())};ge(()=>{document.addEventListener("click",A),document.addEventListener("keydown",O);const D=()=>{i.value&&T()};window.addEventListener("resize",D),window.addEventListener("scroll",D,!0)}),Ae(()=>{document.removeEventListener("click",A),document.removeEventListener("keydown",O),window.removeEventListener("resize",T),window.removeEventListener("scroll",T,!0)});const B={props:e,emit:c,isOpen:i,searchQuery:r,searchInput:d,dropdownRef:u,buttonRef:v,popoverRef:g,highlightedIndex:h,selectedOption:f,buttonClasses:k,filteredOptions:x,toggleDropdown:w,selectOption:M,clearValue:b,closePopover:S,positionPopover:T,handleClickOutside:A,handleEscape:O,handleKeyDown:R,scrollToHighlighted:F,handlePopoverToggle:$,DropShadow:He};return Object.defineProperty(B,"__isScriptSetup",{enumerable:!1,value:!0}),B}}),Tn={ref:"dropdownRef",class:"relative"},Mn={key:0,class:"block text-sm font-medium mb-2"},In={key:0,class:"text-red-500"},Vn=["disabled","aria-expanded"],An={class:"flex items-center justify-between gap-1"},Pn={key:0,class:"flex items-center gap-2 text-neutral-400 flex-1 min-w-0"},Ln={key:1,class:"flex items-center gap-2 flex-1 min-w-0"},En=["src","alt"],jn={class:"block truncate"},On={key:2,class:"block truncate text-neutral-400 flex-1 min-w-0"},Dn={key:1,ref:"popoverRef",class:"dropdown-popover"},qn={class:"bg-white dark:bg-black border-2 border-black dark:border-neutral-300 rounded-lg overflow-hidden"},Un={class:"p-2 border-b border-neutral-200 dark:border-neutral-700"},Bn=["placeholder"],Nn={class:"max-h-60 overflow-y-auto"},Rn={key:0,class:"px-4 py-3 text-sm text-neutral-500 dark:text-neutral-400"},Fn=["onClick","onMouseenter"],zn={class:"flex-shrink-0 w-5 h-5 mt-0.5"},Hn=["src","alt"],Wn={key:1,class:"w-full h-full bg-neutral-200 dark:bg-neutral-700 rounded"},Jn={class:"flex-1 min-w-0"},Kn={class:"text-sm font-medium text-black dark:text-white"},Zn={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},Gn={key:2,class:"mt-1 text-xs text-red-500 dark:text-red-400"};function Xn(p,t,a,e,c,i){return n(),l("div",Tn,[a.label?(n(),l("label",Mn,[ve(y(a.label)+" ",1),a.required?(n(),l("span",In,"*")):s("v-if",!0)])):s("v-if",!0),o("button",{ref:"buttonRef",type:"button",onClick:e.toggleDropdown,disabled:a.disabled,"aria-expanded":e.isOpen,"aria-haspopup":!0,class:Q(e.buttonClasses)},[o("div",An,[a.loading?(n(),l("span",Pn,[...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),ve(" Loading... ",-1)])])):e.selectedOption?(n(),l("span",Ln,[e.selectedOption.icon?(n(),l("img",{key:0,src:e.selectedOption.icon,alt:e.selectedOption.label,class:"w-5 h-5 flex-shrink-0"},null,8,En)):s("v-if",!0),o("span",jn,y(e.selectedOption.label),1)])):(n(),l("span",On,y(a.placeholder),1)),s(" Clear button (only shown when value is selected) "),e.selectedOption&&!a.disabled?(n(),l("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)])])):s("v-if",!0),s(" 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,Vn),s(" Popover dropdown "),e.isOpen?(n(),l("div",Dn,[C(e.DropShadow,{"offset-x":4,"offset-y":4,intensity:.3},{default:re(()=>[o("div",qn,[o("div",Un,[ye(o("input",{ref:"searchInput","onUpdate:modelValue":t[0]||(t[0]=r=>e.searchQuery=r),type:"text",placeholder:a.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,Bn),[[Me,e.searchQuery]])]),o("div",Nn,[e.filteredOptions.length===0?(n(),l("div",Rn," No options found ")):s("v-if",!0),(n(!0),l(G,null,ue(e.filteredOptions,(r,d)=>(n(),l("button",{key:r.value,type:"button",onClick:u=>e.selectOption(r),onMouseenter:u=>e.highlightedIndex=d,class:Q(["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===a.modelValue,"bg-neutral-100 dark:bg-neutral-800 highlighted-option":d===e.highlightedIndex}])},[o("div",zn,[r.icon?(n(),l("img",{key:0,src:r.icon,alt:r.label,class:"w-full h-full"},null,8,Hn)):(n(),l("div",Wn))]),o("div",Jn,[o("div",Kn,y(r.label),1),r.description?(n(),l("div",Zn,y(r.description),1)):s("v-if",!0)])],42,Fn))),128))])])]),_:1})],512)):s("v-if",!0),a.error?(n(),l("p",Gn,y(a.error),1)):s("v-if",!0)],512)}const Se=ee(Sn,[["render",Xn],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/SelectInput.vue"]]),Yn=te({__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:a}){t();const e=p,c=a,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:v=>{if(!e.disabled){const g=v.target;c("update:modelValue",g.checked)}}};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),Qn={class:"flex items-start"},$n=["for"],el=["id","checked","disabled"],tl={class:"flex items-center h-5"},ol={class:"flex-1"},rl={key:0,class:"text-red-500"},al={key:1,class:"text-xs text-neutral-600 dark:text-neutral-400 mt-1"},nl={key:2,class:"text-xs text-red-500 dark:text-red-400 mt-1"};function ll(p,t,a,e,c,i){return n(),l("div",Qn,[o("label",{for:e.checkboxId,class:Q(["flex items-start space-x-3 cursor-pointer select-none",{"cursor-not-allowed":a.disabled}])},[o("input",{id:e.checkboxId,type:"checkbox",checked:a.modelValue,disabled:a.disabled,onChange:e.handleChange,class:"absolute left-[-9999px]"},null,40,el),o("div",tl,[o("span",{class:Q(e.decoratorClasses)},null,2)]),o("div",ol,[a.label?(n(),l("span",{key:0,class:Q(["block text-sm font-medium",{"opacity-50":a.disabled}])},[ve(y(a.label)+" ",1),a.required?(n(),l("span",rl,"*")):s("v-if",!0)],2)):s("v-if",!0),a.helpText?(n(),l("p",al,y(a.helpText),1)):s("v-if",!0),a.error?(n(),l("p",nl,y(a.error),1)):s("v-if",!0)])],10,$n)])}const et=ee(Yn,[["render",ll],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/CheckboxInput.vue"]]),sl=te({__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:a}){t();const e=p,c=a,i=z(()=>e.mode==="edit"),r=m(!1),d=m(""),u=m(""),v=m(""),g=m(null),h=m(""),f=m("dual_ai"),k=m(!1),x=m(""),w=m(""),M=m(null),b=m(""),S=m(""),T=m(""),A=m(""),O=m(!0),R=m(!1),F=m(""),$=m(""),B=m(""),D=m(""),W=m(!1),U=m(null),P=m(""),H=m(""),K=m(""),j=m(""),L=m(""),V=m(""),q=m(!0),_=m(!1),I=m(""),E=m(""),N=m(""),ie=m(""),pe=m(null),J=m(""),le=m(""),Z=m(""),{data:ne,execute:se}=we(X("/api/prompts"),{immediate:!1}).json(),{data:de,execute:fe}=we(X("/api/tools?schema=true"),{immediate:!1}).json(),be=m(null),Te=m(!1),_e=m(null),Oe=m(!1),Pe=m(!1),Xt=z(()=>{if(!ne.value)return[{value:"",label:"Select a prompt..."}];const oe=ne.value?.prompts||[];return[{value:"",label:"None"},...oe.map(ce=>({value:ce.id,label:ce.name}))]}),tt=oe=>de.value?de.value[oe]:null,Yt=z(()=>!be.value||!be.value.tools?[{value:"",label:"None"}]:[{value:"",label:"None"},...be.value.tools.map(oe=>{const ce=typeof oe=="string"?oe:oe.name;return{value:ce,label:ce}})]),Qt=z(()=>!_e.value||!_e.value.tools?[{value:"",label:"None"}]:[{value:"",label:"None"},..._e.value.tools.map(oe=>{const ce=typeof oe=="string"?oe:oe.name;return{value:ce,label:ce}})]),$t=z(()=>{if(!F.value)return[];const oe=tt(F.value);return!oe||!oe.schema||!oe.schema.properties?[]:Object.keys(oe.schema.properties).map(ce=>({value:ce,label:ce}))}),eo=z(()=>{if(!I.value)return[];const oe=tt(I.value);return!oe||!oe.schema||!oe.schema.properties?[]:Object.keys(oe.schema.properties).map(ce=>({value:ce,label:ce}))}),to=[{value:"dual_ai",label:"AI + AI (Subagent)"},{value:"ai_human",label:"AI + Human"}],oo=z({get(){return u.value},set(oe){const ce=g.value?.inputRef,me=ce?.selectionStart??oe.length;let Ie=oe.toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"");if(Ie.endsWith("_agent")||(Ie=Ie+"_agent"),u.value=Ie,ce){ce.value=Ie;const Ce=Math.min(me,Ie.length-6);ce.setSelectionRange(Ce,Ce)}}}),ro=async()=>{await he();const oe=g.value?.inputRef;if(oe&&u.value.endsWith("_agent")){const ce=u.value.length-6;oe.setSelectionRange(ce,ce)}},gt=oe=>!oe||oe==="_agent"?(v.value="Name is required",!1):/^[a-z][a-z0-9_]*_agent$/.test(oe)?(v.value="",!0):(v.value="Name must start with a letter",!1),Ke=()=>{u.value="",d.value="",v.value="",h.value="",f.value="dual_ai",k.value=!1,x.value="",w.value="",M.value=null,b.value="",T.value="",A.value="",O.value=!0,R.value=!1,F.value="",$.value="",B.value="",D.value="",W.value=!1,U.value=null,P.value="",H.value="",K.value="",be.value=null,L.value="",V.value="",q.value=!0,_.value=!1,I.value="",E.value="",N.value="",ie.value="",pe.value=null,J.value="",le.value="",Z.value="",_e.value=null},ht=async()=>{if(e.editAgent?.id){r.value=!0,Pe.value=!0;try{const oe=await fetch(X(`/api/agents/${e.editAgent.id}`));if(oe.ok){const ce=await oe.json(),me=ce.agent||ce;u.value=me.name||"",d.value=me.name||"",h.value=me.title||"",f.value=me.type||"dual_ai",k.value=me.expose_as_tool||!1,x.value=me.tool_description||"",M.value=me.max_session_turns;const Ie=me.side_a_stop_tool||"",Ce=me.side_a_stop_tool_response_property||"",lo=me.side_b_stop_tool||"",so=me.side_b_stop_tool_response_property||"",io=me.side_a_end_conversation_tool||"",co=me.side_b_end_conversation_tool||"";S.value=me.side_a_label||"",j.value=me.side_b_label||"",T.value=me.side_a_agent_prompt||"",L.value=me.side_b_agent_prompt||"",O.value=!!me.side_a_stop_on_response,R.value=!!me.side_a_stop_tool,W.value=!!me.side_a_manual_stop_condition,U.value=me.side_a_max_turns,q.value=!!me.side_b_stop_on_response,_.value=!!me.side_b_stop_tool,pe.value=me.side_b_max_turns,await he(),F.value=Ie,B.value=Ce,I.value=lo,N.value=so,H.value=io,le.value=co}}catch(oe){console.error("Error loading agent data:",oe)}finally{r.value=!1,Pe.value=!1}}},ao=async()=>{v.value="",b.value="",A.value="",$.value="",D.value="",P.value="",K.value="",V.value="",E.value="",ie.value="",J.value="",Z.value="";let oe=!1;gt(u.value)||(oe=!0);const ce=u.value;f.value==="dual_ai"&&M.value!==null&&M.value!==void 0&&M.value<=0&&(b.value="Max session turns must be a positive number",oe=!0),T.value||(A.value="Please select an agent prompt",oe=!0);const me=O.value||F.value,Ie=f.value==="ai_human"&&W.value;if(!me&&!Ie&&(A.value="At least one stop condition is required (or check manual stop condition for ai_human agents)",oe=!0),F.value&&!B.value&&(D.value="Response property required when using stop tool",oe=!0),U.value!==null&&U.value<=0&&(P.value="Max turns must be a positive number",oe=!0),f.value==="dual_ai"&&!H.value&&!le.value&&(K.value="At least one side must have an end conversation tool",Z.value="At least one side must have an end conversation tool",oe=!0),f.value==="dual_ai"&&(L.value||(V.value="Please select an agent prompt",oe=!0),I.value&&!N.value&&(ie.value="Response property required when using stop tool",oe=!0),pe.value!==null&&pe.value<=0&&(J.value="Max turns must be a positive number",oe=!0)),oe)return;const Ce={name:ce,title:h.value||null,type:f.value,expose_as_tool:k.value,tool_description:k.value?x.value:null,max_session_turns:f.value==="dual_ai"?M.value:null,side_a_label:S.value||null,side_a_agent_prompt:T.value,side_a_stop_on_response:O.value,side_a_stop_tool:F.value||null,side_a_stop_tool_response_property:B.value||null,side_a_manual_stop_condition:W.value,side_a_max_turns:U.value,side_a_end_conversation_tool:H.value||null};f.value==="dual_ai"&&(Ce.side_b_label=j.value||null,Ce.side_b_agent_prompt=L.value,Ce.side_b_stop_on_response=q.value,Ce.side_b_stop_tool=I.value||null,Ce.side_b_stop_tool_response_property=N.value||null,Ce.side_b_max_turns=pe.value,Ce.side_b_end_conversation_tool=le.value||null),i.value&&e.editAgent?.id&&(Ce.id=e.editAgent.id),c("save",Ce),Ke(),c("update:modelValue",!1)},no=()=>{Ke(),c("update:modelValue",!1)};ae(T,async oe=>{if(Pe.value||(F.value="",B.value=""),!oe){be.value=null;return}Te.value=!0;try{const ce=await fetch(X(`/api/prompts/${oe}`));ce.ok&&(be.value=await ce.json())}catch(ce){console.error("Error fetching Side A prompt:",ce)}finally{Te.value=!1}}),ae(L,async oe=>{if(Pe.value||(I.value="",N.value=""),!oe){_e.value=null;return}Oe.value=!0;try{const ce=await fetch(X(`/api/prompts/${oe}`));ce.ok&&(_e.value=await ce.json())}catch(ce){console.error("Error fetching Side B prompt:",ce)}finally{Oe.value=!1}}),ae(R,oe=>{oe||(F.value="",B.value="")}),ae(_,oe=>{oe||(I.value="",N.value="")}),ae(()=>e.modelValue,async oe=>{oe&&(await Promise.all([se(),fe()]),i.value?(Ke(),await ht()):Ke())});const vt={props:e,emit:c,isEditMode:i,isLoading:r,originalName:d,name:u,nameError:v,nameInputRef:g,title:h,agentType:f,exposeAsTool:k,toolDescription:x,toolDescriptionError:w,maxSessionTurns:M,maxSessionTurnsError:b,sideALabel:S,sideAAgentPrompt:T,sideAAgentPromptError:A,sideAStopOnResponse:O,sideAStopOnToolCall:R,sideAStopTool:F,sideAStopToolError:$,sideAStopToolResponseProperty:B,sideAStopToolResponsePropertyError:D,sideAManualStopCondition:W,sideAMaxTurns:U,sideAMaxTurnsError:P,sideAEndConversationTool:H,sideAEndConversationToolError:K,sideBLabel:j,sideBAgentPrompt:L,sideBAgentPromptError:V,sideBStopOnResponse:q,sideBStopOnToolCall:_,sideBStopTool:I,sideBStopToolError:E,sideBStopToolResponseProperty:N,sideBStopToolResponsePropertyError:ie,sideBMaxTurns:pe,sideBMaxTurnsError:J,sideBEndConversationTool:le,sideBEndConversationToolError:Z,promptsData:ne,fetchPrompts:se,toolsData:de,fetchTools:fe,sideAPromptData:be,sideAPromptLoading:Te,sideBPromptData:_e,sideBPromptLoading:Oe,isLoadingAgentData:Pe,promptOptions:Xt,getToolByName:tt,sideAToolOptions:Yt,sideBToolOptions:Qt,sideAResponsePropertyOptions:$t,sideBResponsePropertyOptions:eo,agentTypeOptions:to,agentName:oo,handleNameFocus:ro,validateAgentName:gt,resetForm:Ke,loadAgentData:ht,handleSubmit:ao,handleCancel:no,Modal:je,TextInput:Ne,TextareaInput:Ht,SelectInput:Se,CheckboxInput:et};return Object.defineProperty(vt,"__isScriptSetup",{enumerable:!1,value:!0}),vt}}),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},fl={key:0,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},gl={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={"data-testid":"side-a-container",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={"data-testid":"side-b-container",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"},Al={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"},Ll={class:"space-y-3"},El={class:"flex items-start"},jl={key:0,class:"ml-8 mt-2 space-y-2"},Ol={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"},Nl=["disabled"];function Rl(p,t,a,e,c,i){return n(),Y(e.Modal,{"model-value":a.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:re(()=>[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},y(e.isEditMode?"Update Agent":"Create Agent"),9,Nl)])]),default:re(()=>[e.isLoading?(n(),l("div",il,[...t[24]||(t[24]=[o("span",{class:"text-neutral-500"},"Loading agent data...",-1)])])):(n(),l("div",dl,[s(" 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?(n(),l("p",cl," Names are automatically formatted to snake_case with the _agent suffix ")):s("v-if",!0),e.isEditMode?(n(),l("p",ul," Agent names cannot be changed after creation (used as foreign key for threads) ")):s("v-if",!0)]),s(" 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))]),s(" 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))]),s(" Expose as Tool (only for dual_ai agents) "),e.agentType==="dual_ai"?(n(),l("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))])):s("v-if",!0),s(" Tool Description (only show if expose_as_tool is checked and agent is dual_ai) "),e.exposeAsTool&&e.agentType==="dual_ai"?(n(),l("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?s("v-if",!0):(n(),l("p",fl," This description helps other agents understand when to use this agent "))])):s("v-if",!0),s(" Max Session Turns (only show for dual_ai) "),e.agentType==="dual_ai"?(n(),l("div",gl,[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?s("v-if",!0):(n(),l("p",hl," Maximum number of back-and-forth exchanges between the two agents before the conversation ends "))])):s("v-if",!0),s(" Two Column Layout for both sides "),o("div",vl,[s(" 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)),s(" 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))]),s(" 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?s("v-if",!0):(n(),l("p",yl," The prompt that defines this agent's behavior "))]),s(" 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)),s(" 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)),s(" 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?(n(),l("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?s("v-if",!0):(n(),l("p",wl," Agent stops when this tool is called ")),e.sideAStopTool?(n(),l("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))])):s("v-if",!0)])):s("v-if",!0)]),s(" Manual Stop Condition (only for ai_human when both stop conditions are unchecked) "),e.agentType==="ai_human"&&!e.sideAStopOnResponse&&!e.sideAStopOnToolCall?(n(),l("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))])):s("v-if",!0)]),s(" 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?s("v-if",!0):(n(),l("p",Tl," Maximum turns this side can take before yielding (safety limit) "))]),s(" 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?s("v-if",!0):(n(),l("p",Ml," Tool that ends the entire conversation when called "))])]),s(" Side B (AI or Human) "),o("div",Il,[o("h4",Vl," Side B ("+y(e.agentType==="ai_human"?"Human":"AI")+") ",1),s(" 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"?(n(),l("div",Al,[...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)])])):(n(),l(G,{key:1},[s(" 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?s("v-if",!0):(n(),l("p",Pl," The prompt that defines this agent's behavior "))]),s(" Stop Conditions "),o("div",Ll,[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)),s(" 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)),s(" 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?(n(),l("div",jl,[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?s("v-if",!0):(n(),l("p",Ol," Agent stops when this tool is called ")),e.sideBStopTool?(n(),l("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))])):s("v-if",!0)])):s("v-if",!0)])]),s(" 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?s("v-if",!0):(n(),l("p",ql," Maximum turns this side can take before yielding (safety limit) "))]),s(" 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?s("v-if",!0):(n(),l("p",Ul," Tool that ends the entire conversation when called "))])],64))])])]))]),_:1},8,["model-value","title"])}const Fl=ee(sl,[["render",Rl],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/AgentModal.vue"]]),zl={},Hl={class:"p-8 w-full max-w-7xl mx-auto"};function Wl(p,t){return n(),l("div",Hl,[Fe(p.$slots,"default")])}const Re=ee(zl,[["render",Wl],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/CenteredContentView.vue"]]),Jl=te({__name:"AgentsView",setup(p,{expose:t}){t();const a=ze(),e=qe(),c=m(!1),i=m("add"),r=m(null),d=m(null);ae(()=>e.query.refresh,()=>{e.query.refresh&&(d.value?.refresh(),a.replace({path:"/agents",query:{}}))});const h={router:a,route:e,showModal:c,modalMode:i,editingAgent:r,dataTableRef:d,handleAdd:()=>{i.value="add",r.value=null,c.value=!0},handleEdit:f=>{i.value="edit",r.value=f,c.value=!0},handleSave:async f=>{try{const k=i.value==="edit"&&r.value?.id,{originalName:x,...w}=f,M=X(k?`/api/agents/${r.value.id}`:"/api/agents"),S=await fetch(M,{method:k?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(S.ok)d.value?.refresh(),c.value=!1,r.value=null;else{const T=await S.json();alert(T.error||`Failed to ${k?"update":"create"} agent`)}}catch(k){console.error(`Error ${i.value==="edit"?"updating":"creating"} agent:`,k),alert(`Failed to ${i.value==="edit"?"update":"create"} agent`)}},AgentsDataTable:Ja,AgentModal:Fl,CenteredContentView:Re};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}});function Kl(p,t,a,e,c,i){return n(),Y(e.CenteredContentView,null,{default:re(()=>[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=ee(Jl,[["render",Kl],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/AgentsView.vue"]]);function Gl(p){const{limit:t=50,offset:a=0,agentId:e=null,userId:c=null,autoFetch:i=!0}={},r=z(()=>{const M=new URLSearchParams,b=typeof t=="number"?t:t.value,S=typeof a=="number"?a:a.value,T=typeof e=="string"?e:e?.value,A=typeof c=="string"?c:c?.value;return M.append("limit",b.toString()),M.append("offset",S.toString()),T&&M.append("agent_id",T),A&&M.append("user_id",A),X(`/api/threads?${M.toString()}`)}),{data:d,error:u,isFetching:v,isFinished:g,execute:h,abort:f}=we(r,{immediate:i}).get().json(),k=z(()=>d.value?.threads||[]),x=z(()=>d.value?.total||0),w=z(()=>d.value?.hasMore||!1);return{threads:k,total:x,hasMore:w,error:u,isFetching:v,isFinished:g,refetch:h,abort:f}}function ct(p){const t=z(()=>!!(typeof p=="string"?p:p?.value)),a=z(()=>{const g=typeof p=="string"?p:p?.value;return X(g?`/api/threads/${g}`:"/api/threads/placeholder")}),{data:e,error:c,isFetching:i,isFinished:r,execute:d,abort:u}=we(a,{immediate:!1}).get().json();return ae(t,g=>{g&&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:a}=p||{},e=m(null),c=m(!1),i=m(null),r=()=>{e.value&&e.value.close();const u=window.location.protocol==="https:"?"wss:":"ws:",v=window.location.host;let g=`${u}//${v}${X("/api/events")}`;const h=localStorage.getItem("auth_token");h&&(g+=`?token=${encodeURIComponent(h)}`);try{e.value=new WebSocket(g),e.value.onopen=()=>{c.value=!0,i.value=null,console.log("[AgentBuilderEvents] WebSocket connected")},e.value.onmessage=f=>{try{const k=JSON.parse(f.data);console.log("[AgentBuilderEvents] Received event:",k.type),a&&a(k)}catch(k){console.error("[AgentBuilderEvents] Failed to parse WebSocket message:",k)}},e.value.onerror=f=>{i.value="WebSocket connection error",c.value=!1,console.error("[AgentBuilderEvents] WebSocket error:",f)},e.value.onclose=()=>{c.value=!1,console.log("[AgentBuilderEvents] WebSocket disconnected")}}catch(f){i.value=f.message||"Failed to create WebSocket",console.error("[AgentBuilderEvents] WebSocket creation error:",f)}},d=()=>{e.value&&(e.value.close(),e.value=null,c.value=!1)};return t&&r(),Ae(()=>{d()}),{wsConnected:c,wsError:i,connect:r,disconnect:d}}const Yl=te({__name:"Loader",props:{size:{type:String,required:!1,default:"md"}},setup(p,{expose:t}){t();const a=p,e=z(()=>{switch(a.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:a,sizeClasses:e};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}}),Ql={class:"inline-flex items-center justify-center"};function $l(p,t,a,e,c,i){return n(),l("div",Ql,[o("div",{class:Q([e.sizeClasses,"border-black/20 dark:border-white/20 border-t-black dark:border-t-white rounded-full animate-spin"])},null,2)])}const Je=ee(Yl,[["render",$l],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/Loader.vue"]]);function es(p){const a=Date.now()*1e3-p,e=Math.floor(a/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 a=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);a!==null&&(clearInterval(a),a=null),u<60?a=setInterval(c,1e3):u<3600?a=setInterval(c,6e4):u<86400&&(a=setInterval(c,6e5))};return c(),Ae(()=>{a!==null&&clearInterval(a)}),t}const os=te({__name:"TimeAgo",props:{timestamp:{type:Number,required:!0}},setup(p,{expose:t}){t();const a=p,e=ts(()=>a.timestamp),c={props:a,timeString:e};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}});function rs(p,t,a,e,c,i){return n(),l("span",null,y(e.timeString),1)}const ut=ee(os,[["render",rs],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/TimeAgo.vue"]]),as=te({__name:"StatusDot",props:{connected:{type:Boolean,required:!0},error:{type:Boolean,required:!1}},setup(p,{expose:t}){t();const a=m(!1),e=m(null),c={showPopover:a,popoverRef:e};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}}),ns={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,a,e,c,i){return n(),l("div",ns,[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)},[a.connected?(n(),l("span",ls)):a.error?(n(),l("span",ss)):(n(),l("span",is))],32),s(" Popover "),C(De,{"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:re(()=>[e.showPopover?(n(),l("div",{key:0,ref:"popoverRef",class:Q(["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":a.connected,"bg-red-50 dark:bg-red-950 border-red-200 dark:border-red-800 text-red-700 dark:text-red-300":!a.connected&&a.error,"bg-neutral-50 dark:bg-neutral-900 border-neutral-200 dark:border-neutral-700 text-neutral-600 dark:text-neutral-400":!a.connected&&!a.error}])},[a.connected?(n(),l("span",ds,"Live - Connected")):a.error?(n(),l("span",cs,"Connection Error")):(n(),l("span",us,"Offline"))],2)):s("v-if",!0)]),_:1})])}const pt=ee(as,[["render",ps],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/StatusDot.vue"]]),ms=te({__name:"ThreadListPane",props:{selectedThreadId:{type:[String,null],required:!0}},emits:["selectThread","collapse","createThread","threadsLoaded"],setup(p,{expose:t,emit:a}){const e=p,c=a,i=m(""),{threads:r,isFetching:d,isFinished:u,error:v,refetch:g}=Gl(),h=m([]),f=m(new Set),k=z(()=>{const A=r.value.filter(F=>!f.value.has(F.id)),O=new Set(A.map(F=>F.id));return[...h.value.filter(F=>!O.has(F.id)&&!f.value.has(F.id)),...A].sort((F,$)=>$.created_at-F.created_at)}),x=async A=>{if(A.type==="thread_created"){const O={id:A.thread.id,agent_id:A.thread.agent_name,user_id:A.thread.user_id,tags:A.thread.tags||[],created_at:A.thread.created_at,agent:{title:A.thread.agent_name,type:"ai_human"}};h.value.unshift(O)}else A.type==="thread_deleted"&&(f.value.add(A.threadId),h.value=h.value.filter(O=>O.id!==A.threadId))},{wsConnected:w,wsError:M}=Xl({onEvent:x});ae(r,()=>{h.value=[]});const b=m(!1);ae(()=>({threads:r.value,finished:u.value}),({threads:A,finished:O})=>{O&&!b.value&&(b.value=!0,c("threadsLoaded",A[0]?.id??null))},{immediate:!0}),t({refetch:g});const T={props:e,emit:c,searchQuery:i,fetchedThreads:r,isFetching:d,isFinished:u,error:v,refetch:g,wsAddedThreads:h,wsRemovedThreadIds:f,threads:k,handleEvent:x,wsConnected:w,wsError:M,hasEmittedLoaded:b,handleThreadClick:A=>{c("selectThread",A)},Loader:Je,TimeAgo:ut,StatusDot:pt,get ListIcon(){return Vt},get ChevronLeftIcon(){return dt}};return Object.defineProperty(T,"__isScriptSetup",{enumerable:!1,value:!0}),T}}),fs={class:"flex flex-col flex-1"},gs={class:"p-4 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,a,e,c,i){return n(),l("div",fs,[s(" Header (matches MessagesPane style) "),o("div",gs,[o("div",hs,[o("div",vs,[C(e.ListIcon,{size:20,class:"shrink-0"}),t[2]||(t[2]=o("h2",{class:"text-xl 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})])])])]),s(" Thread list "),o("div",ys,[s(" Loading state "),e.isFetching?(n(),l("div",xs,[C(e.Loader)])):e.error?(n(),l(G,{key:1},[s(" Error state "),o("div",ks," Error: "+y(e.error),1)],2112)):e.threads.length===0?(n(),l(G,{key:2},[s(" 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)):(n(),l(G,{key:3},[s(" Thread items - two line layout "),o("div",null,[(n(!0),l(G,null,ue(e.threads,r=>(n(),l("button",{key:r.id,id:`thread-${r.id}`,class:Q(["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":a.selectedThreadId===r.id}]),onClick:d=>e.handleThreadClick(r.id)},[s(" First line: Title and time "),o("div",ws,[o("span",Cs,y(r.agent.title),1),o("span",Ss,[C(e.TimeAgo,{timestamp:r.created_at*1e6},null,8,["timestamp"])])]),s(" Second line: Tags "),r.tags.length>0?(n(),l("div",Ts,[(n(!0),l(G,null,ue(r.tags,d=>(n(),l("span",{key:d,class:"inline-block px-1.5 py-0.5 rounded text-[10px] bg-neutral-200 dark:bg-neutral-800 text-neutral-700 dark:text-neutral-300"},y(d),1))),128))])):s("v-if",!0)],10,_s))),128))])],2112))])])}const Is=ee(ms,[["render",Ms],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/ThreadListPane.vue"]]),Ze=150;function Vs(p,t={}){const{enableWebSocket:a=!0,autoConnect:e=!0}=t,c=m([]),i=m(null),r=m(!1),d=m(!1),u=m(null),v=m(!1),g=m(null),h=m(!1),f=m(!1),k=m(0),x=m(0);let w=null,M=null;function b(P){if(!i.value?.agent)return null;const H=i.value.agent,K=P==="assistant"?"A":"B";return K==="A"&&H.side_a_label?H.side_a_label:K==="B"&&H.side_b_label?H.side_b_label:null}function S(P,H){return P==="system"||H==="system"?!1:P!==H}const T=z(()=>{const P=[],H=c.value.filter(L=>(L.depth??0)===0),K=new Map;for(let L=0;L<H.length;L++){const V=H[L],q=V.role;if(q==="tool"){const J=V.tool_call_id;if(J&&K.has(J)){const le=K.get(J),Z=P[le],ne=Z.items.find(se=>se.type==="tool_call"&&se.tool_call_id===J);if(ne){ne.response=V.content||"",ne.response_log_id=V.log_id;const se=(V.content||"").toLowerCase(),de=se.length,fe=se.includes("failed")||se.includes("error"),be=de<500;fe&&be?ne.response_status="failed":ne.response_status="success"}Z.updated_at=V.created_at,K.delete(J)}continue}const _=b(q==="tool"?"assistant":q),I=P[P.length-1],E=I?.role;I&&S(q,E)&&I.type==="work"&&!I.isComplete&&(I.isComplete=!0);let N=null;if(V.tool_calls)if(typeof V.tool_calls=="string")try{N=JSON.parse(V.tool_calls)}catch(J){console.error("Failed to parse tool_calls:",J)}else Array.isArray(V.tool_calls)&&(N=V.tool_calls);const ie=N&&N.length>0,pe=I?.type==="work"&&I.role===q&&!I.isComplete;if(ie){let J,le;pe?(J=I,le=P.length-1):(J={type:"work",id:V.id,role:q,items:[],created_at:V.created_at,updated_at:V.created_at,isComplete:!1,sideLabel:_,isExpanded:!1,request_sent_at:V.request_sent_at,response_completed_at:V.response_completed_at,status:V.status||"completed"},P.push(J),le=P.length-1),V.reasoning_content&&J.items.push({id:`${V.id}-reasoning`,type:"reasoning",content:V.reasoning_content,created_at:V.created_at,log_id:V.log_id}),V.content&&J.items.push({id:`${V.id}-content`,type:"content",content:V.content,created_at:V.created_at,log_id:V.log_id}),N.forEach(Z=>{J.items.push({id:Z.id,type:"tool_call",content:Z.function.name,created_at:V.created_at,tool_name:Z.function.name,tool_call_id:Z.id,tool_arguments:Z.function.arguments,log_id:V.log_id,response:null,response_status:"pending",response_log_id:null}),K.set(Z.id,le)}),J.updated_at=V.created_at,V.response_completed_at&&(J.response_completed_at=V.response_completed_at),V.status&&V.status!=="completed"?J.status=V.status:V.status==="completed"&&J.status==="pending"&&(J.status="completed")}else pe&&V.status!=="pending"&&(I.isComplete=!0),(V.content||q==="system"||V.status==="pending")&&P.push({type:"text",id:V.id,role:q,content:V.content||"",created_at:V.created_at,log_id:V.log_id,sideLabel:_,isOptimistic:V.isOptimistic,status:V.status})}const j=P[P.length-1];return j?.type==="work"&&!j.isComplete&&(j.isComplete=!0),P});async function A(){if(!p.value){c.value=[],i.value=null,f.value=!1,k.value=0,x.value=0;return}r.value=!0,u.value=null;try{const P=await fetch(X(`/api/threads/${p.value}/messages?limit=${Ze}&includeSilent=true`));if(!P.ok)throw new Error(`Failed to fetch messages: ${P.statusText}`);const H=await P.json();c.value=H.messages||[],f.value=H.hasMore||!1,k.value=H.total||0,x.value=Ze,console.log(`Loaded ${c.value.length} messages, total: ${k.value}, hasMore: ${f.value}`);const K=await fetch(X(`/api/threads/${p.value}`));if(K.ok){const j=await K.json();i.value=j}}catch(P){u.value=P instanceof Error?P.message:"Unknown error",console.error("Error fetching messages:",P)}finally{r.value=!1}}async function O(){if(!(!p.value||d.value||!f.value)){d.value=!0;try{const P=await fetch(X(`/api/threads/${p.value}/messages?limit=${Ze}&offset=${x.value}`));if(!P.ok)throw new Error(`Failed to fetch more messages: ${P.statusText}`);const H=await P.json(),K=H.messages||[];c.value=[...K,...c.value],f.value=H.hasMore||!1,x.value+=Ze,console.log(`Loaded ${K.length} more messages, offset now: ${x.value}, hasMore: ${f.value}`)}catch(P){u.value=P instanceof Error?P.message:"Unknown error",console.error("Error loading more messages:",P)}finally{d.value=!1}}}function R(){if(!(!a||!p.value||w))try{let H=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${X(`/api/threads/${p.value}/stream?includeSilent=true`)}`;const K=localStorage.getItem("auth_token");K&&(H+=`&token=${encodeURIComponent(K)}`),w=new WebSocket(H),w.onopen=()=>{v.value=!0,g.value=null,console.log("WebSocket connected")},w.onmessage=j=>{try{if(j.data==="pong")return;const L=JSON.parse(j.data);if(L.type==="message_data"&&L.message_id){const V=L.message_id,q=L.data,_=c.value.findIndex(I=>I.id===V);if(_>=0)c.value[_]={...c.value[_],...q,id:V};else{const I={id:V,...q},E=c.value.filter(N=>{if(!N.isOptimistic)return!0;if(N.id===V)return!1;const ie=N.content===I.content,pe=N.role===I.role,J=Math.abs(N.created_at-I.created_at)<5e6;return!(ie&&pe&&J)});E.push(I),c.value=E.sort((N,ie)=>N.created_at-ie.created_at)}if(q.status==="pending")h.value=!0;else if(q.status==="completed"||q.status==="failed"){const I=c.value.some(E=>{if((E.depth??0)>0)return!1;if(E.status==="pending"||E.role==="tool"&&E.tool_call_id&&!E.tool_status)return!0;if(E.tool_calls)try{const ie=JSON.parse(E.tool_calls);if(Array.isArray(ie)&&ie.length>0&&!ie.every(J=>c.value.some(le=>(le.depth??0)===0&&le.role==="tool"&&le.tool_call_id===J.id&&le.tool_status)))return!0}catch{}return!1});h.value=I}}else if(L.type==="message_chunk"){const V=L.message_id,q=L.chunk,_=c.value.findIndex(I=>I.id===V);if(_>=0){const I=c.value[_].content||"",E={...c.value[_],content:I+q};c.value.splice(_,1,E)}else{const I={id:V,role:"assistant",content:q,created_at:Date.now()*1e3,status:"pending"};c.value.push(I),c.value=c.value.sort((E,N)=>E.created_at-N.created_at)}}else L.type==="event"?console.log("📡",L.eventType,L.data):L.type==="error"&&(g.value=L.error||"WebSocket error",console.error("WebSocket error:",L.error))}catch(L){console.error("Error parsing WebSocket message:",L)}},w.onerror=j=>{g.value="WebSocket connection error",console.error("WebSocket error:",j)},w.onclose=()=>{v.value=!1,w=null,p.value&&a&&(M=setTimeout(()=>{console.log("Attempting WebSocket reconnect..."),R()},3e3))}}catch(P){g.value=P instanceof Error?P.message:"Unknown error",console.error("Error connecting WebSocket:",P)}}function F(){M&&(clearTimeout(M),M=null),w&&(w.close(),w=null,v.value=!1)}async function $(){await A()}function B(P){c.value.push({...P,isOptimistic:!0})}function D(P){c.value=c.value.filter(H=>H.id!==P)}async function W(P){if(!p.value)return;const H=[...c.value];c.value=c.value.filter(K=>K.id!==P);try{if(!(await fetch(X(`/api/threads/${p.value}/messages/${P}`),{method:"DELETE"})).ok)throw c.value=H,new Error("Failed to delete message")}catch(K){throw c.value=H,K}}async function U(){if(p.value){h.value=!1;try{if(!(await fetch(X(`/api/threads/${p.value}/stop`),{method:"POST"})).ok)throw new Error("Failed to stop thread")}catch(P){throw console.error("Error stopping thread:",P),P}}}return ae(p,async(P,H)=>{P!==H&&(F(),P?(await A(),e&&a&&R()):(c.value=[],i.value=null))},{immediate:e}),Ae(()=>{F()}),{messages:T,threadInfo:i,isFetching:r,isLoadingMore:d,error:u,wsConnected:v,wsError:g,isExecuting:h,hasMore:f,totalMessages:k,refetch:$,loadMoreMessages:O,connectWebSocket:R,disconnectWebSocket:F,addOptimisticMessage:B,removeOptimisticMessage:D,deleteMessageById:W,stopThread:U}}const As=te({__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}},emits:["messageClick","messageHover","deleteMessage"],setup(p,{expose:t,emit:a}){const e=p,c=a,i=m(null),r=m(new Map);function d(_,I){I?r.value.set(_,I):r.value.delete(_)}function u(_){for(let I=0;I<e.messages.length;I++)if(h(I)===_)return I;return-1}function v(_){const I=e.messages.findIndex(E=>E.log_id===_);if(I<=0)return-1;for(let E=I-1;E>=0;E--){const N=e.messages[E];if(N.role==="user")return E;if(N.role==="assistant"&&N.log_id)break}return-1}function g(_,I){const N=e.messages.findIndex(ne=>ne.log_id===_);if(N===-1)return;const ie=r.value.get(N);if(!ie)return;const pe=v(_),J=pe!==-1?r.value.get(pe):null,le=I.getBoundingClientRect(),Z=ie.getBoundingClientRect();if(Z.top<le.top){const de=(J||ie).getBoundingClientRect().top-le.top-10;I.scrollBy({top:de,behavior:"smooth"})}else if(Z.bottom>le.bottom){const ne=Z.bottom-le.bottom+10;I.scrollBy({top:ne,behavior:"smooth"})}else if(J){const ne=J.getBoundingClientRect();if(ne.top<le.top){const se=ne.top-le.top-10;I.scrollBy({top:se,behavior:"smooth"})}}}t({scrollToLogId:g});function h(_){const I=e.messages[_];if(I.log_id)return I.log_id;if(I.role==="user")for(let E=_+1;E<e.messages.length;E++){const N=e.messages[E];if(N.log_id)return N.log_id;if(N.role==="user")break}return null}function f(_,I){return I?h(_)===I:!1}function k(_){const I=e.messages[_],E=h(_);E&&(i.value=I.id,c("messageHover",E))}function x(_){h(_)&&(i.value=null,c("messageHover",null))}function w(_){const I=e.messages[_],E=h(_);E&&c("messageClick",I.id,E)}const M=m(new Set),b=m(new Set),S=m(new Set);function T(_){M.value.has(_)?M.value.delete(_):M.value.add(_)}function A(_){b.value.has(_)?b.value.delete(_):b.value.add(_)}function O(_){S.value.has(_)?S.value.delete(_):S.value.add(_)}function R(_){if(!_)return{};try{return JSON.parse(_)}catch{return{raw:_}}}function F(_){if(!_)return null;const I=R(_),E=Object.keys(I);if(E.length===0)return null;const N=I[E[0]];return typeof N=="string"?N:JSON.stringify(N)}function $(_){return new Date(_/1e3).toLocaleTimeString()}function B(_){const I=Math.round(_/1e6);if(I<1)return"< 1s";if(I<60)return`${I}s`;const E=Math.floor(I/60),N=I%60;return`${E}m ${N}s`}function D(_){if(_.status==="pending")return"...";if(!_.isComplete)return"Working...";let I;return _.request_sent_at&&_.response_completed_at?I=_.response_completed_at-_.request_sent_at:I=_.updated_at-_.created_at,`Worked for ${B(I)}`}function W(_){const I=_.filter(E=>E.type==="content");if(I.length===0){const E=_.filter(N=>N.type==="reasoning");return E.length>0?E[E.length-1].content:null}return I[I.length-1].content}function U(_){const E=_.trim().split(`
|
|
2
|
+
`)[0];return E.length>60?E.substring(0,60):E}function P(_){const I=_.filter(E=>E.type==="tool_call");return I.length===0?null:I[I.length-1].tool_name||null}function H(_){return e.selectedMessageId===_.id?!0:e.selectedLogId?_.items.some(I=>I.log_id===e.selectedLogId):!1}function K(_){return!!(e.selectedLogId&&_.log_id===e.selectedLogId)}function j(){return e.messages.some(_=>_.type==="work"&&!_.isComplete)}function L(_){return!_.isComplete}function V(_){return _?_.trim():""}const q={props:e,emit:c,hoveredMessageId:i,messageRowRefs:r,setMessageRowRef:d,findMessageIndexByLogId:u,findUserMessageIndexForLogId:v,scrollToLogId:g,getEffectiveLogId:h,isMessageHighlighted:f,handleMessageEnter:k,handleMessageLeave:x,handleMessageClick:w,expandedMessages:M,expandedToolCalls:b,expandedReasoning:S,toggleWorkMessage:T,toggleToolCall:A,toggleReasoning:O,parseArguments:R,getArgumentsPreview:F,formatTime:$,formatDuration:B,getWorkStatus:D,getLatestContent:W,getFirstLine:U,getLatestToolName:P,isWorkMessageSelected:H,isWorkItemSelected:K,hasActiveWorkMessage:j,isWorkMessageActive:L,trimContent:V,get ChevronDownIcon(){return go},get ChevronRightIcon(){return fo},get AlertTriangleIcon(){return mo},get Trash2Icon(){return At}};return Object.defineProperty(q,"__isScriptSetup",{enumerable:!1,value:!0}),q}}),Ps=["onMouseenter","onMouseleave","onClick"],Ls=["onClick"],Es={key:1,class:"w-full text-center text-xs text-neutral-400 dark:text-neutral-500 py-1"},js={key:0,class:"whitespace-pre-wrap text-sm"},Os={key:0,class:"opacity-50"},Ds={key:1,class:"opacity-50 italic text-neutral-500 dark:text-neutral-400"},qs=["onClick"],Us=["onClick"],Bs={key:0,class:"space-y-1"},Ns={class:"flex items-start gap-2"},Rs={class:"flex-1 min-w-0"},Fs={key:0,class:"truncate opacity-80"},zs={key:1,class:"italic opacity-60"},Hs={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"],$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},ai={class:"w-full border-collapse"},ni={class:"py-0.5 pr-2 opacity-65 align-top"},li={class:"py-0.5 opacity-85 break-all"},si={key:1},ii=["onClick"],di={class:"whitespace-pre-wrap break-all"},ci={class:"text-[10px]"},ui=["onClick"],pi={key:0,class:"mt-1 pl-4 whitespace-pre-wrap opacity-80"},mi={class:"text-[10px] opacity-80 pl-4 pb-2"},fi=["onClick"];function gi(p,t,a,e,c,i){return n(),l("div",null,[(n(!0),l(G,null,ue(a.messages,(r,d)=>(n(),l("div",{key:r.id,ref_for:!0,ref:u=>e.setMessageRowRef(d,u),class:Q(["flex items-center gap-2 pb-3",{"justify-start":r.role==="assistant","justify-end":r.role==="user","justify-center":r.role==="system","cursor-pointer":e.getEffectiveLogId(d)}]),onMouseenter:u=>e.handleMessageEnter(d),onMouseleave:u=>e.handleMessageLeave(d),onClick:u=>e.handleMessageClick(d)},[s(" Delete button for user messages (left side) "),r.role==="user"&&e.hoveredMessageId===r.id&&!r.isOptimistic?(n(),l("button",{key:0,onClick:ke(u=>e.emit("deleteMessage",r.id),["stop"]),class:"flex-shrink-0 w-6 h-6 rounded-full bg-red-500 text-white hover:bg-red-600 flex items-center justify-center transition-all",title:"Delete message"},[C(e.Trash2Icon,{size:14})],8,Ls)):s("v-if",!0),s(" Interruption message (iOS style) "),r.type==="text"&&r.role==="system"&&r.content?.includes("Execution stopped")?(n(),l("div",Es,y(r.content),1)):r.type==="text"?(n(),l(G,{key:2},[s(" Text Message "),o("div",{class:Q(["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":r.role!=="user"&&e.isMessageHighlighted(d,a.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":r.role!=="user"&&e.getEffectiveLogId(d)&&!r.silent&&!e.isMessageHighlighted(d,a.selectedLogId)&&(e.hoveredMessageId===r.id||e.isMessageHighlighted(d,a.hoveredLogId))}]])},[s(" Message content or typing indicator "),r.content?(n(),l("div",js,y(e.trimContent(r.content)),1)):r.status==="pending"?(n(),l(G,{key:1},[s(" Typing indicator for pending messages with no content "),t[0]||(t[0]=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)):s("v-if",!0),s(" Label and Timestamp (hide when pending) "),r.status!=="pending"?(n(),l("div",{key:2,class:Q(["text-[10px] mt-1 opacity-50 flex gap-2",{"justify-start":r.role==="assistant","justify-end":r.role!=="assistant"}])},[r.sideLabel?(n(),l("span",Os,y(r.sideLabel),1)):s("v-if",!0),o("span",null,y(e.formatTime(r.created_at)),1),r.silent?(n(),l("span",Ds," silent ")):s("v-if",!0)],2)):s("v-if",!0)],2)],2112)):s("v-if",!0),s(" Delete button for assistant messages (right side) "),r.type==="text"&&r.role==="assistant"&&e.hoveredMessageId===r.id&&!r.isOptimistic?(n(),l("button",{key:3,onClick:ke(u=>e.emit("deleteMessage",r.id),["stop"]),class:"flex-shrink-0 w-6 h-6 rounded-full bg-red-500 text-white hover:bg-red-600 flex items-center justify-center transition-all",title:"Delete message"},[C(e.Trash2Icon,{size:14})],8,qs)):r.type==="work"?(n(),l(G,{key:4},[s(" Work Message "),o("div",{class:Q(["max-w-[80%] min-w-[200px] rounded-lg px-3 py-2 text-xs cursor-pointer transition-all border",{"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":e.isWorkMessageSelected(r)}]),onClick:u=>e.toggleWorkMessage(r.id)},[s(" Collapsed state "),e.expandedMessages.has(r.id)?(n(),l(G,{key:1},[s(" Expanded state "),o("div",Ks,[s(" Status header "),o("div",Zs,[C(e.ChevronDownIcon,{size:14,class:"flex-shrink-0"}),o("span",Gs,y(e.getWorkStatus(r)),1),o("span",Xs,y(r.items.length)+" operation"+y(r.items.length!==1?"s":""),1)]),(n(!0),l(G,null,ue(r.items,u=>(n(),l("div",{key:u.id,class:"mb-1"},[s(" Tool Call (with merged response) "),u.type==="tool_call"?(n(),l("div",Ys,[s(" Collapsed: Single row with tool name and status "),o("div",{onClick:ke(v=>e.toggleToolCall(u.id),["stop"]),class:Q(["flex items-center gap-2 cursor-pointer hover:opacity-70 transition-opacity",{"ring-1 ring-accent-500":e.isWorkItemSelected(u)}])},[e.expandedToolCalls.has(u.id)?(n(),Y(e.ChevronDownIcon,{key:1,size:12,class:"flex-shrink-0 opacity-50"})):(n(),Y(e.ChevronRightIcon,{key:0,size:12,class:"flex-shrink-0 opacity-50"})),o("span",$s,y(u.tool_name),1),e.getArgumentsPreview(u.tool_arguments)?(n(),l("span",ei,y(e.getArgumentsPreview(u.tool_arguments)),1)):s("v-if",!0),u.response_status==="success"?(n(),l("span",ti,"✓")):u.response_status==="failed"?(n(),Y(e.AlertTriangleIcon,{key:4,size:12,class:"ml-auto text-red-600 dark:text-red-400"})):s("v-if",!0)],10,Qs),s(" Expanded: Arguments and Response as tables "),e.expandedToolCalls.has(u.id)?(n(),l("div",oi,[s(" Arguments table "),u.tool_arguments?(n(),l("div",ri,[t[1]||(t[1]=o("div",{class:"font-semibold mb-1 opacity-70"},"Arguments:",-1)),o("table",ai,[o("tbody",null,[(n(!0),l(G,null,ue(e.parseArguments(u.tool_arguments),(v,g)=>(n(),l("tr",{key:g,class:"border-b border-current border-opacity-10"},[o("td",ni,y(g),1),o("td",li,y(typeof v=="object"?JSON.stringify(v):v),1)]))),128))])])])):s("v-if",!0),s(" Response "),u.response?(n(),l("div",si,[t[2]||(t[2]=o("div",{class:"font-semibold mb-1 opacity-70"},"Response:",-1)),o("div",{class:Q(["opacity-80 cursor-pointer hover:opacity-100",{"ring-1 ring-accent-500":a.selectedLogId&&u.response_log_id===a.selectedLogId}]),onClick:ke(v=>u.response_log_id&&e.emit("messageClick",r.id,u.response_log_id),["stop"])},[o("div",di,y(e.trimContent(u.response)),1)],10,ii)])):s("v-if",!0)])):s("v-if",!0)])):u.type==="reasoning"?(n(),l(G,{key:1},[s(" Reasoning (nested expandable) "),o("div",ci,[o("button",{onClick:ke(v=>e.toggleReasoning(u.id),["stop"]),class:"flex items-center gap-1 opacity-70 hover:opacity-100 transition-opacity"},[e.expandedReasoning.has(u.id)?(n(),Y(e.ChevronDownIcon,{key:1,size:12,class:"flex-shrink-0"})):(n(),Y(e.ChevronRightIcon,{key:0,size:12,class:"flex-shrink-0"})),t[3]||(t[3]=o("span",{class:"font-semibold"},"Reasoning",-1))],8,ui),e.expandedReasoning.has(u.id)?(n(),l("div",pi,y(e.trimContent(u.content)),1)):s("v-if",!0)])],2112)):u.type==="content"?(n(),l(G,{key:2},[s(" Content "),o("div",mi,y(e.trimContent(u.content)),1)],2112)):s("v-if",!0)]))),128))])],2112)):(n(),l("div",Bs,[s(" Preview text or status "),o("div",Ns,[C(e.ChevronRightIcon,{size:14,class:"flex-shrink-0 mt-0.5 opacity-50"}),o("div",Rs,[e.getLatestContent(r.items)?(n(),l("div",Fs,y(e.getFirstLine(e.getLatestContent(r.items)))+"... ",1)):(n(),l("div",zs,y(e.getWorkStatus(r)),1))])]),s(" Status line "),o("div",Hs,[o("span",Ws,y(r.items.length)+" operation"+y(r.items.length!==1?"s":""),1),o("span",Js,"• "+y(e.getWorkStatus(r)),1)])]))],10,Us)],2112)):s("v-if",!0),s(" Delete button for work messages on right side (assistant) "),r.type==="work"&&r.role==="assistant"&&e.hoveredMessageId===r.id?(n(),l("button",{key:5,onClick:ke(u=>e.emit("deleteMessage",r.id),["stop"]),class:"flex-shrink-0 w-6 h-6 rounded-full bg-red-500 text-white hover:bg-red-600 flex items-center justify-center transition-all",title:"Delete message"},[C(e.Trash2Icon,{size:14})],8,fi)):s("v-if",!0)],42,Ps))),128))])}const hi=ee(As,[["render",gi],["__scopeId","data-v-9082ef4d"],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/AgentMessages.vue"]]),vi=te({__name:"MetadataSlidePane",props:{threadId:{type:[String,null],required:!0},show:{type:Boolean,required:!0}},emits:["close","threadDeleted","editThread"],setup(p,{expose:t,emit:a}){t();const e=p,c=a,{thread:i,isFetching:r,error:d}=ct(z(()=>e.threadId)),u=m(!1),v=m(!1),g=m(!1),h=m(!1),f=m(""),k=m(!1),x=m(!1),w=m(null),{data:M,isFetching:b}=we(X("/api/agents"),{refetch:!0}).json(),S=z(()=>M.value?.agents?M.value.agents.filter(U=>U.type==="ai_human").map(U=>({value:U.id,label:U.title,description:`Type: ${U.type}`})):[]),T=z(()=>i.value?.agent.type==="ai_human"),A=U=>new Date(U*1e3).toLocaleString(),O=()=>{i.value&&(f.value=i.value.agent.id,g.value=!0)},R=()=>{g.value=!1,f.value=""},F=async()=>{if(!(!e.threadId||!f.value)){h.value=!0;try{const U=await fetch(X(`/api/threads/${e.threadId}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent_id:f.value})});if(!U.ok){const P=await U.json();throw new Error(P.error||"Failed to update agent")}window.location.reload()}catch(U){console.error("Error updating agent:",U),alert(`Failed to update agent: ${U.message}`)}finally{h.value=!1}}},$=async()=>{if(e.threadId){x.value=!0,k.value=!0;try{const U=await fetch(X(`/api/threads/${e.threadId}/cost`));if(!U.ok){const P=await U.json();throw new Error(P.error||"Failed to fetch cost breakdown")}w.value=await U.json()}catch(U){console.error("Error fetching cost breakdown:",U),alert(`Failed to fetch cost breakdown: ${U.message}`),k.value=!1}finally{x.value=!1}}},B=U=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(U),D=async()=>{if(e.threadId){v.value=!0;try{const U=await fetch(X(`/api/threads/${e.threadId}`),{method:"DELETE"});if(!U.ok){const P=await U.json();throw new Error(P.error||"Failed to delete thread")}c("threadDeleted",e.threadId)}catch(U){console.error("Error deleting thread:",U),alert(`Failed to delete thread: ${U.message}`)}finally{v.value=!1}}};ae(()=>e.show,U=>{U||(g.value=!1,f.value="")});const W={props:e,emit:c,thread:i,isFetching:r,error:d,showDeleteConfirm:u,isDeleting:v,isEditingAgent:g,isSavingAgent:h,selectedAgentId:f,showCostBreakdown:k,isFetchingCost:x,costData:w,agentsData:M,isFetchingAgents:b,aiHumanAgents:S,isAiHumanAgent:T,formatDate:A,startEditingAgent:O,cancelEditingAgent:R,saveAgent:F,fetchCostBreakdown:$,formatCurrency:B,handleDeleteThread:D,Loader:Je,ConfirmDialog:zt,SelectInput:Se,get ChevronUpIcon(){return bo},get Trash2Icon(){return At},get PencilIcon(){return vo},get DollarSignIcon(){return ho}};return Object.defineProperty(W,"__isScriptSetup",{enumerable:!1,value:!0}),W}}),bi={key:0,class:"overflow-hidden border-b border-neutral-300 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-900"},yi={class:"max-h-[400px] overflow-y-auto"},xi={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"},ki={class:"p-4"},_i={key:0,class:"flex justify-center py-4"},wi={class:"text-red-600 dark:text-red-400 text-center py-4 text-sm"},Ci={class:"space-y-3 text-sm"},Si={class:"flex items-start gap-2"},Ti={class:"font-mono text-xs break-all"},Mi={class:"flex items-start gap-2"},Ii={class:"flex-1"},Vi={key:0,class:"flex items-center gap-2"},Ai={class:"text-xs text-neutral-500"},Pi={key:1,class:"space-y-2"},Li={class:"flex gap-2"},Ei=["disabled"],ji=["disabled"],Oi={class:"flex items-start gap-2"},Di={key:0,class:"flex items-start gap-2"},qi={class:"font-mono text-xs"},Ui={class:"flex items-start gap-2"},Bi={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"},Fi=["disabled"],zi={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"},Wi={class:"flex items-center gap-4 text-xs"},Ji={class:"font-mono font-bold ml-1"},Ki={class:"font-mono font-bold ml-1"},Zi={key:0,class:"text-xs"},Gi={class:"w-full"},Xi={class:"py-1"},Yi={class:"text-right py-1 font-mono"},Qi={class:"text-right py-1 font-mono"},$i={class:"pt-2 border-t border-neutral-200 dark:border-neutral-800 flex justify-end"},ed=["disabled"],td={key:0},od={key:1};function rd(p,t,a,e,c,i){return n(),Y(De,{"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:re(()=>[a.show&&a.threadId?(n(),l("div",bi,[o("div",yi,[s(" Header with close button "),o("div",xi,[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})])]),s(" Content "),o("div",ki,[s(" Loading state "),e.isFetching?(n(),l("div",_i,[C(e.Loader)])):e.error?(n(),l(G,{key:1},[s(" Error state "),o("div",wi," Error loading metadata: "+y(e.error),1)],2112)):e.thread?(n(),l(G,{key:2},[s(" Metadata display "),o("div",Ci,[s(" Thread ID "),o("div",Si,[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",Ti,y(e.thread.id),1)]),s(" Agent "),o("div",Mi,[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",Ii,[e.isEditingAgent?(n(),l("div",Pi,[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",Li,[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"},y(e.isSavingAgent?"Saving...":"Save"),9,Ei),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,ji)])])):(n(),l("div",Vi,[o("span",null,y(e.thread.agent.title),1),o("span",Ai,"("+y(e.thread.agent.type)+")",1),e.isAiHumanAgent?(n(),l("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})])):s("v-if",!0)]))])]),s(" 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,y(e.formatDate(e.thread.created_at)),1)]),s(" User ID "),e.thread.user_id?(n(),l("div",Di,[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",qi,y(e.thread.user_id),1)])):s("v-if",!0),s(" Tags "),o("div",Ui,[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",Bi,[e.thread.tags?.length>0?(n(!0),l(G,{key:0},ue(e.thread.tags,r=>(n(),l("span",{key:r,class:"inline-block px-2 py-0.5 text-xs rounded bg-black text-white dark:bg-white dark:text-black"},y(r),1))),128)):(n(),l("span",Ni,"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})])])]),s(" 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?(n(),l("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,Fi)):s("v-if",!0),e.isFetchingCost?(n(),l("div",zi,[C(e.Loader)])):s("v-if",!0),e.showCostBreakdown?(n(),l("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))])):s("v-if",!0)]),s(" Cost Breakdown Panel (full width below) "),e.showCostBreakdown&&e.costData?(n(),l("div",Hi,[o("div",Wi,[o("div",null,[t[15]||(t[15]=o("span",{class:"text-neutral-500"},"Total:",-1)),o("span",Ji,y(e.formatCurrency(e.costData.totalCost)),1)]),o("div",null,[t[16]||(t[16]=o("span",{class:"text-neutral-500"},"Avg/msg:",-1)),o("span",Ki,y(e.formatCurrency(e.costData.avgCostPerMessage)),1)])]),s(" Model Breakdown "),e.costData.modelBreakdown.length>0?(n(),l("div",Zi,[o("table",Gi,[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,[(n(!0),l(G,null,ue(e.costData.modelBreakdown,r=>(n(),l("tr",{key:r.modelName},[o("td",Xi,y(r.modelName),1),o("td",Yi,y(r.requestCount),1),o("td",Qi,y(e.formatCurrency(r.totalCost)),1)]))),128))])])])):s("v-if",!0)])):s("v-if",!0),s(" Delete Button "),o("div",$i,[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?(n(),l("span",td,"Deleting...")):(n(),l("span",od,"Delete Thread"))],8,ed)])])],2112)):s("v-if",!0)])]),s(" 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"])])):s("v-if",!0)]),_:1})}const ad=ee(vi,[["render",rd],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/MetadataSlidePane.vue"]]),nd=te({__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"],setup(p,{expose:t,emit:a}){const e=p,c=a,i=m(!1),r=()=>{i.value=!i.value},{messages:d,threadInfo:u,isFetching:v,isLoadingMore:g,error:h,wsConnected:f,wsError:k,isExecuting:x,hasMore:w,totalMessages:M,loadMoreMessages:b,connectWebSocket:S,disconnectWebSocket:T,addOptimisticMessage:A,removeOptimisticMessage:O,deleteMessageById:R,stopThread:F}=Vs(z(()=>e.threadId),{enableWebSocket:!0}),{thread:$}=ct(z(()=>e.threadId)),B=m(null),D=m(null),W=J=>{D.value&&B.value&&D.value.scrollToLogId(J,B.value)};t({scrollToLogId:W}),typeof window<"u"&&(window.__testLoadMoreMessages=b);const U=m(""),P=m(null),H=m("B"),K=m(!1),j=m(!1),L=async()=>{await he(),B.value&&(B.value.scrollTop=B.value.scrollHeight)},V=async J=>{J.target.scrollTop<100&&w.value&&!g.value&&!j.value&&(j.value=!0,await b(),j.value=!1)};ae(()=>d.value.length,async()=>{!g.value&&!j.value&&await L()}),ae(()=>e.threadId,async J=>{J&&await L()}),ae(v,async(J,le)=>{le&&!J&&await L()});const q=z(()=>{const J=u.value?.agent||$.value?.agent;if(!J)return"ai A";const le=J.type;return H.value==="A"&&J.side_a_label?J.side_a_label:H.value==="B"&&J.side_b_label?J.side_b_label:le==="ai_human"?H.value==="A"?"ai":"human":H.value==="A"?"ai A":"ai B"}),_=()=>{H.value=H.value==="A"?"B":"A"},I=async()=>{if(!U.value.trim()||!e.threadId||K.value)return;const J=U.value,le=H.value==="A"?"assistant":"user",Z=`optimistic-${Date.now()}`,ne={id:Z,role:le,content:J,created_at:Date.now()*1e3,isOptimistic:!0};A(ne),U.value="",P.value&&(P.value.style.height="auto",P.value.style.height="24px"),K.value=!0;try{if(!(await fetch(X(`/api/threads/${e.threadId}/message`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:J,role:le})})).ok)throw new Error("Failed to send message");await L()}catch(se){console.error("Error sending message:",se),O(Z)}finally{K.value=!1,await he(),P.value&&P.value.focus()}},pe={props:e,emit:c,showMetadataPanel:i,toggleMetadataPanel:r,messages:d,threadInfo:u,isFetching:v,isLoadingMore:g,error:h,wsConnected:f,wsError:k,isExecuting:x,hasMore:w,totalMessages:M,loadMoreMessages:b,connectWebSocket:S,disconnectWebSocket:T,addOptimisticMessage:A,removeOptimisticMessage:O,deleteMessageById:R,stopThread:F,thread:$,messagesContainer:B,agentMessagesRef:D,scrollToLogId:W,messageInput:U,messageTextarea:P,currentSide:H,isSending:K,isLoadingOlder:j,scrollToBottom:L,handleScroll:V,sideLabel:q,toggleSide:_,sendMessage:I,handleKeyDown:J=>{J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),I())},handleDeleteMessage:async J=>{if(e.threadId)try{await R(J)}catch(le){console.error("Error deleting message:",le)}},handleStopThread:async()=>{if(e.threadId)try{await F()}catch(J){console.error("Error stopping thread:",J)}},AgentMessages:hi,MetadataSlidePane:ad,Loader:Je,StatusDot:pt,get MessageSquareIcon(){return Pt},get ChevronLeftIcon(){return dt},get InfoIcon(){return yo}};return Object.defineProperty(pe,"__isScriptSetup",{enumerable:!1,value:!0}),pe}}),ld={class:"flex flex-col h-full"},sd={class:"p-4 border-b border-neutral-300 dark:border-neutral-700"},id={class:"flex items-center justify-between"},dd={class:"flex items-center gap-2"},cd={class:"flex items-center gap-2"},ud={class:"flex-1 flex flex-col overflow-hidden relative"},pd={key:0,class:"text-neutral-500 dark:text-neutral-400 text-center py-8"},md={key:1,class:"flex justify-center py-2"},fd={class:"flex justify-center py-8"},gd={class:"text-red-600 dark:text-red-400 text-center py-8"},hd={key:0,class:"p-3 bg-white dark:bg-neutral-900 border-t border-neutral-300 dark:border-neutral-700"},vd={class:"flex items-start gap-2"},bd={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"},yd=["disabled"],xd=["disabled"],kd={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"},_d={key:1,class:"w-4 h-4"};function wd(p,t,a,e,c,i){return n(),l("div",ld,[s(" Header "),o("div",sd,[o("div",id,[o("div",dd,[C(e.MessageSquareIcon,{size:20,class:"shrink-0"}),t[8]||(t[8]=o("h2",{class:"text-xl font-bold"},"Messages",-1)),a.threadId?(n(),Y(e.StatusDot,{key:0,connected:e.wsConnected,error:e.wsError},null,8,["connected","error"])):s("v-if",!0)]),o("div",cd,[s(" Metadata toggle button "),a.threadId?(n(),l("button",{key:0,onClick:e.toggleMetadataPanel,type:"button",class:Q(["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)):s("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})])])])]),s(" Content area with sliding metadata panel "),o("div",ud,[s(" Sliding metadata panel "),C(e.MetadataSlidePane,{"thread-id":a.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"]),s(" Messages content "),o("div",{ref:"messagesContainer",class:"flex-1 overflow-y-auto p-4 space-y-4",onScroll:e.handleScroll},[s(" No thread selected "),a.threadId?s("v-if",!0):(n(),l("div",pd," Select a thread to view messages ")),s(" Loading older messages indicator "),e.isLoadingMore?(n(),l("div",md,[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?(n(),l(G,{key:2},[s(" Loading state "),o("div",fd,[C(e.Loader)])],2112)):e.error?(n(),l(G,{key:3},[s(" Error state "),o("div",gd," Error loading messages: "+y(e.error),1)],2112)):a.threadId&&e.messages.length===0?(n(),l(G,{key:4},[s(" 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)):(n(),l(G,{key:5},[s(" Message bubbles (using AgentMessages component) "),C(e.AgentMessages,{ref:"agentMessagesRef",messages:e.messages,selectedMessageId:a.selectedMessageId,selectedLogId:a.selectedLogId,hoveredLogId:a.hoveredLogId,onMessageClick:t[4]||(t[4]=(r,d)=>e.emit("messageClick",r,d)),onMessageHover:t[5]||(t[5]=r=>e.emit("messageHover",r)),onDeleteMessage:e.handleDeleteMessage},null,8,["messages","selectedMessageId","selectedLogId","hoveredLogId"])],2112))],544),s(" Message input section (iOS-style single bubble) "),a.threadId?(n(),l("div",hd,[o("div",vd,[s(" Side toggle tag (outside bubble) "),o("button",{onClick:e.toggleSide,class:Q(["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"},y(e.sideLabel),3),s(" Input bubble "),o("div",bd,[s(" Message input (no border, transparent) "),ye(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,yd),[[Me,e.messageInput]]),s(" Send/Stop button (inside bubble) "),e.isExecuting?(n(),l(G,{key:1},[s(" 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)):(n(),l("button",{key:0,id:"send-message-button",onClick:e.sendMessage,disabled:!e.messageInput.trim()||e.isSending,class:Q(["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?(n(),l("div",_d,[C(e.Loader)])):(n(),l("svg",kd,[...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,xd))])])])):s("v-if",!0)])])}const Cd=ee(nd,[["render",wd],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/MessagesPane.vue"]]);function Sd(p,t){const{limit:a=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 B=typeof p=="string"?p:p?.value;if(!B)return X("/api/threads/placeholder/logs");const D=new URLSearchParams,W=typeof a=="number"?a:a.value,U=typeof e=="number"?e:e.value,P=typeof c=="string"?c:c.value;return D.append("limit",W.toString()),D.append("offset",U.toString()),D.append("order",P),X(`/api/threads/${B}/logs?${D.toString()}`)}),{data:u,error:v,isFetching:g,isFinished:h,execute:f,abort:k}=we(d,{immediate:!1}).get().json();ae([d,()=>i],([B,D])=>{B&&!B.includes("placeholder")&&D&&f()},{immediate:!0});const x=z(()=>!v.value||v.value.toString().includes("aborted")||v.value.toString().includes("abort")?null:v.value),w=z(()=>u.value?.logs||[]),M=z(()=>u.value?.total||0),b=z(()=>u.value?.hasMore||!1),S=m(null),T=m(!1),A=m(null),O=m([]),R=()=>{const B=typeof p=="string"?p:p?.value;if(!B||!r)return;S.value&&S.value.close(),O.value=[];const D=window.location.protocol==="https:"?"wss:":"ws:",W=window.location.host;let U=`${D}//${W}${X(`/api/threads/${B}/logs`)}`;const P=localStorage.getItem("auth_token");P&&(U+=`?token=${encodeURIComponent(P)}`);try{S.value=new WebSocket(U),S.value.onopen=()=>{T.value=!0,A.value=null,console.log("WebSocket connected for logs")},S.value.onmessage=H=>{try{const K=JSON.parse(H.data);if(K.type==="log_data"){const j=O.value.findIndex(V=>V.id===K.log_id),L=w.value.find(V=>V.id===K.log_id);j>=0?(O.value[j]={...O.value[j],...K.data},console.log("[WebSocket] Updated existing realtime log:",K.log_id)):L?(O.value.push({...L,...K.data}),console.log("[WebSocket] Updated HTTP log:",K.log_id)):(O.value.push({id:K.log_id,...K.data}),console.log("[WebSocket] Added new log:",K.log_id))}}catch(K){console.error("Failed to parse WebSocket message:",K)}},S.value.onerror=H=>{A.value="WebSocket connection error",T.value=!1,console.error("WebSocket error:",H)},S.value.onclose=()=>{T.value=!1,console.log("WebSocket disconnected")}}catch(H){A.value=H.message||"Failed to create WebSocket",console.error("WebSocket creation error:",H)}},F=()=>{S.value&&(S.value.close(),S.value=null,T.value=!1),O.value=[]};return Ae(()=>{F()}),{logs:z(()=>{if(!r)return w.value;const B=new Map;w.value.forEach(U=>B.set(U.id,U)),O.value.forEach(U=>B.set(U.id,U));const D=typeof c=="string"?c:c.value;return Array.from(B.values()).sort((U,P)=>D==="desc"?P.created_at-U.created_at:U.created_at-P.created_at)}),total:M,hasMore:b,error:x,isFetching:g,isFinished:h,refetch:f,abort:k,wsConnected:T,wsError:A,connectWebSocket:R,disconnectWebSocket:F}}function Td(p,t){const a=z(()=>{const d=p.value,u=t.value;return!d||!u?null:X(`/api/threads/${d}/logs/${u}`)}),{data:e,error:c,isFetching:i,execute:r}=we(a,{immediate:!1}).get().json();return ae([p,t],([d,u])=>{d&&u&&r()},{immediate:!0}),{logDetails:e,error:c,isFetching:i,refetch:r}}const Md=te({__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 a=p,e=m(!1),c=m(!1),u={props:a,copying:e,copied:c,copyToClipboard:async()=>{e.value=!0;try{await navigator.clipboard.writeText(a.content),c.value=!0,setTimeout(()=>{c.value=!1},2e3)}catch(v){console.error("Failed to copy:",v),alert(`Failed to copy: ${v instanceof Error?v.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:Je};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),Id=["disabled","title"],Vd={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"},Pd={key:3};function Ld(p,t,a,e,c,i){return n(),l("button",{onClick:e.copyToClipboard,disabled:e.copying||a.disabled,class:Q([e.sizeClasses[a.size||"sm"],e.variantClasses[a.variant||"solid"],"font-medium rounded hover:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed transition-all"]),title:a.disabled?"No content to copy":e.copied?"Copied!":"Copy to clipboard"},[e.copying?(n(),Y(e.Loader,{key:0,size:"xs"})):a.variant==="ghost"&&!e.copied?(n(),l("svg",Vd,[...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)])])):a.variant==="ghost"&&e.copied?(n(),l("svg",Ad,[...t[1]||(t[1]=[o("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(n(),l("span",Pd,y(e.copied?"Copied!":"Copy"),1))],10,Id)}const Ed=ee(Md,[["render",Ld],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/CopyButton.vue"]]),ot="__shiki_highlighter__";let Ge=null;async function jd(){return typeof window<"u"&&window[ot]?window[ot]:Ge||(Ge=Io({themes:["min-light","github-dark-high-contrast"],langs:["json","markdown"]}).then(p=>(typeof window<"u"&&(window[ot]=p),p)),Ge)}const Od=te({__name:"CodeBlock",props:{code:{type:String,required:!0},language:{type:String,required:!0}},setup(p,{expose:t}){t();const a=p,e=m(""),c=m(!0),i=async()=>{const d=a.code??"";if(!d){e.value='<pre class="shiki"><code></code></pre>',c.value=!1;return}try{const u=await jd();if(a.language==="json"||a.language==="markdown")e.value=u.codeToHtml(d,{lang:a.language,themes:{light:"min-light",dark:"github-dark-high-contrast"}});else{const v=d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");e.value=`<pre class="shiki shiki-text"><code>${v}</code></pre>`}}catch{const v=d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");e.value=`<pre class="shiki"><code>${v}</code></pre>`}finally{c.value=!1}};ge(()=>{i()}),ae(()=>a.code,()=>{i()});const r={props:a,highlightedHtml:e,isLoading:c,highlight:i};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),Dd={class:"code-block"},qd={key:0,class:"text-xs text-neutral-500 p-2"},Ud=["innerHTML"];function Bd(p,t,a,e,c,i){return n(),l("div",Dd,[e.isLoading?(n(),l("div",qd,"Loading...")):(n(),l("div",{key:1,innerHTML:e.highlightedHtml,class:"code-content"},null,8,Ud))])}const Nd=ee(Od,[["render",Bd],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/CodeBlock.vue"]]),Rd=te({__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:a}){t();const e=p,c=a,i=m("request"),r=m(new Set),d=m(new Set),u=m(!1),v=m(!1),g=m(null),h=m(new Set),f=B=>{if(!B)return"N/A";try{return JSON.stringify(JSON.parse(B),null,2)}catch{return B}},k=z(()=>{if(!e.log.tools_schema)return[];try{const B=JSON.parse(e.log.tools_schema);return Array.isArray(B)?B:[]}catch{return[]}}),x=z(()=>{if(!e.log.response_body)return[];try{const D=JSON.parse(e.log.response_body)?.choices?.[0]?.message?.tool_calls;return Array.isArray(D)?D:[]}catch{return[]}}),w=z(()=>{if(!e.log.tool_results)return new Map;try{const B=JSON.parse(e.log.tool_results),D=new Map;return Array.isArray(B)&&B.forEach(W=>{W.tool_call_id&&D.set(W.tool_call_id,{content:W.content,status:W.status,tool_name:W.tool_name,timestamp:W.timestamp})}),D}catch{return new Map}}),M=z(()=>{if(!e.log.response_body)return[];try{const D=JSON.parse(e.log.response_body)?.choices?.[0]?.message?.reasoning_details;return Array.isArray(D)?D:[]}catch{return[]}}),b=B=>{r.value.has(B)?r.value.delete(B):r.value.add(B)},S=B=>{d.value.has(B)?d.value.delete(B):d.value.add(B)},T=B=>{h.value.has(B)?h.value.delete(B):h.value.add(B)},A=B=>!h.value.has(B),O=z(()=>{if(!e.log.errors)return[];try{const B=JSON.parse(e.log.errors);return Array.isArray(B)?B:[]}catch{return[]}}),R=()=>{he(()=>{g.value&&(g.value.scrollTop=g.value.scrollHeight)})};ae(()=>e.log.message_history,()=>{R()},{immediate:!0});const $={props:e,emit:c,activeTab:i,expandedTools:r,expandedToolCalls:d,copyingCurl:u,copiedCurl:v,messagesContainer:g,collapsedSections:h,formatJson:f,tools:k,toolCallsDetailed:x,toolResults:w,reasoningDetails:M,toggleTool:b,toggleToolCall:S,toggleSection:T,isSectionExpanded:A,errorsArray:O,scrollMessagesToBottom:R,copyCurlCommand:async()=>{u.value=!0;try{if(!e.log.request_body||!e.log.model)throw new Error("Missing request data");const B=await fetch(X(`/api/models/${e.log.model}/curl-data`));if(!B.ok)throw new Error("Failed to fetch model data");const D=await B.json(),W=f(e.log.request_body);let U=`curl -X POST '${D.endpoint}' \\
|
|
3
|
+
`;U+=` -H 'Content-Type: application/json' \\
|
|
4
|
+
`,D.sdk?.toLowerCase()==="openrouter"?(U+=` -H 'Authorization: Bearer ${D.api_key}' \\
|
|
5
|
+
`,U+=` -H 'HTTP-Referer: https://agentkit.local' \\
|
|
6
|
+
`,U+=` -H 'X-Title: AgentKit' \\
|
|
7
|
+
`):D.sdk?.toLowerCase()==="openai"&&(U+=` -H 'Authorization: Bearer ${D.api_key}' \\
|
|
8
|
+
`),U+=` -d '${W.replace(/'/g,"'\\''")}'`,await navigator.clipboard.writeText(U),v.value=!0,setTimeout(()=>{v.value=!1},2e3)}catch(B){console.error("Failed to copy cURL command:",B),alert(`Failed to copy cURL: ${B instanceof Error?B.message:"Unknown error"}`)}finally{u.value=!1}},Loader:Je,TimeAgo:ut,CopyButton:Ed,CodeBlock:Nd};return Object.defineProperty($,"__isScriptSetup",{enumerable:!1,value:!0}),$}}),Fd={class:"p-4 h-full overflow-y-auto"},zd={class:"flex items-center justify-between mb-3"},Hd={class:"flex items-center gap-2"},Wd={class:"flex items-center gap-1"},Jd=["disabled"],Kd=["disabled"],Zd={class:"text-lg font-bold"},Gd={class:"flex items-center gap-2"},Xd=["disabled","title"],Yd={key:1},Qd={class:"@container border-b border-neutral-300 dark:border-neutral-700 pb-3"},$d={class:"hidden @[600px]:block"},ec={class:"w-full text-xs"},tc={class:"py-1 font-mono"},oc={class:"py-1 font-mono"},rc={key:1},ac={class:"py-1 font-mono"},nc={key:1},lc={class:"py-1 font-mono"},sc={key:1},ic={class:"py-1 font-mono"},dc={key:1},cc={class:"py-1 font-mono text-xs"},uc={class:"@[600px]:hidden space-y-2"},pc={class:"w-full text-xs"},mc={class:"py-1 font-mono"},fc={class:"py-1 font-mono"},gc={key:1},hc={class:"w-full text-xs"},vc={class:"py-1 font-mono"},bc={key:1},yc={class:"py-1 font-mono"},xc={key:1},kc={class:"py-1 font-mono"},_c={key:1},wc={class:"py-1 font-mono text-xs"},Cc={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"},Sc={class:"flex gap-4"},Tc={key:0,class:"text-red-600 dark:text-red-400"},Mc={class:"space-y-3"},Ic={class:"space-y-2"},Vc={key:0,class:"border border-neutral-300 dark:border-neutral-700 rounded overflow-hidden"},Ac={class:"text-neutral-500 text-xs"},Pc={class:"relative bg-white dark:bg-neutral-900 border-t border-neutral-300 dark:border-neutral-700"},Lc={class:"absolute top-[5px] right-[5px]"},Ec={key:1,class:"border border-neutral-300 dark:border-neutral-700 rounded overflow-hidden"},jc={class:"text-xs font-semibold"},Oc={class:"text-neutral-500 text-xs"},Dc={class:"relative bg-white dark:bg-neutral-900 border-t border-neutral-300 dark:border-neutral-700"},qc={class:"absolute top-[5px] right-[5px]"},Uc={key:2,class:"border border-neutral-300 dark:border-neutral-700 rounded overflow-hidden"},Bc={class:"text-neutral-500 text-xs"},Nc={class:"relative bg-white dark:bg-neutral-900 border-t border-neutral-300 dark:border-neutral-700"},Rc={class:"absolute top-[5px] right-[5px]"},Fc={key:3},zc={class:"border border-neutral-300 dark:border-neutral-700 rounded overflow-hidden"},Hc={class:"text-xs font-semibold"},Wc={class:"text-neutral-500 text-xs"},Jc={class:"border-t border-neutral-300 dark:border-neutral-700"},Kc=["onClick"],Zc={class:"font-mono"},Gc={class:"text-neutral-500"},Xc={class:"px-2 py-2 bg-white dark:bg-neutral-950 border-t border-neutral-200 dark:border-neutral-800"},Yc={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mb-2"},Qc={key:0,class:"mb-4"},$c={class:"text-xs font-semibold text-red-600 dark:text-red-400 mb-1"},eu={class:"space-y-2"},tu={class:"px-2 py-1 bg-red-100 dark:bg-red-900/30 text-xs font-medium text-red-800 dark:text-red-200"},ou={class:"text-xs bg-red-50 dark:bg-red-950 p-2 overflow-x-auto text-red-900 dark:text-red-100"},ru={class:"mb-4"},au={class:"text-xs font-semibold text-red-600 dark:text-red-400 mb-1"},nu={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"},lu={key:2,class:"mb-4"},su={class:"w-full text-xs border border-neutral-300 dark:border-neutral-700 rounded"},iu={class:"border-b border-neutral-200 dark:border-neutral-800"},du={class:"py-1 px-2 font-mono"},cu={key:1},uu={class:"border-b border-neutral-200 dark:border-neutral-800"},pu={class:"py-1 px-2 font-mono"},mu={key:1},fu={key:0,class:"border-b border-neutral-200 dark:border-neutral-800"},gu={class:"py-1 px-2 font-mono"},hu={key:1},vu={class:"border-b border-neutral-200 dark:border-neutral-800"},bu={class:"py-1 px-2 font-mono"},yu={key:1},xu={key:1,class:"border-b border-neutral-200 dark:border-neutral-800"},ku={class:"py-1 px-2 font-mono text-accent-600 dark:text-accent-400"},_u={class:"border-b border-neutral-200 dark:border-neutral-800"},wu={class:"py-1 px-2 font-mono font-semibold"},Cu={key:1},Su={class:"py-1 px-2 font-mono font-semibold"},Tu={key:1},Mu={key:3,class:"mb-4"},Iu={class:"text-xs font-semibold mb-1"},Vu={class:"border border-neutral-300 dark:border-neutral-700 rounded overflow-hidden"},Au=["onClick"],Pu={class:"font-mono"},Lu={class:"text-neutral-500"},Eu={class:"px-2 py-2 bg-white dark:bg-neutral-950 border-t border-neutral-200 dark:border-neutral-800"},ju={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"},Du={class:"text-xs mb-2"},qu={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-neutral-200 dark:border-neutral-800"},Uu={class:"text-xs mb-2"},Bu={class:"rounded overflow-hidden border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-black"},Nu={key:0,class:"text-xs"},Ru={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"},Fu={key:1,class:"text-xs"},zu={key:4,class:"mb-4"},Hu={class:"border border-accent-300 dark:border-accent-700 rounded overflow-hidden bg-accent-50 dark:bg-accent-950/20"},Wu={class:"text-xs p-2 overflow-x-auto whitespace-pre-wrap max-h-96 text-accent-900 dark:text-accent-100"},Ju={key:5,class:"mb-4"},Ku={class:"text-xs font-semibold mb-1"},Zu={class:"border border-purple-300 dark:border-purple-700 rounded overflow-hidden bg-purple-50 dark:bg-purple-950/20"},Gu={class:"divide-y divide-purple-200 dark:divide-purple-800"},Xu={class:"flex items-center gap-2 mb-1"},Yu={class:"text-xs font-semibold text-purple-700 dark:text-purple-300"},Qu={key:0,class:"text-xs font-mono text-purple-600 dark:text-purple-400"},$u={key:1,class:"text-xs text-purple-500 dark:text-purple-500"},e0={key:2,class:"text-xs text-purple-500 dark:text-purple-500"},t0={key:0,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},o0={class:"text-purple-900 dark:text-purple-100 whitespace-pre-wrap"},r0={key:1,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},a0={class:"font-mono text-purple-700 dark:text-purple-300 break-all"},n0={key:2,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},l0={class:"text-purple-900 dark:text-purple-100 whitespace-pre-wrap"},s0={key:0,class:"mt-2 pt-2 border-t border-purple-200 dark:border-purple-800"},i0={class:"font-mono text-purple-700 dark:text-purple-300 text-xs break-all"},d0={key:3,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},c0={class:"text-purple-900 dark:text-purple-100 overflow-x-auto"},u0={key:6,class:"mb-4"},p0={class:"bg-white dark:bg-neutral-900 rounded overflow-hidden border border-neutral-300 dark:border-neutral-700"};function m0(p,t,a,e,c,i){return n(),l("div",Fd,[s(" Header "),o("div",zd,[o("div",Hd,[s(" Navigation Buttons "),o("div",Wd,[o("button",{onClick:t[0]||(t[0]=r=>e.emit("previous")),disabled:!a.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,Jd),o("button",{onClick:t[1]||(t[1]=r=>e.emit("next")),disabled:!a.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,Kd)]),o("h3",Zd,y(a.log.prompt_name||a.log.model_name||a.log.model),1)]),o("div",Gd,[o("button",{onClick:e.copyCurlCommand,disabled:e.copyingCurl||!a.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:a.log.request_body?"Copy cURL command":"No request data available"},[e.copyingCurl?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",Yd,y(e.copiedCurl?"Copied!":"Copy cURL"),1))],8,Xd),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)])])])]),s(" Summary Table "),o("div",Qd,[s(" Single table for wider containers "),o("div",$d,[o("table",ec,[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:Q(["py-1 font-mono",a.log.error?"text-red-600 dark:text-red-400":a.log.is_complete?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"])},y(a.log.error?"ERROR":a.log.is_complete?"SUCCESS":"LOADING"),3),o("td",tc,y(a.log.provider),1),o("td",oc,[!a.log.is_complete&&!a.log.prompt_name?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",rc,y(a.log.prompt_name||"—"),1))]),o("td",ac,[!a.log.is_complete&&!a.log.latency_ms?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",nc,y(a.log.latency_ms?`${a.log.latency_ms}ms`:"—"),1))]),o("td",lc,[!a.log.is_complete&&!a.log.total_tokens?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",sc,y(a.log.total_tokens?`${a.log.input_tokens}/${a.log.output_tokens} (${a.log.total_tokens})`:"—"),1))]),o("td",ic,[!a.log.is_complete&&!a.log.cost_total?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",dc,y(a.log.cost_total?`$${a.log.cost_total.toFixed(6)}`:"—"),1))]),o("td",cc,[C(e.TimeAgo,{timestamp:a.log.created_at},null,8,["timestamp"])])])])])]),s(" Two stacked tables for narrow containers "),o("div",uc,[s(" First table: Status, Provider, Prompt "),o("table",pc,[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:Q(["py-1 font-mono",a.log.error?"text-red-600 dark:text-red-400":a.log.is_complete?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"])},y(a.log.error?"ERROR":a.log.is_complete?"SUCCESS":"LOADING"),3),o("td",mc,y(a.log.provider),1),o("td",fc,[!a.log.is_complete&&!a.log.prompt_name?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",gc,y(a.log.prompt_name||"—"),1))])])])]),s(" Second table: Latency, Tokens, Cost, Created "),o("table",hc,[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",vc,[!a.log.is_complete&&!a.log.latency_ms?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",bc,y(a.log.latency_ms?`${a.log.latency_ms}ms`:"—"),1))]),o("td",yc,[!a.log.is_complete&&!a.log.total_tokens?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",xc,y(a.log.total_tokens?`${a.log.input_tokens}/${a.log.output_tokens} (${a.log.total_tokens})`:"—"),1))]),o("td",kc,[!a.log.is_complete&&!a.log.cost_total?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",_c,y(a.log.cost_total?`$${a.log.cost_total.toFixed(6)}`:"—"),1))]),o("td",wc,[C(e.TimeAgo,{timestamp:a.log.created_at},null,8,["timestamp"])])])])])])]),s(" Tabs (Sticky) "),o("div",Cc,[o("div",Sc,[o("button",{onClick:t[3]||(t[3]=r=>e.activeTab="request"),class:Q(["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:Q(["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]=ve(" Response ",-1)),a.log.error||e.errorsArray.length>0?(n(),l("span",Tc,"⚠")):s("v-if",!0)],2)])]),s(" Tab Content "),o("div",Mc,[s(" Request Tab "),ye(o("div",Ic,[s(" System Prompt (Collapsible) "),a.log.system_prompt?(n(),l("div",Vc,[o("button",{onClick:t[5]||(t[5]=r=>e.toggleSection("system_prompt")),class:"w-full px-3 py-2 text-left bg-neutral-50 dark:bg-neutral-950 hover:bg-neutral-100 dark:hover:bg-neutral-950 transition-colors flex items-center justify-between"},[t[16]||(t[16]=o("span",{class:"text-xs font-semibold"},"System Prompt",-1)),o("span",Ac,y(e.isSectionExpanded("system_prompt")?"▼":"▶"),1)]),ye(o("div",Pc,[C(e.CodeBlock,{code:a.log.system_prompt,language:"markdown"},null,8,["code"]),o("div",Lc,[C(e.CopyButton,{content:a.log.system_prompt,variant:"ghost",size:"xs"},null,8,["content"])])],512),[[Le,e.isSectionExpanded("system_prompt")]])])):s("v-if",!0),s(" Messages (Collapsible) "),a.log.message_history?(n(),l("div",Ec,[o("button",{onClick:t[6]||(t[6]=r=>e.toggleSection("messages")),class:"w-full px-3 py-2 text-left bg-neutral-50 dark:bg-neutral-950 hover:bg-neutral-100 dark:hover:bg-neutral-950 transition-colors flex items-center justify-between"},[o("span",jc,"Messages ("+y(a.log.message_history_length||0)+" messages)",1),o("span",Oc,y(e.isSectionExpanded("messages")?"▼":"▶"),1)]),ye(o("div",Dc,[C(e.CodeBlock,{code:e.formatJson(a.log.message_history),language:"json"},null,8,["code"]),o("div",qc,[C(e.CopyButton,{content:e.formatJson(a.log.message_history),variant:"ghost",size:"xs"},null,8,["content"])])],512),[[Le,e.isSectionExpanded("messages")]])])):s("v-if",!0),s(" Full Request Body (Collapsible) "),a.log.request_body?(n(),l("div",Uc,[o("button",{onClick:t[7]||(t[7]=r=>e.toggleSection("request_body")),class:"w-full px-3 py-2 text-left bg-neutral-50 dark:bg-neutral-950 hover:bg-neutral-100 dark:hover:bg-neutral-950 transition-colors flex items-center justify-between"},[t[17]||(t[17]=o("span",{class:"text-xs font-semibold"},"Full Request Body",-1)),o("span",Bc,y(e.isSectionExpanded("request_body")?"▼":"▶"),1)]),ye(o("div",Nc,[C(e.CodeBlock,{code:e.formatJson(a.log.request_body),language:"json"},null,8,["code"]),o("div",Rc,[C(e.CopyButton,{content:e.formatJson(a.log.request_body),variant:"ghost",size:"xs"},null,8,["content"])])],512),[[Le,e.isSectionExpanded("request_body")]])])):s("v-if",!0),s(" Tools (already accordion-style, keep as-is but after the main sections) "),e.tools.length>0?(n(),l("div",Fc,[o("div",zc,[o("button",{onClick:t[8]||(t[8]=r=>e.toggleSection("tools")),class:"w-full px-3 py-2 text-left bg-neutral-50 dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors flex items-center justify-between"},[o("span",Hc,"Available Tools ("+y(e.tools.length)+")",1),o("span",Wc,y(e.isSectionExpanded("tools")?"▼":"▶"),1)]),ye(o("div",Jc,[(n(!0),l(G,null,ue(e.tools,(r,d)=>(n(),l("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",Zc,y(r.function?.name||r.name||"Unknown"),1),o("span",Gc,y(e.expandedTools.has(d)?"▼":"▶"),1)],8,Kc),ye(o("div",Xc,[r.function?.description||r.description?(n(),l("div",Yc,y(r.function?.description||r.description),1)):s("v-if",!0),C(e.CodeBlock,{code:JSON.stringify(r,null,2),language:"json"},null,8,["code"])],512),[[Le,e.expandedTools.has(d)]])]))),128))],512),[[Le,e.isSectionExpanded("tools")]])])])):s("v-if",!0)],512),[[Le,e.activeTab==="request"]]),s(" Response Tab "),ye(o("div",null,[s(" Errors (Multiple errors from errors array) "),e.errorsArray.length>0?(n(),l("div",Qc,[o("div",$c,y(e.errorsArray.length>1?`Errors (${e.errorsArray.length})`:"Error"),1),o("div",eu,[(n(!0),l(G,null,ue(e.errorsArray,(r,d)=>(n(),l("div",{key:d,class:"border border-red-300 dark:border-red-700 rounded overflow-hidden"},[o("div",tu,y(r.type||"error"),1),o("pre",ou,y(r.message),1)]))),128))])])):a.log.error?(n(),l(G,{key:1},[s(" Fallback: Single error (for backwards compatibility) "),o("div",ru,[o("div",au," Error "+y(a.log.error_type?`(${a.log.error_type})`:""),1),o("pre",nu,y(a.log.error),1)])],2112)):s("v-if",!0),s(" Response Stats "),a.log.is_complete||!a.log.error?(n(),l("div",lu,[t[25]||(t[25]=o("div",{class:"text-xs font-semibold mb-1"},"Response Stats",-1)),o("table",su,[o("tbody",null,[o("tr",iu,[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"}," Finish Reason ",-1)),o("td",du,[!a.log.is_complete&&!a.log.finish_reason?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",cu,y(a.log.finish_reason||"—"),1))])]),o("tr",uu,[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"}," Input Tokens ",-1)),o("td",pu,[!a.log.is_complete&&!a.log.input_tokens?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",mu,y(a.log.input_tokens||"—"),1))])]),a.log.cached_tokens||!a.log.is_complete?(n(),l("tr",fu,[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"}," Cached Tokens ",-1)),o("td",gu,[!a.log.is_complete&&!a.log.cached_tokens?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",hu,y(a.log.cached_tokens||0),1))])])):s("v-if",!0),o("tr",vu,[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"}," Output Tokens ",-1)),o("td",bu,[!a.log.is_complete&&!a.log.output_tokens?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",yu,y(a.log.output_tokens||"—"),1))])]),a.log.reasoning_tokens&&a.log.reasoning_tokens>0?(n(),l("tr",xu,[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"}," Reasoning Tokens ",-1)),o("td",ku,y(a.log.reasoning_tokens),1)])):s("v-if",!0),o("tr",_u,[t[23]||(t[23]=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",wu,[!a.log.is_complete&&!a.log.total_tokens?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",Cu,y(a.log.total_tokens||"—"),1))])]),o("tr",null,[t[24]||(t[24]=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",Su,[!a.log.is_complete&&!a.log.cost_total?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",Tu,y(a.log.cost_total?`$${a.log.cost_total.toFixed(6)}`:"—"),1))])])])])])):s("v-if",!0),s(" Tools Called "),e.toolCallsDetailed.length>0?(n(),l("div",Mu,[o("div",Iu," Tools Called ("+y(e.toolCallsDetailed.length)+") ",1),o("div",Vu,[(n(!0),l(G,null,ue(e.toolCallsDetailed,(r,d)=>(n(),l("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",Pu,y(r.function?.name||"Unknown"),1),o("span",Lu,y(e.expandedToolCalls.has(d)?"▼":"▶"),1)],8,Au),ye(o("div",Eu,[o("div",ju,[t[26]||(t[26]=o("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Tool Call ID ",-1)),o("div",Ou,y(r.id),1)]),o("div",Du,[t[27]||(t[27]=o("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Function Name ",-1)),o("div",qu,y(r.function?.name),1)]),o("div",Uu,[t[28]||(t[28]=o("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Arguments ",-1)),o("div",Bu,[C(e.CodeBlock,{code:e.formatJson(r.function?.arguments||"{}"),language:"json"},null,8,["code"])])]),s(" Tool Result "),e.toolResults.has(r.id)?(n(),l("div",Nu,[t[29]||(t[29]=o("div",{class:"font-semibold text-green-600 dark:text-green-400 mb-1"}," Result ",-1)),o("pre",Ru,y(e.toolResults.get(r.id)?.content||"No content"),1)])):(n(),l("div",Fu,[...t[30]||(t[30]=[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),[[Le,e.expandedToolCalls.has(d)]])]))),128))])])):s("v-if",!0),s(" Reasoning Content (from models like o1) "),a.log.reasoning_content?(n(),l("div",zu,[t[32]||(t[32]=o("div",{class:"text-xs font-semibold mb-1"},"Reasoning Content",-1)),o("div",Hu,[t[31]||(t[31]=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",Wu,y(a.log.reasoning_content),1)])])):s("v-if",!0),s(" Reasoning Details (OpenRouter structured reasoning blocks) "),e.reasoningDetails.length>0?(n(),l("div",Ju,[o("div",Ku," Reasoning Details ("+y(e.reasoningDetails.length)+" blocks) ",1),o("div",Zu,[t[37]||(t[37]=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",Gu,[(n(!0),l(G,null,ue(e.reasoningDetails,(r,d)=>(n(),l("div",{key:d,class:"p-2"},[o("div",Xu,[o("span",Yu,y(r.type||"unknown"),1),r.id?(n(),l("span",Qu," ID: "+y(r.id),1)):s("v-if",!0),r.format?(n(),l("span",$u," Format: "+y(r.format),1)):s("v-if",!0),r.index!==void 0?(n(),l("span",e0," Index: "+y(r.index),1)):s("v-if",!0)]),s(" Summary type "),r.type==="reasoning.summary"&&r.summary?(n(),l("div",t0,[t[33]||(t[33]=o("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Summary: ",-1)),o("div",o0,y(r.summary),1)])):s("v-if",!0),s(" Encrypted type "),r.type==="reasoning.encrypted"&&r.data?(n(),l("div",r0,[t[34]||(t[34]=o("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Encrypted Data: ",-1)),o("div",a0,y(r.data),1)])):s("v-if",!0),s(" Text type "),r.type==="reasoning.text"&&r.text?(n(),l("div",n0,[t[36]||(t[36]=o("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Reasoning Text: ",-1)),o("div",l0,y(r.text),1),r.signature?(n(),l("div",s0,[t[35]||(t[35]=o("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Signature: ",-1)),o("div",i0,y(r.signature),1)])):s("v-if",!0)])):s("v-if",!0),s(" Unknown type - show raw JSON "),["reasoning.summary","reasoning.encrypted","reasoning.text"].includes(r.type)?s("v-if",!0):(n(),l("div",d0,[o("pre",c0,y(JSON.stringify(r,null,2)),1)]))]))),128))])])])):s("v-if",!0),s(" Response Body "),a.log.response_body?(n(),l("div",u0,[t[38]||(t[38]=o("div",{class:"text-xs font-semibold mb-1"},"Full Response Body",-1)),o("div",p0,[C(e.CodeBlock,{code:e.formatJson(a.log.response_body),language:"json"},null,8,["code"])])])):s("v-if",!0)],512),[[Le,e.activeTab==="response"]])])])}const f0=ee(Rd,[["render",m0],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/LogDetails.vue"]]),rt=20,wt=20,g0=te({__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:a}){const e=p,c=a,i=m(0),r=m(rt),{logs:d,total:u,hasMore:v,isFetching:g,error:h,wsConnected:f,wsError:k,connectWebSocket:x,disconnectWebSocket:w,refetch:M}=Sd(z(()=>e.threadId),{limit:z(()=>r.value),offset:z(()=>i.value),enableWebSocket:!0,order:"desc"}),b=m([]),S=m(!0),T=m(null),A=m(null),O=m(!1),R=m(!1),F=m(new Map),$=async()=>{await he(),A.value&&(A.value.scrollTop=A.value.scrollHeight)},B=m(null);ae(d,async Z=>{if(i.value===0)b.value=[...Z].reverse(),S.value&&b.value.length>0&&(await $(),S.value=!1);else{const ne=[...Z].reverse(),se=new Map;b.value.forEach(de=>se.set(de.id,de)),ne.forEach(de=>se.set(de.id,de)),b.value=Array.from(se.values()).sort((de,fe)=>de.created_at-fe.created_at)}},{deep:!0,immediate:!0}),ae(g,(Z,ne)=>{if(ne&&!Z&&i.value===0&&e.threadId&&B.value!==e.threadId&&b.value.length>0){B.value=e.threadId;const se=b.value[b.value.length-1];c("logsLoaded",se?.id??null)}});const{logDetails:D,isFetching:W}=Td(z(()=>e.threadId),z(()=>T.value)),U=z(()=>{if(!T.value)return null;const ne=b.value.find(se=>se.id===T.value);return ne?D.value?{...D.value,...ne}:ne:null}),P=z(()=>T.value?J.value.findIndex(Z=>Z.id===T.value):-1),H=z(()=>P.value>0),K=z(()=>P.value>=0&&P.value<J.value.length-1),j=()=>{if(H.value){const Z=J.value[P.value-1];q(Z)}},L=()=>{if(K.value){const Z=J.value[P.value+1];q(Z)}},V=Z=>{if(!A.value)return;const ne=F.value.get(Z);if(!ne)return;const se=A.value,de=ne.getBoundingClientRect(),fe=se.getBoundingClientRect(),be=se.querySelectorAll(".sticky");let Te=0;be.forEach(Pe=>{Te+=Pe.getBoundingClientRect().height}),Te+=16;const _e=de.top<fe.top+Te,Oe=de.bottom>fe.bottom;_e?se.scrollBy({top:de.top-fe.top-Te,behavior:"smooth"}):Oe&&se.scrollBy({top:de.bottom-fe.bottom,behavior:"smooth"})},q=Z=>{c("logClick",Z.id),T.value=Z.id},_=(Z,ne)=>{ne?F.value.set(Z,ne):F.value.delete(Z)};ae(T,async Z=>{Z&&(await he(),V(Z))}),ae(()=>e.selectedLogId,Z=>{Z&&(T.value=Z)});const I=async Z=>{await he();const ne=F.value.get(Z);if(ne&&A.value){const se=A.value,de=ne.getBoundingClientRect(),fe=se.getBoundingClientRect(),be=se.querySelector("thead"),Te=se.querySelector(":scope > div > div.sticky");let _e=0;be&&(_e+=be.getBoundingClientRect().height),Te&&(_e+=Te.getBoundingClientRect().height),_e+=40;const Oe=de.top<fe.top+_e,Pe=de.bottom>fe.bottom;Oe?se.scrollBy({top:de.top-fe.top-_e,behavior:"smooth"}):Pe&&se.scrollBy({top:de.bottom-fe.bottom,behavior:"smooth"})}};t({scrollToLog:I});const E=async()=>{if(R.value||!v.value||g.value)return;R.value=!0;const Z=A.value?.scrollHeight||0;if(i.value+=r.value,r.value=wt,await M(),await he(),A.value){const ne=A.value.scrollHeight;A.value.scrollTop+=ne-Z}R.value=!1};ae(()=>e.threadId,async Z=>{Z?(w(),x()):w(),i.value=0,r.value=rt,b.value=[],T.value=null,O.value=!1,S.value=!0},{immediate:!0}),ae(b,async()=>{O.value||await $()},{deep:!0});const N=()=>{if(!A.value)return;const{scrollTop:Z,scrollHeight:ne,clientHeight:se}=A.value,de=ne-Z-se<50;O.value=!de},ie=Z=>{if(!Z.tools_called)return"—";try{const ne=JSON.parse(Z.tools_called);return Array.isArray(ne)?ne.join(", "):Z.tools_called}catch{return Z.tools_called}},pe=Z=>Z==null?"—":`$${Z.toFixed(6)}`,J=z(()=>{const Z=new Map,ne=new Map;b.value.forEach(fe=>{Z.set(fe.id,fe);const be=fe.parent_log_id;be&&(ne.has(be)||ne.set(be,[]),ne.get(be).push(fe))});const se=[],de=(fe,be)=>{se.push({...fe,depth:be}),(ne.get(fe.id)||[]).forEach(_e=>{de(_e,be+1)})};return b.value.forEach(fe=>{fe.parent_log_id||de(fe,0)}),se}),le={props:e,emit:c,INITIAL_LOAD_LIMIT:rt,LOAD_MORE_LIMIT:wt,offset:i,limit:r,fetchedLogs:d,total:u,hasMore:v,isFetching:g,error:h,wsConnected:f,wsError:k,connectWebSocket:x,disconnectWebSocket:w,refetch:M,allLoadedLogs:b,isFirstLoad:S,selectedLogIdForDetails:T,logsScrollContainer:A,userHasScrolledUp:O,isLoadingMore:R,logRowRefs:F,scrollToBottom:$,emittedLogsLoadedForThreadId:B,logDetails:D,isFetchingDetails:W,selectedLog:U,selectedLogIndex:P,hasPreviousLog:H,hasNextLog:K,navigateToPreviousLog:j,navigateToNextLog:L,scrollLogIntoView:V,selectLog:q,setLogRowRef:_,scrollToLog:I,loadMoreLogs:E,handleScroll:N,getToolsCalled:ie,formatCost:pe,logsWithDepth:J,LogDetailsComponent:f0,Loader:Je,TimeAgo:ut,StatusDot:pt,get ScrollTextIcon(){return Lt},get ChevronLeftIcon(){return dt},get RotateCwIcon(){return xo}};return Object.defineProperty(le,"__isScriptSetup",{enumerable:!1,value:!0}),le}}),h0={class:"flex flex-col h-full"},v0={class:"p-4 border-b border-neutral-300 dark:border-neutral-700"},b0={class:"flex items-center justify-between"},y0={class:"flex items-center gap-2"},x0={class:"flex items-center gap-2"},k0={key:0,class:"text-neutral-500 dark:text-neutral-400 text-center py-12"},_0={class:"flex justify-center py-12"},w0={class:"text-red-600 dark:text-red-400 text-center py-12"},C0={key:0,class:"border-b border-neutral-300 dark:border-neutral-700 bg-white dark:bg-black sticky top-0 z-10"},S0=["disabled"],T0={key:1},M0={key:2},I0={class:"w-full text-sm"},V0=["onClick","onMouseenter"],A0={class:"px-3 py-2 text-xs"},P0={class:"flex items-center gap-1"},L0={key:0,class:"text-neutral-400 dark:text-neutral-600 mr-1"},E0={key:3},j0={class:"px-3 py-2"},O0={class:"flex items-center gap-2"},D0={key:0,class:"text-red-600 dark:text-red-400",title:"Error"},q0={class:"font-mono text-xs"},U0={class:"px-3 py-2 font-mono text-xs"},B0={key:1},N0={class:"px-3 py-2 text-xs text-neutral-600 dark:text-neutral-400"},R0={key:1},F0={class:"px-3 py-2 text-right text-xs text-neutral-500 dark:text-neutral-500"},z0={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"},H0={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"},W0={key:0,class:"absolute inset-0 bg-white/50 dark:bg-black/50 flex items-center justify-center"};function J0(p,t,a,e,c,i){return n(),l("div",h0,[s(" Header "),o("div",v0,[o("div",b0,[o("div",y0,[C(e.ScrollTextIcon,{size:20,class:"shrink-0"}),t[4]||(t[4]=o("h2",{class:"text-xl font-bold"},"Logs",-1)),a.threadId?(n(),Y(e.StatusDot,{key:0,connected:e.wsConnected,error:e.wsError},null,8,["connected","error"])):s("v-if",!0)]),o("div",x0,[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})])])])]),s(" Top half: Scrollable logs list "),o("div",{ref:"logsScrollContainer",class:"logs-list-container flex-1 overflow-y-auto overflow-x-auto",onScroll:e.handleScroll},[s(" No thread selected "),a.threadId?e.isFetching&&e.offset===0?(n(),l(G,{key:1},[s(" Loading state (initial load only) "),o("div",_0,[C(e.Loader)])],2112)):e.error?(n(),l(G,{key:2},[s(" Error state "),o("div",w0," Error loading logs: "+y(e.error),1)],2112)):e.allLoadedLogs.length===0?(n(),l(G,{key:3},[s(" 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)):(n(),l(G,{key:4},[s(" Logs table "),o("div",null,[s(" Load previous logs button "),e.hasMore?(n(),l("div",C0,[o("button",{onClick:e.loadMoreLogs,disabled:e.isLoadingMore,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?(n(),Y(e.Loader,{key:0,size:"xs"})):s("v-if",!0),e.isLoadingMore?(n(),l("span",T0,"Loading older logs...")):(n(),l("span",M0,"Load previous logs"))],8,S0)])):s("v-if",!0),o("table",I0,[o("thead",{class:Q(["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-2 font-semibold"},"Prompt"),o("th",{class:"text-left px-3 py-2 font-semibold"},"Model"),o("th",{class:"text-left px-3 py-2 font-semibold"},"Cost"),o("th",{class:"text-left px-3 py-2 font-semibold"},"Tools Called"),o("th",{class:"text-right px-3 py-2 font-semibold"},"Called At")],-1)])],2),o("tbody",null,[(n(!0),l(G,null,ue(e.logsWithDepth,r=>(n(),l("tr",{key:r.id,ref_for:!0,ref:d=>e.setLogRowRef(r.id,d),class:Q(["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",A0,[o("div",P0,[r.depth>0?(n(),l("span",L0,"└─")):s("v-if",!0),r.retry_of_log_id?(n(),Y(e.RotateCwIcon,{key:1,size:14,class:"text-neutral-500 dark:text-neutral-400 flex-shrink-0"})):s("v-if",!0),!r.is_complete&&!r.prompt_name?(n(),Y(e.Loader,{key:2,size:"xs"})):(n(),l("span",E0,y(r.prompt_name||"—"),1))])]),o("td",j0,[o("div",O0,[r.error?(n(),l("span",D0," ✕ ")):s("v-if",!0),o("span",q0,y(r.model_name||r.model),1)])]),o("td",U0,[!r.is_complete&&!r.cost_total?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",B0,y(e.formatCost(r.cost_total)),1))]),o("td",N0,[!r.is_complete&&e.getToolsCalled(r)==="—"?(n(),Y(e.Loader,{key:0,size:"xs"})):(n(),l("span",R0,y(e.getToolsCalled(r)),1))]),o("td",F0,[C(e.TimeAgo,{timestamp:r.created_at},null,8,["timestamp"])])],42,V0))),128))])])])],2112)):(n(),l("div",k0," Select a thread to view logs "))],544),s(" Bottom half: Log details "),C(De,{name:"slide-up",onAfterEnter:t[3]||(t[3]=()=>e.selectedLogIdForDetails&&e.scrollLogIntoView(e.selectedLogIdForDetails))},{default:re(()=>[e.selectedLog?(n(),l("div",z0,[o("div",H0,[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"]),s(" Loading overlay for log details "),e.isFetchingDetails?(n(),l("div",W0,[C(e.Loader)])):s("v-if",!0)])])):s("v-if",!0)]),_:1})])}const K0=ee(g0,[["render",J0],["__scopeId","data-v-607bd0a4"],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/LogsPane.vue"]]),Z0=te({__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:a}){t();const e=p,c=a,i=z(()=>!!e.editThread),r=m(""),d=m(""),u=m({}),v=m([]),g=m(""),h=m(!1),f=m(""),k=m(null),{data:x,isFetching:w,execute:M}=we(X("/api/agents"),{immediate:!1}).json(),b=z(()=>x.value?(x.value?.agents||[]).map(q=>({value:q.id,label:q.title})):[]),S=z(()=>!r.value||!x.value?null:(x.value?.agents||[]).find(q=>q.id===r.value)),T=z(()=>S.value&&S.value.type==="ai_human"?"AI":"Side A"),A=z(()=>S.value&&S.value.type==="ai_human"?"Human":"Side B"),{data:O,isFetching:R,execute:F}=we(z(()=>S.value?.side_a_system_prompt?X(`/api/prompts/${S.value.side_a_system_prompt}`):""),{immediate:!1}).json(),$=z(()=>{if(!O.value)return null;const V=O.value?.required_schema;if(!V)return null;try{return typeof V=="string"?JSON.parse(V):V}catch{return null}}),B=z(()=>{const V=$.value;return!V||!V.properties?[]:Object.entries(V.properties).map(([q,_])=>({name:q,type:_.type||"string",description:_.description||"",required:V.required?.includes(q)||!1,enum:_.enum}))});ae(r,async V=>{V&&S.value?.side_a_system_prompt?(await F(),u.value={}):u.value={}});const D=()=>{const V=k.value;V&&(V.style.height="auto",V.style.height=`${V.scrollHeight}px`)},W=V=>{g.value.trim()&&(v.value.push({id:crypto.randomUUID(),role:V,content:g.value.trim()}),g.value="",setTimeout(()=>D(),0))},U=V=>{v.value=v.value.filter(q=>q.id!==V)},P=()=>{r.value="",d.value="",u.value={},v.value=[],g.value="",f.value=""},H=()=>{e.editThread&&(r.value=e.editThread.agent_id,d.value=e.editThread.tags?.join(", ")||"")},K=async()=>{if(!r.value){f.value="Please select an agent";return}if(!i.value&&B.value.length>0){for(const V of B.value)if(V.required&&!u.value[V.name]){f.value=`Please provide ${V.name}`;return}}h.value=!0,f.value="";try{const V=d.value.split(",").map(q=>q.trim()).filter(q=>q.length>0);if(i.value){const q=await fetch(X(`/api/threads/${e.editThread.id}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tags:V})});if(!q.ok){const _=await q.json();throw new Error(_.error||"Failed to update thread")}c("thread-updated"),P(),c("update:modelValue",!1)}else{const q={agent_id:r.value,tags:V.length>0?V:void 0};v.value.length>0&&(q.initial_messages=v.value.map(N=>({role:N.role,content:N.content}))),Object.keys(u.value).length>0&&(q.data=u.value);const _=await fetch(X("/api/threads"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(q)});if(!_.ok){const N=await _.json();throw new Error(N.error||"Failed to create thread")}const E=(await _.json()).threadId;if(!E)throw new Error("Thread created but ID not found in response");c("thread-created",E),P(),c("update:modelValue",!1)}}catch(V){console.error(`Error ${i.value?"updating":"creating"} thread:`,V),f.value=V.message||`Failed to ${i.value?"update":"create"} thread`}finally{h.value=!1}},j=()=>{P(),c("update:modelValue",!1)};ae(()=>e.modelValue,async V=>{V&&(await M(),P(),i.value&&H())});const L={props:e,emit:c,isEditMode:i,selectedAgentId:r,tags:d,requiredData:u,messages:v,newMessageContent:g,isSubmitting:h,errorMessage:f,textareaRef:k,agentsData:x,isFetchingAgents:w,fetchAgents:M,agentOptions:b,selectedAgent:S,sideALabel:T,sideBLabel:A,promptData:O,isFetchingPrompt:R,fetchPrompt:F,requiredSchema:$,schemaFields:B,adjustHeight:D,addMessage:W,removeMessage:U,resetForm:P,populateEditForm:H,handleSubmit:K,handleCancel:j,Modal:je,SelectInput:Se,TextInput:Ne,TextareaInput:Ht};return Object.defineProperty(L,"__isScriptSetup",{enumerable:!1,value:!0}),L}}),G0={class:"space-y-4"},X0={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"},Y0={class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Q0={key:0},$0={key:1},e2={key:1,class:"space-y-4 p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},t2={class:"flex items-center gap-2"},o2=["onUpdate:modelValue","id"],r2=["for"],a2={key:0,class:"text-red-500"},n2={key:5,class:"text-xs text-neutral-500 dark:text-neutral-400 mt-1"},l2={key:2,class:"p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg text-center text-sm text-neutral-500"},s2={key:3},i2={key:0,class:"space-y-3 mb-4 max-h-64 overflow-y-auto p-2"},d2={class:"text-xs font-medium mb-1 opacity-70"},c2={class:"text-sm whitespace-pre-wrap"},u2=["onClick"],p2={class:"space-y-2"},m2={class:"flex items-stretch border border-black dark:border-neutral-300 rounded overflow-hidden bg-white dark:bg-neutral-900"},f2=["disabled","title"],g2={class:"flex-1 relative"},h2=["disabled","title"],v2={class:"text-xs text-neutral-500 dark:text-neutral-400"},b2={class:"flex justify-between"},y2=["disabled"],x2=["disabled"];function k2(p,t,a,e,c,i){return n(),Y(e.Modal,{"model-value":a.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:re(()=>[o("div",b2,[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,y2),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?(n(),l(G,{key:0},[ve(y(e.isSubmitting?"Updating...":"Update Thread"),1)],64)):(n(),l(G,{key:1},[ve(y(e.isSubmitting?"Creating...":"Create Thread"),1)],64))],8,x2)])]),default:re(()=>[o("div",G0,[s(" Error Message "),e.errorMessage?(n(),l("div",X0,y(e.errorMessage),1)):s("v-if",!0),s(" 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",Y0,[e.isEditMode?(n(),l("span",Q0,"Agent cannot be changed after thread creation")):(n(),l("span",$0,"Choose which agent will handle this conversation"))])]),s(" Dynamic schema fields (only in create mode) "),!e.isEditMode&&e.schemaFields.length>0&&!e.isFetchingPrompt?(n(),l("div",e2,[t[8]||(t[8]=o("h4",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"}," Required Information ",-1)),(n(!0),l(G,null,ue(e.schemaFields,r=>(n(),l("div",{key:r.name,class:"space-y-2"},[s(" Enum field (dropdown) "),r.enum?(n(),Y(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"?(n(),l(G,{key:1},[s(" 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"?(n(),l(G,{key:2},[s(" 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"?(n(),l(G,{key:3},[s(" Boolean field "),o("div",t2,[ye(o("input",{"onUpdate:modelValue":d=>e.requiredData[r.name]=d,type:"checkbox",id:`field-${r.name}`,class:"w-4 h-4"},null,8,o2),[[ko,e.requiredData[r.name]]]),o("label",{for:`field-${r.name}`,class:"text-sm"},[ve(y(r.name)+" ",1),r.required?(n(),l("span",a2,"*")):s("v-if",!0)],8,r2)])],2112)):(n(),l(G,{key:4},[s(" 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?(n(),l("p",n2,y(r.description),1)):s("v-if",!0)]))),128))])):s("v-if",!0),s(" Loading prompt schema (only in create mode) "),!e.isEditMode&&e.isFetchingPrompt?(n(),l("div",l2," Loading agent requirements... ")):s("v-if",!0),s(" Conversation Builder (only in create mode) "),e.isEditMode?s("v-if",!0):(n(),l("div",s2,[t[12]||(t[12]=o("h4",{class:"text-sm font-medium mb-3"},"Initial Conversation",-1)),s(" Messages List (iOS style) "),e.messages.length>0?(n(),l("div",i2,[(n(!0),l(G,null,ue(e.messages,r=>(n(),l("div",{key:r.id,class:Q(["flex items-start gap-2",{"justify-start":r.role==="assistant","justify-end":r.role==="user"}])},[o("div",{class:Q(["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",d2,y(r.role==="assistant"?e.sideALabel:e.sideBLabel),1),o("div",c2,y(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,u2)],2))),128))])):(n(),l(G,{key:1},[s(" 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)),s(" Add Message Form "),o("div",p2,[s(" Unified Input Container "),o("div",m2,[s(" 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,y(e.sideALabel),1)],8,f2),s(" Multiline Input (no border, no padding adjustments needed) "),o("div",g2,[ye(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]=nt(ke(r=>e.addMessage("user"),["meta"]),["enter"])),t[4]||(t[4]=nt(ke(r=>e.addMessage("user"),["ctrl"]),["enter"]))]},null,544),[[Me,e.newMessageContent]])]),s(" 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,y(e.sideBLabel),1)],8,h2)]),o("p",v2," Type a message and click "+y(e.sideALabel)+" (left) or "+y(e.sideBLabel)+" (right) to add. Or press Cmd+Enter (Mac) / Ctrl+Enter (Windows) to add as "+y(e.sideBLabel)+". ",1)])])),s(" 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 _2=ee(Z0,[["render",k2],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/threads/CreateThreadModal.vue"]]),w2=te({__name:"ThreadsView",setup(p,{expose:t}){t();const a=qe(),e=ze(),c=m(typeof a.params.id=="string"?a.params.id:null),i=m({threadList:!1,messages:!1,logs:!1}),r=m(!1),d=m(null),u=m(null),{thread:v}=ct(z(()=>c.value)),g=m(null),h=m(null),f=m(null),k=P=>{f.value=P},x=P=>{f.value=P},w=m(null),M=m(null);ae(()=>a.params.id,P=>{c.value=typeof P=="string"?P:null,g.value=null,h.value=null});const U={route:a,router:e,selectedThreadId:c,collapsedPanes:i,showThreadModal:r,editingThread:d,threadListPaneRef:u,thread:v,selectedMessageId:g,selectedLogId:h,hoveredLogId:f,handleMessageHover:k,handleLogHover:x,messagesPaneRef:w,logsPaneRef:M,handleThreadSelect:P=>{e.push(`/threads/${P}`)},handleThreadDeleted:P=>{window.location.href="/threads"},handleEditThread:()=>{v.value&&(d.value=v.value,r.value=!0)},handleCreateThread:()=>{d.value=null,r.value=!0},handleThreadCreated:P=>{u.value?.refetch(),e.push(`/threads/${P}`)},handleThreadUpdated:()=>{window.location.reload()},togglePane:P=>{i.value[P]=!i.value[P]},handleMessageClick:(P,H)=>{g.value=P,h.value=H,H&&M.value?.scrollToLog(H)},handleLogClick:P=>{h.value=P,g.value=null,w.value?.scrollToLogId(P)},handleLogsLoaded:P=>{P&&(h.value=P)},handleThreadsLoaded:P=>{P&&!c.value&&e.push(`/threads/${P}`)},ThreadListPane:Is,MessagesPane:Cd,LogsPane:K0,CreateThreadModal:_2,get ListIcon(){return Vt},get MessageSquareIcon(){return Pt},get ScrollTextIcon(){return Lt}};return Object.defineProperty(U,"__isScriptSetup",{enumerable:!1,value:!0}),U}}),C2={class:"flex h-full overflow-hidden"},S2={key:0,class:"flex flex-col items-center p-4"},T2={key:0,class:"flex flex-col items-center p-4"},M2={key:0,class:"flex flex-col items-center p-4"};function I2(p,t,a,e,c,i){return n(),l("div",C2,[s(" Pane 1: Thread List "),o("div",{class:Q([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?(n(),l("div",S2,[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})])])):(n(),Y(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),s(" Pane 2: Messages "),o("div",{class:Q([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?(n(),l("div",T2,[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})])])):(n(),Y(e.MessagesPane,{key:1,ref:"messagesPaneRef","thread-id":e.selectedThreadId,"selected-message-id":e.selectedMessageId,"selected-log-id":e.selectedLogId,"hovered-log-id":e.hoveredLogId,onCollapse:t[3]||(t[3]=r=>e.togglePane("messages")),onMessageClick:e.handleMessageClick,onMessageHover:e.handleMessageHover,onThreadDeleted:e.handleThreadDeleted,onEditThread:e.handleEditThread},null,8,["thread-id","selected-message-id","selected-log-id","hovered-log-id"]))],2),s(" Pane 3: Logs (flexible width) "),o("div",{class:Q([e.collapsedPanes.logs?"w-[60px]":"flex-1","overflow-hidden transition-all duration-200"])},[e.collapsedPanes.logs?(n(),l("div",M2,[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})])])):(n(),Y(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),s(" 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 Ct=ee(w2,[["render",I2],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/ThreadsView.vue"]]),V2=te({__name:"PromptsDataTable",emits:["add","edit","delete"],setup(p,{expose:t,emit:a}){const e=a,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:(h,f)=>h||f.model_id||"-"},{key:"created_at",label:"Created",width:"w-1/6",formatter:h=>h?new Date(h*1e3).toLocaleDateString():"-"}],d=[{icon:"edit",label:"Edit",handler:h=>e("edit",h)},{icon:"delete",label:"Delete",handler:async h=>{await v(h)},confirm:!0,confirmMessage:"Are you sure you want to delete this prompt?"}],u=async()=>{i.value=!0;try{const h=await fetch(X("/api/prompts"));if(h.ok){const f=await h.json();c.value=f.prompts||[]}}catch(h){console.error("Error fetching prompts:",h)}finally{i.value=!1}},v=async h=>{try{const f=await fetch(X(`/api/prompts/${h.id}`),{method:"DELETE"});if(f.ok)await u();else{const k=await f.json();alert(k.error||"Failed to delete prompt")}}catch(f){console.error("Error deleting prompt:",f),alert("Failed to delete prompt")}};ge(()=>{u()}),t({refresh:u});const g={emit:e,prompts:c,loading:i,columns:r,actions:d,fetchPrompts:u,deletePrompt:v,DataTable:Be};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}});function A2(p,t,a,e,c,i){return n(),l("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 P2=ee(V2,[["render",A2],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/PromptsDataTable.vue"]]),L2=te({__name:"PromptBasicInfo",props:{name:{type:String,required:!0},toolDescription:{type:String,required:!0}},emits:["update:name","update:toolDescription"],setup(p,{expose:t,emit:a}){t();const e=p,c=a,i=m(""),r=v=>{let g=v.replace(/[^a-zA-Z0-9\s_]/g,"");return g=g.trim().toLowerCase().replace(/\s+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),g?/^[a-z][a-z0-9_]*$/.test(g)?i.value="":i.value="Name must start with a letter and contain only lowercase letters, numbers, and underscores":i.value="Name is required",g},d=v=>{const g=r(v);c("update:name",g)};ae(()=>e.name,v=>{v&&r(v)},{immediate:!0});const u={props:e,emit:c,nameError:i,validateAndFormatName:r,handleNameInput:d,TextInput:Ne};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),E2={class:"space-y-4"},j2={key:0,class:"mt-1 text-sm text-red-500"},O2={key:1,class:"mt-1 text-sm text-neutral-500 dark:text-neutral-400"},D2={class:"px-1 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},q2=["value"];function U2(p,t,a,e,c,i){return n(),l("div",E2,[o("div",null,[C(e.TextInput,{"model-value":a.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?(n(),l("p",j2,y(e.nameError),1)):a.name?(n(),l("p",O2,[t[1]||(t[1]=ve(" Will be saved as: ",-1)),o("code",D2,y(a.name),1)])):s("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:a.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,q2)])])}const B2=ee(L2,[["render",U2],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/prompt-form/PromptBasicInfo.vue"]]),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%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",Ye="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",R2="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",St="/agents/assets/img/meta.svg",F2="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",z2="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,%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",W2="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",J2="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBmaWxsPSJub25lIj4KICA8cmVjdCB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIGZpbGw9IiNGRjZCNkIiLz4KICA8dGV4dCB4PSI1MCUiIHk9IjUwJSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZmlsbD0id2hpdGUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZm9udC13ZWlnaHQ9ImJvbGQiPk1NPC90ZXh0Pgo8L3N2Zz4=",K2="/agents/assets/img/moonshotai.svg",Z2="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",G2="/agents/assets/img/zai.svg",X2="/agents/assets/img/zai.svg",Y2="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBmaWxsPSJub25lIj4KICA8cmVjdCB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIGZpbGw9IiNBOEU2QTMiLz4KICA8dGV4dCB4PSI1MCUiIHk9IjUwJSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZmlsbD0iIzJDM0U1MCIgZm9udC1mYW1pbHk9IkFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE0IiBmb250LXdlaWdodD0iYm9sZCI+RVhBPC90ZXh0Pgo8L3N2Zz4=",st="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 Q2(p){const t=We();return t==="/"?p.replace("/agents/","/"):p.replace("/agents/",`${t}/`)}const $2={anthropic:N2,openai:Ye,"openai-sdk":Ye,google:R2,meta:St,"meta-llama":St,nvidia:F2,alibaba:z2,deepseek:H2,qwen:W2,minimax:J2,moonshotai:K2,"x-ai":Z2,"z-ai":G2,zai:X2,exaone:Y2,openrouter:st},ep=new Proxy($2,{get(p,t){const a=p[t];return a?Q2(a):void 0}});function tp(p){if(p&&p.includes("/"))return p.split("/")[0].toLowerCase()}function Qe(p){return ep[p.toLowerCase()]}function mt(p,t){const a=tp(p);if(a){const e=Qe(a);if(e)return e}if(t)return Qe(t)}const op=te({__name:"PromptModelSelect",props:{modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(p,{expose:t,emit:a}){t();const e=p,c=a,i=m([]),r=m(!1),d=z(()=>i.value.map(g=>({value:g.id,label:g.name,description:g.model||g.provider,icon:mt(g.model||g.name,g.provider_id||g.provider)}))),u=async()=>{r.value=!0;try{const g=await fetch(X("/api/models"));if(g.ok){const h=await g.json();i.value=h.models||[]}}catch(g){console.error("Error fetching models:",g)}finally{r.value=!1}};ge(()=>{u()});const v={props:e,emit:c,models:i,loadingModels:r,modelOptions:d,fetchModels:u,SelectInput:Se};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),rp={class:"space-y-4"};function ap(p,t,a,e,c,i){return n(),l("div",rp,[C(e.SelectInput,{"model-value":a.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 np=ee(op,[["render",ap],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/prompt-form/PromptModelSelect.vue"]]),lp=te({__name:"PropertyEditor",props:Ve({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:Ve(["remove","description-keydown","add-top-level"],["update:modelValue"]),setup(p,{expose:t,emit:a}){t();const e=p,c=a,i=Ue(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>'},v=[{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"}],g=z(()=>["object","array","enum","anyOf"].includes(i.value.type));ae(()=>i.value.type,async(T,A)=>{if(["object","array","enum","anyOf"].includes(T)&&(r.value=!0,T==="anyOf"&&!i.value.anyOf&&(i.value.anyOf=[]),T==="object"&&!i.value.properties&&(i.value.properties=[{id:crypto.randomUUID(),name:"property1",type:"string",description:""}]),T==="array"&&!i.value.items&&(i.value.items={id:crypto.randomUUID(),name:"",type:"string",description:""}),T==="enum"&&!i.value.enum&&(i.value.enum=["value1"])),A!==void 0){await he();const O=e.isNested?`[data-nested-property-id="${e.propertyId}"] input[placeholder="Description"]`:`[data-property-id="${e.propertyId}"] input[placeholder="Description"]`,R=document.querySelector(O);R&&R.focus()}});const h=T=>{T.shiftKey&&i.value.type==="object"&&i.value.properties?w():c("add-top-level")},f=()=>{i.value.items||(i.value.items={id:crypto.randomUUID(),name:"",type:"string",description:""})},k=()=>{i.value.enum||(i.value.enum=[]),i.value.enum.push(`value${i.value.enum.length+1}`)},x=T=>{i.value.enum&&i.value.enum.splice(T,1)},w=async()=>{const T={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(T)):(i.value.properties||(i.value.properties=[]),i.value.properties.push(T)),await he();const A=document.querySelector(`[data-nested-property-id="${T.id}"] input[placeholder="Property name"]`);A&&(A.focus(),A.select())},S={props:e,emit:c,modelValue:i,expanded:r,propertyListRef:d,typeIcons:u,typeOptions:v,isExpandable:g,handleEnterKey:h,initArrayItems:f,addEnumValue:k,removeEnumValue:x,addNestedProperty:w,removeNestedProperty:T=>{i.value.type==="anyOf"&&i.value.anyOf?i.value.anyOf=i.value.anyOf.filter(A=>A.id!==T):i.value.properties&&(i.value.properties=i.value.properties.filter(A=>A.id!==T))},handleNestedDescriptionKeydown:T=>{},SelectInput:Se,TextInput:Ne};return Object.defineProperty(S,"__isScriptSetup",{enumerable:!1,value:!0}),S}}),sp=["data-property-id","data-nested-property-id"],ip={class:"p-3 space-y-3"},dp={class:"flex items-start gap-2"},cp={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"},up={class:"flex-1 grid grid-cols-1 md:grid-cols-3 gap-2"},pp={class:"flex items-center gap-2 mt-2"},mp=["disabled"],fp={key:0,class:"ml-6"},gp={key:0,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg space-y-2"},hp={class:"flex items-center justify-between mb-2"},vp=["disabled"],bp={key:0,class:"space-y-1"},yp=["onClick","disabled"],xp={key:1,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},kp={class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"},_p={class:"space-y-2"},wp={class:"flex items-center justify-between"},Cp=["disabled"],Sp={class:"space-y-2"},Tp={key:2,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},Mp={key:0,class:"mb-2"},Ip=["disabled"],Vp={key:1,class:"space-y-2"};function Ap(p,t,a,e,c,i){const r=_o("PropertyEditor",!0);return n(),l("div",{"data-property-id":a.isNested?void 0:a.propertyId,"data-nested-property-id":a.isNested?a.propertyId:void 0,class:Q(["border rounded-lg",a.isNested?"border-neutral-100 dark:border-neutral-900":"border-neutral-200 dark:border-neutral-800"])},[o("div",ip,[o("div",dp,[s(" Drag handle "),a.enableDrag?(n(),l("div",cp,[...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)])])):s("v-if",!0),s(" Property fields "),o("div",up,[C(e.TextInput,{modelValue:e.modelValue.name,"onUpdate:modelValue":t[0]||(t[0]=d=>e.modelValue.name=d),placeholder:"Property name",disabled:a.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:a.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:a.disabled,onKeydown:t[3]||(t[3]=nt(ke(d=>e.handleEnterKey(d),["prevent"]),["enter"]))},null,8,["modelValue","disabled"])]),s(" Controls "),o("div",pp,[e.isExpandable?(n(),l("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"},[(n(),l("svg",{class:Q(["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))])):s("v-if",!0),o("button",{onClick:t[5]||(t[5]=d=>p.$emit("remove")),type:"button",disabled:a.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,mp)])]),s(" Expandable content "),e.expanded&&e.isExpandable?(n(),l("div",fp,[s(" Enum values "),e.modelValue.type==="enum"?(n(),l("div",gp,[o("div",hp,[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:a.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,vp)]),e.modelValue.enum?(n(),l("div",bp,[(n(!0),l(G,null,ue(e.modelValue.enum,(d,u)=>(n(),l("div",{key:u,class:"flex items-center gap-2"},[C(e.TextInput,{modelValue:e.modelValue.enum[u],"onUpdate:modelValue":v=>e.modelValue.enum[u]=v,placeholder:"Enum value",disabled:a.disabled,class:"flex-1"},null,8,["modelValue","onUpdate:modelValue","disabled"]),o("button",{onClick:v=>e.removeEnumValue(u),type:"button",disabled:a.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,yp)]))),128))])):s("v-if",!0)])):s("v-if",!0),s(" Object properties / anyOf types "),e.modelValue.type==="object"||e.modelValue.type==="anyOf"?(n(),l("div",xp,[o("h4",kp,y(e.modelValue.type==="anyOf"?"Type Options":"Nested Properties"),1),o("div",_p,[s(" Add nested properties buttons "),o("div",wp,[o("button",{onClick:e.addNestedProperty,type:"button",disabled:a.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 "+y(e.modelValue.type==="anyOf"?"Type Option":"Property"),9,Cp)]),s(" Render nested properties "),o("div",Sp,[(n(!0),l(G,null,ue(e.modelValue.type==="anyOf"?e.modelValue.anyOf:e.modelValue.properties,(d,u)=>(n(),Y(r,{key:d.id,modelValue:(e.modelValue.type==="anyOf"?e.modelValue.anyOf:e.modelValue.properties)[u],"onUpdate:modelValue":v=>(e.modelValue.type==="anyOf"?e.modelValue.anyOf:e.modelValue.properties)[u]=v,"property-id":d.id,"is-nested":!0,"parent-id":a.propertyId,disabled:a.disabled,"enable-drag":!1,onRemove:v=>e.removeNestedProperty(d.id),onAddTopLevel:t[6]||(t[6]=v=>e.emit("add-top-level"))},null,8,["modelValue","onUpdate:modelValue","property-id","parent-id","disabled","onRemove"]))),128))])])])):s("v-if",!0),s(" Array items "),e.modelValue.type==="array"?(n(),l("div",Tp,[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?s("v-if",!0):(n(),l("div",Mp,[o("button",{onClick:e.initArrayItems,type:"button",disabled:a.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,Ip)])),e.modelValue.items?(n(),l("div",Vp,[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":a.propertyId,disabled:a.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"])])):s("v-if",!0)])):s("v-if",!0)])):s("v-if",!0)])],10,sp)}const Pp=ee(lp,[["render",Ap],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/PropertyEditor.vue"]]),Lp=te({__name:"PropertyList",props:Ve({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:Ve(["add-property","description-keydown"],["update:modelValue"]),setup(p,{expose:t,emit:a}){const e=p,c=a,i=Ue(p,"modelValue"),r=m();let d=!1;ge(async()=>{}),Ae(()=>{});const u=async()=>{if(d)return;d=!0;const f={id:crypto.randomUUID(),name:`property${i.value.length+1}`,type:"string",description:"",required:!1};i.value=[...i.value,f],await he();const k=e.parentId?`[data-nested-property-id="${f.id}"]`:`[data-property-id="${f.id}"]`,x=document.querySelector(`${k} input[placeholder="Property name"]`);x&&(x.focus(),x.select()),c("add-property"),d=!1},v=f=>{i.value=i.value.filter(k=>k.id!==f)},g=f=>{};t({addProperty:u});const h={props:e,emit:c,modelValue:i,dragAreaRef:r,get isAddingProperty(){return d},set isAddingProperty(f){d=f},addProperty:u,removeProperty:v,handleDescriptionKeydown:g,PropertyEditor:Pp};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}}),Ep={class:"space-y-2"},jp={ref:"dragAreaRef",class:"space-y-2"},Op=["disabled"];function Dp(p,t,a,e,c,i){return n(),l("div",Ep,[o("div",jp,[(n(!0),l(G,null,ue(e.modelValue,r=>(n(),Y(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":a.isNested,"parent-id":a.parentId,disabled:a.disabled,"enable-drag":!a.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),s(" Add Property button at the bottom for both nested and non-nested "),o("div",{class:Q(a.isNested?"mt-2":"mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-800")},[o("button",{onClick:e.addProperty,type:"button",disabled:a.disabled,class:Q(a.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"})]),ve(" Add Property ")],-1)])],10,Op)],2)])}const qp=ee(Lp,[["render",Dp],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/PropertyList.vue"]]),Up=te({__name:"JSONSchemaInput",props:Ve({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 a=p,e=Ue(p,"modelValue"),c=m([]),i=m(),r=m(!1),d=()=>{if(e.value?.properties){const b=[];e.value.required;for(const[S,T]of Object.entries(e.value.properties)){const A=T,O={id:crypto.randomUUID(),name:S,type:A.type||"string",description:A.description||""};A.enum&&(O.enum=A.enum),A.anyOf&&(O.type="anyOf",O.anyOf=u(A.anyOf)),A.type==="array"&&A.items&&(O.items=v(A.items)),A.type==="object"&&A.properties&&(O.properties=g(A.properties,A.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?g(S.properties,S.required||[]):void 0,items:S.items?v(S.items):void 0,enum:S.enum}:{id:crypto.randomUUID(),name:"",type:"string",description:""}),v=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=v(b.items)),b.type==="object"&&b.properties&&(S.properties=g(b.properties,b.required||[])),S},g=(b,S)=>{const T=[];for(const[A,O]of Object.entries(b)){const R=O,F={id:crypto.randomUUID(),name:A,type:R.type||"string",description:R.description||""};R.enum&&(F.enum=R.enum),R.anyOf&&(F.type="anyOf",F.anyOf=u(R.anyOf)),R.type==="array"&&R.items&&(F.items=v(R.items)),R.type==="object"&&R.properties&&(F.properties=g(R.properties,R.required||[])),T.push(F)}return T};d();const h=()=>{const b={type:"object",properties:{},required:[],additionalProperties:!1},{properties:S,required:T}=k(c.value);b.properties=S,b.required=Object.keys(S),e.value=b},f=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(f)),b.type==="object"&&b.properties){const{properties:T,required:A}=k(b.properties);S.properties=T,S.required=Object.keys(T),S.additionalProperties=!1}return b.type==="array"&&b.items&&(S.items=f(b.items)),S},k=b=>{const S={},T=[];for(const A of b){const O={type:A.type==="anyOf"?void 0:A.type,description:A.description};if(T.push(A.name),A.type==="enum"&&A.enum&&(O.enum=A.enum,O.type="string"),A.type==="anyOf"&&A.anyOf&&A.anyOf.length>0&&(delete O.type,O.anyOf=A.anyOf.map(f)),A.type==="array"&&A.items&&(O.items=f(A.items)),A.type==="object"&&A.properties){const{properties:R,required:F}=k(A.properties);O.properties=R,O.required=Object.keys(R),O.additionalProperties=!1}S[A.name]=O}return{properties:S,required:T}};ae(c,()=>{h()},{deep:!0}),h();const x=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>')),M={props:a,modelValue:e,properties:c,propertyListRef:i,showSchema:r,initializeProperties:d,convertAnyOfToProperties:u,convertSchemaToProperty:v,convertSchemaToProperties:g,updateSchema:h,convertPropertyToSchema:f,convertPropertiesToSchema:k,highlightedSchema:x,addProperty:async()=>{if(c.value.length===0){const b={id:crypto.randomUUID(),name:"property1",type:"string",description:""};c.value.push(b),await he();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:qp};return Object.defineProperty(M,"__isScriptSetup",{enumerable:!1,value:!0}),M}}),Bp={class:"space-y-4"},Np={key:0,class:"flex items-center justify-between"},Rp={class:"text-sm font-medium"},Fp={key:0,class:"text-red-500"},zp={class:"space-y-2 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4"},Hp={key:0,class:"flex items-center justify-between mb-2"},Wp={key:1,class:"text-center py-12"},Jp=["disabled"],Kp={class:"mt-4 text-center"},Zp={key:3,class:"mt-4"},Gp={class:"bg-neutral-50 dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4 overflow-x-auto"},Xp={class:"text-xs leading-relaxed"},Yp=["innerHTML"];function Qp(p,t,a,e,c,i){return n(),l("div",Bp,[a.label?(n(),l("div",Np,[o("label",Rp,[ve(y(a.label)+" ",1),a.required?(n(),l("span",Fp,"*")):s("v-if",!0)])])):s("v-if",!0),o("div",zp,[e.properties.length>0?(n(),l("div",Hp,[...t[2]||(t[2]=[o("h3",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"}," Properties ",-1)])])):s("v-if",!0),e.properties.length===0?(n(),l("div",Wp,[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:a.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"})]),ve(" Add Property ")],-1)])],8,Jp)])):s("v-if",!0),e.properties.length>0?(n(),Y(e.PropertyList,{key:2,ref:"propertyListRef",modelValue:e.properties,"onUpdate:modelValue":t[0]||(t[0]=r=>e.properties=r),disabled:a.disabled,onAddProperty:e.addProperty},null,8,["modelValue","disabled"])):s("v-if",!0),s(" Show JSON Schema link "),o("div",Kp,[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"},y(e.showSchema?"Hide":"Show")+" JSON Schema ",1)]),s(" JSON Schema Display "),e.showSchema?(n(),l("div",Zp,[o("div",Gp,[o("pre",Xp,[o("code",{class:"font-mono",innerHTML:e.highlightedSchema},null,8,Yp)])])])):s("v-if",!0)])])}const Wt=ee(Up,[["render",Qp],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/JSONSchemaInput.vue"]]),$p=te({__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:a}){t();const e=p,c=a,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),v=j=>j.type==="string"?"":`@${j.type==="variable"?j.label||j.value:j.label||j.id}`,g=()=>{const j=window.getSelection();if(!j||!j.rangeCount||!i.value)return null;const L=j.getRangeAt(0);let V=0;const q=Array.from(i.value.childNodes);for(let _=0;_<q.length;_++){const I=q[_];if(I===L.startContainer||I.contains?.(L.startContainer)){if(I.nodeType===Node.TEXT_NODE)return{segmentIndex:V,offset:L.startOffset};if(I.nodeType===Node.ELEMENT_NODE&&I.classList?.contains("prompt-tag"))return{segmentIndex:V,offset:0}}(I.nodeType===Node.TEXT_NODE||I.nodeType===Node.ELEMENT_NODE&&I.classList?.contains("prompt-tag"))&&V++}return{segmentIndex:0,offset:0}},h=j=>{if(!i.value)return;const L=window.getSelection();if(!L)return;const V=Array.from(i.value.childNodes);let q=0,_=null,I=0;for(const E of V){if(q===j.segmentIndex){if(E.nodeType===Node.TEXT_NODE)_=E,I=Math.min(j.offset,E.textContent?.length||0);else if(E.nodeType===Node.ELEMENT_NODE&&E.classList?.contains("prompt-tag")){const N=E.nextSibling;if(N&&N.nodeType===Node.TEXT_NODE)_=N,I=0;else{const ie=document.createTextNode("");E.parentNode?.insertBefore(ie,E.nextSibling),_=ie,I=0}}break}(E.nodeType===Node.TEXT_NODE||E.nodeType===Node.ELEMENT_NODE&&E.classList?.contains("prompt-tag"))&&q++}if(!_&&V.length){const E=V[V.length-1];if(E.nodeType===Node.TEXT_NODE)_=E,I=E.textContent?.length||0;else if(E.nodeType===Node.ELEMENT_NODE&&E.classList?.contains("prompt-tag")){const N=document.createTextNode("");E.parentNode?.insertBefore(N,E.nextSibling),_=N,I=0}}if(_){const E=document.createRange();E.setStart(_,I),E.collapse(!0),L.removeAllRanges(),L.addRange(E)}},f=()=>{if(!i.value)return;const j=d.segments.map(L=>{if(L.type==="string")return(L.value||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>")||"";{const V=L._uid||(L._uid=u()),q=v(L),_=L.type==="variable"?{type:"variable",value:L.value,label:L.label,schema:L.schema,meta:L.meta}:{type:"prompt",id:L.id,label:L.label,schema:L.schema,meta:L.meta},I=encodeURIComponent(JSON.stringify(_)),E=L.type==="prompt"&&L.meta&&!L.meta.isValid,N=E?'<span class="prompt-tag-warning" title="'+(L.meta.validationMessage||"").replace(/"/g,""")+'">⚠️</span>':"";return`<span class="prompt-tag prompt-tag-clickable${E?" prompt-tag-invalid":""}" contenteditable="false" data-segment-uid="${V}" data-segment="${I}">${q}${N}</span>`}}).join("");i.value.innerHTML=j||"<br>"},k=()=>{const j=[];for(const L of d.segments)L.type==="string"&&j.length>0&&j[j.length-1].type==="string"?j[j.length-1].value+=L.value:j.push(L);d.segments=j.length?j:[{type:"string",value:""}]},x=j=>{const L=j.dataset.segmentUid;let V=d.segments.find(q=>q._uid===L);if(!V){const q=j.dataset.segment;if(q)try{const _=JSON.parse(decodeURIComponent(q));_&&(_.type==="variable"||_.type==="prompt")&&(V=_.type==="variable"?{type:"variable",value:_.value,label:_.label,schema:_.schema,meta:_.meta,_uid:L}:{type:"prompt",id:_.id,label:_.label,schema:_.schema,meta:_.meta,_uid:L})}catch{}}return V||null},w=j=>{const L=j.target;if(L.classList?.contains("prompt-tag")){const V=x(L);V&&c("segment-click",V,j)}},M=j=>{if(d.isComposing)return;const L=j.target,V=[];let q="";const _=()=>{q.length>0&&(V.push({type:"string",value:q}),q="")},I=pe=>{if(pe.nodeType===Node.TEXT_NODE){const J=(pe.textContent||"").replace(/\u00A0/g," ");q+=J;return}if(pe.nodeType===Node.ELEMENT_NODE){const J=pe;if(J.classList?.contains("prompt-tag")){_();const Z=x(J);Z&&V.push(Z);return}if(J.tagName==="BR"){q+=`
|
|
9
|
+
`;return}const le=Array.from(J.childNodes);for(const Z of le)I(Z);(J.tagName==="DIV"||J.tagName==="P"||J.tagName==="LI")&&J.nextSibling&&(q+=`
|
|
10
|
+
`);return}},E=Array.from(L.childNodes);for(const pe of E)I(pe);_();const ie=V.some(pe=>pe.type!=="string")?V:[{type:"string",value:(L.innerText||"").replace(/\r\n/g,`
|
|
11
|
+
`)}];d.segments=ie.length?ie:[{type:"string",value:""}],k(),b(),U()},b=()=>{const j=window.getSelection();if(!j||!j.rangeCount||!i.value)return;const L=j.getRangeAt(0);if(L.startContainer.nodeType!==Node.TEXT_NODE){d.dialogOpen&&T();return}const q=L.startContainer.textContent||"",_=L.startOffset;if(_>0&&q[_-1]==="@")d.atTriggerIndex=_-1,d.searchQuery="",S(),R("");else if(d.dialogOpen&&d.atTriggerIndex>=0)if(L.startContainer.nodeType===Node.TEXT_NODE){const I=L.startContainer.textContent||"",E=L.startOffset;if(E<=d.atTriggerIndex){T();return}const N=I.substring(0,E);if(N.length>d.atTriggerIndex&&N[d.atTriggerIndex]==="@"){const ie=N.substring(d.atTriggerIndex+1);ie.includes(" ")||ie.includes(`
|
|
12
|
+
`)||ie.length>d.searchQuery.length+5?T():(d.searchQuery=ie,R(ie))}else T()}else T()},S=async()=>{d.dialogOpen=!0,d.selectedIndex=0,await he(),A()},T=()=>{d.dialogOpen=!1,d.searchResults=[],d.searchQuery="",d.atTriggerIndex=-1,d.isSearching=!1},A=()=>{if(!r.value||!i.value)return;const j=window.getSelection();if(!j||!j.rangeCount)return;const V=j.getRangeAt(0).getBoundingClientRect(),q=i.value.getBoundingClientRect();d.dialogPosition={x:V.left-q.left,y:V.bottom-q.top+4}};let O=null;const R=async j=>{if(!e.search){d.searchResults=[];return}O&&clearTimeout(O),d.isSearching=!0,O=setTimeout(async()=>{try{const L=await e.search(j);d.searchResults=(L||[]).filter(V=>e.allowedTypes?.includes(V.type))}catch(L){console.error("Search error:",L),d.searchResults=[]}finally{d.isSearching=!1}},200)},F=j=>j.type==="variable"?{type:"variable",value:j.value??j.id??"",label:j.label,schema:j.schema,_uid:u(),meta:j.meta}:{type:"prompt",id:j.id??j.value??"",label:j.label,schema:j.schema,_uid:u(),meta:j.meta},$=j=>{if(d.atTriggerIndex<0||!i.value)return;const L=window.getSelection();if(!L||!L.rangeCount)return;const V=L.getRangeAt(0);if(V.startContainer.nodeType!==Node.TEXT_NODE)return;const q=V.startContainer,_=q.data.slice(0,d.atTriggerIndex),I=q.data.slice(V.startOffset),E=document.createElement("span"),N=F(j),ie=N.type==="prompt"&&N.meta&&!N.meta.isValid;E.className=`prompt-tag${ie?" prompt-tag-invalid":""}`,E.setAttribute("contenteditable","false");const pe=N._uid||(N._uid=u());E.dataset.segmentUid=pe;const J=N.type==="variable"?{type:"variable",value:N.value,label:N.label,schema:N.schema}:{type:"prompt",id:N.id,label:N.label,schema:N.schema};if(E.dataset.segment=encodeURIComponent(JSON.stringify(J)),E.textContent=v(N),ie){const de=document.createElement("span");de.className="prompt-tag-warning",de.textContent="⚠️",de.setAttribute("title",N.meta.validationMessage||"Validation error"),E.appendChild(de)}const le=q.parentNode,Z=document.createTextNode(I),ne=document.createTextNode(_);le.insertBefore(ne,q),le.insertBefore(E,q),le.insertBefore(Z,q),le.removeChild(q),T(),M({target:i.value});const se=window.getSelection();if(se){const de=document.createRange();de.setStart(Z,0),de.collapse(!0),se.removeAllRanges(),se.addRange(de)}i.value.focus()},B=j=>{if((j.key==="ArrowLeft"||j.key==="ArrowRight")&&setTimeout(()=>b(),0),d.dialogOpen)j.key==="ArrowDown"?(j.preventDefault(),d.selectedIndex=Math.min(d.selectedIndex+1,d.searchResults.length-1)):j.key==="ArrowUp"?(j.preventDefault(),d.selectedIndex=Math.max(d.selectedIndex-1,0)):j.key==="Enter"?(j.preventDefault(),d.searchResults[d.selectedIndex]&&$(d.searchResults[d.selectedIndex])):(j.key==="Escape"||j.key==="Esc")&&(j.preventDefault(),T());else if(j.key==="Backspace"||j.key==="Delete"){const L=g();if(j.key==="Backspace"){const V=window.getSelection();if(V&&V.rangeCount){const q=V.getRangeAt(0);if(q.collapsed&&q.startContainer.nodeType===Node.TEXT_NODE&&q.startOffset===0){let _=q.startContainer;for(;_&&_!==i.value;){const I=_.previousSibling;if(I&&I.nodeType===Node.ELEMENT_NODE&&I.classList?.contains("prompt-tag")){j.preventDefault(),I.parentNode?.removeChild(I),M({target:i.value});return}_=_.parentNode}}}}if(!L)return;if(j.key==="Backspace"&&L.offset===0&&L.segmentIndex>0)d.segments[L.segmentIndex-1].type!=="string"&&(j.preventDefault(),d.segments.splice(L.segmentIndex-1,1),k(),U(),f());else if(j.key==="Delete"&&L.segmentIndex<d.segments.length-1){const V=d.segments[L.segmentIndex];V.type==="string"&&(V.value?.length??0)===L.offset&&d.segments[L.segmentIndex+1].type!=="string"&&(j.preventDefault(),d.segments.splice(L.segmentIndex+1,1),k(),U(),f())}}},D=j=>{j.preventDefault();const L=j.clipboardData?.getData("text/plain")||"";document.execCommand("insertText",!1,L)},W=j=>{if(!d.dialogOpen)return;const L=r.value;L&&(L.contains(j.target)||T())},U=()=>{d.ignoreNextWatch=!0;const j=d.segments.map(L=>{const{_uid:V,...q}=L||{};return q});c("update:modelValue",j)},P=()=>{const j=window.getSelection();if(!j||!i.value)return;const L=j.anchorNode;L&&i.value.contains(L)&&b()},H=j=>{(j.key==="Escape"||j.key==="Esc")&&d.dialogOpen&&(j.preventDefault(),T())};ge(()=>{e.modelValue&&e.modelValue.length&&(d.segments=JSON.parse(JSON.stringify(e.modelValue))),f(),document.addEventListener("mousedown",W),document.addEventListener("selectionchange",P),document.addEventListener("keydown",H,!0)}),Ae(()=>{document.removeEventListener("mousedown",W),document.removeEventListener("selectionchange",P),document.removeEventListener("keydown",H,!0)}),ae(()=>e.modelValue,j=>{if(d.ignoreNextWatch){d.ignoreNextWatch=!1;return}j&&(d.segments=JSON.parse(JSON.stringify(j)),f())},{deep:!0});const K={props:e,emit:c,editorRef:i,dialogRef:r,state:d,createUid:u,segmentDisplay:v,getLogicalCursorPosition:g,setLogicalCursorPosition:h,renderContent:f,mergeAdjacentTextSegments:k,readTagSegment:x,handleSegmentClick:w,handleInput:M,checkForAtTrigger:b,openDialog:S,closeDialog:T,positionDialog:A,get searchTimeout(){return O},set searchTimeout(j){O=j},performSearch:R,toSegmentFromResult:F,selectResult:$,handleKeyDown:B,handlePaste:D,onDocumentMouseDown:W,emitUpdate:U,onSelectionChange:P,onDocKeyDown:H,DropShadow:He};return Object.defineProperty(K,"__isScriptSetup",{enumerable:!1,value:!0}),K}}),em={class:"prompt-input-container relative"},tm=["contenteditable","data-placeholder"],om={class:"bg-white dark:bg-black border-2 border-black dark:border-neutral-300 rounded-lg overflow-hidden min-w-[240px] max-w-[320px]"},rm={key:0,class:"p-3 text-sm text-neutral-500"},am={key:1,class:"p-3 text-sm text-neutral-500"},nm={key:2,class:"max-h-[220px] overflow-y-auto"},lm=["onClick"],sm={class:"font-medium flex items-center gap-2"},im=["title"],dm={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},cm={key:1,class:"text-xs text-red-600 dark:text-red-400 mt-1"},um={class:"text-xs mt-1"};function pm(p,t,a,e,c,i){return n(),l("div",em,[o("div",{ref:"editorRef","data-testid":"prompt-editor",contenteditable:!a.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:Q(["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",a.disabled?"opacity-50 cursor-not-allowed":""]),"data-placeholder":a.placeholder},[s(" Slot for custom segment rendering - hidden but provides slot content "),ye(o("div",null,[Fe(p.$slots,"segment",{segment:null},void 0,!0)],512),[[Le,!1]])],42,tm),s(" Mention Dialog "),e.state.dialogOpen?(n(),l("div",{key:0,ref:"dialogRef","data-testid":"mention-dialog",class:"absolute z-50",style:$e({left:`${e.state.dialogPosition.x}px`,top:`${e.state.dialogPosition.y}px`})},[C(e.DropShadow,{"offset-x":2,"offset-y":2,intensity:.3},{default:re(()=>[o("div",om,[e.state.isSearching?(n(),l("div",rm," Searching... ")):e.state.searchResults.length===0?(n(),l("div",am," No results found ")):(n(),l("div",nm,[(n(!0),l(G,null,ue(e.state.searchResults,(r,d)=>(n(),l("button",{key:r.id||r.value||d,type:"button",onClick:u=>e.selectResult(r),class:Q(["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",sm,[ve(y(r.label||r.id||r.value)+" ",1),r.type==="prompt"&&r.meta&&!r.meta.isValid?(n(),l("span",{key:0,title:r.meta.validationMessage,class:"text-red-500"},"⚠️",8,im)):s("v-if",!0)]),r.description?(n(),l("div",dm,y(r.description),1)):s("v-if",!0),r.type==="prompt"&&r.meta&&!r.meta.isValid?(n(),l("div",cm,y(r.meta.validationMessage),1)):s("v-if",!0),o("div",um,[o("span",{class:Q(["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"])},y(r.type),3)])],10,lm))),128))]))])]),_:1})],4)):s("v-if",!0)])}const Jt=ee($p,[["render",pm],["__scopeId","data-v-5b9dcb11"],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/PromptInput.vue"]]);function Tt(p,t){if(!t||!t.properties||Object.keys(t.properties).length===0)return!0;if(!p||!p.properties)return Object.keys(t.properties);const a=[],e=p.properties||{},c=t.properties||{};return(t.required||[]).forEach(r=>{r in e||a.push(r)}),Object.keys(c).forEach(r=>{!(r in e)&&!a.includes(r)&&a.push(r)}),a.length>0?a:!0}function Mt(p){return p.length===0?"":p.length===1?`Missing required field: ${p[0]}`:`Missing required fields: ${p.join(", ")}`}const mm=te({__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:a}){t();const e=p,c=a,i=m([]),r=m(!1),d=x=>x.type==="text"?{type:"string",value:x.content||""}:x.type==="include"?{type:"prompt",id:x.prompt||"",label:x.prompt||""}:x.type==="string"?{type:"string",value:x.value||""}:x.type==="prompt"?{type:"prompt",id:x.id||"",label:x.label||x.id||""}:x.type==="variable"?{type:"variable",value:x.value||"",label:x.label||x.value||""}:{type:"string",value:""},u=z(()=>{if(!e.promptText)return[{type:"string",value:""}];let x=[];try{const M=JSON.parse(e.promptText);Array.isArray(M)?x=M.map(d):x=[{type:"string",value:e.promptText}]}catch{x=[{type:"string",value:e.promptText}]}const w=e.requiredSchema?JSON.parse(e.requiredSchema):{};return x.map(M=>{if(M.type==="prompt"&&M.schema){const b=Tt(w,M.schema),S=b===!0,T=S?[]:b;return{...M,meta:{isValid:S,missingFields:T,validationMessage:S?"":Mt(T)}}}return M})}),v=z(()=>{try{const x=JSON.parse(e.requiredSchema);if(x.properties&&typeof x.properties=="object")return Object.keys(x.properties)}catch{return[]}return[]}),g=async x=>{r.value=!0;try{const w=new URLSearchParams;x&&w.set("search",x);const M=await fetch(X(`/api/prompts${w.toString()?"?"+w.toString():""}`));if(M.ok){const b=await M.json();i.value=b.prompts||[]}}catch(w){console.error("Error fetching prompts:",w)}finally{r.value=!1}},h=async x=>{const w=[];return v.value.forEach(M=>{(!x||M.toLowerCase().includes(x.toLowerCase()))&&w.push({type:"variable",value:M,label:M,description:"Schema property"})}),x!==void 0&&await g(x),i.value.forEach(M=>{if(!(e.currentPromptName&&M.name===e.currentPromptName)&&(!x||M.name.toLowerCase().includes(x.toLowerCase()))){const b=e.requiredSchema?JSON.parse(e.requiredSchema):{},S=Tt(b,M.required_schema),T=S===!0,A=T?[]:S;w.push({type:"prompt",id:M.name,label:M.name,description:M.tool_description||"Available prompt",schema:M.required_schema,meta:{isValid:T,missingFields:A,validationMessage:T?"":Mt(A)}})}}),w},f=x=>{const w=x.map(M=>{const{type:b,value:S,label:T,id:A,schema:O}=M;return b==="string"?{type:b,value:S||""}:b==="variable"?{type:b,value:S||"",label:T}:b==="prompt"?{type:b,id:A||"",label:T,schema:O}:M});c("update:promptText",JSON.stringify(w))};ge(()=>{g()});const k={props:e,emit:c,availablePrompts:i,loadingPrompts:r,normalizeSegment:d,promptSegments:u,schemaProperties:v,fetchPrompts:g,searchReferences:h,handleSegmentsUpdate:f,PromptInput:Jt};return Object.defineProperty(k,"__isScriptSetup",{enumerable:!1,value:!0}),k}}),fm={class:"space-y-4"};function gm(p,t,a,e,c,i){return n(),l("div",fm,[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 hm=ee(mm,[["render",gm],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/prompt-form/PromptTemplate.vue"]]),vm=te({__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:a}){t();const e=p,c=a,i=m(null),r=m(!0),d=z(()=>i.value?.properties?Object.entries(i.value.properties).map(([h,f])=>({value:h,label:h,description:f.description||f.type||""})):[]),u=async()=>{try{const h=await fetch(X(`/api/prompts/${encodeURIComponent(e.toolName)}`));if(h.ok){const f=await h.json();f?.prompt?.required_schema&&(i.value=f.prompt.required_schema)}}catch(h){console.error("Error fetching prompt schema:",h)}finally{r.value=!1}};ge(()=>{u()});const g={props:e,emit:c,schema:i,loading:r,propertyOptions:d,fetchSchema:u,updateOption:(h,f)=>{c("update:option",h,f)},SelectInput:Se,CheckboxInput:et};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}}),bm={class:"space-y-3"},ym={class:"space-y-2 pl-4 border-l-2 border-accent-200 dark:border-accent-700"},xm={class:"space-y-1"},km={class:"space-y-2 pl-4 border-l-2 border-neutral-200 dark:border-neutral-700"};function _m(p,t,a,e,c,i){return n(),l("div",bm,[s(" Initialization Options "),o("div",ym,[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",xm,[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":a.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:a.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))])]),s(" Response Options "),o("div",km,[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":a.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:a.disabled},null,8,["model-value","disabled"]),C(e.CheckboxInput,{"model-value":a.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:a.disabled},null,8,["model-value","disabled"]),C(e.CheckboxInput,{"model-value":a.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:a.disabled},null,8,["model-value","disabled"])])])}const wm=ee(vm,[["render",_m],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/PromptToolOptions.vue"]]);async function Ee(p,t={}){const a=localStorage.getItem("auth_token"),e={"Content-Type":"application/json",...t.headers};a&&(e.Authorization=`Bearer ${a}`);const c=p.startsWith("/")?p:`/${p}`,i=await fetch(X(`/api${c}`),{...t,headers:e});if(i.status===401)throw localStorage.removeItem("auth_token"),window.location.href=X("/login"),new Error("Unauthorized");return i}const Cm=te({__name:"ToolSelectorWithOptions",props:Ve({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 a=p,e=Ue(p,"modelValue"),c=m([]),i=m(!1),r=m();Et(async()=>{r.value,await he(),r.value&&e.value.length>0&&await jt({parent:r,values:e,dragHandle:".drag-handle"})});const d=z(()=>{const x=new Set(e.value.map(w=>w.name));return c.value.filter(w=>!x.has(w.name)).map(w=>{let M=w.name;return w.type==="prompt"?M=`${w.name} (prompt)`:w.type==="mcp"&&(M=`${w.name} (mcp)`),{value:w.name,label:M,description:w.description}})}),u=async()=>{i.value=!0;try{const x=await Ee("/tools");if(x.ok){const w=await x.json();c.value=Object.entries(w).map(([M,b])=>({name:M,description:b.description||"",type:b.type,model:b.model}))}}catch(x){console.error("Error fetching tools:",x)}finally{i.value=!1}},v=x=>{x&&(e.value.find(w=>w.name===x)||(e.value=[...e.value,{name:x,include_text_response:!0,include_tool_calls:!0,include_errors:!0,init_user_message_property:null}]))},g=x=>{e.value=e.value.filter(w=>w.name!==x)},h=x=>c.value.find(w=>w.name===x),f=(x,w,M)=>{e.value=e.value.map(b=>b.name===x?{...b,[w]:M}:b)};ge(()=>{u()});const k={props:a,modelValue:e,tools:c,loadingTools:i,dragAreaRef:r,toolOptions:d,fetchTools:u,handleSelect:v,removeTool:g,getToolInfo:h,updateToolOption:f,SelectInput:Se,PromptToolOptions:wm};return Object.defineProperty(k,"__isScriptSetup",{enumerable:!1,value:!0}),k}}),Sm={class:"space-y-4"},Tm={class:"block text-sm font-medium mb-2"},Mm={key:0,class:"text-red-500"},Im={key:0,class:"space-y-3 mb-4",ref:"dragAreaRef"},Vm={class:"flex items-start justify-between"},Am={class:"flex items-center gap-2 flex-1"},Pm={class:"flex-1"},Lm={class:"font-medium text-sm"},Em={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mt-1"},jm=["onClick","disabled","aria-label"],Om={key:1,class:"text-xs text-red-500 dark:text-red-400 mt-1"},Dm={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 qm(p,t,a,e,c,i){return n(),l("div",Sm,[o("div",null,[o("label",Tm,[ve(y(a.label)+" ",1),a.required?(n(),l("span",Mm,"*")):s("v-if",!0)]),s(" Selected tools list (above dropdown) "),e.modelValue.length>0?(n(),l("div",Im,[(n(!0),l(G,null,ue(e.modelValue,r=>(n(),l("div",{key:r.name,class:"border border-neutral-300 dark:border-neutral-600 rounded-lg p-4"},[o("div",Vm,[o("div",Am,[s(" 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",Pm,[o("h4",Lm,y(r.name),1),e.getToolInfo(r.name)?.description?(n(),l("p",Em,y(e.getToolInfo(r.name)?.description),1)):s("v-if",!0)])]),o("button",{onClick:d=>e.removeTool(r.name),type:"button",disabled:a.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,jm)]),s(" Prompt tool options (fetches schema on mount) "),e.getToolInfo(r.name)?.type==="prompt"?(n(),Y(e.PromptToolOptions,{key:0,"tool-name":r.name,"tool-config":r,disabled:a.disabled,"onUpdate:option":(d,u)=>e.updateToolOption(r.name,d,u)},null,8,["tool-name","tool-config","disabled","onUpdate:option"])):s("v-if",!0)]))),128))],512)):s("v-if",!0),s(" Tool selector dropdown "),C(e.SelectInput,{"model-value":"","onUpdate:modelValue":e.handleSelect,placeholder:e.modelValue.length>0?"Add another tool...":a.placeholder,"search-placeholder":"Search tools...",options:e.toolOptions,disabled:a.disabled||e.loadingTools||e.toolOptions.length===0,loading:e.loadingTools},null,8,["placeholder","options","disabled","loading"]),a.error?(n(),l("p",Om,y(a.error),1)):s("v-if",!0)]),s(" Empty state (only when no tools are available at all) "),e.modelValue.length===0&&!e.loadingTools&&e.toolOptions.length===0?(n(),l("div",Dm," No tools available. Create tools in your agentbuilder/tools directory. ")):s("v-if",!0)])}const Um=ee(Cm,[["render",qm],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/ToolSelectorWithOptions.vue"]]),Bm=te({__name:"MultipleSelectionsInput",props:Ve({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:Ve(["removeItem"],["update:modelValue"]),setup(p,{expose:t,emit:a}){t();const e=p,c=a,i=Ue(p,"modelValue"),r=m();Et(async()=>{r.value,await he(),await jt({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(f=>{const k=e.options.find(x=>x.value===f);return{id:f,label:k?.label||f,description:k?.description,icon:k?.icon}}):[]),u=z(()=>{const f=d.value.map(k=>k.id);return e.options.filter(k=>!f.includes(k.value))}),h={props:e,emit:c,modelValue:i,dragAreaRef:r,selectedItems:d,availableOptions:u,handleSelect:f=>{if(!f)return;const k=e.options.find(x=>x.value===f);if(k)if(i.value.length===0||typeof i.value[0]=="string")i.value=[...i.value,f];else{const x={id:f,label:k.label,description:k.description,icon:k.icon};i.value=[...i.value,x]}},removeItem:f=>{typeof i.value[0]=="string"?i.value=i.value.filter(k=>k!==f):i.value=i.value.filter(k=>k.id!==f),c("removeItem",f)},SelectInput:Se};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}}),Nm={class:"space-y-2"},Rm={key:0,class:"space-y-2"},Fm={key:0,class:"block text-sm font-medium"},zm={key:0,class:"text-red-500"},Hm={class:"space-y-1",ref:"dragAreaRef"},Wm=["src","alt"],Jm={class:"flex-1 text-sm"},Km={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 ml-1"},Zm=["onClick","aria-label"],Gm={key:1,class:"text-xs text-red-500 dark:text-red-400"};function Xm(p,t,a,e,c,i){return n(),l("div",Nm,[e.selectedItems.length>0?(n(),l("div",Rm,[a.label?(n(),l("label",Fm,[ve(y(a.label)+" ",1),a.required?(n(),l("span",zm,"*")):s("v-if",!0)])):s("v-if",!0),o("div",Hm,[(n(!0),l(G,null,ue(e.selectedItems,r=>(n(),l("div",{key:r.id,class:Q(["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",a.disabled?"opacity-50":""])},[s(" 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)),s(" Icon "),r.icon?(n(),l("img",{key:0,src:r.icon,alt:r.label,class:"w-4 h-4 flex-shrink-0"},null,8,Wm)):s("v-if",!0),s(" Label and description "),o("span",Jm,[ve(y(r.label)+" ",1),r.description?(n(),l("span",Km," ("+y(r.description)+") ",1)):s("v-if",!0)]),s(" Remove button "),a.disabled?s("v-if",!0):(n(),l("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,Zm))],2))),128))],512)])):s("v-if",!0),s(" Select input for adding new items "),C(e.SelectInput,{"model-value":"","onUpdate:modelValue":e.handleSelect,label:e.selectedItems.length>0?a.addLabel:a.label,options:e.availableOptions,placeholder:a.placeholder,"search-placeholder":a.searchPlaceholder,disabled:a.disabled||e.availableOptions.length===0,loading:a.loading},null,8,["label","options","placeholder","search-placeholder","disabled","loading"]),a.error?(n(),l("p",Gm,y(a.error),1)):s("v-if",!0)])}const ft=ee(Bm,[["render",Xm],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/MultipleSelectionsInput.vue"]]),Ym=te({__name:"AgentSelectorInput",props:Ve({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 a=p,e=Ue(p,"modelValue"),c=m([]),i=m(!1),r=z(()=>c.value.map(g=>({value:g.id,label:g.title,description:g.tool_description||`Handoff to ${g.title} agent`}))),d=async()=>{i.value=!0;try{const g=X(`/api/agents${a.agentType?`?type=${a.agentType}`:""}`),h=await fetch(g);if(h.ok){const f=await h.json();c.value=f.agents||[]}}catch(g){console.error("Error fetching agents:",g)}finally{i.value=!1}},u=g=>{};ge(()=>{d()}),ae(()=>a.allowMultiple,()=>{a.allowMultiple&&typeof e.value=="string"?e.value=e.value?[e.value]:[]:!a.allowMultiple&&Array.isArray(e.value)&&(e.value=e.value[0]||"")},{immediate:!0});const v={props:a,modelValue:e,agents:c,loadingAgents:i,agentOptions:r,fetchAgents:d,handleRemoveItem:u,SelectInput:Se,MultipleSelectionsInput:ft};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),Qm={key:2,class:"text-xs text-red-500 dark:text-red-400 mt-1"};function $m(p,t,a,e,c,i){return n(),l(G,null,[a.allowMultiple?(n(),Y(e.MultipleSelectionsInput,{key:0,modelValue:e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=r=>e.modelValue=r),label:a.label,placeholder:a.placeholder,"search-placeholder":"Search agents...",error:a.error,required:a.required,disabled:a.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"])):(n(),Y(e.SelectInput,{key:1,modelValue:e.modelValue,"onUpdate:modelValue":t[1]||(t[1]=r=>e.modelValue=r),label:a.label,placeholder:a.placeholder,"search-placeholder":"Search agents...",options:e.agentOptions,disabled:a.disabled,loading:e.loadingAgents},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!a.allowMultiple&&a.error?(n(),l("p",Qm,y(a.error),1)):s("v-if",!0)],64)}const e1=ee(Ym,[["render",$m],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/AgentSelectorInput.vue"]]),t1=te({__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:a}){t();const e=p,c=a,i=z(()=>e.mode==="edit"),r=m(!1),d=z(()=>S.value.length===1),u=m(""),v=m(""),g=m(""),h=m(""),f=m({type:"object",properties:{},required:[],additionalProperties:!1}),k=m(""),x=m(!1),w=m(!1),M=m(""),b=m(""),S=m([]),T=m([]),A=m(!1),O=m("auto"),R=m(null),F=m(null),$=m(!1),B=m(!1),D=z({get:()=>R.value||"",set:L=>R.value=L||null}),W=z({get:()=>O.value,set:L=>O.value=L}),U=()=>{v.value="",u.value="",g.value="",h.value="",f.value={type:"object",properties:{},required:[],additionalProperties:!1},k.value="",x.value=!1,w.value=!1,M.value="",b.value="",S.value=[],T.value=[],A.value=!1,O.value="auto",R.value=null,F.value=null,$.value=!1,B.value=!1},P=async()=>{if(e.editPrompt?.id){r.value=!0;try{const L=await Ee(`/prompts/${e.editPrompt.id}`);if(L.ok){const V=await L.json(),q=V.prompt||V;v.value=q.name||"",u.value=q.name||"",g.value=q.tool_description||"",h.value=q.model_id||"";let _=q.required_schema;if(typeof _=="string")try{_=JSON.parse(_)}catch{_=null}f.value=_||{type:"object",properties:{},required:[],additionalProperties:!1},k.value=q.prompt||"",x.value=q.include_chat||!1,w.value=q.include_past_tools||!1,M.value=q.before_tool||"",b.value=q.after_tool||"";const I=q.tools||[];S.value=I.map(N=>typeof N=="string"?{name:N,include_text_response:!0,include_tool_calls:!0,include_errors:!0,init_user_message_property:null}:N),T.value=q.prompts||q.handoff_agents||[],A.value=q.parallel_tool_calls||!1,O.value=q.tool_choice||"auto";const E=q.reasoning||{};R.value=E.effort||q.reasoning_effort||null,F.value=E.maxTokens||q.reasoning_max_tokens||null,$.value=E.exclude||q.reasoning_exclude||!1,B.value=q.include_reasoning||!1}}catch(L){console.error("Error loading prompt data:",L)}finally{r.value=!1}}},H=async()=>{const L=/^[a-z][a-z0-9_]*$/;if(!v.value||!L.test(v.value)){alert("Please enter a valid name (lowercase letters, numbers, and underscores only, must start with a letter)");return}if(!g.value){alert("Please enter a description");return}if(!h.value){alert("Please select a model");return}if(!k.value){alert("Please enter the prompt template");return}const V={name:v.value,tool_description:g.value,prompt:k.value,required_schema:f.value,model_id:h.value,include_chat:x.value,include_past_tools:w.value,before_tool:M.value||null,after_tool:b.value||null,parallel_tool_calls:A.value,tool_choice:O.value,tools:S.value,handoff_agents:T.value,reasoning_effort:R.value,reasoning_max_tokens:F.value,reasoning_exclude:$.value,include_reasoning:B.value};i.value&&e.editPrompt?.id&&(V.id=e.editPrompt.id,u.value&&u.value!==v.value&&(V.originalName=u.value)),c("save",V),U(),c("update:modelValue",!1)},K=()=>{U(),c("update:modelValue",!1)};ae(()=>S.value.length,L=>{O.value==="function"&&L!==1&&(O.value="auto")}),ae(()=>e.modelValue,async L=>{L&&(i.value?(U(),await he(),await P()):U())}),ae(()=>e.editPrompt,async L=>{L&&i.value&&e.modelValue&&(await he(),await P())},{immediate:!0});const j={props:e,emit:c,isEditMode:i,isLoading:r,isFunctionChoiceAvailable:d,originalName:u,name:v,toolDescription:g,selectedModel:h,requiredSchema:f,promptText:k,includeChat:x,includePastTools:w,beforeTool:M,afterTool:b,selectedTools:S,handoffAgents:T,parallelToolCalls:A,toolChoice:O,reasoningEffort:R,reasoningMaxTokens:F,reasoningExclude:$,includeReasoning:B,reasoningEffortValue:D,toolChoiceValue:W,resetForm:U,loadPromptData:P,handleSubmit:H,handleCancel:K,Modal:je,PromptBasicInfo:B2,PromptModelSelect:np,JSONSchemaInput:Wt,PromptTemplate:hm,CheckboxInput:et,ToolSelectorWithOptions:Um,AgentSelectorInput:e1,SelectInput:Se};return Object.defineProperty(j,"__isScriptSetup",{enumerable:!1,value:!0}),j}}),o1={key:0,class:"min-h-[400px] flex items-center justify-center"},r1={class:"space-y-6 pr-2 pb-4"},a1={class:"space-y-4"},n1={class:"space-y-4"},l1={class:"flex justify-between"},s1={class:"flex gap-2"},i1=["disabled"];function d1(p,t,a,e,c,i){return n(),Y(e.Modal,{"model-value":a.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:re(()=>[o("div",l1,[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",s1,[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},y(e.isEditMode?"Update Prompt":"Create Prompt"),9,i1)])])]),default:re(()=>[e.isLoading?(n(),l("div",o1,[...t[18]||(t[18]=[o("span",{class:"text-neutral-500"},"Loading prompt data...",-1)])])):(n(),l(G,{key:1},[s(" Single long form for both edit and add modes "),o("div",r1,[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",a1,[t[20]||(t[20]=o("h3",{class:"text-sm font-medium text-neutral-900 dark:text-neutral-100"}," Tool Configuration ",-1)),s(" 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"])]),s(" 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))]),s(" Reasoning Tokens Configuration "),o("div",n1,[t[25]||(t[25]=o("h3",{class:"text-sm font-medium text-neutral-900 dark:text-neutral-100"}," Context & Reasoning Configuration ",-1)),s(" 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"])]),s(" 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"])]),s(" 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)),s(" 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))]),s(" 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)),ye(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),[[Me,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))]),s(" 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 Kt=ee(t1,[["render",d1],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/PromptModal.vue"]]),c1=te({__name:"PromptsView",setup(p,{expose:t}){t();const a=ze(),e=qe(),c=m(!1),i=m(null);ae(()=>e.query.refresh,()=>{e.query.refresh&&(i.value?.refresh(),a.replace({path:"/prompts",query:{}}))});const v={router:a,route:e,showModal:c,dataTableRef:i,handleAdd:()=>{c.value=!0},handleEdit:g=>{a.push(`/prompts/${g.id}`)},handleSave:async g=>{try{const h=await fetch(X("/api/prompts"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)});if(h.ok)c.value=!1,await new Promise(f=>setTimeout(f,100)),await i.value?.refresh();else{const f=await h.json();alert(f.error||"Failed to create prompt")}}catch(h){console.error("Error creating prompt:",h),alert("Failed to create prompt")}},PromptsDataTable:P2,PromptModal:Kt,CenteredContentView:Re};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}});function u1(p,t,a,e,c,i){return n(),Y(e.CenteredContentView,null,{default:re(()=>[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 p1=ee(c1,[["render",u1],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/PromptsView.vue"]]),m1=te({__name:"PromptEditView",setup(p,{expose:t}){t();const a=ze(),e=qe(),c=m(!0),i=m(null),r=m(!0),d=async()=>{const h=e.params.id;if(!h){a.push("/prompts");return}r.value=!0;try{const f=await fetch(X(`/api/prompts/${h}`));if(f.ok){const k=await f.json();i.value=k.prompt||k}else alert("Prompt not found"),a.push("/prompts")}catch(f){console.error("Error loading prompt:",f),alert("Failed to load prompt"),a.push("/prompts")}finally{r.value=!1}},u=async h=>{try{const{originalName:f,...k}=h,x=f||k.id,w=await fetch(X(`/api/prompts/${x}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});if(w.ok)a.push({path:"/prompts",query:{refresh:Date.now().toString()}});else{const M=await w.json();alert(M.error||"Failed to update prompt")}}catch(f){console.error("Error updating prompt:",f),alert("Failed to update prompt")}},v=h=>{h||a.push("/prompts")};ge(()=>{d()}),ae(c,h=>{h||a.push("/prompts")});const g={router:a,route:e,showModal:c,editingPrompt:i,isLoading:r,loadPrompt:d,handleSave:u,handleClose:v,PromptModal:Kt};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}}),f1={class:"p-8"},g1={key:0,class:"flex items-center justify-center min-h-[400px]"},h1={key:2,class:"flex items-center justify-center min-h-[400px]"};function v1(p,t,a,e,c,i){return n(),l("div",f1,[e.isLoading?(n(),l("div",g1,[...t[1]||(t[1]=[o("span",{class:"text-neutral-500"},"Loading prompt...",-1)])])):e.editingPrompt?(n(),Y(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"])):(n(),l("div",h1,[...t[2]||(t[2]=[o("span",{class:"text-neutral-500"},"Prompt not found",-1)])]))])}const b1=ee(m1,[["render",v1],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/PromptEditView.vue"]]),y1=te({__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:a}){t();function e(k){if(k===0)return"$0.00";const x=Math.abs(k);let w;return x<1e-4?w=x.toExponential(3):x<.001||x<.01||x<.1?w=x.toFixed(4):x<1?w=x.toFixed(3):x<10||x<100?w=x.toFixed(2):x<1e3?w=x.toFixed(1):w=x.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0}),w.includes(".")&&(w=w.replace(/\.?0+$/,""),!w.includes(".")&&x<100&&(w=x.toFixed(2))),k<0?`-$${w}`:`$${w}`}const c=p,i=a,r=k=>c.modelValue.includes(k),d=k=>{const x=[...c.modelValue],w=x.indexOf(k);w>-1?x.splice(w,1):x.push(k),i("update:modelValue",x)},u=()=>{i("update:modelValue",c.providers.map(k=>k.id))},v=()=>{i("update:modelValue",[])},g=z(()=>c.providers.length>0&&c.modelValue.length===c.providers.length),h=z(()=>c.modelValue.length>0&&c.modelValue.length<c.providers.length),f={dollars:e,props:c,emit:i,isSelected:r,toggleProvider:d,selectAll:u,deselectAll:v,allSelected:g,someSelected:h};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),x1={class:"border-2 border-black dark:border-neutral-300 rounded-lg overflow-hidden"},k1={key:0,class:"px-4 py-2 border-b-2 border-black dark:border-neutral-300 bg-neutral-50 dark:bg-neutral-900"},_1={class:"flex items-center justify-between"},w1={class:"text-sm font-medium"},C1={class:"flex items-center gap-2"},S1={key:1,class:"px-4 py-8 flex items-center justify-center"},T1={key:2,class:"px-4 py-8 text-center text-neutral-500"},M1={key:3,class:"divide-y divide-neutral-200 dark:divide-neutral-700"},I1=["onClick"],V1={class:"flex items-start gap-3"},A1={class:"flex-shrink-0 mt-0.5"},P1=["checked","onClick"],L1={class:"flex-1 min-w-0"},E1={class:"flex items-center gap-2"},j1={class:"text-sm font-medium"},O1={key:0,class:"text-xs px-1.5 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},D1={class:"mt-1 text-xs text-neutral-600 dark:text-neutral-400 space-y-0.5"},q1={key:0},U1={key:0},B1={key:1},N1={key:2};function R1(p,t,a,e,c,i){return n(),l("div",x1,[a.label?(n(),l("div",k1,[o("div",_1,[o("span",w1,y(a.label),1),o("div",C1,[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"},y(e.allSelected?"Deselect All":"Select All"),1)])])])):s("v-if",!0),a.loading?(n(),l("div",S1,[...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)])])):a.providers.length===0?(n(),l("div",T1," No providers available ")):(n(),l("div",M1,[(n(!0),l(G,null,ue(a.providers,r=>(n(),l("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",V1,[o("div",A1,[o("input",{type:"checkbox",checked:e.isSelected(r.id),onClick:ke(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,P1)]),o("div",L1,[o("div",E1,[o("span",j1,y(r.name),1),r.quantization?(n(),l("span",O1,y(r.quantization),1)):s("v-if",!0)]),o("div",D1,[o("div",null,y(e.dollars(r.pricing.prompt*1e6))+"/M input • "+y(e.dollars(r.pricing.completion*1e6))+"/M output ",1),r.maxPromptTokens||r.maxCompletionTokens?(n(),l("div",q1,[r.maxPromptTokens?(n(),l("span",U1," Max prompt: "+y(r.maxPromptTokens.toLocaleString())+" tokens ",1)):s("v-if",!0),r.maxPromptTokens&&r.maxCompletionTokens?(n(),l("span",B1," • ")):s("v-if",!0),r.maxCompletionTokens?(n(),l("span",N1," Max completion: "+y(r.maxCompletionTokens.toLocaleString())+" tokens ",1)):s("v-if",!0)])):s("v-if",!0)])])])],8,I1))),128))]))])}const F1=ee(y1,[["render",R1],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/ExposedSelectList.vue"]]),z1=te({__name:"ModelSelectorInput",props:Ve({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 a=p,e=Ue(p,"modelValue"),c=m([]),i=m(!1),r=z(()=>c.value.map(g=>({value:g.id,label:g.name,description:g.provider_id||g.provider,icon:mt(g.model||g.name,g.provider_id||g.provider)}))),d=async()=>{i.value=!0;try{const g=await fetch(X("/api/models"));if(g.ok){const h=await g.json();c.value=h.models||[]}}catch(g){console.error("Error fetching models:",g)}finally{i.value=!1}},u=g=>{};ge(()=>{d()}),ae(()=>a.allowMultiple,()=>{a.allowMultiple&&typeof e.value=="string"?e.value=e.value?[e.value]:[]:!a.allowMultiple&&Array.isArray(e.value)&&(e.value=e.value[0]||"")});const v={props:a,modelValue:e,models:c,loadingModels:i,modelOptions:r,fetchModels:d,handleRemoveItem:u,SelectInput:Se,MultipleSelectionsInput:ft};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),H1={key:2,class:"text-xs text-red-500 dark:text-red-400 mt-1"};function W1(p,t,a,e,c,i){return n(),l(G,null,[a.allowMultiple?(n(),Y(e.MultipleSelectionsInput,{key:0,modelValue:e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=r=>e.modelValue=r),label:a.label,placeholder:a.placeholder,"search-placeholder":"Search models...",error:a.error,required:a.required,disabled:a.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"])):(n(),Y(e.SelectInput,{key:1,modelValue:e.modelValue,"onUpdate:modelValue":t[1]||(t[1]=r=>e.modelValue=r),label:a.label,placeholder:a.placeholder,"search-placeholder":"Search models...",options:e.modelOptions,disabled:a.disabled,loading:e.loadingModels},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!a.allowMultiple&&a.error?(n(),l("p",H1,y(a.error),1)):s("v-if",!0)],64)}const J1=ee(z1,[["render",W1],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/ModelSelectorInput.vue"]]),K1=te({__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:a}){t();const e=p,c=a,i=m([]),r=m(""),d=m(""),u=m([]),v=m(!1),g=m(!1),h=m([]),f=m([]),k=m(!1),x=m([]),w=z(()=>e.mode==="edit"),M=m(""),b=m(""),S=m(""),T=_=>{let I=_.replace(/[^a-zA-Z0-9\s_-]/g,"");return I=I.trim().toLowerCase().replace(/[\s-]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),I?/^[a-z][a-z0-9_]*$/.test(I)?S.value="":S.value="Name must start with a letter and contain only lowercase letters, numbers, and underscores":S.value="Name is required",I},A=_=>{const I=_.target.value;b.value=T(I)},O=m(!1),R=m(null),F=z(()=>i.value.filter(_=>_.hasApiKey).map(_=>({value:_.name,label:_.name,description:_.sdk==="openai-sdk"?"OpenAI SDK":_.sdk==="openrouter"?"OpenRouter":_.sdk,icon:Qe(_.sdk)}))),$=z(()=>u.value.map(_=>({..._,icon:_.iconId?Qe(_.iconId):void 0}))),B=z(()=>!w.value||!R.value||O.value?!1:b.value!==R.value.name||r.value!==R.value.provider||d.value!==R.value.model||JSON.stringify(f.value.sort())!==JSON.stringify(R.value.endpoints.sort())||JSON.stringify(x.value)!==JSON.stringify(R.value.fallbacks)),D=z(()=>i.value.find(I=>I.name===r.value)?.sdk==="openrouter"),W=async()=>{v.value=!0;try{const _=await fetch(X("/api/providers"));if(_.ok){const I=await _.json();i.value=I.providers||[]}}catch(_){console.error("Error fetching providers:",_)}finally{v.value=!1}},U=async()=>{if(!r.value){u.value=[];return}g.value=!0;try{const _=await fetch(X("/api/models/available"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r.value})});if(_.ok){const I=await _.json();u.value=I.models||[]}else{const I=await _.json();console.error("Error fetching models:",I),u.value=[],alert(I.error||"Failed to fetch available models")}}catch(_){console.error("Error fetching models:",_),u.value=[]}finally{g.value=!1}},P=()=>{b.value="",M.value="",r.value="",d.value="",u.value=[],x.value=[],h.value=[],f.value=[],R.value=null,O.value=!1},H=async()=>{if(e.editModel){O.value=!0;try{await W(),b.value=e.editModel.name||"",M.value=e.editModel.name||"",r.value=e.editModel.provider_id||e.editModel.provider,await U(),d.value=e.editModel.model,await j(),e.editModel.included_providers&&e.editModel.included_providers.length>0&&(f.value=e.editModel.included_providers),await K(),R.value={name:b.value,provider:r.value,model:d.value,endpoints:[...f.value],fallbacks:[...x.value]}}finally{O.value=!1}}};ae(()=>e.modelValue,async _=>{_?w.value&&e.editModel?await H():(await W(),P()):P()});const K=async()=>{if(e.editModel?.id){if(e.editModel.fallbacks&&Array.isArray(e.editModel.fallbacks)){x.value=e.editModel.fallbacks.map(_=>typeof _=="string"?_:_.id);return}try{const _=await fetch(X(`/api/models/${e.editModel.id}/fallbacks`));if(_.ok){const I=await _.json();x.value=I.fallbacks.map(E=>E.fallback_model_id)}}catch(_){console.error("Error loading fallbacks:",_)}}};ae(r,async(_,I)=>{O.value||w.value&&!I&&_===(e.editModel?.provider_id||e.editModel?.provider)||(d.value="",h.value=[],f.value=[],r.value&&await U())});const j=async()=>{if(!d.value||!r.value){h.value=[];return}const _=i.value.find(E=>E.name===r.value);if(!_||_.sdk!=="openrouter"){h.value=[];return}const I=$.value.find(E=>E.value===d.value);if(!I?.slug){console.error("Model slug not found"),h.value=[];return}k.value=!0;try{const E=await fetch(X("/api/models/endpoints"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r.value,modelSlug:I.slug})});if(E.ok){const N=await E.json();h.value=N.endpoints||[],w.value||(f.value=h.value.map(ie=>ie.id))}else{const N=await E.json();console.error("Error fetching endpoints:",N),h.value=[]}}catch(E){console.error("Error fetching endpoints:",E),h.value=[]}finally{k.value=!1}};ae(d,async(_,I)=>{O.value||w.value&&!I&&_===e.editModel?.model||(d.value?(await j(),I&&_!==I&&(f.value=h.value.map(E=>E.id))):(h.value=[],f.value=[]))});const q={props:e,emit:c,providers:i,selectedProvider:r,selectedModel:d,availableModels:u,loadingProviders:v,loadingModels:g,endpoints:h,selectedEndpoints:f,loadingEndpoints:k,fallbackModels:x,isEditMode:w,originalName:M,modelName:b,nameError:S,validateAndFormatName:T,handleNameInput:A,isLoading:O,initialState:R,providerOptions:F,modelOptions:$,hasChanges:B,isOpenRouter:D,fetchProviders:W,fetchAvailableModels:U,resetForm:P,loadEditData:H,loadModelFallbacks:K,fetchEndpoints:j,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 _=D.value?f.value:[],I={name:b.value,model:d.value,provider:r.value,included_providers:_,fallbacks:x.value};w.value&&e.editModel?.id&&(I.id=e.editModel.id,M.value&&M.value!==b.value&&(I.originalName=M.value)),c("save",I)},handleCancel:()=>{P(),c("update:modelValue",!1)},Modal:je,SelectInput:Se,ExposedSelectList:F1,ModelSelectorInput:J1};return Object.defineProperty(q,"__isScriptSetup",{enumerable:!1,value:!0}),q}}),Z1={class:"space-y-4"},G1={key:0},X1={key:1},Y1=["value"],Q1={key:0,class:"mt-1 text-xs text-red-500"},$1={key:1,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},ef={class:"px-1 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},tf={key:2,class:"mt-1 text-xs text-neutral-500 dark:text-neutral-400"},of={key:2},rf={key:3},af={class:"flex justify-end gap-2"},nf=["disabled"];function lf(p,t,a,e,c,i){return n(),Y(e.Modal,{"model-value":a.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:re(()=>[o("div",af,[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},y(e.isEditMode?"Update Model":"Add Model"),9,nf)])]),default:re(()=>[o("div",Z1,[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?(n(),l("div",G1,[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"])])):s("v-if",!0),s(" Name field (shown after model selection) "),e.selectedModel?(n(),l("div",X1,[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:Q(["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,Y1),e.nameError?(n(),l("p",Q1,y(e.nameError),1)):e.modelName?(n(),l("p",$1,[t[5]||(t[5]=ve(" Will be saved as: ",-1)),o("code",ef,y(e.modelName),1)])):(n(),l("p",tf," A descriptive name for this model (e.g., coding_model, planning_model). This becomes the filename and reference ID. "))])):s("v-if",!0),e.selectedModel&&e.isOpenRouter?(n(),l("div",of,[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))])):s("v-if",!0),s(" Fallback Models Section "),e.selectedModel?(n(),l("div",rf,[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))])):s("v-if",!0)])]),_:1},8,["model-value","title","has-changes"])}const sf=ee(K1,[["render",lf],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/ModelModal.vue"]]),df=te({__name:"ModelsView",setup(p,{expose:t}){t();const a=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:k=>{i.value=k,r.value="edit",a.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 k=>{await h(k.id)}}],v=async()=>{c.value=!0;try{const k=await fetch(X("/api/models"));if(!k.ok)throw new Error("Failed to fetch models");const x=await k.json();e.value=x.models||[]}catch(k){console.error("Error fetching models:",k),e.value=[]}finally{c.value=!1}},g=async k=>{try{if(i.value){const{originalName:x,...w}=k,M=x||i.value.id,b=await fetch(X(`/api/models/${M}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!b.ok){const S=await b.json();alert(S.error||"Failed to update model");return}}else{const x=await fetch(X("/api/models"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});if(!x.ok){const w=await x.json();alert(w.error||"Failed to add model");return}}await v(),a.value=!1,i.value=null,r.value="add"}catch(x){console.error("Error saving model:",x),alert("Failed to save model")}},h=async k=>{try{const x=await fetch(X(`/api/models/${k}`),{method:"DELETE"});if(!x.ok){const w=await x.json();alert(w.error||"Failed to delete model");return}await v()}catch(x){console.error("Error deleting model:",x),alert("Failed to delete model")}};ge(()=>{v()});const f={showModal:a,models:e,loading:c,editingModel:i,modalMode:r,columns:d,actions:u,fetchModels:v,handleAddModel:g,deleteModel:h,ModelModal:sf,DataTable:Be,get getModelIcon(){return mt},CenteredContentView:Re};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),cf={class:"flex justify-between items-center mb-6"},uf={class:"flex items-center gap-2"},pf=["src","alt"],mf={class:"text-sm text-neutral-600 dark:text-neutral-400 font-mono"},ff={key:0,class:"space-y-0.5"},gf=["title"],hf={class:"shrink-0 font-mono pr-2"},vf=["src","alt"],bf={class:"truncate"},yf={key:1,class:"text-neutral-400 dark:text-neutral-600 text-sm"};function xf(p,t,a,e,c,i){return n(),Y(e.CenteredContentView,null,{default:re(()=>[o("div",cf,[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":re(({value:r,row:d})=>[o("div",uf,[e.getModelIcon(d.model,d.provider)?(n(),l("img",{key:0,src:e.getModelIcon(d.model,d.provider),class:"w-5 h-5 shrink-0",alt:d.provider},null,8,pf)):s("v-if",!0),o("span",null,y(r),1)])]),"cell-model":re(({value:r})=>[o("span",mf,y(r||"—"),1)]),"cell-fallbacks":re(({value:r})=>[r&&r.length>0?(n(),l("div",ff,[(n(!0),l(G,null,ue(r,(d,u)=>(n(),l("div",{key:d.id,class:"text-sm text-neutral-600 dark:text-neutral-400 flex items-center",title:d.name},[o("span",hf,y(u===r.length-1?"└─":"├─"),1),e.getModelIcon(d.model,d.provider)?(n(),l("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,vf)):s("v-if",!0),o("span",bf,y(d.name),1)],8,gf))),128))])):(n(),l("span",yf," None "))]),_:1},8,["data","loading"]),s(" 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 kf=ee(df,[["render",xf],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/ModelsView.vue"]]),_f=te({__name:"AddProviderModal",props:{modelValue:{type:Boolean,required:!0}},emits:["update:modelValue","save"],setup(p,{expose:t,emit:a}){t();const e=a,c=m({name:"",type:"",apiKey:"",baseUrl:""}),i=[{value:"openai",label:"OpenAI",icon:Ye,sdk:"openai-sdk"},{value:"openrouter",label:"OpenRouter",icon:st,sdk:"openrouter"}],r=b=>b==="openai-sdk"||b==="openai"?Ye:b==="openrouter"?st:null,d=m(!1),u=z(()=>i.find(b=>b.value===c.value.type)),v=()=>{setTimeout(()=>{d.value=!1},200)},g=m({});ae(()=>c.value.type,b=>{if(b&&!c.value.name){const S=i.find(T=>T.value===b);S&&(c.value.name=S.label)}});const h=z(()=>c.value.type==="custom"||c.value.type==="openai"),f=()=>{g.value={};let b=!0;return c.value.name||(g.value.name="Provider name is required",b=!1),c.value.type||(g.value.type="Provider type is required",b=!1),c.value.apiKey||(g.value.apiKey="API key is required",b=!1),h.value&&c.value.type==="custom"&&!c.value.baseUrl&&(g.value.baseUrl="Base URL is required for custom providers",b=!1),b},k=()=>{f()&&(e("save",{...c.value}),w(),e("update:modelValue",!1))},x=()=>{w(),e("update:modelValue",!1)},w=()=>{c.value={name:"",type:"",apiKey:""},g.value={}},M={emit:e,formData:c,providerTypes:i,getProviderIcon:r,isDropdownOpen:d,selectedProvider:u,handleDropdownBlur:v,errors:g,showBaseUrl:h,validateForm:f,handleSave:k,handleCancel:x,resetForm:w,Modal:je,TextInput:Ne};return Object.defineProperty(M,"__isScriptSetup",{enumerable:!1,value:!0}),M}}),wf={class:"space-y-4"},Cf={class:"space-y-1"},Sf={class:"relative"},Tf={key:0,class:"flex items-center gap-2"},Mf=["src","alt"],If={key:1,class:"text-neutral-500"},Vf={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"},Af=["onClick"],Pf=["src","alt"],Lf={key:0,class:"text-xs text-red-500 dark:text-red-400"};function Ef(p,t,a,e,c,i){return n(),Y(e.Modal,{"model-value":a.modelValue,"onUpdate:modelValue":t[4]||(t[4]=r=>p.$emit("update:modelValue",r)),title:"Add Provider",width:"max-w-md"},{footer:re(()=>[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:re(()=>[o("div",wf,[o("div",Cf,[t[6]||(t[6]=o("label",{class:"block text-sm font-medium"},[ve(" Provider Type "),o("span",{class:"text-red-500"},"*")],-1)),o("div",Sf,[o("button",{type:"button",onClick:t[0]||(t[0]=r=>e.isDropdownOpen=!e.isDropdownOpen),onBlur:e.handleDropdownBlur,class:Q(["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?(n(),l("div",Tf,[o("img",{src:e.selectedProvider.icon,alt:e.selectedProvider.label,class:"w-5 h-5"},null,8,Mf),o("span",null,y(e.selectedProvider.label),1)])):(n(),l("span",If,"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?(n(),l("div",Vf,[(n(),l(G,null,ue(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,Pf),o("span",null,y(r.label),1)],8,Af)),64))])):s("v-if",!0)]),e.errors.type?(n(),l("p",Lf,y(e.errors.type),1)):s("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?(n(),Y(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"])):s("v-if",!0)])]),_:1},8,["model-value"])}const jf=ee(_f,[["render",Ef],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/AddProviderModal.vue"]]),Of=te({__name:"ProvidersView",setup(p,{expose:t}){t();const a=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:h=>({"openai-sdk":"OpenAI SDK",openrouter:"OpenRouter",openai:"OpenAI"})[h]||h},{key:"hasApiKey",label:"API Key",width:"w-1/3",formatter:h=>h?"✓ 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 h=>{await v(h.name)}}],d=async()=>{c.value=!0;try{const h=await fetch(X("/api/providers"));if(!h.ok)throw new Error("Failed to fetch providers");const f=await h.json();e.value=f.providers||[]}catch(h){console.error("Error fetching providers:",h),e.value=[]}finally{c.value=!1}},u=async h=>{try{const f=await fetch(X("/api/providers"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)});if(!f.ok){const k=await f.json();alert(k.error||"Failed to add provider");return}await d(),a.value=!1}catch(f){console.error("Error adding provider:",f),alert("Failed to add provider")}},v=async h=>{try{const f=await fetch(X(`/api/providers/${encodeURIComponent(h)}`),{method:"DELETE"});if(!f.ok){const k=await f.json();k.modelCount?alert(`${k.error}
|
|
13
13
|
|
|
14
|
-
This provider has ${w.modelCount} associated model(s).`):alert(w.error||"Failed to delete provider");return}await n()}catch(h){console.error("Error deleting provider:",h),alert("Failed to delete provider")}};ce(()=>{n()});const g={showAddModal:a,providers:e,loading:c,columns:d,actions:r,fetchProviders:n,handleAddProvider:p,deleteProvider:v,AddProviderModal:mg,DataTable:Le,CenteredContentView:je};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}}),fg={class:"flex justify-between items-center mb-6"};function hg(u,t,a,e,c,d){return s(),Z(e.CenteredContentView,null,{default:oe(()=>[o("div",fg,[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-gray-600 dark:text-gray-400 mb-8"}," Manage API providers and authentication keys. All API keys are encrypted at rest. ",-1)),S(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"]),i(" Add Provider Modal "),S(e.AddProviderModal,{modelValue:e.showAddModal,"onUpdate:modelValue":t[1]||(t[1]=r=>e.showAddModal=r),onSave:e.handleAddProvider},null,8,["modelValue"])]),_:1})}const vg=Y(gg,[["render",hg],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/ProvidersView.vue"]]),bg=ee({__name:"JsonViewer",props:{value:{type:null,required:!0}},setup(u,{expose:t}){t();const a=u;function e(n){return n.replace(/"([^"\\]|\\.)*"/g,p=>`<span class="json-string">${c(p)}</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(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const d=z(()=>{try{const n=JSON.stringify(a.value,null,2);return e(n)}catch{return c(String(a.value))}}),r={props:a,highlightJson:e,escapeHtml:c,formattedJson:d};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),yg={class:"json-viewer overflow-auto"},xg=["innerHTML"];function kg(u,t,a,e,c,d){return s(),l("div",yg,[o("pre",{class:"p-4 text-sm font-mono leading-relaxed",innerHTML:e.formattedJson},null,8,xg)])}const _g=Y(bg,[["render",kg],["__scopeId","data-v-01a533a8"],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/JsonViewer.vue"]]),wg={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Cg(u,t){return s(),l("svg",wg,[...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 Sg=ge({name:"lucide-info",render:Cg}),Tg={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Mg(u,t){return s(),l("svg",Tg,[...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 Vg=ge({name:"lucide-triangle-alert",render:Mg}),Ig=ee({__name:"ToolsView",setup(u,{expose:t}){t();const a=m(null),e=m(!1),{data:c}=ve(J("/api/config")).json(),{data:d,error:r,isFetching:n,execute:p}=ve(J("/api/tools?type=tools"),{immediate:!1}).json(),{data:v,error:g,isFetching:f,execute:h}=ve(J("/api/tools?type=prompts&schema=true"),{immediate:!1}).json(),{data:w,error:x,isFetching:k,execute:C}=ve(J("/api/tools?type=agents&schema=true"),{immediate:!1}).json(),{data:y,error:_,isFetching:V,execute:U}=ve(()=>a.value?J(`/api/tools/${a.value.name}`):null,{immediate:!1}).json(),D=m([]),j=m([]),F=m([]),K=async A=>{a.value=A,await U(),y.value?a.value={...A,schema:y.value.schema||null}:_.value&&console.error("Error fetching tool schema:",_.value),e.value=!0},E=async A=>{if(a.value=A,e.value=!0,!A.schema&&A.type==="prompt"){const B=await fetch(J("/api/tools?type=prompts&schema=true"));if(B.ok){const te=await B.json();te[A.name]&&(a.value={...A,schema:te[A.name].schema||null})}}},P=[{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"}],H=[{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"}],R=A=>/^[a-z][a-z0-9_]*[a-z0-9]$/.test(A)||/^[a-z]$/.test(A),N=A=>A.hasError&&A.error?A.error:A.description||"No description available",X=()=>{d.value&&(D.value=Object.entries(d.value).map(([A,B])=>({name:A,description:B.description||"No description available",schema:null,hasError:B.hasError||!1,error:B.error,type:B.type||"tool"})))},Q=()=>{v.value&&(j.value=Object.entries(v.value).map(([A,B])=>({name:A,description:B.description||"No description available",schema:B.schema||null,hasError:!1,type:"prompt",model:B.model})))},L=()=>{w.value&&(F.value=Object.entries(w.value).map(([A,B])=>({name:A,description:B.description||"No description available",schema:B.schema||null,hasError:!1,type:"agent",model:B.model})))},I=async()=>{await p(),X()},T=async()=>{await h(),Q()},q=async()=>{await C(),L()},M=()=>{e.value=!1,a.value=null};ce(()=>{I(),T(),q()});const O={selectedTool:a,showSchemaModal:e,configData:c,toolsData:d,error:r,isFetching:n,execute:p,promptsData:v,promptsError:g,isFetchingPrompts:f,executePrompts:h,agentsData:w,agentsError:x,isFetchingAgents:k,executeAgents:C,toolSchemaData:y,toolSchemaError:_,isFetchingSchema:V,executeToolSchema:U,tools:D,prompts:j,agents:F,openSchema:K,openPromptSchema:E,promptColumns:P,columns:H,isSnakeCase:R,getDescription:N,processToolsData:X,processPromptsData:Q,processAgentsData:L,fetchTools:I,fetchPrompts:T,fetchAgents:q,closeModal:M,DataTable:Le,Modal:Ie,JsonViewer:_g,get IconInfo(){return Sg},get IconEye(){return Pt},get IconTriangleAlert(){return Vg},CenteredContentView:je};return Object.defineProperty(O,"__isScriptSetup",{enumerable:!1,value:!0}),O}}),Ag={class:"mb-6 p-4 border border-black/20 dark:border-white/20 rounded bg-black/5 dark:bg-white/5"},Pg={class:"flex items-start gap-3"},Eg={class:"text-sm"},Lg={class:"font-medium mb-1"},Og={class:"px-1.5 py-0.5 bg-black/10 dark:bg-white/10 rounded font-mono text-xs"},jg=["onClick"],Dg={key:1,class:"text-left font-medium text-red-600 dark:text-red-400"},Ug={key:2,class:"relative group"},qg={key:3,class:"relative group"},Ng={class:"flex justify-end"},Bg=["onClick"],Rg={key:1,class:"text-gray-400 text-sm"},Fg={class:"mt-12"},zg=["onClick"],Hg={class:"text-gray-600 dark:text-gray-400"},Wg={class:"text-sm text-gray-500 dark:text-gray-400"},Jg={class:"mt-12"},Kg=["onClick"],Zg={class:"text-gray-600 dark:text-gray-400"},Gg={class:"text-sm text-gray-500 dark:text-gray-400"},Xg={class:"flex items-center gap-2"},Qg={key:0,class:"space-y-4"},Yg={class:"text-lg font-medium mb-2"},$g={class:"text-sm text-gray-600 dark:text-gray-400 mb-4"},ef={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 tf(u,t,a,e,c,d){return s(),Z(e.CenteredContentView,null,{default:oe(()=>[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-gray-600 dark:text-gray-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 four types of tools: functions, prompts, agents, and MCP tools. 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. MCP tools are tools that are exposed via third party MCP servers. ",-1)),i(" Info banner "),o("div",Ag,[o("div",Pg,[S(e.IconInfo,{class:"w-5 h-5 mt-0.5 text-black/60 dark:text-white/60 flex-shrink-0"}),o("div",Eg,[o("p",Lg,[t[1]||(t[1]=ie(" To create or modify tools, edit the ",-1)),o("code",Og,b(e.configData?.toolsDir||"agentbuilder/tools")+"/",1),t[2]||(t[2]=ie(" 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))])])]),S(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":oe(({row:r})=>[o("div",{class:G(["flex items-center gap-2",{"text-red-600 dark:text-red-400":r.hasError}])},[r.hasError?(s(),l("span",Dg,b(r.name),1)):(s(),l("button",{key:0,onClick:n=>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"},b(r.name),9,jg)),r.hasError?(s(),l("div",Ug,[S(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"},[ie(" 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)?i("v-if",!0):(s(),l("div",qg,[S(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"},[ie(" 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":oe(({row:r})=>[o("span",{class:G({"text-red-600 dark:text-red-400":r.hasError,"text-gray-600 dark:text-gray-400":!r.hasError})},b(e.getDescription(r)),3)]),"cell-actions":oe(({row:r})=>[o("div",Ng,[r.hasError?(s(),l("span",Rg,"—")):(s(),l("button",{key:0,onClick:n=>e.openSchema(r),class:"p-1.5 rounded hover:bg-black/10 dark:hover:bg-white/10 transition-colors",title:"View Schema"},[S(e.IconEye,{class:"w-4 h-4"})],8,Bg))])]),_:1},8,["data","loading","empty-message"]),i(" Prompts Section "),o("div",Fg,[t[6]||(t[6]=o("h2",{class:"text-2xl font-bold mb-4"},"Prompts",-1)),t[7]||(t[7]=o("p",{class:"text-gray-600 dark:text-gray-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)),S(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":oe(({row:r})=>[o("button",{onClick:n=>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"},b(r.name),9,zg)]),"cell-description":oe(({row:r})=>[o("span",Hg,b(r.description),1)]),"cell-model":oe(({row:r})=>[o("span",Wg,b(r.model||"-"),1)]),_:1},8,["data","loading"])]),i(" Agents Section "),o("div",Jg,[t[8]||(t[8]=o("h2",{class:"text-2xl font-bold mb-4"},"Agents",-1)),t[9]||(t[9]=o("p",{class:"text-gray-600 dark:text-gray-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)),S(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":oe(({row:r})=>[o("button",{onClick:n=>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"},b(r.name),9,Kg)]),"cell-description":oe(({row:r})=>[o("span",Zg,b(r.description),1)]),"cell-model":oe(({row:r})=>[o("span",Gg,b(r.model||"-"),1)]),_:1},8,["data","loading"])]),i(" Schema Modal "),S(e.Modal,{modelValue:e.showSchemaModal,"onUpdate:modelValue":t[0]||(t[0]=r=>e.showSchemaModal=r),onClose:e.closeModal,width:"max-w-4xl"},{header:oe(()=>[o("div",Xg,[S(e.IconEye,{class:"w-5 h-5"}),o("span",null,b(e.selectedTool?.name)+" Schema",1)])]),footer:oe(()=>[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:oe(()=>[e.selectedTool?(s(),l("div",Qg,[o("div",null,[o("h3",Yg,b(e.selectedTool.type==="prompt"?"Required Schema":"JSON Schema"),1),o("p",$g,b(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?(s(),l("div",ef,[...t[10]||(t[10]=[o("p",{class:"text-gray-500 dark:text-gray-400"}," No parameters required ",-1)])])):(s(),Z(e.JsonViewer,{key:1,value:e.selectedTool.schema,class:"h-96 border border-black/20 dark:border-white/20 rounded"},null,8,["value"]))])):i("v-if",!0)]),_:1},8,["modelValue"])]),_:1})}const of=Y(Ig,[["render",tf],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/ToolsView.vue"]]),rf=ee({__name:"UsersView",setup(u,{expose:t}){t();const a=m(!1),e=m(!1),c=m([]),d=m(!1),r=m(null),n=m({username:"",password:"",role:"admin"}),p=m({username:"",password:"",role:"admin"}),v=[{value:"admin",label:"Admin"}],g=[{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:y=>new Date(y*1e3).toLocaleString()}],f=[{icon:"edit",label:"Edit",handler:async y=>{r.value=y,p.value={username:y.username,password:"",role:y.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 y=>{await k(y.id)}}],h=async()=>{d.value=!0;try{const y=await Ve("/users");if(!y.ok)throw new Error("Failed to fetch users");const _=await y.json();c.value=_.users||[]}catch(y){console.error("Error fetching users:",y),c.value=[]}finally{d.value=!1}},w=async()=>{if(!n.value.username||!n.value.password){alert("Username and password are required");return}try{const y=await Ve("/users",{method:"POST",body:JSON.stringify(n.value)});if(!y.ok){const _=await y.json();alert(_.error||"Failed to add user");return}await h(),a.value=!1,n.value={username:"",password:"",role:"admin"}}catch(y){console.error("Error adding user:",y),alert("Failed to add user")}},x=async()=>{if(!p.value.username){alert("Username is required");return}try{const y={username:p.value.username,role:p.value.role};p.value.password&&(y.password=p.value.password);const _=await Ve(`/users/${r.value.id}`,{method:"PUT",body:JSON.stringify(y)});if(!_.ok){const V=await _.json();alert(V.error||"Failed to update user");return}await h(),e.value=!1,r.value=null}catch(y){console.error("Error updating user:",y),alert("Failed to update user")}},k=async y=>{try{const _=await Ve(`/users/${y}`,{method:"DELETE"});if(!_.ok){const V=await _.json();alert(V.error||"Failed to delete user");return}await h()}catch(_){console.error("Error deleting user:",_),alert("Failed to delete user")}};ce(()=>{h()});const C={showAddModal:a,showEditModal:e,users:c,loading:d,editingUser:r,newUser:n,editUser:p,roleOptions:v,columns:g,actions:f,fetchUsers:h,handleAddUser:w,handleEditUser:x,deleteUser:k,DataTable:Le,Modal:Ie,SelectInput:xe,CenteredContentView:je};return Object.defineProperty(C,"__isScriptSetup",{enumerable:!1,value:!0}),C}}),af={class:"flex justify-between items-center mb-6"},sf={class:"flex justify-end gap-2 mt-4"},lf={class:"flex justify-end gap-2 mt-4"};function nf(u,t,a,e,c,d){return s(),Z(e.CenteredContentView,null,{default:oe(()=>[o("div",af,[t[13]||(t[13]=o("div",null,[o("h1",{class:"text-3xl font-bold"},"Users"),o("p",{class:"text-gray-600 dark:text-gray-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 ")]),S(e.DataTable,{columns:e.columns,data:e.users,actions:e.actions,loading:e.loading,"empty-message":"No users found"},null,8,["data","loading"]),i(" Add User Modal "),S(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:oe(()=>[o("form",{onSubmit:he(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)),fe(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-gray-300 dark:border-neutral-600 rounded-md dark:bg-gray-700"},null,512),[[_e,e.newUser.username]])]),o("div",null,[t[15]||(t[15]=o("label",{class:"block text-sm font-medium mb-1"},"Password",-1)),fe(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-gray-300 dark:border-neutral-600 rounded-md dark:bg-gray-700"},null,512),[[_e,e.newUser.password]])]),o("div",null,[S(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",sf,[o("button",{type:"button",onClick:t[4]||(t[4]=r=>e.showAddModal=!1),class:"px-4 py-2 border border-gray-300 dark:border-neutral-600 rounded hover:bg-gray-50 dark:hover:bg-gray-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"]),i(" Edit User Modal "),S(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:oe(()=>[o("form",{onSubmit:he(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)),fe(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-gray-300 dark:border-neutral-600 rounded-md dark:bg-gray-700"},null,512),[[_e,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)),fe(o("input",{"onUpdate:modelValue":t[8]||(t[8]=r=>e.editUser.password=r),type:"password",class:"w-full px-3 py-2 border border-gray-300 dark:border-neutral-600 rounded-md dark:bg-gray-700"},null,512),[[_e,e.editUser.password]])]),o("div",null,[S(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",lf,[o("button",{type:"button",onClick:t[10]||(t[10]=r=>e.showEditModal=!1),class:"px-4 py-2 border border-gray-300 dark:border-neutral-600 rounded hover:bg-gray-50 dark:hover:bg-gray-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 df=Y(rf,[["render",nf],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/UsersView.vue"]]),cf=ee({__name:"ApiKeysView",setup(u,{expose:t}){t();const a=m(!1),e=m(!1),c=m([]),d=m(!1),r=m(""),n=m({name:""}),p=[{key:"name",label:"Name",width:"w-1/3"},{key:"keyPreview",label:"API Key",width:"w-1/3",html:!0,formatter:k=>`<code class="bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded text-sm">${k}</code>`},{key:"createdAt",label:"Created",width:"w-1/6",formatter:k=>new Date(k*1e3).toLocaleDateString()},{key:"lastUsedAt",label:"Last Used",width:"w-1/6",formatter:k=>k?new Date(k*1e3).toLocaleDateString():"Never"}],v=[{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this API key? This action cannot be undone.",handler:async k=>{await h(k.id)}}],g=async()=>{d.value=!0;try{const k=await Ve("/api-keys");if(!k.ok)throw new Error("Failed to fetch API keys");const C=await k.json();c.value=(C.keys||[]).map(y=>({...y,keyPreview:`${y.key_prefix}...${y.last_five}`,createdAt:y.created_at,lastUsedAt:y.last_used_at}))}catch(k){console.error("Error fetching API keys:",k),c.value=[]}finally{d.value=!1}},f=async()=>{if(!n.value.name){alert("Name is required");return}try{const k=await Ve("/api-keys",{method:"POST",body:JSON.stringify(n.value)}),C=await k.json();if(!k.ok){alert(C.error||"Failed to create API key");return}r.value=C.key,a.value=!1,e.value=!0,await g(),n.value={name:""}}catch(k){console.error("Error creating API key:",k),alert("Failed to create API key")}},h=async k=>{try{const C=await Ve(`/api-keys/${k}`,{method:"DELETE"});if(!C.ok){const y=await C.json();alert(y.error||"Failed to delete API key");return}await g()}catch(C){console.error("Error deleting API key:",C),alert("Failed to delete API key")}},w=async k=>{try{await navigator.clipboard.writeText(k),alert("API key copied to clipboard!")}catch(C){console.error("Failed to copy:",C)}};ce(()=>{g()});const x={showAddModal:a,showKeyModal:e,apiKeys:c,loading:d,newApiKey:r,newKeyData:n,columns:p,actions:v,fetchApiKeys:g,handleAddApiKey:f,deleteApiKey:h,copyToClipboard:w,DataTable:Le,Modal:Ie,CenteredContentView:je};return Object.defineProperty(x,"__isScriptSetup",{enumerable:!1,value:!0}),x}}),uf={class:"flex justify-between items-center mb-6"},pf={class:"flex justify-end gap-2 mt-4"},mf={class:"space-y-4"},gf={class:"flex gap-2"},ff=["value"],hf={class:"bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-800 text-blue-800 dark:text-blue-400 px-4 py-3 rounded"},vf={class:"block mt-2 bg-white dark:bg-gray-800 px-3 py-2 rounded text-xs"},bf={class:"flex justify-end mt-4"};function yf(u,t,a,e,c,d){return s(),Z(e.CenteredContentView,null,{default:oe(()=>[o("div",uf,[t[9]||(t[9]=o("div",null,[o("h1",{class:"text-3xl font-bold"},"API Keys"),o("p",{class:"text-gray-600 dark:text-gray-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 ")]),S(e.DataTable,{columns:e.columns,data:e.apiKeys,actions:e.actions,loading:e.loading,"empty-message":"No API keys found"},null,8,["data","loading"]),i(" Add API Key Modal "),S(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:oe(()=>[o("form",{onSubmit:he(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)),fe(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-gray-300 dark:border-neutral-600 rounded-md dark:bg-gray-700"},null,512),[[_e,e.newKeyData.name]]),t[11]||(t[11]=o("p",{class:"text-sm text-gray-500 dark:text-gray-400 mt-1"}," A descriptive name to help you identify this key ",-1))]),o("div",pf,[o("button",{type:"button",onClick:t[2]||(t[2]=r=>e.showAddModal=!1),class:"px-4 py-2 border border-gray-300 dark:border-neutral-600 rounded hover:bg-gray-50 dark:hover:bg-gray-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"]),i(" Show New API Key Modal "),S(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:oe(()=>[o("div",mf,[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",gf,[o("input",{value:e.newApiKey,type:"text",readonly:"",class:"flex-1 px-3 py-2 border border-gray-300 dark:border-neutral-600 rounded-md dark:bg-gray-700 font-mono text-sm"},null,8,ff),o("button",{onClick:t[5]||(t[5]=r=>e.copyToClipboard(e.newApiKey)),class:"px-4 py-2 bg-gray-200 dark:bg-gray-700 rounded hover:bg-gray-300 dark:hover:bg-gray-600"}," Copy ")])]),o("div",hf,[t[14]||(t[14]=o("p",{class:"text-sm"}," Use this key in the Authorization header of your API requests: ",-1)),o("code",vf," Authorization: Bearer "+b(e.newApiKey),1)]),o("div",bf,[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 xf=Y(cf,[["render",yf],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/ApiKeysView.vue"]]),kf=ee({__name:"LoginView",setup(u,{expose:t}){t();const a=Ue(),e=Pe(),c=m(""),d=m(""),r=m(""),n=m(!1),p=m(!1),v=m(!1);ce(async()=>{const x=e.query.token,k=e.query.error;if(x){localStorage.setItem("auth_token",x),a.push("/");return}k&&(k==="oauth_failed"?r.value="OAuth authentication failed. Please try again.":k==="oauth_not_configured"&&(r.value="OAuth provider is not configured."));try{const C=await fetch(J("/api/auth/config"));if(C.ok){const y=await C.json();p.value=y.github||!1,v.value=y.google||!1}}catch(C){console.error("Failed to fetch auth config:",C)}});async function g(){r.value="",n.value=!0;try{const x=await fetch(J("/api/auth/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:c.value,password:d.value})}),k=await x.json();x.ok?(localStorage.setItem("auth_token",k.token),a.push("/")):r.value=k.error||"Login failed"}catch{r.value="Network error. Please try again."}finally{n.value=!1}}function f(){window.location.href=J("/api/auth/oauth/github")}function h(){window.location.href=J("/api/auth/oauth/google")}const w={router:a,route:e,username:c,password:d,error:r,loading:n,showGithubLogin:p,showGoogleLogin:v,handleLogin:g,handleGithubLogin:f,handleGoogleLogin:h,TextInput:Oe,DropShadow:ze};return Object.defineProperty(w,"__isScriptSetup",{enumerable:!1,value:!0}),w}}),_f={class:"min-h-screen flex items-center justify-center bg-white dark:bg-black px-4"},wf={class:"max-w-md w-full space-y-8"},Cf={class:"bg-white dark:bg-black border border-black dark:border-neutral-300 py-8 px-6"},Sf={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"},Tf=["disabled"],Mf={key:0,class:"mt-6"};function Vf(u,t,a,e,c,d){return s(),l("div",_f,[o("div",wf,[t[5]||(t[5]=o("div",null,[o("h2",{class:"mt-6 text-center text-3xl font-bold text-black dark:text-white"}," Sign in to AgentBuilder ")],-1)),S(e.DropShadow,{offsetX:8,offsetY:8,intensity:.5,pattern:"crosshatch"},{default:oe(()=>[o("div",Cf,[o("form",{class:"space-y-6",onSubmit:he(e.handleLogin,["prevent"])},[e.error?(s(),l("div",Sf,b(e.error),1)):i("v-if",!0),S(e.TextInput,{modelValue:e.username,"onUpdate:modelValue":t[0]||(t[0]=r=>e.username=r),label:"Username",type:"text",required:!0,disabled:e.loading,placeholder:"Enter your username"},null,8,["modelValue","disabled"]),S(e.TextInput,{modelValue:e.password,"onUpdate:modelValue":t[1]||(t[1]=r=>e.password=r),label:"Password",type:"password",required:!0,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 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed"},b(e.loading?"Signing in...":"Sign in"),9,Tf)])],32),e.showGithubLogin||e.showGoogleLogin?(s(),l("div",Mf,[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-black dark:border-neutral-300"})]),o("div",{class:"relative flex justify-center text-sm"},[o("span",{class:"px-2 bg-white dark:bg-black text-black dark:text-white"},"Or continue with")])],-1)),o("div",{class:G(["mt-6 grid gap-3",e.showGithubLogin&&e.showGoogleLogin?"grid-cols-2":"grid-cols-1"])},[e.showGithubLogin?(s(),l("button",{key:0,onClick:e.handleGithubLogin,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"},[...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)])])):i("v-if",!0),e.showGoogleLogin?(s(),l("button",{key:1,onClick:e.handleGoogleLogin,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2 bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity"},[...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)])])):i("v-if",!0)],2)])):i("v-if",!0)])]),_:1})])])}const If=Y(kf,[["render",Vf],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/LoginView.vue"]]),Af=ee({__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(u,{expose:t,emit:a}){const e=u,c=a,d=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":""]),n=()=>{const h=d.value;h&&(h.style.height="auto",h.style.height=`${h.scrollHeight+2}px`)},p=h=>{const w=h.target;c("update:modelValue",w.value),n()},v=h=>{c("focus",h)},g=h=>{c("blur",h)};ce(()=>{n()}),re(()=>e.modelValue,async()=>{await pe(),n()}),t({textareaRef:d,adjustHeight:n});const f={props:e,emit:c,textareaRef:d,inputClasses:r,adjustHeight:n,handleInput:p,handleFocus:v,handleBlur:g};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),Pf={class:"space-y-1"},Ef={key:0,class:"block text-sm font-medium"},Lf={key:0,class:"text-red-500"},Of=["value","placeholder","disabled"],jf={key:1,class:"text-xs text-red-500 dark:text-red-400"};function Df(u,t,a,e,c,d){return s(),l("div",Pf,[a.label?(s(),l("label",Ef,[ie(b(a.label)+" ",1),a.required?(s(),l("span",Lf,"*")):i("v-if",!0)])):i("v-if",!0),o("textarea",{ref:"textareaRef",value:a.modelValue,placeholder:a.placeholder,disabled:a.disabled,class:G(e.inputClasses),rows:"1",onInput:e.handleInput,onFocus:e.handleFocus,onBlur:e.handleBlur},null,42,Of),a.error?(s(),l("p",jf,b(a.error),1)):i("v-if",!0)])}const Uf=Y(Af,[["render",Df],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/MultilineInput.vue"]]),qf=ee({__name:"TestView",setup(u,{expose:t}){t();const a=m(""),e=m(""),c=m(""),d=m(`Line 1
|
|
14
|
+
This provider has ${k.modelCount} associated model(s).`):alert(k.error||"Failed to delete provider");return}await d()}catch(f){console.error("Error deleting provider:",f),alert("Failed to delete provider")}};ge(()=>{d()});const g={showAddModal:a,providers:e,loading:c,columns:i,actions:r,fetchProviders:d,handleAddProvider:u,deleteProvider:v,AddProviderModal:jf,DataTable:Be,CenteredContentView:Re};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}}),Df={class:"flex justify-between items-center mb-6"};function qf(p,t,a,e,c,i){return n(),Y(e.CenteredContentView,null,{default:re(()=>[o("div",Df,[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"]),s(" 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 Uf=ee(Of,[["render",qf],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/ProvidersView.vue"]]),Bf=te({__name:"JsonViewer",props:{value:{type:null,required:!0}},setup(p,{expose:t}){t();const a=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(a.value,null,2);return e(d)}catch{return c(String(a.value))}}),r={props:a,highlightJson:e,escapeHtml:c,formattedJson:i};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),Nf={class:"json-viewer overflow-auto"},Rf=["innerHTML"];function Ff(p,t,a,e,c,i){return n(),l("div",Nf,[o("pre",{class:"p-4 text-sm font-mono leading-relaxed",innerHTML:e.formattedJson},null,8,Rf)])}const zf=ee(Bf,[["render",Ff],["__scopeId","data-v-01a533a8"],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/JsonViewer.vue"]]),Hf={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Wf(p,t){return n(),l("svg",Hf,[...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 Jf=xe({name:"lucide-info",render:Wf}),Kf={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Zf(p,t){return n(),l("svg",Kf,[...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 Gf=xe({name:"lucide-triangle-alert",render:Zf}),Xf=te({__name:"ToolsView",setup(p,{expose:t}){t();const a=m(null),e=m(!1),{data:c}=we(X("/api/config")).json(),{data:i,error:r,isFetching:d,execute:u}=we(X("/api/tools?type=tools"),{immediate:!1}).json(),{data:v,error:g,isFetching:h,execute:f}=we(X("/api/tools?type=prompts&schema=true"),{immediate:!1}).json(),{data:k,error:x,isFetching:w,execute:M}=we(X("/api/tools?type=agents&schema=true"),{immediate:!1}).json(),{data:b,error:S,isFetching:T,execute:A}=we(()=>a.value?X(`/api/tools/${a.value.name}`):null,{immediate:!1}).json(),O=m([]),R=m([]),F=m([]),$=async E=>{a.value=E,await A(),b.value?a.value={...E,schema:b.value.schema||null}:S.value&&console.error("Error fetching tool schema:",S.value),e.value=!0},B=async E=>{if(a.value=E,e.value=!0,!E.schema&&E.type==="prompt"){const N=await fetch(X("/api/tools?type=prompts&schema=true"));if(N.ok){const ie=await N.json();ie[E.name]&&(a.value={...E,schema:ie[E.name].schema||null})}}},D=[{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"}],W=[{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"}],U=E=>/^[a-z][a-z0-9_]*[a-z0-9]$/.test(E)||/^[a-z]$/.test(E),P=E=>E.hasError&&E.error?E.error:E.description||"No description available",H=()=>{i.value&&(O.value=Object.entries(i.value).map(([E,N])=>({name:E,description:N.description||"No description available",schema:null,hasError:N.hasError||!1,error:N.error,type:N.type||"tool"})))},K=()=>{v.value&&(R.value=Object.entries(v.value).map(([E,N])=>({name:E,description:N.description||"No description available",schema:N.schema||null,hasError:!1,type:"prompt",model:N.model})))},j=()=>{k.value&&(F.value=Object.entries(k.value).map(([E,N])=>({name:E,description:N.description||"No description available",schema:N.schema||null,hasError:!1,type:"agent",model:N.model})))},L=async()=>{await u(),H()},V=async()=>{await f(),K()},q=async()=>{await M(),j()},_=()=>{e.value=!1,a.value=null};ge(()=>{L(),V(),q()});const I={selectedTool:a,showSchemaModal:e,configData:c,toolsData:i,error:r,isFetching:d,execute:u,promptsData:v,promptsError:g,isFetchingPrompts:h,executePrompts:f,agentsData:k,agentsError:x,isFetchingAgents:w,executeAgents:M,toolSchemaData:b,toolSchemaError:S,isFetchingSchema:T,executeToolSchema:A,tools:O,prompts:R,agents:F,openSchema:$,openPromptSchema:B,promptColumns:D,columns:W,isSnakeCase:U,getDescription:P,processToolsData:H,processPromptsData:K,processAgentsData:j,fetchTools:L,fetchPrompts:V,fetchAgents:q,closeModal:_,DataTable:Be,Modal:je,JsonViewer:zf,get IconInfo(){return Jf},get IconEye(){return Rt},get IconTriangleAlert(){return Gf},CenteredContentView:Re};return Object.defineProperty(I,"__isScriptSetup",{enumerable:!1,value:!0}),I}}),Yf={class:"mb-6 p-4 border border-black/20 dark:border-white/20 rounded bg-black/5 dark:bg-white/5"},Qf={class:"flex items-start gap-3"},$f={class:"text-sm"},eg={class:"font-medium mb-1"},tg={class:"px-1.5 py-0.5 bg-black/10 dark:bg-white/10 rounded font-mono text-xs"},og=["onClick"],rg={key:1,class:"text-left font-medium text-red-600 dark:text-red-400"},ag={key:2,class:"relative group"},ng={key:3,class:"relative group"},lg={class:"flex justify-end"},sg=["onClick"],ig={key:1,class:"text-neutral-400 text-sm"},dg={class:"mt-12"},cg=["onClick"],ug={class:"text-neutral-600 dark:text-neutral-400"},pg={class:"text-sm text-neutral-500 dark:text-neutral-400"},mg={class:"mt-12"},fg=["onClick"],gg={class:"text-neutral-600 dark:text-neutral-400"},hg={class:"text-sm text-neutral-500 dark:text-neutral-400"},vg={class:"flex items-center gap-2"},bg={key:0,class:"space-y-4"},yg={class:"text-lg font-medium mb-2"},xg={class:"text-sm text-neutral-600 dark:text-neutral-400 mb-4"},kg={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 _g(p,t,a,e,c,i){return n(),Y(e.CenteredContentView,null,{default:re(()=>[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)),s(" Info banner "),o("div",Yf,[o("div",Qf,[C(e.IconInfo,{class:"w-5 h-5 mt-0.5 text-black/60 dark:text-white/60 flex-shrink-0"}),o("div",$f,[o("p",eg,[t[1]||(t[1]=ve(" To create or modify tools, edit the ",-1)),o("code",tg,y(e.configData?.toolsDir||"agentbuilder/tools")+"/",1),t[2]||(t[2]=ve(" 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))])])]),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":re(({row:r})=>[o("div",{class:Q(["flex items-center gap-2",{"text-red-600 dark:text-red-400":r.hasError}])},[r.hasError?(n(),l("span",rg,y(r.name),1)):(n(),l("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"},y(r.name),9,og)),r.hasError?(n(),l("div",ag,[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"},[ve(" 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)?s("v-if",!0):(n(),l("div",ng,[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"},[ve(" 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":re(({row:r})=>[o("span",{class:Q({"text-red-600 dark:text-red-400":r.hasError,"text-neutral-600 dark:text-neutral-400":!r.hasError})},y(e.getDescription(r)),3)]),"cell-actions":re(({row:r})=>[o("div",lg,[r.hasError?(n(),l("span",ig,"—")):(n(),l("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,sg))])]),_:1},8,["data","loading","empty-message"]),s(" Prompts Section "),o("div",dg,[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":re(({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"},y(r.name),9,cg)]),"cell-description":re(({row:r})=>[o("span",ug,y(r.description),1)]),"cell-model":re(({row:r})=>[o("span",pg,y(r.model||"-"),1)]),_:1},8,["data","loading"])]),s(" Agents Section "),o("div",mg,[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":re(({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"},y(r.name),9,fg)]),"cell-description":re(({row:r})=>[o("span",gg,y(r.description),1)]),"cell-model":re(({row:r})=>[o("span",hg,y(r.model||"-"),1)]),_:1},8,["data","loading"])]),s(" 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:re(()=>[o("div",vg,[C(e.IconEye,{class:"w-5 h-5"}),o("span",null,y(e.selectedTool?.name)+" Schema",1)])]),footer:re(()=>[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:re(()=>[e.selectedTool?(n(),l("div",bg,[o("div",null,[o("h3",yg,y(e.selectedTool.type==="prompt"?"Required Schema":"JSON Schema"),1),o("p",xg,y(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?(n(),l("div",kg,[...t[10]||(t[10]=[o("p",{class:"text-neutral-500 dark:text-neutral-400"}," No parameters required ",-1)])])):(n(),Y(e.JsonViewer,{key:1,value:e.selectedTool.schema,class:"h-96 border border-black/20 dark:border-white/20 rounded"},null,8,["value"]))])):s("v-if",!0)]),_:1},8,["modelValue"])]),_:1})}const wg=ee(Xf,[["render",_g],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/ToolsView.vue"]]),Cg=te({__name:"UsersView",setup(p,{expose:t}){t();const a=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"}),v=[{value:"admin",label:"Admin"}],g=[{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()}],h=[{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 w(b.id)}}],f=async()=>{i.value=!0;try{const b=await Ee("/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}},k=async()=>{if(!d.value.username||!d.value.password){alert("Username and password are required");return}try{const b=await Ee("/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 f(),a.value=!1,d.value={username:"",password:"",role:"admin"}}catch(b){console.error("Error adding user:",b),alert("Failed to add user")}},x=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 Ee(`/users/${r.value.id}`,{method:"PUT",body:JSON.stringify(b)});if(!S.ok){const T=await S.json();alert(T.error||"Failed to update user");return}await f(),e.value=!1,r.value=null}catch(b){console.error("Error updating user:",b),alert("Failed to update user")}},w=async b=>{try{const S=await Ee(`/users/${b}`,{method:"DELETE"});if(!S.ok){const T=await S.json();alert(T.error||"Failed to delete user");return}await f()}catch(S){console.error("Error deleting user:",S),alert("Failed to delete user")}};ge(()=>{f()});const M={showAddModal:a,showEditModal:e,users:c,loading:i,editingUser:r,newUser:d,editUser:u,roleOptions:v,columns:g,actions:h,fetchUsers:f,handleAddUser:k,handleEditUser:x,deleteUser:w,DataTable:Be,Modal:je,SelectInput:Se,CenteredContentView:Re};return Object.defineProperty(M,"__isScriptSetup",{enumerable:!1,value:!0}),M}}),Sg={class:"flex justify-between items-center mb-6"},Tg={class:"flex justify-end gap-2 mt-4"},Mg={class:"flex justify-end gap-2 mt-4"};function Ig(p,t,a,e,c,i){return n(),Y(e.CenteredContentView,null,{default:re(()=>[o("div",Sg,[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"]),s(" 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:re(()=>[o("form",{onSubmit:ke(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)),ye(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),[[Me,e.newUser.username]])]),o("div",null,[t[15]||(t[15]=o("label",{class:"block text-sm font-medium mb-1"},"Password",-1)),ye(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),[[Me,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",Tg,[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"]),s(" 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:re(()=>[o("form",{onSubmit:ke(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)),ye(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),[[Me,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)),ye(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),[[Me,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",Mg,[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 Vg=ee(Cg,[["render",Ig],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/UsersView.vue"]]),Ag=te({__name:"ApiKeysView",setup(p,{expose:t}){t();const a=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:w=>`<code class="bg-neutral-100 dark:bg-neutral-800 px-2 py-1 rounded text-sm">${w}</code>`},{key:"createdAt",label:"Created",width:"w-1/6",formatter:w=>new Date(w*1e3).toLocaleDateString()},{key:"lastUsedAt",label:"Last Used",width:"w-1/6",formatter:w=>w?new Date(w*1e3).toLocaleDateString():"Never"}],v=[{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this API key? This action cannot be undone.",handler:async w=>{await f(w.id)}}],g=async()=>{i.value=!0;try{const w=await Ee("/api-keys");if(!w.ok)throw new Error("Failed to fetch API keys");const M=await w.json();c.value=(M.keys||[]).map(b=>({...b,keyPreview:`${b.key_prefix}...${b.last_five}`,createdAt:b.created_at,lastUsedAt:b.last_used_at}))}catch(w){console.error("Error fetching API keys:",w),c.value=[]}finally{i.value=!1}},h=async()=>{if(!d.value.name){alert("Name is required");return}try{const w=await Ee("/api-keys",{method:"POST",body:JSON.stringify(d.value)}),M=await w.json();if(!w.ok){alert(M.error||"Failed to create API key");return}r.value=M.key,a.value=!1,e.value=!0,await g(),d.value={name:""}}catch(w){console.error("Error creating API key:",w),alert("Failed to create API key")}},f=async w=>{try{const M=await Ee(`/api-keys/${w}`,{method:"DELETE"});if(!M.ok){const b=await M.json();alert(b.error||"Failed to delete API key");return}await g()}catch(M){console.error("Error deleting API key:",M),alert("Failed to delete API key")}},k=async w=>{try{await navigator.clipboard.writeText(w),alert("API key copied to clipboard!")}catch(M){console.error("Failed to copy:",M)}};ge(()=>{g()});const x={showAddModal:a,showKeyModal:e,apiKeys:c,loading:i,newApiKey:r,newKeyData:d,columns:u,actions:v,fetchApiKeys:g,handleAddApiKey:h,deleteApiKey:f,copyToClipboard:k,DataTable:Be,Modal:je,CenteredContentView:Re};return Object.defineProperty(x,"__isScriptSetup",{enumerable:!1,value:!0}),x}}),Pg={class:"flex justify-between items-center mb-6"},Lg={class:"flex justify-end gap-2 mt-4"},Eg={class:"space-y-4"},jg={class:"flex gap-2"},Og=["value"],Dg={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"},qg={class:"block mt-2 bg-white dark:bg-neutral-800 px-3 py-2 rounded text-xs"},Ug={class:"flex justify-end mt-4"};function Bg(p,t,a,e,c,i){return n(),Y(e.CenteredContentView,null,{default:re(()=>[o("div",Pg,[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"]),s(" 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:re(()=>[o("form",{onSubmit:ke(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)),ye(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),[[Me,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",Lg,[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"]),s(" 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:re(()=>[o("div",Eg,[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",jg,[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,Og),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",Dg,[t[14]||(t[14]=o("p",{class:"text-sm"}," Use this key in the Authorization header of your API requests: ",-1)),o("code",qg," Authorization: Bearer "+y(e.newApiKey),1)]),o("div",Ug,[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 Ng=ee(Ag,[["render",Bg],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/ApiKeysView.vue"]]),Rg=te({__name:"LoginView",setup(p,{expose:t}){t();function a(T){if(T.startsWith("/src/")||T.startsWith("data:"))return T;const A=We();return A==="/"?T.replace("/agents/","/"):T.replace("/agents/",`${A}/`)}const e=a(Bt),c=a(Nt),i=ze(),r=qe(),d=m(""),u=m(""),v=m(""),g=m(!1),h=m(!1),f=m(!1),k=m(!1),x=z(()=>k.value?c:e);ge(async()=>{const T=localStorage.getItem("theme");k.value=T==="dark"||!T&&window.matchMedia("(prefers-color-scheme: dark)").matches;const A=r.query.token,O=r.query.error;if(A){localStorage.setItem("auth_token",A),i.push("/");return}O&&(O==="oauth_failed"?v.value="OAuth authentication failed. Please try again.":O==="oauth_not_configured"&&(v.value="OAuth provider is not configured."));try{const R=await fetch(X("/api/auth/config"));if(R.ok){const F=await R.json();h.value=F.github||!1,f.value=F.google||!1}}catch(R){console.error("Failed to fetch auth config:",R)}});async function w(){v.value="",g.value=!0;try{const T=await fetch(X("/api/auth/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:d.value,password:u.value})}),A=await T.json();T.ok?(localStorage.setItem("auth_token",A.token),i.push("/")):v.value=A.error||"Login failed"}catch{v.value="Network error. Please try again."}finally{g.value=!1}}function M(){window.location.href=X("/api/auth/oauth/github")}function b(){window.location.href=X("/api/auth/oauth/google")}const S={transformAssetPath:a,logoLight:e,logoDark:c,router:i,route:r,username:d,password:u,error:v,loading:g,showGithubLogin:h,showGoogleLogin:f,isDark:k,currentLogo:x,handleLogin:w,handleGithubLogin:M,handleGoogleLogin:b,TextInput:Ne,DropShadow:He};return Object.defineProperty(S,"__isScriptSetup",{enumerable:!1,value:!0}),S}}),Fg={class:"login-container flex-1 flex items-center justify-center px-4"},zg={class:"max-w-md w-full space-y-8"},Hg={class:"flex justify-center"},Wg=["src"],Jg={class:"bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-700 py-8 px-6 rounded-lg"},Kg={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"},Zg=["disabled"],Gg={key:0,class:"mt-6"};function Xg(p,t,a,e,c,i){return n(),l("div",Fg,[o("div",zg,[o("div",Hg,[o("img",{src:e.currentLogo,alt:"AgentBuilder",class:"h-16 pointer-events-none select-none"},null,8,Wg)]),C(e.DropShadow,{offsetX:8,offsetY:8,intensity:.2,pattern:"crosshatch"},{default:re(()=>[o("div",Jg,[o("form",{class:"space-y-6",onSubmit:ke(e.handleLogin,["prevent"])},[e.error?(n(),l("div",Kg,y(e.error),1)):s("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"},y(e.loading?"Signing in...":"Sign in"),9,Zg)])],32),e.showGithubLogin||e.showGoogleLogin?(n(),l("div",Gg,[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:Q(["mt-6 grid gap-3",e.showGithubLogin&&e.showGoogleLogin?"grid-cols-2":"grid-cols-1"])},[e.showGithubLogin?(n(),l("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)])])):s("v-if",!0),e.showGoogleLogin?(n(),l("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)])])):s("v-if",!0)],2)])):s("v-if",!0)])]),_:1})])])}const Yg=ee(Rg,[["render",Xg],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/LoginView.vue"]]),Qg=te({__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:a}){const e=p,c=a,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 f=i.value;f&&(f.style.height="auto",f.style.height=`${f.scrollHeight+2}px`)},u=f=>{const k=f.target;c("update:modelValue",k.value),d()},v=f=>{c("focus",f)},g=f=>{c("blur",f)};ge(()=>{d()}),ae(()=>e.modelValue,async()=>{await he(),d()}),t({textareaRef:i,adjustHeight:d});const h={props:e,emit:c,textareaRef:i,inputClasses:r,adjustHeight:d,handleInput:u,handleFocus:v,handleBlur:g};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}}),$g={class:"space-y-1"},eh={key:0,class:"block text-sm font-medium"},th={key:0,class:"text-red-500"},oh=["value","placeholder","disabled"],rh={key:1,class:"text-xs text-red-500 dark:text-red-400"};function ah(p,t,a,e,c,i){return n(),l("div",$g,[a.label?(n(),l("label",eh,[ve(y(a.label)+" ",1),a.required?(n(),l("span",th,"*")):s("v-if",!0)])):s("v-if",!0),o("textarea",{ref:"textareaRef",value:a.modelValue,placeholder:a.placeholder,disabled:a.disabled,class:Q(e.inputClasses),rows:"1",onInput:e.handleInput,onFocus:e.handleFocus,onBlur:e.handleBlur},null,42,oh),a.error?(n(),l("p",rh,y(a.error),1)):s("v-if",!0)])}const nh=ee(Qg,[["render",ah],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/inputs/MultilineInput.vue"]]),lh=te({__name:"TestView",setup(p,{expose:t}){t();const a=m(""),e=m(""),c=m(""),i=m(`Line 1
|
|
15
15
|
Line 2
|
|
16
|
-
Line 3`),r=m(""),n=m(""),p=m("option2"),v=m(""),g=m(""),f=m(""),h=m([]),w=m(["test1","test2"]),x=m(!1),k=m(!0),C=m(!1),y=m(!1),_=m({type:"object",properties:{},required:[]}),V=m(0);ce(()=>{window.resetJSONSchema=()=>{_.value={type:"object",properties:{},required:[]},V.value++}});const F={textValue:a,emailValue:e,multilineValue:c,multilineWithNewlines:d,multilineError:r,selectValue:n,disabledSelectValue:p,overflowSelectValue:v,dropdownValue:g,overflowDropdownValue:f,multipleSelectValue:h,multipleSelectDisabled:w,checkboxValue:x,checkboxWithHelp:k,checkboxDisabled:C,checkboxError:y,jsonSchemaValue:_,jsonSchemaKey:V,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:Oe,MultilineInput:Uf,SelectInput:xe,MultipleSelectionsInput:ut,CheckboxInput:Qe,JSONSchemaInput:jt};return Object.defineProperty(F,"__isScriptSetup",{enumerable:!1,value:!0}),F}}),Nf={class:"p-8 space-y-6"},Bf={"data-testid":"basic-input"},Rf={"data-testid":"output"},Ff={"data-testid":"error-input"},zf={class:"mt-12"},Hf={"data-testid":"basic-multiline",class:"mb-6"},Wf={"data-testid":"multiline-output"},Jf={"data-testid":"multiline-with-newlines",class:"mb-6"},Kf={"data-testid":"multiline-newlines-output"},Zf={"data-testid":"error-multiline",class:"mb-6"},Gf={"data-testid":"basic-select"},Xf={"data-testid":"select-output"},Qf={"data-testid":"error-select"},Yf={"data-testid":"disabled-select"},$f={"data-testid":"overflow-container",class:"mt-8"},eh={class:"border-2 border-red-500 p-4 h-32 overflow-hidden relative"},th={class:"mt-12"},oh={"data-testid":"basic-dropdown",class:"mb-6"},rh={"data-testid":"dropdown-output"},ah={"data-testid":"dropdown-overflow-container"},sh={class:"border-2 border-blue-500 p-4 h-32 overflow-hidden relative"},lh={class:"mt-12"},nh={"data-testid":"multiple-select-test",class:"mb-6"},ih={"data-testid":"multiple-output"},dh={"data-testid":"multiple-select-disabled",class:"mb-6"},ch={class:"mt-12"},uh={"data-testid":"basic-checkbox",class:"mb-6"},ph={"data-testid":"checkbox-output",class:"mt-2 text-sm"},mh={"data-testid":"checkbox-with-help",class:"mb-6"},gh={"data-testid":"checkbox-help-output",class:"mt-2 text-sm"},fh={"data-testid":"disabled-checkbox",class:"mb-6"},hh={"data-testid":"error-checkbox",class:"mb-6"},vh={class:"mt-12"},bh={"data-testid":"json-schema-input",class:"mb-6"},yh={class:"mt-4 p-4 bg-gray-100 dark:bg-gray-900 rounded"},xh={"data-testid":"json-schema-output",class:"text-xs overflow-x-auto"};function kh(u,t,a,e,c,d){return s(),l("div",Nf,[t[30]||(t[30]=o("h1",{class:"text-2xl font-bold"},"Component Test Page",-1)),i(" Basic TextInput "),o("div",Bf,[S(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",Rf,b(e.textValue),1)]),i(" TextInput with Error "),o("div",Ff,[S(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"])]),i(" MultilineInput Tests "),o("div",zf,[t[18]||(t[18]=o("h2",{class:"text-xl font-bold mb-4"},"MultilineInput Tests",-1)),i(" Basic MultilineInput "),o("div",Hf,[S(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",Wf,b(e.multilineValue),1)]),i(" MultilineInput with pre-filled newlines "),o("div",Jf,[S(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",Kf,b(e.multilineWithNewlines),1)]),i(" MultilineInput with Error "),o("div",Zf,[S(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"])])]),i(" Basic SelectInput "),o("div",Gf,[S(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",Xf,b(e.selectValue),1)]),i(" SelectInput with Error "),o("div",Qf,[i(" Note: SelectInput doesn't support error prop yet "),S(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"])]),i(" Disabled SelectInput "),o("div",Yf,[S(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"])]),i(" SelectInput in overflow:hidden container "),o("div",$f,[t[20]||(t[20]=o("h2",{class:"text-lg font-semibold mb-2"},"Overflow Test",-1)),o("div",eh,[t[19]||(t[19]=o("p",{class:"text-sm text-gray-600 mb-2"}," This container has overflow:hidden and limited height ",-1)),S(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-gray-500"}," The dropdown should appear above the red border (in top layer) ",-1))]),i(" DropdownList Tests "),o("div",th,[t[25]||(t[25]=o("h2",{class:"text-xl font-bold mb-4"},"DropdownList Tests",-1)),i(" Basic DropdownList "),o("div",oh,[S(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",rh,b(e.dropdownValue),1)]),i(" DropdownList in overflow:hidden container "),o("div",ah,[t[23]||(t[23]=o("h3",{class:"text-lg font-semibold mb-2"},"DropdownList Overflow Test",-1)),o("div",sh,[t[22]||(t[22]=o("p",{class:"text-sm text-gray-600 mb-2"}," This container has overflow:hidden and limited height ",-1)),S(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-gray-500"}," The dropdown should appear above the blue border (using Popover API) ",-1))])]),i(" MultipleSelectionsInput Tests "),o("div",lh,[t[26]||(t[26]=o("h2",{class:"text-xl font-bold mb-4"},"MultipleSelectionsInput Tests",-1)),i(" Basic MultipleSelectionsInput "),o("div",nh,[S(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",ih,b(e.multipleSelectValue),1)]),i(" Disabled MultipleSelectionsInput "),o("div",dh,[S(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"])])]),i(" CheckboxInput Tests "),o("div",ch,[t[27]||(t[27]=o("h2",{class:"text-xl font-bold mb-4"},"CheckboxInput Tests",-1)),i(" Basic CheckboxInput "),o("div",uh,[S(e.CheckboxInput,{modelValue:e.checkboxValue,"onUpdate:modelValue":t[13]||(t[13]=r=>e.checkboxValue=r),label:"Basic Checkbox"},null,8,["modelValue"]),o("p",ph," Value: "+b(e.checkboxValue),1)]),i(" CheckboxInput with Help Text "),o("div",mh,[S(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",gh," Value: "+b(e.checkboxWithHelp),1)]),i(" Disabled CheckboxInput "),o("div",fh,[S(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"])]),i(" CheckboxInput with Error "),o("div",hh,[S(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"])])]),i(" JSONSchemaInput Tests "),o("div",vh,[t[29]||(t[29]=o("h2",{class:"text-xl font-bold mb-4"},"JSONSchemaInput Tests",-1)),i(" Basic JSONSchemaInput "),o("div",bh,[(s(),Z(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",yh,[t[28]||(t[28]=o("p",{class:"text-sm font-mono mb-2"},"Generated Schema:",-1)),o("pre",xh,b(JSON.stringify(e.jsonSchemaValue,null,2)),1)])])])])}const _h=Y(qf,[["render",kh],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/TestView.vue"]]),wh=ee({__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(u,{expose:t,emit:a}){t();const e=u,c=a,d=m(null),r=m(null),n=m(!1),p=m(""),v=m([]),g=m(0),f=m(-1),h=m(-1),w=m(0),x=m({top:0,left:0}),k=async P=>{const H=P.target,R=H.value,N=H.selectionStart;c("update:modelValue",R),R[N-1]==="@"&&!n.value?C(N):n.value&&await _(R,N)},C=async P=>{f.value=P-1,h.value=P,p.value="",w.value=0,n.value=!0,g.value=0,await y(),await V("")},y=async()=>{if(!d.value)return;await pe();const P=d.value.getBoundingClientRect(),H=window.getComputedStyle(d.value),R=parseInt(H.lineHeight||"20"),N=parseInt(H.paddingTop||"8"),Q=e.modelValue.substring(0,h.value).split(`
|
|
17
|
-
`),
|
|
16
|
+
Line 3`),r=m(""),d=m(""),u=m("option2"),v=m(""),g=m(""),h=m(""),f=m([]),k=m(["test1","test2"]),x=m(!1),w=m(!0),M=m(!1),b=m(!1),S=m({type:"object",properties:{},required:[]}),T=m(0);ge(()=>{window.resetJSONSchema=()=>{S.value={type:"object",properties:{},required:[]},T.value++}});const F={textValue:a,emailValue:e,multilineValue:c,multilineWithNewlines:i,multilineError:r,selectValue:d,disabledSelectValue:u,overflowSelectValue:v,dropdownValue:g,overflowDropdownValue:h,multipleSelectValue:f,multipleSelectDisabled:k,checkboxValue:x,checkboxWithHelp:w,checkboxDisabled:M,checkboxError:b,jsonSchemaValue:S,jsonSchemaKey:T,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:Ne,MultilineInput:nh,SelectInput:Se,MultipleSelectionsInput:ft,CheckboxInput:et,JSONSchemaInput:Wt};return Object.defineProperty(F,"__isScriptSetup",{enumerable:!1,value:!0}),F}}),sh={class:"p-8 space-y-6"},ih={"data-testid":"basic-input"},dh={"data-testid":"output"},ch={"data-testid":"error-input"},uh={class:"mt-12"},ph={"data-testid":"basic-multiline",class:"mb-6"},mh={"data-testid":"multiline-output"},fh={"data-testid":"multiline-with-newlines",class:"mb-6"},gh={"data-testid":"multiline-newlines-output"},hh={"data-testid":"error-multiline",class:"mb-6"},vh={"data-testid":"basic-select"},bh={"data-testid":"select-output"},yh={"data-testid":"error-select"},xh={"data-testid":"disabled-select"},kh={"data-testid":"overflow-container",class:"mt-8"},_h={class:"border-2 border-red-500 p-4 h-32 overflow-hidden relative"},wh={class:"mt-12"},Ch={"data-testid":"basic-dropdown",class:"mb-6"},Sh={"data-testid":"dropdown-output"},Th={"data-testid":"dropdown-overflow-container"},Mh={class:"border-2 border-accent-500 p-4 h-32 overflow-hidden relative"},Ih={class:"mt-12"},Vh={"data-testid":"multiple-select-test",class:"mb-6"},Ah={"data-testid":"multiple-output"},Ph={"data-testid":"multiple-select-disabled",class:"mb-6"},Lh={class:"mt-12"},Eh={"data-testid":"basic-checkbox",class:"mb-6"},jh={"data-testid":"checkbox-output",class:"mt-2 text-sm"},Oh={"data-testid":"checkbox-with-help",class:"mb-6"},Dh={"data-testid":"checkbox-help-output",class:"mt-2 text-sm"},qh={"data-testid":"disabled-checkbox",class:"mb-6"},Uh={"data-testid":"error-checkbox",class:"mb-6"},Bh={class:"mt-12"},Nh={"data-testid":"json-schema-input",class:"mb-6"},Rh={class:"mt-4 p-4 bg-neutral-100 dark:bg-neutral-900 rounded"},Fh={"data-testid":"json-schema-output",class:"text-xs overflow-x-auto"};function zh(p,t,a,e,c,i){return n(),l("div",sh,[t[30]||(t[30]=o("h1",{class:"text-2xl font-bold"},"Component Test Page",-1)),s(" Basic TextInput "),o("div",ih,[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",dh,y(e.textValue),1)]),s(" TextInput with Error "),o("div",ch,[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"])]),s(" MultilineInput Tests "),o("div",uh,[t[18]||(t[18]=o("h2",{class:"text-xl font-bold mb-4"},"MultilineInput Tests",-1)),s(" Basic MultilineInput "),o("div",ph,[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",mh,y(e.multilineValue),1)]),s(" MultilineInput with pre-filled newlines "),o("div",fh,[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",gh,y(e.multilineWithNewlines),1)]),s(" MultilineInput with Error "),o("div",hh,[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"])])]),s(" Basic SelectInput "),o("div",vh,[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",bh,y(e.selectValue),1)]),s(" SelectInput with Error "),o("div",yh,[s(" 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"])]),s(" Disabled SelectInput "),o("div",xh,[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"])]),s(" SelectInput in overflow:hidden container "),o("div",kh,[t[20]||(t[20]=o("h2",{class:"text-lg font-semibold mb-2"},"Overflow Test",-1)),o("div",_h,[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))]),s(" DropdownList Tests "),o("div",wh,[t[25]||(t[25]=o("h2",{class:"text-xl font-bold mb-4"},"DropdownList Tests",-1)),s(" Basic DropdownList "),o("div",Ch,[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",Sh,y(e.dropdownValue),1)]),s(" DropdownList in overflow:hidden container "),o("div",Th,[t[23]||(t[23]=o("h3",{class:"text-lg font-semibold mb-2"},"DropdownList Overflow Test",-1)),o("div",Mh,[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))])]),s(" MultipleSelectionsInput Tests "),o("div",Ih,[t[26]||(t[26]=o("h2",{class:"text-xl font-bold mb-4"},"MultipleSelectionsInput Tests",-1)),s(" Basic MultipleSelectionsInput "),o("div",Vh,[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",Ah,y(e.multipleSelectValue),1)]),s(" Disabled MultipleSelectionsInput "),o("div",Ph,[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"])])]),s(" CheckboxInput Tests "),o("div",Lh,[t[27]||(t[27]=o("h2",{class:"text-xl font-bold mb-4"},"CheckboxInput Tests",-1)),s(" Basic CheckboxInput "),o("div",Eh,[C(e.CheckboxInput,{modelValue:e.checkboxValue,"onUpdate:modelValue":t[13]||(t[13]=r=>e.checkboxValue=r),label:"Basic Checkbox"},null,8,["modelValue"]),o("p",jh," Value: "+y(e.checkboxValue),1)]),s(" CheckboxInput with Help Text "),o("div",Oh,[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",Dh," Value: "+y(e.checkboxWithHelp),1)]),s(" Disabled CheckboxInput "),o("div",qh,[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"])]),s(" CheckboxInput with Error "),o("div",Uh,[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"])])]),s(" JSONSchemaInput Tests "),o("div",Bh,[t[29]||(t[29]=o("h2",{class:"text-xl font-bold mb-4"},"JSONSchemaInput Tests",-1)),s(" Basic JSONSchemaInput "),o("div",Nh,[(n(),Y(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",Rh,[t[28]||(t[28]=o("p",{class:"text-sm font-mono mb-2"},"Generated Schema:",-1)),o("pre",Fh,y(JSON.stringify(e.jsonSchemaValue,null,2)),1)])])])])}const Hh=ee(lh,[["render",zh],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/TestView.vue"]]),Wh=te({__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:a}){t();const e=p,c=a,i=m(null),r=m(null),d=m(!1),u=m(""),v=m([]),g=m(0),h=m(-1),f=m(-1),k=m(0),x=m({top:0,left:0}),w=async D=>{const W=D.target,U=W.value,P=W.selectionStart;c("update:modelValue",U),U[P-1]==="@"&&!d.value?M(P):d.value&&await S(U,P)},M=async D=>{h.value=D-1,f.value=D,u.value="",k.value=0,d.value=!0,g.value=0,await b(),await T("")},b=async()=>{if(!i.value)return;await he();const D=i.value.getBoundingClientRect(),W=window.getComputedStyle(i.value),U=parseInt(W.lineHeight||"20"),P=parseInt(W.paddingTop||"8"),K=e.modelValue.substring(0,f.value).split(`
|
|
17
|
+
`),j=K.length,L=K[K.length-1],q=Math.min(L.length*8,200);x.value={top:D.top+P+j*U+4,left:D.left+P+q}},S=async(D,W)=>{if(W<=h.value){O();return}const U=h.value+1,P=D.substring(U,W);if(v.value.length===0?k.value++:k.value=0,v.value.length===0&&k.value>=5){O();return}u.value=P,await T(P)},T=async D=>{if(!e.search){v.value=[];return}const W=await e.search(D);v.value=Array.isArray(W)?W:[],g.value>=v.value.length&&(g.value=0)},A=D=>{if(!i.value)return;const W=e.modelValue,U=W.substring(0,h.value),P=W.substring(f.value+u.value.length),H=`@${D.value}`,K=U+H+P;c("update:modelValue",K),he(()=>{if(!i.value)return;const j=U.length+H.length;i.value.focus(),i.value.setSelectionRange(j,j)}),O()},O=()=>{d.value=!1,u.value="",v.value=[],g.value=0,h.value=-1,f.value=-1,k.value=0},R=D=>{if(d.value)switch(D.key){case"Escape":D.preventDefault(),O();break;case"ArrowDown":D.preventDefault(),g.value=Math.min(g.value+1,v.value.length-1);break;case"ArrowUp":D.preventDefault(),g.value=Math.max(g.value-1,0);break;case"Enter":v.value.length>0&&(D.preventDefault(),A(v.value[g.value]));break;case"Tab":v.value.length>0&&(D.preventDefault(),A(v.value[g.value]));break}},F=()=>{if(!d.value||!i.value)return;i.value.selectionStart<=h.value&&O()},$=D=>{if(!r.value||!d.value)return;const W=D.target;!r.value.contains(W)&&W!==i.value&&O()};ae(d,D=>{D?document.addEventListener("click",$):document.removeEventListener("click",$)});const B={props:e,emit:c,textarea:i,searchDialog:r,isSearchMode:d,searchQuery:u,searchResults:v,selectedIndex:g,atSymbolPosition:h,searchStartCursorPosition:f,charactersTypedSinceSearch:k,dialogPosition:x,handleInput:w,startSearchMode:M,positionDialog:b,handleSearchModeInput:S,performSearch:T,insertResult:A,exitSearchMode:O,handleKeyDown:R,handleSelectionChange:F,handleClickOutside:$};return Object.defineProperty(B,"__isScriptSetup",{enumerable:!1,value:!0}),B}}),Jh={class:"relative"},Kh=["value","placeholder","rows"],Zh={class:"bg-white dark:bg-black rounded-lg"},Gh={class:"px-3 py-2 border-b border-black dark:border-neutral-300"},Xh={class:"text-xs font-medium text-neutral-600 dark:text-neutral-400"},Yh={key:0,class:"max-h-[200px] overflow-y-auto"},Qh=["onClick"],$h={class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},ev={class:"flex-1"},tv={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mt-0.5"};function ov(p,t,a,e,c,i){return n(),l("div",Jh,[o("textarea",{ref:"textarea",value:a.modelValue,onInput:e.handleInput,onKeydown:e.handleKeyDown,onSelect:e.handleSelectionChange,placeholder:a.placeholder||"Type @ to insert references...",rows:a.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,Kh),s(" Search Dialog with 1-bit dither shadow "),(n(),Y(it,{to:"body"},[e.isSearchMode?(n(),l("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:$e({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`),r=m(""),n=m(""),p=m("option2"),v=m(""),g=m(""),f=m(""),h=m([]),w=m(["te
|
|
|
22
22
|
rgba(0, 0, 0, 0.03) 2px,
|
|
23
23
|
rgba(0, 0, 0, 0.03) 4px
|
|
24
24
|
)
|
|
25
|
-
`})},[o("div",
|
|
25
|
+
`})},[o("div",Zh,[s(" Search header "),o("div",Gh,[o("div",Xh," Search: "+y(e.searchQuery||"..."),1)]),s(" Results "),e.searchResults.length>0?(n(),l("div",Yh,[(n(!0),l(G,null,ue(e.searchResults,(r,d)=>(n(),l("button",{key:`${r.type}-${r.value}`,onClick:u=>e.insertResult(r),class:Q(["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",$h,y(r.type),1),o("div",ev,[o("div",null,y(r.label),1),r.description?(n(),l("div",tv,y(r.description),1)):s("v-if",!0)])],10,Qh))),128))])):(n(),l(G,{key:1},[s(" 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)),s(" 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)):s("v-if",!0)]))])}const rv=ee(Wh,[["render",ov],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/ReferenceInput.vue"]]),av=te({__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:rv};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}}),nv={class:"min-h-screen bg-white dark:bg-black p-8"},lv={class:"max-w-4xl mx-auto space-y-8"},sv={class:"space-y-4"},iv={class:"block"},dv={class:"p-4 border border-neutral-300 dark:border-neutral-700 rounded"},cv={class:"text-sm font-mono whitespace-pre-wrap"};function uv(p,t,a,e,c,i){return n(),l("div",nv,[o("div",lv,[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",sv,[o("label",iv,[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",dv,[t[2]||(t[2]=o("h3",{class:"text-sm font-medium mb-2"},"Current Value:",-1)),o("pre",cv,y(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 pv=ee(av,[["render",uv],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/TestReferenceInput.vue"]]),mv=te({__name:"DebugView",setup(p,{expose:t}){t();const a=m([{id:"1",name:"Item 1"}]),e=()=>{console.log("Adding item...");const d={id:crypto.randomUUID(),name:`Item ${a.value.length+1}`};a.value.push(d),console.log("Item added, total:",a.value.length)};ae(a,()=>{console.log("Items changed:",a.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 g={id:crypto.randomUUID(),name:`Child Item ${d.modelValue.length+1}`};u("update:modelValue",[...d.modelValue,g])}}}},i=m([{id:"1",name:"Parent Item 1"}]),r={items:a,addItem:e,Child:c,parentItems:i};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),fv={class:"p-8 space-y-8"},gv={class:"space-y-2 mb-4"},hv={class:"mt-4 p-2 bg-neutral-100 rounded"};function vv(p,t,a,e,c,i){return n(),l("div",fv,[o("div",null,[t[1]||(t[1]=o("h2",{class:"text-xl font-bold mb-4"},"Direct Array Test",-1)),o("div",gv,[(n(!0),l(G,null,ue(e.items,r=>(n(),l("div",{key:r.id,class:"p-2 border"},y(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",hv,y(JSON.stringify(e.parentItems,null,2)),1)])])}const bv=ee(mv,[["render",vv],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/DebugView.vue"]]),yv=te({__name:"TestPromptInput",setup(p,{expose:t}){t();const a=m([{type:"string",value:""}]),e=u=>{a.value=u};ge(()=>{window.setPromptSegments=e}),Co(()=>{delete window.setPromptSegments});const d={promptValue:a,setPromptSegments:e,searchPrompts:async u=>{await new Promise(h=>setTimeout(h,300));const v=(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(h=>(h.label||h.id||h.value||"").toLowerCase().includes(v)).slice(0,8)},handleUpdate:u=>{a.value=u,console.log("Updated:",u)},handleSegmentClick:(u,v)=>{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: ${p.meta?.description||"No description"}`)},PromptInput:Dt};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),Yh={class:"min-h-screen bg-white dark:bg-black p-8"},$h={class:"max-w-4xl mx-auto"},ev={class:"space-y-8"},tv={class:"space-y-4"},ov={"data-testid":"prompt-input-test"},rv={class:"space-y-4"},av={class:"p-4 bg-gray-100 dark:bg-gray-900 rounded-lg"},sv={"data-testid":"prompt-output",class:"text-sm text-black dark:text-white"};function lv(u,t,a,e,c,d){return s(),l("div",Yh,[o("div",$h,[t[6]||(t[6]=o("h1",{class:"text-3xl font-bold mb-8 text-black dark:text-white"}," PromptInput Component Test ",-1)),o("div",ev,[i(" Basic Example "),o("div",tv,[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-gray-600 dark:text-gray-400"}," Type @ to trigger the autocomplete menu. Use arrow keys to navigate and Enter to select. ",-1)),o("div",ov,[S(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"])])]),i(" Output Display "),o("div",rv,[t[3]||(t[3]=o("h2",{class:"text-xl font-semibold text-black dark:text-white"}," Current Value ",-1)),o("div",av,[t[2]||(t[2]=o("h3",{class:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"}," Segments (value): ",-1)),o("pre",sv,b(JSON.stringify(e.promptValue,null,2)),1)])]),i(" Instructions "),t[4]||(t[4]=rt('<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-gray-600 dark:text-gray-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)),i(" Test Scenarios "),t[5]||(t[5]=rt('<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-gray-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-gray-600 dark:text-gray-400"> Try: @user, @date, @time, @api, @work </p></div><div class="p-4 border-2 border-gray-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-gray-600 dark:text-gray-400"> Try: @greet, @error, @code, @data, @summ </p></div><div class="p-4 border-2 border-gray-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-gray-600 dark:text-gray-400"> Mix text with multiple tags and test editing </p></div><div class="p-4 border-2 border-gray-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-gray-600 dark:text-gray-400"> Test @ at start/end, multiple @@ symbols, etc. </p></div></div></div>',1))])])])}const nv=Y(Qh,[["render",lv],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/TestPromptInput.vue"]]),iv=ee({__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(u,{expose:t,emit:a}){t(),self.MonacoEnvironment={getWorker(k,C){return C==="json"?new ho:new vo}};const e=u,c=a,d=m(null);let r=null,n=!1;const p=m(!1),v={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}},g=()=>{if(!(!r||e.readonly))try{const k=r.getValue(),C=JSON.parse(k),y=JSON.stringify(C,null,2);y!==k&&(n=!0,r.setValue(y),n=!1)}catch{}},f=()=>{p.value=document.documentElement.classList.contains("dark"),r&&ft.setTheme(p.value?"vs-dark":"vs")},h=()=>{d.value&&(r=ft.create(d.value,{value:e.modelValue||"{}",language:"json",theme:p.value?"vs-dark":"vs",...v})(d.value).__monacoEditor=r,r.onDidChangeModelContent(()=>{if(!n){const k=r.getValue();c("update:modelValue",k)}}),r.onDidBlurEditorText(()=>{c("blur"),g()}))};ce(async()=>{f(),await pe(),h();const k=new MutationObserver(f);k.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),Te(()=>{k.disconnect(),r&&r.dispose()})}),re(()=>e.modelValue,k=>{r&&r.getValue()!==k&&(n=!0,r.setValue(k||""),n=!1)}),re(()=>e.readonly,k=>{r&&r.updateOptions({readOnly:k})});const w=e.rows?`${e.rows*1.5}rem`:"18rem",x={props:e,emit:c,containerRef:d,get monacoEditor(){return r},set monacoEditor(k){r=k},get isUpdatingFromProp(){return n},set isUpdatingFromProp(k){n=k},isDark:p,editorOptions:v,formatJson:g,updateTheme:f,initEditor:h,editorHeight:w};return Object.defineProperty(x,"__isScriptSetup",{enumerable:!1,value:!0}),x}}),dv={class:"relative"},cv={key:0,class:"mt-1 text-sm text-red-500"};function uv(u,t,a,e,c,d){return s(),l("div",dv,[o("div",{class:G(["border rounded overflow-hidden bg-white dark:bg-black",[a.error?"border-red-500":"border-black dark:border-neutral-300"]])},[o("div",{ref:"containerRef",class:"monaco-editor-container",style:nt({height:e.editorHeight})},null,4)],2),a.error?(s(),l("div",cv,b(a.error),1)):i("v-if",!0)])}const pv=Y(iv,[["render",uv],["__scopeId","data-v-903708b4"],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/JsonEditor.vue"]]),mv=ee({__name:"TestJsonEditorModal",setup(u,{expose:t}){t();const a=m(!1),e=m(JSON.stringify({name:"Test",value:123},null,2)),c=m(!1),d=m(JSON.stringify({editable:!0,count:0},null,2)),r={showModal:a,jsonValue:e,showEditableModal:c,editableJsonValue:d,Modal:Ie,JsonEditor:pv};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),gv={class:"p-8"},fv={class:"space-y-4"},hv={class:"space-y-4"},vv={class:"space-y-4"};function bv(u,t,a,e,c,d){return s(),l("div",gv,[t[13]||(t[13]=o("h1",{class:"text-3xl font-bold mb-6"},"JsonEditor in Modal Test",-1)),o("div",fv,[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-gray-600 dark:text-gray-400 mb-4"}," This should NOT show unsaved changes warning when closing ",-1)),o("button",{onClick:t[0]||(t[0]=r=>e.showModal=!0),"data-testid":"open-readonly-modal",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-gray-600 dark:text-gray-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),"data-testid":"open-editable-modal",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 ")])]),i(" Read-only Modal "),S(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:oe(()=>[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:oe(()=>[o("div",hv,[t[11]||(t[11]=o("p",{class:"text-sm text-gray-600 dark:text-gray-400"}," This is a read-only JSON editor. No changes can be made. ",-1)),S(e.JsonEditor,{"model-value":e.jsonValue,readonly:!0,"data-testid":"readonly-json-editor"},null,8,["model-value"])])]),_:1},8,["modelValue"]),i(" Editable Modal "),S(e.Modal,{modelValue:e.showEditableModal,"onUpdate:modelValue":t[6]||(t[6]=r=>e.showEditableModal=r),title:"Editable JSON Schema",width:"max-w-4xl"},{footer:oe(()=>[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:oe(()=>[o("div",vv,[t[12]||(t[12]=o("p",{class:"text-sm text-gray-600 dark:text-gray-400"}," This is an editable JSON editor. Changes will be tracked. ",-1)),S(e.JsonEditor,{modelValue:e.editableJsonValue,"onUpdate:modelValue":t[4]||(t[4]=r=>e.editableJsonValue=r),"data-testid":"editable-json-editor"},null,8,["modelValue"])])]),_:1},8,["modelValue"])])}const yv=Y(mv,[["render",bv],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/TestJsonEditorModal.vue"]]),wt="10000000-0000-0000-0000-000000000101",ot="10000000-0000-0000-0000-000000000102",xv=ee({__name:"TestPromptInterpolation",setup(u,{expose:t}){t();const a=m([]),e=m(null),c=m(null),d=m(""),r=m("Alice Johnson"),n=m("alice@example.com"),p=m("28"),{data:v,error:g}=ve(J(`/api/prompts/${wt}`)).json(),{data:f,error:h}=ve(J(`/api/prompts/${ot}`)).json();re(v,C=>{if(C){e.value=C;try{a.value=JSON.parse(C.prompt)}catch(y){console.error("Failed to parse prompt A:",y)}}},{immediate:!0}),re(f,C=>{C&&(c.value=C)},{immediate:!0});function w(C,y){return C.map(_=>{if(_.type==="string")return _.value||"";if(_.type==="variable"){const V=y[_.value];return V===void 0?`{{${_.value}}}`:typeof V=="string"?V:JSON.stringify(V)}else if(_.type==="prompt"){if(_.id===ot&&c.value)try{const V=JSON.parse(c.value.prompt);return w(V,y)}catch{return`[Error loading prompt: ${_.label}]`}return""}return""}).join("")}function x(){const C={name:r.value,email:n.value,age:p.value};d.value=w(a.value,C)}const k={PROMPT_A_ID:wt,PROMPT_B_ID:ot,promptTemplate:a,promptAData:e,promptBData:c,renderedOutput:d,inputName:r,inputEmail:n,inputAge:p,promptA:v,errorA:g,promptB:f,errorB:h,interpolatePrompt:w,renderPrompt:x};return Object.defineProperty(k,"__isScriptSetup",{enumerable:!1,value:!0}),k}}),kv={class:"p-8 max-w-2xl mx-auto"},_v={class:"mb-6"},wv={"data-testid":"prompt-template",class:"p-4 bg-gray-100 dark:bg-gray-800 rounded font-mono text-sm"},Cv={key:0},Sv={class:"whitespace-pre-wrap"},Tv={key:1,class:"text-gray-500"},Mv={class:"mb-6"},Vv={class:"space-y-2"},Iv={class:"mt-6"},Av={"data-testid":"rendered-output",class:"p-4 bg-green-50 dark:bg-green-900 rounded min-h-[100px]"},Pv={key:0,class:"font-mono"},Ev={key:1,class:"text-gray-500"};function Lv(u,t,a,e,c,d){return s(),l("div",kv,[t[11]||(t[11]=o("h1",{class:"text-2xl font-bold mb-6"},"Prompt Interpolation Test",-1)),o("div",_v,[t[4]||(t[4]=o("h2",{class:"text-lg font-semibold mb-2"},"Prompt Template",-1)),o("div",wv,[e.promptAData?(s(),l("div",Cv,[t[3]||(t[3]=o("div",{class:"font-bold mb-2"},"Prompt A:",-1)),o("pre",Sv,b(JSON.stringify(e.promptTemplate,null,2)),1)])):(s(),l("div",Tv,"Loading..."))])]),o("div",Mv,[t[8]||(t[8]=o("h2",{class:"text-lg font-semibold mb-2"},"Context Values",-1)),o("div",Vv,[o("div",null,[t[5]||(t[5]=o("label",{class:"block text-sm mb-1"},"Name:",-1)),fe(o("input",{"data-testid":"input-name","onUpdate:modelValue":t[0]||(t[0]=r=>e.inputName=r),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[_e,e.inputName]])]),o("div",null,[t[6]||(t[6]=o("label",{class:"block text-sm mb-1"},"Email:",-1)),fe(o("input",{"data-testid":"input-email","onUpdate:modelValue":t[1]||(t[1]=r=>e.inputEmail=r),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[_e,e.inputEmail]])]),o("div",null,[t[7]||(t[7]=o("label",{class:"block text-sm mb-1"},"Age:",-1)),fe(o("input",{"data-testid":"input-age","onUpdate:modelValue":t[2]||(t[2]=r=>e.inputAge=r),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[_e,e.inputAge]])])])]),o("button",{"data-testid":"render-button",onClick:e.renderPrompt,class:"px-4 py-2 bg-black text-white rounded hover:bg-gray-800"}," Render Prompt "),o("div",Iv,[t[9]||(t[9]=o("h2",{class:"text-lg font-semibold mb-2"},"Rendered Output",-1)),o("div",Av,[e.renderedOutput?(s(),l("div",Pv,b(e.renderedOutput),1)):(s(),l("div",Ev,'Click "Render Prompt" to see output'))]),t[10]||(t[10]=o("div",{class:"mt-4 p-4 bg-blue-50 dark:bg-blue-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 Ov=Y(xv,[["render",Lv],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/TestPromptInterpolation.vue"]]),qt=mo({history:go(Fe()),routes:[{path:"/login",name:"login",component:If,meta:{public:!0}},{path:"/",name:"dashboard",component:$r},{path:"/agents",name:"agents",component:Pl},{path:"/threads",name:"threads",component:yt},{path:"/threads/:id",name:"thread-detail",component:yt},{path:"/prompts",name:"prompts",component:Jm},{path:"/prompts/:id",name:"prompt-edit",component:Ym},{path:"/models",name:"models",component:eg},{path:"/providers",name:"providers",component:vg},{path:"/tools",name:"tools",component:of},{path:"/settings/users",name:"users",component:df},{path:"/settings/api-keys",name:"api-keys",component:xf},{path:"/test",name:"test",component:_h},{path:"/test-reference-input",name:"test-reference-input",component:Hh},{path:"/debug",name:"debug",component:Xh},{path:"/test-prompt-input",name:"test-prompt-input",component:nv},{path:"/test-json-editor-modal",name:"test-json-editor-modal",component:yv},{path:"/test-prompt-interpolation",name:"test-prompt-interpolation",component:Ov}]});qt.beforeEach(async(u,t,a)=>{const e=u.meta.public===!0,c=localStorage.getItem("auth_token");!e&&!c?a({name:"login"}):e&&c&&u.name==="login"?a({name:"dashboard"}):a()});const jv=window.fetch;window.fetch=async function(u,t){const a=typeof u=="string"?u:u instanceof URL?u.toString():u.url,e=Fe(),c=e==="/"?"/api/":`${e}/api/`,d=a.includes(c)||e==="/"&&a.startsWith("/api/");if(d){const p=localStorage.getItem("auth_token");p&&t?t.headers={...t.headers,Authorization:`Bearer ${p}`}:p&&(t={...t,headers:{Authorization:`Bearer ${p}`}})}const r=await jv(u,t),n=a.includes("/api/auth/");return r.status===401&&d&&!n&&(localStorage.removeItem("auth_token"),window.location.href=J("/login")),r};const Nt=fo(Gr);Nt.use(qt);Nt.mount("#app");
|
|
39
|
+
Description: ${u.meta?.description||"No description"}`)},PromptInput:Jt};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}}),xv={class:"min-h-screen bg-white dark:bg-black p-8"},kv={class:"max-w-4xl mx-auto"},_v={class:"space-y-8"},wv={class:"space-y-4"},Cv={"data-testid":"prompt-input-test"},Sv={class:"space-y-4"},Tv={class:"p-4 bg-neutral-100 dark:bg-neutral-900 rounded-lg"},Mv={"data-testid":"prompt-output",class:"text-sm text-black dark:text-white"};function Iv(p,t,a,e,c,i){return n(),l("div",xv,[o("div",kv,[t[6]||(t[6]=o("h1",{class:"text-3xl font-bold mb-8 text-black dark:text-white"}," PromptInput Component Test ",-1)),o("div",_v,[s(" Basic Example "),o("div",wv,[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",Cv,[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"])])]),s(" Output Display "),o("div",Sv,[t[3]||(t[3]=o("h2",{class:"text-xl font-semibold text-black dark:text-white"}," Current Value ",-1)),o("div",Tv,[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",Mv,y(JSON.stringify(e.promptValue,null,2)),1)])]),s(" Instructions "),t[4]||(t[4]=bt('<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)),s(" Test Scenarios "),t[5]||(t[5]=bt('<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 Vv=ee(yv,[["render",Iv],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/TestPromptInput.vue"]]),Av=te({__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:a}){t(),self.MonacoEnvironment={getWorker(w,M){return M==="json"?new Vo:new Ao}};const e=p,c=a,i=m(null);let r=null,d=!1;const u=m(!1),v={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}},g=()=>{if(!(!r||e.readonly))try{const w=r.getValue(),M=JSON.parse(w),b=JSON.stringify(M,null,2);b!==w&&(d=!0,r.setValue(b),d=!1)}catch{}},h=()=>{u.value=document.documentElement.classList.contains("dark"),r&&yt.setTheme(u.value?"vs-dark":"vs")},f=()=>{i.value&&(r=yt.create(i.value,{value:e.modelValue||"{}",language:"json",theme:u.value?"vs-dark":"vs",...v})(i.value).__monacoEditor=r,r.onDidChangeModelContent(()=>{if(!d){const w=r.getValue();c("update:modelValue",w)}}),r.onDidBlurEditorText(()=>{c("blur"),g()}))};ge(async()=>{h(),await he(),f();const w=new MutationObserver(h);w.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),Ae(()=>{w.disconnect(),r&&r.dispose()})}),ae(()=>e.modelValue,w=>{r&&r.getValue()!==w&&(d=!0,r.setValue(w||""),d=!1)}),ae(()=>e.readonly,w=>{r&&r.updateOptions({readOnly:w})});const k=e.rows?`${e.rows*1.5}rem`:"18rem",x={props:e,emit:c,containerRef:i,get monacoEditor(){return r},set monacoEditor(w){r=w},get isUpdatingFromProp(){return d},set isUpdatingFromProp(w){d=w},isDark:u,editorOptions:v,formatJson:g,updateTheme:h,initEditor:f,editorHeight:k};return Object.defineProperty(x,"__isScriptSetup",{enumerable:!1,value:!0}),x}}),Pv={class:"relative"},Lv={key:0,class:"mt-1 text-sm text-red-500"};function Ev(p,t,a,e,c,i){return n(),l("div",Pv,[o("div",{class:Q(["border rounded overflow-hidden bg-white dark:bg-black",[a.error?"border-red-500":"border-black dark:border-neutral-300"]])},[o("div",{ref:"containerRef",class:"monaco-editor-container",style:$e({height:e.editorHeight})},null,4)],2),a.error?(n(),l("div",Lv,y(a.error),1)):s("v-if",!0)])}const jv=ee(Av,[["render",Ev],["__scopeId","data-v-903708b4"],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/components/JsonEditor.vue"]]),Ov=te({__name:"TestJsonEditorModal",setup(p,{expose:t}){t();const a=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:a,jsonValue:e,showEditableModal:c,editableJsonValue:i,Modal:je,JsonEditor:jv};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}}),Dv={class:"p-8"},qv={class:"space-y-4"},Uv={class:"space-y-4"},Bv={class:"space-y-4"};function Nv(p,t,a,e,c,i){return n(),l("div",Dv,[t[13]||(t[13]=o("h1",{class:"text-3xl font-bold mb-6"},"JsonEditor in Modal Test",-1)),o("div",qv,[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),"data-testid":"open-readonly-modal",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),"data-testid":"open-editable-modal",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 ")])]),s(" 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:re(()=>[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:re(()=>[o("div",Uv,[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,"data-testid":"readonly-json-editor"},null,8,["model-value"])])]),_:1},8,["modelValue"]),s(" 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:re(()=>[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:re(()=>[o("div",Bv,[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),"data-testid":"editable-json-editor"},null,8,["modelValue"])])]),_:1},8,["modelValue"])])}const Rv=ee(Ov,[["render",Nv],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/TestJsonEditorModal.vue"]]),It="10000000-0000-0000-0000-000000000101",at="10000000-0000-0000-0000-000000000102",Fv=te({__name:"TestPromptInterpolation",setup(p,{expose:t}){t();const a=m([]),e=m(null),c=m(null),i=m(""),r=m("Alice Johnson"),d=m("alice@example.com"),u=m("28"),{data:v,error:g}=we(X(`/api/prompts/${It}`)).json(),{data:h,error:f}=we(X(`/api/prompts/${at}`)).json();ae(v,M=>{if(M){e.value=M;try{a.value=JSON.parse(M.prompt)}catch(b){console.error("Failed to parse prompt A:",b)}}},{immediate:!0}),ae(h,M=>{M&&(c.value=M)},{immediate:!0});function k(M,b){return M.map(S=>{if(S.type==="string")return S.value||"";if(S.type==="variable"){const T=b[S.value];return T===void 0?`{{${S.value}}}`:typeof T=="string"?T:JSON.stringify(T)}else if(S.type==="prompt"){if(S.id===at&&c.value)try{const T=JSON.parse(c.value.prompt);return k(T,b)}catch{return`[Error loading prompt: ${S.label}]`}return""}return""}).join("")}function x(){const M={name:r.value,email:d.value,age:u.value};i.value=k(a.value,M)}const w={PROMPT_A_ID:It,PROMPT_B_ID:at,promptTemplate:a,promptAData:e,promptBData:c,renderedOutput:i,inputName:r,inputEmail:d,inputAge:u,promptA:v,errorA:g,promptB:h,errorB:f,interpolatePrompt:k,renderPrompt:x};return Object.defineProperty(w,"__isScriptSetup",{enumerable:!1,value:!0}),w}}),zv={class:"p-8 max-w-2xl mx-auto"},Hv={class:"mb-6"},Wv={"data-testid":"prompt-template",class:"p-4 bg-neutral-100 dark:bg-neutral-800 rounded font-mono text-sm"},Jv={key:0},Kv={class:"whitespace-pre-wrap"},Zv={key:1,class:"text-neutral-500"},Gv={class:"mb-6"},Xv={class:"space-y-2"},Yv={class:"mt-6"},Qv={"data-testid":"rendered-output",class:"p-4 bg-green-50 dark:bg-green-900 rounded min-h-[100px]"},$v={key:0,class:"font-mono"},eb={key:1,class:"text-neutral-500"};function tb(p,t,a,e,c,i){return n(),l("div",zv,[t[11]||(t[11]=o("h1",{class:"text-2xl font-bold mb-6"},"Prompt Interpolation Test",-1)),o("div",Hv,[t[4]||(t[4]=o("h2",{class:"text-lg font-semibold mb-2"},"Prompt Template",-1)),o("div",Wv,[e.promptAData?(n(),l("div",Jv,[t[3]||(t[3]=o("div",{class:"font-bold mb-2"},"Prompt A:",-1)),o("pre",Kv,y(JSON.stringify(e.promptTemplate,null,2)),1)])):(n(),l("div",Zv,"Loading..."))])]),o("div",Gv,[t[8]||(t[8]=o("h2",{class:"text-lg font-semibold mb-2"},"Context Values",-1)),o("div",Xv,[o("div",null,[t[5]||(t[5]=o("label",{class:"block text-sm mb-1"},"Name:",-1)),ye(o("input",{"data-testid":"input-name","onUpdate:modelValue":t[0]||(t[0]=r=>e.inputName=r),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Me,e.inputName]])]),o("div",null,[t[6]||(t[6]=o("label",{class:"block text-sm mb-1"},"Email:",-1)),ye(o("input",{"data-testid":"input-email","onUpdate:modelValue":t[1]||(t[1]=r=>e.inputEmail=r),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Me,e.inputEmail]])]),o("div",null,[t[7]||(t[7]=o("label",{class:"block text-sm mb-1"},"Age:",-1)),ye(o("input",{"data-testid":"input-age","onUpdate:modelValue":t[2]||(t[2]=r=>e.inputAge=r),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Me,e.inputAge]])])])]),o("button",{"data-testid":"render-button",onClick:e.renderPrompt,class:"px-4 py-2 bg-black text-white rounded hover:bg-neutral-800"}," Render Prompt "),o("div",Yv,[t[9]||(t[9]=o("h2",{class:"text-lg font-semibold mb-2"},"Rendered Output",-1)),o("div",Qv,[e.renderedOutput?(n(),l("div",$v,y(e.renderedOutput),1)):(n(),l("div",eb,' 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 ob=ee(Fv,[["render",tb],["__file","/Users/justinschroeder/Projects/standardagents/builder/packages/builder/ui/src/views/TestPromptInterpolation.vue"]]),Zt=So({history:To(We()),routes:[{path:"/login",name:"login",component:Yg,meta:{public:!0}},{path:"/",redirect:"/threads"},{path:"/agents",name:"agents",component:Zl},{path:"/threads",name:"threads",component:Ct},{path:"/threads/:id",name:"thread-detail",component:Ct},{path:"/prompts",name:"prompts",component:p1},{path:"/prompts/:id",name:"prompt-edit",component:b1},{path:"/models",name:"models",component:kf},{path:"/providers",name:"providers",component:Uf},{path:"/tools",name:"tools",component:wg},{path:"/settings/users",name:"users",component:Vg},{path:"/settings/api-keys",name:"api-keys",component:Ng},{path:"/test",name:"test",component:Hh},{path:"/test-reference-input",name:"test-reference-input",component:pv},{path:"/debug",name:"debug",component:bv},{path:"/test-prompt-input",name:"test-prompt-input",component:Vv},{path:"/test-json-editor-modal",name:"test-json-editor-modal",component:Rv},{path:"/test-prompt-interpolation",name:"test-prompt-interpolation",component:ob}]});Zt.beforeEach(async(p,t,a)=>{const e=p.meta.public===!0,c=localStorage.getItem("auth_token");!e&&!c?a({name:"login"}):e&&c&&p.name==="login"?a({name:"threads"}):a()});const rb=window.fetch;window.fetch=async function(p,t){const a=typeof p=="string"?p:p instanceof URL?p.toString():p.url,e=We(),c=e==="/"?"/api/":`${e}/api/`,i=a.includes(c)||e==="/"&&a.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 rb(p,t),d=a.includes("/api/auth/");return r.status===401&&i&&!d&&(localStorage.removeItem("auth_token"),window.location.href=X("/login")),r};const Gt=Mo(xa);Gt.use(Zt);Gt.mount("#app");
|