pub mod agent;
pub mod agents;
pub mod context;
pub mod error;
pub mod genai_llm_client;
pub mod history;
pub mod llm_types;
pub mod prompt_sanitizer;
pub mod vm_execution;
pub mod pool;
pub mod pool_manager;
pub mod tracking;
pub mod workflows;
pub use terraphim_agent_registry::{
AgentCapability, AgentDiscoveryQuery, AgentDiscoveryResult, AgentMetadata, AgentPid,
AgentRegistry as KnowledgeGraphAgentRegistry, AgentRole, AgentStatus, CapabilityMetrics,
KnowledgeGraphIntegration, RegistryBuilder, RegistryConfig, RegistryError, RegistryResult,
RegistryStatistics, SimilarityThresholds, SupervisorId,
};
pub use agent::*;
pub use agents::*;
pub use context::*;
pub use error::*;
pub use genai_llm_client::*;
pub use history::*;
pub use llm_types::*;
pub use prompt_sanitizer::*;
pub use pool::*;
pub use pool_manager::*;
pub use tracking::*;
pub use workflows::*;
pub type MultiAgentResult<T> = Result<T, MultiAgentError>;
pub type AgentId = uuid::Uuid;
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils {
use super::*;
use std::sync::Arc;
use terraphim_config::Role;
use terraphim_persistence::DeviceStorage;
pub fn create_test_role() -> Role {
let mut role = Role::new("TestAgent");
role.shortname = Some("test".to_string());
role.relevance_function = terraphim_types::RelevanceFunction::BM25;
role.extra
.insert("llm_provider".to_string(), serde_json::json!("ollama"));
role.extra
.insert("llm_model".to_string(), serde_json::json!("gemma3:270m"));
role.extra.insert(
"ollama_base_url".to_string(),
serde_json::json!("http://127.0.0.1:11434"),
);
role
}
pub async fn create_test_agent_simple() -> Result<TerraphimAgent, MultiAgentError> {
use terraphim_persistence::memory::create_memory_only_device_settings;
let _settings = create_memory_only_device_settings()
.map_err(|e| MultiAgentError::PersistenceError(e.to_string()))?;
let persistence = DeviceStorage::arc_memory_only()
.await
.map_err(|e| MultiAgentError::PersistenceError(e.to_string()))?;
let role = create_test_role();
TerraphimAgent::new(role, persistence, None).await
}
pub async fn create_test_agent() -> Result<TerraphimAgent, MultiAgentError> {
create_test_agent_simple().await
}
pub async fn create_memory_storage() -> Result<Arc<DeviceStorage>, MultiAgentError> {
use terraphim_persistence::memory::create_memory_only_device_settings;
let _settings = create_memory_only_device_settings()
.map_err(|e| MultiAgentError::PersistenceError(e.to_string()))?;
DeviceStorage::arc_memory_only()
.await
.map_err(|e| MultiAgentError::PersistenceError(e.to_string()))
}
pub async fn create_test_rolegraph(
) -> Result<Arc<terraphim_rolegraph::RoleGraph>, MultiAgentError> {
use terraphim_types::Thesaurus;
let empty_thesaurus = Thesaurus::new("test_thesaurus".to_string());
let rolegraph = terraphim_rolegraph::RoleGraph::new("TestRole".into(), empty_thesaurus)
.await
.map_err(|e| {
MultiAgentError::KnowledgeGraphError(format!(
"Failed to create test rolegraph: {}",
e
))
})?;
Ok(Arc::new(rolegraph))
}
pub fn create_test_automata(
) -> Result<Arc<terraphim_automata::AutocompleteIndex>, MultiAgentError> {
use terraphim_types::Thesaurus;
let empty_thesaurus = Thesaurus::new("test_thesaurus".to_string());
let automata = terraphim_automata::build_autocomplete_index(empty_thesaurus, None)
.map_err(|e| {
MultiAgentError::KnowledgeGraphError(format!(
"Failed to create test automata: {}",
e
))
})?;
Ok(Arc::new(automata))
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_basic_imports() {
let _agent_id = AgentId::new_v4();
}
}