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: reorder imports and fix formatting
Steven Enamakel6335981a5e37
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/transcript.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/transcript.rsindex a0bc80304a..7f6ab1f035 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session/transcript.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/transcript.rs@@ -51,7 +51,7 @@ impl OpenHumanSessionHost {updated: now,turn_count: 0,prefix_message_count: None,- prefix_reset: false,+ prefix_reset: false,input_tokens: 0,output_tokens: 0,cached_input_tokens: 0,diff --git a/crates/openhuman-core/src/agent/turn_host.rs b/crates/openhuman-core/src/agent/turn_host.rsindex 36ef8a8020..de603e85d1 100644--- a/crates/openhuman-core/src/agent/turn_host.rs+++ b/crates/openhuman-core/src/agent/turn_host.rs@@ -37,7 +37,8 @@ pub(crate) struct TrustedAgentTurn {/// Captured configured compiled-module target for native turns. The/// progressive handle itself is opened at runner checkout per admitted/// request, so queued follow-ups never reuse a finished handle.- pub(crate) native_target: Option<Arc<crate::channels::runtime::dispatch::NativeProgressiveTarget>>,+ pub(crate) native_target:+ Option<Arc<crate::channels::runtime::dispatch::NativeProgressiveTarget>>,}impl std::fmt::Debug for TrustedAgentTurn {diff --git a/crates/openhuman-core/src/channels/bus.rs b/crates/openhuman-core/src/channels/bus.rsindex 061787fb07..5539395bb2 100644--- a/crates/openhuman-core/src/channels/bus.rs+++ b/crates/openhuman-core/src/channels/bus.rs@@ -9,8 +9,8 @@ mod subscriber;#[cfg(test)]mod thread_id;-pub use subscriber::ChannelInboundSubscriber;pub(crate) use delivery::NativeProgressiveReply;+pub use subscriber::ChannelInboundSubscriber;#[cfg(test)]pub(crate) use thread_id::derive_inbound_thread_id;diff --git a/crates/openhuman-core/src/channels/bus/delivery.rs b/crates/openhuman-core/src/channels/bus/delivery.rsindex a8c54f2ed3..da1798d008 100644--- a/crates/openhuman-core/src/channels/bus/delivery.rs+++ b/crates/openhuman-core/src/channels/bus/delivery.rs@@ -2,17 +2,17 @@use crate::backend::{BackendApiError, BackendClient};use crate::modules::channel_runtime::ChannelRuntimeLease;use crate::security::credentials::session_support::{- BackendCredential, get_session_token, is_local_session_token,+ get_session_token, is_local_session_token, BackendCredential,};+use serde_json::json;#[cfg(test)]use serde_json::Value;-use serde_json::json;use tinybus::module::ModuleCallError;use tinychannels_bus::module_progressive::{ChannelOutputEvent, ProgressiveCommand, ProgressiveEvent, ProgressiveResult,ProgressiveTransportRequest, ProgressiveTransportResult,};-use tinychannels_bus::{ChannelBackendRequest, ChannelBackendResult, methods};+use tinychannels_bus::{methods, ChannelBackendRequest, ChannelBackendResult};/// Transport refusals are typed facts; recovery and retry budgets belong to the module.pub(super) fn map_backend_error(error: anyhow::Error) -> ProgressiveTransportResult {diff --git a/crates/openhuman-core/src/channels/bus/subscriber_tests.rs b/crates/openhuman-core/src/channels/bus/subscriber_tests.rsindex d63ed5757a..ce73fe76f7 100644--- a/crates/openhuman-core/src/channels/bus/subscriber_tests.rs+++ b/crates/openhuman-core/src/channels/bus/subscriber_tests.rs@@ -63,24 +63,21 @@ async fn backend_channel_wait_does_not_cut_off_a_live_turn_after_180_seconds() {let startup = tokio::time::timeout(Duration::from_secs(15), async {while !block.started.load(std::sync::atomic::Ordering::SeqCst) {match event_rx.try_recv() {- Ok(event) if event.context().request_id == request_id => {- match event.wire_event() {- WebChannelEvent::ChatError { message, .. } => {- return Err(format!(- "shared runner failed before entering controlled turn: {}",- message.as_deref().unwrap_or("no error message")- ));- }- WebChannelEvent::ChatDone { .. }- | WebChannelEvent::ChatCancelled { .. } => {- return Err(format!(- "shared runner terminated before entering controlled turn: {}",- event.wire_event().event_name()- ));- }- _ => {}+ Ok(event) if event.context().request_id == request_id => match event.wire_event() {+ WebChannelEvent::ChatError { message, .. } => {+ return Err(format!(+ "shared runner failed before entering controlled turn: {}",+ message.as_deref().unwrap_or("no error message")+ ));}- }+ WebChannelEvent::ChatDone { .. } | WebChannelEvent::ChatCancelled { .. } => {+ return Err(format!(+ "shared runner terminated before entering controlled turn: {}",+ event.wire_event().event_name()+ ));+ }+ _ => {}+ },Ok(_) | Err(tokio::sync::broadcast::error::TryRecvError::Empty) => {}Err(tokio::sync::broadcast::error::TryRecvError::Lagged(skipped)) => {return Err(format!(diff --git a/crates/openhuman-core/src/channels/host/host_tests.rs b/crates/openhuman-core/src/channels/host/host_tests.rsindex fe28775426..fe4dcc1810 100644--- a/crates/openhuman-core/src/channels/host/host_tests.rs+++ b/crates/openhuman-core/src/channels/host/host_tests.rs@@ -159,12 +159,10 @@ async fn typed_channel_projection_uses_scoped_persisted_row_bindings_after_resta},};- assert!(- super::adapters::project_channel_event(&bob, event.clone())- .await- .unwrap()- .is_none()- );+ assert!(super::adapters::project_channel_event(&bob, event.clone())+ .await+ .unwrap()+ .is_none());let bob_messages = crate::threads::store::blocking::get_messages(bob.clone(),workspace.clone(),@@ -176,12 +174,10 @@ async fn typed_channel_projection_uses_scoped_persisted_row_bindings_after_restabob_messages[0].extra_metadata["voiceNote"]["opaqueId"],"bob-voice");- assert!(- bob_messages[0]- .extra_metadata- .get("channelActivity")- .is_none()- );+ assert!(bob_messages[0]+ .extra_metadata+ .get("channelActivity")+ .is_none());let projected = super::adapters::project_channel_event(&alice, event.clone()).await@@ -213,12 +209,10 @@ async fn typed_channel_projection_uses_scoped_persisted_row_bindings_after_resta},..event};- assert!(- super::adapters::project_channel_event(&restarted, read)- .await- .unwrap()- .is_some()- );+ assert!(super::adapters::project_channel_event(&restarted, read)+ .await+ .unwrap()+ .is_some());let messages = crate::threads::store::blocking::get_messages(restarted, workspace, thread_id).await.unwrap();@@ -286,8 +280,8 @@ async fn event_sink_rejects_non_object_payload() {#[tokio::test]async fn event_sink_routes_channel_reactions_to_domain_bus() {let sink = OpenHumanEventSink;- assert!(- sink.publish(+ assert!(sink+ .publish("channel","reaction_received",serde_json::json!({@@ -296,10 +290,9 @@ async fn event_sink_routes_channel_reactions_to_domain_bus() {}),).await- .is_ok()- );- assert!(- sink.publish(+ .is_ok());+ assert!(sink+ .publish("channel","reaction_sent",serde_json::json!({@@ -308,19 +301,16 @@ async fn event_sink_routes_channel_reactions_to_domain_bus() {}),).await- .is_ok()- );+ .is_ok());// Unknown domain/kind is a benign no-op.- assert!(- sink.publish("mystery", "x", serde_json::json!({}))- .await- .is_ok()- );- assert!(- sink.publish("channel", "unknown", serde_json::json!({}))- .await- .is_ok()- );+ assert!(sink+ .publish("mystery", "x", serde_json::json!({}))+ .await+ .is_ok());+ assert!(sink+ .publish("channel", "unknown", serde_json::json!({}))+ .await+ .is_ok());}// --- ConversationHistoryStore --------------------------------------------diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rsindex d8cb1aff0a..7fcd1c0494 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs@@ -3,15 +3,15 @@use std::collections::HashMap;use std::sync::Arc;-use serde_json::{Value, json};+use serde_json::{json, Value};use super::channel::RelayChannel;use super::params::RelayInboundParams;use super::store::{self, Recorded};use crate::channels::context::MAX_CHANNEL_HISTORY;use crate::channels::runtime::{- PromptToolDescs, build_channel_turn_parts, prepare_runtime_limits,- process_channel_runtime_message, runtime_context,+ build_channel_turn_parts, prepare_runtime_limits, process_channel_runtime_message,+ runtime_context, PromptToolDescs,};use crate::config::Config;use crate::core::Outcome;diff --git a/crates/openhuman-core/src/channels/providers/relay/progressive.rs b/crates/openhuman-core/src/channels/providers/relay/progressive.rsindex fa22bd87f9..3ad28460a5 100644--- a/crates/openhuman-core/src/channels/providers/relay/progressive.rs+++ b/crates/openhuman-core/src/channels/providers/relay/progressive.rs@@ -7,8 +7,8 @@ use std::sync::Arc;use tinybus::Error;use tinychannels_bus::{- ChannelBackendRequest, ChannelBackendResult,module_progressive::{ProgressiveTransportRequest, ProgressiveTransportResult},+ ChannelBackendRequest, ChannelBackendResult,};use super::channel::RelayChannel;diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rsindex fe03a6f72f..2fb8d02130 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs@@ -2,7 +2,7 @@//! assembly, dispatching the agentic turn over the native bus, and//! delivering the draft/final reply.-use crate::channels::context::{ChannelRuntimeContext, is_context_window_overflow_error};+use crate::channels::context::{is_context_window_overflow_error, ChannelRuntimeContext};#[cfg(test)]use crate::channels::routes::get_or_create_turn_model_source;use crate::channels::routes::{get_route_selection, handle_runtime_command_with_reset};@@ -18,15 +18,15 @@ use tokio_util::sync::CancellationToken;use tokio_util::task::AbortOnDropHandle;use super::super::helpers::{- REPLY_LOG_TRUNCATE_CHARS, build_channel_context_block, log_worker_join_result,- spawn_typing_task,+ build_channel_context_block, log_worker_join_result, spawn_typing_task,+ REPLY_LOG_TRUNCATE_CHARS,};use super::super::host_agent::{self, HostRoute};-use super::RuntimeChannelMessage;use super::approval::{channel_has_approval_surface, try_route_approval_reply};#[cfg(test)]use super::bus_turn::dispatch_bus_turn;use super::reset_durable_channel_session;+use super::RuntimeChannelMessage;pub(crate) async fn process_channel_message(ctx: Arc<ChannelRuntimeContext>,diff --git a/crates/openhuman-core/src/channels/runtime/startup.rs b/crates/openhuman-core/src/channels/runtime/startup.rsindex 939431462c..68162423bd 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::{PromptToolDescs, build_channel_turn_parts, runtime_context};+pub(crate) use turn_parts::{build_channel_turn_parts, runtime_context, PromptToolDescs};// 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::{PromptToolDescs, build_channel_turn_parts, runtime_c#[cfg(test)]use crate::config::Config;#[cfg(test)]-use chat_workload::{ChatWorkloadResolution, resolve_chat_workload};+use chat_workload::{resolve_chat_workload, ChatWorkloadResolution};#[cfg(any(test, debug_assertions))]use credentials::resolve_yuanbao_app_secret;#[cfg(test)]diff --git a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rsindex cbdd61affc..d6ae6ea8e6 100644--- a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs@@ -19,11 +19,11 @@ use std::collections::BTreeMap;use std::path::Path;use std::sync::Arc;-use serde_json::{Value, json};+use serde_json::{json, Value};use sha2::Digest;use tinychannels_bus::module_delivery::{- DELIVERY_PENDING_CAPACITY, DELIVERY_RECORD_BYTES, DELIVERY_RESULT_CAPACITY,- DELIVERY_RESULT_TTL_SECONDS, DeliveryQueueEntry, DeliveryTerminalResult,+ DeliveryQueueEntry, DeliveryTerminalResult, DELIVERY_PENDING_CAPACITY, DELIVERY_RECORD_BYTES,+ DELIVERY_RESULT_CAPACITY, DELIVERY_RESULT_TTL_SECONDS,};use tinystoragedrivers::{CollectionSpec, DocumentStore, ErrorKind, Precondition};diff --git a/crates/openhuman-core/src/channels/runtime/startup_tests.rs b/crates/openhuman-core/src/channels/runtime/startup_tests.rsindex 691e9fd8da..e8af9daf17 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::{ChatWorkloadResolution, RelayInboundMessageHandler, resolve_chat_workload};+use super::{resolve_chat_workload, ChatWorkloadResolution, RelayInboundMessageHandler};use crate::config::Config;use tinychannels::relay::RelayInboundHandler;diff --git a/crates/openhuman-core/src/threads/channel_projection.rs b/crates/openhuman-core/src/threads/channel_projection.rsindex b27b0d3a11..8bfbb354e1 100644--- a/crates/openhuman-core/src/threads/channel_projection.rs+++ b/crates/openhuman-core/src/threads/channel_projection.rs@@ -7,14 +7,14 @@//! guesses from a sender, recent message, or equality between provider and row//! identifiers.-use anyhow::{Context, Result, anyhow};+use anyhow::{anyhow, Context, Result};use serde::{Deserialize, Serialize};-use serde_json::{Value, json};+use serde_json::{json, Value};use sha2::{Digest, Sha256};use tinychannels_bus::{ChannelRef, ConversationRef};use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition};-use crate::core::runtime::{DispatchCtx, Tenant, tenant::tenant_key};+use crate::core::runtime::{tenant::tenant_key, DispatchCtx, Tenant};use crate::storage::{self, documents::Repo};const DOMAIN: &str = "threads::channel_projection";