'use strict'; const $ = s => document.querySelector(s); const $$ = s => [...document.querySelectorAll(s)]; const esc = value => String(value ?? '').replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); const number = v => v == null ? '—' : Number(v).toLocaleString('en-US'); const compact = v => v == null ? '—' : Math.abs(v) >= 1e9 ? (v/1e9).toFixed(2)+'B' : Math.abs(v) >= 1e6 ? (v/1e6).toFixed(2)+'M' : Math.abs(v) >= 1e3 ? (v/1e3).toFixed(1)+'K' : Math.round(v).toString(); const pct = v => v == null ? '—' : (v*100).toFixed(1)+'%'; const elapsed = v => v == null ? '—' : v >= 3600 ? (v/3600).toFixed(1)+' h' : v >= 60 ? (v/60).toFixed(1)+' min' : v.toFixed(1)+' s'; const arrow = ''; const colors = {'codex-astra':'#39819c','kinex-astra':'#756ee4','cc-opus':'#b48566','kinex-opus':'#958bc8','cc-opus-vertex-high':'#c9875a','cc-opus-vertex-xhigh':'#8c5a3a','kinex-opus-vertex-high':'#5b8bd8','kinex-opus-vertex-xhigh':'#3a5ba6'}; let data, epoch = 0, current = {}, matrixMetric = 'success'; let filters = {query:'',family:'',status:'',variant:'codex-astra',sort:'catalog'}; let sessionState = {filter:'all',query:'',count:40,view:'timeline'}; let imageItems = [], imageIndex = 0; const sessionCache = new Map(), fileCache = new Map(); const episodes = (variant, family) => data.episodes.filter(e => (!variant || e.variant===variant) && (!family || e.family===family)); const epFor = (key, variant) => data.episodes.find(e => e.task_key===key && e.variant===variant); const variantFor = id => data.variants.find(v => v.id===id); const familyName = id => data.families.find(f => f.id===id)?.name || id; const variantName = id => {const v=variantFor(id);return v ? `${v.agent} + ${v.model}` : id;}; const taskRoute = (key, variant='codex-astra', section='overview') => `#task/${key}/${variant}${section==='overview' ? '' : '/'+section}`; const outcome = e => !e ? 'pending' : e.valid===false ? 'invalid' : typeof e.success!=='boolean' ? 'unreported' : e.success ? 'pass' : 'fail'; const badge = (e, link) => {const s=outcome(e),tag=link?'a':'span';return `<${tag} class="badge ${s}" ${link ? `href="${esc(link)}"` : ''}>${s==='pending'?((data.active_campaign?.initialization_blocked||[]).includes((link||'').split('/').slice(1,4).join('/'))?'Blocked':'Pending'):s==='invalid'?'Invalid':s==='unreported'?'Unreported':s==='pass'?'Pass':'Fail'}`;}; const external = (url,label,cls='') => typeof url==='string' && url.startsWith('https://') ? `${esc(label)} ${arrow}` : ''; const modelLabel = v => `${v.model} / ${v.effort}`; const icon = v => ``; function stats(es) { return UsageMetrics.stats(es); } window.benchmarkStats = stats; const tokens = e => e && Number.isFinite(e.usage?.input_tokens) && Number.isFinite(e.usage?.output_tokens) ? e.usage.input_tokens+e.usage.output_tokens : null; function metric(value,label,detail='',attrs='') {return `
${label}${value}${detail?`${detail}`:''}
`;} function usageDefinition(){return 'Input = fresh input + cache writes. Cached = cache reads. Cache hit rate = cached / (input + cached), weighted by tokens. Output includes reasoning. Metrics cover current selected evaluated episodes; unavailable values are never zero.';} function variantTabs(selected,taskKey,section) { return `
${data.variants.map(v=>`${icon(v)}${esc(v.agent)}${taskKey?badge(epFor(taskKey,v.id)):''}${modelLabel(v)}`).join('')}
`; } const rangeNumber = (lo,hi,formatter=compact) => UsageMetrics.bounds(lo,hi,formatter); const costValue = s => UsageMetrics.bounds(s.costLow,s.costHigh,UsageMetrics.money); const exactMoney = v => v == null ? '—' : '$'+v.toLocaleString('en-US',{minimumFractionDigits:6,maximumFractionDigits:6}); const costNote = s => !s.n ? 'Not evaluated' : s.costCount!==s.n ? `Pricing available for ${s.costCount} / ${s.n} episodes` : s.conditional ? 'Estimated · 5m cache-write basis' : 'Estimated · published rate rules'; function usageTiles(s,includeCost=true) { return `
${metric(rangeNumber(s.inputLow,s.inputHigh),'Input tokens','Fresh input + cache writes',`title="${rangeNumber(s.inputLow,s.inputHigh,number)}; excludes cache reads"`)}${metric(rangeNumber(s.cacheLow,s.cacheHigh),'Cached tokens','Cache reads',`title="${rangeNumber(s.cacheLow,s.cacheHigh,number)}"`)}${metric(rangeNumber(s.cacheRateLow,s.cacheRateHigh,pct),'Cache hit rate','Cached / (input + cached)')}${metric(compact(s.output),'Output tokens',s.reasoning==null?'Includes reasoning when reported':compact(s.reasoning)+' reasoning')}${includeCost?metric(costValue(s),'Total cost',costNote(s)):''}
`; } function costBreakdown(s,open=false) { if (!s.n) return ''; const names={fresh_input:'Fresh input',cache_read:'Cache reads',cache_write:'Cache writes',output:'Output',unclassified_input:'Unclassified input'}; const order=['fresh_input','cache_write','cache_read','output','unclassified_input']; const rows=[...s.buckets].sort((a,b)=>order.indexOf(a.category)-order.indexOf(b.category)||a.tier.localeCompare(b.tier)); return `
Cost breakdown USD · estimated+
${s.costCount!==s.n?`

A complete cost is unavailable. The breakdown covers ${s.costCount} of ${s.n} episodes only.

`:''}
${rows.map(b=>``).join('')}
Usage categoryPricing tierTokensUSD / 1M tokensCost (USD)
${names[b.category]}${esc(b.tier)}${number(b.tokens)}${rangeNumber(b.rate,b.rate_upper,UsageMetrics.money)}${rangeNumber(b.lower,b.upper,exactMoney)}
${s.costCount===s.n?'Total estimated cost':'Known subtotal'}${s.costCount===s.n?rangeNumber(s.costLow,s.costHigh,exactMoney):exactMoney(s.knownCost)}

Each row = tokens × its rate / 1,000,000. Cache reads are charged separately; reasoning is already included in output.

Astra: above 272K input tokens per request, input/cache rates double and output rates increase by 1.5×. ${number(s.longContext)} such requests in this selection. Claude Code uses its recorded list-price estimate, reconciled to the tiers above.${s.conditional?' Kinex + Opus on Vertex uses a 5-minute cache-write assumption; the recorded audit does not establish cache TTL.':''}${s.bounded?' A range allocates unclassified input across the possible rates; it does not treat missing cache counters as zero.':''}

API-equivalent estimates, not verified account charges. Subscription allocation, discounts, credits, taxes, simulator costs and archived attempts are excluded. Rates checked ${esc(UsageMetrics.pricingDate||'—')}.

`; } function modelGroups() { const groups=new Map(); for (const v of data.variants) { const key=v.model+' / '+v.effort; if(!groups.has(key))groups.set(key,{key,model:v.model,effort:v.effort,variants:[]}); groups.get(key).variants.push(v); } return [...groups.values()]; } let expandedModels=null; function comparisonCell(v,f) { const s=stats(episodes(v.id,f.id)),link=`#runs/${v.id}?family=${f.id}`; let value; if(matrixMetric==='success')value=`
${pct(s.rate)}${s.n?s.passes+' / '+s.n+' passed':'Not evaluated'}
`; else if(matrixMetric==='tokens')value=`
Input
${rangeNumber(s.inputLow,s.inputHigh)}
Cached
${rangeNumber(s.cacheLow,s.cacheHigh)}
Cache hit
${rangeNumber(s.cacheRateLow,s.cacheRateHigh,pct)}
Output
${compact(s.output)}
`; else value=`
${costValue(s)}${costNote(s)}
${costBreakdown(s)}`; return `${value}${s.n} evaluated · ${f.tasks-s.n} pending ${arrow}`; } function comparisonTable() { return `

Compare environments

Choose a model to compare its harnesses. Coverage is shown for each environment.

${[['success','Success rate'],['tokens','Token usage'],['cost','Total cost']].map(([k,l])=>``).join('')}

${matrixMetric==='tokens'?usageDefinition():matrixMetric==='cost'?'Estimated USD at the recorded or documented API rates. Expand a breakdown to inspect token categories and pricing tiers.':'Native passes / evaluated tasks. Pending tasks are excluded; compare coverage alongside success rates.'}

${modelGroups().map((g,i)=>`
${esc(g.model)}${esc(g.effort)} effort · ${g.variants.map(v=>esc(v.agent)).join(' vs ')}${g.variants.length} harnesses ⌄
${g.variants.map(v=>``).join('')}${data.families.map(f=>`${g.variants.map(v=>comparisonCell(v,f)).join('')}`).join('')}
Environment${icon(v)}${esc(v.agent)} ${arrow}
${f.id.slice(-2)}${esc(f.name)}${f.tasks} tasks
`).join('')}
`; } function campaignProgress(){ const c=data.active_campaign;if(!c)return '';const n=c.counts||{}; return `
BEHAVIOR evaluation · GPT-6 Astra / high

${number(n.finished||0)} / ${number(c.planned_episodes)} episodes completed · ${number(n.running||0)} running · ${number(n.queued||0)} queued${n.not_run?' · '+number(n.not_run)+' unavailable':''}${n.needs_review?' · '+number(n.needs_review)+' under review':''}. ${c.closed&&c.published_episodes===n.finished?'Evaluations have finished. All available results, videos and evidence are listed below.':'Results, videos and evidence are published after verification.'}

Updated ${esc(c.updated_at)} · Campaign status and provenance ↗

`; } function opusPilotProgress(){ const c=data.pilot_campaigns?.['cc-opus'];if(!c)return '';const n=c.counts||{}; return `
Claude Code · Opus 5.5 / high

${number(n.finished||0)} / ${number(c.planned_episodes)} episodes completed · ${number(n.running||0)} running · ${number(n.queued||0)} pending${n.needs_review?' · '+number(n.needs_review)+' under review':''}${n.interrupted?' · '+number(n.interrupted)+' interrupted':''}.

${c.quota_waiting?'Waiting for model-service quota recovery · ':''}${number(c.published_episodes)} episode records published · Results and protocol ↗

`; } function methodology() { return `
Reading the benchmarkProtocol, metrics & provenance+

One selected episode

Each task–agent pair shows its currently selected episode (seed 0 by default; explicit exceptions retain the measured seed). Previous attempts remain in the archive and are excluded from the displayed metrics. Results are added as episodes finish.

Native success

Success rate is passes / evaluated tasks, pooled over the selected episodes. Pending tasks do not count as failures. Results follow the original native verifier; Native notes identify verified simulator source issues.

Measured configuration

Each episode retains its actual instruction, control budget, runtime version and source revision. Historical runs retain their measured configuration. Availability is shown for each task and agent.

Token accounting

${usageDefinition()} Missing counters display as unavailable, never as zero.

`; } function taskBrowser(variant=null) { return `
${variant?'Episode index':'Browse the benchmark'}

Explore tasks ${data.tasks.length}

${variant?'':``}
${variant?'':data.variants.map(v=>``).join('')}
TaskNative resultInput tokensFresh + cache writesCached tokensCache readsCache hitOutputTotal costEstimated USDControl steps${v.agent}${v.model} · ${v.effort}
`; } function renderRows() { const variant=current.type==='runs'?current.variant:null, selected=variant||filters.variant, q=filters.query.trim().toLowerCase(); let tasks=data.tasks.filter(t=>(!filters.family||t.family===filters.family)&&(!filters.status||outcome(epFor(t.key,selected))===filters.status)&&(!q||[t.key,t.title,t.catalog_instruction,t.native_id,familyName(t.family)].some(s=>s?.toLowerCase().includes(q)))); if(filters.sort==='name') tasks.sort((a,b)=>a.title.localeCompare(b.title)); if(filters.sort==='tokens') tasks.sort((a,b)=>(UsageMetrics.usage(epFor(b.key,selected)).inputHigh??-1)-(UsageMetrics.usage(epFor(a.key,selected)).inputHigh??-1)); if(filters.sort==='cost') tasks.sort((a,b)=>(UsageMetrics.price(epFor(b.key,selected))?.upper??-1)-(UsageMetrics.price(epFor(a.key,selected))?.upper??-1)); $('#task-rows').innerHTML=tasks.length?tasks.map(t=>{const ep=epFor(t.key,selected),us=UsageMetrics.usage(ep),cs=stats(ep?[ep]:[]);return `${esc(t.title)} ↗${familyName(t.family)} · ${t.key}${data.task_notes[t.key]?'◆ Native note':''}${variant?`${badge(ep,taskRoute(t.key,selected))}${rangeNumber(us.inputLow,us.inputHigh)}${rangeNumber(us.cacheLow,us.cacheHigh)}${rangeNumber(us.cacheRateLow,us.cacheRateHigh,pct)}${compact(us.output)}${costValue(cs)}${number(ep?.steps)}${ep?'of '+number(ep.measured_protocol?.max_steps):number(t.planned_protocol.max_control_steps)+' planned'}`:data.variants.map(v=>`${badge(epFor(t.key,v.id),taskRoute(t.key,v.id))}`).join('')}`;}).join(''):'No tasks match these filters. '; $('#task-count').textContent=`${tasks.length} of ${data.tasks.length} tasks`; $('#filter-context').textContent=variant?variantName(variant):'Outcome filter & usage/cost sort: '+variantName(filters.variant); $$('.task-table thead th').forEach((th,i)=>{if(!variant&&i)th.classList.toggle('focus-column',data.variants[i-1].id===filters.variant);}); } function overview() { current={type:'overview'}; $('#main').innerHTML=`
RLE-Bench · Embodied agent evaluation

Coding agents.
Physical tasks.

Compare native success, token usage and recorded behavior.
Every result opens into the full agent session and its evidence.

6environments
164tasks per agent
${data.variants.length}agent–model variants
Evaluation in progress · seed 0
${campaignProgress()}${opusPilotProgress()}
${data.variants.map(v=>{const s=stats(episodes(v.id));return `
${icon(v)}${esc(v.agent)}${s.n?'Partial':'Planned'}

${modelLabel(v)}

${pct(s.rate)}native success
${s.n?s.passes+' / '+s.n:'—'} passed${costValue(s)} total costEstimated USD
${s.n} / ${data.tasks.length} evaluated${s.n?'Explore runs':'View planned'} ${arrow}
`;}).join('')}
Success rates and costs cover selected evaluated tasks only.Recorded effort · Cache-aware costs · Native verdicts preserved
${comparisonTable()}
${taskBrowser()}${methodology()}`; renderRows(); } function runsPage(variant,params,restoredFilters=null) { if(!variantFor(variant)){overview();return;} if(current.type!=='runs'||current.variant!==variant)filters={query:'',family:'',status:'',variant,sort:'catalog'}; current={type:'runs',variant};filters.variant=variant; if(params.has('family')){filters.family=params.get('family');filters.status='';filters.query='';} if(restoredFilters)filters={...restoredFilters}; const v=variantFor(variant),s=stats(episodes(variant)); $('#main').innerHTML=`${variantTabs(variant)}
${s.n?'Selected results':'Planned evaluation'}

${esc(v.agent)} × ${v.model}

${esc(v.effort)} effort · One seed per task · ${s.n} evaluated · ${data.tasks.length-s.n} pending

${metric(pct(s.rate),'Native success',s.n?`${s.passes} passed / ${s.n} evaluated`:'No recorded episodes')}${metric(costValue(s),'Total cost',costNote(s))}${metric(number(s.responses),'Model responses',s.n?'Provider-reported responses':'Not yet measured')}${metric(elapsed(s.wall==null?null:s.wall/s.n),'Mean wall time',s.n?'Per evaluated episode':'Not yet measured')}
${usageTiles(s,false)}${costBreakdown(s)}
${data.families.map(f=>{const fs=stats(episodes(variant,f.id));return ``;}).join('')}

${s.n?'Native success is computed from the selected evaluated episodes. Native notes identify simulator source issues. '+usageDefinition():'This combination has no published episodes. The catalog and planned budgets are shown below.'}

${taskBrowser(variant)}${methodology()}`; renderRows(); } function nativeNote(task,ep) { const note=data.task_notes[task.key];if(!note)return ''; return ``; } function videoPanel(ep,mini=false) { const m=ep.media||{},speed=m.speed||1,links=ep.links; return `
Native recording${m.width||'—'} × ${m.height||'—'} · ${m.duration_s==null?'':m.duration_s.toFixed(2)+' s'}
${external(links.video,'Video','button small')}${external(links.terminal_frame,'Still','button small')}
`; } function episodeMetrics(ep) { const u=ep.usage||{},s=stats([ep]); return `
${usageTiles(s)}

${usageDefinition()}

${costBreakdown(s,true)}
${u.response_count==null&&Number.isFinite(u.known_response_count)?number(u.known_response_count)+'+':number(u.response_count)} model responses${number(ep.call_activity?.model_tool_calls)} tool calls${external(ep.links.usage,'Original usage record')}
`; } // Align words and punctuation while preserving the exact original whitespace. function instructionDiff(original, revised) { const split = text => text.match(/\s+|[\p{L}\p{N}_]+|[^\s]/gu) || []; const a=split(original), b=split(revised); const lcs=Array.from({length:a.length+1},()=>new Uint16Array(b.length+1)); for(let i=a.length-1;i>=0;i--)for(let j=b.length-1;j>=0;j--) lcs[i][j]=a[i]===b[j]?lcs[i+1][j+1]+1:Math.max(lcs[i+1][j],lcs[i][j+1]); const before=[],after=[]; const append=(list,text,changed)=>{const last=list.at(-1);if(last&&last.changed===changed)last.text+=text;else list.push({text,changed});}; let i=0,j=0; while(i=lcs[i+1][j]))append(after,b[j++],true); else append(before,a[i++],true); } const html=(parts,kind)=>parts.map(p=>p.changed&&p.text.trim()?`<${kind==='removed'?'del':'mark'} class="instruction-${kind}">${esc(p.text)}`:esc(p.text)).join(''); return {original:html(before,'removed'),revised:html(after,'added')}; } function instructionPanel(task,ep) { const native=ep?ep.native_instruction:task.native_instruction; const measured=ep?(ep.instruction||(ep.instruction_policy==='original_native'?native:null)):task.catalog_instruction; const changed=Boolean(native&&measured&&native!==measured); const diff=changed?instructionDiff(native,measured):null; const choices=[['measured',ep?'Measured':'Planned',measured],['native','Original native',native],['current','Current catalog',task.catalog_instruction]].filter(([key,,text])=>text&&(key!=='current'||(ep&&text!==measured))); const currentChanged=native&&task.catalog_instruction&&native!==task.catalog_instruction; return `

