Expand description
mcpmesh-codec: the family’s ONE wire codec (mcpmesh spec §7.3) — compact JSON, UTF-8,
one frame per \n, 16 MiB cap.
Both ends of every wire share THIS implementation: the daemon side re-exports it as
mcpmesh_net::framing, and the no-iroh client side (kb, loc, the host shell) as
mcpmesh_local_api::codec — so the two ends can never drift apart. Deliberately tiny:
serde_json + tokio io traits only, NO iroh. Session POLICY (violation strikes,
synthesized error frames) stays with the session owners (mcpmesh-net); only the pure
codec lives here.
Structs§
- Frame
Reader - NDJSON frame reader over any
AsyncRead. Reads byte-at-a-time from an INTERNALBufReader(misuse-proof: callers cannot forget the buffering and pay a poll-per-byte penalty).
Enums§
- Inbound
- One inbound frame, or a framing violation (kept distinct so callers can log/strike).
- Violation
Constants§
- MAX_
FRAME_ BYTES - 16 MiB — the family frame cap (mcpmesh §7.3, spec §12 default). App payloads are ≤1 MiB by policy.
Functions§
- write_
frame - Serialize
frameand write it terminated by\n, flushing (a BufWriter-safe no-op for unbuffered writers — makes BufWriter wrapping misuse-proof).