Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(inference): apply rustfmt import ordering and formatting

Steven Enamakelea22587add13
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs
index 577eccc29b..06d49ca95e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs
@@ -298,15 +298,16 @@ impl Middleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>
guard.output_tokens += usage.output_tokens;
guard.cached_input_tokens += usage.cache_read_tokens;
let host_usage =
- crate::inference::provider::model::usage_info_from_response(response).unwrap_or(
- crate::inference::provider::BilledUsage::from_counts(
- usage.input_tokens,
- usage.output_tokens,
- )
- .with_cached_input_tokens(usage.cache_read_tokens)
- .with_cache_creation_tokens(usage.cache_creation_tokens)
- .with_reasoning_tokens(usage.reasoning_tokens),
- );
+ crate::inference::provider::model::usage_info_from_response(response)
+ .unwrap_or(
+ crate::inference::provider::BilledUsage::from_counts(
+ usage.input_tokens,
+ usage.output_tokens,
+ )
+ .with_cached_input_tokens(usage.cache_read_tokens)
+ .with_cache_creation_tokens(usage.cache_creation_tokens)
+ .with_reasoning_tokens(usage.reasoning_tokens),
+ );
// Use the host's per-call pricing helper whenever the provider
// omitted an authoritative amount. `route` is preferred over a
// construction-time model because it preserves fallback pricing.
diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rs
index 41e6962fbd..383912447f 100644
--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs
@@ -67,11 +67,11 @@ pub(crate) use crate::agent::message_convert::chat_message_to_message;
#[cfg(feature = "flows")]
pub(crate) use crate::agent::message_convert::ta_call_to_oh_call;
-pub(crate) use observability::SubagentScope;
pub(crate) use crate::inference::reasoning::{apply_requested_effort, parse_reasoning_effort};
-pub(crate) use turn_exec::TurnSpec;
pub use crate::inference::turn_models::TurnModelSource;
pub(crate) use crate::inference::turn_models::TurnModels;
+pub(crate) use observability::SubagentScope;
+pub(crate) use turn_exec::TurnSpec;
pub(crate) use turn_outcome::TinyagentsTurnOutcome;
#[cfg(test)]
pub(crate) use turn_policy::is_subagent_spawn_or_delegate_tool;
diff --git a/crates/openhuman-core/src/agent/tinyagents/routes.rs b/crates/openhuman-core/src/agent/tinyagents/routes.rs
index 69cf114636..26340cc78d 100644
--- a/crates/openhuman-core/src/agent/tinyagents/routes.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/routes.rs
@@ -215,7 +215,8 @@ impl ModelMiddleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>
) -> tinyagents_harness::Result<MiddlewareModelOutcome> {
let outcome = next.run(ctx, state, request).await?;
let response = outcome.into_response();
- if let Some(usage) = crate::inference::provider::model::usage_info_from_response(&response) {
+ if let Some(usage) = crate::inference::provider::model::usage_info_from_response(&response)
+ {
self.carry
.lock()
.unwrap_or_else(|p| p.into_inner())
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
index 80072f3e52..f3cc24aa05 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
@@ -28,7 +28,6 @@ use crate::agent::tinyagents::tool_registration::capability_diagnostics;
use crate::agent::tinyagents::turn_middleware::{
TurnMiddlewareInputs, TurnWiring, install_turn_middleware,
};
-use crate::inference::turn_models::TurnModels;
use crate::agent::tinyagents::turn_outcome::TinyagentsTurnOutcome;
use crate::agent::tinyagents::turn_plan::{
OpenHumanTurnPlanner, enforce_registry_diagnostics, turn_models_for_plan, turn_run_policy,
@@ -36,6 +35,7 @@ use crate::agent::tinyagents::turn_plan::{
use crate::agent::tinyagents::turn_run_error::map_turn_run_error;
use crate::agent::tinyagents::turn_run_finalize::finalize_turn_outcome;
use crate::agent::tinyagents::{journal, routes, steering_forwarder};
+use crate::inference::turn_models::TurnModels;
use tinyagents_harness::events::EventSink;
use tinyagents_harness::observability::turn_observer;
use tinyagents_harness::run_queue::RunQueue;
@@ -172,11 +172,8 @@ async fn drive_turn(
// Wrap concrete routes before the invocation-local hosted resolver captures them.
let turn_models = turn_models.with_budget(run_context.model_budget.as_ref());
let hosted_model_resolver = hosted_root.as_ref().map(|_| {
- Arc::new(
- crate::inference::turn_models::TurnModelResolver::from_turn_models(
- &turn_models,
- ),
- ) as Arc<dyn tinyagents_harness::host::ModelResolver<()>>
+ Arc::new(crate::inference::turn_models::TurnModelResolver::from_turn_models(&turn_models))
+ as Arc<dyn tinyagents_harness::host::ModelResolver<()>>
});
// The host security adapter must see the exact same `Arc`-shared instances
// the registration resolves against, so retain only the cheap Arc clone for
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
index 5a3ec2133b..79af97abb5 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
@@ -34,11 +34,11 @@ use crate::agent::tinyagents::context_wiring::install_context_ladder;
use crate::agent::tinyagents::host::OpenHumanRunContext;
use crate::agent::tinyagents::middleware;
use crate::agent::tinyagents::middleware::turn_context::TurnContextMiddleware;
-use crate::inference::provider::model::TurnChatModel;
use crate::agent::tinyagents::observability::{ProviderUsageCarry, SubagentScope, ToolFailureMap};
use crate::agent::tinyagents::routes;
use crate::agent::tinyagents::stop_hooks;
use crate::agent::tinyagents::verify_before_finish;
+use crate::inference::provider::model::TurnChatModel;
use super::ToolPolicyEnforcement;
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs b/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs
index 5170be3912..2f720c3581 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs
@@ -20,10 +20,10 @@ use tinyagents_runtime::{DriverRequest, RuntimeError};
use tinyinference_llm::model::ErrorSlotModel;
use crate::agent::tinyagents::host::OpenHumanRunContext;
-use crate::inference::provider::model::TurnChatModel;
use crate::agent::tinyagents::routes;
use crate::agent::tinyagents::tool_registration::host_tool_set_builder;
use crate::agent::tinyagents::turn_policy::run_policy_for_provider;
+use crate::inference::provider::model::TurnChatModel;
/// The run policy for one turn, and whether it carries a cross-route fallback.
///
diff --git a/crates/openhuman-core/src/inference/context_window.rs b/crates/openhuman-core/src/inference/context_window.rs
index ca6b13850f..7292db1d72 100644
--- a/crates/openhuman-core/src/inference/context_window.rs
+++ b/crates/openhuman-core/src/inference/context_window.rs
@@ -30,7 +30,7 @@ use std::sync::{Mutex, OnceLock};
use tinyinference_llm::model::context_window::{ContextWindowInput, ContextWindowResolver};
use tinyinference_llm::model::context_window::{ResolvedWindow, WindowSource};
use tinyinference_llm::model::discover::{
- model_limits_cache, DiscoveryRequest, ModelLimitsCache, ModelListingFetcher,
+ DiscoveryRequest, ModelLimitsCache, ModelListingFetcher, model_limits_cache,
};
use crate::config::Config;
diff --git a/crates/openhuman-core/src/inference/context_window_tests.rs b/crates/openhuman-core/src/inference/context_window_tests.rs
index 37eb7fb88c..e6d9d2e092 100644
--- a/crates/openhuman-core/src/inference/context_window_tests.rs
+++ b/crates/openhuman-core/src/inference/context_window_tests.rs
@@ -1,12 +1,12 @@
use super::*;
use std::sync::Mutex as StdMutex;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use tempfile::TempDir;
use tinyinference_llm::model::discover::ModelLimitsCache;
-use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};
use crate::config::schema::ModelRegistryEntry;
+use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};
use crate::security::credentials::AuthService;
const OPENROUTER: &str = "https://openrouter.ai/api/v1";
diff --git a/crates/openhuman-core/src/inference/embedding_host/cloud_adapter.rs b/crates/openhuman-core/src/inference/embedding_host/cloud_adapter.rs
index 80c54fc87d..983f874cbf 100644
--- a/crates/openhuman-core/src/inference/embedding_host/cloud_adapter.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/cloud_adapter.rs
@@ -4,12 +4,12 @@ use std::path::PathBuf;
use std::sync::Arc;
use tinyinference_embeddings::{
- BearerResolver, CloudEmbeddingModel, EmbeddingModel, DEFAULT_CLOUD_DIMENSIONS,
- DEFAULT_CLOUD_MODEL,
+ BearerResolver, CloudEmbeddingModel, DEFAULT_CLOUD_DIMENSIONS, DEFAULT_CLOUD_MODEL,
+ EmbeddingModel,
};
use crate::security::approval::ApprovalChatContext;
-use crate::security::credentials::{AuthService, APP_SESSION_PROVIDER};
+use crate::security::credentials::{APP_SESSION_PROVIDER, AuthService};
pub const DEFAULT_CLOUD_EMBEDDING_MODEL: &str = DEFAULT_CLOUD_MODEL;
pub const DEFAULT_CLOUD_EMBEDDING_DIMENSIONS: usize = DEFAULT_CLOUD_DIMENSIONS;
diff --git a/crates/openhuman-core/src/inference/embedding_host/cloud_adapter_tests.rs b/crates/openhuman-core/src/inference/embedding_host/cloud_adapter_tests.rs
index 5ef5276437..0a8d87d653 100644
--- a/crates/openhuman-core/src/inference/embedding_host/cloud_adapter_tests.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/cloud_adapter_tests.rs
@@ -102,7 +102,7 @@ fn env_workspace_scope_is_the_config_dir_not_the_raw_workspace() {
/// session), sent as `Authorization: Bearer <key>` like managed inference.
#[tokio::test]
async fn api_key_alone_authenticates_cloud_embeddings() {
- use axum::{http::HeaderMap, routing::post, Json, Router};
+ use axum::{Json, Router, http::HeaderMap, routing::post};
use std::sync::{Arc, Mutex};
let seen: Arc<Mutex<Option<String>>> = Arc::default();
diff --git a/crates/openhuman-core/src/inference/embedding_host/factory.rs b/crates/openhuman-core/src/inference/embedding_host/factory.rs
index 2901e0bc97..bf8530bbfd 100644
--- a/crates/openhuman-core/src/inference/embedding_host/factory.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/factory.rs
@@ -3,11 +3,11 @@
use std::sync::Arc;
use crate::config::Config;
+use tinyinference_embeddings::EmbeddingModel;
use tinyinference_embeddings::factory::{
- create_configured_embedding_model, create_default_embedding_model, CredentialResolver,
- EmbeddingFactorySettings, ManagedModelFactory,
+ CredentialResolver, EmbeddingFactorySettings, ManagedModelFactory,
+ create_configured_embedding_model, create_default_embedding_model,
};
-use tinyinference_embeddings::EmbeddingModel;
use super::cloud::OpenHumanCloudEmbeddingModel;
use crate::security::approval::ApprovalChatContext;
diff --git a/crates/openhuman-core/src/inference/embedding_host/factory_tests.rs b/crates/openhuman-core/src/inference/embedding_host/factory_tests.rs
index a9cad508ff..e3e0a31f84 100644
--- a/crates/openhuman-core/src/inference/embedding_host/factory_tests.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/factory_tests.rs
@@ -2,7 +2,7 @@ use super::*;
use crate::inference::embedding_host::{
DEFAULT_CLOUD_EMBEDDING_DIMENSIONS, DEFAULT_CLOUD_EMBEDDING_MODEL,
};
-use crate::security::credentials::{AuthService, APP_SESSION_PROVIDER};
+use crate::security::credentials::{APP_SESSION_PROVIDER, AuthService};
use std::collections::HashMap;
use tempfile::TempDir;
use tinyinference_embeddings::factory::validate_custom_endpoint;
@@ -155,7 +155,7 @@ fn config_aware_factory_ollama_honours_config_base_url() {
async fn config_aware_factory_ollama_embeds_against_config_base_url() {
use std::sync::{Arc, Mutex};
- use axum::{extract::State, routing::post, Json, Router};
+ use axum::{Json, Router, extract::State, routing::post};
// Mock Ollama `/api/embed`: records that it was hit and echoes a
// 3-dimensional vector (matching the requested `dims`).
@@ -248,7 +248,7 @@ fn custom_endpoint_validation_rejects_blank_and_credentialed_remote_http() {
async fn default_embedder_honors_configured_local_provider() {
use std::sync::{Arc, Mutex};
- use axum::{extract::State, routing::post, Json, Router};
+ use axum::{Json, Router, extract::State, routing::post};
#[derive(Clone, Default)]
struct Hit {
@@ -301,7 +301,7 @@ async fn default_embedder_honors_configured_local_provider() {
async fn factory_managed_provider_authenticates_with_config_scoped_token() {
use std::sync::{Arc, Mutex};
- use axum::{extract::State, http::HeaderMap, routing::post, Json, Router};
+ use axum::{Json, Router, extract::State, http::HeaderMap, routing::post};
// Mock cloud embeddings backend at {BACKEND_URL}/openai/v1/embeddings.
#[derive(Clone, Default)]
@@ -384,7 +384,7 @@ async fn factory_managed_provider_authenticates_with_config_scoped_token() {
async fn default_provider_with_config_authenticates_with_config_scoped_token() {
use std::sync::{Arc, Mutex};
- use axum::{extract::State, http::HeaderMap, routing::post, Json, Router};
+ use axum::{Json, Router, extract::State, http::HeaderMap, routing::post};
#[derive(Clone, Default)]
struct Captured {
diff --git a/crates/openhuman-core/src/inference/embedding_host/mod.rs b/crates/openhuman-core/src/inference/embedding_host/mod.rs
index 0c58c171bc..f0263d200d 100644
--- a/crates/openhuman-core/src/inference/embedding_host/mod.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/mod.rs
@@ -20,7 +20,7 @@ mod rpc;
mod schemas;
pub use cloud::{
- OpenHumanCloudEmbeddingModel, DEFAULT_CLOUD_EMBEDDING_DIMENSIONS, DEFAULT_CLOUD_EMBEDDING_MODEL,
+ DEFAULT_CLOUD_EMBEDDING_DIMENSIONS, DEFAULT_CLOUD_EMBEDDING_MODEL, OpenHumanCloudEmbeddingModel,
};
pub use factory::{
create_embedding_provider_for_chat, create_embedding_provider_with_config,
diff --git a/crates/openhuman-core/src/inference/embedding_host/rpc.rs b/crates/openhuman-core/src/inference/embedding_host/rpc.rs
index 5ceee0d365..3145ffcf74 100644
--- a/crates/openhuman-core/src/inference/embedding_host/rpc.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/rpc.rs
@@ -18,7 +18,7 @@ use tinyinference_embeddings::probe::redact_secrets;
#[cfg(test)]
use settings::remember_active_custom_profile;
#[cfg(test)]
-use tinyinference_embeddings::probe::{classify_embed_probe, EmbedProbe};
+use tinyinference_embeddings::probe::{EmbedProbe, classify_embed_probe};
#[cfg(test)]
use tinyinference_embeddings::served_models::{
check_requested_model_served, fetch_served_model_ids, normalize_embed_model_id,
diff --git a/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs b/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs
index 3aee247073..62b765c319 100644
--- a/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/rpc/embed.rs
@@ -3,7 +3,7 @@
use crate::config::Config;
use crate::core::Outcome;
-use super::{resolve_api_key, LOG_PREFIX};
+use super::{LOG_PREFIX, resolve_api_key};
use crate::inference::embedding_host::factory::create_embedding_provider_with_config;
use tinyinference_embeddings::probe::probe_custom_embeddings;
diff --git a/crates/openhuman-core/src/inference/embedding_host/rpc/settings.rs b/crates/openhuman-core/src/inference/embedding_host/rpc/settings.rs
index 8a945f1396..1b84c01f70 100644
--- a/crates/openhuman-core/src/inference/embedding_host/rpc/settings.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/rpc/settings.rs
@@ -2,18 +2,18 @@
//! update, including the save-time verification of a custom endpoint.
use crate::config::Config;
-use crate::core::runtime::DispatchCtx;
use crate::core::Outcome;
+use crate::core::runtime::DispatchCtx;
use crate::security::credentials::AuthService;
-use super::{resolve_api_key, LOG_PREFIX};
+use super::{LOG_PREFIX, resolve_api_key};
use tinyinference_embeddings::catalog;
use tinyinference_embeddings::probe::{
- classify_embed_probe, final_probe_dims, probe_custom_embeddings, EmbedProbe,
- EmbeddingProbeRejection,
+ EmbedProbe, EmbeddingProbeRejection, classify_embed_probe, final_probe_dims,
+ probe_custom_embeddings,
};
use tinyinference_embeddings::served_models::{
- check_requested_model_served, fetch_served_model_ids, ModelNotServed,
+ ModelNotServed, check_requested_model_served, fetch_served_model_ids,
};
fn probe_rejection_outcome(reject: EmbeddingProbeRejection) -> Outcome<serde_json::Value> {
@@ -289,10 +289,10 @@ pub async fn update_settings(
// auth vs wrong-model vs unreachable failures (issue #5017).
let reject_code = reject.error;
tracing::warn!(
- provider = effective_provider.as_str(),
- reject_code,
- "{LOG_PREFIX} update_settings rejected — embeddings endpoint failed verification"
- );
+ provider = effective_provider.as_str(),
+ reject_code,
+ "{LOG_PREFIX} update_settings rejected — embeddings endpoint failed verification"
+ );
// Right-feedback (issue #3761): the probe failed. If the
// endpoint lists its served models and the requested id
// isn't among them, the cause is almost certainly a name
@@ -311,27 +311,27 @@ pub async fn update_settings(
if let Some(ep) = listed_endpoint {
let api_key = resolve_api_key(&config, "custom");
tracing::debug!(
- provider = effective_provider.as_str(),
- requested = new_model.as_str(),
- "{LOG_PREFIX} update_settings: probing endpoint /models for served-id guidance"
- );
+ provider = effective_provider.as_str(),
+ requested = new_model.as_str(),
+ "{LOG_PREFIX} update_settings: probing endpoint /models for served-id guidance"
+ );
match fetch_served_model_ids(ep, &api_key).await {
Ok(served) => match check_requested_model_served(&new_model, &served) {
Some(better) => {
tracing::warn!(
- provider = effective_provider.as_str(),
- requested = new_model.as_str(),
- served = served.len(),
- "{LOG_PREFIX} update_settings: model not in served list — returning name-mismatch guidance"
- );
+ provider = effective_provider.as_str(),
+ requested = new_model.as_str(),
+ served = served.len(),
+ "{LOG_PREFIX} update_settings: model not in served list — returning name-mismatch guidance"
+ );
return Ok(model_rejection_outcome(better));
}
None => {
tracing::debug!(
- provider = effective_provider.as_str(),
- served = served.len(),
- "{LOG_PREFIX} update_settings: requested model is served (or list empty) — keeping generic verification error"
- );
+ provider = effective_provider.as_str(),
+ served = served.len(),
+ "{LOG_PREFIX} update_settings: requested model is served (or list empty) — keeping generic verification error"
+ );
}
},
Err(e) => {
@@ -354,12 +354,12 @@ pub async fn update_settings(
let detected_dims = final_probe_dims(&new_model, new_dims, probe_actual_dims);
if detected_dims != new_dims {
tracing::info!(
- provider = effective_provider.as_str(),
- model = new_model.as_str(),
- requested = new_dims,
- detected = detected_dims,
- "{LOG_PREFIX} update_settings auto-detected custom embedding dimension from probe"
- );
+ provider = effective_provider.as_str(),
+ model = new_model.as_str(),
+ requested = new_dims,
+ detected = detected_dims,
+ "{LOG_PREFIX} update_settings auto-detected custom embedding dimension from probe"
+ );
new_dims = detected_dims;
new_sig = format_embedding_signature(&new_provider, &new_model, new_dims);
sig_changed = new_sig != old_sig;
diff --git a/crates/openhuman-core/src/inference/embedding_host/rpc_tests.rs b/crates/openhuman-core/src/inference/embedding_host/rpc_tests.rs
index 0ed49e910a..941aca5368 100644
--- a/crates/openhuman-core/src/inference/embedding_host/rpc_tests.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/rpc_tests.rs
@@ -145,11 +145,13 @@ fn reject_model_not_served_without_match_lists_available() {
#[test]
fn check_requested_model_served_decisions() {
// Served exactly → accept (None).
- assert!(check_requested_model_served(
- "text-embedding-bge-m3",
- &["text-embedding-bge-m3".to_string()],
- )
- .is_none());
+ assert!(
+ check_requested_model_served(
+ "text-embedding-bge-m3",
+ &["text-embedding-bge-m3".to_string()],
+ )
+ .is_none()
+ );
// Empty/unknown list → defer to probe (None), never block.
assert!(check_requested_model_served("bge-m3", &[]).is_none());
// Non-empty list without the model → reject with feedback.
@@ -159,7 +161,7 @@ fn check_requested_model_served_decisions() {
#[tokio::test]
async fn fetch_served_model_ids_parses_openai_models_list() {
- use axum::{routing::get, Json, Router};
+ use axum::{Json, Router, routing::get};
let app = Router::new().route(
"/v1/models",
get(|| async {
@@ -405,9 +407,9 @@ async fn conformant_custom_endpoint_verifies_and_sends_expected_request() {
use std::sync::{Arc, Mutex};
use axum::{
+ Json, Router,
extract::State,
routing::{get, post},
- Json, Router,
};
#[derive(Clone, Default)]
diff --git a/crates/openhuman-core/src/inference/embedding_host/schemas.rs b/crates/openhuman-core/src/inference/embedding_host/schemas.rs
index 53643e5c73..0d1fe7b788 100644
--- a/crates/openhuman-core/src/inference/embedding_host/schemas.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/schemas.rs
@@ -4,8 +4,8 @@ use crate::core::runtime::DispatchCtx;
use serde::Deserialize;
use serde_json::{Map, Value};
-use crate::core::all::{ControllerFuture, RegisteredController};
use crate::core::Outcome;
+use crate::core::all::{ControllerFuture, RegisteredController};
use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
pub fn all_controller_schemas() -> Vec<ControllerSchema> {
diff --git a/crates/openhuman-core/src/inference/failure_copy/halt.rs b/crates/openhuman-core/src/inference/failure_copy/halt.rs
index 5316fecd3b..f758f2693f 100644
--- a/crates/openhuman-core/src/inference/failure_copy/halt.rs
+++ b/crates/openhuman-core/src/inference/failure_copy/halt.rs
@@ -5,7 +5,7 @@
//! `agent::tinyagents::middleware::loop_guards`.
use tinyinference_providers::{
- is_budget_message, is_provider_config_rejection_message, BudgetMatch,
+ BudgetMatch, is_budget_message, is_provider_config_rejection_message,
};
/// Clamp the last-error text embedded in a circuit-breaker halt summary so a huge
diff --git a/crates/openhuman-core/src/inference/failure_copy/mod.rs b/crates/openhuman-core/src/inference/failure_copy/mod.rs
index be87066136..eff9f45402 100644
--- a/crates/openhuman-core/src/inference/failure_copy/mod.rs
+++ b/crates/openhuman-core/src/inference/failure_copy/mod.rs
@@ -21,4 +21,4 @@ pub(crate) use halt::{
terminal_inference_failure_kind, terminal_inference_halt_summary, user_actionable_escalation,
};
pub(crate) use stop_summary::stop_summary_copy;
-pub(crate) use table::{failure_copy, FailureClass};
+pub(crate) use table::{FailureClass, failure_copy};
diff --git a/crates/openhuman-core/src/inference/failure_copy/stop_summary.rs b/crates/openhuman-core/src/inference/failure_copy/stop_summary.rs
index 85e9aecfef..3d1a228cce 100644
--- a/crates/openhuman-core/src/inference/failure_copy/stop_summary.rs
+++ b/crates/openhuman-core/src/inference/failure_copy/stop_summary.rs
@@ -3,14 +3,18 @@
/// The user-facing text for one `turn_stop.*` localization key.
pub(crate) fn stop_summary_copy(key: &str) -> &'static str {
match key {
- "turn_stop.transient" => "a service I needed kept timing out or was temporarily unavailable",
+ "turn_stop.transient" => {
+ "a service I needed kept timing out or was temporarily unavailable"
+ }
"turn_stop.uncertain_side_effect" => {
"an action timed out and I could not confirm whether it went through, so I did not repeat it"
}
"turn_stop.authentication" => "a service rejected my credentials",
"turn_stop.permission" => "I don't have permission for a step this needs",
"turn_stop.policy" => "a step this needs is blocked by your security settings",
- "turn_stop.missing_program" => "a program or feature this needs is not available on this device",
+ "turn_stop.missing_program" => {
+ "a program or feature this needs is not available on this device"
+ }
"turn_stop.not_found" => "something this needs could not be found",
"turn_stop.invalid_calls" => "a tool kept rejecting my requests as invalid",
"turn_stop.unavailable" => "a tool this needs is not available right now",
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops.rs b/crates/openhuman-core/src/inference/host_runtime/ops.rs
index 3b90031282..1d5180fe56 100644
--- a/crates/openhuman-core/src/inference/host_runtime/ops.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/ops.rs
@@ -14,10 +14,10 @@ mod runtime_ops;
mod turn_guards;
pub use agent_chat::{
- agent_chat, agent_chat_for, agent_chat_reply_for, agent_chat_simple, AgentChatEnv,
- AgentChatReply, AgentChatTarget,
+ AgentChatEnv, AgentChatReply, AgentChatTarget, agent_chat, agent_chat_for,
+ agent_chat_reply_for, agent_chat_simple,
};
-pub use complete_once::{complete_once, CompletionEndpoint};
+pub use complete_once::{CompletionEndpoint, complete_once};
pub use runtime_ops::{
local_ai_prompt, local_ai_status, local_ai_summarize, local_ai_transcribe,
local_ai_transcribe_bytes, local_ai_tts, local_ai_vision_prompt,
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/complete_once_tests.rs b/crates/openhuman-core/src/inference/host_runtime/ops/complete_once_tests.rs
index 054633c972..94dba635de 100644
--- a/crates/openhuman-core/src/inference/host_runtime/ops/complete_once_tests.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/ops/complete_once_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use tinyinference_llm::message::Message;
use tinyinference_llm::model::ResponseFormat;
use tinyinference_llm::tool::ToolSchema;
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/turn_guards.rs b/crates/openhuman-core/src/inference/host_runtime/ops/turn_guards.rs
index 290253665e..4b7d42ad6a 100644
--- a/crates/openhuman-core/src/inference/host_runtime/ops/turn_guards.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/ops/turn_guards.rs
@@ -4,7 +4,7 @@
use crate::config::Config;
use crate::security::prompt_injection::{
- enforce_prompt_input, PromptEnforcementAction, PromptEnforcementContext,
+ PromptEnforcementAction, PromptEnforcementContext, enforce_prompt_input,
};
pub(super) fn prompt_guard_user_message(action: PromptEnforcementAction) -> &'static str {
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops_tests.rs b/crates/openhuman-core/src/inference/host_runtime/ops_tests.rs
index 8406593311..06535fb5dd 100644
--- a/crates/openhuman-core/src/inference/host_runtime/ops_tests.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/ops_tests.rs
@@ -280,7 +280,7 @@ async fn effective_origin_defaults_to_direct_chat_outside_any_scope() {
/// see, not the blanket `Cli` allowance this RPC would otherwise impose.
#[tokio::test]
async fn effective_origin_keeps_an_embedder_scoped_label() {
- use crate::agent::turn_origin::{with_origin, AgentTurnOrigin, TrustedAutomationSource};
+ use crate::agent::turn_origin::{AgentTurnOrigin, TrustedAutomationSource, with_origin};
let observed = with_origin(
AgentTurnOrigin::TrustedAutomation {
job_id: "run-7".to_string(),
@@ -308,7 +308,7 @@ async fn effective_origin_keeps_an_embedder_scoped_label() {
/// touched, not a silent fall-through to the orchestrator.
#[tokio::test]
async fn agent_chat_for_rejects_an_unknown_agent_id() {
- use crate::inference::host_runtime::ops::{agent_chat_for, AgentChatTarget};
+ use crate::inference::host_runtime::ops::{AgentChatTarget, agent_chat_for};
let tmp = tempfile::tempdir().unwrap();
let mut config = test_config(&tmp);
std::fs::create_dir_all(&config.workspace_dir).unwrap();
diff --git a/crates/openhuman-core/src/inference/host_runtime/service/speech.rs b/crates/openhuman-core/src/inference/host_runtime/service/speech.rs
index 5ddb202710..95d913586a 100644
--- a/crates/openhuman-core/src/inference/host_runtime/service/speech.rs
+++ b/crates/openhuman-core/src/inference/host_runtime/service/speech.rs
@@ -1,7 +1,7 @@
use std::path::PathBuf;
use std::time::Instant;
-use base64::{engine::general_purpose::STANDARD as BASE64, Engine};
+use base64::{Engine, engine::general_purpose::STANDARD as BASE64};
use log::debug;
use crate::config::Config;
@@ -63,8 +63,8 @@ pub async fn transcribe_with_prompt(
let provider_name = effective_stt_provider(config);
debug!(
- "{LOG_PREFIX} configured STT dispatch provider={provider_name} path={audio_path} mime={mime}"
- );
+ "{LOG_PREFIX} configured STT dispatch provider={provider_name} path={audio_path} mime={mime}"
+ );
let bytes = tokio::fs::read(path)
.await
.map_err(|e| format!("failed to read audio file {audio_path}: {e}"))?;
diff --git a/crates/openhuman-core/src/inference/http/backend.rs b/crates/openhuman-core/src/inference/http/backend.rs
index 2d6a119658..bc3444cd0b 100644
--- a/crates/openhuman-core/src/inference/http/backend.rs
+++ b/crates/openhuman-core/src/inference/http/backend.rs
@@ -13,7 +13,7 @@
use async_trait::async_trait;
use tinyinference_llm::providers::openai::server_http::{
- strip_temperature_suffix, BackendFailure, ChatBackend, ListedModel, ResolvedChat,
+ BackendFailure, ChatBackend, ListedModel, ResolvedChat, strip_temperature_suffix,
};
use tracing::{debug, warn};
diff --git a/crates/openhuman-core/src/inference/mod.rs b/crates/openhuman-core/src/inference/mod.rs
index 5242d83829..602c1a1152 100644
--- a/crates/openhuman-core/src/inference/mod.rs
+++ b/crates/openhuman-core/src/inference/mod.rs
@@ -30,17 +30,17 @@ pub(crate) mod failure_copy;
pub mod host_runtime;
pub mod http;
pub mod model_context;
-pub(crate) mod reasoning;
pub mod ops;
pub mod provider;
-pub mod turn_models;
+pub(crate) mod reasoning;
mod schemas;
pub mod tokenjuice;
+pub mod turn_models;
pub use ops as rpc;
pub use schemas::{
- all_controller_schemas as all_inference_controller_schemas,
- all_registered_controllers as all_inference_registered_controllers, INFERENCE_AGENT_CHAT,
+ INFERENCE_AGENT_CHAT, all_controller_schemas as all_inference_controller_schemas,
+ all_registered_controllers as all_inference_registered_controllers,
};
// Re-export the types that external callers (voice, agent, etc.) import from inference
diff --git a/crates/openhuman-core/src/inference/model_context.rs b/crates/openhuman-core/src/inference/model_context.rs
index 4034259b47..3a739065ba 100644
--- a/crates/openhuman-core/src/inference/model_context.rs
+++ b/crates/openhuman-core/src/inference/model_context.rs
@@ -5,7 +5,7 @@
//! otherwise long histories produce upstream `400 Bad Request` errors when usage
//! metadata is not yet available.
-use crate::config::{legacy_tier_role, MODEL_MANAGED_DEFAULT};
+use crate::config::{MODEL_MANAGED_DEFAULT, legacy_tier_role};
/// Conservative default for OpenHuman abstract tier models (tokens).
const TIER_LARGE_CONTEXT: u64 = 200_000;
diff --git a/crates/openhuman-core/src/inference/ops.rs b/crates/openhuman-core/src/inference/ops.rs
index e9ac765320..163e231a70 100644
--- a/crates/openhuman-core/src/inference/ops.rs
+++ b/crates/openhuman-core/src/inference/ops.rs
@@ -1,15 +1,15 @@
//! JSON-RPC controller surface for inference operations.
-use crate::config::rpc as config_rpc;
use crate::config::Config;
-use crate::core::runtime::DispatchCtx;
+use crate::config::rpc as config_rpc;
use crate::core::Outcome;
+use crate::core::runtime::DispatchCtx;
use crate::inference::host_runtime as local_runtime;
use crate::inference::provider as providers;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use tinyinference_llm::message::Message;
use tinyinference_llm::model::ModelRequest;
-use tinyinference_llm::sentiment::{parse_sentiment_response, SentimentResult};
+use tinyinference_llm::sentiment::{SentimentResult, parse_sentiment_response};
use tinyinference_local::status::LocalAiStatus;
use tracing::{debug, error, warn};
diff --git a/crates/openhuman-core/src/inference/ops_tests.rs b/crates/openhuman-core/src/inference/ops_tests.rs
index 75d1f0acdf..b605131aff 100644
--- a/crates/openhuman-core/src/inference/ops_tests.rs
+++ b/crates/openhuman-core/src/inference/ops_tests.rs
@@ -2,7 +2,7 @@ use super::*;
use crate::core::runtime::DispatchCtx;
use crate::security::credentials::openai_oauth::{OPENAI_OAUTH_PROFILE_NAME, OPENAI_PROVIDER_KEY};
use crate::security::credentials::profiles::{AuthProfile, AuthProfilesStore, TokenSet};
-use axum::{routing::post, Json, Router};
+use axum::{Json, Router, routing::post};
use chrono::{Duration, Utc};
use tempfile::tempdir;
@@ -168,10 +168,12 @@ async fn inference_openai_oauth_start_returns_authorize_payload() {
.await
.expect("oauth start");
- assert!(outcome.value["authUrl"]
- .as_str()
- .unwrap()
- .contains("auth.openai.com"));
+ assert!(
+ outcome.value["authUrl"]
+ .as_str()
+ .unwrap()
+ .contains("auth.openai.com")
+ );
assert_eq!(
outcome.value["redirectUri"].as_str(),
Some("http://127.0.0.1:1455/auth/callback")
diff --git a/crates/openhuman-core/src/inference/provider/error_classify.rs b/crates/openhuman-core/src/inference/provider/error_classify.rs
index 0ac058ddd1..94a8f1ca7c 100644
--- a/crates/openhuman-core/src/inference/provider/error_classify.rs
+++ b/crates/openhuman-core/src/inference/provider/error_classify.rs
@@ -1,8 +1,8 @@
//! OpenHuman-specific policy layered on TinyInference's provider-neutral classifier.
use tinyinference_llm::failure::{
- classify_provider_failure, parse_retry_after_ms as parse_inference_retry_after,
- ProviderFailureClass,
+ ProviderFailureClass, classify_provider_failure,
+ parse_retry_after_ms as parse_inference_retry_after,
};
fn classify(err: &anyhow::Error) -> ProviderFailureClass {
diff --git a/crates/openhuman-core/src/inference/provider/error_code.rs b/crates/openhuman-core/src/inference/provider/error_code.rs
index b61407d5e4..d00582a147 100644
--- a/crates/openhuman-core/src/inference/provider/error_code.rs
+++ b/crates/openhuman-core/src/inference/provider/error_code.rs
@@ -102,11 +102,7 @@ pub fn extract_backend_error_code_token(err: &str) -> Option<String> {
let stripped = after_colon.strip_prefix('"')?;
let end = stripped.find('"')?;
let token = stripped[..end].trim().to_ascii_uppercase();
- if token.is_empty() {
- None
- } else {
- Some(token)
- }
+ if token.is_empty() { None } else { Some(token) }
}
/// Whether the flattened error string is a **managed-backend** envelope (the
diff --git a/crates/openhuman-core/src/inference/provider/factory.rs b/crates/openhuman-core/src/inference/provider/factory.rs
index d4c06fbfd6..c784b6ea58 100644
--- a/crates/openhuman-core/src/inference/provider/factory.rs
+++ b/crates/openhuman-core/src/inference/provider/factory.rs
@@ -86,8 +86,8 @@ use cloud_slug::{
try_create_cloud_slug_chat_model_with_native_tools,
};
use local_runtime::{
- try_create_local_runtime_chat_model, try_create_local_runtime_chat_model_from_string,
- OptionalChatModelResult,
+ OptionalChatModelResult, try_create_local_runtime_chat_model,
+ try_create_local_runtime_chat_model_from_string,
};
pub(crate) use managed_backend::make_openhuman_backend_model_for_thread;
use managed_backend::{resolve_managed_backend, resolve_managed_backend_with_model_override};
@@ -119,21 +119,21 @@ pub mod test_provider_override;
#[path = "factory_tests.rs"]
mod factory_tests;
-use crate::config::schema::cloud_providers::AuthStyle;
use crate::config::Config;
+use crate::config::schema::cloud_providers::AuthStyle;
+use crate::inference::provider::ProviderRuntimeOptions;
use crate::inference::provider::openai_codex::resolve_openai_codex_routing;
use crate::inference::provider::openhuman_backend_model::OpenHumanBackendModel;
-use crate::inference::provider::ProviderRuntimeOptions;
use crate::security::credentials::AuthService;
use crate::security::egress::EgressLedger;
use std::sync::Arc;
use tinyagents_harness::providers::claude_agent_sdk::ClaudeAgentSdkProvider;
use tinyinference_llm::model::{ChatModel, ModelRequest, ModelResponse, ModelStream};
+use tinyinference_llm::providers::openai::AuthStyle as CompatAuthStyle;
use tinyinference_llm::providers::openai::codex::{
- openai_codex_client_version, openai_codex_user_agent, OPENAI_CODEX_ACCOUNT_HEADER,
- OPENAI_CODEX_ORIGINATOR, OPENAI_CODEX_ORIGINATOR_HEADER,
+ OPENAI_CODEX_ACCOUNT_HEADER, OPENAI_CODEX_ORIGINATOR, OPENAI_CODEX_ORIGINATOR_HEADER,
+ openai_codex_client_version, openai_codex_user_agent,
};
-use tinyinference_llm::providers::openai::AuthStyle as CompatAuthStyle;
/// Sentinel meaning "use the OpenHuman backend session JWT".
pub const PROVIDER_OPENHUMAN: &str = "openhuman";
diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rs
index 9cf06d2e33..14c1117c47 100644
--- a/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rs
@@ -77,10 +77,12 @@ fn discovery_request_carries_bearer_auth_and_pins_openrouter_sorting() {
let request =
cloud_discovery_request(&build(&creds, "m", "sk-or")).expect("openrouter has a listing");
assert_eq!(request.endpoint, "https://openrouter.ai/api/v1");
- assert!(request
- .headers
- .iter()
- .any(|(name, value)| name == "Authorization" && value == "Bearer sk-or"));
+ assert!(
+ request
+ .headers
+ .iter()
+ .any(|(name, value)| name == "Authorization" && value == "Bearer sk-or")
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/inference/provider/factory/discovery.rs b/crates/openhuman-core/src/inference/provider/factory/discovery.rs
index aef17a31b0..23a19caa4a 100644
--- a/crates/openhuman-core/src/inference/provider/factory/discovery.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/discovery.rs
@@ -90,7 +90,7 @@ fn managed_limits_request(model: &str, config: &Config) -> Option<DiscoveryReque
is_managed_endpoint_for_api_key, is_safe_endpoint_for_managed_bearer,
};
use crate::security::credentials::session_support::{
- resolve_backend_credential, BackendCredential,
+ BackendCredential, resolve_backend_credential,
};
let model = model.trim();
diff --git a/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs b/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs
index 3aef45d5ac..2149dcae5f 100644
--- a/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs
@@ -40,7 +40,7 @@ pub(super) fn try_create_local_runtime_chat_model_from_string(
egress: &EgressLedger,
) -> OptionalChatModelResult {
use tinyinference_local::local_runtime::{
- resolve_local_runtime, LocalRuntimeAuth, LocalRuntimeInputs,
+ LocalRuntimeAuth, LocalRuntimeInputs, resolve_local_runtime,
};
// Use the same classifier as privacy and session policy. Canonicalize only
diff --git a/crates/openhuman-core/src/inference/provider/factory/primary_cloud.rs b/crates/openhuman-core/src/inference/provider/factory/primary_cloud.rs
index 470304ac87..f9a59c6246 100644
--- a/crates/openhuman-core/src/inference/provider/factory/primary_cloud.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/primary_cloud.rs
@@ -68,11 +68,7 @@ pub(super) fn redact_inference_url(url: Option<&str>) -> &str {
.rfind('@')
.map_or(authority, |i| &authority[i + 1..]);
let host = host.rfind(':').map_or(host, |i| &host[..i]);
- if host.is_empty() {
- None
- } else {
- Some(host)
- }
+ if host.is_empty() { None } else { Some(host) }
})
.unwrap_or("<redacted>")
}
diff --git a/crates/openhuman-core/src/inference/provider/factory/routing_tests.rs b/crates/openhuman-core/src/inference/provider/factory/routing_tests.rs
index 109b68a11d..a871a5d70e 100644
--- a/crates/openhuman-core/src/inference/provider/factory/routing_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/routing_tests.rs
@@ -1,6 +1,6 @@
use super::*;
-use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};
use crate::config::Config;
+use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};
use crate::inference::provider::factory::resolves_to_managed_backend;
fn byok_openai_compatible_entry() -> CloudProviderCreds {
diff --git a/crates/openhuman-core/src/inference/provider/factory/tiers.rs b/crates/openhuman-core/src/inference/provider/factory/tiers.rs
index 0e77dd34dc..f117657584 100644
--- a/crates/openhuman-core/src/inference/provider/factory/tiers.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/tiers.rs
@@ -9,7 +9,7 @@
//! as aliases of their role so un-migrated callers keep routing.
use super::*;
-use crate::config::{legacy_tier_role, MANAGED_MULTIMODAL_MODELS, MODEL_MANAGED_DEFAULT};
+use crate::config::{MANAGED_MULTIMODAL_MODELS, MODEL_MANAGED_DEFAULT, legacy_tier_role};
/// Whether `model` is a managed alias rather than a concrete model id: a
/// `hint:*` role marker or a retired tier slug.
diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
index ef9a0d87fc..346cbf359b 100644
--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
@@ -80,9 +80,11 @@ fn enforce_local_only_inference_errors_on_external_when_local_only() {
Err(error) => error,
Ok(_) => panic!("direct Claude Code model must preserve the privacy gate"),
};
- assert!(claude_code_error
- .to_string()
- .contains("Local-only privacy mode"));
+ assert!(
+ claude_code_error
+ .to_string()
+ .contains("Local-only privacy mode")
+ );
// Both the default factory and a thread-attached managed picker route must
// hit the managed resolver's privacy gate before any backend client exists.
@@ -439,9 +441,11 @@ fn create_chat_model_routes_anthropic_auth_cloud_slug_to_crate_native() {
identity.starts_with("anthropic:https://api.anthropic.com/v1:claude-sonnet-4-6"),
"expected the native Messages adapter, got identity {identity}"
);
- assert!(model
- .profile()
- .is_some_and(|p| p.tool_calling && p.streaming));
+ assert!(
+ model
+ .profile()
+ .is_some_and(|p| p.tool_calling && p.streaming)
+ );
}
/// Text mode (prompt-guided tools) is only implemented on the Chat Completions
diff --git a/crates/openhuman-core/src/inference/provider/factory_tests.rs b/crates/openhuman-core/src/inference/provider/factory_tests.rs
index 051672c51a..16a95856fb 100644
--- a/crates/openhuman-core/src/inference/provider/factory_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_tests.rs
@@ -1,6 +1,6 @@
use super::*;
-use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};
use crate::config::Config;
+use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};
use crate::security::credentials::AuthService;
use tempfile::TempDir;
@@ -153,7 +153,7 @@ fn deepseek_entry(id: &str) -> CloudProviderCreds {
/// A config carrying a resolved model, as `agent_chat` leaves it after applying
/// `model_override` and before building the agent.
fn routed_config(endpoint: &str, api_key: &str, model: &str) -> Config {
- use crate::config::schema::ephemeral_route::{apply, EphemeralRoute};
+ use crate::config::schema::ephemeral_route::{EphemeralRoute, apply};
let mut config = Config {
default_model: Some(model.to_string()),
..Config::default()
diff --git a/crates/openhuman-core/src/inference/provider/mod.rs b/crates/openhuman-core/src/inference/provider/mod.rs
index 0d0436c07e..1cd4c509e6 100644
--- a/crates/openhuman-core/src/inference/provider/mod.rs
+++ b/crates/openhuman-core/src/inference/provider/mod.rs
@@ -9,29 +9,29 @@ pub mod error_classify;
pub mod error_code;
pub mod factory;
pub(crate) mod fallback_diagnostics;
+pub(crate) mod model;
pub(crate) mod openai_codex;
/// Crate-native managed OpenHuman backend as a host `ChatModel` (issue #4727).
pub mod openhuman_backend_model;
pub mod ops;
-pub(crate) mod model;
pub mod types;
#[allow(unused_imports)]
-pub use types::{BilledUsage, ChatResponse, ProviderDelta, AGENT_TURN_MAX_OUTPUT_TOKENS};
+pub use types::{AGENT_TURN_MAX_OUTPUT_TOKENS, BilledUsage, ChatResponse, ProviderDelta};
pub use error_code::{
- backend_error_code_skips_sentry, body_flags_malformed, extract_backend_error_code,
- extract_backend_error_code_token, is_backend_client_guard_leak,
+ BackendErrorCode, backend_error_code_skips_sentry, body_flags_malformed,
+ extract_backend_error_code, extract_backend_error_code_token, is_backend_client_guard_leak,
is_backend_malformed_bad_request, is_managed_backend_envelope, managed_error_skips_sentry,
- BackendErrorCode,
};
#[cfg(feature = "flows")]
pub(crate) use factory::is_raw_passthrough_model;
pub use factory::{
- create_chat_model_from_string, create_chat_model_from_string_with_model_id,
- create_chat_model_in, create_chat_model_with_model_id_in, probe_inference_readiness,
- provider_for_role, role_for_model_tier, BYOK_INCOMPLETE_SENTINEL,
+ BYOK_INCOMPLETE_SENTINEL, create_chat_model_from_string,
+ create_chat_model_from_string_with_model_id, create_chat_model_in,
+ create_chat_model_with_model_id_in, probe_inference_readiness, provider_for_role,
+ role_for_model_tier,
};
pub use openhuman_backend_model::{OpenHumanBackendModel, PROVIDER_LABEL};
pub use ops::*;
diff --git a/crates/openhuman-core/src/inference/provider/openai_codex.rs b/crates/openhuman-core/src/inference/provider/openai_codex.rs
index 96bdb4c99c..e7d020464e 100644
--- a/crates/openhuman-core/src/inference/provider/openai_codex.rs
+++ b/crates/openhuman-core/src/inference/provider/openai_codex.rs
@@ -1,6 +1,6 @@
use crate::config::Config;
use tinyinference_llm::providers::openai::codex::{
- OpenAiCodexRouting, OPENAI_CODEX_BACKEND_BASE_URL,
+ OPENAI_CODEX_BACKEND_BASE_URL, OpenAiCodexRouting,
};
pub(crate) fn resolve_openai_codex_routing(
@@ -19,8 +19,8 @@ pub(crate) fn resolve_openai_codex_routing(
Ok(credentials) => credentials,
Err(err) if !bearer_key.trim().is_empty() => {
log::warn!(
- "[providers][openai-codex] oauth metadata unavailable; continuing with standard bearer key: {err}"
- );
+ "[providers][openai-codex] oauth metadata unavailable; continuing with standard bearer key: {err}"
+ );
None
}
Err(err) => return Err(format!("[chat-factory] openai oauth lookup failed: {err}")),
diff --git a/crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs b/crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs
index d7b2caeefa..948f52855c 100644
--- a/crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs
+++ b/crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs
@@ -28,17 +28,17 @@ use serde_json::Value;
use std::path::PathBuf;
use std::time::Duration;
+use tinyinference_llm::Error as TiError;
use tinyinference_llm::message::Message;
use tinyinference_llm::model::{
ChatModel, Modalities, ModelProfile, ModelRequest, ModelResponse, ModelStream, ModelStreamItem,
ProviderError,
};
-use tinyinference_llm::providers::openai::OpenAiModel;
use tinyinference_llm::providers::ProviderRequestOptions;
-use tinyinference_llm::Error as TiError;
+use tinyinference_llm::providers::openai::OpenAiModel;
use super::ProviderRuntimeOptions;
-use crate::security::credentials::{AuthService, APP_SESSION_PROVIDER};
+use crate::security::credentials::{APP_SESSION_PROVIDER, AuthService};
pub const PROVIDER_LABEL: &str = "OpenHuman";
@@ -510,7 +510,7 @@ fn managed_bearer(
check: crate::security::credentials::session_support::SessionTokenCheck,
) -> anyhow::Result<String> {
use crate::security::credentials::session_support::{
- is_local_session_token, SessionTokenCheck, LOCAL_SESSION_MANAGED_INFERENCE_UNAVAILABLE,
+ LOCAL_SESSION_MANAGED_INFERENCE_UNAVAILABLE, SessionTokenCheck, is_local_session_token,
};
match check {
diff --git a/crates/openhuman-core/src/inference/provider/openhuman_backend_model_auth_tests.rs b/crates/openhuman-core/src/inference/provider/openhuman_backend_model_auth_tests.rs
index e3d4332286..9a8a9e9df6 100644
--- a/crates/openhuman-core/src/inference/provider/openhuman_backend_model_auth_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/openhuman_backend_model_auth_tests.rs
@@ -7,7 +7,7 @@ use super::*;
#[test]
fn the_offline_local_session_cannot_authenticate_managed_inference() {
use crate::security::credentials::session_support::{
- SessionTokenCheck, LOCAL_SESSION_MANAGED_INFERENCE_UNAVAILABLE,
+ LOCAL_SESSION_MANAGED_INFERENCE_UNAVAILABLE, SessionTokenCheck,
};
let error = managed_bearer(SessionTokenCheck::Live("header.payload.local".to_string()))
diff --git a/crates/openhuman-core/src/inference/provider/openhuman_backend_model_offline_session_tests.rs b/crates/openhuman-core/src/inference/provider/openhuman_backend_model_offline_session_tests.rs
index 2aa9f0bf26..042fe089d4 100644
--- a/crates/openhuman-core/src/inference/provider/openhuman_backend_model_offline_session_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/openhuman_backend_model_offline_session_tests.rs
@@ -5,7 +5,7 @@ use super::*;
#[test]
fn the_offline_local_session_cannot_authenticate_managed_inference() {
use crate::security::credentials::session_support::{
- SessionTokenCheck, LOCAL_SESSION_MANAGED_INFERENCE_UNAVAILABLE,
+ LOCAL_SESSION_MANAGED_INFERENCE_UNAVAILABLE, SessionTokenCheck,
};
let error = managed_bearer(SessionTokenCheck::Live("header.payload.local".to_string()))
diff --git a/crates/openhuman-core/src/inference/provider/openhuman_backend_model_tests.rs b/crates/openhuman-core/src/inference/provider/openhuman_backend_model_tests.rs
index 6049879da9..dc7ee0c49f 100644
--- a/crates/openhuman-core/src/inference/provider/openhuman_backend_model_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/openhuman_backend_model_tests.rs
@@ -193,7 +193,7 @@ fn is_provider_not_configured_error_rejects_non_400_status() {
fn seed_app_session(dir: &std::path::Path) {
use crate::security::credentials::{
- AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME,
+ APP_SESSION_PROVIDER, AuthService, DEFAULT_AUTH_PROFILE_NAME,
};
AuthService::new(dir, false)
.store_provider_token(
@@ -211,8 +211,8 @@ fn seed_app_session(dir: &std::path::Path) {
/// can be exercised without a live backend.
fn seed_app_session_with_expiry(dir: &std::path::Path, expires_at: &str) {
use crate::security::credentials::{
- session_support::SESSION_EXPIRES_AT_META, AuthService, APP_SESSION_PROVIDER,
- DEFAULT_AUTH_PROFILE_NAME,
+ APP_SESSION_PROVIDER, AuthService, DEFAULT_AUTH_PROFILE_NAME,
+ session_support::SESSION_EXPIRES_AT_META,
};
let mut metadata = std::collections::HashMap::new();
metadata.insert(SESSION_EXPIRES_AT_META.to_string(), expires_at.to_string());
diff --git a/crates/openhuman-core/src/inference/provider/openhuman_backend_model_usage_tests.rs b/crates/openhuman-core/src/inference/provider/openhuman_backend_model_usage_tests.rs
index 5e10639fa2..d3191e4be4 100644
--- a/crates/openhuman-core/src/inference/provider/openhuman_backend_model_usage_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/openhuman_backend_model_usage_tests.rs
@@ -83,12 +83,14 @@ fn project_managed_usage_is_noop_without_envelope() {
let projected = project_managed_usage(response);
// raw keeps only the wire fields — no meta key injected.
- assert!(projected
- .raw
- .as_ref()
- .unwrap()
- .get("openhuman_usage_meta")
- .is_none());
+ assert!(
+ projected
+ .raw
+ .as_ref()
+ .unwrap()
+ .get("openhuman_usage_meta")
+ .is_none()
+ );
let usage = usage_info_from_response(&projected).expect("usage present");
assert_eq!(usage.charged_amount_usd, 0.0);
assert_eq!(usage.cache_read_tokens, 3, "crate cached preserved");
diff --git a/crates/openhuman-core/src/inference/provider/ops/http_error.rs b/crates/openhuman-core/src/inference/provider/ops/http_error.rs
index ae957469c6..f4470eb2ae 100644
--- a/crates/openhuman-core/src/inference/provider/ops/http_error.rs
+++ b/crates/openhuman-core/src/inference/provider/ops/http_error.rs
@@ -11,7 +11,7 @@ mod tests;
use crate::inference::provider::openhuman_backend_model;
use tinyinference_core::sanitize::sanitize_api_error;
use tinyinference_llm::failure::http::{
- classify_and_report_http_failure, ErrorReporter, ProviderHttpFailure, ProviderHttpFailureFacts,
+ ErrorReporter, ProviderHttpFailure, ProviderHttpFailureFacts, classify_and_report_http_failure,
};
use tinyinference_llm::failure::{
local_provider_no_model_loaded_user_message, ollama_cloud_internal_500_user_message,
diff --git a/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs b/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs
index 1a085714dd..da64300843 100644
--- a/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs
@@ -68,10 +68,11 @@ async fn api_error_replaces_no_model_loaded_body_with_guidance() {
),
)
.await;
- assert!(err
- .to_string()
- .to_ascii_lowercase()
- .contains("load a model"));
+ assert!(
+ err.to_string()
+ .to_ascii_lowercase()
+ .contains("load a model")
+ );
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/inference/provider/ops/mod.rs b/crates/openhuman-core/src/inference/provider/ops/mod.rs
index 0bfdcce991..45f7172c48 100644
--- a/crates/openhuman-core/src/inference/provider/ops/mod.rs
+++ b/crates/openhuman-core/src/inference/provider/ops/mod.rs
@@ -24,7 +24,7 @@ pub use models::{
};
pub use provider_factory::{
- list_providers, ProviderInfo, ProviderRuntimeOptions, INFERENCE_BACKEND_ID,
+ INFERENCE_BACKEND_ID, ProviderInfo, ProviderRuntimeOptions, list_providers,
};
// ── test re-exports for ops_tests.rs ──
diff --git a/crates/openhuman-core/src/inference/provider/ops/models.rs b/crates/openhuman-core/src/inference/provider/ops/models.rs
index baeeb2b554..53ae06cfbf 100644
--- a/crates/openhuman-core/src/inference/provider/ops/models.rs
+++ b/crates/openhuman-core/src/inference/provider/ops/models.rs
@@ -16,8 +16,8 @@
use super::super::openai_codex::resolve_openai_codex_routing;
use tinyinference_core::sanitize::sanitize_api_error;
use tinyinference_llm::providers::openai::codex::{
- openai_codex_client_version, openai_codex_user_agent, OpenAiCodexRouting,
OPENAI_CODEX_ACCOUNT_HEADER, OPENAI_CODEX_ORIGINATOR, OPENAI_CODEX_ORIGINATOR_HEADER,
+ OpenAiCodexRouting, openai_codex_client_version, openai_codex_user_agent,
};
mod catalog_listing;
@@ -25,8 +25,8 @@ mod local_runtime;
mod managed_provider;
mod openrouter;
use tinyinference_llm::catalog::{
- append_query_param, endpoint_hosts_models_listing, is_openrouter_provider,
- merge_openai_codex_model_hints, parse_models_response, ModelInfo,
+ ModelInfo, append_query_param, endpoint_hosts_models_listing, is_openrouter_provider,
+ merge_openai_codex_model_hints, parse_models_response,
};
#[cfg(test)]
diff --git a/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rs b/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rs
index 2d154b97d3..1ac5353f85 100644
--- a/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rs
+++ b/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rs
@@ -160,8 +160,8 @@ pub async fn list_configured_models_from_config(
// A store error still propagates; only a genuinely absent/expired
// session degrades to an empty list.
use crate::security::credentials::session_support::{
- classify_session_token, load_app_session_profile, publish_local_session_expiry,
- SessionTokenCheck,
+ SessionTokenCheck, classify_session_token, load_app_session_profile,
+ publish_local_session_expiry,
};
let profile = load_app_session_profile(config)?;
match classify_session_token(profile.as_ref(), chrono::Utc::now()) {
diff --git a/crates/openhuman-core/src/inference/provider/ops_tests.rs b/crates/openhuman-core/src/inference/provider/ops_tests.rs
index 1d06c87593..a8279b5228 100644
--- a/crates/openhuman-core/src/inference/provider/ops_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/ops_tests.rs
@@ -1,21 +1,21 @@
use super::*;
-use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};
use crate::config::Config;
+use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};
use crate::security::credentials::AuthService;
use axum::{
+ Json, Router,
extract::State,
http::{HeaderMap, StatusCode},
response::{IntoResponse, Response},
routing::get,
- Json, Router,
};
use std::collections::HashMap;
use std::sync::{
- atomic::{AtomicUsize, Ordering as AtomicOrdering},
Arc, Mutex,
+ atomic::{AtomicUsize, Ordering as AtomicOrdering},
};
use tempfile::TempDir;
-use tinyinference_core::sanitize::{sanitize_api_error, MAX_API_ERROR_CHARS};
+use tinyinference_core::sanitize::{MAX_API_ERROR_CHARS, sanitize_api_error};
#[derive(Clone)]
struct ModelProbeState {
diff --git a/crates/openhuman-core/src/inference/provider/ops_tests_error_suppression_tests.rs b/crates/openhuman-core/src/inference/provider/ops_tests_error_suppression_tests.rs
index 369fc61a4c..b45813d158 100644
--- a/crates/openhuman-core/src/inference/provider/ops_tests_error_suppression_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/ops_tests_error_suppression_tests.rs
@@ -6,8 +6,8 @@ fn list_configured_models_accepts_slug() {
// passes a slug instead of the opaque random id. This lets the frontend
// call the RPC before the provider config has been persisted (where only
// the slug is stable).
- use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};
use crate::config::Config;
+ use crate::config::schema::cloud_providers::{AuthStyle, CloudProviderCreds};
let mut config = Config::default();
config.cloud_providers.push(CloudProviderCreds {
@@ -207,8 +207,7 @@ mod provider_config_rejection_suppression {
use super::super::*;
// The exact #2079 Sentry body shape.
- const TIER_LEAK_BODY: &str =
- "The supported API model names are deepseek-v4-pro or deepseek-v4-flash, \
+ const TIER_LEAK_BODY: &str = "The supported API model names are deepseek-v4-pro or deepseek-v4-flash, \
but you passed reasoning-v1.";
// #2076 Moonshot Kimi K2 temperature constraint.
const TEMP_BODY: &str = "invalid temperature: only 1 is allowed for this model";
@@ -350,7 +349,14 @@ mod provider_config_rejection_suppression {
// Verbatim wire body from TAURI-RUST-4XK Sentry issue 5338.
let body = r#"ollama API error (403 Forbidden): {"error":"this model requires a subscription, upgrade for access: https://ollama.com/upgrade (ref: bc48f3c8-fba1-40b6-93a9-786a167d16f9)"}"#;
assert!(
- config_rejection_demoted(&tinyinference_llm::failure::http::classify_http_failure("ollama", reqwest::StatusCode::FORBIDDEN.as_u16(), body), "ollama"),
+ config_rejection_demoted(
+ &tinyinference_llm::failure::http::classify_http_failure(
+ "ollama",
+ reqwest::StatusCode::FORBIDDEN.as_u16(),
+ body
+ ),
+ "ollama"
+ ),
"TAURI-RUST-4XK: ollama 403 subscription-gate must be classified as provider config-rejection"
);
}
diff --git a/crates/openhuman-core/src/inference/schemas.rs b/crates/openhuman-core/src/inference/schemas.rs
index ed118f3f28..b871d5bbd8 100644
--- a/crates/openhuman-core/src/inference/schemas.rs
+++ b/crates/openhuman-core/src/inference/schemas.rs
@@ -14,9 +14,9 @@ mod settings_handlers;
use serde::de::DeserializeOwned;
use serde_json::{Map, Value};
-use crate::core::all::RegisteredController;
use crate::core::ControllerSchema;
use crate::core::Outcome;
+use crate::core::all::RegisteredController;
pub use catalog::schemas;
use claude_code_handlers::*;
diff --git a/crates/openhuman-core/src/inference/schemas/catalog.rs b/crates/openhuman-core/src/inference/schemas/catalog.rs
index 968dd37cd4..cfad8ddda4 100644
--- a/crates/openhuman-core/src/inference/schemas/catalog.rs
+++ b/crates/openhuman-core/src/inference/schemas/catalog.rs
@@ -9,7 +9,10 @@ pub fn schemas(function: &str) -> ControllerSchema {
namespace: "inference",
function: "resolve_model",
description: "Resolve a model hint or tier name to the concrete model the provider router would use.",
- inputs: vec![required_string("hint", "Model hint (e.g. hint:reasoning) or a concrete model id.")],
+ inputs: vec![required_string(
+ "hint",
+ "Model hint (e.g. hint:reasoning) or a concrete model id.",
+ )],
outputs: vec![
json_output("model", "Resolved concrete model id."),
json_output(
@@ -30,7 +33,10 @@ pub fn schemas(function: &str) -> ControllerSchema {
function: "get_client_config",
description: "Read the client-facing inference/provider config used by the AI settings UI.",
inputs: vec![],
- outputs: vec![json_output("config", "Client-facing inference config payload.")],
+ outputs: vec![json_output(
+ "config",
+ "Client-facing inference config payload.",
+ )],
},
"update_model_settings" => ControllerSchema {
namespace: "inference",
@@ -39,20 +45,53 @@ pub fn schemas(function: &str) -> ControllerSchema {
inputs: vec![
optional_string("api_url", "Optional OpenHuman product backend URL."),
optional_string("inference_url", "Optional custom inference base URL."),
- optional_string("api_key", "Optional API key for a custom inference endpoint."),
+ optional_string(
+ "api_key",
+ "Optional API key for a custom inference endpoint.",
+ ),
optional_string("default_model", "Optional default model override."),
- optional_f64("default_temperature", "Optional default temperature override."),
- optional_json("model_routes", "Optional full replacement for legacy model routes."),
- optional_json("cloud_providers", "Optional full replacement for configured cloud providers."),
- optional_json("model_registry", "Optional full replacement for the per-model registry (carries each model's `vision` flag)."),
+ optional_f64(
+ "default_temperature",
+ "Optional default temperature override.",
+ ),
+ optional_json(
+ "model_routes",
+ "Optional full replacement for legacy model routes.",
+ ),
+ optional_json(
+ "cloud_providers",
+ "Optional full replacement for configured cloud providers.",
+ ),
+ optional_json(
+ "model_registry",
+ "Optional full replacement for the per-model registry (carries each model's `vision` flag).",
+ ),
optional_string("primary_cloud", "Optional primary cloud provider id."),
optional_string("chat_provider", "Optional chat workload provider string."),
- optional_string("reasoning_provider", "Optional reasoning workload provider string."),
- optional_string("agentic_provider", "Optional agentic workload provider string."),
- optional_string("coding_provider", "Optional coding workload provider string."),
- optional_string("vision_provider", "Optional vision / multimodal workload provider string."),
- optional_string("memory_provider", "Optional memory workload provider string."),
- optional_string("embeddings_provider", "Optional embeddings workload provider string."),
+ optional_string(
+ "reasoning_provider",
+ "Optional reasoning workload provider string.",
+ ),
+ optional_string(
+ "agentic_provider",
+ "Optional agentic workload provider string.",
+ ),
+ optional_string(
+ "coding_provider",
+ "Optional coding workload provider string.",
+ ),
+ optional_string(
+ "vision_provider",
+ "Optional vision / multimodal workload provider string.",
+ ),
+ optional_string(
+ "memory_provider",
+ "Optional memory workload provider string.",
+ ),
+ optional_string(
+ "embeddings_provider",
+ "Optional embeddings workload provider string.",
+ ),
],
outputs: vec![json_output("snapshot", "Updated config snapshot.")],
},
@@ -61,9 +100,18 @@ pub fn schemas(function: &str) -> ControllerSchema {
function: "update_local_settings",
description: "Persist local inference provider selection, endpoint URL, and local-runtime routing flags.",
inputs: vec![
- optional_bool("runtime_enabled", "Enable or disable local inference runtime routing."),
- optional_bool("opt_in_confirmed", "Persist the local inference opt-in flag."),
- optional_string("provider", "Optional local provider slug, e.g. ollama or lm_studio."),
+ optional_bool(
+ "runtime_enabled",
+ "Enable or disable local inference runtime routing.",
+ ),
+ optional_bool(
+ "opt_in_confirmed",
+ "Persist the local inference opt-in flag.",
+ ),
+ optional_string(
+ "provider",
+ "Optional local provider slug, e.g. ollama or lm_studio.",
+ ),
optional_json(
"base_url",
"Optional local provider base URL string, or null to clear.",
@@ -74,7 +122,10 @@ pub fn schemas(function: &str) -> ControllerSchema {
),
optional_string("model_id", "Optional generic model id override."),
optional_string("chat_model_id", "Optional chat model id override."),
- optional_bool("usage_embeddings", "Whether embeddings workload may use the local provider."),
+ optional_bool(
+ "usage_embeddings",
+ "Whether embeddings workload may use the local provider.",
+ ),
],
outputs: vec![json_output("snapshot", "Updated config snapshot.")],
},
@@ -82,7 +133,10 @@ pub fn schemas(function: &str) -> ControllerSchema {
namespace: "inference",
function: "list_models",
description: "Fetch the available model list from a configured inference provider's /models API.",
- inputs: vec![required_string("provider_id", "Opaque id of the cloud provider entry to query.")],
+ inputs: vec![required_string(
+ "provider_id",
+ "Opaque id of the cloud provider entry to query.",
+ )],
outputs: vec![json_output("models", "Provider model list payload.")],
},
"provider_auth_errors" => ControllerSchema {
@@ -190,9 +244,18 @@ pub fn schemas(function: &str) -> ControllerSchema {
function: "test_provider_model",
description: "Run a one-off Hello-world style test against an explicit provider:model binding without saving routing changes.",
inputs: vec![
- required_string("workload", "Workload id context (chat, reasoning, coding, etc.)."),
- required_string("provider", "Explicit provider string like 'openai:gpt-4o' or 'ollama:llama3.1:8b'."),
- optional_string("prompt", "Optional prompt text to send; defaults to 'Hello world'."),
+ required_string(
+ "workload",
+ "Workload id context (chat, reasoning, coding, etc.).",
+ ),
+ required_string(
+ "provider",
+ "Explicit provider string like 'openai:gpt-4o' or 'ollama:llama3.1:8b'.",
+ ),
+ optional_string(
+ "prompt",
+ "Optional prompt text to send; defaults to 'Hello world'.",
+ ),
],
outputs: vec![json_output("reply", "Assistant reply text.")],
},
@@ -200,7 +263,10 @@ pub fn schemas(function: &str) -> ControllerSchema {
namespace: "inference",
function: "analyze_sentiment",
description: "Classify the emotion and valence of a user message with the inference provider.",
- inputs: vec![required_string("message", "User message content to classify.")],
+ inputs: vec![required_string(
+ "message",
+ "User message content to classify.",
+ )],
outputs: vec![json_output("sentiment", "Sentiment analysis payload.")],
},
"claude_code_status" => ControllerSchema {
diff --git a/crates/openhuman-core/src/inference/schemas/claude_code_handlers.rs b/crates/openhuman-core/src/inference/schemas/claude_code_handlers.rs
index 36a30f0204..91991a080f 100644
--- a/crates/openhuman-core/src/inference/schemas/claude_code_handlers.rs
+++ b/crates/openhuman-core/src/inference/schemas/claude_code_handlers.rs
@@ -6,8 +6,8 @@ use serde::Deserialize;
use serde_json::{Map, Value};
use super::{deserialize_params, to_json};
-use crate::core::all::ControllerFuture;
use crate::core::Outcome;
+use crate::core::all::ControllerFuture;
#[derive(Debug, Deserialize)]
pub(super) struct InferenceClaudeCodeSetFullAccessParams {
diff --git a/crates/openhuman-core/src/inference/schemas/settings_handlers.rs b/crates/openhuman-core/src/inference/schemas/settings_handlers.rs
index 127e93b7e1..843753bc1a 100644
--- a/crates/openhuman-core/src/inference/schemas/settings_handlers.rs
+++ b/crates/openhuman-core/src/inference/schemas/settings_handlers.rs
@@ -3,14 +3,14 @@
//! auth errors, and diagnostics.
use crate::core::runtime::DispatchCtx;
-use serde::de::Deserializer;
use serde::Deserialize;
+use serde::de::Deserializer;
use serde_json::{Map, Value};
use super::{deserialize_params, to_json};
use crate::config::rpc as config_rpc;
-use crate::core::all::ControllerFuture;
use crate::core::Outcome;
+use crate::core::all::ControllerFuture;
#[derive(Debug, Deserialize)]
pub(super) struct InferenceResolveModelParams {
diff --git a/crates/openhuman-core/src/inference/tokenjuice/focus.rs b/crates/openhuman-core/src/inference/tokenjuice/focus.rs
index 636669d56b..568c4301a5 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/focus.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/focus.rs
@@ -8,7 +8,7 @@
use serde_json::Value;
-use tinyjuice_bus::tools::{summary_focus_property, SUMMARY_FOCUS_ARG};
+use tinyjuice_bus::tools::{SUMMARY_FOCUS_ARG, summary_focus_property};
/// Whether a tool's parameter schema declares TinyJuice's `summary_focus`,
/// as opposed to a parameter of its own that happens to share the name.
diff --git a/crates/openhuman-core/src/inference/tokenjuice/focus_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/focus_tests.rs
index 33180e7a1c..351fc7c29f 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/focus_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/focus_tests.rs
@@ -33,10 +33,12 @@ fn arguments_without_a_focus_are_untouched() {
fn the_property_is_an_optional_string() {
let property = summary_focus_property();
assert_eq!(property["type"], "string");
- assert!(property["description"]
- .as_str()
- .unwrap()
- .contains("summarized"));
+ assert!(
+ property["description"]
+ .as_str()
+ .unwrap()
+ .contains("summarized")
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
index d48777c017..323ad90317 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
@@ -49,9 +49,11 @@ async fn the_module_defers_a_summary_until_requested() {
.await;
assert_eq!(output.summarized_from_bytes, None);
- assert!(!output
- .text
- .contains("the rate limit is 60 requests a minute"));
+ assert!(
+ !output
+ .text
+ .contains("the rate limit is 60 requests a minute")
+ );
assert!(
output.text.contains(tinyjuice_bus::tools::RETRIEVE),
"the original stays retrievable: {}",
diff --git a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
index a9c9096167..5fc464f441 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
@@ -263,7 +263,7 @@ impl ModuleReplTool {
Err(error) => {
return Ok(ToolResult::error(format!(
"juice: invalid arguments: {error}"
- )))
+ )));
}
};
let response = self
@@ -364,7 +364,7 @@ impl Tool for ModuleReplTool {
let handle = match handle::classify(raw) {
handle::HandleArg::Handle(handle) => handle,
handle::HandleArg::Path(path) => {
- return self.execute_on_artifact(&ctx, path, args).await
+ return self.execute_on_artifact(&ctx, path, args).await;
}
handle::HandleArg::Invalid => {
log::debug!("[tokenjuice][repl] {} rejected a non-handle", self.name);
diff --git a/crates/openhuman-core/src/inference/tokenjuice/schemas.rs b/crates/openhuman-core/src/inference/tokenjuice/schemas.rs
index e1b731f099..512826a1ff 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/schemas.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/schemas.rs
@@ -69,8 +69,7 @@ pub fn schemas(function: &str) -> ControllerSchema {
"detect" => ControllerSchema {
namespace: "tokenjuice",
function: "detect",
- description:
- "Detect the content kind of a blob (json/code/log/search/diff/html/plain_text).",
+ description: "Detect the content kind of a blob (json/code/log/search/diff/html/plain_text).",
inputs: vec![
FieldSchema {
name: "content",
diff --git a/crates/openhuman-core/src/inference/tokenjuice/tools.rs b/crates/openhuman-core/src/inference/tokenjuice/tools.rs
index e757e6e143..44de5738b8 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/tools.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/tools.rs
@@ -9,7 +9,7 @@
//! Read-only, no side effects, no path/network access.
use async_trait::async_trait;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use tinytools::{PermissionLevel, Tool, ToolResult};
use {tinyjuice_bus::wire::RangeUnit, tinyjuice_bus::wire::RetrieveRange};
diff --git a/vendor/tinyagents b/vendor/tinyagents
index 2ed631a030..75cdc82dae 160000
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@ -1 +1 @@
-Subproject commit 2ed631a030c3383b813b84013a5c4fbc86f3a186
+Subproject commit 75cdc82dae2ec92cec28125053805da0fe8ebbae