pub mod canonicalize;
pub mod chunker;
pub mod compactor;
pub mod content_store;
pub mod embedder;
pub mod entities;
pub mod index;
pub mod jobs;
pub mod ledger;
pub mod model;
pub mod paths;
pub mod pipeline;
pub mod search;
pub mod service;
pub mod store;
pub mod sync;
pub mod tools;
pub mod util;
pub mod worker;
pub use canonicalize::{
CanonicalMetadata, CanonicalizeInput, CanonicalizedSource, canonicalize_by_mime,
canonicalize_url, detect_mime,
};
pub use chunker::{ChunkerInput, LocatorKind, chunk_markdown};
pub use content_store::{
FrontMatter, StageInput, StagedDoc, compose_doc_file, parse_doc_file, read_doc_body,
read_doc_range, stage_doc, verify_doc_sha,
};
pub use embedder::{KbEmbedder, StubEmbedder};
pub use index::{HnswCache, KbIndex, TantivyIndex};
pub use jobs::{ClaimToken, Job, JobKind, JobStatus};
pub use ledger::{IngestLedgerEntry, LedgerOp, LedgerStatus};
pub use model::{
CallerScope, ChunkStatus, EntityKind, KbChunk, KbDoc, KbEntity, KbEntityIndex, KbLocator,
KbSource, KbSourceKind, KbStatus, KbVisibility, LogicalSourceId, MailSource, VersionPointer,
chunk_id, hamming64, simhash64,
};
pub use paths::KbPaths;
pub use pipeline::{IngestInput, IngestOutput, ingest_canonicalized};
pub use service::{KnowledgeError, KnowledgeService};
pub use store::{KbStore, open_db};
pub use util::{RAG_DISCIPLINE_PROMPT, redact};
pub use worker::{DefaultDispatcher, HandlerCtx, JobHandler, WorkerConfig, WorkerPool};
static GLOBAL_SERVICE: std::sync::OnceLock<std::sync::Arc<KnowledgeService>> =
std::sync::OnceLock::new();
pub fn set_global_service(svc: std::sync::Arc<KnowledgeService>) {
let _ = GLOBAL_SERVICE.set(svc);
}
pub fn global_service() -> Option<std::sync::Arc<KnowledgeService>> {
GLOBAL_SERVICE.get().cloned()
}