Skip to main content

Module jsonl

Module jsonl 

Source
Expand description

HAIL JSONL format: streaming serialization/deserialization

A .hail.jsonl file has the structure:

{"type":"header","version":"hail-1.0.0","session_id":"...","agent":{...},"context":{...}}
{"type":"event","event_id":"e1","timestamp":"...","event_type":{...},"content":{...},...}
{"type":"event","event_id":"e2","timestamp":"...","event_type":{...},"content":{...},...}
{"type":"stats","event_count":42,"message_count":10,...}

The header line contains session metadata (no events). Each event is one line. The last line is aggregate stats (optional on write, recomputed on read if missing).

Enums§

HailLine
A single line in a HAIL JSONL file
JsonlError
Error types for JSONL operations

Functions§

from_jsonl_str
Read a Session from a HAIL JSONL string
read_header
Read only the header (first line) from HAIL JSONL — useful for listing sessions without loading all events
read_header_and_stats
Read header + stats (first and last line) without loading events. Returns (version, session_id, agent, context, stats_or_none)
read_jsonl
Read a Session from HAIL JSONL reader
to_jsonl_string
Write a Session as HAIL JSONL to a String
write_jsonl
Write a Session as HAIL JSONL to a writer