Task instruction

${ep?'The exact instruction used for this episode.':'The current catalog instruction for the planned evaluation.'}

${choices.map(([k,label],i)=>``).join('')}
${choices.map(([k,,text],i)=>{ const comparison=k==='current'?(currentChanged?instructionDiff(native,text):null):diff; const html=comparison?(k==='native'?comparison.original:comparison.revised):esc(text); const note=comparison?(k==='native'?'Struck-through text was removed or replaced in the '+(ep?'measured':'planned')+' instruction.':'Highlighted text was added or replaced relative to the original native instruction.'):(native?'No changes from the original native instruction.':'Original native text is unavailable for comparison.'); return `

${comparison?``:''}${note}${k==='current'?' This catalog text is not the measured episode instruction.':''}

${html}
`; }).join('')}
`; } function overviewDetail(task,ep) { const initializationBlocked=(data.active_campaign?.initialization_blocked||[]).includes(task.key+'/'+current.variant); if(!ep)return `
○${initializationBlocked?'Initialization blocked':'Awaiting evaluation'}

${initializationBlocked?'Native seed 0 could not initialize':'No recorded episode yet'}

${variantName(current.variant)} / ${esc(variantFor(current.variant).effort)}

${metric(number(task.planned_protocol.max_control_steps),'Control-step budget')}${metric(String(task.planned_seed_by_variant?.[current.variant]??task.planned_protocol.seed),'Seed')}${metric(task.planned_protocol.control_frequency_hz+' Hz','Control frequency')}

