import type { Metadata } from 'next'; import Link from 'next/link'; import { DataStrip } from '@/components/layout/terminal'; import { BreadcrumbLd } from '@/components/meta/breadcrumb-ld'; import { daysBefore, monthsBefore, todayUtc, validDay } from '@/components/temporal/dates'; import { HardwareAsOf, LeadersAsOf, ModelsAsOf, PricesAsOf } from '@/components/temporal/time-machine-tables'; import { Chip } from '@/components/ui/badges'; import { Container, Note, PageHeader, Section } from '@/components/ui/section'; import { Unavailable } from '@/components/ui/unavailable'; import { apiD3, safe } from '@/lib/api'; import { fmtDate, fmtDateTime, fmtInt, num } from '@/lib/format'; import { routes, SITE_NAME, SITE_URL } from '@/lib/site'; type SP = { date?: string; scope?: string }; const SCOPES = [ { key: 'all', label: 'Overview' }, { key: 'models', label: 'Models' }, { key: 'prices', label: 'Provider prices' }, { key: 'context', label: 'Context lengths' }, { key: 'benchmarks', label: 'Benchmark leaders' }, { key: 'hardware', label: 'Hardware' }, ] as const; type Scope = (typeof SCOPES)[number]['key']; const LIMIT_FOCUS = 200; const LIMIT_ALL = 25; function resolve(sp: SP): { date: string; scope: Scope; invalid: boolean } { const today = todayUtc(); const date = validDay(sp.date) ?? today; const scope = (SCOPES.find((s) => s.key === sp.scope)?.key ?? 'all') as Scope; return { date: date > today ? today : date, scope, invalid: !!sp.date && !validDay(sp.date) }; } function href(date: string, scope: Scope): string { const p = new URLSearchParams({ date }); if (scope !== 'all') p.set('scope', scope); return `/time-machine?${p.toString()}`; } export async function generateMetadata({ searchParams }: { searchParams: Promise }): Promise { const { date, scope } = resolve(await searchParams); const title = `AI Atlas as of ${fmtDate(date)}${scope !== 'all' ? ` — ${SCOPES.find((s) => s.key === scope)?.label.toLowerCase()}` : ''}`; const description = `The AI ecosystem as it stood on ${fmtDate(date)}: which models existed, their context lengths and status then, provider prices valid that day, benchmark leaders known by then, hardware — reconstructed from dated claims and honest about it.`; const og = `${SITE_URL}/time-machine/og?date=${date}&scope=${scope}`; return { title, description, alternates: { canonical: href(date, scope) }, openGraph: { title: `${title} | ${SITE_NAME}`, description, url: `${SITE_URL}${href(date, scope)}`, images: [{ url: og, width: 1200, height: 630 }] }, twitter: { card: 'summary_large_image', images: [og] } }; } export default async function TimeMachinePage({ searchParams }: { searchParams: Promise }) { const sp = await searchParams; const { date, scope, invalid } = resolve(sp); const today = todayUtc(); const apiScope = scope === 'context' ? 'models' : scope; const [focus, overview] = await Promise.all([safe(apiD3.timeMachine(date, apiScope, scope === 'all' ? LIMIT_ALL : LIMIT_FOCUS)), scope === 'all' ? Promise.resolve(null) : safe(apiD3.timeMachine(date, 'all', 1))]); const strip = overview ?? focus; const presets: { label: string; date: string }[] = [ { label: '2023-01-01', date: '2023-01-01' }, { label: '2024-01-01', date: '2024-01-01' }, { label: '2025-01-01', date: '2025-01-01' }, { label: '6 months ago', date: monthsBefore(today, 6) }, { label: '1 month ago', date: monthsBefore(today, 1) }, { label: 'yesterday', date: daysBefore(today, 1) }, ]; const models = focus?.models; const prices = focus?.prices; const leaders = focus?.benchmarks?.leaders ?? []; const hardware = focus?.hardware?.items ?? []; const contextRows = (models?.items ?? []).filter((r) => r.attributes_as_of.context_length !== undefined && r.attributes_as_of.context_length !== null).sort((a, b) => (num(b.attributes_as_of.context_length) ?? 0) - (num(a.attributes_as_of.context_length) ?? 0)); const cls = 'h-11 border border-rule bg-surface px-2.5 text-sm text-ink focus:border-accent focus:outline-none'; return ( AI Atlas as of {fmtDate(date)} } lede="Pick any date: the models that existed, their context lengths and status at the time, the provider prices valid that day, the benchmark leaders known by then, the hardware. Every value opens the claim that establishes it, with its validity interval." aside={
{scope !== 'all' && }
} >
    {presets.map((p) => (
  • {p.label}
  • ))}
{invalid && The date in the URL was not YYYY-MM-DD — showing today instead.}
{!focus ? ( ) : ( <> {/* honesty banner */}

{focus.reconstructed ? Reconstructed : Observed} {focus.reconstructed ? `This date is earlier than AI Atlas's first observation — the state is reconstructed from dated claims and release dates, not from direct observation.` : 'This date is inside the observation history: values are claims that were current that day.'}

Observation history starts {focus.first_entity_at ? : 'unknown'}.{focus.note ? ` ${focus.note}` : ''}

{(scope === 'all' || scope === 'models') && (
Models as of {fmtDate(date)} {fmtInt(models?.total)}} action={scope === 'all' ? { href: href(date, 'models'), label: 'All' } : undefined}>
)} {scope === 'context' && (
Context windows as of {fmtDate(date)} {fmtInt(contextRows.length)} with a dated value}> Only models with a context-length claim valid on that date are listed (sorted by context). Models without a dated claim are omitted rather than guessed.
)} {(scope === 'all' || scope === 'prices') && (
Offers valid on {fmtDate(date)} {fmtInt(prices?.total)}} action={scope === 'all' ? { href: href(date, 'prices'), label: 'All' } : undefined}> {prices?.note && {prices.note}}
)} {(scope === 'all' || scope === 'benchmarks') && (
Leaders known by {fmtDate(date)} {fmtInt(leaders.length)}}> {focus.benchmarks?.note && {focus.benchmarks.note}}
)} {(scope === 'all' || scope === 'hardware') && (
Hardware as of {fmtDate(date)} {fmtInt(hardware.length)}} action={scope === 'all' ? { href: href(date, 'hardware'), label: 'All' } : undefined}>
)} Shareable: this URL reproduces the view. Per-entity: every entity page has a History tab with the same as-of reconstruction. What changed since? Diff {fmtDate(date)} → today. Methodology → )}
); }