1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//! # llm-kernel
//!
//! Foundation library for Rust AI-native applications.
//!
//! Provides a composable, feature-gated set of modules for building
//! LLM-powered tools, agents, and servers:
//!
//! | Feature | Module | Description |
//! |---------------|-------------|-----------------------------------------------------|
//! | `provider` | [`provider`] | Provider catalog, model descriptors, pricing — **default** |
//! | `client-async`| [`llm`] | Async LLM client (OpenAI, Anthropic) with SSE streaming |
//! | `discovery` | [`discovery`] | Dynamic model discovery (models.dev, Ollama, OpenAI-compat) |
//! | `secrets` | [`secrets`] | SecretVault — dotenv-style credential management |
//! | `store` | [`store`] | SQLite init helpers (WAL, PRAGMA, schema versioning) |
//! | `config` | [`config`] | TOML config loader with auto-create from template |
//! | `graph` | [`graph`] | Knowledge graph — SQLite, FTS5, smart recall, BFS traversal |
//! | `mcp` | [`mcp`] | MCP server framework — JSON-RPC 2.0, stdio transport |
//! | `tokens` | [`tokens`] | Token estimation with Unicode-script heuristics |
//! | `install` | [`install`] | AI tool installation wizard (Claude, Cursor, Copilot, etc.) |
//! | `search` | [`search`] | Hybrid search with Reciprocal Rank Fusion |
//! | `embedding` | [`embedding`] | Embedding provider trait + cosine similarity |
//! | `telemetry` | [`telemetry`] | Telemetry framework — enum-gated events, no PII |
//! | `safety` | [`safety`] | Secret masking, error classification, output sanitization |
//! | `dlp` | [`dlp`] | Data-loss prevention — content scan, provider data policy |
//!
//! ## Quick start
//!
//! The [`prelude`] module re-exports the most commonly used types:
//!
//! ```no_run
//! use llm_kernel::prelude::*;
//! ```
// `embedding-fastembed` (static ONNX Runtime archive) and
// `embedding-fastembed-dynamic-linking` (runtime `libonnxruntime.{so,dll,dylib}`
// load) are mutually exclusive. Enabling both unifies `ort-download-binaries-*`
// and `ort-load-dynamic` on the shared `fastembed`/`ort-sys` crate, which makes
// ort-sys skip the static-archive download and silently expect a runtime dylib
// llm-kernel never ships — the original #50/#55 failure mode. Force a hard
// build error so the conflict can never be silent. See `Cargo.toml` feature
// docs and #55.
compile_error!;
// Every reqwest-backed feature needs a TLS crypto provider. reqwest 0.13's
// `rustls` feature pins aws-lc-rs (needs cmake/nasm to cross-compile); the
// `rustls-ring` feature swaps in the ring provider (#93) — no cmake/nasm,
// a plain C compiler suffices (ring still builds some C/assembly). Without
// one of them the build succeeds but reqwest panics at runtime when the
// first client is built — force a hard build error instead.
compile_error!;
// Enabling both unifies reqwest to `rustls` + `rustls-no-provider`, where the
// aws-lc-rs feature silently wins and `rustls-ring` is ignored. Reject it.
compile_error!;
/// TLS provider bootstrap (`rustls-ring`). Internal.
pub
/// Error types and result alias for llm-kernel.
/// Returns the crate name (`"llm-kernel"`).
/// Returns the crate version (from `Cargo.toml`).