/**
 * Thread State + Scheduler Context Aggregator (Spark Plan 11)
 *
 * Aggregates per-thread `thread_state` rows + `sched.with_context` wakeup
 * edges into a `ThreadSchedContextContract`. The contract is the
 * prerequisite prior used by jank, ANR, and startup decision trees.
 */
import { type NsTimeRange, type ThreadSchedContextContract } from '../types/sparkContracts';
export interface ThreadStateRow {
    utid: number;
    pid: number;
    threadName: string;
    state: string;
    durNs: number;
}
export interface WakeupRow {
    fromUtid: number;
    toUtid: number;
    fromThread?: string;
    toThread?: string;
    ts: number;
    latencyNs?: number;
    reason?: string;
}
export interface CriticalChainRow {
    utid: number;
    threadName: string;
    startNs: number;
    endNs: number;
    reason: string;
}
export interface ThreadSchedContextOptions {
    range: NsTimeRange;
    threadStateRows: ThreadStateRow[];
    wakeupEdges?: WakeupRow[];
    criticalChain?: CriticalChainRow[];
    /**
     * Per-utid runnable-latency p95 in ns. Caller computes via SQL window
     * aggregation; supplying it as a separate input keeps this function pure.
     */
    runnableLatencyP95Ns?: Record<number, number>;
}
/**
 * Assemble the contract from raw rows. Caller is responsible for clamping
 * thread_state durations to the analysis window — this function trusts the
 * inputs and just pivots them.
 */
export declare function buildThreadSchedContext(options: ThreadSchedContextOptions): ThreadSchedContextContract;
//# sourceMappingURL=threadSchedContext.d.ts.map