use sacp::schema::{ContentBlock, ContentChunk, SessionNotification, SessionUpdate};
use sacp::{Agent, Client, ConnectTo, Proxy};
pub async fn run_arrow_proxy(
transport: impl ConnectTo<Proxy> + 'static,
) -> Result<(), sacp::Error> {
Proxy
.builder()
.name("arrow-proxy")
.on_receive_notification_from(
Agent,
async |mut notification: SessionNotification, cx| {
match &mut notification.update {
SessionUpdate::AgentMessageChunk(ContentChunk { content, .. }) => {
if let ContentBlock::Text(text_content) = content {
text_content.text = format!(">{}", text_content.text);
}
}
_ => {
}
}
cx.send_notification_to(Client, notification)?;
Ok(())
},
sacp::on_receive_notification!(),
)
.connect_to(transport)
.await
}
#[cfg(test)]
mod tests {
#[test]
fn test_arrow_proxy_compiles() {
}
}