subc-protocol 0.1.0

Shared wire contract for subc <-> modules: the 17-byte envelope, JSON-RPC body shapes, and the capability manifest. Single source of truth, depended on by subc-core and AFT.
Documentation

subc wire contract.

This crate is the single source of truth for the subc <-> module wire, shared by subc-core and AFT. It defines the envelope (the fixed 17-byte routing header subc splices on), the canonical subc-generated body schemas such as [ErrorBody], and the capability manifest. JSON-RPC request and response bodies remain module-owned opaque payloads to subc.

The envelope (locked — see docs/subc-core-architecture.md §4.8)

 offset  size  field     type    purpose
   0      4    len       u32     # of BODY bytes after this 17-byte header
   4      1    ver       u8      envelope version
   5      1    type      u8      frame kind (see FrameType)
   6      1    flags     u8      bit0 BINARY · bits1-2 PRIORITY · bit3 LAST · 4-7 reserved
   7      2    channel   u16     route = (component, session); 0 = subc itself
   9      8    corr      u64     correlation id; CANCEL carries the target call's corr
  17 -> body

Little-endian (same-machine, native, no byte-swap on the hot path).

Frozen prefix (the versioning invariant): len (u32 @ 0) and ver (u8 @ 4) keep fixed meaning + position in every future version. A reader of any version can therefore always read the first 5 bytes, learn ver, look up that version's header length, read the rest, and splice len body bytes. decode_header enforces this discipline.