- 22 AI providers (OpenRouter, Anthropic, OpenAI, Mistral, etc.) - 7 channels (CLI, Telegram, Discord, Slack, iMessage, Matrix, Webhook) - 5-step onboarding wizard with Project Context personalization - OpenClaw-aligned system prompt (SOUL.md, IDENTITY.md, USER.md, AGENTS.md, etc.) - SQLite memory backend with auto-save - Skills system with on-demand loading - Security: autonomy levels, command allowlists, cost limits - 532 tests passing, 0 clippy warnings
29 lines
814 B
Rust
29 lines
814 B
Rust
use async_trait::async_trait;
|
|
|
|
/// A message received from or sent to a channel
|
|
#[derive(Debug, Clone)]
|
|
pub struct ChannelMessage {
|
|
pub id: String,
|
|
pub sender: String,
|
|
pub content: String,
|
|
pub channel: String,
|
|
pub timestamp: u64,
|
|
}
|
|
|
|
/// Core channel trait — implement for any messaging platform
|
|
#[async_trait]
|
|
pub trait Channel: Send + Sync {
|
|
/// Human-readable channel name
|
|
fn name(&self) -> &str;
|
|
|
|
/// Send a message through this channel
|
|
async fn send(&self, message: &str, recipient: &str) -> anyhow::Result<()>;
|
|
|
|
/// Start listening for incoming messages (long-running)
|
|
async fn listen(&self, tx: tokio::sync::mpsc::Sender<ChannelMessage>) -> anyhow::Result<()>;
|
|
|
|
/// Check if channel is healthy
|
|
async fn health_check(&self) -> bool {
|
|
true
|
|
}
|
|
}
|