/**
 * M7: Operational stats (time/attempts) derived from existing truth.
 *
 * No cost/token accounting — ADHDev observes PTY/CDP and cannot see API
 * tokens (explicit non-goal). Everything here is derived at query time from
 * the SQLite ledger and queue rows; there is no separate aggregate table.
 * Tasks with missing ledger evidence report incompleteEvidence instead of
 * estimated numbers.
 */
export interface MeshTaskStats {
    taskId: string;
    status: string;
    dispatchedAt: string | null;
    terminalAt: string | null;
    terminalKind: 'task_completed' | 'task_failed' | null;
    /** dispatched → terminal wall clock; null when evidence is incomplete. */
    durationMs: number | null;
    /** Number of task_dispatched ledger entries observed for this task. */
    dispatchCount: number;
    /** Queue requeueCount (0 when the row is gone or never requeued). */
    requeueCount: number;
    /** True when dispatch or terminal ledger evidence is missing — numbers are withheld, never estimated. */
    incompleteEvidence?: true;
}
export interface MeshMissionStats {
    missionId: string;
    taskCount: number;
    completed: number;
    failed: number;
    /** Sum of per-task durations with complete evidence. */
    totalDurationMs: number;
    /** First dispatch → last terminal across the mission's tasks; null without complete endpoints. */
    wallClockMs: number | null;
    /** Total requeue attempts across the mission's tasks. */
    retries: number;
    /** Task ids whose ledger evidence was incomplete (excluded from sums). */
    incompleteTaskIds: string[];
}
/**
 * Compute per-task stats from ledger entries. Scans a bounded tail window —
 * stats are an operational view of recent work, not a full historical report.
 */
export declare function computeMeshTaskStats(meshId: string, opts?: {
    taskIds?: string[];
    missionId?: string;
    tail?: number;
}): MeshTaskStats[];
/** Mission rollup — derived from per-task stats, no stored aggregates. */
export declare function computeMeshMissionStats(meshId: string, missionId: string): MeshMissionStats;
