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 super::registry::HookRegistry;
use super::types::{Hook, HookAction, HookEvent};
use anyhow::Result;
use std::sync::Arc;

/// System built-in hooks.
pub struct SystemHooks;

impl SystemHooks {
    /// Register all system hooks.
    pub async fn register(registry: &HookRegistry) -> Result<()> {
        // System start hook
        registry.register(Hook::new(
            HookEvent::SystemStart,
            Arc::from("system_start_log"),
            0,
            HookAction::Log(Arc::from("System starting...")),
        )).await?;

        // System stop hook
        registry.register(Hook::new(
            HookEvent::SystemStop,
            Arc::from("system_stop_log"),
            0,
            HookAction::Log(Arc::from("System stopping...")),
        )).await?;

        // Config loaded hook
        registry.register(Hook::new(
            HookEvent::ConfigLoaded,
            Arc::from("config_loaded_log"),
            0,
            HookAction::Log(Arc::from("Configuration loaded")),
        )).await?;

        // Gateway start hook
        registry.register(Hook::new(
            HookEvent::GatewayStart,
            Arc::from("gateway_start_log"),
            0,
            HookAction::Log(Arc::from("Gateway started")),
        )).await?;

        // Agent create hook
        registry.register(Hook::new(
            HookEvent::AgentCreate,
            Arc::from("agent_create_log"),
            10,
            HookAction::Log(Arc::from("Agent created")),
        )).await?;

        // Agent destroy hook
        registry.register(Hook::new(
            HookEvent::AgentDestroy,
            Arc::from("agent_destroy_log"),
            10,
            HookAction::Log(Arc::from("Agent destroyed")),
        )).await?;

        // Message received hook
        registry.register(Hook::new(
            HookEvent::MessageReceived,
            Arc::from("message_received_log"),
            20,
            HookAction::Log(Arc::from("Message received")),
        )).await?;

        tracing::info!("System hooks registered");
        Ok(())
    }
}