//! RPC method implementations — one module per wire namespace //! (`agent.*` → `rpc::agent`), one file per method inside it. pub mod agent; pub mod group; use serde_json::Value; /// Wire-facing error: code + message + structured details, mapped onto /// `Response.code`/`details`/`error` by the dispatcher. #[derive(Debug)] pub struct RpcError { pub code: &'static str, pub message: String, pub details: Option, } impl RpcError { pub fn new(code: &'static str, message: impl Into, details: Option) -> Self { Self { code, message: message.into(), details, } } pub fn invalid(message: impl Into) -> Self { Self::new("invalid_params", message, None) } pub fn internal(e: impl std::fmt::Display) -> Self { Self::new("internal", e.to_string(), None) } }