Skip to main content

agnt5_proto/
lib.rs

1//! Generated Rust bindings for the public AGNT5 SDK/runtime protocol.
2//!
3//! The default feature set exposes only [`protocol::v2`]. Community-runtime
4//! and transition-only APIs require explicit features so SDKs cannot acquire
5//! those implementation contracts accidentally.
6
7#[cfg(feature = "legacy-api")]
8pub mod api {
9    pub mod v1 {
10        tonic::include_proto!("api.v1");
11    }
12}
13
14pub mod protocol {
15    pub mod v2 {
16        tonic::include_proto!("agnt5.protocol.v2");
17    }
18}
19
20#[cfg(feature = "runtime-api")]
21pub mod runtime {
22    pub mod v1 {
23        tonic::include_proto!("agnt5.runtime.v1");
24    }
25}
26
27#[cfg(test)]
28mod tests {
29    use super::protocol::v2::{
30        payload_service_client::PayloadServiceClient, worker_service_client::WorkerServiceClient,
31        ComponentDescriptor, MethodDescriptor,
32    };
33
34    #[test]
35    fn default_artifact_exports_public_descriptors_and_clients() {
36        let descriptor = ComponentDescriptor {
37            name: "cart".into(),
38            version: "v1".into(),
39            methods: vec![MethodDescriptor {
40                name: "add_item".into(),
41                ..Default::default()
42            }],
43            ..Default::default()
44        };
45        assert_eq!(descriptor.methods[0].name, "add_item");
46
47        let _: Option<WorkerServiceClient<tonic::transport::Channel>> = None;
48        let _: Option<PayloadServiceClient<tonic::transport::Channel>> = None;
49    }
50}