Skip to main content

lash_remote_protocol/
lib.rs

1//! Wire DTOs for driving a lash runtime across a process boundary.
2//!
3//! Each domain module carries one slice of the protocol vocabulary
4//! ([`llm`], [`turn_input`], [`turn_result`], [`processes`], [`triggers`],
5//! [`prompt`], [`tools`], [`observations`], [`usage_activity`],
6//! [`registry_errors`]); the crate root re-exports all of them, which is the
7//! established public API for direct consumers of this crate. The
8//! cross-cutting protocol handshake ([`REMOTE_PROTOCOL_VERSION`],
9//! [`ensure_protocol_version`]) lives at the root itself.
10
11pub mod llm;
12pub mod observations;
13pub mod processes;
14pub mod prompt;
15pub mod registry_errors;
16pub mod tools;
17pub mod triggers;
18pub mod turn_input;
19pub mod turn_result;
20pub mod usage_activity;
21
22pub use llm::*;
23pub use observations::*;
24pub use processes::*;
25pub use prompt::*;
26pub use registry_errors::*;
27pub use tools::*;
28pub use triggers::*;
29pub use turn_input::*;
30pub use turn_result::*;
31pub use usage_activity::*;
32
33// Bumped to 7: the process wire mirror gained the additive-but-breaking
34// `Abandoned` terminal variant (on `RemoteProcessTerminalState`,
35// `RemoteProcessAwaitOutput`, `RemoteProcessStatus`, `RemoteProcessLifecycleStatus`,
36// `RemoteProcessStatusFilter`) plus the required `disposition` field and the
37// `first_started`/`abandon_request`/lease-holder read-side fields (ADR 0019). A
38// new tagged-enum variant cannot be deserialized by a version-6 peer, so per
39// docs/reporting.html's "bump for a breaking wire change" policy the version
40// dial moves; `validate()` rejects a version-6 envelope outright.
41pub const REMOTE_PROTOCOL_VERSION: u32 = 7;
42
43pub fn ensure_protocol_version(actual: u32) -> Result<(), RemoteProtocolError> {
44    if actual == REMOTE_PROTOCOL_VERSION {
45        Ok(())
46    } else {
47        Err(RemoteProtocolError::UnsupportedProtocolVersion {
48            actual,
49            expected: REMOTE_PROTOCOL_VERSION,
50        })
51    }
52}
53
54#[cfg(feature = "core-conversions")]
55mod core_conversions;
56
57#[cfg(feature = "core-conversions")]
58pub use core_conversions::{RemoteTurnActivitySink, replay_collected_activities};
59
60#[cfg(test)]
61mod tests;