import type { EditorClient } from "../../types.js";
export interface StablePeerOptions {
    maxQueueSize?: number;
}
export type StablePeerBinding = {
    peer: EditorClient;
    peerId: string;
} | {
    peer: undefined;
};
/**
 * Identity-stable wrapper around the editor `EditorClient`.
 *
 * The underlying socket client is swapped on every WebSocket reconnect.
 * Callers that cache a reference (directly or via a closure) would otherwise
 * keep pushing to the dead pre-reconnect instance. StablePeer keeps the
 * reference stable: `clark.context.peer` is always the same object, and
 * `setInner` only swaps what's behind it.
 *
 * Calls made while disconnected are queued and replayed in order when the
 * next peer is bound, up to `maxQueueSize`. The queue lives in process
 * memory; durability across server restarts is a separate concern.
 */
export declare class StablePeer implements EditorClient {
    private inner;
    private _peerId;
    private queue;
    private readonly maxQueueSize;
    readonly call: EditorClient["call"];
    constructor(options?: StablePeerOptions);
    get peerId(): string | undefined;
    /**
     * Bind or clear the backing peer and its identity token atomically.
     * Binding flushes any queued calls in order to the new peer.
     */
    setInner(binding: StablePeerBinding): void;
    close(): void;
    /** Not used in practice; throws if exercised so new callers are caught in review. */
    requestWithTracing<_Params, _Result>(): Promise<never>;
    /**
     * Memoized per-path so `peer.call.aiPushMessage` returns the same callable
     * on every property access. Streaming handlers invoke `peer.call.X(...)` in
     * tight loops; without memoization each access would allocate a fresh
     * array, nested Proxy, and closure.
     */
    private buildCallProxy;
    private dispatch;
    private invokeOnInner;
    private enqueue;
    private flush;
}
//# sourceMappingURL=stable-peer.d.ts.map