shared sink semantics for *_stream apis.
consumers can opt into three sinks via :into:
- default (no
:into) —{:ok, stream}, lazyStream. :intois apid— events are forwarded as{:openrouter_event, ref, event}; returns{:ok, ref}.:intois afun/2— runsEnum.reduce/3for the consumer withacc: opts[:acc] || []; returns{:ok, acc}.
the streaming function is passed as a thunk so we can decide whether to invoke it inline or inside a separate task — this matters because the underlying stream reads from the mailbox of whichever process opened it.
Summary
Types
@type start_fn() :: (-> {:ok, Enumerable.t()} | {:error, term()})