The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: remove unused imports across core modules
Steven Enamakel17b4e23ef7b9
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rsindex 0bab80ecd2..620504c142 100644--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs@@ -253,7 +253,8 @@ impl OpenHumanSessionHost {// the crate registry `FallbackPolicy`, so `config.reliability.*` no longer// layers on the turn path (it still governs the non-seam provider paths).let (resolved_chat_model, mut model_name) =- crate::inference::provider::create_chat_model_with_model_id(+ crate::inference::provider::create_chat_model_with_model_id_in(+ ctx,provider_role,config,config.default_temperature,diff --git a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rsindex 1377e2654e..f1bd7a66c6 100644--- a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs@@ -106,7 +106,8 @@ pub(crate) fn build_channel_turn_parts(};let (model, provider_name) = match resolve_chat_workload(config) {ChatWorkloadResolution::Cloud => {- let (_chat, model) = provider::create_chat_model_with_model_id(+ let (_chat, model) = provider::create_chat_model_with_model_id_in(+ dispatch,"chat",config,config.default_temperature,@@ -122,7 +123,8 @@ pub(crate) fn build_channel_turn_parts(slug = %slug,"[channels][startup] chat workload routed to per-workload provider — building dedicated channel provider");- let (_chat, model_id) = provider::create_chat_model_with_model_id(+ let (_chat, model_id) = provider::create_chat_model_with_model_id_in(+ dispatch,"chat",config,config.default_temperature,diff --git a/crates/openhuman-core/src/cron/scheduler/agent_run.rs b/crates/openhuman-core/src/cron/scheduler/agent_run.rsindex 09a6b000a0..71af68fe89 100644--- a/crates/openhuman-core/src/cron/scheduler/agent_run.rs+++ b/crates/openhuman-core/src/cron/scheduler/agent_run.rs@@ -93,7 +93,8 @@ pub(super) async fn run_agent_job_for_run(// discarded — `create_chat_model_with_model_id` wraps the// same `create_chat_provider` resolution, so the model id is// identical; temperature is irrelevant to id resolution.- match crate::inference::provider::create_chat_model_with_model_id(+ match crate::inference::provider::create_chat_model_with_model_id_in(+ ctx,workload,&effective,effective.default_temperature,diff --git a/crates/openhuman-core/src/memory/lifecycle/date_hint.rs b/crates/openhuman-core/src/memory/lifecycle/date_hint.rsindex 59f7c58901..f92bf71f12 100644--- a/crates/openhuman-core/src/memory/lifecycle/date_hint.rs+++ b/crates/openhuman-core/src/memory/lifecycle/date_hint.rs@@ -23,9 +23,11 @@ const INSTRUCTION: &str = "Return the calendar date range (local dates) that the/// Not bounded here: the caller owns the deadline (`hooks::pre_turn` wraps/// it in the turn's pre-turn timeout), as tinymemory's `pre_turn_dated`/// requires of its hint.-pub async fn extract(config: &Config, user_text: &str, zone: &str) -> Option<TimeHint> {+pub async fn extract(+ ctx: &crate::core::runtime::DispatchCtx,+ config: &Config, user_text: &str, zone: &str) -> Option<TimeHint> {let (model, model_id) =- match crate::inference::provider::create_chat_model_with_model_id("chat", config, 0.0) {+ match crate::inference::provider::create_chat_model_with_model_id_in(ctx, "chat", config, 0.0) {Ok(model) => model,Err(error) => {tracing::debug!(%error, "[memory:date_hint] no chat model");diff --git a/crates/openhuman-core/src/memory/lifecycle/hooks.rs b/crates/openhuman-core/src/memory/lifecycle/hooks.rsindex b5b381c081..96f51dd7ec 100644--- a/crates/openhuman-core/src/memory/lifecycle/hooks.rs+++ b/crates/openhuman-core/src/memory/lifecycle/hooks.rs@@ -209,10 +209,11 @@ pub async fn pre_turn(let started = std::time::Instant::now();let agent_id = identity.agent_id.clone();let config = config.clone();+ let dispatch = ctx.clone();let identity = identity.clone();let thread = input.thread_id.clone();let task = crate::core::runtime::spawn_scoped(async move {- pre_turn_work(&config, &identity, input).await+ pre_turn_work(&dispatch, &config, &identity, input).await});let pack = match tokio::time::timeout(timeout, task).await {Ok(Ok(pack)) => pack,@@ -235,6 +236,7 @@ pub async fn pre_turn(/// The direct lifecycle operation for bounded background workers. Unlike the/// manual timeout wrapper, its future owns all I/O and can be cancelled.pub(crate) async fn pre_turn_work(+ ctx: &crate::core::runtime::DispatchCtx,config: &Config,identity: &ResolvedIdentity,input: PreTurnInput,@@ -271,12 +273,13 @@ pub(crate) async fn pre_turn_work(// the pack is still ranked and returned before the turn stops waiting.let date_hint = (recall && logging && config.memory.recall.date_hint).then(|| {let config = config.clone();+ let ctx = ctx.clone();let text = input.user_text.clone();let deadline =tokio::time::Instant::now() + timeout.saturating_sub(Duration::from_millis(100));async move {let zone = config.time_zone();- tokio::time::timeout_at(deadline, super::date_hint::extract(&config, &text, &zone))+ tokio::time::timeout_at(deadline, super::date_hint::extract(&ctx, &config, &text, &zone)).await.ok().flatten()diff --git a/crates/openhuman-core/src/memory/lifecycle/prefetch.rs b/crates/openhuman-core/src/memory/lifecycle/prefetch.rsindex 06291ae88f..e188b76d9c 100644--- a/crates/openhuman-core/src/memory/lifecycle/prefetch.rs+++ b/crates/openhuman-core/src/memory/lifecycle/prefetch.rs@@ -160,6 +160,7 @@ pub(crate) fn pre_turn(if let Some(pack) = &pack {crate::memory::tools::record_pack_citations(ctx, &input.thread_id, pack.citations.clone());}+ let dispatch = ctx.clone();enqueue(cache,key,@@ -176,7 +177,7 @@ pub(crate) fn pre_turn(.await;}}- hooks::pre_turn_work(&config, &identity, input).await+ hooks::pre_turn_work(&dispatch, &config, &identity, input).await})),),);diff --git a/crates/openhuman-core/src/threads/ops/title_generation.rs b/crates/openhuman-core/src/threads/ops/title_generation.rsindex ab54e32124..136f523a28 100644--- a/crates/openhuman-core/src/threads/ops/title_generation.rs+++ b/crates/openhuman-core/src/threads/ops/title_generation.rs@@ -129,7 +129,7 @@ pub async fn thread_generate_title(// reports the model this call actually dispatches on, and only the factory// knows what the `summarization` role resolved to for this configuration.let (chat_model, resolved_model) =- match provider::create_chat_model_with_model_id("summarization", &config, 0.2) {+ match provider::create_chat_model_with_model_id_in(ctx, "summarization", &config, 0.2) {Ok(resolved) => resolved,Err(error) => {tracing::warn!(diff --git a/crates/openhuman-core/src/web_chat/suggestions.rs b/crates/openhuman-core/src/web_chat/suggestions.rsindex 1926d7c7bc..301951d429 100644--- a/crates/openhuman-core/src/web_chat/suggestions.rs+++ b/crates/openhuman-core/src/web_chat/suggestions.rs@@ -137,7 +137,7 @@ async fn generate_and_emit(}let (chat_model, resolved_model) =- match provider::create_chat_model_with_model_id("summarization", &config, 0.2) {+ match provider::create_chat_model_with_model_id_in(ctx, "summarization", &config, 0.2) {Ok(resolved) => resolved,Err(error) => {log::debug!(