import{d as T,c as r,n as x,a as e,t,b as D,o as d,_ as I,e as N,F as S,f as c,w as i,u as o,g as A,r as u,h as _}from"./index.js";import{c as k,f as g,s as R,a as F}from"./client.js";import{_ as $}from"./DataTable.vue_vue_type_script_setup_true_lang.js";const M={class:"stat-card__icon"},O={class:"stat-card__body"},z={class:"stat-card__value"},E={class:"stat-card__label"},P={key:0,class:"stat-card__sub"},j=T({__name:"StatCard",props:{icon:{},label:{},value:{},sub:{},variant:{}},setup(l){return(m,n)=>(d(),r("div",{class:x(["stat-card",l.variant?`stat-card--${l.variant}`:""])},[e("div",M,t(l.icon),1),e("div",O,[e("div",z,t(l.value),1),e("div",E,t(l.label),1),l.sub?(d(),r("div",P,t(l.sub),1)):D("",!0)])],2))}}),w=I(j,[["__scopeId","data-v-5c4af34d"]]),q={key:0,class:"loading-center"},G={key:1,class:"card",style:{color:"var(--error)"}},H={class:"grid-3 mb-4"},J={class:"section"},K={class:"card"},L={class:"section"},Q={class:"card"},Y=T({__name:"OverviewView",setup(l){const m=A(),n=u(null),h=u([]),p=u([]),C=u(!0),b=u("");N(async()=>{try{const[v,a]=await Promise.all([k.overview(),k.listThreads(10)]);n.value=v,h.value=a.slice(0,10);const s=[];for(const f of h.value.slice(0,5))try{const y=await k.listRuns(f.id);s.push(...y)}catch{}s.sort((f,y)=>(y.created_at??0)-(f.created_at??0)),p.value=s.slice(0,10)}catch(v){b.value=v.message}finally{C.value=!1}});const V=[{key:"id",label:"Thread ID",mono:!0},{key:"created_at",label:"Created"}],B=[{key:"id",label:"Run ID",mono:!0},{key:"status",label:"Status",width:"120px"},{key:"model",label:"Model"},{key:"created_at",label:"Created"}];return(v,a)=>(d(),r("div",null,[a[5]||(a[5]=e("div",{class:"page-header"},[e("div",null,[e("h1",null,"Overview"),e("div",{class:"page-header__subtitle"},"Compass Developer Dashboard")])],-1)),C.value?(d(),r("div",q,[...a[2]||(a[2]=[e("div",{class:"spinner"},null,-1)])])):b.value?(d(),r("div",G,t(b.value),1)):n.value?(d(),r(S,{key:2},[e("div",H,[c(w,{icon:"A",label:"Agents",value:n.value.assistants},null,8,["value"]),c(w,{icon:"T",label:"Threads",value:n.value.threads},null,8,["value"]),c(w,{icon:"R",label:"Runs",value:n.value.runs},null,8,["value"])]),e("div",J,[a[3]||(a[3]=e("div",{class:"section__title"},"Recent Threads",-1)),e("div",K,[c($,{columns:V,rows:h.value,clickable:"",onRowClick:a[0]||(a[0]=s=>o(m).push(`/threads/${s.id}`))},{id:i(({value:s})=>[_(t(o(R)(s)),1)]),created_at:i(({value:s})=>[_(t(o(g)(s)),1)]),_:1},8,["rows"])])]),e("div",L,[a[4]||(a[4]=e("div",{class:"section__title"},"Recent Runs",-1)),e("div",Q,[c($,{columns:B,rows:p.value,clickable:"",onRowClick:a[1]||(a[1]=s=>o(m).push(`/threads/${s.thread_id}/runs/${s.id}`))},{id:i(({value:s})=>[_(t(o(R)(s)),1)]),status:i(({value:s})=>[e("span",{class:x(["badge",o(F)(s)])},t(s),3)]),created_at:i(({value:s})=>[_(t(o(g)(s)),1)]),_:1},8,["rows"])])])],64)):D("",!0)]))}});export{Y as default};
