Skip to main content

rain_engine_channels/
lib.rs

1//! Multi-channel adapters for RainEngine.
2//!
3//! Each adapter connects to a messaging platform, normalizes inbound
4//! messages into `HumanInputIngressRequest` triggers, and sends agent
5//! responses back to the platform.
6
7pub mod discord;
8pub mod slack;
9pub mod telegram;
10
11use async_trait::async_trait;
12
13/// Configuration for a channel adapter.
14#[derive(Debug, Clone)]
15pub struct ChannelConfig {
16    /// Base URL of the RainEngine runtime HTTP surface.
17    pub runtime_url: String,
18    /// Session ID to use (or derive from platform user ID).
19    pub default_session_prefix: String,
20}
21
22/// Trait implemented by each channel adapter.
23#[async_trait]
24pub trait ChannelAdapter: Send + Sync {
25    /// Human-readable name for logging.
26    fn name(&self) -> &str;
27
28    /// Start the adapter. Runs until cancelled.
29    async fn run(&self, cancel: tokio_util::sync::CancellationToken);
30}