pub struct PluginManager { /* private fields */ }Expand description
Manages plugin lifecycle: install, remove, list.
All operations are synchronous. Plugin watchers and agent config overlays are applied separately by the agent bootstrap layer.
Implementations§
Source§impl PluginManager
impl PluginManager
Sourcepub fn default_plugins_dir() -> PathBuf
pub fn default_plugins_dir() -> PathBuf
Returns the canonical default plugins directory: ~/.local/share/zeph/plugins/.
Both the CLI and TUI must use this helper so they always point to the same directory.
Sourcepub fn new(
plugins_dir: PathBuf,
managed_skills_dir: PathBuf,
mcp_allowed_commands: Vec<String>,
base_allowed_commands: Vec<String>,
) -> Self
pub fn new( plugins_dir: PathBuf, managed_skills_dir: PathBuf, mcp_allowed_commands: Vec<String>, base_allowed_commands: Vec<String>, ) -> Self
Create a new manager.
§Parameters
plugins_dir— root installation directory for plugins.managed_skills_dir— directory for user-managed skills (conflict detection).mcp_allowed_commands— allowlist for MCP server commands from agent config.base_allowed_commands— host’stools.shell.allowed_commands. Used to emit a non-fatal warning when a plugin overlay would be silently dropped at load time (tighten-only invariant).
Sourcepub fn add(&self, source: &str) -> Result<AddResult, PluginError>
pub fn add(&self, source: &str) -> Result<AddResult, PluginError>
Install a plugin from a local directory path.
§Errors
Returns PluginError if the manifest is invalid, the source cannot be read,
there are skill name conflicts, MCP commands are not allowlisted, or config
overlay keys are not in the tighten-only safelist.
Sourcepub fn remove(&self, name: &str) -> Result<RemoveResult, PluginError>
pub fn remove(&self, name: &str) -> Result<RemoveResult, PluginError>
Remove an installed plugin by name.
§Errors
Returns PluginError::NotFound if the plugin is not installed.
Sourcepub fn list_installed(&self) -> Result<Vec<InstalledPlugin>, PluginError>
pub fn list_installed(&self) -> Result<Vec<InstalledPlugin>, PluginError>
Sourcepub fn collect_skill_dirs(&self) -> Result<Vec<PathBuf>, PluginError>
pub fn collect_skill_dirs(&self) -> Result<Vec<PathBuf>, PluginError>
Returns all skill directory paths from installed plugins.
§Errors
Returns PluginError if the plugins directory cannot be read.