Skip to main content

PluginManager

Defined in the plugins module.
Rust AI Agent SDK Manages plugin registration and execution.

Fields

NameTypeDescription
pluginsHashMap<StringRegistered plugins
enabledHashMap<StringEnabled plugins
hook_mapHashMap<PluginHookHook to plugin mapping

Methods

new

fn new() -> Self
Create a new plugin manager

register

fn register(&mut self, plugin: impl Plugin + 'static) -> ()
Register a plugin Parameters:
NameType
pluginimpl Plugin + 'static

enable

fn enable(&mut self, name: &str) -> bool
Enable a plugin Parameters:
NameType
name&str

disable

fn disable(&mut self, name: &str) -> bool
Disable a plugin Parameters:
NameType
name&str

is_enabled

fn is_enabled(&self, name: &str) -> bool
Check if a plugin is enabled Parameters:
NameType
name&str

list_plugins

fn list_plugins(&self) -> Vec<PluginInfo>
List all plugins

get

fn get(&self, name: &str) -> Option<Arc<RwLock<Box<dyn Plugin>>>>
Get plugin by name Parameters:
NameType
name&str

execute_hook

fn execute_hook(
        &self,
        hook: PluginHook,
        data: serde_json::Value,
    ) -> Result<serde_json::Value>
Execute hooks for a specific hook type Parameters:
NameType
hookPluginHook
dataserde_json::Value

get_hook_plugins

fn get_hook_plugins(&self, hook: PluginHook) -> Vec<String>
Get plugins that handle a specific hook Parameters:
NameType
hookPluginHook

len

fn len(&self) -> usize
Count registered plugins

is_empty

fn is_empty(&self) -> bool
Check if empty

enabled_count

fn enabled_count(&self) -> usize
Count enabled plugins

Source

View on GitHub

praisonai/src/plugins/mod.rs at line 258