protocol_droid/lib.rs
1// `dead_code_pub_in_binary` was promoted to library crates in rust 1.98. The
2// library exposes types that downstream users (e.g. an editor that spawns an
3// ACP agent and needs an MCP client to talk to its tool servers) consume; the
4// workspace's own bin does not use every public type, and the library's own
5// test build does not see the integration test crate as a dependent. The
6// allow is necessary for the library's test build to pass; it is a no-op for
7// the library's normal build (where the lint is "unused" — see
8// `unused_attributes` below) and does not propagate to dependents.
9#![allow(dead_code_pub_in_binary, unused_attributes)]
10
11//! The `protocol-droid` library: one canonical IR, many per-revision codecs.
12//!
13//! Application code in this crate speaks a version-agnostic superset IR. Each
14//! per-revision codec lifts wire messages into that IR on the way in and
15//! lowers them back to the wire on the way out, for whichever revision was
16//! negotiated with the peer. Every feature-specific path consults the session's
17//! negotiated `FeatureProfile` before it runs.
18//!
19//! The layer split is the project's hexagonal layout:
20//!
21//! - [`domain`] — value objects, aggregates and pure functions. No I/O, no
22//! runtime, no framework derives.
23//! - [`application`] — one module per use case. Each declares its own narrow
24//! port trait inline, beside the handler that consumes it.
25//! - [`adapters::primary`] — driving adapters: the server transports.
26//! - [`adapters::secondary`] — driven adapters: the client transports, upstream
27//! peers, clocks, RNG and the filesystem.
28//!
29//! There is deliberately no `ports` module. Port traits belong to the consumer,
30//! so they live in the `application` module that needs them, and are never
31//! collected into a shared module.
32//!
33//! # What the attribute macros need
34//!
35//! [`schemars`], [`serde`] and [`serde_json`] are re-exported so code generated by
36//! `#[server]` names them through this crate. Generated code that
37//! spelled `::schemars` and `::serde` would force every user of a macro to
38//! depend on both crates themselves, at versions the macro happened to be built
39//! against, with no way to disagree — and a mismatch would be a compile error
40//! in generated code, which is the worst place to discover a version problem.
41
42pub mod adapters;
43pub mod application;
44pub mod domain;
45
46pub use protocol_droid_macros::{prompt, resource, server, tool};
47pub use schemars;
48pub use serde;
49pub use serde_json;