Skip to content

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

refactor(runtime): reorganize imports in startup modules

Steven Enamakel645233a12715
diff --git a/crates/openhuman-core/src/channels/runtime/startup.rs b/crates/openhuman-core/src/channels/runtime/startup.rs
index 9792015550..28b14c2448 100644
--- a/crates/openhuman-core/src/channels/runtime/startup.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup.rs
@@ -54,7 +54,7 @@ pub(crate) async fn prepare_runtime_limits(
pub(crate) use credentials::hydrate_channel_credentials;
pub use start_channels::start_channels;
pub(crate) use start_channels::start_channels_with_session;
-pub(crate) use turn_parts::{build_channel_turn_parts, runtime_context, PromptToolDescs};
+pub(crate) use turn_parts::{PromptToolDescs, build_channel_turn_parts, runtime_context};
// Re-exported at module scope (rather than left as private `pub(super)`
// items reached only through their owning submodule) so the `#[path]` test
@@ -63,7 +63,7 @@ pub(crate) use turn_parts::{build_channel_turn_parts, runtime_context, PromptToo
#[cfg(test)]
use crate::config::Config;
#[cfg(test)]
-use chat_workload::{resolve_chat_workload, ChatWorkloadResolution};
+use chat_workload::{ChatWorkloadResolution, resolve_chat_workload};
#[cfg(any(test, debug_assertions))]
use credentials::resolve_yuanbao_app_secret;
#[cfg(test)]
diff --git a/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs b/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs
index 2613426d6f..c82b4be6b4 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/callback_tests.rs
@@ -1,9 +1,9 @@
use super::*;
use super::{ProgressiveChannelTransport, ProgressiveOutputObserver};
+use crate::channels::Channel;
use crate::channels::context::ChannelRuntimeContext;
use crate::channels::runtime::dispatch::RuntimeChannelMessage;
-use crate::channels::Channel;
use std::collections::HashMap;
use std::sync::{Arc, Mutex, OnceLock, Weak};
use tinychannels_bus::channel::{
@@ -176,14 +176,16 @@ fn callback_for_channels(
let context_slot: Arc<OnceLock<Weak<ChannelRuntimeContext>>> = Arc::new(OnceLock::new());
assert!(context_slot.set(Arc::downgrade(&context)).is_ok());
let progressive_slot = Arc::new(OnceLock::new());
- assert!(progressive_slot
- .set(Arc::new(
- progressive_channels
- .into_iter()
- .map(|(name, adapter)| (name, Arc::downgrade(&adapter)))
- .collect()
- ))
- .is_ok());
+ assert!(
+ progressive_slot
+ .set(Arc::new(
+ progressive_channels
+ .into_iter()
+ .map(|(name, adapter)| (name, Arc::downgrade(&adapter)))
+ .collect()
+ ))
+ .is_ok()
+ );
let (dispatch, _receiver) = tokio::sync::mpsc::channel::<RuntimeChannelMessage>(1);
let mut callback = ChannelHostCallbacks::new(
&crate::core::runtime::DispatchCtx::host_default(),
@@ -529,14 +531,16 @@ async fn native_progressive_callbacks_stop_after_channel_session_cancellation()
);
callback.cancellation.cancel();
- assert!(callback
- .dispatch_controller_backend(output_event_request(
- Some("telegram:bot-b"),
- Some("chat-42"),
- Some("turn-15"),
- ))
- .await
- .is_err());
+ assert!(
+ callback
+ .dispatch_controller_backend(output_event_request(
+ Some("telegram:bot-b"),
+ Some("chat-42"),
+ Some("turn-15"),
+ ))
+ .await
+ .is_err()
+ );
assert!(observer.seen.lock().await.is_empty());
}
@@ -565,14 +569,16 @@ async fn native_progressive_callbacks_fail_closed_after_transport_owner_drops()
drop(context);
drop(adapter);
- assert!(callback
- .dispatch_controller_backend(output_event_request(
- Some("telegram:bot-b"),
- Some("chat-42"),
- Some("turn-16"),
- ))
- .await
- .is_err());
+ assert!(
+ callback
+ .dispatch_controller_backend(output_event_request(
+ Some("telegram:bot-b"),
+ Some("chat-42"),
+ Some("turn-16"),
+ ))
+ .await
+ .is_err()
+ );
}
#[path = "callback_inbound_tests.rs"]
diff --git a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs
index ed81ed333d..f88127c926 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs
@@ -18,11 +18,11 @@
use std::collections::BTreeMap;
use std::path::Path;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use sha2::Digest;
use tinychannels_bus::module_delivery::{
- DeliveryQueueEntry, DeliveryTerminalResult, DELIVERY_PENDING_CAPACITY, DELIVERY_RECORD_BYTES,
- DELIVERY_RESULT_CAPACITY, DELIVERY_RESULT_TTL_SECONDS,
+ DELIVERY_PENDING_CAPACITY, DELIVERY_RECORD_BYTES, DELIVERY_RESULT_CAPACITY,
+ DELIVERY_RESULT_TTL_SECONDS, DeliveryQueueEntry, DeliveryTerminalResult,
};
use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition};
diff --git a/crates/openhuman-core/src/channels/runtime/startup/progressive_transport_tests.rs b/crates/openhuman-core/src/channels/runtime/startup/progressive_transport_tests.rs
index 040e6521f0..271b99d4bb 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/progressive_transport_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/progressive_transport_tests.rs
@@ -39,7 +39,7 @@ fn module_callback_error_does_not_expose_provider_details() {
#[test]
fn receipt_scope_requires_exact_channel_and_full_conversation_identity() {
- use tinychannels_bus::channel::{types::ConversationKind, MessageReceipt};
+ use tinychannels_bus::channel::{MessageReceipt, types::ConversationKind};
use tinychannels_bus::{ChannelRef, ConversationRef};
let channel = ChannelRef {
diff --git a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
index 0073b73aed..5389f2d905 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
@@ -3,7 +3,7 @@
use super::super::dispatch::run_message_dispatch_loop;
use super::module_providers::ModuleChannelRuntime;
-use super::turn_parts::{build_channel_turn_parts, runtime_context, PromptToolDescs};
+use super::turn_parts::{PromptToolDescs, build_channel_turn_parts, runtime_context};
use crate::config::Config;
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
diff --git a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs
index 640d76af9a..c3e3a3f32b 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs
@@ -6,7 +6,7 @@
//! the caller's own config and policy, so a relayed turn never runs with the
//! operator's tools or workspace.
-use super::chat_workload::{resolve_chat_workload, ChatWorkloadResolution};
+use super::chat_workload::{ChatWorkloadResolution, resolve_chat_workload};
use super::prompt::format_access_context;
use crate::agent::host_runtime;
use crate::channels::context::ChannelRuntimeContext;
diff --git a/crates/openhuman-core/src/channels/runtime/startup_tests.rs b/crates/openhuman-core/src/channels/runtime/startup_tests.rs
index e8af9daf17..691e9fd8da 100644
--- a/crates/openhuman-core/src/channels/runtime/startup_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup_tests.rs
@@ -7,7 +7,7 @@
//! (cloud) path is preserved for users who haven't picked a local /
//! BYOK model, and the override path activates for those who have.
-use super::{resolve_chat_workload, ChatWorkloadResolution, RelayInboundMessageHandler};
+use super::{ChatWorkloadResolution, RelayInboundMessageHandler, resolve_chat_workload};
use crate::config::Config;
use tinychannels::relay::RelayInboundHandler;