import{n as p,a as f,d as o,u as g,j as t,c as m,B as j}from"./index-DXI13nSQ.js";import{r as N}from"./react-Cb2sDjhD.js";import{D as y}from"./data-table-BVcXWtPw.js";import{E as b}from"./empty-state-WHzNYVaT.js";import{S as w}from"./status-badge-DeESb2dc.js";import{u as x}from"./useQuery-CEwGD94N.js";import{u as v}from"./use-event-stream-DgGpGKop.js";import{L as A}from"./loader-circle-BS5FFFg-.js";import{R as S}from"./refresh-ccw-BPKXoMZa.js";import"./table-oUi0mGOn.js";import"./arrow-up-DtrvOH7Z.js";import"./arrow-down-OdSfpgG4.js";/**
 * @license lucide-react v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const C=p("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),l={all:["a2a"],stats:["a2a","stats"],recent:e=>["a2a","recent",e]};function T(){return x({queryKey:l.stats,queryFn:()=>o.getA2AStats()})}function q(e){return x({queryKey:l.recent(e),queryFn:()=>o.getA2ARecent(e)})}function E(){const e=f();return()=>e.invalidateQueries({queryKey:l.all})}const L={connected:"text-success",connecting:"text-text-dim",reconnecting:"text-warning",closed:"text-text-muted"};function V(){const{t:e}=g(["tasks","common"]),s=E(),n=T(),r=q({limit:50}),u=r.data?.rows??[],i=n.data,d=v({job:()=>s()}),h=N.useMemo(()=>[{id:"id",header:e("a2a.col.id"),cell:a=>t.jsxs("span",{className:"tabular-nums text-text-dim",children:["#",a.id]}),headClassName:"w-16"},{id:"agent",header:e("a2a.col.agent"),cell:a=>t.jsx("span",{className:"font-medium",children:a.agent}),headClassName:"w-32"},{id:"parent",header:e("a2a.col.parent"),cell:a=>a.parent_id!=null?t.jsxs("span",{className:"tabular-nums text-text-dim",children:["#",a.parent_id]}):t.jsx("span",{className:"text-text-muted",children:"—"}),headClassName:"w-20"},{id:"depth",header:e("a2a.col.depth"),cell:a=>t.jsx("span",{className:"tabular-nums text-text-dim",children:a.call_depth}),headClassName:"w-16",hideOnMobile:!0},{id:"status",header:e("a2a.col.status"),cell:a=>t.jsx(w,{status:a.status,children:a.status}),headClassName:"w-28"},{id:"prompt",header:e("a2a.col.prompt"),cell:a=>t.jsx("span",{className:"line-clamp-2 text-text-dim",children:a.prompt??"—"}),asCardTitle:!0},{id:"createdAt",header:e("a2a.col.createdAt"),cell:a=>t.jsx("span",{className:"text-text-dim",children:R(a.created_at)}),headClassName:"w-40",hideOnMobile:!0}],[e]);return t.jsxs("div",{className:"mx-auto flex max-w-7xl flex-col gap-4",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx("h1",{className:"text-xl font-semibold",children:e("a2a.title")}),t.jsx("span",{className:m("text-xs font-medium tabular-nums",L[d]),children:e(`jobs.live.${d}`)}),t.jsxs(j,{variant:"ghost",size:"sm",className:"ml-auto",onClick:()=>{r.refetch(),n.refetch()},disabled:r.isFetching||n.isFetching,"aria-label":e("actions.refresh",{ns:"common"}),children:[r.isFetching?t.jsx(A,{className:"h-4 w-4 animate-spin"}):t.jsx(S,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:e("actions.refresh",{ns:"common"})})]})]}),t.jsx("p",{className:"text-sm text-text-dim",children:e("a2a.subtitle")})]}),i&&t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[t.jsx(c,{label:e("a2a.stats.total"),value:i.total,tone:"info"}),t.jsx(c,{label:e("a2a.stats.recent24h"),value:i.recent24h,tone:"success"}),t.jsx(c,{label:e("a2a.stats.maxDepth"),value:i.maxDepth,tone:"warning"})]}),t.jsx(y,{columns:h,rows:u,getRowId:a=>String(a.id),loading:r.isLoading,emptyState:t.jsx(b,{icon:t.jsx(C,{}),title:e("a2a.empty.title"),description:e("a2a.empty.description")})})]})}const k={info:"border-info/30    text-info",success:"border-success/30 text-success",warning:"border-warning/30 text-warning",danger:"border-danger/30  text-danger"};function c({label:e,value:s,tone:n}){return t.jsxs("div",{className:m("rounded-md border bg-surface px-3 py-2",k[n]),children:[t.jsx("div",{className:"text-xs uppercase tracking-wide text-text-dim",children:e}),t.jsx("div",{className:"text-2xl font-semibold tabular-nums",children:s})]})}function R(e){try{const s=new Date(e);return Number.isNaN(s.getTime())?e:s.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}export{V as default};
//# sourceMappingURL=a2a-Bp_OpTfW.js.map
