'use strict';
function recordingRepairHistory(t,e){
const old=t.recording_replacements||[], diagnostics=t.predicate_diagnostics||[];
if(!old.length&&!diagnostics.length)return '';
return panel('Recording repair and native diagnostics',`
${old.map(h=>`
Earlier native ${h.success?'success':'failure'} · ${num(h.steps)} steps. Original native verdict and evidence retained; video repair preserves every available source frame.
`:''}`);
const earlier=e?.instruction_policy==='modified' && measuredInstruction(e)!==r.instruction;
const measured=earlier?'This recording used an earlier modified instruction. The current revised definition is shown for comparison.':e?(e.instruction_policy==='modified'?'This recording used the modified instruction.':'This recording used the original instruction. The revised definition is shown for comparison.'):'This revised task has not been evaluated yet.';
return panel('Modified instruction',`
${measured}
${modifiedText(t)}
Highlighted words show additions and replacements. ${external(r.source_url,'Instruction source')}
${e?`Native: ${outcome(e).toLowerCase()}Execution: ${esc(e.execution.status)}Evidence: ${e.verdict.evidence_valid?'valid':'invalid'}Usage: ${e.usage.audit_complete?'complete':'incomplete'}`:'Pending · no published result'}
Native spectator recording · ${m.width} × ${m.height} · ${m.duration_s.toFixed(2)} s
${views.length} native ${m.recording.views[0].height}p views captured at ${m.source_fps} FPS; ${m.recording.dropped_samples?num(m.recording.dropped_samples)+' capture samples dropped; ':''}edited to 4× simulation speed and ${m.output_fps} FPS. ${m.terminal_hold_s?`All ${num(m.native_frames)} recorded source frames retained; the true final frame is held for ${m.terminal_hold_s} seconds without advancing simulation. ${e.links.terminal_frame?external(e.links.terminal_frame,"Final recorded frame"):""}`:""} Agent events below use wall time and are not frame-synchronized.
Loading session counts… Tool inputs and outputs are expandable; the native session download retains the full event format. Event timestamps are in UTC.
No tool or memo files were saved in this episode. The session and workspace evidence remain available below.','wide-panel')+
panel('Evidence & provenance',`
Lightweight public evidence is stored in the Dataset. Host paths are redacted in copies; original event IDs, native verdicts and usage are preserved.
`;
}).join('');$('#more-events').hidden=count>=selected.length;
}
document.querySelectorAll('.review-event').forEach(button=>button.onclick=()=>{$('#event-filter').value='all';$('#event-search').value=button.dataset.eventId;count=24;renderEvents();const event=document.querySelector('.event[data-event="'+button.dataset.eventId+'"]');if(event){event.open=true;event.scrollIntoView({block:'center'});}});
$('#event-filter').onchange=()=>{count=24;renderEvents();};$('#event-search').oninput=()=>{count=24;renderEvents();};$('#more-events').onclick=()=>{count+=24;renderEvents();};renderEvents();
$('#observation-grid').innerHTML=events.flatMap(v=>v.parts.filter(p=>p.type==='image').map(p=>`${esc(v.id)}`)).join('');
$('#detail').dataset.ready='true';
}
function showError(e){console.error(e);const p=document.createElement('p');p.setAttribute('role','alert');p.textContent='An asset could not be loaded. Please refresh or open the Dataset evidence.';$('#detail').append(p);}
async function route(){
const epoch=++routeEpoch,hash=decodeURIComponent(location.hash.slice(1));
const video=$('#episode-video');if(video)video.pause();
if(hash.startsWith('task/')){
const [taskKey,query]=hash.slice(5).split("?");const task=data.tasks.find(t=>t.key===taskKey);$('#browse').hidden=true;$('#detail').hidden=false;$('#detail').dataset.ready='false';$('#detail').dataset.taskKey=taskKey;window.scrollTo(0,0);
if(!task){$('#detail').innerHTML='← All tasks
Task not found
';return;}
document.title=task.title+' · Codex Benchmark';if(query)window.history.replaceState(null,'','#task/'+task.key);const e=data.episodes.find(e=>e.task_key===task.key&&e.id===task.episode_id);
if(e)await renderResult(task,e,epoch);else{$('#detail').innerHTML=renderPending(task);$('#detail').dataset.ready='true';}
}else{
$('#detail').hidden=true;$('#detail').innerHTML='';$('#browse').hidden=false;document.title=data.title+' · RLE-Bench';
if(hash){if(!document.getElementById(hash)&&data.families.some(f=>f.id===hash)){$('#search').value='';$('#status-filter').value='all';$('#failure-filter').value='all';renderCards();}requestAnimationFrame(()=>document.getElementById(hash)?.scrollIntoView());}else window.scrollTo(0,0);
}
}
(async()=>{try{const r=await fetch('data.json');if(!r.ok)throw Error('Data index unavailable');data=await r.json();renderOverview();$('#loading').hidden=true;$('#search').oninput=renderCards;$('#status-filter').onchange=renderCards;$('#failure-filter').onchange=renderCards;window.addEventListener('hashchange',()=>route().catch(showError));await route();document.body.dataset.ready='true';}catch(e){$('#loading').textContent='Could not load benchmark data. Please refresh or open the Dataset.';console.error(e);}})();