A high-performance inference engine for AI models
Remove stuff for wasm (#1034)
uuuvn1a98bbb13810
diff --git a/Cargo.lock b/Cargo.lockindex 73a493c89..4477b9acc 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -173,17 +173,6 @@ version = "1.0.104"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"-[[package]]-name = "apple-native-keyring-store"-version = "1.0.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2b350bfd03649e07aa05c0a81b3e15934374e585c98204a57e20b9d49f49bb9a"-dependencies = [- "keyring-core",- "log",- "security-framework",-]-[[package]]name = "approx"version = "0.5.1"@@ -3321,8 +3310,8 @@ dependencies = [name = "hanashi"version = "0.6.13"dependencies = [+ "chrono","indexmap 2.14.2",- "libc","minijinja","minijinja-contrib","openai-harmony",@@ -4286,15 +4275,6 @@ dependencies = ["serde",]-[[package]]-name = "keyring-core"-version = "1.0.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "29fbf4b551298c67925f38cf341a1ada797a75f1837bdf8ae1fc8e2ebc6efb59"-dependencies = [- "log",-]-[[package]]name = "khronos-egl"version = "6.0.0"@@ -10016,13 +9996,11 @@ name = "uzu"version = "0.6.13"dependencies = ["anyhow",- "apple-native-keyring-store","async-openai","backend-remote","bindings","bindings-types","bon",- "confy","dirs","dotenvy","download-manager",@@ -10033,7 +10011,6 @@ dependencies = ["indexmap 2.14.2","indicatif","inventory",- "keyring-core","kiban","mock-registry","nagare",diff --git a/Cargo.toml b/Cargo.tomlindex e78793bb9..7c6d1ec06 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -198,11 +198,6 @@ hound = "3.5.1"ignore = "0.4.33"heck = "0.5.0"confy = "2.0.0"-keyring-core = "1.0.1"-apple-native-keyring-store = { version = "1.0.2", features = [- "keychain",- "protected",-] }toml = "1.1.8"toml_edit = "0.25.17"colored = "3.1.1"diff --git a/crates/legacy/cli/src/interactive/app.rs b/crates/legacy/cli/src/interactive/app.rsindex a96b54cf1..401d5fc3d 100644--- a/crates/legacy/cli/src/interactive/app.rs+++ b/crates/legacy/cli/src/interactive/app.rs@@ -2,10 +2,7 @@ use std::io::IsTerminal;use iocraft::prelude::*;use shoji::types::basic::ReasoningEffort;-use uzu::{- engine::{Engine, EngineConfig, EngineError},- settings::SettingsError,-};+use uzu::engine::{Engine, EngineConfig, EngineError};use crate::interactive::components::Application;@@ -14,8 +11,6 @@ use crate::interactive::components::Application;pub enum CliError {#[error(transparent)]Engine(#[from] EngineError),- #[error(transparent)]- Settigs(#[from] SettingsError),#[error("Rendering error: {message}")]RenderingError {message: String,@@ -52,12 +47,9 @@ impl CliApplication {});}- let settings = self.engine.settings().await.ok();-element! {Application(engine: Some(self.engine.clone()),- settings,model,reasoning_effort,seed,diff --git a/crates/legacy/cli/src/interactive/components/application.rs b/crates/legacy/cli/src/interactive/components/application.rsindex ee704bf19..8906f3422 100644--- a/crates/legacy/cli/src/interactive/components/application.rs+++ b/crates/legacy/cli/src/interactive/components/application.rs@@ -7,7 +7,6 @@ use shoji::types::{};use uzu::{engine::Engine,- settings::Settings,storage::{DownloadPhase, DownloadState},};@@ -16,7 +15,7 @@ use crate::{interactive::{APP_IDENTIFIER,components::{CommandInput, HistoryCell, HistoryCellType, Logo, Preferences, SelectedModel, Theme},- flows::{AuthFlow, ExitFlow, Flow, FlowEvent, FlowRegistry, ModelRegistriesFlow, SettingsFlow, ThemeFlow},+ flows::{ExitFlow, Flow, FlowEvent, FlowRegistry, ModelRegistriesFlow, SettingsFlow, ThemeFlow},helpers::SYMBOL_COMMAND,sessions::{self, SessionState},},@@ -27,7 +26,6 @@ const HISTORY_LIMIT: usize = 20;#[derive(Default, Props)]pub struct ApplicationProps {pub engine: Option<Engine>,- pub settings: Option<Settings>,pub model: Option<String>,pub reasoning_effort: Option<ReasoningEffort>,pub seed: Option<i64>,@@ -52,7 +50,6 @@ pub struct ApplicationState {pub seed: Option<i64>,pub no_tools: bool,pub engine: Engine,- pub settings: Option<Settings>,pub flow: Option<Box<dyn Flow>>,pub history: Vec<HistoryCellType>,pub registry: FlowRegistry,@@ -118,7 +115,6 @@ pub fn Application(let state = hooks.use_state(|| ApplicationState {engine,- settings: props.settings.clone(),preferences: ApplicationState::load_preferences().unwrap_or_else(|error| {tracing::warn!("Unable to load or migrate CLI preferences: {error}");Preferences::default()@@ -132,7 +128,6 @@ pub fn Application(flow: None,history: Vec::new(),registry: FlowRegistry::default()- .register("auth", "Add models from a specific provider", false, || Box::new(AuthFlow)).register("model", "Choose the model", false, || Box::new(ModelRegistriesFlow)).register("settings", "Configure thinking and sampling", true, || Box::new(SettingsFlow)).register("theme", "Choose the theme", false, || Box::new(ThemeFlow))diff --git a/crates/legacy/cli/src/interactive/flows/auth.rs b/crates/legacy/cli/src/interactive/flows/auth.rsdeleted file mode 100644index 2bfc76cf5..000000000--- a/crates/legacy/cli/src/interactive/flows/auth.rs+++ /dev/null@@ -1,78 +0,0 @@-use iocraft::prelude::*;-use uzu::engine::config::{- KEY_ANTHROPIC_API_KEY, KEY_BASETEN_API_KEY, KEY_GEMINI_API_KEY, KEY_HF_TOKEN, KEY_LOCAL_PATH, KEY_MIRAI_API_KEY,- KEY_OPENAI_API_KEY, KEY_OPENROUTER_API_KEY, KEY_XAI_API_KEY,-};--use crate::interactive::{- components::{ApplicationState, Selector, SelectorItem, SelectorStyle},- flows::{- Flow, FlowEvent,- auth_key::{AuthKeyFlow, AuthProvider},- },-};--pub struct AuthFlow;--impl Flow for AuthFlow {- fn render(- &self,- on_event: Handler<FlowEvent>,- ) -> AnyElement<'static> {- element! { AuthProviderFlowView(on_event: on_event) }.into()- }-}--#[derive(Default, Props)]-struct AuthProviderFlowViewProps {- on_event: Handler<FlowEvent>,-}--#[component]-fn AuthProviderFlowView(- props: &mut AuthProviderFlowViewProps,- hooks: Hooks,-) -> impl Into<AnyElement<'static>> {- let on_event = std::mem::take(&mut props.on_event);- let state = *hooks.use_context::<State<ApplicationState>>();-- let providers = auth_providers();- let items: Vec<SelectorItem> = providers- .iter()- .map(|provider| SelectorItem {- title: provider.title.clone(),- description: None,- color: None,- })- .collect();-- element! {- Selector(- items: items,- style: SelectorStyle::WithIcon,- maximal_height: (providers.len() as u16).min(5),- accent_color: state.read().theme().accent_color,- subtitle_color: state.read().theme().subtitle_color,- columns_padding: state.read().theme().padding_wide(),- on_submit: move |index: usize| {- if let Some(provider) = providers.get(index) {- on_event(FlowEvent::transition(provider.title.clone(), Box::new(AuthKeyFlow::new(provider.clone()))));- }- },- )- }-}--fn auth_providers() -> Vec<AuthProvider> {- vec![- AuthProvider::key("Mirai", KEY_MIRAI_API_KEY),- AuthProvider::key("OpenAI", KEY_OPENAI_API_KEY),- AuthProvider::key("Anthropic", KEY_ANTHROPIC_API_KEY),- AuthProvider::key("Google Gemini", KEY_GEMINI_API_KEY),- AuthProvider::key("xAI", KEY_XAI_API_KEY),- AuthProvider::key("Baseten", KEY_BASETEN_API_KEY),- AuthProvider::key("OpenRouter", KEY_OPENROUTER_API_KEY),- AuthProvider::key("HuggingFace", KEY_HF_TOKEN),- AuthProvider::path("Local", KEY_LOCAL_PATH),- ]-}diff --git a/crates/legacy/cli/src/interactive/flows/auth_key.rs b/crates/legacy/cli/src/interactive/flows/auth_key.rsdeleted file mode 100644index 26c4948f8..000000000--- a/crates/legacy/cli/src/interactive/flows/auth_key.rs+++ /dev/null@@ -1,136 +0,0 @@-use iocraft::prelude::*;-use unicode_width::UnicodeWidthStr;-use uzu::settings::SettingKind;--use crate::interactive::{- components::{ApplicationState, InputType, TextInput, TextInputFocus},- flows::{Flow, FlowEvent},- helpers::SYMBOL_INPUT_RESULT,-};--const SAFE_PADDING: u16 = 1;--#[derive(Debug, Clone, PartialEq, Eq)]-pub struct AuthProvider {- pub title: String,- pub key: String,- pub value_title: String,- pub input_type: InputType,- pub setting_kind: SettingKind,-}--impl AuthProvider {- pub fn key(- title: impl Into<String>,- key: impl Into<String>,- ) -> Self {- Self {- title: title.into(),- key: key.into(),- value_title: "API_KEY".to_string(),- input_type: InputType::Secret,- setting_kind: SettingKind::Secret,- }- }-- pub fn path(- title: impl Into<String>,- key: impl Into<String>,- ) -> Self {- Self {- title: title.into(),- key: key.into(),- value_title: "PATH".to_string(),- input_type: InputType::Secret,- setting_kind: SettingKind::Config,- }- }-}--impl Default for AuthProvider {- fn default() -> Self {- Self {- title: String::new(),- key: String::new(),- value_title: String::new(),- input_type: InputType::Text,- setting_kind: SettingKind::Config,- }- }-}--pub struct AuthKeyFlow {- provider: AuthProvider,-}--impl AuthKeyFlow {- pub fn new(provider: AuthProvider) -> Self {- Self {- provider,- }- }-}--impl Flow for AuthKeyFlow {- fn render(- &self,- on_event: Handler<FlowEvent>,- ) -> AnyElement<'static> {- element! { AuthKeyFlowView(provider: self.provider.clone(), on_event: on_event) }.into()- }-}--#[derive(Default, Props)]-struct AuthKeyFlowViewProps {- provider: AuthProvider,- on_event: Handler<FlowEvent>,-}--#[component]-fn AuthKeyFlowView(- props: &mut AuthKeyFlowViewProps,- mut hooks: Hooks,-) -> impl Into<AnyElement<'static>> {- let provider = props.provider.clone();- let on_event = std::mem::take(&mut props.on_event);- let state = *hooks.use_context::<State<ApplicationState>>();- let (width, _) = hooks.use_terminal_size();-- let padding = state.read().theme().padding();- let subtitle_color = state.read().theme().subtitle_color;- let label = format!("{} {}", SYMBOL_INPUT_RESULT, provider.value_title);- let maximal_width = width- .saturating_sub(UnicodeWidthStr::width(label.as_str()) as u16)- .saturating_sub(padding)- .saturating_sub(SAFE_PADDING)- .max(1);-- element! {- View(flex_direction: FlexDirection::Row, width: 100pct, column_gap: padding) {- Text(content: label, color: subtitle_color)- TextInput(- maximal_width: maximal_width,- focus: TextInputFocus::Full,- r#type: provider.input_type,- on_change: move |_text: String| {},- on_submit: move |value: String| {- let value = value.trim().to_string();- if value.is_empty() {- on_event(FlowEvent::finish("Error: value is empty"));- return;- }-- let settings = state.read().settings.clone();- let result = match settings {- Some(settings) => settings- .save(provider.setting_kind.clone(), provider.key.clone(), Some(value))- .map(|()| "Saved, please restart to apply changes".to_string())- .unwrap_or_else(|error| format!("Error: {}", error)),- None => "Error: settings are not available".to_string(),- };- on_event(FlowEvent::finish(result));- },- )- }- }-}diff --git a/crates/legacy/cli/src/interactive/flows/mod.rs b/crates/legacy/cli/src/interactive/flows/mod.rsindex 7a35fcc1f..57269ddea 100644--- a/crates/legacy/cli/src/interactive/flows/mod.rs+++ b/crates/legacy/cli/src/interactive/flows/mod.rs@@ -1,5 +1,3 @@-mod auth;-mod auth_key;mod exit;mod model_families;mod model_registries;@@ -8,7 +6,6 @@ mod registry;mod settings;mod theme;-pub use auth::AuthFlow;pub use exit::ExitFlow;use iocraft::prelude::*;pub use model_families::ModelFamiliesFlow;diff --git a/crates/legacy/cli/src/interactive/mod.rs b/crates/legacy/cli/src/interactive/mod.rsindex c54dd1955..b7cf64b6b 100644--- a/crates/legacy/cli/src/interactive/mod.rs+++ b/crates/legacy/cli/src/interactive/mod.rs@@ -28,14 +28,14 @@ pub async fn run_interactive(seed: Option<i64>,no_tools: bool,) -> anyhow::Result<()> {- let engine_config = EngineConfig::default().with_application_identifier(APP_IDENTIFIER.to_string());+ let engine_config = EngineConfig::default();let application = CliApplication::create(engine_config).await?;application.run_with_model(model, reasoning_effort, seed, no_tools).await?;Ok(())}pub async fn run_list_models() -> anyhow::Result<()> {- let engine_config = EngineConfig::default().with_application_identifier(APP_IDENTIFIER.to_string());+ let engine_config = EngineConfig::default();let engine = Engine::new(engine_config).await?;let models = list_models(&engine).await?;if models.is_empty() {@@ -58,7 +58,7 @@ pub async fn run_list_models() -> anyhow::Result<()> {}pub async fn run_list_checkpoints(model_id: String) -> anyhow::Result<()> {- let engine_config = EngineConfig::default().with_application_identifier(APP_IDENTIFIER.to_string());+ let engine_config = EngineConfig::default();let engine = Engine::new(engine_config).await?;let models = list_models(&engine).await?;let checkpoints = get_checkpoints(&models, &model_id);diff --git a/crates/legacy/cli/src/interactive/non_interactive.rs b/crates/legacy/cli/src/interactive/non_interactive.rsindex db79225fd..ff85d6e85 100644--- a/crates/legacy/cli/src/interactive/non_interactive.rs+++ b/crates/legacy/cli/src/interactive/non_interactive.rs@@ -15,7 +15,6 @@ use uzu::{use crate::{common::thinking::ThinkingSupport,interactive::{- APP_IDENTIFIER,components::{ApplicationState, TranscriptItem, chat_transcript_component},sessions::chat::{build_transcript, create_session},},@@ -28,7 +27,7 @@ pub async fn run_non_interactive(seed: Option<i64>,) -> Result<()> {let preferences = ApplicationState::load_preferences().unwrap_or_default();- let config = EngineConfig::default().with_application_identifier(APP_IDENTIFIER.to_string());+ let config = EngineConfig::default();let engine = Engine::new(config).await?;let model = engine.model(model.clone()).await?.with_context(|| format!("Model not found: {model}"))?;if !model.is_chat_capable() {diff --git a/crates/legacy/cli/src/server/runner.rs b/crates/legacy/cli/src/server/runner.rsindex e58d1ab85..5148fdcf9 100644--- a/crates/legacy/cli/src/server/runner.rs+++ b/crates/legacy/cli/src/server/runner.rs@@ -171,7 +171,7 @@ pub async fn run_server(};log::init(tracing::Level::INFO, file_logger.clone(), tracing::Level::DEBUG)?;- let engine_config = EngineConfig::default().with_application_identifier("com.trymirai.cli".to_string());+ let engine_config = EngineConfig::default();let engine = Engine::new(engine_config).await.context("Failed to create engine")?;let resolved = engine.model(model.clone()).await?.with_context(|| format!("Model not found: {model}"))?;diff --git a/crates/legacy/cli/src/storage/mod.rs b/crates/legacy/cli/src/storage/mod.rsindex c62761ab2..ca53632fc 100644--- a/crates/legacy/cli/src/storage/mod.rs+++ b/crates/legacy/cli/src/storage/mod.rs@@ -56,9 +56,7 @@ impl From<DownloadManagerCliType> for DownloadManagerType {pub(crate) async fn run(download_manager: DownloadManagerCliType) -> Result<()> {dotenvy::dotenv().ok();let runtime = tokio::runtime::Handle::current();- let config = EngineConfig::default()- .with_application_identifier("com.trymirai.cli".to_string())- .with_download_manager_type(download_manager.into());+ let config = EngineConfig::default().with_download_manager_type(download_manager.into());let engine = Arc::new(Engine::new(config).await?);// Setup terminaldiff --git a/crates/legacy/hanashi/Cargo.toml b/crates/legacy/hanashi/Cargo.tomlindex a8f7a1719..1fe44a539 100644--- a/crates/legacy/hanashi/Cargo.toml+++ b/crates/legacy/hanashi/Cargo.toml@@ -19,9 +19,9 @@ thiserror.workspace = trueminijinja.workspace = trueminijinja-contrib.workspace = trueregex.workspace = true-libc.workspace = trueindexmap.workspace = truetracing.workspace = true+chrono.workspace = true[build-dependencies]serde_json.workspace = truediff --git a/crates/legacy/hanashi/src/chat/hanashi/renderer/functions/strftime_now.rs b/crates/legacy/hanashi/src/chat/hanashi/renderer/functions/strftime_now.rsindex 2191e1088..bc1eeb76c 100644--- a/crates/legacy/hanashi/src/chat/hanashi/renderer/functions/strftime_now.rs+++ b/crates/legacy/hanashi/src/chat/hanashi/renderer/functions/strftime_now.rs@@ -1,40 +1,3 @@-use std::{ffi::CString, mem::MaybeUninit};--/// Formats the current local time according to the provided `strftime` patternpub fn strftime_now(format_string: String) -> String {- let Ok(c_format) = CString::new(format_string) else {- return String::new();- };-- unsafe {- let now = libc::time(std::ptr::null_mut());- if now == -1 {- return String::new();- }-- let mut tm = MaybeUninit::<libc::tm>::uninit();- if libc::localtime_r(&now, tm.as_mut_ptr()).is_null() {- return String::new();- }-- let tm = tm.assume_init();- let mut buf_len = 128_usize;-- loop {- let mut buffer = vec![0u8; buf_len];- let written =- libc::strftime(buffer.as_mut_ptr() as *mut libc::c_char, buffer.len(), c_format.as_ptr(), &tm);-- if written > 0 {- buffer.truncate(written as usize);- return String::from_utf8_lossy(&buffer).into_owned();- }-- if buf_len >= 4096 {- return String::new();- }-- buf_len *= 2;- }- }+ chrono::Local::now().format(&format_string).to_string()}diff --git a/crates/legacy/hanashi/src/chat/harmony/bridging/message.rs b/crates/legacy/hanashi/src/chat/harmony/bridging/message.rsindex 12928430a..a6f9644e1 100644--- a/crates/legacy/hanashi/src/chat/harmony/bridging/message.rs+++ b/crates/legacy/hanashi/src/chat/harmony/bridging/message.rs@@ -9,12 +9,9 @@ use shoji::types::{session::chat::{ChatContentBlock, ChatMessage, ChatMessageMetadata, ChatRole},};-use crate::chat::{- harmony::{- CHANNEL_ANALYSIS, CHANNEL_COMMENTARY, CHANNEL_FINAL, CONTENT_TYPE_JSON, ROLE_ASSISTANT,- bridging::{Error, FromHarmony, ToHarmony},- },- strftime_now,+use crate::chat::harmony::{+ CHANNEL_ANALYSIS, CHANNEL_COMMENTARY, CHANNEL_FINAL, CONTENT_TYPE_JSON, ROLE_ASSISTANT,+ bridging::{Error, FromHarmony, ToHarmony},};const FUNCTIONS_NAMESPACE: &str = "functions";@@ -300,7 +297,7 @@ pub fn bridge_messages_to_harmony(fn system_message(mut content: ExternalSystemContent) -> ExternalMessage {// Match the reference template's current-date fallback.if content.conversation_start_date.is_none() {- content.conversation_start_date = Some(strftime_now("%Y-%m-%d".to_string()));+ content.conversation_start_date = Some(chrono::Local::now().date_naive().to_string());}ExternalMessage {author: ExternalAuthor::from(ExternalRole::System),diff --git a/crates/legacy/uzu/Cargo.toml b/crates/legacy/uzu/Cargo.tomlindex af8e18586..9c507827b 100644--- a/crates/legacy/uzu/Cargo.toml+++ b/crates/legacy/uzu/Cargo.toml@@ -111,22 +111,11 @@ uuid.workspace = truefutures-util.workspace = trueasync-openai.workspace = truefancy-regex.workspace = true-confy.workspace = true-keyring-core.workspace = true[target.'cfg(target_vendor = "apple")'.dependencies]objc2.workspace = trueobjc2-foundation.workspace = true-[target.'cfg(target_os = "macos")'.dependencies]-apple-native-keyring-store = { workspace = true, features = [- "protected",- "keychain",-] }--[target.'cfg(all(target_vendor = "apple", not(target_os = "macos")))'.dependencies]-apple-native-keyring-store = { workspace = true, features = ["protected"] }-[dev-dependencies]tempfile.workspace = trueindicatif.workspace = truediff --git a/crates/legacy/uzu/bindings/python/uzu/__init__.pyi b/crates/legacy/uzu/bindings/python/uzu/__init__.pyiindex 02ea555ef..15cab5f0a 100644--- a/crates/legacy/uzu/bindings/python/uzu/__init__.pyi+++ b/crates/legacy/uzu/bindings/python/uzu/__init__.pyi@@ -75,8 +75,6 @@ __all__ = ["SamplingParameters","SamplingPolicy","SamplingSeed",- "SettingKind",- "Settings","TextToSpeechOutput","TextToSpeechSession","TextToSpeechSessionState",@@ -754,7 +752,6 @@ class Engine:def chat_with_instance(self, instance: ChatInstance) -> collections.abc.Awaitable[ChatSession]: ...def classification(self, model: Model) -> collections.abc.Awaitable[ClassificationSession]: ...def text_to_speech(self, model: Model) -> collections.abc.Awaitable[TextToSpeechSession]: ...- def settings(self) -> collections.abc.Awaitable[Settings]: ...def chat_model_info(self, model: Model) -> collections.abc.Awaitable[ChatModelInfo | None]: ...@typing.final@@ -764,8 +761,6 @@ class EngineCallback:@typing.finalclass EngineConfig:- @property- def application_identifier(self) -> typing.Optional[builtins.str]: ...@propertydef mirai_api_key(self) -> typing.Optional[builtins.str]: ...@property@@ -790,10 +785,9 @@ class EngineConfig:def allow_lmstudio_usage(self) -> builtins.bool: ...@propertydef download_manager_type(self) -> DownloadManagerType: ...- def __new__(cls, application_identifier: typing.Optional[builtins.str], mirai_api_key: typing.Optional[builtins.str], local_path: typing.Optional[builtins.str], huggingface_api_key: typing.Optional[builtins.str], openai_api_key: typing.Optional[builtins.str], anthropic_api_key: typing.Optional[builtins.str], gemini_api_key: typing.Optional[builtins.str], xai_api_key: typing.Optional[builtins.str], baseten_api_key: typing.Optional[builtins.str], openrouter_api_key: typing.Optional[builtins.str], allow_ollama_usage: builtins.bool, allow_lmstudio_usage: builtins.bool, download_manager_type: DownloadManagerType) -> EngineConfig: ...+ def __new__(cls, mirai_api_key: typing.Optional[builtins.str], local_path: typing.Optional[builtins.str], huggingface_api_key: typing.Optional[builtins.str], openai_api_key: typing.Optional[builtins.str], anthropic_api_key: typing.Optional[builtins.str], gemini_api_key: typing.Optional[builtins.str], xai_api_key: typing.Optional[builtins.str], baseten_api_key: typing.Optional[builtins.str], openrouter_api_key: typing.Optional[builtins.str], allow_ollama_usage: builtins.bool, allow_lmstudio_usage: builtins.bool, download_manager_type: DownloadManagerType) -> EngineConfig: ...@staticmethoddef create() -> EngineConfig: ...- def with_application_identifier(self, application_identifier: builtins.str) -> EngineConfig: ...def with_mirai_api_key(self, mirai_api_key: builtins.str) -> EngineConfig: ...def with_local_path(self, local_path: builtins.str) -> EngineConfig: ...def with_huggingface_api_key(self, huggingface_api_key: builtins.str) -> EngineConfig: ...@@ -1197,12 +1191,6 @@ class SamplingSeed:...-class Settings:- def save(self, kind: SettingKind, key: builtins.str, value: typing.Optional[builtins.str]) -> None: ...- def load(self, kind: SettingKind, key: builtins.str) -> typing.Optional[builtins.str]: ...- def clear(self) -> None: ...-@typing.finalclass TextToSpeechOutput:@property@@ -1425,11 +1413,6 @@ class ReasoningEffort(enum.Enum):High = ...XHigh = ...-class SettingKind(enum.Enum):- Config = ...- Secret = ...-@typing.finalclass TextToSpeechSessionState(enum.Enum):Idle = ...diff --git a/crates/legacy/uzu/bindings/swift/Sources/Uzu/Generated/uzu/uzu.swift b/crates/legacy/uzu/bindings/swift/Sources/Uzu/Generated/uzu/uzu.swiftindex d2faad574..842eaa6b7 100644--- a/crates/legacy/uzu/bindings/swift/Sources/Uzu/Generated/uzu/uzu.swift+++ b/crates/legacy/uzu/bindings/swift/Sources/Uzu/Generated/uzu/uzu.swift@@ -918,8 +918,6 @@ public protocol EngineProtocol: AnyObject, Sendable {func removeRegistry(registryIdentifier: String) async throws- func settings() async throws -> Settings-func textToSpeech(model: Model) async throws -> TextToSpeechSession/**@@ -1510,23 +1508,6 @@ open func removeRegistry(registryIdentifier: String)async throws {)}-open func settings()async throws -> Settings {- return- try await uniffiRustCallAsync(- rustFutureFunc: {- uniffi_uzu_fn_method_engine_settings(- self.uniffiCloneHandle()-- )- },- pollFunc: ffi_uzu_rust_future_poll_u64,- completeFunc: ffi_uzu_rust_future_complete_u64,- freeFunc: ffi_uzu_rust_future_free_u64,- liftFunc: FfiConverterTypeSettings_lift,- errorHandler: FfiConverterTypeEngineError_lift- )-}-open func textToSpeech(model: Model)async throws -> TextToSpeechSession {returntry await uniffiRustCallAsync(@@ -1853,145 +1834,6 @@ public func FfiConverterTypePlayer_lower(_ value: Player) -> UInt64 {---public protocol SettingsProtocol: AnyObject, Sendable {-- func clear() throws-- func load(kind: SettingKind, key: String) throws -> String?-- func save(kind: SettingKind, key: String, value: String?) throws--}-open class Settings: SettingsProtocol, @unchecked Sendable {- fileprivate let handle: UInt64-- /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly.-#if swift(>=5.8)- @_documentation(visibility: private)-#endif- public struct NoHandle {- public init() {}- }-- // TODO: We'd like this to be `private` but for Swifty reasons,- // we can't implement `FfiConverter` without making this `required` and we can't- // make it `required` without making it `public`.-#if swift(>=5.8)- @_documentation(visibility: private)-#endif- required public init(unsafeFromHandle handle: UInt64) {- self.handle = handle- }-- // This constructor can be used to instantiate a fake object.- // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].- //- // - Warning:- // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash.-#if swift(>=5.8)- @_documentation(visibility: private)-#endif- public init(noHandle: NoHandle) {- self.handle = 0- }--#if swift(>=5.8)- @_documentation(visibility: private)-#endif- public func uniffiCloneHandle() -> UInt64 {- return try! rustCall { uniffi_uzu_fn_clone_settings(self.handle, $0) }- }- // No primary constructor declared for this class.-- deinit {- if handle == 0 {- // Mock objects have handle=0 don't try to free them- return- }-- try! rustCall { uniffi_uzu_fn_free_settings(handle, $0) }- }-----open func clear()throws {try rustCallWithError(FfiConverterTypeSettingsError_lift) {- uniffi_uzu_fn_method_settings_clear(- self.uniffiCloneHandle(),$0- )-}-}--open func load(kind: SettingKind, key: String)throws -> String? {- return try FfiConverterOptionString.lift(try rustCallWithError(FfiConverterTypeSettingsError_lift) {- uniffi_uzu_fn_method_settings_load(- self.uniffiCloneHandle(),- FfiConverterTypeSettingKind_lower(kind),- FfiConverterString.lower(key),$0- )-})-}--open func save(kind: SettingKind, key: String, value: String?)throws {try rustCallWithError(FfiConverterTypeSettingsError_lift) {- uniffi_uzu_fn_method_settings_save(- self.uniffiCloneHandle(),- FfiConverterTypeSettingKind_lower(kind),- FfiConverterString.lower(key),- FfiConverterOptionString.lower(value),$0- )-}-}----}---#if swift(>=5.8)-@_documentation(visibility: private)-#endif-public struct FfiConverterTypeSettings: FfiConverter {- typealias FfiType = UInt64- typealias SwiftType = Settings-- public static func lift(_ handle: UInt64) throws -> Settings {- return Settings(unsafeFromHandle: handle)- }-- public static func lower(_ value: Settings) -> UInt64 {- return value.uniffiCloneHandle()- }-- public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Settings {- let handle: UInt64 = try readInt(&buf)- return try lift(handle)- }-- public static func write(_ value: Settings, into buf: inout [UInt8]) {- writeInt(&buf, lower(value))- }-}---#if swift(>=5.8)-@_documentation(visibility: private)-#endif-public func FfiConverterTypeSettings_lift(_ handle: UInt64) throws -> Settings {- return try FfiConverterTypeSettings.lift(handle)-}--#if swift(>=5.8)-@_documentation(visibility: private)-#endif-public func FfiConverterTypeSettings_lower(_ value: Settings) -> UInt64 {- return FfiConverterTypeSettings.lower(value)-}----/*** Chat metadata available without loading model weights or allocating a session.*/@@ -2122,7 +1964,6 @@ public func FfiConverterTypeDevice_lower(_ value: Device) -> RustBuffer {public struct EngineConfig: Equatable, Hashable, Codable {- public var applicationIdentifier: String?public var miraiApiKey: String?public var localPath: String?public var huggingfaceApiKey: String?@@ -2138,8 +1979,7 @@ public struct EngineConfig: Equatable, Hashable, Codable {// Default memberwise initializers are never public by default, so we// declare one manually.- public init(applicationIdentifier: String?, miraiApiKey: String?, localPath: String?, huggingfaceApiKey: String?, openaiApiKey: String?, anthropicApiKey: String?, geminiApiKey: String?, xaiApiKey: String?, basetenApiKey: String?, openrouterApiKey: String?, allowOllamaUsage: Bool, allowLmstudioUsage: Bool, downloadManagerType: DownloadManagerType) {- self.applicationIdentifier = applicationIdentifier+ public init(miraiApiKey: String?, localPath: String?, huggingfaceApiKey: String?, openaiApiKey: String?, anthropicApiKey: String?, geminiApiKey: String?, xaiApiKey: String?, basetenApiKey: String?, openrouterApiKey: String?, allowOllamaUsage: Bool, allowLmstudioUsage: Bool, downloadManagerType: DownloadManagerType) {self.miraiApiKey = miraiApiKeyself.localPath = localPathself.huggingfaceApiKey = huggingfaceApiKey@@ -2182,15 +2022,6 @@ public func withAnthropicApiKey(anthropicApiKey: String) -> EngineConfig {})}-public func withApplicationIdentifier(applicationIdentifier: String) -> EngineConfig {- return try! FfiConverterTypeEngineConfig_lift(try! rustCall() {- uniffi_uzu_fn_method_engineconfig_with_application_identifier(- FfiConverterTypeEngineConfig_lower(self),- FfiConverterString.lower(applicationIdentifier),$0- )-})-}-public func withBasetenApiKey(basetenApiKey: String) -> EngineConfig {return try! FfiConverterTypeEngineConfig_lift(try! rustCall() {uniffi_uzu_fn_method_engineconfig_with_baseten_api_key(@@ -2287,7 +2118,6 @@ public struct FfiConverterTypeEngineConfig: FfiConverterRustBuffer {public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EngineConfig {returntry EngineConfig(- applicationIdentifier: FfiConverterOptionString.read(from: &buf),miraiApiKey: FfiConverterOptionString.read(from: &buf),localPath: FfiConverterOptionString.read(from: &buf),huggingfaceApiKey: FfiConverterOptionString.read(from: &buf),@@ -2304,7 +2134,6 @@ public struct FfiConverterTypeEngineConfig: FfiConverterRustBuffer {}public static func write(_ value: EngineConfig, into buf: inout [UInt8]) {- FfiConverterOptionString.write(value.applicationIdentifier, into: &buf)FfiConverterOptionString.write(value.miraiApiKey, into: &buf)FfiConverterOptionString.write(value.localPath, into: &buf)FfiConverterOptionString.write(value.huggingfaceApiKey, into: &buf)@@ -2414,8 +2243,6 @@ public enum EngineError: Swift.Error, Equatable, Hashable, Codable, Foundation.L)case Device(DeviceError)- case Settings(SettingsError- )case Storage(StorageError)case Registry(RegistryError@@ -2428,7 +2255,6 @@ public enum EngineError: Swift.Error, Equatable, Hashable, Codable, Foundation.L)case TextToSpeechSession(TextToSpeechSessionError)- case SettingsNotAvailablecase ModelConfig(message: String)@@ -2466,28 +2292,24 @@ public struct FfiConverterTypeEngineError: FfiConverterRustBuffer {case 2: return .Device(try FfiConverterTypeDeviceError.read(from: &buf))- case 3: return .Settings(- try FfiConverterTypeSettingsError.read(from: &buf)- )- case 4: return .Storage(+ case 3: return .Storage(try FfiConverterTypeStorageError.read(from: &buf))- case 5: return .Registry(+ case 4: return .Registry(try FfiConverterTypeRegistryError.read(from: &buf))- case 6: return .UnableToCreateBackend- case 7: return .BackendNotFound- case 8: return .ChatSession(+ case 5: return .UnableToCreateBackend+ case 6: return .BackendNotFound+ case 7: return .ChatSession(try FfiConverterTypeChatSessionError.read(from: &buf))- case 9: return .ClassificationSession(+ case 8: return .ClassificationSession(try FfiConverterTypeClassificationSessionError.read(from: &buf))- case 10: return .TextToSpeechSession(+ case 9: return .TextToSpeechSession(try FfiConverterTypeTextToSpeechSessionError.read(from: &buf))- case 11: return .SettingsNotAvailable- case 12: return .ModelConfig(+ case 10: return .ModelConfig(message: try FfiConverterString.read(from: &buf))@@ -2512,50 +2334,41 @@ public struct FfiConverterTypeEngineError: FfiConverterRustBuffer {FfiConverterTypeDeviceError.write(v1, into: &buf)- case let .Settings(v1):- writeInt(&buf, Int32(3))- FfiConverterTypeSettingsError.write(v1, into: &buf)--case let .Storage(v1):- writeInt(&buf, Int32(4))+ writeInt(&buf, Int32(3))FfiConverterTypeStorageError.write(v1, into: &buf)case let .Registry(v1):- writeInt(&buf, Int32(5))+ writeInt(&buf, Int32(4))FfiConverterTypeRegistryError.write(v1, into: &buf)case .UnableToCreateBackend:- writeInt(&buf, Int32(6))+ writeInt(&buf, Int32(5))case .BackendNotFound:- writeInt(&buf, Int32(7))+ writeInt(&buf, Int32(6))case let .ChatSession(v1):- writeInt(&buf, Int32(8))+ writeInt(&buf, Int32(7))FfiConverterTypeChatSessionError.write(v1, into: &buf)case let .ClassificationSession(v1):- writeInt(&buf, Int32(9))+ writeInt(&buf, Int32(8))FfiConverterTypeClassificationSessionError.write(v1, into: &buf)case let .TextToSpeechSession(v1):- writeInt(&buf, Int32(10))+ writeInt(&buf, Int32(9))FfiConverterTypeTextToSpeechSessionError.write(v1, into: &buf)- case .SettingsNotAvailable:- writeInt(&buf, Int32(11))--case let .ModelConfig(message):- writeInt(&buf, Int32(12))+ writeInt(&buf, Int32(10))FfiConverterString.write(message, into: &buf)}@@ -2755,147 +2568,6 @@ public func FfiConverterTypeRegistryError_lower(_ value: RegistryError) -> RustBreturn FfiConverterTypeRegistryError.lower(value)}-// Note that we don't yet support `indirect` for enums.-// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.--public enum SettingKind: Equatable, Hashable, Codable {-- case config- case secret------}--#if compiler(>=6)-extension SettingKind: Sendable {}-#endif--#if swift(>=5.8)-@_documentation(visibility: private)-#endif-public struct FfiConverterTypeSettingKind: FfiConverterRustBuffer {- typealias SwiftType = SettingKind-- public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SettingKind {- let variant: Int32 = try readInt(&buf)- switch variant {-- case 1: return .config-- case 2: return .secret-- default: throw UniffiInternalError.unexpectedEnumCase- }- }-- public static func write(_ value: SettingKind, into buf: inout [UInt8]) {- switch value {--- case .config:- writeInt(&buf, Int32(1))--- case .secret:- writeInt(&buf, Int32(2))-- }- }-}---#if swift(>=5.8)-@_documentation(visibility: private)-#endif-public func FfiConverterTypeSettingKind_lift(_ buf: RustBuffer) throws -> SettingKind {- return try FfiConverterTypeSettingKind.lift(buf)-}--#if swift(>=5.8)-@_documentation(visibility: private)-#endif-public func FfiConverterTypeSettingKind_lower(_ value: SettingKind) -> RustBuffer {- return FfiConverterTypeSettingKind.lower(value)-}----public enum SettingsError: Swift.Error, Equatable, Hashable, Codable, Foundation.LocalizedError {---- case BackendError(message: String- )------- public var errorDescription: String? {- String(reflecting: self)- }--}--#if compiler(>=6)-extension SettingsError: Sendable {}-#endif--#if swift(>=5.8)-@_documentation(visibility: private)-#endif-public struct FfiConverterTypeSettingsError: FfiConverterRustBuffer {- typealias SwiftType = SettingsError-- public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SettingsError {- let variant: Int32 = try readInt(&buf)- switch variant {----- case 1: return .BackendError(- message: try FfiConverterString.read(from: &buf)- )-- default: throw UniffiInternalError.unexpectedEnumCase- }- }-- public static func write(_ value: SettingsError, into buf: inout [UInt8]) {- switch value {------ case let .BackendError(message):- writeInt(&buf, Int32(1))- FfiConverterString.write(message, into: &buf)-- }- }-}---#if swift(>=5.8)-@_documentation(visibility: private)-#endif-public func FfiConverterTypeSettingsError_lift(_ buf: RustBuffer) throws -> SettingsError {- return try FfiConverterTypeSettingsError.lift(buf)-}--#if swift(>=5.8)-@_documentation(visibility: private)-#endif-public func FfiConverterTypeSettingsError_lower(_ value: SettingsError) -> RustBuffer {- return FfiConverterTypeSettingsError.lower(value)-}-public enum StorageError: Swift.Error, Equatable, Hashable, Codable, Foundation.LocalizedError {@@ -3613,9 +3285,6 @@ private let initializationResult: InitializationResult = {if (uniffi_uzu_checksum_method_engine_remove_registry() != 48480) {return InitializationResult.apiChecksumMismatch}- if (uniffi_uzu_checksum_method_engine_settings() != 6450) {- return InitializationResult.apiChecksumMismatch- }if (uniffi_uzu_checksum_method_engine_text_to_speech() != 62782) {return InitializationResult.apiChecksumMismatch}@@ -3646,15 +3315,6 @@ private let initializationResult: InitializationResult = {if (uniffi_uzu_checksum_method_player_stop() != 11919) {return InitializationResult.apiChecksumMismatch}- if (uniffi_uzu_checksum_method_settings_clear() != 28707) {- return InitializationResult.apiChecksumMismatch- }- if (uniffi_uzu_checksum_method_settings_load() != 8520) {- return InitializationResult.apiChecksumMismatch- }- if (uniffi_uzu_checksum_method_settings_save() != 30707) {- return InitializationResult.apiChecksumMismatch- }if (uniffi_uzu_checksum_constructor_enginecallback_create() != 1654) {return InitializationResult.apiChecksumMismatch}diff --git a/crates/legacy/uzu/bindings/typescript/src/napi/index.d.mts b/crates/legacy/uzu/bindings/typescript/src/napi/index.d.mtsindex b615554b0..6e56c8ab8 100644--- a/crates/legacy/uzu/bindings/typescript/src/napi/index.d.mts+++ b/crates/legacy/uzu/bindings/typescript/src/napi/index.d.mts@@ -992,7 +992,6 @@ export declare class Engine {chatWithInstance(instance: ChatInstance): Promise<ChatSession>classification(model: Model): Promise<ClassificationSession>textToSpeech(model: Model): Promise<TextToSpeechSession>- settings(): Promise<Settings>}export declare class EngineCallback {@@ -1000,7 +999,6 @@ export declare class EngineCallback {}export declare class EngineConfig {- applicationIdentifier?: stringmiraiApiKey?: stringlocalPath?: stringhuggingfaceApiKey?: string@@ -1013,10 +1011,9 @@ export declare class EngineConfig {allowOllamaUsage: booleanallowLmstudioUsage: booleandownloadManagerType: DownloadManagerType- constructor(applicationIdentifier?: string, miraiApiKey?: string, localPath?: string, huggingfaceApiKey?: string, openaiApiKey?: string, anthropicApiKey?: string, geminiApiKey?: string, xaiApiKey?: string, basetenApiKey?: string, openrouterApiKey?: string, allowOllamaUsage: boolean, allowLmstudioUsage: boolean, downloadManagerType: DownloadManagerType)+ constructor(miraiApiKey?: string, localPath?: string, huggingfaceApiKey?: string, openaiApiKey?: string, anthropicApiKey?: string, geminiApiKey?: string, xaiApiKey?: string, basetenApiKey?: string, openrouterApiKey?: string, allowOllamaUsage: boolean, allowLmstudioUsage: boolean, downloadManagerType: DownloadManagerType)static create(): EngineConfig- withApplicationIdentifier(applicationIdentifier: string): EngineConfigwithMiraiApiKey(miraiApiKey: string): EngineConfigwithLocalPath(localPath: string): EngineConfigwithHuggingfaceApiKey(huggingfaceApiKey: string): EngineConfig@@ -1037,19 +1034,12 @@ export declare class Player {static create(): Promise<Player>}-export declare class Settings {- save(kind: SettingKind, key: string, value?: string | undefined | null): void- load(kind: SettingKind, key: string): string | null- clear(): void-}-export type DeviceError =| { type: 'UnsupportedDevice' }export type EngineError =| { type: 'TokioError'; message: string }| { type: 'Device'; field0: DeviceError }- | { type: 'Settings'; field0: SettingsError }| { type: 'Storage'; field0: StorageError }| { type: 'Registry'; field0: RegistryError }| { type: 'UnableToCreateBackend' }@@ -1057,7 +1047,6 @@ export type EngineError =| { type: 'ChatSession'; field0: ChatSessionError }| { type: 'ClassificationSession'; field0: ClassificationSessionError }| { type: 'TextToSpeechSession'; field0: TextToSpeechSessionError }- | { type: 'SettingsNotAvailable' }| { type: 'ModelConfig'; message: string }export type PlayerError =@@ -1069,14 +1058,6 @@ export type RegistryError =| { type: 'UnableToGetModels'; message: string }| { type: 'UnableToAddRegistry'; identifier: string }-export declare const enum SettingKind {- Config = 'Config',- Secret = 'Secret'-}--export type SettingsError =- | { type: 'BackendError'; message: string }-export type StorageError =| { type: 'UnableToCreateDirectory'; path: string }| { type: 'DownloadManager'; message: string }diff --git a/crates/legacy/uzu/bindings/typescript/src/napi/index.d.ts b/crates/legacy/uzu/bindings/typescript/src/napi/index.d.tsindex b615554b0..6e56c8ab8 100644--- a/crates/legacy/uzu/bindings/typescript/src/napi/index.d.ts+++ b/crates/legacy/uzu/bindings/typescript/src/napi/index.d.ts@@ -992,7 +992,6 @@ export declare class Engine {chatWithInstance(instance: ChatInstance): Promise<ChatSession>classification(model: Model): Promise<ClassificationSession>textToSpeech(model: Model): Promise<TextToSpeechSession>- settings(): Promise<Settings>}export declare class EngineCallback {@@ -1000,7 +999,6 @@ export declare class EngineCallback {}export declare class EngineConfig {- applicationIdentifier?: stringmiraiApiKey?: stringlocalPath?: stringhuggingfaceApiKey?: string@@ -1013,10 +1011,9 @@ export declare class EngineConfig {allowOllamaUsage: booleanallowLmstudioUsage: booleandownloadManagerType: DownloadManagerType- constructor(applicationIdentifier?: string, miraiApiKey?: string, localPath?: string, huggingfaceApiKey?: string, openaiApiKey?: string, anthropicApiKey?: string, geminiApiKey?: string, xaiApiKey?: string, basetenApiKey?: string, openrouterApiKey?: string, allowOllamaUsage: boolean, allowLmstudioUsage: boolean, downloadManagerType: DownloadManagerType)+ constructor(miraiApiKey?: string, localPath?: string, huggingfaceApiKey?: string, openaiApiKey?: string, anthropicApiKey?: string, geminiApiKey?: string, xaiApiKey?: string, basetenApiKey?: string, openrouterApiKey?: string, allowOllamaUsage: boolean, allowLmstudioUsage: boolean, downloadManagerType: DownloadManagerType)static create(): EngineConfig- withApplicationIdentifier(applicationIdentifier: string): EngineConfigwithMiraiApiKey(miraiApiKey: string): EngineConfigwithLocalPath(localPath: string): EngineConfigwithHuggingfaceApiKey(huggingfaceApiKey: string): EngineConfig@@ -1037,19 +1034,12 @@ export declare class Player {static create(): Promise<Player>}-export declare class Settings {- save(kind: SettingKind, key: string, value?: string | undefined | null): void- load(kind: SettingKind, key: string): string | null- clear(): void-}-export type DeviceError =| { type: 'UnsupportedDevice' }export type EngineError =| { type: 'TokioError'; message: string }| { type: 'Device'; field0: DeviceError }- | { type: 'Settings'; field0: SettingsError }| { type: 'Storage'; field0: StorageError }| { type: 'Registry'; field0: RegistryError }| { type: 'UnableToCreateBackend' }@@ -1057,7 +1047,6 @@ export type EngineError =| { type: 'ChatSession'; field0: ChatSessionError }| { type: 'ClassificationSession'; field0: ClassificationSessionError }| { type: 'TextToSpeechSession'; field0: TextToSpeechSessionError }- | { type: 'SettingsNotAvailable' }| { type: 'ModelConfig'; message: string }export type PlayerError =@@ -1069,14 +1058,6 @@ export type RegistryError =| { type: 'UnableToGetModels'; message: string }| { type: 'UnableToAddRegistry'; identifier: string }-export declare const enum SettingKind {- Config = 'Config',- Secret = 'Secret'-}--export type SettingsError =- | { type: 'BackendError'; message: string }-export type StorageError =| { type: 'UnableToCreateDirectory'; path: string }| { type: 'DownloadManager'; message: string }diff --git a/crates/legacy/uzu/bindings/typescript/src/napi/index.js b/crates/legacy/uzu/bindings/typescript/src/napi/index.jsindex f4f8fda31..6fedd1e2f 100644--- a/crates/legacy/uzu/bindings/typescript/src/napi/index.js+++ b/crates/legacy/uzu/bindings/typescript/src/napi/index.js@@ -635,5 +635,3 @@ module.exports.Engine = nativeBinding.Enginemodule.exports.EngineCallback = nativeBinding.EngineCallbackmodule.exports.EngineConfig = nativeBinding.EngineConfigmodule.exports.Player = nativeBinding.Player-module.exports.Settings = nativeBinding.Settings-module.exports.SettingKind = nativeBinding.SettingKinddiff --git a/crates/legacy/uzu/bindings/typescript/src/napi/index.mjs b/crates/legacy/uzu/bindings/typescript/src/napi/index.mjsindex 2a451d989..3ec14dd00 100644--- a/crates/legacy/uzu/bindings/typescript/src/napi/index.mjs+++ b/crates/legacy/uzu/bindings/typescript/src/napi/index.mjs@@ -132,5 +132,3 @@ export const Engine = cjs.Engine;export const EngineCallback = cjs.EngineCallback;export const EngineConfig = cjs.EngineConfig;export const Player = cjs.Player;-export const Settings = cjs.Settings;-export const SettingKind = cjs.SettingKind;diff --git a/crates/legacy/uzu/src/engine/catalog_tests.rs b/crates/legacy/uzu/src/engine/catalog_tests.rsindex e14ffa41f..779a536a1 100644--- a/crates/legacy/uzu/src/engine/catalog_tests.rs+++ b/crates/legacy/uzu/src/engine/catalog_tests.rs@@ -99,7 +99,6 @@ async fn engine() -> (Engine, TempDir) {let storage = Arc::new(Storage::new(RuntimeHandle::current(), config).await.unwrap());(Engine {- settings: SharedAccess::new(None),registry: SharedAccess::new(MergedRegistry::new(vec![])),storage,backends: SharedAccess::new(HashMap::new()),diff --git a/crates/legacy/uzu/src/engine/config.rs b/crates/legacy/uzu/src/engine/config.rsindex c4fbc1e5b..04da3a728 100644--- a/crates/legacy/uzu/src/engine/config.rs+++ b/crates/legacy/uzu/src/engine/config.rs@@ -2,10 +2,7 @@ use std::env;use serde::{Deserialize, Serialize};-use crate::{- settings::{SettingKind, Settings, SettingsError},- storage::DownloadManagerType,-};+use crate::storage::DownloadManagerType;pub const KEY_MIRAI_API_KEY: &str = "MIRAI_API_KEY";pub const KEY_LOCAL_PATH: &str = "LOCAL_PATH";@@ -21,7 +18,6 @@ pub const KEY_OPENROUTER_API_KEY: &str = "OPENROUTER_API_KEY";#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]#[serde(rename_all = "snake_case")]pub struct EngineConfig {- pub application_identifier: Option<String>,pub mirai_api_key: Option<String>,pub local_path: Option<String>,pub huggingface_api_key: Option<String>,@@ -40,7 +36,6 @@ pub struct EngineConfig {impl Default for EngineConfig {fn default() -> Self {Self {- application_identifier: None,mirai_api_key: env::var(KEY_MIRAI_API_KEY).ok(),local_path: env::var(KEY_LOCAL_PATH).ok(),huggingface_api_key: env::var(KEY_HF_TOKEN).ok(),@@ -50,40 +45,13 @@ impl Default for EngineConfig {xai_api_key: env::var(KEY_XAI_API_KEY).ok(),baseten_api_key: env::var(KEY_BASETEN_API_KEY).ok(),openrouter_api_key: env::var(KEY_OPENROUTER_API_KEY).ok(),- allow_ollama_usage: true,- allow_lmstudio_usage: true,+ allow_ollama_usage: false,+ allow_lmstudio_usage: false,download_manager_type: DownloadManagerType::default(),}}}-impl EngineConfig {- pub fn synchronize_with_settings(- &mut self,- settings: &Settings,- ) -> Result<(), SettingsError> {- macro_rules! synchronize_field {- ($setting_kind:path, $field:ident, $key:expr) => {- if let Some(value) = settings.load($setting_kind, $key)? {- self.$field = Some(value);- }- };- }-- synchronize_field!(SettingKind::Secret, mirai_api_key, KEY_MIRAI_API_KEY.to_string());- synchronize_field!(SettingKind::Config, local_path, KEY_LOCAL_PATH.to_string());- synchronize_field!(SettingKind::Secret, huggingface_api_key, KEY_HF_TOKEN.to_string());- synchronize_field!(SettingKind::Secret, openai_api_key, KEY_OPENAI_API_KEY.to_string());- synchronize_field!(SettingKind::Secret, anthropic_api_key, KEY_ANTHROPIC_API_KEY.to_string());- synchronize_field!(SettingKind::Secret, gemini_api_key, KEY_GEMINI_API_KEY.to_string());- synchronize_field!(SettingKind::Secret, xai_api_key, KEY_XAI_API_KEY.to_string());- synchronize_field!(SettingKind::Secret, baseten_api_key, KEY_BASETEN_API_KEY.to_string());- synchronize_field!(SettingKind::Secret, openrouter_api_key, KEY_OPENROUTER_API_KEY.to_string());-- Ok(())- }-}-#[bindings::export(Implementation)]impl EngineConfig {#[bindings::export(Method(Factory))]@@ -94,17 +62,6 @@ impl EngineConfig {#[bindings::export(Implementation)]impl EngineConfig {- #[bindings::export(Method)]- pub fn with_application_identifier(- &self,- application_identifier: String,- ) -> Self {- Self {- application_identifier: Some(application_identifier),- ..self.clone()- }- }-#[bindings::export(Method)]pub fn with_mirai_api_key(&self,diff --git a/crates/legacy/uzu/src/engine/error.rs b/crates/legacy/uzu/src/engine/error.rsindex 453038811..175ed4dae 100644--- a/crates/legacy/uzu/src/engine/error.rs+++ b/crates/legacy/uzu/src/engine/error.rs@@ -9,8 +9,6 @@ pub enum EngineError {#[error(transparent)]Device(#[from] crate::device::DeviceError),#[error(transparent)]- Settings(#[from] crate::settings::SettingsError),- #[error(transparent)]Storage(#[from] crate::storage::StorageError),#[error(transparent)]Registry(#[from] crate::registry::RegistryError),@@ -24,8 +22,6 @@ pub enum EngineError {ClassificationSession(#[from] nagare::classification::ClassificationSessionError),#[error(transparent)]TextToSpeechSession(#[from] nagare::text_to_speech::TextToSpeechSessionError),- #[error("Settings not available")]- SettingsNotAvailable,#[error("Unable to read model configuration: {message}")]ModelConfig {message: String,diff --git a/crates/legacy/uzu/src/engine/mod.rs b/crates/legacy/uzu/src/engine/mod.rsindex a4ac34d75..492d4239d 100644--- a/crates/legacy/uzu/src/engine/mod.rs+++ b/crates/legacy/uzu/src/engine/mod.rs@@ -48,7 +48,7 @@ use tokio_stream::{StreamExt, wrappers::BroadcastStream};use crate::{device::Device,engine::bridge::UzuLlmBackend,- helpers::{SharedAccess, is_endpoint_reachable},+ helpers::SharedAccess,logs,registry::{CachedRegistry, MergedRegistry, RegistryError,@@ -57,14 +57,12 @@ use crate::{openai::{Config as OpenAIConfig, Registry as OpenAIRegistry},unique_model,},- settings::Settings,storage::{BearerToken, Config as StorageConfig, DownloadPhase, DownloadState, Storage},};#[bindings::export(Class)]#[derive(Clone)]pub struct Engine {- settings: SharedAccess<Option<Settings>>,registry: SharedAccess<MergedRegistry>,storage: Arc<Storage>,backends: SharedAccess<HashMap<String, Arc<dyn Backend>>>,@@ -81,16 +79,6 @@ impl Engine {message: error.to_string(),})?;- let settings = if let Some(application_identifier) = &config.application_identifier {- Some(Settings::new(application_identifier.clone())?)- } else {- None- };- let mut config = config;- if let Some(settings) = &settings {- config.synchronize_with_settings(settings)?;- }-let device = Device::new()?;let registry = SharedAccess::new(MergedRegistry::new(vec![]));@@ -108,7 +96,6 @@ impl Engine {let storage = Arc::new(Storage::new(runtime_handle, storage_config).await?);let engine = Self {- settings: SharedAccess::new(settings),storage,registry,backends: SharedAccess::new(HashMap::new()),@@ -154,16 +141,10 @@ impl Engine {let mut openai_configs: Vec<OpenAIConfig> = vec![];if config.allow_ollama_usage {- let ollama_config = OpenAIConfig::ollama();- if is_endpoint_reachable(&ollama_config.api_endpoint).await {- openai_configs.push(ollama_config);- }+ openai_configs.push(OpenAIConfig::ollama());}if config.allow_lmstudio_usage {- let lmstudio_config = OpenAIConfig::lmstudio();- if is_endpoint_reachable(&lmstudio_config.api_endpoint).await {- openai_configs.push(lmstudio_config);- }+ openai_configs.push(OpenAIConfig::lmstudio());}if let Some(openai_api_key) = config.openai_api_key {openai_configs.push(OpenAIConfig::openai(openai_api_key));@@ -693,14 +674,6 @@ impl Engine {}}-#[bindings::export(Implementation)]-impl Engine {- #[bindings::export(Method)]- pub async fn settings(&self) -> Result<Settings, EngineError> {- self.settings.lock().await.clone().ok_or(EngineError::SettingsNotAvailable)- }-}-impl Engine {pub fn storage_subscribe(&self) -> BroadcastStream<(ModelIdentifier, DownloadState)> {self.storage.subscribe()diff --git a/crates/legacy/uzu/src/helpers/mod.rs b/crates/legacy/uzu/src/helpers/mod.rsindex 9c2f42905..3d68e40bb 100644--- a/crates/legacy/uzu/src/helpers/mod.rs+++ b/crates/legacy/uzu/src/helpers/mod.rs@@ -1,7 +1,5 @@-mod reachability;mod same_origin;mod shared_access;-pub use reachability::is_endpoint_reachable;pub use same_origin::same_origin;pub use shared_access::SharedAccess;diff --git a/crates/legacy/uzu/src/helpers/reachability.rs b/crates/legacy/uzu/src/helpers/reachability.rsdeleted file mode 100644index 6297cbedb..000000000--- a/crates/legacy/uzu/src/helpers/reachability.rs+++ /dev/null@@ -1,21 +0,0 @@-use std::time::Duration;--use reqwest::Url;-use tokio::{net::TcpStream, time::timeout};--pub async fn is_endpoint_reachable(endpoint: &str) -> bool {- let Some(url) = Url::parse(endpoint).ok() else {- return false;- };- let Some(host) = url.host_str().map(|host| host.to_string()) else {- return false;- };- let Some(port) = url.port_or_known_default() else {- return false;- };-- timeout(Duration::from_millis(200), TcpStream::connect((host, port)))- .await- .map(|result| result.is_ok())- .unwrap_or(false)-}diff --git a/crates/legacy/uzu/src/lib.rs b/crates/legacy/uzu/src/lib.rsindex 3d632e5f7..4bde59fd7 100644--- a/crates/legacy/uzu/src/lib.rs+++ b/crates/legacy/uzu/src/lib.rs@@ -54,8 +54,6 @@ pub mod player;#[cfg(not(target_family = "wasm"))]pub mod registry;#[cfg(not(target_family = "wasm"))]-pub mod settings;-#[cfg(not(target_family = "wasm"))]pub mod storage;#[cfg(not(target_family = "wasm"))]pub use nagare as session;diff --git a/crates/legacy/uzu/src/settings/error.rs b/crates/legacy/uzu/src/settings/error.rsdeleted file mode 100644index 036b6e11c..000000000--- a/crates/legacy/uzu/src/settings/error.rs+++ /dev/null@@ -1,9 +0,0 @@-#[bindings::export(Error)]-#[derive(Debug, Clone, PartialEq, thiserror::Error)]-#[non_exhaustive]-pub enum SettingsError {- #[error("Backend error: {message}")]- BackendError {- message: String,- },-}diff --git a/crates/legacy/uzu/src/settings/mod.rs b/crates/legacy/uzu/src/settings/mod.rsdeleted file mode 100644index d5f4d632c..000000000--- a/crates/legacy/uzu/src/settings/mod.rs+++ /dev/null@@ -1,182 +0,0 @@-mod error;--use std::sync::Arc;--pub use error::SettingsError;-use indexmap::IndexMap;-use keyring_core::{CredentialStore, Entry, Error as KeyringError, mock, set_default_store};-use serde::{Deserialize, Serialize};--const CONFIG_NAME: &str = "settings";-const BASE_KEY: &str = "settings";--#[derive(Default, Debug, Serialize, Deserialize)]-struct SettingsConfig {- settings: IndexMap<String, String>,-}--#[bindings::export(Enumeration)]-#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]-#[serde(rename_all = "snake_case")]-pub enum SettingKind {- Config,- Secret,-}--#[bindings::export(Class)]-#[derive(Clone)]-pub struct Settings {- application_identifier: String,-}--impl Settings {- pub fn new(application_identifier: String) -> Result<Self, SettingsError> {- let keyring_store = create_keyring_store()?;- set_default_store(keyring_store);- Ok(Self {- application_identifier,- })- }-- fn keyring_entry(&self) -> Result<Entry, SettingsError> {- Entry::new(&self.application_identifier, BASE_KEY).map_err(|error| SettingsError::BackendError {- message: error.to_string(),- })- }-- fn keyring_load_or_create(- &self,- entry: &Entry,- ) -> Result<IndexMap<String, String>, SettingsError> {- match entry.get_password() {- Ok(value) => {- let settings = serde_json::from_str(&value).map_err(|error| SettingsError::BackendError {- message: error.to_string(),- })?;- Ok(settings)- },- Err(KeyringError::NoEntry) => Ok(IndexMap::new()),- Err(error) => Err(SettingsError::BackendError {- message: error.to_string(),- }),- }- }-- fn config_entry(&self) -> Result<SettingsConfig, SettingsError> {- confy::load(&self.application_identifier, CONFIG_NAME).map_err(|error| SettingsError::BackendError {- message: error.to_string(),- })- }-}--#[bindings::export(Implementation)]-impl Settings {- #[bindings::export(Method)]- pub fn save(- &self,- kind: SettingKind,- key: String,- value: Option<String>,- ) -> Result<(), SettingsError> {- match kind {- SettingKind::Config => {- let mut config = self.config_entry()?;- if let Some(value) = value {- config.settings.insert(key, value);- } else {- config.settings.shift_remove(&key);- }- confy::store(&self.application_identifier, CONFIG_NAME, config).map_err(|error| {- SettingsError::BackendError {- message: error.to_string(),- }- })?;- },- SettingKind::Secret => {- let entry = self.keyring_entry()?;-- let mut settings = self.keyring_load_or_create(&entry)?;- if let Some(value) = value {- settings.insert(key, value);- } else {- settings.shift_remove(&key);- }-- let value = serde_json::to_string(&settings).map_err(|error| SettingsError::BackendError {- message: error.to_string(),- })?;- entry.set_password(&value).map_err(|error| SettingsError::BackendError {- message: error.to_string(),- })?;- },- }- Ok(())- }-- #[bindings::export(Method)]- pub fn load(- &self,- kind: SettingKind,- key: String,- ) -> Result<Option<String>, SettingsError> {- match kind {- SettingKind::Config => {- let config = self.config_entry()?;- Ok(config.settings.get(&key).cloned())- },- SettingKind::Secret => {- let entry = self.keyring_entry()?;- let settings = self.keyring_load_or_create(&entry)?;- Ok(settings.get(&key).cloned())- },- }- }-- #[bindings::export(Method)]- pub fn clear(&self) -> Result<(), SettingsError> {- if let Ok(path) = confy::get_configuration_file_path(&self.application_identifier, CONFIG_NAME) {- std::fs::remove_file(path).map_err(|error| SettingsError::BackendError {- message: error.to_string(),- })?;- }-- let entry = self.keyring_entry()?;- entry.delete_credential().map_err(|error| SettingsError::BackendError {- message: error.to_string(),- })?;-- Ok(())- }-}--#[allow(unreachable_code)]-fn create_keyring_store() -> Result<Arc<CredentialStore>, SettingsError> {- #[cfg(target_os = "macos")]- {- use objc2_foundation::NSBundle;- if NSBundle::mainBundle().bundleIdentifier().is_some() {- use apple_native_keyring_store::protected::Store;- return Ok(Store::new().map_err(|error| SettingsError::BackendError {- message: error.to_string(),- })?);- } else {- use apple_native_keyring_store::keychain::Store;- return Ok(Store::new().map_err(|error| SettingsError::BackendError {- message: error.to_string(),- })?);- }- }-- #[cfg(all(target_vendor = "apple", not(target_os = "macos")))]- {- use apple_native_keyring_store::protected::Store;- return Ok(Store::new().map_err(|error| SettingsError::BackendError {- message: error.to_string(),- })?);- }-- let mock_store = mock::Store::new().map_err(|error| SettingsError::BackendError {- message: error.to_string(),- })?;- Ok(mock_store)-}