1import{u as p,r as b,j as s}from"./index-B3LkCOOS.js";import{k as N}from"./platform-admin.functions-ZmCsXMwx.js";import{H as v,c as _}from"./contracts-CUpHHkMi.js";import{u as f,E as g,P as i,a as o,c as n,C as r,f as d}from"./pieces-BoeW08zD.js";const y=[{hours:1,label:"1H"},{hours:24,label:"24H"},{hours:168,label:"7D"},{hours:720,label:"30D"}];function k({signal:a}){const l=v[a.state],c=a.state==="no_data"||a.state==="unavailable";return s.jsxs("div",{className:"pa-kpi","data-tone":l??void 0,children:[s.jsxs("div",{className:"pa-kpi-label",children:[a.label,s.jsx(r,{tone:l,children:_[a.state]})]}),s.jsx("div",{className:"pa-kpi-value","data-unavailable":c,children:a.rate==null?"â":`${(a.rate*100).toFixed(2)}%`}),s.jsx("div",{className:"pa-kpi-delta",children:a.state==="unavailable"?a.source:a.observed===0?"Nothing observed in this window":`${d(a.failed??0)} failed of ${d(a.observed??0)}`}),a.p95_ms!=null?s.jsxs("div",{className:"pa-sub",children:["p95 ",d(a.p95_ms),"ms"]}):null,a.auto_disabled?s.jsxs("div",{className:"pa-sub",children:[d(a.auto_disabled)," endpoint auto-disabled"]}):null]})}function w(){const a=p(N),[l,c]=b.useState(24),{data:t,loading:u,error:h}=f(()=>a({data:{hours:l}}),[l]),m=t?.signals.filter(e=>(e.observed??0)>0).length??0,x=(t?.signals.length??0)-m;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"pa-page-head",children:[s.jsxs("div",{children:[s.jsx("h2",{children:"System"}),s.jsx("p",{children:"Health of the platformâs own machinery, from its own records."})]}),s.jsx("span",{style:{flex:1}}),s.jsx("div",{className:"pa-tabs",role:"tablist",children:y.map(e=>s.jsx("button",{type:"button",role:"tab","aria-selected":l===e.hours,onClick:()=>c(e.hours),children:e.label},e.hours))})]}),h?s.jsx(g,{message:h}):null,u&&!t?s.jsx("div",{className:"pa-notice",children:"Loadingâ¦"}):null,t?s.jsxs(s.Fragment,{children:[x>0?s.jsxs("div",{className:"pa-notice","data-tone":"warn",children:[s.jsxs("strong",{children:[x," of ",t.signals.length," signals have no observations in this window."]})," ","That is not the same as healthy â it means nothing has been recorded to judge. These tables fill as the platform is used."]}):null,s.jsx("div",{className:"pa-kpis",children:t.signals.map(e=>s.jsx(k,{signal:e},e.key))}),s.jsxs("div",{className:"pa-detail",children:[s.jsx(i,{title:"Recent errors",count:t.recent_errors.length,children:t.recent_errors.length===0?s.jsx(o,{children:"No API request in this window returned an error."}):s.jsx("div",{className:"pa-table-wrap",children:s.jsxs("table",{className:"pa-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"When"}),s.jsx("th",{children:"Request"}),s.jsx("th",{className:"pa-num",children:"Status"}),s.jsx("th",{children:"Code"}),s.jsx("th",{className:"pa-num",children:"ms"})]})}),s.jsx("tbody",{children:t.recent_errors.map((e,j)=>s.jsxs("tr",{children:[s.jsx("td",{className:"pa-sub",children:n(e.created_at)}),s.jsx("td",{children:s.jsxs("code",{children:[e.method??"â"," ",e.path??"â"]})}),s.jsx("td",{className:"pa-num",children:s.jsx(r,{tone:(e.status_code??0)>=500?"bad":"warn",children:e.status_code??"â"})}),s.jsx("td",{className:"pa-sub",children:e.error_code??"â"}),s.jsx("td",{className:"pa-num",children:e.duration_ms??"â"})]},`${e.created_at}-${j}`))})]})})}),s.jsxs("div",{style:{display:"grid",gap:12},children:[s.jsx(i,{title:"Failing webhook endpoints",count:t.failing_endpoints.length,children:t.failing_endpoints.length===0?s.jsx(o,{children:"No endpoint is currently failing or auto-disabled."}):s.jsx("div",{className:"pa-table-wrap",children:s.jsxs("table",{className:"pa-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Endpoint"}),s.jsx("th",{className:"pa-num",children:"Failures"}),s.jsx("th",{children:"Last"})]})}),s.jsx("tbody",{children:t.failing_endpoints.map(e=>s.jsxs("tr",{children:[s.jsxs("td",{children:[e.name??"Unnamed",s.jsx("div",{className:"pa-sub",children:e.url}),e.disabled_reason?s.jsxs("div",{className:"pa-sub",children:["Disabled: ",e.disabled_reason]}):null]}),s.jsx("td",{className:"pa-num",children:s.jsx(r,{tone:"bad",children:e.consecutive_failures??0})}),s.jsxs("td",{className:"pa-sub",children:[e.last_delivery_status??"â",s.jsx("div",{children:n(e.last_delivery_at)})]})]},e.id))})]})})}),s.jsx(i,{title:"Jobs needing attention",count:t.stuck_jobs.length,children:t.stuck_jobs.length===0?s.jsx(o,{children:"No background job is failed or still running."}):s.jsx("div",{className:"pa-table-wrap",children:s.jsxs("table",{className:"pa-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Kind"}),s.jsx("th",{children:"Status"}),s.jsx("th",{children:"Started"})]})}),s.jsx("tbody",{children:t.stuck_jobs.map(e=>s.jsxs("tr",{children:[s.jsxs("td",{children:[e.kind,e.last_error?s.jsx("div",{className:"pa-sub",children:e.last_error}):null]}),s.jsx("td",{children:s.jsx(r,{tone:e.status==="failed"?"bad":"warn",children:e.status??"â"})}),s.jsx("td",{className:"pa-sub",children:n(e.created_at)})]},`${e.kind}-${e.id}`))})]})})}),s.jsx(i,{title:"Rate limiting",children:s.jsxs("div",{className:"pa-panel-body",children:[s.jsxs("dl",{className:"pa-facts",children:[s.jsx("dt",{children:"AI requests counted"}),s.jsx("dd",{children:d(t.rate_limit_requests)}),s.jsx("dt",{children:"Window"}),s.jsxs("dd",{className:"pa-sub",children:[n(t.window.since)," â ",n(t.window.now)]})]}),s.jsxs("p",{className:"pa-sub",style:{marginTop:8},children:["Counted from ",s.jsx("code",{children:"ai_rate_limit_windows"}),". A rising count is load, not an incident; a signal turning red above is an incident."]})]})})]})]})]}):null]})}const T=w;export{T as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.