import type { ResourceLedger } from './ResourceLedger.js';
export interface ResourceSamplerOptions {
    ledger: ResourceLedger;
    /** Returns the live session pane PIDs to sample, keyed by session id. Called
     *  each tick; an error/empty result just means "no sessions this tick". */
    getSessionPids: () => Array<{
        id: string;
        pid: number;
    }>;
    /** Active sampling cadence (ms). Defaults to 60_000. */
    intervalMs?: number;
    /** Idle sampling cadence (ms) — used when getSessionPids() is empty. Default 5min. */
    idleIntervalMs?: number;
    /** Retention window (ms) — samples older than this are pruned each tick. Default 7d. */
    retentionMs?: number;
    /** Test seam: read this process's CPU usage (microseconds). Defaults to process.cpuUsage. */
    cpuUsageFn?: (previous?: NodeJS.CpuUsage) => NodeJS.CpuUsage;
    /** Test seam: read this process's memory. Defaults to process.memoryUsage. */
    memoryUsageFn?: () => NodeJS.MemoryUsage;
    /** Test seam: monotonic clock (ms). Defaults to Date.now. */
    now?: () => number;
    /** Test seam: sample a batch of OS pids. Defaults to a batched `ps` call. */
    samplePidsFn?: (pids: number[]) => Promise<Map<number, {
        cpuPercent: number;
        rssBytes: number;
    }>>;
    /** Optional error sink (defaults to a single console.warn). */
    onError?: (err: unknown) => void;
}
export declare class ResourceSampler {
    private readonly ledger;
    private readonly getSessionPids;
    private readonly intervalMs;
    private readonly idleIntervalMs;
    private readonly retentionMs;
    private readonly cpuUsageFn;
    private readonly memoryUsageFn;
    private readonly now;
    private readonly samplePidsFn;
    private readonly onError;
    private timer;
    private running;
    private started;
    private closed;
    private lastCpu;
    private lastCpuAtMs;
    constructor(opts: ResourceSamplerOptions);
    start(): void;
    stop(): void;
    /** Self-rescheduling timer (NOT setInterval) so the cadence can adapt to
     *  idle/active each tick and a slow tick can't stack. unref()'d. */
    private schedule;
    /** Run one sampling pass. Public for tests. Never throws. */
    tick(): Promise<void>;
    /**
     * CPU% for THIS process over the interval since the last tick: the
     * (user+system) microseconds consumed divided by the wall-clock microseconds
     * elapsed, ×100. One fully-busy core reads ~100. Returns 0 when there's no
     * prior baseline yet (first tick) or the clock didn't advance.
     */
    private computeOwnCpuPercent;
}
//# sourceMappingURL=ResourceSampler.d.ts.map