Expand description
The pure stdout demux — plain CLI stdout lines → neutral aion_core::ActivityEvents.
The stdout demux — the pure translation from a plain CLI agent’s interleaved stdout lines into
neutral [ActivityEvent]s.
This is the case-(b) analogue of the Norn adapter’s translate module, and the whole point of
the observability-only shape: a plain-stdout agent has no structured channel, so its
transcript is recovered by parsing the interleaved lines it prints. The demux is deliberately
lossless: any line the classifier does not recognise falls through to
[ActivityEventKind::Raw] carrying the verbatim line, so nothing an agent prints is ever
silently dropped.
§The recognised shape
A line that parses as a JSON object with a "type" string is mapped onto a neutral kind:
line type | neutral kind |
|---|---|
"message" (with "text") | [ActivityEventKind::Message] (assistant role) |
"tool_call" | [ActivityEventKind::ToolCall] |
"tool_result" | [ActivityEventKind::ToolResult] |
"stop" (with "reason") | [ActivityEventKind::Stop] |
Everything else — a non-JSON log line, a JSON value without a known type, an empty line — is a
[ActivityEventKind::Raw]. This mirrors real observability-only CLIs, which interleave a little
structured output with free-form logging.
The demux is pure and independently tested; the session (crate::session) is the only place
that reads the child’s stdout and stamps ordering onto the events this produces.
Structs§
- Event
Identity - The
(workflow, run, activity, attempt)identity stamped onto every demuxed event.
Functions§
- line_
to_ event - Maps one line of the child’s stdout into a neutral
ActivityEvent.