${initializationBlocked?'No model was called. Seed 0 is retained by user decision; this is excluded from task success rates.':'This task is included in the planned catalog. Results and usage will appear after evaluation.'}

${instructionPanel(task,null)}
${nativeNote(task,null)}`; const m=ep.media||{},u=ep.usage||{},a=ep.analysis||{}; const reason=a.evidence_note||a.failure_reason||a.cause||a.observed||a.visible_completion; return `
${videoPanel(ep)}

${m.source_fps?m.source_fps+' FPS source capture · ':''}${m.speed||1}× simulation speed. Session timestamps use wall time and are not synchronized to video frames.

${nativeNote(task,ep)}${episodeMetrics(ep)}
${instructionPanel(task,ep)}

Episode notes

Recorded observations and task-specific interpretation.

${reason?`

${esc(reason)}

`:`

${esc(a.outcome||'The native result and original evidence are retained for this episode.')}

`}
Read recorded analysis${Object.entries(a).filter(([k])=>k!=='preflight').map(([k,v])=>`
${esc(k.replaceAll('_',' '))}

${esc(typeof v==='string'?v:JSON.stringify(v))}

`).join('')}
≡
Read the full session${number(ep.session_counts?.visible_events)} events · ${number(ep.session_counts?.observed_images)} observations
${arrow}
⌘
Inspect agent artifacts${ep.resources?.length||0} saved files · workspace & evidence
${arrow}
`; } function taskPage(key,variant,section='overview') { const task=data.tasks.find(t=>t.key===key);if(!task||!variantFor(variant)){notFound();return;} const ep=epFor(key,variant), validSections=['overview','session','artifacts','evidence','attempts']; if(!validSections.includes(section)||(!ep&&!['overview','attempts'].includes(section)))section='overview'; current={type:'task',key,variant,section,ep,task}; sessionState={filter:'all',query:'',count:40,view:'timeline'}; const index=data.tasks.indexOf(task),history=data.attempt_history.filter(h=>h.task_key===key&&h.variant===variant); document.title=`${task.title} · ${variantFor(variant).agent} — Kinex Benchmark`; $('#main').innerHTML=`
${familyName(task.family)} · ${key}

