rsclaw 0.0.1-alpha.1

rsclaw: High-performance AI agent (BETA). Optimized for M4 Max and 2GB VPS. 100% compatible with openclaw
Documentation
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::sync::Arc;

/// OpenClaw plugin manifest (openclaw.plugin.json).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PluginManifest {
    pub name: Arc<str>,
    pub version: Arc<str>,
    pub description: Arc<str>,
    pub main: Arc<str>,
    #[serde(default)]
    pub runtime: Arc<str>,
    #[serde(default)]
    pub slots: Vec<SlotDefinition>,
    #[serde(default)]
    pub dependencies: Vec<Dependency>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub config: Option<Value>,
}

impl PluginManifest {
    /// Create a new plugin manifest.
    pub fn new(name: Arc<str>, version: Arc<str>, description: Arc<str>, main: Arc<str>) -> Self {
        Self {
            name,
            version,
            description,
            main,
            runtime: Arc::from("node"),
            slots: Vec::new(),
            dependencies: Vec::new(),
            config: None,
        }
    }
}

impl Default for PluginManifest {
    fn default() -> Self {
        Self {
            name: Arc::from("unnamed"),
            version: Arc::from("0.1.0"),
            description: Arc::from(""),
            main: Arc::from("index.js"),
            runtime: Arc::from("node"),
            slots: Vec::new(),
            dependencies: Vec::new(),
            config: None,
        }
    }
}

/// Slot definition for plugin hooks.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SlotDefinition {
    pub name: Arc<str>,
    #[serde(rename = "type")]
    pub slot_type: Arc<str>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<Arc<str>>,
}

/// Plugin dependency.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Dependency {
    pub name: Arc<str>,
    pub version: Arc<str>,
}