use crate::connection::ConnectionPool;
use once_cell::sync::OnceCell;
pub mod architecture;
pub mod buffer_metrics;
pub mod graph;
pub mod instance;
pub mod profiling;
pub mod record;
pub mod schema;
static CONNECTION_POOL: OnceCell<ConnectionPool> = OnceCell::new();
static DEFAULT_SOCKET: OnceCell<String> = OnceCell::new();
pub fn init_connection_pool(pool: ConnectionPool) {
CONNECTION_POOL.set(pool).ok();
}
pub fn set_default_socket(path: String) {
DEFAULT_SOCKET.set(path).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(|| DEFAULT_SOCKET.get().cloned())
.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, use --socket, or set AIMDB_SOCKET env var)".into(),
)
})
}
pub use architecture::{
get_architecture, 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 buffer_metrics::{get_buffer_metrics, reset_buffer_metrics};
pub use graph::{graph_edges, graph_nodes, graph_topo_order};
pub use instance::{discover_instances, get_instance_info};
pub use profiling::{get_stage_profiling, reset_stage_profiling};
pub use record::{drain_record, get_record, list_records, set_record};
pub use schema::query_schema;