import{r as p,k as e}from"./index-BVfpSx5Q.js";import{L as f}from"./layout-NiehYZnq.js";import{P as v,K as i,S as m,C as h}from"./ui-DGkmnhL-.js";const s={surface:"rgba(255,255,255,0.025)",border:"rgba(255,255,255,0.08)",text:"#f5f5f5",dim:"#8a8a8a",muted:"#5e5e5e",accent:"#c9b787"},u=[{id:"n0",type:"agent",label:"Voice Interface",detail:"Incoming voice session — semantic VAD active",durationMs:0,status:"success",depth:0,children:["n1"],model:"gpt-realtime-1.5"},{id:"n1",type:"guardrail",label:"pii_redaction",detail:"Input screened — no PII detected",durationMs:12,status:"success",depth:1,children:["n2"]},{id:"n2",type:"handoff",label:"Voice → Cascade",detail:"Maritime context detected in utterance",durationMs:120,status:"success",depth:1,children:["n3"],proofHash:"0x7f3a...e2b1"},{id:"n3",type:"agent",label:"Cascade Navigator",detail:'Processing: "What is the ETA for Horizon Star?"',durationMs:340,status:"success",depth:2,children:["n4","n5"],model:"claude-sonnet-4",cost:"$0.003"},{id:"n4",type:"tool",label:"vessel_lookup",detail:"IMO 9834521 → Horizon Star, Position: 1.2°N 103.8°E",durationMs:89,status:"success",depth:3,children:[]},{id:"n5",type:"tool",label:"eta_calc",detail:"Route: Current → Port Klang, ETA: 14.2h, Confidence: 0.94",durationMs:210,status:"success",depth:3,children:["n6"]},{id:"n6",type:"guardrail",label:"sanctions_check",detail:"Horizon Star — OFAC/EU/UN clear",durationMs:45,status:"success",depth:3,children:["n7"]},{id:"n7",type:"output",label:"Response",detail:"ETA 14h to Port Klang. No sanctions risk. Fuel 2% below baseline.",durationMs:0,status:"success",depth:2,children:["n8"],proofHash:"0x2c91...f4a8"},{id:"n8",type:"agent",label:"Cascade Navigator",detail:'Follow-up: "Show me the route optimization"',durationMs:280,status:"success",depth:2,children:["n9","n10"],model:"claude-sonnet-4",cost:"$0.004"},{id:"n9",type:"tool",label:"route_opt",detail:"3 alternatives scored. Optimal: via Malacca Strait, saves 2.1h",durationMs:1200,status:"success",depth:3,children:[]},{id:"n10",type:"tool",label:"weather_api",detail:"Conditions: Clear, Wind NE 12kt, Sea state 2",durationMs:340,status:"success",depth:3,children:["n11"]},{id:"n11",type:"handoff",label:"Cascade → Oracle",detail:"Route change impacts fuel budget — routing to Pipeline Oracle",durationMs:180,status:"success",depth:3,children:["n12"],proofHash:"0x4e87...1c3d"},{id:"n12",type:"agent",label:"Pipeline Oracle",detail:"Assessing fuel cost impact of route change",durationMs:420,status:"success",depth:4,children:["n13"],model:"gpt-4o",cost:"$0.002"},{id:"n13",type:"guardrail",label:"cost_threshold",detail:"Route change cost delta: $12,400 — within threshold",durationMs:8,status:"success",depth:4,children:["n14"]},{id:"n14",type:"human",label:"Approval Gate",detail:"Route change requires VP-Operations approval — pending",durationMs:0,status:"pending",depth:4,children:["n15"]},{id:"n15",type:"output",label:"Final Output",detail:"Route optimization ready. Saves 2.1h, costs $12.4K additional fuel. Awaiting VP approval.",durationMs:0,status:"blocked",depth:2,children:[],proofHash:"0x9d12...7b4e"}],x=[{id:"run-001",agent:"Cascade Navigator",task:"Fleet position monitoring — 12 vessels",status:"active",duration:"47m",events:234,model:"claude-sonnet-4"},{id:"run-002",agent:"Guardian",task:"Threat intel feed processing — STIX/TAXII",status:"active",duration:"2h 14m",events:1847,model:"claude-sonnet-4"},{id:"run-003",agent:"Counsel Sentinel",task:"Deadline scan — 8 active matters",status:"active",duration:"12m",events:47,model:"gpt-4o"},{id:"run-004",agent:"MirrorEval",task:"Continuous evaluation — all agent outputs",status:"active",duration:"24h",events:12847,model:"claude-sonnet-4"},{id:"run-005",agent:"Voice Interface",task:"Active voice session — demo user",status:"active",duration:"3m",events:12,model:"gpt-realtime-1.5"}],g={agent:{bg:"rgba(201,183,135,0.06)",border:"rgba(201,183,135,0.15)",color:s.accent,icon:"⬡"},tool:{bg:"rgba(138,138,138,0.06)",border:"rgba(138,138,138,0.15)",color:s.dim,icon:"◆"},handoff:{bg:"rgba(201,183,135,0.08)",border:"rgba(201,183,135,0.2)",color:s.accent,icon:"→"},guardrail:{bg:"rgba(245,245,245,0.04)",border:"rgba(245,245,245,0.1)",color:s.text,icon:"⬢"},human:{bg:"rgba(201,183,135,0.08)",border:"rgba(201,183,135,0.2)",color:s.accent,icon:"○"},output:{bg:"rgba(94,94,94,0.06)",border:"rgba(94,94,94,0.15)",color:s.muted,icon:"◇"}};function b({nodes:n}){const[c,r]=p.useState(new Set(n.map(t=>t.id))),d=Math.max(...n.map(t=>t.durationMs),1),a=t=>{r(o=>{const l=new Set(o);return l.has(t)?l.delete(t):l.add(t),l})};return e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{border:`1px solid ${s.border}`,background:"#050505"},children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:`1px solid ${s.border}`,background:"rgba(255,255,255,0.02)"},children:[e.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider",style:{color:s.dim},children:"Execution Trace — Waterfall View"}),e.jsxs("span",{className:"text-[9px] font-mono",style:{color:s.accent},children:[n.length," nodes · ",n.filter(t=>t.proofHash).length," proofs"]})]}),e.jsx("div",{className:"p-3 space-y-1",children:n.map(t=>{const o=g[t.type],l=c.has(t.id);return e.jsxs("button",{onClick:()=>a(t.id),className:"w-full text-left rounded-md p-2.5 transition-all hover:brightness-110",style:{background:o.bg,border:`1px solid ${o.border}`,marginLeft:t.depth*20,width:`calc(100% - ${t.depth*20}px)`},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px]",style:{color:o.color},children:o.icon}),e.jsx("span",{className:"text-[11px] font-mono font-medium",style:{color:o.color},children:t.label}),t.model&&e.jsx("span",{className:"text-[9px] font-mono",style:{color:s.muted},children:t.model}),t.cost&&e.jsx("span",{className:"text-[9px] font-mono",style:{color:s.accent},children:t.cost}),t.proofHash&&e.jsxs("span",{className:"text-[9px] font-mono",style:{color:s.muted},children:["⬡ ",t.proofHash]}),e.jsx("span",{className:"ml-auto text-[9px] font-mono",style:{color:t.status==="pending"?s.accent:t.status==="blocked"?s.text:s.muted},children:t.status==="pending"?"AWAITING":t.status==="blocked"?"BLOCKED":t.durationMs>0?`${t.durationMs}ms`:""})]}),l&&e.jsxs("div",{className:"mt-1.5 flex items-center gap-3",children:[e.jsx("span",{className:"text-[10px]",style:{color:s.dim},children:t.detail}),t.durationMs>0&&e.jsx("div",{className:"flex-1 max-w-[120px] h-1 rounded-full overflow-hidden",style:{background:"rgba(255,255,255,0.05)"},children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.max(5,t.durationMs/d*100)}%`,background:o.color,opacity:.5}})})]})]},t.id)})})]})}function y(){const n=[{name:"Voice",x:50,y:10,active:!0},{name:"Cascade",x:15,y:40,active:!0},{name:"Guardian",x:85,y:40,active:!0},{name:"Counsel",x:15,y:70,active:!0},{name:"Oracle",x:50,y:70,active:!0},{name:"Terra",x:85,y:70,active:!0},{name:"MirrorEval",x:50,y:95,active:!0}],c=[{from:0,to:1},{from:0,to:2},{from:1,to:3},{from:1,to:4},{from:4,to:3},{from:5,to:4},{from:2,to:6},{from:1,to:6},{from:3,to:6},{from:4,to:6},{from:5,to:6}],[r,d]=p.useState(0);return p.useEffect(()=>{const a=setInterval(()=>d(t=>(t+1)%c.length),1200);return()=>clearInterval(a)},[]),e.jsxs("div",{className:"rounded-lg p-6",style:{background:"#050505",border:`1px solid ${s.border}`},children:[e.jsx("div",{className:"text-[9px] font-mono uppercase tracking-wider mb-4",style:{color:s.muted},children:"Live Agent Topology"}),e.jsxs("svg",{viewBox:"0 0 100 105",className:"w-full",style:{maxHeight:300},children:[c.map((a,t)=>e.jsx("line",{x1:n[a.from].x,y1:n[a.from].y,x2:n[a.to].x,y2:n[a.to].y,stroke:t===r?s.accent:"rgba(255,255,255,0.06)",strokeWidth:t===r?.4:.2,strokeDasharray:t===r?"none":"1 1"},t)),n.map((a,t)=>e.jsxs("g",{children:[e.jsx("circle",{cx:a.x,cy:a.y,r:3.5,fill:"#0a0a0a",stroke:s.accent,strokeWidth:.3}),a.active&&e.jsx("circle",{cx:a.x,cy:a.y,r:1,fill:s.accent,opacity:.8,children:e.jsx("animate",{attributeName:"r",values:"0.8;1.2;0.8",dur:"2s",repeatCount:"indefinite"})}),e.jsx("text",{x:a.x,y:a.y+6.5,textAnchor:"middle",fill:s.dim,fontSize:2.8,fontFamily:"monospace",children:a.name})]},t))]})]})}function w(){const[n,c]=p.useState("trace"),r=x.reduce((t,o)=>t+o.events,0),d=u.filter(t=>t.proofHash).length,a=u.reduce((t,o)=>t+parseFloat((o.cost||"$0").replace("$","")),0);return e.jsxs(f,{children:[e.jsx(v,{label:"AGENT INTELLIGENCE VISUALIZATION",title:"Agent Visualization",subtitle:"Live execution traces, agent topology, waterfall debugging, proof chain verification, and real-time run monitoring — every agent decision visible and auditable.",status:"LIVE"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3 mb-8",children:[e.jsx(i,{label:"LIVE RUNS",value:x.length,sub:"active",accent:s.accent}),e.jsx(i,{label:"TRACE NODES",value:u.length,sub:"in view",accent:s.accent}),e.jsx(i,{label:"PROOF HASHES",value:d,sub:"verified",accent:s.accent}),e.jsx(i,{label:"TOTAL EVENTS",value:r.toLocaleString(),sub:"today",accent:s.dim}),e.jsx(i,{label:"TRACE COST",value:`$${a.toFixed(3)}`,sub:"this trace",accent:s.dim}),e.jsx(i,{label:"AVG LATENCY",value:"178ms",sub:"per node",accent:s.accent})]}),e.jsx("div",{className:"flex gap-1 mb-6",children:["trace","topology","runs"].map(t=>e.jsx("button",{onClick:()=>c(t),className:"px-4 py-2 text-[10px] font-mono uppercase tracking-widest rounded-md transition-all",style:{background:n===t?"rgba(201,183,135,0.1)":"transparent",color:n===t?s.accent:s.muted,border:`1px solid ${n===t?"rgba(201,183,135,0.2)":"transparent"}`},children:t},t))}),n==="trace"&&e.jsxs(e.Fragment,{children:[e.jsx(m,{children:"Execution Trace"}),e.jsx("p",{className:"text-xs mb-4",style:{color:s.dim},children:"Every agent call, tool invocation, handoff, guardrail check, and human approval gate — visualized as an interactive waterfall. Click any node to expand details."}),e.jsx(b,{nodes:u}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mt-6",children:Object.entries(g).map(([t,o])=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md",style:{background:o.bg,border:`1px solid ${o.border}`},children:[e.jsx("span",{style:{color:o.color},children:o.icon}),e.jsx("span",{className:"text-[10px] font-mono capitalize",style:{color:o.color},children:t}),e.jsx("span",{className:"ml-auto text-[10px] font-mono",style:{color:s.muted},children:u.filter(l=>l.type===t).length})]},t))})]}),n==="topology"&&e.jsxs(e.Fragment,{children:[e.jsx(m,{children:"Agent Topology"}),e.jsx("p",{className:"text-xs mb-4",style:{color:s.dim},children:"Live graph of all active agents, their connections, handoff paths, and current state. Animated connections show active data flow."}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsx(y,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(h,{children:[e.jsx("div",{className:"text-[9px] font-mono uppercase tracking-wider mb-3",style:{color:s.muted},children:"Topology Metrics"}),e.jsxs("div",{className:"space-y-2 font-mono text-[11px]",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{style:{color:s.dim},children:"Active agents"}),e.jsx("span",{style:{color:s.accent},children:"7"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{style:{color:s.dim},children:"Active connections"}),e.jsx("span",{style:{color:s.text},children:"11"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{style:{color:s.dim},children:"Handoffs (24h)"}),e.jsx("span",{style:{color:s.accent},children:"133"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{style:{color:s.dim},children:"Avg handoff latency"}),e.jsx("span",{style:{color:s.text},children:"142ms"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{style:{color:s.dim},children:"Proof chain depth"}),e.jsx("span",{style:{color:s.accent},children:"4.2 avg"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{style:{color:s.dim},children:"Graph cycles"}),e.jsx("span",{style:{color:s.muted},children:"0 (acyclic)"})]})]})]}),e.jsxs(h,{children:[e.jsx("div",{className:"text-[9px] font-mono uppercase tracking-wider mb-3",style:{color:s.muted},children:"Innovation: Proof-Chain Topology"}),e.jsx("div",{className:"text-[10px] leading-relaxed",style:{color:s.dim},children:"Unlike standard agent visualization, a11oy's topology graph is cryptographically verifiable. Every connection, handoff, and data flow is anchored to a proof hash — making the entire agent network auditable, tamper-evident, and investor-grade transparent."})]})]})]})]}),n==="runs"&&e.jsxs(e.Fragment,{children:[e.jsx(m,{children:"Live Agent Runs"}),e.jsx("div",{className:"space-y-2",children:x.map(t=>e.jsxs("div",{className:"rounded-lg p-4 flex items-center gap-4",style:{background:s.surface,border:`1px solid ${s.border}`},children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full",style:{background:s.accent}}),e.jsx("div",{className:"absolute inset-0 w-2.5 h-2.5 rounded-full animate-ping",style:{background:s.accent,opacity:.3}})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium",style:{color:s.text},children:t.agent}),e.jsx("span",{className:"text-[9px] font-mono",style:{color:s.muted},children:t.model})]}),e.jsx("div",{className:"text-[10px] mt-0.5 truncate",style:{color:s.dim},children:t.task})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-[10px] font-mono",style:{color:s.accent},children:[t.events.toLocaleString()," events"]}),e.jsx("div",{className:"text-[9px] font-mono",style:{color:s.muted},children:t.duration})]})]},t.id))})]})]})}export{w as AgentViz};