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(channels): import channel traits from contract crates
Steven Enamakeld152bca020f3
diff --git a/crates/openhuman-core/src/channels/bus_test_support_tests.rs b/crates/openhuman-core/src/channels/bus_test_support_tests.rsindex 3158173a92..310d38c90d 100644--- a/crates/openhuman-core/src/channels/bus_test_support_tests.rs+++ b/crates/openhuman-core/src/channels/bus_test_support_tests.rs@@ -1,7 +1,7 @@//! Debug-build seams for raw integration coverage of channel inbound helpers.use tinychannels::delivery::progressive::{- StreamingState, extract_message_id, latest_thinking_snippet,+ extract_message_id, latest_thinking_snippet, StreamingState,};use tinychannels_runtime::channel::derive_inbound_thread_id;diff --git a/crates/openhuman-core/src/channels/contract_reexport_tests.rs b/crates/openhuman-core/src/channels/contract_reexport_tests.rsdeleted file mode 100644index 80e96fd760..0000000000--- a/crates/openhuman-core/src/channels/contract_reexport_tests.rs+++ /dev/null@@ -1,47 +0,0 @@-//! The host's `Channel` seam is the contract crate's trait, not a copy.-use super::*;-use std::sync::Mutex;--#[derive(Default)]-struct Recorder {- sent: Mutex<Vec<String>>,-}--#[async_trait::async_trait]-impl tinychannels_runtime::Channel for Recorder {- fn name(&self) -> &str {- "recorder"- }- async fn send(&self, message: &SendMessage) -> anyhow::Result<()> {- self.sent.lock().unwrap().push(message.content.clone());- Ok(())- }- async fn listen(- &self,- _tx: tokio::sync::mpsc::Sender<tinychannels_bus::ChannelMessage>,- ) -> anyhow::Result<()> {- Ok(())- }-}--#[tokio::test]-async fn host_send_ext_routes_through_the_contract_trait() {- let ch = Recorder::default();- ChannelSendExt::send_with_outbound_intent(&ch, &SendMessage::new("hi", "u1"))- .await- .unwrap();- assert_eq!(ch.sent.lock().unwrap().as_slice(), ["hi"]);-}--#[test]-fn channel_vocabulary_is_the_contract_crates_own_types() {- use std::any::TypeId;- assert_eq!(- TypeId::of::<dyn Channel>(),- TypeId::of::<dyn tinychannels_runtime::Channel>()- );- assert_eq!(- TypeId::of::<SendMessage>(),- TypeId::of::<tinychannels_bus::SendMessage>()- );-}diff --git a/crates/openhuman-core/src/channels/host/channel_events.rs b/crates/openhuman-core/src/channels/host/channel_events.rsindex 1c25d47562..5559545166 100644--- a/crates/openhuman-core/src/channels/host/channel_events.rs+++ b/crates/openhuman-core/src/channels/host/channel_events.rs@@ -1,8 +1,6 @@//! Host-owned approval routing and turn events over the channel module.use crate::channels::capabilities::capabilities_for;use crate::channels::runtime::ChannelHandle;-#[cfg(test)]-use tinychannels_runtime::ChannelSendExt;use crate::channels::SendMessage;use crate::core::events::DomainEvent;use async_trait::async_trait;@@ -12,6 +10,8 @@ use std::sync::{Arc, Mutex};use tinybus::module::ModuleClient;use tinybus::EventHandler;use tinychannels_bus::{approvals::ReplyContext, ChannelMessage};+#[cfg(test)]+use tinychannels_runtime::ChannelSendExt;/// Captures the account configuration and reply addresses used by approvals.pub struct ChannelApprovalSurfaceSubscriber {diff --git a/crates/openhuman-core/src/channels/mod.rs b/crates/openhuman-core/src/channels/mod.rsindex 466e2c99e2..712efa9285 100644--- a/crates/openhuman-core/src/channels/mod.rs+++ b/crates/openhuman-core/src/channels/mod.rs@@ -65,7 +65,3 @@ pub(crate) use runtime::{session, start_channels_with_session};#[cfg(all(test, feature = "channels", feature = "modules"))]#[path = "module_fixture_tests.rs"]pub(crate) mod module_fixture;--#[cfg(test)]-#[path = "contract_reexport_tests.rs"]-mod contract_reexport_tests;diff --git a/crates/openhuman-core/src/channels/proactive.rs b/crates/openhuman-core/src/channels/proactive.rsindex 8b418b2b11..33d3d2f187 100644--- a/crates/openhuman-core/src/channels/proactive.rs+++ b/crates/openhuman-core/src/channels/proactive.rs@@ -16,13 +16,13 @@use crate::channels::runtime::ChannelHandle;use crate::channels::SendMessage;-#[cfg(test)]-use tinychannels_runtime::ChannelSendExt;use crate::core::events::DomainEvent;use async_trait::async_trait;use std::collections::HashMap;use std::sync::{Arc, RwLock};use tinybus::EventHandler;+#[cfg(test)]+use tinychannels_runtime::ChannelSendExt;#[cfg(not(test))]fn proactive_approval_gate() -> Option<Arc<crate::security::approval::ApprovalGate>> {diff --git a/crates/openhuman-core/src/channels/providers/relay/channel.rs b/crates/openhuman-core/src/channels/providers/relay/channel.rsindex e20e5a439e..c3f8aec82b 100644--- a/crates/openhuman-core/src/channels/providers/relay/channel.rs+++ b/crates/openhuman-core/src/channels/providers/relay/channel.rs@@ -10,12 +10,12 @@ use std::sync::Mutex;use serde_json::json;use crate::web_chat::{publish_web_channel_event, publish_web_channel_event_in, WebChannelEvent};-use tinychannels_bus::SendMessage;-#[cfg(test)]-use tinychannels_bus::ChannelMessage;#[cfg(test)]use async_trait::async_trait;#[cfg(test)]+use tinychannels_bus::ChannelMessage;+use tinychannels_bus::SendMessage;+#[cfg(test)]use tinychannels_runtime::Channel;/// The event name a relayed reply is published under.diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rsindex 8b8927588f..54e6e3cc53 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs@@ -230,14 +230,14 @@ pub(crate) async fn run_relay_turn(#[cfg(test)]channels_by_name.insert(params.channel.clone(), channel.clone());#[cfg(not(test))]- let mut channels_by_name: HashMap<- String,- Arc<crate::channels::runtime::ChannelHandle>,- > = HashMap::new();+ let mut channels_by_name: HashMap<String, Arc<crate::channels::runtime::ChannelHandle>> =+ HashMap::new();#[cfg(not(test))]channels_by_name.insert(params.channel.clone(),- Arc::new(crate::channels::runtime::ChannelHandle::Relay(channel.clone())),+ Arc::new(crate::channels::runtime::ChannelHandle::Relay(+ channel.clone(),+ )),);let mut runtime = runtime_context(&dispatch_ctx,diff --git a/crates/openhuman-core/src/channels/providers/relay/store.rs b/crates/openhuman-core/src/channels/providers/relay/store.rsindex 339c7b3a6c..2d6335761d 100644--- a/crates/openhuman-core/src/channels/providers/relay/store.rs+++ b/crates/openhuman-core/src/channels/providers/relay/store.rs@@ -180,9 +180,11 @@ fn to_history("user" => Some(tinyagents_session::transcript::TranscriptMessage::user(message.content.clone(),)),- "assistant" => Some(tinyagents_session::transcript::TranscriptMessage::assistant(- message.content.clone(),- )),+ "assistant" => Some(+ tinyagents_session::transcript::TranscriptMessage::assistant(+ message.content.clone(),+ ),+ ),_ => None,}).collect()diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rsindex 7bf5216fef..b1297943c3 100644--- a/crates/openhuman-core/src/channels/routes.rs+++ b/crates/openhuman-core/src/channels/routes.rs@@ -1,16 +1,16 @@//! Per-sender routing and runtime command handling.use super::context::{ChannelRouteSelection, ChannelRuntimeContext};-use super::SendMessage;use super::runtime::ChannelHandle;-#[cfg(test)]-use tinychannels_runtime::ChannelSendExt;+use super::SendMessage;use crate::inference::provider;use std::sync::Arc;use tinychannels_bus as traits;use tinychannels_bus::module_control::{ChannelControlRequest, ChannelControlResult, ProviderDescriptor,};+#[cfg(test)]+use tinychannels_runtime::ChannelSendExt;fn provider_descriptors() -> Vec<ProviderDescriptor> {provider::list_providers()diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rsindex ec06d78ff8..db6d31c2eb 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs@@ -7,13 +7,14 @@ use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponseuse crate::agent::host_agents::{self, HostAgent, HostAgentResolver};use crate::channels::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};use crate::channels::runtime::process_channel_message;-use crate::channels::{Channel, SendMessage};+use crate::channels::SendMessage;use crate::core::runtime::{CoreContext, DomainSet};use serde_json::{json, Value};use std::collections::HashMap;use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::{Arc, Mutex};use tinychannels_bus as traits;+use tinychannels_runtime::Channel;use tinytools::{PermissionLevel, Tool, ToolResult};use wiremock::matchers::{method, path};use wiremock::{Mock, MockServer, ResponseTemplate};diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rsindex 7c73e3cfe9..f157cec3b3 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/mod.rs@@ -21,14 +21,14 @@ use std::sync::Arc;use crate::agent::host_agents::HostAgent;use crate::channels::context::ChannelRuntimeContext;-#[cfg(test)]-#[cfg(test)]-use tinychannels_runtime::ChannelSendExt;use crate::channels::SendMessage;use crate::config::Config;use crate::core::bus::BUS;use crate::core::events::DomainEvent;use tinychannels_bus as traits;+#[cfg(test)]+#[cfg(test)]+use tinychannels_runtime::ChannelSendExt;pub(crate) mod posture;mod turn;diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rsindex 09d3b6f96f..d9032caf6b 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs@@ -5,15 +5,15 @@ use crate::channels::context::{is_context_window_overflow_error, ChannelRuntimeC#[cfg(test)]use crate::channels::routes::get_or_create_turn_model_source;use crate::channels::routes::{get_route_selection, handle_runtime_command_with_reset};-#[cfg(test)]-#[cfg(test)]-use tinychannels_runtime::ChannelSendExt;use crate::channels::SendMessage;use crate::core::bus::BUS;use crate::core::events::DomainEvent;use crate::util::truncate_with_ellipsis;use std::sync::Arc;use std::time::Instant;+#[cfg(test)]+#[cfg(test)]+use tinychannels_runtime::ChannelSendExt;use tokio_util::sync::CancellationToken;use tokio_util::task::AbortOnDropHandle;diff --git a/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs b/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rsindex d898e3d888..8d0feb4add 100644--- a/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs@@ -3,7 +3,6 @@ use super::{ProgressiveChannelTransport, ProgressiveOutputObserver};use crate::channels::context::ChannelRuntimeContext;use crate::channels::runtime::dispatch::RuntimeChannelMessage;-use tinychannels_runtime::Channel;use std::collections::HashMap;use std::sync::{Arc, Mutex, OnceLock, Weak};use tinychannels_bus::channel::{@@ -13,6 +12,7 @@ use tinychannels_bus::module_progressive::{ChannelOutputEvent, ProgressiveTransportRequest, ProgressiveTransportResult,};use tinychannels_bus::{ChannelBackendRequest, ChannelBackendResult, SendMessage};+use tinychannels_runtime::Channel;#[derive(Default)]struct RecordingOutputObserver {diff --git a/crates/openhuman-core/src/channels/tests/common.rs b/crates/openhuman-core/src/channels/tests/common.rsindex 936e36ebe4..b1f1e290a6 100644--- a/crates/openhuman-core/src/channels/tests/common.rs+++ b/crates/openhuman-core/src/channels/tests/common.rs@@ -1,9 +1,10 @@-use crate::channels::{Channel, SendMessage};+use crate::channels::SendMessage;use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::{Arc, Mutex};use std::time::Duration;use tempfile::TempDir;use tinychannels_bus as traits;+use tinychannels_runtime::Channel;use tinyinference_llm::message::{AssistantMessage, Message};use tinyinference_llm::model::{ChatModel, ModelProfile, ModelRequest, ModelResponse};use tinyinference_llm::tool::ToolCall;diff --git a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rsindex 599930fc37..60724b91f5 100644--- a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs+++ b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs@@ -3,7 +3,6 @@ use super::super::runtime::test_support::{run_dispatch_harness, DispatchHarnessOuse super::super::runtime::{process_channel_message, run_message_dispatch_loop, RuntimeChannelMessage,};-use super::super::Channel;use super::common::{use_real_agent_handler, RecordingChannel, SlowModel};use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};use crate::core::events::DomainEvent;@@ -13,6 +12,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::{Arc, Mutex};use std::time::Duration;use tinychannels_bus as traits;+use tinychannels_runtime::Channel;use tokio::sync::Barrier;#[tokio::test]diff --git a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rsindex c18dc08d9a..79febb5c83 100644--- a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs+++ b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs@@ -3,7 +3,6 @@ use super::super::context::{CHANNEL_MESSAGE_TIMEOUT_SECS,};use super::super::runtime::process_channel_message;-use super::super::Channel;use super::common::{IterativeToolModel, MockPriceTool, ModelCaptureModel, RecordingChannel,TelegramRecordingChannel, ToolCallingModel,@@ -13,6 +12,7 @@ use std::collections::HashMap;use std::sync::atomic::Ordering;use std::sync::{Arc, Mutex};use tinychannels_bus as traits;+use tinychannels_runtime::Channel;use tinyinference_llm::model::ChatModel;#[tokio::test]