Expand description
4-byte little-endian length-prefix frame codec.
Every IPC message (handshake, JSON-RPC request, JSON-RPC response, batch array, shim header) travels as:
+--------+------------------------------------+
| len:u32| body |
+--------+------------------------------------+lenis little-endian, excludes the prefix itself, and must be<= MAX_FRAME_BYTES(64 MiB). Larger frames are rejected at the codec boundary withio::ErrorKind::InvalidData.bodyis UTF-8 JSON; one complete JSON document per frame, no chunking, no streaming.- An EOF at a frame boundary (zero bytes read before the length
prefix) is a clean disconnect and returns
Ok(None). - An EOF inside a length prefix or body is an
io::ErrorKind::UnexpectedEof— truncated frames are never silently swallowed (this is the Phase 8a iter-1 B3 fix).
Enums§
- Frame
Error - Errors surfaced by the JSON-flavoured codec helpers in this module.
Constants§
- MAX_
FRAME_ BYTES - Per-frame ceiling. Values above this limit are rejected at
read_frame/write_frameboundaries. The bound is generous enough for Phase 8b’s largest expected MCP tool responses (subgraph exports on monorepo-scale graphs) without forcing the complexity of a chunked protocol.
Functions§
- read_
frame - Read a single framed blob.
- read_
frame_ json - Read a framed JSON blob and decode into
T. ReturnsOk(None)on a clean frame-boundary EOF. - write_
frame - Write a single framed blob. Returns
io::ErrorKind::InvalidInputifbody.len() > MAX_FRAME_BYTES. - write_
frame_ json - Write a typed value as a framed JSON blob.