Skip to content

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

style: apply rustfmt import ordering and formatting

Steven Enamakela573d101cfde
diff --git a/crates/openhuman-core/src/threads/mod.rs b/crates/openhuman-core/src/threads/mod.rs
index f30571bae4..15bd3a827e 100644
--- a/crates/openhuman-core/src/threads/mod.rs
+++ b/crates/openhuman-core/src/threads/mod.rs
@@ -18,7 +18,7 @@ pub mod welcome_migration;
pub(crate) mod worker_mirror;
pub(crate) mod worker_thread;
-pub use error::{THREAD_NOT_FOUND_KIND, ThreadsError};
+pub use error::{ThreadsError, THREAD_NOT_FOUND_KIND};
pub use rpc_models::*;
#[doc(hidden)]
pub use run_mode::{parse_mode_label, set_mode};
@@ -26,7 +26,7 @@ pub use schemas::{
all_controller_schemas as all_threads_controller_schemas,
all_registered_controllers as all_threads_registered_controllers,
};
-pub use welcome_migration::{WelcomeMigrationResult, migrate_welcome_agent_artifacts};
+pub use welcome_migration::{migrate_welcome_agent_artifacts, WelcomeMigrationResult};
/// Log prefix for thread-title generation (grep-friendly).
pub(crate) const THREAD_TITLE_LOG_PREFIX: &str = "[threads:title]";
diff --git a/crates/openhuman-core/src/threads/ops/crud.rs b/crates/openhuman-core/src/threads/ops/crud.rs
index be999db407..542981c959 100644
--- a/crates/openhuman-core/src/threads/ops/crud.rs
+++ b/crates/openhuman-core/src/threads/ops/crud.rs
@@ -5,11 +5,11 @@ use super::support::{
counts, envelope, message_to_record, record_to_message, run_to_completion, thread_to_summary,
workspace_dir,
};
-use crate::core::Outcome;
use crate::core::runtime::DispatchCtx;
-use crate::threads::ThreadsError;
+use crate::core::Outcome;
use crate::threads::store as conversations;
use crate::threads::store::{ConversationMessagePatch, CrossThreadHit};
+use crate::threads::ThreadsError;
use crate::threads::{
ApiEnvelope, AppendConversationMessageRequest, ConversationMessageRecord,
ConversationMessagesRequest, ConversationMessagesResponse, ConversationThreadSummary,
diff --git a/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs b/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs
index d1e5108cd7..1eff122c93 100644
--- a/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs
@@ -98,15 +98,10 @@ async fn user_append_stages_original_strips_upload_bytes_and_reuses_returned_con
.data
.unwrap();
assert_eq!(second.content, first.content);
- let staged = crate::attachments::stage_turn(
- &second.content,
- Some(&config),
- None,
- Some("uploads"),
- None,
- )
- .await
- .unwrap();
+ let staged =
+ crate::attachments::stage_turn(&second.content, Some(&config), None, Some("uploads"), None)
+ .await
+ .unwrap();
assert_eq!(staged, first.content);
let persisted = conversations::blocking::get_messages(
crate::core::runtime::DispatchCtx::ambient(),
diff --git a/crates/openhuman-core/src/threads/ops/edit.rs b/crates/openhuman-core/src/threads/ops/edit.rs
index c850a26232..2c0c512362 100644
--- a/crates/openhuman-core/src/threads/ops/edit.rs
+++ b/crates/openhuman-core/src/threads/ops/edit.rs
@@ -39,19 +39,19 @@
//! turn.
use serde::{Deserialize, Serialize};
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use tinyagents_session::transcript::{
SessionRef, SessionTranscript, TranscriptLocator, TranscriptMessage, TranscriptMeta,
TruncateCut,
};
-use crate::core::Outcome;
use crate::core::runtime::DispatchCtx;
-use crate::threads::ThreadsError;
+use crate::core::Outcome;
use crate::threads::store::{self as conversations, reply_run_id, run_reply_message_id};
+use crate::threads::ThreadsError;
-use super::support::{TranscriptStore, transcript_store, workspace_dir};
+use super::support::{transcript_store, workspace_dir, TranscriptStore};
#[derive(Debug, Clone, Deserialize)]
#[serde(deny_unknown_fields)]
diff --git a/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs b/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
index 6d5b0e916b..dcc76c3c5d 100644
--- a/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
@@ -6,7 +6,7 @@
//! truncation tests do.
use super::*;
-use crate::threads::store::{self as conversations, ConversationMessage, run_reply_message_id};
+use crate::threads::store::{self as conversations, run_reply_message_id, ConversationMessage};
use serde_json::json;
use std::sync::Arc;
use tempfile::TempDir;
diff --git a/crates/openhuman-core/src/threads/ops/purge.rs b/crates/openhuman-core/src/threads/ops/purge.rs
index 92f26cae7c..8b32e0c25d 100644
--- a/crates/openhuman-core/src/threads/ops/purge.rs
+++ b/crates/openhuman-core/src/threads/ops/purge.rs
@@ -1,8 +1,8 @@
//! Workspace-wide conversation purge.
use super::support::{envelope, run_to_completion, workspace_dir};
-use crate::core::Outcome;
use crate::core::runtime::DispatchCtx;
+use crate::core::Outcome;
use crate::threads::store as conversations;
use crate::threads::{ApiEnvelope, EmptyRequest, PurgeConversationThreadsResponse};
use std::path::PathBuf;
diff --git a/crates/openhuman-core/src/threads/ops/support.rs b/crates/openhuman-core/src/threads/ops/support.rs
index aa6b60a335..e6172c8b5a 100644
--- a/crates/openhuman-core/src/threads/ops/support.rs
+++ b/crates/openhuman-core/src/threads/ops/support.rs
@@ -3,11 +3,11 @@
//! store-type <-> wire-type conversions every handler needs.
use crate::config::Config;
-use crate::core::runtime::DispatchCtx;
use crate::core::runtime::context::CoreContext;
-use crate::threads::THREAD_TITLE_LOG_PREFIX;
+use crate::core::runtime::DispatchCtx;
use crate::threads::store as conversations;
use crate::threads::store::{ConversationMessage, ConversationThread};
+use crate::threads::THREAD_TITLE_LOG_PREFIX;
use crate::threads::{ConversationMessageRecord, ConversationThreadSummary};
use std::path::PathBuf;
use tinyagents_harness::title::{title_from_user_message, title_log_fingerprint};
diff --git a/crates/openhuman-core/src/threads/run_mode.rs b/crates/openhuman-core/src/threads/run_mode.rs
index d1deda68ab..467c38c614 100644
--- a/crates/openhuman-core/src/threads/run_mode.rs
+++ b/crates/openhuman-core/src/threads/run_mode.rs
@@ -100,8 +100,8 @@ pub fn parse_mode_label(label: &str) -> Option<RunMode> {
// `schemas.rs` because this module IS the domain's entire surface (registry
// + RPC), not a multi-file domain directory.
-use serde::Deserialize;
use serde::de::DeserializeOwned;
+use serde::Deserialize;
use serde_json::{Map, Value};
use crate::core::all::{ControllerFuture, RegisteredController};
diff --git a/crates/openhuman-core/src/threads/run_mode_tests.rs b/crates/openhuman-core/src/threads/run_mode_tests.rs
index 51e09615f4..d0586b0d24 100644
--- a/crates/openhuman-core/src/threads/run_mode_tests.rs
+++ b/crates/openhuman-core/src/threads/run_mode_tests.rs
@@ -56,7 +56,7 @@ fn mode_label_round_trips() {
#[tokio::test]
async fn plan_mode_stays_with_the_agent_that_set_it() {
use crate::core::runtime::agent_scope::test_agent_context;
- use crate::core::runtime::{DomainSet, context::CoreContext};
+ use crate::core::runtime::{context::CoreContext, DomainSet};
let root = CoreContext::for_test(DomainSet::full(), None);
let alpha = test_agent_context(&root, "alpha");
let beta = test_agent_context(&root, "beta");
diff --git a/crates/openhuman-core/src/threads/transcript_host_tests.rs b/crates/openhuman-core/src/threads/transcript_host_tests.rs
index bbc8dd48d4..778badb4ec 100644
--- a/crates/openhuman-core/src/threads/transcript_host_tests.rs
+++ b/crates/openhuman-core/src/threads/transcript_host_tests.rs
@@ -10,10 +10,10 @@ use std::sync::Arc;
use crate::storage::sessions::splice_fixture_tests::memory_locator;
use tempfile::TempDir;
-use tinyagents_session::transcript::TranscriptMessage;
use tinyagents_session::transcript::view::{
- DisplayItem, ToolCallStatus, project_records, project_thread_in,
+ project_records, project_thread_in, DisplayItem, ToolCallStatus,
};
+use tinyagents_session::transcript::TranscriptMessage;
use tinyagents_session::transcript::{self, TranscriptLocator};
/// A thread's display records, read back through the store port.
diff --git a/crates/openhuman-core/src/threads/worker_mirror.rs b/crates/openhuman-core/src/threads/worker_mirror.rs
index 2e1f99dc7a..31b0a0bb58 100644
--- a/crates/openhuman-core/src/threads/worker_mirror.rs
+++ b/crates/openhuman-core/src/threads/worker_mirror.rs
@@ -22,7 +22,7 @@ fn append_worker_message(
sender: &str,
metadata: serde_json::Value,
) {
- use crate::threads::store::{ConversationMessage as StoredMessage, append_message};
+ use crate::threads::store::{append_message, ConversationMessage as StoredMessage};
let mut extra = serde_json::json!({
"scope": "worker_thread",
"agent_id": agent_id,
diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rs
index 71f785a5c6..5d3e6ae447 100644
--- a/crates/openhuman-embed/src/host_internals.rs
+++ b/crates/openhuman-embed/src/host_internals.rs
@@ -20,16 +20,16 @@ pub use openhuman_core::run_core_from_args;
/// Shared by tinyhumans (hosted controllers) and rpc (`http_host`, `/health`).
pub mod core {
pub use openhuman_core::core::{
- ControllerSchema, FieldSchema, Outcome, StructuredRpcError, TypeSchema, unwrap_rpc,
+ unwrap_rpc, ControllerSchema, FieldSchema, Outcome, StructuredRpcError, TypeSchema,
};
pub mod all {
// tinyhumans: hosted controller extension; rpc: http_host + `/health`.
pub use openhuman_core::core::all::{
- ControllerExtension, ControllerFuture, DomainGroup, RegisteredController,
all_controller_schemas, all_http_method_schemas, cli_handler_for_namespace,
namespace_description, register_controller_extension, rpc_method_from_parts,
- schema_for_rpc_method,
+ schema_for_rpc_method, ControllerExtension, ControllerFuture, DomainGroup,
+ RegisteredController,
};
}
@@ -37,30 +37,30 @@ pub mod core {
/// RPC handler and classifier (rpc).
pub mod observability {
pub use openhuman_core::core::observability::{
- API_KEY_REJECTED_PREFIX, BACKEND_UNAVAILABLE_PREFIX, ExpectedErrorKind,
- REPORT_ERROR_TRACING_TARGET, contains_transient_transport_phrase, expected_error_kind,
- is_api_key_rejected_message, is_session_expired_message,
- is_suppressed_usage_probe_backoff, is_transient_http_status_code,
- is_transient_message_failure, report_error_or_expected, report_warning_message,
+ contains_transient_transport_phrase, expected_error_kind, is_api_key_rejected_message,
+ is_session_expired_message, is_suppressed_usage_probe_backoff,
+ is_transient_http_status_code, is_transient_message_failure, report_error_or_expected,
+ report_warning_message, ExpectedErrorKind, API_KEY_REJECTED_PREFIX,
+ BACKEND_UNAVAILABLE_PREFIX, REPORT_ERROR_TRACING_TARGET,
};
}
// rpc server only, below.
pub mod auth {
pub use openhuman_core::core::auth::{
- CORE_TOKEN_ENV_VAR, bearer_matches, get_rpc_token, init_rpc_token,
- init_rpc_token_with_value, verify_bearer_token,
+ bearer_matches, get_rpc_token, init_rpc_token, init_rpc_token_with_value,
+ verify_bearer_token, CORE_TOKEN_ENV_VAR,
};
}
pub mod bus {
- pub use openhuman_core::core::bus::{BUS, init};
+ pub use openhuman_core::core::bus::{init, BUS};
}
pub mod cli {
pub use openhuman_core::core::cli::load_dotenv_for_cli;
}
pub mod dispatch {
pub use openhuman_core::core::dispatch::{
- UNKNOWN_METHOD_PREFIX, is_known_probe_method, unknown_method_name,
+ is_known_probe_method, unknown_method_name, UNKNOWN_METHOD_PREFIX,
};
}
pub mod event_bind_tokens {
@@ -80,14 +80,14 @@ pub mod core {
}
pub mod runtime {
pub use openhuman_core::core::runtime::{
- CoreContext, CoreRuntime, DispatchCtx, Mode, SaasConfig, current_tenant, is_saas,
+ current_tenant, is_saas, CoreContext, CoreRuntime, DispatchCtx, Mode, SaasConfig,
};
pub mod saas {
pub use openhuman_core::core::runtime::saas::build;
}
}
pub mod server_launcher {
- pub use openhuman_core::core::server_launcher::{ServeRequest, install_server_launcher};
+ pub use openhuman_core::core::server_launcher::{install_server_launcher, ServeRequest};
}
pub mod session_expiry {
pub use openhuman_core::core::session_expiry::is_session_expired_error;
@@ -103,13 +103,13 @@ pub mod core {
/// tinyhumans (backend transport, hosted client, team ops) and rpc (`/health`).
pub mod backend {
pub use openhuman_core::backend::{
- BackendApiError, BackendClient, base_url, flatten_authed_error,
+ base_url, flatten_authed_error, BackendApiError, BackendClient,
};
pub mod transport {
pub use openhuman_core::backend::transport::{
- BackendTransport, BackendTransportError, TransportProfile, clear_backend_transport,
- resolve_backend_transport,
+ clear_backend_transport, resolve_backend_transport, BackendTransport,
+ BackendTransportError, TransportProfile,
};
}
}
@@ -117,14 +117,14 @@ pub mod backend {
/// tinyhumans (every hosted controller loads its config) and rpc (server).
pub mod config {
pub use openhuman_core::config::{
- Config, active_workspace_dir, active_workspace_dir_cached, active_workspace_snapshot,
- load_config_with_timeout, workspace_handle,
+ active_workspace_dir, active_workspace_dir_cached, active_workspace_snapshot,
+ load_config_with_timeout, workspace_handle, Config,
};
pub mod app_env {
// tinyhumans: backend URL selection.
pub use openhuman_core::config::app_env::{
- APP_ENV_VAR, VITE_APP_ENV_VAR, app_env_from_env, is_staging_app_env,
+ app_env_from_env, is_staging_app_env, APP_ENV_VAR, VITE_APP_ENV_VAR,
};
}
pub mod ops {
@@ -167,8 +167,8 @@ pub mod agent {
}
pub mod session_store {
pub use openhuman_core::storage::sessions::{
- ReboundSessionStores, WorkspaceSessionStores, context_workspace_dir, install,
- installed, restore,
+ context_workspace_dir, install, installed, restore, ReboundSessionStores,
+ WorkspaceSessionStores,
};
}
}
@@ -185,8 +185,8 @@ pub mod channels {
pub mod inference {
pub mod embedding_host {
pub use openhuman_core::inference::embedding_host::{
- SharedEmbeddingModel, default_embedding_provider_for_chat,
- default_embedding_provider_with_config,
+ default_embedding_provider_for_chat, default_embedding_provider_with_config,
+ SharedEmbeddingModel,
};
}
pub mod provider {
@@ -195,9 +195,9 @@ pub mod inference {
}
}
pub mod http {
- pub use openhuman_core::inference::http::EXTERNAL_OPENAI_COMPAT_PROVIDER;
#[cfg(feature = "http-server")]
pub use openhuman_core::inference::http::router;
+ pub use openhuman_core::inference::http::EXTERNAL_OPENAI_COMPAT_PROVIDER;
}
}
@@ -214,16 +214,16 @@ pub mod security {
/// Host-supplied secret storage and encryption-key sources.
pub mod secret_storage {
pub use openhuman_core::security::secret_storage::{
- EncryptedFileBackend, MasterKeySource, SecretBackend, SecretStorageError,
clear_master_key_source, clear_secret_backend, init_workspace,
install_master_key_source, install_secret_backend, installed_master_key_source,
installed_secret_backend, is_available, store::workspace_dir_for_file_backend,
+ EncryptedFileBackend, MasterKeySource, SecretBackend, SecretStorageError,
};
}
pub mod credentials {
pub use openhuman_core::security::credentials::{
- APP_SESSION_PROVIDER, AuthService, DEFAULT_AUTH_PROFILE_NAME,
- channel_credential_provider,
+ channel_credential_provider, AuthService, APP_SESSION_PROVIDER,
+ DEFAULT_AUTH_PROFILE_NAME,
};
pub mod ops {
pub use openhuman_core::security::credentials::ops::{
@@ -232,8 +232,8 @@ pub mod security {
}
pub mod session_support {
pub use openhuman_core::security::credentials::session_support::{
- BackendCredential, LOCAL_SESSION_BACKEND_UNAVAILABLE, build_session_state,
- current_session_is_local, resolve_backend_credential,
+ build_session_state, current_session_is_local, resolve_backend_credential,
+ BackendCredential, LOCAL_SESSION_BACKEND_UNAVAILABLE,
};
}
}
@@ -285,7 +285,7 @@ pub mod platform {
pub mod connectivity {
pub mod rpc {
pub use openhuman_core::platform::connectivity::rpc::{
- OccupiedByCore, pick_listen_port_for_host_with,
+ pick_listen_port_for_host_with, OccupiedByCore,
};
}
}
@@ -296,16 +296,16 @@ pub mod platform {
pub mod storage {
pub use openhuman_core::storage::{
- STORAGE_URL_VAR, StorageBackend, block_on, block_on_anyhow, clear, configured_url,
- driver_is_shared, install, install_for_url, installed, open, url_from,
+ block_on, block_on_anyhow, clear, configured_url, driver_is_shared, install,
+ install_for_url, installed, open, url_from, StorageBackend, STORAGE_URL_VAR,
};
}
pub mod profiles {
pub mod gateway {
pub use openhuman_core::profiles::gateway::{
- GatewayRefusal, GatewayScope, HeldBy, PROFILE_HELD, PROFILE_OWNER_HEADER, USER_HEADER,
- USER_SIG_HEADER, resolve_scope, sign, verify,
+ resolve_scope, sign, verify, GatewayRefusal, GatewayScope, HeldBy, PROFILE_HELD,
+ PROFILE_OWNER_HEADER, USER_HEADER, USER_SIG_HEADER,
};
}
pub mod host {
@@ -347,9 +347,9 @@ pub mod web3 {
pub mod web_chat {
pub use openhuman_core::web_chat::{
- ChatRequestMetadata, GuardrailPayload, StartChatError, WebChannelEvent,
approval_request_event, cancel_chat_scoped, plan_review_request_event,
publish_web_channel_event, start_chat, subscribe_web_channel_events, unix_epoch_ms,
+ ChatRequestMetadata, GuardrailPayload, StartChatError, WebChannelEvent,
};
}
diff --git a/crates/openhuman-embed/src/runtime/seams_tests.rs b/crates/openhuman-embed/src/runtime/seams_tests.rs
index 0b236451ea..9bcf0ba144 100644
--- a/crates/openhuman-embed/src/runtime/seams_tests.rs
+++ b/crates/openhuman-embed/src/runtime/seams_tests.rs
@@ -30,7 +30,10 @@ struct NamedPostTurn(&'static str);
#[async_trait::async_trait]
impl LearningSink for NamedPostTurn {
- async fn on_turn_complete(&self, _ctx: &TurnSummary) -> anyhow::Result<()> {
+ async fn on_turn_complete(
+ &self,
+ _ctx: &TurnSummary,
+ ) -> Result<(), tinyagents_session::TinyAgentsError> {
Ok(())
}
}
@@ -63,17 +66,13 @@ fn live_replacement_and_removal_update_builder_hooks_and_restore_predecessors()
"seams-live-tool",
Some(Arc::new(NamedToolHook("different-tool-name"))),
);
- assert!(
- embedder_tool_hooks()
- .iter()
- .any(|hook| hook.name() == "seams-live-tool")
- );
+ assert!(embedder_tool_hooks()
+ .iter()
+ .any(|hook| hook.name() == "seams-live-tool"));
seams.tool_hook("seams-live-tool", None);
- assert!(
- !embedder_tool_hooks()
- .iter()
- .any(|hook| hook.name() == "seams-live-tool")
- );
+ assert!(!embedder_tool_hooks()
+ .iter()
+ .any(|hook| hook.name() == "seams-live-tool"));
drop(seams);
assert!(Arc::ptr_eq(
&embedder_post_turn_hook_named(name).unwrap(),
diff --git a/crates/openhuman-embed/src/turn.rs b/crates/openhuman-embed/src/turn.rs
index 467225c88e..4f792ea507 100644
--- a/crates/openhuman-embed/src/turn.rs
+++ b/crates/openhuman-embed/src/turn.rs
@@ -49,8 +49,8 @@ use openhuman_core::security::turn_origin::AgentTurnOrigin;
#[path = "turn_types.rs"]
mod types;
-pub use types::{Route, TurnOutcome, TurnRequest};
pub(crate) use types::{is_safe_endpoint_for_bearer, sanitize_url_for_display};
+pub use types::{Route, TurnOutcome, TurnRequest};
#[path = "turn_control.rs"]
mod control;
@@ -173,11 +173,11 @@ impl Turn {
pub fn tools(
mut self,
factory: impl for<'a> Fn(
- openhuman_core::agent::TurnContext<'a>,
- ) -> openhuman_core::agent::HostTurnTools
- + Send
- + Sync
- + 'static,
+ openhuman_core::agent::TurnContext<'a>,
+ ) -> openhuman_core::agent::HostTurnTools
+ + Send
+ + Sync
+ + 'static,
) -> Self {
self.tools = Some(Arc::new(factory));
self
@@ -606,7 +606,7 @@ async fn dispatch(
let turn: futures_box::BoxFuture<'_, Result<AgentReply, CoreError>> =
Box::pin(async move {
use openhuman_core::inference::host_runtime::ops::{
- AgentChatTarget, agent_chat_reply_for,
+ agent_chat_reply_for, AgentChatTarget,
};
let mut config = dispatch
.load_config()
@@ -652,7 +652,7 @@ async fn dispatch(
let turn: futures_box::BoxFuture<'_, Result<AgentReply, CoreError>> =
Box::pin(async move {
use openhuman_core::inference::host_runtime::ops::{
- AgentChatTarget, agent_chat_for,
+ agent_chat_for, AgentChatTarget,
};
let mut config = inner.config.clone();
let route = openhuman_core::config::schema::EphemeralRoute::from_params(