use crate::connection::ConnectionPool;
use once_cell::sync::OnceCell;
pub mod architecture;
pub mod graph;
pub mod instance;
pub mod record;
pub mod schema;
static CONNECTION_POOL: OnceCell<ConnectionPool> = OnceCell::new();
pub fn init_connection_pool(pool: ConnectionPool) {
CONNECTION_POOL.set(pool).ok();
}
pub(crate) fn connection_pool() -> Option<&'static ConnectionPool> {
CONNECTION_POOL.get()
}
pub(crate) fn resolve_socket_path(explicit: Option<String>) -> crate::error::McpResult<String> {
explicit
.or_else(|| std::env::var("AIMDB_SOCKET").ok())
.filter(|s| !s.is_empty())
.ok_or_else(|| {
crate::error::McpError::InvalidParams(
"Missing socket_path (pass it explicitly or set AIMDB_SOCKET env var)".into(),
)
})
}
pub use architecture::{
get_architecture, get_buffer_metrics, propose_add_binary, propose_add_connector,
propose_add_record, propose_add_task, propose_modify_buffer, propose_modify_fields,
propose_modify_key_variants, remove_binary, remove_record, remove_task, rename_record,
reset_session, resolve_proposal, save_memory, validate_against_instance,
};
pub use graph::{graph_edges, graph_nodes, graph_topo_order};
pub use instance::{discover_instances, get_instance_info};
pub use record::{drain_record, get_record, list_records, set_record};
pub use schema::query_schema;