Expand description
Minimal Cap’n Proto builder for ChatCoreOut messages.
Builds single-segment Cap’n Proto messages without any external dependencies. Follows the wire format: [segment_count-1: u32] [segment0_size_words: u32] [segment0_bytes…]
ChatCoreOut union layout (matching chat_core.capnp): Data section: 1 word (8 bytes) - bytes 0-1: union discriminant (u16 LE) Pointer section: 1 pointer (8 bytes) - ptr 0: Text for content/thinking/error, or struct for toolCallDetected
Union discriminants: 0 = content (Text) 1 = thinking (Text) 2 = toolCallDetected (ToolCallDetectedMsg struct) 3 = complete (Void) 4 = error (Text)
Functions§
- build_
complete - Build a ChatCoreOut.complete message (Void, no payload).
- build_
text_ event - Build a ChatCoreOut message with a Text payload (content, thinking, error).
- build_
tool_ call_ detected - Build a ChatCoreOut.toolCallDetected message. The ToolCallDetectedMsg struct has 4 text fields: ptr 0: id, ptr 1: uuid, ptr 2: description, ptr 3: arguments
- encode_
event_ list - Encode multiple ChatCoreOut events into a single buffer. Format: [u32 LE count] [u32 LE len0] [event0 bytes] [u32 LE len1] [event1 bytes] …