llm_kernel/lib.rs
1//! # llm-kernel
2//!
3//! Foundation library for Rust AI-native applications.
4//!
5//! Provides a composable, feature-gated set of modules for building
6//! LLM-powered tools, agents, and servers:
7//!
8//! | Feature | Module | Description |
9//! |---------------|-------------|-----------------------------------------------------|
10//! | `provider` | [`provider`] | Provider catalog, model descriptors, pricing — **default** |
11//! | `client-async`| [`llm`] | Async LLM client (OpenAI, Anthropic) with SSE streaming |
12//! | `discovery` | [`discovery`] | Dynamic model discovery (models.dev, Ollama, OpenAI-compat) |
13//! | `secrets` | [`secrets`] | SecretVault — dotenv-style credential management |
14//! | `store` | [`store`] | SQLite init helpers (WAL, PRAGMA, schema versioning) |
15//! | `config` | [`config`] | TOML config loader with auto-create from template |
16//! | `graph` | [`graph`] | Knowledge graph — SQLite, FTS5, smart recall, BFS traversal |
17//! | `mcp` | [`mcp`] | MCP server framework — JSON-RPC 2.0, stdio transport |
18//! | `tokens` | [`tokens`] | Token estimation with Unicode-script heuristics |
19//! | `install` | [`install`] | AI tool installation wizard (Claude, Cursor, Copilot, etc.) |
20//! | `search` | [`search`] | Hybrid search with Reciprocal Rank Fusion |
21//! | `embedding` | [`embedding`] | Embedding provider trait + cosine similarity |
22//! | `telemetry` | [`telemetry`] | Telemetry framework — enum-gated events, no PII |
23//! | `safety` | [`safety`] | Secret masking, error classification, output sanitization |
24//!
25//! ## Quick start
26//!
27//! The [`prelude`] module re-exports the most commonly used types:
28//!
29//! ```no_run
30//! use llm_kernel::prelude::*;
31//! ```
32
33pub mod error;
34
35#[cfg(feature = "provider")]
36pub mod provider;
37
38#[cfg(feature = "discovery")]
39pub mod discovery;
40
41#[cfg(feature = "secrets")]
42pub mod secrets;
43
44#[cfg(feature = "client-async")]
45pub mod llm;
46
47#[cfg(feature = "store")]
48pub mod store;
49
50#[cfg(feature = "config")]
51pub mod config;
52
53#[cfg(feature = "graph")]
54pub mod graph;
55
56#[cfg(feature = "mcp")]
57pub mod mcp;
58
59#[cfg(feature = "tokens")]
60pub mod tokens;
61
62#[cfg(feature = "install")]
63pub mod install;
64
65#[cfg(feature = "search")]
66pub mod search;
67
68#[cfg(any(feature = "embedding", feature = "embedding-openai"))]
69pub mod embedding;
70
71#[cfg(feature = "telemetry")]
72pub mod telemetry;
73
74#[cfg(feature = "safety")]
75pub mod safety;
76
77pub mod prelude;
78
79/// Returns the crate name (`"llm-kernel"`).
80pub fn name() -> &'static str {
81 "llm-kernel"
82}
83
84/// Returns the crate version (from `Cargo.toml`).
85pub fn version() -> &'static str {
86 env!("CARGO_PKG_VERSION")
87}