import {useEffect,useState} from 'react'; import Button from './ui/Button'; import {runtime} from '../services/runtime'; import type {RuntimeProvenance,RuntimeHealth,RuntimeProfile,RuntimeStatus,RuntimeSessions,RuntimeUsage} from '../services/runtime'; function Snapshot({value}:{value?:RuntimeProvenance}){return value?

Snapshot inventory · Captured at: {value.capturedAt} · Age: {value.ageSeconds} seconds · {value.freshness} · Live process: {value.liveProcess}. Even fresh snapshots are not live readiness.

:null} export default function RuntimeReadPanel(){ const [revision,setRevision]=useState(0);const [profile,setProfile]=useState('');const [offset,setOffset]=useState(0); const [health,setHealth]=useState(null);const [profiles,setProfiles]=useState([]);const [errors,setErrors]=useState>({}); const [status,setStatus]=useState(null);const [sessions,setSessions]=useState(null);const [usage,setUsage]=useState(null); const [observed,setObserved]=useState(''); useEffect(()=>{let active=true;setHealth(null);setProfiles([]);setErrors({}); runtime.health().then(value=>{if(active){setHealth(value);setObserved(new Date().toISOString())}}).catch(()=>{if(active)setErrors(e=>({...e,health:'Health unavailable — authenticated backend runtime read failed.'}))}); runtime.profiles().then(value=>{if(active){setProfiles(value);setProfile(current=>value.some(p=>p.name===current)?current:'')}}).catch(()=>{if(active){setProfile('');setErrors(e=>({...e,profiles:'Profiles unavailable — no authorized runtime identity list.'}))}}); return ()=>{active=false}; },[revision]); useEffect(()=>{let active=true;setStatus(null);setSessions(null);setUsage(null);setErrors(e=>({health:e.health,profiles:e.profiles}));if(!profile)return; const fail=(name:string)=>{if(active)setErrors(e=>({...e,[name]:name+' unavailable — no fallback values.'}))}; runtime.status(profile).then(v=>{if(active)setStatus(v)}).catch(()=>fail('Status')); runtime.sessions(profile,offset).then(v=>{if(active)setSessions(v)}).catch(()=>fail('Sessions')); runtime.usage(profile).then(v=>{if(active)setUsage(v)}).catch(()=>fail('Usage')); return ()=>{active=false}; },[profile,offset,revision]); return

Hermes runtime — backend authenticated reads

No browser runtime credentials or direct Hermes connection. Refresh observations are not heartbeat timestamps.

{Object.entries(errors).filter(([,message])=>message).map(([name,message])=>

{message}

)} {health&&

Inventory service: {health.ok?'responsive':'not responsive'} (not live Hermes health)

{health.version} · {health.commit}

Client observed at: {observed}. Client receipt time only; not capture time or live heartbeat.

} {!profiles.length&&!errors.profiles&&

No authorized profiles returned.

} {profiles.map(p=>
{p.name} · Gateway {p.provenance?'unknown (snapshot; not process readiness)':p.gateway_running?'running':'stopped'} · {p.is_default?'default profile':'non-default profile'}
)} {status&&

Profile status

{status.overall}

Gateway: {status.provenance?'unknown':status.gateway_running?'running':'stopped'} · State: {status.provenance?'unknown':status.gateway_state??'Unknown'} · Active agents: {status.provenance?'unknown':status.active_agents}

} {usage&&

Runtime usage — {usage.period_days} days, selected profile only

Input tokens: {usage.totals.total_input}

Output tokens: {usage.totals.total_output}

Sessions: {usage.totals.total_sessions}

Upstream estimated cost: {usage.totals.total_estimated_cost} (currency unspecified by source; not settled billing)

Do not add this to 9router totals; attribution overlaps and is not reconciled.

} {sessions&&

Sessions — {sessions.total} returned total

{!sessions.sessions.length&&

No sessions returned.

}{sessions.sessions.map(s=>

{s.id} · {s.profile} · {s.source} · {sessions.provenance?`historical snapshot flag: ${s.is_active?'active':'inactive'}; live activity unknown`:s.is_active?'active':'inactive'}

)}
}
; }