/** Typed, runtime-neutral channel contracts. Durable replay, presence, fan-out, and tenant-aware * routing belong in an adapter; the bundled hub provides only bounded process-local replay for tests * and local development. */ export interface ChannelContract { readonly name: Name; /** Type-only message witness; adapters never materialize it. */ readonly __message?: (value: Message) => Message; } export interface ChannelEvent { /** Monotonic within one channel; adapters may use a different opaque cursor representation. */ readonly sequence: number; readonly resumeToken: string; readonly data: Message; } export type ChannelCloseReason = "closed" | "backpressure" | "aborted"; export interface ChannelSubscription extends AsyncIterableIterator> { readonly channel: string; readonly closed: boolean; readonly closeReason: ChannelCloseReason | undefined; readonly resumeToken: string | undefined; close(): void; } export interface ChannelSubscribeOptions { /** Maximum undelivered events retained for this subscriber. Default 64. */ readonly maxQueue?: number; /** Resume after this opaque cursor. The adapter must fail closed when the cursor is unavailable. */ readonly resumeFrom?: string; readonly signal?: AbortSignal; } export interface ChannelHub { subscribe(channel: ChannelContract, options?: ChannelSubscribeOptions): ChannelSubscription; publish(channel: ChannelContract, data: Message): ChannelEvent; } export interface MemoryChannelHubOptions { /** Default queue bound per subscriber. Default 64. */ readonly maxQueue?: number; /** Maximum events retained per channel for local cursor replay. Default: the queue bound. */ readonly historySize?: number; } /** A requested cursor is malformed, belongs to another channel, or fell outside retained history. */ export declare class ChannelResumeUnavailableError extends Error { readonly channel: string; readonly resumeToken: string; constructor(channel: string, resumeToken: string); } /** Define a typed channel name. Message types are erased; adapters own validation at their boundary. */ export declare function defineChannel(name: Name): ChannelContract; /** A bounded in-memory hub suitable for tests and local development, never for durable fan-out. */ export declare function memoryChannelHub(options?: MemoryChannelHubOptions): ChannelHub; /** Adapt a channel subscription to a cancellable Web stream for SSE/HTTP adapters. */ export declare function channelReadableStream(subscription: ChannelSubscription): ReadableStream>; //# sourceMappingURL=channel.d.ts.map