use anyhow::Result;
use sacp::Component;
use sacp_conductor::{Conductor, McpBridgeMode};
pub struct Symposium {
crate_sources_proxy: bool,
sparkle: bool,
}
impl Symposium {
pub fn new() -> Self {
Symposium {
sparkle: true,
crate_sources_proxy: true,
}
}
pub fn sparkle(mut self, enable: bool) -> Self {
self.sparkle = enable;
self
}
pub fn crate_sources_proxy(mut self, enable: bool) -> Self {
self.crate_sources_proxy = enable;
self
}
}
impl sacp::Component for Symposium {
async fn serve(self, client: impl Component) -> Result<(), sacp::Error> {
let Self { crate_sources_proxy, sparkle } = self;
Conductor::new(
"symposium".to_string(),
move |init_req| async move {
tracing::info!("Building proxy chain based on capabilities");
let mut components = vec![];
if crate_sources_proxy {
components.push(sacp::DynComponent::new(
symposium_crate_sources_proxy::CrateSourcesProxy {},
));
}
if sparkle {
components.push(sacp::DynComponent::new(sparkle::SparkleComponent::new()));
}
Ok((init_req, components))
},
McpBridgeMode::default(),
).run(client).await
}
}