//! Command handlers. Each `sa.*`, `twitter.*`, `grok.*` cmd routes to a
//! per-session handler that implements [`SiteHandler`].
//!
//! Adding a new site with command support:
//! 1. Add a `CommandModule`
//! 2. Register an entry via `SiteEntry::from_module` or
//!    `SiteEntry::from_http_module`; see `registry.rs`

pub(crate) mod executor;
pub(crate) mod response;

use async_trait::async_trait;
use night_fury_daemon_core::protocol::Response;
use serde_json::Value;

/// Per-session command executor. One instance lives for the lifetime of a
/// daemon session; implementations may hold state (e.g. a warmed-up client).
#[async_trait]
pub trait SiteHandler: Send + Sync {
    async fn handle(&self, id: &str, cmd: &str, params: &Value) -> Response;
}
