/**
 * The run event hub.
 *
 * A {@link RunLedger} is a synchronous fan-out: hosts {@link RunLedger.subscribe}
 * to receive every {@link RunEvent} the loop {@link RunLedger.publish}es, and the
 * call returns a disposer that removes that handler. Delivery is sequential over
 * the current handler set — each handler is invoked in turn, and a handler that
 * throws never prevents the remaining handlers from observing the event.
 *
 * The handler set is snapshotted at publish time, so subscribing or
 * unsubscribing from inside a handler is safe: the change takes effect on the
 * next publish rather than mutating the iteration in flight.
 */
import type { RunEvent } from "../contract";
/** A consumer of run events. */
export type RunEventHandler = (event: RunEvent) => void;
/** Removes a previously registered handler. Idempotent. */
export type Unsubscribe = () => void;
/**
 * A subscribable, publishable hub for {@link RunEvent}s.
 *
 * Holds no run state of its own; it only delivers events to the currently
 * registered handlers. Pair it with the accumulator when a host needs the
 * latest snapshot rather than the raw event stream.
 */
export declare class RunLedger {
    /** The live set of handlers. Insertion order is preserved for delivery. */
    private readonly handlers;
    /**
     * Register a handler for every subsequent event.
     *
     * @returns a disposer that removes this handler. Calling it more than once is
     * harmless. The same function reference may be subscribed only once; a
     * duplicate subscription is a no-op that still returns a working disposer.
     */
    subscribe(handler: RunEventHandler): Unsubscribe;
    /**
     * Deliver an event to every currently registered handler.
     *
     * Handlers are notified in registration order over a snapshot of the set, so
     * mutations made during delivery apply to the next publish. A throwing
     * handler is isolated: its error is swallowed so siblings still receive the
     * event and the loop is never broken by a faulty subscriber.
     */
    publish(event: RunEvent): void;
    /** Drop every handler. Useful when tearing a host down. */
    clear(): void;
    /** How many handlers are currently registered. */
    get size(): number;
}
