//! WASM plugin system for ZeroClaw. //! //! Plugins are WebAssembly modules loaded via Extism that can extend //! ZeroClaw with custom tools and channels. Enable with `--features plugins-wasm`. pub mod error; pub mod host; pub mod wasm_channel; pub mod wasm_tool; use serde::{Deserialize, Serialize}; use std::path::PathBuf; /// A plugin's declared manifest (loaded from manifest.toml alongside the .wasm). #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PluginManifest { /// Plugin name (unique identifier) pub name: String, /// Plugin version pub version: String, /// Human-readable description pub description: Option, /// Author name or organization pub author: Option, /// Path to the .wasm file (relative to manifest) pub wasm_path: String, /// Capabilities this plugin provides pub capabilities: Vec, /// Permissions this plugin requests #[serde(default)] pub permissions: Vec, } /// What a plugin can do. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "snake_case")] pub enum PluginCapability { /// Provides one or more tools Tool, /// Provides a channel implementation Channel, /// Provides a memory backend Memory, /// Provides an observer/metrics backend Observer, } /// Permissions a plugin may request. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "snake_case")] pub enum PluginPermission { /// Can make HTTP requests HttpClient, /// Can read from the filesystem (within sandbox) FileRead, /// Can write to the filesystem (within sandbox) FileWrite, /// Can access environment variables EnvRead, /// Can read agent memory MemoryRead, /// Can write agent memory MemoryWrite, } /// Information about a loaded plugin. #[derive(Debug, Clone, Serialize)] pub struct PluginInfo { pub name: String, pub version: String, pub description: Option, pub capabilities: Vec, pub permissions: Vec, pub wasm_path: PathBuf, pub loaded: bool, }