drain_async_reader

Function drain_async_reader 

Source
pub(crate) async fn drain_async_reader<R: AsyncBufRead + Unpin>(
    reader: R,
    tx: &UnboundedSender<AgentEvent>,
) -> Result<AgentRunResult, String>
Expand description

Drain an arbitrary async reader of newline-delimited stream-json frames, forward every emitted AgentEvent on tx, and return an accumulator capturing the terminal Cost and Done values.

Pure async helper — no subprocess, no broker. Unit-tested with tokio::io::duplex in-memory pipes.