export type DisposerFn = () => void | Promise<void>;
export interface DisposerChainOptions {
    /** Logged when an individual disposer throws. Defaults to console.error. */
    onError?: (err: unknown, index: number) => void;
}
export declare class DisposerChain {
    private disposers;
    private disposed;
    private readonly onError;
    constructor(opts?: DisposerChainOptions);
    /**
     * Register a teardown callback. Returns an unregister function so
     * callers can drop a single disposer without disposing the whole
     * chain.
     *
     * If the chain has already been disposed, the callback runs immediately
     * (sync) — this matches the “register-after-shutdown” edge case where
     * an addon's late initialization races with kernel restart.
     */
    add(fn: DisposerFn): () => void;
    /** True after `dispose()` has been called at least once. */
    get isDisposed(): boolean;
    /** Number of disposers currently registered. */
    get size(): number;
    /**
     * Run every registered disposer in LIFO order. Idempotent: subsequent
     * calls do nothing. Awaits async disposers so callers can sequence
     * shutdown → restart correctly.
     */
    dispose(): Promise<void>;
}
//# sourceMappingURL=disposer-chain.d.ts.map