/**
 * The tool child's barrier clock (senpi#3566, plan todo 4).
 *
 * One `Int32Array` over a `SharedArrayBuffer`, shared by the child's protocol loop and every kernel worker. Index 0 is
 * a monotonic clock; after it, one slot per in-flight launch holds `{ackTick, invokeTick, invocations, inUse}`. The
 * protocol loop stores `ackTick` when `launch_ack` arrives; every launch path stores `invokeTick` and bumps
 * `invocations` immediately before it calls the real spawn API. `ackTick < invokeTick` read from the same clock is the
 * causal proof that no command ran before the server recorded its containment handle, independent of transport order
 * or of how long the command runs. Tick 0 never occurs, so 0 in a slot means "not yet".
 */
export declare const DEFAULT_LAUNCH_SLOTS = 256;
export interface SlotState {
    readonly ackTick: number | null;
    readonly invokeTick: number | null;
    readonly invocations: number;
}
export type AckWait = "acked" | "timed-out";
export declare class BarrierClock {
    readonly buffer: SharedArrayBuffer;
    readonly slots: number;
    private readonly cells;
    constructor(buffer: SharedArrayBuffer);
    static create(slots?: number): BarrierClock;
    /** The next tick; strictly increasing across every thread sharing the buffer. */
    tick(): number;
    /** Claims a free slot for one launch (protocol loop only), or undefined when all are in flight. */
    claimSlot(): number | undefined;
    releaseSlot(slot: number): void;
    /** Protocol loop, on `launch_ack`: records the tick and wakes a worker blocked in `waitForAck`. */
    recordAck(slot: number): number;
    /**
     * Launch path, immediately before the real call: stores the invoke tick and counts the invocation. Returns the
     * ticks the proof carries; `ackTick` is null when the call proceeds without an ack (only a mutation can do that).
     */
    recordInvoke(slot: number): {
        readonly ackTick: number | null;
        readonly invokeTick: number;
    };
    /** Worker thread only: blocks until the protocol loop records the slot's ack. */
    waitForAck(slot: number, timeoutMs?: number): AckWait;
    read(slot: number): SlotState;
    private index;
}
/** The proof the server enforces: an ack exists and it precedes the invocation on the shared clock. */
export declare function proofIsOrdered(proof: {
    readonly ackTick: number | null;
    readonly invokeTick: number;
}): boolean;
//# sourceMappingURL=barrier-clock.d.ts.map