Skip to main content

Module parser

Module parser 

Source
Expand description

Streaming JSONL parser for .agentlog files.

Each line of an .agentlog file is one JSON object conforming to the envelope schema from SPEC §3. This module provides a zero-copy-ish iterator that yields one Record per line (or a typed error with the 1-based line number where the failure occurred). It does NOT enforce trace-level invariants like “first record is metadata” or “parents point backward” — those are enforced by callers that actually need them (the replay engine, the differ) rather than at parse time.

Structs§

Parser
Streaming parser. One instance processes one .agentlog stream.

Enums§

ParseError
Errors produced by the streaming parser.

Constants§

DEFAULT_MAX_LINE_BYTES
Maximum bytes per JSONL line. Default covers real agent traces with long tool outputs + conversational context (observed p99 is ~50 KB per record); the ceiling catches runaway inputs early rather than OOMing deep inside read_line.
DEFAULT_MAX_TOTAL_BYTES
Maximum total bytes per trace. Hard cap to prevent a malicious or truncated file from exhausting memory during a parse_all collect. At 1 GB, covers months of production traffic for most agents while still refusing obvious denial-of-service payloads.

Functions§

parse_all
Parse an entire .agentlog stream into a Vec<Record>.