agentv 4.6.0 → 4.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2,9 +2,9 @@
2
2
  import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
3
3
  import {
4
4
  runCli
5
- } from "./chunk-U2LSJ6Y4.js";
6
- import "./chunk-5GZJIXTY.js";
7
- import "./chunk-KQQTEWZF.js";
5
+ } from "./chunk-NSVFUL27.js";
6
+ import "./chunk-MHWYA4CS.js";
7
+ import "./chunk-YXXD27OK.js";
8
8
  import "./chunk-QOBQ5XYF.js";
9
9
  import "./chunk-HQDCIXVH.js";
10
10
  import "./chunk-ZKO2LGRR.js";
@@ -130,6 +130,7 @@ import {
130
130
  readTranscriptFile,
131
131
  removeProject,
132
132
  resolveAndCreateProvider,
133
+ resolveDelegatedTargetDefinition,
133
134
  resolveFileReference,
134
135
  resolveTargetDefinition,
135
136
  resolveWorkspaceTemplate,
@@ -164,7 +165,7 @@ import {
164
165
  transpileEvalYaml,
165
166
  transpileEvalYamlFile,
166
167
  trimBaselineResult
167
- } from "./chunk-KQQTEWZF.js";
168
+ } from "./chunk-YXXD27OK.js";
168
169
  import {
169
170
  OtlpJsonFileExporter
170
171
  } from "./chunk-QOBQ5XYF.js";
@@ -307,6 +308,7 @@ export {
307
308
  readTranscriptFile,
308
309
  removeProject,
309
310
  resolveAndCreateProvider,
311
+ resolveDelegatedTargetDefinition,
310
312
  resolveFileReference,
311
313
  resolveTargetDefinition,
312
314
  resolveWorkspaceTemplate,
@@ -342,4 +344,4 @@ export {
342
344
  transpileEvalYamlFile,
343
345
  trimBaselineResult
344
346
  };
345
- //# sourceMappingURL=dist-FBPCDLOY.js.map
347
+ //# sourceMappingURL=dist-BN5NUVAB.js.map
package/dist/index.js CHANGED
@@ -3,9 +3,9 @@ import {
3
3
  app,
4
4
  preprocessArgv,
5
5
  runCli
6
- } from "./chunk-U2LSJ6Y4.js";
7
- import "./chunk-5GZJIXTY.js";
8
- import "./chunk-KQQTEWZF.js";
6
+ } from "./chunk-NSVFUL27.js";
7
+ import "./chunk-MHWYA4CS.js";
8
+ import "./chunk-YXXD27OK.js";
9
9
  import "./chunk-QOBQ5XYF.js";
10
10
  import "./chunk-HQDCIXVH.js";
11
11
  import "./chunk-ZKO2LGRR.js";
@@ -4,7 +4,7 @@ import {
4
4
  fileExists,
5
5
  findRepoRoot,
6
6
  runEvalCommand
7
- } from "./chunk-5GZJIXTY.js";
7
+ } from "./chunk-MHWYA4CS.js";
8
8
  import {
9
9
  DEFAULT_EVAL_PATTERNS,
10
10
  deriveCategory,
@@ -12,7 +12,7 @@ import {
12
12
  listTargetNames,
13
13
  loadConfig,
14
14
  readTargetDefinitions
15
- } from "./chunk-KQQTEWZF.js";
15
+ } from "./chunk-YXXD27OK.js";
16
16
  import "./chunk-QOBQ5XYF.js";
17
17
  import "./chunk-HQDCIXVH.js";
18
18
  import "./chunk-ZKO2LGRR.js";
@@ -363,4 +363,4 @@ ${ANSI_DIM}Retrying execution errors...${ANSI_RESET}
363
363
  export {
364
364
  launchInteractiveWizard
365
365
  };
