import { useQuery } from '@tanstack/react-query'; import { useMemo, useState, type FormEvent, type ReactNode } from 'react'; import { useSearchParams } from 'react-router-dom'; import { api, h6ReportExportUrl, type H6Breakdown, type H6ReportQuery, type HarnessReportVerdict } from '../lib/api'; import { Card, StatusBadge } from '../components/ui/Card'; const money = (value: number): string => `$${value.toFixed(6)}`; const integer = (value: number): string => new Intl.NumberFormat('en-US').format(value); const verdictTone: Record = { pass: 'border-emerald-300 bg-emerald-50 text-emerald-900', attention: 'border-amber-300 bg-amber-50 text-amber-950', fail: 'border-rose-300 bg-rose-50 text-rose-950', no_data: 'border-slate-300 bg-slate-50 text-slate-800', }; function queryFromSearch(search: URLSearchParams): H6ReportQuery { return { project: search.get('project') || undefined, from: search.get('from') || undefined, to: search.get('to') || undefined, run: search.get('run') || undefined, limit: 50, }; } function FilterField({ label, children }: { label: string; children: ReactNode }) { return ; } function MetricCard({ label, value, sub, accent = false }: { label: string; value: string; sub?: string; accent?: boolean }) { return
{accent && }
{label}
9 ? 'text-base' : 'text-2xl'}`}>{value}
{sub &&
{sub}
}
; } function BreakdownTable({ rows, subject }: { rows: H6Breakdown[]; subject: string }) { return
{rows.map((row) => )}{rows.length === 0 && }
{subject}runsfailuresavg latencytokenscost
{row.key}{integer(row.runs)}{integer(row.failures)}{integer(row.latency_avg_ms)} ms{row.tokens === null ? 'Unavailable' : integer(row.tokens)}{row.cost_usd === null ? 'Unavailable' : money(row.cost_usd)}
No matching {subject.toLowerCase()} records.
; } function LoadingReport() { return
{Array.from({ length: 8 }, (_, index) =>
)}
; } export function H6ReportPage() { const [searchParams, setSearchParams] = useSearchParams(); const query = useMemo(() => queryFromSearch(searchParams), [searchParams]); const [draft, setDraft] = useState(() => ({ project: searchParams.get('project') ?? '', from: searchParams.get('from') ?? '', to: searchParams.get('to') ?? '', run: searchParams.get('run') ?? '', })); const report = useQuery({ queryKey: ['reports', 'h6', query], queryFn: () => api.h6Report(query), retry: false }); const applyFilters = (event: FormEvent) => { event.preventDefault(); const next = new URLSearchParams(); if (draft.project) next.set('project', draft.project); if (draft.from) next.set('from', draft.from); if (draft.to) next.set('to', draft.to); if (draft.run) next.set('run', draft.run); setSearchParams(next); }; const clearFilters = () => { setDraft({ project: '', from: '', to: '', run: '' }); setSearchParams({}); }; const inputClass = 'w-full rounded-xl border border-slate-300 bg-white px-3 py-2.5 text-sm text-slate-800 outline-none transition focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100'; return
H6 · evidence-backed operations

AgentOps assurance dossier

One report surface for runtime health, provider usage, cost provenance, failures, retries, alerts and source freshness.

{report.data &&
{report.data.verdict}{report.data.freshness.status} · {report.data.report_id}
}
Filters apply to API and both exports}>
setDraft((current) => ({ ...current, from: event.target.value }))} className={inputClass} /> setDraft((current) => ({ ...current, to: event.target.value }))} className={inputClass} /> setDraft((current) => ({ ...current, run: event.target.value }))} placeholder="All runs" className={inputClass} />{report.data?.available_filters.runs.map((run) =>
{report.isLoading && } {report.isError &&
The H6 report could not be generated.

Check the selected time range and confirm the Control Panel API can read the canonical telemetry sources.

} {report.data && <>
0 ? integer(report.data.summary.tokens.provider_total ?? report.data.summary.tokens.total ?? 0) : 'Unavailable'} sub={`${report.data.summary.coverage.token_pct}% run coverage`} accent />
}>
{report.data.findings.map((finding) =>
{finding.code}{finding.metric && {finding.metric}: {String(finding.value)}{finding.threshold !== undefined ? ` · threshold ${String(finding.threshold)}` : ''}}

{finding.message}

)}{report.data.findings.length === 0 &&
No threshold breach was detected in this scope.
}
}>
{report.data.evidence_sources.map((source) =>
{source.source}
{source.records} records{source.age_s === null ? 'no timestamp' : `${integer(source.age_s)}s old`}
{source.path}
)}
Token coverage
{report.data.summary.coverage.token_pct}%
Cost coverage
{report.data.summary.coverage.cost_pct}%
{report.data.data_quality.warnings.length > 0 ?
    {report.data.data_quality.warnings.map((warning) =>
  • {warning}
  • )}
:
All required sources are present and no estimation warning was detected.
}
Generated on demand · no hard-coded score}>

Both exports use the same contract, filters, verdict rules and canonical sources as this screen. JSON is machine-auditable; HTML is print-ready for team review.

}
; }