import { type SessionWorkerToHost } from "./session-worker-protocol.ts";
import type { WorkerTransfer } from "./session-worker-transfer.ts";
/** Builds the host message around the wait signal it must carry. */
export type CreditRequest = (signal: SharedArrayBuffer) => SessionWorkerToHost;
export interface WorkerCredit {
    /** Blocks the worker until the host answers; a denial fails the worker with `deniedError`. */
    exchange(message: CreditRequest, deniedError?: string, signal?: SharedArrayBuffer): void;
    /** `exchange` for a payload message: once a transport is installed it is built only under a host permit (S12b). */
    transfer(message: CreditRequest): void;
    /** Posts a payload message that waits for no credit (the `ready` answer), under the same permit rule. */
    post(build: () => SessionWorkerToHost): void;
    /** Moves every later payload message onto the host's permit transport; without one nothing changes (flag OFF). */
    installTransport(transport: WorkerTransfer): void;
    /**
     * Declares a connection's capabilities on the host (omo-relay-daemon#307): `stale` is the host's command-local
     * refusal of a declaration from a retired incarnation; a conflict still fails the worker.
     */
    declareOnHost(message: CreditRequest): "declared" | "stale";
    /** Installs the isolate's session-write grant, reporting denials as domain errors. */
    installWriteReservation(canonical: (path: string) => string): void;
}
/**
 * Synchronous host credit for a session worker.
 *
 * Every exchange blocks the worker thread on its own wait signal, so the host answers
 * before the worker touches a writer, publishes output, or registers client capabilities.
 */
export declare function createWorkerCredit(send: (message: SessionWorkerToHost) => void, fail: (error: string) => never): WorkerCredit;
//# sourceMappingURL=session-worker-credit.d.ts.map