herolib_rpc/lib.rs
1//! RPC framework for Redis-based distributed systems.
2//!
3//! This crate provides:
4//! - `config` - Redis configuration management using OTOML format
5//! - `logger` - Redis-based distributed logging
6//! - `errors` - Redis-based error storage and tracking
7//! - `rpc` - Redis queue-based RPC mechanism
8//! - `mcp` - MCP (Model Context Protocol) client (optional, enabled by default)
9//!
10//! # Example
11//!
12//! ```rust,ignore
13//! use rpc::config::ConfigClient;
14//!
15//! #[tokio::main]
16//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
17//! let client = ConfigClient::new("redis://localhost:6379").await?;
18//!
19//! // Get an LLM configuration
20//! let llm_config = client.get_llm("openai", "default").await?;
21//! println!("Model: {}", llm_config.default_model.unwrap_or_default());
22//!
23//! Ok(())
24//! }
25//! ```
26
27pub mod config;
28pub mod errors;
29pub mod logger;
30pub mod rpc;
31
32#[cfg(feature = "mcp")]
33pub mod mcp;
34
35// Re-export main types for convenience
36pub use config::ConfigClient;
37pub use errors::ErrorStore;
38pub use logger::{LogEntry, LogLevel, RedisLogger};
39pub use rpc::RpcQueue;
40
41#[cfg(feature = "mcp")]
42pub use mcp::McpClient;
43
44/// Prelude module for convenient imports.
45pub mod prelude {
46 pub use crate::config::{ConfigClient, ConfigError};
47 pub use crate::errors::{ErrorEntry, ErrorStore};
48 pub use crate::logger::{LogEntry, LogLevel, RedisLogger};
49 pub use crate::rpc::{RpcQueue, RpcRequest, RpcResponse};
50
51 #[cfg(feature = "mcp")]
52 pub use crate::mcp::{McpClient, McpClientBuilder, RpcClient, RpcServer, ToolInfo};
53}