Class ContinuationEventStream

All Implemented Interfaces:
AutoCloseable, Iterable<InteractionSSEStreamEvent>

public final class ContinuationEventStream extends EventStream<InteractionSSEStreamEvent>
An EventStream of a streaming interactions.create() call that automatically continues across hops (HTTP requests).

Every event of every hop is yielded verbatim and in order, including each hop's own interaction.created and intermediate interaction.completed (with status requires_continuation) events. When a hop completes with requires_continuation and a token, the next hop is requested from that token. When the transport drops (or the stream ends) mid-hop after an interaction.status_update checkpoint token, and nothing was yielded since that checkpoint, the hop is resumed from it; a hop that drops before making progress is retried from its start token up to InteractionContinuation.MAX_STREAM_RECONNECTS_WITHOUT_PROGRESS times in a row. SSE error events are terminal; HTTP status errors are not retried here.

Hand-written (not generated). Per-hop state lives in a ContinuationEventStream.Hop record replaced wholesale when a hop starts, so per-hop fields cannot leak across hops; loop state (next resume token and owner, no-progress reconnect counter, pending transport error) persists on the stream.