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(core): import DispatchCtx across agent and channel modules
Steven Enamakel325aa644c6f5
diff --git a/crates/openhuman-core/src/agent/attachments/mod.rs b/crates/openhuman-core/src/agent/attachments/mod.rsindex 08eab0ced1..4e5ae52db1 100644--- a/crates/openhuman-core/src/agent/attachments/mod.rs+++ b/crates/openhuman-core/src/agent/attachments/mod.rs@@ -1,6 +1,7 @@//! Durable user uploads in the acting workspace. Provider resolution never//! changes the original file or writes inline media into session records.+use crate::core::runtime::DispatchCtx;use std::path::{Component, Path, PathBuf};use serde::{Deserialize, Serialize};diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rsindex d24aa38b28..45b9ff0e7d 100644--- a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs@@ -27,6 +27,7 @@//! appends to the thread's transcript. It persists its reply before announcing//! `chat_done`, so a reconnect cannot lose a completed delegated result.+use crate::core::runtime::DispatchCtx;use std::collections::HashSet;use std::future::Future;use std::path::{Path, PathBuf};diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rsindex 3a6eab2421..f12be2fb98 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs@@ -4,6 +4,7 @@//! accepted. Completion/failure is reported through normal sub-agent lifecycle//! events and, when possible, persisted in the child worker thread.+use crate::core::runtime::DispatchCtx;use super::subagent_abort_report::AbortReport;use crate::agent::harness::host_definition::AgentDefinitionRegistry;use crate::agent::orchestration::fleet_tools::FleetToolSet;diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rsindex 7b84e88608..2604aa322e 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs@@ -12,6 +12,7 @@//! Sub-agents always run in "typed" mode: a narrow archetype-specific//! prompt with a filtered tool list, on a cheaper model where applicable.//!+use crate::core::runtime::DispatchCtx;use crate::agent::harness::host_definition::AgentDefinitionRegistry;use crate::agent::orchestration::tools::dispatch::{incomplete_stop, stopped_subagent_result};use crate::agent::progress::AgentProgress;diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rsindex daf89d8727..03ca7434fd 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs@@ -9,6 +9,7 @@//! Worker threads carry a hard cap on depth: a worker thread cannot spawn//! another worker thread.+use crate::core::runtime::DispatchCtx;use crate::agent::harness::host_definition::AgentDefinitionRegistry;use crate::agent::subagent_host::{run_subagent_with_parent, SubagentRunOptions};use crate::threads::store as conversations;diff --git a/crates/openhuman-core/src/agent/orchestration/tools/worker_thread.rs b/crates/openhuman-core/src/agent/orchestration/tools/worker_thread.rsindex f625d15ae6..6611778346 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/worker_thread.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/worker_thread.rs@@ -10,6 +10,7 @@//! opening `user` message. The sub-agent runner then appends each turn and//! tool result to the same thread via its `worker_thread_id` sink.+use crate::core::runtime::DispatchCtx;use std::path::PathBuf;use serde_json::json;diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/worker_mirror.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/worker_mirror.rsindex 690b482afc..2e91114a6b 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/worker_mirror.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/worker_mirror.rs@@ -1,6 +1,7 @@//! Mirroring a sub-agent turn's conversation onto its spawn's worker thread,//! matching the legacy `SubagentObserver`.+use crate::core::runtime::DispatchCtx;use tinyagents_session::transcript::TranscriptMessage;use tinytools_agent::dialect::{DialectRole, TranscriptEntry};diff --git a/crates/openhuman-core/src/channels/host/remote_control.rs b/crates/openhuman-core/src/channels/host/remote_control.rsindex 8849756dd9..b0a620c181 100644--- a/crates/openhuman-core/src/channels/host/remote_control.rs+++ b/crates/openhuman-core/src/channels/host/remote_control.rs@@ -1,5 +1,6 @@//! Captured host conversation and session state supplied to the channel module.+use crate::core::runtime::DispatchCtx;use crate::channels::context::{clear_sender_history, ChannelRuntimeContext};use crate::threads::store::{self as conversations, CreateConversationThread};diff --git a/crates/openhuman-core/src/channels/providers/relay/store.rs b/crates/openhuman-core/src/channels/providers/relay/store.rsindex f317643f6f..5f4ec41fe8 100644--- a/crates/openhuman-core/src/channels/providers/relay/store.rs+++ b/crates/openhuman-core/src/channels/providers/relay/store.rs@@ -6,6 +6,7 @@//! process-wide channel persistence subscriber is told to leave these turns//! alone (`threads::store::claim_channel_turn`).+use crate::core::runtime::DispatchCtx;use std::collections::HashMap;use std::path::{Path, PathBuf};use std::sync::{Arc, Mutex, OnceLock};diff --git a/crates/openhuman-core/src/cron/scheduler/origin_context.rs b/crates/openhuman-core/src/cron/scheduler/origin_context.rsindex f896165079..dbb29914d8 100644--- a/crates/openhuman-core/src/cron/scheduler/origin_context.rs+++ b/crates/openhuman-core/src/cron/scheduler/origin_context.rs@@ -2,6 +2,7 @@//! a bounded tail of the conversation that created the job, plus a fixed//! preamble saying the run is unattended.+use crate::core::runtime::DispatchCtx;use crate::config::Config;use {crate::cron::channel_bridge, tinyflows_schedule::types::CronJob,diff --git a/crates/openhuman-core/src/memory/backfill.rs b/crates/openhuman-core/src/memory/backfill.rsindex 4459c1732c..c903a969ca 100644--- a/crates/openhuman-core/src/memory/backfill.rs+++ b/crates/openhuman-core/src/memory/backfill.rs@@ -23,6 +23,7 @@//! - **Consent.** It uploads chat history to the selected engine, so//! [`start`] refuses without `consent`.+use crate::core::runtime::DispatchCtx;use std::collections::{BTreeMap, HashSet};use std::path::{Path, PathBuf};use std::sync::{LazyLock, Mutex};diff --git a/crates/openhuman-core/src/threads/welcome_migration.rs b/crates/openhuman-core/src/threads/welcome_migration.rsindex c9e157c44a..3bc9d6a370 100644--- a/crates/openhuman-core/src/threads/welcome_migration.rs+++ b/crates/openhuman-core/src/threads/welcome_migration.rs@@ -15,6 +15,7 @@//! The migration is idempotent and guarded by a marker file under//! `state/migrations/`.+use crate::core::runtime::DispatchCtx;use std::fs;use std::path::Path;diff --git a/crates/openhuman-core/src/tinymemes/mod.rs b/crates/openhuman-core/src/tinymemes/mod.rsindex 2155e56313..00faad5d3f 100644--- a/crates/openhuman-core/src/tinymemes/mod.rs+++ b/crates/openhuman-core/src/tinymemes/mod.rs@@ -39,6 +39,7 @@ mod jev;mod search;pub(crate) mod service;+use crate::core::runtime::DispatchCtx;use crate::config::Config;use async_trait::async_trait;use std::time::{Duration, Instant};diff --git a/crates/openhuman-core/src/web_chat/reply_persistence.rs b/crates/openhuman-core/src/web_chat/reply_persistence.rsindex 6f629bc2e6..2e8174e05a 100644--- a/crates/openhuman-core/src/web_chat/reply_persistence.rs+++ b/crates/openhuman-core/src/web_chat/reply_persistence.rs@@ -18,6 +18,7 @@//! what makes the second write a no-op rather than a duplicate bubble: the//! conversation store is idempotent for exactly this id shape.+use crate::core::runtime::DispatchCtx;use std::path::Path;use serde_json::json;diff --git a/crates/openhuman-core/src/web_chat/run_task.rs b/crates/openhuman-core/src/web_chat/run_task.rsindex 0244f86451..ba02ab424d 100644--- a/crates/openhuman-core/src/web_chat/run_task.rs+++ b/crates/openhuman-core/src/web_chat/run_task.rs@@ -4,6 +4,7 @@//! to a failed turn. Called from `start_chat` and `spawn_parallel_turn`//! (`ops/start_chat.rs`/`ops/parallel_turn.rs`) once the message has been validated.+use crate::core::runtime::DispatchCtx;use std::sync::Arc;use tinyagents_harness::run_queue::RunQueue;@@ -122,7 +123,7 @@ pub(crate) async fn run_chat_task(// policy (which grants `action_dir` as a trusted root) and its tools are// all built on the thread's folder.let thread_dir =- crate::threads::ops::thread_working_dir(DispatchCtx::ambient(), config.workspace_dir.clone(), thread_id).await?;+ crate::threads::ops::thread_working_dir(&ctx, config.workspace_dir.clone(), thread_id).await?;if let Some(dir) = &thread_dir {log::debug!("[web-channel] thread working folder applied thread_id={thread_id}");config.action_dir = dir.clone();