Summary
Parse codex's --json NDJSON output for structured event handling.
CodexWrapper.JsonLineEvent struct: event_type, data (map), raw (string)
CodexWrapper.Exec.execute_json/2 returns list of parsed events
CodexWrapper.Exec.stream/2 returns lazy Stream of JsonLineEvent via Port
- Port-based streaming with line-by-line NDJSON parsing
Event types from codex --json
thread.started, turn.started, item.completed, turn.completed, etc.
Acceptance criteria
Depends on
Reference
- codex-wrapper (Rust):
JsonLineEvent in exec.rs
- claude_wrapper:
lib/claude_wrapper/stream_event.ex, Query.stream/2
Summary
Parse codex's
--jsonNDJSON output for structured event handling.CodexWrapper.JsonLineEventstruct: event_type, data (map), raw (string)CodexWrapper.Exec.execute_json/2returns list of parsed eventsCodexWrapper.Exec.stream/2returns lazyStreamof JsonLineEvent via PortEvent types from codex --json
thread.started,turn.started,item.completed,turn.completed, etc.Acceptance criteria
JsonLineEventstruct withparse/1from JSON stringJsonLineEventaccessor functions (event_type, data fields)Exec.execute_json/2collects all events from--jsonrunExec.stream/2returns lazy Stream via Port (like claude_wrapper's stream)Depends on
Reference
JsonLineEventin exec.rslib/claude_wrapper/stream_event.ex,Query.stream/2