import{d as y,e as g,c as n,a as t,t as o,i as k,v as w,f as b,w as d,u as m,g as x,r as i,j as C,o as c,h as v}from"./index.js";import{c as T,f as V,s as D}from"./client.js";import{_ as L}from"./DataTable.vue_vue_type_script_setup_true_lang.js";const N={class:"page-header"},B={class:"page-header__subtitle"},I={key:0,class:"loading-center"},M={key:1,class:"card",style:{color:"var(--error)"}},S={key:2,class:"card"},j={class:"mono",style:{color:"var(--text-muted)","font-size":"0.75rem"}},z=y({__name:"ThreadsView",setup(O){const p=x(),l=i([]),_=i(!0),u=i(""),r=i("");g(async()=>{try{l.value=await T.listThreads(100)}catch(s){u.value=s.message}finally{_.value=!1}});const h=C(()=>{if(!r.value)return l.value;const s=r.value.toLowerCase();return l.value.filter(e=>e.id.toLowerCase().includes(s)||(e.agent_name??"").toLowerCase().includes(s)||(e.agent_id??"").toLowerCase().includes(s))}),f=[{key:"id",label:"Thread ID",mono:!0},{key:"agent_name",label:"Agent"},{key:"created_at",label:"Created"},{key:"meta",label:"Metadata"}];return(s,e)=>(c(),n("div",null,[t("div",N,[t("div",null,[e[2]||(e[2]=t("h1",null,"Threads",-1)),t("div",B,o(l.value.length)+" total",1)]),k(t("input",{class:"input",style:{"max-width":"280px"},"onUpdate:modelValue":e[0]||(e[0]=a=>r.value=a),placeholder:"Search by ID…"},null,512),[[w,r.value]])]),_.value?(c(),n("div",I,[...e[3]||(e[3]=[t("div",{class:"spinner"},null,-1)])])):u.value?(c(),n("div",M,o(u.value),1)):(c(),n("div",S,[b(L,{columns:f,rows:h.value,clickable:"",onRowClick:e[1]||(e[1]=a=>m(p).push(`/threads/${a.id}`))},{id:d(({value:a})=>[v(o(m(D)(a)),1)]),agent_name:d(({value:a})=>[v(o(a??"—"),1)]),created_at:d(({value:a})=>[v(o(m(V)(a)),1)]),meta:d(({row:a})=>[t("span",j,o(Object.keys(a.metadata||{}).length?JSON.stringify(a.metadata).slice(0,60):"—"),1)]),_:1},8,["rows"])]))]))}});export{z as default};
