/**
 * Channel construction and collapse helpers.
 *
 * A {@link Channel} is just an `AsyncIterable<Emission>`. These helpers let a
 * connector wrap a generator function as a (re-iterable) channel, and let a
 * caller fold a whole channel down to its terminal {@link Reply}.
 */
import type { Channel, Emission, Reply } from "../contract";
/**
 * Wrap a generator factory as a {@link Channel}.
 *
 * Unlike handing a single `AsyncGenerator` around (which is exhausted after one
 * pass), this returns an object whose `[Symbol.asyncIterator]` calls the
 * factory afresh each time, so the channel can be consumed more than once.
 */
export declare function channelOf(gen: () => AsyncGenerator<Emission>): Channel;
/**
 * Drain a channel and produce its final {@link Reply}.
 *
 * If the channel emits a terminal `done`, that reply is returned verbatim. If
 * it emits a terminal `error`, the underlying {@link GatewayError} is thrown.
 * Otherwise the buffered deltas are folded into a reply via {@link foldReply}.
 */
export declare function collectReply(channel: Channel): Promise<Reply>;
