pub trait Plugin: Send + Sync {
// Required methods
fn meta(&self) -> PluginMeta;
fn role(&self) -> PluginRole;
fn start(&mut self) -> PluginResult<'_>;
fn stop(&mut self) -> PluginResult<'_>;
fn health(&self) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + '_>>;
fn as_any(&self) -> &dyn Any;
// Provided methods
fn scheduled_tasks(&self) -> Vec<ScheduledTask> { ... }
fn setup_prompts(&self) -> Vec<SetupPrompt> { ... }
fn tools(&self) -> Vec<Box<dyn Tool>> { ... }
}Expand description
The core plugin contract.
Plugins are constructed via async factory functions — by the time this
trait is available, the plugin is fully initialized and ready for
start().
§Dyn-compatible
Uses Pin<Box<dyn Future>> for async methods. No async_trait dependency.
§Extension via as_any()
Host-specific capabilities (e.g., HTTP routes via axum) are not part of
this trait. Plugins that expose such capabilities implement as_any()
to allow the host to downcast to the concrete type.
Required Methods§
Sourcefn meta(&self) -> PluginMeta
fn meta(&self) -> PluginMeta
Plugin identity (name, version, description).
Sourcefn role(&self) -> PluginRole
fn role(&self) -> PluginRole
What role this plugin fills in the system.
Sourcefn start(&mut self) -> PluginResult<'_>
fn start(&mut self) -> PluginResult<'_>
Start the plugin. Called once after construction.
Sourcefn stop(&mut self) -> PluginResult<'_>
fn stop(&mut self) -> PluginResult<'_>
Stop the plugin gracefully.
Provided Methods§
Sourcefn scheduled_tasks(&self) -> Vec<ScheduledTask>
fn scheduled_tasks(&self) -> Vec<ScheduledTask>
Optional: contribute scheduled tasks.
Sourcefn setup_prompts(&self) -> Vec<SetupPrompt>
fn setup_prompts(&self) -> Vec<SetupPrompt>
Optional: setup wizard prompts for first-time configuration.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".