pub mod audit_jsonl;
pub mod config;
pub mod error;
pub mod intercept;
pub mod mcp_enforce;
pub mod proxy;
pub mod tls;
pub use config::ProxyConfig;
pub use error::ProxyError;
pub async fn run(
config: ProxyConfig,
event_tx: tokio::sync::broadcast::Sender<aa_runtime::pipeline::PipelineEvent>,
) -> anyhow::Result<()> {
let ca = tls::CaStore::load_or_create(&config.ca_dir).await?;
#[cfg(target_os = "macos")]
if !ca.is_installed()? {
tracing::info!("CA not yet trusted — installing into macOS System Keychain");
ca.install()?;
tracing::info!("CA installed successfully");
}
let server = proxy::ProxyServer::new(config, ca, event_tx);
server.run().await?;
Ok(())
}