ol.llx.ai.impl.client.event-stream
platforms: clj, cljs
Shared stream runtime orchestration for all hosts.
Why
Host runtimes should differ only in transport concerns (how bytes arrive, how cancellation reaches the underlying request). Event decoding, lifecycle emission, finalize behavior, and terminal error handling must stay identical.
What
This namespace owns the shared stream loop:
- opens a provider stream with retry policy
- emits canonical :start / delta / :done events
- converts runtime failures into canonical terminal error events
- coordinates cancellation across producer/source and consumer/output channel
How
Hosts inject two hooks:
- :open-stream! to acquire the transport stream response
- :start-source! to push provider payloads onto payload-ch
The shared loop consumes payload/control channels with Promesa CSP, applies
adapter decode/finalize functions, and emits canonical events to out.