// Live data-source pill — shows status + per-config progress bars. const { useState: useStateDS, useEffect: useEffectDS, useRef: useRefDS } = React; function DataSource() { const [s, setS] = useStateDS(window.AtlasLoader.state); const [expanded, setExpanded] = useStateDS(false); const [panelPos, setPanelPos] = useStateDS({ top: 0, right: 0 }); const pillRef = useRefDS(null); useEffectDS(() => window.AtlasLoader.subscribe(setS), []); useEffectDS(() => { if (!expanded || !pillRef.current) return; const r = pillRef.current.getBoundingClientRect(); setPanelPos({ top: r.bottom + 10, right: window.innerWidth - r.right }); }, [expanded]); const dot = { idle: { c: 'var(--cream-dim)', label: 'idle' }, loading: { c: 'var(--gold)', label: 'streaming' }, live: { c: 'var(--sage)', label: 'live' }, error: { c: 'var(--coral)', label: 'offline' }, }[s.status] || { c: 'var(--cream-dim)', label: s.status }; // pill label let pillLabel = `data · ${dot.label}`; if (s.status === 'loading') { const totalLoaded = (s.progress.perHead + s.progress.bouncer + s.progress.prompts) / 3; pillLabel = `streaming · ${Math.round(totalLoaded * 100)}%`; } else if (s.status === 'live') { pillLabel = 'live · juiceb0xc0de'; } const panel = expanded && ReactDOM.createPortal(
connected to
huggingface.co/datasets/{s.repo}
{s.status === 'error' && (
{s.error || 'could not reach dataset'}
)} {s.splits && s.splits.length > 0 && (
configs · {s.splits.length}
{s.splits.map(sp => { // map config name to a progress key const k = sp.config === 'per_head' ? 'perHead' : sp.config === 'bouncer_analysis' ? 'bouncer' : sp.config === 'prompts' ? 'prompts' : null; const p = k ? (s.progress[k] || 0) : null; return (
{sp.config} {(sp.num_rows ?? '?').toLocaleString()} rows
{p != null && (
)}
); })}
)}
status
N_LAYERS{window.AtlasData?.N_LAYERS}
components{window.AtlasData?.COMPONENTS?.length}
features{(window.AtlasData?.SURGICAL?.length || 0).toLocaleString()}
behaviors{window.AtlasData?.BEHAVIORS?.length}
source{window.AtlasData?.META?.source || 'preview'}
Real-time fetch of the published configs from the HuggingFace datasets-server. compliance_scores (52 MB of raw per-feature vectors) is intentionally skipped to keep page load fast — query via SQL instead.
, document.body ); return (
{panel}
); } window.DataSource = DataSource;