import type { Metadata } from 'next'; import Link from 'next/link'; import { AdminTitle, JsonPre, Mono, StatusChip, Trunc } from '@/components/admin/ui'; import { DataTable, EmptyRow, Td, Th } from '@/components/ui/data-table'; import { LiveAgo } from '@/components/ui/live'; import { Stat, StatGrid } from '@/components/ui/section'; import { Unavailable } from '@/components/ui/unavailable'; import { adminApi, load, requireAdmin } from '@/lib/admin/admin-api'; import { fmtBytes, fmtDuration, fmtInt, num } from '@/lib/format'; export const metadata: Metadata = { title: 'Overview', robots: { index: false, follow: false } }; export const dynamic = 'force-dynamic'; export default async function AdminOverviewPage() { await requireAdmin(); const res = await load(adminApi.overview()); if (!res.ok) { return ( <> ); } const o = res.data; const s = o.stats ?? {}; const hb = Object.entries(o.heartbeats ?? {}); const queue = Object.entries(o.queue ?? {}); const health = Object.entries(o.connectors ?? {}); return ( <> stats computed : undefined} />

Queue depth

{queue.length === 0 ? (

Queue empty.

) : ( Kind Status n {queue.flatMap(([kind, byStatus]) => Object.entries(byStatus).map(([st, n]) => ( {kind} {fmtInt(n)} )), )} )}

Jobs →

Connector health

    {health.map(([k, n]) => (
  • {fmtInt(n)}
  • ))} {health.length === 0 &&
  • No connectors.
  • }

Connectors →

{o.review_by_kind && ( <>

Review by kind

    {Object.entries(o.review_by_kind).map(([k, n]) => (
  • {k} {fmtInt(n)}
  • ))}
)}

Heartbeats

{hb.length === 0 ?

None reported (scheduler / workers have not written a heartbeat).

: } {o.archive && ( <>

Archive

raw {fmtBytes(o.archive.raw_bytes)} · {fmtInt(o.archive.raw_files)} files · text {fmtBytes(o.archive.text_bytes)} · {fmtInt(o.archive.text_files)} files

)}

LLM factory · 24 h {o.llm?.available === false && }

{fmtInt(o.llm?.jobs_24h)} jobs · {fmtInt(o.llm?.tokens_24h)} tokens{o.llm?.failed_24h !== undefined && <> · {fmtInt(o.llm.failed_24h)} failed}

{o.llm?.by_stage?.length ? ( Stage Status n {o.llm.by_stage.map((r, i) => ( {r.stage} {fmtInt(r.n)} ))} ) : (

No LLM jobs in the last 24 h.

)}

LLM accounting →

Recent runs

Connector Started Status Duration Fetched Changed Failed Claims Events Error {!o.recent_runs?.length && No runs yet.} {o.recent_runs?.map((r) => ( {r.connector_name} {num(r.duration_ms) === null ? '—' : fmtDuration(Math.round((num(r.duration_ms) ?? 0) / 1000))} {fmtInt(r.docs_fetched)} {fmtInt(r.docs_changed)} {fmtInt(r.docs_failed)} {fmtInt(r.claims_written)} {fmtInt(r.events_emitted)} ))}

All runs →

); }