${esc(task.title)}

${esc(task.native_id)}

${index?`←`:''}${index→`:''}
${variantTabs(variant,key,section)}
${section==='overview'?overviewDetail(task,ep):section==='session'?sessionShell(ep):section==='artifacts'?artifactsPanel(ep):section==='evidence'?evidencePanel(task,ep):historyPanel(history)}
`; setupVideo(); if(section==='session')loadSession(ep,epoch); if(section==='artifacts'&&ep.resources?.length)loadResource(0,epoch); } function setupVideo() { const v=$('#episode-video');if(!v)return; v.onerror=()=>{if($('#video-error'))$('#video-error').hidden=false;}; } function sessionShell(ep) { return `

Session & observations

Loading the original transcript…

Loading session…
`; } async function loadSession(ep,token) { try { if(!sessionCache.has(ep.id)) { const response=await fetch(ep.links.transcript);if(!response.ok)throw Error('HTTP '+response.status); const raw=await response.json();const entries=Array.isArray(raw)?raw:raw.messages||raw.entries||raw.events||[]; if(!Array.isArray(entries))throw Error('Unsupported transcript format'); sessionCache.set(ep.id,entries); if(sessionCache.size>6)sessionCache.delete(sessionCache.keys().next().value); } if(token!==epoch)return; const entries=sessionCache.get(ep.id),images=entries.flatMap((m,i)=>(m.parts||[]).filter(p=>p.type==='image'&&p.src).map(p=>({url:new URL(p.src,ep.links.transcript).href,label:`Event ${i+1} · ${m.id||m.role||'Observation'}`}))); $('#session-summary').textContent=`${number(entries.length)} events · ${number(images.length)} observation images · ${entries.filter(e=>e.error).length} tool errors. Event timestamps are in UTC.`; renderSession(); } catch(error) {if(token!==epoch)return;$('#session-events').innerHTML=`
Transcript preview could not load (${esc(error.message)}).
${external(ep.links.transcript,'Open original transcript')}
`;} } function sessionText(entry) {return [entry.id,entry.role,entry.tool,...(entry.parts||[]).map(p=>p.text||JSON.stringify(p.input||p))].join('\n');} function renderSession() { const entries=sessionCache.get(current.ep.id);if(!entries)return; const {filter,query,count,view}=sessionState, q=query.trim().toLowerCase(); let matches=entries.map((entry,i)=>({entry,index:i})).filter(({entry:e})=>(filter==='all'||filter==='assistant'&&e.role==='assistant'||filter==='tools'&&e.role==='toolResult'||filter==='errors'&&e.error||filter==='images'&&(e.parts||[]).some(p=>p.type==='image')||filter==='context'&&['user','system','developer'].includes(e.role))&&(!q||sessionText(e).toLowerCase().includes(q))); imageItems=[]; const imagePart=(p,index,entry,cls='observation')=>{ const url=new URL(p.src,current.ep.links.transcript).href;if(!url.startsWith('https://'))return ''; const n=imageItems.length;imageItems.push({url,label:`Event ${index+1} · ${entry.id||entry.role||'Observation'}`}); return ``; }; if(view==='gallery') { const images=matches.flatMap(({entry,index})=>(entry.parts||[]).filter(p=>p.type==='image'&&p.src).map(part=>({entry,index,part}))); $('#session-events').innerHTML=images.length?``:'
No observation images match these filters.
'; $('#event-count').textContent=`${Math.min(count,images.length)} / ${images.length} images`;$('#more-events').hidden=count>=images.length; } else { $('#session-events').innerHTML=matches.length?`
${matches.slice(0,count).map(({entry:e,index})=>{ const role=e.role==='toolResult'?'Tool result':e.role==='assistant'?'Assistant':({user:'User',system:'System',developer:'Developer'}[e.role]||e.role||e.type||'Event'); const tool=e.tool||(e.parts||[]).find(p=>p.type==='tool')?.name; return `
${index+1}
${esc(role)}${tool?`${esc(tool)}`:''}${e.error?'Error':''}
${(e.parts||[{type:'text',text:typeof e==='string'?e:JSON.stringify(e,null,2)}]).map(p=>{ if(p.type==='image'&&p.src)return imagePart(p,index,e); if(p.type==='tool')return `
Tool call · ${esc(p.name)}${esc((typeof p.input==='string'?p.input:JSON.stringify(p.input)).slice(0,130))}
${esc(typeof p.input==='string'?p.input:JSON.stringify(p.input,null,2))}
`; const txt=p.text??p.thinking??JSON.stringify(p,null,2); if(txt==='')return 'No text recorded.'; if(p.type==='thinking'||p.type==='reasoning')return `
Recorded reasoning
${esc(txt)}
`; if(e.role==='toolResult'||txt.length>1800)return `
${e.role==='toolResult'?'Tool output':'Message'}${esc(txt.slice(0,160))}
${esc(txt)}
`; return `
${esc(txt)}
`; }).join('')}
${esc(e.id||'')}
`; }).join('')}
`:'
No events match these filters.
'; $('#event-count').textContent=`${Math.min(count,matches.length)} / ${matches.length} events`;$('#more-events').hidden=count>=matches.length; } $('#more-events').textContent=view==='gallery'?'Load more observations':'Load next 40 events'; } function artifactsPanel(ep) { const resources=ep.resources||[]; return `

Agent artifacts

Final files created during this episode. Their edit history remains in the session.

${resources.length?`
${esc(resources[0].name)}

Loading file…
`:'
No standalone tool or memo files were saved in this episode. The original session and workspace evidence remain available.
'}
${evidenceCard('Execution evidence','Original verdict, protocol and runtime identity.',[['verdict','Native verdict'],['protocol','Protocol'],['provenance','Source identity']],ep)}${evidenceCard('Session & interactions','Original tool calls, observations and edited workspace.',[['native_session','Native session'],['trace','Trace'],['workspace_changes','Workspace changes']],ep)}
`; } async function fetchText(url) { if(fileCache.has(url))return fileCache.get(url); const r=await fetch(url);if(!r.ok)throw Error('HTTP '+r.status); if(Number(r.headers.get('content-length'))>3e6)throw Error('File exceeds the 3 MB preview limit; use Open file'); const text=await r.text();if(text.length>3e6)throw Error('File exceeds the preview limit; use Open file'); fileCache.set(url,text);if(fileCache.size>20)fileCache.delete(fileCache.keys().next().value);return text; } async function loadResource(index,token) { const r=current.ep?.resources?.[index];if(!r)return; current.resource=index;$('#resource-name').textContent=r.name;$('#resource-open').href=r.file;$('#resource-kind').textContent=r.kind||'Final workspace snapshot';$('#resource-preview').textContent='Loading file…'; $$('[data-resource]').forEach(b=>{b.classList.toggle('active',+b.dataset.resource===index);b.setAttribute('aria-pressed',+b.dataset.resource===index);}); try{const text=await fetchText(r.file);if(token===epoch&¤t.resource===index){$('#resource-preview').textContent=text;current.resourceText=text;}} catch(e){if(token===epoch&¤t.resource===index){$('#resource-preview').textContent='Preview unavailable: '+e.message;current.resourceText=null;}} } const evidenceGroups=[ ['Native evaluation','Owner verdicts, measured task and control protocol.',[['verdict','Native verdict'],['protocol','Measured protocol'],['native_goal','Task instructions'],['owner_journal','Owner action journal']]], ['Session & workspace','The original agent trajectory and final files.',[['native_session','Native session'],['transcript','Readable transcript'],['trace','Agent trace'],['workspace','Workspace archive'],['workspace_changes','Workspace manifest']]], ['Recording & review','Published media and checks against the recorded evidence.',[['video','Video'],['poster','Poster'],['terminal_frame','Terminal frame'],['recording_manifest','Recording manifest'],['media_check','Media validation'],['analysis','Episode analysis']]], ['Usage & provenance','Provider counters and the actual code used by the episode.',[['usage','Token usage'],['provider_usage','Provider usage ledger'],['provenance','Source identities'],['tool_errors','Tool errors']]] ]; function evidenceCard(title,description,items,ep) { return `

${title}

${description}

${items.filter(([k])=>ep.links[k]).flatMap(([k,l])=>(Array.isArray(ep.links[k])?ep.links[k]:[ep.links[k]]).map((url,i)=>external(url,l+(Array.isArray(ep.links[k])?' '+(i+1):'')))).join('')}
`; } function evidencePanel(task,ep) { const used=new Set(evidenceGroups.flatMap(g=>g[2].map(x=>x[0]))),extras=Object.keys(ep.links).filter(k=>!used.has(k)); const source={...data.sources[ep.variant],...(ep.source_dataset_revision?{dataset_revision:ep.source_dataset_revision}:{})}; return `

Evidence & provenance

Original files pinned to their published Dataset revisions. Native verdicts and measured source identities remain unchanged.

${evidenceGroups.map(([title,desc,items])=>evidenceCard(title,desc,items,ep)).join('')}${extras.length?evidenceCard('Additional records','Episode-specific checks and retained references.',extras.map(k=>[k,k.replaceAll('_',' ')]),ep):''}

Recorded identity

Source and protocol belonging to this episode.

Episode
${esc(ep.source_episode_id)}
Model
${esc(ep.model)} / ${ep.effort}
Dataset
${external('https://huggingface.co/datasets/'+source.dataset,source.dataset)}
Dataset revision
${source.dataset_revision}
${ep.kinex_revision?`
Kinex revision
${esc(ep.kinex_revision)}
`:''}${Object.entries(ep.provenance?.sources||{}).map(([k,v])=>`
${esc(k)}
${esc(v.revision||'Unrecorded revision')}${v.dirty?' Local changes recorded':''}
`).join('')}
Recorded budget
${number(ep.measured_protocol?.max_steps)} steps
Current planned budget
${number(task.planned_protocol.max_control_steps)} steps
Inspect the measured protocol JSON
${esc(JSON.stringify(ep.measured_protocol,null,2))}

Preview an evidence file

Inspect the recorded JSON without leaving this page.

`; } function historyPanel(history) { return `

Previous attempts

Archived attempts are preserved separately and excluded from the current success rate, usage and costs.

Full archive ↗
${history.length?history.map(h=>`
${badge(h)}${h.valid===false?'Interrupted / invalid':typeof h.success==='boolean'?'Archived result':'Verdict not recorded'}
${esc((h.status||'Archived attempt').replaceAll('_',' '))}

${esc(h.id||h.job||h.dataset_revision||'Historical record')}

${h.steps!=null?number(h.steps)+' steps · ':''}${h.usage?'Input '+rangeNumber(UsageMetrics.usage(h).inputLow,UsageMetrics.usage(h).inputHigh)+' · cached '+compact(h.usage.cached_input_tokens)+' · ':''}${h.dataset_revision?'Revision '+h.dataset_revision.slice(0,8):''}${h.instruction?`
Measured instruction

${esc(h.instruction)}

`:''}
`).join(''):'
No earlier attempts are listed for this task and agent combination.
'}
`; } function notFound() {$('#main').innerHTML='

Page not found

Return to the benchmark

';} // Keep each task list's view with its browser history entry. history.scrollRestoration = 'manual'; let taskListReturn = null; const navigationHash = () => location.hash || '#overview'; function saveTaskList(row = null) { if (!['overview', 'runs'].includes(current.type) || !$('#task-rows')) return; row ||= $$('#task-rows tr[data-task]').find(r => r.getBoundingClientRect().bottom > 100); const view = { hash: navigationHash(), filters: {...filters}, x: window.scrollX, y: window.scrollY, task: row?.dataset.task, offset: row?.getBoundingClientRect().top, tableX: $('#tasks .table-scroll').scrollLeft, matrixMetric, expandedModels: $$('[data-model-group][open]').map(el => el.dataset.modelGroup) }; history.replaceState({...history.state, benchmarkNavigation: {list: view}}, ''); return view; } function restoreTaskList(view) { const row = $$('#task-rows tr[data-task]').find(r => r.dataset.task === view.task); const y = row && view.offset != null ? window.scrollY + row.getBoundingClientRect().top - view.offset : view.y; $('#tasks .table-scroll').scrollLeft = view.tableX; window.scrollTo({left: view.x, top: y, behavior: 'instant'}); } document.addEventListener('click', event => { const link = event.target.closest('a[href]'); if (!link || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || link.target === '_blank' || !link.getAttribute('href').startsWith('#')) return; const view = saveTaskList(link.closest('tr[data-task]')); if (view && link.getAttribute('href').startsWith('#task/')) taskListReturn = view; }, true); window.addEventListener('pagehide', () => saveTaskList()); function route() { epoch++;$$('video').forEach(v=>{v.pause();v.removeAttribute('src');v.load();}); const [hash,query='']=location.hash.slice(1).split('?'),parts=hash.split('/'),params=new URLSearchParams(query); const saved = history.state?.benchmarkNavigation; const returning = current.type === 'task' && taskListReturn && (taskListReturn.hash === navigationHash() || ['#overview', '#tasks'].includes(taskListReturn.hash) && ['#overview', '#tasks'].includes(navigationHash())); const view = saved?.list?.hash === navigationHash() ? saved.list : returning ? taskListReturn : null; if (parts[0] === 'task') { taskListReturn = saved ? saved.origin || null : (['overview', 'runs', 'task'].includes(current.type) ? taskListReturn : null); history.replaceState({...history.state, benchmarkNavigation: {origin: taskListReturn}}, ''); } else if (view) { filters = {...view.filters}; matrixMetric = view.matrixMetric; expandedModels = new Set(view.expandedModels); } document.title='Kinex Benchmark — RLE-Bench'; if(parts[0]==='task')taskPage(parts[1]+'/'+parts[2],parts[3],parts[4]||'overview'); else if(parts[0]==='runs')runsPage(parts[1],params,view?.filters); else overview(); $$('[data-nav]').forEach(a=>a.setAttribute('aria-current',a.dataset.nav===(hash||'overview')?'page':'false')); if(view && $('#task-rows'))restoreTaskList(view); else if(hash==='tasks') { const row = $$('#task-rows tr[data-task]').find(r => r.dataset.task === params.get('task')); (row || $('#tasks')).scrollIntoView({block: row ? 'center' : 'start', behavior: 'instant'}); } else if(hash==='methodology'){$('#methodology').open=true;$('#methodology').scrollIntoView();} else window.scrollTo({left:0,top:0,behavior:'instant'}); if(parts[0]!=='task')taskListReturn=null; } function resetFilters() {filters={query:'',family:'',status:'',variant:filters.variant,sort:'catalog'};if(current.type==='runs')runsPage(current.variant,new URLSearchParams());else overview();$('#tasks').scrollIntoView();} function showToast(text){$('#toast').textContent=text;$('#toast').classList.add('visible');setTimeout(()=>$('#toast').classList.remove('visible'),2200);} function exportCSV(variant) { const ids=variant==='all'?data.variants.map(v=>v.id):[variant]; const rows=[['task','environment','title','agent','model','effort','status','native_success','input_tokens_fresh_plus_cache_write','input_tokens_lower','input_tokens_upper','cached_tokens','cached_tokens_lower','cached_tokens_upper','cache_hit_rate','cache_hit_rate_lower','cache_hit_rate_upper','output_tokens','inclusive_input_tokens_original','cache_write_tokens_original','estimated_cost_usd','estimated_cost_lower_usd','estimated_cost_upper_usd','cost_basis','cache_write_basis','cache_write_assumed','steps','episode_id','reasoning_output_tokens','recorded_budget','planned_budget','source_episode_id','inclusive_total_tokens_original']]; for(const t of data.tasks)for(const id of ids){ const e=epFor(t.key,id),v=variantFor(id),u=UsageMetrics.usage(e),c=UsageMetrics.price(e); rows.push([t.key,familyName(t.family),t.title,v.agent,v.model,v.effort,outcome(e),e?e.success:'',u.input,u.inputLow,u.inputHigh,u.cached,u.cacheLow,u.cacheHigh,u.cacheRate,u.cacheRateLow,u.cacheRateHigh,u.output,u.inclusive,e?.usage?.cache_write_input_tokens,c&&c.lower===c.upper?c.lower:null,c?.lower,c?.upper,c?.basis,c?.cache_write_basis,c?.cache_write_assumed,e?.steps,e?.id,e?.usage?.reasoning_output_tokens,e?.measured_protocol?.max_steps,t.planned_protocol.max_control_steps,e?.source_episode_id,tokens(e)]); } const csv=rows.map(row=>row.map(v=>'"'+String(v??'').replaceAll('"','""')+'"').join(',')).join('\r\n'); const url=URL.createObjectURL(new Blob([csv],{type:'text/csv;charset=utf-8'})),a=document.createElement('a');a.href=url;a.download='kinex-benchmark-'+variant+'.csv';a.click();setTimeout(()=>URL.revokeObjectURL(url),1000); } function showImage(index) { if(!imageItems.length)return;imageIndex=(index+imageItems.length)%imageItems.length;const item=imageItems[imageIndex];$('#large-image').src=item.url;$('#image-original').href=item.url;$('#image-caption').textContent=`${imageIndex+1} / ${imageItems.length} · ${item.label}`;if(!$('#image-viewer').open)$('#image-viewer').showModal(); } $('#main').addEventListener('click',async event=>{ const b=event.target.closest('button,a');if(!b)return; if(b.dataset.matrix){expandedModels=new Set($$('[data-model-group][open]').map(x=>x.dataset.modelGroup));matrixMetric=b.dataset.matrix;$('#comparison-mount').innerHTML=comparisonTable();} if(b.dataset.familyLink){filters.family=b.dataset.familyLink;filters.query='';filters.status='';if(location.hash==='#tasks'){overview();$('#tasks').scrollIntoView();}} if(b.dataset.reportFamily){filters.family=filters.family===b.dataset.reportFamily?'':b.dataset.reportFamily;$('#task-family').value=filters.family;$$('[data-report-family]').forEach(x=>x.classList.toggle('active',x.dataset.reportFamily===filters.family));renderRows();$('#tasks').scrollIntoView({behavior:'smooth'});} if(b.id==='reset-filters'||b.hasAttribute('data-reset'))resetFilters(); if(b.dataset.export)exportCSV(b.dataset.export); if(b.dataset.instruction){$$('[data-instruction]').forEach(x=>x.setAttribute('aria-pressed',x===b));$$('.instruction-version').forEach(x=>x.hidden=x.id!=='instruction-'+b.dataset.instruction);} if(b.id==='final-frame'){const v=$('#episode-video');if(v.readyState<1)await new Promise(r=>v.addEventListener('loadedmetadata',r,{once:true}));v.pause();v.currentTime=Math.max(0,v.duration-.001);} if(b.dataset.sessionView){sessionState.view=b.dataset.sessionView;sessionState.count=40;$$('[data-session-view]').forEach(x=>x.setAttribute('aria-pressed',x===b));renderSession();} if(b.id==='more-events'){sessionState.count+=40;renderSession();} if(b.hasAttribute('data-image'))showImage(+b.dataset.image); if(b.hasAttribute('data-resource'))loadResource(+b.dataset.resource,epoch); if(b.hasAttribute('data-retry-session'))loadSession(current.ep,epoch); if(b.id==='copy-resource'){if(current.resourceText!=null){try{await navigator.clipboard.writeText(current.resourceText);showToast('File copied to clipboard');}catch{showToast('Copy unavailable. Use Open file to select the text.');}}} }); $('#main').addEventListener('input',event=>{ if(event.target.id==='task-search'){filters.query=event.target.value;renderRows();} if(event.target.id==='event-search'){sessionState.query=event.target.value;sessionState.count=40;renderSession();} }); $('#main').addEventListener('change',async event=>{ const {id,value}=event.target; if(id==='task-family'){filters.family=value;renderRows();$$('[data-report-family]').forEach(x=>x.classList.toggle('active',x.dataset.reportFamily===value));} if(id==='task-variant'){filters.variant=value;renderRows();} if(id==='task-status'){filters.status=value;renderRows();} if(id==='task-sort'){filters.sort=value;renderRows();} if(id==='playback-speed')$('#episode-video').playbackRate=Number(value); if(id==='event-filter'){sessionState.filter=value;sessionState.count=40;renderSession();} if(id==='evidence-select'){ const preview=$('#evidence-preview'),token=epoch;preview.hidden=!value;if(!value)return;preview.textContent='Loading evidence…'; try{const text=await fetchText(current.ep.links[value]);if(token!==epoch||$('#evidence-select').value!==value)return;try{preview.textContent=JSON.stringify(JSON.parse(text),null,2);}catch{preview.textContent=text;}} catch(e){if(token===epoch)preview.textContent='Preview unavailable: '+e.message;} } }); $('#close-viewer').onclick=()=>$('#image-viewer').close();$('#previous-image').onclick=()=>showImage(imageIndex-1);$('#next-image').onclick=()=>showImage(imageIndex+1); $('#image-viewer').addEventListener('click',event=>{if(event.target===$('#image-viewer'))$('#image-viewer').close();}); $('#image-viewer').addEventListener('keydown',event=>{if(event.key==='ArrowLeft'){event.preventDefault();showImage(imageIndex-1);}if(event.key==='ArrowRight'){event.preventDefault();showImage(imageIndex+1);}}); async function boot(){try{const r=await fetch('data.json');if(!r.ok)throw Error('HTTP '+r.status);data=await r.json(); try{const c=await fetch('cost-data.json');if(c.ok)UsageMetrics.init(await c.json());}catch{UsageMetrics.init({episodes:{},sources:[]});} for(const task of data.tasks){ if(task.family==='task02'){ const {suite_name,task_id}=task.native_identity; task.title=`LIBERO-${suite_name.replace(/^libero_/, '')}-${String(task_id+1).padStart(2,'0')}`; } } window.benchmarkData=data;$('#updated').textContent='Results updated '+data.updated_at.slice(0,10);window.addEventListener('hashchange',route);route();}catch(e){$('#main').innerHTML=`

Results could not load

${esc(e.message)}

Download the results index
`;}} boot();