Skip to main content

brainwires/
lib.rs

1#![deny(missing_docs)]
2//! # Brainwires
3//!
4//! The Brainwires Agent Framework — build any AI application in Rust.
5//!
6//! Re-exports all framework sub-crates via feature flags for convenient access.
7//!
8//! ## Quick Start
9//!
10//! ```toml
11//! [dependencies]
12//! brainwires = { version = "0.1", features = ["full"] }
13//! ```
14//!
15//! ```rust
16//! use brainwires::prelude::*;
17//! ```
18
19/// Core types and traits — available via `brainwires::core::*` or `brainwires::prelude::*`.
20pub mod core {
21    pub use brainwires_core::*;
22}
23
24/// Model tools — file ops, bash, git, search, validation, and web tools.
25#[cfg(feature = "tools")]
26pub mod tools {
27    pub use brainwires_tool_system::*;
28}
29
30/// Agent runtime, communication hub, task management, and validation.
31#[cfg(feature = "agents")]
32pub mod agents {
33    pub use brainwires_agents::*;
34}
35
36/// Persistent storage — LanceDB vector database, tiered memory, embeddings.
37#[cfg(feature = "storage")]
38pub mod storage {
39    pub use brainwires_storage::*;
40}
41
42/// MCP client — connect to external MCP servers and use their tools.
43#[cfg(feature = "mcp")]
44pub mod mcp {
45    pub use brainwires_mcp::*;
46}
47
48/// MDAP — Multi-Dimensional Adaptive Planning with MAKER voting.
49#[cfg(feature = "mdap")]
50pub mod mdap {
51    pub use brainwires_mdap::*;
52}
53
54/// Adaptive prompting — technique library, clustering, temperature optimization.
55#[cfg(feature = "prompting")]
56pub mod prompting {
57    pub use brainwires_prompting::*;
58}
59
60/// Permissions — capability profiles, policy engine, audit logging.
61#[cfg(feature = "permissions")]
62pub mod permissions {
63    pub use brainwires_permissions::*;
64}
65
66/// AI provider implementations — OpenAI, Anthropic, Google, Ollama, and more.
67#[cfg(feature = "providers")]
68pub mod providers {
69    pub use brainwires_providers::*;
70}
71
72/// Chat provider implementations (Provider trait wrappers over API clients).
73///
74/// Re-exported from `brainwires_providers` — Groq, Together, Fireworks, and
75/// Anyscale are now served by `OpenAiChatProvider` with a custom provider name.
76#[cfg(feature = "chat")]
77pub mod chat {
78    pub use brainwires_providers::{
79        AnthropicChatProvider, ChatProviderFactory, GoogleChatProvider, OllamaChatProvider,
80        OpenAiChatProvider, OpenAiResponsesProvider,
81    };
82}
83
84/// SEAL — Self-Evolving Adaptive Learning for coreference and knowledge.
85#[cfg(feature = "seal")]
86pub mod seal {
87    pub use brainwires_seal::*;
88}
89
90// Orchestrator is re-exported via brainwires_tool_system::orchestrator when orchestrator feature is on
91
92/// RAG — codebase indexing, semantic search, and retrieval-augmented generation.
93#[cfg(feature = "rag")]
94pub mod rag {
95    pub use brainwires_rag::*;
96}
97
98/// Sandboxed code interpreters — Rhai, Lua, JavaScript (Boa), Python (RustPython).
99#[cfg(feature = "interpreters")]
100pub mod interpreters {
101    pub use brainwires_code_interpreters::*;
102}
103
104/// Relay — MCP server framework, agent IPC, remote communication.
105#[cfg(feature = "relay")]
106pub mod relay {
107    pub use brainwires_relay::*;
108}
109
110/// Skills — SKILL.md parsing, skill registry, and execution.
111#[cfg(feature = "skills")]
112pub mod skills {
113    pub use brainwires_skills::*;
114}
115
116/// Evaluation framework — Monte Carlo runner, Wilson CI, adversarial tests.
117#[cfg(feature = "eval")]
118pub mod eval {
119    pub use brainwires_agents::eval::*;
120}
121
122/// Protocol proxy framework for debugging and inspecting AI traffic.
123#[cfg(feature = "proxy")]
124pub mod proxy {
125    pub use brainwires_proxy::*;
126}
127
128/// A2A (Agent-to-Agent) protocol support.
129#[cfg(feature = "a2a")]
130pub mod a2a {
131    pub use brainwires_a2a::*;
132}
133
134/// Distributed mesh networking — topology, discovery, federation, routing.
135#[cfg(feature = "mesh")]
136pub mod mesh {
137    pub use brainwires_mesh::*;
138}
139
140/// Audio — capture, playback, speech-to-text, text-to-speech.
141#[cfg(feature = "audio")]
142pub mod audio {
143    pub use brainwires_audio::*;
144}
145
146/// Training data pipelines — JSONL, format conversion, tokenization, dedup.
147#[cfg(feature = "datasets")]
148pub mod datasets {
149    pub use brainwires_datasets::*;
150}
151
152/// Model training — cloud fine-tuning, local Burn-based LoRA/QLoRA/DoRA.
153#[cfg(feature = "training")]
154pub mod training {
155    pub use brainwires_training::*;
156}
157
158/// Autonomous operations — self-improvement, git workflows, safety checks.
159#[cfg(feature = "autonomy")]
160pub mod autonomy {
161    pub use brainwires_autonomy::*;
162}
163
164/// Central knowledge — BKS, PKS, entity graphs, thought processing.
165#[cfg(feature = "brain")]
166pub mod brain {
167    pub use brainwires_brain::*;
168}
169
170/// Re-exports for building MCP servers (rmcp, schemars, CancellationToken).
171///
172/// Enabled with the `mcp-server` feature.
173#[cfg(feature = "mcp-server")]
174pub mod mcp_server_support {
175    pub use rmcp;
176    pub use schemars;
177    pub use tokio_util::sync::CancellationToken;
178}
179
180/// Convenience prelude — import everything commonly needed.
181///
182/// ```rust
183/// use brainwires::prelude::*;
184/// ```
185pub mod prelude {
186    // Core types — always available
187    pub use brainwires_core::{
188        // Tasks
189        AgentResponse,
190        // Providers
191        ChatOptions,
192        // Messages
193        ChatResponse,
194        ContentBlock,
195        EdgeType,
196        // Embeddings & vector store
197        EmbeddingProvider,
198        EntityStoreT,
199        // Graph types & traits
200        EntityType,
201        // Errors
202        FrameworkError,
203        FrameworkResult,
204        GraphEdge,
205        GraphNode,
206        ImageSource,
207        Message,
208        MessageContent,
209        // Permissions
210        PermissionMode,
211        // Plans
212        PlanMetadata,
213        PlanStatus,
214        Provider,
215        RelationshipGraphT,
216        Role,
217        StreamChunk,
218        Task,
219        TaskPriority,
220        TaskStatus,
221        // Tools
222        Tool,
223        ToolCaller,
224        ToolContext,
225        ToolInputSchema,
226        ToolMode,
227        ToolResult,
228        ToolUse,
229        Usage,
230        VectorSearchResult,
231        VectorStore,
232        // Working set
233        WorkingSet,
234        WorkingSetConfig,
235        serialize_messages_to_stateless_history,
236    };
237
238    // Tools — available with "tools" feature
239    #[cfg(feature = "tools")]
240    pub use brainwires_tool_system::{
241        BashTool, FileOpsTool, GitTool, RetryStrategy, SearchTool, ToolCategory, ToolErrorCategory,
242        ToolOutcome, ToolRegistry, ToolSearchTool, ValidationTool, WebTool, classify_error,
243    };
244
245    // Agents — available with "agents" feature
246    #[cfg(feature = "agents")]
247    pub use brainwires_agents::{
248        // Access control
249        AccessControlManager,
250        AgentExecutionResult,
251        // Agent runtime
252        AgentRuntime,
253        CommunicationHub,
254        ContentionStrategy,
255        ExecutionApprovalMode,
256        FileLockManager,
257        // Git coordination
258        GitCoordinator,
259        LockPersistence,
260        PlanExecutionConfig,
261        PlanExecutionStatus,
262        // Plan execution
263        PlanExecutorAgent,
264        TaskManager,
265        TaskQueue,
266        ValidationCheck,
267        ValidationConfig,
268        ValidationSeverity,
269        run_agent_loop,
270    };
271
272    // Storage — available with "storage" feature
273    #[cfg(feature = "storage")]
274    pub use brainwires_storage::{EmbeddingProvider as StorageEmbeddingProvider, TieredMemory};
275
276    // MCP — available with "mcp" feature
277    #[cfg(feature = "mcp")]
278    pub use brainwires_mcp::{McpClient, McpConfigManager, McpServerConfig};
279
280    // MDAP — available with "mdap" feature
281    #[cfg(feature = "mdap")]
282    pub use brainwires_mdap::{
283        Composer, FirstToAheadByKVoter, MdapError, MdapEstimate, MdapResult, MicroagentConfig,
284        StandardRedFlagValidator,
285    };
286
287    // Knowledge — available with "knowledge" feature (now in brainwires-brain::knowledge)
288    #[cfg(feature = "knowledge")]
289    pub use brainwires_brain::knowledge::{
290        BehavioralKnowledgeCache, BehavioralTruth, PersonalKnowledgeCache, TruthCategory,
291    };
292
293    // Prompting — available with "prompting" feature
294    #[cfg(feature = "prompting")]
295    pub use brainwires_prompting::{
296        GeneratedPrompt, PromptGenerator, PromptingTechnique, TaskClusterManager, TechniqueLibrary,
297        TemperatureOptimizer,
298    };
299
300    // Permissions — available with "permissions" feature
301    #[cfg(feature = "permissions")]
302    pub use brainwires_permissions::{
303        AgentCapabilities, ApprovalAction, ApprovalResponse, ApprovalSeverity, AuditLogger,
304        CapabilityProfile, PermissionsConfig, PolicyEngine, TrustLevel, TrustManager,
305    };
306
307    // Audio — available with "audio" feature
308    #[cfg(feature = "audio")]
309    pub use brainwires_audio::{
310        AudioBuffer, AudioCapture, AudioConfig, AudioDevice, AudioError, AudioPlayback,
311        AudioResult, SpeechToText, SttOptions, TextToSpeech, Transcript, TtsOptions, Voice,
312    };
313}