import { Evidence } from '@/components/evidence/evidence'; import { cn } from '@/lib/cn'; import { fmtAgo } from '@/lib/format'; import type { ProvenanceEntry } from '@/lib/types'; import { TierBadge } from './badges'; function domain(url: string | null | undefined): string | null { if (!url) return null; try { return new URL(url).hostname.replace(/^www\./, ''); } catch { return null; } } /** * One-line provenance: "Source: docs.claude.com · T1 · observed 3 h ago · high". Server-safe. * With `slug` + `property` it appends an "Evidence" trigger that opens the drawer (`components/evidence`). */ export function ProvenanceInline({ p, className, showConfidence = true, slug, property, value, entity, }: { p: ProvenanceEntry; className?: string; showConfidence?: boolean; slug?: string; property?: string; value?: unknown; entity?: { name?: string; entity_type?: string } | null; }) { const name = p.source_name ?? domain(p.url) ?? 'source'; return (
Source:
{p.url ? (
{name}
) : (
{name}
)}
·