Skip to main content

parse_message

Function parse_message 

Source
pub fn parse_message(raw: Value) -> Result<Message>
Expand description

Parse a raw JSON value from the CLI stream into a typed Message.

The CLI emits newline-delimited JSON with a top-level type field. Each type has a different structure:

  • "assistant" and "user": have a nested "message" object
  • "result": top-level fields (no message wrapper)
  • "system": has a "subtype" field
  • Others: preserved as Unknown