Skip to main content

zap/
lib.rs

1//! ZAP - Zero-Copy App Proto
2//!
3//! High-performance Cap'n Proto RPC for AI agent communication.
4//!
5//! # Example
6//!
7//! ```rust,ignore
8//! use zap::{Client, Server};
9//! use serde_json::json;
10//!
11//! #[tokio::main]
12//! async fn main() -> zap::Result<()> {
13//!     // Connect to ZAP gateway
14//!     let client = Client::connect("zap://localhost:9999").await?;
15//!
16//!     // List available tools
17//!     let tools = client.list_tools().await?;
18//!
19//!     // Call a tool
20//!     let result = client.call_tool("search", json!({"query": "hello"})).await?;
21//!
22//!     Ok(())
23//! }
24//! ```
25
26// Generated Cap'n Proto bindings - must be at crate root for correct module path
27#[allow(dead_code, clippy::all)]
28pub mod zap_capnp {
29    include!(concat!(env!("OUT_DIR"), "/zap_capnp.rs"));
30}
31
32pub mod client;
33pub mod server;
34pub mod gateway;
35pub mod transport;
36pub mod error;
37pub mod config;
38pub mod crypto;
39pub mod consensus;
40pub mod identity;
41pub mod agent_consensus;
42pub mod schema;
43
44pub use client::Client;
45pub use server::Server;
46pub use gateway::Gateway;
47pub use error::{Error, Result};
48pub use config::Config;
49pub use consensus::{RingtailConsensus, AgentConsensus, RingtailSignature, Round1Output, Round2Output};
50pub use identity::{Did, DidMethod, DidDocument, VerificationMethod, Service, NodeIdentity, StakeRegistry};
51pub use agent_consensus::{AgentConsensusVoting, Query, Response, ConsensusResult, QueryId, ResponseId};
52pub use schema::{ZapSchema, SchemaFormat, transpile, transpile_str, compile_to_rust, capnp_to_zap, migrate_capnp_to_zap};
53
54/// ZAP protocol version
55pub const VERSION: &str = env!("CARGO_PKG_VERSION");
56
57/// Default port for ZAP connections
58pub const DEFAULT_PORT: u16 = 9999;