sqry_daemon_protocol/lib.rs
1//! `sqry-daemon-protocol` — sqryd daemon wire types + framing codec.
2//!
3//! This is a **leaf crate** with no dependencies on any other `sqry-*`
4//! crate. Both the sqryd daemon itself (`sqry-daemon`) and the
5//! client-side crates that need to speak the wire format
6//! (`sqry-daemon-client`, `sqry-lsp`, `sqry-mcp`) depend on this crate
7//! without creating a dependency cycle.
8//!
9//! # Module layout
10//!
11//! - [`framing`] — 4-byte little-endian length-prefix codec
12//! ([`framing::read_frame`] / [`framing::write_frame`] plus typed
13//! JSON wrappers and [`framing::FrameError`]).
14//! - [`protocol`] — wire types: [`DaemonHello`], [`DaemonHelloResponse`],
15//! [`ShimProtocol`], [`ShimRegister`], [`ShimRegisterAck`],
16//! [`ResponseEnvelope`], [`ResponseMeta`], [`WorkspaceState`],
17//! [`JsonRpcVersion`], [`JsonRpcId`], [`JsonRpcRequest`],
18//! [`JsonRpcResponse`], [`JsonRpcPayload`], [`JsonRpcError`].
19//!
20//! # First-frame discrimination
21//!
22//! The router in `sqry-daemon` shape-discriminates the very first
23//! frame between [`DaemonHello`] (CLI / JSON-RPC clients) and
24//! [`ShimRegister`] (Phase 8c shim byte-pump clients). All four
25//! first-frame structs — [`DaemonHello`], [`DaemonHelloResponse`],
26//! [`ShimRegister`], [`ShimRegisterAck`] — carry
27//! `#[serde(deny_unknown_fields)]` so that a first frame matching
28//! neither shape is rejected with `-32600 Invalid Request` rather than
29//! being silently routed to the wrong path.
30
31pub mod framing;
32pub mod protocol;
33
34pub use protocol::{
35 CancelRebuildResult, DaemonHello, DaemonHelloResponse, ENVELOPE_VERSION, JsonRpcError,
36 JsonRpcId, JsonRpcPayload, JsonRpcRequest, JsonRpcResponse, JsonRpcVersion, LoadResult,
37 RebuildResult, ResponseEnvelope, ResponseMeta, ShimProtocol, ShimRegister, ShimRegisterAck,
38 WorkspaceState,
39};