Skip to main content

detect

Function detect 

Source
pub fn detect(path: &Path) -> Result<Format>
Expand description

Detect the format of a session file by inspecting its content shape. Content-based only — no file-extension sniffing, because agx tools in the wild all use vanilla .json / .jsonl extensions regardless of which agent CLI produced them.

Probe order (most specific first, so ambiguous shapes land on the right parser):

The ordering matters. For example, a Vercel AI SDK save has messages at the top level (which would otherwise match Generic), so the Vercel-specific markers (finishReason / stepType / camelCase toolCallId) are checked first. Same story for LangChain exports that happen to include a messages field under inputs.