Plugin Manager • Rust AI Agent SDK
PluginManager: Manages plugin registration and execution.
PluginManager
Defined in the plugins module.
Rust AI Agent SDK
Manages plugin registration and execution.
Fields
| Name | Type | Description |
|---|---|---|
plugins | HashMap<String | Registered plugins |
enabled | HashMap<String | Enabled plugins |
hook_map | HashMap<PluginHook | Hook to plugin mapping |
Methods
new
fn new() -> SelfCreate a new plugin manager
register
fn register(&mut self, plugin: impl Plugin + 'static) -> ()Register a plugin
Parameters:
| Name | Type |
|---|---|
plugin | impl Plugin + 'static |
enable
fn enable(&mut self, name: &str) -> boolEnable a plugin
Parameters:
| Name | Type |
|---|---|
name | &str |
disable
fn disable(&mut self, name: &str) -> boolDisable a plugin
Parameters:
| Name | Type |
|---|---|
name | &str |
is_enabled
fn is_enabled(&self, name: &str) -> boolCheck if a plugin is enabled
Parameters:
| Name | Type |
|---|---|
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:
| Name | Type |
|---|---|
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:
| Name | Type |
|---|---|
hook | PluginHook |
data | serde_json::Value |
get_hook_plugins
fn get_hook_plugins(&self, hook: PluginHook) -> Vec<String>Get plugins that handle a specific hook
Parameters:
| Name | Type |
|---|---|
hook | PluginHook |
len
fn len(&self) -> usizeCount registered plugins
is_empty
fn is_empty(&self) -> boolCheck if empty
enabled_count
fn enabled_count(&self) -> usizeCount enabled plugins
Source
View on GitHubpraisonai/src/plugins/mod.rs at line 258