Spaces:
Paused
Paused
Deploy Sensorflow Studio (part 3)
Browse filesFiles changed (11)
- src/App.tsx+13-8
- src/components/help/HelpMenu.tsx+3-1
- src/components/rotr/RotrAttributionHeatmap.tsxAdded+140
- src/components/rotr/RotrBevReplay.tsxAdded+225
- src/components/rotr/RotrQueryBuilder.tsxAdded+128
- src/content/glossary.ts+95-57
- src/content/pageHelp.ts+48-36
- src/context/LabelEvalContext.tsx+3-1
- src/pages/rotr/RotrControlCenterPage.tsxAdded+843
- src/services/rotr.tsAdded+134
- src/types/rotr.tsAdded+292
40 unmodified lines414243444546474849505152535430 unmodified lines858687888990919293949548 unmodified lines14414514614714814915015115238 unmodified lines191192193194195196197198244 unmodified lines44344444544644744844945045145240 unmodified linesSparkles,LineChart,Layers,RefreshCcwDot,ClipboardCheck,BadgeCheck,Shapes,Network,LayoutGrid,Undo2,Scale,} from 'lucide-react';import { LabelEvalContext, type PageId, ALL_PAGE_IDS } from './context/LabelEvalContext';import { getOverview, useStream } from './services/labeleval';30 unmodified linesimport ScenarioComposerPage from './pages/studio/ScenarioComposerPage';import PipelineBuilderPage from './pages/studio/PipelineBuilderPage';import MyDashboardPage from './pages/studio/MyDashboardPage';import ClosedLoopLabPage from './pages/nextgen/ClosedLoopLabPage';import Studio2GovernancePage from './pages/studio2/Studio2GovernancePage';import ProductionReadinessPage from './pages/hardening/ProductionReadinessPage';import RetroAnalyzerPage from './pages/retro/RetroAnalyzerPage';import LaunchReadinessPage from './pages/agentic/LaunchReadinessPage';import PageIntro from './components/help/PageIntro';import HelpMenu from './components/help/HelpMenu';48 unmodified lines{ id: 'safety-discrepancy', label: 'Discrepancy Mining', icon: <GitCompareArrows size={18} /> },{ id: 'safety-scenarios', label: 'Scenario DB', icon: <Library size={18} /> },{ id: 'safety-search', label: 'Semantic Search', icon: <Sparkles size={18} /> },{ id: 'studio2', label: 'Studio 2.0 Governance', icon: <ClipboardCheck size={18} /> },{ id: 'retro', label: 'Retrospective Analyzer', icon: <Undo2 size={18} /> },{ id: 'launch-readiness', label: 'Launch Readiness', icon: <Scale size={18} /> },];const LEGACY_NAV: NavItem[] = [38 unmodified lines'closed-loop-lab': 'Closed-Loop Lab','launch-readiness': 'Launch Readiness (Agentic Triage)',studio2: 'Studio 2.0 Governance (Control Plane & Release)','production-readiness': 'Production Readiness (Hardening Audit)',legacy: 'Legacy Studio',};function parseHash(): { page: PageId; entityId: string | null } {244 unmodified lines{page === 'pipeline-builder' ? <PipelineBuilderPage /> : null}{page === 'my-dashboard' ? <MyDashboardPage /> : null}{page === 'retro' ? <RetroAnalyzerPage /> : null}{page === 'launch-readiness' ? <LaunchReadinessPage /> : null}{page === 'closed-loop-lab' ? <ClosedLoopLabPage /> : null}{page === 'studio2' ? <Studio2GovernancePage /> : null}{page === 'production-readiness' ? <ProductionReadinessPage /> : null}</Box>)}</Box>40 unmodified lines41424344454647484950515253545530 unmodified lines86878889909192939495969748 unmodified lines14614714814915015115215315415538 unmodified lines194195196197198199200201202244 unmodified lines44744844945045145245345445545645740 unmodified linesSparkles,LineChart,Layers,Shapes,Network,LayoutGrid,Undo2,RefreshCcwDot,Scale,ClipboardCheck,BadgeCheck,TrafficCone,} from 'lucide-react';import { LabelEvalContext, type PageId, ALL_PAGE_IDS } from './context/LabelEvalContext';import { getOverview, useStream } from './services/labeleval';30 unmodified linesimport ScenarioComposerPage from './pages/studio/ScenarioComposerPage';import PipelineBuilderPage from './pages/studio/PipelineBuilderPage';import MyDashboardPage from './pages/studio/MyDashboardPage';import RetroAnalyzerPage from './pages/retro/RetroAnalyzerPage';import ClosedLoopLabPage from './pages/nextgen/ClosedLoopLabPage';import LaunchReadinessPage from './pages/agentic/LaunchReadinessPage';import Studio2GovernancePage from './pages/studio2/Studio2GovernancePage';import ProductionReadinessPage from './pages/hardening/ProductionReadinessPage';import RotrControlCenterPage from './pages/rotr/RotrControlCenterPage';import PageIntro from './components/help/PageIntro';import HelpMenu from './components/help/HelpMenu';48 unmodified lines{ id: 'safety-discrepancy', label: 'Discrepancy Mining', icon: <GitCompareArrows size={18} /> },{ id: 'safety-scenarios', label: 'Scenario DB', icon: <Library size={18} /> },{ id: 'safety-search', label: 'Semantic Search', icon: <Sparkles size={18} /> },{ id: 'retro', label: 'Retrospective Analyzer', icon: <Undo2 size={18} /> },{ id: 'launch-readiness', label: 'Launch Readiness', icon: <Scale size={18} /> },{ id: 'studio2', label: 'Studio 2.0 Governance', icon: <ClipboardCheck size={18} /> },{ id: 'rotr', label: 'ROTR Control Center', icon: <TrafficCone size={18} /> },];const LEGACY_NAV: NavItem[] = [38 unmodified lines'closed-loop-lab': 'Closed-Loop Lab','launch-readiness': 'Launch Readiness (Agentic Triage)',studio2: 'Studio 2.0 Governance (Control Plane & Release)',legacy: 'Legacy Studio','production-readiness': 'Production Readiness (Hardening Audit)',rotr: 'ROTR Control Center (Right-of-the-Road)',};function parseHash(): { page: PageId; entityId: string | null } {244 unmodified lines{page === 'pipeline-builder' ? <PipelineBuilderPage /> : null}{page === 'my-dashboard' ? <MyDashboardPage /> : null}{page === 'retro' ? <RetroAnalyzerPage /> : null}{page === 'closed-loop-lab' ? <ClosedLoopLabPage /> : null}{page === 'launch-readiness' ? <LaunchReadinessPage /> : null}{page === 'studio2' ? <Studio2GovernancePage /> : null}{page === 'production-readiness' ? <ProductionReadinessPage /> : null}{page === 'rotr' ? <RotrControlCenterPage /> : null}</Box>)}</Box>
200 unmodified lines20120220320420520620720820921021135 unmodified lines247248249250251252200 unmodified lines'safety-scenarios','safety-search','retro','closed-loop-lab','launch-readiness','studio2','legacy','production-readiness',];const PAGE_NAMES: Record<PageId, string> = {35 unmodified linesstudio2: 'Studio 2.0 Governance',legacy: 'Legacy Studio','production-readiness': 'Production Readiness',};function PageIndex({ goTo }: { goTo: (p: PageId) => void }) {200 unmodified lines20120220320420520620720820921021121235 unmodified lines248249250251252253254200 unmodified lines'safety-scenarios','safety-search','retro','launch-readiness','closed-loop-lab','studio2','legacy','production-readiness','rotr',];const PAGE_NAMES: Record<PageId, string> = {35 unmodified linesstudio2: 'Studio 2.0 Governance',legacy: 'Legacy Studio','production-readiness': 'Production Readiness',rotr: 'ROTR Control Center',};function PageIndex({ goTo }: { goTo: (p: PageId) => void }) {
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140/** * Attribution-matrix heatmap: one row per violation, one column per causal * layer. Cell color encodes tri-state evidence (SUPPORTED / RULED_OUT / * UNKNOWN); the primary layer carries a ring. Clicking a row selects the * violation for the consequence replay view. */
import Box from '@mui/material/Box';import Chip from '@mui/material/Chip';import Tooltip from '@mui/material/Tooltip';import Typography from '@mui/material/Typography';import type { RotrAttributionMatrix } from '../../types/rotr';
const LAYERS = [ 'perception', 'prediction', 'planning', 'localization', 'map', 'control', 'policy_rule', 'data_label',];
const STATUS_COLOR: Record<string, string> = { SUPPORTED: '#c62828', RULED_OUT: '#1b5e20', UNKNOWN: '#616161',};
interface Props { matrix: RotrAttributionMatrix; selectedViolationId: string | null; onSelect: (violationId: string) => void;}
export default function RotrAttributionHeatmap({ matrix, selectedViolationId, onSelect }: Props) { return ( <Box sx={{ overflowX: 'auto' }}> <Box sx={{ display: 'flex', gap: 1, mb: 1, alignItems: 'center', flexWrap: 'wrap' }}> {Object.entries(STATUS_COLOR).map(([status, color]) => ( <Chip key={status} size="small" label={status} sx={{ bgcolor: color, color: '#fff', fontSize: 10, height: 18 }} /> ))} <Typography variant="caption" sx={{ color: '#8a949e' }}> ring = primary layer (highest-confidence positive evidence) </Typography> </Box> <table style={{ borderCollapse: 'separate', borderSpacing: 3 }}> <thead> <tr> <th style={{ textAlign: 'left', fontSize: 11, color: '#8a949e', paddingRight: 8 }}> violation </th> {LAYERS.map((l) => ( <th key={l} style={{ fontSize: 10, color: '#8a949e', writingMode: 'vertical-rl', transform: 'rotate(180deg)', padding: '2px 0', }} > {l} </th> ))} </tr> </thead> <tbody> {matrix.rows.map((row) => { const selected = row.violation_id === selectedViolationId; return ( <tr key={row.violation_id} onClick={() => onSelect(row.violation_id)} style={{ cursor: 'pointer' }} > <td style={{ fontSize: 11, fontFamily: 'monospace', color: selected ? '#4fc3f7' : '#c9d1d9', paddingRight: 8, whiteSpace: 'nowrap', borderLeft: selected ? '3px solid #4fc3f7' : '3px solid transparent', paddingLeft: 5, }} > {row.violation_id.replace(/^bank-[0-9a-f]+-/, '')} </td> {LAYERS.map((layer) => { const cell = row.layers[layer]; const status = cell?.status ?? 'UNKNOWN'; const isPrimary = row.primary_layer === layer; return ( <Tooltip key={layer} title={ <Box sx={{ maxWidth: 340 }}> <b> {layer}: {status} </b>{' '} (conf {cell ? cell.confidence.toFixed(2) : '—'}) <br /> {cell?.evidence ?? 'no evidence recorded'} </Box> } arrow > <td style={{ width: 26, height: 20, background: STATUS_COLOR[status], opacity: status === 'SUPPORTED' ? (cell ? 0.45 + 0.55 * cell.confidence : 1) : 0.85, borderRadius: 3, outline: isPrimary ? '2px solid #ffb300' : 'none', outlineOffset: -2, }} /> </Tooltip> ); })} </tr> ); })} </tbody> </table> <Typography variant="caption" sx={{ color: '#8a949e', display: 'block', mt: 1 }}> {matrix.invariant} </Typography> </Box> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225/** * BEV schematic replay of one violation: top-down road geometry (lanes, * stop line, crosswalk, intersection box), actor positions at the scrubbed * time, and the OBSERVED vs CORRECTED ego trajectories from the * counterfactual replay. */
import { useMemo, useState } from 'react';import Box from '@mui/material/Box';import Chip from '@mui/material/Chip';import Slider from '@mui/material/Slider';import Typography from '@mui/material/Typography';import type { RotrConsequenceDetail, RotrTrajectoryPoint } from '../../types/rotr';
const W = 860;const H = 340;const PAD = 24;
const ACTOR_COLOR: Record<string, string> = { pedestrian: '#ffb300', cyclist: '#ff7043', vehicle: '#ab47bc', bus: '#7e57c2',};
interface Props { detail: RotrConsequenceDetail;}
function nearest(traj: RotrTrajectoryPoint[], t: number): RotrTrajectoryPoint | null { if (!traj.length) return null; let best = traj[0]; for (const p of traj) if (Math.abs(p.t - t) < Math.abs(best.t - t)) best = p; return best;}
export default function RotrBevReplay({ detail }: Props) { const obs = detail.planner_evaluation.observed_trajectory; const corr = detail.planner_evaluation.corrected_trajectory; const geom = detail.scenario_geometry; const tMax = obs.length ? obs[obs.length - 1].t : 0; const [t, setT] = useState(tMax / 2);
const bounds = useMemo(() => { let xMin = -12; let xMax = 62; let yMin = -9; let yMax = 9; for (const p of [...obs, ...corr]) { xMin = Math.min(xMin, p.x - 3); xMax = Math.max(xMax, p.x + 3); yMin = Math.min(yMin, p.y - 3); yMax = Math.max(yMax, p.y + 3); } for (const a of geom?.actors ?? []) { for (const s of a.states) { if (s.y > -12 && s.y < 24) { yMin = Math.min(yMin, s.y - 2); yMax = Math.max(yMax, s.y + 2); } } } return { xMin, xMax, yMin, yMax }; }, [obs, corr, geom]);
const sx = (x: number) => PAD + ((x - bounds.xMin) / (bounds.xMax - bounds.xMin)) * (W - 2 * PAD); const sy = (y: number) => PAD + ((bounds.yMax - y) / (bounds.yMax - bounds.yMin)) * (H - 2 * PAD);
const path = (traj: RotrTrajectoryPoint[]) => traj.map((p, i) => `${i === 0 ? 'M' : 'L'}${sx(p.x).toFixed(1)},${sy(p.y).toFixed(1)}`).join(' ');
const obsNow = nearest(obs, t); const corrNow = nearest(corr, t); const ctx = geom?.actual_context;
return ( <Box> <Box sx={{ display: 'flex', gap: 1, mb: 1, flexWrap: 'wrap', alignItems: 'center' }}> <Chip size="small" label="observed ego" sx={{ bgcolor: '#c62828', color: '#fff', height: 20 }} /> <Chip size="small" label="corrected ego (counterfactual)" sx={{ bgcolor: '#2e7d32', color: '#fff', height: 20 }} /> <Chip size="small" label={`engine: ${detail.planner_evaluation.engine}`} sx={{ bgcolor: '#232a31', height: 20, fontFamily: 'monospace', fontSize: 10 }} /> <Chip size="small" label={detail.consequence_class} sx={{ bgcolor: detail.consequence_class === 'SAFETY_CRITICAL' ? '#b71c1c' : '#37474f', color: '#fff', height: 20, fontWeight: 700, }} /> </Box> <svg width="100%" viewBox={`0 0 ${W} ${H}`} style={{ background: '#0d1117', borderRadius: 8 }}> {/* lanes */} {ctx?.lanes.map((lane) => ( <g key={lane.lane_id}> <rect x={sx(bounds.xMin)} y={sy(lane.center_y + 1.75)} width={sx(bounds.xMax) - sx(bounds.xMin)} height={sy(lane.center_y - 1.75) - sy(lane.center_y + 1.75)} fill={lane.restricted_to ? 'rgba(255,112,67,0.10)' : 'rgba(255,255,255,0.045)'} stroke="#2c333b" strokeDasharray="6 5" /> <text x={sx(bounds.xMin) + 4} y={sy(lane.center_y) + 4} fontSize={10} fill="#5c6670"> {lane.lane_id} {lane.restricted_to ? ` (${lane.restricted_to}-only)` : ''} </text> </g> ))} {/* intersection box */} {ctx?.intersection_x_min != null && ctx?.intersection_x_max != null ? ( <rect x={sx(ctx.intersection_x_min)} y={PAD} width={sx(ctx.intersection_x_max) - sx(ctx.intersection_x_min)} height={H - 2 * PAD} fill="rgba(79,195,247,0.05)" stroke="#31424e" /> ) : null} {/* crosswalks */} {ctx?.crosswalks.map((cw) => ( <g key={cw.crosswalk_id}> {Array.from({ length: 7 }).map((_, i) => ( <rect key={i} x={sx(cw.x_min) + (i * (sx(cw.x_max) - sx(cw.x_min))) / 7 + 2} y={sy(5)} width={(sx(cw.x_max) - sx(cw.x_min)) / 7 - 4} height={sy(-5) - sy(5)} fill="rgba(255,255,255,0.10)" /> ))} </g> ))} {/* stop line */} {ctx?.stop_line_x != null ? ( <line x1={sx(ctx.stop_line_x)} y1={PAD} x2={sx(ctx.stop_line_x)} y2={H - PAD} stroke="#e53935" strokeWidth={2} strokeDasharray="8 4" /> ) : null} {/* trajectories */} <path d={path(obs)} fill="none" stroke="#c62828" strokeWidth={2.2} /> <path d={path(corr)} fill="none" stroke="#2e7d32" strokeWidth={2.2} strokeDasharray="7 4" /> {/* actors at t */} {geom?.actors.map((a) => { const s = a.states.length ? a.states.reduce((b, c) => (Math.abs(c.t - t) < Math.abs(b.t - t) ? c : b)) : null; if (!s) return null; const color = ACTOR_COLOR[a.class_name] ?? '#90a4ae'; const isPed = a.class_name === 'pedestrian' || a.class_name === 'cyclist'; return ( <g key={a.actor_id}> {isPed ? ( <circle cx={sx(s.x)} cy={sy(s.y)} r={6} fill={color} /> ) : ( <rect x={sx(s.x) - 11} y={sy(s.y) - 6} width={22} height={12} fill={color} rx={2} transform={`rotate(${(-s.yaw * 180) / Math.PI} ${sx(s.x)} ${sy(s.y)})`} /> )} <text x={sx(s.x) + 9} y={sy(s.y) - 8} fontSize={10} fill={color}> {a.actor_id} </text> </g> ); })} {/* ego markers at t */} {obsNow ? ( <rect x={sx(obsNow.x) - 13} y={sy(obsNow.y) - 7} width={26} height={14} fill="#c62828" rx={3} stroke="#fff" strokeWidth={0.8} /> ) : null} {corrNow ? ( <rect x={sx(corrNow.x) - 13} y={sy(corrNow.y) - 7} width={26} height={14} fill="#2e7d32" rx={3} stroke="#fff" strokeWidth={0.8} opacity={0.9} /> ) : null} </svg> <Box sx={{ px: 1, display: 'flex', alignItems: 'center', gap: 2 }}> <Typography variant="caption" sx={{ color: '#8a949e', minWidth: 70 }}> t = {t.toFixed(1)} s </Typography> <Slider size="small" min={0} max={tMax} step={0.1} value={t} onChange={(_, v) => setT(v as number)} /> </Box> <Box sx={{ display: 'flex', gap: 3, flexWrap: 'wrap', mt: 0.5 }}> {( [ ['observed', detail.observed_safety, obsNow], ['corrected', detail.corrected_safety, corrNow], ] as const ).map(([label, sa, now]) => ( <Typography key={label} variant="caption" sx={{ fontFamily: 'monospace', color: label === 'observed' ? '#ef9a9a' : '#a5d6a7' }}> {label}: v={now ? now.v.toFixed(1) : '—'} m/s · minTTC= {sa.min_ttc_s != null ? `${sa.min_ttc_s.toFixed(2)}s` : '—'} · clearance= {sa.min_clearance_m != null ? `${sa.min_clearance_m.toFixed(2)}m` : '—'} · PET= {sa.pet_s != null ? `${sa.pet_s.toFixed(2)}s` : '—'} · brake= {sa.max_braking_mps2.toFixed(1)} m/s² {sa.collision ? '· COLLISION' : ''} </Typography> ))} </Box> <Typography variant="caption" sx={{ color: '#6b7681', display: 'block', mt: 0.5 }}> divergence: {detail.planner_evaluation.max_position_divergence_m.toFixed(2)} m position ·{' '} {detail.planner_evaluation.max_speed_divergence_mps.toFixed(2)} m/s speed · corrected layers:{' '} {detail.corrected_layers.join(', ')} — {detail.observed_safety.surrogate_caveat} </Typography> </Box> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128/** * Structured-query builder for taxonomy mining: one dropdown chip per axis * plus a free-text field that the backend parses DETERMINISTICALLY (keyword * map, no LLM) into the same filterable query object. */
import { useState } from 'react';import Box from '@mui/material/Box';import Button from '@mui/material/Button';import Chip from '@mui/material/Chip';import FormControl from '@mui/material/FormControl';import InputLabel from '@mui/material/InputLabel';import MenuItem from '@mui/material/MenuItem';import Select from '@mui/material/Select';import TextField from '@mui/material/TextField';import Typography from '@mui/material/Typography';
const AXIS_OPTIONS: Record<string, string[]> = { actor: ['pedestrian', 'cyclist', 'vehicle', 'none'], vulnerability: ['VRU', 'NON_VRU'], legality: ['YIELD', 'RESTRICTED_PATH', 'LANE_ASSOCIATION', 'SIGNAL', 'MERGE', 'STOP'], interaction: ['CROSSING', 'MERGING', 'FOLLOWING', 'OTHER', 'NONE'], behavior: [ 'proceed_without_yield', 'enter_restricted_path', 'unpermitted_maneuver', 'run_red_signal', 'insufficient_gap_merge', 'rolling_stop', ], road_geometry: ['uncontrolled', 'controlled', 'none'], traffic_control: ['none', 'signal', 'stop_sign'], visibility: ['clear', 'low'], lighting: ['day', 'dusk', 'night'], weather: ['clear', 'rain'], consequence_class: [ 'NO_MATERIAL_CONSEQUENCE', 'DEGRADED_COMFORT', 'PLANNER_INTERVENTION', 'SAFETY_CRITICAL', ], primary_layer: [ 'perception', 'prediction', 'planning', 'localization', 'map', 'control', 'policy_rule', 'data_label', ],};
interface Props { onRun: (text: string | undefined, filters: Record<string, string>) => void; busy?: boolean;}
export default function RotrQueryBuilder({ onRun, busy }: Props) { const [text, setText] = useState( 'failed to yield to pedestrian at uncontrolled intersection during low visibility' ); const [filters, setFilters] = useState<Record<string, string>>({});
const setAxis = (axis: string, value: string) => { setFilters((f) => { const next = { ...f }; if (value) next[axis] = value; else delete next[axis]; return next; }); };
return ( <Box> <Box sx={{ display: 'flex', gap: 1, alignItems: 'center', mb: 1 }}> <TextField size="small" fullWidth label="natural-language query (parsed by a deterministic keyword map — no LLM)" value={text} onChange={(e) => setText(e.target.value)} /> <Button variant="contained" disabled={busy} onClick={() => onRun(text || undefined, filters)}> Run query </Button> </Box> <Box sx={{ display: 'flex', gap: 1, flexWrap: 'wrap' }}> {Object.entries(AXIS_OPTIONS).map(([axis, options]) => ( <FormControl key={axis} size="small" sx={{ minWidth: 148 }}> <InputLabel sx={{ fontSize: 12 }}>{axis}</InputLabel> <Select label={axis} value={filters[axis] ?? ''} onChange={(e) => setAxis(axis, e.target.value)} sx={{ fontSize: 12 }} > <MenuItem value=""> <em>any</em> </MenuItem> {options.map((o) => ( <MenuItem key={o} value={o} sx={{ fontSize: 12 }}> {o} </MenuItem> ))} </Select> </FormControl> ))} </Box> {Object.keys(filters).length ? ( <Box sx={{ display: 'flex', gap: 0.5, flexWrap: 'wrap', mt: 1, alignItems: 'center' }}> <Typography variant="caption" sx={{ color: '#8a949e' }}> active chips: </Typography> {Object.entries(filters).map(([axis, value]) => ( <Chip key={axis} size="small" label={`${axis}=${value}`} onDelete={() => setAxis(axis, '')} sx={{ height: 20, fontSize: 10, fontFamily: 'monospace' }} /> ))} </Box> ) : null} </Box> );}39 unmodified lines40414243444546917 unmodified lines9649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102247 unmodified lines107010711072107310741075107631 unmodified lines1108110911101111111211131114111513 unmodified lines11291130113111321133113476 unmodified lines121112121213121439 unmodified lines| 'Closed-loop evaluation'| 'Launch readiness'| 'Release governance'| 'Production hardening';export const GLOSSARY: Record<string, GlossaryEntry> = {// ------------------------------------------------------------ detection metrics917 unmodified linesshort: 'Every agent tool call — including denials — is appended to a per-analysis audit log with args, result hash, and timestamp.',detail: 'Tools are read-only by default; the single write tool (CreateEvaluationCase) requires an explicit policy authorization flag. The log reader is path-allowlisted to runs/ and the fixtures directory. The audit trail makes each scorecard reproducible and reviewable.',},// ------------------------------------------------------------ launch readiness (agentic triage)policy_outcome: {term: 'Policy outcome (four-way)',category: 'Launch readiness',short: 'AUTOMATIC_STOP_SHIP / LAUNCH_REVIEW_REQUIRED / CONTINUE_INVESTIGATION / NO_LAUNCH_IMPACT — decided by the deterministic policy engine, never by an agent.',detail: 'The versioned stop-ship policy evaluates explicit conditions over severity × exposure × frequency × confidence × novelty × downstream consequence. Automatic stop-ship fires only on pre-authorized conditions; anything with missing ground truth, incomplete lineage, failed fusion verification or conflicting agents resolves to INDETERMINATE (a fail-safe escalation), never a pass.',caveat: 'All numeric thresholds in the shipped policy are example placeholders (flagged placeholder_values: true); a real deployment must set organization-approved values through the versioned policy API.',},severity_taxonomy: {term: 'Severity taxonomy (S0–S5)',category: 'Launch readiness',short: 'S0 cosmetic → S5 collision-in-replay, assigned by deterministic criteria over class criticality, containment and observed behavioral impact.',detail: 'S4 requires OBSERVED unsafe downstream behavior in replay evidence — a hypothesized consequence cannot reach S4. S3 is a safety-critical misclassification whose downstream effect is not shown to be contained.',},evidence_status_tag: {term: 'Evidence status (OBSERVED / DERIVED / HYPOTHESIS / UNAVAILABLE)',category: 'Launch readiness',short: 'Every node in the failure evidence graph carries an explicit epistemic status; missing evidence is shown as UNAVAILABLE rather than guessed.',detail: 'OBSERVED = measured from campaign data or replay; DERIVED = computed deterministically from observed data; HYPOTHESIS = produced by an advisory agent and requires confirmation; UNAVAILABLE = the evidence does not exist yet. Agents cannot upgrade their own hypotheses.',},option_c_reduced_odd: {term: 'Option C — reduced ODD',category: 'Launch readiness',short: 'Ship while excluding the concentrated failure region from the operational design domain — allowed only when the region is reliably detectable at runtime.',detail: 'Feasibility checks use the ODD taxonomy: the concentrating dimension must be an instrumented ODD dimension, the runtime detector recall must meet MIN_REQUIRED_SAFETY_RECALL, the post-exclusion residual rate must meet MAX_ACCEPTABLE_FAILURE_PROBABILITY, evidence confidence must reach the configured minimum, and the exclusion must not exceed MAX_ALLOWED_ODD_EXCLUSION.',caveat: 'A geographic bucket is not an instrumented ODD dimension, so geo-concentration alone can never justify Option C.',},hard_safety_constraint: {term: 'Safety as a hard constraint',category: 'Launch readiness',short: 'Expected loss is computed for every option, but options whose residual failure rate violates the policy limit are excluded from selection no matter how cheap they are.',detail: 'Business optimization happens only inside the safe feasible region: the option matrix skips a matched row whose option is safety-infeasible, and if no feasible row remains the engine fails safe to human safety review. Tested explicitly: a cheaper unsafe option is never selected.',},contamination_guard: {term: 'Contamination guard',category: 'Launch readiness',short: 'Members of flywheel evaluation suites are never training-eligible without an explicit recorded override (who + why).',detail: 'Prevents the learning flywheel from leaking its own evaluation examples into training data, which would silently invalidate future evaluations. Promotion without an actor and reason raises a leakage error (reusing the raremine lineage guard); overrides are recorded on the suite and in the audit trail.',},small_sample_instability: {term: 'Small-sample instability flag',category: 'Launch readiness',short: 'Raised when event counts are too small for the rate estimate to be stable (e.g. 25 events on a 240k denominator), capping evidence confidence.',detail: 'A ~0.01% rate estimated from a handful of events has a wide Wilson interval and an unstable relative risk. The statistical agent flags this, the evidence-quality level drops to LIKELY or below, and automatic stop-ship (which requires CONFIRMED) cannot fire on it — the case routes to human review instead.',},audit_hash_chain: {term: 'Hash-chained audit log',category: 'Launch readiness',short: 'Every stage transition, agent output, policy evaluation and human decision is appended to a per-failure JSONL log where each record hashes its predecessor.',detail: 'Records carry a monotonically increasing sequence number and a prev_hash → hash chain; any edit, deletion or reordering breaks recomputation and is reported as a broken chain. The log is append-only by construction.',},data_label: {term: 'Data provenance label',category: 'Closed-loop evaluation',47 unmodified linesdetail: 'Cache keys hash (scenario, sensor_version, preprocessing_version, backbone_version, feature_schema_version); any version bump changes the key, so stale cross-version reuse is structurally impossible. Savings are measured, not estimated.',},// ------------------------------------------------------------ Release governance (Studio 2.0)release_decision: {term: 'Release decision (GO / REVIEW / NO-GO)',category: 'Release governance',31 unmodified linesshort: 'The separate recorded action (approver + rationale) that authorizes deployment after a GO decision.',detail: 'Only GO decisions can be approved; REVIEW and NO-GO must be re-evaluated after their conditions are resolved. The approval is a first-class registry entity and lands in the append-only audit trail — the gate recommends, humans authorize.',},// ------------------------------------------------------------ Production hardeninghardening_finding: {term: 'Hardening finding',category: 'Production hardening',13 unmodified linesdetail: 'Defined in sensorflow/hardening/contracts.py and mandatory on every hardening contract. Nothing lower on the ladder may silently substitute for a level above it — e.g. a quality gate must refuse AUTO_LABEL "ground truth". Adapters map existing records (labeleval GT types, pipeline proposals) onto the ladder.',caveat: 'Existing packages are not yet rewritten to these contracts; adapters bridge until their next breaking release.',},};export type GlossaryKey = keyof typeof GLOSSARY;76 unmodified lines'Launch readiness','Release governance','Production hardening',];39 unmodified lines4041424344454647917 unmodified lines96596696796896997047 unmodified lines1018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107631 unmodified lines11081109111011111112111313 unmodified lines11271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117176 unmodified lines1248124912501251125239 unmodified lines| 'Closed-loop evaluation'| 'Launch readiness'| 'Release governance'| 'Production hardening'| 'ROTR (right-of-the-road)';export const GLOSSARY: Record<string, GlossaryEntry> = {// ------------------------------------------------------------ detection metrics917 unmodified linesshort: 'Every agent tool call — including denials — is appended to a per-analysis audit log with args, result hash, and timestamp.',detail: 'Tools are read-only by default; the single write tool (CreateEvaluationCase) requires an explicit policy authorization flag. The log reader is path-allowlisted to runs/ and the fixtures directory. The audit trail makes each scorecard reproducible and reviewable.',},data_label: {term: 'Data provenance label',category: 'Closed-loop evaluation',47 unmodified linesdetail: 'Cache keys hash (scenario, sensor_version, preprocessing_version, backbone_version, feature_schema_version); any version bump changes the key, so stale cross-version reuse is structurally impossible. Savings are measured, not estimated.',},// ------------------------------------------------------------ launch readiness (agentic triage)policy_outcome: {term: 'Policy outcome (four-way)',category: 'Launch readiness',short: 'AUTOMATIC_STOP_SHIP / LAUNCH_REVIEW_REQUIRED / CONTINUE_INVESTIGATION / NO_LAUNCH_IMPACT — decided by the deterministic policy engine, never by an agent.',detail: 'The versioned stop-ship policy evaluates explicit conditions over severity × exposure × frequency × confidence × novelty × downstream consequence. Automatic stop-ship fires only on pre-authorized conditions; anything with missing ground truth, incomplete lineage, failed fusion verification or conflicting agents resolves to INDETERMINATE (a fail-safe escalation), never a pass.',caveat: 'All numeric thresholds in the shipped policy are example placeholders (flagged placeholder_values: true); a real deployment must set organization-approved values through the versioned policy API.',},severity_taxonomy: {term: 'Severity taxonomy (S0–S5)',category: 'Launch readiness',short: 'S0 cosmetic → S5 collision-in-replay, assigned by deterministic criteria over class criticality, containment and observed behavioral impact.',detail: 'S4 requires OBSERVED unsafe downstream behavior in replay evidence — a hypothesized consequence cannot reach S4. S3 is a safety-critical misclassification whose downstream effect is not shown to be contained.',},evidence_status_tag: {term: 'Evidence status (OBSERVED / DERIVED / HYPOTHESIS / UNAVAILABLE)',category: 'Launch readiness',short: 'Every node in the failure evidence graph carries an explicit epistemic status; missing evidence is shown as UNAVAILABLE rather than guessed.',detail: 'OBSERVED = measured from campaign data or replay; DERIVED = computed deterministically from observed data; HYPOTHESIS = produced by an advisory agent and requires confirmation; UNAVAILABLE = the evidence does not exist yet. Agents cannot upgrade their own hypotheses.',},option_c_reduced_odd: {term: 'Option C — reduced ODD',category: 'Launch readiness',short: 'Ship while excluding the concentrated failure region from the operational design domain — allowed only when the region is reliably detectable at runtime.',detail: 'Feasibility checks use the ODD taxonomy: the concentrating dimension must be an instrumented ODD dimension, the runtime detector recall must meet MIN_REQUIRED_SAFETY_RECALL, the post-exclusion residual rate must meet MAX_ACCEPTABLE_FAILURE_PROBABILITY, evidence confidence must reach the configured minimum, and the exclusion must not exceed MAX_ALLOWED_ODD_EXCLUSION.',caveat: 'A geographic bucket is not an instrumented ODD dimension, so geo-concentration alone can never justify Option C.',},hard_safety_constraint: {term: 'Safety as a hard constraint',category: 'Launch readiness',short: 'Expected loss is computed for every option, but options whose residual failure rate violates the policy limit are excluded from selection no matter how cheap they are.',detail: 'Business optimization happens only inside the safe feasible region: the option matrix skips a matched row whose option is safety-infeasible, and if no feasible row remains the engine fails safe to human safety review. Tested explicitly: a cheaper unsafe option is never selected.',},contamination_guard: {term: 'Contamination guard',category: 'Launch readiness',short: 'Members of flywheel evaluation suites are never training-eligible without an explicit recorded override (who + why).',detail: 'Prevents the learning flywheel from leaking its own evaluation examples into training data, which would silently invalidate future evaluations. Promotion without an actor and reason raises a leakage error (reusing the raremine lineage guard); overrides are recorded on the suite and in the audit trail.',},small_sample_instability: {term: 'Small-sample instability flag',category: 'Launch readiness',short: 'Raised when event counts are too small for the rate estimate to be stable (e.g. 25 events on a 240k denominator), capping evidence confidence.',detail: 'A ~0.01% rate estimated from a handful of events has a wide Wilson interval and an unstable relative risk. The statistical agent flags this, the evidence-quality level drops to LIKELY or below, and automatic stop-ship (which requires CONFIRMED) cannot fire on it — the case routes to human review instead.',},audit_hash_chain: {term: 'Hash-chained audit log',category: 'Launch readiness',short: 'Every stage transition, agent output, policy evaluation and human decision is appended to a per-failure JSONL log where each record hashes its predecessor.',detail: 'Records carry a monotonically increasing sequence number and a prev_hash → hash chain; any edit, deletion or reordering breaks recomputation and is reported as a broken chain. The log is append-only by construction.',},// ------------------------------------------------------------ release governance (studio2)release_decision: {term: 'Release decision (GO / REVIEW / NO-GO)',category: 'Release governance',31 unmodified linesshort: 'The separate recorded action (approver + rationale) that authorizes deployment after a GO decision.',detail: 'Only GO decisions can be approved; REVIEW and NO-GO must be re-evaluated after their conditions are resolved. The approval is a first-class registry entity and lands in the append-only audit trail — the gate recommends, humans authorize.',},hardening_finding: {term: 'Hardening finding',category: 'Production hardening',13 unmodified linesdetail: 'Defined in sensorflow/hardening/contracts.py and mandatory on every hardening contract. Nothing lower on the ladder may silently substitute for a level above it — e.g. a quality gate must refuse AUTO_LABEL "ground truth". Adapters map existing records (labeleval GT types, pipeline proposals) onto the ladder.',caveat: 'Existing packages are not yet rewritten to these contracts; adapters bridge until their next breaking release.',},rotr_violation: {term: 'ROTR violation',category: 'ROTR (right-of-the-road)',short: 'A deterministic rule-engine verdict that the executed trajectory broke the expected-behavior envelope (yielding, legal path, right-of-way, stopping).',detail: 'Computed as a function of five evidence structures: ego state, road context, actor states, observed behavior and expected behavior. Each record carries a versioned rule id, structured evidence fields and provenance. Detection runs against the ACTUAL (ground-truth) world; plan compliance runs separately against the stack\u2019s believed world.',caveat: 'A violation verdict says nothing about cause or consequence — those are separate analyses (attribution, counterfactual replay).',},rotr_attribution: {term: 'Causal-layer attribution',category: 'ROTR (right-of-the-road)',short: 'Per-violation, per-layer evidence tests: each of perception / prediction / planning / localization / map / control / data-label / policy-rule is independently SUPPORTED, RULED_OUT or UNKNOWN.',detail: 'The load-bearing invariant: a violation is NEVER auto-attributed to perception. Each layer needs its own positive evidence (e.g. GT-vs-detected diff for perception, correct-perception-but-noncompliant-plan for planning). The primary layer is the highest-confidence SUPPORTED entry; with none, the row stays unattributed and goes to HITL.',},rotr_consequence: {term: 'Behavioral consequence class',category: 'ROTR (right-of-the-road)',short: 'What the violation actually cost, measured by counterfactual replay: NO_MATERIAL_CONSEQUENCE, DEGRADED_COMFORT, PLANNER_INTERVENTION or SAFETY_CRITICAL.',detail: 'The attributed layer\u2019s inputs are corrected and the scenario is re-planned (nextgen closed-loop when importable, else a self-contained IDM-style planner). Observed vs corrected trajectories are compared on TTC, PET, clearance, stopping distance, braking intensity and lateral deviation.',caveat: 'Surrogate-safety measures (TTC/PET/clearance) indicate exposure, not collision certainty — they alone do not establish collision risk.',},sc_rotr_recall: {term: 'SC-ROTR recall',category: 'ROTR (right-of-the-road)',short: 'Safety-critical-weighted violation recall: misses on dangerous violations cost more than misses on cosmetic ones.',detail: 'Weights are exposure-derived per stratum — the fraction of that stratum\u2019s violations whose counterfactual consequence was safety-critical, normalized so weights average 1 — with the calibration method and version recorded next to the number. Not arbitrary class multipliers.',caveat: 'On synthetic banks the weights are calibrated on the bank itself; a production system would calibrate on fleet exposure data.',},rotr_stopship: {term: 'ROTR stop-ship trigger',category: 'ROTR (right-of-the-road)',short: 'Deterministic NO_GO on the strict conjunction: VRU involved AND perception missed the actor AND counterfactual consequence is safety-critical.',detail: 'Policy-versioned and explicitly not LLM-driven. Partial matches never fire. NO_GO events are forwarded to the agentic policy engine as advisory input when importable; the gate outcome is recorded locally either way.',},rotr_six_axis: {term: 'Six-axis ROTR taxonomy',category: 'ROTR (right-of-the-road)',short: 'Actor / Vulnerability / Legality / Environment / Interaction / Behavior — plus road-geometry, traffic-control and visibility extensions — for structured violation mining.',detail: 'Text like "failed to yield to pedestrian at uncontrolled intersection during low visibility" parses through a deterministic keyword map into the same filterable query object as the dropdown chips. Violations cluster into recurring patterns by structured signature.',},};export type GlossaryKey = keyof typeof GLOSSARY;76 unmodified lines'Launch readiness','Release governance','Production hardening','ROTR (right-of-the-road)',];
226 unmodified lines227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268173 unmodified lines4424434444454464476 unmodified lines4544554564574584592 unmodified lines462463464465466467226 unmodified linesdataFlow:'Scenes and engines come read-only from the bevfusion package; sequential verdicts use seqeval\u2019s anytime-valid tests when importable (local paired-t fallback otherwise). Runs persist under runs/vitis/. Generated variants are evaluation-set supplements tagged evaluation-only (never training-eligible) and are offered to the raremine candidate flow when that package is available.',},'closed-loop-lab': {subtitle:'Next-generation evaluation: counterfactual scenario generation with a validity gate, closed-loop behavioral metrics with causal replay, safety-informed metrics, and a priority-scheduled launch gauntlet with compute deduplication.',purpose:'Open-loop metrics (mAP/recall) cannot tell you whether a perception error would have changed vehicle behavior, and aggregate recall can improve while safety-critical recall degrades. This lab generates labeled counterfactual scenarios, runs the full perception→planner→vehicle loop, and answers the causal question directly: replay the same scenario with corrected perception and diff the outcomes.',reading:'Every datum carries a REAL / REPLAYED / SIMULATED / GENERATED / COUNTERFACTUAL provenance label. Counterfactuals show fidelity / validity / realism scores from the gate; low-fidelity scenarios are weight-capped so they cannot dominate launch decisions. The causal replay banner is the key verdict: METRIC_ONLY (visible in metrics, no behavioral change) vs BEHAVIORALLY_CONSEQUENTIAL (the error changes the safety outcome). The Gauntlet tab shows priority strata (safety-critical first), anytime-valid early-stop events, and measured compute savings.',actions:'Build transformation recipes and generate counterfactuals; run the validity gate; run closed-loop replays and causal comparisons with planted perception faults; run the safety-metric divergence demo; launch a 100k-unit gauntlet against a candidate profile and inspect the launch recommendation; read the architecture decision docs.',dataFlow:'Counterfactuals are transformations of bevfusion scenes; safety math reuses the SSAM extensions; sequential early stopping delegates to seqeval; distribution similarity delegates to the mega-eval statistics. Artifacts persist under runs/nextgen/. A run with incomplete lineage is marked INVALID for launch purposes.',},studio2: {subtitle:'The Studio 2.0 control plane: versioned entities for the whole system, one deterministic release decision composed from the real engines (safety gates + seqeval + megaeval shift + agentic/nextgen when available), hardware-stratified gating, and the unified observability funnel.',purpose:'The engines exist; what was missing is the layer that composes them. This page answers "can this candidate ship?" with a GO / REVIEW / NO-GO decision backed by a full evidence tuple, keeps humans (not gates) as the deployment authority, and makes cross-package entities (models, datasets with roles, policies, runs) first-class and browsable.',reading:'Release Board: the decision banner shows status, confidence and evidence completeness; blocking conditions, named degraded inputs and unresolved questions below it; the evidence tuple lists exactly which subsystem artifacts the decision was computed from. A GO decision still shows "deployment not authorized" until the separate human approval is recorded. Control Plane: role badges (REGRESSION/LAUNCH/TEST are PROTECTED by the contamination guard) and REPRODUCIBLE / NON-REPRODUCIBLE badges (a run missing any tuple component is non-reproducible, with the missing parts listed). Hardware Gates: each row is a region × platform × sensor-generation combination; a failing CRITICAL row blocks even when the global aggregate passes; amber rows lack sufficient evidence and never count as passing. Funnel: stage bars are log-scaled; absent sources show UNAVAILABLE with the reason — numbers are never fabricated.',actions:'Evaluate a candidate from live sources, run the end-to-end closed-loop demo (bevfusion scenario → seqeval verdict → nextgen replay → safety gates → release decision → flywheel registration), browse and auto-ingest registry entities, transition dataset roles (guarded transitions demand an audited override), recompute the hardware matrix, and record human deployment approvals.',dataFlow:'Reads the persisted stores of megaeval, seqeval, safety, agentic, nextgen, bevfusion and vitis (best-effort, availability-flagged). Writes only under runs/studio2/: registry entities, release decisions, approvals and an append-only audit trail. Failures found by the demo feed back as protected REGRESSION-role dataset entries.',},'production-readiness': {subtitle:'The hardening audit as a living page: every finding with file:line references, a readiness scorecard computed from the audit (never hand-written), the live data funnel, and the fix-now vs follow-up remediation board.',purpose:'An honest answer to "is this platform production ready?". The scorecard is derived from docs/hardening/audit.json and is hard-wired to report NOT PRODUCTION READY while any Critical finding is open — no one can flip the status without closing the findings.',reading:'The banner shows the overall verdict, finding counts by severity, and fixed-now vs deferred totals. Scorecard cards map each category to its prototype state, production requirement, and open gap IDs. The funnel bars are live counts from the labeleval store (source labeled). The findings table filters by area / severity / disposition; refs are FILE:LINE into this repository. The kanban splits work already done in this pass from documented follow-ups with effort badges (S/M/L).',actions:'Filter and read findings; use the refs to jump into the code. No mutations happen from this page — it is a read-only audit browser.',dataFlow:'All content is served by /api/hardening from docs/hardening/audit.{md,json} plus read-only funnel counts from runs/labeleval. Fixes land in code; the audit document is updated with dispositions; this page re-derives everything from it.',},ssam: {subtitle:'Surrogate-safety analysis of real intersections: conflicts ranked by TTC / PET / severity on an interactive map — the safety context the label platform feeds.',173 unmodified linesdataFlow:'Fixtures live in sensorflow/retro/fixtures; analyses and audit trails persist under runs/retro/. Metric math reuses the SSAM safety extensions; distribution stats delegate to the mega-eval engine; the safety-case corpus is indexed at startup (chromadb or deterministic fallback).',},'launch-readiness': {subtitle:'Agentic launch readiness & misclassification triage: a five-layer pipeline (detection → evidence → analysis → decision → flywheel) where AI agents only recommend and a deterministic, versioned policy engine plus recorded human review own every launch decision.',6 unmodified linesdataFlow:'Detection scans a seeded synthetic campaign (bevfusion scenes + a paired rate population). Statistics delegate to seqeval; safety replays reuse the SSAM extensions; Option C checks use the ODD taxonomy. Validated failures feed evaluation suites (contamination-guarded) under runs/agentic/, and every action lands in a hash-chained append-only audit log.',},legacy: {subtitle:'The original vanilla-JS studio, embedded unchanged — kept for workflows not yet migrated to the React platform.',2 unmodified linesactions: 'Use legacy workflows; open in a new tab for full-window work.',dataFlow: 'Talks to the same backend and datasets as the new platform.',},};/** Short one-liner per page for the global help menu index. */226 unmodified lines227228229230231232173 unmodified lines4064074084094104114124134144154164174184194204214224236 unmodified lines4304314324334344354364374384394404414424434444454464472 unmodified lines450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479226 unmodified linesdataFlow:'Scenes and engines come read-only from the bevfusion package; sequential verdicts use seqeval\u2019s anytime-valid tests when importable (local paired-t fallback otherwise). Runs persist under runs/vitis/. Generated variants are evaluation-set supplements tagged evaluation-only (never training-eligible) and are offered to the raremine candidate flow when that package is available.',},ssam: {subtitle:'Surrogate-safety analysis of real intersections: conflicts ranked by TTC / PET / severity on an interactive map — the safety context the label platform feeds.',173 unmodified linesdataFlow:'Fixtures live in sensorflow/retro/fixtures; analyses and audit trails persist under runs/retro/. Metric math reuses the SSAM safety extensions; distribution stats delegate to the mega-eval engine; the safety-case corpus is indexed at startup (chromadb or deterministic fallback).',},'closed-loop-lab': {subtitle:'Next-generation evaluation: counterfactual scenario generation with a validity gate, closed-loop behavioral metrics with causal replay, safety-informed metrics, and a priority-scheduled launch gauntlet with compute deduplication.',purpose:'Open-loop metrics (mAP/recall) cannot tell you whether a perception error would have changed vehicle behavior, and aggregate recall can improve while safety-critical recall degrades. This lab generates labeled counterfactual scenarios, runs the full perception→planner→vehicle loop, and answers the causal question directly: replay the same scenario with corrected perception and diff the outcomes.',reading:'Every datum carries a REAL / REPLAYED / SIMULATED / GENERATED / COUNTERFACTUAL provenance label. Counterfactuals show fidelity / validity / realism scores from the gate; low-fidelity scenarios are weight-capped so they cannot dominate launch decisions. The causal replay banner is the key verdict: METRIC_ONLY (visible in metrics, no behavioral change) vs BEHAVIORALLY_CONSEQUENTIAL (the error changes the safety outcome). The Gauntlet tab shows priority strata (safety-critical first), anytime-valid early-stop events, and measured compute savings.',actions:'Build transformation recipes and generate counterfactuals; run the validity gate; run closed-loop replays and causal comparisons with planted perception faults; run the safety-metric divergence demo; launch a 100k-unit gauntlet against a candidate profile and inspect the launch recommendation; read the architecture decision docs.',dataFlow:'Counterfactuals are transformations of bevfusion scenes; safety math reuses the SSAM extensions; sequential early stopping delegates to seqeval; distribution similarity delegates to the mega-eval statistics. Artifacts persist under runs/nextgen/. A run with incomplete lineage is marked INVALID for launch purposes.',},'launch-readiness': {subtitle:'Agentic launch readiness & misclassification triage: a five-layer pipeline (detection → evidence → analysis → decision → flywheel) where AI agents only recommend and a deterministic, versioned policy engine plus recorded human review own every launch decision.',6 unmodified linesdataFlow:'Detection scans a seeded synthetic campaign (bevfusion scenes + a paired rate population). Statistics delegate to seqeval; safety replays reuse the SSAM extensions; Option C checks use the ODD taxonomy. Validated failures feed evaluation suites (contamination-guarded) under runs/agentic/, and every action lands in a hash-chained append-only audit log.',},studio2: {subtitle:'The Studio 2.0 control plane: versioned entities for the whole system, one deterministic release decision composed from the real engines (safety gates + seqeval + megaeval shift + agentic/nextgen when available), hardware-stratified gating, and the unified observability funnel.',purpose:'The engines exist; what was missing is the layer that composes them. This page answers "can this candidate ship?" with a GO / REVIEW / NO-GO decision backed by a full evidence tuple, keeps humans (not gates) as the deployment authority, and makes cross-package entities (models, datasets with roles, policies, runs) first-class and browsable.',reading:'Release Board: the decision banner shows status, confidence and evidence completeness; blocking conditions, named degraded inputs and unresolved questions below it; the evidence tuple lists exactly which subsystem artifacts the decision was computed from. A GO decision still shows "deployment not authorized" until the separate human approval is recorded. Control Plane: role badges (REGRESSION/LAUNCH/TEST are PROTECTED by the contamination guard) and REPRODUCIBLE / NON-REPRODUCIBLE badges (a run missing any tuple component is non-reproducible, with the missing parts listed). Hardware Gates: each row is a region × platform × sensor-generation combination; a failing CRITICAL row blocks even when the global aggregate passes; amber rows lack sufficient evidence and never count as passing. Funnel: stage bars are log-scaled; absent sources show UNAVAILABLE with the reason — numbers are never fabricated.',actions:'Evaluate a candidate from live sources, run the end-to-end closed-loop demo (bevfusion scenario → seqeval verdict → nextgen replay → safety gates → release decision → flywheel registration), browse and auto-ingest registry entities, transition dataset roles (guarded transitions demand an audited override), recompute the hardware matrix, and record human deployment approvals.',dataFlow:'Reads the persisted stores of megaeval, seqeval, safety, agentic, nextgen, bevfusion and vitis (best-effort, availability-flagged). Writes only under runs/studio2/: registry entities, release decisions, approvals and an append-only audit trail. Failures found by the demo feed back as protected REGRESSION-role dataset entries.',},legacy: {subtitle:'The original vanilla-JS studio, embedded unchanged — kept for workflows not yet migrated to the React platform.',2 unmodified linesactions: 'Use legacy workflows; open in a new tab for full-window work.',dataFlow: 'Talks to the same backend and datasets as the new platform.',},'production-readiness': {subtitle:'The hardening audit as a living page: every finding with file:line references, a readiness scorecard computed from the audit (never hand-written), the live data funnel, and the fix-now vs follow-up remediation board.',purpose:'An honest answer to "is this platform production ready?". The scorecard is derived from docs/hardening/audit.json and is hard-wired to report NOT PRODUCTION READY while any Critical finding is open — no one can flip the status without closing the findings.',reading:'The banner shows the overall verdict, finding counts by severity, and fixed-now vs deferred totals. Scorecard cards map each category to its prototype state, production requirement, and open gap IDs. The funnel bars are live counts from the labeleval store (source labeled). The findings table filters by area / severity / disposition; refs are FILE:LINE into this repository. The kanban splits work already done in this pass from documented follow-ups with effort badges (S/M/L).',actions:'Filter and read findings; use the refs to jump into the code. No mutations happen from this page — it is a read-only audit browser.',dataFlow:'All content is served by /api/hardening from docs/hardening/audit.{md,json} plus read-only funnel counts from runs/labeleval. Fixes land in code; the audit document is updated with dispositions; this page re-derives everything from it.',},rotr: {subtitle:'Right-of-the-road violation detection, triage, evaluation & training: deterministic rule verdicts, causal-layer attribution (never auto-blamed on perception), counterfactual consequence replay, seqeval-gated regression, and a contamination-guarded flywheel.',purpose:'A ROTR violation ("failed to yield to a crossing pedestrian") is only actionable once three separate questions are answered: did it happen (rule engine vs ground truth), why (per-layer evidence: perception / prediction / planning / localization / map / control), and did it matter (counterfactual replay of the corrected stack). This page runs that pipeline on deterministic planted-violation scenario banks and closes the loop into a protected regression suite.',reading:'The gate banner is the deterministic stop-ship verdict (VRU + missed detection + safety-critical exposure ⇒ NO_GO; policy-versioned, not LLM-driven). Executive: recall / SC-recall / BCR / CFR tiles and the six-outcome regression status. Engineering: the attribution heatmap colors each violation × layer cell SUPPORTED / RULED_OUT / UNKNOWN with a ring on the primary layer — click a row to open the BEV replay of observed (red) vs corrected (green dashed) trajectories. Data: coverage of the planted bank, the HITL queue, and training candidates whose REGRESSION-role members show a PROTECTED guard chip. Infrastructure: measured wall time and seqeval sample counts; unmeasured figures say NOT MEASURED.',actions:'Generate a scenario bank and run detection for one of three stack profiles; compare two runs through seqeval; mine violations with the six-axis structured query (text parses through a deterministic keyword map); validate or reject HITL items (validation creates a protected regression artifact); attempt training promotion — the contamination guard blocks protected members unless a reasoned governance override is recorded.',dataFlow:'Scenario banks and all run artifacts persist under runs/rotr/. Regression statistics delegate to seqeval over a megaeval population; validated artifacts mirror to the studio2 registry when available; NO_GO events forward to the agentic policy engine as advisory input. Everything is reproducible from bank id + seed + version pins.',},};/** Short one-liner per page for the global help menu index. */
38 unmodified lines3940414243444534 unmodified lines80818283848538 unmodified lines| 'launch-readiness'| 'studio2'| 'legacy'| 'production-readiness';export const ALL_PAGE_IDS: PageId[] = ['command',34 unmodified lines'studio2','legacy','production-readiness',];/** Maps backend evidence_link.page strings (unknown vocabulary) onto our page ids. */38 unmodified lines394041424344454634 unmodified lines8182838485868738 unmodified lines| 'launch-readiness'| 'studio2'| 'legacy'| 'production-readiness'| 'rotr';export const ALL_PAGE_IDS: PageId[] = ['command',34 unmodified lines'studio2','legacy','production-readiness','rotr',];/** Maps backend evidence_link.page strings (unknown vocabulary) onto our page ids. */
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843/** * ROTR Control Center — right-of-the-road violation detection, triage, * evaluation & training. Four audiences, four views: * Executive — headline metrics, gate state, regression status * Engineering — taxonomy distributions, attribution heatmap, clusters, * model comparison, consequence replay (BEV schematic) * Data — coverage, rare patterns, HITL queue, training * candidates with role badges + contamination guard, * regression suite * Infrastructure — measured throughput + delegation stats; unmeasured * figures are flagged honestly, never invented */
import { useCallback, useEffect, useMemo, useState } from 'react';import type { ReactNode } from 'react';import Alert from '@mui/material/Alert';import Box from '@mui/material/Box';import Button from '@mui/material/Button';import Chip from '@mui/material/Chip';import CircularProgress from '@mui/material/CircularProgress';import FormControl from '@mui/material/FormControl';import InputLabel from '@mui/material/InputLabel';import MenuItem from '@mui/material/MenuItem';import Paper from '@mui/material/Paper';import Select from '@mui/material/Select';import Tab from '@mui/material/Tab';import Table from '@mui/material/Table';import TableBody from '@mui/material/TableBody';import TableCell from '@mui/material/TableCell';import TableHead from '@mui/material/TableHead';import TableRow from '@mui/material/TableRow';import Tabs from '@mui/material/Tabs';import TextField from '@mui/material/TextField';import Typography from '@mui/material/Typography';import RotrAttributionHeatmap from '../../components/rotr/RotrAttributionHeatmap';import RotrBevReplay from '../../components/rotr/RotrBevReplay';import RotrQueryBuilder from '../../components/rotr/RotrQueryBuilder';import * as api from '../../services/rotr';import type { RotrAttributionMatrix, RotrConsequenceDetail, RotrHITLReview, RotrQueryResponse, RotrRegressionResult, RotrRunListItem, RotrRunSummary, RotrStopshipPolicy, RotrSuite, RotrTrainingCandidate,} from '../../types/rotr';
const MODEL_VERSIONS = ['stack-v1', 'stack-v2-improved', 'stack-v3-planning-regression'];
const CONSEQUENCE_COLOR: Record<string, string> = { SAFETY_CRITICAL: '#b71c1c', PLANNER_INTERVENTION: '#e65100', DEGRADED_COMFORT: '#f9a825', NO_MATERIAL_CONSEQUENCE: '#37474f',};
const ROLE_COLOR: Record<string, string> = { REGRESSION: '#6a1b9a', LAUNCH: '#4527a0', TRAIN: '#1565c0', VALIDATION: '#00695c', TEST: '#5d4037', MONITORING: '#37474f',};
function pct(v: number | null | undefined): string { return v == null ? '—' : `${(v * 100).toFixed(1)}%`;}
function SectionCard({ title, children, subtitle }: { title: string; subtitle?: string; children: ReactNode }) { return ( <Paper sx={{ p: 2, bgcolor: '#161b22', border: '1px solid #232a31', borderRadius: 2 }}> <Typography variant="subtitle2" sx={{ fontWeight: 800, mb: subtitle ? 0 : 1.25 }}> {title} </Typography> {subtitle ? ( <Typography variant="caption" sx={{ color: '#8a949e', display: 'block', mb: 1.25 }}> {subtitle} </Typography> ) : null} {children} </Paper> );}
function Tile({ label, value, hint, color }: { label: string; value: string; hint?: string; color?: string }) { return ( <Paper sx={{ p: 1.5, bgcolor: '#161b22', border: '1px solid #232a31', minWidth: 148, flex: 1 }}> <Typography variant="caption" sx={{ color: '#8a949e' }}> {label} </Typography> <Typography variant="h5" sx={{ fontWeight: 800, color: color ?? '#e6edf3' }}> {value} </Typography> {hint ? ( <Typography variant="caption" sx={{ color: '#6b7681' }}> {hint} </Typography> ) : null} </Paper> );}
function DistBar({ counts, total }: { counts: Record<string, number>; total: number }) { const entries = Object.entries(counts).sort((a, b) => b[1] - a[1]); return ( <Box> {entries.map(([k, n]) => ( <Box key={k} sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 0.4 }}> <Typography variant="caption" sx={{ width: 190, color: '#c9d1d9', fontFamily: 'monospace', fontSize: 11 }}> {k} </Typography> <Box sx={{ flex: 1, bgcolor: '#0d1117', borderRadius: 1, height: 12 }}> <Box sx={{ width: `${(n / Math.max(total, 1)) * 100}%`, bgcolor: '#4fc3f7', height: 12, borderRadius: 1 }} /> </Box> <Typography variant="caption" sx={{ width: 26, textAlign: 'right', color: '#8a949e' }}> {n} </Typography> </Box> ))} </Box> );}
export default function RotrControlCenterPage() { const [tab, setTab] = useState(0); const [runs, setRuns] = useState<RotrRunListItem[]>([]); const [runId, setRunId] = useState<string>(''); const [run, setRun] = useState<RotrRunSummary | null>(null); const [matrix, setMatrix] = useState<RotrAttributionMatrix | null>(null); const [allViolations, setAllViolations] = useState<RotrQueryResponse | null>(null); const [selectedVid, setSelectedVid] = useState<string | null>(null); const [consequence, setConsequence] = useState<RotrConsequenceDetail | null>(null); const [queryResult, setQueryResult] = useState<RotrQueryResponse | null>(null); const [regressions, setRegressions] = useState<RotrRegressionResult[]>([]); const [baselineId, setBaselineId] = useState<string>(''); const [hitl, setHitl] = useState<RotrHITLReview[]>([]); const [candidates, setCandidates] = useState<RotrTrainingCandidate[]>([]); const [suite, setSuite] = useState<RotrSuite | null>(null); const [policy, setPolicy] = useState<RotrStopshipPolicy | null>(null); const [overrideReason, setOverrideReason] = useState(''); const [nScenarios, setNScenarios] = useState(28); const [seed, setSeed] = useState(7); const [modelVersion, setModelVersion] = useState('stack-v1'); const [busy, setBusy] = useState(false); const [error, setError] = useState<string | null>(null); const [notice, setNotice] = useState<string | null>(null); const [lastRunWallMs, setLastRunWallMs] = useState<number | null>(null);
const loadRun = useCallback(async (id: string) => { const [summary, m, all, queue] = await Promise.all([ api.getRun(id), api.getAttributionMatrix(id), api.structuredQuery({ run_id: id }), api.getHitlQueue(id), ]); setRun(summary); setMatrix(m); setAllViolations(all); setHitl(queue); setSelectedVid(null); setConsequence(null); setQueryResult(null); }, []);
const refreshGlobal = useCallback(async () => { const [rs, regs, cands, s, pol] = await Promise.all([ api.listRuns(), api.listRegressions(), api.listCandidates(), api.getSuite(), api.getStopshipPolicy(), ]); setRuns(rs); setRegressions(regs); setCandidates(cands); setSuite(s); setPolicy(pol); return rs; }, []);
useEffect(() => { refreshGlobal() .then((rs) => { if (rs.length && !runId) { setRunId(rs[rs.length - 1].run_id); return loadRun(rs[rs.length - 1].run_id); } return undefined; }) .catch((e) => setError(String(e))); // eslint-disable-next-line react-hooks/exhaustive-deps }, []);
const generateAndRun = async () => { setBusy(true); setError(null); try { const start = performance.now(); const summary = await api.createRun({ n_scenarios: nScenarios, seed, model_version: modelVersion }); setLastRunWallMs(performance.now() - start); await refreshGlobal(); setRunId(summary.run_id); await loadRun(summary.run_id); setNotice(`run ${summary.run_id} complete: ${summary.n_violations} violations on ${summary.n_scenarios} scenarios`); } catch (e) { setError(String(e)); } finally { setBusy(false); } };
const selectRun = async (id: string) => { setRunId(id); setBusy(true); try { await loadRun(id); } catch (e) { setError(String(e)); } finally { setBusy(false); } };
const selectViolation = async (vid: string) => { setSelectedVid(vid); try { setConsequence(await api.getConsequence(runId, vid)); } catch (e) { setError(String(e)); } };
const runQuery = async (text: string | undefined, filters: Record<string, string>) => { setBusy(true); try { setQueryResult(await api.structuredQuery({ run_id: runId, text, filters })); } catch (e) { setError(String(e)); } finally { setBusy(false); } };
const doRegression = async () => { if (!baselineId || !runId) return; setBusy(true); try { await api.runRegression({ baseline_run_id: baselineId, candidate_run_id: runId }); setRegressions(await api.listRegressions()); setNotice('regression comparison complete (statistics delegated to seqeval)'); } catch (e) { setError(String(e)); } finally { setBusy(false); } };
const act = async (review: RotrHITLReview, action: 'VALIDATE' | 'REJECT') => { try { await api.hitlAction({ run_id: runId, review_id: review.review_id, action, actor: 'studio-reviewer', notes: action === 'VALIDATE' ? 'confirmed via control center' : 'rejected via control center', }); setHitl(await api.getHitlQueue(runId)); setCandidates(await api.listCandidates()); setSuite(await api.getSuite()); setNotice(action === 'VALIDATE' ? 'validated → regression artifact created (role REGRESSION, protected)' : 'review rejected'); } catch (e) { setError(String(e)); } };
const promote = async (c: RotrTrainingCandidate) => { try { await api.promoteCandidate({ candidate_id: c.candidate_id, actor: 'studio-reviewer' }); setCandidates(await api.listCandidates()); setNotice(`candidate ${c.candidate_id} promoted to training`); } catch (e) { setError(`contamination guard: ${String(e)}`); } };
const override = async (c: RotrTrainingCandidate) => { try { await api.overrideCandidate({ candidate_id: c.candidate_id, actor: 'safety-lead', reason: overrideReason }); setCandidates(await api.listCandidates()); setNotice('governance override recorded (audited)'); } catch (e) { setError(String(e)); } };
const distributions = useMemo(() => { const axes = ['legality', 'vulnerability', 'visibility', 'behavior', 'traffic_control'] as const; const out: Record<string, Record<string, number>> = {}; for (const axis of axes) out[axis] = {}; const layerCounts: Record<string, number> = {}; const consCounts: Record<string, number> = {}; for (const v of allViolations?.results ?? []) { for (const axis of axes) { const val = v.taxonomy[axis] ?? '?'; out[axis][val] = (out[axis][val] ?? 0) + 1; } const l = v.primary_layer ?? 'unattributed (HITL)'; layerCounts[l] = (layerCounts[l] ?? 0) + 1; const c = v.consequence_class ?? 'UNCLASSIFIED'; consCounts[c] = (consCounts[c] ?? 0) + 1; } return { axes: out, layers: layerCounts, consequences: consCounts }; }, [allViolations]);
const scCount = distributions.consequences['SAFETY_CRITICAL'] ?? 0; const latestReg = regressions.length ? regressions[regressions.length - 1] : null; const metrics = run?.metrics;
return ( <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}> {/* controls */} <Paper sx={{ p: 1.5, bgcolor: '#161b22', border: '1px solid #232a31', display: 'flex', gap: 1.5, alignItems: 'center', flexWrap: 'wrap' }}> <FormControl size="small" sx={{ minWidth: 230 }}> <InputLabel>stack under evaluation</InputLabel> <Select label="stack under evaluation" value={modelVersion} onChange={(e) => setModelVersion(e.target.value)}> {MODEL_VERSIONS.map((m) => ( <MenuItem key={m} value={m}> {m} </MenuItem> ))} </Select> </FormControl> <TextField size="small" type="number" label="scenarios" value={nScenarios} onChange={(e) => setNScenarios(Number(e.target.value))} sx={{ width: 100 }} /> <TextField size="small" type="number" label="seed" value={seed} onChange={(e) => setSeed(Number(e.target.value))} sx={{ width: 90 }} /> <Button variant="contained" onClick={generateAndRun} disabled={busy}> Generate bank & run detection </Button> {busy ? <CircularProgress size={20} /> : null} <Box sx={{ flex: 1 }} /> <FormControl size="small" sx={{ minWidth: 260 }}> <InputLabel>inspect run</InputLabel> <Select label="inspect run" value={runId} onChange={(e) => selectRun(e.target.value)}> {runs.map((r) => ( <MenuItem key={r.run_id} value={r.run_id}> {r.run_id} · {r.model_version} · {r.n_violations} violations </MenuItem> ))} </Select> </FormControl> </Paper>
{error ? ( <Alert severity="error" onClose={() => setError(null)}> {error} </Alert> ) : null} {notice ? ( <Alert severity="info" onClose={() => setNotice(null)}> {notice} </Alert> ) : null}
{!run ? ( <Alert severity="info">No runs yet — generate a scenario bank and run detection to populate the control center.</Alert> ) : ( <> {/* gate banner */} <Alert severity={run.gate.outcome === 'NO_GO' ? 'error' : 'success'} sx={{ fontWeight: 700, alignItems: 'center' }} action={ <Chip size="small" label={`stop-ship policy ${run.gate.policy_version}`} sx={{ fontFamily: 'monospace', fontSize: 10 }} /> } > RELEASE GATE: {run.gate.outcome} {run.gate.outcome === 'NO_GO' ? ` — ${run.gate.events.filter((e) => e.fired).length} catastrophic conjunction(s) fired (VRU + missed detection + safety-critical exposure). Deterministic policy, not LLM-driven.` : ' — no catastrophic conjunction observed on this run.'} </Alert>
<Tabs value={tab} onChange={(_, v) => setTab(v)} sx={{ borderBottom: '1px solid #232a31' }}> <Tab label="Executive" /> <Tab label="Engineering" /> <Tab label="Data" /> <Tab label="Infrastructure" /> </Tabs>
{/* ------------------------------------------------ EXECUTIVE */} {tab === 0 && metrics ? ( <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}> <Box sx={{ display: 'flex', gap: 1.5, flexWrap: 'wrap' }}> <Tile label="violations detected" value={String(run.n_violations)} hint={`${metrics.n_committed_violations} planted · recall ${pct(metrics.rotr_recall)}`} /> <Tile label="safety-critical" value={String(scCount)} color="#ef5350" hint="counterfactual consequence class" /> <Tile label="SC-ROTR recall" value={pct(metrics.sc_rotr_recall)} hint={`exposure-derived weights ${metrics.weight_calibration.version}`} /> <Tile label="false accusations" value={pct(metrics.false_accusation_rate)} hint={`${metrics.n_planted_non_violations} planted non-violations`} /> <Tile label="BCR" value={pct(metrics.bcr)} hint="behavioral consequence rate" /> <Tile label="CFR" value={pct(metrics.cfr)} hint={`95% CI [${pct(metrics.cfr_wilson_95[0])}, ${pct(metrics.cfr_wilson_95[1])}]`} /> </Box> <SectionCard title="Regression status" subtitle="claims are delegated to seqeval's sequential engine; every comparison lands in the six-outcome distinction"> {latestReg ? ( <Box> <Box sx={{ display: 'flex', gap: 1, alignItems: 'center', flexWrap: 'wrap', mb: 1 }}> <Chip label={latestReg.primary_outcome} sx={{ fontWeight: 800, bgcolor: latestReg.primary_outcome.includes('REGRESSION') ? '#b71c1c' : '#1b5e20', color: '#fff', }} /> <Typography variant="caption" sx={{ fontFamily: 'monospace', color: '#8a949e' }}> {latestReg.baseline_model} → {latestReg.candidate_model} </Typography> </Box> <Box sx={{ display: 'flex', gap: 0.5, flexWrap: 'wrap' }}> {Object.entries(latestReg.six_outcomes).map(([k, v]) => ( <Chip key={k} size="small" label={k.replace(/_/g, ' ')} sx={{ height: 20, fontSize: 10, bgcolor: v ? '#37474f' : '#161b22', color: v ? '#fff' : '#5c6670', border: '1px solid #232a31' }} /> ))} </Box> <Typography variant="caption" sx={{ color: '#8a949e', display: 'block', mt: 1 }}> {latestReg.distribution_note} </Typography> </Box> ) : ( <Typography variant="caption" sx={{ color: '#8a949e' }}> No comparisons yet — pick a baseline run under Engineering → Model comparison. </Typography> )} </SectionCard> <SectionCard title="Runs"> <Table size="small"> <TableHead> <TableRow> <TableCell>run</TableCell> <TableCell>stack</TableCell> <TableCell align="right">scenarios</TableCell> <TableCell align="right">violations</TableCell> <TableCell align="right">ROTR recall</TableCell> <TableCell>gate</TableCell> </TableRow> </TableHead> <TableBody> {runs.map((r) => ( <TableRow key={r.run_id} hover selected={r.run_id === runId} onClick={() => selectRun(r.run_id)} sx={{ cursor: 'pointer' }}> <TableCell sx={{ fontFamily: 'monospace', fontSize: 11 }}>{r.run_id}</TableCell> <TableCell>{r.model_version}</TableCell> <TableCell align="right">{r.n_scenarios}</TableCell> <TableCell align="right">{r.n_violations}</TableCell> <TableCell align="right">{pct(r.rotr_recall)}</TableCell> <TableCell> <Chip size="small" label={r.gate_outcome} sx={{ height: 18, fontSize: 10, fontWeight: 700, bgcolor: r.gate_outcome === 'NO_GO' ? '#b71c1c' : '#1b5e20', color: '#fff' }} /> </TableCell> </TableRow> ))} </TableBody> </Table> </SectionCard> </Box> ) : null}
{/* ------------------------------------------------ ENGINEERING */} {tab === 1 ? ( <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}> <Box sx={{ display: 'grid', gridTemplateColumns: { xs: '1fr', md: '1fr 1fr 1fr' }, gap: 2 }}> <SectionCard title="Violations by legality axis"> <DistBar counts={distributions.axes.legality ?? {}} total={run.n_violations} /> </SectionCard> <SectionCard title="By attributed causal layer"> <DistBar counts={distributions.layers} total={run.n_violations} /> </SectionCard> <SectionCard title="Consequence breakdown"> {Object.entries(distributions.consequences).map(([k, n]) => ( <Box key={k} sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 0.5 }}> <Chip size="small" label={k} sx={{ bgcolor: CONSEQUENCE_COLOR[k] ?? '#37474f', color: '#fff', height: 20, fontSize: 10, minWidth: 200 }} /> <Typography variant="body2" sx={{ fontWeight: 700 }}> {n} </Typography> </Box> ))} </SectionCard> </Box>
<SectionCard title="Attribution matrix" subtitle="a violation is NEVER auto-attributed to perception — every layer needs its own positive evidence; click a row to open its consequence replay"> {matrix ? <RotrAttributionHeatmap matrix={matrix} selectedViolationId={selectedVid} onSelect={selectViolation} /> : <CircularProgress size={20} />} </SectionCard>
{consequence ? ( <SectionCard title={`Consequence replay — ${consequence.violation_id}`} subtitle="observed trajectory vs corrected-input counterfactual; scrub time with the slider"> <RotrBevReplay detail={consequence} /> </SectionCard> ) : ( <Alert severity="info">Select a violation in the attribution matrix to open its BEV consequence replay.</Alert> )}
<SectionCard title="Cluster browser" subtitle="recurring patterns grouped by structured signature (legality · actor · control · behavior · layer)"> <Table size="small"> <TableHead> <TableRow> <TableCell>cluster</TableCell> <TableCell>signature key</TableCell> <TableCell align="right">members</TableCell> <TableCell>environments</TableCell> <TableCell>consequences</TableCell> <TableCell /> </TableRow> </TableHead> <TableBody> {run.clusters.map((c) => ( <TableRow key={c.cluster_id} hover> <TableCell sx={{ fontFamily: 'monospace', fontSize: 11 }}>{c.cluster_id}</TableCell> <TableCell sx={{ fontFamily: 'monospace', fontSize: 11 }}>{c.key}</TableCell> <TableCell align="right">{c.count}</TableCell> <TableCell sx={{ fontSize: 11 }}>{c.environment_spread.join(', ')}</TableCell> <TableCell sx={{ fontSize: 11 }}> {Object.entries(c.consequence_distribution) .map(([k, n]) => `${k}:${n}`) .join(' ')} </TableCell> <TableCell> <Button size="small" onClick={() => selectViolation(c.exemplar_violation_id)}> open exemplar </Button> </TableCell> </TableRow> ))} </TableBody> </Table> </SectionCard>
<SectionCard title="Model comparison" subtitle="baseline vs the currently inspected run; statistics delegated to seqeval (rare-event aware sequential testing)"> <Box sx={{ display: 'flex', gap: 1.5, alignItems: 'center', mb: 1.5, flexWrap: 'wrap' }}> <FormControl size="small" sx={{ minWidth: 260 }}> <InputLabel>baseline run</InputLabel> <Select label="baseline run" value={baselineId} onChange={(e) => setBaselineId(e.target.value)}> {runs .filter((r) => r.run_id !== runId) .map((r) => ( <MenuItem key={r.run_id} value={r.run_id}> {r.run_id} · {r.model_version} </MenuItem> ))} </Select> </FormControl> <Typography variant="caption" sx={{ color: '#8a949e' }}> candidate = {runId} ({run.model_version}) </Typography> <Button variant="outlined" disabled={!baselineId || busy} onClick={doRegression}> Run seqeval-gated comparison </Button> </Box> {latestReg ? ( <Table size="small"> <TableHead> <TableRow> <TableCell>metric</TableCell> <TableCell align="right">delta (candidate − baseline)</TableCell> </TableRow> </TableHead> <TableBody> {Object.entries(latestReg.metric_deltas).map(([k, v]) => ( <TableRow key={k}> <TableCell sx={{ fontFamily: 'monospace', fontSize: 11 }}>{k}</TableCell> <TableCell align="right" sx={{ color: v > 0 && k.startsWith('violation_rate') ? '#ef5350' : v < 0 && k.startsWith('violation_rate') ? '#66bb6a' : '#c9d1d9', fontFamily: 'monospace' }}> {v > 0 ? '+' : ''} {v.toFixed(4)} </TableCell> </TableRow> ))} </TableBody> </Table> ) : null} </SectionCard>
<SectionCard title="Taxonomy mining — structured query" subtitle="six-axis taxonomy (+ road geometry / traffic control / visibility extensions); text parses through a deterministic keyword map"> <RotrQueryBuilder onRun={runQuery} busy={busy} /> {queryResult ? ( <Box sx={{ mt: 1.5 }}> <Typography variant="caption" sx={{ color: '#8a949e' }}> parsed query:{' '} {Object.entries(queryResult.query) .filter(([k, v]) => v != null && k !== 'text') .map(([k, v]) => `${k}=${v}`) .join(' · ') || '(no filters)'}{' '} → {queryResult.n_results} result(s) </Typography> <Table size="small"> <TableHead> <TableRow> <TableCell>violation</TableCell> <TableCell>rule</TableCell> <TableCell>layer</TableCell> <TableCell>consequence</TableCell> <TableCell>environment</TableCell> <TableCell>cluster</TableCell> <TableCell /> </TableRow> </TableHead> <TableBody> {queryResult.results.map((r) => ( <TableRow key={r.violation_id} hover> <TableCell sx={{ fontFamily: 'monospace', fontSize: 11 }}>{r.violation_id.replace(/^bank-[0-9a-f]+-/, '')}</TableCell> <TableCell sx={{ fontSize: 11 }}>{r.rule_id}</TableCell> <TableCell sx={{ fontSize: 11 }}>{r.primary_layer ?? '—'}</TableCell> <TableCell> <Chip size="small" label={r.consequence_class ?? '—'} sx={{ height: 18, fontSize: 9, bgcolor: CONSEQUENCE_COLOR[r.consequence_class ?? ''] ?? '#37474f', color: '#fff' }} /> </TableCell> <TableCell sx={{ fontSize: 11 }}> {r.environment.visibility}/{r.environment.lighting}/{r.environment.weather} </TableCell> <TableCell sx={{ fontFamily: 'monospace', fontSize: 10 }}>{r.cluster_id ?? '—'}</TableCell> <TableCell> <Button size="small" onClick={() => selectViolation(r.violation_id)}> replay </Button> </TableCell> </TableRow> ))} </TableBody> </Table> </Box> ) : null} </SectionCard> </Box> ) : null}
{/* ------------------------------------------------ DATA */} {tab === 2 ? ( <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}> <SectionCard title="Scenario coverage" subtitle="planted opportunity mix of the inspected bank (kind × environment), with commit outcomes for this stack"> <Table size="small"> <TableHead> <TableRow> <TableCell>kind</TableCell> <TableCell align="right">scenarios</TableCell> <TableCell align="right">opportunities</TableCell> <TableCell align="right">committed</TableCell> <TableCell>environments</TableCell> </TableRow> </TableHead> <TableBody> {Object.entries( run.scenario_summaries.reduce<Record<string, { n: number; opp: number; com: number; envs: Set<string> }>>((acc, s) => { const e = acc[s.kind] ?? { n: 0, opp: 0, com: 0, envs: new Set<string>() }; e.n += 1; if (s.is_violation_opportunity) e.opp += 1; if (s.committed) e.com += 1; e.envs.add(`${s.visibility}/${s.lighting}`); acc[s.kind] = e; return acc; }, {}) ).map(([kind, e]) => ( <TableRow key={kind}> <TableCell sx={{ fontFamily: 'monospace', fontSize: 11 }}>{kind}</TableCell> <TableCell align="right">{e.n}</TableCell> <TableCell align="right">{e.opp}</TableCell> <TableCell align="right" sx={{ color: e.com ? '#ef5350' : '#66bb6a' }}> {e.com} </TableCell> <TableCell sx={{ fontSize: 11 }}>{[...e.envs].join(', ')}</TableCell> </TableRow> ))} </TableBody> </Table> </SectionCard>
<SectionCard title="Rare patterns" subtitle="singleton clusters — signatures observed exactly once on this run (raremine-style rarity lens)"> {run.clusters.filter((c) => c.count === 1).length ? ( <Box sx={{ display: 'flex', gap: 0.5, flexWrap: 'wrap' }}> {run.clusters .filter((c) => c.count === 1) .map((c) => ( <Chip key={c.cluster_id} size="small" label={c.key} onClick={() => selectViolation(c.exemplar_violation_id)} sx={{ fontFamily: 'monospace', fontSize: 10 }} /> ))} </Box> ) : ( <Typography variant="caption" sx={{ color: '#8a949e' }}> No singleton signatures on this run. </Typography> )} </SectionCard>
<SectionCard title="HITL validation queue" subtitle="confirmed violation → failure signature → cluster → regression-test artifact; validation is the ONLY path into the suite"> <Table size="small"> <TableHead> <TableRow> <TableCell>review</TableCell> <TableCell>violation</TableCell> <TableCell>cluster</TableCell> <TableCell>status</TableCell> <TableCell /> </TableRow> </TableHead> <TableBody> {hitl.map((r) => ( <TableRow key={r.review_id} hover> <TableCell sx={{ fontFamily: 'monospace', fontSize: 11 }}>{r.review_id.replace(/^rev-bank-[0-9a-f]+-/, '')}</TableCell> <TableCell sx={{ fontFamily: 'monospace', fontSize: 11 }}>{r.violation_id.replace(/^bank-[0-9a-f]+-/, '')}</TableCell> <TableCell sx={{ fontFamily: 'monospace', fontSize: 10 }}>{r.cluster_id ?? '—'}</TableCell> <TableCell> <Chip size="small" label={r.status} sx={{ height: 18, fontSize: 10, bgcolor: r.status === 'PENDING' ? '#e65100' : r.status === 'VALIDATED' ? '#1b5e20' : '#37474f', color: '#fff' }} /> </TableCell> <TableCell> {r.status === 'PENDING' ? ( <> <Button size="small" color="success" onClick={() => act(r, 'VALIDATE')}> validate </Button> <Button size="small" color="inherit" onClick={() => act(r, 'REJECT')}> reject </Button> </> ) : null} </TableCell> </TableRow> ))} </TableBody> </Table> </SectionCard>
<SectionCard title="Training candidates" subtitle="immutable dataset roles; REGRESSION/LAUNCH members are never training-eligible without a recorded governance override (contamination guard)"> <Box sx={{ display: 'flex', gap: 1, alignItems: 'center', mb: 1 }}> <TextField size="small" fullWidth label="governance override reason (required before promoting a protected member)" value={overrideReason} onChange={(e) => setOverrideReason(e.target.value)} /> </Box> <Table size="small"> <TableHead> <TableRow> <TableCell>candidate</TableCell> <TableCell>violation</TableCell> <TableCell>role</TableCell> <TableCell>guard</TableCell> <TableCell>training-eligible</TableCell> <TableCell /> </TableRow> </TableHead> <TableBody> {candidates.map((c) => ( <TableRow key={c.candidate_id} hover> <TableCell sx={{ fontFamily: 'monospace', fontSize: 11 }}>{c.candidate_id}</TableCell> <TableCell sx={{ fontFamily: 'monospace', fontSize: 11 }}>{c.violation_id.replace(/^bank-[0-9a-f]+-/, '')}</TableCell> <TableCell> <Chip size="small" label={c.dataset_role} sx={{ height: 18, fontSize: 10, fontWeight: 700, bgcolor: ROLE_COLOR[c.dataset_role] ?? '#37474f', color: '#fff' }} /> </TableCell> <TableCell> <Chip size="small" label={c.guard_state} sx={{ height: 18, fontSize: 10, bgcolor: c.guard_state === 'PROTECTED' ? '#b71c1c' : c.guard_state === 'OVERRIDDEN' ? '#e65100' : '#1b5e20', color: '#fff' }} /> </TableCell> <TableCell sx={{ fontSize: 11 }}>{c.training_eligible ? 'yes' : 'no'}</TableCell> <TableCell> <Button size="small" onClick={() => promote(c)}> promote to training </Button> <Button size="small" color="warning" disabled={!overrideReason.trim()} onClick={() => override(c)}> record override </Button> </TableCell> </TableRow> ))} </TableBody> </Table> </SectionCard>
<SectionCard title="Regression suite" subtitle={`suite members re-run against every candidate · registry backend: ${suite?.registry_backend ?? '—'}`}> {suite?.members.length ? ( <Table size="small"> <TableHead> <TableRow> <TableCell>candidate</TableCell> <TableCell>violation</TableCell> <TableCell>role</TableCell> <TableCell>added by</TableCell> <TableCell>added at</TableCell> </TableRow> </TableHead> <TableBody> {suite.members.map((m) => ( <TableRow key={m.candidate_id}> <TableCell sx={{ fontFamily: 'monospace', fontSize: 11 }}>{m.candidate_id}</TableCell> <TableCell sx={{ fontFamily: 'monospace', fontSize: 11 }}>{m.violation_id.replace(/^bank-[0-9a-f]+-/, '')}</TableCell> <TableCell> <Chip size="small" label={m.role} sx={{ height: 18, fontSize: 10, bgcolor: ROLE_COLOR[m.role] ?? '#37474f', color: '#fff' }} /> </TableCell> <TableCell sx={{ fontSize: 11 }}>{m.added_by ?? '—'}</TableCell> <TableCell sx={{ fontSize: 11 }}>{m.added_at}</TableCell> </TableRow> ))} </TableBody> </Table> ) : ( <Typography variant="caption" sx={{ color: '#8a949e' }}> Empty — validate a HITL item to create the first regression artifact. </Typography> )} </SectionCard> </Box> ) : null}
{/* ------------------------------------------------ INFRASTRUCTURE */} {tab === 3 && metrics ? ( <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}> <Box sx={{ display: 'flex', gap: 1.5, flexWrap: 'wrap' }}> <Tile label="last run wall time (measured in this browser)" value={lastRunWallMs != null ? `${(lastRunWallMs / 1000).toFixed(1)}s` : 'not measured this session'} hint={lastRunWallMs != null ? `${(run.n_scenarios / (lastRunWallMs / 1000)).toFixed(1)} scenarios/s incl. attribution + counterfactual replay` : 'generate a run to measure'} /> <Tile label="scenarios in run" value={String(run.n_scenarios)} hint={`bank ${run.bank_id}`} /> <Tile label="seqeval samples used (last comparison)" value={latestReg?.seqeval && typeof latestReg.seqeval.samples_used === 'number' ? String(latestReg.seqeval.samples_used) : '—'} hint={latestReg?.seqeval && typeof latestReg.seqeval.full_population === 'number' ? `of ${latestReg.seqeval.full_population} population objects (early stopping)` : 'run a comparison first'} /> <Tile label="evaluation cost" value="NOT MEASURED" color="#8a949e" hint="no cost meter exists in this deployment; a production system could attach one per run" /> <Tile label="storage footprint" value="NOT MEASURED" color="#8a949e" hint="runs persist as JSON under runs/rotr/; no quota accounting is implemented" /> </Box> <SectionCard title="Deterministic versions" subtitle="everything that must be pinned for a byte-identical re-run"> <Box sx={{ display: 'flex', gap: 0.75, flexWrap: 'wrap' }}> <Chip size="small" label={`ruleset ${run.ruleset_version}`} sx={{ fontFamily: 'monospace' }} /> <Chip size="small" label={`weights ${metrics.weight_calibration.version}`} sx={{ fontFamily: 'monospace' }} /> <Chip size="small" label={`stop-ship policy ${policy?.policy_version ?? '—'}`} sx={{ fontFamily: 'monospace' }} /> <Chip size="small" label={`stack ${run.model_version}`} sx={{ fontFamily: 'monospace' }} /> <Chip size="small" label={`bank ${run.bank_id} (content-addressed)`} sx={{ fontFamily: 'monospace' }} /> </Box> <Typography variant="caption" sx={{ color: '#8a949e', display: 'block', mt: 1 }}> {metrics.weight_calibration.method} </Typography> </SectionCard> <SectionCard title="Honesty ledger" subtitle="what is real vs illustrative on this page"> <Typography variant="body2" sx={{ color: '#c9d1d9', fontSize: 13 }}> Real: rule verdicts, attribution evidence, counterfactual trajectories, seqeval statistics, contamination-guard enforcement, all determinism guarantees. Illustrative (synthetic substrate): every physical threshold, the scenario kinematics, the exposure-derived weights (calibrated on the bank itself). Surrogate caveat: {metrics.surrogate_caveat} </Typography> </SectionCard> </Box> ) : null} </> )} </Box> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134/** Typed fetch wrappers for the ROTR capability (/api/rotr/*). */
import type { RotrConsequenceDetail, RotrQueryResponse, RotrRegressionResult, RotrRunListItem, RotrRunSummary, RotrHITLReview, RotrStopshipPolicy, RotrSuite, RotrTrainingCandidate, RotrViolationDetail, RotrAttributionMatrix,} from '../types/rotr';
async function handle<T>(res: Response): Promise<T> { if (!res.ok) { const body = await res.text().catch(() => ''); throw new Error(`API ${res.status}: ${body || res.statusText}`); } return res.json() as Promise<T>;}
const JSON_HEADERS = { 'Content-Type': 'application/json' };
function get<T>(url: string): Promise<T> { return fetch(url).then((res) => handle<T>(res));}
function post<T>(url: string, body?: unknown): Promise<T> { return fetch(url, { method: 'POST', headers: JSON_HEADERS, body: body === undefined ? undefined : JSON.stringify(body), }).then((res) => handle<T>(res));}
export function createRun(params: { n_scenarios: number; seed: number; model_version: string;}): Promise<RotrRunSummary> { return post('/api/rotr/runs', params);}
export function listRuns(): Promise<RotrRunListItem[]> { return get('/api/rotr/runs');}
export function getRun(runId: string): Promise<RotrRunSummary> { return get(`/api/rotr/runs/${encodeURIComponent(runId)}`);}
export function getAttributionMatrix(runId: string): Promise<RotrAttributionMatrix> { return get(`/api/rotr/runs/${encodeURIComponent(runId)}/attribution`);}
export function getViolation(runId: string, violationId: string): Promise<RotrViolationDetail> { return get( `/api/rotr/runs/${encodeURIComponent(runId)}/violations/${encodeURIComponent(violationId)}` );}
export function getConsequence( runId: string, violationId: string): Promise<RotrConsequenceDetail> { return get( `/api/rotr/runs/${encodeURIComponent(runId)}/violations/${encodeURIComponent( violationId )}/consequence` );}
export function structuredQuery(params: { run_id: string; text?: string; filters?: Record<string, string>;}): Promise<RotrQueryResponse> { return post('/api/rotr/query', params);}
export function runRegression(params: { baseline_run_id: string; candidate_run_id: string;}): Promise<RotrRegressionResult> { return post('/api/rotr/regression', params);}
export function listRegressions(): Promise<RotrRegressionResult[]> { return get('/api/rotr/regressions');}
export function getHitlQueue(runId: string): Promise<RotrHITLReview[]> { return get(`/api/rotr/runs/${encodeURIComponent(runId)}/hitl`);}
export function hitlAction(params: { run_id: string; review_id: string; action: 'VALIDATE' | 'REJECT'; actor: string; notes?: string;}): Promise<{ review: RotrHITLReview; candidate: RotrTrainingCandidate | null }> { return post('/api/rotr/hitl/action', params);}
export function getSuite(): Promise<RotrSuite> { return get('/api/rotr/flywheel/suite');}
export function listCandidates(): Promise<RotrTrainingCandidate[]> { return get('/api/rotr/flywheel/candidates');}
export function promoteCandidate(params: { candidate_id: string; actor: string;}): Promise<RotrTrainingCandidate> { return post('/api/rotr/flywheel/promote', params);}
export function overrideCandidate(params: { candidate_id: string; actor: string; reason: string;}): Promise<RotrTrainingCandidate> { return post('/api/rotr/flywheel/override', params);}
export function getStopshipPolicy(): Promise<RotrStopshipPolicy> { return get('/api/rotr/stopship/policy');}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292/** Contracts for the ROTR (right-of-the-road) API (/api/rotr/*). */
export interface RotrEnvironment { visibility: string; weather: string; lighting: string;}
export interface RotrScenarioSummary { scenario_id: string; kind: string; committed: boolean; is_violation_opportunity: boolean; expected_rule_id: string | null; cause_layer: string | null; vulnerability: string; visibility: string; lighting: string; weather: string; n_violations_detected: number;}
export interface RotrLayerEvidence { layer: string; status: 'SUPPORTED' | 'RULED_OUT' | 'UNKNOWN'; evidence: string; confidence: number;}
export interface RotrAttributionRow { violation_id: string; scenario_id: string; rule_id: string; primary_layer: string | null; layers: Record<string, RotrLayerEvidence>; note: string;}
export interface RotrAttributionMatrix { run_id: string; rows: RotrAttributionRow[]; invariant: string;}
export interface RotrSafetyAssessment { min_ttc_s: number | null; pet_s: number | null; min_clearance_m: number | null; stopping_distance_m: number | null; max_braking_mps2: number; max_lateral_deviation_m: number; collision: boolean; surrogate_caveat: string;}
export interface RotrTrajectoryPoint { t: number; x: number; y: number; v: number; a: number;}
export interface RotrConsequenceSummary { consequence_class: string; corrected_layers: string[]; engine: string; max_position_divergence_m: number; observed_safety: RotrSafetyAssessment; corrected_safety: RotrSafetyAssessment;}
export interface RotrConsequenceDetail { counterfactual_id: string; violation_id: string; scenario_id: string; corrected_layers: string[]; consequence_class: string; planner_evaluation: { engine: string; observed_trajectory: RotrTrajectoryPoint[]; corrected_trajectory: RotrTrajectoryPoint[]; max_position_divergence_m: number; max_speed_divergence_mps: number; corrected_max_braking_mps2: number; corrected_intervention: boolean; }; observed_safety: RotrSafetyAssessment; corrected_safety: RotrSafetyAssessment; scenario_geometry?: { actual_context: { intersection_type: string; control: string; stop_line_x: number | null; intersection_x_min: number | null; intersection_x_max: number | null; lanes: { lane_id: string; center_y: number; restricted_to: string | null }[]; crosswalks: { crosswalk_id: string; x_min: number; x_max: number }[]; }; actors: { actor_id: string; class_name: string; dims: number[]; states: { t: number; x: number; y: number; yaw: number }[]; }[]; };}
export interface RotrGateEvent { violation_id: string; legs: Record<string, boolean>; fired: boolean; note: string;}
export interface RotrGate { gate_id: string; run_id: string; policy_version: string; outcome: 'GO' | 'NO_GO'; events: RotrGateEvent[]; agentic_advisory: Record<string, unknown> | null;}
export interface RotrCluster { cluster_id: string; key: string; count: number; member_violation_ids: string[]; exemplar_violation_id: string; environment_spread: string[]; consequence_distribution: Record<string, number>;}
export interface RotrWeightStratum { n: number; harm_fraction: number; weight: number; recall: number | null;}
export interface RotrMetrics { n_scenarios: number; n_committed_violations: number; n_planted_non_violations: number; n_detected: number; n_violation_records: number; rotr_recall: number | null; false_accusation_rate: number | null; sc_rotr_recall: number | null; bcr: number | null; cfr: number | null; cfr_wilson_95: [number, number]; weight_calibration: { version: string; method: string; strata: Record<string, RotrWeightStratum>; }; cohorts: Record<string, { n: number; detected: number; recall: number | null }>; behavior_rates: Record< string, { opportunities: number; committed: number; violation_rate: number | null } >; surrogate_caveat: string;}
export interface RotrRunSummary { run_id: string; bank_id: string; model_version: string; ruleset_version: string; n_scenarios: number; n_violations: number; scenario_summaries: RotrScenarioSummary[]; metrics: RotrMetrics; clusters: RotrCluster[]; gate: RotrGate;}
export interface RotrRunListItem { run_id: string; bank_id: string; model_version: string; n_scenarios: number; n_violations: number; gate_outcome: string; rotr_recall: number | null;}
export interface RotrQueryResultItem { violation_id: string; scenario_id: string; rule_id: string; rule_version: string; description: string; taxonomy: Record<string, string>; evidence: Record<string, unknown>; confidence: number; primary_layer: string | null; consequence_class: string | null; cluster_id: string | null; environment: RotrEnvironment; provenance: Record<string, unknown>;}
export interface RotrQueryResponse { query: Record<string, string | null>; n_results: number; results: RotrQueryResultItem[];}
export interface RotrViolationDetail { violation: { violation_id: string; scenario_id: string; rule_id: string; rule_version: string; description: string; actor_ids: string[]; evidence: Record<string, unknown>; confidence: number; taxonomy: Record<string, string>; }; attribution: { primary_layer: string | null; layers: Record<string, RotrLayerEvidence>; note: string; } | null; consequence: RotrConsequenceSummary | null;}
export interface RotrRegressionResult { regression_id: string; baseline_run_id: string; candidate_run_id: string; baseline_model: string; candidate_model: string; metric_deltas: Record<string, number>; six_outcomes: Record<string, boolean>; primary_outcome: string; seqeval: Record<string, unknown> | null; distribution_note: string;}
export interface RotrHITLReview { review_id: string; run_id: string; violation_id: string; cluster_id: string | null; status: 'PENDING' | 'VALIDATED' | 'REJECTED'; action: string | null; actor: string | null; notes: string;}
export interface RotrTrainingCandidate { candidate_id: string; run_id: string; violation_id: string; cluster_id: string | null; dataset_role: string; training_eligible: boolean; guard_state: string; override: { actor: string; reason: string; at: string } | null; studio2_entity_id?: string | null; registry_backend?: string;}
export interface RotrSuite { suite_id: string; registry_backend: string; members: { candidate_id: string; violation_id: string; cluster_id: string | null; run_id: string; role: string; added_at: string; added_by: string | null; }[];}
export interface RotrStopshipPolicy { policy: { policy_name: string; policy_semver: string; conjunction: Record<string, unknown>; notes: string; }; policy_version: string; note: string;}src/App.tsx+13-8
src/components/help/HelpMenu.tsx+3-1
src/components/rotr/RotrAttributionHeatmap.tsxAdded+140
src/components/rotr/RotrBevReplay.tsxAdded+225
src/components/rotr/RotrQueryBuilder.tsxAdded+128
src/content/glossary.ts+95-57
src/content/pageHelp.ts+48-36
src/context/LabelEvalContext.tsx+3-1
src/pages/rotr/RotrControlCenterPage.tsxAdded+843
src/services/rotr.tsAdded+134
src/types/rotr.tsAdded+292