Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn version(&self) -> &str;
    fn methods(&self) -> Vec<MethodSpec>;
    fn call<'life0, 'life1, 'async_trait>(
        &'life0 self,
        method: &'life1 str,
        params: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn on_register<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 mut PluginContext,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Plugin trait — implement this to extend aclaw with JSON-RPC methods

Required Methods§

Source

fn name(&self) -> &str

Plugin name (e.g., “ai”, “remote”, “tools”, “vibemania”, “git”)

Source

fn version(&self) -> &str

Plugin version

Source

fn methods(&self) -> Vec<MethodSpec>

List available methods this plugin provides

Source

fn call<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, params: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute a method (JSON-RPC style)

Provided Methods§

Source

fn on_register<'life0, 'life1, 'async_trait>( &'life0 self, _ctx: &'life1 mut PluginContext, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called after registration — gives the plugin a chance to register tools and hooks. Default implementation does nothing.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§