caelum0x 695a365ae4 feat: PaperTrail — enterprise evidence-verification platform
Multi-tenant platform (182 pages, 228 API routes, ~30 modules) built on a
deterministic verification core: clinical-trial claims checked against
ClinicalTrials.gov registered results and raw event counts (ARR/NNT/RR+CI
recomputed in code, oracle-tested), code-enforced exact-span grounding, and
multi-source cross-verification. Auth/RBAC/multi-tenancy, document processing
at scale (unpdf + Docling), agentic workflows, Claude Science connector,
compliance/audit, billing, public API, and more.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 07:21:22 +03:00

68 lines
1.5 KiB
TypeScript

// Shared, serializable shapes returned by the API-usage analytics endpoints and
// consumed by the console pages. Kept free of `pg`/server-only imports so the
// client components can import them safely.
export interface RouteUsage {
route: string;
requests: number;
errors: number;
errorRate: number; // 0..1
avgDurationMs: number | null;
p95DurationMs: number | null;
}
export interface KeyUsage {
apiKeyId: string | null;
keyName: string | null;
requests: number;
errors: number;
errorRate: number; // 0..1
lastUsedAt: string | null;
}
export interface UsageSummary {
rangeDays: number;
totalRequests: number;
totalErrors: number;
errorRate: number; // 0..1
avgDurationMs: number | null;
p95DurationMs: number | null;
rateLimitedCount: number;
activeKeys: number;
topRoutes: RouteUsage[];
topKeys: KeyUsage[];
}
export interface TimeseriesPoint {
bucket: string; // ISO timestamp at the start of the bucket
requests: number;
errors: number;
avgDurationMs: number | null;
}
export interface UsageTimeseries {
rangeDays: number;
bucket: "hour" | "day" | "week";
totalRequests: number;
points: TimeseriesPoint[];
}
export interface ApiRequestLogItem {
id: string;
route: string;
method: string;
statusCode: number;
durationMs: number;
apiKeyId: string | null;
keyName: string | null;
createdAt: string;
}
export interface RateLimitEventItem {
id: string;
route: string;
apiKeyId: string | null;
keyName: string | null;
createdAt: string;
}