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
refactor(core): import DispatchCtx instead of using fully qualified paths
Steven Enamakelfa3f1a9dc690
diff --git a/crates/openhuman-core/src/channels/host/adapters.rs b/crates/openhuman-core/src/channels/host/adapters.rsindex b500b70c4c..b37e936882 100644--- a/crates/openhuman-core/src/channels/host/adapters.rs+++ b/crates/openhuman-core/src/channels/host/adapters.rs@@ -4,6 +4,7 @@//! voice, persistence, allowlist, and event operations. The legacy portable//! provider-trait adapters below exist only for unit-test compatibility.+use crate::core::runtime::DispatchCtx;use std::sync::Arc;#[cfg(test)]@@ -208,7 +209,7 @@ impl ConversationStore for ConversationHistoryStore {session_key: &str,limit: usize,) -> anyhow::Result<Vec<ConversationMessage>> {- let messages = crate::threads::store::get_messages(&crate::core::runtime::DispatchCtx::ambient(), self.workspace_dir.clone(), session_key)+ let messages = crate::threads::store::get_messages(&DispatchCtx::ambient(), self.workspace_dir.clone(), session_key).map_err(|e| anyhow::anyhow!(e))?;let start = messages.len().saturating_sub(limit);Ok(messages[start..]@@ -225,7 +226,7 @@ impl ConversationStore for ConversationHistoryStore {let now = chrono::Utc::now().to_rfc3339();// `append_message` requires the thread to exist; create-or-noop first.crate::threads::store::ensure_thread(- &crate::core::runtime::DispatchCtx::ambient(),+ &DispatchCtx::ambient(),self.workspace_dir.clone(),crate::threads::store::CreateConversationThread {id: session_key.to_string(),@@ -246,7 +247,7 @@ impl ConversationStore for ConversationHistoryStore {sender: message.role,created_at: now,};- crate::threads::store::append_message(&crate::core::runtime::DispatchCtx::ambient(), self.workspace_dir.clone(), session_key, stored)+ crate::threads::store::append_message(&DispatchCtx::ambient(), self.workspace_dir.clone(), session_key, stored).map_err(|e| anyhow::anyhow!(e))?;Ok(())}diff --git a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rsindex 170f511d1a..b140635ce8 100644--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs@@ -11,6 +11,7 @@//! - Channel origin: the reply is sent to the origin's reply target, then//! appended to that chat's history so its next turn sees it.+use crate::core::runtime::DispatchCtx;use super::delivery::strip_openhuman_link_markup;use crate::config::Config;use crate::web_chat::{publish_web_channel_event, WebChannelEvent};@@ -236,7 +237,7 @@ async fn deliver_to_web_thread(let persist_thread = thread_id.to_string();let persist_request = request_id.clone();let persist_text = text.to_string();- let persist_ctx = crate::core::runtime::DispatchCtx::ambient();+ let persist_ctx = DispatchCtx::ambient();crate::core::runtime::spawn_blocking_scoped(move || {crate::web_chat::persist_delivered_reply(&persist_ctx,diff --git a/crates/openhuman-core/src/voice/live/persist.rs b/crates/openhuman-core/src/voice/live/persist.rsindex c5780c9b7c..1f9d22a8b2 100644--- a/crates/openhuman-core/src/voice/live/persist.rs+++ b/crates/openhuman-core/src/voice/live/persist.rs@@ -5,6 +5,7 @@//! no-op and the UI can refresh the thread to show it. Partial transcripts and//! tool traffic are not stored.+use crate::core::runtime::DispatchCtx;use std::path::PathBuf;use serde_json::json;@@ -75,7 +76,7 @@ impl TranscriptPersister {};let id = message.id.clone();match crate::threads::store::blocking::append_message(- crate::core::runtime::DispatchCtx::ambient(),+ DispatchCtx::ambient(),self.workspace_dir.clone(),self.thread_id.clone(),message,diff --git a/crates/openhuman-core/src/voice/live/session.rs b/crates/openhuman-core/src/voice/live/session.rsindex 05bbe60dd3..d6783188bb 100644--- a/crates/openhuman-core/src/voice/live/session.rs+++ b/crates/openhuman-core/src/voice/live/session.rs@@ -7,6 +7,7 @@//! `voice` external-channel origin and an approval chat context for the//! thread, so approval prompts reach the user's open conversation.+use crate::core::runtime::DispatchCtx;use std::sync::Arc;use tinyagents_harness::context::RunConfig;@@ -101,7 +102,7 @@ async fn ensure_thread(.filter(|t| !t.trim().is_empty()).unwrap_or_else(|| format!("voice-{}", uuid::Uuid::new_v4()));crate::threads::store::blocking::ensure_thread(- crate::core::runtime::DispatchCtx::ambient(),+ DispatchCtx::ambient(),config.workspace_dir.clone(),CreateConversationThread {id: id.clone(),@@ -140,7 +141,7 @@ pub(crate) async fn start(let harness = assemble_live_tool_harness(host.live_tool_surface());let recent = crate::threads::store::blocking::get_messages(- crate::core::runtime::DispatchCtx::ambient(),+ DispatchCtx::ambient(),config.workspace_dir.clone(),thread_id.clone(),)diff --git a/tests/in_process/transcript_search_e2e.rs b/tests/in_process/transcript_search_e2e.rsindex 8b32cc0ab9..b226185111 100644--- a/tests/in_process/transcript_search_e2e.rs+++ b/tests/in_process/transcript_search_e2e.rs@@ -110,7 +110,7 @@ async fn transcript_search_op_finds_message_in_prior_thread() {let _ws = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", &workspace);seed_workspace(&workspace);- let hits = transcript_search(openhuman_core::core::runtime::DispatchCtx::ambient(), "Postgres migration script", 10, None)+ let hits = transcript_search(&openhuman_core::core::runtime::DispatchCtx::ambient(), "Postgres migration script", 10, None).await.expect("transcript_search op");@@ -141,7 +141,7 @@ async fn transcript_search_op_honours_exclude_thread() {let _ws = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", &workspace);seed_workspace(&workspace);- let hits = transcript_search(openhuman_core::core::runtime::DispatchCtx::ambient(), "migration", 10, Some("thread-pg"))+ let hits = transcript_search(&openhuman_core::core::runtime::DispatchCtx::ambient(), "migration", 10, Some("thread-pg")).await.expect("transcript_search op");@@ -162,7 +162,7 @@ async fn transcript_search_op_returns_empty_on_no_match() {let _ws = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", &workspace);seed_workspace(&workspace);- let hits = transcript_search(openhuman_core::core::runtime::DispatchCtx::ambient(), "quantum chromodynamics zzz", 10, None)+ let hits = transcript_search(&openhuman_core::core::runtime::DispatchCtx::ambient(), "quantum chromodynamics zzz", 10, None).await.expect("transcript_search op");