Skip to main content

plexus_core/
lib.rs

1//! Hub Core - Core infrastructure for building Plexus RPC servers
2//!
3//! This crate provides:
4//! - `DynamicHub` - Dynamic routing hub for activations (implements Plexus RPC protocol)
5//! - `Activation` - Trait for implementing activations
6//! - `PlexusMcpBridge` - MCP server integration
7//! - `Handle` - Typed references to activation method results
8//!
9//! # Example
10//!
11//! ```rust,no_run
12//! use plexus_core::plexus::DynamicHub;
13//! use plexus_core::activations::echo::Echo;
14//! use plexus_core::activations::health::Health;
15//! use std::sync::Arc;
16//!
17//! let hub = Arc::new(
18//!     DynamicHub::new("myapp")
19//!         .register(Health::new())
20//!         .register(Echo::new())
21//! );
22//! ```
23
24/// Crate version, populated at compile time from `CARGO_PKG_VERSION`.
25///
26/// Exposed so the `plexus-rpc` umbrella can stamp it into the
27/// `Capabilities` manifest backends embed in `_info`. See UMB-2.
28pub const VERSION: &str = env!("CARGO_PKG_VERSION");
29
30pub mod activations;
31pub mod builder;
32pub mod mcp_bridge;
33pub mod plexus;
34pub mod plugin_system;
35pub mod request;
36pub mod serde_helpers;
37pub mod types;
38
39// Re-export commonly used items
40pub use builder::build_example_hub;
41pub use mcp_bridge::PlexusMcpBridge;
42#[allow(deprecated)]
43pub use plexus::{
44    Activation, ChildCapabilities, ChildRouter, DeprecationInfo, DynamicHub, MethodRole,
45    PlexusError, ReturnShape, PLEXUS_NOTIF_METHOD,
46};
47pub use types::{Envelope, Handle, HandleParseError, HandleResolutionParams, Origin};
48
49// Re-export schemars under a stable private path so PlexusRequest derive-generated code
50// can reference the real schemars::JsonSchema trait without requiring the caller to have
51// schemars in their own dependencies.
52#[doc(hidden)]
53pub use schemars as __schemars;
54
55// Proc-macro re-exports.
56// Use as `plexus_core::activation` / `plexus_core::method`, or via a
57// `plexus = { package = "plexus-core" }` Cargo alias as `plexus::activation` / `plexus::method`.
58pub use plexus_macros::activation;
59pub use plexus_macros::method;
60#[allow(deprecated)]
61#[deprecated(since = "0.5.0", note = "Use `plexus_core::activation` instead")]
62pub use plexus_macros::hub_methods;
63#[allow(deprecated)]
64#[deprecated(since = "0.5.0", note = "Use `plexus_core::method` instead")]
65pub use plexus_macros::hub_method;