import{r as l,k as e}from"./index-BVfpSx5Q.js";import{L as p}from"./layout-NiehYZnq.js";import{P as m}from"./ui-DGkmnhL-.js";const n=[{id:"kc-1",name:"Governance Policies",description:"All covenant policies, constitution, compliance frameworks",documentCount:847,chunkCount:12340,embeddingModel:"BAAI/bge-m3",lastIngested:Date.now()-36e5,sizeBytes:234e6,vertical:"Governance"},{id:"kc-2",name:"Deal Intelligence",description:"Deal memos, approval chains, revenue forecasts, pipeline data",documentCount:2341,chunkCount:45600,embeddingModel:"BAAI/bge-m3",lastIngested:Date.now()-18e5,sizeBytes:567e6,vertical:"Revenue"},{id:"kc-3",name:"Security Findings",description:"Vulnerability reports, threat intel, incident post-mortems",documentCount:1567,chunkCount:23400,embeddingModel:"BAAI/bge-m3",lastIngested:Date.now()-72e5,sizeBytes:345e6,vertical:"Security"},{id:"kc-4",name:"Agent Execution History",description:"Workcell traces, proof packets, agent decision logs",documentCount:8934,chunkCount:134500,embeddingModel:"BAAI/bge-m3",lastIngested:Date.now()-9e5,sizeBytes:123e7,vertical:"Operations"},{id:"kc-5",name:"Maritime Intelligence",description:"Vessel positions, port schedules, compliance records, sanctions data",documentCount:4567,chunkCount:67800,embeddingModel:"BAAI/bge-m3",lastIngested:Date.now()-144e5,sizeBytes:89e7,vertical:"Maritime"},{id:"kc-6",name:"Legal Corpus",description:"Case law, filings, contract templates, regulatory updates",documentCount:3456,chunkCount:89e3,embeddingModel:"BAAI/bge-m3",lastIngested:Date.now()-288e5,sizeBytes:678e6,vertical:"Legal"}],i={query:"What is the current approval chain policy for deals exceeding $1M, and have there been any recent violations?",answer:`Based on the governance corpus and recent execution history, here is the current state:
**Active Policy: COV-APPROVAL-3**
Deals exceeding $1M require explicit human approval from a designated approver at VP level or above. Automated escalation is permitted but automated approval is blocked.
**Recent Violations (Last 30 Days):**
1. **WC-0491 (Vantex Acquisition)** — Approval chain void since March 11. Primary approver departed with no fallback delegate. 3 automated escalation attempts were correctly blocked by the policy. Revenue exposure: $4.2M.
2. **WC-0523 (Stratford Expansion)** — Near-violation flagged. Approver responded 6 hours past SLA but within the 24h grace window. No policy breach, but workflow health impact noted.
**Recommendation:** Configure fallback delegates for all approval chains to prevent future void states. The Vantex situation would have been avoided with a single delegate assignment.`,steps:[{id:"s-1",type:"query_rewrite",label:"Query Understanding",detail:"Decomposed into 2 sub-queries: (1) approval chain policy for >$1M deals, (2) recent violations/breaches",durationMs:45,confidence:.97},{id:"s-2",type:"retrieve",label:"Vector Retrieval",detail:"Searched Governance Policies collection — top 20 chunks retrieved with bge-m3 embeddings",durationMs:89,resultCount:20},{id:"s-3",type:"retrieve",label:"Graph Lookup",detail:"Queried knowledge graph for COV-APPROVAL-* policies linked to deal entities",durationMs:56,resultCount:7},{id:"s-4",type:"retrieve",label:"Execution History",detail:"Searched Agent Execution History for workcells with covenant violations in last 30 days",durationMs:112,resultCount:34},{id:"s-5",type:"rerank",label:"Cross-Encoder Reranking",detail:"Re-ranked 61 passages using cross-encoder — kept top 12 above 0.7 threshold",durationMs:78,resultCount:12,confidence:.92},{id:"s-6",type:"filter",label:"Policy Compliance Filter",detail:"Filtered results through covenant compliance checker — removed 2 stale policies",durationMs:23,resultCount:10},{id:"s-7",type:"synthesize",label:"Answer Generation",detail:"Synthesized answer from 10 verified passages with citation tracking",durationMs:890,confidence:.94},{id:"s-8",type:"verify",label:"Proof Verification",detail:"Created proof packet PP-31204 — all claims verified against source documents",durationMs:134,confidence:.91}],sources:[{title:"COV-APPROVAL-3 Policy Document",uri:"a11oy://governance/policies/cov-approval-3",score:.97,chunk:"Section 4.2: Any deal with estimated value exceeding $1,000,000 USD requires explicit human approval from a designated approver..."},{title:"WC-0491 Execution Trace",uri:"a11oy://workcells/wc-0491/trace",score:.94,chunk:"Step 7 — Approval gate reached. Primary approver David Chen (VP Sales) not found in active directory..."},{title:"Covenant Enforcement Log",uri:"a11oy://governance/enforcement/2026-04",score:.91,chunk:"April 2026: 3 escalation attempts blocked by COV-APPROVAL-3 for WC-0491. Automated approval bypass denied..."},{title:"WC-0523 Execution Trace",uri:"a11oy://workcells/wc-0523/trace",score:.88,chunk:"Approval received at T+6h02m. SLA threshold: 6h. Grace window: 24h. Status: within grace, no violation..."}],totalLatencyMs:1427,tokensUsed:3456,proofId:"PP-31204"},u=[{name:"Chronicle",description:"Permanent organizational narrative",size:"12.4 GB",entries:"234K",retention:"Forever",icon:"📜"},{name:"Episodic",description:"Replayable session history",size:"8.7 GB",entries:"89K",retention:"90 days",icon:"🎬"},{name:"Semantic",description:"Embedded knowledge vectors",size:"34.2 GB",entries:"372K",retention:"Until superseded",icon:"🧠"},{name:"Working",description:"Active session context",size:"456 MB",entries:"2.1K",retention:"Session",icon:"⚡"},{name:"Procedural",description:"Learned agent workflows",size:"2.1 GB",entries:"12K",retention:"Until deprecated",icon:"🔧"}];function x({step:t}){const o={query_rewrite:"#8b5cf6",retrieve:"#3b82f6",rerank:"#f59e0b",filter:"#ef4444",synthesize:"#22c55e",verify:"#c9b787"}[t.type];return e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:`${o}15`,border:`1px solid ${o}30`},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"3",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})}),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:"rgba(255,255,255,0.8)"},children:t.label}),e.jsxs("span",{className:"text-[10px] font-mono",style:{color:"rgba(255,255,255,0.2)"},children:[t.durationMs,"ms"]}),t.resultCount!==void 0&&e.jsxs("span",{className:"text-[10px] font-mono",style:{color:"rgba(255,255,255,0.2)"},children:[t.resultCount," results"]}),t.confidence!==void 0&&e.jsxs("span",{className:"text-[10px] px-1 py-0.5 rounded",style:{backgroundColor:"rgba(34,197,94,0.08)",color:"rgba(34,197,94,0.7)"},children:[(t.confidence*100).toFixed(0),"%"]})]}),e.jsx("p",{className:"text-[10px] mt-0.5 truncate",style:{color:"rgba(255,255,255,0.3)"},children:t.detail})]})]})}function v(){const[t,a]=l.useState("pipeline"),[o,c]=l.useState(null);return n.reduce((s,r)=>s+r.documentCount,0),n.reduce((s,r)=>s+r.chunkCount,0),n.reduce((s,r)=>s+r.sizeBytes,0),e.jsx(p,{children:e.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[e.jsx(m,{label:"KNOWLEDGE",title:"Agentic RAG",subtitle:"Multi-step retrieval, reasoning, and synthesis with governed knowledge",status:"LIVE"}),e.jsx("div",{className:"flex gap-1 mb-6",children:["pipeline","collections","memory"].map(s=>e.jsx("button",{onClick:()=>a(s),className:"px-4 py-2 rounded-lg text-xs font-medium transition-colors capitalize",style:{backgroundColor:t===s?"rgba(201,183,135,0.1)":"transparent",color:t===s?"#c9b787":"rgba(255,255,255,0.4)"},children:s==="pipeline"?"RAG Pipeline":s==="collections"?"Knowledge Collections":"Memory Fabric"},s))}),t==="pipeline"&&e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"p-4 rounded-xl mb-4",style:{backgroundColor:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)"},children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider mb-2",style:{color:"rgba(255,255,255,0.3)"},children:"Query"}),e.jsx("p",{className:"text-sm",style:{color:"rgba(255,255,255,0.85)"},children:i.query})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-wider mb-3",style:{color:"rgba(255,255,255,0.3)"},children:["Agentic Pipeline — ",i.steps.length," steps · ",i.totalLatencyMs,"ms total"]}),e.jsx("div",{className:"pl-3",style:{borderLeft:"2px solid rgba(201,183,135,0.1)"},children:i.steps.map(s=>e.jsx(x,{step:s},s.id))})]}),e.jsxs("div",{className:"p-4 rounded-xl",style:{backgroundColor:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider",style:{color:"rgba(255,255,255,0.3)"},children:"Synthesized Answer"}),e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-mono",style:{backgroundColor:"rgba(34,197,94,0.08)",color:"rgba(34,197,94,0.6)"},children:["verified · ",i.proofId]})]}),e.jsx("div",{className:"text-sm leading-relaxed",style:{color:"rgba(255,255,255,0.8)"},dangerouslySetInnerHTML:{__html:i.answer.replace(/\*\*(.*?)\*\*/g,'$1').replace(/\n/g,"
")}}),e.jsxs("div",{className:"flex items-center gap-4 mt-4 pt-3 text-[10px] font-mono",style:{color:"rgba(255,255,255,0.2)",borderTop:"1px solid rgba(255,255,255,0.04)"},children:[e.jsxs("span",{children:[i.totalLatencyMs,"ms latency"]}),e.jsxs("span",{children:[i.tokensUsed.toLocaleString()," tokens"]}),e.jsxs("span",{children:[i.sources.length," sources cited"]})]})]})]}),e.jsx("div",{className:"w-80 flex-shrink-0",children:e.jsxs("div",{className:"sticky top-6",children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-wider mb-3",style:{color:"rgba(255,255,255,0.3)"},children:["Sources (",i.sources.length,")"]}),e.jsx("div",{className:"flex flex-col gap-2",children:i.sources.map((s,r)=>e.jsxs("button",{onClick:()=>c(o===r?null:r),className:"w-full p-3 rounded-lg text-left transition-colors",style:{backgroundColor:"rgba(255,255,255,0.02)",border:`1px solid ${o===r?"rgba(201,183,135,0.15)":"rgba(255,255,255,0.06)"}`},children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"rgba(255,255,255,0.7)"},children:s.title}),e.jsxs("span",{className:"text-[10px] font-mono ml-2 flex-shrink-0",style:{color:"rgba(34,197,94,0.6)"},children:[(s.score*100).toFixed(0),"%"]})]}),e.jsx("div",{className:"text-[10px] font-mono truncate",style:{color:"rgba(201,183,135,0.4)"},children:s.uri}),o===r&&e.jsx("div",{className:"mt-2 p-2 rounded text-[10px] leading-relaxed",style:{backgroundColor:"rgba(255,255,255,0.02)",color:"rgba(255,255,255,0.5)"},children:s.chunk})]},r))}),e.jsxs("div",{className:"mt-6 p-3 rounded-lg",style:{backgroundColor:"rgba(201,183,135,0.03)",border:"1px solid rgba(201,183,135,0.08)"},children:[e.jsx("div",{className:"text-[10px] font-semibold mb-2",style:{color:"#c9b787"},children:"What makes this Agentic"}),e.jsxs("div",{className:"space-y-2 text-[10px]",style:{color:"rgba(255,255,255,0.4)"},children:[e.jsxs("p",{children:[e.jsx("strong",{style:{color:"rgba(255,255,255,0.6)"},children:"Multi-step retrieval"})," — queries are decomposed, routed to multiple collections, and iteratively refined."]}),e.jsxs("p",{children:[e.jsx("strong",{style:{color:"rgba(255,255,255,0.6)"},children:"Self-correcting"})," — if initial retrieval is insufficient, the agent autonomously broadens or narrows its search."]}),e.jsxs("p",{children:[e.jsx("strong",{style:{color:"rgba(255,255,255,0.6)"},children:"Knowledge graph + vectors"})," — hybrid retrieval combining semantic similarity with structured relationships."]}),e.jsxs("p",{children:[e.jsx("strong",{style:{color:"rgba(255,255,255,0.6)"},children:"Governed synthesis"})," — every answer carries a proof packet linking claims to source documents."]})]})]})]})})]}),t==="collections"&&e.jsx("div",{className:"grid grid-cols-2 gap-4",children:n.map(s=>e.jsxs("div",{className:"p-4 rounded-xl",style:{backgroundColor:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-semibold",style:{color:"rgba(255,255,255,0.9)"},children:s.name}),e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{backgroundColor:"rgba(201,183,135,0.08)",color:"rgba(201,183,135,0.6)"},children:s.vertical})]}),e.jsx("p",{className:"text-xs mb-3",style:{color:"rgba(255,255,255,0.4)"},children:s.description}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{label:"Documents",value:s.documentCount.toLocaleString()},{label:"Chunks",value:s.chunkCount.toLocaleString()},{label:"Size",value:`${(s.sizeBytes/1e6).toFixed(0)} MB`},{label:"Model",value:s.embeddingModel}].map((r,d)=>e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px]",style:{color:"rgba(255,255,255,0.25)"},children:r.label}),e.jsx("div",{className:"text-xs font-mono",style:{color:"rgba(255,255,255,0.6)"},children:r.value})]},d))})]},s.id))}),t==="memory"&&e.jsxs("div",{children:[e.jsx("div",{className:"grid grid-cols-5 gap-3 mb-6",children:u.map(s=>e.jsxs("div",{className:"p-4 rounded-xl text-center",style:{backgroundColor:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)"},children:[e.jsx("div",{className:"text-2xl mb-2",children:s.icon}),e.jsx("div",{className:"text-xs font-semibold mb-1",style:{color:"rgba(255,255,255,0.8)"},children:s.name}),e.jsx("div",{className:"text-[10px] mb-2",style:{color:"rgba(255,255,255,0.35)"},children:s.description}),e.jsx("div",{className:"text-lg font-semibold",style:{color:"#c9b787"},children:s.size}),e.jsxs("div",{className:"text-[10px] mt-1",style:{color:"rgba(255,255,255,0.25)"},children:[s.entries," entries"]}),e.jsxs("div",{className:"text-[10px] mt-1 font-mono",style:{color:"rgba(255,255,255,0.2)"},children:["TTL: ",s.retention]})]},s.name))}),e.jsxs("div",{className:"p-4 rounded-xl",style:{backgroundColor:"rgba(201,183,135,0.03)",border:"1px solid rgba(201,183,135,0.08)"},children:[e.jsx("h4",{className:"text-xs font-semibold mb-3",style:{color:"#c9b787"},children:"Memory Fabric Architecture"}),e.jsxs("div",{className:"grid grid-cols-3 gap-6 text-[10px]",style:{color:"rgba(255,255,255,0.4)"},children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium mb-1",style:{color:"rgba(255,255,255,0.6)"},children:"Ingestion Pipeline"}),e.jsx("p",{children:"Documents flow through chunking (recursive, semantic, or sliding window), embedding (bge-m3), and indexing (HNSW + IVF). Metadata is extracted and linked to the knowledge graph."})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium mb-1",style:{color:"rgba(255,255,255,0.6)"},children:"Retrieval Strategy"}),e.jsx("p",{children:"Hybrid retrieval combines dense vectors (cosine similarity), sparse BM25, and knowledge graph traversal. Results are re-ranked with a cross-encoder before synthesis."})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium mb-1",style:{color:"rgba(255,255,255,0.6)"},children:"Governed Provenance"}),e.jsx("p",{children:"Every retrieved passage carries provenance metadata — source document, ingestion timestamp, freshness score, sensitivity level, and retention policy."})]})]})]})]})]})})}export{v as AgenticRag};