import Link from 'next/link'; import { CompareButton } from '@/components/compare/compare-button'; import { ComparabilityBadge, ConfigChipEl, OpennessChip, TrustBadge } from '@/components/models/badges'; import { configChipsOf, fmtScoreUnit, refToSummary } from '@/components/models/shared'; import { FrontierLineChart } from './client-charts'; import { ScrollX } from '@/components/models/scroll-x'; import { EntityLink } from '@/components/ui/entity'; import { Pagination } from '@/components/ui/pagination'; import { SourceCell } from '@/components/ui/provenance'; import { Note } from '@/components/ui/section'; import { EmptyState } from '@/components/ui/unavailable'; import { cn } from '@/lib/cn'; import { fmtDate, fmtInt, fmtSigned } from '@/lib/format'; import { routes } from '@/lib/site'; import type { BenchmarkFrontierPayload, Group, LeaderboardRow } from '@/lib/types'; /* Leaderboard 2.0 (server): one row per canonical model — rank (+Δ vs closed rows) · model · score bar · trust · config chips · comparability vs leader · evaluated/observed · source · History · Compare. Mobile stacks (rank + model + score first). */ export function Leaderboard2({ rows, group, total, limit, offset, makeHref, historyHref, activeModel, unit }: { rows: LeaderboardRow[]; group: Group | null; total: number; limit: number; offset: number; makeHref: (offset: number) => string; historyHref: (slug: string) => string; activeModel?: string; unit?: string | null }) { if (!rows.length) return Relax the trust / organization filters or pick another comparability group.; const hib = rows[0]?.higher_is_better !== false; const scores = rows.map((r) => r.score).filter(Number.isFinite); const max = Math.max(...scores); const min = Math.min(...scores); const width = (s: number) => { if (!Number.isFinite(s) || max <= 0) return 0; const v = hib ? s / max : min > 0 ? min / s : 0; return Math.max(2, Math.min(100, v * 100)); }; const u = unit ?? rows[0]?.unit ?? null; const leader = rows.find((r) => r.rank === 1) ?? rows[0]; return ( <> {rows.map((r) => { const on = activeModel === r.model.slug; const chips = configChipsOf(r.config, group?.config ?? null, 4); const openness = typeof r.model.attributes?.openness === 'string' ? r.model.attributes.openness : null; return ( ); })}
Leaderboard
# Model Score Trust Configuration vs leader Evaluated Source Actions
{fmtInt(r.rank)} {r.delta_rank !== null && r.delta_rank !== 0 && ( 0 ? 'text-positive' : 'text-danger')} title={`Rank moved ${fmtSigned(r.delta_rank)} vs the closed rows of this group${r.previous_rank ? ` (was ${r.previous_rank})` : ''}`}> {r.delta_rank > 0 ? '▲' : '▼'} {Math.abs(r.delta_rank)} )} {openness && } {r.model.organization?.name ?? ''} {typeof r.model.attributes?.family === 'string' ? ` · ${r.model.attributes.family}` : ''} {r.n_rows > 1 ? ` · best of ${r.n_rows} rows` : ''} {fmtScoreUnit(r.score, u)} {chips.length ? chips.map((c) => ) : group defaults} {r.rank === 1 ? leader : } {leader && r.rank !== 1 && {(hib ? r.score - leader.score : leader.score - r.score).toFixed(Math.abs(r.score - leader.score) < 10 ? 2 : 1)}{u === '%' ? ' pt' : ''}} {r.evaluated_at ? fmtDate(r.evaluated_at) : obs. {fmtDate(r.observed_at)}} History
One row per canonical model — its best current row inside this comparability group (effort variants are folded into the model). Bars are relative to the page's best score{hib ? '' : ' (lower is better)'}. “vs leader” reads comparability: partially comparable = same task, conditions differ (reasoning effort, temperature, judge). Rules → ); } /** Frontier over time: a point each time a new best appeared in the group; markers = leader changes. */ export function FrontierChart({ frontier, group, unit }: { frontier: BenchmarkFrontierPayload | null; group: Group | null; unit?: string | null }) { if (!frontier) return Frontier history unavailable.; const series = frontier.series.find((s) => (group ? s.group.config_key === group.config_key && s.group.metric === group.metric : s.primary)) ?? frontier.series.find((s) => s.primary) ?? frontier.series[0]; if (!series) return No frontier history for this group.; const pts = series.points.map((p) => ({ x: new Date(p.date), y: p.score, p })).filter((x) => !Number.isNaN(x.x.getTime())).sort((a, b) => a.x.getTime() - b.x.getTime()); const days = new Set(pts.map((p) => p.x.toISOString().slice(0, 10))); return (
{pts.length < 2 || days.size < 2 ? ( {pts.length === 0 ? 'No leader recorded yet.' : `${fmtInt(pts.length)} leader change${pts.length === 1 ? '' : 's'} recorded, all dated ${fmtDate(pts[0]?.p.date)} — the frontier line needs at least two distinct dates.`} The corpus is young: every result was first observed on the same day, so leader changes will separate in time as sources are re-crawled. ) : ( ({ x: p.p.date, y: p.y }))} unit={unit ?? null} label={`Frontier of ${frontier.benchmark.name}`} /> )} {pts.length > 0 && (
    {[...pts].reverse().slice(0, 8).map((p) => (
  1. {fmtScoreUnit(p.y, unit)} {p.p.model.organization?.name ?? ''} {fmtDate(p.p.date)}
  2. ))}
)} {frontier.methodology}
); } /** Group picker: links when ≤ 8 groups, else a GET : null))} ); }