use async_trait::async_trait;
use futures::stream::BoxStream;
use crate::error::Result;
use crate::message::{Message, ToolCall, ToolResult};
#[async_trait]
pub trait LlmBackend: Send + Sync {
fn id(&self) -> String;
async fn complete(&self, model: &str, messages: &[Message]) -> Result<Message>;
async fn stream(
&self,
model: &str,
messages: &[Message],
) -> Result<BoxStream<'static, Result<Message>>>;
}
#[async_trait]
pub trait McpClient: Send + Sync {
fn server_name(&self) -> &str;
async fn list_tools(&self) -> Result<Vec<ToolDescriptor>>;
async fn call(&self, call: &ToolCall) -> Result<ToolResult>;
}
#[derive(Debug, Clone)]
pub struct ToolDescriptor {
pub name: String,
pub description: String,
pub json_schema: serde_json::Value,
}
#[async_trait]
pub trait Store: Send + Sync {
async fn append(&self, session: crate::message::SessionId, msg: &Message) -> Result<()>;
async fn load(&self, session: crate::message::SessionId) -> Result<Vec<Message>>;
async fn list(&self) -> Result<Vec<crate::message::SessionId>>;
}
pub trait Sandbox: Send + Sync {
fn availability(&self) -> &'static str;
fn enforces(&self) -> bool;
}