From f321dad686d38feecc92d234434e97124ea64a0d Mon Sep 17 00:00:00 2001 From: clearloop Date: Sat, 28 Feb 2026 12:22:40 +0800 Subject: [PATCH 1/8] feat(provider): introduce the organized provider --- Cargo.lock | 27 ++-- Cargo.toml | 1 + app/daemon/Cargo.toml | 8 +- app/daemon/src/config.rs | 24 +--- app/daemon/src/gateway/builder.rs | 88 ++----------- app/daemon/src/gateway/mod.rs | 3 +- app/daemon/src/lib.rs | 1 - app/provider/Cargo.toml | 25 ++++ app/provider/src/config.rs | 30 +++++ app/provider/src/lib.rs | 16 +++ app/provider/src/manager.rs | 151 +++++++++++++++++++++++ app/{daemon => provider}/src/provider.rs | 78 ++++++++++-- app/provider/tests/build_provider.rs | 81 ++++++++++++ app/provider/tests/config.rs | 26 ++++ app/provider/tests/manager.rs | 119 ++++++++++++++++++ crates/runtime/examples/common/mod.rs | 1 - 16 files changed, 555 insertions(+), 124 deletions(-) create mode 100644 app/provider/Cargo.toml create mode 100644 app/provider/src/config.rs create mode 100644 app/provider/src/lib.rs create mode 100644 app/provider/src/manager.rs rename app/{daemon => provider}/src/provider.rs (51%) create mode 100644 app/provider/tests/build_provider.rs create mode 100644 app/provider/tests/config.rs create mode 100644 app/provider/tests/manager.rs diff --git a/Cargo.lock b/Cargo.lock index ad50a6f..135de6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2157,13 +2157,10 @@ name = "walrus-daemon" version = "0.0.9" dependencies = [ "anyhow", - "async-stream", "chrono", "compact_str", "cron", "dirs", - "futures-core", - "futures-util", "rmcp", "serde", "serde_json", @@ -2173,13 +2170,10 @@ dependencies = [ "toml", "tracing", "tracing-subscriber", - "walrus-claude", "walrus-core", - "walrus-deepseek", "walrus-llm", - "walrus-mistral", - "walrus-openai", "walrus-protocol", + "walrus-provider", "walrus-runtime", "walrus-sqlite", ] @@ -2254,6 +2248,25 @@ dependencies = [ "tokio", ] +[[package]] +name = "walrus-provider" +version = "0.0.9" +dependencies = [ + "anyhow", + "async-stream", + "compact_str", + "futures-core", + "futures-util", + "serde", + "serde_json", + "tokio", + "walrus-claude", + "walrus-deepseek", + "walrus-llm", + "walrus-mistral", + "walrus-openai", +] + [[package]] name = "walrus-runtime" version = "0.0.9" diff --git a/Cargo.toml b/Cargo.toml index 93b26e1..51a2ba9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ runtime = { path = "crates/runtime", package = "walrus-runtime", version = "0.0. sqlite = { path = "crates/sqlite", package = "walrus-sqlite", version = "0.0.9" } telegram = { path = "crates/telegram", package = "walrus-telegram", version = "0.0.9" } protocol = { path = "app/protocol", package = "walrus-protocol", version = "0.0.9" } +provider = { path = "app/provider", package = "walrus-provider", version = "0.0.9" } daemon = { path = "app/daemon", package = "walrus-daemon", version = "0.0.9" } client = { path = "app/client", package = "walrus-client", version = "0.0.9" } diff --git a/app/daemon/Cargo.toml b/app/daemon/Cargo.toml index 965ab4f..07ecce3 100644 --- a/app/daemon/Cargo.toml +++ b/app/daemon/Cargo.toml @@ -14,10 +14,7 @@ path = "src/bin/main.rs" [dependencies] runtime = { workspace = true } wcore = { workspace = true } -deepseek = { workspace = true } -openai = { workspace = true } -claude = { workspace = true } -mistral = { workspace = true } +provider = { workspace = true } sqlite = { workspace = true } llm = { workspace = true } protocol = { workspace = true } @@ -33,9 +30,6 @@ smallvec = { workspace = true } cron = { workspace = true } chrono = { workspace = true } rmcp = { workspace = true } -futures-core = { workspace = true } -futures-util = { workspace = true } -async-stream = { workspace = true } dirs = { workspace = true } [dev-dependencies] diff --git a/app/daemon/src/config.rs b/app/daemon/src/config.rs index 9741595..cedf35f 100644 --- a/app/daemon/src/config.rs +++ b/app/daemon/src/config.rs @@ -2,6 +2,7 @@ use anyhow::{Context, Result}; use compact_str::CompactString; +pub use provider::ProviderKind; use serde::{Deserialize, Serialize}; use std::path::Path; @@ -79,29 +80,6 @@ impl Default for LlmConfig { } } -/// Supported LLM provider kinds. -#[derive(Debug, Default, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)] -#[serde(rename_all = "snake_case")] -pub enum ProviderKind { - /// DeepSeek API (default). - #[default] - DeepSeek, - /// OpenAI API. - OpenAI, - /// Grok (xAI) API — OpenAI-compatible. - Grok, - /// Qwen (Alibaba DashScope) API — OpenAI-compatible. - Qwen, - /// Kimi (Moonshot) API — OpenAI-compatible. - Kimi, - /// Ollama local API — OpenAI-compatible, no key required. - Ollama, - /// Claude (Anthropic) Messages API. - Claude, - /// Mistral chat completions API. - Mistral, -} - /// Memory backend configuration. #[derive(Debug, Default, Serialize, Deserialize)] #[serde(default)] diff --git a/app/daemon/src/gateway/builder.rs b/app/daemon/src/gateway/builder.rs index 27a7c69..a4136d4 100644 --- a/app/daemon/src/gateway/builder.rs +++ b/app/daemon/src/gateway/builder.rs @@ -1,56 +1,13 @@ //! Runtime builder — constructs a fully-configured Runtime from GatewayConfig. use crate::MemoryBackend; -use crate::config::{self, MemoryBackendKind, ProviderKind}; +use crate::config::{self, MemoryBackendKind}; use crate::gateway::GatewayHook; -use crate::provider::Provider; use anyhow::Result; -use claude::Claude; -use deepseek::DeepSeek; -use mistral::Mistral; -use openai::OpenAI; +use provider::ProviderConfig; use runtime::{General, McpBridge, Runtime, SkillRegistry}; use std::path::Path; -fn build_provider(config: &crate::config::LlmConfig, client: llm::Client) -> Result { - let key = &config.api_key; - let provider = match config.provider { - ProviderKind::DeepSeek => match &config.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), - None => Provider::DeepSeek(DeepSeek::new(client, key)?), - }, - ProviderKind::OpenAI => match &config.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), - None => Provider::OpenAI(OpenAI::api(client, key)?), - }, - ProviderKind::Grok => match &config.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), - None => Provider::OpenAI(OpenAI::grok(client, key)?), - }, - ProviderKind::Qwen => match &config.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), - None => Provider::OpenAI(OpenAI::qwen(client, key)?), - }, - ProviderKind::Kimi => match &config.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), - None => Provider::OpenAI(OpenAI::kimi(client, key)?), - }, - ProviderKind::Ollama => match &config.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), - None => Provider::OpenAI(OpenAI::ollama(client)?), - }, - ProviderKind::Claude => match &config.base_url { - Some(url) => Provider::Claude(Claude::custom(client, key, url)?), - None => Provider::Claude(Claude::anthropic(client, key)?), - }, - ProviderKind::Mistral => match &config.base_url { - Some(url) => Provider::Mistral(Mistral::custom(client, key, url)?), - None => Provider::Mistral(Mistral::api(client, key)?), - }, - }; - Ok(provider) -} - /// Build a fully-configured `Runtime` from config and directory. /// /// Loads agents from `config_dir/agents/*.md`, skills from `config_dir/skills/`, @@ -76,9 +33,16 @@ pub async fn build_runtime( } }; - // Construct provider. + // Construct provider from LlmConfig via ProviderConfig. + let provider_config = ProviderConfig { + name: "default".into(), + provider: config.llm.provider, + model: config.llm.model.clone(), + api_key: config.llm.api_key.clone(), + base_url: config.llm.base_url.clone(), + }; let client = llm::Client::new(); - let provider = build_provider(&config.llm, client)?; + let provider = provider::build_provider(&provider_config, client)?; tracing::info!( "provider {:?} initialized for model {}", config.llm.provider, @@ -136,33 +100,3 @@ pub async fn build_runtime( Ok(runtime) } - -#[cfg(test)] -mod tests { - use super::build_provider; - use crate::config::{LlmConfig, ProviderKind}; - - #[test] - fn build_provider_mistral_default_endpoint() { - let config = LlmConfig { - provider: ProviderKind::Mistral, - model: "mistral-small-latest".into(), - api_key: "test-key".to_string(), - base_url: None, - }; - let provider = build_provider(&config, llm::Client::new()).expect("provider"); - assert!(matches!(provider, crate::provider::Provider::Mistral(_))); - } - - #[test] - fn build_provider_mistral_custom_endpoint() { - let config = LlmConfig { - provider: ProviderKind::Mistral, - model: "mistral-small-latest".into(), - api_key: "test-key".to_string(), - base_url: Some("http://localhost:8080/v1/chat/completions".to_string()), - }; - let provider = build_provider(&config, llm::Client::new()).expect("provider"); - assert!(matches!(provider, crate::provider::Provider::Mistral(_))); - } -} diff --git a/app/daemon/src/gateway/mod.rs b/app/daemon/src/gateway/mod.rs index 1f130d4..24bfb68 100644 --- a/app/daemon/src/gateway/mod.rs +++ b/app/daemon/src/gateway/mod.rs @@ -1,6 +1,7 @@ //! Protocol impls for the gateway. -use crate::{MemoryBackend, provider::Provider}; +use crate::MemoryBackend; +use provider::Provider; use runtime::{DEFAULT_COMPACT_PROMPT, DEFAULT_FLUSH_PROMPT, Hook, Runtime}; use std::sync::Arc; diff --git a/app/daemon/src/lib.rs b/app/daemon/src/lib.rs index 7cd28ca..6ceb271 100644 --- a/app/daemon/src/lib.rs +++ b/app/daemon/src/lib.rs @@ -5,7 +5,6 @@ pub mod channel; pub mod config; mod feature; pub mod gateway; -pub mod provider; pub mod utils; pub use channel::router::{ChannelRouter, RoutingRule}; diff --git a/app/provider/Cargo.toml b/app/provider/Cargo.toml new file mode 100644 index 0000000..556cf32 --- /dev/null +++ b/app/provider/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "walrus-provider" +version.workspace = true +edition.workspace = true +authors.workspace = true +license.workspace = true +repository.workspace = true +keywords.workspace = true + +[dependencies] +llm = { workspace = true } +deepseek = { workspace = true } +openai = { workspace = true } +claude = { workspace = true } +mistral = { workspace = true } +compact_str = { workspace = true } +anyhow = { workspace = true } +tokio = { workspace = true } +serde = { workspace = true } +async-stream = { workspace = true } +futures-core = { workspace = true } +futures-util = { workspace = true } + +[dev-dependencies] +serde_json = { workspace = true } diff --git a/app/provider/src/config.rs b/app/provider/src/config.rs new file mode 100644 index 0000000..96df012 --- /dev/null +++ b/app/provider/src/config.rs @@ -0,0 +1,30 @@ +//! Provider configuration + +use crate::ProviderKind; +use compact_str::CompactString; +use serde::{Deserialize, Serialize}; + +/// Named provider configuration. Combines identity (`name`) with the fields +/// needed to construct a `Provider`. +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct ProviderConfig { + /// Unique name for this provider entry. Defaults to `"default"`. + #[serde(default = "default_name")] + pub name: CompactString, + /// Which LLM provider to use. + #[serde(default)] + pub provider: ProviderKind, + /// Model identifier. Not used by `build_provider()` — the caller passes + /// this to `General::model` when constructing requests. + pub model: CompactString, + /// API key (supports `${ENV_VAR}` expansion at the daemon layer). + #[serde(default)] + pub api_key: String, + /// Optional base URL override for the provider endpoint. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub base_url: Option, +} + +fn default_name() -> CompactString { + CompactString::const_new("default") +} diff --git a/app/provider/src/lib.rs b/app/provider/src/lib.rs new file mode 100644 index 0000000..f2cf14a --- /dev/null +++ b/app/provider/src/lib.rs @@ -0,0 +1,16 @@ +//! Provider crate — centralizes LLM provider enum dispatch, configuration, +//! construction, and runtime management. +//! +//! `Provider` enum wraps concrete backends (DeepSeek, OpenAI, Claude, Mistral) +//! behind a unified `LLM` impl. `ProviderManager` holds a named map of +//! providers with concurrent-safe active-provider swapping (DD#60, DD#65). + +mod config; +pub mod manager; +mod provider; + +pub use { + config::ProviderConfig, + manager::ProviderManager, + provider::{Provider, ProviderKind, build_provider}, +}; diff --git a/app/provider/src/manager.rs b/app/provider/src/manager.rs new file mode 100644 index 0000000..57eef3a --- /dev/null +++ b/app/provider/src/manager.rs @@ -0,0 +1,151 @@ +//! `ProviderManager` — concurrent-safe named provider map with active-provider +//! swapping (DD#65). + +use crate::{Provider, ProviderConfig, build_provider}; +use anyhow::{Result, bail}; +use compact_str::CompactString; +use std::collections::BTreeMap; +use std::sync::{Arc, RwLock}; + +/// Manages a set of named providers with an active selection. +/// +/// All methods that read or mutate the inner state acquire the `RwLock`. +/// `active()` returns a clone of the current `Provider` — callers do not +/// hold the lock while performing LLM calls. +pub struct ProviderManager { + inner: Arc>, +} + +struct Inner { + /// Named provider instances. + providers: BTreeMap, + /// Name of the currently active provider. + active: CompactString, + /// Shared HTTP client for constructing new providers. + client: llm::Client, +} + +/// Info about a single provider entry returned by `list()`. +#[derive(Debug, Clone)] +pub struct ProviderEntry { + /// Provider name. + pub name: CompactString, + /// Whether this is the active provider. + pub active: bool, +} + +impl ProviderManager { + /// Create a new manager from a list of provider configs. + /// + /// The first config in the list becomes the active provider. Returns an + /// error if the list is empty or any provider fails to build. + pub fn from_configs(configs: &[ProviderConfig]) -> Result { + if configs.is_empty() { + bail!("at least one provider config is required"); + } + + let client = llm::Client::new(); + let mut providers = BTreeMap::new(); + let active = configs[0].name.clone(); + + for config in configs { + let provider = build_provider(config, client.clone())?; + providers.insert(config.name.clone(), provider); + } + + Ok(Self { + inner: Arc::new(RwLock::new(Inner { + providers, + active, + client, + })), + }) + } + + /// Create a manager with a single provider. + pub fn single(name: CompactString, provider: Provider) -> Self { + let mut providers = BTreeMap::new(); + providers.insert(name.clone(), provider); + Self { + inner: Arc::new(RwLock::new(Inner { + providers, + active: name, + client: llm::Client::new(), + })), + } + } + + /// Get a clone of the active provider. + pub fn active(&self) -> Provider { + let inner = self.inner.read().expect("provider lock poisoned"); + inner.providers[&inner.active].clone() + } + + /// Get the name of the active provider. + pub fn active_name(&self) -> CompactString { + let inner = self.inner.read().expect("provider lock poisoned"); + inner.active.clone() + } + + /// Switch to a different provider by name. Returns an error if the name + /// is not found. + pub fn switch(&self, name: &str) -> Result<()> { + let mut inner = self.inner.write().expect("provider lock poisoned"); + if !inner.providers.contains_key(name) { + bail!("provider '{}' not found", name); + } + inner.active = CompactString::from(name); + Ok(()) + } + + /// Add a new provider. Replaces any existing provider with the same name. + pub fn add(&self, config: &ProviderConfig) -> Result<()> { + let mut inner = self.inner.write().expect("provider lock poisoned"); + let provider = build_provider(config, inner.client.clone())?; + inner.providers.insert(config.name.clone(), provider); + Ok(()) + } + + /// Remove a provider by name. Fails if the provider is currently active. + pub fn remove(&self, name: &str) -> Result<()> { + let mut inner = self.inner.write().expect("provider lock poisoned"); + if inner.active == name { + bail!("cannot remove the active provider '{}'", name); + } + if inner.providers.remove(name).is_none() { + bail!("provider '{}' not found", name); + } + Ok(()) + } + + /// List all providers with their active status. + pub fn list(&self) -> Vec { + let inner = self.inner.read().expect("provider lock poisoned"); + inner + .providers + .keys() + .map(|name| ProviderEntry { + name: name.clone(), + active: *name == inner.active, + }) + .collect() + } +} + +impl std::fmt::Debug for ProviderManager { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let inner = self.inner.read().expect("provider lock poisoned"); + f.debug_struct("ProviderManager") + .field("active", &inner.active) + .field("count", &inner.providers.len()) + .finish() + } +} + +impl Clone for ProviderManager { + fn clone(&self) -> Self { + Self { + inner: Arc::clone(&self.inner), + } + } +} diff --git a/app/daemon/src/provider.rs b/app/provider/src/provider.rs similarity index 51% rename from app/daemon/src/provider.rs rename to app/provider/src/provider.rs index 2c17f9d..67ce8a2 100644 --- a/app/daemon/src/provider.rs +++ b/app/provider/src/provider.rs @@ -1,10 +1,6 @@ -//! Provider enum for runtime dispatch across LLM backends. -//! -//! Follows the same enum dispatch pattern as `MemoryBackend` (DD#22). -//! Each variant wraps a concrete provider. `impl LLM` delegates to the -//! inner provider, converting `General` config to the variant's native -//! request format via `From`. +//! Provider implementation +use crate::config::ProviderConfig; use anyhow::Result; use async_stream::try_stream; use claude::Claude; @@ -14,11 +10,35 @@ use futures_util::StreamExt; use llm::{General, LLM, Message, Response, StreamChunk}; use mistral::Mistral; use openai::OpenAI; +use serde::{Deserialize, Serialize}; + +/// Supported LLM provider kinds. +#[derive(Debug, Default, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)] +#[serde(rename_all = "snake_case")] +pub enum ProviderKind { + /// DeepSeek API (default). + #[default] + DeepSeek, + /// OpenAI API. + OpenAI, + /// Grok (xAI) API — OpenAI-compatible. + Grok, + /// Qwen (Alibaba DashScope) API — OpenAI-compatible. + Qwen, + /// Kimi (Moonshot) API — OpenAI-compatible. + Kimi, + /// Ollama local API — OpenAI-compatible, no key required. + Ollama, + /// Claude (Anthropic) Messages API. + Claude, + /// Mistral chat completions API. + Mistral, +} /// Unified LLM provider enum. /// /// The gateway constructs the appropriate variant based on `ProviderKind` -/// in `LlmConfig`. The runtime is monomorphized on `Provider`. +/// in config. The runtime is monomorphized on `Provider`. #[derive(Clone)] pub enum Provider { /// DeepSeek API. @@ -31,6 +51,50 @@ pub enum Provider { Mistral(Mistral), } +/// Construct a `Provider` from config and a shared HTTP client. +/// +/// `ProviderKind::DeepSeek` with a custom `base_url` maps to the OpenAI +/// variant (OpenAI-compatible endpoint). Same for Grok, Qwen, Kimi, Ollama +/// with custom URLs. +pub fn build_provider(config: &ProviderConfig, client: llm::Client) -> Result { + let key = &config.api_key; + let provider = match config.provider { + ProviderKind::DeepSeek => match &config.base_url { + Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), + None => Provider::DeepSeek(DeepSeek::new(client, key)?), + }, + ProviderKind::OpenAI => match &config.base_url { + Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), + None => Provider::OpenAI(OpenAI::api(client, key)?), + }, + ProviderKind::Grok => match &config.base_url { + Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), + None => Provider::OpenAI(OpenAI::grok(client, key)?), + }, + ProviderKind::Qwen => match &config.base_url { + Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), + None => Provider::OpenAI(OpenAI::qwen(client, key)?), + }, + ProviderKind::Kimi => match &config.base_url { + Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), + None => Provider::OpenAI(OpenAI::kimi(client, key)?), + }, + ProviderKind::Ollama => match &config.base_url { + Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), + None => Provider::OpenAI(OpenAI::ollama(client)?), + }, + ProviderKind::Claude => match &config.base_url { + Some(url) => Provider::Claude(Claude::custom(client, key, url)?), + None => Provider::Claude(Claude::anthropic(client, key)?), + }, + ProviderKind::Mistral => match &config.base_url { + Some(url) => Provider::Mistral(Mistral::custom(client, key, url)?), + None => Provider::Mistral(Mistral::api(client, key)?), + }, + }; + Ok(provider) +} + impl LLM for Provider { type ChatConfig = General; diff --git a/app/provider/tests/build_provider.rs b/app/provider/tests/build_provider.rs new file mode 100644 index 0000000..17e5aa8 --- /dev/null +++ b/app/provider/tests/build_provider.rs @@ -0,0 +1,81 @@ +//! Tests for `build_provider()` factory. + +use walrus_provider::{ProviderConfig, ProviderKind, Provider, build_provider}; + +#[test] +fn test_build_provider_deepseek_default() { + let config = ProviderConfig { + name: "ds".into(), + provider: ProviderKind::DeepSeek, + model: "deepseek-chat".into(), + api_key: "test-key".to_string(), + base_url: None, + }; + let p = build_provider(&config, llm::Client::new()).unwrap(); + assert!(matches!(p, Provider::DeepSeek(_))); +} + +#[test] +fn test_build_provider_openai_custom_url() { + let config = ProviderConfig { + name: "oai".into(), + provider: ProviderKind::OpenAI, + model: "gpt-4o".into(), + api_key: "test-key".to_string(), + base_url: Some("http://localhost:8080/v1".to_string()), + }; + let p = build_provider(&config, llm::Client::new()).unwrap(); + assert!(matches!(p, Provider::OpenAI(_))); +} + +#[test] +fn test_build_provider_ollama_no_key() { + let config = ProviderConfig { + name: "ollama".into(), + provider: ProviderKind::Ollama, + model: "llama3".into(), + api_key: String::new(), + base_url: None, + }; + let p = build_provider(&config, llm::Client::new()).unwrap(); + assert!(matches!(p, Provider::OpenAI(_))); +} + +#[test] +fn test_build_provider_claude_default() { + let config = ProviderConfig { + name: "claude".into(), + provider: ProviderKind::Claude, + model: "claude-sonnet-4-6".into(), + api_key: "test-key".to_string(), + base_url: None, + }; + let p = build_provider(&config, llm::Client::new()).unwrap(); + assert!(matches!(p, Provider::Claude(_))); +} + +#[test] +fn test_build_provider_mistral_default() { + let config = ProviderConfig { + name: "mistral".into(), + provider: ProviderKind::Mistral, + model: "mistral-small-latest".into(), + api_key: "test-key".to_string(), + base_url: None, + }; + let p = build_provider(&config, llm::Client::new()).unwrap(); + assert!(matches!(p, Provider::Mistral(_))); +} + +#[test] +fn test_build_provider_mistral_custom_endpoint() { + let config = ProviderConfig { + name: "mistral-local".into(), + provider: ProviderKind::Mistral, + model: "mistral-small-latest".into(), + api_key: "test-key".to_string(), + base_url: Some("http://localhost:8080/v1/chat/completions".to_string()), + }; + let p = build_provider(&config, llm::Client::new()).unwrap(); + assert!(matches!(p, Provider::Mistral(_))); +} diff --git a/app/provider/tests/config.rs b/app/provider/tests/config.rs new file mode 100644 index 0000000..c529e91 --- /dev/null +++ b/app/provider/tests/config.rs @@ -0,0 +1,26 @@ +//! Tests for `ProviderConfig`. + +use walrus_provider::ProviderConfig; + +#[test] +fn test_provider_config_default_name() { + let json = r#"{"model": "gpt-4o", "api_key": "key"}"#; + let config: ProviderConfig = serde_json::from_str(json).unwrap(); + assert_eq!(config.name.as_str(), "default"); +} + +#[test] +fn test_provider_config_custom_name() { + let json = r#"{"name": "prod", "model": "gpt-4o", "api_key": "key"}"#; + let config: ProviderConfig = serde_json::from_str(json).unwrap(); + assert_eq!(config.name.as_str(), "prod"); +} + +#[test] +fn test_provider_config_roundtrip() { + let json = r#"{"name":"test","provider":"mistral","model":"mistral-small","api_key":"k"}"#; + let config: ProviderConfig = serde_json::from_str(json).unwrap(); + assert_eq!(config.name.as_str(), "test"); + assert_eq!(config.provider, walrus_provider::ProviderKind::Mistral); + assert_eq!(config.model.as_str(), "mistral-small"); +} diff --git a/app/provider/tests/manager.rs b/app/provider/tests/manager.rs new file mode 100644 index 0000000..96f658a --- /dev/null +++ b/app/provider/tests/manager.rs @@ -0,0 +1,119 @@ +//! Tests for `ProviderManager`. + +use walrus_provider::{ProviderConfig, ProviderKind, ProviderManager}; + +fn test_configs() -> Vec { + vec![ + ProviderConfig { + name: "primary".into(), + provider: ProviderKind::DeepSeek, + model: "deepseek-chat".into(), + api_key: "key1".to_string(), + base_url: None, + }, + ProviderConfig { + name: "secondary".into(), + provider: ProviderKind::OpenAI, + model: "gpt-4o".into(), + api_key: "key2".to_string(), + base_url: None, + }, + ] +} + +#[test] +fn test_manager_add_and_switch() { + let configs = test_configs(); + let manager = ProviderManager::from_configs(&configs).unwrap(); + + // First config is active by default. + assert_eq!(manager.active_name().as_str(), "primary"); + + // Switch to secondary. + manager.switch("secondary").unwrap(); + assert_eq!(manager.active_name().as_str(), "secondary"); + + // Add a third provider and switch to it. + let third = ProviderConfig { + name: "third".into(), + provider: ProviderKind::Claude, + model: "claude-sonnet-4-6".into(), + api_key: "key3".to_string(), + base_url: None, + }; + manager.add(&third).unwrap(); + manager.switch("third").unwrap(); + assert_eq!(manager.active_name().as_str(), "third"); +} + +#[test] +fn test_manager_remove_active_fails() { + let configs = test_configs(); + let manager = ProviderManager::from_configs(&configs).unwrap(); + + let result = manager.remove("primary"); + assert!(result.is_err()); + assert!( + result + .unwrap_err() + .to_string() + .contains("cannot remove the active provider") + ); +} + +#[test] +fn test_manager_remove_inactive() { + let configs = test_configs(); + let manager = ProviderManager::from_configs(&configs).unwrap(); + + manager.remove("secondary").unwrap(); + let entries = manager.list(); + assert_eq!(entries.len(), 1); + assert_eq!(entries[0].name.as_str(), "primary"); +} + +#[test] +fn test_manager_list_shows_active() { + let configs = test_configs(); + let manager = ProviderManager::from_configs(&configs).unwrap(); + + let entries = manager.list(); + assert_eq!(entries.len(), 2); + + let primary = entries.iter().find(|e| e.name == "primary").unwrap(); + let secondary = entries.iter().find(|e| e.name == "secondary").unwrap(); + assert!(primary.active); + assert!(!secondary.active); +} + +#[test] +fn test_manager_switch_unknown_fails() { + let configs = test_configs(); + let manager = ProviderManager::from_configs(&configs).unwrap(); + + let result = manager.switch("nonexistent"); + assert!(result.is_err()); + assert!(result.unwrap_err().to_string().contains("not found")); +} + +#[test] +fn test_manager_remove_unknown_fails() { + let configs = test_configs(); + let manager = ProviderManager::from_configs(&configs).unwrap(); + + let result = manager.remove("nonexistent"); + assert!(result.is_err()); + assert!(result.unwrap_err().to_string().contains("not found")); +} + +#[test] +fn test_manager_empty_configs_fails() { + let result = ProviderManager::from_configs(&[]); + assert!(result.is_err()); + assert!( + result + .unwrap_err() + .to_string() + .contains("at least one provider") + ); +} diff --git a/crates/runtime/examples/common/mod.rs b/crates/runtime/examples/common/mod.rs index 61b2d4d..540d22f 100644 --- a/crates/runtime/examples/common/mod.rs +++ b/crates/runtime/examples/common/mod.rs @@ -3,7 +3,6 @@ #![allow(dead_code)] use deepseek::DeepSeek; -use llm::LLM; use walrus_runtime::{DEFAULT_COMPACT_PROMPT, DEFAULT_FLUSH_PROMPT, Hook, Memory, prelude::*}; /// Example hook wiring DeepSeek as the LLM provider. From 0f4b7584d88512780f74aad89f3044bea4ee047f Mon Sep 17 00:00:00 2001 From: clearloop Date: Sat, 28 Feb 2026 13:49:03 +0800 Subject: [PATCH 2/8] feat(llm): support local llms --- Cargo.lock | 6913 ++++++++++++++++++++++---- Cargo.toml | 3 +- app/daemon/src/config.rs | 53 +- app/daemon/src/gateway/builder.rs | 16 +- app/daemon/tests/backend.rs | 1 + app/daemon/tests/config.rs | 86 +- app/provider/Cargo.toml | 7 +- app/provider/src/config.rs | 159 +- app/provider/src/lib.rs | 10 +- app/provider/src/manager.rs | 12 +- app/provider/src/provider.rs | 155 +- app/provider/tests/build_provider.rs | 80 +- app/provider/tests/config.rs | 67 +- app/provider/tests/manager.rs | 70 +- llm/{mistral => local}/Cargo.toml | 17 +- llm/local/src/lib.rs | 52 + llm/local/src/provider.rs | 244 + llm/mistral/src/lib.rs | 52 - llm/mistral/src/provider.rs | 65 - llm/mistral/src/request.rs | 224 - llm/mistral/tests/constructors.rs | 18 - 21 files changed, 6649 insertions(+), 1655 deletions(-) rename llm/{mistral => local}/Cargo.toml (53%) create mode 100644 llm/local/src/lib.rs create mode 100644 llm/local/src/provider.rs delete mode 100644 llm/mistral/src/lib.rs delete mode 100644 llm/mistral/src/provider.rs delete mode 100644 llm/mistral/src/request.rs delete mode 100644 llm/mistral/tests/constructors.rs diff --git a/Cargo.lock b/Cargo.lock index 135de6b..2e83c0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,42 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "accelerate-src" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415ed64958754dbe991900f3940677e6a7eefb4d7367afd70d642677b0c7d19d" + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "serde", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.4" @@ -11,6 +47,36 @@ dependencies = [ "memchr", ] +[[package]] +name = "akin" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1763692fc1416554cf051efc56a3de5595eca47299d731cc5c2b583adf8b4d2f" + +[[package]] +name = "aligned" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685" +dependencies = [ + "as-slice", +] + +[[package]] +name = "aligned-vec" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b" +dependencies = [ + "equator", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -20,6 +86,17 @@ dependencies = [ "libc", ] +[[package]] +name = "annotate-snippets" +version = "0.12.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c86cd1c51b95d71dde52bca69ed225008f6ff4c8cc825b08042aa1ef823e1980" +dependencies = [ + "anstyle", + "memchr", + "unicode-width", +] + [[package]] name = "anstream" version = "0.6.21" @@ -76,6 +153,65 @@ version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +[[package]] +name = "apodize" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fca387cdc0a1f9c7a7c26556d584aa2d07fc529843082e4861003cde4ab914ed" + +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" + +[[package]] +name = "arg_enum_proc_macro" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "arraydeque" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "as-any" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0f477b951e452a0b6b4a10b53ccd569042d1d01729b519e02074a9c0958a063" + +[[package]] +name = "as-slice" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" +dependencies = [ + "stable_deref_trait", +] + [[package]] name = "async-stream" version = "0.3.6" @@ -95,7 +231,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] @@ -106,7 +242,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] @@ -122,1581 +258,5227 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bitflags" -version = "2.10.0" +name = "av-scenechange" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394" +dependencies = [ + "aligned", + "anyhow", + "arg_enum_proc_macro", + "arrayvec", + "log", + "num-rational", + "num-traits", + "pastey 0.1.1", + "rayon", + "thiserror 2.0.18", + "v_frame", + "y4m", +] [[package]] -name = "bumpalo" -version = "3.19.1" +name = "av1-grain" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" +checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8" +dependencies = [ + "anyhow", + "arrayvec", + "log", + "nom 8.0.0", + "num-rational", + "v_frame", +] [[package]] -name = "bytes" -version = "1.11.0" +name = "avif-serialize" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +checksum = "375082f007bd67184fb9c0374614b29f9aaa604ec301635f72338bb65386a53d" +dependencies = [ + "arrayvec", +] [[package]] -name = "castaway" -version = "0.2.4" +name = "aws-lc-rs" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +checksum = "d9a7b350e3bb1767102698302bc37256cbd48422809984b98d292c40e2579aa9" dependencies = [ - "rustversion", + "aws-lc-sys", + "zeroize", ] [[package]] -name = "cc" -version = "1.2.49" +name = "aws-lc-sys" +version = "0.37.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" +checksum = "b092fe214090261288111db7a2b2c2118e5a7f30dc2569f1732c4069a6840549" dependencies = [ - "find-msvc-tools", - "shlex", + "cc", + "cmake", + "dunce", + "fs_extra", ] [[package]] -name = "cfg-if" -version = "1.0.4" +name = "base64" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] -name = "cfg_aliases" -version = "0.2.1" +name = "base64" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] -name = "chrono" -version = "0.4.44" +name = "bit-set" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" dependencies = [ - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-link", + "bit-vec 0.6.3", ] [[package]] -name = "clap" -version = "4.5.60" +name = "bit-set" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ - "clap_builder", - "clap_derive", + "bit-vec 0.8.0", ] [[package]] -name = "clap_builder" -version = "4.5.60" +name = "bit-vec" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] -name = "clap_derive" -version = "4.5.55" +name = "bit-vec" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] -name = "clap_lex" -version = "1.0.0" +name = "bit_field" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" +checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" [[package]] -name = "clipboard-win" -version = "5.4.1" +name = "bitflags" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" -dependencies = [ - "error-code", -] +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "colorchoice" -version = "1.0.4" +name = "bitflags" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] -name = "compact_str" -version = "0.8.1" +name = "bitstream-io" +version = "4.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b79c4069c6cad78e2e0cdfcbd26275770669fb39fd308a752dc110e83b9af32" +checksum = "60d4bd9d1db2c6bdf285e223a7fa369d5ce98ec767dec949c6ca62863ce61757" dependencies = [ - "castaway", - "cfg-if", - "itoa", - "rustversion", - "ryu", - "serde", - "static_assertions", + "core2", ] [[package]] -name = "core-foundation" -version = "0.9.4" +name = "block" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] -name = "core-foundation-sys" -version = "0.8.7" +name = "block-buffer" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] [[package]] -name = "cron" -version = "0.15.0" +name = "block2" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5877d3fbf742507b66bc2a1945106bd30dd8504019d596901ddd012a4dd01740" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" dependencies = [ - "chrono", - "once_cell", - "winnow 0.6.26", + "objc2", ] [[package]] -name = "darling" -version = "0.23.0" +name = "bm25" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +checksum = "1cbd8ffdfb7b4c2ff038726178a780a94f90525ed0ad264c0afaa75dd8c18a64" dependencies = [ - "darling_core", - "darling_macro", + "cached", + "deunicode", + "fxhash", + "rust-stemmers", + "stop-words", + "unicode-segmentation", ] [[package]] -name = "darling_core" -version = "0.23.0" +name = "bstr" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" dependencies = [ - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", + "memchr", + "regex-automata", + "serde", ] [[package]] -name = "darling_macro" -version = "0.23.0" +name = "built" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" -dependencies = [ - "darling_core", - "quote", - "syn", -] +checksum = "f4ad8f11f288f48ca24471bbd51ac257aaeaaa07adae295591266b792902ae64" [[package]] -name = "dirs" -version = "6.0.0" +name = "bumpalo" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" -dependencies = [ - "dirs-sys", -] +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] -name = "dirs-sys" -version = "0.5.0" +name = "bytemuck" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.61.2", + "bytemuck_derive", ] [[package]] -name = "displaydoc" -version = "0.2.5" +name = "bytemuck_derive" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] -name = "dotenvy" -version = "0.15.7" +name = "byteorder" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] -name = "dyn-clone" -version = "1.0.20" +name = "byteorder-lite" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] -name = "encoding_rs" -version = "0.8.35" +name = "bytes" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" + +[[package]] +name = "cached" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801927ee168e17809ab8901d9f01f700cd7d8d6a6527997fee44e4b0327a253c" dependencies = [ - "cfg-if", + "ahash", + "cached_proc_macro", + "cached_proc_macro_types", + "hashbrown 0.15.5", + "once_cell", + "thiserror 2.0.18", + "web-time", ] [[package]] -name = "endian-type" -version = "0.1.2" +name = "cached_proc_macro" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +checksum = "9225bdcf4e4a9a4c08bf16607908eb2fbf746828d5e0b5e019726dbf6571f201" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] [[package]] -name = "equivalent" -version = "1.0.2" +name = "cached_proc_macro_types" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +checksum = "ade8366b8bd5ba243f0a58f036cc0ca8a2f069cff1a2351ef1cac6b083e16fc0" [[package]] -name = "errno" -version = "0.3.14" +name = "candle-core" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +checksum = "c15b675b80d994b2eadb20a4bbe434eabeb454eac3ee5e2b4cf6f147ee9be091" dependencies = [ + "accelerate-src", + "byteorder", + "candle-metal-kernels", + "candle-ug", + "float8", + "gemm 0.19.0", + "half", "libc", - "windows-sys 0.61.2", + "libm", + "memmap2", + "num-traits", + "num_cpus", + "objc2-foundation", + "objc2-metal", + "rand 0.9.2", + "rand_distr 0.5.1", + "rayon", + "safetensors 0.7.0", + "thiserror 2.0.18", + "yoke 0.8.1", + "zip", ] [[package]] -name = "error-code" -version = "3.3.2" +name = "candle-metal-kernels" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59" +checksum = "2fdfe9d06de16ce49961e49084e5b79a75a9bdf157246e7c7b6328e87a7aa25d" +dependencies = [ + "half", + "objc2", + "objc2-foundation", + "objc2-metal", + "once_cell", + "thiserror 2.0.18", + "tracing", +] [[package]] -name = "fallible-iterator" -version = "0.3.0" +name = "candle-nn" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" +checksum = "3045fa9e7aef8567d209a27d56b692f60b96f4d0569f4c3011f8ca6715c65e03" +dependencies = [ + "accelerate-src", + "candle-core", + "candle-metal-kernels", + "half", + "libc", + "num-traits", + "objc2-metal", + "rayon", + "safetensors 0.7.0", + "serde", + "thiserror 2.0.18", +] [[package]] -name = "fallible-streaming-iterator" -version = "0.1.9" +name = "candle-ug" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" +checksum = "c22d62be69068bf58987a45f690612739d8d2ea1bf508c1b87dc6815a019575d" +dependencies = [ + "ug", + "ug-metal", +] [[package]] -name = "fastrand" -version = "2.3.0" +name = "castaway" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] [[package]] -name = "fd-lock" -version = "4.0.4" +name = "cc" +version = "1.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" +checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" dependencies = [ - "cfg-if", - "rustix", - "windows-sys 0.52.0", + "find-msvc-tools", + "jobserver", + "libc", + "shlex", ] [[package]] -name = "find-msvc-tools" -version = "0.1.5" +name = "cesu8" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" [[package]] -name = "fnv" -version = "1.0.7" +name = "cfg-if" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] -name = "foldhash" -version = "0.1.5" +name = "cfg_aliases" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] -name = "foreign-types" -version = "0.3.2" +name = "cfgrammar" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +checksum = "3efdd8f0bddcc9e33f4a664d0f28bc4e51cd5367c16284087a95313104371865" dependencies = [ - "foreign-types-shared", + "indexmap 2.13.0", + "num-traits", + "proc-macro2", + "quote", + "regex", + "vob", ] [[package]] -name = "foreign-types-shared" -version = "0.1.1" +name = "chrono" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link 0.2.1", +] [[package]] -name = "form_urlencoded" -version = "1.2.2" +name = "clap" +version = "4.5.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" dependencies = [ - "percent-encoding", + "clap_builder", + "clap_derive", ] [[package]] -name = "futures" -version = "0.3.31" +name = "clap_builder" +version = "4.5.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", + "anstream", + "anstyle", + "clap_lex", + "strsim 0.11.1", + "terminal_size", ] [[package]] -name = "futures-channel" -version = "0.3.31" +name = "clap_derive" +version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" dependencies = [ - "futures-core", - "futures-sink", + "heck", + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] -name = "futures-core" -version = "0.3.31" +name = "clap_lex" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" [[package]] -name = "futures-executor" -version = "0.3.31" +name = "clipboard-win" +version = "5.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" dependencies = [ - "futures-core", - "futures-task", - "futures-util", + "error-code", ] [[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-macro" -version = "0.3.31" +name = "cmake" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "75443c44cd6b379beb8c5b45d85d0773baf31cce901fe7bb252f4eff3008ef7d" dependencies = [ - "proc-macro2", - "quote", - "syn", + "cc", ] [[package]] -name = "futures-sink" -version = "0.3.31" +name = "color_quant" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] -name = "futures-task" -version = "0.3.31" +name = "colorchoice" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] -name = "futures-util" -version = "0.3.31" +name = "combine" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", + "bytes", "memchr", - "pin-project-lite", - "pin-utils", - "slab", ] [[package]] -name = "getrandom" -version = "0.2.16" +name = "compact_str" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "3b79c4069c6cad78e2e0cdfcbd26275770669fb39fd308a752dc110e83b9af32" dependencies = [ + "castaway", "cfg-if", - "libc", - "wasi", + "itoa", + "rustversion", + "ryu", + "serde", + "static_assertions", ] [[package]] -name = "getrandom" -version = "0.3.4" +name = "compact_str" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +checksum = "3fdb1325a1cece981e8a296ab8f0f9b63ae357bd0784a9faaf548cc7b480707a" dependencies = [ + "castaway", "cfg-if", - "libc", - "r-efi", - "wasip2", + "itoa", + "rustversion", + "ryu", + "serde", + "static_assertions", ] [[package]] -name = "h2" -version = "0.4.12" +name = "console" +version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" +checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", + "encode_unicode", + "libc", + "once_cell", + "unicode-width", + "windows-sys 0.59.0", ] [[package]] -name = "hashbrown" -version = "0.15.5" +name = "console" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +checksum = "03e45a4a8926227e4197636ba97a9fc9b00477e9f4bd711395687c5f0734bec4" dependencies = [ - "foldhash", + "encode_unicode", + "libc", + "once_cell", + "unicode-width", + "windows-sys 0.61.2", ] [[package]] -name = "hashbrown" -version = "0.16.1" +name = "core-foundation" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] -name = "hashlink" -version = "0.10.0" +name = "core-foundation" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" dependencies = [ - "hashbrown 0.15.5", + "core-foundation-sys", + "libc", ] [[package]] -name = "heck" -version = "0.5.0" +name = "core-foundation-sys" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] -name = "home" -version = "0.5.12" +name = "core-graphics-types" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ - "windows-sys 0.61.2", + "bitflags 1.3.2", + "core-foundation 0.9.4", + "libc", ] [[package]] -name = "http" -version = "1.4.0" +name = "core2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" dependencies = [ - "bytes", - "itoa", + "memchr", ] [[package]] -name = "http-body" -version = "1.0.1" +name = "cpufeatures" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "bytes", - "http", + "libc", ] [[package]] -name = "http-body-util" -version = "0.1.3" +name = "crc32fast" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "pin-project-lite", + "cfg-if", ] [[package]] -name = "httparse" -version = "1.10.1" +name = "cron" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" +checksum = "5877d3fbf742507b66bc2a1945106bd30dd8504019d596901ddd012a4dd01740" +dependencies = [ + "chrono", + "once_cell", + "winnow 0.6.26", +] [[package]] -name = "hyper" -version = "1.8.1" +name = "crossbeam-deque" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ - "atomic-waker", - "bytes", - "futures-channel", - "futures-core", - "h2", - "http", - "http-body", - "httparse", - "itoa", - "pin-project-lite", - "pin-utils", - "smallvec", - "tokio", - "want", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] -name = "hyper-rustls" -version = "0.27.7" +name = "crossbeam-epoch" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "http", - "hyper", - "hyper-util", - "rustls", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", + "crossbeam-utils", ] [[package]] -name = "hyper-tls" -version = "0.6.0" +name = "crossbeam-utils" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] -name = "hyper-util" -version = "0.1.19" +name = "crossterm" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" +checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" dependencies = [ - "base64", - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "http", - "http-body", - "hyper", - "ipnet", + "bitflags 1.3.2", + "crossterm_winapi", "libc", - "percent-encoding", - "pin-project-lite", - "socket2", - "system-configuration", - "tokio", - "tower-service", - "tracing", - "windows-registry", + "mio 0.8.11", + "parking_lot", + "signal-hook", + "signal-hook-mio", + "winapi", ] [[package]] -name = "iana-time-zone" -version = "0.1.65" +name = "crossterm_winapi" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core", + "winapi", ] [[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" +name = "crunchy" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ - "cc", + "generic-array", + "typenum", ] [[package]] -name = "icu_collections" -version = "2.1.1" +name = "cssparser" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +checksum = "dae61cf9c0abb83bd659dab65b7e4e38d8236824c85f0f804f173567bda257d2" dependencies = [ - "displaydoc", - "potential_utf", - "yoke", - "zerofrom", - "zerovec", + "cssparser-macros", + "dtoa-short", + "itoa", + "phf", + "smallvec 1.15.1", ] [[package]] -name = "icu_locale_core" -version = "2.1.1" +name = "cssparser-macros" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", + "quote", + "syn 2.0.111", ] [[package]] -name = "icu_normalizer" -version = "2.1.1" +name = "csv" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +checksum = "52cd9d68cf7efc6ddfaaee42e7288d3a99d613d4b50f76ce9827ae0c6e14f938" dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", + "csv-core", + "itoa", + "ryu", + "serde_core", ] [[package]] -name = "icu_normalizer_data" -version = "2.1.1" +name = "csv-core" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" +checksum = "704a3c26996a80471189265814dbc2c257598b96b8a7feae2d31ace646bb9782" +dependencies = [ + "memchr", +] [[package]] -name = "icu_properties" -version = "2.1.2" +name = "darling" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +checksum = "dbffa8f8e38810422f320ca457a93cf1cd0056dc9c06c556b867558e0d471463" dependencies = [ - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", + "darling_core 0.11.0", + "darling_macro 0.11.0", ] [[package]] -name = "icu_properties_data" -version = "2.1.2" +name = "darling" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] [[package]] -name = "icu_provider" -version = "2.1.1" +name = "darling" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", + "darling_core 0.21.3", + "darling_macro 0.21.3", ] [[package]] -name = "ident_case" -version = "1.0.1" +name = "darling" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +dependencies = [ + "darling_core 0.23.0", + "darling_macro 0.23.0", +] [[package]] -name = "idna" -version = "1.1.0" +name = "darling_core" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +checksum = "06e172685d94b7b83800e3256a63261537b9d6129e10f21c8e13ddf9dba8c64d" dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.109", ] [[package]] -name = "idna_adapter" -version = "1.2.1" +name = "darling_core" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ - "icu_normalizer", - "icu_properties", + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.11.1", + "syn 2.0.111", ] [[package]] -name = "indexmap" -version = "2.12.1" +name = "darling_core" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" dependencies = [ - "equivalent", - "hashbrown 0.16.1", + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.11.1", + "syn 2.0.111", ] [[package]] -name = "ipnet" -version = "2.11.0" +name = "darling_core" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim 0.11.1", + "syn 2.0.111", +] [[package]] -name = "iri-string" -version = "0.7.9" +name = "darling_macro" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" +checksum = "f0618ac802792cebd1918ac6042a6ea1eeab92db34b35656afaa577929820788" dependencies = [ - "memchr", - "serde", + "darling_core 0.11.0", + "quote", + "syn 1.0.109", ] [[package]] -name = "is_terminal_polyfill" -version = "1.70.2" +name = "darling_macro" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.111", +] [[package]] -name = "itoa" -version = "1.0.15" +name = "darling_macro" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "js-sys" -version = "0.3.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "once_cell", - "wasm-bindgen", + "darling_core 0.21.3", + "quote", + "syn 2.0.111", ] [[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "libc" -version = "0.2.180" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" - -[[package]] -name = "libredox" -version = "0.1.12" +name = "darling_macro" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ - "bitflags", - "libc", + "darling_core 0.23.0", + "quote", + "syn 2.0.111", ] [[package]] -name = "libsqlite3-sys" -version = "0.32.0" +name = "dary_heap" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbb8270bb4060bd76c6e96f20c52d80620f1d82a3470885694e41e0f81ef6fe7" +checksum = "06d2e3287df1c007e74221c49ca10a95d557349e54b3a75dc2fb14712c751f04" dependencies = [ - "cc", - "pkg-config", - "vcpkg", + "serde", ] [[package]] -name = "linux-raw-sys" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" - -[[package]] -name = "litemap" -version = "0.8.1" +name = "data-encoding" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" +checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" [[package]] -name = "log" -version = "0.4.29" +name = "defmac" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" +checksum = "aafbece59594ed57696a1a69e8bb3ca1683fbc9cdb41d5c02726070b2cd8f19d" [[package]] -name = "matchers" -version = "0.2.0" +name = "deranged" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ - "regex-automata", + "powerfmt", + "serde_core", ] [[package]] -name = "memchr" -version = "2.7.6" +name = "derive-new" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "2cdc8d50f426189eef89dac62fabfa0abb27d5cc008f25bf4156a0203325becc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] [[package]] -name = "mime" -version = "0.3.17" +name = "derive_builder" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" +dependencies = [ + "derive_builder_macro", +] [[package]] -name = "mio" -version = "1.1.1" +name = "derive_builder_core" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ - "libc", - "wasi", - "windows-sys 0.61.2", + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] -name = "native-tls" -version = "0.2.14" +name = "derive_builder_macro" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", + "derive_builder_core", + "syn 2.0.111", ] [[package]] -name = "nibble_vec" -version = "0.1.0" +name = "derive_more" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ - "smallvec", + "derive_more-impl", ] [[package]] -name = "nix" -version = "0.29.0" +name = "derive_more-impl" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ - "bitflags", - "cfg-if", - "cfg_aliases", - "libc", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.111", ] [[package]] -name = "nix" -version = "0.31.1" +name = "derivre" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225e7cfe711e0ba79a68baeddb2982723e4235247aefce1482f2f16c27865b66" +checksum = "786c7c65c4ef0c7deb05de3005e01991612a8f09fe0844fc0969c68b90468ba8" dependencies = [ - "bitflags", - "cfg-if", - "cfg_aliases", - "libc", + "anyhow", + "bytemuck", + "bytemuck_derive", + "hashbrown 0.15.5", + "regex-syntax", + "strum", ] [[package]] -name = "nu-ansi-term" -version = "0.50.3" +name = "deunicode" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" -dependencies = [ - "windows-sys 0.61.2", -] +checksum = "abd57806937c9cc163efc8ea3910e00a62e2aeb0b8119f1793a978088f8f6b04" [[package]] -name = "num-traits" -version = "0.2.19" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "autocfg", + "block-buffer", + "crypto-common", ] [[package]] -name = "once_cell" -version = "1.21.3" +name = "dirs" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] [[package]] -name = "once_cell_polyfill" -version = "1.70.2" +name = "dirs-sys" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] [[package]] -name = "openssl" -version = "0.10.75" +name = "dispatch2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", + "bitflags 2.10.0", + "objc2", ] [[package]] -name = "openssl-macros" -version = "0.1.1" +name = "displaydoc" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] -name = "openssl-probe" -version = "0.1.6" +name = "doctest-file" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +checksum = "aac81fa3e28d21450aa4d2ac065992ba96a1d7303efbce51a95f4fd175b67562" [[package]] -name = "openssl-sys" -version = "0.9.111" +name = "dotenvy" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] -name = "option-ext" -version = "0.2.0" +name = "dtoa" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" [[package]] -name = "pastey" -version = "0.2.1" +name = "dtoa-short" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b867cad97c0791bbd3aaa6472142568c6c9e8f71937e98379f584cfb0cf35bec" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] [[package]] -name = "percent-encoding" -version = "2.3.2" +name = "dunce" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] -name = "pin-project-lite" -version = "0.2.16" +name = "dyn-clone" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" [[package]] -name = "pin-utils" -version = "0.1.0" +name = "dyn-stack" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "1c4713e43e2886ba72b8271aa66c93d722116acf7a75555cce11dcde84388fe8" +dependencies = [ + "bytemuck", + "dyn-stack-macros", +] [[package]] -name = "pkg-config" -version = "0.3.32" +name = "dyn-stack-macros" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" +checksum = "e1d926b4d407d372f141f93bb444696142c29d32962ccbd3531117cf3aa0bfa9" [[package]] -name = "potential_utf" -version = "0.1.4" +name = "ego-tree" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" -dependencies = [ - "zerovec", -] +checksum = "b2972feb8dffe7bc8c5463b1dacda1b0dfbed3710e50f977d965429692d74cd8" [[package]] -name = "proc-macro2" -version = "1.0.103" +name = "either" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" dependencies = [ - "unicode-ident", + "serde", ] [[package]] -name = "process-wrap" -version = "9.0.3" +name = "encode_unicode" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccd9713fe2c91c3c85ac388b31b89de339365d2c995146e630b5e0da9d06526a" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ - "futures", - "indexmap", - "nix 0.31.1", - "tokio", - "tracing", - "windows", + "cfg-if", ] [[package]] -name = "quote" -version = "1.0.42" +name = "encoding_rs_io" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "1cc3c5651fb62ab8aa3103998dade57efdd028544bd300516baa31840c252a83" dependencies = [ - "proc-macro2", + "encoding_rs", ] [[package]] -name = "r-efi" -version = "5.3.0" +name = "endian-type" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] -name = "radix_trie" -version = "0.2.1" +name = "endian-type" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" -dependencies = [ - "endian-type", - "nibble_vec", -] +checksum = "869b0adbda23651a9c5c0c3d270aac9fcb52e8622a8f2b17e57802d7791962f2" [[package]] -name = "redox_users" -version = "0.5.2" +name = "enum-as-inner" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" dependencies = [ - "getrandom 0.2.16", - "libredox", - "thiserror", + "heck", + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] -name = "ref-cast" -version = "1.0.25" +name = "equator" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc" dependencies = [ - "ref-cast-impl", + "equator-macro", +] + +[[package]] +name = "equator-macro" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "error-code" +version = "3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59" + +[[package]] +name = "esaxx-rs" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d817e038c30374a4bcb22f94d0a8a0e216958d4c3dcde369b1439fec4bdda6e6" + +[[package]] +name = "exr" +version = "1.74.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4300e043a56aa2cb633c01af81ca8f699a321879a7854d3896a0ba89056363be" +dependencies = [ + "bit_field", + "half", + "lebe", + "miniz_oxide", + "rayon-core", + "smallvec 1.15.1", + "zune-inflate", +] + +[[package]] +name = "extended" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af9673d8203fcb076b19dfd17e38b3d4ae9f44959416ea532ce72415a6020365" + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + +[[package]] +name = "fancy-regex" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "531e46835a22af56d1e3b66f04844bed63158bc094a628bec1d321d9b4c44bf2" +dependencies = [ + "bit-set 0.5.3", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "fancy-regex" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e24cb5a94bcae1e5408b0effca5cd7172ea3c5755049c5f3af4cd283a165298" +dependencies = [ + "bit-set 0.8.0", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "fax" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05de7d48f37cd6730705cbca900770cab77a89f413d23e100ad7fad7795a0ab" +dependencies = [ + "fax_derive", +] + +[[package]] +name = "fax_derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0aca10fb742cb43f9e7bb8467c91aa9bcb8e3ffbc6a6f7389bb93ffc920577d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "fd-lock" +version = "4.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" +dependencies = [ + "cfg-if", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "float8" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719a903cc23e4a89e87962c2a80fdb45cdaad0983a89bd150bb57b4c8571a7d5" +dependencies = [ + "half", + "num-traits", + "rand 0.9.2", + "rand_distr 0.5.1", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared 0.1.1", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared 0.3.1", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "galil-seiferas" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "794ac25cfda3fa11d2b07ff8c65889c6c03411646df54e59e606878d899e1d5a" +dependencies = [ + "defmac", + "unchecked-index", +] + +[[package]] +name = "gemm" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab96b703d31950f1aeddded248bc95543c9efc7ac9c4a21fda8703a83ee35451" +dependencies = [ + "dyn-stack", + "gemm-c32 0.18.2", + "gemm-c64 0.18.2", + "gemm-common 0.18.2", + "gemm-f16 0.18.2", + "gemm-f32 0.18.2", + "gemm-f64 0.18.2", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa0673db364b12263d103b68337a68fbecc541d6f6b61ba72fe438654709eacb" +dependencies = [ + "dyn-stack", + "gemm-c32 0.19.0", + "gemm-c64 0.19.0", + "gemm-common 0.19.0", + "gemm-f16 0.19.0", + "gemm-f32 0.19.0", + "gemm-f64 0.19.0", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-c32" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6db9fd9f40421d00eea9dd0770045a5603b8d684654816637732463f4073847" +dependencies = [ + "dyn-stack", + "gemm-common 0.18.2", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-c32" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "086936dbdcb99e37aad81d320f98f670e53c1e55a98bee70573e83f95beb128c" +dependencies = [ + "dyn-stack", + "gemm-common 0.19.0", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-c64" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfcad8a3d35a43758330b635d02edad980c1e143dc2f21e6fd25f9e4eada8edf" +dependencies = [ + "dyn-stack", + "gemm-common 0.18.2", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-c64" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c8aeeeec425959bda4d9827664029ba1501a90a0d1e6228e48bef741db3a3f" +dependencies = [ + "dyn-stack", + "gemm-common 0.19.0", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-common" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a352d4a69cbe938b9e2a9cb7a3a63b7e72f9349174a2752a558a8a563510d0f3" +dependencies = [ + "bytemuck", + "dyn-stack", + "half", + "libm", + "num-complex", + "num-traits", + "once_cell", + "paste", + "pulp 0.21.5", + "raw-cpuid", + "rayon", + "seq-macro", + "sysctl", +] + +[[package]] +name = "gemm-common" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88027625910cc9b1085aaaa1c4bc46bb3a36aad323452b33c25b5e4e7c8e2a3e" +dependencies = [ + "bytemuck", + "dyn-stack", + "half", + "libm", + "num-complex", + "num-traits", + "once_cell", + "paste", + "pulp 0.22.2", + "raw-cpuid", + "rayon", + "seq-macro", + "sysctl", +] + +[[package]] +name = "gemm-f16" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff95ae3259432f3c3410eaa919033cd03791d81cebd18018393dc147952e109" +dependencies = [ + "dyn-stack", + "gemm-common 0.18.2", + "gemm-f32 0.18.2", + "half", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "rayon", + "seq-macro", +] + +[[package]] +name = "gemm-f16" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3df7a55202e6cd6739d82ae3399c8e0c7e1402859b30e4cb780e61525d9486e" +dependencies = [ + "dyn-stack", + "gemm-common 0.19.0", + "gemm-f32 0.19.0", + "half", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "rayon", + "seq-macro", +] + +[[package]] +name = "gemm-f32" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc8d3d4385393304f407392f754cd2dc4b315d05063f62cf09f47b58de276864" +dependencies = [ + "dyn-stack", + "gemm-common 0.18.2", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-f32" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e0b8c9da1fbec6e3e3ab2ce6bc259ef18eb5f6f0d3e4edf54b75f9fd41a81c" +dependencies = [ + "dyn-stack", + "gemm-common 0.19.0", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-f64" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35b2a4f76ce4b8b16eadc11ccf2e083252d8237c1b589558a49b0183545015bd" +dependencies = [ + "dyn-stack", + "gemm-common 0.18.2", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-f64" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "056131e8f2a521bfab322f804ccd652520c79700d81209e9d9275bbdecaadc6a" +dependencies = [ + "dyn-stack", + "gemm-common 0.19.0", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getopts" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", + "wasip3", +] + +[[package]] +name = "gif" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5df2ba84018d80c213569363bdcd0c64e6933c67fe4c1d60ecf822971a3c35e" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "h2" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap 2.13.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "bytemuck", + "cfg-if", + "crunchy", + "num-traits", + "rand 0.9.2", + "rand_distr 0.5.1", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", + "serde", + "serde_core", +] + +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hf-hub" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "629d8f3bbeda9d148036d6b0de0a3ab947abd08ce90626327fc3547a49d59d97" +dependencies = [ + "dirs", + "futures", + "http", + "indicatif 0.17.11", + "libc", + "log", + "num_cpus", + "rand 0.9.2", + "reqwest 0.12.26", + "serde", + "serde_json", + "thiserror 2.0.18", + "tokio", + "ureq", + "windows-sys 0.60.2", +] + +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "hound" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f" + +[[package]] +name = "html2text" +version = "0.16.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12d23156ea4dbe6b37ad48fab2da56ff27b0f6192fb5db210c44eb07bfe6e787" +dependencies = [ + "html5ever 0.38.0", + "tendril 0.5.0", + "thiserror 2.0.18", + "unicode-width", +] + +[[package]] +name = "html5ever" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6452c4751a24e1b99c3260d505eaeee76a050573e61f30ac2c924ddc7236f01e" +dependencies = [ + "log", + "markup5ever 0.36.1", +] + +[[package]] +name = "html5ever" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1054432bae2f14e0061e33d23402fbaa67a921d319d56adc6bcf887ddad1cbc2" +dependencies = [ + "log", + "markup5ever 0.38.0", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec 1.15.1", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots 1.0.6", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke 0.8.1", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec 1.15.1", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke 0.8.1", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec 1.15.1", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6506c6c10786659413faa717ceebcb8f70731c0a60cbae39795fdf114519c1a" +dependencies = [ + "bytemuck", + "byteorder-lite", + "color_quant", + "exr", + "gif", + "image-webp", + "moxcms", + "num-traits", + "png", + "qoi", + "ravif", + "rayon", + "rgb", + "tiff", + "zune-core 0.5.1", + "zune-jpeg 0.5.12", +] + +[[package]] +name = "image-webp" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" +dependencies = [ + "byteorder-lite", + "quick-error", +] + +[[package]] +name = "imgref" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c5cedc30da3a610cac6b4ba17597bdf7152cf974e8aab3afb3d54455e371c8" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", + "serde", + "serde_core", +] + +[[package]] +name = "indicatif" +version = "0.17.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" +dependencies = [ + "console 0.15.11", + "number_prefix", + "portable-atomic", + "unicode-width", + "web-time", +] + +[[package]] +name = "indicatif" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25470f23803092da7d239834776d653104d551bc4d7eacaf31e6837854b8e9eb" +dependencies = [ + "console 0.16.2", + "portable-atomic", + "rayon", + "unicode-width", + "unit-prefix", + "web-time", +] + +[[package]] +name = "interpolate_name" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "interprocess" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6be5e5c847dbdb44564bd85294740d031f4f8aeb3464e5375ef7141f7538db69" +dependencies = [ + "doctest-file", + "libc", + "recvmsg", + "widestring", + "windows-sys 0.52.0", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "lebe" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8" + +[[package]] +name = "libc" +version = "0.2.180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" + +[[package]] +name = "libfuzzer-sys" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f12a681b7dd8ce12bff52488013ba614b869148d54dd79836ab85aafdd53f08d" +dependencies = [ + "arbitrary", + "cc", +] + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link 0.2.1", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" +dependencies = [ + "bitflags 2.10.0", + "libc", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbb8270bb4060bd76c6e96f20c52d80620f1d82a3470885694e41e0f81ef6fe7" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "llguidance" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6bd9b883ab54097b0651668e5b590be1c7ca906500db40d4de74522382e011" +dependencies = [ + "anyhow", + "derivre", + "indexmap 2.13.0", + "regex-syntax", + "serde", + "serde_json", + "toktrie", +] + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "loop9" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" +dependencies = [ + "imgref", +] + +[[package]] +name = "lrtable" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15ad6a43e5cff4ac046d51281d2256a36d1440065eab53ccce9362b48db5b42" +dependencies = [ + "cfgrammar", + "fnv", + "num-traits", + "sparsevec", + "vob", +] + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "macro_rules_attribute" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65049d7923698040cd0b1ddcced9b0eb14dd22c5f86ae59c3740eab64a676520" +dependencies = [ + "macro_rules_attribute-proc_macro", + "paste", +] + +[[package]] +name = "macro_rules_attribute-proc_macro" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670fdfda89751bc4a84ac13eaa63e205cf0fd22b4c9a5fbfa085b63c1f1d3a30" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "markup5ever" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c3294c4d74d0742910f8c7b466f44dda9eb2d5742c1e430138df290a1e8451c" +dependencies = [ + "log", + "tendril 0.4.3", + "web_atoms", +] + +[[package]] +name = "markup5ever" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8983d30f2915feeaaab2d6babdd6bc7e9ed1a00b66b5e6d74df19aa9c0e91862" +dependencies = [ + "log", + "tendril 0.5.0", + "web_atoms", +] + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matrixmultiply" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08" +dependencies = [ + "autocfg", + "rawpointer", +] + +[[package]] +name = "maybe-rayon" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" +dependencies = [ + "cfg-if", + "rayon", +] + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "memmap2" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3" +dependencies = [ + "libc", + "stable_deref_trait", +] + +[[package]] +name = "metal" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" +dependencies = [ + "bitflags 2.10.0", + "block", + "core-graphics-types", + "foreign-types 0.5.0", + "log", + "objc", + "paste", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minijinja" +version = "2.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c54f3bcc034dd74496b5ca929fd0b710186672d5ff0b0f255a9ceb259042ece" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "minijinja-contrib" +version = "2.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86201a560fde90bf270d3c9d5da0c2a5a0c25bd3242d674fcf03e6a35fcfa7ba" +dependencies = [ + "minijinja", + "serde", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "mistralrs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b94ffe881c76d6531a334c729743db91a255267a097e9b20b52f66d8531296d1" +dependencies = [ + "anyhow", + "candle-core", + "candle-nn", + "clap", + "either", + "futures", + "image", + "indexmap 2.13.0", + "mistralrs-core", + "mistralrs-macros", + "rand 0.9.2", + "reqwest 0.13.2", + "schemars 1.2.1", + "serde", + "serde_json", + "tokio", + "tracing", + "tracing-subscriber", + "walkdir", +] + +[[package]] +name = "mistralrs-audio" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a78dd99327fca9c2c59ac8e5aa0a922db076645e4b46a1dbe6cfbb9fe11443b" +dependencies = [ + "anyhow", + "apodize", + "hound", + "symphonia", +] + +[[package]] +name = "mistralrs-core" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fb8dc16443f611d7611c377e3239cd4c41fa4fbbcebdbd40dc80549436b125" +dependencies = [ + "ahash", + "akin", + "anyhow", + "apodize", + "as-any", + "async-trait", + "base64 0.22.1", + "bm25", + "bytemuck", + "bytemuck_derive", + "candle-core", + "candle-metal-kernels", + "candle-nn", + "cfgrammar", + "chrono", + "clap", + "csv", + "derive-new", + "derive_more", + "dirs", + "either", + "float8", + "futures", + "galil-seiferas", + "half", + "hashbrown 0.16.1", + "hf-hub", + "hound", + "html2text", + "http", + "image", + "indexmap 2.13.0", + "indicatif 0.18.4", + "interprocess", + "itertools", + "libc", + "llguidance", + "lrtable", + "minijinja", + "minijinja-contrib", + "mistralrs-audio", + "mistralrs-mcp", + "mistralrs-paged-attn", + "mistralrs-quant", + "mistralrs-vision", + "num-traits", + "objc", + "objc2-metal", + "openai-harmony", + "ordered-float", + "parking_lot", + "radix_trie 0.3.0", + "rand 0.9.2", + "rand_distr 0.5.1", + "rand_isaac", + "rayon", + "regex", + "regex-automata", + "reqwest 0.13.2", + "rubato", + "rust-mcp-schema", + "rustc-hash 2.1.1", + "rustfft", + "safetensors 0.7.0", + "schemars 1.2.1", + "scraper", + "serde", + "serde-big-array", + "serde-saphyr", + "serde_json", + "serde_plain", + "statrs", + "strum", + "symphonia", + "sysinfo", + "thiserror 2.0.18", + "tokenizers", + "tokio", + "tokio-rayon", + "tokio-tungstenite", + "toktrie_hf_tokenizers", + "toml 0.9.12+spec-1.1.0", + "tqdm", + "tracing", + "tracing-subscriber", + "urlencoding", + "uuid 1.21.0", + "variantly", + "vob", +] + +[[package]] +name = "mistralrs-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c4805bae591126918a68c86cb541498ee64e4a584451127e6044643f2fafc1b" +dependencies = [ + "darling 0.23.0", + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "mistralrs-mcp" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e82edad2da585a3ea817684856b3ffd6d8da2a4996e829c767de2a77c83c1b8" +dependencies = [ + "anyhow", + "async-trait", + "futures-util", + "http", + "reqwest 0.13.2", + "rust-mcp-schema", + "serde", + "serde_json", + "tokio", + "tokio-tungstenite", + "tracing", + "utoipa", + "uuid 1.21.0", +] + +[[package]] +name = "mistralrs-paged-attn" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6000b390e4a7b56a58fc7005ac721780edd6fd28e70cb6a138872dd3c700dda" +dependencies = [ + "anyhow", + "candle-core", + "candle-metal-kernels", + "float8", + "half", + "objc2-foundation", + "objc2-metal", + "thiserror 2.0.18", +] + +[[package]] +name = "mistralrs-quant" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9fb187f2c9397a73f2b00437f6bbedb4c556f1c06d13af2f8d35ec5543a00" +dependencies = [ + "byteorder", + "candle-core", + "candle-metal-kernels", + "candle-nn", + "float8", + "half", + "hf-hub", + "lazy_static", + "memmap2", + "objc2-foundation", + "objc2-metal", + "paste", + "rayon", + "regex", + "safetensors 0.7.0", + "serde", + "serde_json", + "thiserror 2.0.18", + "tokio", + "tracing", + "yoke 0.8.1", +] + +[[package]] +name = "mistralrs-vision" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d79247946a50fdac4300e80504bc6950e298a9c2e7e1a2bcd948fe91852b8a7b" +dependencies = [ + "candle-core", + "image", + "rayon", +] + +[[package]] +name = "monostate" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3341a273f6c9d5bef1908f17b7267bbab0e95c9bf69a0d4dcf8e9e1b2c76ef67" +dependencies = [ + "monostate-impl", + "serde", + "serde_core", +] + +[[package]] +name = "monostate-impl" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4db6d5580af57bf992f59068d4ea26fd518574ff48d7639b255a36f9de6e7e9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "moxcms" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac9557c559cd6fc9867e122e20d2cbefc9ca29d80d027a8e39310920ed2f0a97" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "nalgebra" +version = "0.33.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26aecdf64b707efd1310e3544d709c5c0ac61c13756046aaaba41be5c4f66a3b" +dependencies = [ + "approx", + "matrixmultiply", + "num-complex", + "num-rational", + "num-traits", + "rand 0.8.5", + "rand_distr 0.4.3", + "simba", + "typenum", +] + +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe 0.1.6", + "openssl-sys", + "schannel", + "security-framework 2.11.1", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec 1.15.1", +] + +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nix" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225e7cfe711e0ba79a68baeddb2982723e4235247aefce1482f2f16c27865b66" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "noop_proc_macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" + +[[package]] +name = "ntapi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" +dependencies = [ + "winapi", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "bytemuck", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "objc2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.10.0", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.10.0", + "block2", + "libc", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" +dependencies = [ + "libc", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags 2.10.0", + "block2", + "dispatch2", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "openai-harmony" +version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e77e82af451fc95deeb728a40b84db8ee82d341e136c268de415123a560b9b72" +dependencies = [ + "anyhow", + "base64 0.22.1", + "bstr", + "clap", + "fancy-regex 0.13.0", + "futures", + "image", + "regex", + "reqwest 0.12.26", + "rustc-hash 1.1.0", + "serde", + "serde_json", + "serde_with", + "sha1", + "sha2", + "thiserror 2.0.18", +] + +[[package]] +name = "openssl" +version = "0.10.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "foreign-types 0.3.2", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "openssl-sys" +version = "0.9.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "ordered-float" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4779c6901a562440c3786d08192c6fbda7c1c2060edd10006b05ee35d10f2d" +dependencies = [ + "num-traits", +] + +[[package]] +name = "packedvec" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69e0a534dd2e6aefce319af62a0aa0066a76bdfcec0201dfe02df226bc9ec70" +dependencies = [ + "num-traits", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec 1.15.1", + "windows-link 0.2.1", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pastey" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" + +[[package]] +name = "pastey" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b867cad97c0791bbd3aaa6472142568c6c9e8f71937e98379f584cfb0cf35bec" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.10.0", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "portable-atomic" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.111", +] + +[[package]] +name = "primal-check" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0d895b311e3af9902528fbb8f928688abbd95872819320517cc24ca6b2bd08" +dependencies = [ + "num-integer", +] + +[[package]] +name = "proc-macro2" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "process-wrap" +version = "9.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccd9713fe2c91c3c85ac388b31b89de339365d2c995146e630b5e0da9d06526a" +dependencies = [ + "futures", + "indexmap 2.13.0", + "nix 0.31.1", + "tokio", + "tracing", + "windows 0.62.2", +] + +[[package]] +name = "profiling" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773" +dependencies = [ + "profiling-procmacros", +] + +[[package]] +name = "profiling-procmacros" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52717f9a02b6965224f95ca2a81e2e0c5c43baacd28ca057577988930b6c3d5b" +dependencies = [ + "quote", + "syn 2.0.111", +] + +[[package]] +name = "pulp" +version = "0.21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b86df24f0a7ddd5e4b95c94fc9ed8a98f1ca94d3b01bdce2824097e7835907" +dependencies = [ + "bytemuck", + "cfg-if", + "libm", + "num-complex", + "reborrow", + "version_check", +] + +[[package]] +name = "pulp" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e205bb30d5b916c55e584c22201771bcf2bad9aabd5d4127f38387140c38632" +dependencies = [ + "bytemuck", + "cfg-if", + "libm", + "num-complex", + "paste", + "pulp-wasm-simd-flag", + "raw-cpuid", + "reborrow", + "version_check", +] + +[[package]] +name = "pulp-wasm-simd-flag" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40e24eee682d89fb193496edf918a7f407d30175b2e785fe057e4392dfd182e0" + +[[package]] +name = "pxfm" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7186d3822593aa4393561d186d1393b3923e9d6163d3fbfd6e825e3e6cf3e6a8" +dependencies = [ + "num-traits", +] + +[[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash 2.1.1", + "rustls", + "socket2", + "thiserror 2.0.18", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "aws-lc-rs", + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.2", + "ring", + "rustc-hash 2.1.1", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.18", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type 0.1.2", + "nibble_vec", +] + +[[package]] +name = "radix_trie" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b4431027dcd37fc2a73ef740b5f233aa805897935b8bce0195e41bbf9a3289a" +dependencies = [ + "endian-type 0.2.0", + "nibble_vec", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_distr" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "rand_distr" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8615d50dcf34fa31f7ab52692afec947c4dd0ab803cc87cb3b0b4570ff7463" +dependencies = [ + "num-traits", + "rand 0.9.2", +] + +[[package]] +name = "rand_isaac" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3382fc9f0aad4f2e2a56b53d9133c8c810b4dbf21e7e370e24346161a5b2c7bd" +dependencies = [ + "rand_core 0.9.5", +] + +[[package]] +name = "rav1e" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b" +dependencies = [ + "aligned-vec", + "arbitrary", + "arg_enum_proc_macro", + "arrayvec", + "av-scenechange", + "av1-grain", + "bitstream-io", + "built", + "cfg-if", + "interpolate_name", + "itertools", + "libc", + "libfuzzer-sys", + "log", + "maybe-rayon", + "new_debug_unreachable", + "noop_proc_macro", + "num-derive", + "num-traits", + "paste", + "profiling", + "rand 0.9.2", + "rand_chacha 0.9.0", + "simd_helpers", + "thiserror 2.0.18", + "v_frame", + "wasm-bindgen", +] + +[[package]] +name = "ravif" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef69c1990ceef18a116855938e74793a5f7496ee907562bd0857b6ac734ab285" +dependencies = [ + "avif-serialize", + "imgref", + "loop9", + "quick-error", + "rav1e", + "rayon", + "rgb", +] + +[[package]] +name = "raw-cpuid" +version = "11.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186" +dependencies = [ + "bitflags 2.10.0", +] + +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-cond" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2964d0cf57a3e7a06e8183d14a8b527195c706b7983549cd5462d5aa3747438f" +dependencies = [ + "either", + "itertools", + "rayon", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "realfft" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f821338fddb99d089116342c46e9f1fbf3828dba077674613e734e01d6ea8677" +dependencies = [ + "rustfft", +] + +[[package]] +name = "reborrow" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03251193000f4bd3b042892be858ee50e8b3719f2b08e5833ac4353724632430" + +[[package]] +name = "recvmsg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.10.0", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.16", + "libredox", + "thiserror 2.0.18", +] + +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", ] [[package]] name = "ref-cast-impl" version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "regex" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "reqwest" +version = "0.12.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b4c14b2d9afca6a60277086b0cc6a6ae0b568f6f7916c943a8cdc79f8be240f" +dependencies = [ + "base64 0.22.1", + "bytes", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "js-sys", + "log", + "mime", + "mime_guess", + "native-tls", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams 0.4.2", + "web-sys", + "webpki-roots 1.0.6", +] + +[[package]] +name = "reqwest" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab3f43e3283ab1488b624b44b0e988d0acea0b3214e694730a055cb6b2efa801" +dependencies = [ + "base64 0.22.1", + "bytes", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_json", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams 0.5.0", + "web-sys", +] + +[[package]] +name = "rgb" +version = "0.8.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.16", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rmcp" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4c9c94680f75470ee8083a0667988b5d7b5beb70b9f998a8e51de7c682ce60" +dependencies = [ + "async-trait", + "base64 0.22.1", + "chrono", + "futures", + "pastey 0.2.1", + "pin-project-lite", + "process-wrap", + "rmcp-macros", + "schemars 1.2.1", + "serde", + "serde_json", + "thiserror 2.0.18", + "tokio", + "tokio-stream", + "tokio-util", + "tracing", +] + +[[package]] +name = "rmcp-macros" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90c23c8f26cae4da838fbc3eadfaecf2d549d97c04b558e7bd90526a9c28b42a" +dependencies = [ + "darling 0.23.0", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.111", +] + +[[package]] +name = "rubato" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5258099699851cfd0082aeb645feb9c084d9a5e1f1b8d5372086b989fc5e56a1" +dependencies = [ + "num-complex", + "num-integer", + "num-traits", + "realfft", +] + +[[package]] +name = "rusqlite" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e34486da88d8e051c7c0e23c3f15fd806ea8546260aa2fec247e97242ec143" +dependencies = [ + "bitflags 2.10.0", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec 1.15.1", +] + +[[package]] +name = "rust-mcp-schema" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ed324cdee4b735926a1eaa7741b63a5d103ee08bbe0d3701398279b0c3bf3ce" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "rust-stemmers" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e46a2036019fdb888131db7a4c847a1063a7493f971ed94ea82c67eada63ca54" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustfft" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21db5f9893e91f41798c88680037dba611ca6674703c1a18601b01a72c8adb89" +dependencies = [ + "num-complex", + "num-integer", + "num-traits", + "primal-check", + "strength_reduce", + "transpose", +] + +[[package]] +name = "rustix" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +dependencies = [ + "bitflags 2.10.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +dependencies = [ + "aws-lc-rs", + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" +dependencies = [ + "openssl-probe 0.2.1", + "rustls-pki-types", + "schannel", + "security-framework 3.5.1", +] + +[[package]] +name = "rustls-pki-types" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21e6f2ab2928ca4291b86736a8bd920a277a399bba1589409d72154ff87c1282" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d99feebc72bae7ab76ba994bb5e121b8d83d910ca40b36e0921f53becc41784" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework 3.5.1", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + +[[package]] +name = "rustls-webpki" +version = "0.103.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "rustyline" +version = "15.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee1e066dc922e513bda599c6ccb5f3bb2b0ea5870a579448f2622993f0a9a2f" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "clipboard-win", + "fd-lock", + "home", + "libc", + "log", + "memchr", + "nix 0.29.0", + "radix_trie 0.2.1", + "unicode-segmentation", + "unicode-width", + "utf8parse", + "windows-sys 0.59.0", +] + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "safe_arch" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b02de82ddbe1b636e6170c21be622223aea188ef2e139be0a5b219ec215323" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "safetensors" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44560c11236a6130a46ce36c836a62936dc81ebf8c36a37947423571be0e55b6" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "safetensors" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "675656c1eabb620b921efea4f9199f97fc86e36dd6ffd1fbbe48d0f59a4987f5" +dependencies = [ + "hashbrown 0.16.1", + "serde", + "serde_json", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "saphyr-parser-bw" +version = "0.0.605" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1aee7486406df3541b5a657204a11be97175a467d77bc98e6d94a66289fb80" +dependencies = [ + "arraydeque", + "smallvec 2.0.0-alpha.12", + "thiserror 2.0.18", +] + +[[package]] +name = "schannel" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" +dependencies = [ + "chrono", + "dyn-clone", + "ref-cast", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d115b50f4aaeea07e79c1912f645c7513d81715d0420f8bc77a18c6260b307f" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.111", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scraper" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93cecd86d6259499c844440546d02f55f3e17bd286e529e48d1f9f67e92315cb" +dependencies = [ + "cssparser", + "ego-tree", + "getopts", + "html5ever 0.36.1", + "precomputed-hash", + "selectors", + "tendril 0.4.3", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.10.0", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef" +dependencies = [ + "bitflags 2.10.0", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "selectors" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feef350c36147532e1b79ea5c1f3791373e61cbd9a6a2615413b3807bb164fb7" +dependencies = [ + "bitflags 2.10.0", + "cssparser", + "derive_more", + "log", + "new_debug_unreachable", + "phf", + "phf_codegen", + "precomputed-hash", + "rustc-hash 2.1.1", + "servo_arc", + "smallvec 1.15.1", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "seq-macro" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-big-array" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11fc7cc2c76d73e0f27ee52abbd64eec84d46f370c88371120433196934e4b7f" +dependencies = [ + "serde", +] + +[[package]] +name = "serde-saphyr" +version = "0.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4db5a4a562bcc0017c34cd0efbabf447be783f00576a2a516947f884e6a7ed57" +dependencies = [ + "ahash", + "annotate-snippets", + "base64 0.22.1", + "encoding_rs_io", + "nohash-hasher", + "num-traits", + "regex", + "saphyr-parser-bw", + "serde", + "serde_json", + "smallvec 2.0.0-alpha.12", + "zmij", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "indexmap 2.13.0", + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_plain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1fc6db65a611022b23a0dec6975d63fb80a302cb3388835ff02c097258d50" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "381b283ce7bc6b476d903296fb59d0d36633652b633b27f64db4fb46dcbfc3b9" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.13.0", + "schemars 0.9.0", + "schemars 1.2.1", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6d4e30573c8cb306ed6ab1dca8423eec9a463ea0e155f45399455e0368b27e0" dependencies = [ + "darling 0.21.3", "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] -name = "regex-automata" -version = "0.4.14" +name = "serde_yaml" +version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", + "indexmap 2.13.0", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", ] [[package]] -name = "regex-syntax" -version = "0.8.10" +name = "servo_arc" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" +checksum = "170fb83ab34de17dc69aa7c67482b22218ddb85da56546f9bd6b929e32a05930" +dependencies = [ + "stable_deref_trait", +] [[package]] -name = "reqwest" -version = "0.12.26" +name = "sha1" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b4c14b2d9afca6a60277086b0cc6a6ae0b568f6f7916c943a8cdc79f8be240f" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-tls", - "hyper-util", - "js-sys", - "log", - "mime", - "native-tls", - "percent-encoding", - "pin-project-lite", - "rustls-pki-types", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tokio-native-tls", - "tokio-util", - "tower", - "tower-http", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-streams", - "web-sys", + "cfg-if", + "cpufeatures", + "digest", ] [[package]] -name = "ring" -version = "0.17.14" +name = "sha2" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ - "cc", "cfg-if", - "getrandom 0.2.16", - "libc", - "untrusted", - "windows-sys 0.52.0", + "cpufeatures", + "digest", ] [[package]] -name = "rmcp" -version = "0.16.0" +name = "sharded-slab" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4c9c94680f75470ee8083a0667988b5d7b5beb70b9f998a8e51de7c682ce60" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ - "async-trait", - "base64", - "chrono", - "futures", - "pastey", - "pin-project-lite", - "process-wrap", - "rmcp-macros", - "schemars", - "serde", - "serde_json", - "thiserror", - "tokio", - "tokio-stream", - "tokio-util", - "tracing", + "lazy_static", ] [[package]] -name = "rmcp-macros" -version = "0.16.0" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90c23c8f26cae4da838fbc3eadfaecf2d549d97c04b558e7bd90526a9c28b42a" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" dependencies = [ - "darling", - "proc-macro2", - "quote", - "serde_json", - "syn", + "libc", + "signal-hook-registry", ] [[package]] -name = "rusqlite" -version = "0.34.0" +name = "signal-hook-mio" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e34486da88d8e051c7c0e23c3f15fd806ea8546260aa2fec247e97242ec143" +checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" dependencies = [ - "bitflags", - "fallible-iterator", - "fallible-streaming-iterator", - "hashlink", - "libsqlite3-sys", - "smallvec", + "libc", + "mio 0.8.11", + "signal-hook", ] [[package]] -name = "rustix" -version = "1.1.2" +name = "signal-hook-registry" +version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ - "bitflags", "errno", "libc", - "linux-raw-sys", - "windows-sys 0.61.2", ] [[package]] -name = "rustls" -version = "0.23.35" +name = "simba" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +checksum = "c99284beb21666094ba2b75bbceda012e610f5479dfcc2d6e2426f53197ffd95" dependencies = [ - "once_cell", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", + "approx", + "num-complex", + "num-traits", + "paste", + "wide", ] [[package]] -name = "rustls-pki-types" -version = "1.13.2" +name = "simd-adler32" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e6f2ab2928ca4291b86736a8bd920a277a399bba1589409d72154ff87c1282" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" + +[[package]] +name = "simd_helpers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" dependencies = [ - "zeroize", + "quote", ] [[package]] -name = "rustls-webpki" -version = "0.103.8" +name = "siphasher" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" +checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", + "serde", ] [[package]] -name = "rustversion" -version = "1.0.22" +name = "smallvec" +version = "2.0.0-alpha.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +checksum = "ef784004ca8777809dcdad6ac37629f0a97caee4c685fcea805278d81dd8b857" [[package]] -name = "rustyline" -version = "15.0.0" +name = "socket2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ee1e066dc922e513bda599c6ccb5f3bb2b0ea5870a579448f2622993f0a9a2f" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" dependencies = [ - "bitflags", - "cfg-if", - "clipboard-win", - "fd-lock", - "home", "libc", - "log", - "memchr", - "nix 0.29.0", - "radix_trie", - "unicode-segmentation", - "unicode-width", - "utf8parse", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] -name = "ryu" -version = "1.0.20" +name = "socks" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b" +dependencies = [ + "byteorder", + "libc", + "winapi", +] [[package]] -name = "schannel" -version = "0.1.28" +name = "sparsevec" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +checksum = "68b4a8ce3045f0fe173fb5ae3c6b7dcfbec02bfa650bb8618b2301f52af0134d" dependencies = [ - "windows-sys 0.61.2", + "num-traits", + "packedvec", + "vob", ] [[package]] -name = "schemars" -version = "1.1.0" +name = "spm_precompiled" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9558e172d4e8533736ba97870c4b2cd63f84b382a3d6eb063da41b91cce17289" +checksum = "5851699c4033c63636f7ea4cf7b7c1f1bf06d0cc03cfb42e711de5a5c46cf326" dependencies = [ - "chrono", - "dyn-clone", - "ref-cast", - "schemars_derive", + "base64 0.13.1", + "nom 7.1.3", "serde", - "serde_json", + "unicode-segmentation", ] [[package]] -name = "schemars_derive" +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301858a4023d78debd2353c7426dc486001bddc91ae31a76fb1f55132f7e2633" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "statrs" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a3fe7c28c6512e766b0874335db33c94ad7b8f9054228ae1c2abd47ce7d335e" dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn", + "approx", + "nalgebra", + "num-traits", + "rand 0.8.5", ] [[package]] -name = "security-framework" -version = "2.11.1" +name = "stop-words" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +checksum = "645a3d441ccf4bf47f2e4b7681461986681a6eeea9937d4c3bc9febd61d17c71" dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", + "serde_json", ] [[package]] -name = "security-framework-sys" -version = "2.15.0" +name = "strength_reduce" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + +[[package]] +name = "string_cache" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901" dependencies = [ - "core-foundation-sys", - "libc", + "new_debug_unreachable", + "parking_lot", + "phf_shared", + "precomputed-hash", ] [[package]] -name = "serde" -version = "1.0.228" +name = "string_cache_codegen" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69" dependencies = [ - "serde_core", - "serde_derive", + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", ] [[package]] -name = "serde_core" -version = "1.0.228" +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" dependencies = [ - "serde_derive", + "strum_macros", ] [[package]] -name = "serde_derive" -version = "1.0.228" +name = "strum_macros" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" dependencies = [ + "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] -name = "serde_derive_internals" -version = "0.29.1" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] -name = "serde_json" -version = "1.0.145" +name = "symphonia" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "5773a4c030a19d9bfaa090f49746ff35c75dfddfa700df7a5939d5e076a57039" dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", - "serde_core", + "lazy_static", + "symphonia-bundle-flac", + "symphonia-bundle-mp3", + "symphonia-codec-pcm", + "symphonia-codec-vorbis", + "symphonia-core", + "symphonia-format-isomp4", + "symphonia-format-ogg", + "symphonia-format-riff", + "symphonia-metadata", ] [[package]] -name = "serde_spanned" -version = "0.6.9" +name = "symphonia-bundle-flac" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +checksum = "c91565e180aea25d9b80a910c546802526ffd0072d0b8974e3ebe59b686c9976" dependencies = [ - "serde", + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", ] [[package]] -name = "serde_urlencoded" -version = "0.7.1" +name = "symphonia-bundle-mp3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +checksum = "4872dd6bb56bf5eac799e3e957aa1981086c3e613b27e0ac23b176054f7c57ed" dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", ] [[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" +name = "symphonia-codec-pcm" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +checksum = "4e89d716c01541ad3ebe7c91ce4c8d38a7cf266a3f7b2f090b108fb0cb031d95" dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", + "log", + "symphonia-core", ] [[package]] -name = "sharded-slab" -version = "0.1.7" +name = "symphonia-codec-vorbis" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +checksum = "f025837c309cd69ffef572750b4a2257b59552c5399a5e49707cc5b1b85d1c73" dependencies = [ - "lazy_static", + "log", + "symphonia-core", + "symphonia-utils-xiph", ] [[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook-registry" -version = "1.4.8" +name = "symphonia-core" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +checksum = "ea00cc4f79b7f6bb7ff87eddc065a1066f3a43fe1875979056672c9ef948c2af" dependencies = [ - "errno", - "libc", + "arrayvec", + "bitflags 1.3.2", + "bytemuck", + "lazy_static", + "log", ] [[package]] -name = "slab" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" - -[[package]] -name = "smallvec" -version = "1.15.1" +name = "symphonia-format-isomp4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +checksum = "243739585d11f81daf8dac8d9f3d18cc7898f6c09a259675fc364b382c30e0a5" dependencies = [ - "serde", + "encoding_rs", + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", ] [[package]] -name = "socket2" -version = "0.6.1" +name = "symphonia-format-ogg" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +checksum = "2b4955c67c1ed3aa8ae8428d04ca8397fbef6a19b2b051e73b5da8b1435639cb" dependencies = [ - "libc", - "windows-sys 0.60.2", + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", ] [[package]] -name = "stable_deref_trait" -version = "1.2.1" +name = "symphonia-format-riff" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +checksum = "c2d7c3df0e7d94efb68401d81906eae73c02b40d5ec1a141962c592d0f11a96f" +dependencies = [ + "extended", + "log", + "symphonia-core", + "symphonia-metadata", +] [[package]] -name = "static_assertions" -version = "1.1.0" +name = "symphonia-metadata" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +checksum = "36306ff42b9ffe6e5afc99d49e121e0bd62fe79b9db7b9681d48e29fa19e6b16" +dependencies = [ + "encoding_rs", + "lazy_static", + "log", + "symphonia-core", +] [[package]] -name = "strsim" -version = "0.11.1" +name = "symphonia-utils-xiph" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "ee27c85ab799a338446b68eec77abf42e1a6f1bb490656e121c6e27bfbab9f16" +dependencies = [ + "symphonia-core", + "symphonia-metadata", +] [[package]] -name = "subtle" -version = "2.6.1" +name = "syn" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] [[package]] name = "syn" @@ -1726,7 +5508,35 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", +] + +[[package]] +name = "sysctl" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01198a2debb237c62b6826ec7081082d951f46dbb64b0e8c7649a452230d1dfc" +dependencies = [ + "bitflags 2.10.0", + "byteorder", + "enum-as-inner", + "libc", + "thiserror 1.0.69", + "walkdir", +] + +[[package]] +name = "sysinfo" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "252800745060e7b9ffb7b2badbd8b31cfa4aa2e61af879d0a3bf2a317c20217d" +dependencies = [ + "libc", + "memchr", + "ntapi", + "objc2-core-foundation", + "objc2-io-kit", + "windows 0.61.3", ] [[package]] @@ -1735,8 +5545,8 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags", - "core-foundation", + "bitflags 2.10.0", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -1763,13 +5573,64 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + +[[package]] +name = "tendril" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4790fc369d5a530f4b544b094e31388b9b3a37c0f4652ade4505945f5660d24" +dependencies = [ + "new_debug_unreachable", + "utf-8", +] + +[[package]] +name = "terminal_size" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b8cb979cb11c32ce1603f8137b22262a9d131aaa5c37b5678025f22b8becd0" +dependencies = [ + "rustix", + "windows-sys 0.60.2", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + [[package]] name = "thiserror" version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl", + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] @@ -1780,7 +5641,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] @@ -1792,6 +5653,51 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tiff" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af9605de7fee8d9551863fd692cce7637f548dbd9db9180fcc07ccc6d26c336f" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg 0.4.21", +] + +[[package]] +name = "time" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "time-macros" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinystr" version = "0.8.2" @@ -1802,15 +5708,64 @@ dependencies = [ "zerovec", ] +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokenizers" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a620b996116a59e184c2fa2dfd8251ea34a36d0a514758c6f966386bd2e03476" +dependencies = [ + "ahash", + "aho-corasick", + "compact_str 0.9.0", + "dary_heap", + "derive_builder", + "esaxx-rs", + "fancy-regex 0.14.0", + "getrandom 0.3.4", + "itertools", + "log", + "macro_rules_attribute", + "monostate", + "paste", + "rand 0.9.2", + "rayon", + "rayon-cond", + "regex", + "regex-syntax", + "serde", + "serde_json", + "spm_precompiled", + "thiserror 2.0.18", + "unicode-normalization-alignments", + "unicode-segmentation", + "unicode_categories", +] + [[package]] name = "tokio" -version = "1.48.0" +version = "1.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" dependencies = [ "bytes", "libc", - "mio", + "mio 1.1.1", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", @@ -1826,7 +5781,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] @@ -1839,6 +5794,16 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rayon" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cf33a76e0b1dd03b778f83244137bd59887abf25c0e87bc3e7071105f457693" +dependencies = [ + "rayon", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.26.4" @@ -1860,6 +5825,18 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-tungstenite" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25a406cddcc431a75d3d9afc6a7c0f7428d4891dd973e4d54c56b46127bf857" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite", +] + [[package]] name = "tokio-util" version = "0.7.17" @@ -1873,6 +5850,33 @@ dependencies = [ "tokio", ] +[[package]] +name = "toktrie" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06f161a10057ac758fe4d1bac8d86b1ce07e8a2255ee4f9eec1d408bed7be125" +dependencies = [ + "anyhow", + "bytemuck", + "bytemuck_derive", + "serde", + "serde_json", +] + +[[package]] +name = "toktrie_hf_tokenizers" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9caa3495044651ace1f33dff8d8d083142984b7014f926365ca8e003531df65" +dependencies = [ + "anyhow", + "log", + "serde", + "serde_json", + "tokenizers", + "toktrie", +] + [[package]] name = "toml" version = "0.8.23" @@ -1880,11 +5884,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ "serde", - "serde_spanned", - "toml_datetime", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", "toml_edit", ] +[[package]] +name = "toml" +version = "0.9.12+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +dependencies = [ + "indexmap 2.13.0", + "serde_core", + "serde_spanned 1.0.4", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 0.7.14", +] + [[package]] name = "toml_datetime" version = "0.6.11" @@ -1895,16 +5914,34 @@ dependencies = [ ] [[package]] -name = "toml_edit" -version = "0.22.27" +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap 2.13.0", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", + "toml_write", + "winnow 0.7.14", +] + +[[package]] +name = "toml_parser" +version = "1.0.9+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "toml_write", "winnow 0.7.14", ] @@ -1914,6 +5951,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" +[[package]] +name = "toml_writer" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" + [[package]] name = "tower" version = "0.5.2" @@ -1935,7 +5978,7 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ - "bitflags", + "bitflags 2.10.0", "bytes", "futures-util", "http", @@ -1959,11 +6002,22 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" +[[package]] +name = "tqdm" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b316d5c2ac649ca856dacd487d0ebb94f3b746bada51355d93dd2c007ab62a2e" +dependencies = [ + "anyhow", + "crossterm", + "once_cell", +] + [[package]] name = "tracing" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -1978,14 +6032,14 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] name = "tracing-core" -version = "0.1.35" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -2013,25 +6067,120 @@ dependencies = [ "once_cell", "regex-automata", "sharded-slab", - "smallvec", + "smallvec 1.15.1", "thread_local", "tracing", "tracing-core", "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "try-lock" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "tungstenite" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8628dcc84e5a09eb3d8423d6cb682965dea9133204e8fb3efee74c2a0c259442" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.9.2", + "sha1", + "thiserror 2.0.18", + "utf-8", +] + +[[package]] +name = "typed-path" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e" + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "ug" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76b761acf8af3494640d826a8609e2265e19778fb43306c7f15379c78c9b05b0" +dependencies = [ + "gemm 0.18.2", + "half", + "libloading", + "memmap2", + "num", + "num-traits", + "num_cpus", + "rayon", + "safetensors 0.4.5", + "serde", + "thiserror 1.0.69", + "tracing", + "yoke 0.7.5", +] + +[[package]] +name = "ug-metal" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7adf545a99a086d362efc739e7cf4317c18cbeda22706000fd434d70ea3d95" +dependencies = [ + "half", + "metal", + "objc", + "serde", + "thiserror 1.0.69", + "ug", +] + +[[package]] +name = "unchecked-index" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeba86d422ce181a719445e51872fa30f1f7413b62becb52e95ec91aa262d85c" + +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + [[package]] name = "unicode-ident" version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +[[package]] +name = "unicode-normalization-alignments" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f613e4fa046e69818dd287fdc4bc78175ff20331479dab6e1b0f98d57062de" +dependencies = [ + "smallvec 1.15.1", +] + [[package]] name = "unicode-segmentation" version = "1.12.0" @@ -2044,6 +6193,24 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "unit-prefix" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" + [[package]] name = "unsafe-libyaml" version = "0.2.11" @@ -2056,6 +6223,25 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "ureq" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d" +dependencies = [ + "base64 0.22.1", + "flate2", + "log", + "once_cell", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "socks", + "url", + "webpki-roots 0.26.11", +] + [[package]] name = "url" version = "2.5.7" @@ -2068,6 +6254,18 @@ dependencies = [ "serde", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "utf8_iter" version = "1.0.4" @@ -2080,25 +6278,119 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "utoipa" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fcc29c80c21c31608227e0912b2d7fddba57ad76b606890627ba8ee7964e993" +dependencies = [ + "indexmap 2.13.0", + "serde", + "serde_json", + "utoipa-gen", +] + +[[package]] +name = "utoipa-gen" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d79d08d92ab8af4c5e8a6da20c47ae3f61a0f1dabc1997cdf2d082b757ca08b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "uuid" +version = "1.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b672338555252d43fd2240c714dc444b8c6fb0a5c5335e65a07bba7742735ddb" +dependencies = [ + "getrandom 0.4.1", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "v_frame" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2" +dependencies = [ + "aligned-vec", + "num-traits", + "wasm-bindgen", +] + [[package]] name = "valuable" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" +[[package]] +name = "variantly" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a332341ba79a179d9e9b33c0d72fbf3dc2c80e1be79416401a08d2b820ef56" +dependencies = [ + "Inflector", + "darling 0.11.0", + "proc-macro2", + "quote", + "syn 1.0.109", + "uuid 0.8.2", +] + [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vob" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc936b5a7202a703aeaf7ce05e7931db2e0c8126813f97db3e9e06d867b0bb38" +dependencies = [ + "num-traits", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "walrus-claude" version = "0.0.9" dependencies = [ "anyhow", "async-stream", - "compact_str", + "compact_str 0.8.1", "futures-core", "futures-util", "serde", @@ -2113,13 +6405,13 @@ version = "0.0.9" dependencies = [ "anyhow", "clap", - "compact_str", + "compact_str 0.8.1", "dirs", "futures-core", "futures-util", "rustyline", "tokio", - "toml", + "toml 0.8.23", "tracing", "tracing-subscriber", "walrus-client", @@ -2144,10 +6436,10 @@ name = "walrus-core" version = "0.0.9" dependencies = [ "anyhow", - "compact_str", + "compact_str 0.8.1", "futures-core", "serde_json", - "smallvec", + "smallvec 1.15.1", "tokio", "walrus-llm", ] @@ -2158,16 +6450,16 @@ version = "0.0.9" dependencies = [ "anyhow", "chrono", - "compact_str", + "compact_str 0.8.1", "cron", "dirs", "rmcp", "serde", "serde_json", - "smallvec", + "smallvec 1.15.1", "tempfile", "tokio", - "toml", + "toml 0.8.23", "tracing", "tracing-subscriber", "walrus-core", @@ -2198,27 +6490,26 @@ version = "0.0.9" dependencies = [ "anyhow", "async-stream", - "compact_str", + "compact_str 0.8.1", "futures-core", "futures-util", - "reqwest", - "schemars", + "reqwest 0.12.26", + "schemars 1.2.1", "serde", "serde_json", - "smallvec", + "smallvec 1.15.1", "tracing", ] [[package]] -name = "walrus-mistral" +name = "walrus-local" version = "0.0.9" dependencies = [ "anyhow", "async-stream", + "compact_str 0.8.1", "futures-core", - "futures-util", - "schemars", - "serde", + "mistralrs", "serde_json", "tracing", "walrus-llm", @@ -2242,7 +6533,7 @@ dependencies = [ name = "walrus-protocol" version = "0.0.9" dependencies = [ - "compact_str", + "compact_str 0.8.1", "serde", "serde_json", "tokio", @@ -2254,16 +6545,17 @@ version = "0.0.9" dependencies = [ "anyhow", "async-stream", - "compact_str", + "compact_str 0.8.1", "futures-core", "futures-util", + "mistralrs", "serde", "serde_json", "tokio", "walrus-claude", "walrus-deepseek", "walrus-llm", - "walrus-mistral", + "walrus-local", "walrus-openai", ] @@ -2274,13 +6566,13 @@ dependencies = [ "anyhow", "async-stream", "chrono", - "compact_str", + "compact_str 0.8.1", "dotenvy", "futures-core", "futures-util", - "reqwest", + "reqwest 0.12.26", "rmcp", - "schemars", + "schemars 1.2.1", "serde", "serde_json", "serde_yaml", @@ -2298,7 +6590,7 @@ name = "walrus-sqlite" version = "0.0.9" dependencies = [ "anyhow", - "compact_str", + "compact_str 0.8.1", "rusqlite", "serde_json", "tokio", @@ -2311,9 +6603,9 @@ version = "0.0.9" dependencies = [ "anyhow", "async-stream", - "compact_str", + "compact_str 0.8.1", "futures-core", - "reqwest", + "reqwest 0.12.26", "serde", "serde_json", "tokio", @@ -2342,14 +6634,23 @@ version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.46.0", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", ] [[package]] name = "wasm-bindgen" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" dependencies = [ "cfg-if", "once_cell", @@ -2360,11 +6661,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.56" +version = "0.4.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c" +checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" dependencies = [ "cfg-if", + "futures-util", "js-sys", "once_cell", "wasm-bindgen", @@ -2373,9 +6675,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2383,26 +6685,48 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn", + "syn 2.0.111", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap 2.13.0", + "wasm-encoder", + "wasmparser", +] + [[package]] name = "wasm-streams" version = "0.4.2" @@ -2417,13 +6741,153 @@ dependencies = [ ] [[package]] -name = "web-sys" -version = "0.3.83" +name = "wasm-streams" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.10.0", + "hashbrown 0.15.5", + "indexmap 2.13.0", + "semver", +] + +[[package]] +name = "web-sys" +version = "0.3.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web_atoms" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a9779e9f04d2ac1ce317aee707aa2f6b773afba7b931222bff6983843b1576" +dependencies = [ + "phf", + "phf_codegen", + "string_cache", + "string_cache_codegen", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "804f18a4ac2676ffb4e8b5b5fa9ae38af06df08162314f96a68d2a363e21a8ca" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "webpki-roots" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.6", +] + +[[package]] +name = "webpki-roots" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cfaf3c063993ff62e73cb4311efde4db1efb31ab78a3e5c457939ad5cc0bed" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wide" +version = "0.7.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce5da8ecb62bcd8ec8b7ea19f69a51275e91299be594ea5cc6ef7819e16cd03" +dependencies = [ + "bytemuck", + "safe_arch", +] + +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.61.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" dependencies = [ - "js-sys", - "wasm-bindgen", + "windows-collections 0.2.0", + "windows-core 0.61.2", + "windows-future 0.2.1", + "windows-link 0.1.3", + "windows-numerics 0.2.0", ] [[package]] @@ -2432,10 +6896,19 @@ version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" dependencies = [ - "windows-collections", - "windows-core", - "windows-future", - "windows-numerics", + "windows-collections 0.3.2", + "windows-core 0.62.2", + "windows-future 0.3.2", + "windows-numerics 0.3.1", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", ] [[package]] @@ -2444,7 +6917,20 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" dependencies = [ - "windows-core", + "windows-core 0.62.2", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", ] [[package]] @@ -2455,9 +6941,20 @@ checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", - "windows-link", - "windows-result", - "windows-strings", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading 0.1.0", ] [[package]] @@ -2466,9 +6963,9 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" dependencies = [ - "windows-core", - "windows-link", - "windows-threading", + "windows-core 0.62.2", + "windows-link 0.2.1", + "windows-threading 0.2.1", ] [[package]] @@ -2479,7 +6976,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] [[package]] @@ -2490,23 +6987,39 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", ] +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + [[package]] name = "windows-numerics" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" dependencies = [ - "windows-core", - "windows-link", + "windows-core 0.62.2", + "windows-link 0.2.1", ] [[package]] @@ -2515,9 +7028,18 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" dependencies = [ - "windows-link", - "windows-result", - "windows-strings", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", ] [[package]] @@ -2526,7 +7048,16 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-link", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", ] [[package]] @@ -2535,7 +7066,25 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "windows-link", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2571,7 +7120,37 @@ version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-link", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2596,7 +7175,7 @@ version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ - "windows-link", + "windows-link 0.2.1", "windows_aarch64_gnullvm 0.53.1", "windows_aarch64_msvc 0.53.1", "windows_i686_gnu 0.53.1", @@ -2607,15 +7186,36 @@ dependencies = [ "windows_x86_64_msvc 0.53.1", ] +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", +] + [[package]] name = "windows-threading" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" dependencies = [ - "windows-link", + "windows-link 0.2.1", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -2628,6 +7228,18 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" @@ -2640,6 +7252,18 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2664,6 +7288,18 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" @@ -2676,6 +7312,18 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" @@ -2688,6 +7336,18 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" @@ -2700,6 +7360,18 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2736,12 +7408,118 @@ version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap 2.13.0", + "prettyplease", + "syn 2.0.111", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.111", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.10.0", + "indexmap 2.13.0", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.13.0", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "writeable" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" +[[package]] +name = "y4m" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive 0.7.5", + "zerofrom", +] + [[package]] name = "yoke" version = "0.8.1" @@ -2749,10 +7527,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" dependencies = [ "stable_deref_trait", - "yoke-derive", + "yoke-derive 0.8.1", "zerofrom", ] +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", + "synstructure", +] + [[package]] name = "yoke-derive" version = "0.8.1" @@ -2761,10 +7551,30 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", "synstructure", ] +[[package]] +name = "zerocopy" +version = "0.8.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a789c6e490b576db9f7e6b6d661bcc9799f7c0ac8352f56ea20193b2681532e5" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f65c489a7071a749c849713807783f70672b28094011623e200cb86dcb835953" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "zerofrom" version = "0.1.6" @@ -2782,7 +7592,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", "synstructure", ] @@ -2799,7 +7609,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" dependencies = [ "displaydoc", - "yoke", + "yoke 0.8.1", "zerofrom", ] @@ -2809,7 +7619,7 @@ version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" dependencies = [ - "yoke", + "yoke 0.8.1", "zerofrom", "zerovec-derive", ] @@ -2822,5 +7632,62 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.111", +] + +[[package]] +name = "zip" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42e33efc22a0650c311c2ef19115ce232583abbe80850bc8b66509ebef02de0" +dependencies = [ + "crc32fast", + "indexmap 2.13.0", + "memchr", + "typed-path", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + +[[package]] +name = "zune-core" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" + +[[package]] +name = "zune-core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9" + +[[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "zune-jpeg" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29ce2c8a9384ad323cf564b67da86e21d3cfdff87908bc1223ed5c99bc792713" +dependencies = [ + "zune-core 0.4.12", +] + +[[package]] +name = "zune-jpeg" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "410e9ecef634c709e3831c2cfdb8d9c32164fae1c67496d5b68fff728eec37fe" +dependencies = [ + "zune-core 0.5.1", ] diff --git a/Cargo.toml b/Cargo.toml index 51a2ba9..eca2b21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["llm", "agent", "ai"] deepseek = { path = "llm/deepseek", package = "walrus-deepseek", version = "0.0.9" } openai = { path = "llm/openai", package = "walrus-openai", version = "0.0.9" } claude = { path = "llm/claude", package = "walrus-claude", version = "0.0.9" } -mistral = { path = "llm/mistral", package = "walrus-mistral", version = "0.0.9" } +local = { path = "llm/local", package = "walrus-local", version = "0.0.9" } llm = { path = "crates/llm", package = "walrus-llm", version = "0.0.9", default-features = true } wcore = { path = "crates/core", package = "walrus-core", version = "0.0.9" } runtime = { path = "crates/runtime", package = "walrus-runtime", version = "0.0.9" } @@ -58,3 +58,4 @@ clap = { version = "4", features = ["derive"] } rustyline = "15" crossterm = "0.29" dirs = "6" +mistralrs = { version = "0.7", default-features = false } diff --git a/app/daemon/src/config.rs b/app/daemon/src/config.rs index cedf35f..635f244 100644 --- a/app/daemon/src/config.rs +++ b/app/daemon/src/config.rs @@ -2,7 +2,8 @@ use anyhow::{Context, Result}; use compact_str::CompactString; -pub use provider::ProviderKind; +use provider::config::{BackendConfig, RemoteConfig}; +pub use provider::{ProviderConfig, ProviderManager}; use serde::{Deserialize, Serialize}; use std::path::Path; @@ -27,12 +28,12 @@ pub fn global_config_dir() -> std::path::PathBuf { } /// Top-level gateway configuration. -#[derive(Debug, Default, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] pub struct GatewayConfig { /// Server bind configuration. pub server: ServerConfig, /// LLM provider configuration. - pub llm: LlmConfig, + pub llm: ProviderConfig, /// Memory backend configuration. #[serde(default)] pub memory: MemoryConfig, @@ -44,6 +45,25 @@ pub struct GatewayConfig { pub mcp_servers: Vec, } +impl Default for GatewayConfig { + fn default() -> Self { + Self { + server: ServerConfig::default(), + llm: ProviderConfig { + name: "default".into(), + model: "deepseek-chat".into(), + backend: BackendConfig::DeepSeek(RemoteConfig { + api_key: "${DEEPSEEK_API_KEY}".to_owned(), + base_url: None, + }), + }, + memory: MemoryConfig::default(), + channels: Vec::new(), + mcp_servers: Vec::new(), + } + } +} + /// Server configuration. #[derive(Debug, Default, Serialize, Deserialize)] #[serde(default)] @@ -53,33 +73,6 @@ pub struct ServerConfig { pub socket_path: Option, } -/// LLM provider configuration. -#[derive(Debug, Serialize, Deserialize)] -pub struct LlmConfig { - /// Which LLM provider to use. - #[serde(default)] - pub provider: ProviderKind, - /// Model identifier. - pub model: CompactString, - /// API key (supports `${ENV_VAR}` expansion). - #[serde(default)] - pub api_key: String, - /// Optional base URL override for the provider endpoint. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub base_url: Option, -} - -impl Default for LlmConfig { - fn default() -> Self { - Self { - provider: ProviderKind::DeepSeek, - model: "deepseek-chat".into(), - api_key: "${DEEPSEEK_API_KEY}".to_owned(), - base_url: None, - } - } -} - /// Memory backend configuration. #[derive(Debug, Default, Serialize, Deserialize)] #[serde(default)] diff --git a/app/daemon/src/gateway/builder.rs b/app/daemon/src/gateway/builder.rs index a4136d4..8a11ebe 100644 --- a/app/daemon/src/gateway/builder.rs +++ b/app/daemon/src/gateway/builder.rs @@ -4,7 +4,6 @@ use crate::MemoryBackend; use crate::config::{self, MemoryBackendKind}; use crate::gateway::GatewayHook; use anyhow::Result; -use provider::ProviderConfig; use runtime::{General, McpBridge, Runtime, SkillRegistry}; use std::path::Path; @@ -33,19 +32,12 @@ pub async fn build_runtime( } }; - // Construct provider from LlmConfig via ProviderConfig. - let provider_config = ProviderConfig { - name: "default".into(), - provider: config.llm.provider, - model: config.llm.model.clone(), - api_key: config.llm.api_key.clone(), - base_url: config.llm.base_url.clone(), - }; + // Construct provider from config. let client = llm::Client::new(); - let provider = provider::build_provider(&provider_config, client)?; + let provider = provider::build_provider(&config.llm, client).await?; tracing::info!( - "provider {:?} initialized for model {}", - config.llm.provider, + "provider {} initialized for model {}", + config.llm.kind(), config.llm.model ); diff --git a/app/daemon/tests/backend.rs b/app/daemon/tests/backend.rs index 9df0f50..1b289ce 100644 --- a/app/daemon/tests/backend.rs +++ b/app/daemon/tests/backend.rs @@ -125,6 +125,7 @@ fn default_bind_address() { r#" [server] [llm] +provider = "deep_seek" model = "deepseek-chat" api_key = "test-key" "#, diff --git a/app/daemon/tests/config.rs b/app/daemon/tests/config.rs index da78b78..9599b2e 100644 --- a/app/daemon/tests/config.rs +++ b/app/daemon/tests/config.rs @@ -1,9 +1,6 @@ //! Gateway configuration tests. -use walrus_daemon::{ - GatewayConfig, - config::{MemoryBackendKind, ProviderKind}, -}; +use walrus_daemon::{GatewayConfig, config::MemoryBackendKind}; #[test] fn parse_minimal_config() { @@ -11,13 +8,14 @@ fn parse_minimal_config() { [server] [llm] +provider = "deep_seek" model = "deepseek-chat" api_key = "test-key" "#; let config = GatewayConfig::from_toml(toml).unwrap(); assert!(config.server.socket_path.is_none()); assert_eq!(config.llm.model.as_str(), "deepseek-chat"); - assert_eq!(config.llm.api_key, "test-key"); + assert_eq!(config.llm.kind(), "deepseek"); assert!(config.channels.is_empty()); } @@ -28,6 +26,7 @@ fn parse_full_config() { socket_path = "/tmp/walrus.sock" [llm] +provider = "deep_seek" model = "deepseek-chat" api_key = "sk-test" @@ -56,26 +55,13 @@ args = ["playwright-mcp"] assert!(config.mcp_servers[0].auto_restart); } -#[test] -fn default_server_config() { - let toml = r#" -[server] - -[llm] -model = "deepseek-chat" -api_key = "key" -"#; - let config = GatewayConfig::from_toml(toml).unwrap(); - assert!(config.server.socket_path.is_none()); - assert_eq!(config.llm.provider, ProviderKind::DeepSeek); -} - #[test] fn default_memory_config() { let toml = r#" [server] [llm] +provider = "deep_seek" model = "deepseek-chat" api_key = "key" "#; @@ -89,6 +75,7 @@ fn default_socket_path() { [server] [llm] +provider = "deep_seek" model = "deepseek-chat" api_key = "key" "#; @@ -104,6 +91,7 @@ fn custom_socket_path() { socket_path = "/run/walrus/custom.sock" [llm] +provider = "deep_seek" model = "deepseek-chat" api_key = "key" "#; @@ -119,11 +107,17 @@ fn env_var_expansion() { [server] [llm] +provider = "deep_seek" model = "deepseek-chat" api_key = "${TEST_WALRUS_KEY}" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - assert_eq!(config.llm.api_key, "expanded-value"); + match &config.llm.backend { + provider::BackendConfig::DeepSeek(rc) => { + assert_eq!(rc.api_key, "expanded-value"); + } + _ => panic!("expected DeepSeek backend"), + } unsafe { std::env::remove_var("TEST_WALRUS_KEY") }; } @@ -133,6 +127,7 @@ fn mcp_server_config() { [server] [llm] +provider = "deep_seek" model = "deepseek-chat" api_key = "key" @@ -158,49 +153,60 @@ KEY = "value" #[test] fn global_config_dir_is_under_platform_config() { let dir = walrus_daemon::config::global_config_dir(); - // Should end with "walrus" assert_eq!(dir.file_name().unwrap(), "walrus"); } #[test] -fn parse_mistral_provider() { +fn parse_claude_provider() { let toml = r#" [server] [llm] -provider = "mistral" -model = "mistral-small-latest" +provider = "claude" +model = "claude-sonnet-4-20250514" api_key = "test-key" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - assert_eq!(config.llm.provider, ProviderKind::Mistral); - assert_eq!(config.llm.model.as_str(), "mistral-small-latest"); + assert_eq!(config.llm.kind(), "claude"); + assert_eq!(config.llm.model.as_str(), "claude-sonnet-4-20250514"); } #[test] -fn parse_mistral_with_base_url() { +fn parse_openai_with_base_url() { let toml = r#" [server] [llm] -provider = "mistral" -model = "mistral-small-latest" +provider = "openai" +model = "gpt-4o" api_key = "test-key" base_url = "http://localhost:8080/v1/chat/completions" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - assert_eq!(config.llm.provider, ProviderKind::Mistral); - assert_eq!( - config.llm.base_url.as_deref(), - Some("http://localhost:8080/v1/chat/completions") - ); + assert_eq!(config.llm.kind(), "openai"); + match &config.llm.backend { + provider::BackendConfig::OpenAI(rc) => { + assert_eq!( + rc.base_url.as_deref(), + Some("http://localhost:8080/v1/chat/completions") + ); + } + _ => panic!("expected OpenAI backend"), + } } #[test] -fn provider_kind_mistral_roundtrip() { - let kind = ProviderKind::Mistral; - let serialized = serde_json::to_string(&kind).unwrap(); - assert_eq!(serialized, "\"mistral\""); - let parsed: ProviderKind = serde_json::from_str(&serialized).unwrap(); - assert_eq!(parsed, ProviderKind::Mistral); +fn parse_local_provider() { + let toml = r#" +[server] + +[llm] +provider = "local" +model = "phi-3.5-mini" +model_id = "microsoft/Phi-3.5-mini-instruct" +quantization = "q4k" +"#; + let config = GatewayConfig::from_toml(toml).unwrap(); + assert_eq!(config.llm.kind(), "local"); + assert_eq!(config.llm.model.as_str(), "phi-3.5-mini"); } diff --git a/app/provider/Cargo.toml b/app/provider/Cargo.toml index 556cf32..b41ccef 100644 --- a/app/provider/Cargo.toml +++ b/app/provider/Cargo.toml @@ -12,7 +12,8 @@ llm = { workspace = true } deepseek = { workspace = true } openai = { workspace = true } claude = { workspace = true } -mistral = { workspace = true } +local = { workspace = true, optional = true } +mistralrs = { workspace = true, optional = true } compact_str = { workspace = true } anyhow = { workspace = true } tokio = { workspace = true } @@ -21,5 +22,9 @@ async-stream = { workspace = true } futures-core = { workspace = true } futures-util = { workspace = true } +[features] +default = ["local"] +local = ["dep:local", "dep:mistralrs"] + [dev-dependencies] serde_json = { workspace = true } diff --git a/app/provider/src/config.rs b/app/provider/src/config.rs index 96df012..2347b10 100644 --- a/app/provider/src/config.rs +++ b/app/provider/src/config.rs @@ -1,22 +1,71 @@ //! Provider configuration +//! +//! Unified config for both remote (API-key-based) and local (model-path-based) +//! providers. Uses `#[serde(tag = "provider", flatten)]` so all fields appear +//! at the same level in TOML (DD#66). -use crate::ProviderKind; use compact_str::CompactString; use serde::{Deserialize, Serialize}; -/// Named provider configuration. Combines identity (`name`) with the fields -/// needed to construct a `Provider`. +/// Named provider configuration. Combines identity (`name`) with the +/// provider-specific backend settings via `BackendConfig`. #[derive(Debug, Serialize, Deserialize, Clone)] pub struct ProviderConfig { /// Unique name for this provider entry. Defaults to `"default"`. #[serde(default = "default_name")] pub name: CompactString, - /// Which LLM provider to use. - #[serde(default)] - pub provider: ProviderKind, - /// Model identifier. Not used by `build_provider()` — the caller passes - /// this to `General::model` when constructing requests. + /// Model identifier. Passed to `General::model` when constructing requests. pub model: CompactString, + /// Provider-specific settings, discriminated by the `provider` field. + #[serde(flatten)] + pub backend: BackendConfig, +} + +impl ProviderConfig { + /// Human-readable provider kind string for logging and protocol messages. + pub fn kind(&self) -> &'static str { + match &self.backend { + BackendConfig::DeepSeek(_) => "deepseek", + BackendConfig::OpenAI(_) => "openai", + BackendConfig::Grok(_) => "grok", + BackendConfig::Qwen(_) => "qwen", + BackendConfig::Kimi(_) => "kimi", + BackendConfig::Ollama(_) => "ollama", + BackendConfig::Claude(_) => "claude", + #[cfg(feature = "local")] + BackendConfig::Local(_) => "local", + } + } +} + +/// Provider-specific configuration, discriminated by the `provider` field +/// in TOML/JSON. +#[derive(Debug, Serialize, Deserialize, Clone)] +#[serde(tag = "provider", rename_all = "snake_case")] +pub enum BackendConfig { + /// DeepSeek API (default). + DeepSeek(RemoteConfig), + /// OpenAI API. + #[serde(rename = "openai")] + OpenAI(RemoteConfig), + /// Grok (xAI) API — OpenAI-compatible. + Grok(RemoteConfig), + /// Qwen (Alibaba DashScope) API — OpenAI-compatible. + Qwen(RemoteConfig), + /// Kimi (Moonshot) API — OpenAI-compatible. + Kimi(RemoteConfig), + /// Ollama local API — OpenAI-compatible, no key required. + Ollama(OllamaConfig), + /// Claude (Anthropic) Messages API. + Claude(RemoteConfig), + /// Local inference via mistralrs (DD#59). + #[cfg(feature = "local")] + Local(LocalConfig), +} + +/// Configuration for remote HTTP API providers. +#[derive(Debug, Serialize, Deserialize, Clone, Default)] +pub struct RemoteConfig { /// API key (supports `${ENV_VAR}` expansion at the daemon layer). #[serde(default)] pub api_key: String, @@ -25,6 +74,100 @@ pub struct ProviderConfig { pub base_url: Option, } +/// Configuration for Ollama (OpenAI-compatible, no key required). +#[derive(Debug, Serialize, Deserialize, Clone, Default)] +pub struct OllamaConfig { + /// Optional base URL override. Defaults to `http://localhost:11434/v1/chat/completions`. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub base_url: Option, +} + +/// Configuration for local inference via mistralrs. +#[cfg(feature = "local")] +#[derive(Debug, Serialize, Deserialize, Clone, Default)] +pub struct LocalConfig { + /// HuggingFace model ID for `TextModelBuilder` (e.g. `"microsoft/Phi-3.5-mini-instruct"`). + /// Mutually exclusive with `model_path`. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub model_id: Option, + /// Local directory path for `GgufModelBuilder`. + /// Mutually exclusive with `model_id`. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub model_path: Option, + /// GGUF filenames (required when `model_path` is set). + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub model_files: Vec, + /// In-situ quantization type. `None` means no ISQ. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub quantization: Option, + /// Optional chat template override (path or inline Jinja). + #[serde(default, skip_serializing_if = "Option::is_none")] + pub chat_template: Option, +} + +/// Quantization types supported by mistralrs (maps to `IsqType`). +#[cfg(feature = "local")] +#[derive(Debug, Serialize, Deserialize, Clone, Copy)] +pub enum QuantizationType { + /// GGML Q4_0. + #[serde(rename = "q4_0")] + Q4_0, + /// GGML Q4_1. + #[serde(rename = "q4_1")] + Q4_1, + /// GGML Q5_0. + #[serde(rename = "q5_0")] + Q5_0, + /// GGML Q5_1. + #[serde(rename = "q5_1")] + Q5_1, + /// GGML Q8_0. + #[serde(rename = "q8_0")] + Q8_0, + /// GGML Q8_1. + #[serde(rename = "q8_1")] + Q8_1, + /// GGML Q2K. + #[serde(rename = "q2k")] + Q2K, + /// GGML Q3K. + #[serde(rename = "q3k")] + Q3K, + /// GGML Q4K. + #[serde(rename = "q4k")] + Q4K, + /// GGML Q5K. + #[serde(rename = "q5k")] + Q5K, + /// GGML Q6K. + #[serde(rename = "q6k")] + Q6K, + /// GGML Q8K. + #[serde(rename = "q8k")] + Q8K, +} + +#[cfg(feature = "local")] +impl QuantizationType { + /// Convert to the mistralrs `IsqType`. + pub fn to_isq(self) -> mistralrs::IsqType { + match self { + Self::Q4_0 => mistralrs::IsqType::Q4_0, + Self::Q4_1 => mistralrs::IsqType::Q4_1, + Self::Q5_0 => mistralrs::IsqType::Q5_0, + Self::Q5_1 => mistralrs::IsqType::Q5_1, + Self::Q8_0 => mistralrs::IsqType::Q8_0, + Self::Q8_1 => mistralrs::IsqType::Q8_1, + Self::Q2K => mistralrs::IsqType::Q2K, + Self::Q3K => mistralrs::IsqType::Q3K, + Self::Q4K => mistralrs::IsqType::Q4K, + Self::Q5K => mistralrs::IsqType::Q5K, + Self::Q6K => mistralrs::IsqType::Q6K, + Self::Q8K => mistralrs::IsqType::Q8K, + } + } +} + fn default_name() -> CompactString { CompactString::const_new("default") } diff --git a/app/provider/src/lib.rs b/app/provider/src/lib.rs index f2cf14a..6735549 100644 --- a/app/provider/src/lib.rs +++ b/app/provider/src/lib.rs @@ -1,16 +1,18 @@ //! Provider crate — centralizes LLM provider enum dispatch, configuration, //! construction, and runtime management. //! -//! `Provider` enum wraps concrete backends (DeepSeek, OpenAI, Claude, Mistral) +//! `Provider` enum wraps concrete backends (DeepSeek, OpenAI, Claude, Local) //! behind a unified `LLM` impl. `ProviderManager` holds a named map of //! providers with concurrent-safe active-provider swapping (DD#60, DD#65). +//! Config uses `BackendConfig` tagged enum to describe both remote and local +//! providers in a single type (DD#66). -mod config; +pub mod config; pub mod manager; mod provider; pub use { - config::ProviderConfig, + config::{BackendConfig, ProviderConfig}, manager::ProviderManager, - provider::{Provider, ProviderKind, build_provider}, + provider::{Provider, build_provider}, }; diff --git a/app/provider/src/manager.rs b/app/provider/src/manager.rs index 57eef3a..a0f2191 100644 --- a/app/provider/src/manager.rs +++ b/app/provider/src/manager.rs @@ -39,7 +39,7 @@ impl ProviderManager { /// /// The first config in the list becomes the active provider. Returns an /// error if the list is empty or any provider fails to build. - pub fn from_configs(configs: &[ProviderConfig]) -> Result { + pub async fn from_configs(configs: &[ProviderConfig]) -> Result { if configs.is_empty() { bail!("at least one provider config is required"); } @@ -49,7 +49,7 @@ impl ProviderManager { let active = configs[0].name.clone(); for config in configs { - let provider = build_provider(config, client.clone())?; + let provider = build_provider(config, client.clone()).await?; providers.insert(config.name.clone(), provider); } @@ -99,9 +99,13 @@ impl ProviderManager { } /// Add a new provider. Replaces any existing provider with the same name. - pub fn add(&self, config: &ProviderConfig) -> Result<()> { + pub async fn add(&self, config: &ProviderConfig) -> Result<()> { + let client = { + let inner = self.inner.read().expect("provider lock poisoned"); + inner.client.clone() + }; + let provider = build_provider(config, client).await?; let mut inner = self.inner.write().expect("provider lock poisoned"); - let provider = build_provider(config, inner.client.clone())?; inner.providers.insert(config.name.clone(), provider); Ok(()) } diff --git a/app/provider/src/provider.rs b/app/provider/src/provider.rs index 67ce8a2..e7b31e9 100644 --- a/app/provider/src/provider.rs +++ b/app/provider/src/provider.rs @@ -1,6 +1,9 @@ //! Provider implementation +//! +//! Unified `Provider` enum with enum dispatch over concrete backends. +//! `build_provider()` is async to support local model loading (DD#66). -use crate::config::ProviderConfig; +use crate::config::{BackendConfig, ProviderConfig, RemoteConfig}; use anyhow::Result; use async_stream::try_stream; use claude::Claude; @@ -8,36 +11,11 @@ use deepseek::DeepSeek; use futures_core::Stream; use futures_util::StreamExt; use llm::{General, LLM, Message, Response, StreamChunk}; -use mistral::Mistral; use openai::OpenAI; -use serde::{Deserialize, Serialize}; - -/// Supported LLM provider kinds. -#[derive(Debug, Default, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)] -#[serde(rename_all = "snake_case")] -pub enum ProviderKind { - /// DeepSeek API (default). - #[default] - DeepSeek, - /// OpenAI API. - OpenAI, - /// Grok (xAI) API — OpenAI-compatible. - Grok, - /// Qwen (Alibaba DashScope) API — OpenAI-compatible. - Qwen, - /// Kimi (Moonshot) API — OpenAI-compatible. - Kimi, - /// Ollama local API — OpenAI-compatible, no key required. - Ollama, - /// Claude (Anthropic) Messages API. - Claude, - /// Mistral chat completions API. - Mistral, -} /// Unified LLM provider enum. /// -/// The gateway constructs the appropriate variant based on `ProviderKind` +/// The gateway constructs the appropriate variant based on `BackendConfig` /// in config. The runtime is monomorphized on `Provider`. #[derive(Clone)] pub enum Provider { @@ -47,54 +25,91 @@ pub enum Provider { OpenAI(OpenAI), /// Anthropic Messages API. Claude(Claude), - /// Mistral chat completions API. - Mistral(Mistral), + /// Local inference via mistralrs. + #[cfg(feature = "local")] + Local(local::Local), } /// Construct a `Provider` from config and a shared HTTP client. /// -/// `ProviderKind::DeepSeek` with a custom `base_url` maps to the OpenAI -/// variant (OpenAI-compatible endpoint). Same for Grok, Qwen, Kimi, Ollama -/// with custom URLs. -pub fn build_provider(config: &ProviderConfig, client: llm::Client) -> Result { - let key = &config.api_key; - let provider = match config.provider { - ProviderKind::DeepSeek => match &config.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), - None => Provider::DeepSeek(DeepSeek::new(client, key)?), - }, - ProviderKind::OpenAI => match &config.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), - None => Provider::OpenAI(OpenAI::api(client, key)?), - }, - ProviderKind::Grok => match &config.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), - None => Provider::OpenAI(OpenAI::grok(client, key)?), - }, - ProviderKind::Qwen => match &config.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), - None => Provider::OpenAI(OpenAI::qwen(client, key)?), - }, - ProviderKind::Kimi => match &config.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), - None => Provider::OpenAI(OpenAI::kimi(client, key)?), - }, - ProviderKind::Ollama => match &config.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, key, url)?), +/// This function is async because local providers need to load model weights +/// asynchronously. +pub async fn build_provider(config: &ProviderConfig, client: llm::Client) -> Result { + let provider = match &config.backend { + BackendConfig::DeepSeek(rc) => build_remote_deepseek(rc, client)?, + BackendConfig::OpenAI(rc) => build_remote_openai(rc, client)?, + BackendConfig::Grok(rc) => build_remote_grok(rc, client)?, + BackendConfig::Qwen(rc) => build_remote_qwen(rc, client)?, + BackendConfig::Kimi(rc) => build_remote_kimi(rc, client)?, + BackendConfig::Ollama(oc) => match &oc.base_url { + Some(url) => Provider::OpenAI(OpenAI::custom(client, "", url)?), None => Provider::OpenAI(OpenAI::ollama(client)?), }, - ProviderKind::Claude => match &config.base_url { - Some(url) => Provider::Claude(Claude::custom(client, key, url)?), - None => Provider::Claude(Claude::anthropic(client, key)?), - }, - ProviderKind::Mistral => match &config.base_url { - Some(url) => Provider::Mistral(Mistral::custom(client, key, url)?), - None => Provider::Mistral(Mistral::api(client, key)?), + BackendConfig::Claude(rc) => match &rc.base_url { + Some(url) => Provider::Claude(Claude::custom(client, &rc.api_key, url)?), + None => Provider::Claude(Claude::anthropic(client, &rc.api_key)?), }, + #[cfg(feature = "local")] + BackendConfig::Local(lc) => build_local(lc).await?, }; Ok(provider) } +fn build_remote_deepseek(rc: &RemoteConfig, client: llm::Client) -> Result { + match &rc.base_url { + Some(url) => Ok(Provider::OpenAI(OpenAI::custom(client, &rc.api_key, url)?)), + None => Ok(Provider::DeepSeek(DeepSeek::new(client, &rc.api_key)?)), + } +} + +fn build_remote_openai(rc: &RemoteConfig, client: llm::Client) -> Result { + match &rc.base_url { + Some(url) => Ok(Provider::OpenAI(OpenAI::custom(client, &rc.api_key, url)?)), + None => Ok(Provider::OpenAI(OpenAI::api(client, &rc.api_key)?)), + } +} + +fn build_remote_grok(rc: &RemoteConfig, client: llm::Client) -> Result { + match &rc.base_url { + Some(url) => Ok(Provider::OpenAI(OpenAI::custom(client, &rc.api_key, url)?)), + None => Ok(Provider::OpenAI(OpenAI::grok(client, &rc.api_key)?)), + } +} + +fn build_remote_qwen(rc: &RemoteConfig, client: llm::Client) -> Result { + match &rc.base_url { + Some(url) => Ok(Provider::OpenAI(OpenAI::custom(client, &rc.api_key, url)?)), + None => Ok(Provider::OpenAI(OpenAI::qwen(client, &rc.api_key)?)), + } +} + +fn build_remote_kimi(rc: &RemoteConfig, client: llm::Client) -> Result { + match &rc.base_url { + Some(url) => Ok(Provider::OpenAI(OpenAI::custom(client, &rc.api_key, url)?)), + None => Ok(Provider::OpenAI(OpenAI::kimi(client, &rc.api_key)?)), + } +} + +#[cfg(feature = "local")] +async fn build_local(lc: &crate::config::LocalConfig) -> Result { + use anyhow::bail; + + let provider = if let Some(model_id) = &lc.model_id { + let isq = lc.quantization.map(|q| q.to_isq()); + local::Local::from_hf(model_id, isq).await? + } else if let Some(model_path) = &lc.model_path { + local::Local::from_gguf( + model_path, + lc.model_files.clone(), + lc.chat_template.as_deref(), + ) + .await? + } else { + bail!("local provider requires either model_id or model_path"); + }; + Ok(Provider::Local(provider)) +} + impl LLM for Provider { type ChatConfig = General; @@ -112,10 +127,8 @@ impl LLM for Provider { let req = claude::Request::from(config.clone()); p.send(&req, messages).await } - Self::Mistral(p) => { - let req = mistral::Request::from(config.clone()); - p.send(&req, messages).await - } + #[cfg(feature = "local")] + Self::Local(p) => p.send(config, messages).await, } } @@ -150,9 +163,9 @@ impl LLM for Provider { yield chunk?; } } - Provider::Mistral(p) => { - let req = mistral::Request::from(config); - let mut stream = std::pin::pin!(p.stream(req, &messages, usage)); + #[cfg(feature = "local")] + Provider::Local(p) => { + let mut stream = std::pin::pin!(p.stream(config, &messages, usage)); while let Some(chunk) = stream.next().await { yield chunk?; } diff --git a/app/provider/tests/build_provider.rs b/app/provider/tests/build_provider.rs index 17e5aa8..fbd792d 100644 --- a/app/provider/tests/build_provider.rs +++ b/app/provider/tests/build_provider.rs @@ -1,81 +1,59 @@ //! Tests for `build_provider()` factory. -use walrus_provider::{ProviderConfig, ProviderKind, Provider, build_provider}; +use walrus_provider::{ + Provider, ProviderConfig, build_provider, + config::{BackendConfig, OllamaConfig, RemoteConfig}, +}; -#[test] -fn test_build_provider_deepseek_default() { +#[tokio::test] +async fn test_build_provider_deepseek_default() { let config = ProviderConfig { name: "ds".into(), - provider: ProviderKind::DeepSeek, model: "deepseek-chat".into(), - api_key: "test-key".to_string(), - base_url: None, + backend: BackendConfig::DeepSeek(RemoteConfig { + api_key: "test-key".to_string(), + base_url: None, + }), }; - let p = build_provider(&config, llm::Client::new()).unwrap(); + let p = build_provider(&config, llm::Client::new()).await.unwrap(); assert!(matches!(p, Provider::DeepSeek(_))); } -#[test] -fn test_build_provider_openai_custom_url() { +#[tokio::test] +async fn test_build_provider_openai_custom_url() { let config = ProviderConfig { name: "oai".into(), - provider: ProviderKind::OpenAI, model: "gpt-4o".into(), - api_key: "test-key".to_string(), - base_url: Some("http://localhost:8080/v1".to_string()), + backend: BackendConfig::OpenAI(RemoteConfig { + api_key: "test-key".to_string(), + base_url: Some("http://localhost:8080/v1".to_string()), + }), }; - let p = build_provider(&config, llm::Client::new()).unwrap(); + let p = build_provider(&config, llm::Client::new()).await.unwrap(); assert!(matches!(p, Provider::OpenAI(_))); } -#[test] -fn test_build_provider_ollama_no_key() { +#[tokio::test] +async fn test_build_provider_ollama_no_key() { let config = ProviderConfig { name: "ollama".into(), - provider: ProviderKind::Ollama, model: "llama3".into(), - api_key: String::new(), - base_url: None, + backend: BackendConfig::Ollama(OllamaConfig { base_url: None }), }; - let p = build_provider(&config, llm::Client::new()).unwrap(); + let p = build_provider(&config, llm::Client::new()).await.unwrap(); assert!(matches!(p, Provider::OpenAI(_))); } -#[test] -fn test_build_provider_claude_default() { +#[tokio::test] +async fn test_build_provider_claude_default() { let config = ProviderConfig { name: "claude".into(), - provider: ProviderKind::Claude, model: "claude-sonnet-4-6".into(), - api_key: "test-key".to_string(), - base_url: None, + backend: BackendConfig::Claude(RemoteConfig { + api_key: "test-key".to_string(), + base_url: None, + }), }; - let p = build_provider(&config, llm::Client::new()).unwrap(); + let p = build_provider(&config, llm::Client::new()).await.unwrap(); assert!(matches!(p, Provider::Claude(_))); } - -#[test] -fn test_build_provider_mistral_default() { - let config = ProviderConfig { - name: "mistral".into(), - provider: ProviderKind::Mistral, - model: "mistral-small-latest".into(), - api_key: "test-key".to_string(), - base_url: None, - }; - let p = build_provider(&config, llm::Client::new()).unwrap(); - assert!(matches!(p, Provider::Mistral(_))); -} - -#[test] -fn test_build_provider_mistral_custom_endpoint() { - let config = ProviderConfig { - name: "mistral-local".into(), - provider: ProviderKind::Mistral, - model: "mistral-small-latest".into(), - api_key: "test-key".to_string(), - base_url: Some("http://localhost:8080/v1/chat/completions".to_string()), - }; - let p = build_provider(&config, llm::Client::new()).unwrap(); - assert!(matches!(p, Provider::Mistral(_))); -} diff --git a/app/provider/tests/config.rs b/app/provider/tests/config.rs index c529e91..33e33df 100644 --- a/app/provider/tests/config.rs +++ b/app/provider/tests/config.rs @@ -1,26 +1,75 @@ //! Tests for `ProviderConfig`. -use walrus_provider::ProviderConfig; +use walrus_provider::{ProviderConfig, config::BackendConfig}; #[test] -fn test_provider_config_default_name() { - let json = r#"{"model": "gpt-4o", "api_key": "key"}"#; +fn test_provider_config_deepseek_from_json() { + let json = r#"{"provider": "deep_seek", "model": "deepseek-chat", "api_key": "key"}"#; let config: ProviderConfig = serde_json::from_str(json).unwrap(); assert_eq!(config.name.as_str(), "default"); + assert_eq!(config.model.as_str(), "deepseek-chat"); + assert!(matches!(config.backend, BackendConfig::DeepSeek(_))); } #[test] fn test_provider_config_custom_name() { - let json = r#"{"name": "prod", "model": "gpt-4o", "api_key": "key"}"#; + let json = + r#"{"name": "prod", "provider": "openai", "model": "gpt-4o", "api_key": "key"}"#; let config: ProviderConfig = serde_json::from_str(json).unwrap(); assert_eq!(config.name.as_str(), "prod"); + assert!(matches!(config.backend, BackendConfig::OpenAI(_))); } #[test] -fn test_provider_config_roundtrip() { - let json = r#"{"name":"test","provider":"mistral","model":"mistral-small","api_key":"k"}"#; +fn test_provider_config_claude() { + let json = r#"{"provider": "claude", "model": "claude-sonnet", "api_key": "k"}"#; let config: ProviderConfig = serde_json::from_str(json).unwrap(); - assert_eq!(config.name.as_str(), "test"); - assert_eq!(config.provider, walrus_provider::ProviderKind::Mistral); - assert_eq!(config.model.as_str(), "mistral-small"); + assert_eq!(config.kind(), "claude"); +} + +#[test] +fn test_provider_config_ollama() { + let json = r#"{"provider": "ollama", "model": "llama3"}"#; + let config: ProviderConfig = serde_json::from_str(json).unwrap(); + assert_eq!(config.kind(), "ollama"); +} + +#[cfg(feature = "local")] +#[test] +fn test_provider_config_local_hf() { + let json = r#"{ + "provider": "local", + "model": "phi-3.5-mini", + "model_id": "microsoft/Phi-3.5-mini-instruct", + "quantization": "q4k" + }"#; + let config: ProviderConfig = serde_json::from_str(json).unwrap(); + assert_eq!(config.kind(), "local"); + match &config.backend { + BackendConfig::Local(lc) => { + assert_eq!(lc.model_id.as_deref(), Some("microsoft/Phi-3.5-mini-instruct")); + assert!(lc.quantization.is_some()); + } + _ => panic!("expected Local backend"), + } +} + +#[cfg(feature = "local")] +#[test] +fn test_provider_config_local_gguf() { + let json = r#"{ + "provider": "local", + "model": "mistral-7b", + "model_path": "/models/mistral/", + "model_files": ["mistral-7b.Q4_K_M.gguf"] + }"#; + let config: ProviderConfig = serde_json::from_str(json).unwrap(); + assert_eq!(config.kind(), "local"); + match &config.backend { + BackendConfig::Local(lc) => { + assert_eq!(lc.model_path.as_deref(), Some("/models/mistral/")); + assert_eq!(lc.model_files.len(), 1); + } + _ => panic!("expected Local backend"), + } } diff --git a/app/provider/tests/manager.rs b/app/provider/tests/manager.rs index 96f658a..b64e914 100644 --- a/app/provider/tests/manager.rs +++ b/app/provider/tests/manager.rs @@ -1,30 +1,35 @@ //! Tests for `ProviderManager`. -use walrus_provider::{ProviderConfig, ProviderKind, ProviderManager}; +use walrus_provider::{ + ProviderConfig, ProviderManager, + config::{BackendConfig, RemoteConfig}, +}; fn test_configs() -> Vec { vec![ ProviderConfig { name: "primary".into(), - provider: ProviderKind::DeepSeek, model: "deepseek-chat".into(), - api_key: "key1".to_string(), - base_url: None, + backend: BackendConfig::DeepSeek(RemoteConfig { + api_key: "key1".to_string(), + base_url: None, + }), }, ProviderConfig { name: "secondary".into(), - provider: ProviderKind::OpenAI, model: "gpt-4o".into(), - api_key: "key2".to_string(), - base_url: None, + backend: BackendConfig::OpenAI(RemoteConfig { + api_key: "key2".to_string(), + base_url: None, + }), }, ] } -#[test] -fn test_manager_add_and_switch() { +#[tokio::test] +async fn test_manager_add_and_switch() { let configs = test_configs(); - let manager = ProviderManager::from_configs(&configs).unwrap(); + let manager = ProviderManager::from_configs(&configs).await.unwrap(); // First config is active by default. assert_eq!(manager.active_name().as_str(), "primary"); @@ -36,20 +41,21 @@ fn test_manager_add_and_switch() { // Add a third provider and switch to it. let third = ProviderConfig { name: "third".into(), - provider: ProviderKind::Claude, model: "claude-sonnet-4-6".into(), - api_key: "key3".to_string(), - base_url: None, + backend: BackendConfig::Claude(RemoteConfig { + api_key: "key3".to_string(), + base_url: None, + }), }; - manager.add(&third).unwrap(); + manager.add(&third).await.unwrap(); manager.switch("third").unwrap(); assert_eq!(manager.active_name().as_str(), "third"); } -#[test] -fn test_manager_remove_active_fails() { +#[tokio::test] +async fn test_manager_remove_active_fails() { let configs = test_configs(); - let manager = ProviderManager::from_configs(&configs).unwrap(); + let manager = ProviderManager::from_configs(&configs).await.unwrap(); let result = manager.remove("primary"); assert!(result.is_err()); @@ -61,10 +67,10 @@ fn test_manager_remove_active_fails() { ); } -#[test] -fn test_manager_remove_inactive() { +#[tokio::test] +async fn test_manager_remove_inactive() { let configs = test_configs(); - let manager = ProviderManager::from_configs(&configs).unwrap(); + let manager = ProviderManager::from_configs(&configs).await.unwrap(); manager.remove("secondary").unwrap(); let entries = manager.list(); @@ -72,10 +78,10 @@ fn test_manager_remove_inactive() { assert_eq!(entries[0].name.as_str(), "primary"); } -#[test] -fn test_manager_list_shows_active() { +#[tokio::test] +async fn test_manager_list_shows_active() { let configs = test_configs(); - let manager = ProviderManager::from_configs(&configs).unwrap(); + let manager = ProviderManager::from_configs(&configs).await.unwrap(); let entries = manager.list(); assert_eq!(entries.len(), 2); @@ -86,29 +92,29 @@ fn test_manager_list_shows_active() { assert!(!secondary.active); } -#[test] -fn test_manager_switch_unknown_fails() { +#[tokio::test] +async fn test_manager_switch_unknown_fails() { let configs = test_configs(); - let manager = ProviderManager::from_configs(&configs).unwrap(); + let manager = ProviderManager::from_configs(&configs).await.unwrap(); let result = manager.switch("nonexistent"); assert!(result.is_err()); assert!(result.unwrap_err().to_string().contains("not found")); } -#[test] -fn test_manager_remove_unknown_fails() { +#[tokio::test] +async fn test_manager_remove_unknown_fails() { let configs = test_configs(); - let manager = ProviderManager::from_configs(&configs).unwrap(); + let manager = ProviderManager::from_configs(&configs).await.unwrap(); let result = manager.remove("nonexistent"); assert!(result.is_err()); assert!(result.unwrap_err().to_string().contains("not found")); } -#[test] -fn test_manager_empty_configs_fails() { - let result = ProviderManager::from_configs(&[]); +#[tokio::test] +async fn test_manager_empty_configs_fails() { + let result = ProviderManager::from_configs(&[]).await; assert!(result.is_err()); assert!( result diff --git a/llm/mistral/Cargo.toml b/llm/local/Cargo.toml similarity index 53% rename from llm/mistral/Cargo.toml rename to llm/local/Cargo.toml index 9ce7bb0..c510b62 100644 --- a/llm/mistral/Cargo.toml +++ b/llm/local/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "walrus-mistral" -description = "Walrus Mistral provider implementation" -documentation = "https://docs.rs/walrus-mistral" +name = "walrus-local" +description = "Walrus local LLM provider via mistralrs" +documentation = "https://docs.rs/walrus-local" version.workspace = true edition.workspace = true authors.workspace = true @@ -11,16 +11,13 @@ keywords.workspace = true [dependencies] llm.workspace = true - -# crates-io dependencies anyhow.workspace = true async-stream.workspace = true +compact_str.workspace = true futures-core.workspace = true -futures-util.workspace = true -serde.workspace = true serde_json.workspace = true tracing.workspace = true +mistralrs.workspace = true -[dev-dependencies] -llm.workspace = true -schemars.workspace = true +[target.'cfg(target_os = "macos")'.dependencies] +mistralrs = { workspace = true, features = ["metal", "accelerate"] } diff --git a/llm/local/src/lib.rs b/llm/local/src/lib.rs new file mode 100644 index 0000000..1ed8d3a --- /dev/null +++ b/llm/local/src/lib.rs @@ -0,0 +1,52 @@ +//! Local LLM provider via mistralrs. +//! +//! Wraps `mistralrs::Model` for native on-device inference (DD#59). +//! No HTTP transport — inference runs in-process. + +use std::sync::Arc; + +mod provider; + +/// Local LLM provider wrapping a mistralrs `Model`. +#[derive(Clone)] +pub struct Local { + model: Arc, +} + +impl Local { + /// Construct from a pre-built mistralrs `Model`. + pub fn from_model(model: mistralrs::Model) -> Self { + Self { + model: Arc::new(model), + } + } + + /// Build from a HuggingFace model ID using `TextModelBuilder`. + /// + /// Optionally applies in-situ quantization via `isq`. + pub async fn from_hf( + model_id: &str, + isq: Option, + ) -> anyhow::Result { + let mut builder = mistralrs::TextModelBuilder::new(model_id).with_logging(); + if let Some(isq) = isq { + builder = builder.with_isq(isq); + } + let model = builder.build().await?; + Ok(Self::from_model(model)) + } + + /// Build from local GGUF files using `GgufModelBuilder`. + pub async fn from_gguf( + model_id: &str, + files: Vec, + chat_template: Option<&str>, + ) -> anyhow::Result { + let mut builder = mistralrs::GgufModelBuilder::new(model_id, files).with_logging(); + if let Some(template) = chat_template { + builder = builder.with_chat_template(template); + } + let model = builder.build().await?; + Ok(Self::from_model(model)) + } +} diff --git a/llm/local/src/provider.rs b/llm/local/src/provider.rs new file mode 100644 index 0000000..5eaae22 --- /dev/null +++ b/llm/local/src/provider.rs @@ -0,0 +1,244 @@ +//! LLM trait implementation for the Local provider. + +use crate::Local; +use anyhow::Result; +use async_stream::try_stream; +use compact_str::CompactString; +use futures_core::Stream; +use llm::{ + Choice, CompletionMeta, Delta, FunctionCall, General, LLM, Message, Response, Role, + StreamChunk, ToolCall, Usage, +}; +use std::collections::HashMap; + +impl LLM for Local { + type ChatConfig = General; + + async fn send(&self, config: &General, messages: &[Message]) -> Result { + let request = build_request(config, messages); + let resp = self.model.send_chat_request(request).await?; + Ok(to_response(resp)) + } + + fn stream( + &self, + config: General, + messages: &[Message], + _usage: bool, + ) -> impl Stream> + Send { + let model = self.model.clone(); + let messages = messages.to_vec(); + try_stream! { + let request = build_request(&config, &messages); + let mut stream = model.stream_chat_request(request).await?; + while let Some(resp) = stream.next().await { + match resp { + mistralrs::Response::Chunk(chunk) => { + yield to_stream_chunk(chunk); + } + mistralrs::Response::Done(_) => break, + mistralrs::Response::InternalError(e) + | mistralrs::Response::ValidationError(e) => { + Err(anyhow::anyhow!("{e}"))?; + } + mistralrs::Response::ModelError(msg, _) => { + Err(anyhow::anyhow!("model error: {msg}"))?; + } + _ => {} + } + } + } + } +} + +/// Build a mistralrs `RequestBuilder` from walrus `General` config and messages. +fn build_request(config: &General, messages: &[Message]) -> mistralrs::RequestBuilder { + let mut builder = mistralrs::RequestBuilder::new(); + + for msg in messages { + match msg.role { + Role::System => { + builder = + builder.add_message(mistralrs::TextMessageRole::System, &msg.content); + } + Role::User => { + builder = + builder.add_message(mistralrs::TextMessageRole::User, &msg.content); + } + Role::Assistant => { + if msg.tool_calls.is_empty() { + builder = builder + .add_message(mistralrs::TextMessageRole::Assistant, &msg.content); + } else { + let tool_calls = msg + .tool_calls + .iter() + .map(|tc| mistralrs::ToolCallResponse { + id: tc.id.to_string(), + tp: mistralrs::ToolCallType::Function, + function: mistralrs::CalledFunction { + name: tc.function.name.to_string(), + arguments: tc.function.arguments.clone(), + }, + index: tc.index as usize, + }) + .collect(); + builder = builder.add_message_with_tool_call( + mistralrs::TextMessageRole::Assistant, + &msg.content, + tool_calls, + ); + } + } + Role::Tool => { + builder = builder.add_tool_message(&msg.content, &msg.tool_call_id); + } + } + } + + if let Some(tools) = &config.tools { + let mr_tools = tools + .iter() + .map(|t| { + let params: HashMap = + serde_json::from_value( + serde_json::to_value(&t.parameters).unwrap_or_default(), + ) + .unwrap_or_default(); + mistralrs::Tool { + tp: mistralrs::ToolType::Function, + function: mistralrs::Function { + description: Some(t.description.clone()), + name: t.name.to_string(), + parameters: Some(params), + }, + } + }) + .collect(); + builder = builder.set_tools(mr_tools); + } + + if let Some(tool_choice) = &config.tool_choice { + let mr_choice = match tool_choice { + llm::ToolChoice::None => mistralrs::ToolChoice::None, + llm::ToolChoice::Auto | llm::ToolChoice::Required => mistralrs::ToolChoice::Auto, + llm::ToolChoice::Function(name) => { + mistralrs::ToolChoice::Tool(mistralrs::Tool { + tp: mistralrs::ToolType::Function, + function: mistralrs::Function { + description: None, + name: name.to_string(), + parameters: None, + }, + }) + } + }; + builder = builder.set_tool_choice(mr_choice); + } + + builder +} + +/// Convert a mistralrs `ChatCompletionResponse` to a walrus `Response`. +fn to_response(resp: mistralrs::ChatCompletionResponse) -> Response { + let choices = resp + .choices + .into_iter() + .map(|c| Choice { + index: c.index as u32, + delta: Delta { + role: Some(Role::Assistant), + content: c.message.content, + reasoning_content: c.message.reasoning_content, + tool_calls: c + .message + .tool_calls + .map(|tcs| tcs.into_iter().map(convert_tool_call).collect()), + }, + finish_reason: parse_finish_reason(&c.finish_reason), + logprobs: None, + }) + .collect(); + + Response { + meta: CompletionMeta { + id: CompactString::from(&resp.id), + object: CompactString::from(&resp.object), + created: resp.created, + model: CompactString::from(&resp.model), + system_fingerprint: Some(CompactString::from(&resp.system_fingerprint)), + }, + choices, + usage: convert_usage(&resp.usage), + } +} + +/// Convert a mistralrs `ChatCompletionChunkResponse` to a walrus `StreamChunk`. +fn to_stream_chunk(chunk: mistralrs::ChatCompletionChunkResponse) -> StreamChunk { + let choices = chunk + .choices + .into_iter() + .map(|c| Choice { + index: c.index as u32, + delta: Delta { + role: Some(Role::Assistant), + content: c.delta.content, + reasoning_content: c.delta.reasoning_content, + tool_calls: c + .delta + .tool_calls + .map(|tcs| tcs.into_iter().map(convert_tool_call).collect()), + }, + finish_reason: c.finish_reason.as_ref().and_then(|r| parse_finish_reason(r)), + logprobs: None, + }) + .collect(); + + StreamChunk { + meta: CompletionMeta { + id: CompactString::from(&chunk.id), + object: CompactString::from(&chunk.object), + created: chunk.created as u64, + model: CompactString::from(&chunk.model), + system_fingerprint: Some(CompactString::from(&chunk.system_fingerprint)), + }, + choices, + usage: chunk.usage.as_ref().map(convert_usage), + } +} + +/// Convert a mistralrs `ToolCallResponse` to a walrus `ToolCall`. +fn convert_tool_call(tc: mistralrs::ToolCallResponse) -> ToolCall { + ToolCall { + id: CompactString::from(&tc.id), + index: tc.index as u32, + call_type: CompactString::from("function"), + function: FunctionCall { + name: CompactString::from(&tc.function.name), + arguments: tc.function.arguments, + }, + } +} + +/// Convert a mistralrs `Usage` to a walrus `Usage`. +fn convert_usage(u: &mistralrs::Usage) -> Usage { + Usage { + prompt_tokens: u.prompt_tokens as u32, + completion_tokens: u.completion_tokens as u32, + total_tokens: u.total_tokens as u32, + prompt_cache_hit_tokens: None, + prompt_cache_miss_tokens: None, + completion_tokens_details: None, + } +} + +/// Parse a finish reason string into a walrus `FinishReason`. +fn parse_finish_reason(reason: &str) -> Option { + match reason { + "stop" => Some(llm::FinishReason::Stop), + "length" => Some(llm::FinishReason::Length), + "content_filter" => Some(llm::FinishReason::ContentFilter), + "tool_calls" => Some(llm::FinishReason::ToolCalls), + _ => None, + } +} diff --git a/llm/mistral/src/lib.rs b/llm/mistral/src/lib.rs deleted file mode 100644 index 1360695..0000000 --- a/llm/mistral/src/lib.rs +++ /dev/null @@ -1,52 +0,0 @@ -//! Mistral LLM provider. -//! -//! Supports the Mistral chat completions API and compatible endpoints. - -use llm::reqwest::{Client, header::HeaderMap}; -pub use request::Request; - -mod provider; -mod request; - -/// Mistral endpoint URLs. -pub mod endpoint { - /// Mistral chat completions endpoint. - pub const MISTRAL: &str = "https://api.mistral.ai/v1/chat/completions"; -} - -/// Mistral provider. -#[derive(Clone)] -pub struct Mistral { - /// The HTTP client. - pub client: Client, - /// Request headers (authorization, content-type). - headers: HeaderMap, - /// Chat completions endpoint URL. - endpoint: String, -} - -impl Mistral { - /// Create a provider targeting the Mistral API. - pub fn api(client: Client, key: &str) -> anyhow::Result { - Self::custom(client, key, endpoint::MISTRAL) - } - - /// Create a provider targeting a custom Mistral-compatible endpoint. - pub fn custom(client: Client, key: &str, endpoint: &str) -> anyhow::Result { - use llm::reqwest::header; - let mut headers = HeaderMap::new(); - headers.insert(header::CONTENT_TYPE, "application/json".parse()?); - headers.insert(header::ACCEPT, "application/json".parse()?); - headers.insert(header::AUTHORIZATION, format!("Bearer {key}").parse()?); - Ok(Self { - client, - headers, - endpoint: endpoint.to_owned(), - }) - } - - /// Get the endpoint URL. - pub fn endpoint(&self) -> &str { - &self.endpoint - } -} diff --git a/llm/mistral/src/provider.rs b/llm/mistral/src/provider.rs deleted file mode 100644 index 666cbf4..0000000 --- a/llm/mistral/src/provider.rs +++ /dev/null @@ -1,65 +0,0 @@ -//! LLM trait implementation for the Mistral provider. - -use crate::{Mistral, Request}; -use anyhow::Result; -use async_stream::try_stream; -use futures_core::Stream; -use futures_util::StreamExt; -use llm::{LLM, Message, Response, StreamChunk, reqwest::Method}; - -impl LLM for Mistral { - type ChatConfig = Request; - - async fn send(&self, req: &Request, messages: &[Message]) -> Result { - let body = req.messages(messages); - tracing::trace!("request: {}", serde_json::to_string(&body)?); - let text = self - .client - .request(Method::POST, &self.endpoint) - .headers(self.headers.clone()) - .json(&body) - .send() - .await? - .text() - .await?; - - serde_json::from_str(&text).map_err(Into::into) - } - - fn stream( - &self, - req: Request, - messages: &[Message], - usage: bool, - ) -> impl Stream> { - let body = req.messages(messages).stream(usage); - if let Ok(body) = serde_json::to_string(&body) { - tracing::trace!("request: {}", body); - } - let request = self - .client - .request(Method::POST, &self.endpoint) - .headers(self.headers.clone()) - .json(&body); - - try_stream! { - let response = request.send().await?; - let mut stream = response.bytes_stream(); - while let Some(next) = stream.next().await { - let bytes = next?; - let text = String::from_utf8_lossy(&bytes).into_owned(); - tracing::trace!("chunk: {}", text); - for data in text.split("data: ").skip(1).filter(|s| !s.starts_with("[DONE]")) { - let trimmed = data.trim(); - if trimmed.is_empty() { - continue; - } - match serde_json::from_str::(trimmed) { - Ok(chunk) => yield chunk, - Err(e) => tracing::warn!("failed to parse chunk: {e}, data: {trimmed}"), - } - } - } - } - } -} diff --git a/llm/mistral/src/request.rs b/llm/mistral/src/request.rs deleted file mode 100644 index d924839..0000000 --- a/llm/mistral/src/request.rs +++ /dev/null @@ -1,224 +0,0 @@ -//! Request body for Mistral chat completions API. - -use llm::{Config, General, Message, Tool, ToolChoice}; -use serde::Serialize; -use serde_json::{Value, json}; - -/// The request body for Mistral chat completions API. -#[derive(Debug, Clone, Serialize)] -pub struct Request { - /// The messages to send. - pub messages: Vec, - /// The model identifier. - pub model: String, - /// Frequency penalty. - #[serde(skip_serializing_if = "Option::is_none")] - pub frequency_penalty: Option, - /// Whether to return log probabilities. - #[serde(skip_serializing_if = "Option::is_none")] - pub logprobs: Option, - /// Maximum tokens to generate. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_tokens: Option, - /// Presence penalty. - #[serde(skip_serializing_if = "Option::is_none")] - pub presence_penalty: Option, - /// Response format. - #[serde(skip_serializing_if = "Option::is_none")] - pub response_format: Option, - /// Stop sequences. - #[serde(skip_serializing_if = "Option::is_none")] - pub stop: Option, - /// Whether to stream the response. - #[serde(skip_serializing_if = "Option::is_none")] - pub stream: Option, - /// Stream options (e.g. include_usage). - #[serde(skip_serializing_if = "Option::is_none")] - pub stream_options: Option, - /// Temperature. - #[serde(skip_serializing_if = "Option::is_none")] - pub temperature: Option, - /// Tool choice control. - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_choice: Option, - /// Tools the model may call. - #[serde(skip_serializing_if = "Option::is_none")] - pub tools: Option, - /// Top-p sampling. - #[serde(skip_serializing_if = "Option::is_none")] - pub top_p: Option, -} - -impl Request { - /// Clone the request with the given messages. - pub fn messages(&self, messages: &[Message]) -> Self { - Self { - messages: messages.to_vec(), - ..self.clone() - } - } - - /// Enable streaming for the request. - pub fn stream(mut self, usage: bool) -> Self { - self.stream = Some(true); - self.stream_options = if usage { - Some(json!({ "include_usage": true })) - } else { - None - }; - self - } -} - -impl From for Request { - fn from(config: General) -> Self { - let mut req = Self { - messages: Vec::new(), - model: config.model.to_string(), - frequency_penalty: None, - logprobs: None, - max_tokens: None, - presence_penalty: None, - response_format: None, - stop: None, - stream: None, - stream_options: None, - temperature: None, - tool_choice: None, - tools: None, - top_p: None, - }; - - if let Some(tools) = config.tools { - req = req.with_tools(tools); - } - if let Some(tool_choice) = config.tool_choice { - req = req.with_tool_choice(tool_choice); - } - - req - } -} - -impl Config for Request { - fn with_tools(self, tools: Vec) -> Self { - let tools = tools - .into_iter() - .map(|tool| { - json!({ - "type": "function", - "function": json!(tool), - }) - }) - .collect::>(); - Self { - tools: Some(json!(tools)), - ..self - } - } - - fn with_tool_choice(self, tool_choice: ToolChoice) -> Self { - Self { - tool_choice: match tool_choice { - ToolChoice::None => Some(json!("none")), - ToolChoice::Auto => Some(json!("auto")), - ToolChoice::Required => Some(json!("required")), - ToolChoice::Function(name) => Some(json!({ - "type": "function", - "function": { "name": name } - })), - }, - ..self - } - } -} - -#[cfg(test)] -mod tests { - use super::Request; - use llm::{Config, General, Tool, ToolChoice}; - - #[test] - fn request_from_general_sets_model() { - let general = General { - model: "mistral-medium".into(), - ..General::default() - }; - let req = Request::from(general); - assert_eq!(req.model, "mistral-medium"); - } - - #[test] - fn request_from_general_tools() { - let tool = Tool { - name: "search".into(), - description: "find docs".into(), - parameters: schemars::schema_for!(String), - strict: false, - }; - let general = General { - model: "mistral-small".into(), - tools: Some(vec![tool]), - ..General::default() - }; - let req = Request::from(general); - let tools = req.tools.expect("tools"); - assert_eq!(tools[0]["type"], "function"); - assert_eq!(tools[0]["function"]["name"], "search"); - } - - #[test] - fn request_from_general_tool_choice() { - let general = General { - model: "mistral-small".into(), - tool_choice: Some(ToolChoice::Function("search".into())), - ..General::default() - }; - let req = Request::from(general); - let choice = req.tool_choice.expect("tool_choice"); - assert_eq!(choice["type"], "function"); - assert_eq!(choice["function"]["name"], "search"); - } - - #[test] - fn stream_sets_include_usage() { - let req = Request::from(General::default()).stream(true); - assert_eq!(req.stream, Some(true)); - let opts = req.stream_options.expect("stream options"); - assert_eq!(opts["include_usage"], true); - } - - #[test] - fn stream_without_usage_omits_stream_options() { - let req = Request::from(General::default()).stream(false); - assert_eq!(req.stream, Some(true)); - assert!(req.stream_options.is_none()); - } - - #[test] - fn with_tool_choice_auto() { - let req = Request::from(General::default()).with_tool_choice(ToolChoice::Auto); - assert_eq!( - req.tool_choice.expect("tool choice"), - serde_json::json!("auto") - ); - } - - #[test] - fn with_tool_choice_none() { - let req = Request::from(General::default()).with_tool_choice(ToolChoice::None); - assert_eq!( - req.tool_choice.expect("tool choice"), - serde_json::json!("none") - ); - } - - #[test] - fn with_tool_choice_required() { - let req = Request::from(General::default()).with_tool_choice(ToolChoice::Required); - assert_eq!( - req.tool_choice.expect("tool choice"), - serde_json::json!("required") - ); - } -} diff --git a/llm/mistral/tests/constructors.rs b/llm/mistral/tests/constructors.rs deleted file mode 100644 index 02b1c39..0000000 --- a/llm/mistral/tests/constructors.rs +++ /dev/null @@ -1,18 +0,0 @@ -//! Tests for Mistral provider constructors. - -use walrus_mistral::{Mistral, endpoint}; - -#[test] -fn custom_constructor_sets_endpoint() { - let client = llm::Client::new(); - let custom = "http://localhost:9999/v1/chat/completions"; - let provider = Mistral::custom(client, "test-key", custom).expect("provider"); - assert_eq!(provider.endpoint(), custom); -} - -#[test] -fn api_constructor_uses_default_endpoint() { - let client = llm::Client::new(); - let provider = Mistral::api(client, "test-key").expect("provider"); - assert_eq!(provider.endpoint(), endpoint::MISTRAL); -} From d019352c87daa50d65bd59df8b40d465a795ab51 Mon Sep 17 00:00:00 2001 From: clearloop Date: Sat, 28 Feb 2026 14:57:06 +0800 Subject: [PATCH 3/8] chore(provider): merge configs for remote and local models --- Cargo.lock | 1 + app/daemon/src/config.rs | 29 +-- app/daemon/src/gateway/builder.rs | 16 +- app/daemon/src/gateway/mod.rs | 4 +- app/daemon/tests/backend.rs | 4 +- app/daemon/tests/config.rs | 103 +++++----- app/provider/src/config.rs | 258 +++++++++++++---------- app/provider/src/lib.rs | 5 +- app/provider/src/manager.rs | 83 ++++++-- app/provider/src/provider.rs | 129 +++++------- app/provider/tests/build_provider.rs | 54 ++--- app/provider/tests/config.rs | 292 ++++++++++++++++++++++----- app/provider/tests/manager.rs | 116 +++++++---- llm/local/Cargo.toml | 1 + llm/local/src/lib.rs | 59 +++++- llm/local/src/provider.rs | 39 ++-- 16 files changed, 776 insertions(+), 417 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2e83c0f..9e25cfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6508,6 +6508,7 @@ dependencies = [ "anyhow", "async-stream", "compact_str 0.8.1", + "dirs", "futures-core", "mistralrs", "serde_json", diff --git a/app/daemon/src/config.rs b/app/daemon/src/config.rs index 635f244..ffd8ea4 100644 --- a/app/daemon/src/config.rs +++ b/app/daemon/src/config.rs @@ -1,10 +1,10 @@ -//! Gateway configuration loaded from TOML. +//! Gateway configuration loaded from TOML (DD#67). use anyhow::{Context, Result}; use compact_str::CompactString; -use provider::config::{BackendConfig, RemoteConfig}; pub use provider::{ProviderConfig, ProviderManager}; use serde::{Deserialize, Serialize}; +use std::collections::BTreeMap; use std::path::Path; /// Config directory name under platform config dir. @@ -32,8 +32,8 @@ pub fn global_config_dir() -> std::path::PathBuf { pub struct GatewayConfig { /// Server bind configuration. pub server: ServerConfig, - /// LLM provider configuration. - pub llm: ProviderConfig, + /// Named LLM provider configurations (`[llm.name]` tables). + pub llm: BTreeMap, /// Memory backend configuration. #[serde(default)] pub memory: MemoryConfig, @@ -47,16 +47,21 @@ pub struct GatewayConfig { impl Default for GatewayConfig { fn default() -> Self { - Self { - server: ServerConfig::default(), - llm: ProviderConfig { - name: "default".into(), + let mut llm = BTreeMap::new(); + llm.insert( + CompactString::const_new("default"), + ProviderConfig { model: "deepseek-chat".into(), - backend: BackendConfig::DeepSeek(RemoteConfig { - api_key: "${DEEPSEEK_API_KEY}".to_owned(), - base_url: None, - }), + api_key: Some("${DEEPSEEK_API_KEY}".to_owned()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, }, + ); + Self { + server: ServerConfig::default(), + llm, memory: MemoryConfig::default(), channels: Vec::new(), mcp_servers: Vec::new(), diff --git a/app/daemon/src/gateway/builder.rs b/app/daemon/src/gateway/builder.rs index 8a11ebe..58013ed 100644 --- a/app/daemon/src/gateway/builder.rs +++ b/app/daemon/src/gateway/builder.rs @@ -4,6 +4,7 @@ use crate::MemoryBackend; use crate::config::{self, MemoryBackendKind}; use crate::gateway::GatewayHook; use anyhow::Result; +use provider::ProviderManager; use runtime::{General, McpBridge, Runtime, SkillRegistry}; use std::path::Path; @@ -32,23 +33,22 @@ pub async fn build_runtime( } }; - // Construct provider from config. - let client = llm::Client::new(); - let provider = provider::build_provider(&config.llm, client).await?; + // Construct provider manager from named config map. + let manager = ProviderManager::from_configs(&config.llm).await?; tracing::info!( - "provider {} initialized for model {}", - config.llm.kind(), - config.llm.model + "provider manager initialized — active: {} (model: {})", + manager.active_name(), + manager.active_model() ); // Build general config. let general = General { - model: config.llm.model.clone(), + model: manager.active_model(), ..General::default() }; // Build runtime. - let mut runtime = Runtime::::new(general, provider, memory); + let mut runtime = Runtime::::new(general, manager, memory); // Load agents from markdown files. let agents = runtime::load_agents_dir(&config_dir.join(config::AGENTS_DIR))?; diff --git a/app/daemon/src/gateway/mod.rs b/app/daemon/src/gateway/mod.rs index 24bfb68..7a5b42a 100644 --- a/app/daemon/src/gateway/mod.rs +++ b/app/daemon/src/gateway/mod.rs @@ -1,7 +1,7 @@ //! Protocol impls for the gateway. use crate::MemoryBackend; -use provider::Provider; +use provider::ProviderManager; use runtime::{DEFAULT_COMPACT_PROMPT, DEFAULT_FLUSH_PROMPT, Hook, Runtime}; use std::sync::Arc; @@ -27,7 +27,7 @@ impl Clone for Gateway { pub struct GatewayHook; impl Hook for GatewayHook { - type Provider = Provider; + type Provider = ProviderManager; type Memory = MemoryBackend; fn compact() -> &'static str { diff --git a/app/daemon/tests/backend.rs b/app/daemon/tests/backend.rs index 1b289ce..85a7fca 100644 --- a/app/daemon/tests/backend.rs +++ b/app/daemon/tests/backend.rs @@ -100,7 +100,6 @@ fn memory_backend_from_config_inmemory() { backend: MemoryBackendKind::InMemory, }; assert_eq!(config.backend, MemoryBackendKind::InMemory); - // Constructing in-memory should always succeed. let _backend = MemoryBackend::in_memory(); } @@ -124,8 +123,7 @@ fn default_bind_address() { let config = walrus_daemon::GatewayConfig::from_toml( r#" [server] -[llm] -provider = "deep_seek" +[llm.default] model = "deepseek-chat" api_key = "test-key" "#, diff --git a/app/daemon/tests/config.rs b/app/daemon/tests/config.rs index 9599b2e..631a54d 100644 --- a/app/daemon/tests/config.rs +++ b/app/daemon/tests/config.rs @@ -1,4 +1,4 @@ -//! Gateway configuration tests. +//! Gateway configuration tests (DD#67). use walrus_daemon::{GatewayConfig, config::MemoryBackendKind}; @@ -7,26 +7,46 @@ fn parse_minimal_config() { let toml = r#" [server] -[llm] -provider = "deep_seek" +[llm.default] model = "deepseek-chat" api_key = "test-key" "#; let config = GatewayConfig::from_toml(toml).unwrap(); assert!(config.server.socket_path.is_none()); - assert_eq!(config.llm.model.as_str(), "deepseek-chat"); - assert_eq!(config.llm.kind(), "deepseek"); + assert_eq!(config.llm.len(), 1); + let default = &config.llm["default"]; + assert_eq!(default.model.as_str(), "deepseek-chat"); assert!(config.channels.is_empty()); } +#[test] +fn parse_multi_provider() { + let toml = r#" +[server] + +[llm.ds] +model = "deepseek-chat" +api_key = "key1" + +[llm.oai] +model = "gpt-4o" +api_key = "key2" +"#; + let config = GatewayConfig::from_toml(toml).unwrap(); + assert_eq!(config.llm.len(), 2); + assert!(config.llm.contains_key("ds")); + assert!(config.llm.contains_key("oai")); + assert_eq!(config.llm["ds"].model.as_str(), "deepseek-chat"); + assert_eq!(config.llm["oai"].model.as_str(), "gpt-4o"); +} + #[test] fn parse_full_config() { let toml = r#" [server] socket_path = "/tmp/walrus.sock" -[llm] -provider = "deep_seek" +[llm.default] model = "deepseek-chat" api_key = "sk-test" @@ -60,8 +80,7 @@ fn default_memory_config() { let toml = r#" [server] -[llm] -provider = "deep_seek" +[llm.default] model = "deepseek-chat" api_key = "key" "#; @@ -74,8 +93,7 @@ fn default_socket_path() { let toml = r#" [server] -[llm] -provider = "deep_seek" +[llm.default] model = "deepseek-chat" api_key = "key" "#; @@ -90,8 +108,7 @@ fn custom_socket_path() { [server] socket_path = "/run/walrus/custom.sock" -[llm] -provider = "deep_seek" +[llm.default] model = "deepseek-chat" api_key = "key" "#; @@ -106,18 +123,13 @@ fn env_var_expansion() { let toml = r#" [server] -[llm] -provider = "deep_seek" +[llm.default] model = "deepseek-chat" api_key = "${TEST_WALRUS_KEY}" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - match &config.llm.backend { - provider::BackendConfig::DeepSeek(rc) => { - assert_eq!(rc.api_key, "expanded-value"); - } - _ => panic!("expected DeepSeek backend"), - } + let default = &config.llm["default"]; + assert_eq!(default.api_key.as_deref(), Some("expanded-value")); unsafe { std::env::remove_var("TEST_WALRUS_KEY") }; } @@ -126,8 +138,7 @@ fn mcp_server_config() { let toml = r#" [server] -[llm] -provider = "deep_seek" +[llm.default] model = "deepseek-chat" api_key = "key" @@ -161,14 +172,14 @@ fn parse_claude_provider() { let toml = r#" [server] -[llm] -provider = "claude" +[llm.claude] model = "claude-sonnet-4-20250514" api_key = "test-key" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - assert_eq!(config.llm.kind(), "claude"); - assert_eq!(config.llm.model.as_str(), "claude-sonnet-4-20250514"); + let claude = &config.llm["claude"]; + assert_eq!(claude.model.as_str(), "claude-sonnet-4-20250514"); + assert_eq!(claude.kind().unwrap().as_str(), "claude"); } #[test] @@ -176,23 +187,18 @@ fn parse_openai_with_base_url() { let toml = r#" [server] -[llm] -provider = "openai" +[llm.oai] model = "gpt-4o" api_key = "test-key" base_url = "http://localhost:8080/v1/chat/completions" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - assert_eq!(config.llm.kind(), "openai"); - match &config.llm.backend { - provider::BackendConfig::OpenAI(rc) => { - assert_eq!( - rc.base_url.as_deref(), - Some("http://localhost:8080/v1/chat/completions") - ); - } - _ => panic!("expected OpenAI backend"), - } + let oai = &config.llm["oai"]; + assert_eq!(oai.kind().unwrap().as_str(), "openai"); + assert_eq!( + oai.base_url.as_deref(), + Some("http://localhost:8080/v1/chat/completions") + ); } #[test] @@ -200,13 +206,20 @@ fn parse_local_provider() { let toml = r#" [server] -[llm] -provider = "local" -model = "phi-3.5-mini" -model_id = "microsoft/Phi-3.5-mini-instruct" +[llm.phi] +model = "microsoft/Phi-3.5-mini-instruct" quantization = "q4k" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - assert_eq!(config.llm.kind(), "local"); - assert_eq!(config.llm.model.as_str(), "phi-3.5-mini"); + let phi = &config.llm["phi"]; + assert_eq!(phi.kind().unwrap().as_str(), "local"); + assert_eq!(phi.model.as_str(), "microsoft/Phi-3.5-mini-instruct"); +} + +#[test] +fn default_config_serializes() { + let config = GatewayConfig::default(); + let toml_str = toml::to_string_pretty(&config).unwrap(); + // Should roundtrip. + let _parsed: GatewayConfig = toml::from_str(&toml_str).unwrap(); } diff --git a/app/provider/src/config.rs b/app/provider/src/config.rs index 2347b10..dfbc7e5 100644 --- a/app/provider/src/config.rs +++ b/app/provider/src/config.rs @@ -1,148 +1,206 @@ -//! Provider configuration +//! Provider configuration (DD#67). //! -//! Unified config for both remote (API-key-based) and local (model-path-based) -//! providers. Uses `#[serde(tag = "provider", flatten)]` so all fields appear -//! at the same level in TOML (DD#66). +//! Flat `ProviderConfig` with optional fields for both remote and local +//! providers. Provider kind inferred from model name prefix via `kind()`. +//! `Loader` selects which mistralrs builder to use for local models. +use anyhow::{Result, bail}; use compact_str::CompactString; use serde::{Deserialize, Serialize}; -/// Named provider configuration. Combines identity (`name`) with the -/// provider-specific backend settings via `BackendConfig`. +/// Flat provider configuration. All fields except `model` are optional. +/// Provider kind is inferred from the model name — no explicit `provider` tag. #[derive(Debug, Serialize, Deserialize, Clone)] pub struct ProviderConfig { - /// Unique name for this provider entry. Defaults to `"default"`. - #[serde(default = "default_name")] - pub name: CompactString, - /// Model identifier. Passed to `General::model` when constructing requests. + /// Model identifier. Remote models use known prefixes (`deepseek-*`, + /// `gpt-*`, `claude-*`, etc.). Local models use HuggingFace repo IDs + /// containing `/` (e.g. `microsoft/Phi-3.5-mini-instruct`). pub model: CompactString, - /// Provider-specific settings, discriminated by the `provider` field. - #[serde(flatten)] - pub backend: BackendConfig, + /// API key for remote providers. Supports `${ENV_VAR}` expansion at the + /// daemon layer. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub api_key: Option, + /// Base URL override for remote providers. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub base_url: Option, + /// Mistralrs model builder to use for local models. Defaults to `Text`. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub loader: Option, + /// In-situ quantization for local models. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub quantization: Option, + /// Chat template override for local models (path or inline Jinja). + #[serde(default, skip_serializing_if = "Option::is_none")] + pub chat_template: Option, } impl ProviderConfig { - /// Human-readable provider kind string for logging and protocol messages. - pub fn kind(&self) -> &'static str { - match &self.backend { - BackendConfig::DeepSeek(_) => "deepseek", - BackendConfig::OpenAI(_) => "openai", - BackendConfig::Grok(_) => "grok", - BackendConfig::Qwen(_) => "qwen", - BackendConfig::Kimi(_) => "kimi", - BackendConfig::Ollama(_) => "ollama", - BackendConfig::Claude(_) => "claude", - #[cfg(feature = "local")] - BackendConfig::Local(_) => "local", + /// Detect the provider kind from the model name. + pub fn kind(&self) -> Result { + ProviderKind::from_model(&self.model) + } + + /// Validate field combinations. + /// + /// Called on startup and on provider add/reload. + pub fn validate(&self) -> Result<()> { + if self.model.is_empty() { + bail!("model is required"); } + + let kind = self.kind()?; + + match kind { + ProviderKind::Local => { + if self.api_key.is_some() { + bail!("local provider '{}' must not have api_key", self.model); + } + } + _ => { + // Remote providers: api_key is required unless base_url is set + // (e.g. Ollama which is keyless with a local base_url). + if self.api_key.is_none() && self.base_url.is_none() { + bail!( + "remote provider '{}' requires api_key or base_url", + self.model + ); + } + if self.loader.is_some() { + bail!( + "remote provider '{}' must not have loader field", + self.model + ); + } + if self.quantization.is_some() { + bail!( + "remote provider '{}' must not have quantization field", + self.model + ); + } + if self.chat_template.is_some() { + bail!( + "remote provider '{}' must not have chat_template field", + self.model + ); + } + } + } + + Ok(()) } } -/// Provider-specific configuration, discriminated by the `provider` field -/// in TOML/JSON. -#[derive(Debug, Serialize, Deserialize, Clone)] -#[serde(tag = "provider", rename_all = "snake_case")] -pub enum BackendConfig { - /// DeepSeek API (default). - DeepSeek(RemoteConfig), - /// OpenAI API. - #[serde(rename = "openai")] - OpenAI(RemoteConfig), - /// Grok (xAI) API — OpenAI-compatible. - Grok(RemoteConfig), - /// Qwen (Alibaba DashScope) API — OpenAI-compatible. - Qwen(RemoteConfig), - /// Kimi (Moonshot) API — OpenAI-compatible. - Kimi(RemoteConfig), - /// Ollama local API — OpenAI-compatible, no key required. - Ollama(OllamaConfig), - /// Claude (Anthropic) Messages API. - Claude(RemoteConfig), - /// Local inference via mistralrs (DD#59). - #[cfg(feature = "local")] - Local(LocalConfig), +/// Provider kind, inferred from the model name at runtime. +/// +/// Not serialized — purely a dispatch enum. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ProviderKind { + DeepSeek, + OpenAI, + Claude, + Grok, + Qwen, + Kimi, + Local, } -/// Configuration for remote HTTP API providers. -#[derive(Debug, Serialize, Deserialize, Clone, Default)] -pub struct RemoteConfig { - /// API key (supports `${ENV_VAR}` expansion at the daemon layer). - #[serde(default)] - pub api_key: String, - /// Optional base URL override for the provider endpoint. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub base_url: Option, -} +impl ProviderKind { + /// Detect provider kind from a model name string. + /// + /// Rules: + /// 1. If model contains `/` → Local (HuggingFace repo ID). + /// 2. Otherwise, match known remote prefixes. + /// 3. No match → error. + pub fn from_model(model: &str) -> Result { + if model.contains('/') { + return Ok(Self::Local); + } -/// Configuration for Ollama (OpenAI-compatible, no key required). -#[derive(Debug, Serialize, Deserialize, Clone, Default)] -pub struct OllamaConfig { - /// Optional base URL override. Defaults to `http://localhost:11434/v1/chat/completions`. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub base_url: Option, + let prefixes: &[(&[&str], ProviderKind)] = &[ + (&["deepseek-"], ProviderKind::DeepSeek), + (&["gpt-", "o1-", "o3-", "o4-"], ProviderKind::OpenAI), + (&["claude-"], ProviderKind::Claude), + (&["grok-"], ProviderKind::Grok), + (&["qwen-", "qwq-"], ProviderKind::Qwen), + (&["kimi-", "moonshot-"], ProviderKind::Kimi), + ]; + + for (patterns, kind) in prefixes { + for prefix in *patterns { + if model.starts_with(prefix) { + return Ok(*kind); + } + } + } + + bail!("unknown model prefix: '{model}' — cannot detect provider kind") + } + + /// Human-readable name for logging. + pub fn as_str(self) -> &'static str { + match self { + Self::DeepSeek => "deepseek", + Self::OpenAI => "openai", + Self::Claude => "claude", + Self::Grok => "grok", + Self::Qwen => "qwen", + Self::Kimi => "kimi", + Self::Local => "local", + } + } } -/// Configuration for local inference via mistralrs. -#[cfg(feature = "local")] -#[derive(Debug, Serialize, Deserialize, Clone, Default)] -pub struct LocalConfig { - /// HuggingFace model ID for `TextModelBuilder` (e.g. `"microsoft/Phi-3.5-mini-instruct"`). - /// Mutually exclusive with `model_path`. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub model_id: Option, - /// Local directory path for `GgufModelBuilder`. - /// Mutually exclusive with `model_id`. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub model_path: Option, - /// GGUF filenames (required when `model_path` is set). - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub model_files: Vec, - /// In-situ quantization type. `None` means no ISQ. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub quantization: Option, - /// Optional chat template override (path or inline Jinja). - #[serde(default, skip_serializing_if = "Option::is_none")] - pub chat_template: Option, +/// Selects which mistralrs model builder to use for local inference. +/// +/// Defaults to `Text` when omitted in config. +#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default)] +#[serde(rename_all = "snake_case")] +pub enum Loader { + /// `TextModelBuilder` — standard text models. + #[default] + Text, + /// `LoraModelBuilder` — LoRA adapter models. + Lora, + /// `XLoraModelBuilder` — X-LoRA adapter models. + #[serde(rename = "xlora")] + XLora, + /// `GgufModelBuilder` — GGUF quantized models. + Gguf, + /// `GgufLoraModelBuilder` — GGUF + LoRA. + #[serde(rename = "gguf_lora")] + GgufLora, + /// `GgufXLoraModelBuilder` — GGUF + X-LoRA. + #[serde(rename = "gguf_xlora")] + GgufXLora, + /// `VisionModelBuilder` — vision-language models. + Vision, } /// Quantization types supported by mistralrs (maps to `IsqType`). -#[cfg(feature = "local")] #[derive(Debug, Serialize, Deserialize, Clone, Copy)] pub enum QuantizationType { - /// GGML Q4_0. #[serde(rename = "q4_0")] Q4_0, - /// GGML Q4_1. #[serde(rename = "q4_1")] Q4_1, - /// GGML Q5_0. #[serde(rename = "q5_0")] Q5_0, - /// GGML Q5_1. #[serde(rename = "q5_1")] Q5_1, - /// GGML Q8_0. #[serde(rename = "q8_0")] Q8_0, - /// GGML Q8_1. #[serde(rename = "q8_1")] Q8_1, - /// GGML Q2K. #[serde(rename = "q2k")] Q2K, - /// GGML Q3K. #[serde(rename = "q3k")] Q3K, - /// GGML Q4K. #[serde(rename = "q4k")] Q4K, - /// GGML Q5K. #[serde(rename = "q5k")] Q5K, - /// GGML Q6K. #[serde(rename = "q6k")] Q6K, - /// GGML Q8K. #[serde(rename = "q8k")] Q8K, } @@ -167,7 +225,3 @@ impl QuantizationType { } } } - -fn default_name() -> CompactString { - CompactString::const_new("default") -} diff --git a/app/provider/src/lib.rs b/app/provider/src/lib.rs index 6735549..2b36827 100644 --- a/app/provider/src/lib.rs +++ b/app/provider/src/lib.rs @@ -4,15 +4,14 @@ //! `Provider` enum wraps concrete backends (DeepSeek, OpenAI, Claude, Local) //! behind a unified `LLM` impl. `ProviderManager` holds a named map of //! providers with concurrent-safe active-provider swapping (DD#60, DD#65). -//! Config uses `BackendConfig` tagged enum to describe both remote and local -//! providers in a single type (DD#66). +//! Config uses flat `ProviderConfig` with model-prefix kind detection (DD#67). pub mod config; pub mod manager; mod provider; pub use { - config::{BackendConfig, ProviderConfig}, + config::{ProviderConfig, ProviderKind}, manager::ProviderManager, provider::{Provider, build_provider}, }; diff --git a/app/provider/src/manager.rs b/app/provider/src/manager.rs index a0f2191..e563a8b 100644 --- a/app/provider/src/manager.rs +++ b/app/provider/src/manager.rs @@ -1,9 +1,13 @@ //! `ProviderManager` — concurrent-safe named provider map with active-provider -//! swapping (DD#65). +//! swapping (DD#65, DD#67). use crate::{Provider, ProviderConfig, build_provider}; use anyhow::{Result, bail}; +use async_stream::try_stream; use compact_str::CompactString; +use futures_core::Stream; +use futures_util::StreamExt; +use llm::{General, LLM, Message, Response, StreamChunk}; use std::collections::BTreeMap; use std::sync::{Arc, RwLock}; @@ -17,8 +21,8 @@ pub struct ProviderManager { } struct Inner { - /// Named provider instances. - providers: BTreeMap, + /// Named provider instances with their configs. + providers: BTreeMap, /// Name of the currently active provider. active: CompactString, /// Shared HTTP client for constructing new providers. @@ -35,24 +39,31 @@ pub struct ProviderEntry { } impl ProviderManager { - /// Create a new manager from a list of provider configs. + /// Create a new manager from a named map of provider configs. /// - /// The first config in the list becomes the active provider. Returns an - /// error if the list is empty or any provider fails to build. - pub async fn from_configs(configs: &[ProviderConfig]) -> Result { + /// The first key (BTreeMap alphabetical order) becomes the active provider. + /// Returns an error if the map is empty, any config fails validation, or + /// any provider fails to build. + pub async fn from_configs(configs: &BTreeMap) -> Result { if configs.is_empty() { bail!("at least one provider config is required"); } let client = llm::Client::new(); let mut providers = BTreeMap::new(); - let active = configs[0].name.clone(); - for config in configs { + for (name, config) in configs { + config.validate()?; let provider = build_provider(config, client.clone()).await?; - providers.insert(config.name.clone(), provider); + providers.insert(name.clone(), (config.clone(), provider)); } + let active = providers + .keys() + .next() + .expect("non-empty checked above") + .clone(); + Ok(Self { inner: Arc::new(RwLock::new(Inner { providers, @@ -63,9 +74,9 @@ impl ProviderManager { } /// Create a manager with a single provider. - pub fn single(name: CompactString, provider: Provider) -> Self { + pub fn single(name: CompactString, config: ProviderConfig, provider: Provider) -> Self { let mut providers = BTreeMap::new(); - providers.insert(name.clone(), provider); + providers.insert(name.clone(), (config, provider)); Self { inner: Arc::new(RwLock::new(Inner { providers, @@ -78,7 +89,7 @@ impl ProviderManager { /// Get a clone of the active provider. pub fn active(&self) -> Provider { let inner = self.inner.read().expect("provider lock poisoned"); - inner.providers[&inner.active].clone() + inner.providers[&inner.active].1.clone() } /// Get the name of the active provider. @@ -87,6 +98,18 @@ impl ProviderManager { inner.active.clone() } + /// Get the model identifier of the active provider. + pub fn active_model(&self) -> CompactString { + let inner = self.inner.read().expect("provider lock poisoned"); + inner.providers[&inner.active].0.model.clone() + } + + /// Get a clone of the active provider's config. + pub fn active_config(&self) -> ProviderConfig { + let inner = self.inner.read().expect("provider lock poisoned"); + inner.providers[&inner.active].0.clone() + } + /// Switch to a different provider by name. Returns an error if the name /// is not found. pub fn switch(&self, name: &str) -> Result<()> { @@ -98,15 +121,19 @@ impl ProviderManager { Ok(()) } - /// Add a new provider. Replaces any existing provider with the same name. - pub async fn add(&self, config: &ProviderConfig) -> Result<()> { + /// Add a new provider. Validates config first. Replaces any existing + /// provider with the same name. + pub async fn add(&self, name: &str, config: &ProviderConfig) -> Result<()> { + config.validate()?; let client = { let inner = self.inner.read().expect("provider lock poisoned"); inner.client.clone() }; let provider = build_provider(config, client).await?; let mut inner = self.inner.write().expect("provider lock poisoned"); - inner.providers.insert(config.name.clone(), provider); + inner + .providers + .insert(CompactString::from(name), (config.clone(), provider)); Ok(()) } @@ -136,6 +163,30 @@ impl ProviderManager { } } +impl LLM for ProviderManager { + type ChatConfig = General; + + async fn send(&self, config: &General, messages: &[Message]) -> Result { + self.active().send(config, messages).await + } + + fn stream( + &self, + config: General, + messages: &[Message], + usage: bool, + ) -> impl Stream> + Send { + let provider = self.active(); + let messages = messages.to_vec(); + try_stream! { + let mut stream = std::pin::pin!(provider.stream(config, &messages, usage)); + while let Some(chunk) = stream.next().await { + yield chunk?; + } + } + } +} + impl std::fmt::Debug for ProviderManager { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let inner = self.inner.read().expect("provider lock poisoned"); diff --git a/app/provider/src/provider.rs b/app/provider/src/provider.rs index e7b31e9..82a1c92 100644 --- a/app/provider/src/provider.rs +++ b/app/provider/src/provider.rs @@ -1,9 +1,9 @@ -//! Provider implementation +//! Provider implementation (DD#67). //! //! Unified `Provider` enum with enum dispatch over concrete backends. -//! `build_provider()` is async to support local model loading (DD#66). +//! `build_provider()` matches on `ProviderKind` detected from the model name. -use crate::config::{BackendConfig, ProviderConfig, RemoteConfig}; +use crate::config::{ProviderConfig, ProviderKind}; use anyhow::Result; use async_stream::try_stream; use claude::Claude; @@ -15,8 +15,8 @@ use openai::OpenAI; /// Unified LLM provider enum. /// -/// The gateway constructs the appropriate variant based on `BackendConfig` -/// in config. The runtime is monomorphized on `Provider`. +/// The gateway constructs the appropriate variant based on `ProviderKind` +/// detected from the model name. The runtime is monomorphized on `Provider`. #[derive(Clone)] pub enum Provider { /// DeepSeek API. @@ -35,81 +35,64 @@ pub enum Provider { /// This function is async because local providers need to load model weights /// asynchronously. pub async fn build_provider(config: &ProviderConfig, client: llm::Client) -> Result { - let provider = match &config.backend { - BackendConfig::DeepSeek(rc) => build_remote_deepseek(rc, client)?, - BackendConfig::OpenAI(rc) => build_remote_openai(rc, client)?, - BackendConfig::Grok(rc) => build_remote_grok(rc, client)?, - BackendConfig::Qwen(rc) => build_remote_qwen(rc, client)?, - BackendConfig::Kimi(rc) => build_remote_kimi(rc, client)?, - BackendConfig::Ollama(oc) => match &oc.base_url { - Some(url) => Provider::OpenAI(OpenAI::custom(client, "", url)?), - None => Provider::OpenAI(OpenAI::ollama(client)?), + let kind = config.kind()?; + let api_key = config.api_key.as_deref().unwrap_or(""); + let base_url = config.base_url.as_deref(); + + let provider = match kind { + ProviderKind::DeepSeek => match base_url { + Some(url) => Provider::OpenAI(OpenAI::custom(client, api_key, url)?), + None => Provider::DeepSeek(DeepSeek::new(client, api_key)?), + }, + ProviderKind::OpenAI => match base_url { + Some(url) => Provider::OpenAI(OpenAI::custom(client, api_key, url)?), + None => Provider::OpenAI(OpenAI::api(client, api_key)?), + }, + ProviderKind::Claude => match base_url { + Some(url) => Provider::Claude(Claude::custom(client, api_key, url)?), + None => Provider::Claude(Claude::anthropic(client, api_key)?), + }, + ProviderKind::Grok => match base_url { + Some(url) => Provider::OpenAI(OpenAI::custom(client, api_key, url)?), + None => Provider::OpenAI(OpenAI::grok(client, api_key)?), }, - BackendConfig::Claude(rc) => match &rc.base_url { - Some(url) => Provider::Claude(Claude::custom(client, &rc.api_key, url)?), - None => Provider::Claude(Claude::anthropic(client, &rc.api_key)?), + ProviderKind::Qwen => match base_url { + Some(url) => Provider::OpenAI(OpenAI::custom(client, api_key, url)?), + None => Provider::OpenAI(OpenAI::qwen(client, api_key)?), + }, + ProviderKind::Kimi => match base_url { + Some(url) => Provider::OpenAI(OpenAI::custom(client, api_key, url)?), + None => Provider::OpenAI(OpenAI::kimi(client, api_key)?), }, #[cfg(feature = "local")] - BackendConfig::Local(lc) => build_local(lc).await?, + ProviderKind::Local => { + use crate::config::Loader; + let loader = config.loader.unwrap_or_default(); + let isq = config.quantization.map(|q| q.to_isq()); + let chat_template = config.chat_template.as_deref(); + let local = match loader { + Loader::Text => local::Local::from_text(&config.model, isq, chat_template).await?, + Loader::Gguf => local::Local::from_gguf(&config.model, chat_template).await?, + Loader::Vision => { + local::Local::from_vision(&config.model, isq, chat_template).await? + } + Loader::Lora | Loader::XLora | Loader::GgufLora | Loader::GgufXLora => { + anyhow::bail!( + "loader {:?} requires adapter configuration (not yet supported)", + loader + ); + } + }; + Provider::Local(local) + } + #[cfg(not(feature = "local"))] + ProviderKind::Local => { + anyhow::bail!("local provider requires the 'local' feature"); + } }; Ok(provider) } -fn build_remote_deepseek(rc: &RemoteConfig, client: llm::Client) -> Result { - match &rc.base_url { - Some(url) => Ok(Provider::OpenAI(OpenAI::custom(client, &rc.api_key, url)?)), - None => Ok(Provider::DeepSeek(DeepSeek::new(client, &rc.api_key)?)), - } -} - -fn build_remote_openai(rc: &RemoteConfig, client: llm::Client) -> Result { - match &rc.base_url { - Some(url) => Ok(Provider::OpenAI(OpenAI::custom(client, &rc.api_key, url)?)), - None => Ok(Provider::OpenAI(OpenAI::api(client, &rc.api_key)?)), - } -} - -fn build_remote_grok(rc: &RemoteConfig, client: llm::Client) -> Result { - match &rc.base_url { - Some(url) => Ok(Provider::OpenAI(OpenAI::custom(client, &rc.api_key, url)?)), - None => Ok(Provider::OpenAI(OpenAI::grok(client, &rc.api_key)?)), - } -} - -fn build_remote_qwen(rc: &RemoteConfig, client: llm::Client) -> Result { - match &rc.base_url { - Some(url) => Ok(Provider::OpenAI(OpenAI::custom(client, &rc.api_key, url)?)), - None => Ok(Provider::OpenAI(OpenAI::qwen(client, &rc.api_key)?)), - } -} - -fn build_remote_kimi(rc: &RemoteConfig, client: llm::Client) -> Result { - match &rc.base_url { - Some(url) => Ok(Provider::OpenAI(OpenAI::custom(client, &rc.api_key, url)?)), - None => Ok(Provider::OpenAI(OpenAI::kimi(client, &rc.api_key)?)), - } -} - -#[cfg(feature = "local")] -async fn build_local(lc: &crate::config::LocalConfig) -> Result { - use anyhow::bail; - - let provider = if let Some(model_id) = &lc.model_id { - let isq = lc.quantization.map(|q| q.to_isq()); - local::Local::from_hf(model_id, isq).await? - } else if let Some(model_path) = &lc.model_path { - local::Local::from_gguf( - model_path, - lc.model_files.clone(), - lc.chat_template.as_deref(), - ) - .await? - } else { - bail!("local provider requires either model_id or model_path"); - }; - Ok(Provider::Local(provider)) -} - impl LLM for Provider { type ChatConfig = General; diff --git a/app/provider/tests/build_provider.rs b/app/provider/tests/build_provider.rs index fbd792d..ce5f985 100644 --- a/app/provider/tests/build_provider.rs +++ b/app/provider/tests/build_provider.rs @@ -1,58 +1,58 @@ -//! Tests for `build_provider()` factory. +//! Tests for `build_provider()` factory (DD#67). -use walrus_provider::{ - Provider, ProviderConfig, build_provider, - config::{BackendConfig, OllamaConfig, RemoteConfig}, -}; +use walrus_provider::{Provider, ProviderConfig, build_provider}; #[tokio::test] -async fn test_build_provider_deepseek_default() { +async fn build_deepseek_default() { let config = ProviderConfig { - name: "ds".into(), model: "deepseek-chat".into(), - backend: BackendConfig::DeepSeek(RemoteConfig { - api_key: "test-key".to_string(), - base_url: None, - }), + api_key: Some("test-key".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, }; let p = build_provider(&config, llm::Client::new()).await.unwrap(); assert!(matches!(p, Provider::DeepSeek(_))); } #[tokio::test] -async fn test_build_provider_openai_custom_url() { +async fn build_openai_custom_url() { let config = ProviderConfig { - name: "oai".into(), model: "gpt-4o".into(), - backend: BackendConfig::OpenAI(RemoteConfig { - api_key: "test-key".to_string(), - base_url: Some("http://localhost:8080/v1".to_string()), - }), + api_key: Some("test-key".into()), + base_url: Some("http://localhost:8080/v1".into()), + loader: None, + quantization: None, + chat_template: None, }; let p = build_provider(&config, llm::Client::new()).await.unwrap(); assert!(matches!(p, Provider::OpenAI(_))); } #[tokio::test] -async fn test_build_provider_ollama_no_key() { +async fn build_ollama_base_url_only() { let config = ProviderConfig { - name: "ollama".into(), - model: "llama3".into(), - backend: BackendConfig::Ollama(OllamaConfig { base_url: None }), + model: "gpt-4o".into(), + api_key: None, + base_url: Some("http://localhost:11434/v1/chat/completions".into()), + loader: None, + quantization: None, + chat_template: None, }; let p = build_provider(&config, llm::Client::new()).await.unwrap(); assert!(matches!(p, Provider::OpenAI(_))); } #[tokio::test] -async fn test_build_provider_claude_default() { +async fn build_claude_default() { let config = ProviderConfig { - name: "claude".into(), model: "claude-sonnet-4-6".into(), - backend: BackendConfig::Claude(RemoteConfig { - api_key: "test-key".to_string(), - base_url: None, - }), + api_key: Some("test-key".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, }; let p = build_provider(&config, llm::Client::new()).await.unwrap(); assert!(matches!(p, Provider::Claude(_))); diff --git a/app/provider/tests/config.rs b/app/provider/tests/config.rs index 33e33df..ca61a57 100644 --- a/app/provider/tests/config.rs +++ b/app/provider/tests/config.rs @@ -1,75 +1,259 @@ -//! Tests for `ProviderConfig`. +//! Tests for `ProviderConfig` (DD#67). -use walrus_provider::{ProviderConfig, config::BackendConfig}; +use walrus_provider::{ProviderConfig, ProviderKind}; + +// --- kind detection --- #[test] -fn test_provider_config_deepseek_from_json() { - let json = r#"{"provider": "deep_seek", "model": "deepseek-chat", "api_key": "key"}"#; - let config: ProviderConfig = serde_json::from_str(json).unwrap(); - assert_eq!(config.name.as_str(), "default"); - assert_eq!(config.model.as_str(), "deepseek-chat"); - assert!(matches!(config.backend, BackendConfig::DeepSeek(_))); +fn kind_deepseek() { + let config = ProviderConfig { + model: "deepseek-chat".into(), + api_key: Some("k".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert_eq!(config.kind().unwrap(), ProviderKind::DeepSeek); } #[test] -fn test_provider_config_custom_name() { - let json = - r#"{"name": "prod", "provider": "openai", "model": "gpt-4o", "api_key": "key"}"#; - let config: ProviderConfig = serde_json::from_str(json).unwrap(); - assert_eq!(config.name.as_str(), "prod"); - assert!(matches!(config.backend, BackendConfig::OpenAI(_))); +fn kind_openai() { + let config = ProviderConfig { + model: "gpt-4o".into(), + api_key: Some("k".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert_eq!(config.kind().unwrap(), ProviderKind::OpenAI); } #[test] -fn test_provider_config_claude() { - let json = r#"{"provider": "claude", "model": "claude-sonnet", "api_key": "k"}"#; - let config: ProviderConfig = serde_json::from_str(json).unwrap(); - assert_eq!(config.kind(), "claude"); +fn kind_openai_o_series() { + for model in &["o1-preview", "o3-mini", "o4-mini"] { + let config = ProviderConfig { + model: (*model).into(), + api_key: Some("k".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert_eq!( + config.kind().unwrap(), + ProviderKind::OpenAI, + "model: {model}" + ); + } } #[test] -fn test_provider_config_ollama() { - let json = r#"{"provider": "ollama", "model": "llama3"}"#; - let config: ProviderConfig = serde_json::from_str(json).unwrap(); - assert_eq!(config.kind(), "ollama"); +fn kind_claude() { + let config = ProviderConfig { + model: "claude-sonnet-4-20250514".into(), + api_key: Some("k".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert_eq!(config.kind().unwrap(), ProviderKind::Claude); +} + +#[test] +fn kind_grok() { + let config = ProviderConfig { + model: "grok-3".into(), + api_key: Some("k".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert_eq!(config.kind().unwrap(), ProviderKind::Grok); +} + +#[test] +fn kind_qwen() { + let config = ProviderConfig { + model: "qwen-plus".into(), + api_key: Some("k".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert_eq!(config.kind().unwrap(), ProviderKind::Qwen); } -#[cfg(feature = "local")] #[test] -fn test_provider_config_local_hf() { - let json = r#"{ - "provider": "local", - "model": "phi-3.5-mini", - "model_id": "microsoft/Phi-3.5-mini-instruct", - "quantization": "q4k" - }"#; +fn kind_qwq() { + let config = ProviderConfig { + model: "qwq-32b".into(), + api_key: Some("k".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert_eq!(config.kind().unwrap(), ProviderKind::Qwen); +} + +#[test] +fn kind_kimi() { + let config = ProviderConfig { + model: "kimi-latest".into(), + api_key: Some("k".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert_eq!(config.kind().unwrap(), ProviderKind::Kimi); +} + +#[test] +fn kind_moonshot() { + let config = ProviderConfig { + model: "moonshot-v1-128k".into(), + api_key: Some("k".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert_eq!(config.kind().unwrap(), ProviderKind::Kimi); +} + +#[test] +fn kind_local() { + let config = ProviderConfig { + model: "microsoft/Phi-3.5-mini-instruct".into(), + api_key: None, + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert_eq!(config.kind().unwrap(), ProviderKind::Local); +} + +#[test] +fn kind_unknown_prefix_errors() { + let config = ProviderConfig { + model: "foobar-model".into(), + api_key: Some("k".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert!(config.kind().is_err()); +} + +// --- validation --- + +#[test] +fn validate_remote_ok() { + let config = ProviderConfig { + model: "deepseek-chat".into(), + api_key: Some("key".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + config.validate().unwrap(); +} + +#[test] +fn validate_remote_with_base_url_no_key() { + let config = ProviderConfig { + model: "gpt-4o".into(), + api_key: None, + base_url: Some("http://localhost:8080/v1".into()), + loader: None, + quantization: None, + chat_template: None, + }; + config.validate().unwrap(); +} + +#[test] +fn validate_remote_missing_key_and_url() { + let config = ProviderConfig { + model: "deepseek-chat".into(), + api_key: None, + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert!(config.validate().is_err()); +} + +#[test] +fn validate_local_rejects_api_key() { + let config = ProviderConfig { + model: "microsoft/Phi-3.5-mini-instruct".into(), + api_key: Some("key".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + let err = config.validate().unwrap_err(); + assert!(err.to_string().contains("must not have api_key")); +} + +#[test] +fn validate_remote_rejects_loader() { + use walrus_provider::config::Loader; + let config = ProviderConfig { + model: "deepseek-chat".into(), + api_key: Some("key".into()), + base_url: None, + loader: Some(Loader::Text), + quantization: None, + chat_template: None, + }; + let err = config.validate().unwrap_err(); + assert!(err.to_string().contains("must not have loader")); +} + +#[test] +fn validate_empty_model() { + let config = ProviderConfig { + model: "".into(), + api_key: None, + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + let err = config.validate().unwrap_err(); + assert!(err.to_string().contains("model is required")); +} + +// --- serde round-trip --- + +#[test] +fn deserialize_flat_remote() { + let json = r#"{"model": "deepseek-chat", "api_key": "test-key"}"#; let config: ProviderConfig = serde_json::from_str(json).unwrap(); - assert_eq!(config.kind(), "local"); - match &config.backend { - BackendConfig::Local(lc) => { - assert_eq!(lc.model_id.as_deref(), Some("microsoft/Phi-3.5-mini-instruct")); - assert!(lc.quantization.is_some()); - } - _ => panic!("expected Local backend"), - } + assert_eq!(config.model.as_str(), "deepseek-chat"); + assert_eq!(config.api_key.as_deref(), Some("test-key")); + assert!(config.loader.is_none()); } -#[cfg(feature = "local")] #[test] -fn test_provider_config_local_gguf() { - let json = r#"{ - "provider": "local", - "model": "mistral-7b", - "model_path": "/models/mistral/", - "model_files": ["mistral-7b.Q4_K_M.gguf"] - }"#; +fn deserialize_flat_local_with_loader() { + let json = + r#"{"model": "microsoft/Phi-3.5-mini-instruct", "loader": "gguf", "quantization": "q4k"}"#; let config: ProviderConfig = serde_json::from_str(json).unwrap(); - assert_eq!(config.kind(), "local"); - match &config.backend { - BackendConfig::Local(lc) => { - assert_eq!(lc.model_path.as_deref(), Some("/models/mistral/")); - assert_eq!(lc.model_files.len(), 1); - } - _ => panic!("expected Local backend"), - } + assert_eq!(config.kind().unwrap(), ProviderKind::Local); + assert!(config.loader.is_some()); + assert!(config.quantization.is_some()); } diff --git a/app/provider/tests/manager.rs b/app/provider/tests/manager.rs index b64e914..04a9476 100644 --- a/app/provider/tests/manager.rs +++ b/app/provider/tests/manager.rs @@ -1,62 +1,100 @@ -//! Tests for `ProviderManager`. +//! Tests for `ProviderManager` (DD#67). -use walrus_provider::{ - ProviderConfig, ProviderManager, - config::{BackendConfig, RemoteConfig}, -}; +use compact_str::CompactString; +use std::collections::BTreeMap; +use walrus_provider::{ProviderConfig, ProviderManager}; -fn test_configs() -> Vec { - vec![ +fn test_configs() -> BTreeMap { + let mut map = BTreeMap::new(); + map.insert( + "primary".into(), ProviderConfig { - name: "primary".into(), model: "deepseek-chat".into(), - backend: BackendConfig::DeepSeek(RemoteConfig { - api_key: "key1".to_string(), - base_url: None, - }), + api_key: Some("key1".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, }, + ); + map.insert( + "secondary".into(), ProviderConfig { - name: "secondary".into(), model: "gpt-4o".into(), - backend: BackendConfig::OpenAI(RemoteConfig { - api_key: "key2".to_string(), - base_url: None, - }), + api_key: Some("key2".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, }, - ] + ); + map } #[tokio::test] -async fn test_manager_add_and_switch() { +async fn from_btreemap_first_key_active() { let configs = test_configs(); let manager = ProviderManager::from_configs(&configs).await.unwrap(); - - // First config is active by default. + // BTreeMap sorts alphabetically — "primary" < "secondary". assert_eq!(manager.active_name().as_str(), "primary"); +} - // Switch to secondary. +#[tokio::test] +async fn active_model_returns_model() { + let configs = test_configs(); + let manager = ProviderManager::from_configs(&configs).await.unwrap(); + assert_eq!(manager.active_model().as_str(), "deepseek-chat"); +} + +#[tokio::test] +async fn switch_and_active_config() { + let configs = test_configs(); + let manager = ProviderManager::from_configs(&configs).await.unwrap(); manager.switch("secondary").unwrap(); assert_eq!(manager.active_name().as_str(), "secondary"); + assert_eq!(manager.active_model().as_str(), "gpt-4o"); + let config = manager.active_config(); + assert_eq!(config.model.as_str(), "gpt-4o"); +} - // Add a third provider and switch to it. +#[tokio::test] +async fn add_and_switch() { + let configs = test_configs(); + let manager = ProviderManager::from_configs(&configs).await.unwrap(); let third = ProviderConfig { - name: "third".into(), model: "claude-sonnet-4-6".into(), - backend: BackendConfig::Claude(RemoteConfig { - api_key: "key3".to_string(), - base_url: None, - }), + api_key: Some("key3".into()), + base_url: None, + loader: None, + quantization: None, + chat_template: None, }; - manager.add(&third).await.unwrap(); + manager.add("third", &third).await.unwrap(); manager.switch("third").unwrap(); assert_eq!(manager.active_name().as_str(), "third"); + assert_eq!(manager.active_model().as_str(), "claude-sonnet-4-6"); } #[tokio::test] -async fn test_manager_remove_active_fails() { +async fn add_validates_config() { let configs = test_configs(); let manager = ProviderManager::from_configs(&configs).await.unwrap(); + // Missing api_key and base_url for remote model — should fail validation. + let invalid = ProviderConfig { + model: "deepseek-chat".into(), + api_key: None, + base_url: None, + loader: None, + quantization: None, + chat_template: None, + }; + assert!(manager.add("invalid", &invalid).await.is_err()); +} +#[tokio::test] +async fn remove_active_fails() { + let configs = test_configs(); + let manager = ProviderManager::from_configs(&configs).await.unwrap(); let result = manager.remove("primary"); assert!(result.is_err()); assert!( @@ -68,10 +106,9 @@ async fn test_manager_remove_active_fails() { } #[tokio::test] -async fn test_manager_remove_inactive() { +async fn remove_inactive() { let configs = test_configs(); let manager = ProviderManager::from_configs(&configs).await.unwrap(); - manager.remove("secondary").unwrap(); let entries = manager.list(); assert_eq!(entries.len(), 1); @@ -79,13 +116,11 @@ async fn test_manager_remove_inactive() { } #[tokio::test] -async fn test_manager_list_shows_active() { +async fn list_shows_active() { let configs = test_configs(); let manager = ProviderManager::from_configs(&configs).await.unwrap(); - let entries = manager.list(); assert_eq!(entries.len(), 2); - let primary = entries.iter().find(|e| e.name == "primary").unwrap(); let secondary = entries.iter().find(|e| e.name == "secondary").unwrap(); assert!(primary.active); @@ -93,28 +128,27 @@ async fn test_manager_list_shows_active() { } #[tokio::test] -async fn test_manager_switch_unknown_fails() { +async fn switch_unknown_fails() { let configs = test_configs(); let manager = ProviderManager::from_configs(&configs).await.unwrap(); - let result = manager.switch("nonexistent"); assert!(result.is_err()); assert!(result.unwrap_err().to_string().contains("not found")); } #[tokio::test] -async fn test_manager_remove_unknown_fails() { +async fn remove_unknown_fails() { let configs = test_configs(); let manager = ProviderManager::from_configs(&configs).await.unwrap(); - let result = manager.remove("nonexistent"); assert!(result.is_err()); assert!(result.unwrap_err().to_string().contains("not found")); } #[tokio::test] -async fn test_manager_empty_configs_fails() { - let result = ProviderManager::from_configs(&[]).await; +async fn empty_configs_fails() { + let configs: BTreeMap = BTreeMap::new(); + let result = ProviderManager::from_configs(&configs).await; assert!(result.is_err()); assert!( result diff --git a/llm/local/Cargo.toml b/llm/local/Cargo.toml index c510b62..b8758d5 100644 --- a/llm/local/Cargo.toml +++ b/llm/local/Cargo.toml @@ -14,6 +14,7 @@ llm.workspace = true anyhow.workspace = true async-stream.workspace = true compact_str.workspace = true +dirs.workspace = true futures-core.workspace = true serde_json.workspace = true tracing.workspace = true diff --git a/llm/local/src/lib.rs b/llm/local/src/lib.rs index 1ed8d3a..2977884 100644 --- a/llm/local/src/lib.rs +++ b/llm/local/src/lib.rs @@ -1,8 +1,11 @@ -//! Local LLM provider via mistralrs. +//! Local LLM provider via mistralrs (DD#67). //! -//! Wraps `mistralrs::Model` for native on-device inference (DD#59). +//! Wraps `mistralrs::Model` for native on-device inference. //! No HTTP transport — inference runs in-process. +//! Provides per-builder constructors: `from_text()`, `from_gguf()`, +//! `from_vision()`. All use the walrus model cache directory. +use std::path::PathBuf; use std::sync::Arc; mod provider; @@ -21,28 +24,56 @@ impl Local { } } - /// Build from a HuggingFace model ID using `TextModelBuilder`. + /// Build using `TextModelBuilder`. /// - /// Optionally applies in-situ quantization via `isq`. - pub async fn from_hf( + /// Standard text models from HuggingFace. + pub async fn from_text( model_id: &str, isq: Option, + chat_template: Option<&str>, ) -> anyhow::Result { - let mut builder = mistralrs::TextModelBuilder::new(model_id).with_logging(); + let mut builder = mistralrs::TextModelBuilder::new(model_id) + .with_logging() + .from_hf_cache_pathf(cache_dir()); if let Some(isq) = isq { builder = builder.with_isq(isq); } + if let Some(template) = chat_template { + builder = builder.with_chat_template(template); + } let model = builder.build().await?; Ok(Self::from_model(model)) } - /// Build from local GGUF files using `GgufModelBuilder`. - pub async fn from_gguf( + /// Build using `GgufModelBuilder`. + /// + /// GGUF quantized models from HuggingFace. The `model_id` is the HF repo + /// ID; mistralrs auto-discovers GGUF files in the repo. + pub async fn from_gguf(model_id: &str, chat_template: Option<&str>) -> anyhow::Result { + // Pass empty files vec — mistralrs will auto-detect GGUF files. + let mut builder = + mistralrs::GgufModelBuilder::new(model_id, Vec::::new()).with_logging(); + if let Some(template) = chat_template { + builder = builder.with_chat_template(template); + } + let model = builder.build().await?; + Ok(Self::from_model(model)) + } + + /// Build using `VisionModelBuilder`. + /// + /// Vision-language models from HuggingFace. + pub async fn from_vision( model_id: &str, - files: Vec, + isq: Option, chat_template: Option<&str>, ) -> anyhow::Result { - let mut builder = mistralrs::GgufModelBuilder::new(model_id, files).with_logging(); + let mut builder = mistralrs::VisionModelBuilder::new(model_id) + .with_logging() + .from_hf_cache_pathf(cache_dir()); + if let Some(isq) = isq { + builder = builder.with_isq(isq); + } if let Some(template) = chat_template { builder = builder.with_chat_template(template); } @@ -50,3 +81,11 @@ impl Local { Ok(Self::from_model(model)) } } + +/// Walrus model cache directory: `~/.cache/walrus/models/`. +fn cache_dir() -> PathBuf { + dirs::cache_dir() + .expect("no platform cache directory") + .join("walrus") + .join("models") +} diff --git a/llm/local/src/provider.rs b/llm/local/src/provider.rs index 5eaae22..0704f5c 100644 --- a/llm/local/src/provider.rs +++ b/llm/local/src/provider.rs @@ -58,17 +58,15 @@ fn build_request(config: &General, messages: &[Message]) -> mistralrs::RequestBu for msg in messages { match msg.role { Role::System => { - builder = - builder.add_message(mistralrs::TextMessageRole::System, &msg.content); + builder = builder.add_message(mistralrs::TextMessageRole::System, &msg.content); } Role::User => { - builder = - builder.add_message(mistralrs::TextMessageRole::User, &msg.content); + builder = builder.add_message(mistralrs::TextMessageRole::User, &msg.content); } Role::Assistant => { if msg.tool_calls.is_empty() { - builder = builder - .add_message(mistralrs::TextMessageRole::Assistant, &msg.content); + builder = + builder.add_message(mistralrs::TextMessageRole::Assistant, &msg.content); } else { let tool_calls = msg .tool_calls @@ -101,10 +99,8 @@ fn build_request(config: &General, messages: &[Message]) -> mistralrs::RequestBu .iter() .map(|t| { let params: HashMap = - serde_json::from_value( - serde_json::to_value(&t.parameters).unwrap_or_default(), - ) - .unwrap_or_default(); + serde_json::from_value(serde_json::to_value(&t.parameters).unwrap_or_default()) + .unwrap_or_default(); mistralrs::Tool { tp: mistralrs::ToolType::Function, function: mistralrs::Function { @@ -122,16 +118,14 @@ fn build_request(config: &General, messages: &[Message]) -> mistralrs::RequestBu let mr_choice = match tool_choice { llm::ToolChoice::None => mistralrs::ToolChoice::None, llm::ToolChoice::Auto | llm::ToolChoice::Required => mistralrs::ToolChoice::Auto, - llm::ToolChoice::Function(name) => { - mistralrs::ToolChoice::Tool(mistralrs::Tool { - tp: mistralrs::ToolType::Function, - function: mistralrs::Function { - description: None, - name: name.to_string(), - parameters: None, - }, - }) - } + llm::ToolChoice::Function(name) => mistralrs::ToolChoice::Tool(mistralrs::Tool { + tp: mistralrs::ToolType::Function, + function: mistralrs::Function { + description: None, + name: name.to_string(), + parameters: None, + }, + }), }; builder = builder.set_tool_choice(mr_choice); } @@ -189,7 +183,10 @@ fn to_stream_chunk(chunk: mistralrs::ChatCompletionChunkResponse) -> StreamChunk .tool_calls .map(|tcs| tcs.into_iter().map(convert_tool_call).collect()), }, - finish_reason: c.finish_reason.as_ref().and_then(|r| parse_finish_reason(r)), + finish_reason: c + .finish_reason + .as_ref() + .and_then(|r| parse_finish_reason(r)), logprobs: None, }) .collect(); From 2718a048c16860d794da408a07b3007de311ea5e Mon Sep 17 00:00:00 2001 From: clearloop Date: Sat, 28 Feb 2026 14:58:41 +0800 Subject: [PATCH 4/8] chore(daemon): rename llm to models --- app/daemon/src/config.rs | 8 ++++---- app/daemon/src/gateway/builder.rs | 2 +- app/daemon/tests/config.rs | 22 +++++++++++----------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/daemon/src/config.rs b/app/daemon/src/config.rs index ffd8ea4..eb40700 100644 --- a/app/daemon/src/config.rs +++ b/app/daemon/src/config.rs @@ -33,7 +33,7 @@ pub struct GatewayConfig { /// Server bind configuration. pub server: ServerConfig, /// Named LLM provider configurations (`[llm.name]` tables). - pub llm: BTreeMap, + pub models: BTreeMap, /// Memory backend configuration. #[serde(default)] pub memory: MemoryConfig, @@ -47,8 +47,8 @@ pub struct GatewayConfig { impl Default for GatewayConfig { fn default() -> Self { - let mut llm = BTreeMap::new(); - llm.insert( + let mut models = BTreeMap::new(); + models.insert( CompactString::const_new("default"), ProviderConfig { model: "deepseek-chat".into(), @@ -61,7 +61,7 @@ impl Default for GatewayConfig { ); Self { server: ServerConfig::default(), - llm, + models, memory: MemoryConfig::default(), channels: Vec::new(), mcp_servers: Vec::new(), diff --git a/app/daemon/src/gateway/builder.rs b/app/daemon/src/gateway/builder.rs index 58013ed..752438e 100644 --- a/app/daemon/src/gateway/builder.rs +++ b/app/daemon/src/gateway/builder.rs @@ -34,7 +34,7 @@ pub async fn build_runtime( }; // Construct provider manager from named config map. - let manager = ProviderManager::from_configs(&config.llm).await?; + let manager = ProviderManager::from_configs(&config.models).await?; tracing::info!( "provider manager initialized — active: {} (model: {})", manager.active_name(), diff --git a/app/daemon/tests/config.rs b/app/daemon/tests/config.rs index 631a54d..99acced 100644 --- a/app/daemon/tests/config.rs +++ b/app/daemon/tests/config.rs @@ -13,8 +13,8 @@ api_key = "test-key" "#; let config = GatewayConfig::from_toml(toml).unwrap(); assert!(config.server.socket_path.is_none()); - assert_eq!(config.llm.len(), 1); - let default = &config.llm["default"]; + assert_eq!(config.models.len(), 1); + let default = &config.models["default"]; assert_eq!(default.model.as_str(), "deepseek-chat"); assert!(config.channels.is_empty()); } @@ -33,11 +33,11 @@ model = "gpt-4o" api_key = "key2" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - assert_eq!(config.llm.len(), 2); - assert!(config.llm.contains_key("ds")); - assert!(config.llm.contains_key("oai")); - assert_eq!(config.llm["ds"].model.as_str(), "deepseek-chat"); - assert_eq!(config.llm["oai"].model.as_str(), "gpt-4o"); + assert_eq!(config.models.len(), 2); + assert!(config.models.contains_key("ds")); + assert!(config.models.contains_key("oai")); + assert_eq!(config.models["ds"].model.as_str(), "deepseek-chat"); + assert_eq!(config.models["oai"].model.as_str(), "gpt-4o"); } #[test] @@ -128,7 +128,7 @@ model = "deepseek-chat" api_key = "${TEST_WALRUS_KEY}" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - let default = &config.llm["default"]; + let default = &config.models["default"]; assert_eq!(default.api_key.as_deref(), Some("expanded-value")); unsafe { std::env::remove_var("TEST_WALRUS_KEY") }; } @@ -177,7 +177,7 @@ model = "claude-sonnet-4-20250514" api_key = "test-key" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - let claude = &config.llm["claude"]; + let claude = &config.models["claude"]; assert_eq!(claude.model.as_str(), "claude-sonnet-4-20250514"); assert_eq!(claude.kind().unwrap().as_str(), "claude"); } @@ -193,7 +193,7 @@ api_key = "test-key" base_url = "http://localhost:8080/v1/chat/completions" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - let oai = &config.llm["oai"]; + let oai = &config.models["oai"]; assert_eq!(oai.kind().unwrap().as_str(), "openai"); assert_eq!( oai.base_url.as_deref(), @@ -211,7 +211,7 @@ model = "microsoft/Phi-3.5-mini-instruct" quantization = "q4k" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - let phi = &config.llm["phi"]; + let phi = &config.models["phi"]; assert_eq!(phi.kind().unwrap().as_str(), "local"); assert_eq!(phi.model.as_str(), "microsoft/Phi-3.5-mini-instruct"); } From b1ad1480ab9968f4b8c413e3590c151407a3fe9f Mon Sep 17 00:00:00 2001 From: clearloop Date: Sat, 28 Feb 2026 16:13:47 +0800 Subject: [PATCH 5/8] refactor(daemon): clean daemon configs --- app/cli/src/cmd/mod.rs | 6 +- app/cli/src/config.rs | 8 +- app/cli/src/repl.rs | 4 +- app/cli/tests/prefs.rs | 2 +- app/client/src/lib.rs | 8 +- app/client/tests/config.rs | 2 +- app/daemon/src/bin/main.rs | 2 +- app/daemon/src/config.rs | 78 ++++-------------- app/daemon/src/gateway/builder.rs | 25 ++---- app/daemon/src/gateway/serve.rs | 15 +--- app/daemon/tests/backend.rs | 41 +--------- app/daemon/tests/config.rs | 129 ++++++++---------------------- app/daemon/tests/gateway.rs | 14 ---- app/provider/src/manager.rs | 72 ++++++++--------- app/provider/tests/manager.rs | 50 ++++-------- 15 files changed, 121 insertions(+), 335 deletions(-) delete mode 100644 app/daemon/tests/gateway.rs diff --git a/app/cli/src/cmd/mod.rs b/app/cli/src/cmd/mod.rs index 7a42404..254cca1 100644 --- a/app/cli/src/cmd/mod.rs +++ b/app/cli/src/cmd/mod.rs @@ -38,9 +38,9 @@ impl Cli { /// Resolve the socket path from CLI flag or default. fn resolve_socket(&self) -> PathBuf { self.socket.clone().unwrap_or_else(|| { - dirs::config_dir() - .expect("no platform config directory") - .join("walrus") + dirs::home_dir() + .expect("no home directory") + .join(".walrus") .join("walrus.sock") }) } diff --git a/app/cli/src/config.rs b/app/cli/src/config.rs index 958661c..c45bdf4 100644 --- a/app/cli/src/config.rs +++ b/app/cli/src/config.rs @@ -1,13 +1,13 @@ //! Configuration resolution for the CLI. //! -//! Resolves the path to `~/.config/walrus/gateway.toml` for config commands. +//! Resolves the path to `~/.walrus/gateway.toml` for config commands. use std::path::PathBuf; /// Resolve the config file path. pub fn resolve_config_path() -> PathBuf { - dirs::config_dir() - .expect("no platform config directory") - .join("walrus") + dirs::home_dir() + .expect("no home directory") + .join(".walrus") .join("gateway.toml") } diff --git a/app/cli/src/repl.rs b/app/cli/src/repl.rs index 6e6f31c..5f9bcd7 100644 --- a/app/cli/src/repl.rs +++ b/app/cli/src/repl.rs @@ -69,9 +69,9 @@ impl ChatRepl { } } -/// Resolve the history file path at `~/.config/walrus/history`. +/// Resolve the history file path at `~/.walrus/history`. fn history_file_path() -> Option { - dirs::config_dir().map(|d| d.join("walrus").join("history")) + dirs::home_dir().map(|d| d.join(".walrus").join("history")) } /// Consume a stream of content chunks and print them to stdout in real time. diff --git a/app/cli/tests/prefs.rs b/app/cli/tests/prefs.rs index 99ff600..c62dbec 100644 --- a/app/cli/tests/prefs.rs +++ b/app/cli/tests/prefs.rs @@ -5,5 +5,5 @@ use walrus_cli::config::resolve_config_path; #[test] fn config_path_global_default() { let path = resolve_config_path(); - assert!(path.ends_with("walrus/gateway.toml")); + assert!(path.ends_with(".walrus/gateway.toml")); } diff --git a/app/client/src/lib.rs b/app/client/src/lib.rs index 14f3aa3..9e55488 100644 --- a/app/client/src/lib.rs +++ b/app/client/src/lib.rs @@ -21,11 +21,11 @@ impl Default for ClientConfig { } } -/// Default socket path: `~/.config/walrus/walrus.sock`. +/// Default socket path: `~/.walrus/walrus.sock`. fn default_socket_path() -> PathBuf { - dirs::config_dir() - .expect("no platform config directory") - .join("walrus") + dirs::home_dir() + .expect("no home directory") + .join(".walrus") .join("walrus.sock") } diff --git a/app/client/tests/config.rs b/app/client/tests/config.rs index af018cb..00c07bb 100644 --- a/app/client/tests/config.rs +++ b/app/client/tests/config.rs @@ -5,7 +5,7 @@ use walrus_client::{ClientConfig, WalrusClient}; #[test] fn client_config_defaults() { let config = ClientConfig::default(); - assert!(config.socket_path.ends_with("walrus/walrus.sock")); + assert!(config.socket_path.ends_with(".walrus/walrus.sock")); } #[test] diff --git a/app/daemon/src/bin/main.rs b/app/daemon/src/bin/main.rs index eb55608..43cc2dc 100644 --- a/app/daemon/src/bin/main.rs +++ b/app/daemon/src/bin/main.rs @@ -20,7 +20,7 @@ async fn main() -> Result<()> { tracing::info!("created config directory at {}", config_dir.display()); } - let handle = walrus_daemon::serve(&config_dir, None).await?; + let handle = walrus_daemon::serve(&config_dir).await?; tracing::info!("walrusd listening on {}", handle.socket_path.display()); signal::ctrl_c().await?; diff --git a/app/daemon/src/config.rs b/app/daemon/src/config.rs index eb40700..3457c92 100644 --- a/app/daemon/src/config.rs +++ b/app/daemon/src/config.rs @@ -4,11 +4,8 @@ use anyhow::{Context, Result}; use compact_str::CompactString; pub use provider::{ProviderConfig, ProviderManager}; use serde::{Deserialize, Serialize}; -use std::collections::BTreeMap; -use std::path::Path; +use std::path::{Path, PathBuf}; -/// Config directory name under platform config dir. -pub const CONFIG_DIR: &str = "walrus"; /// Agents subdirectory (contains *.md files). pub const AGENTS_DIR: &str = "agents"; /// Skills subdirectory. @@ -20,23 +17,21 @@ pub const DATA_DIR: &str = "data"; /// SQLite memory database filename. pub const MEMORY_DB: &str = "memory.db"; -/// Resolve the global configuration directory (`~/.config/walrus/` on unix). -pub fn global_config_dir() -> std::path::PathBuf { - dirs::config_dir() - .expect("no platform config directory") - .join(CONFIG_DIR) +/// Resolve the global configuration directory (`~/.walrus/`). +pub fn global_config_dir() -> PathBuf { + dirs::home_dir().expect("no home directory").join(".walrus") +} + +/// Pinned socket path (`~/.walrus/walrus.sock`). +pub fn socket_path() -> PathBuf { + global_config_dir().join("walrus.sock") } /// Top-level gateway configuration. #[derive(Debug, Serialize, Deserialize)] pub struct GatewayConfig { - /// Server bind configuration. - pub server: ServerConfig, - /// Named LLM provider configurations (`[llm.name]` tables). - pub models: BTreeMap, - /// Memory backend configuration. - #[serde(default)] - pub memory: MemoryConfig, + /// LLM provider configurations (`[[models]]` array). + pub models: Vec, /// Channel configurations. #[serde(default)] pub channels: Vec, @@ -47,56 +42,21 @@ pub struct GatewayConfig { impl Default for GatewayConfig { fn default() -> Self { - let mut models = BTreeMap::new(); - models.insert( - CompactString::const_new("default"), - ProviderConfig { + Self { + models: vec![ProviderConfig { model: "deepseek-chat".into(), api_key: Some("${DEEPSEEK_API_KEY}".to_owned()), base_url: None, loader: None, quantization: None, chat_template: None, - }, - ); - Self { - server: ServerConfig::default(), - models, - memory: MemoryConfig::default(), + }], channels: Vec::new(), mcp_servers: Vec::new(), } } } -/// Server configuration. -#[derive(Debug, Default, Serialize, Deserialize)] -#[serde(default)] -pub struct ServerConfig { - /// Custom Unix domain socket path. When `None`, defaults to - /// `/walrus.sock`. - pub socket_path: Option, -} - -/// Memory backend configuration. -#[derive(Debug, Default, Serialize, Deserialize)] -#[serde(default)] -pub struct MemoryConfig { - /// Backend type: "in_memory" or "sqlite". - pub backend: MemoryBackendKind, -} - -/// Memory backend kind. -#[derive(Debug, Default, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)] -#[serde(rename_all = "snake_case")] -pub enum MemoryBackendKind { - /// In-memory backend (no persistence). - #[default] - InMemory, - /// SQLite-backed persistent memory. - Sqlite, -} - /// Channel configuration. #[derive(Debug, Serialize, Deserialize)] pub struct ChannelConfig { @@ -157,16 +117,6 @@ impl GatewayConfig { let content = std::fs::read_to_string(path)?; Self::from_toml(&content) } - - /// Resolve the socket path. Uses the explicit config value if set, - /// otherwise defaults to `/walrus.sock`. - pub fn socket_path(&self, config_dir: &std::path::Path) -> std::path::PathBuf { - self.server - .socket_path - .as_ref() - .map(std::path::PathBuf::from) - .unwrap_or_else(|| config_dir.join("walrus.sock")) - } } /// Scaffold the full config directory structure on first run. diff --git a/app/daemon/src/gateway/builder.rs b/app/daemon/src/gateway/builder.rs index 752438e..29fe801 100644 --- a/app/daemon/src/gateway/builder.rs +++ b/app/daemon/src/gateway/builder.rs @@ -1,7 +1,7 @@ //! Runtime builder — constructs a fully-configured Runtime from GatewayConfig. use crate::MemoryBackend; -use crate::config::{self, MemoryBackendKind}; +use crate::config; use crate::gateway::GatewayHook; use anyhow::Result; use provider::ProviderManager; @@ -17,27 +17,14 @@ pub async fn build_runtime( config: &crate::GatewayConfig, config_dir: &Path, ) -> Result> { - // Construct memory backend. - let memory = match config.memory.backend { - MemoryBackendKind::InMemory => { - tracing::info!("using in-memory backend"); - MemoryBackend::in_memory() - } - MemoryBackendKind::Sqlite => { - let data_dir = config_dir.join(config::DATA_DIR); - std::fs::create_dir_all(&data_dir)?; - let db_path = data_dir.join(config::MEMORY_DB); - let path = db_path.to_str().expect("non-UTF-8 config path"); - tracing::info!("using sqlite backend at {path}"); - MemoryBackend::sqlite(path)? - } - }; + // Construct in-memory backend. + let memory = MemoryBackend::in_memory(); + tracing::info!("using in-memory backend"); - // Construct provider manager from named config map. + // Construct provider manager from config list. let manager = ProviderManager::from_configs(&config.models).await?; tracing::info!( - "provider manager initialized — active: {} (model: {})", - manager.active_name(), + "provider manager initialized — active model: {}", manager.active_model() ); diff --git a/app/daemon/src/gateway/serve.rs b/app/daemon/src/gateway/serve.rs index 649f9c4..42eac4f 100644 --- a/app/daemon/src/gateway/serve.rs +++ b/app/daemon/src/gateway/serve.rs @@ -32,22 +32,17 @@ impl ServeHandle { /// Load config, build runtime, bind the Unix domain socket, and start serving. /// -/// `socket_path` overrides the config value when `Some`. /// Returns a [`ServeHandle`] with the socket path and a shutdown trigger. -pub async fn serve(config_dir: &Path, socket_path: Option<&Path>) -> Result { +pub async fn serve(config_dir: &Path) -> Result { let config_path = config_dir.join("gateway.toml"); let config = GatewayConfig::load(&config_path)?; tracing::info!("loaded configuration from {}", config_path.display()); - serve_with_config(&config, config_dir, socket_path).await + serve_with_config(&config, config_dir).await } /// Serve with an already-loaded config. Useful when the caller resolves /// config separately (e.g. CLI with scaffold logic). -pub async fn serve_with_config( - config: &GatewayConfig, - config_dir: &Path, - socket_path: Option<&Path>, -) -> Result { +pub async fn serve_with_config(config: &GatewayConfig, config_dir: &Path) -> Result { use crate::gateway::uds; use std::sync::Arc; @@ -57,9 +52,7 @@ pub async fn serve_with_config( runtime: Arc::new(runtime), }; - let resolved_path = socket_path - .map(PathBuf::from) - .unwrap_or_else(|| config.socket_path(config_dir)); + let resolved_path = crate::config::socket_path(); // Ensure the parent directory exists. if let Some(parent) = resolved_path.parent() { diff --git a/app/daemon/tests/backend.rs b/app/daemon/tests/backend.rs index 85a7fca..0270e46 100644 --- a/app/daemon/tests/backend.rs +++ b/app/daemon/tests/backend.rs @@ -1,4 +1,4 @@ -//! Tests for the MemoryBackend enum dispatch and configuration integration. +//! Tests for the MemoryBackend enum dispatch. use walrus_daemon::MemoryBackend; @@ -92,42 +92,3 @@ async fn in_memory_backend_compile_relevant() { let compiled = backend.compile_relevant("sky color").await; assert!(compiled.contains("the sky is blue")); } - -#[test] -fn memory_backend_from_config_inmemory() { - use walrus_daemon::config::{MemoryBackendKind, MemoryConfig}; - let config = MemoryConfig { - backend: MemoryBackendKind::InMemory, - }; - assert_eq!(config.backend, MemoryBackendKind::InMemory); - let _backend = MemoryBackend::in_memory(); -} - -#[test] -fn memory_backend_from_config_sqlite() { - use walrus_daemon::config::{MemoryBackendKind, MemoryConfig}; - let dir = tempfile::tempdir().unwrap(); - let path = dir.path().join("cfg.db"); - let config = MemoryConfig { - backend: MemoryBackendKind::Sqlite, - }; - assert_eq!(config.backend, MemoryBackendKind::Sqlite); - let backend = MemoryBackend::sqlite(path.to_str().unwrap()).unwrap(); - use wcore::Memory; - backend.set("test", "ok"); - assert_eq!(backend.get("test").unwrap(), "ok"); -} - -#[test] -fn default_bind_address() { - let config = walrus_daemon::GatewayConfig::from_toml( - r#" -[server] -[llm.default] -model = "deepseek-chat" -api_key = "test-key" -"#, - ) - .unwrap(); - assert!(config.server.socket_path.is_none()); -} diff --git a/app/daemon/tests/config.rs b/app/daemon/tests/config.rs index 99acced..1d77280 100644 --- a/app/daemon/tests/config.rs +++ b/app/daemon/tests/config.rs @@ -1,58 +1,44 @@ //! Gateway configuration tests (DD#67). -use walrus_daemon::{GatewayConfig, config::MemoryBackendKind}; +use walrus_daemon::GatewayConfig; #[test] fn parse_minimal_config() { let toml = r#" -[server] - -[llm.default] +[[models]] model = "deepseek-chat" api_key = "test-key" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - assert!(config.server.socket_path.is_none()); assert_eq!(config.models.len(), 1); - let default = &config.models["default"]; - assert_eq!(default.model.as_str(), "deepseek-chat"); + assert_eq!(config.models[0].model.as_str(), "deepseek-chat"); assert!(config.channels.is_empty()); } #[test] fn parse_multi_provider() { let toml = r#" -[server] - -[llm.ds] +[[models]] model = "deepseek-chat" api_key = "key1" -[llm.oai] +[[models]] model = "gpt-4o" api_key = "key2" "#; let config = GatewayConfig::from_toml(toml).unwrap(); assert_eq!(config.models.len(), 2); - assert!(config.models.contains_key("ds")); - assert!(config.models.contains_key("oai")); - assert_eq!(config.models["ds"].model.as_str(), "deepseek-chat"); - assert_eq!(config.models["oai"].model.as_str(), "gpt-4o"); + assert_eq!(config.models[0].model.as_str(), "deepseek-chat"); + assert_eq!(config.models[1].model.as_str(), "gpt-4o"); } #[test] fn parse_full_config() { let toml = r#" -[server] -socket_path = "/tmp/walrus.sock" - -[llm.default] +[[models]] model = "deepseek-chat" api_key = "sk-test" -[memory] -backend = "sqlite" - [[channels]] platform = "telegram" bot_token = "bot-token-123" @@ -64,81 +50,29 @@ command = "npx" args = ["playwright-mcp"] "#; let config = GatewayConfig::from_toml(toml).unwrap(); - assert_eq!( - config.server.socket_path.as_deref(), - Some("/tmp/walrus.sock") - ); - assert_eq!(config.memory.backend, MemoryBackendKind::Sqlite); assert_eq!(config.channels.len(), 1); assert_eq!(config.mcp_servers.len(), 1); assert_eq!(config.mcp_servers[0].name.as_str(), "playwright"); assert!(config.mcp_servers[0].auto_restart); } -#[test] -fn default_memory_config() { - let toml = r#" -[server] - -[llm.default] -model = "deepseek-chat" -api_key = "key" -"#; - let config = GatewayConfig::from_toml(toml).unwrap(); - assert_eq!(config.memory.backend, MemoryBackendKind::InMemory); -} - -#[test] -fn default_socket_path() { - let toml = r#" -[server] - -[llm.default] -model = "deepseek-chat" -api_key = "key" -"#; - let config = GatewayConfig::from_toml(toml).unwrap(); - let path = config.socket_path(std::path::Path::new("/tmp/walrus")); - assert_eq!(path, std::path::PathBuf::from("/tmp/walrus/walrus.sock")); -} - -#[test] -fn custom_socket_path() { - let toml = r#" -[server] -socket_path = "/run/walrus/custom.sock" - -[llm.default] -model = "deepseek-chat" -api_key = "key" -"#; - let config = GatewayConfig::from_toml(toml).unwrap(); - let path = config.socket_path(std::path::Path::new("/tmp/walrus")); - assert_eq!(path, std::path::PathBuf::from("/run/walrus/custom.sock")); -} - #[test] fn env_var_expansion() { unsafe { std::env::set_var("TEST_WALRUS_KEY", "expanded-value") }; let toml = r#" -[server] - -[llm.default] +[[models]] model = "deepseek-chat" api_key = "${TEST_WALRUS_KEY}" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - let default = &config.models["default"]; - assert_eq!(default.api_key.as_deref(), Some("expanded-value")); + assert_eq!(config.models[0].api_key.as_deref(), Some("expanded-value")); unsafe { std::env::remove_var("TEST_WALRUS_KEY") }; } #[test] fn mcp_server_config() { let toml = r#" -[server] - -[llm.default] +[[models]] model = "deepseek-chat" api_key = "key" @@ -162,41 +96,42 @@ KEY = "value" } #[test] -fn global_config_dir_is_under_platform_config() { +fn global_config_dir_is_under_home() { let dir = walrus_daemon::config::global_config_dir(); - assert_eq!(dir.file_name().unwrap(), "walrus"); + assert_eq!(dir.file_name().unwrap(), ".walrus"); +} + +#[test] +fn socket_path_is_under_walrus_dir() { + let path = walrus_daemon::config::socket_path(); + assert_eq!(path.file_name().unwrap(), "walrus.sock"); + assert_eq!(path.parent().unwrap().file_name().unwrap(), ".walrus"); } #[test] fn parse_claude_provider() { let toml = r#" -[server] - -[llm.claude] +[[models]] model = "claude-sonnet-4-20250514" api_key = "test-key" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - let claude = &config.models["claude"]; - assert_eq!(claude.model.as_str(), "claude-sonnet-4-20250514"); - assert_eq!(claude.kind().unwrap().as_str(), "claude"); + assert_eq!(config.models[0].model.as_str(), "claude-sonnet-4-20250514"); + assert_eq!(config.models[0].kind().unwrap().as_str(), "claude"); } #[test] fn parse_openai_with_base_url() { let toml = r#" -[server] - -[llm.oai] +[[models]] model = "gpt-4o" api_key = "test-key" base_url = "http://localhost:8080/v1/chat/completions" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - let oai = &config.models["oai"]; - assert_eq!(oai.kind().unwrap().as_str(), "openai"); + assert_eq!(config.models[0].kind().unwrap().as_str(), "openai"); assert_eq!( - oai.base_url.as_deref(), + config.models[0].base_url.as_deref(), Some("http://localhost:8080/v1/chat/completions") ); } @@ -204,16 +139,16 @@ base_url = "http://localhost:8080/v1/chat/completions" #[test] fn parse_local_provider() { let toml = r#" -[server] - -[llm.phi] +[[models]] model = "microsoft/Phi-3.5-mini-instruct" quantization = "q4k" "#; let config = GatewayConfig::from_toml(toml).unwrap(); - let phi = &config.models["phi"]; - assert_eq!(phi.kind().unwrap().as_str(), "local"); - assert_eq!(phi.model.as_str(), "microsoft/Phi-3.5-mini-instruct"); + assert_eq!(config.models[0].kind().unwrap().as_str(), "local"); + assert_eq!( + config.models[0].model.as_str(), + "microsoft/Phi-3.5-mini-instruct" + ); } #[test] diff --git a/app/daemon/tests/gateway.rs b/app/daemon/tests/gateway.rs deleted file mode 100644 index 1f354e0..0000000 --- a/app/daemon/tests/gateway.rs +++ /dev/null @@ -1,14 +0,0 @@ -//! Gateway integration tests. - -use walrus_daemon::GatewayConfig; - -/// Verify that GatewayConfig default socket path resolves correctly. -#[test] -fn default_socket_path() { - let config = GatewayConfig::default(); - let path = config.socket_path(std::path::Path::new("/home/user/.config/walrus")); - assert_eq!( - path, - std::path::PathBuf::from("/home/user/.config/walrus/walrus.sock") - ); -} diff --git a/app/provider/src/manager.rs b/app/provider/src/manager.rs index e563a8b..5ffbcb3 100644 --- a/app/provider/src/manager.rs +++ b/app/provider/src/manager.rs @@ -21,9 +21,9 @@ pub struct ProviderManager { } struct Inner { - /// Named provider instances with their configs. + /// Provider instances keyed by model name. providers: BTreeMap, - /// Name of the currently active provider. + /// Model name of the currently active provider. active: CompactString, /// Shared HTTP client for constructing new providers. client: llm::Client, @@ -32,19 +32,19 @@ struct Inner { /// Info about a single provider entry returned by `list()`. #[derive(Debug, Clone)] pub struct ProviderEntry { - /// Provider name. + /// Provider model name (key). pub name: CompactString, /// Whether this is the active provider. pub active: bool, } impl ProviderManager { - /// Create a new manager from a named map of provider configs. + /// Create a new manager from a list of provider configs. /// - /// The first key (BTreeMap alphabetical order) becomes the active provider. - /// Returns an error if the map is empty, any config fails validation, or + /// The first element becomes the active provider. + /// Returns an error if the slice is empty, any config fails validation, or /// any provider fails to build. - pub async fn from_configs(configs: &BTreeMap) -> Result { + pub async fn from_configs(configs: &[ProviderConfig]) -> Result { if configs.is_empty() { bail!("at least one provider config is required"); } @@ -52,17 +52,13 @@ impl ProviderManager { let client = llm::Client::new(); let mut providers = BTreeMap::new(); - for (name, config) in configs { + for config in configs { config.validate()?; let provider = build_provider(config, client.clone()).await?; - providers.insert(name.clone(), (config.clone(), provider)); + providers.insert(config.model.clone(), (config.clone(), provider)); } - let active = providers - .keys() - .next() - .expect("non-empty checked above") - .clone(); + let active = configs[0].model.clone(); Ok(Self { inner: Arc::new(RwLock::new(Inner { @@ -74,13 +70,14 @@ impl ProviderManager { } /// Create a manager with a single provider. - pub fn single(name: CompactString, config: ProviderConfig, provider: Provider) -> Self { + pub fn single(config: ProviderConfig, provider: Provider) -> Self { + let model = config.model.clone(); let mut providers = BTreeMap::new(); - providers.insert(name.clone(), (config, provider)); + providers.insert(model.clone(), (config, provider)); Self { inner: Arc::new(RwLock::new(Inner { providers, - active: name, + active: model, client: llm::Client::new(), })), } @@ -92,16 +89,10 @@ impl ProviderManager { inner.providers[&inner.active].1.clone() } - /// Get the name of the active provider. - pub fn active_name(&self) -> CompactString { - let inner = self.inner.read().expect("provider lock poisoned"); - inner.active.clone() - } - - /// Get the model identifier of the active provider. + /// Get the model name of the active provider (also its key). pub fn active_model(&self) -> CompactString { let inner = self.inner.read().expect("provider lock poisoned"); - inner.providers[&inner.active].0.model.clone() + inner.active.clone() } /// Get a clone of the active provider's config. @@ -110,20 +101,20 @@ impl ProviderManager { inner.providers[&inner.active].0.clone() } - /// Switch to a different provider by name. Returns an error if the name - /// is not found. - pub fn switch(&self, name: &str) -> Result<()> { + /// Switch to a different provider by model name. Returns an error if the + /// name is not found. + pub fn switch(&self, model: &str) -> Result<()> { let mut inner = self.inner.write().expect("provider lock poisoned"); - if !inner.providers.contains_key(name) { - bail!("provider '{}' not found", name); + if !inner.providers.contains_key(model) { + bail!("provider '{}' not found", model); } - inner.active = CompactString::from(name); + inner.active = CompactString::from(model); Ok(()) } /// Add a new provider. Validates config first. Replaces any existing - /// provider with the same name. - pub async fn add(&self, name: &str, config: &ProviderConfig) -> Result<()> { + /// provider with the same model name. + pub async fn add(&self, config: &ProviderConfig) -> Result<()> { config.validate()?; let client = { let inner = self.inner.read().expect("provider lock poisoned"); @@ -133,18 +124,19 @@ impl ProviderManager { let mut inner = self.inner.write().expect("provider lock poisoned"); inner .providers - .insert(CompactString::from(name), (config.clone(), provider)); + .insert(config.model.clone(), (config.clone(), provider)); Ok(()) } - /// Remove a provider by name. Fails if the provider is currently active. - pub fn remove(&self, name: &str) -> Result<()> { + /// Remove a provider by model name. Fails if the provider is currently + /// active. + pub fn remove(&self, model: &str) -> Result<()> { let mut inner = self.inner.write().expect("provider lock poisoned"); - if inner.active == name { - bail!("cannot remove the active provider '{}'", name); + if inner.active == model { + bail!("cannot remove the active provider '{}'", model); } - if inner.providers.remove(name).is_none() { - bail!("provider '{}' not found", name); + if inner.providers.remove(model).is_none() { + bail!("provider '{}' not found", model); } Ok(()) } diff --git a/app/provider/tests/manager.rs b/app/provider/tests/manager.rs index 04a9476..764b695 100644 --- a/app/provider/tests/manager.rs +++ b/app/provider/tests/manager.rs @@ -1,13 +1,9 @@ //! Tests for `ProviderManager` (DD#67). -use compact_str::CompactString; -use std::collections::BTreeMap; use walrus_provider::{ProviderConfig, ProviderManager}; -fn test_configs() -> BTreeMap { - let mut map = BTreeMap::new(); - map.insert( - "primary".into(), +fn test_configs() -> Vec { + vec![ ProviderConfig { model: "deepseek-chat".into(), api_key: Some("key1".into()), @@ -16,9 +12,6 @@ fn test_configs() -> BTreeMap { quantization: None, chat_template: None, }, - ); - map.insert( - "secondary".into(), ProviderConfig { model: "gpt-4o".into(), api_key: Some("key2".into()), @@ -27,20 +20,11 @@ fn test_configs() -> BTreeMap { quantization: None, chat_template: None, }, - ); - map -} - -#[tokio::test] -async fn from_btreemap_first_key_active() { - let configs = test_configs(); - let manager = ProviderManager::from_configs(&configs).await.unwrap(); - // BTreeMap sorts alphabetically — "primary" < "secondary". - assert_eq!(manager.active_name().as_str(), "primary"); + ] } #[tokio::test] -async fn active_model_returns_model() { +async fn first_config_is_active() { let configs = test_configs(); let manager = ProviderManager::from_configs(&configs).await.unwrap(); assert_eq!(manager.active_model().as_str(), "deepseek-chat"); @@ -50,8 +34,7 @@ async fn active_model_returns_model() { async fn switch_and_active_config() { let configs = test_configs(); let manager = ProviderManager::from_configs(&configs).await.unwrap(); - manager.switch("secondary").unwrap(); - assert_eq!(manager.active_name().as_str(), "secondary"); + manager.switch("gpt-4o").unwrap(); assert_eq!(manager.active_model().as_str(), "gpt-4o"); let config = manager.active_config(); assert_eq!(config.model.as_str(), "gpt-4o"); @@ -69,9 +52,8 @@ async fn add_and_switch() { quantization: None, chat_template: None, }; - manager.add("third", &third).await.unwrap(); - manager.switch("third").unwrap(); - assert_eq!(manager.active_name().as_str(), "third"); + manager.add(&third).await.unwrap(); + manager.switch("claude-sonnet-4-6").unwrap(); assert_eq!(manager.active_model().as_str(), "claude-sonnet-4-6"); } @@ -88,14 +70,14 @@ async fn add_validates_config() { quantization: None, chat_template: None, }; - assert!(manager.add("invalid", &invalid).await.is_err()); + assert!(manager.add(&invalid).await.is_err()); } #[tokio::test] async fn remove_active_fails() { let configs = test_configs(); let manager = ProviderManager::from_configs(&configs).await.unwrap(); - let result = manager.remove("primary"); + let result = manager.remove("deepseek-chat"); assert!(result.is_err()); assert!( result @@ -109,10 +91,10 @@ async fn remove_active_fails() { async fn remove_inactive() { let configs = test_configs(); let manager = ProviderManager::from_configs(&configs).await.unwrap(); - manager.remove("secondary").unwrap(); + manager.remove("gpt-4o").unwrap(); let entries = manager.list(); assert_eq!(entries.len(), 1); - assert_eq!(entries[0].name.as_str(), "primary"); + assert_eq!(entries[0].name.as_str(), "deepseek-chat"); } #[tokio::test] @@ -121,10 +103,10 @@ async fn list_shows_active() { let manager = ProviderManager::from_configs(&configs).await.unwrap(); let entries = manager.list(); assert_eq!(entries.len(), 2); - let primary = entries.iter().find(|e| e.name == "primary").unwrap(); - let secondary = entries.iter().find(|e| e.name == "secondary").unwrap(); - assert!(primary.active); - assert!(!secondary.active); + let ds = entries.iter().find(|e| e.name == "deepseek-chat").unwrap(); + let oai = entries.iter().find(|e| e.name == "gpt-4o").unwrap(); + assert!(ds.active); + assert!(!oai.active); } #[tokio::test] @@ -147,7 +129,7 @@ async fn remove_unknown_fails() { #[tokio::test] async fn empty_configs_fails() { - let configs: BTreeMap = BTreeMap::new(); + let configs: Vec = Vec::new(); let result = ProviderManager::from_configs(&configs).await; assert!(result.is_err()); assert!( From b5d7343fc0d870cb49ad7679d29cce4bd03391a3 Mon Sep 17 00:00:00 2001 From: clearloop Date: Sat, 28 Feb 2026 17:04:01 +0800 Subject: [PATCH 6/8] feat(daemon): rename all gateway stuffs to daemon --- app/cli/src/config.rs | 4 ++-- app/cli/tests/prefs.rs | 2 +- app/daemon/src/config.rs | 18 +++++++++--------- app/daemon/src/gateway/builder.rs | 4 ++-- app/daemon/src/gateway/serve.rs | 8 ++++---- app/daemon/src/lib.rs | 2 +- app/daemon/tests/config.rs | 24 ++++++++++++------------ 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/app/cli/src/config.rs b/app/cli/src/config.rs index c45bdf4..4471983 100644 --- a/app/cli/src/config.rs +++ b/app/cli/src/config.rs @@ -1,6 +1,6 @@ //! Configuration resolution for the CLI. //! -//! Resolves the path to `~/.walrus/gateway.toml` for config commands. +//! Resolves the path to `~/.walrus/walrus.toml` for config commands. use std::path::PathBuf; @@ -9,5 +9,5 @@ pub fn resolve_config_path() -> PathBuf { dirs::home_dir() .expect("no home directory") .join(".walrus") - .join("gateway.toml") + .join("walrus.toml") } diff --git a/app/cli/tests/prefs.rs b/app/cli/tests/prefs.rs index c62dbec..3360239 100644 --- a/app/cli/tests/prefs.rs +++ b/app/cli/tests/prefs.rs @@ -5,5 +5,5 @@ use walrus_cli::config::resolve_config_path; #[test] fn config_path_global_default() { let path = resolve_config_path(); - assert!(path.ends_with(".walrus/gateway.toml")); + assert!(path.ends_with(".walrus/walrus.toml")); } diff --git a/app/daemon/src/config.rs b/app/daemon/src/config.rs index 3457c92..6ee7d52 100644 --- a/app/daemon/src/config.rs +++ b/app/daemon/src/config.rs @@ -1,4 +1,4 @@ -//! Gateway configuration loaded from TOML (DD#67). +//! Daemon configuration loaded from TOML (DD#67). use anyhow::{Context, Result}; use compact_str::CompactString; @@ -27,9 +27,9 @@ pub fn socket_path() -> PathBuf { global_config_dir().join("walrus.sock") } -/// Top-level gateway configuration. +/// Top-level daemon configuration. #[derive(Debug, Serialize, Deserialize)] -pub struct GatewayConfig { +pub struct DaemonConfig { /// LLM provider configurations (`[[models]]` array). pub models: Vec, /// Channel configurations. @@ -40,7 +40,7 @@ pub struct GatewayConfig { pub mcp_servers: Vec, } -impl Default for GatewayConfig { +impl Default for DaemonConfig { fn default() -> Self { Self { models: vec![ProviderConfig { @@ -103,8 +103,8 @@ tools: You are a helpful assistant. Be concise. "#; -impl GatewayConfig { - /// Parse a TOML string into a `GatewayConfig`, expanding environment +impl DaemonConfig { + /// Parse a TOML string into a `DaemonConfig`, expanding environment /// variables in supported fields. pub fn from_toml(toml_str: &str) -> anyhow::Result { let expanded = crate::utils::expand_env_vars(toml_str); @@ -122,7 +122,7 @@ impl GatewayConfig { /// Scaffold the full config directory structure on first run. /// /// Creates subdirectories (agents, skills, cron, data), writes a default -/// gateway.toml and a default assistant agent markdown file. +/// walrus.toml and a default assistant agent markdown file. pub fn scaffold_config_dir(config_dir: &Path) -> Result<()> { std::fs::create_dir_all(config_dir.join(AGENTS_DIR)) .context("failed to create agents directory")?; @@ -133,8 +133,8 @@ pub fn scaffold_config_dir(config_dir: &Path) -> Result<()> { std::fs::create_dir_all(config_dir.join(DATA_DIR)) .context("failed to create data directory")?; - let gateway_toml = config_dir.join("gateway.toml"); - let contents = toml::to_string_pretty(&GatewayConfig::default()) + let gateway_toml = config_dir.join("walrus.toml"); + let contents = toml::to_string_pretty(&DaemonConfig::default()) .context("failed to serialize default config")?; std::fs::write(&gateway_toml, contents) .with_context(|| format!("failed to write {}", gateway_toml.display()))?; diff --git a/app/daemon/src/gateway/builder.rs b/app/daemon/src/gateway/builder.rs index 29fe801..5cfb484 100644 --- a/app/daemon/src/gateway/builder.rs +++ b/app/daemon/src/gateway/builder.rs @@ -1,4 +1,4 @@ -//! Runtime builder — constructs a fully-configured Runtime from GatewayConfig. +//! Runtime builder — constructs a fully-configured Runtime from DaemonConfig. use crate::MemoryBackend; use crate::config; @@ -14,7 +14,7 @@ use std::path::Path; /// memory from `config_dir/data/memory.db` (when sqlite), and MCP servers /// from TOML config. pub async fn build_runtime( - config: &crate::GatewayConfig, + config: &crate::DaemonConfig, config_dir: &Path, ) -> Result> { // Construct in-memory backend. diff --git a/app/daemon/src/gateway/serve.rs b/app/daemon/src/gateway/serve.rs index 42eac4f..8dcb234 100644 --- a/app/daemon/src/gateway/serve.rs +++ b/app/daemon/src/gateway/serve.rs @@ -1,6 +1,6 @@ //! Shared gateway serve entrypoint — used by the binary and CLI. -use crate::{GatewayConfig, gateway::Gateway}; +use crate::{DaemonConfig, gateway::Gateway}; use anyhow::Result; use std::path::{Path, PathBuf}; use tokio::sync::oneshot; @@ -34,15 +34,15 @@ impl ServeHandle { /// /// Returns a [`ServeHandle`] with the socket path and a shutdown trigger. pub async fn serve(config_dir: &Path) -> Result { - let config_path = config_dir.join("gateway.toml"); - let config = GatewayConfig::load(&config_path)?; + let config_path = config_dir.join("walrus.toml"); + let config = DaemonConfig::load(&config_path)?; tracing::info!("loaded configuration from {}", config_path.display()); serve_with_config(&config, config_dir).await } /// Serve with an already-loaded config. Useful when the caller resolves /// config separately (e.g. CLI with scaffold logic). -pub async fn serve_with_config(config: &GatewayConfig, config_dir: &Path) -> Result { +pub async fn serve_with_config(config: &DaemonConfig, config_dir: &Path) -> Result { use crate::gateway::uds; use std::sync::Arc; diff --git a/app/daemon/src/lib.rs b/app/daemon/src/lib.rs index 6ceb271..f94969a 100644 --- a/app/daemon/src/lib.rs +++ b/app/daemon/src/lib.rs @@ -8,7 +8,7 @@ pub mod gateway; pub mod utils; pub use channel::router::{ChannelRouter, RoutingRule}; -pub use config::GatewayConfig; +pub use config::DaemonConfig; pub use feature::{ cron::{CronJob, CronScheduler}, memory::MemoryBackend, diff --git a/app/daemon/tests/config.rs b/app/daemon/tests/config.rs index 1d77280..9e44aeb 100644 --- a/app/daemon/tests/config.rs +++ b/app/daemon/tests/config.rs @@ -1,6 +1,6 @@ -//! Gateway configuration tests (DD#67). +//! Daemon configuration tests (DD#67). -use walrus_daemon::GatewayConfig; +use walrus_daemon::DaemonConfig; #[test] fn parse_minimal_config() { @@ -9,7 +9,7 @@ fn parse_minimal_config() { model = "deepseek-chat" api_key = "test-key" "#; - let config = GatewayConfig::from_toml(toml).unwrap(); + let config = DaemonConfig::from_toml(toml).unwrap(); assert_eq!(config.models.len(), 1); assert_eq!(config.models[0].model.as_str(), "deepseek-chat"); assert!(config.channels.is_empty()); @@ -26,7 +26,7 @@ api_key = "key1" model = "gpt-4o" api_key = "key2" "#; - let config = GatewayConfig::from_toml(toml).unwrap(); + let config = DaemonConfig::from_toml(toml).unwrap(); assert_eq!(config.models.len(), 2); assert_eq!(config.models[0].model.as_str(), "deepseek-chat"); assert_eq!(config.models[1].model.as_str(), "gpt-4o"); @@ -49,7 +49,7 @@ name = "playwright" command = "npx" args = ["playwright-mcp"] "#; - let config = GatewayConfig::from_toml(toml).unwrap(); + let config = DaemonConfig::from_toml(toml).unwrap(); assert_eq!(config.channels.len(), 1); assert_eq!(config.mcp_servers.len(), 1); assert_eq!(config.mcp_servers[0].name.as_str(), "playwright"); @@ -64,7 +64,7 @@ fn env_var_expansion() { model = "deepseek-chat" api_key = "${TEST_WALRUS_KEY}" "#; - let config = GatewayConfig::from_toml(toml).unwrap(); + let config = DaemonConfig::from_toml(toml).unwrap(); assert_eq!(config.models[0].api_key.as_deref(), Some("expanded-value")); unsafe { std::env::remove_var("TEST_WALRUS_KEY") }; } @@ -85,7 +85,7 @@ auto_restart = false [mcp_servers.env] KEY = "value" "#; - let config = GatewayConfig::from_toml(toml).unwrap(); + let config = DaemonConfig::from_toml(toml).unwrap(); assert_eq!(config.mcp_servers.len(), 1); let mcp = &config.mcp_servers[0]; assert_eq!(mcp.name.as_str(), "test-server"); @@ -115,7 +115,7 @@ fn parse_claude_provider() { model = "claude-sonnet-4-20250514" api_key = "test-key" "#; - let config = GatewayConfig::from_toml(toml).unwrap(); + let config = DaemonConfig::from_toml(toml).unwrap(); assert_eq!(config.models[0].model.as_str(), "claude-sonnet-4-20250514"); assert_eq!(config.models[0].kind().unwrap().as_str(), "claude"); } @@ -128,7 +128,7 @@ model = "gpt-4o" api_key = "test-key" base_url = "http://localhost:8080/v1/chat/completions" "#; - let config = GatewayConfig::from_toml(toml).unwrap(); + let config = DaemonConfig::from_toml(toml).unwrap(); assert_eq!(config.models[0].kind().unwrap().as_str(), "openai"); assert_eq!( config.models[0].base_url.as_deref(), @@ -143,7 +143,7 @@ fn parse_local_provider() { model = "microsoft/Phi-3.5-mini-instruct" quantization = "q4k" "#; - let config = GatewayConfig::from_toml(toml).unwrap(); + let config = DaemonConfig::from_toml(toml).unwrap(); assert_eq!(config.models[0].kind().unwrap().as_str(), "local"); assert_eq!( config.models[0].model.as_str(), @@ -153,8 +153,8 @@ quantization = "q4k" #[test] fn default_config_serializes() { - let config = GatewayConfig::default(); + let config = DaemonConfig::default(); let toml_str = toml::to_string_pretty(&config).unwrap(); // Should roundtrip. - let _parsed: GatewayConfig = toml::from_str(&toml_str).unwrap(); + let _parsed: DaemonConfig = toml::from_str(&toml_str).unwrap(); } From b89b78154c45395e421286f0ee593b780922a36f Mon Sep 17 00:00:00 2001 From: clearloop Date: Sat, 28 Feb 2026 19:25:20 +0800 Subject: [PATCH 7/8] feat(model): merge all llms into model --- Cargo.lock | 609 ++---------------- Cargo.toml | 13 +- app/daemon/Cargo.toml | 5 +- app/daemon/src/config.rs | 2 +- app/daemon/src/feature/memory.rs | 2 +- app/daemon/src/gateway/builder.rs | 2 +- app/daemon/src/gateway/mod.rs | 2 +- app/daemon/src/gateway/uds.rs | 2 +- app/provider/Cargo.toml | 30 - app/provider/src/lib.rs | 17 - crates/{telegram => channel}/Cargo.toml | 6 +- crates/{telegram => channel}/src/lib.rs | 0 .../{telegram => channel}/tests/telegram.rs | 2 +- crates/core/Cargo.toml | 6 +- crates/core/src/channel.rs | 4 +- crates/core/src/lib.rs | 2 + crates/core/src/memory/embedder.rs | 2 +- crates/{llm/src => core/src/model}/config.rs | 2 +- crates/{llm/src => core/src/model}/message.rs | 2 +- .../{llm/src/lib.rs => core/src/model/mod.rs} | 16 +- crates/{llm/src => core/src/model}/noop.rs | 2 +- .../{llm/src => core/src/model}/provider.rs | 2 +- .../{llm/src => core/src/model}/response.rs | 2 +- crates/{llm/src => core/src/model}/stream.rs | 4 +- crates/{llm/src => core/src/model}/tool.rs | 0 crates/core/tests/channel.rs | 4 +- crates/llm/templates/deepseek/response.json | 68 -- crates/llm/templates/deepseek/stream.json | 183 ------ crates/llm/tests/http_provider.rs | 66 -- crates/llm/tests/request.rs | 110 ---- crates/{sqlite => memory}/Cargo.toml | 6 +- crates/{sqlite => memory}/sql/delete.sql | 0 crates/{sqlite => memory}/sql/recall_fts.sql | 0 .../{sqlite => memory}/sql/recall_vector.sql | 0 crates/{sqlite => memory}/sql/schema.sql | 0 .../{sqlite => memory}/sql/select_entries.sql | 0 .../{sqlite => memory}/sql/select_entry.sql | 0 .../{sqlite => memory}/sql/select_value.sql | 0 .../{sqlite => memory}/sql/touch_access.sql | 0 crates/{sqlite => memory}/sql/upsert.sql | 0 crates/{sqlite => memory}/sql/upsert_full.sql | 0 crates/{sqlite => memory}/src/lib.rs | 0 crates/{sqlite => memory}/src/memory.rs | 0 crates/{sqlite => memory}/src/sql.rs | 0 crates/{sqlite => memory}/src/utils.rs | 0 crates/{sqlite => memory}/tests/sqlite.rs | 2 +- crates/{llm => model}/Cargo.toml | 22 +- .../lib.rs => crates/model/src/claude/mod.rs | 4 +- .../model/src/claude}/provider.rs | 13 +- .../model/src/claude}/request.rs | 2 +- .../src => crates/model/src/claude}/stream.rs | 2 +- {app/provider => crates/model}/src/config.rs | 0 .../model/src/deepseek/mod.rs | 2 +- .../model/src/deepseek}/provider.rs | 11 +- .../model/src/deepseek}/request.rs | 2 +- crates/{llm => model}/src/http.rs | 2 +- crates/model/src/lib.rs | 25 + .../lib.rs => crates/model/src/local/mod.rs | 0 .../model/src/local}/provider.rs | 20 +- {app/provider => crates/model}/src/manager.rs | 8 +- .../lib.rs => crates/model/src/openai/mod.rs | 6 +- .../model/src/openai}/provider.rs | 5 +- .../model/src/openai}/request.rs | 2 +- .../provider => crates/model}/src/provider.rs | 30 +- crates/{llm => model}/src/request.rs | 2 +- .../model}/tests/build_provider.rs | 10 +- .../provider => crates/model}/tests/config.rs | 4 +- .../model}/tests/manager.rs | 2 +- crates/runtime/Cargo.toml | 3 +- crates/runtime/examples/common/mod.rs | 5 +- crates/runtime/src/hook.rs | 2 +- crates/runtime/src/lib.rs | 4 +- crates/runtime/src/mcp.rs | 6 +- crates/runtime/src/team.rs | 2 +- crates/runtime/tests/runtime.rs | 2 +- crates/runtime/tests/team.rs | 6 +- llm/claude/Cargo.toml | 23 - llm/deepseek/Cargo.toml | 22 - llm/deepseek/README.md | 24 - llm/local/Cargo.toml | 24 - llm/openai/Cargo.toml | 22 - 81 files changed, 201 insertions(+), 1293 deletions(-) delete mode 100644 app/provider/Cargo.toml delete mode 100644 app/provider/src/lib.rs rename crates/{telegram => channel}/Cargo.toml (80%) rename crates/{telegram => channel}/src/lib.rs (100%) rename crates/{telegram => channel}/tests/telegram.rs (96%) rename crates/{llm/src => core/src/model}/config.rs (98%) rename crates/{llm/src => core/src/model}/message.rs (99%) rename crates/{llm/src/lib.rs => core/src/model/mod.rs} (51%) rename crates/{llm/src => core/src/model}/noop.rs (94%) rename crates/{llm/src => core/src/model}/provider.rs (92%) rename crates/{llm/src => core/src/model}/response.rs (99%) rename crates/{llm/src => core/src/model}/stream.rs (97%) rename crates/{llm/src => core/src/model}/tool.rs (100%) delete mode 100644 crates/llm/templates/deepseek/response.json delete mode 100644 crates/llm/templates/deepseek/stream.json delete mode 100644 crates/llm/tests/http_provider.rs delete mode 100644 crates/llm/tests/request.rs rename crates/{sqlite => memory}/Cargo.toml (73%) rename crates/{sqlite => memory}/sql/delete.sql (100%) rename crates/{sqlite => memory}/sql/recall_fts.sql (100%) rename crates/{sqlite => memory}/sql/recall_vector.sql (100%) rename crates/{sqlite => memory}/sql/schema.sql (100%) rename crates/{sqlite => memory}/sql/select_entries.sql (100%) rename crates/{sqlite => memory}/sql/select_entry.sql (100%) rename crates/{sqlite => memory}/sql/select_value.sql (100%) rename crates/{sqlite => memory}/sql/touch_access.sql (100%) rename crates/{sqlite => memory}/sql/upsert.sql (100%) rename crates/{sqlite => memory}/sql/upsert_full.sql (100%) rename crates/{sqlite => memory}/src/lib.rs (100%) rename crates/{sqlite => memory}/src/memory.rs (100%) rename crates/{sqlite => memory}/src/sql.rs (100%) rename crates/{sqlite => memory}/src/utils.rs (100%) rename crates/{sqlite => memory}/tests/sqlite.rs (99%) rename crates/{llm => model}/Cargo.toml (53%) rename llm/claude/src/lib.rs => crates/model/src/claude/mod.rs (94%) rename {llm/claude/src => crates/model/src/claude}/provider.rs (95%) rename {llm/claude/src => crates/model/src/claude}/request.rs (98%) rename {llm/claude/src => crates/model/src/claude}/stream.rs (99%) rename {app/provider => crates/model}/src/config.rs (100%) rename llm/deepseek/src/lib.rs => crates/model/src/deepseek/mod.rs (84%) rename {llm/deepseek/src => crates/model/src/deepseek}/provider.rs (94%) rename {llm/deepseek/src => crates/model/src/deepseek}/request.rs (98%) rename crates/{llm => model}/src/http.rs (99%) create mode 100644 crates/model/src/lib.rs rename llm/local/src/lib.rs => crates/model/src/local/mod.rs (100%) rename {llm/local/src => crates/model/src/local}/provider.rs (92%) rename {app/provider => crates/model}/src/manager.rs (97%) rename llm/openai/src/lib.rs => crates/model/src/openai/mod.rs (96%) rename {llm/openai/src => crates/model/src/openai}/provider.rs (95%) rename {llm/openai/src => crates/model/src/openai}/request.rs (98%) rename {app/provider => crates/model}/src/provider.rs (84%) rename crates/{llm => model}/src/request.rs (98%) rename {app/provider => crates/model}/tests/build_provider.rs (78%) rename {app/provider => crates/model}/tests/config.rs (98%) rename {app/provider => crates/model}/tests/manager.rs (98%) delete mode 100644 llm/claude/Cargo.toml delete mode 100644 llm/deepseek/Cargo.toml delete mode 100644 llm/deepseek/README.md delete mode 100644 llm/local/Cargo.toml delete mode 100644 llm/openai/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index 9e25cfd..a26c692 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,12 +12,6 @@ dependencies = [ "regex", ] -[[package]] -name = "accelerate-src" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "415ed64958754dbe991900f3940677e6a7eefb4d7367afd70d642677b0c7d19d" - [[package]] name = "adler2" version = "2.0.1" @@ -391,12 +385,6 @@ dependencies = [ "core2", ] -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" - [[package]] name = "block-buffer" version = "0.10.4" @@ -406,15 +394,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block2" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" -dependencies = [ - "objc2", -] - [[package]] name = "bm25" version = "2.3.2" @@ -529,73 +508,39 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c15b675b80d994b2eadb20a4bbe434eabeb454eac3ee5e2b4cf6f147ee9be091" dependencies = [ - "accelerate-src", "byteorder", - "candle-metal-kernels", - "candle-ug", "float8", - "gemm 0.19.0", + "gemm", "half", - "libc", "libm", "memmap2", "num-traits", "num_cpus", - "objc2-foundation", - "objc2-metal", "rand 0.9.2", "rand_distr 0.5.1", "rayon", - "safetensors 0.7.0", + "safetensors", "thiserror 2.0.18", - "yoke 0.8.1", + "yoke", "zip", ] -[[package]] -name = "candle-metal-kernels" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fdfe9d06de16ce49961e49084e5b79a75a9bdf157246e7c7b6328e87a7aa25d" -dependencies = [ - "half", - "objc2", - "objc2-foundation", - "objc2-metal", - "once_cell", - "thiserror 2.0.18", - "tracing", -] - [[package]] name = "candle-nn" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3045fa9e7aef8567d209a27d56b692f60b96f4d0569f4c3011f8ca6715c65e03" dependencies = [ - "accelerate-src", "candle-core", - "candle-metal-kernels", "half", "libc", "num-traits", - "objc2-metal", "rayon", - "safetensors 0.7.0", + "safetensors", "serde", "thiserror 2.0.18", ] -[[package]] -name = "candle-ug" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22d62be69068bf58987a45f690612739d8d2ea1bf508c1b87dc6815a019575d" -dependencies = [ - "ug", - "ug-metal", -] - [[package]] name = "castaway" version = "0.2.4" @@ -826,17 +771,6 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "core-graphics-types" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "libc", -] - [[package]] name = "core2" version = "0.4.0" @@ -1269,16 +1203,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "dispatch2" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" -dependencies = [ - "bitflags 2.10.0", - "objc2", -] - [[package]] name = "displaydoc" version = "0.2.5" @@ -1609,28 +1533,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared 0.1.1", -] - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared 0.3.1", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.111", + "foreign-types-shared", ] [[package]] @@ -1639,12 +1542,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - [[package]] name = "form_urlencoded" version = "1.2.2" @@ -1778,26 +1675,6 @@ dependencies = [ "unchecked-index", ] -[[package]] -name = "gemm" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab96b703d31950f1aeddded248bc95543c9efc7ac9c4a21fda8703a83ee35451" -dependencies = [ - "dyn-stack", - "gemm-c32 0.18.2", - "gemm-c64 0.18.2", - "gemm-common 0.18.2", - "gemm-f16 0.18.2", - "gemm-f32 0.18.2", - "gemm-f64 0.18.2", - "num-complex", - "num-traits", - "paste", - "raw-cpuid", - "seq-macro", -] - [[package]] name = "gemm" version = "0.19.0" @@ -1805,27 +1682,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa0673db364b12263d103b68337a68fbecc541d6f6b61ba72fe438654709eacb" dependencies = [ "dyn-stack", - "gemm-c32 0.19.0", - "gemm-c64 0.19.0", - "gemm-common 0.19.0", - "gemm-f16 0.19.0", - "gemm-f32 0.19.0", - "gemm-f64 0.19.0", - "num-complex", - "num-traits", - "paste", - "raw-cpuid", - "seq-macro", -] - -[[package]] -name = "gemm-c32" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6db9fd9f40421d00eea9dd0770045a5603b8d684654816637732463f4073847" -dependencies = [ - "dyn-stack", - "gemm-common 0.18.2", + "gemm-c32", + "gemm-c64", + "gemm-common", + "gemm-f16", + "gemm-f32", + "gemm-f64", "num-complex", "num-traits", "paste", @@ -1840,22 +1702,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "086936dbdcb99e37aad81d320f98f670e53c1e55a98bee70573e83f95beb128c" dependencies = [ "dyn-stack", - "gemm-common 0.19.0", - "num-complex", - "num-traits", - "paste", - "raw-cpuid", - "seq-macro", -] - -[[package]] -name = "gemm-c64" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfcad8a3d35a43758330b635d02edad980c1e143dc2f21e6fd25f9e4eada8edf" -dependencies = [ - "dyn-stack", - "gemm-common 0.18.2", + "gemm-common", "num-complex", "num-traits", "paste", @@ -1870,7 +1717,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20c8aeeeec425959bda4d9827664029ba1501a90a0d1e6228e48bef741db3a3f" dependencies = [ "dyn-stack", - "gemm-common 0.19.0", + "gemm-common", "num-complex", "num-traits", "paste", @@ -1878,27 +1725,6 @@ dependencies = [ "seq-macro", ] -[[package]] -name = "gemm-common" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a352d4a69cbe938b9e2a9cb7a3a63b7e72f9349174a2752a558a8a563510d0f3" -dependencies = [ - "bytemuck", - "dyn-stack", - "half", - "libm", - "num-complex", - "num-traits", - "once_cell", - "paste", - "pulp 0.21.5", - "raw-cpuid", - "rayon", - "seq-macro", - "sysctl", -] - [[package]] name = "gemm-common" version = "0.19.0" @@ -1913,31 +1739,13 @@ dependencies = [ "num-traits", "once_cell", "paste", - "pulp 0.22.2", + "pulp", "raw-cpuid", "rayon", "seq-macro", "sysctl", ] -[[package]] -name = "gemm-f16" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff95ae3259432f3c3410eaa919033cd03791d81cebd18018393dc147952e109" -dependencies = [ - "dyn-stack", - "gemm-common 0.18.2", - "gemm-f32 0.18.2", - "half", - "num-complex", - "num-traits", - "paste", - "raw-cpuid", - "rayon", - "seq-macro", -] - [[package]] name = "gemm-f16" version = "0.19.0" @@ -1945,8 +1753,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3df7a55202e6cd6739d82ae3399c8e0c7e1402859b30e4cb780e61525d9486e" dependencies = [ "dyn-stack", - "gemm-common 0.19.0", - "gemm-f32 0.19.0", + "gemm-common", + "gemm-f32", "half", "num-complex", "num-traits", @@ -1956,21 +1764,6 @@ dependencies = [ "seq-macro", ] -[[package]] -name = "gemm-f32" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc8d3d4385393304f407392f754cd2dc4b315d05063f62cf09f47b58de276864" -dependencies = [ - "dyn-stack", - "gemm-common 0.18.2", - "num-complex", - "num-traits", - "paste", - "raw-cpuid", - "seq-macro", -] - [[package]] name = "gemm-f32" version = "0.19.0" @@ -1978,22 +1771,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02e0b8c9da1fbec6e3e3ab2ce6bc259ef18eb5f6f0d3e4edf54b75f9fd41a81c" dependencies = [ "dyn-stack", - "gemm-common 0.19.0", - "num-complex", - "num-traits", - "paste", - "raw-cpuid", - "seq-macro", -] - -[[package]] -name = "gemm-f64" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35b2a4f76ce4b8b16eadc11ccf2e083252d8237c1b589558a49b0183545015bd" -dependencies = [ - "dyn-stack", - "gemm-common 0.18.2", + "gemm-common", "num-complex", "num-traits", "paste", @@ -2008,7 +1786,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "056131e8f2a521bfab322f804ccd652520c79700d81209e9d9275bbdecaadc6a" dependencies = [ "dyn-stack", - "gemm-common 0.19.0", + "gemm-common", "num-complex", "num-traits", "paste", @@ -2398,7 +2176,7 @@ checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" dependencies = [ "displaydoc", "potential_utf", - "yoke 0.8.1", + "yoke", "zerofrom", "zerovec", ] @@ -2465,7 +2243,7 @@ dependencies = [ "displaydoc", "icu_locale_core", "writeable", - "yoke 0.8.1", + "yoke", "zerofrom", "zerotrie", "zerovec", @@ -2731,16 +2509,6 @@ dependencies = [ "cc", ] -[[package]] -name = "libloading" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" -dependencies = [ - "cfg-if", - "windows-link 0.2.1", -] - [[package]] name = "libm" version = "0.2.16" @@ -2860,15 +2628,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "670fdfda89751bc4a84ac13eaa63e205cf0fd22b4c9a5fbfa085b63c1f1d3a30" -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - [[package]] name = "markup5ever" version = "0.36.1" @@ -2936,21 +2695,6 @@ dependencies = [ "stable_deref_trait", ] -[[package]] -name = "metal" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" -dependencies = [ - "bitflags 2.10.0", - "block", - "core-graphics-types", - "foreign-types 0.5.0", - "log", - "objc", - "paste", -] - [[package]] name = "mime" version = "0.3.17" @@ -3082,7 +2826,6 @@ dependencies = [ "bytemuck", "bytemuck_derive", "candle-core", - "candle-metal-kernels", "candle-nn", "cfgrammar", "chrono", @@ -3113,12 +2856,9 @@ dependencies = [ "minijinja-contrib", "mistralrs-audio", "mistralrs-mcp", - "mistralrs-paged-attn", "mistralrs-quant", "mistralrs-vision", "num-traits", - "objc", - "objc2-metal", "openai-harmony", "ordered-float", "parking_lot", @@ -3134,7 +2874,7 @@ dependencies = [ "rust-mcp-schema", "rustc-hash 2.1.1", "rustfft", - "safetensors 0.7.0", + "safetensors", "schemars 1.2.1", "scraper", "serde", @@ -3195,22 +2935,6 @@ dependencies = [ "uuid 1.21.0", ] -[[package]] -name = "mistralrs-paged-attn" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6000b390e4a7b56a58fc7005ac721780edd6fd28e70cb6a138872dd3c700dda" -dependencies = [ - "anyhow", - "candle-core", - "candle-metal-kernels", - "float8", - "half", - "objc2-foundation", - "objc2-metal", - "thiserror 2.0.18", -] - [[package]] name = "mistralrs-quant" version = "0.7.0" @@ -3219,25 +2943,22 @@ checksum = "9fb9fb187f2c9397a73f2b00437f6bbedb4c556f1c06d13af2f8d35ec5543a00" dependencies = [ "byteorder", "candle-core", - "candle-metal-kernels", "candle-nn", "float8", "half", "hf-hub", "lazy_static", "memmap2", - "objc2-foundation", - "objc2-metal", "paste", "rayon", "regex", - "safetensors 0.7.0", + "safetensors", "serde", "serde_json", "thiserror 2.0.18", "tokio", "tracing", - "yoke 0.8.1", + "yoke", ] [[package]] @@ -3405,20 +3126,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - [[package]] name = "num-bigint" version = "0.4.6" @@ -3465,17 +3172,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.2" @@ -3513,24 +3209,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", -] - -[[package]] -name = "objc2" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" -dependencies = [ - "objc2-encode", -] - [[package]] name = "objc2-core-foundation" version = "0.3.2" @@ -3538,27 +3216,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ "bitflags 2.10.0", - "dispatch2", - "objc2", -] - -[[package]] -name = "objc2-encode" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" - -[[package]] -name = "objc2-foundation" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" -dependencies = [ - "bitflags 2.10.0", - "block2", - "libc", - "objc2", - "objc2-core-foundation", ] [[package]] @@ -3571,20 +3228,6 @@ dependencies = [ "objc2-core-foundation", ] -[[package]] -name = "objc2-metal" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" -dependencies = [ - "bitflags 2.10.0", - "block2", - "dispatch2", - "objc2", - "objc2-core-foundation", - "objc2-foundation", -] - [[package]] name = "once_cell" version = "1.21.3" @@ -3629,7 +3272,7 @@ checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" dependencies = [ "bitflags 2.10.0", "cfg-if", - "foreign-types 0.3.2", + "foreign-types", "libc", "once_cell", "openssl-macros", @@ -3923,20 +3566,6 @@ dependencies = [ "syn 2.0.111", ] -[[package]] -name = "pulp" -version = "0.21.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b86df24f0a7ddd5e4b95c94fc9ed8a98f1ca94d3b01bdce2824097e7835907" -dependencies = [ - "bytemuck", - "cfg-if", - "libm", - "num-complex", - "reborrow", - "version_check", -] - [[package]] name = "pulp" version = "0.22.2" @@ -4713,16 +4342,6 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "safetensors" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44560c11236a6130a46ce36c836a62936dc81ebf8c36a37947423571be0e55b6" -dependencies = [ - "serde", - "serde_json", -] - [[package]] name = "safetensors" version = "0.7.0" @@ -6119,41 +5738,6 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" -[[package]] -name = "ug" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76b761acf8af3494640d826a8609e2265e19778fb43306c7f15379c78c9b05b0" -dependencies = [ - "gemm 0.18.2", - "half", - "libloading", - "memmap2", - "num", - "num-traits", - "num_cpus", - "rayon", - "safetensors 0.4.5", - "serde", - "thiserror 1.0.69", - "tracing", - "yoke 0.7.5", -] - -[[package]] -name = "ug-metal" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7adf545a99a086d362efc739e7cf4317c18cbeda22706000fd434d70ea3d95" -dependencies = [ - "half", - "metal", - "objc", - "serde", - "thiserror 1.0.69", - "ug", -] - [[package]] name = "unchecked-index" version = "0.2.2" @@ -6385,18 +5969,19 @@ dependencies = [ ] [[package]] -name = "walrus-claude" +name = "walrus-channel" version = "0.0.9" dependencies = [ "anyhow", "async-stream", "compact_str 0.8.1", "futures-core", - "futures-util", + "reqwest 0.12.26", "serde", "serde_json", + "tokio", "tracing", - "walrus-llm", + "walrus-core", ] [[package]] @@ -6436,12 +6021,15 @@ name = "walrus-core" version = "0.0.9" dependencies = [ "anyhow", + "async-stream", "compact_str 0.8.1", "futures-core", + "schemars 1.2.1", + "serde", "serde_json", "smallvec 1.15.1", "tokio", - "walrus-llm", + "tracing", ] [[package]] @@ -6463,46 +6051,26 @@ dependencies = [ "tracing", "tracing-subscriber", "walrus-core", - "walrus-llm", + "walrus-memory", + "walrus-model", "walrus-protocol", - "walrus-provider", "walrus-runtime", - "walrus-sqlite", -] - -[[package]] -name = "walrus-deepseek" -version = "0.0.9" -dependencies = [ - "anyhow", - "async-stream", - "futures-core", - "futures-util", - "serde", - "serde_json", - "tracing", - "walrus-llm", ] [[package]] -name = "walrus-llm" +name = "walrus-memory" version = "0.0.9" dependencies = [ "anyhow", - "async-stream", "compact_str 0.8.1", - "futures-core", - "futures-util", - "reqwest 0.12.26", - "schemars 1.2.1", - "serde", + "rusqlite", "serde_json", - "smallvec 1.15.1", - "tracing", + "tokio", + "walrus-core", ] [[package]] -name = "walrus-local" +name = "walrus-model" version = "0.0.9" dependencies = [ "anyhow", @@ -6510,24 +6078,14 @@ dependencies = [ "compact_str 0.8.1", "dirs", "futures-core", - "mistralrs", - "serde_json", - "tracing", - "walrus-llm", -] - -[[package]] -name = "walrus-openai" -version = "0.0.9" -dependencies = [ - "anyhow", - "async-stream", - "futures-core", "futures-util", + "mistralrs", + "reqwest 0.12.26", "serde", "serde_json", + "tokio", "tracing", - "walrus-llm", + "walrus-core", ] [[package]] @@ -6540,26 +6098,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "walrus-provider" -version = "0.0.9" -dependencies = [ - "anyhow", - "async-stream", - "compact_str 0.8.1", - "futures-core", - "futures-util", - "mistralrs", - "serde", - "serde_json", - "tokio", - "walrus-claude", - "walrus-deepseek", - "walrus-llm", - "walrus-local", - "walrus-openai", -] - [[package]] name = "walrus-runtime" version = "0.0.9" @@ -6582,36 +6120,7 @@ dependencies = [ "tracing", "tracing-subscriber", "walrus-core", - "walrus-deepseek", - "walrus-llm", -] - -[[package]] -name = "walrus-sqlite" -version = "0.0.9" -dependencies = [ - "anyhow", - "compact_str 0.8.1", - "rusqlite", - "serde_json", - "tokio", - "walrus-core", -] - -[[package]] -name = "walrus-telegram" -version = "0.0.9" -dependencies = [ - "anyhow", - "async-stream", - "compact_str 0.8.1", - "futures-core", - "reqwest 0.12.26", - "serde", - "serde_json", - "tokio", - "tracing", - "walrus-core", + "walrus-model", ] [[package]] @@ -7509,18 +7018,6 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" -[[package]] -name = "yoke" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive 0.7.5", - "zerofrom", -] - [[package]] name = "yoke" version = "0.8.1" @@ -7528,22 +7025,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" dependencies = [ "stable_deref_trait", - "yoke-derive 0.8.1", + "yoke-derive", "zerofrom", ] -[[package]] -name = "yoke-derive" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.111", - "synstructure", -] - [[package]] name = "yoke-derive" version = "0.8.1" @@ -7610,7 +7095,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" dependencies = [ "displaydoc", - "yoke 0.8.1", + "yoke", "zerofrom", ] @@ -7620,7 +7105,7 @@ version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" dependencies = [ - "yoke 0.8.1", + "yoke", "zerofrom", "zerovec-derive", ] diff --git a/Cargo.toml b/Cargo.toml index eca2b21..ed6e3d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "3" -members = ["app/*", "crates/*", "llm/*"] +members = ["app/*", "crates/*"] [workspace.package] version = "0.0.9" @@ -11,17 +11,12 @@ repository = "https://github.com/clearloop/walrus" keywords = ["llm", "agent", "ai"] [workspace.dependencies] -deepseek = { path = "llm/deepseek", package = "walrus-deepseek", version = "0.0.9" } -openai = { path = "llm/openai", package = "walrus-openai", version = "0.0.9" } -claude = { path = "llm/claude", package = "walrus-claude", version = "0.0.9" } -local = { path = "llm/local", package = "walrus-local", version = "0.0.9" } -llm = { path = "crates/llm", package = "walrus-llm", version = "0.0.9", default-features = true } wcore = { path = "crates/core", package = "walrus-core", version = "0.0.9" } +model = { path = "crates/model", package = "walrus-model", version = "0.0.9" } runtime = { path = "crates/runtime", package = "walrus-runtime", version = "0.0.9" } -sqlite = { path = "crates/sqlite", package = "walrus-sqlite", version = "0.0.9" } -telegram = { path = "crates/telegram", package = "walrus-telegram", version = "0.0.9" } +memory = { path = "crates/memory", package = "walrus-memory", version = "0.0.9" } +channel = { path = "crates/channel", package = "walrus-channel", version = "0.0.9" } protocol = { path = "app/protocol", package = "walrus-protocol", version = "0.0.9" } -provider = { path = "app/provider", package = "walrus-provider", version = "0.0.9" } daemon = { path = "app/daemon", package = "walrus-daemon", version = "0.0.9" } client = { path = "app/client", package = "walrus-client", version = "0.0.9" } diff --git a/app/daemon/Cargo.toml b/app/daemon/Cargo.toml index 07ecce3..7252b04 100644 --- a/app/daemon/Cargo.toml +++ b/app/daemon/Cargo.toml @@ -14,9 +14,8 @@ path = "src/bin/main.rs" [dependencies] runtime = { workspace = true } wcore = { workspace = true } -provider = { workspace = true } -sqlite = { workspace = true } -llm = { workspace = true } +model = { workspace = true } +memory = { workspace = true } protocol = { workspace = true } compact_str = { workspace = true } serde = { workspace = true } diff --git a/app/daemon/src/config.rs b/app/daemon/src/config.rs index 6ee7d52..e4f58cf 100644 --- a/app/daemon/src/config.rs +++ b/app/daemon/src/config.rs @@ -2,7 +2,7 @@ use anyhow::{Context, Result}; use compact_str::CompactString; -pub use provider::{ProviderConfig, ProviderManager}; +pub use model::{ProviderConfig, ProviderManager}; use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; diff --git a/app/daemon/src/feature/memory.rs b/app/daemon/src/feature/memory.rs index 49252ee..bbd5069 100644 --- a/app/daemon/src/feature/memory.rs +++ b/app/daemon/src/feature/memory.rs @@ -4,7 +4,7 @@ //! delegation, following the Provider enum pattern (DD#22). use anyhow::Result; -use sqlite::SqliteMemory; +use memory::SqliteMemory; use std::future::Future; use wcore::{InMemory, Memory, MemoryEntry, NoEmbedder, RecallOptions}; diff --git a/app/daemon/src/gateway/builder.rs b/app/daemon/src/gateway/builder.rs index 5cfb484..db6175a 100644 --- a/app/daemon/src/gateway/builder.rs +++ b/app/daemon/src/gateway/builder.rs @@ -4,7 +4,7 @@ use crate::MemoryBackend; use crate::config; use crate::gateway::GatewayHook; use anyhow::Result; -use provider::ProviderManager; +use model::ProviderManager; use runtime::{General, McpBridge, Runtime, SkillRegistry}; use std::path::Path; diff --git a/app/daemon/src/gateway/mod.rs b/app/daemon/src/gateway/mod.rs index 7a5b42a..d9f8907 100644 --- a/app/daemon/src/gateway/mod.rs +++ b/app/daemon/src/gateway/mod.rs @@ -1,7 +1,7 @@ //! Protocol impls for the gateway. use crate::MemoryBackend; -use provider::ProviderManager; +use model::ProviderManager; use runtime::{DEFAULT_COMPACT_PROMPT, DEFAULT_FLUSH_PROMPT, Hook, Runtime}; use std::sync::Arc; diff --git a/app/daemon/src/gateway/uds.rs b/app/daemon/src/gateway/uds.rs index c9719f9..3a4b16c 100644 --- a/app/daemon/src/gateway/uds.rs +++ b/app/daemon/src/gateway/uds.rs @@ -2,7 +2,7 @@ use crate::gateway::Gateway; use compact_str::CompactString; -use llm::Message; +use wcore::model::Message; use protocol::codec::{self, FrameError}; use protocol::{AgentSummary, ClientMessage, ServerMessage}; use runtime::Hook; diff --git a/app/provider/Cargo.toml b/app/provider/Cargo.toml deleted file mode 100644 index b41ccef..0000000 --- a/app/provider/Cargo.toml +++ /dev/null @@ -1,30 +0,0 @@ -[package] -name = "walrus-provider" -version.workspace = true -edition.workspace = true -authors.workspace = true -license.workspace = true -repository.workspace = true -keywords.workspace = true - -[dependencies] -llm = { workspace = true } -deepseek = { workspace = true } -openai = { workspace = true } -claude = { workspace = true } -local = { workspace = true, optional = true } -mistralrs = { workspace = true, optional = true } -compact_str = { workspace = true } -anyhow = { workspace = true } -tokio = { workspace = true } -serde = { workspace = true } -async-stream = { workspace = true } -futures-core = { workspace = true } -futures-util = { workspace = true } - -[features] -default = ["local"] -local = ["dep:local", "dep:mistralrs"] - -[dev-dependencies] -serde_json = { workspace = true } diff --git a/app/provider/src/lib.rs b/app/provider/src/lib.rs deleted file mode 100644 index 2b36827..0000000 --- a/app/provider/src/lib.rs +++ /dev/null @@ -1,17 +0,0 @@ -//! Provider crate — centralizes LLM provider enum dispatch, configuration, -//! construction, and runtime management. -//! -//! `Provider` enum wraps concrete backends (DeepSeek, OpenAI, Claude, Local) -//! behind a unified `LLM` impl. `ProviderManager` holds a named map of -//! providers with concurrent-safe active-provider swapping (DD#60, DD#65). -//! Config uses flat `ProviderConfig` with model-prefix kind detection (DD#67). - -pub mod config; -pub mod manager; -mod provider; - -pub use { - config::{ProviderConfig, ProviderKind}, - manager::ProviderManager, - provider::{Provider, build_provider}, -}; diff --git a/crates/telegram/Cargo.toml b/crates/channel/Cargo.toml similarity index 80% rename from crates/telegram/Cargo.toml rename to crates/channel/Cargo.toml index a4c38f8..b5d68db 100644 --- a/crates/telegram/Cargo.toml +++ b/crates/channel/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "walrus-telegram" -description = "Walrus Telegram channel adapter" -documentation = "https://docs.rs/walrus-telegram" +name = "walrus-channel" +description = "Walrus channel adapters" +documentation = "https://docs.rs/walrus-channel" version.workspace = true edition.workspace = true authors.workspace = true diff --git a/crates/telegram/src/lib.rs b/crates/channel/src/lib.rs similarity index 100% rename from crates/telegram/src/lib.rs rename to crates/channel/src/lib.rs diff --git a/crates/telegram/tests/telegram.rs b/crates/channel/tests/telegram.rs similarity index 96% rename from crates/telegram/tests/telegram.rs rename to crates/channel/tests/telegram.rs index 671f3ec..c863271 100644 --- a/crates/telegram/tests/telegram.rs +++ b/crates/channel/tests/telegram.rs @@ -1,6 +1,6 @@ //! Tests for the Telegram channel adapter. -use walrus_telegram::{TelegramChannel, channel_message_from_update, send_message_url}; +use walrus_channel::{TelegramChannel, channel_message_from_update, send_message_url}; use wcore::{Channel, Platform}; #[test] diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index fa462c7..558b046 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -11,11 +11,15 @@ keywords.workspace = true [dependencies] anyhow.workspace = true +async-stream.workspace = true compact_str.workspace = true futures-core.workspace = true -llm.workspace = true +schemars.workspace = true +serde.workspace = true serde_json.workspace = true smallvec.workspace = true +tracing.workspace = true [dev-dependencies] +serde_json.workspace = true tokio.workspace = true diff --git a/crates/core/src/channel.rs b/crates/core/src/channel.rs index a1a31ff..12461a0 100644 --- a/crates/core/src/channel.rs +++ b/crates/core/src/channel.rs @@ -58,9 +58,9 @@ pub enum AttachmentKind { Video, } -impl From for llm::Message { +impl From for crate::model::Message { fn from(msg: ChannelMessage) -> Self { - llm::Message::user(msg.content) + crate::model::Message::user(msg.content) } } diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index 8a9b622..d8cbc02 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -5,6 +5,7 @@ //! - [`Embedder`]: Text-to-vector trait for semantic search. //! - [`Channel`]: Messaging platform integration trait. //! - [`Skill`] / [`SkillTier`]: Skill data types. +//! - [`model`]: Unified LLM interface types and traits. pub use agent::Agent; pub use channel::{Attachment, AttachmentKind, Channel, ChannelMessage, Platform}; @@ -14,4 +15,5 @@ pub use skill::{Skill, SkillTier}; mod agent; mod channel; pub mod memory; +pub mod model; mod skill; diff --git a/crates/core/src/memory/embedder.rs b/crates/core/src/memory/embedder.rs index d7bfce8..d759956 100644 --- a/crates/core/src/memory/embedder.rs +++ b/crates/core/src/memory/embedder.rs @@ -1,6 +1,6 @@ //! Embedding trait for converting text to vector representations. //! -//! Used by memory backends that support semantic search (e.g. walrus-sqlite). +//! Used by memory backends that support semantic search (e.g. walrus-memory). use std::future::Future; diff --git a/crates/llm/src/config.rs b/crates/core/src/model/config.rs similarity index 98% rename from crates/llm/src/config.rs rename to crates/core/src/model/config.rs index a0751e7..e93d10f 100644 --- a/crates/llm/src/config.rs +++ b/crates/core/src/model/config.rs @@ -1,6 +1,6 @@ //! Configuration for a chat -use crate::{Tool, ToolChoice}; +use crate::model::{Tool, ToolChoice}; use compact_str::CompactString; use serde::{Deserialize, Serialize}; diff --git a/crates/llm/src/message.rs b/crates/core/src/model/message.rs similarity index 99% rename from crates/llm/src/message.rs rename to crates/core/src/model/message.rs index ae3e846..417ee3c 100644 --- a/crates/llm/src/message.rs +++ b/crates/core/src/model/message.rs @@ -1,6 +1,6 @@ //! Turbofish LLM message -use crate::{StreamChunk, ToolCall}; +use crate::model::{StreamChunk, ToolCall}; use compact_str::CompactString; use serde::{Deserialize, Serialize}; use smallvec::SmallVec; diff --git a/crates/llm/src/lib.rs b/crates/core/src/model/mod.rs similarity index 51% rename from crates/llm/src/lib.rs rename to crates/core/src/model/mod.rs index 706d65b..28f8485 100644 --- a/crates/llm/src/lib.rs +++ b/crates/core/src/model/mod.rs @@ -1,20 +1,12 @@ //! Unified LLM interface types and traits. //! -//! This crate provides the shared types used across all LLM providers: +//! Provides the shared types used across all LLM providers: //! `Message`, `Response`, `StreamChunk`, `Tool`, `Config`, and the `LLM` trait. -//! Also provides `HttpProvider` for OpenAI-compatible HTTP transport (DD#58) -//! and a shared `Request` type. pub use config::{Config, General}; -#[cfg(feature = "http")] -pub use http::HttpProvider; -pub use message::{Message, Role, estimate_tokens}; +pub use message::{Message, MessageBuilder, Role, estimate_tokens}; pub use noop::NoopProvider; pub use provider::LLM; -#[cfg(feature = "http")] -pub use request::Request; -#[cfg(feature = "http")] -pub use reqwest::{self, Client}; pub use response::{ Choice, CompletionMeta, CompletionTokensDetails, Delta, FinishReason, Response, Usage, }; @@ -22,13 +14,9 @@ pub use stream::StreamChunk; pub use tool::{FunctionCall, Tool, ToolCall, ToolChoice}; mod config; -#[cfg(feature = "http")] -mod http; mod message; mod noop; mod provider; -#[cfg(feature = "http")] -mod request; mod response; mod stream; mod tool; diff --git a/crates/llm/src/noop.rs b/crates/core/src/model/noop.rs similarity index 94% rename from crates/llm/src/noop.rs rename to crates/core/src/model/noop.rs index 9eb0f6c..23b3d6d 100644 --- a/crates/llm/src/noop.rs +++ b/crates/core/src/model/noop.rs @@ -4,7 +4,7 @@ //! unit tests that exercise tool dispatch, memory, and session logic //! without making real LLM calls. -use crate::{General, LLM, Message, Response, StreamChunk}; +use crate::model::{General, LLM, Message, Response, StreamChunk}; use anyhow::Result; use futures_core::Stream; diff --git a/crates/llm/src/provider.rs b/crates/core/src/model/provider.rs similarity index 92% rename from crates/llm/src/provider.rs rename to crates/core/src/model/provider.rs index 08fc6c4..2afa10c 100644 --- a/crates/llm/src/provider.rs +++ b/crates/core/src/model/provider.rs @@ -1,6 +1,6 @@ //! Provider abstractions for the unified LLM Interfaces -use crate::{Config, Message, Response, StreamChunk}; +use crate::model::{Config, Message, Response, StreamChunk}; use anyhow::Result; use futures_core::Stream; diff --git a/crates/llm/src/response.rs b/crates/core/src/model/response.rs similarity index 99% rename from crates/llm/src/response.rs rename to crates/core/src/model/response.rs index be12ab2..0d53d98 100644 --- a/crates/llm/src/response.rs +++ b/crates/core/src/model/response.rs @@ -1,6 +1,6 @@ //! Chat response abstractions for the unified LLM Interfaces -use crate::{Message, Role, tool::ToolCall}; +use crate::model::{Message, Role, tool::ToolCall}; use compact_str::CompactString; use serde::{Deserialize, Serialize}; diff --git a/crates/llm/src/stream.rs b/crates/core/src/model/stream.rs similarity index 97% rename from crates/llm/src/stream.rs rename to crates/core/src/model/stream.rs index dc4a931..ef60a56 100644 --- a/crates/llm/src/stream.rs +++ b/crates/core/src/model/stream.rs @@ -1,6 +1,6 @@ //! Streaming response abstractions for the unified LLM Interfaces -use crate::{ +use crate::model::{ FinishReason, response::{Choice, CompletionMeta, Delta}, tool::ToolCall, @@ -18,7 +18,7 @@ pub struct StreamChunk { pub choices: Vec, /// Token usage statistics (only in final chunk) - pub usage: Option, + pub usage: Option, } impl StreamChunk { diff --git a/crates/llm/src/tool.rs b/crates/core/src/model/tool.rs similarity index 100% rename from crates/llm/src/tool.rs rename to crates/core/src/model/tool.rs diff --git a/crates/core/tests/channel.rs b/crates/core/tests/channel.rs index dd915b5..c3007bb 100644 --- a/crates/core/tests/channel.rs +++ b/crates/core/tests/channel.rs @@ -19,9 +19,9 @@ fn channel_message_to_llm_message() { reply_to: None, timestamp: 1000, }; - let llm_msg: llm::Message = msg.into(); + let llm_msg: walrus_core::model::Message = msg.into(); assert_eq!(llm_msg.content, "hello agent"); - assert_eq!(llm_msg.role, llm::Role::User); + assert_eq!(llm_msg.role, walrus_core::model::Role::User); } #[test] diff --git a/crates/llm/templates/deepseek/response.json b/crates/llm/templates/deepseek/response.json deleted file mode 100644 index 7b7d3b8..0000000 --- a/crates/llm/templates/deepseek/response.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "id": "string", - "choices": [ - { - "finish_reason": "stop", - "index": 0, - "message": { - "content": "string", - "reasoning_content": "string", - "tool_calls": [ - { - "id": "string", - "type": "function", - "function": { - "name": "string", - "arguments": "string" - } - } - ], - "role": "assistant" - }, - "logprobs": { - "content": [ - { - "token": "string", - "logprob": 0, - "bytes": [0], - "top_logprobs": [ - { - "token": "string", - "logprob": 0, - "bytes": [0] - } - ] - } - ], - "reasoning_content": [ - { - "token": "string", - "logprob": 0, - "bytes": [0], - "top_logprobs": [ - { - "token": "string", - "logprob": 0, - "bytes": [0] - } - ] - } - ] - } - } - ], - "created": 0, - "model": "string", - "system_fingerprint": "string", - "object": "chat.completion", - "usage": { - "completion_tokens": 0, - "prompt_tokens": 0, - "prompt_cache_hit_tokens": 0, - "prompt_cache_miss_tokens": 0, - "total_tokens": 0, - "completion_tokens_details": { - "reasoning_tokens": 0 - } - } -} diff --git a/crates/llm/templates/deepseek/stream.json b/crates/llm/templates/deepseek/stream.json deleted file mode 100644 index 9198e9b..0000000 --- a/crates/llm/templates/deepseek/stream.json +++ /dev/null @@ -1,183 +0,0 @@ -[ - { - "id": "1f633d8bfc032625086f14113c411638", - "choices": [ - { - "index": 0, - "delta": { "content": "", "role": "assistant" }, - "finish_reason": null, - "logprobs": null - } - ], - "created": 1718345013, - "model": "deepseek-chat", - "system_fingerprint": "fp_a49d71b8a1", - "object": "chat.completion.chunk", - "usage": null - }, - - { - "choices": [ - { - "delta": { "content": "Hello", "role": "assistant" }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 1718345013, - "id": "1f633d8bfc032625086f14113c411638", - "model": "deepseek-chat", - "object": "chat.completion.chunk", - "system_fingerprint": "fp_a49d71b8a1" - }, - - { - "choices": [ - { - "delta": { "content": "!", "role": "assistant" }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 1718345013, - "id": "1f633d8bfc032625086f14113c411638", - "model": "deepseek-chat", - "object": "chat.completion.chunk", - "system_fingerprint": "fp_a49d71b8a1" - }, - - { - "choices": [ - { - "delta": { "content": " How", "role": "assistant" }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 1718345013, - "id": "1f633d8bfc032625086f14113c411638", - "model": "deepseek-chat", - "object": "chat.completion.chunk", - "system_fingerprint": "fp_a49d71b8a1" - }, - - { - "choices": [ - { - "delta": { "content": " can", "role": "assistant" }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 1718345013, - "id": "1f633d8bfc032625086f14113c411638", - "model": "deepseek-chat", - "object": "chat.completion.chunk", - "system_fingerprint": "fp_a49d71b8a1" - }, - - { - "choices": [ - { - "delta": { "content": " I", "role": "assistant" }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 1718345013, - "id": "1f633d8bfc032625086f14113c411638", - "model": "deepseek-chat", - "object": "chat.completion.chunk", - "system_fingerprint": "fp_a49d71b8a1" - }, - - { - "choices": [ - { - "delta": { "content": " assist", "role": "assistant" }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 1718345013, - "id": "1f633d8bfc032625086f14113c411638", - "model": "deepseek-chat", - "object": "chat.completion.chunk", - "system_fingerprint": "fp_a49d71b8a1" - }, - - { - "choices": [ - { - "delta": { "content": " you", "role": "assistant" }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 1718345013, - "id": "1f633d8bfc032625086f14113c411638", - "model": "deepseek-chat", - "object": "chat.completion.chunk", - "system_fingerprint": "fp_a49d71b8a1" - }, - - { - "choices": [ - { - "delta": { "content": " today", "role": "assistant" }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 1718345013, - "id": "1f633d8bfc032625086f14113c411638", - "model": "deepseek-chat", - "object": "chat.completion.chunk", - "system_fingerprint": "fp_a49d71b8a1" - }, - - { - "choices": [ - { - "delta": { "content": "?", "role": "assistant" }, - "finish_reason": null, - "index": 0, - "logprobs": null - } - ], - "created": 1718345013, - "id": "1f633d8bfc032625086f14113c411638", - "model": "deepseek-chat", - "object": "chat.completion.chunk", - "system_fingerprint": "fp_a49d71b8a1" - }, - - { - "choices": [ - { - "delta": { "content": "", "role": null }, - "finish_reason": "stop", - "index": 0, - "logprobs": null - } - ], - "created": 1718345013, - "id": "1f633d8bfc032625086f14113c411638", - "model": "deepseek-chat", - "object": "chat.completion.chunk", - "system_fingerprint": "fp_a49d71b8a1", - "usage": { - "completion_tokens": 9, - "prompt_tokens": 17, - "total_tokens": 26 - } - } -] diff --git a/crates/llm/tests/http_provider.rs b/crates/llm/tests/http_provider.rs deleted file mode 100644 index 0d840e6..0000000 --- a/crates/llm/tests/http_provider.rs +++ /dev/null @@ -1,66 +0,0 @@ -//! Tests for HttpProvider header construction. - -use walrus_llm::HttpProvider; - -#[test] -fn bearer_sets_authorization_header() { - let client = walrus_llm::Client::new(); - let provider = HttpProvider::bearer(client, "test-key", "http://example.com/v1/chat") - .expect("bearer provider"); - - let auth = provider - .headers() - .get("authorization") - .expect("authorization header"); - assert_eq!(auth.to_str().unwrap(), "Bearer test-key"); - assert_eq!(provider.endpoint(), "http://example.com/v1/chat"); -} - -#[test] -fn no_auth_omits_authorization_header() { - let client = walrus_llm::Client::new(); - let provider = HttpProvider::no_auth(client, "http://localhost:11434/v1/chat"); - - assert!(provider.headers().get("authorization").is_none()); - assert_eq!(provider.endpoint(), "http://localhost:11434/v1/chat"); -} - -#[test] -fn bearer_sets_content_type_and_accept() { - let client = walrus_llm::Client::new(); - let provider = - HttpProvider::bearer(client, "k", "http://example.com").expect("bearer provider"); - - let ct = provider - .headers() - .get("content-type") - .expect("content-type"); - assert_eq!(ct.to_str().unwrap(), "application/json"); - let accept = provider.headers().get("accept").expect("accept"); - assert_eq!(accept.to_str().unwrap(), "application/json"); -} - -#[test] -fn no_auth_sets_content_type_and_accept() { - let client = walrus_llm::Client::new(); - let provider = HttpProvider::no_auth(client, "http://localhost:8080"); - - let ct = provider - .headers() - .get("content-type") - .expect("content-type"); - assert_eq!(ct.to_str().unwrap(), "application/json"); - let accept = provider.headers().get("accept").expect("accept"); - assert_eq!(accept.to_str().unwrap(), "application/json"); -} - -#[test] -fn custom_header_sets_named_header() { - let client = walrus_llm::Client::new(); - let provider = HttpProvider::custom_header(client, "x-api-key", "sk-123", "http://example.com") - .expect("custom header provider"); - - let key = provider.headers().get("x-api-key").expect("x-api-key"); - assert_eq!(key.to_str().unwrap(), "sk-123"); - assert!(provider.headers().get("authorization").is_none()); -} diff --git a/crates/llm/tests/request.rs b/crates/llm/tests/request.rs deleted file mode 100644 index 062415c..0000000 --- a/crates/llm/tests/request.rs +++ /dev/null @@ -1,110 +0,0 @@ -//! Tests for the shared OpenAI-compatible Request type. - -use walrus_llm::{Config, General, Request, Tool, ToolChoice}; - -#[test] -fn request_from_general_sets_model() { - let general = General { - model: "gpt-4".into(), - ..General::default() - }; - let req = Request::from(general); - assert_eq!(req.model, "gpt-4"); -} - -#[test] -fn request_from_general_with_tools() { - let tool = Tool { - name: "search".into(), - description: "find docs".into(), - parameters: schemars::schema_for!(String), - strict: false, - }; - let general = General { - model: "gpt-4".into(), - tools: Some(vec![tool]), - ..General::default() - }; - let req = Request::from(general); - let tools = req.tools.expect("tools"); - assert_eq!(tools[0]["type"], "function"); - assert_eq!(tools[0]["function"]["name"], "search"); -} - -#[test] -fn request_with_tool_choice_auto() { - let req = Request::from(General::default()).with_tool_choice(ToolChoice::Auto); - assert_eq!( - req.tool_choice.expect("tool_choice"), - serde_json::json!("auto") - ); -} - -#[test] -fn request_with_tool_choice_none() { - let req = Request::from(General::default()).with_tool_choice(ToolChoice::None); - assert_eq!( - req.tool_choice.expect("tool_choice"), - serde_json::json!("none") - ); -} - -#[test] -fn request_with_tool_choice_required() { - let req = Request::from(General::default()).with_tool_choice(ToolChoice::Required); - assert_eq!( - req.tool_choice.expect("tool_choice"), - serde_json::json!("required") - ); -} - -#[test] -fn request_with_tool_choice_function() { - let general = General { - model: "gpt-4".into(), - tool_choice: Some(ToolChoice::Function("search".into())), - ..General::default() - }; - let req = Request::from(general); - let choice = req.tool_choice.expect("tool_choice"); - assert_eq!(choice["type"], "function"); - assert_eq!(choice["function"]["name"], "search"); -} - -#[test] -fn request_stream_sets_include_usage() { - let req = Request::from(General::default()).stream(true); - assert_eq!(req.stream, Some(true)); - let opts = req.stream_options.expect("stream_options"); - assert_eq!(opts["include_usage"], true); -} - -#[test] -fn request_stream_without_usage_omits_stream_options() { - let req = Request::from(General::default()).stream(false); - assert_eq!(req.stream, Some(true)); - assert!(req.stream_options.is_none()); -} - -#[test] -fn request_from_general_thinking_enabled() { - let general = General { - model: "deepseek-reasoner".into(), - think: true, - ..General::default() - }; - let req = Request::from(general); - let thinking = req.thinking.expect("thinking"); - assert_eq!(thinking["type"], "enabled"); -} - -#[test] -fn request_from_general_thinking_disabled() { - let general = General { - model: "gpt-4".into(), - think: false, - ..General::default() - }; - let req = Request::from(general); - assert!(req.thinking.is_none()); -} diff --git a/crates/sqlite/Cargo.toml b/crates/memory/Cargo.toml similarity index 73% rename from crates/sqlite/Cargo.toml rename to crates/memory/Cargo.toml index 0ecd4a0..e121afe 100644 --- a/crates/sqlite/Cargo.toml +++ b/crates/memory/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "walrus-sqlite" -description = "SQLite-backed memory for Walrus agents" -documentation = "https://docs.rs/walrus-sqlite" +name = "walrus-memory" +description = "Memory backends for Walrus agents" +documentation = "https://docs.rs/walrus-memory" version.workspace = true edition.workspace = true authors.workspace = true diff --git a/crates/sqlite/sql/delete.sql b/crates/memory/sql/delete.sql similarity index 100% rename from crates/sqlite/sql/delete.sql rename to crates/memory/sql/delete.sql diff --git a/crates/sqlite/sql/recall_fts.sql b/crates/memory/sql/recall_fts.sql similarity index 100% rename from crates/sqlite/sql/recall_fts.sql rename to crates/memory/sql/recall_fts.sql diff --git a/crates/sqlite/sql/recall_vector.sql b/crates/memory/sql/recall_vector.sql similarity index 100% rename from crates/sqlite/sql/recall_vector.sql rename to crates/memory/sql/recall_vector.sql diff --git a/crates/sqlite/sql/schema.sql b/crates/memory/sql/schema.sql similarity index 100% rename from crates/sqlite/sql/schema.sql rename to crates/memory/sql/schema.sql diff --git a/crates/sqlite/sql/select_entries.sql b/crates/memory/sql/select_entries.sql similarity index 100% rename from crates/sqlite/sql/select_entries.sql rename to crates/memory/sql/select_entries.sql diff --git a/crates/sqlite/sql/select_entry.sql b/crates/memory/sql/select_entry.sql similarity index 100% rename from crates/sqlite/sql/select_entry.sql rename to crates/memory/sql/select_entry.sql diff --git a/crates/sqlite/sql/select_value.sql b/crates/memory/sql/select_value.sql similarity index 100% rename from crates/sqlite/sql/select_value.sql rename to crates/memory/sql/select_value.sql diff --git a/crates/sqlite/sql/touch_access.sql b/crates/memory/sql/touch_access.sql similarity index 100% rename from crates/sqlite/sql/touch_access.sql rename to crates/memory/sql/touch_access.sql diff --git a/crates/sqlite/sql/upsert.sql b/crates/memory/sql/upsert.sql similarity index 100% rename from crates/sqlite/sql/upsert.sql rename to crates/memory/sql/upsert.sql diff --git a/crates/sqlite/sql/upsert_full.sql b/crates/memory/sql/upsert_full.sql similarity index 100% rename from crates/sqlite/sql/upsert_full.sql rename to crates/memory/sql/upsert_full.sql diff --git a/crates/sqlite/src/lib.rs b/crates/memory/src/lib.rs similarity index 100% rename from crates/sqlite/src/lib.rs rename to crates/memory/src/lib.rs diff --git a/crates/sqlite/src/memory.rs b/crates/memory/src/memory.rs similarity index 100% rename from crates/sqlite/src/memory.rs rename to crates/memory/src/memory.rs diff --git a/crates/sqlite/src/sql.rs b/crates/memory/src/sql.rs similarity index 100% rename from crates/sqlite/src/sql.rs rename to crates/memory/src/sql.rs diff --git a/crates/sqlite/src/utils.rs b/crates/memory/src/utils.rs similarity index 100% rename from crates/sqlite/src/utils.rs rename to crates/memory/src/utils.rs diff --git a/crates/sqlite/tests/sqlite.rs b/crates/memory/tests/sqlite.rs similarity index 99% rename from crates/sqlite/tests/sqlite.rs rename to crates/memory/tests/sqlite.rs index 699101b..525a373 100644 --- a/crates/sqlite/tests/sqlite.rs +++ b/crates/memory/tests/sqlite.rs @@ -1,6 +1,6 @@ //! Tests for SqliteMemory. -use walrus_sqlite::{SqliteMemory, cosine_similarity}; +use walrus_memory::{SqliteMemory, cosine_similarity}; use wcore::{Embedder, Memory, MemoryEntry, RecallOptions}; /// Noop embedder for tests that don't need vector search. diff --git a/crates/llm/Cargo.toml b/crates/model/Cargo.toml similarity index 53% rename from crates/llm/Cargo.toml rename to crates/model/Cargo.toml index 8a80efa..c8b7e9f 100644 --- a/crates/llm/Cargo.toml +++ b/crates/model/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "walrus-llm" -description = "Walrus unified LLM interface" -documentation = "https://docs.rs/walrus-llm" +name = "walrus-model" +description = "Walrus LLM provider implementations" +documentation = "https://docs.rs/walrus-model" version.workspace = true edition.workspace = true authors.workspace = true @@ -10,21 +10,23 @@ repository.workspace = true keywords.workspace = true [features] -default = ["http"] -http = ["dep:reqwest", "dep:futures-util"] +default = ["local"] +local = ["dep:mistralrs", "dep:dirs"] [dependencies] +wcore.workspace = true anyhow.workspace = true async-stream.workspace = true compact_str.workspace = true +futures-core.workspace = true +futures-util.workspace = true +reqwest.workspace = true serde.workspace = true -smallvec.workspace = true serde_json.workspace = true -futures-core.workspace = true -futures-util = { workspace = true, optional = true } -reqwest = { workspace = true, optional = true } -schemars.workspace = true +tokio.workspace = true tracing.workspace = true +dirs = { workspace = true, optional = true } +mistralrs = { workspace = true, optional = true } [dev-dependencies] serde_json.workspace = true diff --git a/llm/claude/src/lib.rs b/crates/model/src/claude/mod.rs similarity index 94% rename from llm/claude/src/lib.rs rename to crates/model/src/claude/mod.rs index 4effbf1..bc3a592 100644 --- a/llm/claude/src/lib.rs +++ b/crates/model/src/claude/mod.rs @@ -3,7 +3,7 @@ //! Implements the Anthropic Messages API, which differs from the OpenAI //! chat completions format in message structure and streaming events. -use llm::reqwest::{Client, header::HeaderMap}; +use reqwest::{Client, header::HeaderMap}; pub use request::Request; mod provider; @@ -35,7 +35,7 @@ impl Claude { /// Create a provider targeting a custom Anthropic-compatible endpoint. pub fn custom(client: Client, key: &str, endpoint: &str) -> anyhow::Result { - use llm::reqwest::header; + use reqwest::header; let mut headers = HeaderMap::new(); headers.insert(header::CONTENT_TYPE, "application/json".parse()?); headers.insert("x-api-key", key.parse()?); diff --git a/llm/claude/src/provider.rs b/crates/model/src/claude/provider.rs similarity index 95% rename from llm/claude/src/provider.rs rename to crates/model/src/claude/provider.rs index b9bf430..967dcea 100644 --- a/llm/claude/src/provider.rs +++ b/crates/model/src/claude/provider.rs @@ -1,14 +1,15 @@ //! LLM trait implementation for the Claude (Anthropic) provider. -use crate::{Claude, Request, stream::Event}; +use super::{Claude, Request, stream::Event}; use anyhow::Result; use async_stream::try_stream; use compact_str::CompactString; use futures_core::Stream; use futures_util::StreamExt; -use llm::{ +use reqwest::Method; +use wcore::model::{ Choice, CompletionMeta, CompletionTokensDetails, Delta, FinishReason, LLM, Message, Response, - StreamChunk, Usage, reqwest::Method, + StreamChunk, Usage, }; /// Raw Anthropic non-streaming response. @@ -135,11 +136,11 @@ fn to_response(raw: AnthropicResponse) -> Response { content.push_str(&text); } ContentBlock::ToolUse { id, name, input } => { - tool_calls.push(llm::ToolCall { + tool_calls.push(wcore::model::ToolCall { id, index: tool_calls.len() as u32, call_type: "function".into(), - function: llm::FunctionCall { + function: wcore::model::FunctionCall { name, arguments: serde_json::to_string(&input).unwrap_or_default(), }, @@ -165,7 +166,7 @@ fn to_response(raw: AnthropicResponse) -> Response { choices: vec![Choice { index: 0, delta: Delta { - role: Some(llm::Role::Assistant), + role: Some(wcore::model::Role::Assistant), content: Some(content), reasoning_content: None, tool_calls: if tool_calls.is_empty() { diff --git a/llm/claude/src/request.rs b/crates/model/src/claude/request.rs similarity index 98% rename from llm/claude/src/request.rs rename to crates/model/src/claude/request.rs index 1b1e583..22f6c68 100644 --- a/llm/claude/src/request.rs +++ b/crates/model/src/claude/request.rs @@ -1,6 +1,6 @@ //! Request body for the Anthropic Messages API. -use llm::{Config, General, Message, Role, Tool, ToolChoice}; +use wcore::model::{Config, General, Message, Role, Tool, ToolChoice}; use serde::Serialize; use serde_json::{Value, json}; diff --git a/llm/claude/src/stream.rs b/crates/model/src/claude/stream.rs similarity index 99% rename from llm/claude/src/stream.rs rename to crates/model/src/claude/stream.rs index 1a18a65..9350578 100644 --- a/llm/claude/src/stream.rs +++ b/crates/model/src/claude/stream.rs @@ -9,7 +9,7 @@ //! - `message_stop` — end of message use compact_str::CompactString; -use llm::{ +use wcore::model::{ Choice, CompletionMeta, CompletionTokensDetails, Delta, FinishReason, FunctionCall, StreamChunk, ToolCall, Usage, }; diff --git a/app/provider/src/config.rs b/crates/model/src/config.rs similarity index 100% rename from app/provider/src/config.rs rename to crates/model/src/config.rs diff --git a/llm/deepseek/src/lib.rs b/crates/model/src/deepseek/mod.rs similarity index 84% rename from llm/deepseek/src/lib.rs rename to crates/model/src/deepseek/mod.rs index 3cc51f5..36da47f 100644 --- a/llm/deepseek/src/lib.rs +++ b/crates/model/src/deepseek/mod.rs @@ -1,6 +1,6 @@ //! DeepSeek LLM provider -use llm::reqwest::{Client, header::HeaderMap}; +use reqwest::{Client, header::HeaderMap}; pub use request::Request; mod provider; diff --git a/llm/deepseek/src/provider.rs b/crates/model/src/deepseek/provider.rs similarity index 94% rename from llm/deepseek/src/provider.rs rename to crates/model/src/deepseek/provider.rs index 0b78491..008a2d7 100644 --- a/llm/deepseek/src/provider.rs +++ b/crates/model/src/deepseek/provider.rs @@ -1,17 +1,12 @@ //! The LLM implementation -use crate::{DeepSeek, Request}; +use super::{DeepSeek, Request}; use anyhow::Result; use async_stream::try_stream; use futures_core::Stream; use futures_util::StreamExt; -use llm::{ - Client, LLM, Message, Response, StreamChunk, - reqwest::{ - Method, - header::{self, HeaderMap}, - }, -}; +use reqwest::{Client, Method, header::{self, HeaderMap}}; +use wcore::model::{LLM, Message, Response, StreamChunk}; const ENDPOINT: &str = "https://api.deepseek.com/chat/completions"; diff --git a/llm/deepseek/src/request.rs b/crates/model/src/deepseek/request.rs similarity index 98% rename from llm/deepseek/src/request.rs rename to crates/model/src/deepseek/request.rs index 3ac042b..25ae117 100644 --- a/llm/deepseek/src/request.rs +++ b/crates/model/src/deepseek/request.rs @@ -1,6 +1,6 @@ //! The request body for the DeepSeek API -use llm::{Config, General, Message, Tool, ToolChoice}; +use wcore::model::{Config, General, Message, Tool, ToolChoice}; use serde::Serialize; use serde_json::{Value, json}; diff --git a/crates/llm/src/http.rs b/crates/model/src/http.rs similarity index 99% rename from crates/llm/src/http.rs rename to crates/model/src/http.rs index 461eef2..edb7c62 100644 --- a/crates/llm/src/http.rs +++ b/crates/model/src/http.rs @@ -5,7 +5,7 @@ //! Server-Sent Events streaming. Used by DeepSeek, OpenAI, and Mistral — //! Claude uses its own transport (different SSE format). -use crate::{Response, StreamChunk}; +use wcore::model::{Response, StreamChunk}; use anyhow::Result; use async_stream::try_stream; use futures_core::Stream; diff --git a/crates/model/src/lib.rs b/crates/model/src/lib.rs new file mode 100644 index 0000000..37a9a49 --- /dev/null +++ b/crates/model/src/lib.rs @@ -0,0 +1,25 @@ +//! Model crate — LLM provider implementations, enum dispatch, configuration, +//! construction, and runtime management. +//! +//! Merges all provider backends (DeepSeek, OpenAI, Claude, Local) with the +//! `Provider` enum, `ProviderManager`, and `ProviderConfig` into a single crate. +//! Config uses flat `ProviderConfig` with model-prefix kind detection (DD#67). + +pub mod config; +pub mod http; +pub mod manager; +mod provider; +pub mod request; + +pub mod claude; +pub mod deepseek; +#[cfg(feature = "local")] +pub mod local; +pub mod openai; + +pub use config::{ProviderConfig, ProviderKind}; +pub use http::HttpProvider; +pub use manager::ProviderManager; +pub use provider::{Provider, build_provider}; +pub use request::Request; +pub use reqwest::Client; diff --git a/llm/local/src/lib.rs b/crates/model/src/local/mod.rs similarity index 100% rename from llm/local/src/lib.rs rename to crates/model/src/local/mod.rs diff --git a/llm/local/src/provider.rs b/crates/model/src/local/provider.rs similarity index 92% rename from llm/local/src/provider.rs rename to crates/model/src/local/provider.rs index 0704f5c..a0e255a 100644 --- a/llm/local/src/provider.rs +++ b/crates/model/src/local/provider.rs @@ -1,11 +1,11 @@ //! LLM trait implementation for the Local provider. -use crate::Local; +use super::Local; use anyhow::Result; use async_stream::try_stream; use compact_str::CompactString; use futures_core::Stream; -use llm::{ +use wcore::model::{ Choice, CompletionMeta, Delta, FunctionCall, General, LLM, Message, Response, Role, StreamChunk, ToolCall, Usage, }; @@ -116,9 +116,9 @@ fn build_request(config: &General, messages: &[Message]) -> mistralrs::RequestBu if let Some(tool_choice) = &config.tool_choice { let mr_choice = match tool_choice { - llm::ToolChoice::None => mistralrs::ToolChoice::None, - llm::ToolChoice::Auto | llm::ToolChoice::Required => mistralrs::ToolChoice::Auto, - llm::ToolChoice::Function(name) => mistralrs::ToolChoice::Tool(mistralrs::Tool { + wcore::model::ToolChoice::None => mistralrs::ToolChoice::None, + wcore::model::ToolChoice::Auto | wcore::model::ToolChoice::Required => mistralrs::ToolChoice::Auto, + wcore::model::ToolChoice::Function(name) => mistralrs::ToolChoice::Tool(mistralrs::Tool { tp: mistralrs::ToolType::Function, function: mistralrs::Function { description: None, @@ -230,12 +230,12 @@ fn convert_usage(u: &mistralrs::Usage) -> Usage { } /// Parse a finish reason string into a walrus `FinishReason`. -fn parse_finish_reason(reason: &str) -> Option { +fn parse_finish_reason(reason: &str) -> Option { match reason { - "stop" => Some(llm::FinishReason::Stop), - "length" => Some(llm::FinishReason::Length), - "content_filter" => Some(llm::FinishReason::ContentFilter), - "tool_calls" => Some(llm::FinishReason::ToolCalls), + "stop" => Some(wcore::model::FinishReason::Stop), + "length" => Some(wcore::model::FinishReason::Length), + "content_filter" => Some(wcore::model::FinishReason::ContentFilter), + "tool_calls" => Some(wcore::model::FinishReason::ToolCalls), _ => None, } } diff --git a/app/provider/src/manager.rs b/crates/model/src/manager.rs similarity index 97% rename from app/provider/src/manager.rs rename to crates/model/src/manager.rs index 5ffbcb3..158edf5 100644 --- a/app/provider/src/manager.rs +++ b/crates/model/src/manager.rs @@ -7,7 +7,7 @@ use async_stream::try_stream; use compact_str::CompactString; use futures_core::Stream; use futures_util::StreamExt; -use llm::{General, LLM, Message, Response, StreamChunk}; +use wcore::model::{General, LLM, Message, Response, StreamChunk}; use std::collections::BTreeMap; use std::sync::{Arc, RwLock}; @@ -26,7 +26,7 @@ struct Inner { /// Model name of the currently active provider. active: CompactString, /// Shared HTTP client for constructing new providers. - client: llm::Client, + client: reqwest::Client, } /// Info about a single provider entry returned by `list()`. @@ -49,7 +49,7 @@ impl ProviderManager { bail!("at least one provider config is required"); } - let client = llm::Client::new(); + let client = reqwest::Client::new(); let mut providers = BTreeMap::new(); for config in configs { @@ -78,7 +78,7 @@ impl ProviderManager { inner: Arc::new(RwLock::new(Inner { providers, active: model, - client: llm::Client::new(), + client: reqwest::Client::new(), })), } } diff --git a/llm/openai/src/lib.rs b/crates/model/src/openai/mod.rs similarity index 96% rename from llm/openai/src/lib.rs rename to crates/model/src/openai/mod.rs index a199ae0..e45066f 100644 --- a/llm/openai/src/lib.rs +++ b/crates/model/src/openai/mod.rs @@ -3,7 +3,7 @@ //! Covers OpenAI, Grok (xAI), Qwen (Alibaba), Kimi (Moonshot), Ollama, //! and any other service exposing the OpenAI chat completions API. -use llm::reqwest::{Client, header::HeaderMap}; +use reqwest::{Client, header::HeaderMap}; pub use request::Request; mod provider; @@ -57,7 +57,7 @@ impl OpenAI { /// Create a provider targeting a local Ollama instance (no API key). pub fn ollama(client: Client) -> anyhow::Result { - use llm::reqwest::header; + use reqwest::header; let mut headers = HeaderMap::new(); headers.insert(header::CONTENT_TYPE, "application/json".parse()?); headers.insert(header::ACCEPT, "application/json".parse()?); @@ -70,7 +70,7 @@ impl OpenAI { /// Create a provider targeting a custom OpenAI-compatible endpoint. pub fn custom(client: Client, key: &str, endpoint: &str) -> anyhow::Result { - use llm::reqwest::header; + use reqwest::header; let mut headers = HeaderMap::new(); headers.insert(header::CONTENT_TYPE, "application/json".parse()?); headers.insert(header::ACCEPT, "application/json".parse()?); diff --git a/llm/openai/src/provider.rs b/crates/model/src/openai/provider.rs similarity index 95% rename from llm/openai/src/provider.rs rename to crates/model/src/openai/provider.rs index e4d2b2f..2689666 100644 --- a/llm/openai/src/provider.rs +++ b/crates/model/src/openai/provider.rs @@ -1,11 +1,12 @@ //! LLM trait implementation for the OpenAI-compatible provider. -use crate::{OpenAI, Request}; +use super::{OpenAI, Request}; use anyhow::Result; use async_stream::try_stream; use futures_core::Stream; use futures_util::StreamExt; -use llm::{LLM, Message, Response, StreamChunk, reqwest::Method}; +use reqwest::Method; +use wcore::model::{LLM, Message, Response, StreamChunk}; impl LLM for OpenAI { type ChatConfig = Request; diff --git a/llm/openai/src/request.rs b/crates/model/src/openai/request.rs similarity index 98% rename from llm/openai/src/request.rs rename to crates/model/src/openai/request.rs index e1254a3..f4c8964 100644 --- a/llm/openai/src/request.rs +++ b/crates/model/src/openai/request.rs @@ -1,6 +1,6 @@ //! Request body for OpenAI-compatible chat completions API. -use llm::{Config, General, Message, Tool, ToolChoice}; +use wcore::model::{Config, General, Message, Tool, ToolChoice}; use serde::Serialize; use serde_json::{Value, json}; diff --git a/app/provider/src/provider.rs b/crates/model/src/provider.rs similarity index 84% rename from app/provider/src/provider.rs rename to crates/model/src/provider.rs index 82a1c92..1fb641e 100644 --- a/app/provider/src/provider.rs +++ b/crates/model/src/provider.rs @@ -6,12 +6,12 @@ use crate::config::{ProviderConfig, ProviderKind}; use anyhow::Result; use async_stream::try_stream; -use claude::Claude; -use deepseek::DeepSeek; +use crate::claude::Claude; +use crate::deepseek::DeepSeek; use futures_core::Stream; use futures_util::StreamExt; -use llm::{General, LLM, Message, Response, StreamChunk}; -use openai::OpenAI; +use wcore::model::{General, LLM, Message, Response, StreamChunk}; +use crate::openai::OpenAI; /// Unified LLM provider enum. /// @@ -27,14 +27,14 @@ pub enum Provider { Claude(Claude), /// Local inference via mistralrs. #[cfg(feature = "local")] - Local(local::Local), + Local(crate::local::Local), } /// Construct a `Provider` from config and a shared HTTP client. /// /// This function is async because local providers need to load model weights /// asynchronously. -pub async fn build_provider(config: &ProviderConfig, client: llm::Client) -> Result { +pub async fn build_provider(config: &ProviderConfig, client: reqwest::Client) -> Result { let kind = config.kind()?; let api_key = config.api_key.as_deref().unwrap_or(""); let base_url = config.base_url.as_deref(); @@ -71,10 +71,10 @@ pub async fn build_provider(config: &ProviderConfig, client: llm::Client) -> Res let isq = config.quantization.map(|q| q.to_isq()); let chat_template = config.chat_template.as_deref(); let local = match loader { - Loader::Text => local::Local::from_text(&config.model, isq, chat_template).await?, - Loader::Gguf => local::Local::from_gguf(&config.model, chat_template).await?, + Loader::Text => crate::local::Local::from_text(&config.model, isq, chat_template).await?, + Loader::Gguf => crate::local::Local::from_gguf(&config.model, chat_template).await?, Loader::Vision => { - local::Local::from_vision(&config.model, isq, chat_template).await? + crate::local::Local::from_vision(&config.model, isq, chat_template).await? } Loader::Lora | Loader::XLora | Loader::GgufLora | Loader::GgufXLora => { anyhow::bail!( @@ -99,15 +99,15 @@ impl LLM for Provider { async fn send(&self, config: &General, messages: &[Message]) -> Result { match self { Self::DeepSeek(p) => { - let req = deepseek::Request::from(config.clone()); + let req = crate::deepseek::Request::from(config.clone()); p.send(&req, messages).await } Self::OpenAI(p) => { - let req = openai::Request::from(config.clone()); + let req = crate::openai::Request::from(config.clone()); p.send(&req, messages).await } Self::Claude(p) => { - let req = claude::Request::from(config.clone()); + let req = crate::claude::Request::from(config.clone()); p.send(&req, messages).await } #[cfg(feature = "local")] @@ -126,21 +126,21 @@ impl LLM for Provider { try_stream! { match this { Provider::DeepSeek(p) => { - let req = deepseek::Request::from(config); + let req = crate::deepseek::Request::from(config); let mut stream = std::pin::pin!(p.stream(req, &messages, usage)); while let Some(chunk) = stream.next().await { yield chunk?; } } Provider::OpenAI(p) => { - let req = openai::Request::from(config); + let req = crate::openai::Request::from(config); let mut stream = std::pin::pin!(p.stream(req, &messages, usage)); while let Some(chunk) = stream.next().await { yield chunk?; } } Provider::Claude(p) => { - let req = claude::Request::from(config); + let req = crate::claude::Request::from(config); let mut stream = std::pin::pin!(p.stream(req, &messages, usage)); while let Some(chunk) = stream.next().await { yield chunk?; diff --git a/crates/llm/src/request.rs b/crates/model/src/request.rs similarity index 98% rename from crates/llm/src/request.rs rename to crates/model/src/request.rs index 1612122..c397fe4 100644 --- a/crates/llm/src/request.rs +++ b/crates/model/src/request.rs @@ -4,7 +4,7 @@ //! use `Option` + `skip_serializing_if` so provider-specific extras (like //! DeepSeek's `thinking`) are simply absent when unused. -use crate::{Config, General, Message, Tool, ToolChoice}; +use wcore::model::{Config, General, Message, Tool, ToolChoice}; use serde::Serialize; use serde_json::{Value, json}; diff --git a/app/provider/tests/build_provider.rs b/crates/model/tests/build_provider.rs similarity index 78% rename from app/provider/tests/build_provider.rs rename to crates/model/tests/build_provider.rs index ce5f985..7f1ce1b 100644 --- a/app/provider/tests/build_provider.rs +++ b/crates/model/tests/build_provider.rs @@ -1,6 +1,6 @@ //! Tests for `build_provider()` factory (DD#67). -use walrus_provider::{Provider, ProviderConfig, build_provider}; +use walrus_model::{Provider, ProviderConfig, build_provider}; #[tokio::test] async fn build_deepseek_default() { @@ -12,7 +12,7 @@ async fn build_deepseek_default() { quantization: None, chat_template: None, }; - let p = build_provider(&config, llm::Client::new()).await.unwrap(); + let p = build_provider(&config, walrus_model::Client::new()).await.unwrap(); assert!(matches!(p, Provider::DeepSeek(_))); } @@ -26,7 +26,7 @@ async fn build_openai_custom_url() { quantization: None, chat_template: None, }; - let p = build_provider(&config, llm::Client::new()).await.unwrap(); + let p = build_provider(&config, walrus_model::Client::new()).await.unwrap(); assert!(matches!(p, Provider::OpenAI(_))); } @@ -40,7 +40,7 @@ async fn build_ollama_base_url_only() { quantization: None, chat_template: None, }; - let p = build_provider(&config, llm::Client::new()).await.unwrap(); + let p = build_provider(&config, walrus_model::Client::new()).await.unwrap(); assert!(matches!(p, Provider::OpenAI(_))); } @@ -54,6 +54,6 @@ async fn build_claude_default() { quantization: None, chat_template: None, }; - let p = build_provider(&config, llm::Client::new()).await.unwrap(); + let p = build_provider(&config, walrus_model::Client::new()).await.unwrap(); assert!(matches!(p, Provider::Claude(_))); } diff --git a/app/provider/tests/config.rs b/crates/model/tests/config.rs similarity index 98% rename from app/provider/tests/config.rs rename to crates/model/tests/config.rs index ca61a57..fe428fd 100644 --- a/app/provider/tests/config.rs +++ b/crates/model/tests/config.rs @@ -1,6 +1,6 @@ //! Tests for `ProviderConfig` (DD#67). -use walrus_provider::{ProviderConfig, ProviderKind}; +use walrus_model::{ProviderConfig, ProviderKind}; // --- kind detection --- @@ -210,7 +210,7 @@ fn validate_local_rejects_api_key() { #[test] fn validate_remote_rejects_loader() { - use walrus_provider::config::Loader; + use walrus_model::config::Loader; let config = ProviderConfig { model: "deepseek-chat".into(), api_key: Some("key".into()), diff --git a/app/provider/tests/manager.rs b/crates/model/tests/manager.rs similarity index 98% rename from app/provider/tests/manager.rs rename to crates/model/tests/manager.rs index 764b695..c9bacae 100644 --- a/app/provider/tests/manager.rs +++ b/crates/model/tests/manager.rs @@ -1,6 +1,6 @@ //! Tests for `ProviderManager` (DD#67). -use walrus_provider::{ProviderConfig, ProviderManager}; +use walrus_model::{ProviderConfig, ProviderManager}; fn test_configs() -> Vec { vec![ diff --git a/crates/runtime/Cargo.toml b/crates/runtime/Cargo.toml index 54c9af8..5dc63f8 100644 --- a/crates/runtime/Cargo.toml +++ b/crates/runtime/Cargo.toml @@ -10,7 +10,6 @@ repository.workspace = true keywords.workspace = true [dependencies] -llm.workspace = true wcore.workspace = true # crates-io dependencies @@ -29,7 +28,7 @@ tokio.workspace = true tracing.workspace = true [dev-dependencies] -deepseek.workspace = true +model.workspace = true tempfile.workspace = true tracing-subscriber.workspace = true dotenvy.workspace = true diff --git a/crates/runtime/examples/common/mod.rs b/crates/runtime/examples/common/mod.rs index 540d22f..63380c9 100644 --- a/crates/runtime/examples/common/mod.rs +++ b/crates/runtime/examples/common/mod.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] -use deepseek::DeepSeek; +use model::deepseek::DeepSeek; use walrus_runtime::{DEFAULT_COMPACT_PROMPT, DEFAULT_FLUSH_PROMPT, Hook, Memory, prelude::*}; /// Example hook wiring DeepSeek as the LLM provider. @@ -39,7 +39,8 @@ pub fn load_api_key() -> String { /// Build a default Runtime with DeepSeek provider and InMemory. pub fn build_runtime() -> Runtime { let key = load_api_key(); - let provider = DeepSeek::new(llm::Client::new(), &key).expect("failed to create provider"); + let provider = + DeepSeek::new(model::Client::new(), &key).expect("failed to create provider"); Runtime::new(General::default(), provider, InMemory::new()) } diff --git a/crates/runtime/src/hook.rs b/crates/runtime/src/hook.rs index 4aafedd..3c4ac46 100644 --- a/crates/runtime/src/hook.rs +++ b/crates/runtime/src/hook.rs @@ -4,7 +4,7 @@ //! which [`Memory`] backend and LLM provider to use, and what prompts //! to send for automatic compaction and memory flush. -use llm::{General, LLM, NoopProvider}; +use wcore::model::{General, LLM, NoopProvider}; use wcore::{InMemory, Memory}; /// Type-level runtime configuration. diff --git a/crates/runtime/src/lib.rs b/crates/runtime/src/lib.rs index c6504ba..2a3d438 100644 --- a/crates/runtime/src/lib.rs +++ b/crates/runtime/src/lib.rs @@ -16,7 +16,7 @@ //! ``` pub use hook::{DEFAULT_COMPACT_PROMPT, DEFAULT_FLUSH_PROMPT, Hook}; -pub use llm::{Client, General, Message, Response, Role, StreamChunk, Tool}; +pub use wcore::model::{General, Message, Response, Role, StreamChunk, Tool}; pub use loader::{CronEntry, load_agents_dir, load_cron_dir, parse_agent_md, parse_cron_md}; pub use mcp::McpBridge; pub use skills::{SkillRegistry, parse_skill_md}; @@ -27,7 +27,7 @@ use anyhow::Result; use compact_str::CompactString; use futures_core::Stream; use futures_util::StreamExt; -use llm::{Config, FinishReason, LLM, ToolCall, ToolChoice, estimate_tokens}; +use wcore::model::{Config, FinishReason, LLM, ToolCall, ToolChoice, estimate_tokens}; use std::{collections::BTreeMap, future::Future, pin::Pin, sync::Arc}; pub mod hook; diff --git a/crates/runtime/src/mcp.rs b/crates/runtime/src/mcp.rs index 2942370..de8b8cc 100644 --- a/crates/runtime/src/mcp.rs +++ b/crates/runtime/src/mcp.rs @@ -5,7 +5,7 @@ use anyhow::Result; use compact_str::CompactString; -use llm::Tool; +use wcore::model::Tool; use rmcp::{ ServiceExt, model::{CallToolRequestParams, RawContent}, @@ -23,7 +23,7 @@ struct ConnectedPeer { /// Bridge to one or more MCP servers via the rmcp SDK. /// -/// Converts MCP tool definitions to walrus-llm [`Tool`] schemas and +/// Converts MCP tool definitions to walrus-core [`Tool`] schemas and /// dispatches tool calls through the protocol. pub struct McpBridge { peers: Mutex>, @@ -121,7 +121,7 @@ impl McpBridge { } } -/// Convert an rmcp Tool to a walrus-llm Tool. +/// Convert an rmcp Tool to a walrus-core Tool. pub fn convert_tool(mcp_tool: &rmcp::model::Tool) -> Tool { let schema_value = serde_json::to_value(mcp_tool.input_schema.as_ref()).unwrap_or(serde_json::json!({})); diff --git a/crates/runtime/src/team.rs b/crates/runtime/src/team.rs index 8c845de..2325716 100644 --- a/crates/runtime/src/team.rs +++ b/crates/runtime/src/team.rs @@ -20,7 +20,7 @@ use crate::{Handler, Hook, MAX_TOOL_CALLS, SkillRegistry}; use compact_str::CompactString; -use llm::{Config, General, LLM, Message, Tool, ToolChoice}; +use wcore::model::{Config, General, LLM, Message, Tool, ToolChoice}; use std::{collections::BTreeMap, sync::Arc}; use wcore::{Agent, Memory}; diff --git a/crates/runtime/tests/runtime.rs b/crates/runtime/tests/runtime.rs index d0509e2..1636373 100644 --- a/crates/runtime/tests/runtime.rs +++ b/crates/runtime/tests/runtime.rs @@ -1,7 +1,7 @@ //! Tests for the Runtime orchestrator. use compact_str::CompactString; -use llm::{FunctionCall, General, Message, NoopProvider, Tool, ToolCall}; +use wcore::model::{FunctionCall, General, Message, NoopProvider, Tool, ToolCall}; use std::collections::BTreeMap; use walrus_runtime::{Hook, Runtime, SkillRegistry}; use wcore::{Agent, InMemory, Memory, Skill, SkillTier}; diff --git a/crates/runtime/tests/team.rs b/crates/runtime/tests/team.rs index b4e7880..4837d41 100644 --- a/crates/runtime/tests/team.rs +++ b/crates/runtime/tests/team.rs @@ -1,6 +1,6 @@ //! Tests for team composition. -use llm::{General, NoopProvider}; +use wcore::model::{General, NoopProvider}; use walrus_runtime::{Runtime, build_team, extract_input, worker_tool}; use wcore::{Agent, InMemory}; @@ -89,11 +89,11 @@ async fn worker_handler_parses_input() { let _leader = build_team(leader, vec![analyst], &mut rt); // Dispatch a tool call with invalid JSON to verify input parsing. - let calls = vec![llm::ToolCall { + let calls = vec![wcore::model::ToolCall { id: "call_1".into(), index: 0, call_type: "function".into(), - function: llm::FunctionCall { + function: wcore::model::FunctionCall { name: "analyst".into(), arguments: "not json".into(), }, diff --git a/llm/claude/Cargo.toml b/llm/claude/Cargo.toml deleted file mode 100644 index 5f2172d..0000000 --- a/llm/claude/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "walrus-claude" -description = "Walrus Claude (Anthropic) provider implementation" -documentation = "https://docs.rs/walrus-claude" -version.workspace = true -edition.workspace = true -authors.workspace = true -license.workspace = true -repository.workspace = true -keywords.workspace = true - -[dependencies] -llm.workspace = true - -# crates-io dependencies -anyhow.workspace = true -compact_str.workspace = true -async-stream.workspace = true -futures-core.workspace = true -futures-util.workspace = true -serde.workspace = true -serde_json.workspace = true -tracing.workspace = true diff --git a/llm/deepseek/Cargo.toml b/llm/deepseek/Cargo.toml deleted file mode 100644 index 7f4799c..0000000 --- a/llm/deepseek/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "walrus-deepseek" -description = "Walrus DeepSeek provider implementation" -documentation = "https://docs.rs/walrus-deepseek" -version.workspace = true -edition.workspace = true -authors.workspace = true -license.workspace = true -repository.workspace = true -keywords.workspace = true - -[dependencies] -llm.workspace = true - -# crates-io dependencies -anyhow.workspace = true -async-stream.workspace = true -futures-core.workspace = true -futures-util.workspace = true -serde.workspace = true -serde_json.workspace = true -tracing.workspace = true diff --git a/llm/deepseek/README.md b/llm/deepseek/README.md deleted file mode 100644 index 46d04ff..0000000 --- a/llm/deepseek/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# walrus-deepseek - -DeepSeek LLM provider for walrus. - -## Overview - -Implements the `LLM` trait for DeepSeek API, supporting: - -- `deepseek-chat` - Standard chat model -- `deepseek-reasoner` - Reasoning model with thinking mode -- Streaming responses -- Tool calling with thinking mode - -## Usage - -```rust -use walrus::{DeepSeek, LLM}; - -let provider = DeepSeek::new(client, "your-api-key")?; -``` - -## License - -MIT diff --git a/llm/local/Cargo.toml b/llm/local/Cargo.toml deleted file mode 100644 index b8758d5..0000000 --- a/llm/local/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -name = "walrus-local" -description = "Walrus local LLM provider via mistralrs" -documentation = "https://docs.rs/walrus-local" -version.workspace = true -edition.workspace = true -authors.workspace = true -license.workspace = true -repository.workspace = true -keywords.workspace = true - -[dependencies] -llm.workspace = true -anyhow.workspace = true -async-stream.workspace = true -compact_str.workspace = true -dirs.workspace = true -futures-core.workspace = true -serde_json.workspace = true -tracing.workspace = true -mistralrs.workspace = true - -[target.'cfg(target_os = "macos")'.dependencies] -mistralrs = { workspace = true, features = ["metal", "accelerate"] } diff --git a/llm/openai/Cargo.toml b/llm/openai/Cargo.toml deleted file mode 100644 index 3e8843f..0000000 --- a/llm/openai/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "walrus-openai" -description = "Walrus OpenAI-compatible provider implementation" -documentation = "https://docs.rs/walrus-openai" -version.workspace = true -edition.workspace = true -authors.workspace = true -license.workspace = true -repository.workspace = true -keywords.workspace = true - -[dependencies] -llm.workspace = true - -# crates-io dependencies -anyhow.workspace = true -async-stream.workspace = true -futures-core.workspace = true -futures-util.workspace = true -serde.workspace = true -serde_json.workspace = true -tracing.workspace = true From 7f64a9f4e76b14536f7dcd1404297f09adc91295 Mon Sep 17 00:00:00 2001 From: clearloop Date: Sat, 28 Feb 2026 19:25:44 +0800 Subject: [PATCH 8/8] chore(clippy): make clippy happy --- app/daemon/src/gateway/uds.rs | 2 +- crates/model/src/claude/mod.rs | 2 +- crates/model/src/claude/request.rs | 2 +- crates/model/src/claude/stream.rs | 2 +- crates/model/src/deepseek/mod.rs | 2 +- crates/model/src/deepseek/provider.rs | 5 ++++- crates/model/src/deepseek/request.rs | 2 +- crates/model/src/http.rs | 2 +- crates/model/src/local/provider.rs | 24 ++++++++++++++---------- crates/model/src/manager.rs | 2 +- crates/model/src/openai/mod.rs | 2 +- crates/model/src/openai/request.rs | 2 +- crates/model/src/provider.rs | 14 +++++++++----- crates/model/src/request.rs | 2 +- crates/model/tests/build_provider.rs | 16 ++++++++++++---- crates/runtime/examples/common/mod.rs | 3 +-- crates/runtime/src/lib.rs | 4 ++-- crates/runtime/src/mcp.rs | 2 +- crates/runtime/src/team.rs | 2 +- crates/runtime/tests/runtime.rs | 2 +- crates/runtime/tests/team.rs | 2 +- 21 files changed, 57 insertions(+), 39 deletions(-) diff --git a/app/daemon/src/gateway/uds.rs b/app/daemon/src/gateway/uds.rs index 3a4b16c..3a34758 100644 --- a/app/daemon/src/gateway/uds.rs +++ b/app/daemon/src/gateway/uds.rs @@ -2,7 +2,6 @@ use crate::gateway::Gateway; use compact_str::CompactString; -use wcore::model::Message; use protocol::codec::{self, FrameError}; use protocol::{AgentSummary, ClientMessage, ServerMessage}; use runtime::Hook; @@ -11,6 +10,7 @@ use tokio::net::UnixListener; use tokio::net::unix::{OwnedReadHalf, OwnedWriteHalf}; use tokio::sync::{mpsc, oneshot}; use wcore::Memory; +use wcore::model::Message; /// Accept connections on the given `UnixListener` until shutdown is signalled. pub async fn accept_loop( diff --git a/crates/model/src/claude/mod.rs b/crates/model/src/claude/mod.rs index bc3a592..0c92843 100644 --- a/crates/model/src/claude/mod.rs +++ b/crates/model/src/claude/mod.rs @@ -3,8 +3,8 @@ //! Implements the Anthropic Messages API, which differs from the OpenAI //! chat completions format in message structure and streaming events. -use reqwest::{Client, header::HeaderMap}; pub use request::Request; +use reqwest::{Client, header::HeaderMap}; mod provider; mod request; diff --git a/crates/model/src/claude/request.rs b/crates/model/src/claude/request.rs index 22f6c68..995d65c 100644 --- a/crates/model/src/claude/request.rs +++ b/crates/model/src/claude/request.rs @@ -1,8 +1,8 @@ //! Request body for the Anthropic Messages API. -use wcore::model::{Config, General, Message, Role, Tool, ToolChoice}; use serde::Serialize; use serde_json::{Value, json}; +use wcore::model::{Config, General, Message, Role, Tool, ToolChoice}; /// The request body for the Anthropic Messages API. #[derive(Debug, Clone, Serialize)] diff --git a/crates/model/src/claude/stream.rs b/crates/model/src/claude/stream.rs index 9350578..02d5bbe 100644 --- a/crates/model/src/claude/stream.rs +++ b/crates/model/src/claude/stream.rs @@ -9,11 +9,11 @@ //! - `message_stop` — end of message use compact_str::CompactString; +use serde::Deserialize; use wcore::model::{ Choice, CompletionMeta, CompletionTokensDetails, Delta, FinishReason, FunctionCall, StreamChunk, ToolCall, Usage, }; -use serde::Deserialize; /// A raw SSE event from the Anthropic streaming API. #[derive(Debug, Deserialize)] diff --git a/crates/model/src/deepseek/mod.rs b/crates/model/src/deepseek/mod.rs index 36da47f..ccc12a5 100644 --- a/crates/model/src/deepseek/mod.rs +++ b/crates/model/src/deepseek/mod.rs @@ -1,7 +1,7 @@ //! DeepSeek LLM provider -use reqwest::{Client, header::HeaderMap}; pub use request::Request; +use reqwest::{Client, header::HeaderMap}; mod provider; mod request; diff --git a/crates/model/src/deepseek/provider.rs b/crates/model/src/deepseek/provider.rs index 008a2d7..74b3549 100644 --- a/crates/model/src/deepseek/provider.rs +++ b/crates/model/src/deepseek/provider.rs @@ -5,7 +5,10 @@ use anyhow::Result; use async_stream::try_stream; use futures_core::Stream; use futures_util::StreamExt; -use reqwest::{Client, Method, header::{self, HeaderMap}}; +use reqwest::{ + Client, Method, + header::{self, HeaderMap}, +}; use wcore::model::{LLM, Message, Response, StreamChunk}; const ENDPOINT: &str = "https://api.deepseek.com/chat/completions"; diff --git a/crates/model/src/deepseek/request.rs b/crates/model/src/deepseek/request.rs index 25ae117..fca42f5 100644 --- a/crates/model/src/deepseek/request.rs +++ b/crates/model/src/deepseek/request.rs @@ -1,8 +1,8 @@ //! The request body for the DeepSeek API -use wcore::model::{Config, General, Message, Tool, ToolChoice}; use serde::Serialize; use serde_json::{Value, json}; +use wcore::model::{Config, General, Message, Tool, ToolChoice}; /// The request body for the DeepSeek API #[derive(Debug, Clone, Serialize)] diff --git a/crates/model/src/http.rs b/crates/model/src/http.rs index edb7c62..ce41682 100644 --- a/crates/model/src/http.rs +++ b/crates/model/src/http.rs @@ -5,7 +5,6 @@ //! Server-Sent Events streaming. Used by DeepSeek, OpenAI, and Mistral — //! Claude uses its own transport (different SSE format). -use wcore::model::{Response, StreamChunk}; use anyhow::Result; use async_stream::try_stream; use futures_core::Stream; @@ -15,6 +14,7 @@ use reqwest::{ header::{self, HeaderMap, HeaderName, HeaderValue}, }; use serde::Serialize; +use wcore::model::{Response, StreamChunk}; /// Shared HTTP transport for OpenAI-compatible providers. /// diff --git a/crates/model/src/local/provider.rs b/crates/model/src/local/provider.rs index a0e255a..88a142b 100644 --- a/crates/model/src/local/provider.rs +++ b/crates/model/src/local/provider.rs @@ -5,11 +5,11 @@ use anyhow::Result; use async_stream::try_stream; use compact_str::CompactString; use futures_core::Stream; +use std::collections::HashMap; use wcore::model::{ Choice, CompletionMeta, Delta, FunctionCall, General, LLM, Message, Response, Role, StreamChunk, ToolCall, Usage, }; -use std::collections::HashMap; impl LLM for Local { type ChatConfig = General; @@ -117,15 +117,19 @@ fn build_request(config: &General, messages: &[Message]) -> mistralrs::RequestBu if let Some(tool_choice) = &config.tool_choice { let mr_choice = match tool_choice { wcore::model::ToolChoice::None => mistralrs::ToolChoice::None, - wcore::model::ToolChoice::Auto | wcore::model::ToolChoice::Required => mistralrs::ToolChoice::Auto, - wcore::model::ToolChoice::Function(name) => mistralrs::ToolChoice::Tool(mistralrs::Tool { - tp: mistralrs::ToolType::Function, - function: mistralrs::Function { - description: None, - name: name.to_string(), - parameters: None, - }, - }), + wcore::model::ToolChoice::Auto | wcore::model::ToolChoice::Required => { + mistralrs::ToolChoice::Auto + } + wcore::model::ToolChoice::Function(name) => { + mistralrs::ToolChoice::Tool(mistralrs::Tool { + tp: mistralrs::ToolType::Function, + function: mistralrs::Function { + description: None, + name: name.to_string(), + parameters: None, + }, + }) + } }; builder = builder.set_tool_choice(mr_choice); } diff --git a/crates/model/src/manager.rs b/crates/model/src/manager.rs index 158edf5..ccd0310 100644 --- a/crates/model/src/manager.rs +++ b/crates/model/src/manager.rs @@ -7,9 +7,9 @@ use async_stream::try_stream; use compact_str::CompactString; use futures_core::Stream; use futures_util::StreamExt; -use wcore::model::{General, LLM, Message, Response, StreamChunk}; use std::collections::BTreeMap; use std::sync::{Arc, RwLock}; +use wcore::model::{General, LLM, Message, Response, StreamChunk}; /// Manages a set of named providers with an active selection. /// diff --git a/crates/model/src/openai/mod.rs b/crates/model/src/openai/mod.rs index e45066f..23bce1a 100644 --- a/crates/model/src/openai/mod.rs +++ b/crates/model/src/openai/mod.rs @@ -3,8 +3,8 @@ //! Covers OpenAI, Grok (xAI), Qwen (Alibaba), Kimi (Moonshot), Ollama, //! and any other service exposing the OpenAI chat completions API. -use reqwest::{Client, header::HeaderMap}; pub use request::Request; +use reqwest::{Client, header::HeaderMap}; mod provider; mod request; diff --git a/crates/model/src/openai/request.rs b/crates/model/src/openai/request.rs index f4c8964..87a75af 100644 --- a/crates/model/src/openai/request.rs +++ b/crates/model/src/openai/request.rs @@ -1,8 +1,8 @@ //! Request body for OpenAI-compatible chat completions API. -use wcore::model::{Config, General, Message, Tool, ToolChoice}; use serde::Serialize; use serde_json::{Value, json}; +use wcore::model::{Config, General, Message, Tool, ToolChoice}; /// The request body for the OpenAI chat completions API. #[derive(Debug, Clone, Serialize)] diff --git a/crates/model/src/provider.rs b/crates/model/src/provider.rs index 1fb641e..4f90d7c 100644 --- a/crates/model/src/provider.rs +++ b/crates/model/src/provider.rs @@ -3,15 +3,15 @@ //! Unified `Provider` enum with enum dispatch over concrete backends. //! `build_provider()` matches on `ProviderKind` detected from the model name. +use crate::claude::Claude; use crate::config::{ProviderConfig, ProviderKind}; +use crate::deepseek::DeepSeek; +use crate::openai::OpenAI; use anyhow::Result; use async_stream::try_stream; -use crate::claude::Claude; -use crate::deepseek::DeepSeek; use futures_core::Stream; use futures_util::StreamExt; use wcore::model::{General, LLM, Message, Response, StreamChunk}; -use crate::openai::OpenAI; /// Unified LLM provider enum. /// @@ -71,8 +71,12 @@ pub async fn build_provider(config: &ProviderConfig, client: reqwest::Client) -> let isq = config.quantization.map(|q| q.to_isq()); let chat_template = config.chat_template.as_deref(); let local = match loader { - Loader::Text => crate::local::Local::from_text(&config.model, isq, chat_template).await?, - Loader::Gguf => crate::local::Local::from_gguf(&config.model, chat_template).await?, + Loader::Text => { + crate::local::Local::from_text(&config.model, isq, chat_template).await? + } + Loader::Gguf => { + crate::local::Local::from_gguf(&config.model, chat_template).await? + } Loader::Vision => { crate::local::Local::from_vision(&config.model, isq, chat_template).await? } diff --git a/crates/model/src/request.rs b/crates/model/src/request.rs index c397fe4..d827343 100644 --- a/crates/model/src/request.rs +++ b/crates/model/src/request.rs @@ -4,9 +4,9 @@ //! use `Option` + `skip_serializing_if` so provider-specific extras (like //! DeepSeek's `thinking`) are simply absent when unused. -use wcore::model::{Config, General, Message, Tool, ToolChoice}; use serde::Serialize; use serde_json::{Value, json}; +use wcore::model::{Config, General, Message, Tool, ToolChoice}; /// OpenAI-compatible chat completions request body. #[derive(Debug, Clone, Serialize)] diff --git a/crates/model/tests/build_provider.rs b/crates/model/tests/build_provider.rs index 7f1ce1b..3d27d0e 100644 --- a/crates/model/tests/build_provider.rs +++ b/crates/model/tests/build_provider.rs @@ -12,7 +12,9 @@ async fn build_deepseek_default() { quantization: None, chat_template: None, }; - let p = build_provider(&config, walrus_model::Client::new()).await.unwrap(); + let p = build_provider(&config, walrus_model::Client::new()) + .await + .unwrap(); assert!(matches!(p, Provider::DeepSeek(_))); } @@ -26,7 +28,9 @@ async fn build_openai_custom_url() { quantization: None, chat_template: None, }; - let p = build_provider(&config, walrus_model::Client::new()).await.unwrap(); + let p = build_provider(&config, walrus_model::Client::new()) + .await + .unwrap(); assert!(matches!(p, Provider::OpenAI(_))); } @@ -40,7 +44,9 @@ async fn build_ollama_base_url_only() { quantization: None, chat_template: None, }; - let p = build_provider(&config, walrus_model::Client::new()).await.unwrap(); + let p = build_provider(&config, walrus_model::Client::new()) + .await + .unwrap(); assert!(matches!(p, Provider::OpenAI(_))); } @@ -54,6 +60,8 @@ async fn build_claude_default() { quantization: None, chat_template: None, }; - let p = build_provider(&config, walrus_model::Client::new()).await.unwrap(); + let p = build_provider(&config, walrus_model::Client::new()) + .await + .unwrap(); assert!(matches!(p, Provider::Claude(_))); } diff --git a/crates/runtime/examples/common/mod.rs b/crates/runtime/examples/common/mod.rs index 63380c9..06f3dc0 100644 --- a/crates/runtime/examples/common/mod.rs +++ b/crates/runtime/examples/common/mod.rs @@ -39,8 +39,7 @@ pub fn load_api_key() -> String { /// Build a default Runtime with DeepSeek provider and InMemory. pub fn build_runtime() -> Runtime { let key = load_api_key(); - let provider = - DeepSeek::new(model::Client::new(), &key).expect("failed to create provider"); + let provider = DeepSeek::new(model::Client::new(), &key).expect("failed to create provider"); Runtime::new(General::default(), provider, InMemory::new()) } diff --git a/crates/runtime/src/lib.rs b/crates/runtime/src/lib.rs index 2a3d438..c4bd49a 100644 --- a/crates/runtime/src/lib.rs +++ b/crates/runtime/src/lib.rs @@ -16,19 +16,19 @@ //! ``` pub use hook::{DEFAULT_COMPACT_PROMPT, DEFAULT_FLUSH_PROMPT, Hook}; -pub use wcore::model::{General, Message, Response, Role, StreamChunk, Tool}; pub use loader::{CronEntry, load_agents_dir, load_cron_dir, parse_agent_md, parse_cron_md}; pub use mcp::McpBridge; pub use skills::{SkillRegistry, parse_skill_md}; pub use team::{build_team, extract_input, worker_tool}; +pub use wcore::model::{General, Message, Response, Role, StreamChunk, Tool}; pub use wcore::{Agent, InMemory, Memory, NoEmbedder, Skill, SkillTier}; use anyhow::Result; use compact_str::CompactString; use futures_core::Stream; use futures_util::StreamExt; -use wcore::model::{Config, FinishReason, LLM, ToolCall, ToolChoice, estimate_tokens}; use std::{collections::BTreeMap, future::Future, pin::Pin, sync::Arc}; +use wcore::model::{Config, FinishReason, LLM, ToolCall, ToolChoice, estimate_tokens}; pub mod hook; pub mod loader; diff --git a/crates/runtime/src/mcp.rs b/crates/runtime/src/mcp.rs index de8b8cc..00eec64 100644 --- a/crates/runtime/src/mcp.rs +++ b/crates/runtime/src/mcp.rs @@ -5,7 +5,6 @@ use anyhow::Result; use compact_str::CompactString; -use wcore::model::Tool; use rmcp::{ ServiceExt, model::{CallToolRequestParams, RawContent}, @@ -14,6 +13,7 @@ use rmcp::{ }; use std::collections::BTreeMap; use tokio::{process::Command, sync::Mutex}; +use wcore::model::Tool; /// A connected MCP server peer with its tool names. struct ConnectedPeer { diff --git a/crates/runtime/src/team.rs b/crates/runtime/src/team.rs index 2325716..3a2206c 100644 --- a/crates/runtime/src/team.rs +++ b/crates/runtime/src/team.rs @@ -20,8 +20,8 @@ use crate::{Handler, Hook, MAX_TOOL_CALLS, SkillRegistry}; use compact_str::CompactString; -use wcore::model::{Config, General, LLM, Message, Tool, ToolChoice}; use std::{collections::BTreeMap, sync::Arc}; +use wcore::model::{Config, General, LLM, Message, Tool, ToolChoice}; use wcore::{Agent, Memory}; /// Build a team: register each worker as a tool and add to the leader. diff --git a/crates/runtime/tests/runtime.rs b/crates/runtime/tests/runtime.rs index 1636373..dc33109 100644 --- a/crates/runtime/tests/runtime.rs +++ b/crates/runtime/tests/runtime.rs @@ -1,9 +1,9 @@ //! Tests for the Runtime orchestrator. use compact_str::CompactString; -use wcore::model::{FunctionCall, General, Message, NoopProvider, Tool, ToolCall}; use std::collections::BTreeMap; use walrus_runtime::{Hook, Runtime, SkillRegistry}; +use wcore::model::{FunctionCall, General, Message, NoopProvider, Tool, ToolCall}; use wcore::{Agent, InMemory, Memory, Skill, SkillTier}; fn echo_tool() -> Tool { diff --git a/crates/runtime/tests/team.rs b/crates/runtime/tests/team.rs index 4837d41..f35a0e0 100644 --- a/crates/runtime/tests/team.rs +++ b/crates/runtime/tests/team.rs @@ -1,7 +1,7 @@ //! Tests for team composition. -use wcore::model::{General, NoopProvider}; use walrus_runtime::{Runtime, build_team, extract_input, worker_tool}; +use wcore::model::{General, NoopProvider}; use wcore::{Agent, InMemory}; #[test]