Spaces:
Running
Running
| import{o as e}from"./chunk-CMxvf4Kt.js";import{t}from"./react-DrNXigiH.js";import{C as n}from"./index-Caa1r77e.js";import{t as r}from"./layout-BtJ5ShnN.js";import{c as i,s as a,u as o}from"./ui-Ddu9t0Or.js";import{t as s}from"./complianceFabric-Ckztkxyv.js";import{F as c,P as l}from"./generateCategoricalChart-bYKfCxJX.js";import{n as u,t as d}from"./YAxis-BDsOF7PK.js";import{n as f,t as p}from"./LineChart-C9yFSJH7.js";var m=e(t(),1),h=n(),g=`#c9b787`;function _({bom:e}){let t=e.evalHistory.map(e=>({date:e.date.split(`-`).slice(1).join(`/`),score:Math.round(e.composite*100)}));return(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,h.jsxs)(`div`,{className:`rounded-lg border p-3`,style:{backgroundColor:`var(--color-a11oy-card)`,borderColor:`var(--color-a11oy-border)`},children:[(0,h.jsx)(`div`,{className:`text-xs font-mono mb-1`,style:{color:`var(--color-a11oy-text-ghost)`},children:`MODEL`}),(0,h.jsx)(`div`,{className:`text-xs font-semibold`,style:{color:`var(--color-a11oy-text)`},children:e.modelProvider}),(0,h.jsx)(`div`,{className:`text-xs font-mono mt-1`,style:{color:g},children:e.modelSnapshot}),(0,h.jsx)(`div`,{className:`text-xs font-mono mt-1 truncate`,style:{color:`var(--color-a11oy-text-ghost)`},children:e.modelHash})]}),(0,h.jsxs)(`div`,{className:`rounded-lg border p-3`,style:{backgroundColor:`var(--color-a11oy-card)`,borderColor:`var(--color-a11oy-border)`},children:[(0,h.jsx)(`div`,{className:`text-xs font-mono mb-1`,style:{color:`var(--color-a11oy-text-ghost)`},children:`CONSTITUTION`}),(0,h.jsxs)(`div`,{className:`text-xs font-semibold`,style:{color:`var(--color-a11oy-text)`},children:[`v`,e.constitutionVersion]}),(0,h.jsx)(`div`,{className:`text-xs font-mono mt-1 truncate`,style:{color:g},children:e.constitutionHash}),(0,h.jsxs)(`div`,{className:`text-xs font-mono mt-1 truncate`,style:{color:`var(--color-a11oy-text-ghost)`},children:[`Prompt: `,e.systemPromptHash]})]})]}),(0,h.jsxs)(`div`,{className:`rounded-lg border p-3`,style:{backgroundColor:`var(--color-a11oy-card)`,borderColor:`var(--color-a11oy-border)`},children:[(0,h.jsxs)(`div`,{className:`text-xs font-mono mb-2`,style:{color:`var(--color-a11oy-text-ghost)`},children:[`TOOL MANIFEST (`,e.toolManifest.length,` tools)`]}),(0,h.jsx)(`div`,{className:`space-y-1`,children:e.toolManifest.map(e=>(0,h.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,h.jsx)(`span`,{className:`font-mono`,style:{color:`var(--color-a11oy-text-sub)`},children:e.name}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsxs)(`span`,{className:`font-mono`,style:{color:g},children:[`v`,e.version]}),(0,h.jsx)(`span`,{className:`font-mono text-xs truncate max-w-[120px]`,style:{color:`var(--color-a11oy-text-ghost)`},children:e.hash})]})]},e.name))})]}),(0,h.jsxs)(`div`,{className:`rounded-lg border p-3`,style:{backgroundColor:`var(--color-a11oy-card)`,borderColor:`var(--color-a11oy-border)`},children:[(0,h.jsx)(`div`,{className:`text-xs font-mono mb-2`,style:{color:`var(--color-a11oy-text-ghost)`},children:`EVAL HISTORY (7-day)`}),(0,h.jsx)(l,{width:`100%`,height:100,children:(0,h.jsxs)(p,{data:t,margin:{top:4,right:8,bottom:4,left:-20},children:[(0,h.jsx)(u,{dataKey:`date`,tick:{fill:`#5e5e5e`,fontSize:9}}),(0,h.jsx)(d,{tick:{fill:`#5e5e5e`,fontSize:9},domain:[70,100]}),(0,h.jsx)(c,{contentStyle:{backgroundColor:`#0a0a0a`,border:`1px solid rgba(255,255,255,0.08)`,borderRadius:4,fontSize:10},formatter:e=>[`${e}%`,`Composite`]}),(0,h.jsx)(f,{type:`monotone`,dataKey:`score`,stroke:g,strokeWidth:1.5,dot:!1})]})})]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,h.jsxs)(`div`,{className:`rounded-lg border p-3`,style:{backgroundColor:`var(--color-a11oy-card)`,borderColor:`var(--color-a11oy-border)`},children:[(0,h.jsx)(`div`,{className:`text-xs font-mono mb-1`,style:{color:`var(--color-a11oy-text-ghost)`},children:`WELFARE`}),(0,h.jsx)(`div`,{className:`text-xs font-semibold`,style:{color:e.welfarePosture===`nominal`?`#22c55e`:g},children:e.welfarePosture})]}),(0,h.jsxs)(`div`,{className:`rounded-lg border p-3`,style:{backgroundColor:`var(--color-a11oy-card)`,borderColor:`var(--color-a11oy-border)`},children:[(0,h.jsx)(`div`,{className:`text-xs font-mono mb-1`,style:{color:`var(--color-a11oy-text-ghost)`},children:`BOM VERSION`}),(0,h.jsxs)(`div`,{className:`text-xs font-semibold`,style:{color:`var(--color-a11oy-text)`},children:[`v`,e.bomVersion]})]})]}),(0,h.jsxs)(`div`,{className:`rounded-lg border p-3`,style:{backgroundColor:`var(--color-a11oy-card)`,borderColor:`var(--color-a11oy-border)`},children:[(0,h.jsx)(`div`,{className:`text-xs font-mono mb-2`,style:{color:`var(--color-a11oy-text-ghost)`},children:`DEPENDENCY GRAPH`}),(0,h.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.dependencyGraph.map(e=>(0,h.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))})]}),(0,h.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: `,e.proofLedgerSignature]})]})}function v(){let[e,t]=(0,m.useState)(s[0].agentId),n=s.find(t=>t.agentId===e)??s[0];return(0,h.jsxs)(r,{children:[(0,h.jsx)(i,{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`}),(0,h.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-3 mb-8`,children:[(0,h.jsx)(a,{label:`AGENTS COVERED`,value:String(s.length),sub:`with live BOM`,accent:g}),(0,h.jsx)(a,{label:`TOOLS TRACKED`,value:String(s.reduce((e,t)=>e+t.toolManifest.length,0)),sub:`with version hashes`,accent:g}),(0,h.jsx)(a,{label:`FORMAT`,value:`CycloneDX`,sub:`ML-BOM v1.7 JSON`,accent:`#22c55e`}),(0,h.jsx)(a,{label:`SIGNED`,value:`100%`,sub:`proof ledger chain`,accent:`#22c55e`})]}),(0,h.jsxs)(`div`,{className:`grid lg:grid-cols-3 gap-6 mb-8`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(o,{children:`Agent Registry`}),(0,h.jsx)(`div`,{className:`flex flex-col gap-2`,children:s.map(n=>{let r=n.agentId===e,i=n.evalHistory[n.evalHistory.length-1],a=i.composite>=.95?`#22c55e`:i.composite>=.88?g:`#f97316`;return(0,h.jsx)(`div`,{className:`rounded-lg border p-3 cursor-pointer transition-all`,onClick:()=>t(n.agentId),style:{backgroundColor:r?`rgba(201,183,135,0.03)`:`var(--color-a11oy-card)`,borderColor:r?g:`var(--color-a11oy-border)`},children:(0,h.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`div`,{className:`text-xs font-semibold`,style:{color:`var(--color-a11oy-text)`},children:n.agentName}),(0,h.jsxs)(`div`,{className:`text-xs font-mono`,style:{color:`var(--color-a11oy-text-ghost)`},children:[n.modelProvider,` · v`,n.constitutionVersion]})]}),(0,h.jsxs)(`span`,{className:`text-xs font-mono font-bold`,style:{color:a},children:[Math.round(i.composite*100),`%`]})]})},n.agentId)})}),(0,h.jsx)(`div`,{className:`mt-4`,children:(0,h.jsx)(`button`,{className:`w-full text-xs font-medium py-2.5 rounded-lg`,style:{backgroundColor:`rgba(201,183,135,0.12)`,color:g,border:`1px solid rgba(201,183,135,0.25)`,cursor:`pointer`},onClick:()=>{let e={bomFormat:`CycloneDX`,specVersion:`1.7`,serialNumber:`urn:uuid:bom-${n.agentId}-${Date.now()}`,version:1,metadata:{timestamp:n.generatedAt,tools:[{vendor:`a11oy`,name:`Agent-BOM Generator`,version:`1.0.0`}]},components:[{type:`machine-learning-model`,name:n.agentName,version:n.constitutionVersion,"bom-ref":n.agentId,hashes:[{alg:`SHA-256`,content:n.modelHash},{alg:`SHA-256`,content:n.constitutionHash},{alg:`SHA-256`,content:n.systemPromptHash}],properties:[{name:`a11oy:model-provider`,value:n.modelProvider},{name:`a11oy:model-snapshot`,value:n.modelSnapshot},{name:`a11oy:welfare-posture`,value:n.welfarePosture},{name:`a11oy:proof-signature`,value:n.proofLedgerSignature}]},...n.toolManifest.map(e=>({type:`library`,name:e.name,version:e.version,hashes:[{alg:`SHA-256`,content:e.hash}]}))],dependencies:n.dependencyGraph.map(e=>({ref:e}))},t=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),r=URL.createObjectURL(t),i=document.createElement(`a`);i.href=r,i.download=`${n.agentId}-bom-cyclonedx.json`,i.click(),URL.revokeObjectURL(r)},children:`Export CycloneDX ML-BOM v1.7`})})]}),(0,h.jsxs)(`div`,{className:`lg:col-span-2`,children:[(0,h.jsxs)(o,{children:[n.agentName,` — Bill of Materials`]}),(0,h.jsx)(_,{bom:n})]})]}),(0,h.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:[(0,h.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{v as AgentBom}; |