import { type StudyCosts, type StudyCostRow } from "./study-costs.js"; export declare const STATS_SCHEMA = "humanish.stats.v1"; export interface StatsParticipants { total: number; reachedGoal: number; reportedFriction: number; } export interface StatsLabRow { lab: string; runs: number; live: number; dryRun: number; /** Runs whose bundle carries a verdict; the denominator for passRate. */ judged: number; passed: number; /** passed / judged, absent when judged is 0. */ passRate?: number; /** Over live runs with both timestamps. */ medianDurationMs?: number; durationSamples: number; /** Legacy participant/desktop-only median over runs with a known estimate. */ medianCostUsd?: number; costSamples: number; /** Runs with no estimate: a subscription brain, an interrupted run, an old bundle. Never zero. */ unpricedRuns: number; participants: StatsParticipants; costs: StudyCosts; } export interface StatsDayRow { day: string; runs: number; live: number; /** Legacy participant/desktop subtotal; costs also includes retained analysis. */ estimatedSpendUsd: number; unpricedRuns: number; costs: StudyCosts; } export interface StatsResult { schema: typeof STATS_SCHEMA; ok: true; cwd: string; since?: string; lab?: string; totals: { runs: number; live: number; dryRun: number; running: number; /** Legacy participant/desktop subtotal. Use costs.estimatedTotalUsd for retained analysis too. */ estimatedSpendUsd: number; unpricedRuns: number; participants: StatsParticipants; verdicts: Record; costs: StudyCosts; }; labs: StatsLabRow[]; days: StatsDayRow[]; /** Same selected runs; individual accounting gaps are inspectable without reading private evidence. */ costsByRun: StudyCostRow[]; /** Directories that could not be read, by name — surfaced, never silently dropped. */ unreadable: string[]; note: string; } export declare const STATS_NOTE: string; export interface StatsOptions { /** ISO date or datetime; runs that started before it are excluded. */ since?: string; /** Lab id; runs from other labs are excluded. */ lab?: string; nowMs?: number; } export interface StatsFailure { schema: typeof STATS_SCHEMA; ok: false; cwd: string; error: { code: "HUMANISH_STATS_INVALID_SINCE"; message: string; }; } export declare function computeStats(cwdInput: string, options?: StatsOptions): Promise; export declare function formatStatsHuman(result: StatsResult | StatsFailure): string;