a(null),onApprove:()=>{m(),f(t=>({...t,approved:t.approved+1}))},onDeny:()=>{m(),f(t=>({...t,denied:t.denied+1}))}})]})})}function F({expiresAt:s,isT2:o}){const[x,u]=n.useState("");return n.useEffect(()=>{const v=()=>{const b=s-Date.now();if(b<=0){u("EXPIRED");return}const h=Math.floor(b/6e4),c=Math.floor(b%6e4/1e3);u(`${h}m ${c.toString().padStart(2,"0")}s`)};v();const g=setInterval(v,1e3);return()=>clearInterval(g)},[s]),e.jsx("span",{className:`font-mono text-sm font-bold ${o?"text-red-400":"text-amber-400"}`,children:x})}function S(s){const o=Date.now()-s;return o<6e4?`${Math.floor(o/1e3)}s ago`:o<36e5?`${Math.floor(o/6e4)}m ago`:`${Math.floor(o/36e5)}h ago`}function O(s){return s<1e3?`${s}ms`:s<6e4?`${Math.floor(s/1e3)}s`:s<36e5?`${Math.floor(s/6e4)}m ${Math.floor(s%6e4/1e3)}s`:`${Math.floor(s/36e5)}h ${Math.floor(s%36e5/6e4)}m`}export{Q as default};
-//# sourceMappingURL=ApprovalsPremium-CdjJuruO.js.map
diff --git a/apps/console-proxy/public/assets/CompliancePage-Bpt_D9yK.js b/apps/console-proxy/public/assets/CompliancePage-C5o8sfAA.js
similarity index 99%
rename from apps/console-proxy/public/assets/CompliancePage-Bpt_D9yK.js
rename to apps/console-proxy/public/assets/CompliancePage-C5o8sfAA.js
index a20e5500..e58baefc 100644
--- a/apps/console-proxy/public/assets/CompliancePage-Bpt_D9yK.js
+++ b/apps/console-proxy/public/assets/CompliancePage-C5o8sfAA.js
@@ -1,2 +1,2 @@
-import{a as j,r as d,j as e}from"./index-D_7YXFSJ.js";const g={getQuickStats:(s=30)=>j.get("/compliance/quick-stats",{period:s}),listReports:(s=50,i=0)=>j.get("/compliance/reports",{limit:s,offset:i}),getReport:s=>j.get(`/compliance/reports/${s}`),generateReport:s=>j.post("/compliance/reports/generate",s),deleteReport:s=>j.delete(`/compliance/reports/${s}`),getPdfUrl:s=>`/api/v1/compliance/reports/${s}/pdf`,getCsvUrl:s=>`/api/v1/compliance/reports/${s}/csv`,listTemplates:()=>j.get("/compliance/templates"),createTemplate:s=>j.post("/compliance/templates",s),updateTemplate:(s,i)=>j.put(`/compliance/templates/${s}`,i),createSchedule:s=>j.post("/compliance/schedule",s)},B={executive_summary:"Executive Summary",governance_overview:"Governance Overview",action_volume:"Action Volume",policy_compliance:"Policy Compliance",agent_performance:"Agent Performance",risk_analysis:"Risk Analysis",approval_metrics:"Approval Metrics",violations_incidents:"Violations & Incidents",integration_health:"Integration Health",recommendations:"Recommendations"},M=Object.keys(B),t={page:{padding:"0"},statsGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"12px",marginBottom:"28px"},statCard:s=>({background:"var(--bg-panel, #0F1419)",borderRadius:"0",padding:"20px",textAlign:"center"}),statValue:s=>({fontSize:"32px",fontWeight:700,color:s,lineHeight:1.1}),statLabel:{fontSize:"11px",color:"#94a3b8",marginTop:"6px",textTransform:"uppercase",letterSpacing:"0.5px"},statUnit:{fontSize:"14px",fontWeight:400,color:"#64748b"},periodBar:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px"},periodBtn:s=>({padding:"6px 14px",fontSize:"12px",fontWeight:s?600:400,color:s?"#f59e0b":"#94a3b8",background:s?"rgba(245,158,11,0.15)":"transparent",border:"1px solid "+(s?"rgba(245,158,11,0.3)":"rgba(255,255,255,0.08)"),borderRadius:"0",cursor:"pointer",marginLeft:"6px"}),tabBar:{display:"flex",gap:"2px",marginBottom:"24px",borderBottom:"1px solid rgba(251, 191, 36, 0.15)"},tab:s=>({padding:"10px 18px",fontSize:"13px",fontWeight:s?600:400,color:s?"var(--text-primary)":"#94a3b8",background:"transparent",border:"none",borderBottom:s?"2px solid var(--text-primary)":"2px solid transparent",borderRadius:0,cursor:"pointer"}),primaryBtn:{padding:"10px 20px",fontSize:"13px",fontWeight:600,color:"#fff",background:"#f59e0b",border:"none",borderRadius:"0",cursor:"pointer"},secondaryBtn:{padding:"8px 16px",fontSize:"12px",fontWeight:500,color:"#f59e0b",background:"rgba(245,158,11,0.1)",border:"1px solid rgba(245,158,11,0.2)",borderRadius:"0",cursor:"pointer"},dangerBtn:{padding:"6px 12px",fontSize:"11px",fontWeight:500,color:"#ef4444",background:"rgba(239,68,68,0.1)",border:"1px solid rgba(239,68,68,0.2)",borderRadius:"0",cursor:"pointer"},ghostBtn:{padding:"6px 12px",fontSize:"11px",fontWeight:500,color:"#94a3b8",background:"transparent",border:"1px solid rgba(251, 191, 36, 0.15)",borderRadius:"0",cursor:"pointer"},overlay:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},modal:{background:"var(--bg-panel, #0F1419)",border:"1px solid rgba(251, 191, 36, 0.2)",borderRadius:"0",padding:"28px",width:"520px",maxHeight:"80vh",overflow:"auto"},modalTitle:{fontSize:"18px",fontWeight:700,color:"#e2e8f0",marginBottom:"20px"},formGroup:{marginBottom:"16px"},label:{display:"block",fontSize:"12px",fontWeight:600,color:"#94a3b8",marginBottom:"6px",textTransform:"uppercase",letterSpacing:"0.5px"},select:{width:"100%",padding:"10px 12px",fontSize:"13px",color:"#e2e8f0",background:"var(--bg-app, #0A0E14)",border:"1px solid rgba(251, 191, 36, 0.2)",borderRadius:"0",outline:"none"},input:{width:"100%",padding:"10px 12px",fontSize:"13px",color:"#e2e8f0",background:"var(--bg-app, #0A0E14)",border:"1px solid rgba(251, 191, 36, 0.2)",borderRadius:"0",outline:"none"},checkbox:{marginRight:"8px"},checkboxLabel:{fontSize:"13px",color:"#cbd5e1",cursor:"pointer"},table:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},th:{padding:"10px 12px",textAlign:"left",fontWeight:600,color:"#94a3b8",borderBottom:"1px solid rgba(251, 191, 36, 0.15)",fontSize:"11px",textTransform:"uppercase",letterSpacing:"0.5px"},td:{padding:"10px 12px",borderBottom:"1px solid rgba(251, 191, 36, 0.1)",color:"#cbd5e1"},viewerWrapper:{background:"var(--bg-panel, #0F1419)",borderRadius:"0",padding:"0",overflow:"hidden",border:"1px solid rgba(251, 191, 36, 0.2)"},viewerToolbar:{display:"flex",gap:"8px",alignItems:"center",justifyContent:"space-between",padding:"12px 20px",background:"var(--bg-panel, #0F1419)",borderBottom:"1px solid rgba(251, 191, 36, 0.15)"},viewerContent:{padding:"32px 40px",background:"var(--surface-secondary, #12131a)"},viewerNav:{position:"sticky",top:0,display:"flex",flexDirection:"column",gap:"2px",padding:"12px",background:"var(--bg-app, #0A0E14)",borderRight:"1px solid rgba(251, 191, 36, 0.15)",minWidth:"200px"},viewerNavItem:s=>({padding:"8px 12px",fontSize:"12px",fontWeight:s?600:400,color:s?"#f59e0b":"#64748b",background:s?"rgba(245,158,11,0.08)":"transparent",border:"none",borderRadius:"0",cursor:"pointer",textAlign:"left"}),badge:(s,i)=>({display:"inline-block",padding:"2px 10px",borderRadius:"0",fontSize:"11px",fontWeight:600,color:s,background:i}),statusBadge:s=>{const i={ready:["#166534","#dcfce7"],generating:["#854d0e","#fef9c3"],failed:["#991b1b","#fee2e2"],scheduled:["#1e40af","#dbeafe"]},[l,r]=i[s]||["#64748b","#f1f5f9"];return{display:"inline-block",padding:"2px 10px",borderRadius:"0",fontSize:"11px",fontWeight:600,color:l,background:r}},sectionBlock:{marginBottom:"32px",color:"#e2e8f0"},sectionTitle:{fontSize:"18px",fontWeight:700,color:"#e2e8f0",marginBottom:"12px",paddingBottom:"8px",borderBottom:"1px solid rgba(251, 191, 36, 0.15)"},kpiGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px"},kpiCard:{background:"var(--bg-panel, #0F1419)",border:"1px solid rgba(251, 191, 36, 0.15)",borderRadius:"0",padding:"14px",textAlign:"center"},kpiValue:(s="#e2e8f0")=>({fontSize:"24px",fontWeight:700,color:s}),kpiLabel:{fontSize:"10px",color:"rgba(255,255,255,0.6)",marginTop:"2px",textTransform:"uppercase",letterSpacing:"0.5px"},barRow:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},barLabel:{width:"120px",fontSize:"12px",fontWeight:500,color:"rgba(255,255,255,0.6)",textAlign:"right"},barTrack:{flex:1,height:"16px",background:"rgba(255,255,255,0.08)",borderRadius:"0",overflow:"hidden"},barFill:(s,i)=>({width:`${s}%`,height:"100%",background:i,borderRadius:"0"}),barValue:{width:"36px",fontSize:"12px",fontWeight:600,color:"rgba(255,255,255,0.6)"},dataTable:{width:"100%",borderCollapse:"collapse",fontSize:"12px",marginBottom:"12px"},dtTh:{padding:"8px 10px",textAlign:"left",fontWeight:600,color:"rgba(255,255,255,0.6)",borderBottom:"2px solid rgba(255,255,255,0.08)",background:"var(--bg-panel, #0F1419)",fontSize:"10px",textTransform:"uppercase"},dtTd:{padding:"8px 10px",borderBottom:"1px solid rgba(251, 191, 36, 0.1)",color:"#e2e8f0"},trustBar:s=>({display:"inline-flex",alignItems:"center",gap:"4px",color:s>=80?"#22c55e":s>=60?"#f59e0b":"#ef4444"}),highlight:{background:"var(--bg-panel, #0F1419)",borderRadius:"0",padding:"14px 18px",marginTop:"12px"},highlightItem:{fontSize:"13px",color:"rgba(255,255,255,0.6)",marginBottom:"4px",lineHeight:1.5},rec:s=>{const i={critical:["#fef2f2","#ef4444"],warning:["#fffbeb","#f59e0b"],info:["#eff6ff","#3b82f6"]},[l,r]=i[s]||["#f8fafc","#94a3b8"];return{padding:"12px 14px",borderRadius:"0",marginBottom:"8px",borderLeft:`4px solid ${r}`,background:l}},recCategory:{fontSize:"11px",fontWeight:600,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.5px",marginLeft:"8px"},recMessage:{fontSize:"13px",color:"#e2e8f0",margin:"4px 0"},recAction:{fontSize:"12px",color:"rgba(255,255,255,0.6)",fontStyle:"italic"},callout:s=>({padding:"10px 14px",borderRadius:"0",marginBottom:"8px",fontSize:"13px",background:s==="green"?"rgba(34, 197, 94, 0.15)":"rgba(245, 158, 11, 0.15)",borderLeft:`4px solid ${s==="green"?"#22c55e":"#f59e0b"}`,color:"#e2e8f0"}),empty:{textAlign:"center",padding:"60px 20px",color:"rgba(255,255,255,0.6)"},spinner:{display:"inline-block",width:"16px",height:"16px",border:"2px solid #f59e0b",borderTop:"2px solid transparent",borderRadius:"50%",animation:"spin 0.8s linear infinite"}};function oe(){const[s,i]=d.useState("dashboard"),[l,r]=d.useState(30),[o,c]=d.useState(null),[h,x]=d.useState([]),[b,f]=d.useState(0),[w,m]=d.useState([]),[y,S]=d.useState(null),[R,C]=d.useState(""),[A,a]=d.useState(!1),[v,_]=d.useState(!1),[ie,D]=d.useState(!1),[L,z]=d.useState(""),I=d.useCallback(async()=>{try{const n=await g.getQuickStats(l);c(n)}catch{}},[l]),T=d.useCallback(async()=>{try{const n=await g.listReports();x(n.reports),f(n.total)}catch{}},[]),V=d.useCallback(async()=>{try{const n=await g.listTemplates();m(n)}catch{}},[]);d.useEffect(()=>{I()},[I]),d.useEffect(()=>{T(),V()},[T,V]);const G=async n=>{D(!0);try{const u=await g.getReport(n);S(u);const k=typeof u.report_data=="string"?JSON.parse(u.report_data):u.report_data,$=Object.keys(k.sections||{})[0]||"";C($),i("viewer")}catch(u){z(u.message)}finally{D(!1)}},E=async n=>{if(confirm("Delete this report?"))try{await g.deleteReport(n),T()}catch(u){z(u.message)}},F=n=>{a(!1),T();const u=setInterval(async()=>{try{const k=await g.getReport(n.id);(k.status==="ready"||k.status==="failed")&&(clearInterval(u),T(),k.status==="ready"&&G(k.id))}catch{clearInterval(u)}},2e3)};return e.jsxs("div",{style:t.page,children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"22px",fontWeight:700,color:"#e2e8f0",margin:0},children:"Compliance Reports"}),e.jsx("p",{style:{fontSize:"13px",color:"#94a3b8",marginTop:"4px"},children:"Board-ready governance reports with real data"})]}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("button",{style:t.secondaryBtn,onClick:()=>_(!0),children:"Schedule Report"}),e.jsx("button",{style:t.primaryBtn,onClick:()=>a(!0),children:"Generate Report"})]})]}),e.jsx("div",{style:t.tabBar,children:["dashboard","history","viewer","schedules"].map(n=>e.jsx("button",{style:t.tab(s===n),onClick:()=>i(n),children:n==="dashboard"?"📊 Dashboard":n==="history"?"📋 Reports":n==="viewer"?"📄 Viewer":"⏰ Schedules"},n))}),L&&e.jsxs("div",{style:{padding:"10px 14px",background:"rgba(239,68,68,0.1)",border:"1px solid rgba(239,68,68,0.2)",borderRadius:"0",color:"#ef4444",fontSize:"13px",marginBottom:"16px"},children:[L," ",e.jsx("button",{onClick:()=>z(""),style:{float:"right",background:"none",border:"none",color:"#ef4444",cursor:"pointer"},children:"✕"})]}),s==="dashboard"&&e.jsxs("div",{children:[e.jsxs("div",{style:t.periodBar,children:[e.jsx("span",{style:{fontSize:"13px",color:"#94a3b8"},children:"Reporting period"}),e.jsx("div",{children:[7,30,90,365].map(n=>e.jsx("button",{style:t.periodBtn(l===n),onClick:()=>r(n),children:n===365?"1y":`${n}d`},n))})]}),o?e.jsxs("div",{style:t.statsGrid,children:[e.jsxs("div",{style:t.statCard("#f59e0b"),children:[e.jsx("div",{style:t.statValue("#f59e0b"),children:o.total_actions.toLocaleString()}),e.jsx("div",{style:t.statLabel,children:"Actions Governed"})]}),e.jsxs("div",{style:t.statCard(o.compliance_rate>=95?"#22c55e":"#ef4444"),children:[e.jsxs("div",{style:t.statValue(o.compliance_rate>=95?"#10b981":"#ef4444"),children:[o.compliance_rate,"%"]}),e.jsx("div",{style:t.statLabel,children:"Compliance Rate"})]}),e.jsxs("div",{style:t.statCard(o.policy_violations>10?"#ef4444":o.policy_violations>0?"#f59e0b":"#22c55e"),children:[e.jsx("div",{style:t.statValue(o.policy_violations>10?"#ef4444":o.policy_violations>0?"#f59e0b":"#10b981"),children:o.policy_violations}),e.jsx("div",{style:t.statLabel,children:"Policy Violations"})]}),e.jsxs("div",{style:t.statCard("#3b82f6"),children:[e.jsxs("div",{style:t.statValue("#60a5fa"),children:[o.avg_approval_time_minutes,e.jsx("span",{style:t.statUnit,children:" min"})]}),e.jsx("div",{style:t.statLabel,children:"Avg Approval Time"})]}),e.jsxs("div",{style:t.statCard(o.unauthorized_executions>0?"#ef4444":"#22c55e"),children:[e.jsx("div",{style:t.statValue(o.unauthorized_executions>0?"#ef4444":"#10b981"),children:o.unauthorized_executions}),e.jsx("div",{style:t.statLabel,children:"Unauthorized Executions"})]}),e.jsxs("div",{style:t.statCard(o.fleet_health_score>=80?"#22c55e":o.fleet_health_score>=60?"#f59e0b":"#ef4444"),children:[e.jsxs("div",{style:t.statValue(o.fleet_health_score>=80?"#10b981":o.fleet_health_score>=60?"#f59e0b":"#ef4444"),children:[o.fleet_health_score,e.jsx("span",{style:t.statUnit,children:"/100"})]}),e.jsx("div",{style:t.statLabel,children:"Fleet Health Score"})]})]}):e.jsxs("div",{style:t.empty,children:[e.jsx("div",{style:t.spinner})," Loading stats..."]}),e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#e2e8f0",marginBottom:"12px"},children:"Recent Reports"}),h.length>0?e.jsxs("table",{style:t.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.th,children:"Title"}),e.jsx("th",{style:t.th,children:"Type"}),e.jsx("th",{style:t.th,children:"Status"}),e.jsx("th",{style:t.th,children:"Generated"}),e.jsx("th",{style:t.th,children:"Actions"})]})}),e.jsx("tbody",{children:h.slice(0,5).map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:t.td,children:n.title}),e.jsx("td",{style:t.td,children:e.jsx("span",{style:t.badge("#f59e0b","rgba(245,158,11,0.15)"),children:n.report_type})}),e.jsx("td",{style:t.td,children:e.jsx("span",{style:t.statusBadge(n.status),children:n.status})}),e.jsx("td",{style:t.td,children:new Date(n.generated_at).toLocaleDateString()}),e.jsx("td",{style:t.td,children:n.status==="ready"&&e.jsx("button",{style:t.ghostBtn,onClick:()=>G(n.id),children:"View"})})]},n.id))})]}):e.jsx("div",{style:t.empty,children:"No reports yet. Generate your first compliance report above."})]}),s==="history"&&e.jsxs("div",{children:[e.jsxs("table",{style:t.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.th,children:"Title"}),e.jsx("th",{style:t.th,children:"Type"}),e.jsx("th",{style:t.th,children:"Period"}),e.jsx("th",{style:t.th,children:"Generated By"}),e.jsx("th",{style:t.th,children:"Date"}),e.jsx("th",{style:t.th,children:"Status"}),e.jsx("th",{style:t.th,children:"Actions"})]})}),e.jsx("tbody",{children:h.map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:t.td,children:n.title}),e.jsx("td",{style:t.td,children:e.jsx("span",{style:t.badge("#f59e0b","rgba(245,158,11,0.15)"),children:n.report_type})}),e.jsxs("td",{style:{...t.td,fontSize:"11px"},children:[new Date(n.period_start).toLocaleDateString()," – ",new Date(n.period_end).toLocaleDateString()]}),e.jsx("td",{style:t.td,children:n.generated_by}),e.jsx("td",{style:t.td,children:new Date(n.generated_at).toLocaleString()}),e.jsx("td",{style:t.td,children:e.jsx("span",{style:t.statusBadge(n.status),children:n.status})}),e.jsxs("td",{style:{...t.td,display:"flex",gap:"4px"},children:[n.status==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{style:t.ghostBtn,onClick:()=>G(n.id),children:"View"}),e.jsx("a",{href:g.getPdfUrl(n.id),target:"_blank",rel:"noreferrer",style:{...t.ghostBtn,textDecoration:"none"},children:"PDF"}),e.jsx("a",{href:g.getCsvUrl(n.id),style:{...t.ghostBtn,textDecoration:"none"},children:"CSV"})]}),e.jsx("button",{style:t.dangerBtn,onClick:()=>E(n.id),children:"Delete"})]})]},n.id))})]}),h.length===0&&e.jsx("div",{style:t.empty,children:"No reports generated yet."})]}),s==="viewer"&&(y?e.jsx(U,{report:y,activeSection:R,onSectionChange:C,onBack:()=>{S(null),i("history")}}):e.jsx("div",{style:t.empty,children:"Select a report from the History tab to view it."})),s==="schedules"&&e.jsxs("div",{children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx("button",{style:t.primaryBtn,onClick:()=>_(!0),children:"+ Add Schedule"})}),h.filter(n=>n.schedule_cron).length>0?e.jsxs("table",{style:t.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.th,children:"Report Type"}),e.jsx("th",{style:t.th,children:"Schedule"}),e.jsx("th",{style:t.th,children:"Recipients"})]})}),e.jsx("tbody",{children:h.filter(n=>n.schedule_cron).map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:t.td,children:n.report_type}),e.jsx("td",{style:t.td,children:e.jsx("code",{style:{fontSize:"12px",color:"#f59e0b"},children:n.schedule_cron})}),e.jsx("td",{style:t.td,children:(n.recipients||[]).join(", ")||"—"})]},n.id))})]}):e.jsx("div",{style:t.empty,children:"No scheduled reports. Set up recurring report generation."})]}),A&&e.jsx(P,{templates:w,onClose:()=>a(!1),onGenerated:F}),v&&e.jsx(N,{onClose:()=>_(!1),onCreated:()=>{_(!1),T()}})]})}function P({templates:s,onClose:i,onGenerated:l}){const[r,o]=d.useState("quarterly"),[c,h]=d.useState(""),[x,b]=d.useState([...M]),[f,w]=d.useState(""),[m,y]=d.useState(""),[S,R]=d.useState(!1),C=a=>{b(v=>v.includes(a)?v.filter(_=>_!==a):[...v,a])},A=async()=>{R(!0);try{const a={report_type:r,sections:x};c&&(a.template_id=c),r==="custom"&&f&&(a.period_start=f),r==="custom"&&m&&(a.period_end=m);const v=await g.generateReport(a);l(v)}catch(a){alert("Generation failed: "+a.message)}finally{R(!1)}};return e.jsx("div",{style:t.overlay,onClick:i,children:e.jsxs("div",{style:t.modal,onClick:a=>a.stopPropagation(),children:[e.jsx("h2",{style:t.modalTitle,children:"Generate Compliance Report"}),e.jsxs("div",{style:t.formGroup,children:[e.jsx("label",{style:t.label,children:"Report Type"}),e.jsxs("select",{style:t.select,value:r,onChange:a=>o(a.target.value),children:[e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"}),e.jsx("option",{value:"quarterly",children:"Quarterly"}),e.jsx("option",{value:"annual",children:"Annual"}),e.jsx("option",{value:"custom",children:"Custom Range"})]})]}),r==="custom"&&e.jsxs("div",{style:{display:"flex",gap:"12px"},children:[e.jsxs("div",{style:{...t.formGroup,flex:1},children:[e.jsx("label",{style:t.label,children:"Start Date"}),e.jsx("input",{type:"date",style:t.input,value:f,onChange:a=>w(a.target.value)})]}),e.jsxs("div",{style:{...t.formGroup,flex:1},children:[e.jsx("label",{style:t.label,children:"End Date"}),e.jsx("input",{type:"date",style:t.input,value:m,onChange:a=>y(a.target.value)})]})]}),s.length>0&&e.jsxs("div",{style:t.formGroup,children:[e.jsx("label",{style:t.label,children:"Template"}),e.jsxs("select",{style:t.select,value:c,onChange:a=>h(a.target.value),children:[e.jsx("option",{value:"",children:"All Sections (Default)"}),s.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]})]}),e.jsxs("div",{style:t.formGroup,children:[e.jsx("label",{style:t.label,children:"Sections"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"6px"},children:M.map(a=>e.jsxs("label",{style:{...t.checkboxLabel,display:"flex",alignItems:"center"},children:[e.jsx("input",{type:"checkbox",style:t.checkbox,checked:x.includes(a),onChange:()=>C(a)}),B[a]]},a))})]}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginTop:"20px"},children:[e.jsx("button",{style:t.secondaryBtn,onClick:i,children:"Cancel"}),e.jsx("button",{style:{...t.primaryBtn,opacity:S?.6:1},disabled:S,onClick:A,children:S?"Generating...":"Generate Report"})]})]})})}function N({onClose:s,onCreated:i}){const[l,r]=d.useState("weekly"),[o,c]=d.useState("weekly"),[h,x]=d.useState(""),[b,f]=d.useState(!1),w={daily:"0 8 * * *",weekly:"0 8 * * 1",monthly:"0 8 1 * *"},m=async()=>{f(!0);try{await g.createSchedule({report_type:l,schedule_cron:w[o]||"0 8 * * 1",recipients:h.split(",").map(y=>y.trim()).filter(Boolean)}),i()}catch(y){alert("Failed: "+y.message)}finally{f(!1)}};return e.jsx("div",{style:t.overlay,onClick:s,children:e.jsxs("div",{style:t.modal,onClick:y=>y.stopPropagation(),children:[e.jsx("h2",{style:t.modalTitle,children:"Schedule Recurring Report"}),e.jsxs("div",{style:t.formGroup,children:[e.jsx("label",{style:t.label,children:"Report Type"}),e.jsxs("select",{style:t.select,value:l,onChange:y=>r(y.target.value),children:[e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"}),e.jsx("option",{value:"quarterly",children:"Quarterly"})]})]}),e.jsxs("div",{style:t.formGroup,children:[e.jsx("label",{style:t.label,children:"Frequency"}),e.jsxs("select",{style:t.select,value:o,onChange:y=>c(y.target.value),children:[e.jsx("option",{value:"daily",children:"Daily (8:00 AM)"}),e.jsx("option",{value:"weekly",children:"Weekly (Monday 8:00 AM)"}),e.jsx("option",{value:"monthly",children:"Monthly (1st, 8:00 AM)"})]})]}),e.jsxs("div",{style:t.formGroup,children:[e.jsx("label",{style:t.label,children:"Recipients (comma-separated emails)"}),e.jsx("input",{style:t.input,placeholder:"ciso@company.com, cto@company.com",value:h,onChange:y=>x(y.target.value)})]}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginTop:"20px"},children:[e.jsx("button",{style:t.secondaryBtn,onClick:s,children:"Cancel"}),e.jsx("button",{style:{...t.primaryBtn,opacity:b?.6:1},disabled:b,onClick:m,children:b?"Creating...":"Create Schedule"})]})]})})}function U({report:s,activeSection:i,onSectionChange:l,onBack:r}){const c=(typeof s.report_data=="string"?JSON.parse(s.report_data):s.report_data).sections||{},h=Object.keys(c);return e.jsxs("div",{style:t.viewerWrapper,children:[e.jsxs("div",{style:t.viewerToolbar,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[e.jsx("button",{onClick:r,style:{...t.ghostBtn,color:"#64748b"},children:"← Back"}),e.jsx("span",{style:{fontSize:"14px",fontWeight:600,color:"#e2e8f0"},children:s.title})]}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("a",{href:g.getPdfUrl(s.id),target:"_blank",rel:"noreferrer",style:{...t.primaryBtn,textDecoration:"none",fontSize:"12px",padding:"8px 14px",background:"#f59e0b"},children:"Download PDF"}),e.jsx("a",{href:g.getCsvUrl(s.id),style:{...t.secondaryBtn,textDecoration:"none",color:"#f59e0b",borderColor:"rgba(245,158,11,0.2)"},children:"Export CSV"})]})]}),e.jsxs("div",{style:{display:"flex"},children:[e.jsx("div",{style:t.viewerNav,children:h.map((x,b)=>e.jsxs("button",{style:t.viewerNavItem(i===x),onClick:()=>l(x),children:[b+1,". ",B[x]||x]},x))}),e.jsxs("div",{style:t.viewerContent,children:[e.jsxs("div",{style:{marginBottom:"32px",borderBottom:"3px solid #f59e0b",paddingBottom:"20px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:700,color:"#f59e0b",letterSpacing:"2px",marginBottom:"8px"},children:"VIENNA OS"}),e.jsx("h1",{style:{fontSize:"24px",fontWeight:700,color:"#e2e8f0",margin:"0 0 6px"},children:s.title}),e.jsxs("div",{style:{fontSize:"13px",color:"rgba(255,255,255,0.6)"},children:["Period: ",e.jsx("strong",{children:new Date(s.period_start).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})})," — ",e.jsx("strong",{children:new Date(s.period_end).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})})," · ","Generated: ",new Date(s.generated_at).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})]})]}),h.map((x,b)=>e.jsx("div",{id:`section-${x}`,style:t.sectionBlock,children:e.jsx(O,{sectionKey:x,data:c[x],index:b+1})},x))]})]})]})}function O({sectionKey:s,data:i,index:l}){if(!i||i.error)return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[l,". ",B[s]||s]}),e.jsx("p",{style:{color:"#94a3b8",fontStyle:"italic"},children:(i==null?void 0:i.error)||"No data available"})]});switch(s){case"executive_summary":return e.jsx(q,{data:i,index:l});case"governance_overview":return e.jsx(H,{data:i,index:l});case"action_volume":return e.jsx(Q,{data:i,index:l});case"policy_compliance":return e.jsx(J,{data:i,index:l});case"agent_performance":return e.jsx(K,{data:i,index:l});case"risk_analysis":return e.jsx(X,{data:i,index:l});case"approval_metrics":return e.jsx(Y,{data:i,index:l});case"violations_incidents":return e.jsx(Z,{data:i,index:l});case"integration_health":return e.jsx(ee,{data:i,index:l});case"recommendations":return e.jsx(te,{data:i,index:l});default:return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[l,". ",s]}),e.jsx("pre",{style:{fontSize:"11px",color:"#64748b"},children:JSON.stringify(i,null,2)})]})}}function q({data:s,index:i}){var l,r;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Executive Summary"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:((l=s.total_actions_governed)==null?void 0:l.toLocaleString())||"0",label:"Actions Governed"}),e.jsx(p,{value:`${s.policy_compliance_rate||0}%`,label:"Compliance Rate",color:(s.policy_compliance_rate||0)>=95?"#16a34a":"#dc2626"}),e.jsx(p,{value:String(s.unauthorized_executions||0),label:"Unauthorized Executions",color:s.unauthorized_executions===0?"#16a34a":"#dc2626"}),e.jsx(p,{value:`${s.fleet_health_score||0}/100`,label:"Fleet Health",color:(s.fleet_health_score||0)>=80?"#16a34a":"#f59e0b"}),e.jsx(p,{value:String(s.active_agents||0),label:"Active Agents"}),e.jsx(p,{value:`${s.avg_approval_time_minutes||0} min`,label:"Avg Approval Time"})]}),((r=s.highlights)==null?void 0:r.length)>0&&e.jsx("div",{style:t.highlight,children:s.highlights.map((o,c)=>e.jsxs("p",{style:t.highlightItem,children:["• ",o]},c))})]})}function H({data:s,index:i}){var l;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Governance Overview"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:String(s.active_rules_count||0),label:"Active Rules"}),e.jsx(p,{value:String(s.rules_added_in_period||0),label:"Rules Added"})]}),((l=s.action_distribution)==null?void 0:l.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"Default Action Distribution"}),e.jsx(W,{items:s.action_distribution.map(r=>({label:r.action,value:r.count,color:r.action==="deny"?"#ef4444":r.action==="require_approval"?"#f59e0b":"#22c55e"}))})]})]})}function Q({data:s,index:i}){var l,r,o;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Action Volume"]}),e.jsx("div",{style:t.kpiGrid,children:e.jsx(p,{value:(s.total_intents||0).toLocaleString(),label:"Total Intents"})}),((l=s.by_risk_tier)==null?void 0:l.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"By Risk Tier"}),e.jsx(W,{items:s.by_risk_tier.map(c=>({label:c.tier,value:c.count,color:c.tier==="T2"?"#ef4444":c.tier==="T1"?"#f59e0b":"#22c55e"}))})]}),((r=s.by_action_type)==null?void 0:r.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"By Action Type"}),e.jsxs("table",{style:t.dataTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.dtTh,children:"Type"}),e.jsx("th",{style:t.dtTh,children:"Count"}),e.jsx("th",{style:t.dtTh,children:"%"})]})}),e.jsx("tbody",{children:s.by_action_type.map(c=>{const h=s.total_intents>0?Math.round(c.count/s.total_intents*100):0;return e.jsxs("tr",{children:[e.jsx("td",{style:t.dtTd,children:c.type}),e.jsx("td",{style:t.dtTd,children:c.count}),e.jsxs("td",{style:t.dtTd,children:[e.jsx(se,{pct:h})," ",h,"%"]})]},c.type)})})]})]}),((o=s.daily_trend)==null?void 0:o.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"Daily Trend"}),e.jsx(re,{data:s.daily_trend})]})]})}function J({data:s,index:i}){var l;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Policy Compliance"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:(s.total_evaluations||0).toLocaleString(),label:"Rules Evaluated"}),e.jsx(p,{value:`${s.match_rate||0}%`,label:"Match Rate"})]}),((l=s.top_triggered_rules)==null?void 0:l.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"Top Triggered Rules"}),e.jsxs("table",{style:t.dataTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.dtTh,children:"Rule"}),e.jsx("th",{style:t.dtTh,children:"Triggered"}),e.jsx("th",{style:t.dtTh,children:"Block Rate"})]})}),e.jsx("tbody",{children:s.top_triggered_rules.map(r=>e.jsxs("tr",{children:[e.jsx("td",{style:t.dtTd,children:r.name}),e.jsx("td",{style:t.dtTd,children:r.times_triggered}),e.jsx("td",{style:t.dtTd,children:e.jsxs("span",{style:t.badge(r.block_rate>50?"#991b1b":"#854d0e",r.block_rate>50?"#fee2e2":"#fef9c3"),children:[r.block_rate,"%"]})})]},r.rule_id))})]})]})]})}function K({data:s,index:i}){var l;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Agent Performance"]}),s.best_performer&&e.jsxs("div",{style:t.callout("green"),children:["🏆 Best Performer: ",e.jsx("strong",{children:s.best_performer.name})," (Trust: ",s.best_performer.trust_score,"/100)"]}),s.worst_performer&&e.jsxs("div",{style:t.callout("yellow"),children:["⚠️ Needs Attention: ",e.jsx("strong",{children:s.worst_performer.name})," (Trust: ",s.worst_performer.trust_score,"/100)"]}),((l=s.scorecards)==null?void 0:l.length)>0&&e.jsxs("table",{style:t.dataTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.dtTh,children:"Agent"}),e.jsx("th",{style:t.dtTh,children:"Status"}),e.jsx("th",{style:t.dtTh,children:"Actions"}),e.jsx("th",{style:t.dtTh,children:"Approval"}),e.jsx("th",{style:t.dtTh,children:"Error"}),e.jsx("th",{style:t.dtTh,children:"Latency"}),e.jsx("th",{style:t.dtTh,children:"Trust"})]})}),e.jsx("tbody",{children:s.scorecards.map(r=>e.jsxs("tr",{children:[e.jsx("td",{style:{...t.dtTd,fontWeight:600},children:r.display_name}),e.jsx("td",{style:t.dtTd,children:e.jsx("span",{style:t.badge(r.status==="active"?"#166534":r.status==="suspended"?"#991b1b":"#64748b",r.status==="active"?"#dcfce7":r.status==="suspended"?"#fee2e2":"#f1f5f9"),children:r.status})}),e.jsx("td",{style:t.dtTd,children:r.total_actions}),e.jsxs("td",{style:t.dtTd,children:[r.approval_rate,"%"]}),e.jsxs("td",{style:{...t.dtTd,color:r.error_rate>10?"#ef4444":r.error_rate>5?"#f59e0b":"#22c55e"},children:[r.error_rate,"%"]}),e.jsxs("td",{style:t.dtTd,children:[r.avg_latency_ms,"ms"]}),e.jsx("td",{style:t.dtTd,children:e.jsx(le,{score:r.trust_score})})]},r.agent_id))})]})]})}function X({data:s,index:i}){var l,r;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Risk Analysis"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:String(((l=s.high_risk_actions)==null?void 0:l.total)||0),label:"High-Risk (T2) Actions",color:"#ef4444"}),e.jsx(p,{value:String(s.scope_creep_attempts||0),label:"Scope Creep Attempts"}),e.jsx(p,{value:String(s.anomalies_detected||0),label:"Anomalies Detected"})]}),((r=s.top_denials)==null?void 0:r.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"Top Denial Reasons"}),e.jsxs("table",{style:t.dataTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.dtTh,children:"Agent"}),e.jsx("th",{style:t.dtTh,children:"Action"}),e.jsx("th",{style:t.dtTh,children:"Denials"})]})}),e.jsx("tbody",{children:s.top_denials.map((o,c)=>e.jsxs("tr",{children:[e.jsx("td",{style:t.dtTd,children:o.agent_id}),e.jsx("td",{style:t.dtTd,children:o.action_type}),e.jsx("td",{style:t.dtTd,children:o.count})]},c))})]})]})]})}function Y({data:s,index:i}){var l;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Approval Metrics"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:String(s.total_approvals_requested||0),label:"Approvals Requested"}),e.jsx(p,{value:`${s.avg_time_to_approval_minutes||0} min`,label:"Avg Time to Approval"}),e.jsx(p,{value:`${s.approval_rate||0}%`,label:"Approval Rate",color:"#16a34a"})]}),((l=s.by_tier)==null?void 0:l.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"By Tier"}),e.jsx(W,{items:s.by_tier.map(r=>({label:r.tier,value:r.count,color:"#f59e0b"}))})]})]})}function Z({data:s,index:i}){var l,r;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Violations & Incidents"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:String(s.total_violations||0),label:"Total Violations",color:s.total_violations>0?"#ef4444":"#16a34a"}),e.jsx(p,{value:String(s.unresolved_count||0),label:"Unresolved",color:s.unresolved_count>0?"#f59e0b":"#16a34a"})]}),((l=s.by_severity)==null?void 0:l.length)>0&&e.jsx("div",{style:{display:"flex",gap:"8px",marginBottom:"16px"},children:s.by_severity.map(o=>e.jsxs("span",{style:t.badge(o.severity==="critical"?"#991b1b":o.severity==="warning"?"#854d0e":"#1e40af",o.severity==="critical"?"#fee2e2":o.severity==="warning"?"#fef9c3":"#dbeafe"),children:[o.severity,": ",o.count]},o.severity))}),((r=s.incident_timeline)==null?void 0:r.length)>0&&e.jsxs("table",{style:t.dataTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.dtTh,children:"Time"}),e.jsx("th",{style:t.dtTh,children:"Agent"}),e.jsx("th",{style:t.dtTh,children:"Type"}),e.jsx("th",{style:t.dtTh,children:"Severity"}),e.jsx("th",{style:t.dtTh,children:"Message"}),e.jsx("th",{style:t.dtTh,children:"Resolved"})]})}),e.jsx("tbody",{children:s.incident_timeline.slice(0,15).map(o=>e.jsxs("tr",{children:[e.jsx("td",{style:{...t.dtTd,fontSize:"11px",whiteSpace:"nowrap"},children:new Date(o.created_at).toLocaleString()}),e.jsx("td",{style:t.dtTd,children:o.agent_id}),e.jsx("td",{style:t.dtTd,children:o.alert_type}),e.jsx("td",{style:t.dtTd,children:e.jsx("span",{style:t.badge(o.severity==="critical"?"#991b1b":o.severity==="warning"?"#854d0e":"#1e40af",o.severity==="critical"?"#fee2e2":o.severity==="warning"?"#fef9c3":"#dbeafe"),children:o.severity})}),e.jsx("td",{style:{...t.dtTd,fontSize:"11px",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis"},children:o.message}),e.jsx("td",{style:t.dtTd,children:o.resolved?"✅":"❌"})]},o.id))})]})]})}function ee({data:s,index:i}){var l;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Integration Health"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:String(s.total_active||0),label:"Active Integrations"}),e.jsx(p,{value:`${s.overall_delivery_rate||100}%`,label:"Delivery Rate",color:"#16a34a"})]}),((l=s.integrations)==null?void 0:l.length)>0&&e.jsxs("table",{style:t.dataTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.dtTh,children:"Name"}),e.jsx("th",{style:t.dtTh,children:"Type"}),e.jsx("th",{style:t.dtTh,children:"Status"}),e.jsx("th",{style:t.dtTh,children:"Success Rate"}),e.jsx("th",{style:t.dtTh,children:"Events"})]})}),e.jsx("tbody",{children:s.integrations.map(r=>e.jsxs("tr",{children:[e.jsx("td",{style:t.dtTd,children:r.name}),e.jsx("td",{style:t.dtTd,children:r.type}),e.jsx("td",{style:t.dtTd,children:e.jsx("span",{style:t.badge(r.enabled?"#166534":"#64748b",r.enabled?"#dcfce7":"#f1f5f9"),children:r.enabled?"Active":"Disabled"})}),e.jsxs("td",{style:t.dtTd,children:[r.delivery_success_rate,"%"]}),e.jsx("td",{style:t.dtTd,children:r.events_in_period})]},r.name))})]})]})}function te({data:s,index:i}){var l;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Recommendations"]}),((l=s.items)==null?void 0:l.length)>0?s.items.map((r,o)=>e.jsxs("div",{style:t.rec(r.severity),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",marginBottom:"4px"},children:[e.jsx("span",{style:t.badge(r.severity==="critical"?"#991b1b":r.severity==="warning"?"#854d0e":"#1e40af",r.severity==="critical"?"#fee2e2":r.severity==="warning"?"#fef9c3":"#dbeafe"),children:r.severity.toUpperCase()}),e.jsx("span",{style:t.recCategory,children:r.category})]}),e.jsx("p",{style:t.recMessage,children:r.message}),e.jsxs("p",{style:t.recAction,children:["→ ",r.action]})]},o)):e.jsx("p",{style:{color:"#94a3b8",fontStyle:"italic"},children:"No recommendations at this time. Governance posture is strong. ✅"})]})}function p({value:s,label:i,color:l}){return e.jsxs("div",{style:t.kpiCard,children:[e.jsx("div",{style:t.kpiValue(l||"#1a1a2e"),children:s}),e.jsx("div",{style:t.kpiLabel,children:i})]})}function W({items:s}){const i=Math.max(...s.map(l=>l.value),1);return e.jsx("div",{children:s.map((l,r)=>e.jsxs("div",{style:t.barRow,children:[e.jsx("span",{style:t.barLabel,children:l.label}),e.jsx("div",{style:t.barTrack,children:e.jsx("div",{style:t.barFill(l.value/i*100,l.color)})}),e.jsx("span",{style:t.barValue,children:l.value})]},r))})}function se({pct:s}){return e.jsx("span",{style:{display:"inline-block",width:"60px",height:"6px",background:"rgba(255,255,255,0.08)",borderRadius:"0",overflow:"hidden",verticalAlign:"middle",marginRight:"4px"},children:e.jsx("span",{style:{display:"block",width:`${s}%`,height:"100%",background:"#f59e0b",borderRadius:"0"}})})}function re({data:s}){const i=Math.max(...s.map(l=>l.count),1);return e.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:"2px",height:"60px",borderBottom:"1px solid rgba(251, 191, 36, 0.15)"},children:s.map((l,r)=>e.jsx("div",{title:`${l.date}: ${l.count}`,style:{flex:1,minWidth:"3px",background:"#f59e0b",borderRadius:"2px 2px 0 0",opacity:.8,height:`${Math.max(4,l.count/i*56)}px`}},r))})}function le({score:s}){const i=s>=80?"#22c55e":s>=60?"#f59e0b":"#ef4444";return e.jsxs("span",{style:t.trustBar(s),children:[e.jsx("span",{style:{width:"40px",height:"5px",background:"rgba(255,255,255,0.08)",borderRadius:"0",overflow:"hidden",display:"inline-block"},children:e.jsx("span",{style:{display:"block",width:`${s}%`,height:"100%",background:i,borderRadius:"0"}})}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600},children:s})]})}export{oe as CompliancePage};
-//# sourceMappingURL=CompliancePage-Bpt_D9yK.js.map
+import{e as j,r as d,j as e}from"./index-C0nK3ekl.js";const g={getQuickStats:(s=30)=>j.get("/compliance/quick-stats",{period:s}),listReports:(s=50,i=0)=>j.get("/compliance/reports",{limit:s,offset:i}),getReport:s=>j.get(`/compliance/reports/${s}`),generateReport:s=>j.post("/compliance/reports/generate",s),deleteReport:s=>j.delete(`/compliance/reports/${s}`),getPdfUrl:s=>`/api/v1/compliance/reports/${s}/pdf`,getCsvUrl:s=>`/api/v1/compliance/reports/${s}/csv`,listTemplates:()=>j.get("/compliance/templates"),createTemplate:s=>j.post("/compliance/templates",s),updateTemplate:(s,i)=>j.put(`/compliance/templates/${s}`,i),createSchedule:s=>j.post("/compliance/schedule",s)},B={executive_summary:"Executive Summary",governance_overview:"Governance Overview",action_volume:"Action Volume",policy_compliance:"Policy Compliance",agent_performance:"Agent Performance",risk_analysis:"Risk Analysis",approval_metrics:"Approval Metrics",violations_incidents:"Violations & Incidents",integration_health:"Integration Health",recommendations:"Recommendations"},M=Object.keys(B),t={page:{padding:"0"},statsGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"12px",marginBottom:"28px"},statCard:s=>({background:"var(--bg-panel, #0F1419)",borderRadius:"0",padding:"20px",textAlign:"center"}),statValue:s=>({fontSize:"32px",fontWeight:700,color:s,lineHeight:1.1}),statLabel:{fontSize:"11px",color:"#94a3b8",marginTop:"6px",textTransform:"uppercase",letterSpacing:"0.5px"},statUnit:{fontSize:"14px",fontWeight:400,color:"#64748b"},periodBar:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px"},periodBtn:s=>({padding:"6px 14px",fontSize:"12px",fontWeight:s?600:400,color:s?"#f59e0b":"#94a3b8",background:s?"rgba(245,158,11,0.15)":"transparent",border:"1px solid "+(s?"rgba(245,158,11,0.3)":"rgba(255,255,255,0.08)"),borderRadius:"0",cursor:"pointer",marginLeft:"6px"}),tabBar:{display:"flex",gap:"2px",marginBottom:"24px",borderBottom:"1px solid rgba(251, 191, 36, 0.15)"},tab:s=>({padding:"10px 18px",fontSize:"13px",fontWeight:s?600:400,color:s?"var(--text-primary)":"#94a3b8",background:"transparent",border:"none",borderBottom:s?"2px solid var(--text-primary)":"2px solid transparent",borderRadius:0,cursor:"pointer"}),primaryBtn:{padding:"10px 20px",fontSize:"13px",fontWeight:600,color:"#fff",background:"#f59e0b",border:"none",borderRadius:"0",cursor:"pointer"},secondaryBtn:{padding:"8px 16px",fontSize:"12px",fontWeight:500,color:"#f59e0b",background:"rgba(245,158,11,0.1)",border:"1px solid rgba(245,158,11,0.2)",borderRadius:"0",cursor:"pointer"},dangerBtn:{padding:"6px 12px",fontSize:"11px",fontWeight:500,color:"#ef4444",background:"rgba(239,68,68,0.1)",border:"1px solid rgba(239,68,68,0.2)",borderRadius:"0",cursor:"pointer"},ghostBtn:{padding:"6px 12px",fontSize:"11px",fontWeight:500,color:"#94a3b8",background:"transparent",border:"1px solid rgba(251, 191, 36, 0.15)",borderRadius:"0",cursor:"pointer"},overlay:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},modal:{background:"var(--bg-panel, #0F1419)",border:"1px solid rgba(251, 191, 36, 0.2)",borderRadius:"0",padding:"28px",width:"520px",maxHeight:"80vh",overflow:"auto"},modalTitle:{fontSize:"18px",fontWeight:700,color:"#e2e8f0",marginBottom:"20px"},formGroup:{marginBottom:"16px"},label:{display:"block",fontSize:"12px",fontWeight:600,color:"#94a3b8",marginBottom:"6px",textTransform:"uppercase",letterSpacing:"0.5px"},select:{width:"100%",padding:"10px 12px",fontSize:"13px",color:"#e2e8f0",background:"var(--bg-app, #0A0E14)",border:"1px solid rgba(251, 191, 36, 0.2)",borderRadius:"0",outline:"none"},input:{width:"100%",padding:"10px 12px",fontSize:"13px",color:"#e2e8f0",background:"var(--bg-app, #0A0E14)",border:"1px solid rgba(251, 191, 36, 0.2)",borderRadius:"0",outline:"none"},checkbox:{marginRight:"8px"},checkboxLabel:{fontSize:"13px",color:"#cbd5e1",cursor:"pointer"},table:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},th:{padding:"10px 12px",textAlign:"left",fontWeight:600,color:"#94a3b8",borderBottom:"1px solid rgba(251, 191, 36, 0.15)",fontSize:"11px",textTransform:"uppercase",letterSpacing:"0.5px"},td:{padding:"10px 12px",borderBottom:"1px solid rgba(251, 191, 36, 0.1)",color:"#cbd5e1"},viewerWrapper:{background:"var(--bg-panel, #0F1419)",borderRadius:"0",padding:"0",overflow:"hidden",border:"1px solid rgba(251, 191, 36, 0.2)"},viewerToolbar:{display:"flex",gap:"8px",alignItems:"center",justifyContent:"space-between",padding:"12px 20px",background:"var(--bg-panel, #0F1419)",borderBottom:"1px solid rgba(251, 191, 36, 0.15)"},viewerContent:{padding:"32px 40px",background:"var(--surface-secondary, #12131a)"},viewerNav:{position:"sticky",top:0,display:"flex",flexDirection:"column",gap:"2px",padding:"12px",background:"var(--bg-app, #0A0E14)",borderRight:"1px solid rgba(251, 191, 36, 0.15)",minWidth:"200px"},viewerNavItem:s=>({padding:"8px 12px",fontSize:"12px",fontWeight:s?600:400,color:s?"#f59e0b":"#64748b",background:s?"rgba(245,158,11,0.08)":"transparent",border:"none",borderRadius:"0",cursor:"pointer",textAlign:"left"}),badge:(s,i)=>({display:"inline-block",padding:"2px 10px",borderRadius:"0",fontSize:"11px",fontWeight:600,color:s,background:i}),statusBadge:s=>{const i={ready:["#166534","#dcfce7"],generating:["#854d0e","#fef9c3"],failed:["#991b1b","#fee2e2"],scheduled:["#1e40af","#dbeafe"]},[l,r]=i[s]||["#64748b","#f1f5f9"];return{display:"inline-block",padding:"2px 10px",borderRadius:"0",fontSize:"11px",fontWeight:600,color:l,background:r}},sectionBlock:{marginBottom:"32px",color:"#e2e8f0"},sectionTitle:{fontSize:"18px",fontWeight:700,color:"#e2e8f0",marginBottom:"12px",paddingBottom:"8px",borderBottom:"1px solid rgba(251, 191, 36, 0.15)"},kpiGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px"},kpiCard:{background:"var(--bg-panel, #0F1419)",border:"1px solid rgba(251, 191, 36, 0.15)",borderRadius:"0",padding:"14px",textAlign:"center"},kpiValue:(s="#e2e8f0")=>({fontSize:"24px",fontWeight:700,color:s}),kpiLabel:{fontSize:"10px",color:"rgba(255,255,255,0.6)",marginTop:"2px",textTransform:"uppercase",letterSpacing:"0.5px"},barRow:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},barLabel:{width:"120px",fontSize:"12px",fontWeight:500,color:"rgba(255,255,255,0.6)",textAlign:"right"},barTrack:{flex:1,height:"16px",background:"rgba(255,255,255,0.08)",borderRadius:"0",overflow:"hidden"},barFill:(s,i)=>({width:`${s}%`,height:"100%",background:i,borderRadius:"0"}),barValue:{width:"36px",fontSize:"12px",fontWeight:600,color:"rgba(255,255,255,0.6)"},dataTable:{width:"100%",borderCollapse:"collapse",fontSize:"12px",marginBottom:"12px"},dtTh:{padding:"8px 10px",textAlign:"left",fontWeight:600,color:"rgba(255,255,255,0.6)",borderBottom:"2px solid rgba(255,255,255,0.08)",background:"var(--bg-panel, #0F1419)",fontSize:"10px",textTransform:"uppercase"},dtTd:{padding:"8px 10px",borderBottom:"1px solid rgba(251, 191, 36, 0.1)",color:"#e2e8f0"},trustBar:s=>({display:"inline-flex",alignItems:"center",gap:"4px",color:s>=80?"#22c55e":s>=60?"#f59e0b":"#ef4444"}),highlight:{background:"var(--bg-panel, #0F1419)",borderRadius:"0",padding:"14px 18px",marginTop:"12px"},highlightItem:{fontSize:"13px",color:"rgba(255,255,255,0.6)",marginBottom:"4px",lineHeight:1.5},rec:s=>{const i={critical:["#fef2f2","#ef4444"],warning:["#fffbeb","#f59e0b"],info:["#eff6ff","#3b82f6"]},[l,r]=i[s]||["#f8fafc","#94a3b8"];return{padding:"12px 14px",borderRadius:"0",marginBottom:"8px",borderLeft:`4px solid ${r}`,background:l}},recCategory:{fontSize:"11px",fontWeight:600,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.5px",marginLeft:"8px"},recMessage:{fontSize:"13px",color:"#e2e8f0",margin:"4px 0"},recAction:{fontSize:"12px",color:"rgba(255,255,255,0.6)",fontStyle:"italic"},callout:s=>({padding:"10px 14px",borderRadius:"0",marginBottom:"8px",fontSize:"13px",background:s==="green"?"rgba(34, 197, 94, 0.15)":"rgba(245, 158, 11, 0.15)",borderLeft:`4px solid ${s==="green"?"#22c55e":"#f59e0b"}`,color:"#e2e8f0"}),empty:{textAlign:"center",padding:"60px 20px",color:"rgba(255,255,255,0.6)"},spinner:{display:"inline-block",width:"16px",height:"16px",border:"2px solid #f59e0b",borderTop:"2px solid transparent",borderRadius:"50%",animation:"spin 0.8s linear infinite"}};function oe(){const[s,i]=d.useState("dashboard"),[l,r]=d.useState(30),[o,c]=d.useState(null),[h,x]=d.useState([]),[b,f]=d.useState(0),[w,m]=d.useState([]),[y,S]=d.useState(null),[R,C]=d.useState(""),[A,a]=d.useState(!1),[v,_]=d.useState(!1),[ie,D]=d.useState(!1),[L,z]=d.useState(""),I=d.useCallback(async()=>{try{const n=await g.getQuickStats(l);c(n)}catch{}},[l]),T=d.useCallback(async()=>{try{const n=await g.listReports();x(n.reports),f(n.total)}catch{}},[]),V=d.useCallback(async()=>{try{const n=await g.listTemplates();m(n)}catch{}},[]);d.useEffect(()=>{I()},[I]),d.useEffect(()=>{T(),V()},[T,V]);const G=async n=>{D(!0);try{const u=await g.getReport(n);S(u);const k=typeof u.report_data=="string"?JSON.parse(u.report_data):u.report_data,$=Object.keys(k.sections||{})[0]||"";C($),i("viewer")}catch(u){z(u.message)}finally{D(!1)}},E=async n=>{if(confirm("Delete this report?"))try{await g.deleteReport(n),T()}catch(u){z(u.message)}},F=n=>{a(!1),T();const u=setInterval(async()=>{try{const k=await g.getReport(n.id);(k.status==="ready"||k.status==="failed")&&(clearInterval(u),T(),k.status==="ready"&&G(k.id))}catch{clearInterval(u)}},2e3)};return e.jsxs("div",{style:t.page,children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"22px",fontWeight:700,color:"#e2e8f0",margin:0},children:"Compliance Reports"}),e.jsx("p",{style:{fontSize:"13px",color:"#94a3b8",marginTop:"4px"},children:"Board-ready governance reports with real data"})]}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("button",{style:t.secondaryBtn,onClick:()=>_(!0),children:"Schedule Report"}),e.jsx("button",{style:t.primaryBtn,onClick:()=>a(!0),children:"Generate Report"})]})]}),e.jsx("div",{style:t.tabBar,children:["dashboard","history","viewer","schedules"].map(n=>e.jsx("button",{style:t.tab(s===n),onClick:()=>i(n),children:n==="dashboard"?"📊 Dashboard":n==="history"?"📋 Reports":n==="viewer"?"📄 Viewer":"⏰ Schedules"},n))}),L&&e.jsxs("div",{style:{padding:"10px 14px",background:"rgba(239,68,68,0.1)",border:"1px solid rgba(239,68,68,0.2)",borderRadius:"0",color:"#ef4444",fontSize:"13px",marginBottom:"16px"},children:[L," ",e.jsx("button",{onClick:()=>z(""),style:{float:"right",background:"none",border:"none",color:"#ef4444",cursor:"pointer"},children:"✕"})]}),s==="dashboard"&&e.jsxs("div",{children:[e.jsxs("div",{style:t.periodBar,children:[e.jsx("span",{style:{fontSize:"13px",color:"#94a3b8"},children:"Reporting period"}),e.jsx("div",{children:[7,30,90,365].map(n=>e.jsx("button",{style:t.periodBtn(l===n),onClick:()=>r(n),children:n===365?"1y":`${n}d`},n))})]}),o?e.jsxs("div",{style:t.statsGrid,children:[e.jsxs("div",{style:t.statCard("#f59e0b"),children:[e.jsx("div",{style:t.statValue("#f59e0b"),children:o.total_actions.toLocaleString()}),e.jsx("div",{style:t.statLabel,children:"Actions Governed"})]}),e.jsxs("div",{style:t.statCard(o.compliance_rate>=95?"#22c55e":"#ef4444"),children:[e.jsxs("div",{style:t.statValue(o.compliance_rate>=95?"#10b981":"#ef4444"),children:[o.compliance_rate,"%"]}),e.jsx("div",{style:t.statLabel,children:"Compliance Rate"})]}),e.jsxs("div",{style:t.statCard(o.policy_violations>10?"#ef4444":o.policy_violations>0?"#f59e0b":"#22c55e"),children:[e.jsx("div",{style:t.statValue(o.policy_violations>10?"#ef4444":o.policy_violations>0?"#f59e0b":"#10b981"),children:o.policy_violations}),e.jsx("div",{style:t.statLabel,children:"Policy Violations"})]}),e.jsxs("div",{style:t.statCard("#3b82f6"),children:[e.jsxs("div",{style:t.statValue("#60a5fa"),children:[o.avg_approval_time_minutes,e.jsx("span",{style:t.statUnit,children:" min"})]}),e.jsx("div",{style:t.statLabel,children:"Avg Approval Time"})]}),e.jsxs("div",{style:t.statCard(o.unauthorized_executions>0?"#ef4444":"#22c55e"),children:[e.jsx("div",{style:t.statValue(o.unauthorized_executions>0?"#ef4444":"#10b981"),children:o.unauthorized_executions}),e.jsx("div",{style:t.statLabel,children:"Unauthorized Executions"})]}),e.jsxs("div",{style:t.statCard(o.fleet_health_score>=80?"#22c55e":o.fleet_health_score>=60?"#f59e0b":"#ef4444"),children:[e.jsxs("div",{style:t.statValue(o.fleet_health_score>=80?"#10b981":o.fleet_health_score>=60?"#f59e0b":"#ef4444"),children:[o.fleet_health_score,e.jsx("span",{style:t.statUnit,children:"/100"})]}),e.jsx("div",{style:t.statLabel,children:"Fleet Health Score"})]})]}):e.jsxs("div",{style:t.empty,children:[e.jsx("div",{style:t.spinner})," Loading stats..."]}),e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#e2e8f0",marginBottom:"12px"},children:"Recent Reports"}),h.length>0?e.jsxs("table",{style:t.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.th,children:"Title"}),e.jsx("th",{style:t.th,children:"Type"}),e.jsx("th",{style:t.th,children:"Status"}),e.jsx("th",{style:t.th,children:"Generated"}),e.jsx("th",{style:t.th,children:"Actions"})]})}),e.jsx("tbody",{children:h.slice(0,5).map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:t.td,children:n.title}),e.jsx("td",{style:t.td,children:e.jsx("span",{style:t.badge("#f59e0b","rgba(245,158,11,0.15)"),children:n.report_type})}),e.jsx("td",{style:t.td,children:e.jsx("span",{style:t.statusBadge(n.status),children:n.status})}),e.jsx("td",{style:t.td,children:new Date(n.generated_at).toLocaleDateString()}),e.jsx("td",{style:t.td,children:n.status==="ready"&&e.jsx("button",{style:t.ghostBtn,onClick:()=>G(n.id),children:"View"})})]},n.id))})]}):e.jsx("div",{style:t.empty,children:"No reports yet. Generate your first compliance report above."})]}),s==="history"&&e.jsxs("div",{children:[e.jsxs("table",{style:t.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.th,children:"Title"}),e.jsx("th",{style:t.th,children:"Type"}),e.jsx("th",{style:t.th,children:"Period"}),e.jsx("th",{style:t.th,children:"Generated By"}),e.jsx("th",{style:t.th,children:"Date"}),e.jsx("th",{style:t.th,children:"Status"}),e.jsx("th",{style:t.th,children:"Actions"})]})}),e.jsx("tbody",{children:h.map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:t.td,children:n.title}),e.jsx("td",{style:t.td,children:e.jsx("span",{style:t.badge("#f59e0b","rgba(245,158,11,0.15)"),children:n.report_type})}),e.jsxs("td",{style:{...t.td,fontSize:"11px"},children:[new Date(n.period_start).toLocaleDateString()," – ",new Date(n.period_end).toLocaleDateString()]}),e.jsx("td",{style:t.td,children:n.generated_by}),e.jsx("td",{style:t.td,children:new Date(n.generated_at).toLocaleString()}),e.jsx("td",{style:t.td,children:e.jsx("span",{style:t.statusBadge(n.status),children:n.status})}),e.jsxs("td",{style:{...t.td,display:"flex",gap:"4px"},children:[n.status==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{style:t.ghostBtn,onClick:()=>G(n.id),children:"View"}),e.jsx("a",{href:g.getPdfUrl(n.id),target:"_blank",rel:"noreferrer",style:{...t.ghostBtn,textDecoration:"none"},children:"PDF"}),e.jsx("a",{href:g.getCsvUrl(n.id),style:{...t.ghostBtn,textDecoration:"none"},children:"CSV"})]}),e.jsx("button",{style:t.dangerBtn,onClick:()=>E(n.id),children:"Delete"})]})]},n.id))})]}),h.length===0&&e.jsx("div",{style:t.empty,children:"No reports generated yet."})]}),s==="viewer"&&(y?e.jsx(U,{report:y,activeSection:R,onSectionChange:C,onBack:()=>{S(null),i("history")}}):e.jsx("div",{style:t.empty,children:"Select a report from the History tab to view it."})),s==="schedules"&&e.jsxs("div",{children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx("button",{style:t.primaryBtn,onClick:()=>_(!0),children:"+ Add Schedule"})}),h.filter(n=>n.schedule_cron).length>0?e.jsxs("table",{style:t.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.th,children:"Report Type"}),e.jsx("th",{style:t.th,children:"Schedule"}),e.jsx("th",{style:t.th,children:"Recipients"})]})}),e.jsx("tbody",{children:h.filter(n=>n.schedule_cron).map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:t.td,children:n.report_type}),e.jsx("td",{style:t.td,children:e.jsx("code",{style:{fontSize:"12px",color:"#f59e0b"},children:n.schedule_cron})}),e.jsx("td",{style:t.td,children:(n.recipients||[]).join(", ")||"—"})]},n.id))})]}):e.jsx("div",{style:t.empty,children:"No scheduled reports. Set up recurring report generation."})]}),A&&e.jsx(P,{templates:w,onClose:()=>a(!1),onGenerated:F}),v&&e.jsx(N,{onClose:()=>_(!1),onCreated:()=>{_(!1),T()}})]})}function P({templates:s,onClose:i,onGenerated:l}){const[r,o]=d.useState("quarterly"),[c,h]=d.useState(""),[x,b]=d.useState([...M]),[f,w]=d.useState(""),[m,y]=d.useState(""),[S,R]=d.useState(!1),C=a=>{b(v=>v.includes(a)?v.filter(_=>_!==a):[...v,a])},A=async()=>{R(!0);try{const a={report_type:r,sections:x};c&&(a.template_id=c),r==="custom"&&f&&(a.period_start=f),r==="custom"&&m&&(a.period_end=m);const v=await g.generateReport(a);l(v)}catch(a){alert("Generation failed: "+a.message)}finally{R(!1)}};return e.jsx("div",{style:t.overlay,onClick:i,children:e.jsxs("div",{style:t.modal,onClick:a=>a.stopPropagation(),children:[e.jsx("h2",{style:t.modalTitle,children:"Generate Compliance Report"}),e.jsxs("div",{style:t.formGroup,children:[e.jsx("label",{style:t.label,children:"Report Type"}),e.jsxs("select",{style:t.select,value:r,onChange:a=>o(a.target.value),children:[e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"}),e.jsx("option",{value:"quarterly",children:"Quarterly"}),e.jsx("option",{value:"annual",children:"Annual"}),e.jsx("option",{value:"custom",children:"Custom Range"})]})]}),r==="custom"&&e.jsxs("div",{style:{display:"flex",gap:"12px"},children:[e.jsxs("div",{style:{...t.formGroup,flex:1},children:[e.jsx("label",{style:t.label,children:"Start Date"}),e.jsx("input",{type:"date",style:t.input,value:f,onChange:a=>w(a.target.value)})]}),e.jsxs("div",{style:{...t.formGroup,flex:1},children:[e.jsx("label",{style:t.label,children:"End Date"}),e.jsx("input",{type:"date",style:t.input,value:m,onChange:a=>y(a.target.value)})]})]}),s.length>0&&e.jsxs("div",{style:t.formGroup,children:[e.jsx("label",{style:t.label,children:"Template"}),e.jsxs("select",{style:t.select,value:c,onChange:a=>h(a.target.value),children:[e.jsx("option",{value:"",children:"All Sections (Default)"}),s.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]})]}),e.jsxs("div",{style:t.formGroup,children:[e.jsx("label",{style:t.label,children:"Sections"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"6px"},children:M.map(a=>e.jsxs("label",{style:{...t.checkboxLabel,display:"flex",alignItems:"center"},children:[e.jsx("input",{type:"checkbox",style:t.checkbox,checked:x.includes(a),onChange:()=>C(a)}),B[a]]},a))})]}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginTop:"20px"},children:[e.jsx("button",{style:t.secondaryBtn,onClick:i,children:"Cancel"}),e.jsx("button",{style:{...t.primaryBtn,opacity:S?.6:1},disabled:S,onClick:A,children:S?"Generating...":"Generate Report"})]})]})})}function N({onClose:s,onCreated:i}){const[l,r]=d.useState("weekly"),[o,c]=d.useState("weekly"),[h,x]=d.useState(""),[b,f]=d.useState(!1),w={daily:"0 8 * * *",weekly:"0 8 * * 1",monthly:"0 8 1 * *"},m=async()=>{f(!0);try{await g.createSchedule({report_type:l,schedule_cron:w[o]||"0 8 * * 1",recipients:h.split(",").map(y=>y.trim()).filter(Boolean)}),i()}catch(y){alert("Failed: "+y.message)}finally{f(!1)}};return e.jsx("div",{style:t.overlay,onClick:s,children:e.jsxs("div",{style:t.modal,onClick:y=>y.stopPropagation(),children:[e.jsx("h2",{style:t.modalTitle,children:"Schedule Recurring Report"}),e.jsxs("div",{style:t.formGroup,children:[e.jsx("label",{style:t.label,children:"Report Type"}),e.jsxs("select",{style:t.select,value:l,onChange:y=>r(y.target.value),children:[e.jsx("option",{value:"weekly",children:"Weekly"}),e.jsx("option",{value:"monthly",children:"Monthly"}),e.jsx("option",{value:"quarterly",children:"Quarterly"})]})]}),e.jsxs("div",{style:t.formGroup,children:[e.jsx("label",{style:t.label,children:"Frequency"}),e.jsxs("select",{style:t.select,value:o,onChange:y=>c(y.target.value),children:[e.jsx("option",{value:"daily",children:"Daily (8:00 AM)"}),e.jsx("option",{value:"weekly",children:"Weekly (Monday 8:00 AM)"}),e.jsx("option",{value:"monthly",children:"Monthly (1st, 8:00 AM)"})]})]}),e.jsxs("div",{style:t.formGroup,children:[e.jsx("label",{style:t.label,children:"Recipients (comma-separated emails)"}),e.jsx("input",{style:t.input,placeholder:"ciso@company.com, cto@company.com",value:h,onChange:y=>x(y.target.value)})]}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginTop:"20px"},children:[e.jsx("button",{style:t.secondaryBtn,onClick:s,children:"Cancel"}),e.jsx("button",{style:{...t.primaryBtn,opacity:b?.6:1},disabled:b,onClick:m,children:b?"Creating...":"Create Schedule"})]})]})})}function U({report:s,activeSection:i,onSectionChange:l,onBack:r}){const c=(typeof s.report_data=="string"?JSON.parse(s.report_data):s.report_data).sections||{},h=Object.keys(c);return e.jsxs("div",{style:t.viewerWrapper,children:[e.jsxs("div",{style:t.viewerToolbar,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[e.jsx("button",{onClick:r,style:{...t.ghostBtn,color:"#64748b"},children:"← Back"}),e.jsx("span",{style:{fontSize:"14px",fontWeight:600,color:"#e2e8f0"},children:s.title})]}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("a",{href:g.getPdfUrl(s.id),target:"_blank",rel:"noreferrer",style:{...t.primaryBtn,textDecoration:"none",fontSize:"12px",padding:"8px 14px",background:"#f59e0b"},children:"Download PDF"}),e.jsx("a",{href:g.getCsvUrl(s.id),style:{...t.secondaryBtn,textDecoration:"none",color:"#f59e0b",borderColor:"rgba(245,158,11,0.2)"},children:"Export CSV"})]})]}),e.jsxs("div",{style:{display:"flex"},children:[e.jsx("div",{style:t.viewerNav,children:h.map((x,b)=>e.jsxs("button",{style:t.viewerNavItem(i===x),onClick:()=>l(x),children:[b+1,". ",B[x]||x]},x))}),e.jsxs("div",{style:t.viewerContent,children:[e.jsxs("div",{style:{marginBottom:"32px",borderBottom:"3px solid #f59e0b",paddingBottom:"20px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:700,color:"#f59e0b",letterSpacing:"2px",marginBottom:"8px"},children:"VIENNA OS"}),e.jsx("h1",{style:{fontSize:"24px",fontWeight:700,color:"#e2e8f0",margin:"0 0 6px"},children:s.title}),e.jsxs("div",{style:{fontSize:"13px",color:"rgba(255,255,255,0.6)"},children:["Period: ",e.jsx("strong",{children:new Date(s.period_start).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})})," — ",e.jsx("strong",{children:new Date(s.period_end).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})})," · ","Generated: ",new Date(s.generated_at).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})]})]}),h.map((x,b)=>e.jsx("div",{id:`section-${x}`,style:t.sectionBlock,children:e.jsx(O,{sectionKey:x,data:c[x],index:b+1})},x))]})]})]})}function O({sectionKey:s,data:i,index:l}){if(!i||i.error)return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[l,". ",B[s]||s]}),e.jsx("p",{style:{color:"#94a3b8",fontStyle:"italic"},children:(i==null?void 0:i.error)||"No data available"})]});switch(s){case"executive_summary":return e.jsx(q,{data:i,index:l});case"governance_overview":return e.jsx(H,{data:i,index:l});case"action_volume":return e.jsx(Q,{data:i,index:l});case"policy_compliance":return e.jsx(J,{data:i,index:l});case"agent_performance":return e.jsx(K,{data:i,index:l});case"risk_analysis":return e.jsx(X,{data:i,index:l});case"approval_metrics":return e.jsx(Y,{data:i,index:l});case"violations_incidents":return e.jsx(Z,{data:i,index:l});case"integration_health":return e.jsx(ee,{data:i,index:l});case"recommendations":return e.jsx(te,{data:i,index:l});default:return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[l,". ",s]}),e.jsx("pre",{style:{fontSize:"11px",color:"#64748b"},children:JSON.stringify(i,null,2)})]})}}function q({data:s,index:i}){var l,r;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Executive Summary"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:((l=s.total_actions_governed)==null?void 0:l.toLocaleString())||"0",label:"Actions Governed"}),e.jsx(p,{value:`${s.policy_compliance_rate||0}%`,label:"Compliance Rate",color:(s.policy_compliance_rate||0)>=95?"#16a34a":"#dc2626"}),e.jsx(p,{value:String(s.unauthorized_executions||0),label:"Unauthorized Executions",color:s.unauthorized_executions===0?"#16a34a":"#dc2626"}),e.jsx(p,{value:`${s.fleet_health_score||0}/100`,label:"Fleet Health",color:(s.fleet_health_score||0)>=80?"#16a34a":"#f59e0b"}),e.jsx(p,{value:String(s.active_agents||0),label:"Active Agents"}),e.jsx(p,{value:`${s.avg_approval_time_minutes||0} min`,label:"Avg Approval Time"})]}),((r=s.highlights)==null?void 0:r.length)>0&&e.jsx("div",{style:t.highlight,children:s.highlights.map((o,c)=>e.jsxs("p",{style:t.highlightItem,children:["• ",o]},c))})]})}function H({data:s,index:i}){var l;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Governance Overview"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:String(s.active_rules_count||0),label:"Active Rules"}),e.jsx(p,{value:String(s.rules_added_in_period||0),label:"Rules Added"})]}),((l=s.action_distribution)==null?void 0:l.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"Default Action Distribution"}),e.jsx(W,{items:s.action_distribution.map(r=>({label:r.action,value:r.count,color:r.action==="deny"?"#ef4444":r.action==="require_approval"?"#f59e0b":"#22c55e"}))})]})]})}function Q({data:s,index:i}){var l,r,o;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Action Volume"]}),e.jsx("div",{style:t.kpiGrid,children:e.jsx(p,{value:(s.total_intents||0).toLocaleString(),label:"Total Intents"})}),((l=s.by_risk_tier)==null?void 0:l.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"By Risk Tier"}),e.jsx(W,{items:s.by_risk_tier.map(c=>({label:c.tier,value:c.count,color:c.tier==="T2"?"#ef4444":c.tier==="T1"?"#f59e0b":"#22c55e"}))})]}),((r=s.by_action_type)==null?void 0:r.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"By Action Type"}),e.jsxs("table",{style:t.dataTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.dtTh,children:"Type"}),e.jsx("th",{style:t.dtTh,children:"Count"}),e.jsx("th",{style:t.dtTh,children:"%"})]})}),e.jsx("tbody",{children:s.by_action_type.map(c=>{const h=s.total_intents>0?Math.round(c.count/s.total_intents*100):0;return e.jsxs("tr",{children:[e.jsx("td",{style:t.dtTd,children:c.type}),e.jsx("td",{style:t.dtTd,children:c.count}),e.jsxs("td",{style:t.dtTd,children:[e.jsx(se,{pct:h})," ",h,"%"]})]},c.type)})})]})]}),((o=s.daily_trend)==null?void 0:o.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"Daily Trend"}),e.jsx(re,{data:s.daily_trend})]})]})}function J({data:s,index:i}){var l;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Policy Compliance"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:(s.total_evaluations||0).toLocaleString(),label:"Rules Evaluated"}),e.jsx(p,{value:`${s.match_rate||0}%`,label:"Match Rate"})]}),((l=s.top_triggered_rules)==null?void 0:l.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"Top Triggered Rules"}),e.jsxs("table",{style:t.dataTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.dtTh,children:"Rule"}),e.jsx("th",{style:t.dtTh,children:"Triggered"}),e.jsx("th",{style:t.dtTh,children:"Block Rate"})]})}),e.jsx("tbody",{children:s.top_triggered_rules.map(r=>e.jsxs("tr",{children:[e.jsx("td",{style:t.dtTd,children:r.name}),e.jsx("td",{style:t.dtTd,children:r.times_triggered}),e.jsx("td",{style:t.dtTd,children:e.jsxs("span",{style:t.badge(r.block_rate>50?"#991b1b":"#854d0e",r.block_rate>50?"#fee2e2":"#fef9c3"),children:[r.block_rate,"%"]})})]},r.rule_id))})]})]})]})}function K({data:s,index:i}){var l;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Agent Performance"]}),s.best_performer&&e.jsxs("div",{style:t.callout("green"),children:["🏆 Best Performer: ",e.jsx("strong",{children:s.best_performer.name})," (Trust: ",s.best_performer.trust_score,"/100)"]}),s.worst_performer&&e.jsxs("div",{style:t.callout("yellow"),children:["⚠️ Needs Attention: ",e.jsx("strong",{children:s.worst_performer.name})," (Trust: ",s.worst_performer.trust_score,"/100)"]}),((l=s.scorecards)==null?void 0:l.length)>0&&e.jsxs("table",{style:t.dataTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.dtTh,children:"Agent"}),e.jsx("th",{style:t.dtTh,children:"Status"}),e.jsx("th",{style:t.dtTh,children:"Actions"}),e.jsx("th",{style:t.dtTh,children:"Approval"}),e.jsx("th",{style:t.dtTh,children:"Error"}),e.jsx("th",{style:t.dtTh,children:"Latency"}),e.jsx("th",{style:t.dtTh,children:"Trust"})]})}),e.jsx("tbody",{children:s.scorecards.map(r=>e.jsxs("tr",{children:[e.jsx("td",{style:{...t.dtTd,fontWeight:600},children:r.display_name}),e.jsx("td",{style:t.dtTd,children:e.jsx("span",{style:t.badge(r.status==="active"?"#166534":r.status==="suspended"?"#991b1b":"#64748b",r.status==="active"?"#dcfce7":r.status==="suspended"?"#fee2e2":"#f1f5f9"),children:r.status})}),e.jsx("td",{style:t.dtTd,children:r.total_actions}),e.jsxs("td",{style:t.dtTd,children:[r.approval_rate,"%"]}),e.jsxs("td",{style:{...t.dtTd,color:r.error_rate>10?"#ef4444":r.error_rate>5?"#f59e0b":"#22c55e"},children:[r.error_rate,"%"]}),e.jsxs("td",{style:t.dtTd,children:[r.avg_latency_ms,"ms"]}),e.jsx("td",{style:t.dtTd,children:e.jsx(le,{score:r.trust_score})})]},r.agent_id))})]})]})}function X({data:s,index:i}){var l,r;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Risk Analysis"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:String(((l=s.high_risk_actions)==null?void 0:l.total)||0),label:"High-Risk (T2) Actions",color:"#ef4444"}),e.jsx(p,{value:String(s.scope_creep_attempts||0),label:"Scope Creep Attempts"}),e.jsx(p,{value:String(s.anomalies_detected||0),label:"Anomalies Detected"})]}),((r=s.top_denials)==null?void 0:r.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"Top Denial Reasons"}),e.jsxs("table",{style:t.dataTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.dtTh,children:"Agent"}),e.jsx("th",{style:t.dtTh,children:"Action"}),e.jsx("th",{style:t.dtTh,children:"Denials"})]})}),e.jsx("tbody",{children:s.top_denials.map((o,c)=>e.jsxs("tr",{children:[e.jsx("td",{style:t.dtTd,children:o.agent_id}),e.jsx("td",{style:t.dtTd,children:o.action_type}),e.jsx("td",{style:t.dtTd,children:o.count})]},c))})]})]})]})}function Y({data:s,index:i}){var l;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Approval Metrics"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:String(s.total_approvals_requested||0),label:"Approvals Requested"}),e.jsx(p,{value:`${s.avg_time_to_approval_minutes||0} min`,label:"Avg Time to Approval"}),e.jsx(p,{value:`${s.approval_rate||0}%`,label:"Approval Rate",color:"#16a34a"})]}),((l=s.by_tier)==null?void 0:l.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"#334155",margin:"16px 0 8px"},children:"By Tier"}),e.jsx(W,{items:s.by_tier.map(r=>({label:r.tier,value:r.count,color:"#f59e0b"}))})]})]})}function Z({data:s,index:i}){var l,r;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Violations & Incidents"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:String(s.total_violations||0),label:"Total Violations",color:s.total_violations>0?"#ef4444":"#16a34a"}),e.jsx(p,{value:String(s.unresolved_count||0),label:"Unresolved",color:s.unresolved_count>0?"#f59e0b":"#16a34a"})]}),((l=s.by_severity)==null?void 0:l.length)>0&&e.jsx("div",{style:{display:"flex",gap:"8px",marginBottom:"16px"},children:s.by_severity.map(o=>e.jsxs("span",{style:t.badge(o.severity==="critical"?"#991b1b":o.severity==="warning"?"#854d0e":"#1e40af",o.severity==="critical"?"#fee2e2":o.severity==="warning"?"#fef9c3":"#dbeafe"),children:[o.severity,": ",o.count]},o.severity))}),((r=s.incident_timeline)==null?void 0:r.length)>0&&e.jsxs("table",{style:t.dataTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.dtTh,children:"Time"}),e.jsx("th",{style:t.dtTh,children:"Agent"}),e.jsx("th",{style:t.dtTh,children:"Type"}),e.jsx("th",{style:t.dtTh,children:"Severity"}),e.jsx("th",{style:t.dtTh,children:"Message"}),e.jsx("th",{style:t.dtTh,children:"Resolved"})]})}),e.jsx("tbody",{children:s.incident_timeline.slice(0,15).map(o=>e.jsxs("tr",{children:[e.jsx("td",{style:{...t.dtTd,fontSize:"11px",whiteSpace:"nowrap"},children:new Date(o.created_at).toLocaleString()}),e.jsx("td",{style:t.dtTd,children:o.agent_id}),e.jsx("td",{style:t.dtTd,children:o.alert_type}),e.jsx("td",{style:t.dtTd,children:e.jsx("span",{style:t.badge(o.severity==="critical"?"#991b1b":o.severity==="warning"?"#854d0e":"#1e40af",o.severity==="critical"?"#fee2e2":o.severity==="warning"?"#fef9c3":"#dbeafe"),children:o.severity})}),e.jsx("td",{style:{...t.dtTd,fontSize:"11px",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis"},children:o.message}),e.jsx("td",{style:t.dtTd,children:o.resolved?"✅":"❌"})]},o.id))})]})]})}function ee({data:s,index:i}){var l;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Integration Health"]}),e.jsxs("div",{style:t.kpiGrid,children:[e.jsx(p,{value:String(s.total_active||0),label:"Active Integrations"}),e.jsx(p,{value:`${s.overall_delivery_rate||100}%`,label:"Delivery Rate",color:"#16a34a"})]}),((l=s.integrations)==null?void 0:l.length)>0&&e.jsxs("table",{style:t.dataTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:t.dtTh,children:"Name"}),e.jsx("th",{style:t.dtTh,children:"Type"}),e.jsx("th",{style:t.dtTh,children:"Status"}),e.jsx("th",{style:t.dtTh,children:"Success Rate"}),e.jsx("th",{style:t.dtTh,children:"Events"})]})}),e.jsx("tbody",{children:s.integrations.map(r=>e.jsxs("tr",{children:[e.jsx("td",{style:t.dtTd,children:r.name}),e.jsx("td",{style:t.dtTd,children:r.type}),e.jsx("td",{style:t.dtTd,children:e.jsx("span",{style:t.badge(r.enabled?"#166534":"#64748b",r.enabled?"#dcfce7":"#f1f5f9"),children:r.enabled?"Active":"Disabled"})}),e.jsxs("td",{style:t.dtTd,children:[r.delivery_success_rate,"%"]}),e.jsx("td",{style:t.dtTd,children:r.events_in_period})]},r.name))})]})]})}function te({data:s,index:i}){var l;return e.jsxs("div",{children:[e.jsxs("h2",{style:t.sectionTitle,children:[i,". Recommendations"]}),((l=s.items)==null?void 0:l.length)>0?s.items.map((r,o)=>e.jsxs("div",{style:t.rec(r.severity),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",marginBottom:"4px"},children:[e.jsx("span",{style:t.badge(r.severity==="critical"?"#991b1b":r.severity==="warning"?"#854d0e":"#1e40af",r.severity==="critical"?"#fee2e2":r.severity==="warning"?"#fef9c3":"#dbeafe"),children:r.severity.toUpperCase()}),e.jsx("span",{style:t.recCategory,children:r.category})]}),e.jsx("p",{style:t.recMessage,children:r.message}),e.jsxs("p",{style:t.recAction,children:["→ ",r.action]})]},o)):e.jsx("p",{style:{color:"#94a3b8",fontStyle:"italic"},children:"No recommendations at this time. Governance posture is strong. ✅"})]})}function p({value:s,label:i,color:l}){return e.jsxs("div",{style:t.kpiCard,children:[e.jsx("div",{style:t.kpiValue(l||"#1a1a2e"),children:s}),e.jsx("div",{style:t.kpiLabel,children:i})]})}function W({items:s}){const i=Math.max(...s.map(l=>l.value),1);return e.jsx("div",{children:s.map((l,r)=>e.jsxs("div",{style:t.barRow,children:[e.jsx("span",{style:t.barLabel,children:l.label}),e.jsx("div",{style:t.barTrack,children:e.jsx("div",{style:t.barFill(l.value/i*100,l.color)})}),e.jsx("span",{style:t.barValue,children:l.value})]},r))})}function se({pct:s}){return e.jsx("span",{style:{display:"inline-block",width:"60px",height:"6px",background:"rgba(255,255,255,0.08)",borderRadius:"0",overflow:"hidden",verticalAlign:"middle",marginRight:"4px"},children:e.jsx("span",{style:{display:"block",width:`${s}%`,height:"100%",background:"#f59e0b",borderRadius:"0"}})})}function re({data:s}){const i=Math.max(...s.map(l=>l.count),1);return e.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:"2px",height:"60px",borderBottom:"1px solid rgba(251, 191, 36, 0.15)"},children:s.map((l,r)=>e.jsx("div",{title:`${l.date}: ${l.count}`,style:{flex:1,minWidth:"3px",background:"#f59e0b",borderRadius:"2px 2px 0 0",opacity:.8,height:`${Math.max(4,l.count/i*56)}px`}},r))})}function le({score:s}){const i=s>=80?"#22c55e":s>=60?"#f59e0b":"#ef4444";return e.jsxs("span",{style:t.trustBar(s),children:[e.jsx("span",{style:{width:"40px",height:"5px",background:"rgba(255,255,255,0.08)",borderRadius:"0",overflow:"hidden",display:"inline-block"},children:e.jsx("span",{style:{display:"block",width:`${s}%`,height:"100%",background:i,borderRadius:"0"}})}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600},children:s})]})}export{oe as CompliancePage};
+//# sourceMappingURL=CompliancePage-C5o8sfAA.js.map
diff --git a/apps/console-proxy/public/assets/CompliancePremium-BpLUmZne.js b/apps/console-proxy/public/assets/CompliancePremium-BpLUmZne.js
deleted file mode 100644
index fcb935d8..00000000
--- a/apps/console-proxy/public/assets/CompliancePremium-BpLUmZne.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import{r as u,b as v,j as e,S as T,R as B}from"./index-D_7YXFSJ.js";import{P as M}from"./PageLayout-CTYKc2go.js";import{A as U}from"./activity-C-iTiNlh.js";import{C as V}from"./circle-check-BIUeiM-B.js";const A={critical:"#dc2626",high:"#ef4444",medium:"#f59e0b",low:"#fbbf24"},$={open:"#ef4444",investigating:"#f59e0b",resolved:"#10b981"},F={success:"#10b981",failure:"#ef4444",partial:"#f59e0b"};function N({score:t}){const[o,d]=B.useState(!1),c=t.overall>=90?"#10b981":t.overall>=75?"#f59e0b":"#ef4444",p=t.trend==="up"?"▲":t.trend==="down"?"▼":"━",j=t.trend==="up"?"#10b981":t.trend==="down"?"#ef4444":"#6b7280";return e.jsxs("div",{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{background:"linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(245, 158, 11, 0.1) 100%)",border:"2px solid rgba(251, 191, 36, 0.3)",padding:"24px",boxShadow:o?"0 0 30px rgba(16, 185, 129, 0.4)":"0 0 20px rgba(251, 191, 36, 0.2)",transform:o?"translateY(-2px)":"translateY(0)",transition:"all 300ms cubic-bezier(0.4, 0, 0.2, 1)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"16px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:700,color:"rgba(251, 191, 36, 0.7)",letterSpacing:"0.1em",fontFamily:"var(--font-mono)",marginBottom:"6px"},children:"COMPLIANCE SCORE"}),e.jsxs("div",{style:{fontSize:"56px",fontWeight:700,color:c,fontFamily:"var(--font-mono)",lineHeight:1},children:[t.overall,e.jsx("span",{style:{fontSize:"24px",color:"rgba(230, 225, 220, 0.5)"},children:"/100"})]})]}),e.jsxs("div",{style:{textAlign:"right"},children:[e.jsx("div",{style:{fontSize:"18px",fontWeight:700,color:j,fontFamily:"var(--font-mono)"},children:p}),e.jsx("div",{style:{fontSize:"9px",color:"rgba(230, 225, 220, 0.4)",fontFamily:"var(--font-mono)"},children:t.trend.toUpperCase()})]})]}),e.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:"1px",height:"32px",marginBottom:"16px"},children:t.sparkline.map((x,f)=>e.jsx("div",{style:{flex:1,background:c,height:`${x}%`,opacity:.3+x/100*.7}},f))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"12px"},children:[{label:"Policy",value:t.policy_adherence},{label:"Approval",value:t.approval_compliance},{label:"Audit",value:t.audit_coverage},{label:"Risk",value:t.risk_mitigation}].map(({label:x,value:f})=>e.jsxs("div",{style:{background:"rgba(0, 0, 0, 0.3)",padding:"10px",border:"1px solid rgba(251, 191, 36, 0.15)"},children:[e.jsx("div",{style:{fontSize:"9px",fontWeight:700,color:"rgba(251, 191, 36, 0.6)",marginBottom:"4px",fontFamily:"var(--font-mono)"},children:x.toUpperCase()}),e.jsx("div",{style:{fontSize:"20px",fontWeight:700,color:f>=90?"#10b981":f>=75?"#f59e0b":"#ef4444",fontFamily:"var(--font-mono)"},children:f})]},x))})]})}function H({policies:t}){return t.length===0?e.jsxs("div",{style:{background:"rgba(10, 14, 20, 0.6)",border:"1px solid rgba(251, 191, 36, 0.2)",padding:"32px",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"32px",marginBottom:"8px"},children:"📋"}),e.jsx("div",{style:{fontSize:"12px",color:"rgba(230, 225, 220, 0.5)"},children:"No policies defined yet"})]}):e.jsxs("div",{style:{background:"rgba(10, 14, 20, 0.6)",border:"1px solid rgba(251, 191, 36, 0.2)",overflow:"hidden"},children:[e.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid rgba(251, 191, 36, 0.15)",background:"rgba(251, 191, 36, 0.05)"},children:e.jsxs("h3",{style:{margin:0,fontSize:"12px",fontWeight:700,color:"#fbbf24",fontFamily:"var(--font-mono)",letterSpacing:"0.05em"},children:[e.jsx(U,{size:16,style:{display:"inline-block",marginRight:"8px",verticalAlign:"middle"},strokeWidth:2}),"POLICY ADHERENCE"]})}),e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"11px"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{borderBottom:"1px solid rgba(251, 191, 36, 0.1)"},children:["Policy","Evaluations","Compliant","Violations","Compliance %","Last Violation"].map(o=>e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",fontSize:"9px",fontWeight:700,color:"rgba(251, 191, 36, 0.6)",fontFamily:"var(--font-mono)",letterSpacing:"0.05em"},children:o},o))})}),e.jsx("tbody",{children:t.map(o=>{const d=o.total_evaluations>0?Math.round(o.compliant/o.total_evaluations*100):100,c=d>=90?"#10b981":d>=75?"#f59e0b":"#ef4444";return e.jsxs("tr",{style:{borderBottom:"1px solid rgba(255,255,255,0.02)"},children:[e.jsxs("td",{style:{padding:"10px 12px"},children:[e.jsx("div",{style:{fontWeight:600,color:"#E6E1DC"},children:o.policy_name}),e.jsxs("div",{style:{fontSize:"9px",color:"rgba(230, 225, 220, 0.4)",fontFamily:"var(--font-mono)"},children:[o.policy_id.slice(0,16),"..."]})]}),e.jsx("td",{style:{padding:"10px 12px",fontFamily:"var(--font-mono)",fontSize:"11px",color:"rgba(230, 225, 220, 0.7)"},children:o.total_evaluations.toLocaleString()}),e.jsx("td",{style:{padding:"10px 12px",fontFamily:"var(--font-mono)",fontSize:"11px",color:"#10b981",fontWeight:600},children:o.compliant.toLocaleString()}),e.jsx("td",{style:{padding:"10px 12px",fontFamily:"var(--font-mono)",fontSize:"11px",color:o.violations>0?"#ef4444":"rgba(230, 225, 220, 0.3)",fontWeight:o.violations>0?600:400},children:o.violations}),e.jsx("td",{style:{padding:"10px 12px"},children:e.jsxs("div",{style:{display:"inline-block",padding:"4px 10px",background:`${c}20`,color:c,fontFamily:"var(--font-mono)",fontWeight:700,fontSize:"11px"},children:[d,"%"]})}),e.jsx("td",{style:{padding:"10px 12px",fontSize:"10px",color:"rgba(230, 225, 220, 0.4)",fontFamily:"var(--font-mono)"},children:o.last_violation?new Date(o.last_violation).toLocaleDateString():"—"})]},o.policy_id)})})]})]})}function Y({violations:t}){return e.jsxs("div",{style:{background:"rgba(10, 14, 20, 0.6)",border:"1px solid rgba(251, 191, 36, 0.2)",overflow:"hidden"},children:[e.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid rgba(251, 191, 36, 0.15)",background:"rgba(251, 191, 36, 0.05)"},children:e.jsx("h3",{style:{margin:0,fontSize:"12px",fontWeight:700,color:"#fbbf24",fontFamily:"var(--font-mono)",letterSpacing:"0.05em"},children:"🚨 VIOLATIONS & INCIDENTS"})}),e.jsx("div",{style:{padding:"12px 16px",maxHeight:"400px",overflowY:"auto"},children:t.length===0?e.jsxs("div",{style:{padding:"24px",textAlign:"center",color:"rgba(230, 225, 220, 0.4)",fontSize:"11px"},children:[e.jsx(V,{size:14,style:{display:"inline-block",marginRight:"6px",verticalAlign:"middle"},color:"#10b981",strokeWidth:2}),"No violations recorded"]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:t.map(o=>e.jsxs("div",{style:{padding:"12px 14px",background:"rgba(0, 0, 0, 0.2)",border:`1px solid ${A[o.severity]}30`},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"6px"},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:700,color:A[o.severity],fontFamily:"var(--font-mono)",letterSpacing:"0.05em"},children:o.severity.toUpperCase()}),e.jsx("div",{style:{fontSize:"9px",padding:"2px 6px",background:`${$[o.status]}20`,color:$[o.status],fontFamily:"var(--font-mono)",fontWeight:600},children:o.status.toUpperCase()})]}),e.jsx("div",{style:{fontSize:"11px",color:"#E6E1DC",marginBottom:"4px",fontWeight:500},children:o.policy_name}),e.jsx("div",{style:{fontSize:"10px",color:"rgba(230, 225, 220, 0.6)",marginBottom:"6px"},children:o.description}),e.jsxs("div",{style:{display:"flex",gap:"12px",fontSize:"9px",color:"rgba(230, 225, 220, 0.4)",fontFamily:"var(--font-mono)"},children:[e.jsx("span",{children:new Date(o.timestamp).toLocaleString()}),e.jsxs("span",{children:["Agent: ",o.agent_id.slice(0,12),"..."]}),e.jsxs("span",{children:["Action: ",o.action_type]})]})]},o.id))})})]})}function G({entries:t}){return e.jsxs("div",{style:{background:"rgba(10, 14, 20, 0.6)",border:"1px solid rgba(251, 191, 36, 0.2)",overflow:"hidden"},children:[e.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid rgba(251, 191, 36, 0.15)",background:"rgba(251, 191, 36, 0.05)"},children:e.jsx("h3",{style:{margin:0,fontSize:"12px",fontWeight:700,color:"#fbbf24",fontFamily:"var(--font-mono)",letterSpacing:"0.05em"},children:"📜 AUDIT TRAIL"})}),e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"11px"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{borderBottom:"1px solid rgba(251, 191, 36, 0.1)"},children:["Timestamp","Event","User","Action","Outcome","Details"].map(o=>e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",fontSize:"9px",fontWeight:700,color:"rgba(251, 191, 36, 0.6)",fontFamily:"var(--font-mono)",letterSpacing:"0.05em"},children:o},o))})}),e.jsx("tbody",{children:t.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,style:{padding:"32px",textAlign:"center",color:"rgba(230, 225, 220, 0.4)",fontSize:"11px"},children:"No audit entries"})}):t.map(o=>e.jsxs("tr",{style:{borderBottom:"1px solid rgba(255,255,255,0.02)"},children:[e.jsx("td",{style:{padding:"10px 12px",fontSize:"9px",color:"rgba(230, 225, 220, 0.4)",fontFamily:"var(--font-mono)",whiteSpace:"nowrap"},children:new Date(o.timestamp).toLocaleString()}),e.jsx("td",{style:{padding:"10px 12px",fontSize:"10px",color:"rgba(230, 225, 220, 0.7)",fontFamily:"var(--font-mono)"},children:o.event_type}),e.jsx("td",{style:{padding:"10px 12px",fontSize:"10px",color:"#E6E1DC"},children:o.user}),e.jsx("td",{style:{padding:"10px 12px",fontSize:"10px",color:"rgba(230, 225, 220, 0.7)"},children:o.action}),e.jsx("td",{style:{padding:"10px 12px"},children:e.jsx("span",{style:{fontSize:"9px",padding:"2px 6px",background:`${F[o.outcome]}20`,color:F[o.outcome],fontFamily:"var(--font-mono)",fontWeight:600},children:o.outcome.toUpperCase()})}),e.jsx("td",{style:{padding:"10px 12px",fontSize:"10px",color:"rgba(230, 225, 220, 0.5)",maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.details})]},o.id))})]})]})}function Z(){const[t,o]=u.useState(null),[d,c]=u.useState(!0),[p,j]=u.useState("30d"),x=u.useCallback(async()=>{var a;c(!0);try{const r=localStorage.getItem("vienna_access_token"),g={"Content-Type":"application/json"};r&&(g.Authorization=`Bearer ${r}`);const[b,m,n,_,S]=await Promise.all([fetch("/api/v1/compliance/quick-stats",{credentials:"include",headers:g}).then(i=>i.json()).catch(()=>({success:!1})),fetch("/api/v1/policies",{credentials:"include",headers:g}).then(i=>i.json()).catch(()=>({success:!1})),fetch("/api/v1/proposals?state=denied&limit=20",{credentials:"include",headers:g}).then(i=>i.json()).catch(()=>({success:!1})),fetch("/api/v1/activity/feed?limit=50",{credentials:"include",headers:g}).then(i=>i.json()).catch(()=>({success:!1})),fetch("/api/v1/compliance/reports?limit=10",{credentials:"include",headers:g}).then(i=>i.json()).catch(()=>({success:!1}))]),E=b.success?b.data:{},k=m.success?m.data:[],z=n.success?n.data:[],O=_.success?_.data:[],q=S.success?((a=S.data)==null?void 0:a.rows)||S.data||[]:[],L=E.compliance_rate||0,l=Math.round(L),D={overall:l,policy_adherence:Math.min(100,l+5),approval_compliance:l,audit_coverage:Math.min(100,l+3),risk_mitigation:Math.max(0,l-5),trend:l>=90?"up":l>=75?"stable":"down",sparkline:[l-10,l-5,l-2,l,l+2,l+5].map(i=>Math.max(0,Math.min(100,i)))},P=k.slice(0,10).map(i=>{var w;const s=z.filter(C=>C.policy_id===i.id),h=s.length||1,y=s.filter(C=>C.state==="denied").length;return{policy_id:i.id,policy_name:i.name||`Policy ${i.id.slice(0,8)}`,total_evaluations:h,compliant:Math.max(0,h-y),violations:y,last_violation:((w=s[0])==null?void 0:w.evaluated_at)||null}}),W=z.slice(0,10).map(i=>{var s;return{id:i.id,timestamp:i.created_at||new Date().toISOString(),policy_name:((s=k.find(h=>h.id===i.policy_id))==null?void 0:s.name)||"Unknown Policy",agent_id:i.agent_id||"unknown",action_type:i.action_type||"unknown",severity:"high",status:"open",description:"Proposal denied by policy evaluation"}}),I=O.slice(0,20).map(i=>{var s,h,y;return{id:i.id,timestamp:i.timestamp||new Date().toISOString(),event_type:i.type||"system.event",user:((s=i.agent)==null?void 0:s.display_name)||"system",agent_id:(h=i.agent)==null?void 0:h.id,action:((y=i.type)==null?void 0:y.split(".")[1])||"action",outcome:"success",details:`${i.type}`}});o({score:D,policies:P,violations:W,audit_trail:I,period:p==="7d"?"Last 7 Days":p==="30d"?"Last 30 Days":"Last 90 Days"})}catch{v("Failed to load compliance data","error")}finally{c(!1)}},[p]);u.useEffect(()=>{x()},[x]);const f=()=>{const a=window.open("","_blank");if(!a||!t){v("Unable to open print window","error");return}a.document.write(`
- Vienna OS Compliance Report
-
- Vienna OS — Compliance Report
- Generated: ${new Date().toLocaleString()}
- Compliance Score
- | Overall Score | ${t.score.overall}/100 |
|---|
- Policy Adherence
- | Policy | Evaluations | Compliant | Violations |
- ${t.policies.map(r=>`| ${r.policy_name} | ${r.total_evaluations} | ${r.compliant} | ${r.violations} |
`).join("")}
-
- `),a.document.close(),a.print(),v("PDF report opened for printing","success")},R=()=>{if(!t)return;const r=["Vienna OS Compliance Report",`Generated: ${new Date().toISOString()}`,`Period: ${t.period}`,"",`Overall Score: ${t.score.overall}/100`,`Policy Adherence: ${t.score.policy_adherence}`,`Approval Compliance: ${t.score.approval_compliance}`,`Audit Coverage: ${t.score.audit_coverage}`,`Risk Mitigation: ${t.score.risk_mitigation}`,"","--- Policy Adherence ---","Policy,Evaluations,Compliant,Violations,Compliance %",...t.policies.map(n=>`${n.policy_name},${n.total_evaluations},${n.compliant},${n.violations},${Math.round(n.compliant/n.total_evaluations*100)}%`),"","--- Violations ---","Timestamp,Severity,Status,Policy,Agent,Action,Description",...t.violations.map(n=>`${n.timestamp},${n.severity},${n.status},${n.policy_name},${n.agent_id},${n.action_type},${n.description}`)].join(`
-`),g=new Blob([r],{type:"text/csv"}),b=URL.createObjectURL(g),m=document.createElement("a");m.href=b,m.download=`vienna-compliance-${new Date().toISOString().slice(0,10)}.csv`,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(b),v("Compliance report exported","success")};return e.jsx("div",{style:{position:"relative",minHeight:"100vh"},children:e.jsx("div",{style:{position:"relative",zIndex:1},children:e.jsxs(M,{title:"",description:"",children:[e.jsx("div",{style:{background:"linear-gradient(180deg, rgba(16, 185, 129, 0.1) 0%, transparent 100%)",borderBottom:"1px solid rgba(251, 191, 36, 0.2)",padding:"20px",marginBottom:"20px"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[e.jsxs("h1",{style:{fontSize:"24px",fontWeight:700,color:"#10b981",margin:0,fontFamily:"var(--font-mono)",letterSpacing:"0.02em"},children:[e.jsx(T,{size:16,style:{display:"inline-block",marginRight:"8px",verticalAlign:"middle"},strokeWidth:2}),"COMPLIANCE TERMINAL"]}),e.jsxs("div",{style:{fontSize:"11px",color:"rgba(230, 225, 220, 0.5)",marginTop:"4px",fontFamily:"var(--font-mono)"},children:[(t==null?void 0:t.period)||"Loading..."," — SOC 2 Audit Ready"]})]}),e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[e.jsx("div",{style:{display:"flex",gap:"4px"},children:["7d","30d","90d"].map(a=>e.jsx("button",{onClick:()=>j(a),style:{padding:"6px 12px",background:p===a?"rgba(16, 185, 129, 0.2)":"rgba(0, 0, 0, 0.3)",border:`1px solid ${p===a?"#10b981":"rgba(251, 191, 36, 0.2)"}`,color:p===a?"#10b981":"rgba(230, 225, 220, 0.5)",fontSize:"10px",fontWeight:700,cursor:"pointer",fontFamily:"var(--font-mono)"},children:a.toUpperCase()},a))}),e.jsx("button",{onClick:R,disabled:!t,style:{padding:"6px 14px",background:t?"rgba(16, 185, 129, 0.2)":"rgba(107, 114, 128, 0.2)",border:`1px solid ${t?"#10b981":"#6b7280"}`,color:t?"#10b981":"#6b7280",fontSize:"10px",fontWeight:700,cursor:t?"pointer":"default",fontFamily:"var(--font-mono)"},children:"📥 CSV"}),e.jsx("button",{onClick:f,disabled:!t,style:{padding:"6px 14px",background:t?"rgba(245, 158, 11, 0.2)":"rgba(107, 114, 128, 0.2)",border:`1px solid ${t?"#f59e0b":"#6b7280"}`,color:t?"#f59e0b":"#6b7280",fontSize:"10px",fontWeight:700,cursor:t?"pointer":"default",fontFamily:"var(--font-mono)"},children:"📄 PDF"})]})]})}),d?e.jsxs("div",{style:{padding:"80px",textAlign:"center"},children:[e.jsx("div",{style:{display:"inline-block",width:"32px",height:"32px",border:"3px solid rgba(16, 185, 129, 0.2)",borderTop:"3px solid #10b981",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),e.jsx("p",{style:{marginTop:"16px",fontSize:"12px",color:"rgba(230, 225, 220, 0.5)",fontFamily:"var(--font-mono)"},children:"LOADING COMPLIANCE DATA..."}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}):t&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[e.jsx(N,{score:t.score}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr",gap:"12px"},children:[e.jsx(H,{policies:t.policies}),e.jsx(Y,{violations:t.violations})]}),e.jsx(G,{entries:t.audit_trail})]})]})})})}export{Z as CompliancePremium};
-//# sourceMappingURL=CompliancePremium-BpLUmZne.js.map
diff --git a/apps/console-proxy/public/assets/ConnectAgentPage-B2q_drgu.js b/apps/console-proxy/public/assets/ConnectAgentPage-BeQD2oWm.js
similarity index 98%
rename from apps/console-proxy/public/assets/ConnectAgentPage-B2q_drgu.js
rename to apps/console-proxy/public/assets/ConnectAgentPage-BeQD2oWm.js
index 712380ee..07e377d4 100644
--- a/apps/console-proxy/public/assets/ConnectAgentPage-B2q_drgu.js
+++ b/apps/console-proxy/public/assets/ConnectAgentPage-BeQD2oWm.js
@@ -1,4 +1,4 @@
-import{u as F,d as K,r as n,a as u,j as e,R as E}from"./index-D_7YXFSJ.js";import{P as L}from"./PageLayout-CTYKc2go.js";function Y(){const h=F(),v=K(r=>r.tenant),b=(v==null?void 0:v.id)||"unknown",[a,s]=n.useState(1),[o,j]=n.useState(null),[x,k]=n.useState("openai"),[l,S]=n.useState(""),[i,m]=n.useState(null),[d,c]=n.useState(!1),[p,g]=n.useState(null),[z,w]=n.useState([]);n.useEffect(()=>{C()},[]);const C=async()=>{try{const r=await u.get("/policy-templates/packs");w(r.packs||[{id:"soc2",name:"SOC 2",description:"Security controls for data handling and system availability",templates:[{id:"access-control",name:"Access Control",description:"User authentication and authorization"},{id:"data-protection",name:"Data Protection",description:"Encryption and data handling policies"}]},{id:"financial",name:"Financial",description:"Controls for financial operations and transactions",templates:[{id:"transaction-limits",name:"Transaction Limits",description:"Spending and transfer limits"},{id:"dual-approval",name:"Dual Approval",description:"Multi-person approval for high-value actions"}]},{id:"hipaa",name:"HIPAA",description:"Healthcare data privacy and security compliance",templates:[{id:"phi-protection",name:"PHI Protection",description:"Protected health information handling"},{id:"access-audit",name:"Access Auditing",description:"Healthcare data access logging"}]},{id:"dev-safety",name:"Development Safety",description:"Safe deployment and development practices",templates:[{id:"deployment-gates",name:"Deployment Gates",description:"Production deployment controls"},{id:"code-review",name:"Code Review",description:"Automated code review requirements"}]}])}catch{}},P=async()=>{var r,t;c(!0),g(null);try{await u.post("/connect/test",{method:o,provider:x,apiKey:o==="api-proxy"?l:void 0}),s(3)}catch(y){g(((t=(r=y.response)==null?void 0:r.data)==null?void 0:t.error)||"Connection test failed")}finally{c(!1)}},R=async()=>{var r,t;if(i){c(!0),g(null);try{await u.post("/connect/activate-pack",{policy_pack_id:i,tenant_id:b}),s(4)}catch(y){g(((t=(r=y.response)==null?void 0:r.data)==null?void 0:t.error)||"Failed to activate policy pack")}finally{c(!1)}}},W=async()=>{var r,t;c(!0),g(null);try{const y=await u.post("/intent",{agent_id:"connect-wizard-test",action_type:"test_action",description:"Test action from Connect Your Agent wizard",context:{integration_method:o,provider:o==="api-proxy"?x:void 0},risk_tier:1})}catch(y){g(((t=(r=y.response)==null?void 0:r.data)==null?void 0:t.error)||"Failed to send test action")}finally{c(!1)}},f=r=>{navigator.clipboard.writeText(r)},B=()=>e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:32},children:[e.jsx("h2",{style:{fontSize:20,fontWeight:600,color:"var(--text-primary)",margin:"0 0 8px"},children:"Choose Integration Method"}),e.jsx("p",{style:{color:"var(--text-secondary)",fontSize:14,margin:0},children:"How would you like to connect your agent to Vienna?"})]}),e.jsx("div",{style:{display:"grid",gap:16,maxWidth:600},children:[{id:"api-proxy",icon:"🔑",title:"API Key Proxy",description:"Paste your LLM API key. Vienna wraps it and governs every call.",recommended:!0},{id:"sdk",icon:"📦",title:"SDK Integration",description:"Add 5 lines to your agent code.",recommended:!1},{id:"webhook",icon:"🔌",title:"Webhook",description:"Point your agent's webhook to Vienna.",recommended:!1}].map(r=>e.jsxs("div",{onClick:()=>{j(r.id),s(2)},style:{padding:20,border:"1px solid var(--border-subtle)",borderRadius:8,cursor:"pointer",background:"var(--bg-primary)",transition:"all 150ms",position:"relative"},onMouseEnter:t=>{t.currentTarget.style.borderColor="var(--border-primary)",t.currentTarget.style.background="var(--bg-secondary)"},onMouseLeave:t=>{t.currentTarget.style.borderColor="var(--border-subtle)",t.currentTarget.style.background="var(--bg-primary)"},children:[r.recommended&&e.jsx("div",{style:{position:"absolute",top:-8,right:16,background:"#f59e0b",color:"white",fontSize:10,fontWeight:600,padding:"2px 8px",borderRadius:4,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Recommended"}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12},children:[e.jsx("div",{style:{fontSize:24,marginTop:2},children:r.icon}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:16,fontWeight:600,color:"var(--text-primary)",marginBottom:4},children:r.title}),e.jsx("div",{style:{fontSize:14,color:"var(--text-secondary)"},children:r.description})]}),e.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:"→"})]})]},r.id))})]}),A=()=>e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:32},children:[e.jsxs("h2",{style:{fontSize:20,fontWeight:600,color:"var(--text-primary)",margin:"0 0 8px"},children:["Configure ",o==="api-proxy"?"API Proxy":o==="sdk"?"SDK":"Webhook"]}),e.jsxs("p",{style:{color:"var(--text-secondary)",fontSize:14,margin:0},children:[o==="api-proxy"&&"Provide your LLM API key to enable proxied governance",o==="sdk"&&"Copy the integration code to your agent",o==="webhook"&&"Configure your webhook endpoint"]})]}),o==="api-proxy"&&e.jsxs("div",{style:{maxWidth:500},children:[e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("label",{style:{display:"block",fontSize:14,fontWeight:500,color:"var(--text-primary)",marginBottom:8},children:"Provider"}),e.jsxs("select",{value:x,onChange:r=>k(r.target.value),style:{width:"100%",padding:"10px 12px",border:"1px solid var(--border-subtle)",borderRadius:6,background:"var(--bg-primary)",color:"var(--text-primary)",fontSize:14},children:[e.jsx("option",{value:"openai",children:"OpenAI"}),e.jsx("option",{value:"anthropic",children:"Anthropic"}),e.jsx("option",{value:"google",children:"Google"}),e.jsx("option",{value:"custom",children:"Custom"})]})]}),e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("label",{style:{display:"block",fontSize:14,fontWeight:500,color:"var(--text-primary)",marginBottom:8},children:"API Key"}),e.jsx("input",{type:"password",placeholder:`Enter your ${x} API key`,value:l,onChange:r=>S(r.target.value),style:{width:"100%",padding:"10px 12px",border:"1px solid var(--border-subtle)",borderRadius:6,background:"var(--bg-primary)",color:"var(--text-primary)",fontSize:14,fontFamily:"var(--font-mono)"}})]}),e.jsxs("div",{style:{padding:16,background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:20},children:[e.jsx("div",{style:{fontSize:12,fontWeight:500,color:"var(--text-secondary)",marginBottom:8},children:"Vienna Proxy URL"}),e.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-primary)",wordBreak:"break-all",background:"var(--bg-primary)",padding:8,borderRadius:4,border:"1px solid var(--border-subtle)"},children:["https://console.regulator.ai/api/v1/proxy/",b,"/v1/chat/completions"]})]}),e.jsx("button",{onClick:P,disabled:!l||d,style:{padding:"10px 20px",background:l?"#f59e0b":"var(--bg-tertiary)",color:l?"white":"var(--text-tertiary)",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:l?"pointer":"not-allowed",transition:"background 150ms"},children:d?"Testing...":"Test Connection"})]}),o==="sdk"&&e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)",marginBottom:8},children:"Install Command"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px"},children:[e.jsx("code",{style:{flex:1,fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)"},children:"npm install vienna-os"}),e.jsx("button",{onClick:()=>f("npm install vienna-os"),style:{padding:"4px 8px",background:"var(--bg-primary)",border:"1px solid var(--border-subtle)",borderRadius:4,fontSize:10,color:"var(--text-secondary)",cursor:"pointer"},children:"Copy"})]})]}),e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)",marginBottom:8},children:"Integration Code"}),e.jsxs("div",{style:{background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:12,position:"relative"},children:[e.jsx("button",{onClick:()=>f(`import { Vienna } from 'vienna-os';
+import{u as F,f as K,r as n,e as u,j as e,R as E}from"./index-C0nK3ekl.js";import{P as L}from"./PageLayout-D94mSHCV.js";function Y(){const h=F(),v=K(r=>r.tenant),b=(v==null?void 0:v.id)||"unknown",[a,s]=n.useState(1),[o,j]=n.useState(null),[x,k]=n.useState("openai"),[l,S]=n.useState(""),[i,m]=n.useState(null),[d,c]=n.useState(!1),[p,g]=n.useState(null),[z,w]=n.useState([]);n.useEffect(()=>{C()},[]);const C=async()=>{try{const r=await u.get("/policy-templates/packs");w(r.packs||[{id:"soc2",name:"SOC 2",description:"Security controls for data handling and system availability",templates:[{id:"access-control",name:"Access Control",description:"User authentication and authorization"},{id:"data-protection",name:"Data Protection",description:"Encryption and data handling policies"}]},{id:"financial",name:"Financial",description:"Controls for financial operations and transactions",templates:[{id:"transaction-limits",name:"Transaction Limits",description:"Spending and transfer limits"},{id:"dual-approval",name:"Dual Approval",description:"Multi-person approval for high-value actions"}]},{id:"hipaa",name:"HIPAA",description:"Healthcare data privacy and security compliance",templates:[{id:"phi-protection",name:"PHI Protection",description:"Protected health information handling"},{id:"access-audit",name:"Access Auditing",description:"Healthcare data access logging"}]},{id:"dev-safety",name:"Development Safety",description:"Safe deployment and development practices",templates:[{id:"deployment-gates",name:"Deployment Gates",description:"Production deployment controls"},{id:"code-review",name:"Code Review",description:"Automated code review requirements"}]}])}catch{}},P=async()=>{var r,t;c(!0),g(null);try{await u.post("/connect/test",{method:o,provider:x,apiKey:o==="api-proxy"?l:void 0}),s(3)}catch(y){g(((t=(r=y.response)==null?void 0:r.data)==null?void 0:t.error)||"Connection test failed")}finally{c(!1)}},R=async()=>{var r,t;if(i){c(!0),g(null);try{await u.post("/connect/activate-pack",{policy_pack_id:i,tenant_id:b}),s(4)}catch(y){g(((t=(r=y.response)==null?void 0:r.data)==null?void 0:t.error)||"Failed to activate policy pack")}finally{c(!1)}}},W=async()=>{var r,t;c(!0),g(null);try{const y=await u.post("/intent",{agent_id:"connect-wizard-test",action_type:"test_action",description:"Test action from Connect Your Agent wizard",context:{integration_method:o,provider:o==="api-proxy"?x:void 0},risk_tier:1})}catch(y){g(((t=(r=y.response)==null?void 0:r.data)==null?void 0:t.error)||"Failed to send test action")}finally{c(!1)}},f=r=>{navigator.clipboard.writeText(r)},B=()=>e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:32},children:[e.jsx("h2",{style:{fontSize:20,fontWeight:600,color:"var(--text-primary)",margin:"0 0 8px"},children:"Choose Integration Method"}),e.jsx("p",{style:{color:"var(--text-secondary)",fontSize:14,margin:0},children:"How would you like to connect your agent to Vienna?"})]}),e.jsx("div",{style:{display:"grid",gap:16,maxWidth:600},children:[{id:"api-proxy",icon:"🔑",title:"API Key Proxy",description:"Paste your LLM API key. Vienna wraps it and governs every call.",recommended:!0},{id:"sdk",icon:"📦",title:"SDK Integration",description:"Add 5 lines to your agent code.",recommended:!1},{id:"webhook",icon:"🔌",title:"Webhook",description:"Point your agent's webhook to Vienna.",recommended:!1}].map(r=>e.jsxs("div",{onClick:()=>{j(r.id),s(2)},style:{padding:20,border:"1px solid var(--border-subtle)",borderRadius:8,cursor:"pointer",background:"var(--bg-primary)",transition:"all 150ms",position:"relative"},onMouseEnter:t=>{t.currentTarget.style.borderColor="var(--border-primary)",t.currentTarget.style.background="var(--bg-secondary)"},onMouseLeave:t=>{t.currentTarget.style.borderColor="var(--border-subtle)",t.currentTarget.style.background="var(--bg-primary)"},children:[r.recommended&&e.jsx("div",{style:{position:"absolute",top:-8,right:16,background:"#f59e0b",color:"white",fontSize:10,fontWeight:600,padding:"2px 8px",borderRadius:4,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Recommended"}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12},children:[e.jsx("div",{style:{fontSize:24,marginTop:2},children:r.icon}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:16,fontWeight:600,color:"var(--text-primary)",marginBottom:4},children:r.title}),e.jsx("div",{style:{fontSize:14,color:"var(--text-secondary)"},children:r.description})]}),e.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:"→"})]})]},r.id))})]}),A=()=>e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:32},children:[e.jsxs("h2",{style:{fontSize:20,fontWeight:600,color:"var(--text-primary)",margin:"0 0 8px"},children:["Configure ",o==="api-proxy"?"API Proxy":o==="sdk"?"SDK":"Webhook"]}),e.jsxs("p",{style:{color:"var(--text-secondary)",fontSize:14,margin:0},children:[o==="api-proxy"&&"Provide your LLM API key to enable proxied governance",o==="sdk"&&"Copy the integration code to your agent",o==="webhook"&&"Configure your webhook endpoint"]})]}),o==="api-proxy"&&e.jsxs("div",{style:{maxWidth:500},children:[e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("label",{style:{display:"block",fontSize:14,fontWeight:500,color:"var(--text-primary)",marginBottom:8},children:"Provider"}),e.jsxs("select",{value:x,onChange:r=>k(r.target.value),style:{width:"100%",padding:"10px 12px",border:"1px solid var(--border-subtle)",borderRadius:6,background:"var(--bg-primary)",color:"var(--text-primary)",fontSize:14},children:[e.jsx("option",{value:"openai",children:"OpenAI"}),e.jsx("option",{value:"anthropic",children:"Anthropic"}),e.jsx("option",{value:"google",children:"Google"}),e.jsx("option",{value:"custom",children:"Custom"})]})]}),e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("label",{style:{display:"block",fontSize:14,fontWeight:500,color:"var(--text-primary)",marginBottom:8},children:"API Key"}),e.jsx("input",{type:"password",placeholder:`Enter your ${x} API key`,value:l,onChange:r=>S(r.target.value),style:{width:"100%",padding:"10px 12px",border:"1px solid var(--border-subtle)",borderRadius:6,background:"var(--bg-primary)",color:"var(--text-primary)",fontSize:14,fontFamily:"var(--font-mono)"}})]}),e.jsxs("div",{style:{padding:16,background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:20},children:[e.jsx("div",{style:{fontSize:12,fontWeight:500,color:"var(--text-secondary)",marginBottom:8},children:"Vienna Proxy URL"}),e.jsxs("div",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-primary)",wordBreak:"break-all",background:"var(--bg-primary)",padding:8,borderRadius:4,border:"1px solid var(--border-subtle)"},children:["https://console.regulator.ai/api/v1/proxy/",b,"/v1/chat/completions"]})]}),e.jsx("button",{onClick:P,disabled:!l||d,style:{padding:"10px 20px",background:l?"#f59e0b":"var(--bg-tertiary)",color:l?"white":"var(--text-tertiary)",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:l?"pointer":"not-allowed",transition:"background 150ms"},children:d?"Testing...":"Test Connection"})]}),o==="sdk"&&e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)",marginBottom:8},children:"Install Command"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px"},children:[e.jsx("code",{style:{flex:1,fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)"},children:"npm install vienna-os"}),e.jsx("button",{onClick:()=>f("npm install vienna-os"),style:{padding:"4px 8px",background:"var(--bg-primary)",border:"1px solid var(--border-subtle)",borderRadius:4,fontSize:10,color:"var(--text-secondary)",cursor:"pointer"},children:"Copy"})]})]}),e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)",marginBottom:8},children:"Integration Code"}),e.jsxs("div",{style:{background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:12,position:"relative"},children:[e.jsx("button",{onClick:()=>f(`import { Vienna } from 'vienna-os';
const vienna = new Vienna({
apiKey: 'vos_YOUR_KEY',
endpoint: 'https://console.regulator.ai'
@@ -17,4 +17,4 @@ const result = await vienna.govern('deploy_to_prod', { env: 'production' });`})]
"context": { "version": "1.2.3" },
"risk_tier": 2
}`})})]}),e.jsx("button",{onClick:()=>s(3),style:{padding:"10px 20px",background:"#f59e0b",color:"white",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"Continue"})]}),p&&e.jsx("div",{style:{marginTop:16,padding:"10px 12px",background:"rgba(239,68,68,0.1)",border:"1px solid rgba(239,68,68,0.2)",borderRadius:6,color:"#ef4444",fontSize:14},children:p})]}),I=()=>e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:32},children:[e.jsx("h2",{style:{fontSize:20,fontWeight:600,color:"var(--text-primary)",margin:"0 0 8px"},children:"Select Policy Pack"}),e.jsx("p",{style:{color:"var(--text-secondary)",fontSize:14,margin:0},children:"Choose a pre-configured policy pack or skip to configure policies later."})]}),e.jsxs("div",{style:{display:"grid",gap:16,maxWidth:700,marginBottom:32},children:[z.map(r=>e.jsxs("div",{onClick:()=>m(r.id),style:{padding:20,border:`2px solid ${i===r.id?"#f59e0b":"var(--border-subtle)"}`,borderRadius:8,cursor:"pointer",background:i===r.id?"rgba(124, 58, 237, 0.05)":"var(--bg-primary)",transition:"all 150ms"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:12},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:600,color:"var(--text-primary)",marginBottom:4},children:r.name}),e.jsx("div",{style:{fontSize:14,color:"var(--text-secondary)"},children:r.description})]}),i===r.id&&e.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:"#f59e0b",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:12},children:"✓"})]}),e.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:r.templates.map(t=>e.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",background:"var(--bg-secondary)",padding:"2px 6px",borderRadius:3},children:t.name},t.id))})]},r.id)),e.jsxs("div",{onClick:()=>m(null),style:{padding:20,border:`1px dashed ${i===null?"#f59e0b":"var(--border-subtle)"}`,borderRadius:8,cursor:"pointer",background:i===null?"rgba(124, 58, 237, 0.05)":"transparent",textAlign:"center",transition:"all 150ms"},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"var(--text-secondary)",marginBottom:4},children:"Skip — I'll configure policies later"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:"Proceed without applying a policy pack"})]})]}),e.jsxs("div",{style:{display:"flex",gap:12},children:[e.jsx("button",{onClick:()=>s(2),style:{padding:"10px 16px",background:"var(--bg-tertiary)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:14,cursor:"pointer"},children:"← Back"}),e.jsx("button",{onClick:i?R:()=>s(4),disabled:d,style:{padding:"10px 20px",background:"#f59e0b",color:"white",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer",opacity:d?.7:1},children:d?"Activating...":i?"Activate Policy Pack":"Continue"})]}),p&&e.jsx("div",{style:{marginTop:16,padding:"10px 12px",background:"rgba(239,68,68,0.1)",border:"1px solid rgba(239,68,68,0.2)",borderRadius:6,color:"#ef4444",fontSize:14},children:p})]}),_=()=>e.jsxs("div",{style:{textAlign:"center",maxWidth:500,margin:"0 auto"},children:[e.jsx("div",{style:{fontSize:48,marginBottom:16},children:"🎉"}),e.jsx("h2",{style:{fontSize:24,fontWeight:600,color:"var(--text-primary)",margin:"0 0 16px"},children:"Your Agent is Connected!"}),e.jsx("p",{style:{color:"var(--text-secondary)",fontSize:16,marginBottom:32,lineHeight:1.5},children:"Vienna is now protecting your agent. Try sending a test action through the governance pipeline."}),e.jsxs("div",{style:{background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:24,marginBottom:24},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)",marginBottom:16},children:"Test Your Integration"}),e.jsx("button",{onClick:W,disabled:d,style:{width:"100%",padding:"12px 20px",background:"#10b981",color:"white",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer",marginBottom:16,opacity:d?.7:1},children:d?"Sending...":"Send Test Action"}),p&&e.jsx("div",{style:{padding:"8px 12px",background:"rgba(239,68,68,0.1)",border:"1px solid rgba(239,68,68,0.2)",borderRadius:6,color:"#ef4444",fontSize:12},children:p})]}),e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"center"},children:[e.jsx("button",{onClick:()=>h("/fleet"),style:{padding:"10px 16px",background:"var(--bg-primary)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:14,cursor:"pointer"},children:"View Fleet"}),e.jsx("button",{onClick:()=>h("/"),style:{padding:"10px 20px",background:"#f59e0b",color:"white",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"Go to Dashboard"})]})]}),T=()=>e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:40},children:[1,2,3,4].map(r=>e.jsxs(E.Fragment,{children:[e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:r<=a?"#f59e0b":"var(--bg-tertiary)",color:r<=a?"white":"var(--text-tertiary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:600},children:re.jsxs("button",{onClick:t.action,disabled:!t.enabled,style:{display:"flex",alignItems:"center",gap:"6px",padding:"8px 14px",background:t.enabled?`${t.color}20`:"rgba(107, 114, 128, 0.1)",border:`1px solid ${t.enabled?`${t.color}40`:"rgba(107, 114, 128, 0.2)"}`,color:t.enabled?t.color:"#6b7280",fontSize:"10px",fontWeight:700,fontFamily:"var(--font-mono)",cursor:t.enabled?"pointer":"not-allowed",transition:"all 150ms",letterSpacing:"0.05em"},onMouseEnter:s=>{t.enabled&&(s.currentTarget.style.transform="translateY(-1px)",s.currentTarget.style.boxShadow=`0 4px 12px ${t.color}40`)},onMouseLeave:s=>{s.currentTarget.style.transform="translateY(0)",s.currentTarget.style.boxShadow="none"},children:[t.icon,t.label]},t.id))]})}function m({label:i,value:t,unit:s,color:l,pulse:f}){const[a,y]=g.useState(!1);return e.jsxs("div",{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),style:{background:"rgba(10, 14, 20, 0.6)",border:"1px solid rgba(251, 191, 36, 0.2)",padding:"16px",display:"flex",flexDirection:"column",gap:"8px",position:"relative",overflow:"hidden",boxShadow:a?`0 0 20px ${l}40`:"0 0 0 1px rgba(0,0,0,0.8)",transform:a?"translateY(-2px)":"translateY(0)",transition:"all 200ms cubic-bezier(0.4, 0, 0.2, 1)"},children:[f&&e.jsx("div",{style:{position:"absolute",top:"12px",right:"12px",width:"8px",height:"8px",borderRadius:"50%",background:l,boxShadow:`0 0 8px ${l}`,animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"}}),e.jsx("div",{style:{fontSize:"10px",fontWeight:700,color:"rgba(251, 191, 36, 0.7)",letterSpacing:"0.1em",fontFamily:"var(--font-mono)"},children:i}),e.jsxs("div",{style:{fontSize:"36px",fontWeight:700,color:l,fontFamily:"var(--font-mono)",lineHeight:1},children:[t,s&&e.jsx("span",{style:{fontSize:"16px",color:"rgba(230, 225, 220, 0.5)",marginLeft:"4px"},children:s})]}),e.jsx("style",{children:`
- @keyframes pulse {
- 0%, 100% { opacity: 1; }
- 50% { opacity: 0.3; }
- }
- `})]})}function v({label:i,status:t,detail:s,action:l}){const a={healthy:{color:"#10b981",glow:"rgba(16, 185, 129, 0.4)",label:"OPERATIONAL"},degraded:{color:"#f59e0b",glow:"rgba(245, 158, 11, 0.4)",label:"DEGRADED"},critical:{color:"#ef4444",glow:"rgba(239, 68, 68, 0.4)",label:"CRITICAL"}}[t];return e.jsxs("div",{style:{background:"rgba(10, 14, 20, 0.6)",border:`1px solid ${a.color}40`,padding:"14px 16px",boxShadow:`0 0 12px ${a.glow}`},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"8px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:"#E6E1DC"},children:i}),e.jsx("div",{style:{width:"6px",height:"6px",borderRadius:"50%",background:a.color,boxShadow:`0 0 8px ${a.glow}`,animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})]}),e.jsx("div",{style:{fontSize:"10px",fontWeight:700,color:a.color,marginBottom:"6px",fontFamily:"var(--font-mono)",letterSpacing:"0.05em"},children:a.label}),e.jsx("div",{style:{fontSize:"10px",color:"rgba(230, 225, 220, 0.6)",fontFamily:"var(--font-mono)"},children:s}),l&&e.jsx("button",{onClick:l,style:{marginTop:"10px",padding:"6px 10px",background:`${a.color}20`,border:`1px solid ${a.color}40`,color:a.color,fontSize:"9px",fontWeight:700,fontFamily:"var(--font-mono)",cursor:"pointer",width:"100%",letterSpacing:"0.05em"},children:"INVESTIGATE →"})]})}function B(){const i=C(),[t,s]=g.useState({activeAgents:0,totalAgents:0,warrantsToday:0,avgTrust:0,pendingApprovals:0,avgLatencyMs:0,systemStatus:"healthy"}),[l,f]=g.useState(!0),[a,y]=g.useState(!0),p=g.useCallback(async()=>{var n;f(!0);try{const r=localStorage.getItem("vienna_access_token"),x={"Content-Type":"application/json"};r&&(x.Authorization=`Bearer ${r}`);const[u,d,o]=await Promise.all([fetch("/api/v1/fleet/agents",{credentials:"include",headers:x}).then(c=>c.json()).catch(()=>({success:!1})),fetch("/api/v1/executions/stats",{credentials:"include",headers:x}).then(c=>c.json()).catch(()=>({success:!1})),fetch("/api/v1/dashboard?range=24h",{credentials:"include",headers:x}).then(c=>c.json()).catch(()=>({success:!1}))]),h=(u.success?u.data:u.agents)||[],j=d.success?d.data:{},S=o.success?o.data:{},A=S.overview||{};s({activeAgents:h.filter(c=>c.status==="active").length,totalAgents:h.length,warrantsToday:Number(j.total_executions||A.executions_period||0),avgTrust:h.length>0?h.reduce((c,w)=>c+(Number(w.trust_score)||0),0)/h.length:0,pendingApprovals:Number(A.pending_approvals||j.pending_approval||0),avgLatencyMs:Number(((n=S.systemHealth)==null?void 0:n.latencyMs)||0),systemStatus:"healthy"})}catch{}finally{f(!1)}},[]);g.useEffect(()=>{p()},[p]),g.useEffect(()=>{if(!a)return;const n=setInterval(p,3e4);return()=>clearInterval(n)},[a,p]);const T=[{id:"start-tour",label:"START TOUR",icon:e.jsx(M,{size:12}),color:"#d4af37",action:()=>{window.startGuidedTour&&window.startGuidedTour()},enabled:!0},{id:"refresh",label:"REFRESH",icon:e.jsx(z,{size:12}),color:"#10b981",action:p,enabled:!0},{id:"pause-all",label:a?"PAUSE AUTO":"RESUME AUTO",icon:a?e.jsx(R,{size:12}):e.jsx(k,{size:12}),color:"#f59e0b",action:()=>y(!a),enabled:!0},{id:"approve-all",label:"APPROVE QUEUE",icon:e.jsx(I,{size:12}),color:"#10b981",action:async()=>{try{const n=localStorage.getItem("vienna_access_token"),r={"Content-Type":"application/json"};n&&(r.Authorization=`Bearer ${n}`);const d=((await(await fetch("/api/v1/approvals",{credentials:"include",headers:r})).json()).data||[]).filter(o=>o.status==="pending");if(d.length===0){b("No pending approvals in queue","info");return}for(const o of d)await fetch(`/api/v1/approvals/${o.approval_id||o.id}/approve`,{method:"POST",credentials:"include",headers:r,body:JSON.stringify({reason:"Batch approved from dashboard"})});b(`Approved ${d.length} pending requests`,"success"),p()}catch(n){b("Batch approve failed: "+n.message,"error")}},enabled:t.pendingApprovals>0},{id:"emergency",label:"EMERGENCY HALT",icon:e.jsx(L,{size:12}),color:"#ef4444",action:async()=>{if(confirm("⚠️ Halt ALL agent operations? This will suspend every active agent."))try{const n=localStorage.getItem("vienna_access_token"),r={"Content-Type":"application/json"};n&&(r.Authorization=`Bearer ${n}`);const d=((await(await fetch("/api/v1/fleet/agents",{credentials:"include",headers:r})).json()).data||[]).filter(o=>o.status==="active");for(const o of d)await fetch(`/api/v1/agents/${o.id}`,{method:"PUT",credentials:"include",headers:r,body:JSON.stringify({status:"suspended"})});b(`Emergency halt: ${d.length} agents suspended`,"warning"),p()}catch(n){b("Emergency halt failed: "+n.message,"error")}},enabled:!0},{id:"terminal",label:"CONSOLE",icon:e.jsx(O,{size:12}),color:"#06b6d4",action:()=>i("/workspace"),enabled:!0}];return e.jsx("div",{style:{position:"relative",minHeight:"100vh"},children:e.jsx("div",{style:{position:"relative",zIndex:1},children:e.jsxs($,{title:"",description:"",children:[e.jsx("div",{style:{background:"linear-gradient(180deg, rgba(16, 185, 129, 0.1) 0%, transparent 100%)",borderBottom:"1px solid rgba(251, 191, 36, 0.2)",padding:"20px",marginBottom:"20px"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[e.jsxs("h1",{style:{fontSize:"24px",fontWeight:700,color:"#10b981",margin:0,fontFamily:"var(--font-mono)",letterSpacing:"0.02em"},children:[e.jsx(N,{size:16,style:{display:"inline-block",marginRight:"8px",verticalAlign:"middle"},strokeWidth:2}),"MISSION CONTROL"]}),e.jsx("div",{style:{fontSize:"11px",color:"rgba(230, 225, 220, 0.5)",marginTop:"4px",fontFamily:"var(--font-mono)"},children:"Live Agent Governance Dashboard"})]}),e.jsxs("div",{style:{fontSize:"11px",fontFamily:"var(--font-mono)",color:t.systemStatus==="healthy"?"#10b981":"#ef4444",fontWeight:700,display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:t.systemStatus==="healthy"?"#10b981":"#ef4444",boxShadow:`0 0 8px ${t.systemStatus==="healthy"?"rgba(16, 185, 129, 0.6)":"rgba(239, 68, 68, 0.6)"}`,animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"}}),t.systemStatus.toUpperCase()]})]})}),e.jsx(D,{actions:T}),l?e.jsxs("div",{style:{padding:"80px",textAlign:"center"},children:[e.jsx("div",{style:{display:"inline-block",width:"32px",height:"32px",border:"3px solid rgba(16, 185, 129, 0.2)",borderTop:"3px solid #10b981",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),e.jsx("p",{style:{marginTop:"16px",fontSize:"12px",color:"rgba(230, 225, 220, 0.5)",fontFamily:"var(--font-mono)"},children:"LOADING MISSION CONTROL..."}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"12px"},children:[e.jsx(m,{label:"ACTIVE AGENTS",value:t.activeAgents,color:"#10b981",pulse:!0}),e.jsx(m,{label:"WARRANTS TODAY",value:t.warrantsToday.toLocaleString(),color:"#fbbf24"}),e.jsx(m,{label:"AVG TRUST",value:t.avgTrust.toFixed(1),unit:"%",color:"#06b6d4"}),e.jsx(m,{label:"PENDING",value:t.pendingApprovals,color:t.pendingApprovals>10?"#f59e0b":"#10b981",pulse:t.pendingApprovals>10})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"12px"},children:[e.jsx(v,{label:"Governance Engine",status:t.avgLatencyMs<100?"healthy":"degraded",detail:`Avg latency: ${t.avgLatencyMs}ms`,action:()=>i("/analytics")}),e.jsx(v,{label:"Approval Queue",status:t.pendingApprovals<20?"healthy":"degraded",detail:`${t.pendingApprovals} pending approvals`,action:()=>i("/approvals")}),e.jsx(v,{label:"Fleet Status",status:t.activeAgents>=t.totalAgents*.8?"healthy":"degraded",detail:`${t.activeAgents} active of ${t.totalAgents} total`,action:()=>i("/fleet")})]}),e.jsxs("div",{style:{background:"linear-gradient(90deg, rgba(16, 185, 129, 0.1) 0%, rgba(245, 158, 11, 0.1) 100%)",border:"1px solid rgba(251, 191, 36, 0.2)",padding:"16px 20px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:700,color:"rgba(251, 191, 36, 0.7)",letterSpacing:"0.1em",fontFamily:"var(--font-mono)",marginBottom:"4px"},children:"SYSTEM PERFORMANCE"}),e.jsxs("div",{style:{fontSize:"13px",color:"#E6E1DC",fontFamily:"var(--font-mono)"},children:["All systems nominal • ",t.warrantsToday.toLocaleString()," warrants processed today • ",t.avgLatencyMs,"ms average latency"]})]}),e.jsxs("div",{style:{fontSize:"24px",fontWeight:700,color:"#10b981",fontFamily:"var(--font-mono)"},children:[(t.activeAgents/Math.max(t.totalAgents,1)*100).toFixed(0),"%"]})]})]})]})})})}export{B as DashboardControl};
-//# sourceMappingURL=DashboardControl-BkG73T-T.js.map
diff --git a/apps/console-proxy/public/assets/DashboardPremium-D1X6YCtJ.js b/apps/console-proxy/public/assets/DashboardPremium-D1X6YCtJ.js
deleted file mode 100644
index 850f8c9f..00000000
--- a/apps/console-proxy/public/assets/DashboardPremium-D1X6YCtJ.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import{c as U,r as u,y as N,u as V,j as e,T as O,w as B,C as _,S as q}from"./index-D_7YXFSJ.js";import{T as Y}from"./trending-up-xPmnKzgu.js";import{C as D}from"./circle-x-DJXSWLrE.js";import{C as X}from"./clock-DwbEOyPD.js";import{A as M}from"./activity-C-iTiNlh.js";/**
- * @license lucide-react v1.7.0 - ISC
- *
- * This source code is licensed under the ISC license.
- * See the LICENSE file in the root directory of this source tree.
- */const K=[["path",{d:"M5 12h14",key:"1ays0h"}]],Q=U("minus",K),P="/api/v1";function Z(){const a=u.useRef(null),s=u.useRef(null),r=u.useRef(0),c=N(d=>d.setSSEConnected),n=N(d=>d.setSystemStatus),o=N(d=>d.addObjective),p=N(d=>d.updateObjective),l=N(d=>d.addDecision),S=N(d=>d.removeDecision),f=()=>{a.current&&a.current.close(),console.log("[SSE] Attempting connection...");const d=localStorage.getItem("vienna_access_token"),T=d?`${P}/stream?token=${encodeURIComponent(d)}`:`${P}/stream`,m=new EventSource(T);a.current=m,m.onopen=()=>{console.log("[SSE] Connected to Vienna event stream"),c(!0),r.current=0},m.addEventListener("system.status",i=>{try{const t=JSON.parse(i.data);n(t)}catch(t){console.error("[SSE] Failed to parse system.status event:",t)}}),m.addEventListener("execution.paused",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Execution paused:",t)}catch(t){console.error("[SSE] Failed to parse execution.paused event:",t)}}),m.addEventListener("execution.resumed",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Execution resumed:",t)}catch(t){console.error("[SSE] Failed to parse execution.resumed event:",t)}}),m.addEventListener("provider.health",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Provider health update:",t)}catch(t){console.error("[SSE] Failed to parse provider.health event:",t)}}),m.addEventListener("service.health",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Service health update:",t)}catch(t){console.error("[SSE] Failed to parse service.health event:",t)}}),m.addEventListener("objective.created",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Objective created:",t),o(t)}catch(t){console.error("[SSE] Failed to parse objective.created event:",t)}}),m.addEventListener("objective.updated",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Objective updated:",t),p(t.objective_id,t)}catch(t){console.error("[SSE] Failed to parse objective.updated event:",t)}}),m.addEventListener("objective.completed",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Objective completed:",t),p(t.objective_id,{...t,status:"completed"})}catch(t){console.error("[SSE] Failed to parse objective.completed event:",t)}}),m.addEventListener("approval.created",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Approval created:",t),l(t)}catch(t){console.error("[SSE] Failed to parse approval.created event:",t)}}),m.addEventListener("approval.approved",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Approval approved:",t),S(t.approval_id||t.decision_id)}catch(t){console.error("[SSE] Failed to parse approval.approved event:",t)}}),m.addEventListener("approval.denied",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Approval denied:",t),S(t.approval_id||t.decision_id)}catch(t){console.error("[SSE] Failed to parse approval.denied event:",t)}}),m.addEventListener("execution.started",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Execution started:",t)}catch(t){console.error("[SSE] Failed to parse execution.started event:",t)}}),m.addEventListener("execution.completed",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Execution completed:",t),t.objective_id&&p(t.objective_id,{status:"completed"})}catch(t){console.error("[SSE] Failed to parse execution.completed event:",t)}}),m.addEventListener("execution.failed",i=>{try{const t=JSON.parse(i.data);console.log("[SSE] Execution failed:",t),t.objective_id&&p(t.objective_id,{status:"failed"})}catch(t){console.error("[SSE] Failed to parse execution.failed event:",t)}}),m.onerror=i=>{if(console.warn("[SSE] Connection error (non-critical):",i),m.close(),!localStorage.getItem("vienna_access_token")){console.warn("[SSE] No auth token — skipping reconnect");return}if(r.current>=5){console.warn("[SSE] Max reconnect attempts reached — stopping");return}const E=Math.min(1e3*Math.pow(2,r.current),3e4);r.current++,console.log(`[SSE] Reconnecting in ${E/1e3}s (attempt ${r.current})`),s.current=setTimeout(()=>{f()},E)}};return u.useEffect(()=>(f(),()=>{console.log("[SSE] Disconnecting from Vienna event stream"),s.current&&clearTimeout(s.current),a.current&&a.current.close(),c(!1)}),[]),{connected:N(d=>d.sseConnected)}}const $=({label:a,value:s,trend:r,trendDirection:c,sparklineData:n,color:o="green",loading:p})=>{const l={green:"bg-emerald-500",amber:"bg-amber-500",blue:"bg-blue-500",red:"bg-red-500"},S={up:"text-emerald-500",down:"text-red-500",stable:"text-zinc-500"};return p?e.jsxs("div",{className:"bg-[#0d0e14] border border-white/[0.06] p-3.5 flex flex-col animate-pulse",children:[e.jsx("div",{className:"h-3 w-20 bg-white/[0.06] rounded mb-3"}),e.jsx("div",{className:"h-7 w-14 bg-white/[0.06] rounded mb-4"}),e.jsx("div",{className:"flex gap-px items-end h-6",children:Array.from({length:10},(f,d)=>e.jsx("div",{className:"flex-1 bg-white/[0.04]",style:{height:`${20+d*7%60}%`}},d))})]}):e.jsxs("div",{className:"bg-[#0d0e14] border border-white/[0.06] p-3.5 flex flex-col hover:border-white/[0.12] transition-colors",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("div",{className:"text-[10px] font-mono text-zinc-500 uppercase tracking-widest",children:a}),r&&e.jsxs("div",{className:`text-[10px] font-bold font-mono ${S[c||"stable"]} flex items-center gap-1`,children:[r," ",c==="up"&&e.jsx(Y,{size:10}),c==="stable"&&e.jsx(Q,{size:10})]})]}),e.jsx("div",{className:`text-[26px] font-bold font-mono mt-1 leading-none ${o==="amber"?"text-amber-500":o==="red"?"text-red-400":"text-white"}`,children:s}),e.jsx("div",{className:"mt-3 flex gap-px items-end h-6",children:n.map((f,d)=>e.jsx("div",{className:`flex-1 ${l[o]}`,style:{height:`${Math.max(f,2)}%`,opacity:d===n.length-1?1:.15+f/100*.7}},d))})]})},I={T0:{label:"T0",color:"text-emerald-400",bg:"bg-emerald-500",desc:"Auto-approved"},T1:{label:"T1",color:"text-blue-400",bg:"bg-blue-500",desc:"Policy-gated"},T2:{label:"T2",color:"text-amber-400",bg:"bg-amber-500",desc:"Human review"},T3:{label:"T3",color:"text-red-400",bg:"bg-red-500",desc:"Multi-party sign-off"},unclassified:{label:"—",color:"text-zinc-500",bg:"bg-zinc-600",desc:"Unclassified"}},ee=({data:a,loading:s})=>{const r=a.reduce((n,o)=>n+Number(o.count),0),c=["T0","T1","T2","T3","unclassified"].map(n=>{const o=a.find(p=>p.risk_tier===n);return{tier:n,count:o?Number(o.count):0}}).filter(n=>n.count>0);return e.jsxs("div",{className:"bg-[#0d0e14] border border-white/[0.06] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-[11px] font-mono text-zinc-500 uppercase tracking-widest",children:"Risk Distribution"}),e.jsxs("span",{className:"text-[10px] font-mono text-zinc-600",children:[r," warrants"]})]}),s?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(n=>e.jsx("div",{className:"h-6 bg-white/[0.04] animate-pulse"},n))}):c.length===0?e.jsx("div",{className:"text-center py-6 text-zinc-600 text-xs font-mono",children:"No warrants issued yet"}):e.jsx("div",{className:"space-y-3",children:c.map(({tier:n,count:o})=>{const p=I[n]||I.unclassified,l=r>0?o/r*100:0;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-[11px] font-mono font-bold ${p.color}`,children:p.label}),e.jsx("span",{className:"text-[10px] text-zinc-600 font-mono",children:p.desc})]}),e.jsxs("span",{className:"text-[11px] font-mono text-zinc-400",children:[o," ",e.jsxs("span",{className:"text-zinc-600",children:["(",l.toFixed(0),"%)"]})]})]}),e.jsx("div",{className:"h-1.5 bg-white/[0.04] overflow-hidden",children:e.jsx("div",{className:`h-full ${p.bg} transition-all duration-500`,style:{width:`${l}%`,opacity:.8}})})]},n)})})]})},te=({data:a,loading:s})=>{if(s||!a)return e.jsxs("div",{className:"bg-[#0d0e14] border border-white/[0.06] p-4 animate-pulse",children:[e.jsx("div",{className:"h-3 w-32 bg-white/[0.06] rounded mb-4"}),e.jsx("div",{className:"space-y-3",children:[1,2,3,4].map(o=>e.jsx("div",{className:"h-8 bg-white/[0.04]"},o))})]});const r=a.pending+a.approved+a.denied+a.expired,c=a.avg_resolution_seconds?Math.round(a.avg_resolution_seconds/60):null,n=[{label:"Approved",count:a.approved,icon:e.jsx(_,{size:12}),color:"text-emerald-400",bar:"bg-emerald-500"},{label:"Denied",count:a.denied,icon:e.jsx(D,{size:12}),color:"text-red-400",bar:"bg-red-500"},{label:"Pending",count:a.pending,icon:e.jsx(X,{size:12}),color:"text-amber-400",bar:"bg-amber-500"},{label:"Expired",count:a.expired,icon:e.jsx(O,{size:12}),color:"text-zinc-500",bar:"bg-zinc-600"}];return e.jsxs("div",{className:"bg-[#0d0e14] border border-white/[0.06] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-[11px] font-mono text-zinc-500 uppercase tracking-widest",children:"Approval Pipeline"}),c!==null&&e.jsxs("span",{className:"text-[10px] font-mono text-zinc-600",children:["avg ",c,"m resolution"]})]}),e.jsx("div",{className:"space-y-2.5",children:n.map(o=>{const p=r>0?o.count/r*100:0;return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`${o.color} shrink-0`,children:o.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[e.jsx("span",{className:"text-[11px] font-mono text-zinc-400",children:o.label}),e.jsx("span",{className:`text-[12px] font-mono font-bold ${o.color}`,children:o.count})]}),e.jsx("div",{className:"h-1 bg-white/[0.04] overflow-hidden",children:e.jsx("div",{className:`h-full ${o.bar} transition-all duration-500`,style:{width:`${p}%`,opacity:.7}})})]})]},o.label)})}),a.new_this_period>0&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-white/[0.04] text-[10px] font-mono text-zinc-600",children:[a.new_this_period," new requests this period"]})]})},se={warrant_issued:{icon:e.jsx(q,{size:11}),color:"text-emerald-400"},warrant_revoked:{icon:e.jsx(D,{size:11}),color:"text-red-400"},policy_created:{icon:e.jsx(_,{size:11}),color:"text-blue-400"},policy_updated:{icon:e.jsx(_,{size:11}),color:"text-blue-400"},agent_registered:{icon:e.jsx(M,{size:11}),color:"text-amber-400"},approval_granted:{icon:e.jsx(_,{size:11}),color:"text-emerald-400"},approval_denied:{icon:e.jsx(D,{size:11}),color:"text-red-400"},execution_completed:{icon:e.jsx(_,{size:11}),color:"text-emerald-400"},execution_rejected:{icon:e.jsx(O,{size:11}),color:"text-red-400"}},ae=a=>{const s=a.details||{};switch(a.event_type){case"warrant_issued":return`Warrant issued for ${s.agent_id||"agent"} → ${s.action||s.objective||"action"}`;case"warrant_revoked":return`Warrant revoked: ${s.warrant_id||s.reason||"manual revocation"}`;case"policy_created":return`Policy "${s.name||s.policy_id||"policy"}" created`;case"policy_updated":return`Policy "${s.name||s.policy_id||"policy"}" updated`;case"agent_registered":return`Agent "${s.display_name||s.agent_id||"agent"}" registered`;case"approval_granted":return`Approval granted: ${s.action||s.intent_id||"request"} (${s.approver||a.actor})`;case"approval_denied":return`Approval denied: ${s.action||s.intent_id||"request"} (${s.approver||a.actor})`;case"execution_completed":return`Execution complete: ${s.objective||s.execution_id||"task"}`;case"execution_rejected":return`Execution rejected: ${s.reason||s.execution_id||"task"}`;default:return s.event||s.message||a.event_type.replace(/_/g," ")}},ne=({events:a,loading:s})=>e.jsxs("div",{className:"bg-[#0d0e14] border border-white/[0.06] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-[11px] font-mono text-zinc-500 uppercase tracking-widest",children:"Governance Log"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full animate-pulse"}),e.jsx("span",{className:"text-[9px] font-mono text-zinc-600 uppercase",children:"Live"})]})]}),s?e.jsx("div",{className:"space-y-2",children:Array.from({length:6},(r,c)=>e.jsxs("div",{className:"flex gap-3 p-2 bg-white/[0.02] animate-pulse",children:[e.jsx("div",{className:"h-3 w-14 bg-white/[0.06] rounded"}),e.jsx("div",{className:"h-3 flex-1 bg-white/[0.04] rounded"})]},c))}):a.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"text-zinc-600 text-xs font-mono mb-1",children:"No governance events yet"}),e.jsx("div",{className:"text-zinc-700 text-[10px] font-mono",children:"Connect an agent and submit an intent to see the pipeline in action"})]}):e.jsx("div",{className:"space-y-1 max-h-[380px] overflow-y-auto",children:a.map(r=>{const c=se[r.event_type]||{icon:e.jsx(M,{size:11}),color:"text-zinc-500"},n=new Date(r.created_at).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return e.jsxs("div",{className:"flex items-start gap-2.5 py-1.5 px-2 hover:bg-white/[0.02] transition-colors group",children:[e.jsx("div",{className:`mt-0.5 shrink-0 ${c.color}`,children:c.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[11px] text-zinc-300 font-mono truncate",children:ae(r)}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx("span",{className:"text-[9px] font-mono text-zinc-600",children:n}),r.actor&&e.jsx("span",{className:"text-[9px] font-mono text-zinc-700",children:r.actor})]})]})]},r.id)})})]}),re=({checks:a,loading:s})=>{const r={operational:"bg-emerald-500",degraded:"bg-amber-500",warning:"bg-red-500"},c={operational:"text-emerald-500",degraded:"text-amber-500",warning:"text-red-500"};return e.jsxs("div",{className:"bg-[#0d0e14] border border-white/[0.06] p-4",children:[e.jsx("h3",{className:"text-[11px] font-mono text-zinc-500 uppercase tracking-widest mb-3",children:"System Health"}),s?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(n=>e.jsx("div",{className:"h-10 bg-white/[0.04] animate-pulse"},n))}):e.jsx("div",{className:"space-y-2",children:a.map((n,o)=>e.jsxs("div",{className:"flex items-center gap-3 py-2 px-2.5 bg-white/[0.02] border border-white/[0.04]",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${r[n.status]} ${n.status==="operational"?"":"animate-pulse"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[11px] font-mono text-zinc-300",children:n.label}),e.jsx("div",{className:"text-[9px] font-mono text-zinc-600",children:n.detail})]}),e.jsx("span",{className:`text-[9px] font-mono font-bold uppercase tracking-wider ${c[n.status]}`,children:n.status})]},o))})]})},oe=({data:a,loading:s})=>{const r=Math.max(...a.map(c=>Number(c.executions)),1);return e.jsxs("div",{className:"bg-[#0d0e14] border border-white/[0.06] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-[11px] font-mono text-zinc-500 uppercase tracking-widest",children:"Execution Throughput"}),e.jsx("span",{className:"text-[10px] font-mono text-zinc-600",children:"24h"})]}),s?e.jsx("div",{className:"h-24 bg-white/[0.04] animate-pulse"}):a.length===0?e.jsx("div",{className:"h-24 flex items-center justify-center text-zinc-700 text-[10px] font-mono",children:"No executions in this period"}):e.jsx("div",{className:"flex items-end gap-px h-24",children:a.map((c,n)=>{const o=Number(c.executions)/r*100,p=Number(c.rejected),l=p>0;return e.jsxs("div",{className:"flex-1 flex flex-col items-stretch justify-end gap-0",title:`${c.executions} executions${l?`, ${p} rejected`:""}`,children:[l&&e.jsx("div",{className:"bg-red-500/60",style:{height:`${p/r*100}%`,minHeight:"2px"}}),e.jsx("div",{className:"bg-emerald-500/70 hover:bg-emerald-500 transition-colors",style:{height:`${o-(l?p/r*100:0)}%`,minHeight:"1px"}})]},n)})}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 pt-2 border-t border-white/[0.04]",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-2 h-2 bg-emerald-500/70"}),e.jsx("span",{className:"text-[9px] font-mono text-zinc-600",children:"Completed"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-2 h-2 bg-red-500/60"}),e.jsx("span",{className:"text-[9px] font-mono text-zinc-600",children:"Rejected"})]})]})]})};function xe(){const a=V(),[s,r]=u.useState(!0),[c,n]=u.useState(!1),[o,p]=u.useState(null),[l,S]=u.useState({activeAgents:0,totalAgents:0,warrantsToday:0,pendingApprovals:0,policyEvals:0,avgTrust:0,avgLatencyMs:0,totalWarrants:0,activeWarrants:0,activePolicies:0,executionsPeriod:0,auditEventsPeriod:0,openIncidents:0}),[f,d]=u.useState([]),[T,m]=u.useState(null),[i,t]=u.useState([]),[L,R]=u.useState([]),[E,J]=u.useState([]),[k,W]=u.useState({});Z();const z=u.useCallback(()=>{const b=localStorage.getItem("vienna_access_token"),h={"Content-Type":"application/json"};return b&&(h.Authorization=`Bearer ${b}`),h},[]),y=u.useCallback(async(b=!1)=>{b&&n(!0);const h=z();try{const j=await(await fetch("/api/v1/dashboard",{credentials:"include",headers:h})).json();if(j.success&&j.data){const x=j.data,g=x.overview||{},F=x.agents||[],H=F.filter(v=>(v==null?void 0:v.status)==="active").reduce((v,C)=>v+Number(C.count||0),0),G=F.reduce((v,C)=>v+Number(C.count||0),0);if(S({activeAgents:H,totalAgents:Number(g.total_agents)||G,warrantsToday:Number(g.active_warrants)||0,pendingApprovals:Number(g.pending_approvals)||0,policyEvals:Number(g.evaluations_period)||0,avgTrust:0,avgLatencyMs:0,totalWarrants:Number(g.total_warrants)||0,activeWarrants:Number(g.active_warrants)||0,activePolicies:Number(g.active_policies)||0,executionsPeriod:Number(g.executions_period)||0,auditEventsPeriod:Number(g.audit_events_period)||0,openIncidents:Number(g.open_incidents)||0}),x.riskDistribution&&d(x.riskDistribution),x.approvals&&m({pending:Number(x.approvals.pending)||0,approved:Number(x.approvals.approved)||0,denied:Number(x.approvals.denied)||0,expired:Number(x.approvals.expired)||0,avg_resolution_seconds:x.approvals.avg_resolution_seconds?Number(x.approvals.avg_resolution_seconds):null,new_this_period:Number(x.approvals.new_this_period)||0}),x.executionTrend&&R(x.executionTrend),x.recentActivity&&t(x.recentActivity),x.systemHealth){const v=x.systemHealth;J([{label:"Database",status:"operational",detail:`${Number(v.active_api_keys)||0} active API keys`},{label:"Webhook Delivery",status:Number(v.failed_webhooks_1h)>0?"degraded":"operational",detail:Number(v.failed_webhooks_1h)>0?`${v.failed_webhooks_1h} failed in last hour`:`${Number(v.active_webhooks)||0} active webhooks`},{label:"Integrations",status:"operational",detail:`${Number(v.active_integrations)||0} connected`}])}p(null)}}catch(w){console.error("[Dashboard] Load failed:",w),p("Failed to load dashboard data")}finally{r(!1),n(!1)}},[z]);u.useEffect(()=>{y()},[y]),u.useEffect(()=>{const b=setInterval(()=>y(),3e4);return()=>clearInterval(b)},[y]),u.useEffect(()=>{const b=z();Promise.all([fetch("/api/v1/dashboard/sparklines?metric=executions&range=24h&points=10",{credentials:"include",headers:b}).then(h=>h.json()).catch(()=>null),fetch("/api/v1/dashboard/sparklines?metric=evaluations&range=24h&points=10",{credentials:"include",headers:b}).then(h=>h.json()).catch(()=>null),fetch("/api/v1/dashboard/sparklines?metric=approvals&range=24h&points=10",{credentials:"include",headers:b}).then(h=>h.json()).catch(()=>null),fetch("/api/v1/dashboard/sparklines?metric=audit&range=24h&points=10",{credentials:"include",headers:b}).then(h=>h.json()).catch(()=>null)]).then(([h,w,j,x])=>{W({executions:(h==null?void 0:h.points)||new Array(10).fill(0),evaluations:(w==null?void 0:w.points)||new Array(10).fill(0),approvals:(j==null?void 0:j.points)||new Array(10).fill(0),audit:(x==null?void 0:x.points)||new Array(10).fill(0)})})},[z]);const A=new Array(10).fill(0);return e.jsxs("div",{className:"space-y-4",children:[o&&e.jsxs("div",{className:"bg-red-500/[0.08] border border-red-500/20 py-2.5 px-4 flex items-center gap-3",children:[e.jsx(O,{className:"text-red-400 shrink-0",size:14}),e.jsx("span",{className:"text-[11px] text-red-300/80 font-mono flex-1",children:o}),e.jsx("button",{onClick:()=>y(!0),className:"text-red-400 hover:text-white transition-colors text-[10px] font-mono font-bold",children:"RETRY"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-[13px] font-mono font-bold text-white uppercase tracking-wider",children:"Mission Control"}),!s&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-0.5 bg-emerald-500/[0.08] border border-emerald-500/20",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full animate-pulse"}),e.jsxs("span",{className:"text-[9px] font-mono text-emerald-500 uppercase",children:[l.totalAgents," agent",l.totalAgents!==1?"s":""," · ",l.activePolicies," polic",l.activePolicies!==1?"ies":"y"]})]})]}),e.jsxs("button",{onClick:()=>y(!0),disabled:c,className:"flex items-center gap-1.5 px-2 py-1 text-[10px] font-mono text-zinc-500 hover:text-white border border-white/[0.06] hover:border-white/[0.12] transition-colors",children:[e.jsx(B,{size:10,className:c?"animate-spin":""}),c?"REFRESHING":"REFRESH"]})]}),!s&&l.totalAgents===0&&l.totalWarrants===0&&e.jsxs("div",{className:"border-2 border-dashed border-amber-500/20 p-8 text-center",children:[e.jsx("div",{className:"text-[11px] font-mono text-amber-500 uppercase tracking-widest mb-2",children:"Getting Started"}),e.jsx("p",{className:"text-sm text-zinc-400 font-mono mb-6 max-w-lg mx-auto",children:"Connect your first agent, define a governance policy, and submit a test intent to see the full warrant pipeline."}),e.jsxs("div",{className:"flex items-center justify-center gap-4",children:[e.jsx("button",{onClick:()=>a("/connect"),className:"px-4 py-2 bg-amber-500 text-black text-[11px] font-mono font-bold hover:bg-amber-400 transition-colors cursor-pointer",style:{border:"none"},children:"CONNECT AGENT →"}),e.jsx("button",{onClick:()=>a("/demo"),className:"px-4 py-2 border border-amber-500/30 text-amber-500 text-[11px] font-mono font-bold hover:border-amber-500 transition-colors cursor-pointer",style:{background:"transparent"},children:"TRY DEMO"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx($,{label:"Executions (24h)",value:s?"—":l.executionsPeriod.toLocaleString(),sparklineData:k.executions||A,color:"green",loading:s}),e.jsx($,{label:"Policy Evaluations",value:s?"—":l.policyEvals.toLocaleString(),sparklineData:k.evaluations||A,color:"blue",loading:s}),e.jsx($,{label:"Active Warrants",value:s?"—":l.activeWarrants,trend:l.totalWarrants>0?`${l.totalWarrants} total`:void 0,trendDirection:"stable",sparklineData:k.approvals||A,color:"amber",loading:s}),e.jsx($,{label:"Pending Approvals",value:s?"—":l.pendingApprovals,trend:l.openIncidents>0?`${l.openIncidents} incident${l.openIncidents>1?"s":""}`:void 0,trendDirection:l.openIncidents>0?"up":"stable",sparklineData:k.audit||A,color:l.pendingApprovals>20?"red":"amber",loading:s})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-3",children:[e.jsx(ne,{events:i,loading:s}),e.jsx(oe,{data:L,loading:s})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(ee,{data:f,loading:s}),e.jsx(te,{data:T,loading:s}),e.jsx(re,{checks:E,loading:s})]})]})]})}export{xe as default};
-//# sourceMappingURL=DashboardPremium-D1X6YCtJ.js.map
diff --git a/apps/console-proxy/public/assets/DemoModePage-C4H2jnTf.js b/apps/console-proxy/public/assets/DemoModePage-C4H2jnTf.js
deleted file mode 100644
index b5808aa7..00000000
--- a/apps/console-proxy/public/assets/DemoModePage-C4H2jnTf.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import{c as j,r as d,j as e,T as E,C as M}from"./index-D_7YXFSJ.js";import{T as A}from"./terminal-ybst6913.js";import{C as v}from"./clock-DwbEOyPD.js";/**
- * @license lucide-react v1.7.0 - ISC
- *
- * This source code is licensed under the ISC license.
- * See the LICENSE file in the root directory of this source tree.
- */const I=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],O=j("circle-play",I);/**
- * @license lucide-react v1.7.0 - ISC
- *
- * This source code is licensed under the ISC license.
- * See the LICENSE file in the root directory of this source tree.
- */const q=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],L=j("rotate-ccw",q);function F(){var g,f;const[o,u]=d.useState(null),[N,c]=d.useState(!1),[m,x]=d.useState(0),[a,p]=d.useState([]),i=[{id:"quick-tour",name:"Quick Tour (2 min)",description:"Basic governance flow: 3 agents, 5 intents, 1 denial",duration:"2 minutes",events:12},{id:"compliance-demo",name:"Compliance Audit (5 min)",description:"SOC 2 scenario: 5 agents, 15 intents, policy violations, audit trail",duration:"5 minutes",events:35},{id:"risk-escalation",name:"Risk Escalation (3 min)",description:"T2/T3 actions, human approval flow, execution monitoring",duration:"3 minutes",events:18},{id:"multi-agent",name:"Multi-Agent Fleet (10 min)",description:"20 agents, parallel workflows, fleet coordination",duration:"10 minutes",events:80}],y=async t=>{u(t),c(!0),x(0),p([]);try{await fetch("/api/v1/demo/seed",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({scenario:t})})}catch{}const h=i.find(s=>s.id===t);if(!h)return;const b=parseInt(h.duration)*60*1e3,S=b/100,C=setInterval(()=>{x(s=>s>=100?(clearInterval(C),c(!1),100):s+1)},S),l=[],_=["agent-alpha","agent-beta","agent-gamma","agent-delta","agent-epsilon"],R=["deploy_infrastructure","query_database","send_email","update_config","delete_resource","create_user","modify_permissions"],D=["T0","T1","T2","T3"],P=["approved","approved","approved","denied","complete"],r=(s,n)=>s[n%s.length];for(let s=0;s{p(n=>[...n,l[s]])},s/l.length*b)},w=()=>{u(null),c(!1),x(0),p([])},k=t=>{switch(t){case"approved":case"complete":return e.jsx(M,{className:"w-4 h-4 text-green-400"});case"denied":case"failed":return e.jsx(E,{className:"w-4 h-4 text-red-400"});case"pending":return e.jsx(v,{className:"w-4 h-4 text-amber-400"})}},T=t=>{switch(t){case"T0":return"text-green-400";case"T1":return"text-amber-400";case"T2":return"text-red-400";case"T3":return"text-red-600";default:return"text-gray-400"}};return e.jsx("div",{className:"relative min-h-screen bg-[#0a0a0a] text-[#e4e4e4] overflow-hidden",children:e.jsxs("div",{className:"relative z-10 max-w-7xl mx-auto px-6 py-12",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[e.jsx(A,{className:"w-8 h-8 text-[#d4af37]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-[#d4af37] font-mono",children:"Demo Mode"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"One-click governance scenarios for sales and demos"})]})]}),!o&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-12",children:i.map(t=>e.jsxs("button",{onClick:()=>y(t.id),className:"bg-[#1a1a1a]/80 backdrop-blur-sm border border-[#d4af37]/20 rounded-lg p-6 text-left hover:border-[#d4af37]/60 hover:shadow-[0_0_20px_rgba(212,175,55,0.15)] transition-all duration-300 group",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsx("h3",{className:"text-lg font-bold text-[#d4af37] font-mono group-hover:text-[#d4af37]/90",children:t.name}),e.jsx(O,{className:"w-6 h-6 text-[#d4af37]/60 group-hover:text-[#d4af37]"})]}),e.jsx("p",{className:"text-sm text-gray-400 mb-4",children:t.description}),e.jsxs("div",{className:"flex items-center gap-4 text-xs font-mono",children:[e.jsxs("span",{className:"text-gray-500",children:[e.jsx(v,{className:"w-3 h-3 inline mr-1"}),t.duration]}),e.jsxs("span",{className:"text-gray-500",children:[t.events," events"]})]})]},t.id))}),o&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-[#1a1a1a]/80 backdrop-blur-sm border border-[#d4af37]/20 rounded-lg p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-[#d4af37] font-mono",children:(g=i.find(t=>t.id===o))==null?void 0:g.name}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:(f=i.find(t=>t.id===o))==null?void 0:f.description})]}),e.jsxs("button",{onClick:w,className:"px-4 py-2 bg-red-500/20 text-red-400 rounded border border-red-500/40 hover:bg-red-500/30 transition-colors flex items-center gap-2 font-mono text-sm",children:[e.jsx(L,{className:"w-4 h-4"}),"Reset"]})]}),e.jsx("div",{className:"relative w-full h-3 bg-[#2a2a2a] rounded-full overflow-hidden",children:e.jsx("div",{className:"absolute top-0 left-0 h-full bg-gradient-to-r from-[#d4af37] to-amber-500 transition-all duration-300",style:{width:`${m}%`}})}),e.jsxs("div",{className:"flex justify-between mt-2 text-xs font-mono text-gray-500",children:[e.jsxs("span",{children:[m,"%"]}),e.jsx("span",{children:N?"Running...":m===100?"Complete":"Ready"})]})]}),e.jsxs("div",{className:"bg-[#1a1a1a]/80 backdrop-blur-sm border border-[#d4af37]/20 rounded-lg p-6",children:[e.jsx("h4",{className:"text-sm font-bold text-[#d4af37] font-mono mb-4 uppercase tracking-wider",children:"Governance Timeline"}),e.jsxs("div",{className:"space-y-2 max-h-[500px] overflow-y-auto scrollbar-thin scrollbar-thumb-[#d4af37]/20 scrollbar-track-transparent",children:[a.length===0&&e.jsx("div",{className:"text-center py-12 text-gray-500 text-sm font-mono",children:"No events yet. Demo will start shortly..."}),a.map(t=>e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-[#0a0a0a]/60 rounded border border-gray-800 hover:border-[#d4af37]/40 transition-colors",children:[e.jsx("div",{className:"flex-shrink-0",children:k(t.status)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[e.jsx("span",{className:"text-gray-400",children:t.type.toUpperCase()}),e.jsx("span",{className:"text-gray-600",children:"•"}),e.jsx("span",{className:"text-gray-400",children:t.agent}),e.jsx("span",{className:"text-gray-600",children:"•"}),e.jsx("span",{className:T(t.tier),children:t.tier})]}),e.jsx("div",{className:"text-sm text-[#e4e4e4] mt-1 truncate",children:t.action})]}),e.jsx("div",{className:"flex-shrink-0 text-xs font-mono text-gray-500",children:new Date(t.timestamp).toLocaleTimeString()})]},t.id))]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-[#1a1a1a]/80 backdrop-blur-sm border border-[#d4af37]/20 rounded-lg p-4",children:[e.jsx("div",{className:"text-xs font-mono text-gray-500 uppercase mb-1",children:"Total Events"}),e.jsx("div",{className:"text-2xl font-bold text-[#d4af37] font-mono",children:a.length})]}),e.jsxs("div",{className:"bg-[#1a1a1a]/80 backdrop-blur-sm border border-[#d4af37]/20 rounded-lg p-4",children:[e.jsx("div",{className:"text-xs font-mono text-gray-500 uppercase mb-1",children:"Approved"}),e.jsx("div",{className:"text-2xl font-bold text-green-400 font-mono",children:a.filter(t=>t.status==="approved"||t.status==="complete").length})]}),e.jsxs("div",{className:"bg-[#1a1a1a]/80 backdrop-blur-sm border border-[#d4af37]/20 rounded-lg p-4",children:[e.jsx("div",{className:"text-xs font-mono text-gray-500 uppercase mb-1",children:"Denied"}),e.jsx("div",{className:"text-2xl font-bold text-red-400 font-mono",children:a.filter(t=>t.status==="denied"||t.status==="failed").length})]}),e.jsxs("div",{className:"bg-[#1a1a1a]/80 backdrop-blur-sm border border-[#d4af37]/20 rounded-lg p-4",children:[e.jsx("div",{className:"text-xs font-mono text-gray-500 uppercase mb-1",children:"High Risk"}),e.jsx("div",{className:"text-2xl font-bold text-amber-400 font-mono",children:a.filter(t=>t.tier==="T2"||t.tier==="T3").length})]})]})]})]})})}export{F as default};
-//# sourceMappingURL=DemoModePage-C4H2jnTf.js.map
diff --git a/apps/console-proxy/public/assets/EmbedWidgetPage-BDFnGg9J.js b/apps/console-proxy/public/assets/EmbedWidgetPage-BDFnGg9J.js
deleted file mode 100644
index 1008eea7..00000000
--- a/apps/console-proxy/public/assets/EmbedWidgetPage-BDFnGg9J.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import{c,r as n,j as e,D as x}from"./index-D_7YXFSJ.js";import{a as m,C as h}from"./copy-DPJWkP7J.js";import{E as p}from"./eye-46CiQ26c.js";/**
- * @license lucide-react v1.7.0 - ISC
- *
- * This source code is licensed under the ISC license.
- * See the LICENSE file in the root directory of this source tree.
- */const b=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],f=c("external-link",b);function y(){const[s,t]=n.useState({theme:"terminal",showAgents:!0,showWarrants:!0,showApprovals:!0,showPolicies:!0,refreshInterval:60,size:"medium"}),[d,r]=n.useState(!1),l=()=>``,o=async()=>{await navigator.clipboard.writeText(l()),r(!0),setTimeout(()=>r(!1),2e3)};return e.jsx("div",{className:"relative min-h-screen bg-[#0a0a0a] text-[#e4e4e4] overflow-hidden",children:e.jsxs("div",{className:"relative z-10 max-w-6xl mx-auto px-6 py-12",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[e.jsx(m,{className:"w-8 h-8 text-[#d4af37]"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-[#d4af37] font-mono",children:"Embeddable Widget Generator"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Generate embeddable governance stats for your website, docs, or blog"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-[#1a1a1a]/80 backdrop-blur-sm border border-[#d4af37]/20 rounded-lg p-6",children:[e.jsx("h2",{className:"text-lg font-bold text-[#d4af37] font-mono mb-6 uppercase tracking-wider",children:"Widget Configuration"}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"block text-xs font-mono text-gray-400 uppercase mb-2",children:"Theme"}),e.jsx("div",{className:"flex gap-3",children:["light","dark","terminal"].map(a=>e.jsx("button",{onClick:()=>t({...s,theme:a}),className:`flex-1 py-2 px-4 rounded border font-mono text-xs uppercase transition-all ${s.theme===a?"bg-[#d4af37] text-black border-[#d4af37]":"bg-[#0a0a0a]/60 text-gray-400 border-gray-800 hover:border-[#d4af37]/40"}`,children:a},a))})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"block text-xs font-mono text-gray-400 uppercase mb-2",children:"Size"}),e.jsx("div",{className:"flex gap-3",children:["small","medium","large"].map(a=>e.jsx("button",{onClick:()=>t({...s,size:a}),className:`flex-1 py-2 px-4 rounded border font-mono text-xs uppercase transition-all ${s.size===a?"bg-[#d4af37] text-black border-[#d4af37]":"bg-[#0a0a0a]/60 text-gray-400 border-gray-800 hover:border-[#d4af37]/40"}`,children:a},a))}),e.jsxs("div",{className:"mt-2 text-xs font-mono text-gray-500",children:[s.size==="small"&&"300×200px",s.size==="medium"&&"400×300px",s.size==="large"&&"600×400px"]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"block text-xs font-mono text-gray-400 uppercase mb-2",children:"Visible Metrics"}),e.jsx("div",{className:"space-y-2",children:[{key:"showAgents",label:"Active Agents"},{key:"showWarrants",label:"Warrants Issued"},{key:"showApprovals",label:"Pending Approvals"},{key:"showPolicies",label:"Active Policies"}].map(a=>e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group",children:[e.jsx("input",{type:"checkbox",checked:s[a.key],onChange:i=>t({...s,[a.key]:i.target.checked}),className:"w-4 h-4 accent-[#d4af37]"}),e.jsx("span",{className:"text-sm text-gray-300 group-hover:text-[#d4af37] transition-colors",children:a.label})]},a.key))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-mono text-gray-400 uppercase mb-2",children:"Refresh Interval (seconds)"}),e.jsx("input",{type:"number",min:"10",max:"300",value:s.refreshInterval,onChange:a=>t({...s,refreshInterval:parseInt(a.target.value)||60}),className:"w-full px-4 py-2 bg-[#0a0a0a]/60 border border-gray-800 rounded text-gray-300 font-mono text-sm focus:outline-none focus:border-[#d4af37]/60"})]})]}),e.jsxs("div",{className:"bg-[#1a1a1a]/80 backdrop-blur-sm border border-[#d4af37]/20 rounded-lg p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-bold text-[#d4af37] font-mono uppercase tracking-wider",children:"Live Preview"}),e.jsx(p,{className:"w-5 h-5 text-[#d4af37]/60"})]}),e.jsx("div",{className:`rounded border overflow-hidden ${s.theme==="terminal"?"bg-[#0a0a0a] border-[#d4af37]/20":s.theme==="dark"?"bg-gray-900 border-gray-700":"bg-white border-gray-300"}`,style:{width:s.size==="small"?"300px":s.size==="medium"?"400px":"100%",height:s.size==="small"?"200px":s.size==="medium"?"300px":"400px"},children:e.jsx(g,{config:s})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-[#1a1a1a]/80 backdrop-blur-sm border border-[#d4af37]/20 rounded-lg p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-bold text-[#d4af37] font-mono uppercase tracking-wider",children:"Embed Code"}),e.jsx("button",{onClick:o,className:"flex items-center gap-2 px-3 py-1.5 bg-[#d4af37]/20 text-[#d4af37] rounded border border-[#d4af37]/40 hover:bg-[#d4af37]/30 transition-colors text-xs font-mono",children:d?e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"w-4 h-4"}),"Copied!"]}):e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"w-4 h-4"}),"Copy"]})})]}),e.jsx("pre",{className:"bg-[#0a0a0a]/80 border border-gray-800 rounded p-4 overflow-x-auto text-xs text-gray-300 font-mono",children:l()})]}),e.jsxs("div",{className:"bg-[#1a1a1a]/80 backdrop-blur-sm border border-[#d4af37]/20 rounded-lg p-6",children:[e.jsx("h2",{className:"text-lg font-bold text-[#d4af37] font-mono mb-4 uppercase tracking-wider",children:"Usage Instructions"}),e.jsxs("div",{className:"space-y-4 text-sm text-gray-300",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-[#d4af37] mb-2 font-mono text-xs uppercase",children:"1. Copy the code"}),e.jsx("p",{className:"text-gray-400 leading-relaxed",children:'Click the "Copy" button above to copy the embed code to your clipboard.'})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-[#d4af37] mb-2 font-mono text-xs uppercase",children:"2. Paste into HTML"}),e.jsx("p",{className:"text-gray-400 leading-relaxed",children:"Add the iframe code to your website, documentation, or blog post where you want the stats widget to appear."})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-[#d4af37] mb-2 font-mono text-xs uppercase",children:"3. Customize"}),e.jsx("p",{className:"text-gray-400 leading-relaxed",children:"Adjust the configuration options on the left to match your site's design and data requirements."})]}),e.jsxs("div",{className:"pt-4 border-t border-gray-800",children:[e.jsx("h3",{className:"font-bold text-[#d4af37] mb-2 font-mono text-xs uppercase",children:"Example Use Cases"}),e.jsxs("ul",{className:"space-y-2 text-gray-400",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-[#d4af37] mt-1",children:"•"}),e.jsx("span",{children:"Add to your homepage to showcase live governance metrics"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-[#d4af37] mt-1",children:"•"}),e.jsx("span",{children:"Embed in documentation for transparency"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-[#d4af37] mt-1",children:"•"}),e.jsx("span",{children:"Include in blog posts about your AI governance practices"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-[#d4af37] mt-1",children:"•"}),e.jsx("span",{children:"Share with stakeholders in compliance reports"})]})]})]}),e.jsx("div",{className:"pt-4 border-t border-gray-800",children:e.jsxs("a",{href:"https://docs.regulator.ai/embed-widget",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-[#d4af37] hover:text-[#d4af37]/80 transition-colors font-mono text-xs",children:[e.jsx(f,{className:"w-4 h-4"}),"View full documentation"]})})]})]})]})]})]})})}function g({config:s}){const[t,d]=n.useState({agents:24,warrants:1847,approvals:3,policies:15});n.useEffect(()=>{const a=setInterval(()=>{d({agents:24,warrants:t.warrants+1,approvals:t.approvals>0?t.approvals-1:3,policies:15})},s.refreshInterval*1e3);return()=>clearInterval(a)},[s.refreshInterval]);const r=s.theme==="terminal"?"#d4af37":s.theme==="dark"?"#10b981":"#059669",l=s.theme==="terminal"?"#0a0a0a":s.theme==="dark"?"#111827":"#ffffff",o=s.theme==="light"?"#6b7280":"#9ca3af";return e.jsxs("div",{className:"p-6 h-full flex flex-col",style:{background:l},children:[e.jsx("h3",{className:"text-lg font-bold font-mono mb-4",style:{color:r},children:"Vienna OS Stats"}),e.jsxs("div",{className:"flex-1 grid grid-cols-2 gap-4",children:[s.showAgents&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-mono uppercase mb-1",style:{color:o},children:"Active Agents"}),e.jsx("div",{className:"text-3xl font-bold font-mono",style:{color:r},children:t.agents})]}),s.showWarrants&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-mono uppercase mb-1",style:{color:o},children:"Warrants"}),e.jsx("div",{className:"text-3xl font-bold font-mono",style:{color:r},children:t.warrants})]}),s.showApprovals&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-mono uppercase mb-1",style:{color:o},children:"Pending"}),e.jsx("div",{className:"text-3xl font-bold font-mono",style:{color:r},children:t.approvals})]}),s.showPolicies&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-mono uppercase mb-1",style:{color:o},children:"Policies"}),e.jsx("div",{className:"text-3xl font-bold font-mono",style:{color:r},children:t.policies})]})]}),e.jsx("div",{className:"text-xs font-mono mt-4 pt-4 border-t",style:{color:o,borderColor:o+"40"},children:"Powered by Vienna OS"})]})}export{y as default};
-//# sourceMappingURL=EmbedWidgetPage-BDFnGg9J.js.map
diff --git a/apps/console-proxy/public/assets/ExecutionPage-CdXjf9HJ.js b/apps/console-proxy/public/assets/ExecutionPage-CzELhGv6.js
similarity index 99%
rename from apps/console-proxy/public/assets/ExecutionPage-CdXjf9HJ.js
rename to apps/console-proxy/public/assets/ExecutionPage-CzELhGv6.js
index f4eb06e8..8c1f078f 100644
--- a/apps/console-proxy/public/assets/ExecutionPage-CdXjf9HJ.js
+++ b/apps/console-proxy/public/assets/ExecutionPage-CzELhGv6.js
@@ -1,7 +1,7 @@
-import{a as x,r as a,j as e,R as C,e as M}from"./index-D_7YXFSJ.js";const A={async getStatus(){return await x.get("/system/status")}};function N(){const[r,o]=a.useState([{name:"Intent",count:null,status:"unknown"},{name:"Plan",count:null,status:"unknown"},{name:"Policy",count:null,status:"unknown"},{name:"Warrant",count:null,status:"unknown"},{name:"Execution",count:null,status:"unknown"},{name:"Verification",count:null,status:"unknown"}]),[c,l]=a.useState(null);a.useEffect(()=>{n();const s=setInterval(n,1e4);return()=>clearInterval(s)},[]);const n=async()=>{try{const s=await A.getStatus(),i=[{name:"Intent",count:null,status:"unknown"},{name:"Plan",count:null,status:"unknown"},{name:"Policy",count:null,status:"unknown"},{name:"Warrant",count:null,status:"unknown"},{name:"Execution",count:s.active_envelopes||0,status:s.active_envelopes>0?"active":"idle"},{name:"Verification",count:null,status:"unknown"}];o(i),l(null)}catch(s){console.error("[ExecutionPipeline] Error fetching status:",s),l(s instanceof Error?s.message:"Unknown error")}},p=s=>{switch(s){case"active":return"active";case"idle":return"idle";default:return"unknown"}};return c?e.jsxs("div",{className:"execution-pipeline-status",children:[e.jsx("div",{className:"panel-header",children:e.jsx("h3",{children:"Execution Pipeline"})}),e.jsx("div",{className:"panel-body",children:e.jsxs("div",{className:"error-state",children:["Error: ",c]})})]}):e.jsxs("div",{className:"execution-pipeline-status",children:[e.jsx("div",{className:"panel-header",children:e.jsx("h3",{children:"Execution Pipeline"})}),e.jsx("div",{className:"panel-body",children:e.jsx("div",{className:"pipeline-container",children:r.map((s,i)=>e.jsxs(C.Fragment,{children:[e.jsxs("div",{className:`pipeline-stage ${p(s.status)}`,children:[e.jsx("div",{className:"stage-name",children:s.name}),e.jsx("div",{className:"stage-value",children:s.count!==null?s.count:"—"})]}),i{const l=a.useMemo(()=>{const n=[],p=r.find(d=>d.stage==="requested"),s=r.find(d=>d.stage==="evaluated"),i=r.find(d=>d.stage==="approved"),g=r.find(d=>d.stage==="denied"),h=r.find(d=>d.stage==="executed"),b=r.find(d=>d.stage==="blocked");return p&&n.push(p),s&&n.push(s),(i||g)&&n.push(i||g),(h||b)&&n.push(h||b),n},[r]);return l.length===0?e.jsx("div",{style:{padding:"16px",backgroundColor:"var(--bg-primary)",border:"1px solid var(--border-subtle)",borderRadius:"8px",color:"var(--text-tertiary)",fontSize:"12px",textAlign:"center"},children:"No warrant timeline available"}):e.jsxs("div",{style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border-subtle)",borderRadius:"12px",padding:"24px"},children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"var(--text-primary)",margin:"0 0 4px"},children:"📜 Warrant Lifecycle"}),o&&e.jsxs("div",{style:{fontSize:"11px",color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["ID: ",o]})]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"0",overflowX:"auto"},children:l.map((n,p)=>{const s=P[n.stage],i=D(n.status),g=p===l.length-1;return e.jsxs("div",{style:{display:"flex",alignItems:"center",flex:"0 0 auto"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"50%",backgroundColor:`${i}15`,border:`2px solid ${i}`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"16px",flexShrink:0,animation:n.status==="pending"?"pulse 2s infinite":void 0},title:`${s.label} - ${n.status}`,children:s.icon}),e.jsxs("div",{style:{textAlign:"center",minWidth:"80px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:"var(--text-primary)",textTransform:"uppercase",letterSpacing:"0.04em"},children:s.label}),n.timestamp&&e.jsx("div",{style:{fontSize:"9px",color:"var(--text-tertiary)",marginTop:"2px"},title:new Date(n.timestamp).toLocaleString(),children:$(n.timestamp)}),n.actor&&e.jsx("div",{style:{fontSize:"8px",color:"var(--text-muted)",marginTop:"1px"},children:n.actor})]})]}),!g&&e.jsx("div",{style:{width:"40px",height:"2px",backgroundColor:i,margin:"0 16px",opacity:.6,flexShrink:0,position:"relative"},children:e.jsx("div",{style:{position:"absolute",right:"-6px",top:"-3px",width:"0",height:"0",borderLeft:`6px solid ${i}`,borderTop:"3px solid transparent",borderBottom:"3px solid transparent",opacity:.6}})})]},`${n.stage}-${p}`)})}),e.jsx("style",{children:`
+import{e as x,r as a,j as e,R as C,h as M}from"./index-C0nK3ekl.js";const A={async getStatus(){return await x.get("/system/status")}};function N(){const[r,o]=a.useState([{name:"Intent",count:null,status:"unknown"},{name:"Plan",count:null,status:"unknown"},{name:"Policy",count:null,status:"unknown"},{name:"Warrant",count:null,status:"unknown"},{name:"Execution",count:null,status:"unknown"},{name:"Verification",count:null,status:"unknown"}]),[c,l]=a.useState(null);a.useEffect(()=>{n();const s=setInterval(n,1e4);return()=>clearInterval(s)},[]);const n=async()=>{try{const s=await A.getStatus(),i=[{name:"Intent",count:null,status:"unknown"},{name:"Plan",count:null,status:"unknown"},{name:"Policy",count:null,status:"unknown"},{name:"Warrant",count:null,status:"unknown"},{name:"Execution",count:s.active_envelopes||0,status:s.active_envelopes>0?"active":"idle"},{name:"Verification",count:null,status:"unknown"}];o(i),l(null)}catch(s){console.error("[ExecutionPipeline] Error fetching status:",s),l(s instanceof Error?s.message:"Unknown error")}},p=s=>{switch(s){case"active":return"active";case"idle":return"idle";default:return"unknown"}};return c?e.jsxs("div",{className:"execution-pipeline-status",children:[e.jsx("div",{className:"panel-header",children:e.jsx("h3",{children:"Execution Pipeline"})}),e.jsx("div",{className:"panel-body",children:e.jsxs("div",{className:"error-state",children:["Error: ",c]})})]}):e.jsxs("div",{className:"execution-pipeline-status",children:[e.jsx("div",{className:"panel-header",children:e.jsx("h3",{children:"Execution Pipeline"})}),e.jsx("div",{className:"panel-body",children:e.jsx("div",{className:"pipeline-container",children:r.map((s,i)=>e.jsxs(C.Fragment,{children:[e.jsxs("div",{className:`pipeline-stage ${p(s.status)}`,children:[e.jsx("div",{className:"stage-name",children:s.name}),e.jsx("div",{className:"stage-value",children:s.count!==null?s.count:"—"})]}),i{const l=a.useMemo(()=>{const n=[],p=r.find(d=>d.stage==="requested"),s=r.find(d=>d.stage==="evaluated"),i=r.find(d=>d.stage==="approved"),g=r.find(d=>d.stage==="denied"),h=r.find(d=>d.stage==="executed"),b=r.find(d=>d.stage==="blocked");return p&&n.push(p),s&&n.push(s),(i||g)&&n.push(i||g),(h||b)&&n.push(h||b),n},[r]);return l.length===0?e.jsx("div",{style:{padding:"16px",backgroundColor:"var(--bg-primary)",border:"1px solid var(--border-subtle)",borderRadius:"8px",color:"var(--text-tertiary)",fontSize:"12px",textAlign:"center"},children:"No warrant timeline available"}):e.jsxs("div",{style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border-subtle)",borderRadius:"12px",padding:"24px"},children:[e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsx("h3",{style:{fontSize:"14px",fontWeight:600,color:"var(--text-primary)",margin:"0 0 4px"},children:"📜 Warrant Lifecycle"}),o&&e.jsxs("div",{style:{fontSize:"11px",color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["ID: ",o]})]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"0",overflowX:"auto"},children:l.map((n,p)=>{const s=P[n.stage],i=D(n.status),g=p===l.length-1;return e.jsxs("div",{style:{display:"flex",alignItems:"center",flex:"0 0 auto"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"50%",backgroundColor:`${i}15`,border:`2px solid ${i}`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"16px",flexShrink:0,animation:n.status==="pending"?"pulse 2s infinite":void 0},title:`${s.label} - ${n.status}`,children:s.icon}),e.jsxs("div",{style:{textAlign:"center",minWidth:"80px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:"var(--text-primary)",textTransform:"uppercase",letterSpacing:"0.04em"},children:s.label}),n.timestamp&&e.jsx("div",{style:{fontSize:"9px",color:"var(--text-tertiary)",marginTop:"2px"},title:new Date(n.timestamp).toLocaleString(),children:$(n.timestamp)}),n.actor&&e.jsx("div",{style:{fontSize:"8px",color:"var(--text-muted)",marginTop:"1px"},children:n.actor})]})]}),!g&&e.jsx("div",{style:{width:"40px",height:"2px",backgroundColor:i,margin:"0 16px",opacity:.6,flexShrink:0,position:"relative"},children:e.jsx("div",{style:{position:"absolute",right:"-6px",top:"-3px",width:"0",height:"0",borderLeft:`6px solid ${i}`,borderTop:"3px solid transparent",borderBottom:"3px solid transparent",opacity:.6}})})]},`${n.stage}-${p}`)})}),e.jsx("style",{children:`
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
`})]})},f={getActive:()=>x.get("/execution/active"),getQueue:()=>x.get("/execution/queue"),getBlocked:()=>x.get("/execution/blocked"),getMetrics:()=>x.get("/execution/metrics"),getHealth:()=>x.get("/execution/health"),getIntegrity:()=>x.get("/execution/integrity"),pause:(r,o)=>x.post("/execution/pause",{operator:r,reason:o}),resume:r=>x.post("/execution/resume",{operator:r}),checkIntegrity:r=>x.post("/execution/integrity-check",{operator:r}),emergencyOverride:(r,o,c,l)=>x.post("/execution/emergency-override",{operator:r,reason:o,duration_minutes:c,metternich_approval_id:l})};function L(){const[r,o]=a.useState(null),[c,l]=a.useState(!0);a.useEffect(()=>{n()},[]);const n=async()=>{try{const i=await fetch("/api/v1/settings/execution-modes",{credentials:"include",headers:{Authorization:`Bearer ${localStorage.getItem("vienna_access_token")}`}});if(i.ok){const g=await i.json();o(g.data)}}catch{}finally{l(!1)}},p=i=>i==="direct"?"⚡":"🔄",s=i=>i==="direct"?"#f59e0b":"#3b82f6";return c||!r?null:e.jsxs("div",{style:{background:"var(--bg-primary)",border:"1px solid var(--border-subtle)",borderRadius:"12px",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"12px",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:"8px"},children:"Current Execution Mode Configuration"}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"},children:["T0","T1","T2","T3"].map(i=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 8px",background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",borderRadius:"6px",fontSize:"11px"},children:[e.jsx("span",{style:{fontWeight:600,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:i}),e.jsxs("span",{style:{color:s(r[i]),display:"flex",alignItems:"center",gap:"2px"},children:[p(r[i]),e.jsx("span",{style:{fontSize:"10px",fontWeight:500},children:r[i]==="direct"?"Direct":"Passback"})]})]},i))})]}),e.jsx("a",{href:"/settings",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid rgba(124, 58, 237, 0.3)",background:"rgba(124, 58, 237, 0.08)",color:"#f59e0b",fontSize:"11px",fontWeight:600,textDecoration:"none",display:"flex",alignItems:"center",gap:"4px",transition:"all 150ms"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(124, 58, 237, 0.12)"},onMouseLeave:i=>{i.currentTarget.style.background="rgba(124, 58, 237, 0.08)"},children:"⚙️ Configure"})]})}function O(){const[r,o]=a.useState([]),[c,l]=a.useState(null),[n,p]=a.useState(null),[s,i]=a.useState([]),[g,h]=a.useState(!1),[b,d]=a.useState(!0),[k,w]=a.useState(null),{isMobile:j}=M(),v=a.useCallback(async()=>{try{const[t,u,y]=await Promise.all([f.getActive().catch(()=>[]),f.getQueue().catch(()=>null),f.getMetrics().catch(()=>null)]);o(Array.isArray(t)?t:[]),l(u&&typeof u=="object"?u:null),p(y&&typeof y=="object"?y:null),w(null)}catch(t){w(t instanceof Error?t.message:"Unknown error")}},[]),S=a.useCallback(async()=>{try{const t=await fetch("/api/v1/execution-records?limit=20",{credentials:"include"});if(t.ok){const u=await t.json(),y=(u==null?void 0:u.data)??u;i(Array.isArray(y)?y:[])}}catch{}},[]);a.useEffect(()=>{d(!0),Promise.all([v(),S()]).finally(()=>{d(!1)});const t=setInterval(()=>{v(),S()},5e3);return()=>clearInterval(t)},[v,S]);const E=async()=>{try{await f.pause("console-operator","Manual pause from console"),h(!0),v()}catch{}},z=async()=>{try{await f.resume("console-operator"),h(!1),v()}catch{}},R=async()=>{if(window.confirm("EMERGENCY OVERRIDE: This will bypass all governance for 15 minutes. Are you sure?"))try{await f.emergencyOverride("console-operator","Emergency override from console",15,"console-emergency"),v()}catch{}},T=(t,u)=>{const y=new Date(t),m=new Date().getTime()-y.getTime();return m<1e3?`${m}ms`:m<6e4?`${Math.floor(m/1e3)}s`:`${Math.floor(m/6e4)}m ${Math.floor(m%6e4/1e3)}s`},I=t=>{switch(t){case"executing":return"text-blue-400";case"completed":return"text-emerald-400";case"failed":return"text-red-400";case"approved":return"text-amber-400";default:return"text-slate-400"}},W=t=>t==="vienna_direct"?"Vienna Direct":"Agent Passback",_=t=>{switch(t){case"T0":return"text-emerald-400 bg-emerald-500/10 border-emerald-500/20";case"T1":return"text-blue-400 bg-blue-500/10 border-blue-500/20";case"T2":return"text-amber-400 bg-amber-500/10 border-amber-500/20";case"T3":return"text-red-400 bg-red-500/10 border-red-500/20";default:return"text-slate-400 bg-slate-500/10 border-slate-500/20"}};return b?e.jsx("div",{className:"max-w-7xl mx-auto",children:e.jsx("div",{style:{padding:"24px 0",textAlign:"center",color:"var(--text-secondary)"},children:"Loading execution pipeline..."})}):e.jsxs("div",{className:"max-w-7xl mx-auto space-y-6",children:[e.jsx(L,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"24px",fontWeight:600,color:"var(--text-primary)",margin:0,display:"flex",alignItems:"center",gap:"12px"},children:"▶️ Execution Pipeline"}),e.jsx("p",{style:{fontSize:"14px",color:"var(--text-tertiary)",margin:"4px 0 0 0"},children:"Live execution pipeline visualization and controls"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[g?e.jsx("button",{onClick:z,style:{background:"var(--accent-primary)",border:"1px solid var(--accent-primary)",borderRadius:"8px",padding:"8px 16px",fontSize:"13px",fontWeight:500,color:"white",cursor:"pointer",transition:"all 150ms ease"},children:"▶️ Resume"}):e.jsx("button",{onClick:E,style:{background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",borderRadius:"8px",padding:"8px 16px",fontSize:"13px",fontWeight:500,color:"var(--text-primary)",cursor:"pointer",transition:"all 150ms ease"},onMouseEnter:t=>{t.currentTarget.style.background="var(--bg-tertiary)"},onMouseLeave:t=>{t.currentTarget.style.background="var(--bg-secondary)"},children:"⏸️ Pause"}),e.jsx("button",{onClick:R,style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.2)",borderRadius:"8px",padding:"8px 16px",fontSize:"13px",fontWeight:500,color:"#f87171",cursor:"pointer",transition:"all 150ms ease"},onMouseEnter:t=>{t.currentTarget.style.background="rgba(239, 68, 68, 0.15)"},onMouseLeave:t=>{t.currentTarget.style.background="rgba(239, 68, 68, 0.1)"},children:"🚨 Emergency Override"})]})]}),k&&e.jsxs("div",{style:{background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.2)",borderRadius:"12px",padding:"16px",color:"#f87171",fontSize:"14px"},children:["Error: ",k]}),r.length>0&&r[0]&&e.jsx("div",{style:{marginBottom:"24px"},children:e.jsx(B,{stages:[{stage:"requested",status:"complete",timestamp:r[0].started_at},{stage:"evaluated",status:"complete",timestamp:r[0].started_at},{stage:"approved",status:r[0].state==="executing"?"complete":"pending",timestamp:r[0].started_at},{stage:"executed",status:r[0].state==="completed"?"complete":"pending",timestamp:r[0].started_at}],warrantsId:r[0].envelope_id})}),e.jsx("div",{style:{background:"var(--bg-primary)",border:"1px solid var(--border-subtle)",borderRadius:"12px",overflow:"hidden"},children:e.jsx(N,{})}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:j?"1fr":"1fr 1fr",gap:"24px"},children:[e.jsxs("div",{style:{background:"var(--bg-primary)",border:"1px solid var(--border-subtle)",borderRadius:"12px",overflow:"hidden"},children:[e.jsx("div",{style:{padding:"20px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-secondary)"},children:e.jsxs("h3",{style:{fontSize:"16px",fontWeight:600,color:"var(--text-primary)",margin:0,display:"flex",alignItems:"center",gap:"8px"},children:["🔄 Active Executions",e.jsx("span",{style:{background:"var(--accent-primary)",color:"white",fontSize:"11px",fontWeight:600,padding:"2px 8px",borderRadius:"12px"},children:r.length})]})}),e.jsx("div",{style:{padding:"20px"},children:r.length===0?e.jsx("div",{style:{textAlign:"center",color:"var(--text-tertiary)",fontSize:"14px"},children:"No active executions"}):e.jsx("div",{style:{display:"grid",gap:"12px"},children:r.slice(0,5).map(t=>e.jsxs("div",{style:{background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",borderRadius:"8px",padding:"12px"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start",marginBottom:"8px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"13px",fontWeight:500,color:"var(--text-primary)"},children:t.action_type||t.envelope_id.slice(0,8)}),e.jsx("div",{style:{fontSize:"11px",color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:t.envelope_id})]}),e.jsx("div",{style:{fontSize:"11px",fontWeight:500,padding:"2px 6px",borderRadius:"4px",background:"var(--accent-primary)",color:"white"},children:t.state})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"11px",color:"var(--text-tertiary)"},children:[e.jsxs("span",{children:["Started: ",new Date(t.started_at).toLocaleTimeString()]}),e.jsx("span",{children:T(t.started_at)})]})]},t.envelope_id))})})]}),e.jsxs("div",{style:{background:"var(--bg-primary)",border:"1px solid var(--border-subtle)",borderRadius:"12px",overflow:"hidden"},children:[e.jsx("div",{style:{padding:"20px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-secondary)"},children:e.jsx("h3",{style:{fontSize:"16px",fontWeight:600,color:"var(--text-primary)",margin:0,display:"flex",alignItems:"center",gap:"8px"},children:"📋 Queue Status"})}),e.jsx("div",{style:{padding:"20px"},children:c?e.jsxs("div",{style:{display:"grid",gap:"16px"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:j?"1fr":"1fr 1fr",gap:"12px"},children:[e.jsxs("div",{style:{background:"var(--bg-secondary)",borderRadius:"8px",padding:"16px",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"24px",fontWeight:600,color:"var(--accent-primary)",marginBottom:"4px"},children:c.queued}),e.jsx("div",{style:{fontSize:"11px",color:"var(--text-tertiary)"},children:"Queued"})]}),e.jsxs("div",{style:{background:"var(--bg-secondary)",borderRadius:"8px",padding:"16px",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"24px",fontWeight:600,color:"#f87171",marginBottom:"4px"},children:c.blocked||0}),e.jsx("div",{style:{fontSize:"11px",color:"var(--text-tertiary)"},children:"Blocked"})]})]}),n&&e.jsxs("div",{style:{background:"var(--bg-secondary)",borderRadius:"8px",padding:"16px"},children:[e.jsx("div",{style:{fontSize:"13px",fontWeight:500,color:"var(--text-primary)",marginBottom:"12px"},children:"Pipeline Throughput"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:j?"1fr":"1fr 1fr 1fr",gap:"8px",fontSize:"11px",color:"var(--text-tertiary)"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)"},children:n.total_executed||0}),e.jsx("div",{children:"Processed"})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)"},children:n.success_rate!=null?`${(n.success_rate*100).toFixed(1)}%`:"0%"}),e.jsx("div",{children:"Success Rate"})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)"},children:n.avg_latency_ms?`${n.avg_latency_ms}ms`:"0ms"}),e.jsx("div",{children:"Avg Time"})]})]})]})]}):e.jsx("div",{style:{textAlign:"center",color:"var(--text-tertiary)",fontSize:"14px"},children:"Loading queue status..."})})]})]}),e.jsxs("div",{style:{background:"var(--bg-primary)",border:"1px solid var(--border-subtle)",borderRadius:"12px",overflow:"hidden"},children:[e.jsx("div",{style:{padding:"20px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-secondary)"},children:e.jsx("h3",{style:{fontSize:"16px",fontWeight:600,color:"var(--text-primary)",margin:0,display:"flex",alignItems:"center",gap:"8px"},children:"📜 Recent Execution History"})}),e.jsx("div",{style:{padding:"20px"},children:s.length===0?e.jsx("div",{style:{textAlign:"center",color:"var(--text-tertiary)",fontSize:"14px"},children:"No execution records found"}):e.jsx("div",{style:{display:"grid",gap:"8px"},children:s.slice(0,10).map(t=>e.jsxs("div",{style:{background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)",borderRadius:"8px",padding:"12px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"13px",fontWeight:500,color:"var(--text-primary)",marginBottom:"2px"},children:t.action}),e.jsxs("div",{style:{fontSize:"11px",color:"var(--text-tertiary)"},children:[t.agent_id," • ",new Date(t.created_at).toLocaleString()]})]})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"10px",fontWeight:600,padding:"2px 6px",borderRadius:"4px",border:"1px solid",fontFamily:"var(--font-mono)"},className:_(t.risk_tier),children:t.risk_tier}),e.jsx("span",{style:{fontSize:"11px",fontWeight:500,padding:"2px 8px",borderRadius:"12px",background:t.mode==="vienna_direct"?"rgba(124, 58, 237, 0.1)":"rgba(59, 130, 246, 0.1)",color:t.mode==="vienna_direct"?"#f59e0b":"#60a5fa"},children:W(t.mode)}),e.jsx("span",{style:{fontSize:"11px",fontWeight:500,padding:"2px 8px",borderRadius:"12px",color:I(t.status)},children:t.status})]})]},t.id))})})]})]})}export{O as ExecutionPage};
-//# sourceMappingURL=ExecutionPage-CdXjf9HJ.js.map
+//# sourceMappingURL=ExecutionPage-CzELhGv6.js.map
diff --git a/apps/console-proxy/public/assets/ExecutionsPage-B56L-9ov.js b/apps/console-proxy/public/assets/ExecutionsPage-VSi5gxch.js
similarity index 99%
rename from apps/console-proxy/public/assets/ExecutionsPage-B56L-9ov.js
rename to apps/console-proxy/public/assets/ExecutionsPage-VSi5gxch.js
index c704f082..a186b8d4 100644
--- a/apps/console-proxy/public/assets/ExecutionsPage-B56L-9ov.js
+++ b/apps/console-proxy/public/assets/ExecutionsPage-VSi5gxch.js
@@ -1,4 +1,4 @@
-import{j as e,r as f,b as A}from"./index-D_7YXFSJ.js";function K(t){if(!t)return"—";const r=typeof t=="string"?parseInt(t):t;return isNaN(r)?"—":r<1e3?`${r}ms`:r<6e4?`${(r/1e3).toFixed(1)}s`:`${(r/6e4).toFixed(1)}m`}const _=({value:t,label:r,color:n,icon:a,subtext:l})=>e.jsxs("div",{style:{background:"var(--bg-primary)",borderRadius:"10px",padding:"18px 20px",borderLeft:`3px solid ${n}`,flex:"1 1 0",minWidth:0,display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:"26px",fontWeight:700,color:n,fontFamily:"var(--font-mono)",lineHeight:1,marginBottom:"4px"},children:t}),e.jsx("div",{style:{fontSize:"11px",color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",fontWeight:500},children:r}),l&&e.jsx("div",{style:{fontSize:"9px",color:"var(--text-muted)",marginTop:"2px"},children:l})]}),e.jsx("div",{style:{fontSize:"28px",opacity:.5,flexShrink:0},children:a})]}),Y=({stats:t,loading:r=!1})=>{if(r)return e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"12px",marginBottom:"20px"},children:[...Array(6)].map((u,p)=>e.jsx("div",{style:{background:"var(--bg-primary)",borderRadius:"10px",padding:"18px 20px",height:"80px",animation:"pulse 2s infinite",opacity:.5}},p))});if(!t)return null;const n=Number(t.total_executions)||0,a=Number(t.executed)||0,l=Number(t.denied)||0,g=Number(t.pending)||0,c=Number(t.failed)||0,d=Number(t.executing)||0,i=t.avg_latency_ms||t.avg_duration_ms||0,x=n>0?Math.round((a+l+c)/n*100):0;return e.jsxs("div",{style:{marginBottom:"20px"},children:[e.jsx("style",{children:`
+import{j as e,r as f,g as A}from"./index-C0nK3ekl.js";function K(t){if(!t)return"—";const r=typeof t=="string"?parseInt(t):t;return isNaN(r)?"—":r<1e3?`${r}ms`:r<6e4?`${(r/1e3).toFixed(1)}s`:`${(r/6e4).toFixed(1)}m`}const _=({value:t,label:r,color:n,icon:a,subtext:l})=>e.jsxs("div",{style:{background:"var(--bg-primary)",borderRadius:"10px",padding:"18px 20px",borderLeft:`3px solid ${n}`,flex:"1 1 0",minWidth:0,display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:"26px",fontWeight:700,color:n,fontFamily:"var(--font-mono)",lineHeight:1,marginBottom:"4px"},children:t}),e.jsx("div",{style:{fontSize:"11px",color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",fontWeight:500},children:r}),l&&e.jsx("div",{style:{fontSize:"9px",color:"var(--text-muted)",marginTop:"2px"},children:l})]}),e.jsx("div",{style:{fontSize:"28px",opacity:.5,flexShrink:0},children:a})]}),Y=({stats:t,loading:r=!1})=>{if(r)return e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"12px",marginBottom:"20px"},children:[...Array(6)].map((u,p)=>e.jsx("div",{style:{background:"var(--bg-primary)",borderRadius:"10px",padding:"18px 20px",height:"80px",animation:"pulse 2s infinite",opacity:.5}},p))});if(!t)return null;const n=Number(t.total_executions)||0,a=Number(t.executed)||0,l=Number(t.denied)||0,g=Number(t.pending)||0,c=Number(t.failed)||0,d=Number(t.executing)||0,i=t.avg_latency_ms||t.avg_duration_ms||0,x=n>0?Math.round((a+l+c)/n*100):0;return e.jsxs("div",{style:{marginBottom:"20px"},children:[e.jsx("style",{children:`
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
@@ -11,4 +11,4 @@ import{j as e,r as f,b as A}from"./index-D_7YXFSJ.js";function K(t){if(!t)return
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes spin { to { transform: rotate(360deg); } }
`}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsxs("h1",{style:{fontSize:"22px",fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",margin:0,display:"flex",alignItems:"center",gap:"10px"},children:["Executions",L>0&&e.jsxs("span",{style:{padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600,background:"rgba(16,185,129,0.15)",color:"#10b981",animation:"pulse 2s infinite"},children:["+",L," new"]})]}),e.jsx("p",{style:{fontSize:"13px",color:"var(--text-tertiary)",marginTop:"4px"},children:"Managed execution pipeline — real-time lifecycle monitoring"})]}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("button",{onClick:()=>oe(y),disabled:y.length===0,style:{padding:"8px 14px",borderRadius:"6px",fontSize:"12px",fontWeight:500,background:y.length>0?"rgba(16,185,129,0.1)":"rgba(255,255,255,0.03)",color:y.length>0?"#10b981":"var(--text-tertiary)",border:`1px solid ${y.length>0?"rgba(16,185,129,0.2)":"var(--border-subtle)"}`,cursor:y.length>0?"pointer":"not-allowed",fontFamily:"var(--font-mono)",display:"flex",alignItems:"center",gap:"6px"},children:"📥 Export CSV"}),e.jsx("button",{onClick:()=>{g(!0),m()},style:{padding:"8px 14px",borderRadius:"6px",fontSize:"12px",fontWeight:500,background:"rgba(255,255,255,0.06)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",cursor:"pointer",fontFamily:"var(--font-mono)"},children:"↻ Refresh"})]})]}),e.jsx(Y,{stats:n,loading:l}),e.jsx(ne,{filters:c,onChange:d,onClear:()=>d(I),activeCount:j}),j>0&&e.jsxs("div",{style:{fontSize:"12px",color:"var(--text-tertiary)",marginBottom:"8px"},children:["Showing ",y.length," of ",t.length," executions"]}),e.jsx("div",{style:{background:"var(--bg-primary)",borderRadius:"12px",overflow:"hidden",border:"1px solid var(--border-subtle)"},children:l?e.jsxs("div",{style:{padding:"48px",textAlign:"center"},children:[e.jsx("div",{style:{display:"inline-block",width:"24px",height:"24px",border:"2px solid var(--border-subtle)",borderTop:"2px solid #f59e0b",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),e.jsx("p",{style:{marginTop:"12px",fontSize:"12px",color:"var(--text-tertiary)"},children:"Loading executions..."})]}):y.length===0?e.jsxs("div",{style:{padding:"60px 24px",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:j>0?"🔍":"🔄"}),e.jsx("h3",{style:{fontSize:"16px",fontWeight:600,color:"var(--text-primary)",margin:"0 0 8px"},children:j>0?"No matching executions":"No executions yet"}),e.jsx("p",{style:{fontSize:"13px",color:"var(--text-tertiary)",maxWidth:"400px",margin:"0 auto",lineHeight:1.6},children:j>0?"Try adjusting your filters or clearing them to see all executions.":"Executions appear here when intents are submitted through the governance pipeline."}),j>0&&e.jsx("button",{onClick:()=>d(I),style:{marginTop:"16px",padding:"8px 16px",fontSize:"12px",borderRadius:"6px",border:"none",background:"rgba(245,158,11,0.1)",color:"#f59e0b",cursor:"pointer",fontWeight:500},children:"Clear all filters"})]}):e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px",minWidth:"700px"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["Execution","State","Tier","Objective","Steps","Duration","Created"].map(o=>e.jsx("th",{style:{padding:"11px 14px",textAlign:"left",fontSize:"10px",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em"},children:o},o))})}),e.jsx("tbody",{children:y.map(o=>e.jsxs("tr",{onClick:()=>B(o.execution_id),style:{cursor:"pointer",background:i===o.execution_id?"rgba(245,158,11,0.05)":"transparent",borderBottom:"1px solid rgba(255,255,255,0.03)",transition:"background 100ms"},onMouseEnter:b=>{b.currentTarget.style.background="rgba(255,255,255,0.02)"},onMouseLeave:b=>{b.currentTarget.style.background=i===o.execution_id?"rgba(245,158,11,0.05)":"transparent"},children:[e.jsxs("td",{style:{padding:"11px 14px",fontFamily:"var(--font-mono)",fontSize:"11px",color:"var(--text-primary)",fontWeight:500},children:[o.execution_id.slice(0,16),"…"]}),e.jsx("td",{style:{padding:"11px 14px"},children:e.jsx(re,{state:o.state,tier:o.risk_tier})}),e.jsx("td",{style:{padding:"11px 14px"},children:e.jsx(X,{tier:o.risk_tier})}),e.jsx("td",{style:{padding:"11px 14px",maxWidth:"260px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-secondary)"},children:o.objective}),e.jsx("td",{style:{padding:"11px 14px",fontFamily:"var(--font-mono)",fontSize:"11px",color:"var(--text-tertiary)"},children:o.step_count}),e.jsx("td",{style:{padding:"11px 14px",fontFamily:"var(--font-mono)",fontSize:"11px",color:"var(--text-tertiary)"},children:ie(o.duration_ms)}),e.jsx("td",{style:{padding:"11px 14px",fontFamily:"var(--font-mono)",fontSize:"11px",color:"var(--text-tertiary)"},children:se(o.created_at)})]},o.execution_id))})]})})}),q&&e.jsx(ae,{detail:u,loading:k,onClose:G})]})}function pe({timeline:t}){return t.length?e.jsxs("div",{style:{position:"relative",paddingLeft:"20px"},children:[e.jsx("div",{style:{position:"absolute",left:"7px",top:"8px",bottom:"8px",width:"2px",background:"rgba(245,158,11,0.15)"}}),t.map((r,n)=>{var a;return e.jsxs("div",{style:{position:"relative",paddingBottom:"14px",paddingLeft:"16px"},children:[e.jsx("div",{style:{position:"absolute",left:"-16px",top:"6px",width:"10px",height:"10px",borderRadius:"50%",background:((a=z[r.state])==null?void 0:a.dot)||"#94a3b8",border:"2px solid rgba(0,0,0,0.3)"}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"2px"},children:[e.jsx(E,{state:r.state}),e.jsx("span",{style:{fontSize:"12px",color:"var(--text-secondary)"},children:r.detail})]}),e.jsxs("div",{style:{fontSize:"10px",color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:[new Date(r.timestamp).toLocaleString(),r.actor&&e.jsxs(e.Fragment,{children:[" · ",r.actor]})]})]},n)})]}):e.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"12px"},children:"No timeline entries"})}function ce({steps:t}){return t.length?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:t.map((r,n)=>{var l;const a=r.status==="complete";return e.jsxs("div",{style:{background:a?"rgba(16,185,129,0.04)":"rgba(239,68,68,0.04)",border:`1px solid ${a?"rgba(16,185,129,0.12)":"rgba(239,68,68,0.12)"}`,borderRadius:"8px",padding:"12px 14px"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[e.jsxs("span",{style:{fontSize:"11px",fontWeight:700,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",width:"20px"},children:["#",r.step_index]}),e.jsx("span",{style:{fontSize:"13px",fontWeight:600,color:"var(--text-primary)"},children:r.step_name}),e.jsx(E,{state:r.status})]}),e.jsxs("div",{style:{display:"flex",gap:"14px",fontSize:"11px",fontFamily:"var(--font-mono)",color:"var(--text-tertiary)"},children:[r.adapter_id&&e.jsx("span",{title:r.adapter_id,children:"🔌 adapter"}),e.jsxs("span",{children:["⏱ ",r.latency_ms,"ms"]}),((l=r.result)==null?void 0:l.status_code)&&e.jsxs("span",{children:["HTTP ",r.result.status_code]})]})]}),r.error&&e.jsxs("div",{style:{marginTop:"6px",fontSize:"11px",color:"#ef4444",fontFamily:"var(--font-mono)",padding:"4px 0 0 30px"},children:["⚠ ",r.error]})]},n)})}):e.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"12px"},children:"No steps recorded"})}function xe({events:t}){return t.length?e.jsxs("div",{style:{background:"rgba(0,0,0,0.1)",borderRadius:"8px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px 1fr 80px 120px",gap:"0",fontSize:"10px",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em",padding:"8px 12px",borderBottom:"1px solid rgba(255,255,255,0.06)"},children:[e.jsx("span",{children:"#"}),e.jsx("span",{children:"Event"}),e.jsx("span",{children:"Stage"}),e.jsx("span",{children:"Time"})]}),t.map((r,n)=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px 1fr 80px 120px",gap:"0",padding:"6px 12px",borderBottom:"1px solid rgba(255,255,255,0.03)",fontSize:"11px",fontFamily:"var(--font-mono)"},children:[e.jsx("span",{style:{color:"var(--text-tertiary)"},children:r.sequence_num}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:r.event_type}),e.jsx("span",{style:{color:"var(--text-tertiary)"},children:r.stage}),e.jsx("span",{style:{color:"var(--text-tertiary)"},children:new Date(r.event_timestamp||r.created_at).toLocaleTimeString()})]},n))]}):e.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"12px"},children:"No ledger events"})}function ge({result:t}){if(!t)return e.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"12px"},children:"No result data"});let r=t;if(typeof t=="string")try{r=JSON.parse(t)}catch{}return e.jsx("pre",{style:{background:"rgba(0,0,0,0.15)",borderRadius:"8px",padding:"14px",fontSize:"11px",fontFamily:"var(--font-mono)",color:"var(--text-secondary)",overflow:"auto",maxHeight:"500px",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0,lineHeight:1.6},children:JSON.stringify(r,null,2)})}export{be as ExecutionsPage};
-//# sourceMappingURL=ExecutionsPage-B56L-9ov.js.map
+//# sourceMappingURL=ExecutionsPage-VSi5gxch.js.map
diff --git a/apps/console-proxy/public/assets/FleetDashboardPage-Cd5radQs.js b/apps/console-proxy/public/assets/FleetDashboardPage-nC3mT2F1.js
similarity index 99%
rename from apps/console-proxy/public/assets/FleetDashboardPage-Cd5radQs.js
rename to apps/console-proxy/public/assets/FleetDashboardPage-nC3mT2F1.js
index 3ad75b5c..501f6265 100644
--- a/apps/console-proxy/public/assets/FleetDashboardPage-Cd5radQs.js
+++ b/apps/console-proxy/public/assets/FleetDashboardPage-nC3mT2F1.js
@@ -1,2 +1,2 @@
-import{j as e,r as g,R as oe}from"./index-D_7YXFSJ.js";import{f as T}from"./fleet-Bmy_93a8.js";const se={T0:"#10b981",T1:"#10b981",T2:"#fbbf24",T3:"#ef4444"},ie={T0:"AUTO_APPROVE",T1:"POLICY_GATE",T2:"HUMAN_GATE",T3:"STRICT_HALT"},d={card:"var(--bg-primary)",cardHover:"var(--bg-secondary)",border:"var(--border-subtle)",borderActive:"var(--border-default)",borderStrong:"var(--border-strong)",green:"var(--success-text)",yellow:"var(--warning-text)",red:"var(--error-text)",textPrimary:"var(--text-primary)",textSecondary:"var(--text-secondary)",textMuted:"var(--text-tertiary)"},le={active:d.green,idle:d.yellow,suspended:d.red,terminated:d.textMuted},de={"Active Warrant":d.green,"No Warrant":d.textMuted,Expired:d.red},P={fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', monospace"};function ae(n){if(!n)return"never";const o=Date.now()-new Date(n).getTime();if(o<0)return"just now";const s=Math.floor(o/1e3);if(s<60)return`${s}s ago`;const l=Math.floor(s/60);if(l<60)return`${l}m ago`;const a=Math.floor(l/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function ce(n,o=3e5){return n?Date.now()-new Date(n).getTime()>o:!0}function xe(n){return n>70?d.green:n>=40?d.yellow:d.red}function ue({status:n}){const o=le[n]||d.textMuted,s=n==="active";return e.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:o,boxShadow:s?`0 0 6px ${o}`:"none",animation:s?"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite":"none"}})}function G({text:n,color:o,small:s}){return e.jsx("span",{style:{...P,fontSize:s?9:10,fontWeight:600,color:o,background:`${o}18`,border:`1px solid ${o}33`,borderRadius:3,padding:s?"1px 4px":"2px 6px",textTransform:"uppercase",letterSpacing:"0.04em",whiteSpace:"nowrap"},children:n})}function pe({score:n}){const o=xe(n);return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,width:"100%"},children:[e.jsx("div",{style:{flex:1,height:6,background:"rgba(255,255,255,0.08)",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${n}%`,height:"100%",background:o,borderRadius:3,transition:"width 300ms ease"}})}),e.jsx("span",{style:{...P,fontSize:11,color:o,fontWeight:600,minWidth:24,textAlign:"right"},children:n})]})}function ge({agent:n,riskTier:o,warrantStatus:s,onClick:l,onAdjustTrust:a,onSuspend:p,onActivate:i}){const h=ce(n.last_heartbeat),v=se[o],C=ie[o];return e.jsxs("div",{onClick:l,style:{background:d.card,border:`1px solid ${d.border}`,borderLeft:`4px solid ${v}`,borderRadius:6,padding:16,cursor:l?"pointer":"default",transition:"all 200ms ease",display:"flex",flexDirection:"column",gap:12,height:"100%"},onMouseEnter:c=>{l&&(c.currentTarget.style.background=d.cardHover,c.currentTarget.style.borderColor=d.borderActive,c.currentTarget.style.boxShadow="0 8px 24px rgba(0,0,0,0.3)")},onMouseLeave:c=>{c.currentTarget.style.background=d.card,c.currentTarget.style.borderColor=d.border,c.currentTarget.style.boxShadow="none"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[e.jsx(ue,{status:n.status}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:15,fontWeight:700,color:d.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.display_name}),e.jsx("div",{style:{...P,fontSize:10,color:d.textMuted,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.agent_id})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,alignItems:"flex-end"},children:[e.jsx(G,{text:o,color:v,small:!0}),e.jsx("span",{style:{...P,fontSize:9,color:d.textMuted,textTransform:"uppercase",letterSpacing:"0.03em"},children:C})]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:d.textMuted,textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:6},children:"Trust Score"}),e.jsx(pe,{score:n.trust_score})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("div",{style:{fontSize:10,color:d.textMuted,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Last Activity"}),e.jsx("span",{style:{...P,fontSize:11,color:h?d.red:d.textSecondary},children:ae(n.last_heartbeat)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("div",{style:{fontSize:10,color:d.textMuted,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Warrant"}),e.jsx(G,{text:s,color:de[s]||d.textMuted})]}),e.jsxs("div",{style:{display:"flex",gap:6,marginTop:4},children:[n.status==="suspended"?e.jsx("button",{onClick:c=>{c.stopPropagation(),i==null||i()},style:{flex:1,padding:"6px 10px",fontSize:11,fontWeight:600,border:`1px solid ${d.green}33`,background:"rgba(16,185,129,0.1)",color:d.green,borderRadius:4,cursor:"pointer",transition:"all 150ms ease"},onMouseEnter:c=>{c.currentTarget.style.borderColor=`${d.green}66`,c.currentTarget.style.background="rgba(16,185,129,0.15)"},onMouseLeave:c=>{c.currentTarget.style.borderColor=`${d.green}33`,c.currentTarget.style.background="rgba(16,185,129,0.1)"},children:"⚡ Activate"}):e.jsx("button",{onClick:c=>{c.stopPropagation(),p==null||p()},style:{flex:1,padding:"6px 10px",fontSize:11,fontWeight:600,border:`1px solid ${d.red}33`,background:"rgba(239,68,68,0.1)",color:d.red,borderRadius:4,cursor:"pointer",transition:"all 150ms ease"},onMouseEnter:c=>{c.currentTarget.style.borderColor=`${d.red}66`,c.currentTarget.style.background="rgba(239,68,68,0.15)"},onMouseLeave:c=>{c.currentTarget.style.borderColor=`${d.red}33`,c.currentTarget.style.background="rgba(239,68,68,0.1)"},children:"⏸ Suspend"}),e.jsx("button",{onClick:c=>{c.stopPropagation(),a==null||a()},style:{flex:1,padding:"6px 10px",fontSize:11,fontWeight:600,border:`1px solid ${d.borderStrong}`,background:"transparent",color:d.textSecondary,borderRadius:4,cursor:"pointer",transition:"all 150ms ease"},onMouseEnter:c=>{c.currentTarget.style.borderColor=d.borderActive,c.currentTarget.style.color=d.textPrimary},onMouseLeave:c=>{c.currentTarget.style.borderColor=d.borderStrong,c.currentTarget.style.color=d.textSecondary},children:"🎚 Adjust"})]})]})}const u={card:"var(--bg-primary)",border:"var(--border-subtle)",green:"var(--success-text)",yellow:"var(--warning-text)",red:"var(--error-text)",blue:"var(--info-text)",textPrimary:"var(--text-primary)",textSecondary:"var(--text-secondary)",textMuted:"var(--text-tertiary)"},E={fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', monospace"};function W({label:n,value:o,unit:s,color:l,secondaryValue:a,children:p}){return e.jsxs("div",{style:{background:u.card,border:`1px solid ${u.border}`,borderRadius:6,padding:"12px 16px",flex:"1 1 0",minWidth:140},children:[e.jsx("div",{style:{fontSize:10,color:u.textMuted,textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:8},children:n}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:4,marginBottom:4},children:[e.jsx("div",{style:{...E,fontSize:24,fontWeight:700,color:l||u.textPrimary,lineHeight:1},children:o}),s&&e.jsx("span",{style:{...E,fontSize:11,color:u.textSecondary,fontWeight:500},children:s})]}),a&&e.jsxs("div",{style:{...E,fontSize:10,color:u.textMuted,display:"flex",justifyContent:"space-between"},children:[e.jsx("span",{children:a.label}),e.jsx("span",{children:a.value})]}),p]})}function ye({activeCount:n,idleCount:o,suspendedCount:s}){const l=n+o+s;if(l===0)return null;const a=n/l*100,p=o/l*100,i=s/l*100;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[e.jsxs("div",{style:{display:"flex",height:4,borderRadius:2,overflow:"hidden",flex:1,background:"rgba(255,255,255,0.08)"},children:[a>0&&e.jsx("div",{style:{width:`${a}%`,background:u.green}}),p>0&&e.jsx("div",{style:{width:`${p}%`,background:u.yellow}}),i>0&&e.jsx("div",{style:{width:`${i}%`,background:u.red}})]}),e.jsxs("div",{style:{display:"flex",gap:8,fontSize:9,color:u.textMuted,whiteSpace:"nowrap"},children:[e.jsxs("span",{style:{color:u.green},children:["●",n]}),e.jsxs("span",{style:{color:u.yellow},children:["●",o]}),e.jsxs("span",{style:{color:u.red},children:["●",s]})]})]})}function he({totalAgents:n,activeAgents:o,idleAgents:s,suspendedAgents:l,avgTrustScore:a,t0Count:p,t1Count:i,t2Count:h,t3Count:v,pendingApprovals:C,actionsToday:c,avgLatencyMs:M,unresolvedAlerts:m}){const k=a>70?u.green:a>=40?u.yellow:u.red;return e.jsxs("div",{style:{display:"flex",gap:10,marginBottom:16,flexWrap:"wrap"},children:[e.jsx(W,{label:"Total Agents",value:n,color:u.textPrimary,secondaryValue:{label:"Registered",value:n},children:e.jsx(ye,{activeCount:o,idleCount:s,suspendedCount:l})}),e.jsx(W,{label:"Avg Trust Score",value:Math.round(a),unit:"%",color:k,secondaryValue:{label:"Fleet health",value:k===u.green?"✓ Good":k===u.yellow?"⚠ Fair":"✗ Low"}}),e.jsx(W,{label:"Actions Today",value:c,color:u.blue,secondaryValue:{label:"Real-time",value:"flowing"}}),e.jsx(W,{label:"Avg Latency",value:M,unit:"ms",color:M>1e3?u.yellow:u.green,secondaryValue:{label:"Status",value:M>1e3?"⚠ Slow":"✓ Fast"}}),e.jsx(W,{label:"Unresolved Alerts",value:m,color:m>0?u.yellow:u.green,secondaryValue:{label:"Status",value:m>0?`${m} pending`:"All clear"}}),C>0&&e.jsx(W,{label:"⚡ Pending Approvals",value:C,color:u.yellow,secondaryValue:{label:"Status",value:"Awaiting"}})]})}const t={card:"var(--bg-primary)",cardHover:"var(--bg-secondary)",border:"var(--border-subtle)",borderActive:"var(--border-default)",green:"var(--success-text)",yellow:"var(--warning-text)",red:"var(--error-text)",blue:"var(--info-text)",amber:"var(--accent-primary)",cyan:"#06b6d4",textPrimary:"var(--text-primary)",textSecondary:"var(--text-secondary)",textMuted:"var(--text-tertiary)"},fe={active:t.green,idle:t.yellow,suspended:t.red,terminated:t.textMuted},I={info:t.blue,warning:t.yellow,critical:t.red},be={executed:t.green,approved:t.green,denied:t.yellow,failed:t.red,timeout:t.textMuted},me={autonomous:t.amber,"semi-autonomous":t.blue,supervised:t.cyan},x={fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', monospace"},ve=15e3;function H(n){if(!n)return"never";const o=Date.now()-new Date(n).getTime();if(o<0)return"just now";const s=Math.floor(o/1e3);if(s<60)return`${s}s ago`;const l=Math.floor(s/60);if(l<60)return`${l}m ago`;const a=Math.floor(l/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function je(n,o=3e5){return n?Date.now()-new Date(n).getTime()>o:!0}function F(n){return n>70?t.green:n>=40?t.yellow:t.red}function B(n){return n>85?"T0":n>65?"T1":n>40?"T2":"T3"}function Se(n){if(n.warrant_status){if(n.warrant_status==="active")return"Active Warrant";if(n.warrant_status==="expired")return"Expired"}return"No Warrant"}function we({score:n}){const o=F(n);return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("div",{style:{width:60,height:6,background:"rgba(255,255,255,0.08)",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${n}%`,height:"100%",background:o,borderRadius:3,transition:"width 300ms ease"}})}),e.jsx("span",{style:{...x,fontSize:11,color:o,fontWeight:600},children:n})]})}function Te({status:n}){const o=fe[n]||t.textMuted;return e.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:o,boxShadow:n==="active"?`0 0 6px ${o}`:"none"}})}function O({text:n,color:o}){return e.jsx("span",{style:{...x,fontSize:10,fontWeight:600,color:o,background:`${o}18`,border:`1px solid ${o}33`,borderRadius:3,padding:"1px 6px",textTransform:"uppercase",letterSpacing:"0.04em"},children:n})}function ke({detail:n}){const{metrics:o,recentActivity:s,alerts:l}=n,a=Object.entries(o.actionsByType).sort((i,h)=>h[1]-i[1]).slice(0,5),p=a.length>0?a[0][1]:1;return e.jsx("tr",{children:e.jsx("td",{colSpan:11,style:{padding:0,border:"none"},children:e.jsxs("div",{style:{background:"#161f2e",borderTop:`1px solid ${t.border}`,borderBottom:`1px solid ${t.border}`,padding:"16px 20px",display:"grid",gridTemplateColumns:"1fr 1fr 1.5fr",gap:20},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:t.textMuted,textTransform:"uppercase",marginBottom:8,letterSpacing:"0.05em"},children:"Metrics"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"6px 16px"},children:[["Actions/Day",o.actionsToday],["Actions/Week",o.actionsThisWeek],["Avg Latency",`${o.avgLatencyMs}ms`],["Approval %",`${o.approvalRate}%`],["Error %",`${o.errorRate}%`],["Denied %",`${o.deniedRate}%`]].map(([i,h])=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontSize:11,color:t.textMuted},children:i}),e.jsx("span",{style:{...x,fontSize:11,color:t.textPrimary},children:h})]},i))}),e.jsxs("div",{style:{marginTop:12},children:[e.jsx("div",{style:{fontSize:11,color:t.textMuted,textTransform:"uppercase",marginBottom:6,letterSpacing:"0.05em"},children:"Top Actions"}),a.map(([i,h])=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:3},children:[e.jsx("span",{style:{...x,fontSize:10,color:t.textSecondary,width:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),e.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.06)",borderRadius:2},children:e.jsx("div",{style:{width:`${h/p*100}%`,height:"100%",background:t.blue,borderRadius:2}})}),e.jsx("span",{style:{...x,fontSize:10,color:t.textMuted,width:24,textAlign:"right"},children:h})]},i))]})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:11,color:t.textMuted,textTransform:"uppercase",marginBottom:8,letterSpacing:"0.05em"},children:["Active Alerts (",l.length,")"]}),l.length===0?e.jsx("div",{style:{fontSize:12,color:t.textMuted},children:"No active alerts"}):l.slice(0,4).map(i=>e.jsxs("div",{style:{background:t.card,border:`1px solid ${I[i.severity]}33`,borderLeft:`3px solid ${I[i.severity]}`,borderRadius:4,padding:"6px 10px",marginBottom:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[e.jsx(O,{text:i.severity,color:I[i.severity]}),e.jsx("span",{style:{...x,fontSize:10,color:t.textMuted},children:i.alert_type})]}),e.jsx("div",{style:{fontSize:11,color:t.textSecondary,lineHeight:1.3},children:i.message})]},i.id))]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:t.textMuted,textTransform:"uppercase",marginBottom:8,letterSpacing:"0.05em"},children:"Recent Activity"}),e.jsx("div",{style:{maxHeight:200,overflowY:"auto"},children:s.map(i=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 0",borderBottom:`1px solid ${t.border}`},children:[e.jsx(O,{text:i.result,color:be[i.result]||t.textMuted}),e.jsx("span",{style:{...x,fontSize:11,color:t.textPrimary,flex:1},children:i.action_type}),i.risk_tier&&e.jsx(O,{text:i.risk_tier,color:t.textSecondary}),e.jsxs("span",{style:{...x,fontSize:10,color:t.textMuted},children:[i.latency_ms,"ms"]}),e.jsx("span",{style:{...x,fontSize:10,color:t.textMuted,width:55,textAlign:"right"},children:H(i.created_at)})]},i.id))})]})]})})})}function Ce({agent:n,onSuspend:o,onActivate:s,onAdjustTrust:l}){const[a,p]=g.useState(!1);return e.jsxs("div",{style:{position:"relative"},children:[e.jsx("button",{onClick:i=>{i.stopPropagation(),p(!a)},style:{background:"none",border:`1px solid ${t.border}`,borderRadius:4,color:t.textSecondary,cursor:"pointer",padding:"2px 6px",fontSize:14,lineHeight:1},children:"⋯"}),a&&e.jsxs("div",{onClick:i=>i.stopPropagation(),style:{position:"absolute",right:0,top:"100%",marginTop:4,background:t.card,border:`1px solid ${t.borderActive}`,borderRadius:6,padding:4,zIndex:100,minWidth:140,boxShadow:"0 8px 24px rgba(0,0,0,0.4)"},children:[n.status==="suspended"?e.jsx(D,{label:"⚡ Activate",onClick:()=>{s(n.agent_id),p(!1)}}):e.jsx(D,{label:"⏸ Suspend",onClick:()=>{o(n.agent_id),p(!1)},color:t.red}),e.jsx(D,{label:"🎚 Adjust Trust",onClick:()=>{l(n.agent_id),p(!1)}})]})]})}function D({label:n,onClick:o,color:s}){return e.jsx("button",{onClick:o,style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",color:s||t.textSecondary,fontSize:12,padding:"6px 10px",borderRadius:4,cursor:"pointer"},onMouseEnter:l=>{l.currentTarget.style.background="rgba(255,255,255,0.06)"},onMouseLeave:l=>{l.currentTarget.style.background="none"},children:n})}function J({alerts:n,onResolve:o}){return e.jsxs("div",{style:{background:t.card,border:`1px solid ${t.border}`,borderRadius:6,padding:16,maxHeight:360,overflowY:"auto"},children:[e.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:e.jsxs("div",{style:{fontSize:13,fontWeight:600,color:t.textPrimary,textTransform:"uppercase",letterSpacing:"0.05em"},children:["🚨 Alerts (",n.length,")"]})}),n.length===0?e.jsx("div",{style:{fontSize:12,color:t.textMuted,textAlign:"center",padding:20},children:"All clear — no active alerts"}):n.map(s=>e.jsxs("div",{style:{borderLeft:`3px solid ${I[s.severity]}`,background:`${I[s.severity]}08`,borderRadius:4,padding:"8px 12px",marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(O,{text:s.severity,color:I[s.severity]}),e.jsx("span",{style:{...x,fontSize:11,color:t.textPrimary,fontWeight:600},children:s.agent_name||s.agent_id}),e.jsx("span",{style:{...x,fontSize:10,color:t.textMuted},children:s.alert_type})]}),e.jsx("button",{onClick:()=>o(s.id),style:{background:"none",border:`1px solid ${t.border}`,borderRadius:3,color:t.textMuted,fontSize:10,padding:"2px 8px",cursor:"pointer"},onMouseEnter:l=>{l.currentTarget.style.borderColor=t.green,l.currentTarget.style.color=t.green},onMouseLeave:l=>{l.currentTarget.style.borderColor=t.border,l.currentTarget.style.color=t.textMuted},children:"Resolve"})]}),e.jsx("div",{style:{fontSize:11,color:t.textSecondary,lineHeight:1.4},children:s.message}),e.jsx("div",{style:{...x,fontSize:10,color:t.textMuted,marginTop:4},children:H(s.created_at)})]},s.id))]})}function Me({agentId:n,currentScore:o,onSubmit:s,onClose:l}){const[a,p]=g.useState(o);return e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:l,children:e.jsxs("div",{style:{background:t.card,border:`1px solid ${t.borderActive}`,borderRadius:8,padding:24,width:320,boxShadow:"0 16px 48px rgba(0,0,0,0.5)"},onClick:i=>i.stopPropagation(),children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:t.textPrimary,marginBottom:4},children:"Adjust Trust Score"}),e.jsx("div",{style:{...x,fontSize:12,color:t.textMuted,marginBottom:16},children:n}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:16},children:[e.jsx("input",{type:"range",min:0,max:100,value:a,onChange:i=>p(parseInt(i.target.value)),style:{flex:1,accentColor:F(a)}}),e.jsx("span",{style:{...x,fontSize:18,fontWeight:700,color:F(a),width:36,textAlign:"right"},children:a})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:l,style:{background:"none",border:`1px solid ${t.border}`,borderRadius:4,color:t.textSecondary,fontSize:12,padding:"6px 14px",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{onClick:()=>s(a),style:{background:t.blue,border:"none",borderRadius:4,color:"#fff",fontSize:12,fontWeight:600,padding:"6px 14px",cursor:"pointer"},children:"Apply"})]})]})})}function Re(){const[n,o]=g.useState(null),[s,l]=g.useState([]),[a,p]=g.useState(!0),[i,h]=g.useState(null),[v,C]=g.useState(null),[c,M]=g.useState(null),[m,k]=g.useState(null),[K,Q]=g.useState(new Date),[L,X]=g.useState(""),[R,q]=g.useState("all"),[j,_]=g.useState(new Set),[A,N]=g.useState("cards"),f=g.useCallback(async()=>{try{const[r,y]=await Promise.all([T.getOverview(),T.getAlerts()]);o(r),l(y),h(null),Q(new Date)}catch(r){h(r instanceof Error?r.message:"Failed to load fleet data")}finally{p(!1)}},[]);g.useEffect(()=>{f();const r=setInterval(f,ve);return()=>clearInterval(r)},[f]),g.useEffect(()=>{if(!v){M(null);return}T.getAgent(v).then(M).catch(()=>M(null))},[v]);const V=async r=>{await T.suspend(r),f()},U=async r=>{await T.activate(r),f()},Z=async r=>{m&&(await T.adjustTrust(m.agentId,r),k(null),f())},Y=async r=>{await T.resolveAlert(r),f()};if(a)return e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:400,color:t.textMuted},children:e.jsx("div",{style:{...x,fontSize:14},children:"Loading fleet data..."})});if(i||!n)return e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:400},children:e.jsxs("div",{style:{textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:14,color:t.red,marginBottom:8},children:["⚠ ",i||"No data"]}),e.jsx("button",{onClick:f,style:{background:t.card,border:`1px solid ${t.border}`,borderRadius:4,color:t.textSecondary,padding:"6px 14px",fontSize:12,cursor:"pointer"},children:"Retry"})]})});const{agents:b,summary:S}=n,w=b.filter(r=>!(L&&!r.display_name.toLowerCase().includes(L.toLowerCase())&&!r.agent_id.toLowerCase().includes(L.toLowerCase())||R!=="all"&&r.status!==R)),ee=r=>{_(y=>{const $=new Set(y);return $.has(r)?$.delete(r):$.add(r),$})},te=()=>{j.size===w.length?_(new Set):_(new Set(w.map(r=>r.agent_id)))},re=async()=>{if(confirm(`Suspend ${j.size} agents?`)){for(const r of j)await T.suspend(r);_(new Set),f()}},ne=async()=>{if(confirm(`Activate ${j.size} agents?`)){for(const r of j)await T.activate(r);_(new Set),f()}};return S.trendData.map(r=>r.count),e.jsxs("div",{style:{maxWidth:1400,margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:18,fontWeight:700,color:t.textPrimary,margin:0,letterSpacing:"-0.01em"},children:"Agent Fleet"}),e.jsxs("div",{style:{...x,fontSize:11,color:t.textMuted,marginTop:2},children:["Governance Dashboard — ",S.totalAgents," agents registered"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("div",{style:{display:"flex",gap:2,background:"rgba(255,255,255,0.03)",borderRadius:4,padding:2},children:[e.jsx("button",{onClick:()=>N("cards"),style:{padding:"4px 10px",fontSize:11,borderRadius:3,border:"none",cursor:"pointer",fontWeight:A==="cards"?600:400,background:A==="cards"?"rgba(255,255,255,0.08)":"transparent",color:A==="cards"?t.textPrimary:t.textMuted},children:"⊞ Cards"}),e.jsx("button",{onClick:()=>N("table"),style:{padding:"4px 10px",fontSize:11,borderRadius:3,border:"none",cursor:"pointer",fontWeight:A==="table"?600:400,background:A==="table"?"rgba(255,255,255,0.08)":"transparent",color:A==="table"?t.textPrimary:t.textMuted},children:"▦ Table"})]}),e.jsxs("div",{style:{...x,fontSize:10,color:t.textMuted},children:["Updated ",K.toLocaleTimeString()]}),e.jsx("button",{onClick:f,style:{background:"none",border:`1px solid ${t.border}`,borderRadius:4,color:t.textSecondary,padding:"4px 10px",fontSize:11,cursor:"pointer"},onMouseEnter:r=>{r.currentTarget.style.borderColor=t.blue},onMouseLeave:r=>{r.currentTarget.style.borderColor=t.border},children:"↻ Refresh"})]})]}),e.jsx(he,{totalAgents:S.totalAgents,activeAgents:S.activeAgents,idleAgents:b.filter(r=>r.status==="idle").length,suspendedAgents:b.filter(r=>r.status==="suspended").length,avgTrustScore:b.length>0?b.reduce((r,y)=>r+y.trust_score,0)/b.length:0,t0Count:b.filter(r=>B(r.trust_score)==="T0").length,t1Count:b.filter(r=>B(r.trust_score)==="T1").length,t2Count:b.filter(r=>B(r.trust_score)==="T2").length,t3Count:b.filter(r=>B(r.trust_score)==="T3").length,pendingApprovals:0,actionsToday:S.actionsToday,avgLatencyMs:S.avgLatencyMs,unresolvedAlerts:S.unresolvedAlerts}),e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:12,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("input",{type:"text",placeholder:"Search agents...",value:L,onChange:r=>X(r.target.value),style:{padding:"6px 12px",fontSize:12,borderRadius:4,border:`1px solid ${t.border}`,background:"rgba(255,255,255,0.04)",color:t.textPrimary,width:200,fontFamily:"inherit",outline:"none"}}),e.jsx("div",{style:{display:"flex",gap:2,background:"rgba(255,255,255,0.03)",borderRadius:4,padding:2},children:[{key:"all",label:"All"},{key:"active",label:"🟢 Active"},{key:"idle",label:"🟡 Idle"},{key:"suspended",label:"🔴 Suspended"}].map(r=>e.jsx("button",{onClick:()=>q(r.key),style:{padding:"4px 10px",fontSize:11,borderRadius:3,border:"none",cursor:"pointer",fontWeight:R===r.key?600:400,background:R===r.key?"rgba(255,255,255,0.08)":"transparent",color:R===r.key?t.textPrimary:t.textMuted},children:r.label},r.key))}),(L||R!=="all")&&e.jsxs("span",{style:{...x,fontSize:10,color:t.textMuted},children:[w.length," of ",b.length]})]}),j.size>0&&e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:12,padding:"8px 12px",background:"rgba(59,130,246,0.08)",borderRadius:6,border:"1px solid rgba(59,130,246,0.15)"},children:[e.jsxs("span",{style:{fontSize:12,color:t.blue,fontWeight:600},children:[j.size," selected"]}),e.jsx("button",{onClick:ne,style:{padding:"4px 10px",fontSize:11,borderRadius:4,border:"1px solid rgba(16,185,129,0.3)",background:"rgba(16,185,129,0.1)",color:t.green,cursor:"pointer",fontWeight:500},children:"⚡ Activate All"}),e.jsx("button",{onClick:re,style:{padding:"4px 10px",fontSize:11,borderRadius:4,border:"1px solid rgba(239,68,68,0.3)",background:"rgba(239,68,68,0.1)",color:t.red,cursor:"pointer",fontWeight:500},children:"⏸ Suspend All"}),e.jsx("button",{onClick:()=>_(new Set),style:{padding:"4px 10px",fontSize:11,borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.textMuted,cursor:"pointer"},children:"Clear"})]}),A==="cards"?e.jsxs("div",{style:{display:"grid",gridTemplateColumns:window.innerWidth>768?"1fr 340px":"1fr",gap:16},children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:16},children:w.length===0?e.jsxs("div",{style:{gridColumn:"1 / -1",display:"flex",alignItems:"center",justifyContent:"center",minHeight:300,color:t.textMuted,flexDirection:"column",gap:12},children:[e.jsx("div",{style:{fontSize:16},children:"📭"}),e.jsx("div",{style:{fontSize:14,fontWeight:600},children:"No agents registered yet"}),e.jsx("div",{style:{fontSize:11,color:t.textMuted},children:'Connect your first agent to get started. Click "Connect Agent" in settings.'})]}):w.map(r=>e.jsx(ge,{agent:r,riskTier:B(r.trust_score),warrantStatus:Se(r),onClick:()=>C(r.agent_id===v?null:r.agent_id),onAdjustTrust:()=>k({agentId:r.agent_id,score:r.trust_score}),onSuspend:()=>V(r.agent_id),onActivate:()=>U(r.agent_id)},r.agent_id))}),e.jsx(J,{alerts:s,onResolve:Y})]}):e.jsxs("div",{style:{display:"grid",gridTemplateColumns:window.innerWidth>768?"1fr 340px":"1fr",gap:16},children:[e.jsx("div",{style:{background:t.card,border:`1px solid ${t.border}`,borderRadius:6,overflow:"hidden"},children:e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:`1px solid ${t.border}`},children:[e.jsx("th",{style:{padding:"10px 10px",width:28},children:e.jsx("input",{type:"checkbox",checked:w.length>0&&j.size===w.length,onChange:te,style:{cursor:"pointer",accentColor:t.blue}})}),["","Agent","Type","Trust","Actions","Latency","Errors","Alerts","Last Seen",""].map((r,y)=>e.jsx("th",{style:{textAlign:"left",padding:"10px 10px",fontSize:10,fontWeight:600,color:t.textMuted,textTransform:"uppercase",letterSpacing:"0.06em",whiteSpace:"nowrap",...y===0?{width:24}:{}},children:r},y))]})}),e.jsx("tbody",{children:w.length===0?e.jsx("tr",{children:e.jsxs("td",{colSpan:11,style:{padding:"40px 20px",textAlign:"center",color:t.textMuted},children:[e.jsx("div",{style:{fontSize:14,marginBottom:8},children:"No agents registered"}),e.jsx("div",{style:{fontSize:11,color:t.textMuted},children:"Agents will appear here once they connect to Vienna OS"})]})}):w.map(r=>{const y=v===r.agent_id,$=je(r.last_heartbeat);return e.jsxs(oe.Fragment,{children:[e.jsxs("tr",{onClick:()=>C(y?null:r.agent_id),style:{borderBottom:`1px solid ${t.border}`,cursor:"pointer",background:y?"#161f2e":"transparent",transition:"background 150ms"},onMouseEnter:z=>{y||(z.currentTarget.style.background=t.cardHover)},onMouseLeave:z=>{y||(z.currentTarget.style.background="transparent")},children:[e.jsx("td",{style:{padding:"8px 10px",textAlign:"center"},onClick:z=>z.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:j.has(r.agent_id),onChange:()=>ee(r.agent_id),style:{cursor:"pointer",accentColor:t.blue}})}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"center"},children:e.jsx(Te,{status:r.status})}),e.jsxs("td",{style:{padding:"8px 10px"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.textPrimary,lineHeight:1.2},children:r.display_name}),e.jsx("div",{style:{...x,fontSize:10,color:t.textMuted},children:r.agent_id})]}),e.jsx("td",{style:{padding:"8px 10px"},children:e.jsx(O,{text:r.agent_type,color:me[r.agent_type]||t.textMuted})}),e.jsx("td",{style:{padding:"8px 10px"},children:e.jsx(we,{score:r.trust_score})}),e.jsx("td",{style:{padding:"8px 10px"},children:e.jsx("span",{style:{...x,fontSize:12,color:t.textPrimary},children:r.actions_today})}),e.jsx("td",{style:{padding:"8px 10px"},children:e.jsxs("span",{style:{...x,fontSize:12,color:r.avg_latency_ms>1e3?t.yellow:t.textSecondary},children:[r.avg_latency_ms,"ms"]})}),e.jsx("td",{style:{padding:"8px 10px"},children:e.jsxs("span",{style:{...x,fontSize:12,color:r.error_rate>10?t.red:t.textSecondary},children:[r.error_rate,"%"]})}),e.jsx("td",{style:{padding:"8px 10px"},children:r.unresolved_alerts>0?e.jsx("span",{style:{...x,fontSize:12,color:t.yellow,fontWeight:700},children:r.unresolved_alerts}):e.jsx("span",{style:{...x,fontSize:12,color:t.textMuted},children:"0"})}),e.jsx("td",{style:{padding:"8px 10px"},children:e.jsx("span",{style:{...x,fontSize:11,color:$?t.red:t.textMuted},children:H(r.last_heartbeat)})}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right"},children:e.jsx(Ce,{agent:r,onSuspend:V,onActivate:U,onAdjustTrust:z=>k({agentId:z,score:r.trust_score})})})]}),y&&c&&e.jsx(ke,{detail:c})]},r.agent_id)})})]})})}),e.jsx(J,{alerts:s,onResolve:Y})]}),S.agentsNeedingAttention.length>0&&e.jsxs("div",{style:{marginTop:16,background:t.card,border:`1px solid ${t.red}33`,borderRadius:6,padding:16},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.red,textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:8},children:"⚠ Agents Needing Attention"}),e.jsx("div",{style:{display:"flex",gap:12,flexWrap:"wrap"},children:S.agentsNeedingAttention.map(r=>e.jsxs("div",{style:{background:"rgba(248,113,113,0.06)",border:`1px solid ${t.red}22`,borderRadius:4,padding:"6px 12px",display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{...x,fontSize:12,color:t.textPrimary,fontWeight:600},children:r.display_name}),e.jsx("span",{style:{fontSize:11,color:t.red},children:r.reason})]},r.agent_id))})]}),m&&e.jsx(Me,{agentId:m.agentId,currentScore:m.score,onSubmit:Z,onClose:()=>k(null)})]})}export{Re as FleetDashboardPage};
-//# sourceMappingURL=FleetDashboardPage-Cd5radQs.js.map
+import{j as e,r as g,R as oe}from"./index-C0nK3ekl.js";import{f as T}from"./fleet-ClHE8wrR.js";const se={T0:"#10b981",T1:"#10b981",T2:"#fbbf24",T3:"#ef4444"},ie={T0:"AUTO_APPROVE",T1:"POLICY_GATE",T2:"HUMAN_GATE",T3:"STRICT_HALT"},d={card:"var(--bg-primary)",cardHover:"var(--bg-secondary)",border:"var(--border-subtle)",borderActive:"var(--border-default)",borderStrong:"var(--border-strong)",green:"var(--success-text)",yellow:"var(--warning-text)",red:"var(--error-text)",textPrimary:"var(--text-primary)",textSecondary:"var(--text-secondary)",textMuted:"var(--text-tertiary)"},le={active:d.green,idle:d.yellow,suspended:d.red,terminated:d.textMuted},de={"Active Warrant":d.green,"No Warrant":d.textMuted,Expired:d.red},P={fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', monospace"};function ae(n){if(!n)return"never";const o=Date.now()-new Date(n).getTime();if(o<0)return"just now";const s=Math.floor(o/1e3);if(s<60)return`${s}s ago`;const l=Math.floor(s/60);if(l<60)return`${l}m ago`;const a=Math.floor(l/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function ce(n,o=3e5){return n?Date.now()-new Date(n).getTime()>o:!0}function xe(n){return n>70?d.green:n>=40?d.yellow:d.red}function ue({status:n}){const o=le[n]||d.textMuted,s=n==="active";return e.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:o,boxShadow:s?`0 0 6px ${o}`:"none",animation:s?"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite":"none"}})}function G({text:n,color:o,small:s}){return e.jsx("span",{style:{...P,fontSize:s?9:10,fontWeight:600,color:o,background:`${o}18`,border:`1px solid ${o}33`,borderRadius:3,padding:s?"1px 4px":"2px 6px",textTransform:"uppercase",letterSpacing:"0.04em",whiteSpace:"nowrap"},children:n})}function pe({score:n}){const o=xe(n);return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,width:"100%"},children:[e.jsx("div",{style:{flex:1,height:6,background:"rgba(255,255,255,0.08)",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${n}%`,height:"100%",background:o,borderRadius:3,transition:"width 300ms ease"}})}),e.jsx("span",{style:{...P,fontSize:11,color:o,fontWeight:600,minWidth:24,textAlign:"right"},children:n})]})}function ge({agent:n,riskTier:o,warrantStatus:s,onClick:l,onAdjustTrust:a,onSuspend:p,onActivate:i}){const h=ce(n.last_heartbeat),v=se[o],C=ie[o];return e.jsxs("div",{onClick:l,style:{background:d.card,border:`1px solid ${d.border}`,borderLeft:`4px solid ${v}`,borderRadius:6,padding:16,cursor:l?"pointer":"default",transition:"all 200ms ease",display:"flex",flexDirection:"column",gap:12,height:"100%"},onMouseEnter:c=>{l&&(c.currentTarget.style.background=d.cardHover,c.currentTarget.style.borderColor=d.borderActive,c.currentTarget.style.boxShadow="0 8px 24px rgba(0,0,0,0.3)")},onMouseLeave:c=>{c.currentTarget.style.background=d.card,c.currentTarget.style.borderColor=d.border,c.currentTarget.style.boxShadow="none"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:[e.jsx(ue,{status:n.status}),e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:15,fontWeight:700,color:d.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.display_name}),e.jsx("div",{style:{...P,fontSize:10,color:d.textMuted,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.agent_id})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,alignItems:"flex-end"},children:[e.jsx(G,{text:o,color:v,small:!0}),e.jsx("span",{style:{...P,fontSize:9,color:d.textMuted,textTransform:"uppercase",letterSpacing:"0.03em"},children:C})]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:d.textMuted,textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:6},children:"Trust Score"}),e.jsx(pe,{score:n.trust_score})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("div",{style:{fontSize:10,color:d.textMuted,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Last Activity"}),e.jsx("span",{style:{...P,fontSize:11,color:h?d.red:d.textSecondary},children:ae(n.last_heartbeat)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("div",{style:{fontSize:10,color:d.textMuted,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Warrant"}),e.jsx(G,{text:s,color:de[s]||d.textMuted})]}),e.jsxs("div",{style:{display:"flex",gap:6,marginTop:4},children:[n.status==="suspended"?e.jsx("button",{onClick:c=>{c.stopPropagation(),i==null||i()},style:{flex:1,padding:"6px 10px",fontSize:11,fontWeight:600,border:`1px solid ${d.green}33`,background:"rgba(16,185,129,0.1)",color:d.green,borderRadius:4,cursor:"pointer",transition:"all 150ms ease"},onMouseEnter:c=>{c.currentTarget.style.borderColor=`${d.green}66`,c.currentTarget.style.background="rgba(16,185,129,0.15)"},onMouseLeave:c=>{c.currentTarget.style.borderColor=`${d.green}33`,c.currentTarget.style.background="rgba(16,185,129,0.1)"},children:"⚡ Activate"}):e.jsx("button",{onClick:c=>{c.stopPropagation(),p==null||p()},style:{flex:1,padding:"6px 10px",fontSize:11,fontWeight:600,border:`1px solid ${d.red}33`,background:"rgba(239,68,68,0.1)",color:d.red,borderRadius:4,cursor:"pointer",transition:"all 150ms ease"},onMouseEnter:c=>{c.currentTarget.style.borderColor=`${d.red}66`,c.currentTarget.style.background="rgba(239,68,68,0.15)"},onMouseLeave:c=>{c.currentTarget.style.borderColor=`${d.red}33`,c.currentTarget.style.background="rgba(239,68,68,0.1)"},children:"⏸ Suspend"}),e.jsx("button",{onClick:c=>{c.stopPropagation(),a==null||a()},style:{flex:1,padding:"6px 10px",fontSize:11,fontWeight:600,border:`1px solid ${d.borderStrong}`,background:"transparent",color:d.textSecondary,borderRadius:4,cursor:"pointer",transition:"all 150ms ease"},onMouseEnter:c=>{c.currentTarget.style.borderColor=d.borderActive,c.currentTarget.style.color=d.textPrimary},onMouseLeave:c=>{c.currentTarget.style.borderColor=d.borderStrong,c.currentTarget.style.color=d.textSecondary},children:"🎚 Adjust"})]})]})}const u={card:"var(--bg-primary)",border:"var(--border-subtle)",green:"var(--success-text)",yellow:"var(--warning-text)",red:"var(--error-text)",blue:"var(--info-text)",textPrimary:"var(--text-primary)",textSecondary:"var(--text-secondary)",textMuted:"var(--text-tertiary)"},E={fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', monospace"};function W({label:n,value:o,unit:s,color:l,secondaryValue:a,children:p}){return e.jsxs("div",{style:{background:u.card,border:`1px solid ${u.border}`,borderRadius:6,padding:"12px 16px",flex:"1 1 0",minWidth:140},children:[e.jsx("div",{style:{fontSize:10,color:u.textMuted,textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:8},children:n}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:4,marginBottom:4},children:[e.jsx("div",{style:{...E,fontSize:24,fontWeight:700,color:l||u.textPrimary,lineHeight:1},children:o}),s&&e.jsx("span",{style:{...E,fontSize:11,color:u.textSecondary,fontWeight:500},children:s})]}),a&&e.jsxs("div",{style:{...E,fontSize:10,color:u.textMuted,display:"flex",justifyContent:"space-between"},children:[e.jsx("span",{children:a.label}),e.jsx("span",{children:a.value})]}),p]})}function ye({activeCount:n,idleCount:o,suspendedCount:s}){const l=n+o+s;if(l===0)return null;const a=n/l*100,p=o/l*100,i=s/l*100;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:8},children:[e.jsxs("div",{style:{display:"flex",height:4,borderRadius:2,overflow:"hidden",flex:1,background:"rgba(255,255,255,0.08)"},children:[a>0&&e.jsx("div",{style:{width:`${a}%`,background:u.green}}),p>0&&e.jsx("div",{style:{width:`${p}%`,background:u.yellow}}),i>0&&e.jsx("div",{style:{width:`${i}%`,background:u.red}})]}),e.jsxs("div",{style:{display:"flex",gap:8,fontSize:9,color:u.textMuted,whiteSpace:"nowrap"},children:[e.jsxs("span",{style:{color:u.green},children:["●",n]}),e.jsxs("span",{style:{color:u.yellow},children:["●",o]}),e.jsxs("span",{style:{color:u.red},children:["●",s]})]})]})}function he({totalAgents:n,activeAgents:o,idleAgents:s,suspendedAgents:l,avgTrustScore:a,t0Count:p,t1Count:i,t2Count:h,t3Count:v,pendingApprovals:C,actionsToday:c,avgLatencyMs:M,unresolvedAlerts:m}){const k=a>70?u.green:a>=40?u.yellow:u.red;return e.jsxs("div",{style:{display:"flex",gap:10,marginBottom:16,flexWrap:"wrap"},children:[e.jsx(W,{label:"Total Agents",value:n,color:u.textPrimary,secondaryValue:{label:"Registered",value:n},children:e.jsx(ye,{activeCount:o,idleCount:s,suspendedCount:l})}),e.jsx(W,{label:"Avg Trust Score",value:Math.round(a),unit:"%",color:k,secondaryValue:{label:"Fleet health",value:k===u.green?"✓ Good":k===u.yellow?"⚠ Fair":"✗ Low"}}),e.jsx(W,{label:"Actions Today",value:c,color:u.blue,secondaryValue:{label:"Real-time",value:"flowing"}}),e.jsx(W,{label:"Avg Latency",value:M,unit:"ms",color:M>1e3?u.yellow:u.green,secondaryValue:{label:"Status",value:M>1e3?"⚠ Slow":"✓ Fast"}}),e.jsx(W,{label:"Unresolved Alerts",value:m,color:m>0?u.yellow:u.green,secondaryValue:{label:"Status",value:m>0?`${m} pending`:"All clear"}}),C>0&&e.jsx(W,{label:"⚡ Pending Approvals",value:C,color:u.yellow,secondaryValue:{label:"Status",value:"Awaiting"}})]})}const t={card:"var(--bg-primary)",cardHover:"var(--bg-secondary)",border:"var(--border-subtle)",borderActive:"var(--border-default)",green:"var(--success-text)",yellow:"var(--warning-text)",red:"var(--error-text)",blue:"var(--info-text)",amber:"var(--accent-primary)",cyan:"#06b6d4",textPrimary:"var(--text-primary)",textSecondary:"var(--text-secondary)",textMuted:"var(--text-tertiary)"},fe={active:t.green,idle:t.yellow,suspended:t.red,terminated:t.textMuted},I={info:t.blue,warning:t.yellow,critical:t.red},be={executed:t.green,approved:t.green,denied:t.yellow,failed:t.red,timeout:t.textMuted},me={autonomous:t.amber,"semi-autonomous":t.blue,supervised:t.cyan},x={fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', monospace"},ve=15e3;function H(n){if(!n)return"never";const o=Date.now()-new Date(n).getTime();if(o<0)return"just now";const s=Math.floor(o/1e3);if(s<60)return`${s}s ago`;const l=Math.floor(s/60);if(l<60)return`${l}m ago`;const a=Math.floor(l/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function je(n,o=3e5){return n?Date.now()-new Date(n).getTime()>o:!0}function F(n){return n>70?t.green:n>=40?t.yellow:t.red}function B(n){return n>85?"T0":n>65?"T1":n>40?"T2":"T3"}function Se(n){if(n.warrant_status){if(n.warrant_status==="active")return"Active Warrant";if(n.warrant_status==="expired")return"Expired"}return"No Warrant"}function we({score:n}){const o=F(n);return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("div",{style:{width:60,height:6,background:"rgba(255,255,255,0.08)",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${n}%`,height:"100%",background:o,borderRadius:3,transition:"width 300ms ease"}})}),e.jsx("span",{style:{...x,fontSize:11,color:o,fontWeight:600},children:n})]})}function Te({status:n}){const o=fe[n]||t.textMuted;return e.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:o,boxShadow:n==="active"?`0 0 6px ${o}`:"none"}})}function O({text:n,color:o}){return e.jsx("span",{style:{...x,fontSize:10,fontWeight:600,color:o,background:`${o}18`,border:`1px solid ${o}33`,borderRadius:3,padding:"1px 6px",textTransform:"uppercase",letterSpacing:"0.04em"},children:n})}function ke({detail:n}){const{metrics:o,recentActivity:s,alerts:l}=n,a=Object.entries(o.actionsByType).sort((i,h)=>h[1]-i[1]).slice(0,5),p=a.length>0?a[0][1]:1;return e.jsx("tr",{children:e.jsx("td",{colSpan:11,style:{padding:0,border:"none"},children:e.jsxs("div",{style:{background:"#161f2e",borderTop:`1px solid ${t.border}`,borderBottom:`1px solid ${t.border}`,padding:"16px 20px",display:"grid",gridTemplateColumns:"1fr 1fr 1.5fr",gap:20},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:t.textMuted,textTransform:"uppercase",marginBottom:8,letterSpacing:"0.05em"},children:"Metrics"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"6px 16px"},children:[["Actions/Day",o.actionsToday],["Actions/Week",o.actionsThisWeek],["Avg Latency",`${o.avgLatencyMs}ms`],["Approval %",`${o.approvalRate}%`],["Error %",`${o.errorRate}%`],["Denied %",`${o.deniedRate}%`]].map(([i,h])=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontSize:11,color:t.textMuted},children:i}),e.jsx("span",{style:{...x,fontSize:11,color:t.textPrimary},children:h})]},i))}),e.jsxs("div",{style:{marginTop:12},children:[e.jsx("div",{style:{fontSize:11,color:t.textMuted,textTransform:"uppercase",marginBottom:6,letterSpacing:"0.05em"},children:"Top Actions"}),a.map(([i,h])=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:3},children:[e.jsx("span",{style:{...x,fontSize:10,color:t.textSecondary,width:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),e.jsx("div",{style:{flex:1,height:4,background:"rgba(255,255,255,0.06)",borderRadius:2},children:e.jsx("div",{style:{width:`${h/p*100}%`,height:"100%",background:t.blue,borderRadius:2}})}),e.jsx("span",{style:{...x,fontSize:10,color:t.textMuted,width:24,textAlign:"right"},children:h})]},i))]})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:11,color:t.textMuted,textTransform:"uppercase",marginBottom:8,letterSpacing:"0.05em"},children:["Active Alerts (",l.length,")"]}),l.length===0?e.jsx("div",{style:{fontSize:12,color:t.textMuted},children:"No active alerts"}):l.slice(0,4).map(i=>e.jsxs("div",{style:{background:t.card,border:`1px solid ${I[i.severity]}33`,borderLeft:`3px solid ${I[i.severity]}`,borderRadius:4,padding:"6px 10px",marginBottom:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[e.jsx(O,{text:i.severity,color:I[i.severity]}),e.jsx("span",{style:{...x,fontSize:10,color:t.textMuted},children:i.alert_type})]}),e.jsx("div",{style:{fontSize:11,color:t.textSecondary,lineHeight:1.3},children:i.message})]},i.id))]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:t.textMuted,textTransform:"uppercase",marginBottom:8,letterSpacing:"0.05em"},children:"Recent Activity"}),e.jsx("div",{style:{maxHeight:200,overflowY:"auto"},children:s.map(i=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 0",borderBottom:`1px solid ${t.border}`},children:[e.jsx(O,{text:i.result,color:be[i.result]||t.textMuted}),e.jsx("span",{style:{...x,fontSize:11,color:t.textPrimary,flex:1},children:i.action_type}),i.risk_tier&&e.jsx(O,{text:i.risk_tier,color:t.textSecondary}),e.jsxs("span",{style:{...x,fontSize:10,color:t.textMuted},children:[i.latency_ms,"ms"]}),e.jsx("span",{style:{...x,fontSize:10,color:t.textMuted,width:55,textAlign:"right"},children:H(i.created_at)})]},i.id))})]})]})})})}function Ce({agent:n,onSuspend:o,onActivate:s,onAdjustTrust:l}){const[a,p]=g.useState(!1);return e.jsxs("div",{style:{position:"relative"},children:[e.jsx("button",{onClick:i=>{i.stopPropagation(),p(!a)},style:{background:"none",border:`1px solid ${t.border}`,borderRadius:4,color:t.textSecondary,cursor:"pointer",padding:"2px 6px",fontSize:14,lineHeight:1},children:"⋯"}),a&&e.jsxs("div",{onClick:i=>i.stopPropagation(),style:{position:"absolute",right:0,top:"100%",marginTop:4,background:t.card,border:`1px solid ${t.borderActive}`,borderRadius:6,padding:4,zIndex:100,minWidth:140,boxShadow:"0 8px 24px rgba(0,0,0,0.4)"},children:[n.status==="suspended"?e.jsx(D,{label:"⚡ Activate",onClick:()=>{s(n.agent_id),p(!1)}}):e.jsx(D,{label:"⏸ Suspend",onClick:()=>{o(n.agent_id),p(!1)},color:t.red}),e.jsx(D,{label:"🎚 Adjust Trust",onClick:()=>{l(n.agent_id),p(!1)}})]})]})}function D({label:n,onClick:o,color:s}){return e.jsx("button",{onClick:o,style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",color:s||t.textSecondary,fontSize:12,padding:"6px 10px",borderRadius:4,cursor:"pointer"},onMouseEnter:l=>{l.currentTarget.style.background="rgba(255,255,255,0.06)"},onMouseLeave:l=>{l.currentTarget.style.background="none"},children:n})}function J({alerts:n,onResolve:o}){return e.jsxs("div",{style:{background:t.card,border:`1px solid ${t.border}`,borderRadius:6,padding:16,maxHeight:360,overflowY:"auto"},children:[e.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:e.jsxs("div",{style:{fontSize:13,fontWeight:600,color:t.textPrimary,textTransform:"uppercase",letterSpacing:"0.05em"},children:["🚨 Alerts (",n.length,")"]})}),n.length===0?e.jsx("div",{style:{fontSize:12,color:t.textMuted,textAlign:"center",padding:20},children:"All clear — no active alerts"}):n.map(s=>e.jsxs("div",{style:{borderLeft:`3px solid ${I[s.severity]}`,background:`${I[s.severity]}08`,borderRadius:4,padding:"8px 12px",marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(O,{text:s.severity,color:I[s.severity]}),e.jsx("span",{style:{...x,fontSize:11,color:t.textPrimary,fontWeight:600},children:s.agent_name||s.agent_id}),e.jsx("span",{style:{...x,fontSize:10,color:t.textMuted},children:s.alert_type})]}),e.jsx("button",{onClick:()=>o(s.id),style:{background:"none",border:`1px solid ${t.border}`,borderRadius:3,color:t.textMuted,fontSize:10,padding:"2px 8px",cursor:"pointer"},onMouseEnter:l=>{l.currentTarget.style.borderColor=t.green,l.currentTarget.style.color=t.green},onMouseLeave:l=>{l.currentTarget.style.borderColor=t.border,l.currentTarget.style.color=t.textMuted},children:"Resolve"})]}),e.jsx("div",{style:{fontSize:11,color:t.textSecondary,lineHeight:1.4},children:s.message}),e.jsx("div",{style:{...x,fontSize:10,color:t.textMuted,marginTop:4},children:H(s.created_at)})]},s.id))]})}function Me({agentId:n,currentScore:o,onSubmit:s,onClose:l}){const[a,p]=g.useState(o);return e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:l,children:e.jsxs("div",{style:{background:t.card,border:`1px solid ${t.borderActive}`,borderRadius:8,padding:24,width:320,boxShadow:"0 16px 48px rgba(0,0,0,0.5)"},onClick:i=>i.stopPropagation(),children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:t.textPrimary,marginBottom:4},children:"Adjust Trust Score"}),e.jsx("div",{style:{...x,fontSize:12,color:t.textMuted,marginBottom:16},children:n}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:16},children:[e.jsx("input",{type:"range",min:0,max:100,value:a,onChange:i=>p(parseInt(i.target.value)),style:{flex:1,accentColor:F(a)}}),e.jsx("span",{style:{...x,fontSize:18,fontWeight:700,color:F(a),width:36,textAlign:"right"},children:a})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:l,style:{background:"none",border:`1px solid ${t.border}`,borderRadius:4,color:t.textSecondary,fontSize:12,padding:"6px 14px",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{onClick:()=>s(a),style:{background:t.blue,border:"none",borderRadius:4,color:"#fff",fontSize:12,fontWeight:600,padding:"6px 14px",cursor:"pointer"},children:"Apply"})]})]})})}function Re(){const[n,o]=g.useState(null),[s,l]=g.useState([]),[a,p]=g.useState(!0),[i,h]=g.useState(null),[v,C]=g.useState(null),[c,M]=g.useState(null),[m,k]=g.useState(null),[K,Q]=g.useState(new Date),[L,X]=g.useState(""),[R,q]=g.useState("all"),[j,_]=g.useState(new Set),[A,N]=g.useState("cards"),f=g.useCallback(async()=>{try{const[r,y]=await Promise.all([T.getOverview(),T.getAlerts()]);o(r),l(y),h(null),Q(new Date)}catch(r){h(r instanceof Error?r.message:"Failed to load fleet data")}finally{p(!1)}},[]);g.useEffect(()=>{f();const r=setInterval(f,ve);return()=>clearInterval(r)},[f]),g.useEffect(()=>{if(!v){M(null);return}T.getAgent(v).then(M).catch(()=>M(null))},[v]);const V=async r=>{await T.suspend(r),f()},U=async r=>{await T.activate(r),f()},Z=async r=>{m&&(await T.adjustTrust(m.agentId,r),k(null),f())},Y=async r=>{await T.resolveAlert(r),f()};if(a)return e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:400,color:t.textMuted},children:e.jsx("div",{style:{...x,fontSize:14},children:"Loading fleet data..."})});if(i||!n)return e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:400},children:e.jsxs("div",{style:{textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:14,color:t.red,marginBottom:8},children:["⚠ ",i||"No data"]}),e.jsx("button",{onClick:f,style:{background:t.card,border:`1px solid ${t.border}`,borderRadius:4,color:t.textSecondary,padding:"6px 14px",fontSize:12,cursor:"pointer"},children:"Retry"})]})});const{agents:b,summary:S}=n,w=b.filter(r=>!(L&&!r.display_name.toLowerCase().includes(L.toLowerCase())&&!r.agent_id.toLowerCase().includes(L.toLowerCase())||R!=="all"&&r.status!==R)),ee=r=>{_(y=>{const $=new Set(y);return $.has(r)?$.delete(r):$.add(r),$})},te=()=>{j.size===w.length?_(new Set):_(new Set(w.map(r=>r.agent_id)))},re=async()=>{if(confirm(`Suspend ${j.size} agents?`)){for(const r of j)await T.suspend(r);_(new Set),f()}},ne=async()=>{if(confirm(`Activate ${j.size} agents?`)){for(const r of j)await T.activate(r);_(new Set),f()}};return S.trendData.map(r=>r.count),e.jsxs("div",{style:{maxWidth:1400,margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:18,fontWeight:700,color:t.textPrimary,margin:0,letterSpacing:"-0.01em"},children:"Agent Fleet"}),e.jsxs("div",{style:{...x,fontSize:11,color:t.textMuted,marginTop:2},children:["Governance Dashboard — ",S.totalAgents," agents registered"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("div",{style:{display:"flex",gap:2,background:"rgba(255,255,255,0.03)",borderRadius:4,padding:2},children:[e.jsx("button",{onClick:()=>N("cards"),style:{padding:"4px 10px",fontSize:11,borderRadius:3,border:"none",cursor:"pointer",fontWeight:A==="cards"?600:400,background:A==="cards"?"rgba(255,255,255,0.08)":"transparent",color:A==="cards"?t.textPrimary:t.textMuted},children:"⊞ Cards"}),e.jsx("button",{onClick:()=>N("table"),style:{padding:"4px 10px",fontSize:11,borderRadius:3,border:"none",cursor:"pointer",fontWeight:A==="table"?600:400,background:A==="table"?"rgba(255,255,255,0.08)":"transparent",color:A==="table"?t.textPrimary:t.textMuted},children:"▦ Table"})]}),e.jsxs("div",{style:{...x,fontSize:10,color:t.textMuted},children:["Updated ",K.toLocaleTimeString()]}),e.jsx("button",{onClick:f,style:{background:"none",border:`1px solid ${t.border}`,borderRadius:4,color:t.textSecondary,padding:"4px 10px",fontSize:11,cursor:"pointer"},onMouseEnter:r=>{r.currentTarget.style.borderColor=t.blue},onMouseLeave:r=>{r.currentTarget.style.borderColor=t.border},children:"↻ Refresh"})]})]}),e.jsx(he,{totalAgents:S.totalAgents,activeAgents:S.activeAgents,idleAgents:b.filter(r=>r.status==="idle").length,suspendedAgents:b.filter(r=>r.status==="suspended").length,avgTrustScore:b.length>0?b.reduce((r,y)=>r+y.trust_score,0)/b.length:0,t0Count:b.filter(r=>B(r.trust_score)==="T0").length,t1Count:b.filter(r=>B(r.trust_score)==="T1").length,t2Count:b.filter(r=>B(r.trust_score)==="T2").length,t3Count:b.filter(r=>B(r.trust_score)==="T3").length,pendingApprovals:0,actionsToday:S.actionsToday,avgLatencyMs:S.avgLatencyMs,unresolvedAlerts:S.unresolvedAlerts}),e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:12,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("input",{type:"text",placeholder:"Search agents...",value:L,onChange:r=>X(r.target.value),style:{padding:"6px 12px",fontSize:12,borderRadius:4,border:`1px solid ${t.border}`,background:"rgba(255,255,255,0.04)",color:t.textPrimary,width:200,fontFamily:"inherit",outline:"none"}}),e.jsx("div",{style:{display:"flex",gap:2,background:"rgba(255,255,255,0.03)",borderRadius:4,padding:2},children:[{key:"all",label:"All"},{key:"active",label:"🟢 Active"},{key:"idle",label:"🟡 Idle"},{key:"suspended",label:"🔴 Suspended"}].map(r=>e.jsx("button",{onClick:()=>q(r.key),style:{padding:"4px 10px",fontSize:11,borderRadius:3,border:"none",cursor:"pointer",fontWeight:R===r.key?600:400,background:R===r.key?"rgba(255,255,255,0.08)":"transparent",color:R===r.key?t.textPrimary:t.textMuted},children:r.label},r.key))}),(L||R!=="all")&&e.jsxs("span",{style:{...x,fontSize:10,color:t.textMuted},children:[w.length," of ",b.length]})]}),j.size>0&&e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:12,padding:"8px 12px",background:"rgba(59,130,246,0.08)",borderRadius:6,border:"1px solid rgba(59,130,246,0.15)"},children:[e.jsxs("span",{style:{fontSize:12,color:t.blue,fontWeight:600},children:[j.size," selected"]}),e.jsx("button",{onClick:ne,style:{padding:"4px 10px",fontSize:11,borderRadius:4,border:"1px solid rgba(16,185,129,0.3)",background:"rgba(16,185,129,0.1)",color:t.green,cursor:"pointer",fontWeight:500},children:"⚡ Activate All"}),e.jsx("button",{onClick:re,style:{padding:"4px 10px",fontSize:11,borderRadius:4,border:"1px solid rgba(239,68,68,0.3)",background:"rgba(239,68,68,0.1)",color:t.red,cursor:"pointer",fontWeight:500},children:"⏸ Suspend All"}),e.jsx("button",{onClick:()=>_(new Set),style:{padding:"4px 10px",fontSize:11,borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.textMuted,cursor:"pointer"},children:"Clear"})]}),A==="cards"?e.jsxs("div",{style:{display:"grid",gridTemplateColumns:window.innerWidth>768?"1fr 340px":"1fr",gap:16},children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:16},children:w.length===0?e.jsxs("div",{style:{gridColumn:"1 / -1",display:"flex",alignItems:"center",justifyContent:"center",minHeight:300,color:t.textMuted,flexDirection:"column",gap:12},children:[e.jsx("div",{style:{fontSize:16},children:"📭"}),e.jsx("div",{style:{fontSize:14,fontWeight:600},children:"No agents registered yet"}),e.jsx("div",{style:{fontSize:11,color:t.textMuted},children:'Connect your first agent to get started. Click "Connect Agent" in settings.'})]}):w.map(r=>e.jsx(ge,{agent:r,riskTier:B(r.trust_score),warrantStatus:Se(r),onClick:()=>C(r.agent_id===v?null:r.agent_id),onAdjustTrust:()=>k({agentId:r.agent_id,score:r.trust_score}),onSuspend:()=>V(r.agent_id),onActivate:()=>U(r.agent_id)},r.agent_id))}),e.jsx(J,{alerts:s,onResolve:Y})]}):e.jsxs("div",{style:{display:"grid",gridTemplateColumns:window.innerWidth>768?"1fr 340px":"1fr",gap:16},children:[e.jsx("div",{style:{background:t.card,border:`1px solid ${t.border}`,borderRadius:6,overflow:"hidden"},children:e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:`1px solid ${t.border}`},children:[e.jsx("th",{style:{padding:"10px 10px",width:28},children:e.jsx("input",{type:"checkbox",checked:w.length>0&&j.size===w.length,onChange:te,style:{cursor:"pointer",accentColor:t.blue}})}),["","Agent","Type","Trust","Actions","Latency","Errors","Alerts","Last Seen",""].map((r,y)=>e.jsx("th",{style:{textAlign:"left",padding:"10px 10px",fontSize:10,fontWeight:600,color:t.textMuted,textTransform:"uppercase",letterSpacing:"0.06em",whiteSpace:"nowrap",...y===0?{width:24}:{}},children:r},y))]})}),e.jsx("tbody",{children:w.length===0?e.jsx("tr",{children:e.jsxs("td",{colSpan:11,style:{padding:"40px 20px",textAlign:"center",color:t.textMuted},children:[e.jsx("div",{style:{fontSize:14,marginBottom:8},children:"No agents registered"}),e.jsx("div",{style:{fontSize:11,color:t.textMuted},children:"Agents will appear here once they connect to Vienna OS"})]})}):w.map(r=>{const y=v===r.agent_id,$=je(r.last_heartbeat);return e.jsxs(oe.Fragment,{children:[e.jsxs("tr",{onClick:()=>C(y?null:r.agent_id),style:{borderBottom:`1px solid ${t.border}`,cursor:"pointer",background:y?"#161f2e":"transparent",transition:"background 150ms"},onMouseEnter:z=>{y||(z.currentTarget.style.background=t.cardHover)},onMouseLeave:z=>{y||(z.currentTarget.style.background="transparent")},children:[e.jsx("td",{style:{padding:"8px 10px",textAlign:"center"},onClick:z=>z.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:j.has(r.agent_id),onChange:()=>ee(r.agent_id),style:{cursor:"pointer",accentColor:t.blue}})}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"center"},children:e.jsx(Te,{status:r.status})}),e.jsxs("td",{style:{padding:"8px 10px"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.textPrimary,lineHeight:1.2},children:r.display_name}),e.jsx("div",{style:{...x,fontSize:10,color:t.textMuted},children:r.agent_id})]}),e.jsx("td",{style:{padding:"8px 10px"},children:e.jsx(O,{text:r.agent_type,color:me[r.agent_type]||t.textMuted})}),e.jsx("td",{style:{padding:"8px 10px"},children:e.jsx(we,{score:r.trust_score})}),e.jsx("td",{style:{padding:"8px 10px"},children:e.jsx("span",{style:{...x,fontSize:12,color:t.textPrimary},children:r.actions_today})}),e.jsx("td",{style:{padding:"8px 10px"},children:e.jsxs("span",{style:{...x,fontSize:12,color:r.avg_latency_ms>1e3?t.yellow:t.textSecondary},children:[r.avg_latency_ms,"ms"]})}),e.jsx("td",{style:{padding:"8px 10px"},children:e.jsxs("span",{style:{...x,fontSize:12,color:r.error_rate>10?t.red:t.textSecondary},children:[r.error_rate,"%"]})}),e.jsx("td",{style:{padding:"8px 10px"},children:r.unresolved_alerts>0?e.jsx("span",{style:{...x,fontSize:12,color:t.yellow,fontWeight:700},children:r.unresolved_alerts}):e.jsx("span",{style:{...x,fontSize:12,color:t.textMuted},children:"0"})}),e.jsx("td",{style:{padding:"8px 10px"},children:e.jsx("span",{style:{...x,fontSize:11,color:$?t.red:t.textMuted},children:H(r.last_heartbeat)})}),e.jsx("td",{style:{padding:"8px 10px",textAlign:"right"},children:e.jsx(Ce,{agent:r,onSuspend:V,onActivate:U,onAdjustTrust:z=>k({agentId:z,score:r.trust_score})})})]}),y&&c&&e.jsx(ke,{detail:c})]},r.agent_id)})})]})})}),e.jsx(J,{alerts:s,onResolve:Y})]}),S.agentsNeedingAttention.length>0&&e.jsxs("div",{style:{marginTop:16,background:t.card,border:`1px solid ${t.red}33`,borderRadius:6,padding:16},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.red,textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:8},children:"⚠ Agents Needing Attention"}),e.jsx("div",{style:{display:"flex",gap:12,flexWrap:"wrap"},children:S.agentsNeedingAttention.map(r=>e.jsxs("div",{style:{background:"rgba(248,113,113,0.06)",border:`1px solid ${t.red}22`,borderRadius:4,padding:"6px 12px",display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{...x,fontSize:12,color:t.textPrimary,fontWeight:600},children:r.display_name}),e.jsx("span",{style:{fontSize:11,color:t.red},children:r.reason})]},r.agent_id))})]}),m&&e.jsx(Me,{agentId:m.agentId,currentScore:m.score,onSubmit:Z,onClose:()=>k(null)})]})}export{Re as FleetDashboardPage};
+//# sourceMappingURL=FleetDashboardPage-nC3mT2F1.js.map
diff --git a/apps/console-proxy/public/assets/FleetPremium-DwUXznBp.js b/apps/console-proxy/public/assets/FleetPremium-DwUXznBp.js
deleted file mode 100644
index d121ca53..00000000
--- a/apps/console-proxy/public/assets/FleetPremium-DwUXznBp.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import{u as k,r as o,j as e,w as A}from"./index-D_7YXFSJ.js";import{f as L}from"./fleet-Bmy_93a8.js";function D(){var v;const a=k(),[s,d]=o.useState([]),[r,x]=o.useState(null),[g,j]=o.useState(!0),[h,f]=o.useState(!1),c=o.useCallback(async(t=!1)=>{t&&f(!0);try{const l=await L.getOverview();d(l.agents||[]),x(l.summary||null)}catch(l){console.error("Fleet load failed:",l)}finally{j(!1),f(!1)}},[]);o.useEffect(()=>{c()},[c]),o.useEffect(()=>{const t=setInterval(()=>c(),3e4);return()=>clearInterval(t)},[c]);const n=s.length,m=s.filter(t=>t.status==="active").length,u=s.filter(t=>t.status==="idle").length,p=s.filter(t=>t.status==="suspended").length,N=n>0?(s.reduce((t,l)=>t+(l.trust_score||0),0)/n).toFixed(1):"0.0",w=(r==null?void 0:r.actionsToday)??s.reduce((t,l)=>t+(l.actions_today||0),0),C=((v=r==null?void 0:r.avgLatencyMs)==null?void 0:v.toFixed(1))??"—";return g?e.jsx("div",{className:"flex items-center justify-center py-24",children:e.jsx("div",{className:"w-8 h-8 border-2 rounded-full animate-spin",style:{borderColor:"var(--border-subtle)",borderTopColor:"var(--accent-primary)"}})}):e.jsx("div",{style:{position:"relative",minHeight:"100vh"},children:e.jsx("div",{style:{position:"relative",zIndex:1},children:e.jsxs("div",{className:"space-y-6 max-w-[1440px] mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold tracking-tight",style:{color:"var(--text-primary)"},children:"Fleet Console"}),e.jsxs("p",{className:"text-[11px] uppercase tracking-widest mt-0.5",style:{color:"var(--text-muted)"},children:[n," agents registered"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"px-3 py-1.5 rounded flex items-center gap-2",style:{background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)"},children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),e.jsx("span",{className:"text-xs font-mono text-emerald-500 uppercase tracking-wider",children:"Live"})]}),e.jsx("button",{onClick:()=>c(!0),disabled:h,className:"p-2 rounded-lg transition-colors hover:opacity-80",style:{background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)"},children:e.jsx(A,{size:16,className:h?"animate-spin":"",style:{color:"var(--text-tertiary)"}})}),e.jsx("button",{onClick:()=>a("/connect"),className:"px-3 py-1.5 text-xs font-semibold rounded-md transition-colors",style:{background:"var(--accent-primary)",color:"#000"},children:"+ Connect Agent"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-2.5",children:[e.jsxs(i,{label:"Total Agents",value:`${n}`,children:[e.jsxs("div",{className:"flex h-1 rounded-full overflow-hidden mt-2",style:{background:"var(--border-subtle)"},children:[m>0&&e.jsx("div",{className:"bg-emerald-500",style:{width:`${m/Math.max(n,1)*100}%`}}),u>0&&e.jsx("div",{className:"bg-amber-500",style:{width:`${u/Math.max(n,1)*100}%`}}),p>0&&e.jsx("div",{className:"bg-red-500",style:{width:`${p/Math.max(n,1)*100}%`}})]}),e.jsxs("div",{className:"flex gap-3 text-[9px] font-mono mt-1.5",style:{color:"var(--text-muted)"},children:[e.jsxs("span",{className:"text-emerald-500",children:["● ",m," ACT"]}),e.jsxs("span",{className:"text-amber-500",children:["● ",u," IDL"]}),e.jsxs("span",{className:"text-red-500",children:["● ",p," SUS"]})]})]}),e.jsx(i,{label:"Avg Trust",value:`${N}`,suffix:"%",valueColor:"text-emerald-500"}),e.jsx(i,{label:"Actions (24h)",value:w.toLocaleString(),valueColor:"text-blue-500"}),e.jsx(i,{label:"Fleet Latency",value:C,suffix:"ms"}),e.jsx(i,{label:"Total Warrants",value:((r==null?void 0:r.actionsToday)??0).toLocaleString(),valueColor:"text-amber-500"})]}),e.jsx("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)"},children:s.length===0?e.jsxs("div",{className:"p-12 text-center",children:[e.jsx("p",{className:"text-sm mb-2",style:{color:"var(--text-tertiary)"},children:"No agents registered yet"}),e.jsx("button",{onClick:()=>a("/connect"),className:"text-sm underline",style:{color:"var(--accent-primary)"},children:"Connect your first agent →"})]}):e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["Status","Agent ID","Name","Trust","Actions (24h)","Last Heartbeat","Latency",""].map(t=>e.jsx("th",{className:`py-3 px-4 text-[11px] font-semibold uppercase tracking-wider ${t==="Trust"||t==="Actions (24h)"||t==="Latency"?"text-right":"text-left"}`,style:{color:"var(--text-muted)"},children:t},t))})}),e.jsx("tbody",{children:s.map((t,l)=>{var y,b;return e.jsxs("tr",{className:"transition-colors hover:opacity-90 cursor-pointer",style:{borderBottom:"1px solid var(--border-subtle)",background:l%2===0?"transparent":"rgba(255, 255, 255, 0.02)"},onClick:()=>a(`/fleet/${t.agent_id}`),children:[e.jsx("td",{className:"py-2 px-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${S(t.status)}`}),e.jsx("span",{className:"text-[10px] font-mono font-semibold uppercase",style:{color:"var(--text-tertiary)"},children:_(t.status)})]})}),e.jsx("td",{className:"py-2 px-4",children:e.jsx("span",{className:"font-mono text-xs",style:{color:"var(--accent-primary)"},children:t.agent_id})}),e.jsx("td",{className:"py-2 px-4",children:e.jsx("span",{className:"font-mono text-xs",style:{color:"var(--text-primary)"},children:t.display_name||t.agent_id})}),e.jsx("td",{className:"py-2 px-4 text-right",children:e.jsxs("span",{className:`font-mono text-xs font-medium ${$(t.trust_score)}`,children:[((y=t.trust_score)==null?void 0:y.toFixed(1))??"—","%"]})}),e.jsx("td",{className:"py-2 px-4 text-right",children:e.jsx("span",{className:"font-mono text-xs",style:{color:"var(--text-secondary)"},children:(t.actions_today??0).toLocaleString()})}),e.jsx("td",{className:"py-2 px-4",children:e.jsx("span",{className:"font-mono text-xs",style:{color:"var(--text-muted)"},children:t.last_heartbeat?T(t.last_heartbeat):"—"})}),e.jsx("td",{className:"py-2 px-4 text-right",children:e.jsxs("span",{className:"font-mono text-xs",style:{color:"var(--text-tertiary)"},children:[((b=t.avg_latency_ms)==null?void 0:b.toFixed(0))??"—","ms"]})}),e.jsx("td",{className:"py-2 px-4 text-right",children:e.jsx("button",{className:"text-xs font-medium",style:{color:"var(--accent-primary)"},children:"Details →"})})]},t.id||t.agent_id)})})]})})]})})})}function i({label:a,value:s,suffix:d,valueColor:r,children:x}){return e.jsxs("div",{className:"rounded-md p-3.5 flex flex-col",style:{background:"var(--bg-secondary)",border:"1px solid var(--border-subtle)"},children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-muted)"},children:a}),e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:`font-mono text-2xl font-bold ${r||""}`,style:r?{}:{color:"var(--text-primary)"},children:s}),d&&e.jsx("span",{className:"font-mono text-[11px]",style:{color:"var(--text-tertiary)"},children:d})]}),x]})}function S(a){switch(a){case"active":return"bg-emerald-500";case"idle":return"bg-amber-500";case"suspended":return"bg-red-500";default:return"bg-gray-500"}}function _(a){switch(a){case"active":return"ACT";case"idle":return"IDL";case"suspended":return"SUS";default:return"UNK"}}function $(a){return a?a>=95?"text-emerald-500":a>=85?"text-amber-500":"text-red-500":""}function T(a){const s=Date.now()-new Date(a).getTime();return s<6e4?`${Math.floor(s/1e3)}s ago`:s<36e5?`${Math.floor(s/6e4)}m ago`:s<864e5?`${Math.floor(s/36e5)}h ago`:`${Math.floor(s/864e5)}d ago`}export{D as default};
-//# sourceMappingURL=FleetPremium-DwUXznBp.js.map
diff --git a/apps/console-proxy/public/assets/GovernanceChainPage-BrCtXDQy.js b/apps/console-proxy/public/assets/GovernanceChainPage-BrCtXDQy.js
deleted file mode 100644
index f81a41e2..00000000
--- a/apps/console-proxy/public/assets/GovernanceChainPage-BrCtXDQy.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import{a as _,r as m,j as e,S as y,v as j,w as E,C as f,T as I,Z as N,F as A,x as $}from"./index-D_7YXFSJ.js";import{E as O}from"./eye-46CiQ26c.js";import{L as R}from"./lock-BIMZjRC7.js";import{C as D}from"./circle-x-DJXSWLrE.js";import{C as F}from"./clock-DwbEOyPD.js";async function G(a="24h"){return _.get("/governance",{range:a})}async function L(a,o){const s={};return _.get(`/governance/chain/${a}`,s)}const w={intent:{icon:N,label:"Intent Submitted",color:"text-blue-400",bgColor:"bg-blue-500/10"},policy:{icon:A,label:"Policy Evaluated",color:"text-amber-400",bgColor:"bg-amber-500/10"},approval:{icon:f,label:"Approval",color:"text-amber-400",bgColor:"bg-amber-500/10"},warrant:{icon:R,label:"Warrant Issued",color:"text-green-400",bgColor:"bg-green-500/10"},execution:{icon:N,label:"Executed",color:"text-cyan-400",bgColor:"bg-cyan-500/10"},verification:{icon:O,label:"Verified",color:"text-amber-400",bgColor:"bg-amber-500/10"},attestation:{icon:y,label:"Attested",color:"text-emerald-400",bgColor:"bg-emerald-500/10"}},u={T0:"text-green-400 bg-green-500/10 border-green-500/30",T1:"text-amber-400 bg-amber-500/10 border-amber-500/30",T2:"text-red-400 bg-red-500/10 border-red-500/30",T3:"text-amber-400 bg-amber-500/10 border-amber-500/30"};function P({step:a}){const[o,s]=m.useState(!1),l=w[a.type]||w.intent,x=l.icon,p=a.status==="completed"?e.jsx(f,{className:"w-4 h-4 text-green-400"}):a.status==="failed"?e.jsx(D,{className:"w-4 h-4 text-red-400"}):a.status==="pending"?e.jsx(F,{className:"w-4 h-4 text-amber-400 animate-pulse"}):e.jsx("div",{className:"w-4 h-4 rounded-full bg-[var(--bg-tertiary)]"});return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-6 top-12 bottom-0 w-px bg-[var(--border-subtle)]"}),e.jsxs("div",{className:`p-4 rounded-lg border cursor-pointer transition-all ${a.status==="completed"?"border-[var(--border-default)] bg-[var(--bg-secondary)]":a.status==="failed"?"border-red-500/30 bg-red-500/5":a.status==="pending"?"border-amber-500/30 bg-amber-500/5":"border-[var(--border-subtle)] bg-[var(--bg-primary)] opacity-50"}`,onClick:()=>s(!o),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${l.bgColor}`,children:e.jsx(x,{className:`w-5 h-5 ${l.color}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:l.label}),p,a.duration_ms!==void 0&&e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:a.duration_ms<1e3?`${a.duration_ms}ms`:`${(a.duration_ms/1e3).toFixed(1)}s`})]}),e.jsx("div",{className:"text-sm text-[var(--text-secondary)] truncate",children:a.id})]}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)]",children:new Date(a.timestamp).toLocaleTimeString()}),e.jsx($,{className:`w-4 h-4 text-[var(--text-tertiary)] transition-transform ${o?"rotate-90":""}`})]}),o&&e.jsx("div",{className:"mt-3 pt-3 border-t border-[var(--border-subtle)]",children:e.jsx("pre",{className:"text-xs text-[var(--text-secondary)] bg-[var(--bg-primary)] p-3 rounded overflow-x-auto",children:JSON.stringify(a.data,null,2)})})]})]})}function X(){const[a,o]=m.useState(""),[s,l]=m.useState(null),[x,p]=m.useState(!1),[v,C]=m.useState([]);m.useEffect(()=>{S()},[]);async function S(){try{const t=(await G("24h")).recentChains.map(n=>{var c,g,b;return{intent_id:n.intent_id,agent_id:n.agent_id,action:n.action_type,risk_tier:((b=(g=(c=n.warrants)==null?void 0:c[0])==null?void 0:g.risk_tier)==null?void 0:b.toString())||"T0",steps:[],total_duration_ms:0,chain_valid:!0}});C(t)}catch{}}async function h(i){p(!0);try{const t=await L(i);if(!t){l(null);return}const n=[];let c="T0",g=(t==null?void 0:t.agent_id)||"unknown",b=(t==null?void 0:t.action_type)||"unknown";if(t!=null&&t.intent){const r=t.intent;n.push({id:r.id||"intent-"+Date.now(),type:"intent",status:"completed",timestamp:r.created_at||new Date().toISOString(),data:r})}(Array.isArray(t==null?void 0:t.evaluations)?t.evaluations:[]).forEach(r=>{n.push({id:r.id||"eval-"+Date.now(),type:"policy",status:r.result==="deny"?"failed":"completed",timestamp:r.evaluated_at||new Date().toISOString(),data:r})}),(Array.isArray(t==null?void 0:t.warrants)?t.warrants:[]).forEach(r=>{var d;c=((d=r.risk_tier)==null?void 0:d.toString())||c,n.push({id:r.id||"warrant-"+Date.now(),type:"warrant",status:r.status==="active"?"completed":"failed",timestamp:r.created_at||new Date().toISOString(),data:r})}),(Array.isArray(t==null?void 0:t.executions)?t.executions:[]).forEach(r=>{const d=String(r.event_type||"");n.push({id:r.execution_id||"exec-"+Date.now(),type:"execution",status:d.includes("failed")?"failed":"completed",timestamp:r.timestamp||new Date().toISOString(),data:r})}),n.sort((r,d)=>new Date(r.timestamp).getTime()-new Date(d.timestamp).getTime());const T=n[0]?new Date(n[0].timestamp).getTime():0,k=n[n.length-1]?new Date(n[n.length-1].timestamp).getTime():0;l({intent_id:i,agent_id:g,action:b,risk_tier:c,steps:n,total_duration_ms:k-T,chain_valid:n.every(r=>r.status!=="failed")})}catch(t){console.error("Failed to load governance chain:",t)}finally{p(!1)}}return e.jsxs("div",{className:"max-w-4xl mx-auto p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-[var(--text-primary)] flex items-center gap-3",children:[e.jsx(y,{className:"w-7 h-7 text-amber-400"}),"Governance Chain"]}),e.jsx("p",{className:"text-[var(--text-secondary)] mt-1",children:"Trace any action through the complete authorization chain — from intent to attestation."})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(j,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("input",{type:"text",placeholder:"Enter intent ID (e.g., int_1711900000_abc123)",value:a,onChange:i=>o(i.target.value),onKeyDown:i=>i.key==="Enter"&&a&&h(a),className:"w-full pl-10 pr-4 py-2.5 bg-[var(--bg-secondary)] border border-[var(--border-default)] rounded-lg text-[var(--text-primary)] placeholder:text-[var(--text-tertiary)] focus:outline-none focus:ring-2 focus:ring-[var(--accent-primary)]/50"})]}),e.jsxs("button",{onClick:()=>a&&h(a),disabled:x||!a,className:"px-4 py-2.5 bg-[var(--accent-primary)] text-white rounded-lg font-medium disabled:opacity-50 transition-colors hover:bg-[var(--accent-secondary)] flex items-center gap-2",children:[x?e.jsx(E,{className:"w-4 h-4 animate-spin"}):e.jsx(j,{className:"w-4 h-4"}),"Trace"]})]}),s&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-[var(--bg-secondary)] border border-[var(--border-default)] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`px-3 py-1 rounded-full border text-sm font-mono ${u[s.risk_tier]||u.T0}`,children:s.risk_tier}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-[var(--text-primary)]",children:s.action}),e.jsxs("div",{className:"text-sm text-[var(--text-secondary)]",children:["Agent: ",s.agent_id," · ",s.steps.length," steps · ",s.total_duration_ms,"ms total"]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:s.chain_valid?e.jsxs("div",{className:"flex items-center gap-1.5 text-green-400 text-sm",children:[e.jsx(f,{className:"w-4 h-4"}),"Chain Valid"]}):e.jsxs("div",{className:"flex items-center gap-1.5 text-red-400 text-sm",children:[e.jsx(I,{className:"w-4 h-4"}),"Chain Broken"]})})]}),e.jsx("div",{className:"space-y-3 pl-2",children:s.steps.map((i,t)=>e.jsx(P,{step:i},`${i.type}-${t}`))}),s.steps.length>0&&s.steps.length<7&&e.jsxs("div",{className:"p-3 bg-[var(--bg-secondary)] border border-[var(--border-subtle)] rounded-lg text-sm text-[var(--text-tertiary)]",children:[7-s.steps.length," step(s) not yet recorded in audit trail. The full chain is: Intent → Policy → Approval → Warrant → Execution → Verification → Attestation"]})]}),!s&&v.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)]",children:"Recent Intents"}),v.map((i,t)=>e.jsx("button",{onClick:()=>{o(i.intent_id),h(i.intent_id)},className:"w-full p-3 bg-[var(--bg-secondary)] border border-[var(--border-default)] rounded-lg text-left hover:bg-[var(--bg-hover)] transition-colors",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`px-2 py-0.5 rounded text-xs font-mono ${u[i.risk_tier]||u.T0}`,children:i.risk_tier}),e.jsx("span",{className:"font-mono text-sm text-[var(--text-primary)]",children:i.intent_id}),e.jsx("span",{className:"text-sm text-[var(--text-secondary)]",children:i.action})]})},t))]}),!s&&v.length===0&&!x&&e.jsxs("div",{className:"text-center py-16 text-[var(--text-tertiary)]",children:[e.jsx(y,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),e.jsx("p",{className:"text-lg",children:"Enter an intent ID to trace its governance chain"}),e.jsx("p",{className:"text-sm mt-2",children:"Every action in Vienna OS has a complete, cryptographically verifiable authorization chain."})]})]})}export{X as GovernanceChainPage,X as default};
-//# sourceMappingURL=GovernanceChainPage-BrCtXDQy.js.map
diff --git a/apps/console-proxy/public/assets/GovernanceLivePage-BuoY7Y-J.js b/apps/console-proxy/public/assets/GovernanceLivePage-BuoY7Y-J.js
deleted file mode 100644
index 0e342c55..00000000
--- a/apps/console-proxy/public/assets/GovernanceLivePage-BuoY7Y-J.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import{r as x,j as e,Z as C,U as S,S as I,T as v,C as j}from"./index-D_7YXFSJ.js";import{A as h}from"./activity-C-iTiNlh.js";import{L as E}from"./lock-BIMZjRC7.js";import{E as T}from"./eye-46CiQ26c.js";import{T as N}from"./trending-up-xPmnKzgu.js";import{C as R}from"./clock-DwbEOyPD.js";import{C as D}from"./circle-x-DJXSWLrE.js";const $={"intent.submitted":{icon:C,label:"Intent Submitted",color:"text-blue-400",bgColor:"bg-blue-500/10"},"intent.approved":{icon:j,label:"Intent Approved",color:"text-green-400",bgColor:"bg-green-500/10"},"intent.denied":{icon:D,label:"Intent Denied",color:"text-red-400",bgColor:"bg-red-500/10"},"warrant.issued":{icon:E,label:"Warrant Issued",color:"text-amber-400",bgColor:"bg-amber-500/10"},"warrant.expired":{icon:R,label:"Warrant Expired",color:"text-amber-400",bgColor:"bg-amber-500/10"},"warrant.tampered":{icon:v,label:"TAMPER DETECTED",color:"text-red-500",bgColor:"bg-red-500/20"},"approval.required":{icon:T,label:"Approval Required",color:"text-amber-400",bgColor:"bg-amber-500/10"},"approval.resolved":{icon:j,label:"Approval Resolved",color:"text-green-400",bgColor:"bg-green-500/10"},"agent.registered":{icon:S,label:"Agent Registered",color:"text-cyan-400",bgColor:"bg-cyan-500/10"},"execution.started":{icon:h,label:"Execution Started",color:"text-amber-400",bgColor:"bg-amber-500/10"},"execution.completed":{icon:j,label:"Execution Completed",color:"text-green-400",bgColor:"bg-green-500/10"},"execution.scope_drift":{icon:v,label:"Scope Drift!",color:"text-red-400",bgColor:"bg-red-500/10"},"anomaly.detected":{icon:v,label:"Anomaly Detected",color:"text-orange-400",bgColor:"bg-orange-500/10"}},k={T0:"bg-green-500/20 text-green-400 border-green-500/30",T1:"bg-amber-500/20 text-amber-400 border-amber-500/30",T2:"bg-red-500/20 text-red-400 border-red-500/30",T3:"bg-amber-500/20 text-amber-400 border-amber-500/30"};function g({icon:i,label:o,value:c,trend:n,color:l}){return e.jsxs("div",{className:"bg-[var(--bg-secondary)] border border-[var(--border-default)] rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx(i,{className:`w-5 h-5 ${l}`}),n==="up"&&e.jsx(N,{className:"w-4 h-4 text-green-400"}),n==="down"&&e.jsx(N,{className:"w-4 h-4 text-red-400 rotate-180"})]}),e.jsx("div",{className:"text-2xl font-bold text-[var(--text-primary)]",children:c}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:o})]})}function L({event:i}){const o=$[i.type]||{icon:h,label:i.type,color:"text-slate-400",bgColor:"bg-slate-500/10"},c=o.icon,n=i.data||{},l=n.risk_tier||"",b=n.agent_id||"",d=n.warrant_id||"",u=n.action||"";return e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-[var(--bg-secondary)] border border-[var(--border-subtle)] rounded-lg animate-in fade-in slide-in-from-top-2 duration-300",children:[e.jsx("div",{className:`p-1.5 rounded ${o.bgColor}`,children:e.jsx(c,{className:`w-4 h-4 ${o.color}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`font-medium text-sm ${o.color}`,children:o.label}),l&&e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded border ${k[l]||""}`,children:l})]}),e.jsxs("div",{className:"text-xs text-[var(--text-tertiary)] truncate",children:[b&&e.jsxs("span",{children:["Agent: ",b]}),u&&e.jsxs("span",{children:[" · ",u]}),d&&e.jsxs("span",{children:[" · ",d.slice(0,16)]})]})]}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)] whitespace-nowrap",children:new Date(i.timestamp).toLocaleTimeString()})]})}function J(){const[i,o]=x.useState([]),[c,n]=x.useState({intents_per_minute:0,warrants_active:0,approvals_pending:0,agents_active:0,chain_length:0,anomalies_24h:0}),[l,b]=x.useState(!1),[d,u]=x.useState(!1),A=x.useRef(null),y=100;x.useEffect(()=>{const t=new EventSource("/api/v1/stream");A.current=t,t.onopen=()=>b(!0),t.onerror=()=>b(!1),t.onmessage=a=>{try{const r=JSON.parse(a.data);if(r.type==="heartbeat")return;const m={id:r.id||`evt_${Date.now()}`,type:r.type||r.event||"unknown",timestamp:r.timestamp||new Date().toISOString(),data:r.data||r};d||(o(p=>[m,...p].slice(0,y)),w(m))}catch{}};const s=["intent.submitted","intent.approved","intent.denied","warrant.issued","warrant.expired","approval.required","approval.resolved","agent.registered","execution.started","execution.completed"];for(const a of s)t.addEventListener(a,r=>{try{const m=JSON.parse(r.data),p={id:`${a}_${Date.now()}`,type:a,timestamp:new Date().toISOString(),data:m};d||(o(f=>[p,...f].slice(0,y)),w(p))}catch{}});return()=>t.close()},[d]),x.useEffect(()=>{fetch("/api/v1/governance?range=24h",{credentials:"include"}).then(t=>t.json()).then(t=>{if(t.success&&t.data){const s=t.data;n(a=>{var r,m,p;return{...a,warrants_active:((r=s.warrantStatus)==null?void 0:r.reduce((f,_)=>f+(_.status==="active"?parseInt(_.count,10):0),0))||0,approvals_pending:(m=s.chainStats)!=null&&m.pending_chains?parseInt(s.chainStats.pending_chains,10):0,chain_length:(p=s.chainStats)!=null&&p.completed_chains?parseInt(s.chainStats.completed_chains,10):0}})}}).catch(()=>{}),fetch("/api/v1/fleet/agents",{credentials:"include"}).then(t=>t.json()).then(t=>{t.success&&t.data&&n(s=>({...s,agents_active:t.data.length||0}))}).catch(()=>{})},[]);const w=x.useCallback(t=>{n(s=>{const a={...s};return t.type.includes("intent.submitted")&&a.intents_per_minute++,t.type.includes("warrant.issued")&&a.warrants_active++,t.type.includes("warrant.expired")&&(a.warrants_active=Math.max(0,a.warrants_active-1)),t.type.includes("approval.required")&&a.approvals_pending++,t.type.includes("approval.resolved")&&(a.approvals_pending=Math.max(0,a.approvals_pending-1)),t.type.includes("anomaly")&&a.anomalies_24h++,t.type.includes("warrant")&&t.type.includes("chained")&&a.chain_length++,a})},[]);return e.jsxs("div",{className:"max-w-6xl mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-[var(--text-primary)] flex items-center gap-3",children:[e.jsx(h,{className:"w-7 h-7 text-amber-400"}),"Governance Live"]}),e.jsx("p",{className:"text-[var(--text-secondary)] mt-1",children:"Real-time governance pipeline activity"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:`flex items-center gap-2 text-sm ${l?"text-green-400":"text-red-400"}`,children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${l?"bg-green-400 animate-pulse":"bg-red-400"}`}),l?"Connected":"Disconnected"]}),e.jsx("button",{onClick:()=>u(!d),className:`px-3 py-1.5 rounded-lg text-sm font-medium transition ${d?"bg-green-500/20 text-green-400 hover:bg-green-500/30":"bg-amber-500/20 text-amber-400 hover:bg-amber-500/30"}`,children:d?"▶ Resume":"⏸ Pause"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:[e.jsx(g,{icon:C,label:"Intents / min",value:c.intents_per_minute,color:"text-blue-400"}),e.jsx(g,{icon:E,label:"Active Warrants",value:c.warrants_active,color:"text-amber-400"}),e.jsx(g,{icon:T,label:"Pending Approvals",value:c.approvals_pending,color:"text-amber-400"}),e.jsx(g,{icon:S,label:"Active Agents",value:c.agents_active,color:"text-cyan-400"}),e.jsx(g,{icon:I,label:"Chain Length",value:c.chain_length,color:"text-green-400"}),e.jsx(g,{icon:v,label:"Anomalies (24h)",value:c.anomalies_24h,color:"text-orange-400"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--text-primary)]",children:"Event Stream"}),e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)]",children:[i.length," events"]})]}),e.jsx("div",{className:"space-y-2 max-h-[600px] overflow-y-auto",children:i.length===0?e.jsxs("div",{className:"text-center py-16 text-[var(--text-tertiary)]",children:[e.jsx(h,{className:"w-12 h-12 mx-auto mb-4 opacity-30 animate-pulse"}),e.jsx("p",{children:"Waiting for governance events..."}),e.jsx("p",{className:"text-sm mt-2",children:"Events will appear here in real-time as agents submit intents."})]}):i.map(t=>e.jsx(L,{event:t},t.id))})]})]})}export{J as GovernanceLivePage,J as default};
-//# sourceMappingURL=GovernanceLivePage-BuoY7Y-J.js.map
diff --git a/apps/console-proxy/public/assets/HistoryPage-C1gCvivw.js b/apps/console-proxy/public/assets/HistoryPage-Ck44Svwk.js
similarity index 98%
rename from apps/console-proxy/public/assets/HistoryPage-C1gCvivw.js
rename to apps/console-proxy/public/assets/HistoryPage-Ck44Svwk.js
index e02a756d..90c1deaa 100644
--- a/apps/console-proxy/public/assets/HistoryPage-C1gCvivw.js
+++ b/apps/console-proxy/public/assets/HistoryPage-Ck44Svwk.js
@@ -1,4 +1,4 @@
-import{r as c,j as t,b as x}from"./index-D_7YXFSJ.js";import{P as h}from"./PageLayout-CTYKc2go.js";function v(a,r){const o=[];r.forEach((n,l)=>{l>0&&o.push(""),o.push(`# ${n.title}`),n.headers&&o.push(n.headers.join(",")),n.rows.forEach(d=>{o.push(d.map(p=>{const s=String(p).replace(/"/g,'""');return s.includes(",")||s.includes('"')||s.includes(`
+import{r as c,j as t,g as x}from"./index-C0nK3ekl.js";import{P as h}from"./PageLayout-D94mSHCV.js";function v(a,r){const o=[];r.forEach((n,l)=>{l>0&&o.push(""),o.push(`# ${n.title}`),n.headers&&o.push(n.headers.join(",")),n.rows.forEach(d=>{o.push(d.map(p=>{const s=String(p).replace(/"/g,'""');return s.includes(",")||s.includes('"')||s.includes(`
`)?`"${s}"`:s}).join(","))})});const e=new Blob([o.join(`
`)],{type:"text/csv;charset=utf-8;"});j(e,a)}function y(a,r){const o=window.open("","_blank");if(!o)return;const e=`
@@ -51,4 +51,4 @@ import{r as c,j as t,b as x}from"./index-D_7YXFSJ.js";import{P as h}from"./PageL
<\/script>