#![allow(clippy::too_many_arguments)]
#![allow(clippy::type_complexity)]
#![allow(clippy::redundant_closure)]
#![allow(unused_imports)]
#![allow(clippy::needless_borrows_for_generic_args)]
#![allow(clippy::option_as_ref_deref)]
#![allow(clippy::map_flatten)]
#![allow(clippy::for_kv_map)]
pub mod config;
pub mod billing_config;
pub mod fleet_secrets;
pub use config::{DatabaseConfig, QdrantConfig, default_qdrant_url};
pub use billing_config::{BillingConfig, ModelPricingConfig};
pub use fleet_secrets::{
decrypt_api_key, encrypt_api_key, last_n_visible, EncryptedPayload, FleetSecrets,
FleetSecretsError, MasterKey, ProviderOverride,
};
pub mod vectorstore;
#[cfg(feature = "ares-vector")]
pub mod ares_vector;
#[cfg(feature = "chromadb")]
pub mod chromadb;
#[cfg(any(feature = "lancedb", feature = "postgres"))]
pub mod lancedb;
#[cfg(any(feature = "pgvector", feature = "postgres"))]
pub mod pgvector;
#[cfg(any(feature = "pinecone", feature = "postgres"))]
pub mod pinecone;
#[cfg(any(feature = "qdrant", feature = "postgres"))]
pub mod qdrant;
#[cfg(feature = "postgres")]
pub mod agent_runs;
#[cfg(feature = "postgres")]
pub mod agent_feedback;
#[cfg(feature = "postgres")]
pub mod alerts;
#[cfg(feature = "postgres")]
pub mod audit_log;
#[cfg(feature = "postgres")]
pub mod postgres;
#[cfg(feature = "postgres")]
pub mod tenant_agents;
#[cfg(feature = "postgres")]
pub mod tenants;
#[cfg(feature = "postgres")]
pub mod realms;
#[cfg(feature = "postgres")]
pub use realms::TenantRealms;
#[cfg(feature = "postgres")]
pub mod traits;
#[cfg(feature = "turso")]
pub mod turso;
#[cfg(feature = "postgres")]
pub mod agent_versions;
#[cfg(feature = "postgres")]
pub use agent_versions::AgentVersionInput;
#[cfg(feature = "postgres")]
pub mod fleet_provider_secrets;
#[cfg(feature = "postgres")]
pub mod runtime_providers;
#[cfg(feature = "postgres")]
pub mod tenant_model_tiers;
#[cfg(feature = "postgres")]
pub mod tenant_allowlist;
#[cfg(feature = "postgres")]
pub mod token_budgets;
#[cfg(feature = "postgres")]
pub mod runtime_tools;
#[cfg(feature = "postgres")]
pub mod run_history;
#[cfg(feature = "postgres")]
pub mod skills;
#[cfg(feature = "postgres")]
pub mod schedules;
#[cfg(feature = "postgres")]
pub mod oauth_credentials;
#[cfg(feature = "postgres")]
pub mod query_builders;
pub use vectorstore::{CollectionInfo, CollectionStats, VectorStore, VectorStoreProvider};
#[cfg(feature = "ares-vector")]
pub use ares_vector::AresVectorStore;
#[cfg(feature = "lancedb")]
pub use lancedb::LanceDBStore;
#[cfg(feature = "postgres")]
pub use postgres::PostgresClient;
#[cfg(feature = "turso")]
pub use turso::TursoClient;
#[cfg(feature = "qdrant")]
pub use qdrant::QdrantVectorStore;
#[cfg(feature = "postgres")]
pub use tenants::{TenantDb, UsageSummary};
#[cfg(feature = "postgres")]
pub type Store = TenantDb;
mod plugins;
pub use plugins::register_plugins;
pub struct PostgresService;
impl cordis::Service for PostgresService {
fn name(&self) -> &'static str {
"postgres"
}
fn check(&self) -> bool {
cfg!(feature = "postgres")
}
}
#[cfg(test)]
mod tests {
use super::{CollectionInfo, CollectionStats};
#[cfg(feature = "ares-vector")]
use super::VectorStoreProvider;
#[cfg(feature = "ares-vector")]
use serde_json::json;
#[test]
fn collection_stats_serde_roundtrip() {
let stats = CollectionStats {
name: "docs".into(),
document_count: 42,
dimensions: 384,
index_size_bytes: Some(1024),
distance_metric: "cosine".into(),
};
let value = serde_json::to_value(&stats).expect("serialize");
let back: CollectionStats = serde_json::from_value(value).expect("deserialize");
assert_eq!(back.name, "docs");
assert_eq!(back.document_count, 42);
assert_eq!(back.dimensions, 384);
}
#[test]
fn collection_info_serde_roundtrip() {
let info = CollectionInfo {
name: "embeddings".into(),
dimensions: 768,
document_count: 10,
};
let json = serde_json::to_string(&info).expect("serialize");
let back: CollectionInfo = serde_json::from_str(&json).expect("deserialize");
assert_eq!(back.name, "embeddings");
assert_eq!(back.dimensions, 768);
}
#[cfg(feature = "ares-vector")]
#[test]
fn ares_vector_provider_tagged_json() {
let provider = VectorStoreProvider::AresVector {
path: Some("./data/vectors".into()),
};
let value = serde_json::to_value(&provider).expect("serialize");
assert_eq!(value["provider"], json!("aresvector"));
}
}