Raw stdout (possibly many newline-delimited JSON objects).
Optionallogger: StreamLogger
Optional structural logger; receives an "unknown event"
warn for any line whose parsed type is unrecognized — at most ONCE per
distinct type per call, so a repeated novel type cannot flood the log.
Never throws on a malformed line — non-JSON lines are skipped.
How much of a tool call and a tool result reaches either rendering. Defaults to DEFAULT_TRANSCRIPT_LIMITS.
{ text, modelMessages, messages, sessionId, result }: text is
the joined assistant-visible text, modelMessages the same transcript as
AI SDK messages (toModelMessages), messages is every
successfully-parsed line, sessionId is the top-level session_id Claude
Code stamps on its system/init line (and may restamp on later events;
last-wins, left undefined when no line carries one), and result is the
terminal ClaudeResultEnvelope read off the type: "result" line
(an empty object when none was emitted). The adapter threads sessionId
to continue a session across turns and inspects result to tell a real
failure, including a stale --resume, from a healthy run (see the
adapter's call).
Parse Claude Code stream-json stdout into the concatenated assistant text, the structured model messages, and the list of parsed lines.