import{d as M,o as n,c as r,n as h,a as e,t as a,b as v,u as l,_ as T,e as R,f as w,w as u,F as C,k as N,l as A,g as j,r as g,m as z,h as _,p as F}from"./index.js";import{f as V,c as B,s as f,d as S,a as E}from"./client.js";import{_ as H}from"./DataTable.vue_vue_type_script_setup_true_lang.js";const L={class:"msg__header"},P={class:"msg__role-group"},q={class:"msg__role"},G={key:0,class:"msg__agent"},J={class:"msg__time"},K={class:"msg__body"},O={key:0,class:"msg__meta"},Q={class:"mono"},U=M({__name:"MessageBubble",props:{message:{}},setup(i){function p(c){return!c||!Array.isArray(c)?"":c.filter(o=>o.type==="text"&&o.text!=null).map(o=>{const d=o.text;return typeof d=="string"?d:d.value}).join(`
`)}return(c,o)=>(n(),r("div",{class:h(["msg",`msg--${i.message.role}`])},[e("div",L,[e("div",P,[e("span",q,a(i.message.role),1),i.message.agent_name?(n(),r("span",G,a(i.message.agent_name),1)):v("",!0)]),e("span",J,a(l(V)(i.message.created_at)),1)]),e("div",K,a(p(i.message.content)),1),i.message.run_id?(n(),r("div",O,[e("span",Q,"run "+a(i.message.run_id.slice(0,8)),1)])):v("",!0)],2))}}),W=T(U,[["__scopeId","data-v-7ee9ec93"]]),X={class:"breadcrumbs"},Y={class:"page-header"},Z={class:"page-header__subtitle mono"},ee={key:0,class:"loading-center"},se={key:1,class:"card",style:{color:"var(--error)"}},te={class:"tabs"},ae={key:0,class:"message-list"},ne={key:0,class:"empty-state"},oe={key:1,class:"card"},le=M({__name:"ThreadDetailView",setup(i){const p=A(),c=j(),o=p.params.threadId,d=g([]),y=g([]),x=g(!0),b=g(""),m=g("messages");R(async()=>{try{const[k,t]=await Promise.all([B.listMessages(o),B.listRuns(o)]);d.value=k,y.value=t}catch(k){b.value=k.message}finally{x.value=!1}});const D=[{key:"id",label:"Run ID",mono:!0},{key:"assistant_id",label:"Agent",mono:!0},{key:"status",label:"Status",width:"120px"},{key:"model",label:"Model"},{key:"duration",label:"Duration",width:"100px"},{key:"tokens",label:"Tokens",width:"80px"},{key:"created_at",label:"Created"}];return(k,t)=>{const I=z("router-link");return n(),r("div",null,[e("div",X,[w(I,{to:"/threads"},{default:u(()=>[...t[3]||(t[3]=[_("Threads",-1)])]),_:1}),t[4]||(t[4]=e("span",null,"›",-1)),e("span",null,a(l(f)(l(o))),1)]),e("div",Y,[e("div",null,[t[5]||(t[5]=e("h1",null,"Thread Detail",-1)),e("div",Z,a(l(o)),1)])]),x.value?(n(),r("div",ee,[...t[6]||(t[6]=[e("div",{class:"spinner"},null,-1)])])):b.value?(n(),r("div",se,a(b.value),1)):(n(),r(C,{key:2},[e("div",te,[e("div",{class:h(["tab",{"tab--active":m.value==="messages"}]),onClick:t[0]||(t[0]=s=>m.value="messages")}," Messages ("+a(d.value.length)+") ",3),e("div",{class:h(["tab",{"tab--active":m.value==="runs"}]),onClick:t[1]||(t[1]=s=>m.value="runs")}," Runs ("+a(y.value.length)+") ",3)]),m.value==="messages"?(n(),r("div",ae,[d.value.length===0?(n(),r("div",ne,[...t[7]||(t[7]=[e("div",{class:"empty-state__icon"},[e("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[e("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})])],-1),e("div",{class:"empty-state__title"},"No messages",-1)])])):v("",!0),(n(!0),r(C,null,N(d.value,s=>(n(),F(W,{key:s.id,message:s},null,8,["message"]))),128))])):v("",!0),m.value==="runs"?(n(),r("div",oe,[w(H,{columns:D,rows:y.value,clickable:"",onRowClick:t[2]||(t[2]=s=>l(c).push(`/threads/${l(o)}/runs/${s.id}`))},{id:u(({value:s})=>[_(a(l(f)(s)),1)]),assistant_id:u(({value:s})=>[_(a(l(f)(s)),1)]),status:u(({value:s})=>[e("span",{class:h(["badge",l(E)(s)])},a(s),3)]),duration:u(({row:s})=>[_(a(l(S)(s.started_at,s.completed_at||s.failed_at)),1)]),tokens:u(({row:s})=>{var $;return[_(a((($=s.usage)==null?void 0:$.total_tokens)??"—"),1)]}),created_at:u(({value:s})=>[_(a(l(V)(s)),1)]),_:1},8,["rows"])])):v("",!0)],64))])}}}),ue=T(le,[["__scopeId","data-v-f6d4aaea"]]);export{ue as default};
