export { ChannelStreamSource }; import type { Channel } from './server/channel.js'; import type { StreamSource } from './types.js'; type StreamSourceChannel = Pick; /** * Receives tagged binary frames from a channel with credit-based backpressure. * * Each binary frame is tagged: `[TAG_DATA (0x00)][payload]` or * `[TAG_ERROR (0x01)][JSON error payload]`. * * Used by both directions: * - Client response: receives chunks from server-side channel pump * - Server request: receives chunks from client-side channel pump * * Raw frames are queued as-is; tags are parsed at dequeue time in readNextChunk. * This naturally preserves frame ordering — all data before an error is delivered * before the error is thrown. * * The optional `throwError` callback handles error frames with caller-specific * formatting (e.g. telefunc abort/bug errors). If omitted, a generic Error is thrown. * * Internally uses a read-head index for O(1) dequeues with periodic compaction. */ declare class ChannelStreamSource { private queue; private readHead; private wake; private closed; private closeError; private cancelled; private readonly channel; private readonly throwError?; private constructor(); /** Returns a unified `StreamSource` — chunk-pull, byte-buffer, and lazy stream views * over the same channel. `throwError` is called when an error frame is dequeued; * if omitted, error frames throw a generic Error. */ static create(channel: StreamSourceChannel, throwError?: (errorPayload: Record) => never): StreamSource; private readNextChunk; private cancel; }