Skip to main content

strop_ui_protocol/
lib.rs

1//! The strop UI protocol (0056 AR09/AR10): one bounded, versioned,
2//! non-graphical contract between the `strop --ui-stdio` backend and any
3//! frontend process (the future Windows GUI, test drivers, automation).
4//!
5//! Shape:
6//! - Bytes: bounded Content-Length framing ([`frame`]), the convention
7//!   strop-lsp already pins at its trace boundary. stdout carries frames
8//!   only; diagnostics stay on stderr.
9//! - Envelopes: [`message`] — handshake, admitted actions, acknowledgements
10//!   with explicit outcomes, semantic snapshots/deltas keyed by backend
11//!   incarnation + view generation, host effects, resync and shutdown.
12//! - Actions: [`message::AdmittedAction`] mirrors the engine's admitted
13//!   input surface one-to-one — there is no parallel command table.
14//! - Client: [`client::Client`] is the pure readonly cache (snapshot/delta
15//!   application, resync poisoning); [`driver::Driver`] is the stdio
16//!   process transport with deterministic state/revision barriers.
17//!
18//! The client is never an editing model: it holds the last published
19//! view, refuses to act on stale or poisoned state, and recovers through
20//! an explicit resync — never by blindly applying a delta.
21
22pub mod client;
23pub mod driver;
24pub mod frame;
25pub mod message;
26
27pub use client::{Client, ClientError, ClientEvent, ResyncReason};
28pub use driver::{Driver, DriverError};
29pub use frame::{FrameDecoder, FrameError, MAX_BODY_BYTES, MAX_HEADER_BYTES};
30pub use message::{
31    AckOutcome, ActionLimits, AdmittedAction, BackendInfo, BaseStamp, ClientCapabilities,
32    ClientInfo, ClientMessage, EffectOutcome, EffectRequest, Geometry, PaneDelta, PaneSnapshot,
33    ProtocolError, Rect, Refusal, ServerCapabilities, ServerMessage, ShutdownReason, ViewBounds,
34    ViewDelta, ViewSnapshot, PROTOCOL_VERSION,
35};
36
37/// Bound on client requests queued between the transport reader and the
38/// server loop (AR06 convention: the LSP queue admits 256 jobs).
39pub const MAX_PENDING_REQUESTS: usize = 256;
40
41/// Geometry cap, the same one the engine's frame action enforces.
42pub const MAX_VIEWPORT_CELLS: u32 = 1_000_000;