366
- //# sourceMappingURL=interactive-6D3ULOMN.js.map
366
+ //# sourceMappingURL=interactive-DMSVE6CS.js.map
@@ -1,4 +1,4 @@
1
- import{r as u,W as T}from"./index-D-gfAa3s.js";function ie(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function be(e){if(Array.isArray(e))return e}function ye(e,t,r){return(t=Ee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function we(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,s,p=[],g=!0,v=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(g=(n=i.call(r)).done)&&(p.push(n.value),p.length!==t);g=!0);}catch(P){v=!0,o=P}finally{try{if(!g&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(v)throw o}}return p}}function Oe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as u,W as T}from"./index-vn54AYtS.js";function ie(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function be(e){if(Array.isArray(e))return e}function ye(e,t,r){return(t=Ee(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function we(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,s,p=[],g=!0,v=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(g=(n=i.call(r)).done)&&(p.push(n.value),p.length!==t);g=!0);}catch(P){v=!0,o=P}finally{try{if(!g&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(v)throw o}}return p}}function Oe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ue(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ae(Object(r),!0).forEach(function(n){ye(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function je(e,t){if(e==null)return{};var r,n,o=Me(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Me(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Pe(e,t){return be(e)||we(e,t)||Ie(e,t)||Oe()}function Se(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ee(e){var t=Se(e,"string");return typeof t=="symbol"?t:t+""}function Ie(e,t){if(e){if(typeof e=="string")return ie(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ie(e,t):void 0}}function Re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function le(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ce(Object(r),!0).forEach(function(n){Re(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ce(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ce(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function q(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var s=arguments.length,p=new Array(s),g=0;g<s;g++)p[g]=arguments[g];return t.apply(r,[].concat(o,p))}}}function K(e){return{}.toString.call(e).includes("Object")}function Le(e){return!Object.keys(e).length}function U(e){return typeof e=="function"}function Ae(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Te(e,t){return K(t)||E("changeType"),Object.keys(t).some(function(r){return!Ae(e,r)})&&E("changeField"),t}function $e(e){U(e)||E("selectorType")}function De(e){U(e)||K(e)||E("handlerType"),K(e)&&Object.values(e).some(function(t){return!U(t)})&&E("handlersType")}function Ve(e){e||E("initialIsRequired"),K(e)||E("initialType"),Le(e)&&E("initialContent")}function xe(e,t){throw new Error(e[t]||e.default)}var Ne={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},E=q(xe)(Ne),_={changes:Te,selector:$e,handler:De,initial:Ve};function qe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};_.initial(e),_.handler(t);var r={current:e},n=q(Fe)(r,t),o=q(Ue)(r),i=q(_.changes)(e),s=q(ze)(r);function p(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(P){return P};return _.selector(v),v(r.current)}function g(v){Ce(n,o,i,s)(v)}return[p,g]}function ze(e,t){return U(t)?t(e.current):t}function Ue(e,t){return e.current=le(le({},e.current),t),t}function Fe(e,t,r){return U(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var We={create:qe},He={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function _e(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var s=arguments.length,p=new Array(s),g=0;g<s;g++)p[g]=arguments[g];return t.apply(r,[].concat(o,p))}}}function Be(e){return{}.toString.call(e).includes("Object")}function Ke(e){return e||se("configIsRequired"),Be(e)||se("configType"),e.urls?(Ge(),{paths:{vs:e.urls.monacoBase}}):e}function Ge(){console.warn(fe.deprecation)}function Ye(e,t){throw new Error(e[t]||e.default)}var fe={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
3
  You are using deprecated way of configuration.
4
4
 
@@ -62,4 +62,4 @@ Error generating stack: `+s.message+`
62
62
  *
63
63
  * This source code is licensed under the MIT license found in the
64
64
  * LICENSE file in the root directory of this source tree.
65
- */var qy;function BS(){if(qy)return cf;qy=1;var n=Gi(),l=LS();function i(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var u=typeof Object.is=="function"?Object.is:i,o=l.useSyncExternalStore,d=n.useRef,h=n.useEffect,y=n.useMemo,p=n.useDebugValue;return cf.useSyncExternalStoreWithSelector=function(g,b,v,S,j){var N=d(null);if(N.current===null){var M={hasValue:!1,value:null};N.current=M}else M=N.current;N=y(function(){function U(k){if(!$){if($=!0,K=k,k=S(k),j!==void 0&&M.hasValue){var Z=M.value;if(j(Z,k))return L=Z}return L=k}if(Z=L,u(K,k))return Z;var P=S(k);return j!==void 0&&j(Z,P)?(K=k,Z):(K=k,L=P)}var $=!1,K,L,X=v===void 0?null:v;return[function(){return U(b())},X===null?void 0:function(){return U(X())}]},[b,v,S,j]);var C=o(g,N[0],N[1]);return h(function(){M.hasValue=!0,M.value=C},[C]),p(C),C},cf}var Qy;function HS(){return Qy||(Qy=1,uf.exports=BS()),uf.exports}var qS=HS();function QS(n,l){return n===l}function ye(n,l,i=QS){const u=F.useCallback(h=>{if(!n)return()=>{};const{unsubscribe:y}=n.subscribe(h);return y},[n]),o=F.useCallback(()=>n==null?void 0:n.get(),[n]);return qS.useSyncExternalStoreWithSelector(u,o,o,l,i)}var YS={state:void 0,get:()=>{},subscribe:()=>()=>{}};function gs(n){const l=be(),i=F.useContext(n.from?MS:Au),u=n.from??i,o=u?n.from?l.stores.getMatchStoreByRouteId(u):l.stores.activeMatchStoresById.get(u):void 0,d=F.useRef(void 0);return ye(o??YS,h=>{if((n.shouldThrow??!0)&&!h&&Ya(),h===void 0)return;const y=n.select?n.select(h):h;if(n.structuralSharing??l.options.defaultStructuralSharing){const p=Cn(d.current,y);return d.current=p,p}return y})}function Ug(n){return gs({from:n.from,strict:n.strict,structuralSharing:n.structuralSharing,select:l=>n.select?n.select(l.loaderData):l.loaderData})}function Lg(n){const{select:l,...i}=n;return gs({...i,select:u=>l?l(u.loaderDeps):u.loaderDeps})}function Bg(n){return gs({from:n.from,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,strict:n.strict,select:l=>{const i=n.strict===!1?l.params:l._strictParams;return n.select?n.select(i):i}})}function Hg(n){return gs({from:n.from,strict:n.strict,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,select:l=>n.select?n.select(l.search):l.search})}function Ou(n){const l=be();return F.useCallback(i=>l.navigate({...i,from:i.from??(n==null?void 0:n.from)}),[n==null?void 0:n.from,l])}function qg(n){return gs({...n,select:l=>n.select?n.select(l.context):l.context})}var GS=lg();function VS(n,l){const i=be(),u=Nb(l),{activeProps:o,inactiveProps:d,activeOptions:h,to:y,preload:p,preloadDelay:g,hashScrollIntoView:b,replace:v,startTransition:S,resetScroll:j,viewTransition:N,children:M,target:C,disabled:U,style:$,className:K,onClick:L,onBlur:X,onFocus:k,onMouseEnter:Z,onMouseLeave:P,onTouchStart:J,ignoreBlocker:G,params:I,search:lt,hash:it,state:ot,mask:nt,reloadDocument:D,unsafeRelative:V,from:at,_fromLocation:yt,...ft}=n,E=Cg(),Q=F.useMemo(()=>n,[i,n.from,n._fromLocation,n.hash,n.to,n.search,n.params,n.state,n.mask,n.unsafeRelative]),W=ye(i.stores.location,St=>St,(St,de)=>St.href===de.href),tt=F.useMemo(()=>{const St={_fromLocation:W,...Q};return i.buildLocation(St)},[i,W,Q]),ht=tt.maskedLocation?tt.maskedLocation.publicHref:tt.publicHref,xt=tt.maskedLocation?tt.maskedLocation.external:tt.external,bt=F.useMemo(()=>JS(ht,xt,i.history,U),[U,xt,ht,i.history]),Pt=F.useMemo(()=>{if(bt!=null&&bt.external)return ju(bt.href,i.protocolAllowlist)?void 0:bt.href;if(!IS(y)&&!(typeof y!="string"||y.indexOf(":")===-1))try{return new URL(y),ju(y,i.protocolAllowlist)?void 0:y}catch{}},[y,bt,i.protocolAllowlist]),qt=F.useMemo(()=>{if(Pt)return!1;if(h!=null&&h.exact){if(!Yb(W.pathname,tt.pathname,i.basepath))return!1}else{const St=Nu(W.pathname,i.basepath),de=Nu(tt.pathname,i.basepath);if(!(St.startsWith(de)&&(St.length===de.length||St[de.length]==="/")))return!1}return((h==null?void 0:h.includeSearch)??!0)&&!ds(W.search,tt.search,{partial:!(h!=null&&h.exact),ignoreUndefined:!(h!=null&&h.explicitUndefined)})?!1:h!=null&&h.includeHash?E&&W.hash===tt.hash:!0},[h==null?void 0:h.exact,h==null?void 0:h.explicitUndefined,h==null?void 0:h.includeHash,h==null?void 0:h.includeSearch,W,Pt,E,tt.hash,tt.pathname,tt.search,i.basepath]),la=qt?Mn(o,{})??XS:df,ga=qt?df:Mn(d,{})??df,vs=[K,la.className,ga.className].filter(Boolean).join(" "),El=($||la.style||ga.style)&&{...$,...la.style,...ga.style},[pa,xs]=F.useState(!1),bs=F.useRef(!1),Xa=n.reloadDocument||Pt?!1:p??i.options.defaultPreload,Ss=g??i.options.defaultPreloadDelay??0,We=F.useCallback(()=>{i.preloadRoute({...Q,_builtLocation:tt}).catch(St=>{console.warn(St),console.warn(jS)})},[i,Q,tt]);jb(u,F.useCallback(St=>{St!=null&&St.isIntersecting&&We()},[We]),$S,{disabled:!!U||Xa!=="viewport"}),F.useEffect(()=>{bs.current||!U&&Xa==="render"&&(We(),bs.current=!0)},[U,We,Xa]);const Tl=St=>{const de=St.currentTarget.getAttribute("target"),ia=C!==void 0?C:de;if(!U&&!FS(St)&&!St.defaultPrevented&&(!ia||ia==="_self")&&St.button===0){St.preventDefault(),GS.flushSync(()=>{xs(!0)});const Zi=i.subscribe("onResolved",()=>{Zi(),xs(!1)});i.navigate({...Q,replace:v,resetScroll:j,hashScrollIntoView:b,startTransition:S,viewTransition:N,ignoreBlocker:G})}};if(Pt)return{...ft,ref:u,href:Pt,...M&&{children:M},...C&&{target:C},...U&&{disabled:U},...$&&{style:$},...K&&{className:K},...L&&{onClick:L},...X&&{onBlur:X},...k&&{onFocus:k},...Z&&{onMouseEnter:Z},...P&&{onMouseLeave:P},...J&&{onTouchStart:J}};const js=St=>{if(U||Xa!=="intent")return;if(!Ss){We();return}const de=St.currentTarget;if(Ei.has(de))return;const ia=setTimeout(()=>{Ei.delete(de),We()},Ss);Ei.set(de,ia)},zu=St=>{U||Xa!=="intent"||We()},Ki=St=>{if(U||!Xa||!Ss)return;const de=St.currentTarget,ia=Ei.get(de);ia&&(clearTimeout(ia),Ei.delete(de))};return{...ft,...la,...ga,href:bt==null?void 0:bt.href,ref:u,onClick:rl([L,Tl]),onBlur:rl([X,Ki]),onFocus:rl([k,js]),onMouseEnter:rl([Z,js]),onMouseLeave:rl([P,Ki]),onTouchStart:rl([J,zu]),disabled:!!U,target:C,...El&&{style:El},...vs&&{className:vs},...U&&KS,...qt&&ZS,...E&&pa&&PS}}var df={},XS={className:"active"},KS={role:"link","aria-disabled":!0},ZS={"data-status":"active","aria-current":"page"},PS={"data-transitioning":"transitioning"},Ei=new WeakMap,$S={rootMargin:"100px"},rl=n=>l=>{for(const i of n)if(i){if(l.defaultPrevented)return;i(l)}};function JS(n,l,i,u){if(!u)return l?{href:n,external:!0}:{href:i.createHref(n)||"/",external:!1}}function IS(n){if(typeof n!="string")return!1;const l=n.charCodeAt(0);return l===47?n.charCodeAt(1)!==47:l===46}var Mt=F.forwardRef((n,l)=>{const{_asChild:i,...u}=n,{type:o,...d}=VS(u,l),h=typeof u.children=="function"?u.children({isActive:d["data-status"]==="active"}):u.children;if(!i){const{disabled:y,...p}=d;return F.createElement("a",p,h)}return F.createElement(i,d,h)});function FS(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}var kS=class extends Mg{constructor(l){super(l),this.useMatch=i=>gs({select:i==null?void 0:i.select,from:this.id,structuralSharing:i==null?void 0:i.structuralSharing}),this.useRouteContext=i=>qg({...i,from:this.id}),this.useSearch=i=>Hg({select:i==null?void 0:i.select,structuralSharing:i==null?void 0:i.structuralSharing,from:this.id}),this.useParams=i=>Bg({select:i==null?void 0:i.select,structuralSharing:i==null?void 0:i.structuralSharing,from:this.id}),this.useLoaderDeps=i=>Lg({...i,from:this.id}),this.useLoaderData=i=>Ug({...i,from:this.id}),this.useNavigate=()=>Ou({from:this.fullPath}),this.Link=Ai.forwardRef((i,u)=>f.jsx(Mt,{ref:u,from:this.fullPath,...i}))}};function WS(n){return new kS(n)}var t1=class extends NS{constructor(n){super(n),this.useMatch=l=>gs({select:l==null?void 0:l.select,from:this.id,structuralSharing:l==null?void 0:l.structuralSharing}),this.useRouteContext=l=>qg({...l,from:this.id}),this.useSearch=l=>Hg({select:l==null?void 0:l.select,structuralSharing:l==null?void 0:l.structuralSharing,from:this.id}),this.useParams=l=>Bg({select:l==null?void 0:l.select,structuralSharing:l==null?void 0:l.structuralSharing,from:this.id}),this.useLoaderDeps=l=>Lg({...l,from:this.id}),this.useLoaderData=l=>Ug({...l,from:this.id}),this.useNavigate=()=>Ou({from:this.fullPath}),this.Link=Ai.forwardRef((l,i)=>f.jsx(Mt,{ref:i,from:this.fullPath,...l}))}};function e1(n){return new t1(n)}function ya(n){return typeof n=="object"?new Yy(n,{silent:!0}).createRoute(n):new Yy(n,{silent:!0}).createRoute}var Yy=class{constructor(n,l){this.path=n,this.createRoute=i=>{const u=WS(i);return u.isRoot=!1,u},this.silent=l==null?void 0:l.silent}};function a1(n){const l=be(),i=`not-found-${ye(l.stores.location,u=>u.pathname)}-${ye(l.stores.status,u=>u)}`;return f.jsx(Vf,{getResetKey:()=>i,onCatch:(u,o)=>{var d;if(xe(u))(d=n.onCatch)==null||d.call(n,u,o);else throw u},errorComponent:({error:u})=>{var o;if(xe(u))return(o=n.fallback)==null?void 0:o.call(n,u);throw u},children:n.children})}function n1(){return f.jsx("p",{children:"Not Found"})}function ul(n){return f.jsx(f.Fragment,{children:n.children})}function Qg(n,l,i){return l.options.notFoundComponent?f.jsx(l.options.notFoundComponent,{...i}):n.options.defaultNotFoundComponent?f.jsx(n.options.defaultNotFoundComponent,{...i}):f.jsx(n1,{})}function s1(n){return null}function l1(){return s1(be()),null}var Yg=F.memo(function({matchId:l}){const i=be(),u=i.stores.activeMatchStoresById.get(l);u||Ya();const o=ye(i.stores.loadedAt,h=>h),d=ye(u,h=>h);return f.jsx(i1,{router:i,matchId:l,resetKey:o,matchState:F.useMemo(()=>{var p;const h=d.routeId,y=(p=i.routesById[h].parentRoute)==null?void 0:p.id;return{routeId:h,ssr:d.ssr,_displayPending:d._displayPending,parentRouteId:y}},[d._displayPending,d.routeId,d.ssr,i.routesById])})});function i1({router:n,matchId:l,resetKey:i,matchState:u}){var N,M;const o=n.routesById[u.routeId],d=o.options.pendingComponent??n.options.defaultPendingComponent,h=d?f.jsx(d,{}):null,y=o.options.errorComponent??n.options.defaultErrorComponent,p=o.options.onCatch??n.options.defaultOnCatch,g=o.isRoot?o.options.notFoundComponent??((N=n.options.notFoundRoute)==null?void 0:N.options.component):o.options.notFoundComponent,b=u.ssr===!1||u.ssr==="data-only",v=(!o.isRoot||o.options.wrapInSuspense||b)&&(o.options.wrapInSuspense??d??(((M=o.options.errorComponent)==null?void 0:M.preload)||b))?F.Suspense:ul,S=y?Vf:ul,j=g?a1:ul;return f.jsxs(o.isRoot?o.options.shellComponent??ul:ul,{children:[f.jsx(Au.Provider,{value:l,children:f.jsx(v,{fallback:h,children:f.jsx(S,{getResetKey:()=>i,errorComponent:y||Xf,onCatch:(C,U)=>{if(xe(C))throw C;p==null||p(C,U)},children:f.jsx(j,{fallback:C=>{if(!g||C.routeId&&C.routeId!==u.routeId||!C.routeId&&!o.isRoot)throw C;return F.createElement(g,C)},children:b||u._displayPending?f.jsx(ES,{fallback:h,children:f.jsx(Gy,{matchId:l})}):f.jsx(Gy,{matchId:l})})})})}),u.parentRouteId===hs?f.jsxs(f.Fragment,{children:[f.jsx(r1,{resetKey:i}),n.options.scrollRestoration&&vg?f.jsx(l1,{}):null]}):null]})}function r1({resetKey:n}){const l=be(),i=F.useRef(void 0);return Ci(()=>{const u=l.latestLocation.href;(i.current===void 0||i.current!==u)&&(l.emit({type:"onRendered",...cl(l.stores.location.state,l.stores.resolvedLocation.state)}),i.current=u)},[l.latestLocation.state.__TSR_key,n,l]),null}var Gy=F.memo(function({matchId:l}){var g,b,v,S;const i=be(),u=i.stores.activeMatchStoresById.get(l);u||Ya();const o=ye(u,j=>j),d=o.routeId,h=i.routesById[d],y=F.useMemo(()=>{var N;const j=(N=i.routesById[d].options.remountDeps??i.options.defaultRemountDeps)==null?void 0:N({routeId:d,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return j?JSON.stringify(j):void 0},[d,o.loaderDeps,o._strictParams,o._strictSearch,i.options.defaultRemountDeps,i.routesById]),p=F.useMemo(()=>{const j=h.options.component??i.options.defaultComponent;return j?f.jsx(j,{},y):f.jsx(Gg,{})},[y,h.options.component,i.options.defaultComponent]);if(o._displayPending)throw(g=i.getMatch(o.id))==null?void 0:g._nonReactive.displayPendingPromise;if(o._forcePending)throw(b=i.getMatch(o.id))==null?void 0:b._nonReactive.minPendingPromise;if(o.status==="pending"){const j=h.options.pendingMinMs??i.options.defaultPendingMinMs;if(j){const N=i.getMatch(o.id);if(N&&!N._nonReactive.minPendingPromise){const M=Nl();N._nonReactive.minPendingPromise=M,setTimeout(()=>{M.resolve(),N._nonReactive.minPendingPromise=void 0},j)}}throw(v=i.getMatch(o.id))==null?void 0:v._nonReactive.loadPromise}if(o.status==="notFound")return xe(o.error)||Ya(),Qg(i,h,o.error);if(o.status==="redirected")throw Ae(o.error)||Ya(),(S=i.getMatch(o.id))==null?void 0:S._nonReactive.loadPromise;if(o.status==="error")throw o.error;return p}),Gg=F.memo(function(){const l=be(),i=F.useContext(Au);let u,o=!1,d;{const g=i?l.stores.activeMatchStoresById.get(i):void 0;[u,o]=ye(g,b=>[b==null?void 0:b.routeId,(b==null?void 0:b.globalNotFound)??!1]),d=ye(l.stores.matchesId,b=>b[b.findIndex(v=>v===i)+1])}const h=u?l.routesById[u]:void 0,y=l.options.defaultPendingComponent?f.jsx(l.options.defaultPendingComponent,{}):null;if(o)return h||Ya(),Qg(l,h,void 0);if(!d)return null;const p=f.jsx(Yg,{matchId:d});return u===hs?f.jsx(F.Suspense,{fallback:y,children:p}):p});function u1(){const n=be(),l=F.useRef({router:n,mounted:!1}),[i,u]=F.useState(!1),o=ye(n.stores.isLoading,v=>v),d=ye(n.stores.hasPendingMatches,v=>v),h=Wo(o),y=o||i||d,p=Wo(y),g=o||d,b=Wo(g);return n.startTransition=v=>{u(!0),F.startTransition(()=>{v(),u(!1)})},F.useEffect(()=>{const v=n.history.subscribe(n.load),S=n.buildLocation({to:n.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return zn(n.latestLocation.publicHref)!==zn(S.publicHref)&&n.commitLocation({...S,replace:!0}),()=>{v()}},[n,n.history]),Ci(()=>{if(typeof window<"u"&&n.ssr||l.current.router===n&&l.current.mounted)return;l.current={router:n,mounted:!0},(async()=>{try{await n.load()}catch(S){console.error(S)}})()},[n]),Ci(()=>{h&&!o&&n.emit({type:"onLoad",...cl(n.stores.location.state,n.stores.resolvedLocation.state)})},[h,n,o]),Ci(()=>{b&&!g&&n.emit({type:"onBeforeRouteMount",...cl(n.stores.location.state,n.stores.resolvedLocation.state)})},[g,b,n]),Ci(()=>{if(p&&!y){const v=cl(n.stores.location.state,n.stores.resolvedLocation.state);n.emit({type:"onResolved",...v}),zg(()=>{n.stores.status.setState(()=>"idle"),n.stores.resolvedLocation.setState(()=>n.stores.location.state)}),v.hrefChanged&&RS(n)}},[y,p,n]),null}function c1(){const n=be(),l=n.routesById[hs].options.pendingComponent??n.options.defaultPendingComponent,i=l?f.jsx(l,{}):null,u=f.jsxs(typeof document<"u"&&n.ssr?ul:F.Suspense,{fallback:i,children:[f.jsx(u1,{}),f.jsx(o1,{})]});return n.options.InnerWrap?f.jsx(n.options.InnerWrap,{children:u}):u}function o1(){const n=be(),l=ye(n.stores.firstMatchId,o=>o),i=ye(n.stores.loadedAt,o=>o),u=l?f.jsx(Yg,{matchId:l}):null;return f.jsx(Au.Provider,{value:l,children:n.options.disableGlobalCatchBoundary?u:f.jsx(Vf,{getResetKey:()=>i,errorComponent:Xf,onCatch:void 0,children:u})})}function Vg(){const n=be();return ye(n.stores.matchRouteReactivity,l=>l),F.useCallback(l=>{const{pending:i,caseSensitive:u,fuzzy:o,includeSearch:d,...h}=l;return n.matchRoute(h,{pending:i,caseSensitive:u,fuzzy:o,includeSearch:d})},[n])}function f1(n){const l=be(),i=F.useRef(void 0);return ye(l.stores.activeMatchesSnapshot,u=>{const o=u;if(l.options.defaultStructuralSharing){const d=Cn(i.current,o);return i.current=d,d}return o})}var d1=n=>({createMutableStore:Ly,createReadonlyStore:Ly,batch:zg}),h1=n=>new m1(n),m1=class extends yS{constructor(n){super(n,d1)}};function y1({router:n,children:l,...i}){Object.keys(i).length>0&&n.update({...n.options,...i,context:{...n.options.context,...i.context}});const u=f.jsx(Ag.Provider,{value:n,children:l});return n.options.Wrap?f.jsx(n.options.Wrap,{children:u}):u}function g1({router:n,...l}){return f.jsx(y1,{router:n,...l,children:f.jsx(c1,{})})}function Xg(n){const i=be();return F.useRef(void 0),ye(i.stores.__store,u=>u)}function p1(n){const l=[];for(let i=1;i<n.length;i++){const u=n[i],o=u.routeId??u.id,d=u.params;o==="/"||o==="/_layout"||(o.includes("/runs/$runId/category/$category")?(l.some(h=>h.label===d.runId)||l.push({label:d.runId??"Run",to:`/runs/${encodeURIComponent(d.runId)}`}),l.push({label:d.category??"Category",to:u.pathname})):o.includes("/runs/$runId/dataset/$dataset")?l.push({label:d.dataset??"Dataset",to:u.pathname}):o.includes("/runs/$runId")?l.push({label:d.runId??"Run",to:u.pathname}):o.includes("/evals/$runId/$evalId")?(l.some(h=>h.label===d.runId)||l.push({label:d.runId??"Run",to:`/runs/${encodeURIComponent(d.runId)}`}),l.push({label:d.evalId??"Eval",to:u.pathname})):o.includes("/experiments/$experimentName")?l.push({label:d.experimentName??"Experiment",to:u.pathname}):(o==="/index"||o==="/")&&l.push({label:"Home",to:"/"}))}return l}function v1(){const n=f1(),l=p1(n);return l.length===0?null:f.jsxs("div",{className:"flex items-center gap-2 border-b border-gray-800 bg-gray-950 px-6 py-2 text-sm",children:[f.jsx(Mt,{to:"/",className:"text-cyan-400 hover:text-cyan-300 hover:underline",children:"Home"}),l.map((i,u)=>{const o=u===l.length-1;return f.jsxs("span",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"text-gray-600",children:">"}),o?f.jsx("span",{className:"text-gray-400",children:i.label}):f.jsx(Mt,{to:i.to??"/",className:"text-cyan-400 hover:text-cyan-300 hover:underline",children:i.label})]},`${i.label}-${u}`)})]})}async function fe(n){const l=await fetch(n);if(!l.ok)throw new Error(`API error: ${l.status} ${l.statusText}`);return l.json()}const x1={queryKey:["runs"],queryFn:()=>fe("/api/runs"),refetchInterval:5e3};function b1(n){return{queryKey:["runs",n],queryFn:()=>fe(`/api/runs/${encodeURIComponent(n)}`),enabled:!!n}}const S1={queryKey:["feedback"],queryFn:()=>fe("/api/feedback")},j1={queryKey:["experiments"],queryFn:()=>fe("/api/experiments")},N1={queryKey:["targets"],queryFn:()=>fe("/api/targets")};function R1(n,l){return{queryKey:["runs",n,"evals",l,"files"],queryFn:()=>fe(`/api/runs/${encodeURIComponent(n)}/evals/${encodeURIComponent(l)}/files`),enabled:!!n&&!!l}}function _1(n,l,i){return{queryKey:["runs",n,"evals",l,"files",i],queryFn:()=>fe(`/api/runs/${encodeURIComponent(n)}/evals/${encodeURIComponent(l)}/files/${i}`),enabled:!!n&&!!l&&!!i}}function E1(n,l){return{queryKey:["runs",n,"categories",l,"datasets"],queryFn:()=>fe(`/api/runs/${encodeURIComponent(n)}/categories/${encodeURIComponent(l)}/datasets`),enabled:!!n&&!!l}}const T1={queryKey:["config"],queryFn:()=>fe("/api/config"),staleTime:5e3};function Zf(){return oe(x1)}function Xi(n){return oe(b1(n))}function M1(){return oe(S1)}function Pf(){return oe(j1)}function C1(){return oe(N1)}function A1(n,l){return oe(R1(n,l))}function O1(n,l,i){return oe(_1(n,l,i))}function Kg(n,l){return oe(E1(n,l))}function ps(){return oe(T1)}const zf=.8;function wn(n,l=zf){return n>=l}const z1={queryKey:["projects"],queryFn:()=>fe("/api/projects"),refetchInterval:1e4};function $f(){return oe(z1)}const D1={queryKey:["projects","all-runs"],queryFn:()=>fe("/api/projects/all-runs"),refetchInterval:5e3};function w1(){return oe(D1)}async function U1(n){const l=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});if(!l.ok){const i=await l.json();throw new Error(i.error||`Failed to add project: ${l.status}`)}return l.json()}async function L1(n){const l=await fetch("/api/projects/discover",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});if(!l.ok){const u=await l.json();throw new Error(u.error||`Failed to discover: ${l.status}`)}return(await l.json()).discovered}function _l(n){return`/api/projects/${encodeURIComponent(n)}`}function B1(n){return{queryKey:["projects",n,"runs"],queryFn:()=>fe(`${_l(n)}/runs`),enabled:!!n,refetchInterval:5e3}}function Zg(n){return oe(B1(n))}function H1(n,l){return{queryKey:["projects",n,"runs",l],queryFn:()=>fe(`${_l(n)}/runs/${encodeURIComponent(l)}`),enabled:!!n&&!!l}}function Jf(n,l){return oe(H1(n,l))}function q1(n,l,i){return{queryKey:["projects",n,"runs",l,"evals",i,"files"],queryFn:()=>fe(`${_l(n)}/runs/${encodeURIComponent(l)}/evals/${encodeURIComponent(i)}/files`),enabled:!!n&&!!l&&!!i}}function Q1(n,l,i,u){return{queryKey:["projects",n,"runs",l,"evals",i,"files",u],queryFn:()=>fe(`${_l(n)}/runs/${encodeURIComponent(l)}/evals/${encodeURIComponent(i)}/files/${u}`),enabled:!!n&&!!l&&!!i&&!!u}}function Y1(n){return{queryKey:["projects",n,"experiments"],queryFn:()=>fe(`${_l(n)}/experiments`),enabled:!!n}}function G1(n){return{queryKey:["projects",n,"targets"],queryFn:()=>fe(`${_l(n)}/targets`),enabled:!!n}}async function V1(n){const l=await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!l.ok)throw new Error(`Failed to save config: ${l.status}`);return l.json()}function X1(){const n=Vg(),l=n({to:"/projects/$projectId/evals/$runId/$evalId",fuzzy:!0}),i=n({to:"/projects/$projectId/runs/$runId",fuzzy:!0}),u=n({to:"/projects/$projectId",fuzzy:!0});if(l&&typeof l=="object"&&"projectId"in l){const{projectId:p,runId:g,evalId:b}=l;return f.jsx(J1,{projectId:p,runId:g,currentEvalId:b})}if(i&&typeof i=="object"&&"projectId"in i){const{projectId:p,runId:g}=i;return f.jsx(Vy,{projectId:p,currentRunId:g})}if(u&&typeof u=="object"&&"projectId"in u){const{projectId:p}=u;return f.jsx(Vy,{projectId:p})}const o=n({to:"/evals/$runId/$evalId",fuzzy:!0}),d=n({to:"/runs/$runId/category/$category",fuzzy:!0}),h=n({to:"/runs/$runId/dataset/$dataset",fuzzy:!0}),y=n({to:"/experiments/$experimentName",fuzzy:!0});if(d&&typeof d=="object"&&"runId"in d){const{runId:p,category:g}=d;return f.jsx($1,{runId:p,category:g})}if(h&&typeof h=="object"&&"runId"in h){const{runId:p,dataset:g}=h;return f.jsx(P1,{runId:p,dataset:g})}if(o&&typeof o=="object"&&"runId"in o){const{runId:p,evalId:g}=o;return f.jsx(Z1,{runId:p,currentEvalId:g})}if(y&&typeof y=="object"&&"experimentName"in y){const{experimentName:p}=y;return f.jsx(I1,{currentExperiment:p})}return f.jsx(K1,{})}function K1(){const n=Vg(),{data:l}=$f(),i=((l==null?void 0:l.projects.length)??0)>0,u=n({to:"/"}),o=n({to:"/runs/$runId",fuzzy:!0}),d=i&&u!==!1,{data:h}=Zf(),{data:y}=w1(),p=d?y:h;return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Runs"}),p==null?void 0:p.runs.map(g=>{const b=u===!1&&o&&typeof o=="object"&&"runId"in o&&o.runId===g.filename;return g.project_id?f.jsx(Mt,{to:"/projects/$projectId/runs/$runId",params:{projectId:g.project_id,runId:g.filename},className:"mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm text-gray-400 transition-colors hover:bg-gray-800/50 hover:text-gray-200",title:g.project_name,children:g.filename},`${g.project_id}/${g.filename}`):f.jsx(Mt,{to:"/runs/$runId",params:{runId:g.filename},className:`mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm transition-colors ${b?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:g.filename},g.filename)})]}),f.jsx("div",{className:"border-t border-gray-800 px-4 py-3",children:f.jsx(Mt,{to:"/settings",className:"flex items-center gap-2 text-sm text-gray-400 hover:text-cyan-400",children:"Settings"})})]})}function Z1({runId:n,currentEvalId:l}){const{data:i}=Xi(n),{data:u}=ps(),o=(u==null?void 0:u.pass_threshold)??.8;return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Mt,{to:"/runs/$runId",params:{runId:n},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Evaluations"}),i==null?void 0:i.results.map(d=>{const h=d.testId===l,y=wn(d.score,o);return f.jsxs(Mt,{to:"/evals/$runId/$evalId",params:{runId:n,evalId:d.testId},className:`mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors ${h?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:[f.jsx("span",{className:`text-xs ${y?"text-emerald-400":"text-red-400"}`,children:y?"✓":"✗"}),f.jsx("span",{className:"truncate",children:d.testId})]},d.testId)})]})]})}function P1({runId:n,dataset:l}){const{data:i}=Xi(n),{data:u}=ps(),o=(u==null?void 0:u.pass_threshold)??.8,d=((i==null?void 0:i.results)??[]).filter(h=>(h.dataset??"Uncategorized")===l);return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Mt,{to:"/runs/$runId",params:{runId:n},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n}),f.jsx("p",{className:"truncate text-xs text-gray-500",children:l})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Evaluations"}),d.map(h=>{const y=wn(h.score,o);return f.jsxs(Mt,{to:"/evals/$runId/$evalId",params:{runId:n,evalId:h.testId},className:"mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-gray-400 transition-colors hover:bg-gray-800/50 hover:text-gray-200",children:[f.jsx("span",{className:`text-xs ${y?"text-emerald-400":"text-red-400"}`,children:y?"✓":"✗"}),f.jsx("span",{className:"truncate",children:h.testId})]},h.testId)})]})]})}function $1({runId:n,category:l}){const{data:i}=Kg(n,l),u=(i==null?void 0:i.datasets)??[];return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Mt,{to:"/runs/$runId",params:{runId:n},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n}),f.jsx("p",{className:"truncate text-xs text-gray-500",children:l})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Datasets"}),u.map(o=>f.jsxs(Mt,{to:"/runs/$runId/dataset/$dataset",params:{runId:n,dataset:o.name},className:"mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-gray-400 transition-colors hover:bg-gray-800/50 hover:text-gray-200",children:[f.jsx("span",{className:`text-xs ${o.passed===o.total?"text-emerald-400":"text-red-400"}`,children:o.passed===o.total?"✓":"✗"}),f.jsx("span",{className:"truncate",children:o.name})]},o.name))]})]})}function Vy({projectId:n,currentRunId:l}){const{data:i}=Zg(n);return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Mt,{to:"/",className:"text-xs text-gray-400 hover:text-cyan-400",children:"← All Projects"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Runs"}),i==null?void 0:i.runs.map(u=>{const o=l===u.filename;return f.jsx(Mt,{to:"/projects/$projectId/runs/$runId",params:{projectId:n,runId:u.filename},className:`mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm transition-colors ${o?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:u.filename},u.filename)})]})]})}function J1({projectId:n,runId:l,currentEvalId:i}){const{data:u}=Jf(n,l),{data:o}=ps(),d=(o==null?void 0:o.pass_threshold)??.8;return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Mt,{to:"/projects/$projectId/runs/$runId",params:{projectId:n,runId:l},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:l})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Evaluations"}),u==null?void 0:u.results.map(h=>{const y=h.testId===i,p=wn(h.score,d);return f.jsxs(Mt,{to:"/projects/$projectId/evals/$runId/$evalId",params:{projectId:n,runId:l,evalId:h.testId},className:`mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors ${y?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:[f.jsx("span",{className:`text-xs ${p?"text-emerald-400":"text-red-400"}`,children:p?"✓":"✗"}),f.jsx("span",{className:"truncate",children:h.testId})]},h.testId)})]})]})}function I1({currentExperiment:n}){const{data:l}=Pf(),i=(l==null?void 0:l.experiments)??[];return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsx("div",{className:"border-b border-gray-800 px-4 py-2",children:f.jsx(Mt,{to:"/",search:{tab:"experiments"},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← All experiments"})}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Experiments"}),i.map(u=>{const o=u.name===n;return f.jsx(Mt,{to:"/experiments/$experimentName",params:{experimentName:u.name},className:`mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm transition-colors ${o?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:u.name},u.name)})]})]})}function F1(){return f.jsxs("div",{className:"flex h-screen overflow-hidden",children:[f.jsx(X1,{}),f.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[f.jsx(v1,{}),f.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:f.jsx(Gg,{})})]})]})}const sa=e1({component:F1}),k1=ya("/settings")({component:W1});function W1(){const{data:n,isLoading:l}=ps(),i=Vi(),[u,o]=F.useState(""),[d,h]=F.useState(!1),[y,p]=F.useState(null),g=(n==null?void 0:n.pass_threshold)??zf,b=u||String(g),v=async()=>{const S=Number.parseFloat(u||String(g));if(Number.isNaN(S)||S<0||S>1){p({type:"error",text:"Threshold must be a number between 0 and 1"});return}h(!0),p(null);try{await V1({pass_threshold:S}),await i.invalidateQueries({queryKey:["config"]}),o(""),p({type:"success",text:"Settings saved"}),setTimeout(()=>p(null),3e3)}catch{p({type:"error",text:"Failed to save settings"})}finally{h(!1)}};return l?f.jsxs("div",{className:"mx-auto max-w-2xl space-y-6",children:[f.jsx("div",{className:"h-8 w-48 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"h-40 animate-pulse rounded-lg bg-gray-900"})]}):f.jsxs("div",{className:"mx-auto max-w-2xl space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Settings"}),f.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Configure your AgentV Studio dashboard"})]}),f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6",children:[f.jsx("h2",{className:"text-lg font-medium text-white",children:"Evaluation"}),f.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Configure how evaluation results are classified"}),f.jsx("div",{className:"mt-6 space-y-4",children:f.jsxs("div",{children:[f.jsx("label",{htmlFor:"pass-threshold",className:"block text-sm font-medium text-gray-300",children:"Pass Threshold"}),f.jsxs("p",{className:"mt-1 text-xs text-gray-500",children:["Score at or above this value is considered passing. Default: ",zf]}),f.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[f.jsx("input",{id:"pass-threshold",type:"number",min:"0",max:"1",step:"0.05",value:b,onChange:S=>o(S.target.value),className:"w-32 rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white placeholder-gray-500 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500"}),f.jsxs("span",{className:"text-sm text-gray-400",children:["(",Math.round((Number.parseFloat(b)||0)*100),"%)"]})]})]})}),f.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[f.jsx("button",{type:"button",onClick:v,disabled:d,className:"rounded-md bg-cyan-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-cyan-500 disabled:opacity-50",children:d?"Saving...":"Save Settings"}),y&&f.jsx("span",{className:`text-sm ${y.type==="success"?"text-emerald-400":"text-red-400"}`,children:y.text})]})]}),f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:f.jsxs("p",{className:"text-xs text-gray-500",children:["Settings are stored in ",f.jsx("code",{className:"text-gray-400",children:".agentv/config.yaml"})]})})]})}function Va({score:n,className:l=""}){const i=Math.round(Math.max(0,Math.min(1,n))*100);return f.jsxs("div",{className:`flex items-center gap-3 ${l}`,children:[f.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-gray-800",children:f.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-cyan-400 to-blue-500 transition-all duration-300",style:{width:`${i}%`}})}),f.jsxs("span",{className:"w-12 text-right text-sm font-medium tabular-nums text-gray-300",children:[i,"%"]})]})}function tj(){const{data:n,isLoading:l}=Pf();if(l)return f.jsx(aj,{});const i=(n==null?void 0:n.experiments)??[];return i.length===0?f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No experiments found"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Experiments will appear here once evaluations are run with experiment labels."})]}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Targets"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Last Run"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:i.map(u=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3",children:f.jsx(Mt,{to:"/experiments/$experimentName",params:{experimentName:u.name},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:u.name})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:u.run_count}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:u.target_count}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Va,{score:u.pass_rate})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:ej(u.last_run)})]},u.name))})]})})}function ej(n){if(!n)return"N/A";try{const l=new Date(n);return Number.isNaN(l.getTime())?"N/A":l.toLocaleString()}catch{return"N/A"}}function aj(){return f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("div",{className:"animate-pulse",children:[f.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(n=>f.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[f.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"})]},n))]})})}function nj(n){if(!n)return"No runs";const l=new Date(n);if(Number.isNaN(l.getTime()))return"N/A";const i=Date.now()-l.getTime(),u=Math.floor(i/6e4);if(u<1)return"Just now";if(u<60)return`${u}m ago`;const o=Math.floor(u/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function sj({project:n}){const l=Math.round(n.pass_rate*100);return f.jsxs(Mt,{to:"/projects/$projectId",params:{projectId:n.id},className:"group block rounded-lg border border-gray-800 bg-gray-900/50 p-5 transition-colors hover:border-cyan-800 hover:bg-gray-900",children:[f.jsx("div",{className:"flex items-start justify-between",children:f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("h3",{className:"truncate text-lg font-semibold text-white group-hover:text-cyan-400",children:n.name}),f.jsx("p",{className:"mt-1 truncate text-xs text-gray-500",children:n.path})]})}),f.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-3",children:[f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-gray-500",children:"Runs"}),f.jsx("p",{className:"text-lg font-semibold text-white",children:n.run_count})]}),f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-gray-500",children:"Pass Rate"}),f.jsx("p",{className:`text-lg font-semibold ${n.run_count===0?"text-gray-500":l>=80?"text-emerald-400":l>=50?"text-yellow-400":"text-red-400"}`,children:n.run_count>0?`${l}%`:"--"})]}),f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-gray-500",children:"Last Run"}),f.jsx("p",{className:"text-sm text-gray-300",children:nj(n.last_run)})]})]})]})}function lj(n){if(!n)return"N/A";try{const l=new Date(n);return Number.isNaN(l.getTime())?"N/A":l.toLocaleString()}catch{return"N/A"}}function If({runs:n,projectId:l}){return n.length===0?f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No evaluation runs found."}),f.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Run an evaluation first:"," ",f.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"agentv eval <eval-file>"})]})]}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Run"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Timestamp"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Tests"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",title:"Percentage of tests with a perfect score (1.0)",children:"Tests Passing"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",title:"Mean score across all tests (0-100%)",children:"Mean Score"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(i=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3",children:l?f.jsx(Mt,{to:"/projects/$projectId/runs/$runId",params:{projectId:l,runId:i.filename},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:i.filename}):f.jsx(Mt,{to:"/runs/$runId",params:{runId:i.filename},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:i.filename})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:i.target??"-"}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:i.experiment??"-"}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:lj(i.timestamp)}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums",children:i.test_count}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Va,{score:i.pass_rate})}),f.jsxs("td",{className:"px-4 py-3 text-right tabular-nums",children:[(i.avg_score*100).toFixed(1),"%"]})]},i.filename))})]})})}function ij(){const{data:n,isLoading:l}=C1();if(l)return f.jsx(rj,{});const i=(n==null?void 0:n.targets)??[];return i.length===0?f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Targets will appear here once evaluations are run with target labels."})]}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Experiments"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:i.map(u=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:u.name}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:u.run_count}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:u.experiment_count}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Va,{score:u.pass_rate})}),f.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[f.jsx("span",{className:"text-emerald-400",children:u.passed_count}),f.jsx("span",{className:"text-gray-600",children:"/"}),f.jsx("span",{children:u.eval_count})]})]},u.name))})]})})}function rj(){return f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("div",{className:"animate-pulse",children:[f.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(n=>f.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[f.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-20 rounded bg-gray-800"})]},n))]})})}const Xy=[{id:"runs",label:"Recent Runs"},{id:"experiments",label:"Experiments"},{id:"targets",label:"Targets"}],uj=ya("/")({component:cj});function cj(){const{data:n,isLoading:l}=$f(),i=((n==null?void 0:n.projects.length)??0)>0;return l?f.jsx(Pg,{}):i?f.jsx(oj,{}):f.jsx(fj,{})}function oj(){const{data:n}=$f(),l=Vi(),[i,u]=F.useState(""),[o,d]=F.useState(""),[h,y]=F.useState(null),[p,g]=F.useState(!1),b=(n==null?void 0:n.projects)??[];async function v(j){if(j.preventDefault(),!!i.trim()){y(null);try{await U1(i.trim()),u(""),g(!1),l.invalidateQueries({queryKey:["projects"]})}catch(N){y(N.message)}}}async function S(j){if(j.preventDefault(),!!o.trim()){y(null);try{const N=await L1(o.trim());d(""),N.length===0&&y("No projects with .agentv/ found in that directory."),l.invalidateQueries({queryKey:["projects"]})}catch(N){y(N.message)}}}return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Projects"}),f.jsx("button",{type:"button",onClick:()=>g(!p),className:"rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500",children:p?"Cancel":"Add Project"})]}),h&&f.jsx("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-3 text-sm text-red-400",children:h}),p&&f.jsxs("div",{className:"space-y-3 rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[f.jsxs("form",{onSubmit:v,className:"flex gap-2",children:[f.jsx("input",{type:"text",value:i,onChange:j=>u(j.target.value),placeholder:"Project path (e.g., /home/user/projects/my-app)",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),f.jsx("button",{type:"submit",className:"rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500",children:"Add"})]}),f.jsxs("form",{onSubmit:S,className:"flex gap-2",children:[f.jsx("input",{type:"text",value:o,onChange:j=>d(j.target.value),placeholder:"Discover projects in directory...",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),f.jsx("button",{type:"submit",className:"rounded-md bg-gray-700 px-3 py-1.5 text-sm font-medium text-white hover:bg-gray-600",children:"Discover"})]})]}),f.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:b.map(j=>f.jsx(sj,{project:j},j.id))})]})}function fj(){const i=Xg().location.search.tab,u=Ou(),{data:o,isLoading:d,error:h}=Zf(),y=Xy.some(p=>p.id===i)?i:"runs";return f.jsxs("div",{className:"space-y-6",children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Evaluation Runs"}),f.jsx("div",{className:"border-b border-gray-800",children:f.jsx("div",{className:"flex gap-1",children:Xy.map(p=>f.jsx("button",{type:"button",onClick:()=>u({to:"/",search:{tab:p.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${y===p.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:p.label},p.id))})}),y==="runs"&&f.jsx(dj,{data:o,isLoading:d,error:h}),y==="experiments"&&f.jsx(tj,{}),y==="targets"&&f.jsx(ij,{})]})}function dj({data:n,isLoading:l,error:i}){return l?f.jsx(Pg,{}):i?f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",i.message]}):f.jsx(If,{runs:(n==null?void 0:n.runs)??[]})}function Pg(){return f.jsx("div",{className:"space-y-2",children:["s1","s2","s3","s4","s5"].map(n=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},n))})}function Ti({label:n,value:l,accent:i}){return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("p",{className:"text-sm text-gray-400",children:n}),f.jsx("p",{className:`mt-1 text-2xl font-semibold tabular-nums ${i??"text-white"}`,children:l})]})}function Tu({total:n,passed:l,failed:i,passRate:u,totalCost:o}){return f.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-5",children:[f.jsx(Ti,{label:"Total",value:String(n)}),f.jsx(Ti,{label:"Passed",value:String(l),accent:"text-emerald-400"}),f.jsx(Ti,{label:"Failed",value:String(i),accent:"text-red-400"}),f.jsx(Ti,{label:"Pass Rate",value:`${Math.round(u*100)}%`,accent:"text-cyan-400"}),o!==void 0&&f.jsx(Ti,{label:"Cost",value:`$${o.toFixed(4)}`,accent:"text-amber-400"})]})}function hj(n,l){const i=new Map;for(const u of n){const o=u.category??"Uncategorized",d=u.dataset??"Uncategorized";i.has(o)||i.set(o,new Map);const h=i.get(o),y=h.get(d)??{passed:0,failed:0,total:0,scoreSum:0};y.total+=1,y.scoreSum+=u.score,wn(u.score,l)?y.passed+=1:y.failed+=1,h.set(d,y)}return Array.from(i.entries()).map(([u,o])=>{const d=Array.from(o.entries()).map(([b,v])=>({name:b,...v,avgScore:v.total>0?v.scoreSum/v.total:0})).sort((b,v)=>b.name.localeCompare(v.name)),h=d.reduce((b,v)=>b+v.total,0),y=d.reduce((b,v)=>b+v.passed,0),p=d.reduce((b,v)=>b+v.failed,0),g=d.reduce((b,v)=>b+v.avgScore*v.total,0);return{name:u,datasets:d,total:h,passed:y,failed:p,avgScore:h>0?g/h:0}}).sort((u,o)=>u.name.localeCompare(o.name))}function $g({results:n,runId:l,projectId:i}){var S;const{data:u}=ps(),o=(u==null?void 0:u.pass_threshold)??.8,d=n.length,h=n.filter(j=>wn(j.score,o)).length,y=d-h,p=d>0?h/d:0,g=n.reduce((j,N)=>j+(N.costUsd??0),0),b=hj(n,o),v=b.length>1;return d===0?f.jsxs("div",{className:"space-y-6",children:[f.jsx(Tu,{total:0,passed:0,failed:0,passRate:0}),f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations found"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"This run has no results yet."})]})]}):f.jsxs("div",{className:"space-y-6",children:[f.jsx(Tu,{total:d,passed:h,failed:y,passRate:p,totalCost:g>0?g:void 0}),v?f.jsxs("div",{className:"space-y-4",children:[f.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Categories"}),b.map(j=>f.jsx(mj,{category:j,runId:l},j.name))]}):f.jsxs("div",{className:"space-y-3",children:[f.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Datasets"}),f.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:(S=b[0])==null?void 0:S.datasets.map(j=>f.jsx(Jg,{dataset:j,runId:l},j.name))})]}),f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Test ID"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Score"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Status"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Duration"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Cost"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map((j,N)=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3",children:i?f.jsx(Mt,{to:"/projects/$projectId/evals/$runId/$evalId",params:{projectId:i,runId:l,evalId:j.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:j.testId}):f.jsx(Mt,{to:"/evals/$runId/$evalId",params:{runId:l,evalId:j.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:j.testId})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:j.target??"-"}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Va,{score:j.score})}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(yj,{status:j.executionStatus})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:j.durationMs!=null?`${(j.durationMs/1e3).toFixed(1)}s`:"-"}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:j.costUsd!=null?`$${j.costUsd.toFixed(4)}`:"-"})]},`${j.testId}-${N}`))})]})})]})}function mj({category:n,runId:l}){const[i,u]=F.useState(!0);return f.jsxs("div",{className:"rounded-lg border border-gray-800",children:[f.jsxs("button",{type:"button",onClick:()=>u(!i),className:"flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-gray-900/50",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("span",{className:"text-xs text-gray-500",children:i?"▼":"▶"}),f.jsx("span",{className:"text-sm font-medium text-gray-200",children:n.name}),f.jsxs("span",{className:"text-xs text-gray-500",children:[n.datasets.length," dataset",n.datasets.length!==1?"s":""]})]}),f.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[f.jsxs("span",{className:"text-emerald-400",children:[n.passed," passed"]}),n.failed>0&&f.jsxs("span",{className:"text-red-400",children:[n.failed," failed"]}),f.jsxs("span",{className:"text-gray-500",children:[n.passed,"/",n.total]})]})]}),i&&f.jsx("div",{className:"border-t border-gray-800 p-3",children:f.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:n.datasets.map(o=>f.jsx(Jg,{dataset:o,runId:l},o.name))})})]})}function Jg({dataset:n,runId:l}){return f.jsxs(Mt,{to:"/runs/$runId/dataset/$dataset",params:{runId:l,dataset:n.name},className:"rounded-lg border border-gray-800 bg-gray-900 p-3 text-left transition-colors hover:border-gray-700",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm font-medium text-gray-200 truncate",children:n.name}),f.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:[n.passed,"/",n.total]})]}),f.jsx("div",{className:"mt-2",children:f.jsx(Va,{score:n.avgScore})}),f.jsxs("div",{className:"mt-1 flex gap-3 text-xs",children:[f.jsxs("span",{className:"text-emerald-400",children:[n.passed," passed"]}),n.failed>0&&f.jsxs("span",{className:"text-red-400",children:[n.failed," failed"]})]})]})}function yj({status:n}){if(!n)return f.jsx("span",{className:"text-gray-500",children:"-"});const l=n==="success"||n==="completed",i=n==="error"||n==="failed";return f.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${l?"bg-emerald-900/50 text-emerald-400":i?"bg-red-900/50 text-red-400":"bg-gray-800 text-gray-400"}`,children:n})}const Ig=ya("/runs/$runId")({component:gj});function gj(){const{runId:n}=Ig.useParams(),{data:l,isLoading:i,error:u}=Xi(n);return i?f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(o=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},o))})]}):u?f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",u.message]}):f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsxs("h1",{className:"text-2xl font-semibold text-white",children:["Run: ",n]}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Source: ",l==null?void 0:l.source]})]}),f.jsx($g,{results:(l==null?void 0:l.results)??[],runId:n})]})}const Ky=[{id:"runs",label:"Recent Runs"},{id:"experiments",label:"Experiments"},{id:"targets",label:"Targets"}],Fg=ya("/projects/$projectId")({component:pj});function pj(){const{projectId:n}=Fg.useParams(),u=Xg().location.search.tab,o=Ou(),d=Ky.some(h=>h.id===u)?u:"runs";return f.jsxs("div",{className:"space-y-6",children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:n}),f.jsx("div",{className:"border-b border-gray-800",children:f.jsx("div",{className:"flex gap-1",children:Ky.map(h=>f.jsx("button",{type:"button",onClick:()=>o({to:"/projects/$projectId",params:{projectId:n},search:{tab:h.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${d===h.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:h.label},h.id))})}),d==="runs"&&f.jsx(vj,{projectId:n}),d==="experiments"&&f.jsx(xj,{projectId:n}),d==="targets"&&f.jsx(bj,{projectId:n})]})}function vj({projectId:n}){const{data:l,isLoading:i,error:u}=Zg(n);return i?f.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(o=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},o))}):u?f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",u.message]}):f.jsx(If,{runs:(l==null?void 0:l.runs)??[],projectId:n})}function xj({projectId:n}){const{data:l,isLoading:i}=oe(Y1(n)),u=(l==null?void 0:l.experiments)??[];return i?f.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(o=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},o))}):u.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No experiments found"})}):f.jsx("div",{className:"space-y-2",children:u.map(o=>f.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[f.jsxs("div",{children:[f.jsx("p",{className:"font-medium text-white",children:o.name}),f.jsxs("p",{className:"text-sm text-gray-400",children:[o.run_count," run",o.run_count!==1?"s":""]})]}),f.jsxs("span",{className:"text-lg font-semibold tabular-nums text-cyan-400",children:[Math.round(o.pass_rate*100),"%"]})]},o.name))})}function bj({projectId:n}){const{data:l,isLoading:i}=oe(G1(n)),u=(l==null?void 0:l.targets)??[];return i?f.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(o=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},o))}):u.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"})}):f.jsx("div",{className:"space-y-2",children:u.map(o=>f.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[f.jsxs("div",{children:[f.jsx("p",{className:"font-medium text-white",children:o.name}),f.jsxs("p",{className:"text-sm text-gray-400",children:[o.run_count," run",o.run_count!==1?"s":""," · ",o.experiment_count," ","experiment",o.experiment_count!==1?"s":""]})]}),f.jsxs("span",{className:"text-lg font-semibold tabular-nums text-cyan-400",children:[Math.round(o.pass_rate*100),"%"]})]},o.name))})}const kg=ya("/experiments/$experimentName")({component:Sj});function Sj(){var v;const{experimentName:n}=kg.useParams(),{data:l,isLoading:i}=Pf(),{data:u,isLoading:o}=Zf();if(i||o)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-4 gap-4",children:["s1","s2","s3","s4"].map(S=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},S))})]});const h=(v=l==null?void 0:l.experiments)==null?void 0:v.find(S=>S.name===n),y=(u==null?void 0:u.runs)??[],p=(h==null?void 0:h.pass_rate)??0,g=(h==null?void 0:h.run_count)??0,b=(h==null?void 0:h.target_count)??0;return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:n}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[g," run",g!==1?"s":""," · ",b," target",b!==1?"s":"",(h==null?void 0:h.last_run)&&f.jsxs("span",{className:"ml-2",children:["· Last run: ",Zy(h.last_run)]})]})]}),h&&f.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-4",children:[f.jsx(mu,{label:"Runs",value:String(g)}),f.jsx(mu,{label:"Targets",value:String(b)}),f.jsx(mu,{label:"Pass Rate",value:`${Math.round(p*100)}%`,accent:"text-cyan-400"}),f.jsx(mu,{label:"Last Run",value:Zy(h.last_run)})]}),f.jsxs("div",{children:[f.jsx("h2",{className:"mb-4 text-lg font-medium text-gray-200",children:"All Runs"}),f.jsx(If,{runs:y})]})]})}function mu({label:n,value:l,accent:i}){return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("p",{className:"text-sm text-gray-400",children:n}),f.jsx("p",{className:`mt-1 text-2xl font-semibold tabular-nums ${i??"text-white"}`,children:l})]})}function Zy(n){if(!n)return"N/A";try{const l=new Date(n);return Number.isNaN(l.getTime())?"N/A":l.toLocaleString()}catch{return"N/A"}}async function jj(n,l){const i=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviews:[{test_id:n,comment:l}]})});if(!i.ok)throw new Error(`Failed to save feedback: ${i.status}`);return i.json()}function Nj({testId:n}){var b;const{data:l}=M1(),i=Vi(),u=(b=l==null?void 0:l.reviews)==null?void 0:b.find(v=>v.test_id===n),[o,d]=F.useState((u==null?void 0:u.comment)??""),[h,y]=F.useState(!1);F.useEffect(()=>{d((u==null?void 0:u.comment)??""),y(!1)},[u==null?void 0:u.comment]);const p=Sb({mutationFn:()=>jj(n,o),onSuccess:()=>{i.invalidateQueries({queryKey:["feedback"]}),y(!0),setTimeout(()=>y(!1),2e3)}}),g=F.useCallback(()=>{p.mutate()},[p]);return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("h4",{className:"mb-2 text-sm font-medium text-gray-400",children:"Feedback"}),f.jsx("textarea",{value:o,onChange:v=>{d(v.target.value),y(!1)},placeholder:"Add feedback for this test...",className:"w-full rounded-md border border-gray-700 bg-gray-800 p-3 text-sm text-gray-200 placeholder-gray-500 focus:border-cyan-400 focus:outline-none",rows:3}),f.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[f.jsx("button",{type:"button",onClick:g,disabled:p.isPending,className:"rounded-md bg-cyan-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-cyan-500 disabled:opacity-50",children:p.isPending?"Saving...":"Save Feedback"}),h&&f.jsx("span",{className:"text-sm text-emerald-400",children:"Saved"}),p.isError&&f.jsx("span",{className:"text-sm text-red-400",children:"Error saving feedback"})]})]})}function Rj(n){var i;switch((i=n.split(".").pop())==null?void 0:i.toLowerCase()){case"ts":case"tsx":return"📘";case"json":return"📋";case"log":case"txt":return"📜";case"md":return"📝";default:return"📄"}}function Wg(n){const l=[];for(const i of n)i.type==="dir"&&(l.push(i.path),i.children&&l.push(...Wg(i.children)));return l}function tp({node:n,selectedPath:l,onSelect:i,openFolders:u,toggleFolder:o,depth:d=0}){const h=n.type==="dir",y=u.has(n.path),p=l===n.path;return f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>{h?o(n.path):i(n.path)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors ${p?"bg-cyan-400/20 text-cyan-400":"text-gray-300 hover:bg-gray-800/50 hover:text-gray-200"}`,style:{paddingLeft:`${d*16+8}px`},children:[f.jsx("span",{className:"flex-shrink-0 text-xs",children:h?y?"📂":"📁":Rj(n.name)}),f.jsx("span",{className:"truncate",children:n.name})]}),h&&y&&n.children&&f.jsx("div",{children:n.children.map(g=>f.jsx(tp,{node:g,selectedPath:l,onSelect:i,openFolders:u,toggleFolder:o,depth:d+1},g.path))})]})}function _j({files:n,selectedPath:l,onSelect:i}){const[u,o]=F.useState(()=>new Set(Wg(n))),d=h=>{o(y=>{const p=new Set(y);return p.has(h)?p.delete(h):p.add(h),p})};return f.jsxs("div",{className:"w-64 overflow-y-auto rounded-lg border border-gray-800 bg-gray-900 py-2",children:[n.length===0&&f.jsx("p",{className:"px-4 py-2 text-sm text-gray-500",children:"No files."}),n.map(h=>f.jsx(tp,{node:h,selectedPath:l,onSelect:i,openFolders:u,toggleFolder:d},h.path))]})}const Ej="modulepreload",Tj=function(n){return"/"+n},Py={},Mj=function(l,i,u){let o=Promise.resolve();if(i&&i.length>0){let h=function(g){return Promise.all(g.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const y=document.querySelector("meta[property=csp-nonce]"),p=(y==null?void 0:y.nonce)||(y==null?void 0:y.getAttribute("nonce"));o=h(i.map(g=>{if(g=Tj(g),g in Py)return;Py[g]=!0;const b=g.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${v}`))return;const S=document.createElement("link");if(S.rel=b?"stylesheet":Ej,b||(S.as="script"),S.crossOrigin="",S.href=g,p&&S.setAttribute("nonce",p),document.head.appendChild(S),b)return new Promise((j,N)=>{S.addEventListener("load",j),S.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(h){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=h,window.dispatchEvent(y),!y.defaultPrevented)throw h}return o.then(h=>{for(const y of h||[])y.status==="rejected"&&d(y.reason);return l().catch(d)})},Cj=F.lazy(()=>Mj(()=>import("./index-zWHsVvgi.js"),[]));function Aj({value:n,language:l="json",height:i="400px"}){return f.jsx(F.Suspense,{fallback:f.jsx("div",{className:"flex items-center justify-center rounded-lg bg-gray-900 p-8 text-gray-500",children:"Loading editor..."}),children:f.jsx(Cj,{height:i,language:l,value:n,theme:"vs-dark",options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,lineNumbers:"on",wordWrap:"on",padding:{top:12}}})})}function ep(n){for(const l of n){if(l.type==="file")return l.path;if(l.children){const i=ep(l.children);if(i)return i}}return null}function ap({eval:n,runId:l,projectId:i}){const[u,o]=F.useState("checks"),d=[{id:"checks",label:"Checks"},{id:"files",label:"Files"},{id:"feedback",label:"Feedback"}];return f.jsxs("div",{className:"flex min-h-full flex-col gap-6",children:[f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h3",{className:"text-lg font-medium",children:n.testId}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[n.target&&f.jsxs("span",{children:["Target: ",n.target]}),n.durationMs!=null&&f.jsxs("span",{className:"ml-4",children:[(n.durationMs/1e3).toFixed(1),"s"]}),n.costUsd!=null&&f.jsxs("span",{className:"ml-4",children:["$",n.costUsd.toFixed(4)]})]})]}),f.jsx("div",{className:"w-48",children:f.jsx(Va,{score:n.score})})]})}),n.scores&&n.scores.length>0&&f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-400",children:"Evaluator Scores"}),f.jsx("div",{className:"space-y-3",children:n.scores.map((h,y)=>f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("span",{className:"w-40 truncate text-sm text-gray-300",children:h.name??h.type??`Score ${y+1}`}),f.jsx("div",{className:"flex-1",children:f.jsx(Va,{score:h.score})})]},`${h.name??h.type??y}`))})]}),f.jsx("div",{className:"border-b border-gray-800",children:f.jsx("div",{className:"flex gap-1",children:d.map(h=>f.jsx("button",{type:"button",onClick:()=>o(h.id),className:`px-4 py-2 text-sm font-medium transition-colors ${u===h.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:h.label},h.id))})}),f.jsxs("div",{className:"min-h-0 flex-1",children:[u==="checks"&&f.jsx(Oj,{result:n}),u==="files"&&f.jsx(zj,{result:n,runId:l,projectId:i}),u==="feedback"&&f.jsx(Nj,{testId:n.testId})]})]})}function Oj({result:n}){const{data:l}=ps(),i=(l==null?void 0:l.pass_threshold)??.8,u=n.assertions??[],o=!wn(n.score,i)||n.executionStatus==="error"||n.executionStatus==="failed",d=[];n.error&&d.push(n.error),(n.executionStatus==="error"||n.executionStatus==="failed")&&d.push(`Execution status: ${n.executionStatus}`);const h=u.filter(y=>!y.passed);for(const y of h){const p=y.evidence?`${y.text}: ${y.evidence}`:y.text;d.push(p)}if(n.scores)for(const y of n.scores){if(!wn(y.score,i)&&y.details){const p=typeof y.details=="string"?y.details:JSON.stringify(y.details,null,2);d.push(`[${y.name??y.type??"evaluator"}] ${p}`)}if(y.assertions){for(const p of y.assertions)if(!p.passed){const g=p.evidence?`${p.text}: ${p.evidence}`:p.text;d.includes(g)||d.push(g)}}}return f.jsxs("div",{className:"space-y-4",children:[u.length===0&&f.jsx("p",{className:"text-sm text-gray-500",children:"No assertion steps recorded."}),u.length>0&&f.jsx("div",{className:"space-y-2",children:u.map(y=>f.jsxs("div",{className:`flex items-start gap-3 rounded-lg border p-3 ${y.passed?"border-emerald-900/50 bg-emerald-950/20":"border-red-900/50 bg-red-950/20"}`,children:[f.jsx("span",{className:`mt-0.5 text-lg ${y.passed?"text-emerald-400":"text-red-400"}`,children:y.passed?"✓":"✗"}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsxs("p",{className:"text-sm text-gray-200",children:[y.text,y.durationMs!=null&&f.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:["(",(y.durationMs/1e3).toFixed(1),"s)"]})]}),y.evidence&&f.jsx("p",{className:"mt-1 text-xs text-gray-400",children:y.evidence})]})]},`${y.text}-${y.passed}`))}),o&&d.length>0&&f.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4",children:[f.jsx("h4",{className:"mb-2 text-sm font-medium text-red-400",children:"Failure Reason"}),f.jsx("div",{className:"space-y-2",children:d.map(y=>f.jsx("p",{className:"text-sm text-gray-300",children:y},y))})]})]})}function zj({result:n,runId:l,projectId:i}){const u=n.testId,{data:o}=i?oe(q1(i,l,u)):A1(l,u),d=(o==null?void 0:o.files)??[],[h,y]=F.useState(null),p=h??(d.length>0?ep(d):null),{data:g,isLoading:b}=i?oe(Q1(i,l,u,p??"")):O1(l,u,p??"");if(d.length===0)return f.jsx("p",{className:"text-sm text-gray-500",children:"No artifact files available."});const v=p?b?"Loading...":(g==null?void 0:g.content)??"":"",S=p?(g==null?void 0:g.language)??"plaintext":"plaintext";return f.jsxs("div",{className:"flex h-full min-h-[400px] gap-4",children:[f.jsx(_j,{files:d,selectedPath:p,onSelect:y}),f.jsx("div",{className:"flex-1",children:f.jsx(Aj,{value:v,language:S,height:"100%"})})]})}const np=ya("/evals/$runId/$evalId")({component:Dj});function Dj(){const{runId:n,evalId:l}=np.useParams(),{data:i,isLoading:u,error:o}=Xi(n);if(u)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",o.message]});const d=i==null?void 0:i.results.find(h=>h.testId===l);return d?f.jsxs("div",{className:"flex h-full flex-col gap-6",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",n," / Eval: ",l]}),f.jsx("h1",{className:"text-2xl font-semibold text-white",children:l})]}),f.jsx(ap,{eval:d,runId:n})]}):f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:f.jsxs("p",{className:"text-gray-400",children:["Eval ",f.jsx("code",{className:"text-cyan-400",children:l})," not found in run"," ",f.jsx("code",{className:"text-cyan-400",children:n}),"."]})})}const sp=ya("/runs/$runId_/dataset/$dataset")({component:wj});function wj(){const{runId:n,dataset:l}=sp.useParams(),{data:i,isLoading:u,error:o}=Xi(n),{data:d}=ps(),h=(d==null?void 0:d.pass_threshold)??.8;if(u)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(j=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},j))})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",o.message]});const y=((i==null?void 0:i.results)??[]).filter(j=>(j.dataset??"Uncategorized")===l),p=y.length,g=y.filter(j=>wn(j.score,h)).length,b=p-g,v=p>0?g/p:0,S=y.reduce((j,N)=>j+(N.costUsd??0),0);return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:l}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Dataset in run: ",n]})]}),f.jsx(Tu,{total:p,passed:g,failed:b,passRate:v,totalCost:S>0?S:void 0}),p===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations in this dataset"})}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Test ID"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Score"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Status"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Duration"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Cost"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:y.map((j,N)=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3",children:f.jsx(Mt,{to:"/evals/$runId/$evalId",params:{runId:n,evalId:j.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:j.testId})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:j.target??"-"}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Va,{score:j.score})}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Uj,{status:j.executionStatus})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:j.durationMs!=null?`${(j.durationMs/1e3).toFixed(1)}s`:"-"}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:j.costUsd!=null?`$${j.costUsd.toFixed(4)}`:"-"})]},`${j.testId}-${N}`))})]})})]})}function Uj({status:n}){if(!n)return f.jsx("span",{className:"text-gray-500",children:"-"});const l=n==="success"||n==="completed",i=n==="error"||n==="failed";return f.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${l?"bg-emerald-900/50 text-emerald-400":i?"bg-red-900/50 text-red-400":"bg-gray-800 text-gray-400"}`,children:n})}const lp=ya("/runs/$runId_/category/$category")({component:Lj});function Lj(){const{runId:n,category:l}=lp.useParams(),{data:i,isLoading:u,error:o}=Kg(n,l);if(u)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(b=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},b))})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load category: ",o.message]});const d=(i==null?void 0:i.datasets)??[],h=d.reduce((b,v)=>b+v.total,0),y=d.reduce((b,v)=>b+v.passed,0),p=h-y,g=h>0?y/h:0;return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:l}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Category in run: ",n]})]}),f.jsx(Tu,{total:h,passed:y,failed:p,passRate:g}),d.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No datasets in this category"})}):f.jsxs("div",{className:"space-y-3",children:[f.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Datasets"}),f.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:d.map(b=>f.jsxs(Mt,{to:"/runs/$runId/dataset/$dataset",params:{runId:n,dataset:b.name},className:"rounded-lg border border-gray-800 bg-gray-900 p-3 text-left transition-colors hover:border-gray-700",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm font-medium text-gray-200 truncate",children:b.name}),f.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:[b.passed,"/",b.total]})]}),f.jsx("div",{className:"mt-2",children:f.jsx(Va,{score:b.avg_score})}),f.jsxs("div",{className:"mt-1 flex gap-3 text-xs",children:[f.jsxs("span",{className:"text-emerald-400",children:[b.passed," passed"]}),b.failed>0&&f.jsxs("span",{className:"text-red-400",children:[b.failed," failed"]})]})]},b.name))})]})]})}const ip=ya("/projects/$projectId_/runs/$runId")({component:Bj});function Bj(){const{projectId:n,runId:l}=ip.useParams(),{data:i,isLoading:u,error:o}=Jf(n,l);return u?f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(d=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},d))})]}):o?f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",o.message]}):f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsxs("h1",{className:"text-2xl font-semibold text-white",children:["Run: ",l]}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Source: ",i==null?void 0:i.source]})]}),f.jsx($g,{results:(i==null?void 0:i.results)??[],runId:l,projectId:n})]})}const rp=ya("/projects/$projectId_/evals/$runId/$evalId")({component:Hj});function Hj(){const{projectId:n,runId:l,evalId:i}=rp.useParams(),{data:u,isLoading:o,error:d}=Jf(n,l);if(o)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(d)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",d.message]});const h=u==null?void 0:u.results.find(y=>y.testId===i);return h?f.jsxs("div",{className:"flex h-full flex-col gap-6",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",l," / Eval: ",i]}),f.jsx("h1",{className:"text-2xl font-semibold text-white",children:i})]}),f.jsx(ap,{eval:h,runId:l,projectId:n})]}):f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:f.jsxs("p",{className:"text-gray-400",children:["Eval ",f.jsx("code",{className:"text-cyan-400",children:i})," not found in run"," ",f.jsx("code",{className:"text-cyan-400",children:l}),"."]})})}const qj=k1.update({id:"/settings",path:"/settings",getParentRoute:()=>sa}),Qj=uj.update({id:"/",path:"/",getParentRoute:()=>sa}),Yj=Ig.update({id:"/runs/$runId",path:"/runs/$runId",getParentRoute:()=>sa}),Gj=Fg.update({id:"/projects/$projectId",path:"/projects/$projectId",getParentRoute:()=>sa}),Vj=kg.update({id:"/experiments/$experimentName",path:"/experiments/$experimentName",getParentRoute:()=>sa}),Xj=np.update({id:"/evals/$runId/$evalId",path:"/evals/$runId/$evalId",getParentRoute:()=>sa}),Kj=sp.update({id:"/runs/$runId_/dataset/$dataset",path:"/runs/$runId/dataset/$dataset",getParentRoute:()=>sa}),Zj=lp.update({id:"/runs/$runId_/category/$category",path:"/runs/$runId/category/$category",getParentRoute:()=>sa}),Pj=ip.update({id:"/projects/$projectId_/runs/$runId",path:"/projects/$projectId/runs/$runId",getParentRoute:()=>sa}),$j=rp.update({id:"/projects/$projectId_/evals/$runId/$evalId",path:"/projects/$projectId/evals/$runId/$evalId",getParentRoute:()=>sa}),Jj={IndexRoute:Qj,SettingsRoute:qj,ExperimentsExperimentNameRoute:Vj,ProjectsProjectIdRoute:Gj,RunsRunIdRoute:Yj,EvalsRunIdEvalIdRoute:Xj,ProjectsProjectIdRunsRunIdRoute:Pj,RunsRunIdCategoryCategoryRoute:Zj,RunsRunIdDatasetDatasetRoute:Kj,ProjectsProjectIdEvalsRunIdEvalIdRoute:$j},Ij=sa._addFileChildren(Jj)._addFileTypes(),Fj=new ub({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!0}}}),kj=h1({routeTree:Ij}),up=document.getElementById("root");if(!up)throw new Error("Root element not found");Bx.createRoot(up).render(f.jsx(F.StrictMode,{children:f.jsx(cb,{client:Fj,children:f.jsx(g1,{router:kj})})}));export{Ai as W,F as r};
65
+ */var qy;function BS(){if(qy)return cf;qy=1;var n=Gi(),l=LS();function i(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var u=typeof Object.is=="function"?Object.is:i,o=l.useSyncExternalStore,d=n.useRef,h=n.useEffect,y=n.useMemo,p=n.useDebugValue;return cf.useSyncExternalStoreWithSelector=function(g,b,v,S,j){var N=d(null);if(N.current===null){var M={hasValue:!1,value:null};N.current=M}else M=N.current;N=y(function(){function U(k){if(!$){if($=!0,K=k,k=S(k),j!==void 0&&M.hasValue){var Z=M.value;if(j(Z,k))return L=Z}return L=k}if(Z=L,u(K,k))return Z;var P=S(k);return j!==void 0&&j(Z,P)?(K=k,Z):(K=k,L=P)}var $=!1,K,L,X=v===void 0?null:v;return[function(){return U(b())},X===null?void 0:function(){return U(X())}]},[b,v,S,j]);var C=o(g,N[0],N[1]);return h(function(){M.hasValue=!0,M.value=C},[C]),p(C),C},cf}var Qy;function HS(){return Qy||(Qy=1,uf.exports=BS()),uf.exports}var qS=HS();function QS(n,l){return n===l}function ye(n,l,i=QS){const u=F.useCallback(h=>{if(!n)return()=>{};const{unsubscribe:y}=n.subscribe(h);return y},[n]),o=F.useCallback(()=>n==null?void 0:n.get(),[n]);return qS.useSyncExternalStoreWithSelector(u,o,o,l,i)}var YS={state:void 0,get:()=>{},subscribe:()=>()=>{}};function gs(n){const l=be(),i=F.useContext(n.from?MS:Au),u=n.from??i,o=u?n.from?l.stores.getMatchStoreByRouteId(u):l.stores.activeMatchStoresById.get(u):void 0,d=F.useRef(void 0);return ye(o??YS,h=>{if((n.shouldThrow??!0)&&!h&&Ya(),h===void 0)return;const y=n.select?n.select(h):h;if(n.structuralSharing??l.options.defaultStructuralSharing){const p=Cn(d.current,y);return d.current=p,p}return y})}function Ug(n){return gs({from:n.from,strict:n.strict,structuralSharing:n.structuralSharing,select:l=>n.select?n.select(l.loaderData):l.loaderData})}function Lg(n){const{select:l,...i}=n;return gs({...i,select:u=>l?l(u.loaderDeps):u.loaderDeps})}function Bg(n){return gs({from:n.from,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,strict:n.strict,select:l=>{const i=n.strict===!1?l.params:l._strictParams;return n.select?n.select(i):i}})}function Hg(n){return gs({from:n.from,strict:n.strict,shouldThrow:n.shouldThrow,structuralSharing:n.structuralSharing,select:l=>n.select?n.select(l.search):l.search})}function Ou(n){const l=be();return F.useCallback(i=>l.navigate({...i,from:i.from??(n==null?void 0:n.from)}),[n==null?void 0:n.from,l])}function qg(n){return gs({...n,select:l=>n.select?n.select(l.context):l.context})}var GS=lg();function VS(n,l){const i=be(),u=Nb(l),{activeProps:o,inactiveProps:d,activeOptions:h,to:y,preload:p,preloadDelay:g,hashScrollIntoView:b,replace:v,startTransition:S,resetScroll:j,viewTransition:N,children:M,target:C,disabled:U,style:$,className:K,onClick:L,onBlur:X,onFocus:k,onMouseEnter:Z,onMouseLeave:P,onTouchStart:J,ignoreBlocker:G,params:I,search:lt,hash:it,state:ot,mask:nt,reloadDocument:D,unsafeRelative:V,from:at,_fromLocation:yt,...ft}=n,E=Cg(),Q=F.useMemo(()=>n,[i,n.from,n._fromLocation,n.hash,n.to,n.search,n.params,n.state,n.mask,n.unsafeRelative]),W=ye(i.stores.location,St=>St,(St,de)=>St.href===de.href),tt=F.useMemo(()=>{const St={_fromLocation:W,...Q};return i.buildLocation(St)},[i,W,Q]),ht=tt.maskedLocation?tt.maskedLocation.publicHref:tt.publicHref,xt=tt.maskedLocation?tt.maskedLocation.external:tt.external,bt=F.useMemo(()=>JS(ht,xt,i.history,U),[U,xt,ht,i.history]),Pt=F.useMemo(()=>{if(bt!=null&&bt.external)return ju(bt.href,i.protocolAllowlist)?void 0:bt.href;if(!IS(y)&&!(typeof y!="string"||y.indexOf(":")===-1))try{return new URL(y),ju(y,i.protocolAllowlist)?void 0:y}catch{}},[y,bt,i.protocolAllowlist]),qt=F.useMemo(()=>{if(Pt)return!1;if(h!=null&&h.exact){if(!Yb(W.pathname,tt.pathname,i.basepath))return!1}else{const St=Nu(W.pathname,i.basepath),de=Nu(tt.pathname,i.basepath);if(!(St.startsWith(de)&&(St.length===de.length||St[de.length]==="/")))return!1}return((h==null?void 0:h.includeSearch)??!0)&&!ds(W.search,tt.search,{partial:!(h!=null&&h.exact),ignoreUndefined:!(h!=null&&h.explicitUndefined)})?!1:h!=null&&h.includeHash?E&&W.hash===tt.hash:!0},[h==null?void 0:h.exact,h==null?void 0:h.explicitUndefined,h==null?void 0:h.includeHash,h==null?void 0:h.includeSearch,W,Pt,E,tt.hash,tt.pathname,tt.search,i.basepath]),la=qt?Mn(o,{})??XS:df,ga=qt?df:Mn(d,{})??df,vs=[K,la.className,ga.className].filter(Boolean).join(" "),El=($||la.style||ga.style)&&{...$,...la.style,...ga.style},[pa,xs]=F.useState(!1),bs=F.useRef(!1),Xa=n.reloadDocument||Pt?!1:p??i.options.defaultPreload,Ss=g??i.options.defaultPreloadDelay??0,We=F.useCallback(()=>{i.preloadRoute({...Q,_builtLocation:tt}).catch(St=>{console.warn(St),console.warn(jS)})},[i,Q,tt]);jb(u,F.useCallback(St=>{St!=null&&St.isIntersecting&&We()},[We]),$S,{disabled:!!U||Xa!=="viewport"}),F.useEffect(()=>{bs.current||!U&&Xa==="render"&&(We(),bs.current=!0)},[U,We,Xa]);const Tl=St=>{const de=St.currentTarget.getAttribute("target"),ia=C!==void 0?C:de;if(!U&&!FS(St)&&!St.defaultPrevented&&(!ia||ia==="_self")&&St.button===0){St.preventDefault(),GS.flushSync(()=>{xs(!0)});const Zi=i.subscribe("onResolved",()=>{Zi(),xs(!1)});i.navigate({...Q,replace:v,resetScroll:j,hashScrollIntoView:b,startTransition:S,viewTransition:N,ignoreBlocker:G})}};if(Pt)return{...ft,ref:u,href:Pt,...M&&{children:M},...C&&{target:C},...U&&{disabled:U},...$&&{style:$},...K&&{className:K},...L&&{onClick:L},...X&&{onBlur:X},...k&&{onFocus:k},...Z&&{onMouseEnter:Z},...P&&{onMouseLeave:P},...J&&{onTouchStart:J}};const js=St=>{if(U||Xa!=="intent")return;if(!Ss){We();return}const de=St.currentTarget;if(Ei.has(de))return;const ia=setTimeout(()=>{Ei.delete(de),We()},Ss);Ei.set(de,ia)},zu=St=>{U||Xa!=="intent"||We()},Ki=St=>{if(U||!Xa||!Ss)return;const de=St.currentTarget,ia=Ei.get(de);ia&&(clearTimeout(ia),Ei.delete(de))};return{...ft,...la,...ga,href:bt==null?void 0:bt.href,ref:u,onClick:rl([L,Tl]),onBlur:rl([X,Ki]),onFocus:rl([k,js]),onMouseEnter:rl([Z,js]),onMouseLeave:rl([P,Ki]),onTouchStart:rl([J,zu]),disabled:!!U,target:C,...El&&{style:El},...vs&&{className:vs},...U&&KS,...qt&&ZS,...E&&pa&&PS}}var df={},XS={className:"active"},KS={role:"link","aria-disabled":!0},ZS={"data-status":"active","aria-current":"page"},PS={"data-transitioning":"transitioning"},Ei=new WeakMap,$S={rootMargin:"100px"},rl=n=>l=>{for(const i of n)if(i){if(l.defaultPrevented)return;i(l)}};function JS(n,l,i,u){if(!u)return l?{href:n,external:!0}:{href:i.createHref(n)||"/",external:!1}}function IS(n){if(typeof n!="string")return!1;const l=n.charCodeAt(0);return l===47?n.charCodeAt(1)!==47:l===46}var Mt=F.forwardRef((n,l)=>{const{_asChild:i,...u}=n,{type:o,...d}=VS(u,l),h=typeof u.children=="function"?u.children({isActive:d["data-status"]==="active"}):u.children;if(!i){const{disabled:y,...p}=d;return F.createElement("a",p,h)}return F.createElement(i,d,h)});function FS(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}var kS=class extends Mg{constructor(l){super(l),this.useMatch=i=>gs({select:i==null?void 0:i.select,from:this.id,structuralSharing:i==null?void 0:i.structuralSharing}),this.useRouteContext=i=>qg({...i,from:this.id}),this.useSearch=i=>Hg({select:i==null?void 0:i.select,structuralSharing:i==null?void 0:i.structuralSharing,from:this.id}),this.useParams=i=>Bg({select:i==null?void 0:i.select,structuralSharing:i==null?void 0:i.structuralSharing,from:this.id}),this.useLoaderDeps=i=>Lg({...i,from:this.id}),this.useLoaderData=i=>Ug({...i,from:this.id}),this.useNavigate=()=>Ou({from:this.fullPath}),this.Link=Ai.forwardRef((i,u)=>f.jsx(Mt,{ref:u,from:this.fullPath,...i}))}};function WS(n){return new kS(n)}var t1=class extends NS{constructor(n){super(n),this.useMatch=l=>gs({select:l==null?void 0:l.select,from:this.id,structuralSharing:l==null?void 0:l.structuralSharing}),this.useRouteContext=l=>qg({...l,from:this.id}),this.useSearch=l=>Hg({select:l==null?void 0:l.select,structuralSharing:l==null?void 0:l.structuralSharing,from:this.id}),this.useParams=l=>Bg({select:l==null?void 0:l.select,structuralSharing:l==null?void 0:l.structuralSharing,from:this.id}),this.useLoaderDeps=l=>Lg({...l,from:this.id}),this.useLoaderData=l=>Ug({...l,from:this.id}),this.useNavigate=()=>Ou({from:this.fullPath}),this.Link=Ai.forwardRef((l,i)=>f.jsx(Mt,{ref:i,from:this.fullPath,...l}))}};function e1(n){return new t1(n)}function ya(n){return typeof n=="object"?new Yy(n,{silent:!0}).createRoute(n):new Yy(n,{silent:!0}).createRoute}var Yy=class{constructor(n,l){this.path=n,this.createRoute=i=>{const u=WS(i);return u.isRoot=!1,u},this.silent=l==null?void 0:l.silent}};function a1(n){const l=be(),i=`not-found-${ye(l.stores.location,u=>u.pathname)}-${ye(l.stores.status,u=>u)}`;return f.jsx(Vf,{getResetKey:()=>i,onCatch:(u,o)=>{var d;if(xe(u))(d=n.onCatch)==null||d.call(n,u,o);else throw u},errorComponent:({error:u})=>{var o;if(xe(u))return(o=n.fallback)==null?void 0:o.call(n,u);throw u},children:n.children})}function n1(){return f.jsx("p",{children:"Not Found"})}function ul(n){return f.jsx(f.Fragment,{children:n.children})}function Qg(n,l,i){return l.options.notFoundComponent?f.jsx(l.options.notFoundComponent,{...i}):n.options.defaultNotFoundComponent?f.jsx(n.options.defaultNotFoundComponent,{...i}):f.jsx(n1,{})}function s1(n){return null}function l1(){return s1(be()),null}var Yg=F.memo(function({matchId:l}){const i=be(),u=i.stores.activeMatchStoresById.get(l);u||Ya();const o=ye(i.stores.loadedAt,h=>h),d=ye(u,h=>h);return f.jsx(i1,{router:i,matchId:l,resetKey:o,matchState:F.useMemo(()=>{var p;const h=d.routeId,y=(p=i.routesById[h].parentRoute)==null?void 0:p.id;return{routeId:h,ssr:d.ssr,_displayPending:d._displayPending,parentRouteId:y}},[d._displayPending,d.routeId,d.ssr,i.routesById])})});function i1({router:n,matchId:l,resetKey:i,matchState:u}){var N,M;const o=n.routesById[u.routeId],d=o.options.pendingComponent??n.options.defaultPendingComponent,h=d?f.jsx(d,{}):null,y=o.options.errorComponent??n.options.defaultErrorComponent,p=o.options.onCatch??n.options.defaultOnCatch,g=o.isRoot?o.options.notFoundComponent??((N=n.options.notFoundRoute)==null?void 0:N.options.component):o.options.notFoundComponent,b=u.ssr===!1||u.ssr==="data-only",v=(!o.isRoot||o.options.wrapInSuspense||b)&&(o.options.wrapInSuspense??d??(((M=o.options.errorComponent)==null?void 0:M.preload)||b))?F.Suspense:ul,S=y?Vf:ul,j=g?a1:ul;return f.jsxs(o.isRoot?o.options.shellComponent??ul:ul,{children:[f.jsx(Au.Provider,{value:l,children:f.jsx(v,{fallback:h,children:f.jsx(S,{getResetKey:()=>i,errorComponent:y||Xf,onCatch:(C,U)=>{if(xe(C))throw C;p==null||p(C,U)},children:f.jsx(j,{fallback:C=>{if(!g||C.routeId&&C.routeId!==u.routeId||!C.routeId&&!o.isRoot)throw C;return F.createElement(g,C)},children:b||u._displayPending?f.jsx(ES,{fallback:h,children:f.jsx(Gy,{matchId:l})}):f.jsx(Gy,{matchId:l})})})})}),u.parentRouteId===hs?f.jsxs(f.Fragment,{children:[f.jsx(r1,{resetKey:i}),n.options.scrollRestoration&&vg?f.jsx(l1,{}):null]}):null]})}function r1({resetKey:n}){const l=be(),i=F.useRef(void 0);return Ci(()=>{const u=l.latestLocation.href;(i.current===void 0||i.current!==u)&&(l.emit({type:"onRendered",...cl(l.stores.location.state,l.stores.resolvedLocation.state)}),i.current=u)},[l.latestLocation.state.__TSR_key,n,l]),null}var Gy=F.memo(function({matchId:l}){var g,b,v,S;const i=be(),u=i.stores.activeMatchStoresById.get(l);u||Ya();const o=ye(u,j=>j),d=o.routeId,h=i.routesById[d],y=F.useMemo(()=>{var N;const j=(N=i.routesById[d].options.remountDeps??i.options.defaultRemountDeps)==null?void 0:N({routeId:d,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return j?JSON.stringify(j):void 0},[d,o.loaderDeps,o._strictParams,o._strictSearch,i.options.defaultRemountDeps,i.routesById]),p=F.useMemo(()=>{const j=h.options.component??i.options.defaultComponent;return j?f.jsx(j,{},y):f.jsx(Gg,{})},[y,h.options.component,i.options.defaultComponent]);if(o._displayPending)throw(g=i.getMatch(o.id))==null?void 0:g._nonReactive.displayPendingPromise;if(o._forcePending)throw(b=i.getMatch(o.id))==null?void 0:b._nonReactive.minPendingPromise;if(o.status==="pending"){const j=h.options.pendingMinMs??i.options.defaultPendingMinMs;if(j){const N=i.getMatch(o.id);if(N&&!N._nonReactive.minPendingPromise){const M=Nl();N._nonReactive.minPendingPromise=M,setTimeout(()=>{M.resolve(),N._nonReactive.minPendingPromise=void 0},j)}}throw(v=i.getMatch(o.id))==null?void 0:v._nonReactive.loadPromise}if(o.status==="notFound")return xe(o.error)||Ya(),Qg(i,h,o.error);if(o.status==="redirected")throw Ae(o.error)||Ya(),(S=i.getMatch(o.id))==null?void 0:S._nonReactive.loadPromise;if(o.status==="error")throw o.error;return p}),Gg=F.memo(function(){const l=be(),i=F.useContext(Au);let u,o=!1,d;{const g=i?l.stores.activeMatchStoresById.get(i):void 0;[u,o]=ye(g,b=>[b==null?void 0:b.routeId,(b==null?void 0:b.globalNotFound)??!1]),d=ye(l.stores.matchesId,b=>b[b.findIndex(v=>v===i)+1])}const h=u?l.routesById[u]:void 0,y=l.options.defaultPendingComponent?f.jsx(l.options.defaultPendingComponent,{}):null;if(o)return h||Ya(),Qg(l,h,void 0);if(!d)return null;const p=f.jsx(Yg,{matchId:d});return u===hs?f.jsx(F.Suspense,{fallback:y,children:p}):p});function u1(){const n=be(),l=F.useRef({router:n,mounted:!1}),[i,u]=F.useState(!1),o=ye(n.stores.isLoading,v=>v),d=ye(n.stores.hasPendingMatches,v=>v),h=Wo(o),y=o||i||d,p=Wo(y),g=o||d,b=Wo(g);return n.startTransition=v=>{u(!0),F.startTransition(()=>{v(),u(!1)})},F.useEffect(()=>{const v=n.history.subscribe(n.load),S=n.buildLocation({to:n.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return zn(n.latestLocation.publicHref)!==zn(S.publicHref)&&n.commitLocation({...S,replace:!0}),()=>{v()}},[n,n.history]),Ci(()=>{if(typeof window<"u"&&n.ssr||l.current.router===n&&l.current.mounted)return;l.current={router:n,mounted:!0},(async()=>{try{await n.load()}catch(S){console.error(S)}})()},[n]),Ci(()=>{h&&!o&&n.emit({type:"onLoad",...cl(n.stores.location.state,n.stores.resolvedLocation.state)})},[h,n,o]),Ci(()=>{b&&!g&&n.emit({type:"onBeforeRouteMount",...cl(n.stores.location.state,n.stores.resolvedLocation.state)})},[g,b,n]),Ci(()=>{if(p&&!y){const v=cl(n.stores.location.state,n.stores.resolvedLocation.state);n.emit({type:"onResolved",...v}),zg(()=>{n.stores.status.setState(()=>"idle"),n.stores.resolvedLocation.setState(()=>n.stores.location.state)}),v.hrefChanged&&RS(n)}},[y,p,n]),null}function c1(){const n=be(),l=n.routesById[hs].options.pendingComponent??n.options.defaultPendingComponent,i=l?f.jsx(l,{}):null,u=f.jsxs(typeof document<"u"&&n.ssr?ul:F.Suspense,{fallback:i,children:[f.jsx(u1,{}),f.jsx(o1,{})]});return n.options.InnerWrap?f.jsx(n.options.InnerWrap,{children:u}):u}function o1(){const n=be(),l=ye(n.stores.firstMatchId,o=>o),i=ye(n.stores.loadedAt,o=>o),u=l?f.jsx(Yg,{matchId:l}):null;return f.jsx(Au.Provider,{value:l,children:n.options.disableGlobalCatchBoundary?u:f.jsx(Vf,{getResetKey:()=>i,errorComponent:Xf,onCatch:void 0,children:u})})}function Vg(){const n=be();return ye(n.stores.matchRouteReactivity,l=>l),F.useCallback(l=>{const{pending:i,caseSensitive:u,fuzzy:o,includeSearch:d,...h}=l;return n.matchRoute(h,{pending:i,caseSensitive:u,fuzzy:o,includeSearch:d})},[n])}function f1(n){const l=be(),i=F.useRef(void 0);return ye(l.stores.activeMatchesSnapshot,u=>{const o=u;if(l.options.defaultStructuralSharing){const d=Cn(i.current,o);return i.current=d,d}return o})}var d1=n=>({createMutableStore:Ly,createReadonlyStore:Ly,batch:zg}),h1=n=>new m1(n),m1=class extends yS{constructor(n){super(n,d1)}};function y1({router:n,children:l,...i}){Object.keys(i).length>0&&n.update({...n.options,...i,context:{...n.options.context,...i.context}});const u=f.jsx(Ag.Provider,{value:n,children:l});return n.options.Wrap?f.jsx(n.options.Wrap,{children:u}):u}function g1({router:n,...l}){return f.jsx(y1,{router:n,...l,children:f.jsx(c1,{})})}function Xg(n){const i=be();return F.useRef(void 0),ye(i.stores.__store,u=>u)}function p1(n){const l=[];for(let i=1;i<n.length;i++){const u=n[i],o=u.routeId??u.id,d=u.params;o==="/"||o==="/_layout"||(o.includes("/runs/$runId/category/$category")?(l.some(h=>h.label===d.runId)||l.push({label:d.runId??"Run",to:`/runs/${encodeURIComponent(d.runId)}`}),l.push({label:d.category??"Category",to:u.pathname})):o.includes("/runs/$runId/dataset/$dataset")?l.push({label:d.dataset??"Dataset",to:u.pathname}):o.includes("/runs/$runId")?l.push({label:d.runId??"Run",to:u.pathname}):o.includes("/evals/$runId/$evalId")?(l.some(h=>h.label===d.runId)||l.push({label:d.runId??"Run",to:`/runs/${encodeURIComponent(d.runId)}`}),l.push({label:d.evalId??"Eval",to:u.pathname})):o.includes("/experiments/$experimentName")?l.push({label:d.experimentName??"Experiment",to:u.pathname}):(o==="/index"||o==="/")&&l.push({label:"Home",to:"/"}))}return l}function v1(){const n=f1(),l=p1(n);return l.length===0?null:f.jsxs("div",{className:"flex items-center gap-2 border-b border-gray-800 bg-gray-950 px-6 py-2 text-sm",children:[f.jsx(Mt,{to:"/",className:"text-cyan-400 hover:text-cyan-300 hover:underline",children:"Home"}),l.map((i,u)=>{const o=u===l.length-1;return f.jsxs("span",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"text-gray-600",children:">"}),o?f.jsx("span",{className:"text-gray-400",children:i.label}):f.jsx(Mt,{to:i.to??"/",className:"text-cyan-400 hover:text-cyan-300 hover:underline",children:i.label})]},`${i.label}-${u}`)})]})}async function fe(n){const l=await fetch(n);if(!l.ok)throw new Error(`API error: ${l.status} ${l.statusText}`);return l.json()}const x1={queryKey:["runs"],queryFn:()=>fe("/api/runs"),refetchInterval:5e3};function b1(n){return{queryKey:["runs",n],queryFn:()=>fe(`/api/runs/${encodeURIComponent(n)}`),enabled:!!n}}const S1={queryKey:["feedback"],queryFn:()=>fe("/api/feedback")},j1={queryKey:["experiments"],queryFn:()=>fe("/api/experiments")},N1={queryKey:["targets"],queryFn:()=>fe("/api/targets")};function R1(n,l){return{queryKey:["runs",n,"evals",l,"files"],queryFn:()=>fe(`/api/runs/${encodeURIComponent(n)}/evals/${encodeURIComponent(l)}/files`),enabled:!!n&&!!l}}function _1(n,l,i){return{queryKey:["runs",n,"evals",l,"files",i],queryFn:()=>fe(`/api/runs/${encodeURIComponent(n)}/evals/${encodeURIComponent(l)}/files/${i}`),enabled:!!n&&!!l&&!!i}}function E1(n,l){return{queryKey:["runs",n,"categories",l,"datasets"],queryFn:()=>fe(`/api/runs/${encodeURIComponent(n)}/categories/${encodeURIComponent(l)}/datasets`),enabled:!!n&&!!l}}const T1={queryKey:["config"],queryFn:()=>fe("/api/config"),staleTime:5e3};function Zf(){return oe(x1)}function Xi(n){return oe(b1(n))}function M1(){return oe(S1)}function Pf(){return oe(j1)}function C1(){return oe(N1)}function A1(n,l){return oe(R1(n,l))}function O1(n,l,i){return oe(_1(n,l,i))}function Kg(n,l){return oe(E1(n,l))}function ps(){return oe(T1)}const zf=.8;function wn(n,l=zf){return n>=l}const z1={queryKey:["projects"],queryFn:()=>fe("/api/projects"),refetchInterval:1e4};function $f(){return oe(z1)}const D1={queryKey:["projects","all-runs"],queryFn:()=>fe("/api/projects/all-runs"),refetchInterval:5e3};function w1(){return oe(D1)}async function U1(n){const l=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});if(!l.ok){const i=await l.json();throw new Error(i.error||`Failed to add project: ${l.status}`)}return l.json()}async function L1(n){const l=await fetch("/api/projects/discover",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});if(!l.ok){const u=await l.json();throw new Error(u.error||`Failed to discover: ${l.status}`)}return(await l.json()).discovered}function _l(n){return`/api/projects/${encodeURIComponent(n)}`}function B1(n){return{queryKey:["projects",n,"runs"],queryFn:()=>fe(`${_l(n)}/runs`),enabled:!!n,refetchInterval:5e3}}function Zg(n){return oe(B1(n))}function H1(n,l){return{queryKey:["projects",n,"runs",l],queryFn:()=>fe(`${_l(n)}/runs/${encodeURIComponent(l)}`),enabled:!!n&&!!l}}function Jf(n,l){return oe(H1(n,l))}function q1(n,l,i){return{queryKey:["projects",n,"runs",l,"evals",i,"files"],queryFn:()=>fe(`${_l(n)}/runs/${encodeURIComponent(l)}/evals/${encodeURIComponent(i)}/files`),enabled:!!n&&!!l&&!!i}}function Q1(n,l,i,u){return{queryKey:["projects",n,"runs",l,"evals",i,"files",u],queryFn:()=>fe(`${_l(n)}/runs/${encodeURIComponent(l)}/evals/${encodeURIComponent(i)}/files/${u}`),enabled:!!n&&!!l&&!!i&&!!u}}function Y1(n){return{queryKey:["projects",n,"experiments"],queryFn:()=>fe(`${_l(n)}/experiments`),enabled:!!n}}function G1(n){return{queryKey:["projects",n,"targets"],queryFn:()=>fe(`${_l(n)}/targets`),enabled:!!n}}async function V1(n){const l=await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!l.ok)throw new Error(`Failed to save config: ${l.status}`);return l.json()}function X1(){const n=Vg(),l=n({to:"/projects/$projectId/evals/$runId/$evalId",fuzzy:!0}),i=n({to:"/projects/$projectId/runs/$runId",fuzzy:!0}),u=n({to:"/projects/$projectId",fuzzy:!0});if(l&&typeof l=="object"&&"projectId"in l){const{projectId:p,runId:g,evalId:b}=l;return f.jsx(J1,{projectId:p,runId:g,currentEvalId:b})}if(i&&typeof i=="object"&&"projectId"in i){const{projectId:p,runId:g}=i;return f.jsx(Vy,{projectId:p,currentRunId:g})}if(u&&typeof u=="object"&&"projectId"in u){const{projectId:p}=u;return f.jsx(Vy,{projectId:p})}const o=n({to:"/evals/$runId/$evalId",fuzzy:!0}),d=n({to:"/runs/$runId/category/$category",fuzzy:!0}),h=n({to:"/runs/$runId/dataset/$dataset",fuzzy:!0}),y=n({to:"/experiments/$experimentName",fuzzy:!0});if(d&&typeof d=="object"&&"runId"in d){const{runId:p,category:g}=d;return f.jsx($1,{runId:p,category:g})}if(h&&typeof h=="object"&&"runId"in h){const{runId:p,dataset:g}=h;return f.jsx(P1,{runId:p,dataset:g})}if(o&&typeof o=="object"&&"runId"in o){const{runId:p,evalId:g}=o;return f.jsx(Z1,{runId:p,currentEvalId:g})}if(y&&typeof y=="object"&&"experimentName"in y){const{experimentName:p}=y;return f.jsx(I1,{currentExperiment:p})}return f.jsx(K1,{})}function K1(){const n=Vg(),{data:l}=$f(),i=((l==null?void 0:l.projects.length)??0)>0,u=n({to:"/"}),o=n({to:"/runs/$runId",fuzzy:!0}),d=i&&u!==!1,{data:h}=Zf(),{data:y}=w1(),p=d?y:h;return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Runs"}),p==null?void 0:p.runs.map(g=>{const b=u===!1&&o&&typeof o=="object"&&"runId"in o&&o.runId===g.filename;return g.project_id?f.jsx(Mt,{to:"/projects/$projectId/runs/$runId",params:{projectId:g.project_id,runId:g.filename},className:"mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm text-gray-400 transition-colors hover:bg-gray-800/50 hover:text-gray-200",title:g.project_name,children:g.filename},`${g.project_id}/${g.filename}`):f.jsx(Mt,{to:"/runs/$runId",params:{runId:g.filename},className:`mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm transition-colors ${b?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:g.filename},g.filename)})]}),f.jsx("div",{className:"border-t border-gray-800 px-4 py-3",children:f.jsx(Mt,{to:"/settings",className:"flex items-center gap-2 text-sm text-gray-400 hover:text-cyan-400",children:"Settings"})})]})}function Z1({runId:n,currentEvalId:l}){const{data:i}=Xi(n),{data:u}=ps(),o=(u==null?void 0:u.pass_threshold)??.8;return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Mt,{to:"/runs/$runId",params:{runId:n},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Evaluations"}),i==null?void 0:i.results.map(d=>{const h=d.testId===l,y=wn(d.score,o);return f.jsxs(Mt,{to:"/evals/$runId/$evalId",params:{runId:n,evalId:d.testId},className:`mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors ${h?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:[f.jsx("span",{className:`text-xs ${y?"text-emerald-400":"text-red-400"}`,children:y?"✓":"✗"}),f.jsx("span",{className:"truncate",children:d.testId})]},d.testId)})]})]})}function P1({runId:n,dataset:l}){const{data:i}=Xi(n),{data:u}=ps(),o=(u==null?void 0:u.pass_threshold)??.8,d=((i==null?void 0:i.results)??[]).filter(h=>(h.dataset??"Uncategorized")===l);return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Mt,{to:"/runs/$runId",params:{runId:n},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n}),f.jsx("p",{className:"truncate text-xs text-gray-500",children:l})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Evaluations"}),d.map(h=>{const y=wn(h.score,o);return f.jsxs(Mt,{to:"/evals/$runId/$evalId",params:{runId:n,evalId:h.testId},className:"mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-gray-400 transition-colors hover:bg-gray-800/50 hover:text-gray-200",children:[f.jsx("span",{className:`text-xs ${y?"text-emerald-400":"text-red-400"}`,children:y?"✓":"✗"}),f.jsx("span",{className:"truncate",children:h.testId})]},h.testId)})]})]})}function $1({runId:n,category:l}){const{data:i}=Kg(n,l),u=(i==null?void 0:i.datasets)??[];return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Mt,{to:"/runs/$runId",params:{runId:n},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n}),f.jsx("p",{className:"truncate text-xs text-gray-500",children:l})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Datasets"}),u.map(o=>f.jsxs(Mt,{to:"/runs/$runId/dataset/$dataset",params:{runId:n,dataset:o.name},className:"mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm text-gray-400 transition-colors hover:bg-gray-800/50 hover:text-gray-200",children:[f.jsx("span",{className:`text-xs ${o.passed===o.total?"text-emerald-400":"text-red-400"}`,children:o.passed===o.total?"✓":"✗"}),f.jsx("span",{className:"truncate",children:o.name})]},o.name))]})]})}function Vy({projectId:n,currentRunId:l}){const{data:i}=Zg(n);return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Mt,{to:"/",className:"text-xs text-gray-400 hover:text-cyan-400",children:"← All Projects"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:n})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Runs"}),i==null?void 0:i.runs.map(u=>{const o=l===u.filename;return f.jsx(Mt,{to:"/projects/$projectId/runs/$runId",params:{projectId:n,runId:u.filename},className:`mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm transition-colors ${o?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:u.filename},u.filename)})]})]})}function J1({projectId:n,runId:l,currentEvalId:i}){const{data:u}=Jf(n,l),{data:o}=ps(),d=(o==null?void 0:o.pass_threshold)??.8;return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsxs("div",{className:"border-b border-gray-800 px-4 py-2",children:[f.jsx(Mt,{to:"/projects/$projectId/runs/$runId",params:{projectId:n,runId:l},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← Back to run"}),f.jsx("p",{className:"mt-1 truncate text-sm font-medium text-gray-300",children:l})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Evaluations"}),u==null?void 0:u.results.map(h=>{const y=h.testId===i,p=wn(h.score,d);return f.jsxs(Mt,{to:"/projects/$projectId/evals/$runId/$evalId",params:{projectId:n,runId:l,evalId:h.testId},className:`mb-0.5 flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors ${y?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:[f.jsx("span",{className:`text-xs ${p?"text-emerald-400":"text-red-400"}`,children:p?"✓":"✗"}),f.jsx("span",{className:"truncate",children:h.testId})]},h.testId)})]})]})}function I1({currentExperiment:n}){const{data:l}=Pf(),i=(l==null?void 0:l.experiments)??[];return f.jsxs("aside",{className:"flex w-64 flex-col border-r border-gray-800 bg-gray-900/50",children:[f.jsx("div",{className:"flex items-center gap-2 border-b border-gray-800 px-4 py-4",children:f.jsx(Mt,{to:"/",className:"text-lg font-semibold text-white hover:text-cyan-400",children:"AgentV Studio"})}),f.jsx("div",{className:"border-b border-gray-800 px-4 py-2",children:f.jsx(Mt,{to:"/",search:{tab:"experiments"},className:"text-xs text-gray-400 hover:text-cyan-400",children:"← All experiments"})}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 py-3",children:[f.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-gray-500",children:"Experiments"}),i.map(u=>{const o=u.name===n;return f.jsx(Mt,{to:"/experiments/$experimentName",params:{experimentName:u.name},className:`mb-0.5 block truncate rounded-md px-2 py-1.5 text-sm transition-colors ${o?"bg-gray-800 text-cyan-400":"text-gray-400 hover:bg-gray-800/50 hover:text-gray-200"}`,children:u.name},u.name)})]})]})}function F1(){return f.jsxs("div",{className:"flex h-screen overflow-hidden",children:[f.jsx(X1,{}),f.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[f.jsx(v1,{}),f.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:f.jsx(Gg,{})})]})]})}const sa=e1({component:F1}),k1=ya("/settings")({component:W1});function W1(){const{data:n,isLoading:l}=ps(),i=Vi(),[u,o]=F.useState(""),[d,h]=F.useState(!1),[y,p]=F.useState(null),g=(n==null?void 0:n.pass_threshold)??zf,b=u||String(g),v=async()=>{const S=Number.parseFloat(u||String(g));if(Number.isNaN(S)||S<0||S>1){p({type:"error",text:"Threshold must be a number between 0 and 1"});return}h(!0),p(null);try{await V1({pass_threshold:S}),await i.invalidateQueries({queryKey:["config"]}),o(""),p({type:"success",text:"Settings saved"}),setTimeout(()=>p(null),3e3)}catch{p({type:"error",text:"Failed to save settings"})}finally{h(!1)}};return l?f.jsxs("div",{className:"mx-auto max-w-2xl space-y-6",children:[f.jsx("div",{className:"h-8 w-48 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"h-40 animate-pulse rounded-lg bg-gray-900"})]}):f.jsxs("div",{className:"mx-auto max-w-2xl space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Settings"}),f.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Configure your AgentV Studio dashboard"})]}),f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6",children:[f.jsx("h2",{className:"text-lg font-medium text-white",children:"Evaluation"}),f.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"Configure how evaluation results are classified"}),f.jsx("div",{className:"mt-6 space-y-4",children:f.jsxs("div",{children:[f.jsx("label",{htmlFor:"pass-threshold",className:"block text-sm font-medium text-gray-300",children:"Pass Threshold"}),f.jsxs("p",{className:"mt-1 text-xs text-gray-500",children:["Score at or above this value is considered passing. Default: ",zf]}),f.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[f.jsx("input",{id:"pass-threshold",type:"number",min:"0",max:"1",step:"0.05",value:b,onChange:S=>o(S.target.value),className:"w-32 rounded-md border border-gray-700 bg-gray-800 px-3 py-2 text-sm text-white placeholder-gray-500 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500"}),f.jsxs("span",{className:"text-sm text-gray-400",children:["(",Math.round((Number.parseFloat(b)||0)*100),"%)"]})]})]})}),f.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[f.jsx("button",{type:"button",onClick:v,disabled:d,className:"rounded-md bg-cyan-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-cyan-500 disabled:opacity-50",children:d?"Saving...":"Save Settings"}),y&&f.jsx("span",{className:`text-sm ${y.type==="success"?"text-emerald-400":"text-red-400"}`,children:y.text})]})]}),f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:f.jsxs("p",{className:"text-xs text-gray-500",children:["Settings are stored in ",f.jsx("code",{className:"text-gray-400",children:".agentv/config.yaml"})]})})]})}function Va({score:n,className:l=""}){const i=Math.round(Math.max(0,Math.min(1,n))*100);return f.jsxs("div",{className:`flex items-center gap-3 ${l}`,children:[f.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-gray-800",children:f.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-cyan-400 to-blue-500 transition-all duration-300",style:{width:`${i}%`}})}),f.jsxs("span",{className:"w-12 text-right text-sm font-medium tabular-nums text-gray-300",children:[i,"%"]})]})}function tj(){const{data:n,isLoading:l}=Pf();if(l)return f.jsx(aj,{});const i=(n==null?void 0:n.experiments)??[];return i.length===0?f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No experiments found"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Experiments will appear here once evaluations are run with experiment labels."})]}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Targets"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Last Run"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:i.map(u=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3",children:f.jsx(Mt,{to:"/experiments/$experimentName",params:{experimentName:u.name},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:u.name})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:u.run_count}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:u.target_count}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Va,{score:u.pass_rate})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:ej(u.last_run)})]},u.name))})]})})}function ej(n){if(!n)return"N/A";try{const l=new Date(n);return Number.isNaN(l.getTime())?"N/A":l.toLocaleString()}catch{return"N/A"}}function aj(){return f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("div",{className:"animate-pulse",children:[f.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(n=>f.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[f.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-24 rounded bg-gray-800"})]},n))]})})}function nj(n){if(!n)return"No runs";const l=new Date(n);if(Number.isNaN(l.getTime()))return"N/A";const i=Date.now()-l.getTime(),u=Math.floor(i/6e4);if(u<1)return"Just now";if(u<60)return`${u}m ago`;const o=Math.floor(u/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function sj({project:n}){const l=Math.round(n.pass_rate*100);return f.jsxs(Mt,{to:"/projects/$projectId",params:{projectId:n.id},className:"group block rounded-lg border border-gray-800 bg-gray-900/50 p-5 transition-colors hover:border-cyan-800 hover:bg-gray-900",children:[f.jsx("div",{className:"flex items-start justify-between",children:f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("h3",{className:"truncate text-lg font-semibold text-white group-hover:text-cyan-400",children:n.name}),f.jsx("p",{className:"mt-1 truncate text-xs text-gray-500",children:n.path})]})}),f.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-3",children:[f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-gray-500",children:"Runs"}),f.jsx("p",{className:"text-lg font-semibold text-white",children:n.run_count})]}),f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-gray-500",children:"Pass Rate"}),f.jsx("p",{className:`text-lg font-semibold ${n.run_count===0?"text-gray-500":l>=80?"text-emerald-400":l>=50?"text-yellow-400":"text-red-400"}`,children:n.run_count>0?`${l}%`:"--"})]}),f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-gray-500",children:"Last Run"}),f.jsx("p",{className:"text-sm text-gray-300",children:nj(n.last_run)})]})]})]})}function lj(n){if(!n)return"N/A";try{const l=new Date(n);return Number.isNaN(l.getTime())?"N/A":l.toLocaleString()}catch{return"N/A"}}function If({runs:n,projectId:l}){return n.length===0?f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No evaluation runs found."}),f.jsxs("p",{className:"mt-2 text-sm text-gray-500",children:["Run an evaluation first:"," ",f.jsx("code",{className:"rounded bg-gray-800 px-2 py-1 text-cyan-400",children:"agentv eval <eval-file>"})]})]}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Run"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Experiment"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Timestamp"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Tests"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",title:"Percentage of tests with a perfect score (1.0)",children:"Tests Passing"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",title:"Mean score across all tests (0-100%)",children:"Mean Score"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map(i=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3",children:l?f.jsx(Mt,{to:"/projects/$projectId/runs/$runId",params:{projectId:l,runId:i.filename},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:i.filename}):f.jsx(Mt,{to:"/runs/$runId",params:{runId:i.filename},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:i.filename})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:i.target??"-"}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:i.experiment??"-"}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:lj(i.timestamp)}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums",children:i.test_count}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Va,{score:i.pass_rate})}),f.jsxs("td",{className:"px-4 py-3 text-right tabular-nums",children:[(i.avg_score*100).toFixed(1),"%"]})]},i.filename))})]})})}function ij(){const{data:n,isLoading:l}=C1();if(l)return f.jsx(rj,{});const i=(n==null?void 0:n.targets)??[];return i.length===0?f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Targets will appear here once evaluations are run with target labels."})]}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Runs"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Experiments"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Pass Rate"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Evals"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:i.map(u=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3 font-medium text-gray-200",children:u.name}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:u.run_count}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:u.experiment_count}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Va,{score:u.pass_rate})}),f.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:[f.jsx("span",{className:"text-emerald-400",children:u.passed_count}),f.jsx("span",{className:"text-gray-600",children:"/"}),f.jsx("span",{children:u.eval_count})]})]},u.name))})]})})}function rj(){return f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("div",{className:"animate-pulse",children:[f.jsx("div",{className:"border-b border-gray-800 bg-gray-900/50 px-4 py-3",children:f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"})}),["sk-1","sk-2","sk-3","sk-4","sk-5"].map(n=>f.jsxs("div",{className:"flex gap-4 border-b border-gray-800/50 px-4 py-3",children:[f.jsx("div",{className:"h-4 w-32 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-12 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-48 rounded bg-gray-800"}),f.jsx("div",{className:"h-4 w-20 rounded bg-gray-800"})]},n))]})})}const Xy=[{id:"runs",label:"Recent Runs"},{id:"experiments",label:"Experiments"},{id:"targets",label:"Targets"}],uj=ya("/")({component:cj});function cj(){const{data:n,isLoading:l}=$f(),i=((n==null?void 0:n.projects.length)??0)>0;return l?f.jsx(Pg,{}):i?f.jsx(oj,{}):f.jsx(fj,{})}function oj(){const{data:n}=$f(),l=Vi(),[i,u]=F.useState(""),[o,d]=F.useState(""),[h,y]=F.useState(null),[p,g]=F.useState(!1),b=(n==null?void 0:n.projects)??[];async function v(j){if(j.preventDefault(),!!i.trim()){y(null);try{await U1(i.trim()),u(""),g(!1),l.invalidateQueries({queryKey:["projects"]})}catch(N){y(N.message)}}}async function S(j){if(j.preventDefault(),!!o.trim()){y(null);try{const N=await L1(o.trim());d(""),N.length===0&&y("No projects with .agentv/ found in that directory."),l.invalidateQueries({queryKey:["projects"]})}catch(N){y(N.message)}}}return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Projects"}),f.jsx("button",{type:"button",onClick:()=>g(!p),className:"rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500",children:p?"Cancel":"Add Project"})]}),h&&f.jsx("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-3 text-sm text-red-400",children:h}),p&&f.jsxs("div",{className:"space-y-3 rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[f.jsxs("form",{onSubmit:v,className:"flex gap-2",children:[f.jsx("input",{type:"text",value:i,onChange:j=>u(j.target.value),placeholder:"Project path (e.g., /home/user/projects/my-app)",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),f.jsx("button",{type:"submit",className:"rounded-md bg-cyan-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-cyan-500",children:"Add"})]}),f.jsxs("form",{onSubmit:S,className:"flex gap-2",children:[f.jsx("input",{type:"text",value:o,onChange:j=>d(j.target.value),placeholder:"Discover projects in directory...",className:"flex-1 rounded-md border border-gray-700 bg-gray-800 px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:border-cyan-600 focus:outline-none"}),f.jsx("button",{type:"submit",className:"rounded-md bg-gray-700 px-3 py-1.5 text-sm font-medium text-white hover:bg-gray-600",children:"Discover"})]})]}),f.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:b.map(j=>f.jsx(sj,{project:j},j.id))})]})}function fj(){const i=Xg().location.search.tab,u=Ou(),{data:o,isLoading:d,error:h}=Zf(),y=Xy.some(p=>p.id===i)?i:"runs";return f.jsxs("div",{className:"space-y-6",children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Evaluation Runs"}),f.jsx("div",{className:"border-b border-gray-800",children:f.jsx("div",{className:"flex gap-1",children:Xy.map(p=>f.jsx("button",{type:"button",onClick:()=>u({to:"/",search:{tab:p.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${y===p.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:p.label},p.id))})}),y==="runs"&&f.jsx(dj,{data:o,isLoading:d,error:h}),y==="experiments"&&f.jsx(tj,{}),y==="targets"&&f.jsx(ij,{})]})}function dj({data:n,isLoading:l,error:i}){return l?f.jsx(Pg,{}):i?f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",i.message]}):f.jsx(If,{runs:(n==null?void 0:n.runs)??[]})}function Pg(){return f.jsx("div",{className:"space-y-2",children:["s1","s2","s3","s4","s5"].map(n=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},n))})}function Ti({label:n,value:l,accent:i}){return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("p",{className:"text-sm text-gray-400",children:n}),f.jsx("p",{className:`mt-1 text-2xl font-semibold tabular-nums ${i??"text-white"}`,children:l})]})}function Tu({total:n,passed:l,failed:i,passRate:u,totalCost:o}){return f.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-5",children:[f.jsx(Ti,{label:"Total",value:String(n)}),f.jsx(Ti,{label:"Passed",value:String(l),accent:"text-emerald-400"}),f.jsx(Ti,{label:"Failed",value:String(i),accent:"text-red-400"}),f.jsx(Ti,{label:"Pass Rate",value:`${Math.round(u*100)}%`,accent:"text-cyan-400"}),o!==void 0&&f.jsx(Ti,{label:"Cost",value:`$${o.toFixed(4)}`,accent:"text-amber-400"})]})}function hj(n,l){const i=new Map;for(const u of n){const o=u.category??"Uncategorized",d=u.dataset??"Uncategorized";i.has(o)||i.set(o,new Map);const h=i.get(o),y=h.get(d)??{passed:0,failed:0,total:0,scoreSum:0};y.total+=1,y.scoreSum+=u.score,wn(u.score,l)?y.passed+=1:y.failed+=1,h.set(d,y)}return Array.from(i.entries()).map(([u,o])=>{const d=Array.from(o.entries()).map(([b,v])=>({name:b,...v,avgScore:v.total>0?v.scoreSum/v.total:0})).sort((b,v)=>b.name.localeCompare(v.name)),h=d.reduce((b,v)=>b+v.total,0),y=d.reduce((b,v)=>b+v.passed,0),p=d.reduce((b,v)=>b+v.failed,0),g=d.reduce((b,v)=>b+v.avgScore*v.total,0);return{name:u,datasets:d,total:h,passed:y,failed:p,avgScore:h>0?g/h:0}}).sort((u,o)=>u.name.localeCompare(o.name))}function $g({results:n,runId:l,projectId:i}){var S;const{data:u}=ps(),o=(u==null?void 0:u.pass_threshold)??.8,d=n.length,h=n.filter(j=>wn(j.score,o)).length,y=d-h,p=d>0?h/d:0,g=n.reduce((j,N)=>j+(N.costUsd??0),0),b=hj(n,o),v=b.length>1;return d===0?f.jsxs("div",{className:"space-y-6",children:[f.jsx(Tu,{total:0,passed:0,failed:0,passRate:0}),f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:[f.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations found"}),f.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"This run has no results yet."})]})]}):f.jsxs("div",{className:"space-y-6",children:[f.jsx(Tu,{total:d,passed:h,failed:y,passRate:p,totalCost:g>0?g:void 0}),v?f.jsxs("div",{className:"space-y-4",children:[f.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Categories"}),b.map(j=>f.jsx(mj,{category:j,runId:l},j.name))]}):f.jsxs("div",{className:"space-y-3",children:[f.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Datasets"}),f.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:(S=b[0])==null?void 0:S.datasets.map(j=>f.jsx(Jg,{dataset:j,runId:l},j.name))})]}),f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Test ID"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Score"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Status"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Duration"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Cost"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:n.map((j,N)=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3",children:i?f.jsx(Mt,{to:"/projects/$projectId/evals/$runId/$evalId",params:{projectId:i,runId:l,evalId:j.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:j.testId}):f.jsx(Mt,{to:"/evals/$runId/$evalId",params:{runId:l,evalId:j.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:j.testId})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:j.target??"-"}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Va,{score:j.score})}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(yj,{status:j.executionStatus})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:j.durationMs!=null?`${(j.durationMs/1e3).toFixed(1)}s`:"-"}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:j.costUsd!=null?`$${j.costUsd.toFixed(4)}`:"-"})]},`${j.testId}-${N}`))})]})})]})}function mj({category:n,runId:l}){const[i,u]=F.useState(!0);return f.jsxs("div",{className:"rounded-lg border border-gray-800",children:[f.jsxs("button",{type:"button",onClick:()=>u(!i),className:"flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-gray-900/50",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("span",{className:"text-xs text-gray-500",children:i?"▼":"▶"}),f.jsx("span",{className:"text-sm font-medium text-gray-200",children:n.name}),f.jsxs("span",{className:"text-xs text-gray-500",children:[n.datasets.length," dataset",n.datasets.length!==1?"s":""]})]}),f.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[f.jsxs("span",{className:"text-emerald-400",children:[n.passed," passed"]}),n.failed>0&&f.jsxs("span",{className:"text-red-400",children:[n.failed," failed"]}),f.jsxs("span",{className:"text-gray-500",children:[n.passed,"/",n.total]})]})]}),i&&f.jsx("div",{className:"border-t border-gray-800 p-3",children:f.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:n.datasets.map(o=>f.jsx(Jg,{dataset:o,runId:l},o.name))})})]})}function Jg({dataset:n,runId:l}){return f.jsxs(Mt,{to:"/runs/$runId/dataset/$dataset",params:{runId:l,dataset:n.name},className:"rounded-lg border border-gray-800 bg-gray-900 p-3 text-left transition-colors hover:border-gray-700",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm font-medium text-gray-200 truncate",children:n.name}),f.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:[n.passed,"/",n.total]})]}),f.jsx("div",{className:"mt-2",children:f.jsx(Va,{score:n.avgScore})}),f.jsxs("div",{className:"mt-1 flex gap-3 text-xs",children:[f.jsxs("span",{className:"text-emerald-400",children:[n.passed," passed"]}),n.failed>0&&f.jsxs("span",{className:"text-red-400",children:[n.failed," failed"]})]})]})}function yj({status:n}){if(!n)return f.jsx("span",{className:"text-gray-500",children:"-"});const l=n==="success"||n==="completed",i=n==="error"||n==="failed";return f.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${l?"bg-emerald-900/50 text-emerald-400":i?"bg-red-900/50 text-red-400":"bg-gray-800 text-gray-400"}`,children:n})}const Ig=ya("/runs/$runId")({component:gj});function gj(){const{runId:n}=Ig.useParams(),{data:l,isLoading:i,error:u}=Xi(n);return i?f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(o=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},o))})]}):u?f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",u.message]}):f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsxs("h1",{className:"text-2xl font-semibold text-white",children:["Run: ",n]}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Source: ",l==null?void 0:l.source]})]}),f.jsx($g,{results:(l==null?void 0:l.results)??[],runId:n})]})}const Ky=[{id:"runs",label:"Recent Runs"},{id:"experiments",label:"Experiments"},{id:"targets",label:"Targets"}],Fg=ya("/projects/$projectId")({component:pj});function pj(){const{projectId:n}=Fg.useParams(),u=Xg().location.search.tab,o=Ou(),d=Ky.some(h=>h.id===u)?u:"runs";return f.jsxs("div",{className:"space-y-6",children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:n}),f.jsx("div",{className:"border-b border-gray-800",children:f.jsx("div",{className:"flex gap-1",children:Ky.map(h=>f.jsx("button",{type:"button",onClick:()=>o({to:"/projects/$projectId",params:{projectId:n},search:{tab:h.id}}),className:`px-4 py-2 text-sm font-medium transition-colors ${d===h.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:h.label},h.id))})}),d==="runs"&&f.jsx(vj,{projectId:n}),d==="experiments"&&f.jsx(xj,{projectId:n}),d==="targets"&&f.jsx(bj,{projectId:n})]})}function vj({projectId:n}){const{data:l,isLoading:i,error:u}=Zg(n);return i?f.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(o=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},o))}):u?f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load runs: ",u.message]}):f.jsx(If,{runs:(l==null?void 0:l.runs)??[],projectId:n})}function xj({projectId:n}){const{data:l,isLoading:i}=oe(Y1(n)),u=(l==null?void 0:l.experiments)??[];return i?f.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(o=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},o))}):u.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No experiments found"})}):f.jsx("div",{className:"space-y-2",children:u.map(o=>f.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[f.jsxs("div",{children:[f.jsx("p",{className:"font-medium text-white",children:o.name}),f.jsxs("p",{className:"text-sm text-gray-400",children:[o.run_count," run",o.run_count!==1?"s":""]})]}),f.jsxs("span",{className:"text-lg font-semibold tabular-nums text-cyan-400",children:[Math.round(o.pass_rate*100),"%"]})]},o.name))})}function bj({projectId:n}){const{data:l,isLoading:i}=oe(G1(n)),u=(l==null?void 0:l.targets)??[];return i?f.jsx("div",{className:"space-y-2",children:["s1","s2","s3"].map(o=>f.jsx("div",{className:"h-12 animate-pulse rounded-lg bg-gray-900"},o))}):u.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No targets found"})}):f.jsx("div",{className:"space-y-2",children:u.map(o=>f.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-800 bg-gray-900/50 p-4",children:[f.jsxs("div",{children:[f.jsx("p",{className:"font-medium text-white",children:o.name}),f.jsxs("p",{className:"text-sm text-gray-400",children:[o.run_count," run",o.run_count!==1?"s":""," · ",o.experiment_count," ","experiment",o.experiment_count!==1?"s":""]})]}),f.jsxs("span",{className:"text-lg font-semibold tabular-nums text-cyan-400",children:[Math.round(o.pass_rate*100),"%"]})]},o.name))})}const kg=ya("/experiments/$experimentName")({component:Sj});function Sj(){var v;const{experimentName:n}=kg.useParams(),{data:l,isLoading:i}=Pf(),{data:u,isLoading:o}=Zf();if(i||o)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-4 gap-4",children:["s1","s2","s3","s4"].map(S=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},S))})]});const h=(v=l==null?void 0:l.experiments)==null?void 0:v.find(S=>S.name===n),y=(u==null?void 0:u.runs)??[],p=(h==null?void 0:h.pass_rate)??0,g=(h==null?void 0:h.run_count)??0,b=(h==null?void 0:h.target_count)??0;return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:n}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[g," run",g!==1?"s":""," · ",b," target",b!==1?"s":"",(h==null?void 0:h.last_run)&&f.jsxs("span",{className:"ml-2",children:["· Last run: ",Zy(h.last_run)]})]})]}),h&&f.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-4",children:[f.jsx(mu,{label:"Runs",value:String(g)}),f.jsx(mu,{label:"Targets",value:String(b)}),f.jsx(mu,{label:"Pass Rate",value:`${Math.round(p*100)}%`,accent:"text-cyan-400"}),f.jsx(mu,{label:"Last Run",value:Zy(h.last_run)})]}),f.jsxs("div",{children:[f.jsx("h2",{className:"mb-4 text-lg font-medium text-gray-200",children:"All Runs"}),f.jsx(If,{runs:y})]})]})}function mu({label:n,value:l,accent:i}){return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("p",{className:"text-sm text-gray-400",children:n}),f.jsx("p",{className:`mt-1 text-2xl font-semibold tabular-nums ${i??"text-white"}`,children:l})]})}function Zy(n){if(!n)return"N/A";try{const l=new Date(n);return Number.isNaN(l.getTime())?"N/A":l.toLocaleString()}catch{return"N/A"}}async function jj(n,l){const i=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviews:[{test_id:n,comment:l}]})});if(!i.ok)throw new Error(`Failed to save feedback: ${i.status}`);return i.json()}function Nj({testId:n}){var b;const{data:l}=M1(),i=Vi(),u=(b=l==null?void 0:l.reviews)==null?void 0:b.find(v=>v.test_id===n),[o,d]=F.useState((u==null?void 0:u.comment)??""),[h,y]=F.useState(!1);F.useEffect(()=>{d((u==null?void 0:u.comment)??""),y(!1)},[u==null?void 0:u.comment]);const p=Sb({mutationFn:()=>jj(n,o),onSuccess:()=>{i.invalidateQueries({queryKey:["feedback"]}),y(!0),setTimeout(()=>y(!1),2e3)}}),g=F.useCallback(()=>{p.mutate()},[p]);return f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("h4",{className:"mb-2 text-sm font-medium text-gray-400",children:"Feedback"}),f.jsx("textarea",{value:o,onChange:v=>{d(v.target.value),y(!1)},placeholder:"Add feedback for this test...",className:"w-full rounded-md border border-gray-700 bg-gray-800 p-3 text-sm text-gray-200 placeholder-gray-500 focus:border-cyan-400 focus:outline-none",rows:3}),f.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[f.jsx("button",{type:"button",onClick:g,disabled:p.isPending,className:"rounded-md bg-cyan-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-cyan-500 disabled:opacity-50",children:p.isPending?"Saving...":"Save Feedback"}),h&&f.jsx("span",{className:"text-sm text-emerald-400",children:"Saved"}),p.isError&&f.jsx("span",{className:"text-sm text-red-400",children:"Error saving feedback"})]})]})}function Rj(n){var i;switch((i=n.split(".").pop())==null?void 0:i.toLowerCase()){case"ts":case"tsx":return"📘";case"json":return"📋";case"log":case"txt":return"📜";case"md":return"📝";default:return"📄"}}function Wg(n){const l=[];for(const i of n)i.type==="dir"&&(l.push(i.path),i.children&&l.push(...Wg(i.children)));return l}function tp({node:n,selectedPath:l,onSelect:i,openFolders:u,toggleFolder:o,depth:d=0}){const h=n.type==="dir",y=u.has(n.path),p=l===n.path;return f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>{h?o(n.path):i(n.path)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors ${p?"bg-cyan-400/20 text-cyan-400":"text-gray-300 hover:bg-gray-800/50 hover:text-gray-200"}`,style:{paddingLeft:`${d*16+8}px`},children:[f.jsx("span",{className:"flex-shrink-0 text-xs",children:h?y?"📂":"📁":Rj(n.name)}),f.jsx("span",{className:"truncate",children:n.name})]}),h&&y&&n.children&&f.jsx("div",{children:n.children.map(g=>f.jsx(tp,{node:g,selectedPath:l,onSelect:i,openFolders:u,toggleFolder:o,depth:d+1},g.path))})]})}function _j({files:n,selectedPath:l,onSelect:i}){const[u,o]=F.useState(()=>new Set(Wg(n))),d=h=>{o(y=>{const p=new Set(y);return p.has(h)?p.delete(h):p.add(h),p})};return f.jsxs("div",{className:"w-64 overflow-y-auto rounded-lg border border-gray-800 bg-gray-900 py-2",children:[n.length===0&&f.jsx("p",{className:"px-4 py-2 text-sm text-gray-500",children:"No files."}),n.map(h=>f.jsx(tp,{node:h,selectedPath:l,onSelect:i,openFolders:u,toggleFolder:d},h.path))]})}const Ej="modulepreload",Tj=function(n){return"/"+n},Py={},Mj=function(l,i,u){let o=Promise.resolve();if(i&&i.length>0){let h=function(g){return Promise.all(g.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const y=document.querySelector("meta[property=csp-nonce]"),p=(y==null?void 0:y.nonce)||(y==null?void 0:y.getAttribute("nonce"));o=h(i.map(g=>{if(g=Tj(g),g in Py)return;Py[g]=!0;const b=g.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${v}`))return;const S=document.createElement("link");if(S.rel=b?"stylesheet":Ej,b||(S.as="script"),S.crossOrigin="",S.href=g,p&&S.setAttribute("nonce",p),document.head.appendChild(S),b)return new Promise((j,N)=>{S.addEventListener("load",j),S.addEventListener("error",()=>N(Error(`Unable to preload CSS for ${g}`)))})}))}function d(h){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=h,window.dispatchEvent(y),!y.defaultPrevented)throw h}return o.then(h=>{for(const y of h||[])y.status==="rejected"&&d(y.reason);return l().catch(d)})},Cj=F.lazy(()=>Mj(()=>import("./index-C7TnyYee.js"),[]));function Aj({value:n,language:l="json",height:i="400px"}){return f.jsx(F.Suspense,{fallback:f.jsx("div",{className:"flex items-center justify-center rounded-lg bg-gray-900 p-8 text-gray-500",children:"Loading editor..."}),children:f.jsx(Cj,{height:i,language:l,value:n,theme:"vs-dark",options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,lineNumbers:"on",wordWrap:"on",padding:{top:12}}})})}function ep(n){for(const l of n){if(l.type==="file")return l.path;if(l.children){const i=ep(l.children);if(i)return i}}return null}function ap({eval:n,runId:l,projectId:i}){const[u,o]=F.useState("checks"),d=[{id:"checks",label:"Checks"},{id:"files",label:"Files"},{id:"feedback",label:"Feedback"}];return f.jsxs("div",{className:"flex min-h-full flex-col gap-6",children:[f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("h3",{className:"text-lg font-medium",children:n.testId}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:[n.target&&f.jsxs("span",{children:["Target: ",n.target]}),n.durationMs!=null&&f.jsxs("span",{className:"ml-4",children:[(n.durationMs/1e3).toFixed(1),"s"]}),n.costUsd!=null&&f.jsxs("span",{className:"ml-4",children:["$",n.costUsd.toFixed(4)]})]})]}),f.jsx("div",{className:"w-48",children:f.jsx(Va,{score:n.score})})]})}),n.scores&&n.scores.length>0&&f.jsxs("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-4",children:[f.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-400",children:"Evaluator Scores"}),f.jsx("div",{className:"space-y-3",children:n.scores.map((h,y)=>f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("span",{className:"w-40 truncate text-sm text-gray-300",children:h.name??h.type??`Score ${y+1}`}),f.jsx("div",{className:"flex-1",children:f.jsx(Va,{score:h.score})})]},`${h.name??h.type??y}`))})]}),f.jsx("div",{className:"border-b border-gray-800",children:f.jsx("div",{className:"flex gap-1",children:d.map(h=>f.jsx("button",{type:"button",onClick:()=>o(h.id),className:`px-4 py-2 text-sm font-medium transition-colors ${u===h.id?"border-b-2 border-cyan-400 text-cyan-400":"text-gray-400 hover:text-gray-300"}`,children:h.label},h.id))})}),f.jsxs("div",{className:"min-h-0 flex-1",children:[u==="checks"&&f.jsx(Oj,{result:n}),u==="files"&&f.jsx(zj,{result:n,runId:l,projectId:i}),u==="feedback"&&f.jsx(Nj,{testId:n.testId})]})]})}function Oj({result:n}){const{data:l}=ps(),i=(l==null?void 0:l.pass_threshold)??.8,u=n.assertions??[],o=!wn(n.score,i)||n.executionStatus==="error"||n.executionStatus==="failed",d=[];n.error&&d.push(n.error),(n.executionStatus==="error"||n.executionStatus==="failed")&&d.push(`Execution status: ${n.executionStatus}`);const h=u.filter(y=>!y.passed);for(const y of h){const p=y.evidence?`${y.text}: ${y.evidence}`:y.text;d.push(p)}if(n.scores)for(const y of n.scores){if(!wn(y.score,i)&&y.details){const p=typeof y.details=="string"?y.details:JSON.stringify(y.details,null,2);d.push(`[${y.name??y.type??"evaluator"}] ${p}`)}if(y.assertions){for(const p of y.assertions)if(!p.passed){const g=p.evidence?`${p.text}: ${p.evidence}`:p.text;d.includes(g)||d.push(g)}}}return f.jsxs("div",{className:"space-y-4",children:[u.length===0&&f.jsx("p",{className:"text-sm text-gray-500",children:"No assertion steps recorded."}),u.length>0&&f.jsx("div",{className:"space-y-2",children:u.map(y=>f.jsxs("div",{className:`flex items-start gap-3 rounded-lg border p-3 ${y.passed?"border-emerald-900/50 bg-emerald-950/20":"border-red-900/50 bg-red-950/20"}`,children:[f.jsx("span",{className:`mt-0.5 text-lg ${y.passed?"text-emerald-400":"text-red-400"}`,children:y.passed?"✓":"✗"}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsxs("p",{className:"text-sm text-gray-200",children:[y.text,y.durationMs!=null&&f.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:["(",(y.durationMs/1e3).toFixed(1),"s)"]})]}),y.evidence&&f.jsx("p",{className:"mt-1 text-xs text-gray-400",children:y.evidence})]})]},`${y.text}-${y.passed}`))}),o&&d.length>0&&f.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4",children:[f.jsx("h4",{className:"mb-2 text-sm font-medium text-red-400",children:"Failure Reason"}),f.jsx("div",{className:"space-y-2",children:d.map(y=>f.jsx("p",{className:"text-sm text-gray-300",children:y},y))})]})]})}function zj({result:n,runId:l,projectId:i}){const u=n.testId,{data:o}=i?oe(q1(i,l,u)):A1(l,u),d=(o==null?void 0:o.files)??[],[h,y]=F.useState(null),p=h??(d.length>0?ep(d):null),{data:g,isLoading:b}=i?oe(Q1(i,l,u,p??"")):O1(l,u,p??"");if(d.length===0)return f.jsx("p",{className:"text-sm text-gray-500",children:"No artifact files available."});const v=p?b?"Loading...":(g==null?void 0:g.content)??"":"",S=p?(g==null?void 0:g.language)??"plaintext":"plaintext";return f.jsxs("div",{className:"flex h-full min-h-[400px] gap-4",children:[f.jsx(_j,{files:d,selectedPath:p,onSelect:y}),f.jsx("div",{className:"flex-1",children:f.jsx(Aj,{value:v,language:S,height:"100%"})})]})}const np=ya("/evals/$runId/$evalId")({component:Dj});function Dj(){const{runId:n,evalId:l}=np.useParams(),{data:i,isLoading:u,error:o}=Xi(n);if(u)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",o.message]});const d=i==null?void 0:i.results.find(h=>h.testId===l);return d?f.jsxs("div",{className:"flex h-full flex-col gap-6",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",n," / Eval: ",l]}),f.jsx("h1",{className:"text-2xl font-semibold text-white",children:l})]}),f.jsx(ap,{eval:d,runId:n})]}):f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:f.jsxs("p",{className:"text-gray-400",children:["Eval ",f.jsx("code",{className:"text-cyan-400",children:l})," not found in run"," ",f.jsx("code",{className:"text-cyan-400",children:n}),"."]})})}const sp=ya("/runs/$runId_/dataset/$dataset")({component:wj});function wj(){const{runId:n,dataset:l}=sp.useParams(),{data:i,isLoading:u,error:o}=Xi(n),{data:d}=ps(),h=(d==null?void 0:d.pass_threshold)??.8;if(u)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(j=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},j))})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",o.message]});const y=((i==null?void 0:i.results)??[]).filter(j=>(j.dataset??"Uncategorized")===l),p=y.length,g=y.filter(j=>wn(j.score,h)).length,b=p-g,v=p>0?g/p:0,S=y.reduce((j,N)=>j+(N.costUsd??0),0);return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:l}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Dataset in run: ",n]})]}),f.jsx(Tu,{total:p,passed:g,failed:b,passRate:v,totalCost:S>0?S:void 0}),p===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No evaluations in this dataset"})}):f.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-800",children:f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/50",children:f.jsxs("tr",{children:[f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Test ID"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Target"}),f.jsx("th",{className:"w-48 px-4 py-3 font-medium text-gray-400",children:"Score"}),f.jsx("th",{className:"px-4 py-3 font-medium text-gray-400",children:"Status"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Duration"}),f.jsx("th",{className:"px-4 py-3 text-right font-medium text-gray-400",children:"Cost"})]})}),f.jsx("tbody",{className:"divide-y divide-gray-800/50",children:y.map((j,N)=>f.jsxs("tr",{className:"transition-colors hover:bg-gray-900/30",children:[f.jsx("td",{className:"px-4 py-3",children:f.jsx(Mt,{to:"/evals/$runId/$evalId",params:{runId:n,evalId:j.testId},className:"font-medium text-cyan-400 hover:text-cyan-300 hover:underline",children:j.testId})}),f.jsx("td",{className:"px-4 py-3 text-gray-400",children:j.target??"-"}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Va,{score:j.score})}),f.jsx("td",{className:"px-4 py-3",children:f.jsx(Uj,{status:j.executionStatus})}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:j.durationMs!=null?`${(j.durationMs/1e3).toFixed(1)}s`:"-"}),f.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-gray-400",children:j.costUsd!=null?`$${j.costUsd.toFixed(4)}`:"-"})]},`${j.testId}-${N}`))})]})})]})}function Uj({status:n}){if(!n)return f.jsx("span",{className:"text-gray-500",children:"-"});const l=n==="success"||n==="completed",i=n==="error"||n==="failed";return f.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${l?"bg-emerald-900/50 text-emerald-400":i?"bg-red-900/50 text-red-400":"bg-gray-800 text-gray-400"}`,children:n})}const lp=ya("/runs/$runId_/category/$category")({component:Lj});function Lj(){const{runId:n,category:l}=lp.useParams(),{data:i,isLoading:u,error:o}=Kg(n,l);if(u)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(b=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},b))})]});if(o)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load category: ",o.message]});const d=(i==null?void 0:i.datasets)??[],h=d.reduce((b,v)=>b+v.total,0),y=d.reduce((b,v)=>b+v.passed,0),p=h-y,g=h>0?y/h:0;return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-semibold text-white",children:l}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Category in run: ",n]})]}),f.jsx(Tu,{total:h,passed:y,failed:p,passRate:g}),d.length===0?f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-8 text-center",children:f.jsx("p",{className:"text-lg text-gray-400",children:"No datasets in this category"})}):f.jsxs("div",{className:"space-y-3",children:[f.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Datasets"}),f.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:d.map(b=>f.jsxs(Mt,{to:"/runs/$runId/dataset/$dataset",params:{runId:n,dataset:b.name},className:"rounded-lg border border-gray-800 bg-gray-900 p-3 text-left transition-colors hover:border-gray-700",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm font-medium text-gray-200 truncate",children:b.name}),f.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:[b.passed,"/",b.total]})]}),f.jsx("div",{className:"mt-2",children:f.jsx(Va,{score:b.avg_score})}),f.jsxs("div",{className:"mt-1 flex gap-3 text-xs",children:[f.jsxs("span",{className:"text-emerald-400",children:[b.passed," passed"]}),b.failed>0&&f.jsxs("span",{className:"text-red-400",children:[b.failed," failed"]})]})]},b.name))})]})]})}const ip=ya("/projects/$projectId_/runs/$runId")({component:Bj});function Bj(){const{projectId:n,runId:l}=ip.useParams(),{data:i,isLoading:u,error:o}=Jf(n,l);return u?f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"grid grid-cols-5 gap-4",children:["s1","s2","s3","s4","s5"].map(d=>f.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-gray-900"},d))})]}):o?f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load run: ",o.message]}):f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsxs("h1",{className:"text-2xl font-semibold text-white",children:["Run: ",l]}),f.jsxs("p",{className:"mt-1 text-sm text-gray-400",children:["Source: ",i==null?void 0:i.source]})]}),f.jsx($g,{results:(i==null?void 0:i.results)??[],runId:l,projectId:n})]})}const rp=ya("/projects/$projectId_/evals/$runId/$evalId")({component:Hj});function Hj(){const{projectId:n,runId:l,evalId:i}=rp.useParams(),{data:u,isLoading:o,error:d}=Jf(n,l);if(o)return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"h-8 w-64 animate-pulse rounded bg-gray-800"}),f.jsx("div",{className:"h-48 animate-pulse rounded-lg bg-gray-900"})]});if(d)return f.jsxs("div",{className:"rounded-lg border border-red-900/50 bg-red-950/20 p-6 text-red-400",children:["Failed to load eval: ",d.message]});const h=u==null?void 0:u.results.find(y=>y.testId===i);return h?f.jsxs("div",{className:"flex h-full flex-col gap-6",children:[f.jsxs("div",{children:[f.jsxs("p",{className:"text-sm text-gray-400",children:["Run: ",l," / Eval: ",i]}),f.jsx("h1",{className:"text-2xl font-semibold text-white",children:i})]}),f.jsx(ap,{eval:h,runId:l,projectId:n})]}):f.jsx("div",{className:"rounded-lg border border-gray-800 bg-gray-900 p-6 text-center",children:f.jsxs("p",{className:"text-gray-400",children:["Eval ",f.jsx("code",{className:"text-cyan-400",children:i})," not found in run"," ",f.jsx("code",{className:"text-cyan-400",children:l}),"."]})})}const qj=k1.update({id:"/settings",path:"/settings",getParentRoute:()=>sa}),Qj=uj.update({id:"/",path:"/",getParentRoute:()=>sa}),Yj=Ig.update({id:"/runs/$runId",path:"/runs/$runId",getParentRoute:()=>sa}),Gj=Fg.update({id:"/projects/$projectId",path:"/projects/$projectId",getParentRoute:()=>sa}),Vj=kg.update({id:"/experiments/$experimentName",path:"/experiments/$experimentName",getParentRoute:()=>sa}),Xj=np.update({id:"/evals/$runId/$evalId",path:"/evals/$runId/$evalId",getParentRoute:()=>sa}),Kj=sp.update({id:"/runs/$runId_/dataset/$dataset",path:"/runs/$runId/dataset/$dataset",getParentRoute:()=>sa}),Zj=lp.update({id:"/runs/$runId_/category/$category",path:"/runs/$runId/category/$category",getParentRoute:()=>sa}),Pj=ip.update({id:"/projects/$projectId_/runs/$runId",path:"/projects/$projectId/runs/$runId",getParentRoute:()=>sa}),$j=rp.update({id:"/projects/$projectId_/evals/$runId/$evalId",path:"/projects/$projectId/evals/$runId/$evalId",getParentRoute:()=>sa}),Jj={IndexRoute:Qj,SettingsRoute:qj,ExperimentsExperimentNameRoute:Vj,ProjectsProjectIdRoute:Gj,RunsRunIdRoute:Yj,EvalsRunIdEvalIdRoute:Xj,ProjectsProjectIdRunsRunIdRoute:Pj,RunsRunIdCategoryCategoryRoute:Zj,RunsRunIdDatasetDatasetRoute:Kj,ProjectsProjectIdEvalsRunIdEvalIdRoute:$j},Ij=sa._addFileChildren(Jj)._addFileTypes(),Fj=new ub({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!0}}}),kj=h1({routeTree:Ij}),up=document.getElementById("root");if(!up)throw new Error("Root element not found");Bx.createRoot(up).render(f.jsx(F.StrictMode,{children:f.jsx(cb,{client:Fj,children:f.jsx(g1,{router:kj})})}));export{Ai as W,F as r};
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>AgentV Studio</title>
7
- <script type="module" crossorigin src="/assets/index-D-gfAa3s.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-vn54AYtS.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-jJVIJh8b.css">
9
9
  </head>
10
10
  <body class="bg-gray-950 text-gray-100">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentv",
3
- "version": "4.6.0",
3
+ "version": "4.6.1",
4
4
  "description": "CLI entry point for AgentV",
5
5
  "type": "module",
6
6
  "repository": {