use crate::types::{QuestionHookResult, Step, ToolResult};
use async_trait::async_trait;
use futures_util::stream::BoxStream;
#[async_trait]
pub trait Connection: Send + Sync {
fn conversation_id(&self) -> &str;
fn is_idle(&self) -> bool;
fn receive_steps(&self) -> BoxStream<'static, Result<Step, anyhow::Error>>;
async fn send(&self, content: &str) -> Result<(), anyhow::Error>;
async fn send_trigger_notification(&self, content: &str) -> Result<(), anyhow::Error>;
async fn send_halt_request(&self) -> Result<(), anyhow::Error>;
async fn send_tool_confirmation(
&self,
trajectory_id: &str,
step_index: u32,
accepted: bool,
) -> Result<(), anyhow::Error>;
async fn send_tool_response(&self, id: &str, result: ToolResult) -> Result<(), anyhow::Error>;
async fn send_question_response(
&self,
trajectory_id: &str,
step_index: u32,
answers: QuestionHookResult,
) -> Result<(), anyhow::Error>;
async fn disconnect(&self) -> Result<(), anyhow::Error>;
}