Skip to content

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

refactor(channels): clean up imports and structure

Steven Enamakel0a44912f87ba
diff --git a/crates/openhuman-core/src/channels/host/channel_events.rs b/crates/openhuman-core/src/channels/host/channel_events.rs
index a652e810d9..c57e596df0 100644
--- a/crates/openhuman-core/src/channels/host/channel_events.rs
+++ b/crates/openhuman-core/src/channels/host/channel_events.rs
@@ -6,9 +6,9 @@ use async_trait::async_trait;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
-use tinybus::module::ModuleClient;
use tinybus::EventHandler;
-use tinychannels_bus::{approvals::ReplyContext, ChannelMessage};
+use tinybus::module::ModuleClient;
+use tinychannels_bus::{ChannelMessage, approvals::ReplyContext};
/// Captures the account configuration and reply addresses used by approvals.
pub struct ChannelApprovalSurfaceSubscriber {
diff --git a/crates/openhuman-core/src/channels/module_fixture_tests.rs b/crates/openhuman-core/src/channels/module_fixture_tests.rs
index 8ddaefba14..5081d1ba3e 100644
--- a/crates/openhuman-core/src/channels/module_fixture_tests.rs
+++ b/crates/openhuman-core/src/channels/module_fixture_tests.rs
@@ -8,8 +8,8 @@
//! on a process-lifetime runtime, so it outlives the short Tokio runtimes of
//! individual tests.
-use crate::config::schema::ModuleSourceMode;
use crate::config::Config;
+use crate::config::schema::ModuleSourceMode;
use crate::modules::linked::register_linked;
use crate::modules::{ops, runtime};
use std::sync::Arc;
@@ -140,10 +140,10 @@ async fn linked_module_prepares_runtime_limits_over_confidential_bus_call() {
#[cfg(feature = "e2e-test-support")]
async fn linked_module_prepares_legacy_inbound_facts_over_confidential_bus_call() {
let _storage = install_memory_storage();
+ use tinychannels_bus::ChannelMessage;
use tinychannels_bus::module_inbound::{
ChannelInboundSource, PrepareChannelInboundRequest, PreparedChannelInbound,
};
- use tinychannels_bus::ChannelMessage;
let message = ChannelMessage {
id: "message-1".into(),
diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rs
index 0b7c493972..568a5e99bc 100644
--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs
@@ -4,15 +4,15 @@ use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use super::channel::RelayChannel;
use super::params::RelayInboundParams;
use super::store::{self, Recorded};
use crate::channels::context::MAX_CHANNEL_HISTORY;
use crate::channels::runtime::{
- build_channel_turn_parts, prepare_runtime_limits, process_channel_runtime_message,
- runtime_context, PromptToolDescs,
+ PromptToolDescs, build_channel_turn_parts, prepare_runtime_limits,
+ process_channel_runtime_message, runtime_context,
};
use crate::config::Config;
use crate::core::Outcome;
diff --git a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs
index c93bd4a10d..be727ffd1c 100644
--- a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs
@@ -1,6 +1,6 @@
use super::super::channel::CHANNEL_OUTBOUND_EVENT;
use super::*;
-use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};
+use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};
use crate::agent::turn_origin::AgentTurnOrigin;
use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};
use std::sync::Mutex;
@@ -212,12 +212,16 @@ async fn a_relayed_turn_runs_as_an_external_channel_and_keeps_its_thread() {
}
}
assert_eq!(outbound.len(), 2, "one channel_outbound per reply");
- assert!(outbound
- .iter()
- .all(|event| event.event_name() == CHANNEL_OUTBOUND_EVENT));
- assert!(outbound
- .iter()
- .all(|event| event.context().thread_id == thread));
+ assert!(
+ outbound
+ .iter()
+ .all(|event| event.event_name() == CHANNEL_OUTBOUND_EVENT)
+ );
+ assert!(
+ outbound
+ .iter()
+ .all(|event| event.context().thread_id == thread)
+ );
assert_eq!(outbound[0].context().request_id, "req-m1");
assert!(matches!(
outbound[0].wire_event(),
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
index 0b68b13a7e..bdee54fa99 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs
@@ -1,7 +1,7 @@
//! The per-message pipeline: typing indicator, ACK reaction, durable-session
//! dispatch through the shared runner, and final reply delivery.
-use crate::channels::context::{is_context_window_overflow_error, ChannelRuntimeContext};
+use crate::channels::context::{ChannelRuntimeContext, is_context_window_overflow_error};
#[cfg(test)]
use crate::channels::routes::get_or_create_turn_model_source;
use crate::channels::routes::{get_route_selection, handle_runtime_command_with_reset};
@@ -15,12 +15,12 @@ use tokio_util::sync::CancellationToken;
use tokio_util::task::AbortOnDropHandle;
use super::super::helpers::{
- build_channel_context_block, log_worker_join_result, spawn_typing_task,
- REPLY_LOG_TRUNCATE_CHARS,
+ REPLY_LOG_TRUNCATE_CHARS, build_channel_context_block, log_worker_join_result,
+ spawn_typing_task,
};
use super::super::host_agent::{self, HostRoute};
-use super::approval::{channel_has_approval_surface, try_route_approval_reply};
use super::RuntimeChannelMessage;
+use super::approval::{channel_has_approval_surface, try_route_approval_reply};
fn inbound_console_preview(
envelope: &tinychannels_bus::ChannelInboundEnvelope,
diff --git a/crates/openhuman-core/src/threads/store/bus.rs b/crates/openhuman-core/src/threads/store/bus.rs
index 45044ac3b4..70a68b4bc2 100644
--- a/crates/openhuman-core/src/threads/store/bus.rs
+++ b/crates/openhuman-core/src/threads/store/bus.rs
@@ -36,7 +36,7 @@ use tinychannels_bus::ChannelMessage;
use tinychannels_runtime::context::conversation_history_key;
use super::{
- append_message, ensure_thread, get_messages, ConversationMessage, CreateConversationThread,
+ ConversationMessage, CreateConversationThread, append_message, ensure_thread, get_messages,
};
static CONVERSATION_PERSISTENCE_HANDLE: OnceLock<SubscriptionHandle> = OnceLock::new();