/** Failure Evidence Graph rendered as a status-colored node panel. */ import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import type { EvidenceGraph } from '../../types/agentic'; import { EVIDENCE_STATUS_COLORS, EvidenceStatusChip, PanelTitle } from './common'; const NODE_ORDER = [ 'Object', 'Environment', 'Sensors', 'Prediction', 'GroundTruth', 'Tracking', 'Planner', 'HistoricalSimilarity', 'Frequency', 'SafetyConsequence', ]; export default function EvidenceGraphPanel({ graph }: { graph: EvidenceGraph }) { const byId = new Map(graph.nodes.map((n) => [n.node_id, n])); const nodes = [...graph.nodes].sort( (a, b) => NODE_ORDER.indexOf(a.node_type) - NODE_ORDER.indexOf(b.node_type) ); return ( {(['OBSERVED', 'DERIVED', 'HYPOTHESIS', 'UNAVAILABLE'] as const).map((s) => ( ))} } /> {nodes.map((n) => ( {n.node_type} {n.summary} {n.caveats.length > 0 ? ( {n.caveats.join(' · ')} ) : null} source: {n.source} ))} Relations:{' '} {graph.edges .map( (e) => `${byId.get(e.src)?.node_type ?? '?'} —${e.relation}→ ${byId.get(e.dst)?.node_type ?? '?'}` ) .join(' · ')} ); }