Function consumeStream

  • Drive one streamed request to completion over an injected transport.

    Yields each event value; returns the done value; throws StreamError on an error frame. Always unsubscribes (via the generator's finally) so an early break in the consumer doesn't leak the listener.

    signal wires a caller AbortSignal to mid-stream cancellation: when it fires (or the consumer breaks before a terminal frame), the finally sends a cancel frame back over transport.cancel so the HOST stops generating — without it, aborting only stops the app-side iterator while the upstream provider keeps streaming and BILLING (LLM_AND_AGENTS_SPEC §3.3, R3-224 / adversarial F2).

    Type Parameters

    • T = unknown
    • R = unknown

    Parameters

    • transport: StreamTransport
    • type: string
    • method: string
    • params: unknown[]
    • msgId: number = ...
    • Optionalsignal: AbortSignal
    • Optionalopts: BoundedCallOptions & { idleTimeoutMs?: number }

    Returns AsyncGenerator<T, R, void>