use std::{collections::HashMap, sync::Arc};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub(crate) struct AgentId(pub(crate) u64);
impl std::fmt::Display for AgentId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "agent-{}", self.0)
}
}
pub(crate) struct AgentBridgeState {
pub(crate) registry: Option<Arc<crate::tools::ToolRegistry>>,
pub(crate) hook_runner: Option<Arc<crate::hooks::Hooks>>,
pub(crate) policies: crate::policies::PolicySet,
pub(crate) policy_handler: Option<Arc<dyn crate::policies::AskUserHandler>>,
pub(crate) tool_state: Arc<std::sync::RwLock<HashMap<String, serde_json::Value>>>,
}
static BRIDGE_STATE: std::sync::OnceLock<
std::sync::RwLock<std::collections::HashMap<u64, AgentBridgeState>>,
> = std::sync::OnceLock::new();
pub(crate) fn bridge_state()
-> &'static std::sync::RwLock<std::collections::HashMap<u64, AgentBridgeState>> {
BRIDGE_STATE.get_or_init(|| std::sync::RwLock::new(std::collections::HashMap::new()))
}