Structs§
- Assistant
Message - Assistant
Message Body - Control
Request Body - Control
Request Message - Result
Message - Stream
Event Message - System
Message - Tool
Progress Message - User
Message
Enums§
- Content
Block - Stream
Message - Top-level message from Claude CLI stdout (NDJSON stream-json protocol).
Functions§
- answer_
question - Build a control response that approves an AskUserQuestion request
and injects the user’s answer via
updated_input. - approve_
tool - Build a tool-approval control response (allow unapproved tools after user confirmation).
- control_
response - Build a control response JSON line to write to stdin (e.g. tool approval). Returns an error if serialization fails (should be extremely rare).
- deny_
tool - Build a tool-denial control response (reject unapproved tools). Returns a hardcoded fallback if serialization fails (should never happen for this simple JSON).
- parse_
line - Parse a single NDJSON line from Claude CLI stdout.
Returns
Nonefor empty/malformed lines (logged as warnings). - user_
message - Build a user message JSON line to write to stdin. Returns an error if serialization fails (should be extremely rare).