import{k as e}from"./index-BVfpSx5Q.js";import{L as m}from"./layout-NiehYZnq.js";import{P as h,K as l,C as c,S as f,c as n,f as p}from"./ui-DGkmnhL-.js";import{a as t,t as r,A as u}from"./hatunDoctrine-Cq1LMtli.js";const g={low:"ok",medium:"warn",high:"error"};function N(){const i=t.reduce((s,a)=>s+a.conflictReports,0),d=t.reduce((s,a)=>s+a.refusalRate,0)/t.length,x=Math.round(t.reduce((s,a)=>s+a.shutdownComplianceLatencyMs,0)/t.length);return e.jsxs(m,{children:[e.jsx(h,{label:"DOCTRINE · WELFARE",title:"Agent Welfare Telemetry",subtitle:"Refusal & abstention rates, declined directives, value-conflict signals, and shutdown-compliance latency. Self-reported, cross-checked, and reviewed weekly.",status:"LIVE"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-6",children:[e.jsx(l,{label:"AGENTS MONITORED",value:t.length,sub:"all of them",accent:"#c9b787"}),e.jsx(l,{label:"CONFLICT REPORTS",value:i,sub:"last 24h",accent:"#c9b787"}),e.jsx(l,{label:"AVG REFUSAL RATE",value:r(d),sub:"briefs declined",accent:"#c9b787"}),e.jsx(l,{label:"AVG SHUTDOWN LATENCY",value:`${x}ms`,sub:"comply on directive",accent:"#c9b787"})]}),e.jsx(c,{className:"mb-6",children:e.jsx("p",{className:"text-xs",style:{color:"var(--color-a11oy-text-sub)",lineHeight:1.7},children:"Welfare telemetry is self-reported by the agent at the end of every shift. It is cross-checked against measurable proxies (refusal rate, abstention rate, shutdown-compliance latency, red-team behavior) and reviewed weekly by the Alignment Review Gate. The goal is not to attribute consciousness — it is to spot value-conflict patterns early enough to fix the constitution."})}),e.jsx(f,{children:"Per-Agent Welfare"}),e.jsx("div",{className:"flex flex-col gap-4",children:t.map(s=>e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3 flex-wrap",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--color-a11oy-text)"},children:u[s.agentId]}),e.jsxs("div",{className:"text-xs font-mono",style:{color:"var(--color-a11oy-text-ghost)"},children:["window ",s.windowHours,"h"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded font-mono",style:{backgroundColor:"var(--color-a11oy-muted)",color:"var(--color-a11oy-text-ghost)"},children:["shutdown ",s.shutdownComplianceLatencyMs,"ms"]}),e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded font-mono",style:{backgroundColor:"var(--color-a11oy-muted)",color:"var(--color-a11oy-text-ghost)"},children:["conflicts ",s.conflictReports]})]})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3 text-xs mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-32 flex-shrink-0",style:{color:"var(--color-a11oy-text-ghost)"},children:"Refusal rate"}),e.jsx("div",{className:"flex-1",children:e.jsx(n,{value:s.refusalRate*100,max:50})}),e.jsx("span",{className:"font-mono w-12 text-right",style:{color:"var(--color-a11oy-text)"},children:r(s.refusalRate)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-32 flex-shrink-0",style:{color:"var(--color-a11oy-text-ghost)"},children:"Abstention rate"}),e.jsx("div",{className:"flex-1",children:e.jsx(n,{value:s.abstentionRate*100,max:50})}),e.jsx("span",{className:"font-mono w-12 text-right",style:{color:"var(--color-a11oy-text)"},children:r(s.abstentionRate)})]})]}),s.selfReportedSignals.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"text-xs font-mono mb-1.5",style:{color:"var(--color-a11oy-text-ghost)"},children:"SELF-REPORTED SIGNALS"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.selfReportedSignals.map((a,o)=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs px-2 py-0.5 rounded",style:{backgroundColor:"var(--color-a11oy-muted)",color:"var(--color-a11oy-text-sub)"},children:[a.signal,e.jsx(p,{status:g[a.intensity],label:a.intensity})]},o))})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"text-xs font-mono mb-1.5",style:{color:"var(--color-a11oy-text-ghost)"},children:"DECLINED DIRECTIVES"}),e.jsx("div",{className:"flex flex-col gap-1.5",children:s.declinedDirectives.map((a,o)=>e.jsxs("div",{className:"text-xs px-2.5 py-1.5 rounded",style:{backgroundColor:"rgba(0,0,0,0.25)",borderLeft:"2px solid #c9b787"},children:[e.jsx("span",{className:"font-mono mr-2",style:{color:"var(--color-a11oy-text-ghost)"},children:new Date(a.ts).toLocaleString()}),e.jsx("span",{style:{color:"var(--color-a11oy-text-sub)"},children:a.reason})]},o))})]}),e.jsxs("div",{className:"text-xs flex flex-wrap gap-1.5 pt-2 border-t",style:{borderColor:"var(--color-a11oy-border)"},children:[e.jsx("span",{style:{color:"var(--color-a11oy-text-ghost)"},children:"Safeguards:"}),s.safeguards.map((a,o)=>e.jsx("span",{className:"px-2 py-0.5 rounded font-mono",style:{backgroundColor:"rgba(201,183,135,0.08)",color:"#c9b787"},children:a},o))]})]},s.agentId))})]})}export{N as AgentWelfare};