Skip to content

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

refactor(channels): move channel turn driver out of agent harness

Steven Enamakel830094dab878
diff --git a/crates/openhuman-core/src/agent/bus.rs b/crates/openhuman-core/src/agent/bus.rs
index 8328a9ccfa..41877068aa 100644
--- a/crates/openhuman-core/src/agent/bus.rs
+++ b/crates/openhuman-core/src/agent/bus.rs
@@ -30,7 +30,7 @@ use crate::security::turn_origin::{self, AgentTurnOrigin};
use tinyagents_session::transcript::TranscriptMessage;
use tinytools::Tool;
-use super::harness::run_channel_turn_via_graph;
+use crate::channels::runtime::turn_driver::run_channel_turn_via_graph;
use crate::agent_registry::host_definition::AgentDefinitionRegistry;
use tinyagents_definition::SandboxMode;
use tinytools_std::file_state::with_file_state_agent_id;
diff --git a/crates/openhuman-core/src/agent/harness/mod.rs b/crates/openhuman-core/src/agent/harness/mod.rs
index f1fb16dc77..02a6b078f4 100644
--- a/crates/openhuman-core/src/agent/harness/mod.rs
+++ b/crates/openhuman-core/src/agent/harness/mod.rs
@@ -17,7 +17,6 @@
//! `crate::agent::tinyagents`); there is no in-house interrupt fence.
pub mod artifact_offload;
-pub(crate) mod graph;
#[cfg(test)]
pub(crate) mod test_support;
pub(crate) mod tool_result_artifacts;
@@ -25,4 +24,3 @@ pub(crate) mod tool_result_artifacts;
// NOTE: deliberately no flat re-export here. `artifact_offload::ArtifactKind`
// would shadow the unrelated `openhuman::artifacts::ArtifactKind` for anyone
// glob-importing this module; callers import the owning library directly.
-pub(crate) use graph::run_channel_turn_via_graph;
diff --git a/crates/openhuman-core/src/channels/mod.rs b/crates/openhuman-core/src/channels/mod.rs
index a132d16093..fb3847f56e 100644
--- a/crates/openhuman-core/src/channels/mod.rs
+++ b/crates/openhuman-core/src/channels/mod.rs
@@ -33,8 +33,7 @@ pub(crate) mod prompt;
pub mod providers;
#[cfg(feature = "channels")]
mod routes;
-#[cfg(feature = "channels")]
-mod runtime;
+pub(crate) mod runtime;
#[cfg(feature = "channels")]
pub(crate) mod system_prompt;
diff --git a/crates/openhuman-core/src/channels/runtime/mod.rs b/crates/openhuman-core/src/channels/runtime/mod.rs
index 87b8ee69b1..a1b4626886 100644
--- a/crates/openhuman-core/src/channels/runtime/mod.rs
+++ b/crates/openhuman-core/src/channels/runtime/mod.rs
@@ -1,27 +1,41 @@
//! Channel runtime entry points.
+#[cfg(feature = "channels")]
mod dispatch;
+#[cfg(feature = "channels")]
pub(crate) mod session;
+#[cfg(feature = "channels")]
mod startup;
-#[cfg(test)]
+#[cfg(all(test, feature = "channels"))]
mod supervision;
+pub(crate) mod turn_driver;
+#[cfg(feature = "channels")]
pub(crate) use startup::hydrate_channel_credentials;
+#[cfg(feature = "channels")]
pub(crate) use startup::prepare_runtime_limits;
+#[cfg(feature = "channels")]
pub use startup::start_channels;
+#[cfg(feature = "channels")]
pub(crate) use startup::start_channels_with_session;
// The hosted-channel relay (`channels::providers::relay`) runs one message
// through the same pipeline, with a context built from the caller's config.
#[cfg(test)]
+#[cfg(feature = "channels")]
pub(crate) use dispatch::process_channel_message;
+#[cfg(feature = "channels")]
pub(crate) use dispatch::{process_channel_runtime_message, RuntimeChannelMessage};
+#[cfg(feature = "channels")]
pub(crate) use startup::{build_channel_turn_parts, runtime_context, PromptToolDescs};
+#[cfg(feature = "channels")]
#[cfg(any(test, debug_assertions))]
pub mod test_support;
// Re-exported for `channels::tests` only; omit in normal lib builds to avoid unused-import warnings.
#[cfg(test)]
+#[cfg(feature = "channels")]
pub(crate) use dispatch::run_message_dispatch_loop;
#[cfg(test)]
+#[cfg(feature = "channels")]
pub(crate) use supervision::spawn_supervised_listener;
diff --git a/crates/openhuman-core/src/channels/runtime/turn_driver.rs b/crates/openhuman-core/src/channels/runtime/turn_driver.rs
index ed014dc4a1..511dc1168c 100644
--- a/crates/openhuman-core/src/channels/runtime/turn_driver.rs
+++ b/crates/openhuman-core/src/channels/runtime/turn_driver.rs
@@ -255,5 +255,5 @@ fn seed_channel_attachments(
}
#[cfg(test)]
-#[path = "graph_tests.rs"]
+#[path = "turn_driver_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs b/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs
index 76f082291d..8e7f6d1205 100644
--- a/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs
+++ b/crates/openhuman-core/src/skills/e2e_plumbing_tests.rs
@@ -27,7 +27,7 @@ use std::time::Duration;
use async_trait::async_trait;
use parking_lot::Mutex;
-use crate::agent::harness::run_channel_turn_via_graph;
+use crate::channels::runtime::turn_driver::run_channel_turn_via_graph;
use crate::config::{Config, MultimodalConfig, MultimodalFileConfig};
use crate::skills::ops_create::{
create_workflow_inner, CreateWorkflowParams, WorkflowCreateInputDef,