Expand description
Streaming execution for codex exec commands.
Instead of buffering all JSONL output and returning it at once,
the streaming API pipes stdout from the child process and delivers
each JsonLineEvent to a caller-supplied callback as soon as it
arrives.
Malformed UTF-8 in exec stdout and stderr is decoded with replacement
characters, matching buffered exec.
§Example
use codex_wrapper::{Codex, ExecCommand, JsonLineEvent};
let codex = Codex::builder().build()?;
let cmd = ExecCommand::new("what is 2+2?").ephemeral();
cmd.stream(&codex, |event: JsonLineEvent| {
println!("{}: {:?}", event.event_type, event.extra);
})
.await?;Functions§
- stream_
exec - Stream JSONL events from
codex exec <prompt>, invokinghandlerfor each parsedJsonLineEvent. - stream_
exec_ cancellable - Stream JSONL events until the command completes or
cancelresolves. - stream_
exec_ resume - Stream JSONL events from
codex exec resume, invokinghandlerfor each parsedJsonLineEvent. - stream_
exec_ resume_ cancellable - Stream resumed-turn JSONL events until completion or cancellation.