Skip to main content

parse_codex_line

Function parse_codex_line 

Source
pub fn parse_codex_line(
    line: &str,
    session_id: &str,
    abs_byte_offset: u64,
) -> Option<ParsedEvent>
Expand description

Parse one Codex CLI JSONL line.

session_id must be derived from the filename before calling this function (e.g. from rollout-<timestamp>-<uuid>.jsonl). abs_byte_offset is the file byte offset of the start of this line; it is embedded in the synthesised event UUID so that INSERT OR IGNORE on session_messages.id is idempotent across re-tails of an append-only file.

Returns None for:

  • blank or whitespace-only lines
  • lines that are not valid JSON objects
  • lines whose top-level type is "event_msg" — these are duplicate event-stream representations of messages and must not be double-stored
  • any other line type that carries no useful message content

The returned raw and text fields have secrets masked.