Skip to main content

steamroom_cli/daemon/proto/
frame.rs

1use super::Event;
2use super::Request;
3use super::Response;
4use rkyv::Archive;
5use rkyv::Deserialize;
6use rkyv::Serialize;
7
8/// The single rkyv-archived top-level type that flows over the socket.
9/// Length-prefixed framing wraps these (see `daemon::framing`).
10#[derive(Archive, Serialize, Deserialize, Debug, Clone)]
11#[rkyv(derive(Debug))]
12pub enum Frame {
13    Request(Request),
14    Response(Response),
15    Event(Event),
16    /// Closes a streaming reply. `exit_code` is the process-style exit
17    /// code the attached CLI should propagate to its own caller.
18    EndOfStream {
19        exit_code: i32,
20    },
21}
22
23/// Wire-format version. Bump on any breaking change to a `*Params`,
24/// `Request`, `Response`, or `Event` variant layout. Receivers check this
25/// before deserializing and close the connection on mismatch.
26pub const PROTO_VERSION: u16 = 1;