Skip to main content

Module session_codec

Module session_codec 

Source
Expand description

Phase 3 SESSION-lane codec (soldr#2365, slice 3a): bridge the proxy pump’s SessionFrames onto the v1 Frame envelope and back.

The pump (crate::broker::session_pump) speaks in-memory SessionFrame channels; this module is the byte-boundary twin that lets those frames cross a real transport. Each SessionFrame rides exactly one Frame on the SESSION_PAYLOAD_PROTOCOL lane, encoded with the same [u8 framing_version=1][u32 LE len][prost Frame] wire shape every other lane uses (via encode_framed / try_decode_framed).

Direction. The frame kind is derived from the SessionFrame variant: client→daemon frames (Stdin, StdinEof) are REQUEST, daemon→client frames (Stdout, Stderr, Exit) are RESPONSE. This is a provisional hint, not request/response correlation — a compile session is one long-lived bidirectional exchange, so request_id carries a session-local sequence number for observability, not a request/response pairing. A later slice (3b) that multiplexes many sessions over one endpoint will introduce a real session id; until then one transport carries one session and direction is implied by which half of the duplex a frame arrives on.

This module deliberately does not touch the broker socket, FrameClient, or any OS handle: it is a pure SessionFrame <-> bytes codec so the fidelity it guarantees (byte-transparency across partial-frame boundaries) can be proven in isolation and reused by whatever transport slice 3b lands.

Structs§

DecodedSessionFrame
One SessionFrame decoded from the front of a byte buffer, plus how many wire bytes it occupied.

Enums§

SessionCodecError
Errors from try_decode_session_frame.

Functions§

encode_session_frame
Encode one SessionFrame to complete wire bytes ([1][u32 len][prost Frame]), ready to write to a transport.
session_frame_to_frame
Wrap one SessionFrame in a SESSION-lane Frame.
try_decode_session_frame
Incrementally decode one SESSION-lane SessionFrame from the front of buf.