import{r as v,k as o}from"./index-BVfpSx5Q.js";import{L as h}from"./layout-NiehYZnq.js";import{P as y,K as i,S as m}from"./ui-DGkmnhL-.js";import{A as n}from"./complianceFabric-CIzuJFiy.js";import{R as g,f as p}from"./generateCategoricalChart-C3RFeikY.js";import{a as u,L as f}from"./LineChart-60khDhjR.js";import{X as b,Y as j}from"./YAxis-BcKAP-pG.js";const a="#c9b787";function N({bom:r}){const x=r.evalHistory.map(e=>({date:e.date.split("-").slice(1).join("/"),score:Math.round(e.composite*100)}));return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"rounded-lg border p-3",style:{backgroundColor:"var(--color-a11oy-card)",borderColor:"var(--color-a11oy-border)"},children:[o.jsx("div",{className:"text-xs font-mono mb-1",style:{color:"var(--color-a11oy-text-ghost)"},children:"MODEL"}),o.jsx("div",{className:"text-xs font-semibold",style:{color:"var(--color-a11oy-text)"},children:r.modelProvider}),o.jsx("div",{className:"text-xs font-mono mt-1",style:{color:a},children:r.modelSnapshot}),o.jsx("div",{className:"text-xs font-mono mt-1 truncate",style:{color:"var(--color-a11oy-text-ghost)"},children:r.modelHash})]}),o.jsxs("div",{className:"rounded-lg border p-3",style:{backgroundColor:"var(--color-a11oy-card)",borderColor:"var(--color-a11oy-border)"},children:[o.jsx("div",{className:"text-xs font-mono mb-1",style:{color:"var(--color-a11oy-text-ghost)"},children:"CONSTITUTION"}),o.jsxs("div",{className:"text-xs font-semibold",style:{color:"var(--color-a11oy-text)"},children:["v",r.constitutionVersion]}),o.jsx("div",{className:"text-xs font-mono mt-1 truncate",style:{color:a},children:r.constitutionHash}),o.jsxs("div",{className:"text-xs font-mono mt-1 truncate",style:{color:"var(--color-a11oy-text-ghost)"},children:["Prompt: ",r.systemPromptHash]})]})]}),o.jsxs("div",{className:"rounded-lg border p-3",style:{backgroundColor:"var(--color-a11oy-card)",borderColor:"var(--color-a11oy-border)"},children:[o.jsxs("div",{className:"text-xs font-mono mb-2",style:{color:"var(--color-a11oy-text-ghost)"},children:["TOOL MANIFEST (",r.toolManifest.length," tools)"]}),o.jsx("div",{className:"space-y-1",children:r.toolManifest.map(e=>o.jsxs("div",{className:"flex items-center justify-between text-xs",children:[o.jsx("span",{className:"font-mono",style:{color:"var(--color-a11oy-text-sub)"},children:e.name}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"font-mono",style:{color:a},children:["v",e.version]}),o.jsx("span",{className:"font-mono text-xs truncate max-w-[120px]",style:{color:"var(--color-a11oy-text-ghost)"},children:e.hash})]})]},e.name))})]}),o.jsxs("div",{className:"rounded-lg border p-3",style:{backgroundColor:"var(--color-a11oy-card)",borderColor:"var(--color-a11oy-border)"},children:[o.jsx("div",{className:"text-xs font-mono mb-2",style:{color:"var(--color-a11oy-text-ghost)"},children:"EVAL HISTORY (7-day)"}),o.jsx(g,{width:"100%",height:100,children:o.jsxs(u,{data:x,margin:{top:4,right:8,bottom:4,left:-20},children:[o.jsx(b,{dataKey:"date",tick:{fill:"#5e5e5e",fontSize:9}}),o.jsx(j,{tick:{fill:"#5e5e5e",fontSize:9},domain:[70,100]}),o.jsx(p,{contentStyle:{backgroundColor:"#0a0a0a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:4,fontSize:10},formatter:e=>[`${e}%`,"Composite"]}),o.jsx(f,{type:"monotone",dataKey:"score",stroke:a,strokeWidth:1.5,dot:!1})]})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"rounded-lg border p-3",style:{backgroundColor:"var(--color-a11oy-card)",borderColor:"var(--color-a11oy-border)"},children:[o.jsx("div",{className:"text-xs font-mono mb-1",style:{color:"var(--color-a11oy-text-ghost)"},children:"WELFARE"}),o.jsx("div",{className:"text-xs font-semibold",style:{color:r.welfarePosture==="nominal"?"#22c55e":a},children:r.welfarePosture})]}),o.jsxs("div",{className:"rounded-lg border p-3",style:{backgroundColor:"var(--color-a11oy-card)",borderColor:"var(--color-a11oy-border)"},children:[o.jsx("div",{className:"text-xs font-mono mb-1",style:{color:"var(--color-a11oy-text-ghost)"},children:"BOM VERSION"}),o.jsxs("div",{className:"text-xs font-semibold",style:{color:"var(--color-a11oy-text)"},children:["v",r.bomVersion]})]})]}),o.jsxs("div",{className:"rounded-lg border p-3",style:{backgroundColor:"var(--color-a11oy-card)",borderColor:"var(--color-a11oy-border)"},children:[o.jsx("div",{className:"text-xs font-mono mb-2",style:{color:"var(--color-a11oy-text-ghost)"},children:"DEPENDENCY GRAPH"}),o.jsx("div",{className:"flex flex-wrap gap-1",children:r.dependencyGraph.map(e=>o.jsx("span",{className:"text-xs font-mono px-2 py-0.5 rounded",style:{backgroundColor:"var(--color-a11oy-deep)",border:"1px solid var(--color-a11oy-border)",color:"var(--color-a11oy-text-ghost)"},children:e},e))})]}),o.jsxs("div",{className:"font-mono text-xs px-3 py-2 rounded",style:{backgroundColor:"var(--color-a11oy-deep)",border:"1px solid var(--color-a11oy-border)",color:"#22c55e",wordBreak:"break-all"},children:["Proof Ledger Signature: ",r.proofLedgerSignature]})]})}function E(){const[r,x]=v.useState(n[0].agentId),e=n.find(s=>s.agentId===r)??n[0];return o.jsxs(h,{children:[o.jsx(y,{label:"AGENT-BOM โ€” BILL OF MATERIALS",title:"Agent Bill of Materials",subtitle:"Per-agent, continuously-updated AIBOM covering model snapshot fingerprints, tool manifest hashes, constitution version, prompt hashes, evaluation history, and welfare posture. Exportable as CycloneDX ML-BOM v1.7 JSON.",status:"LIVE"}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-8",children:[o.jsx(i,{label:"AGENTS COVERED",value:String(n.length),sub:"with live BOM",accent:a}),o.jsx(i,{label:"TOOLS TRACKED",value:String(n.reduce((s,t)=>s+t.toolManifest.length,0)),sub:"with version hashes",accent:a}),o.jsx(i,{label:"FORMAT",value:"CycloneDX",sub:"ML-BOM v1.7 JSON",accent:"#22c55e"}),o.jsx(i,{label:"SIGNED",value:"100%",sub:"proof ledger chain",accent:"#22c55e"})]}),o.jsxs("div",{className:"grid lg:grid-cols-3 gap-6 mb-8",children:[o.jsxs("div",{children:[o.jsx(m,{children:"Agent Registry"}),o.jsx("div",{className:"flex flex-col gap-2",children:n.map(s=>{const t=s.agentId===r,l=s.evalHistory[s.evalHistory.length-1],c=l.composite>=.95?"#22c55e":l.composite>=.88?a:"#f97316";return o.jsx("div",{className:"rounded-lg border p-3 cursor-pointer transition-all",onClick:()=>x(s.agentId),style:{backgroundColor:t?"rgba(201,183,135,0.03)":"var(--color-a11oy-card)",borderColor:t?a:"var(--color-a11oy-border)"},children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs font-semibold",style:{color:"var(--color-a11oy-text)"},children:s.agentName}),o.jsxs("div",{className:"text-xs font-mono",style:{color:"var(--color-a11oy-text-ghost)"},children:[s.modelProvider," ยท v",s.constitutionVersion]})]}),o.jsxs("span",{className:"text-xs font-mono font-bold",style:{color:c},children:[Math.round(l.composite*100),"%"]})]})},s.agentId)})}),o.jsx("div",{className:"mt-4",children:o.jsx("button",{className:"w-full text-xs font-medium py-2.5 rounded-lg",style:{backgroundColor:"rgba(201,183,135,0.12)",color:a,border:"1px solid rgba(201,183,135,0.25)",cursor:"pointer"},onClick:()=>{const s={bomFormat:"CycloneDX",specVersion:"1.7",serialNumber:`urn:uuid:bom-${e.agentId}-${Date.now()}`,version:1,metadata:{timestamp:e.generatedAt,tools:[{vendor:"a11oy",name:"Agent-BOM Generator",version:"1.0.0"}]},components:[{type:"machine-learning-model",name:e.agentName,version:e.constitutionVersion,"bom-ref":e.agentId,hashes:[{alg:"SHA-256",content:e.modelHash},{alg:"SHA-256",content:e.constitutionHash},{alg:"SHA-256",content:e.systemPromptHash}],properties:[{name:"a11oy:model-provider",value:e.modelProvider},{name:"a11oy:model-snapshot",value:e.modelSnapshot},{name:"a11oy:welfare-posture",value:e.welfarePosture},{name:"a11oy:proof-signature",value:e.proofLedgerSignature}]},...e.toolManifest.map(d=>({type:"library",name:d.name,version:d.version,hashes:[{alg:"SHA-256",content:d.hash}]}))],dependencies:e.dependencyGraph.map(d=>({ref:d}))},t=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),l=URL.createObjectURL(t),c=document.createElement("a");c.href=l,c.download=`${e.agentId}-bom-cyclonedx.json`,c.click(),URL.revokeObjectURL(l)},children:"Export CycloneDX ML-BOM v1.7"})})]}),o.jsxs("div",{className:"lg:col-span-2",children:[o.jsxs(m,{children:[e.agentName," โ€” Bill of Materials"]}),o.jsx(N,{bom:e})]})]}),o.jsxs("div",{className:"p-3 rounded-lg text-xs flex items-center gap-2",style:{backgroundColor:"rgba(201,183,135,0.06)",border:"1px solid rgba(201,183,135,0.15)",color:"var(--color-a11oy-text-ghost)"},children:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--color-a11oy-blue)] flex-shrink-0"})," Agent-BOM โ€” every registered agent has a live bill of materials. CycloneDX export is cryptographically signed via the Proof Ledger. Machine-verifiable by external supply chain auditors."]})]})}export{E as AgentBom};