pub mod backup;
pub mod cli;
pub mod daemon;
pub mod embedding;
pub mod errors;
pub mod hook;
pub mod install;
pub mod kb;
pub mod llm;
pub mod llm_trace;
pub mod mcp;
pub mod migrate;
pub mod paths;
pub mod refine;
pub mod settings;
pub mod storage;
pub mod upgrade;
pub mod utils;
pub mod web;
#[cfg(test)]
mod tests;
pub use errors::{InnateError, Result};
pub use kb::{
AbstainReason, AppraiseParams, Contributor, CurateReport, FlaggedPoint, KnowledgeBase,
RecallParams, RecallResult, RecordParams, Situation, Tier, Valence, Verdict, APPRAISE_ADVISORY,
};
pub fn open_kb(db_path: impl AsRef<std::path::Path>) -> Result<KnowledgeBase> {
use std::sync::Arc;
let s = settings::load()?;
let embedding: Option<Arc<dyn embedding::EmbeddingProvider>> = s.embedding.as_ref().map(|c| {
Arc::new(llm::LlmEmbeddingProvider::new(c.clone())) as Arc<dyn embedding::EmbeddingProvider>
});
let distiller: Option<Arc<dyn refine::Distiller>> = s.llm.as_ref().map(|c| {
let primary = llm::build_distiller(c) as Arc<dyn refine::Distiller>;
Arc::new(refine::ResilientDistiller::new(
primary,
Arc::new(refine::HeuristicDistiller),
2,
)) as Arc<dyn refine::Distiller>
});
let kb = KnowledgeBase::open_with(db_path, embedding, None, distiller, None, None)?;
let kb = match s.llm.as_ref() {
Some(c) => kb.with_reranker(Arc::new(llm::LlmReranker::new(c.clone()))),
None => kb,
};
Ok(kb)
}