import { useEffect, useState } from "react"; export default function App() { const [health, setHealth] = useState(null); const [runs, setRuns] = useState([]); const [selected, setSelected] = useState(null); const [metrics, setMetrics] = useState(null); const [eventId, setEventId] = useState(""); const [question, setQuestion] = useState(""); const [explanation, setExplanation] = useState(null); const [error, setError] = useState(""); useEffect(() => { Promise.all([ fetch("/api/health").then((r) => r.json()), fetch("/api/runs").then((r) => r.json()), fetch("/api/metrics").then((r) => r.json()), ]) .then(([healthBody, runsBody, metricsBody]) => { setHealth(healthBody); setRuns(runsBody.runs || []); setMetrics(metricsBody); }) .catch((err) => setError(String(err))); }, []); function openRun(runId) { fetch(`/api/runs/${runId}`) .then((r) => r.json()) .then(setSelected) .catch((err) => setError(String(err))); } function requestExplanation(event) { event.preventDefault(); setExplanation(null); fetch("/api/explanations", { method: "POST", headers: { "Content-Type": "application/json", "Idempotency-Key": `dashboard-${Date.now()}`, }, body: JSON.stringify({ event_id: eventId, question }), }) .then((response) => response.json().then((body) => ({ response, body }))) .then(({ response, body }) => { if (!response.ok) throw new Error(body.detail || "Explanation request failed"); setExplanation(body); }) .catch((err) => setError(String(err))); } return (

Simulation evidence only. Not a live-city deployment. No lives saved. No measured air quality. No best-episode headline.

CoFlow-5 Synapse

Read-only view of tagged evidence bundles. This UI cannot reach TraCI.

{error ?

{error}

: null} {health ? (

API health: {health.status}. Actuates: {String(health.actuates)}. SUMO in process: {String(health.sumo)}.

) : (

Loading API health…

)}

Explanation quality

{metrics?.abstention_rate ?? "—"}abstention rate
{metrics?.fallback_rate ?? "—"}fallback rate
{metrics?.average_latency_ms ?? "—"}average latency ms
{metrics?.cost_units ?? "—"}cost units

Explain a frozen decision

{explanation ? (
{explanation.fallback}

{explanation.answer}

Citations: {explanation.citations?.join(", ") || "none"}

{JSON.stringify(explanation.provenance, null, 2)}
) : null}

Runs

{runs.length === 0 ? (

No tagged bundles in the evidence root yet.

) : ( )} {selected ? (

Manifest {selected.run_id}

Measured J0 evidence: frozen simulation artifact; not deployment evidence.

{JSON.stringify(selected, null, 2)}
) : null}
); }