Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn name(&self) -> &str;
    fn version(&self) -> &str;

    // Provided methods
    fn init<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn shutdown<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn commands(&self) -> Vec<PluginCommand> { ... }
    fn routes(&self) -> Option<Router> { ... }
    fn tools(&self) -> Vec<Box<dyn Tool>> { ... }
}
Expand description

The core Plugin trait. Implement this to extend Smooth.

Plugins can register CLI subcommands, API routes, and smooth-operator tools. Each plugin has a unique identifier, a human-readable name, and a version string. Lifecycle hooks (init / shutdown) are called once at startup and shutdown.

Required Methods§

Source

fn id(&self) -> &str

Unique plugin identifier (e.g., “smooai”, “jira”, “linear”)

Source

fn name(&self) -> &str

Human-readable name

Source

fn version(&self) -> &str

Version string

Provided Methods§

Source

fn init<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called once at startup.

§Errors

Returns an error if initialization fails.

Source

fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called on shutdown.

§Errors

Returns an error if shutdown cleanup fails.

Source

fn commands(&self) -> Vec<PluginCommand>

Register CLI subcommands (returns command definitions).

Source

fn routes(&self) -> Option<Router>

Register API routes (returns axum Router to be nested).

Source

fn tools(&self) -> Vec<Box<dyn Tool>>

Register smooth-operator tools.

Implementors§