import type { IoHelper } from '../api-private';
/**
 * Tracks async resources via async_hooks and, on demand, reports the ones still
 * keeping the event loop alive, with where they were created.
 *
 * Nothing is tracked until `start()` runs. Not exported as a value, so the only
 * way to get one is `trackLeakedHandles()`, which returns a started tracker.
 */
declare class LeakedHandleTracker {
    private readonly watched;
    /**
     * Whether we stopped recording because {@link MAX_TRACKED_HANDLES} was reached.
     * Reported, so a short list is never mistaken for a complete one.
     */
    private atCapacity;
    private readonly hook;
    /**
     * Begin watching async resources. Must run before the resources we care about
     * are created, and only when the user opted in, since the hook adds a small
     * per-resource cost.
     */
    start(): void;
    /**
     * Stop watching and discard all tracked state.
     */
    stop(): void;
    /**
     * Report the leaked handles once the grace period has passed. The timer is
     * unref'd, so it never fires if the process exits cleanly within the window and
     * never holds the process open itself.
     */
    scheduleReport(ioHelper: IoHelper): void;
    /**
     * Report every resource still holding the event loop open, each with the source
     * location where it was created. Call at the very end of execution, by which
     * point only genuinely leaked handles should remain.
     *
     * Emitted as one message, so unrelated output cannot interleave into the middle
     * of a stack trace, and at DEBUG, which is the level `--debug-cli` raises the
     * CLI to.
     */
    report(ioHelper: IoHelper): Promise<void>;
    private renderReport;
}
/**
 * Start watching async resources and return the tracker doing so.
 *
 * Call as early as possible, and only when the user asked for it. The tracker can
 * only report on resources created after it starts.
 */
export declare function trackLeakedHandles(): LeakedHandleTracker;
export type { LeakedHandleTracker };
