111 lines
2.5 KiB
Rust
111 lines
2.5 KiB
Rust
#![allow(clippy::collapsible_if)] // TODO: Remove once we can rely on Rust 2024 let-chains
|
|
|
|
//! Core traits and types for OWLEN LLM client
|
|
//!
|
|
//! This crate provides the foundational abstractions for building
|
|
//! LLM providers, routers, and MCP (Model Context Protocol) adapters.
|
|
|
|
pub mod agent;
|
|
pub mod config;
|
|
pub mod consent;
|
|
pub mod conversation;
|
|
pub mod credentials;
|
|
pub mod encryption;
|
|
pub mod facade;
|
|
pub mod formatting;
|
|
pub mod input;
|
|
pub mod llm;
|
|
pub mod mcp;
|
|
pub mod mode;
|
|
pub mod model;
|
|
pub mod oauth;
|
|
pub mod provider;
|
|
pub mod providers;
|
|
pub mod router;
|
|
pub mod sandbox;
|
|
pub mod session;
|
|
pub mod state;
|
|
pub mod storage;
|
|
pub mod theme;
|
|
pub mod tools;
|
|
pub mod types;
|
|
pub mod ui;
|
|
pub mod validation;
|
|
pub mod wrap_cursor;
|
|
|
|
pub use agent::*;
|
|
pub use config::*;
|
|
pub use consent::*;
|
|
pub use conversation::*;
|
|
pub use credentials::*;
|
|
pub use encryption::*;
|
|
pub use formatting::*;
|
|
pub use input::*;
|
|
pub use oauth::*;
|
|
// Export MCP types but exclude test_utils to avoid ambiguity
|
|
pub use facade::llm_client::*;
|
|
pub use llm::{
|
|
ChatStream, LlmProvider, Provider, ProviderConfig, ProviderRegistry, send_via_stream,
|
|
};
|
|
pub use mcp::{
|
|
LocalMcpClient, McpServer, McpToolCall, McpToolDescriptor, McpToolResponse, client, factory,
|
|
failover, permission, protocol, remote_client,
|
|
};
|
|
pub use mode::*;
|
|
pub use model::*;
|
|
pub use provider::*;
|
|
pub use providers::*;
|
|
pub use router::*;
|
|
pub use sandbox::*;
|
|
pub use session::*;
|
|
pub use state::*;
|
|
pub use theme::*;
|
|
pub use tools::*;
|
|
pub use validation::*;
|
|
|
|
/// Result type used throughout the OWLEN ecosystem
|
|
pub type Result<T> = std::result::Result<T, Error>;
|
|
|
|
/// Core error types for OWLEN
|
|
#[derive(thiserror::Error, Debug)]
|
|
pub enum Error {
|
|
#[error("Provider error: {0}")]
|
|
Provider(#[from] anyhow::Error),
|
|
|
|
#[error("Network error: {0}")]
|
|
Network(String),
|
|
|
|
#[error("Authentication error: {0}")]
|
|
Auth(String),
|
|
|
|
#[error("Configuration error: {0}")]
|
|
Config(String),
|
|
|
|
#[error("I/O error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
|
|
#[error("Invalid input: {0}")]
|
|
InvalidInput(String),
|
|
|
|
#[error("Operation timed out: {0}")]
|
|
Timeout(String),
|
|
|
|
#[error("Serialization error: {0}")]
|
|
Serialization(#[from] serde_json::Error),
|
|
|
|
#[error("Storage error: {0}")]
|
|
Storage(String),
|
|
|
|
#[error("Unknown error: {0}")]
|
|
Unknown(String),
|
|
|
|
#[error("Not implemented: {0}")]
|
|
NotImplemented(String),
|
|
|
|
#[error("Permission denied: {0}")]
|
|
PermissionDenied(String),
|
|
|
|
#[error("Agent execution error: {0}")]
|
|
Agent(String),
|
|
}
|