Skip to content

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

chore: tidy imports and remove dead code

Steven Enamakel761f35e91d4e
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
index e86448cf43..6b19e7d3c5 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
@@ -415,10 +415,10 @@ pub(crate) struct HarnessHostPolicy {
pub(crate) tool_call_cap: Option<usize>,
}
+pub use super::operation_context::approval_for_tool;
#[cfg(test)]
pub(crate) use super::operation_context::tool_context_with_approval;
pub use super::operation_context::OpenHumanRunExt;
-pub use super::operation_context::approval_for_tool;
pub(crate) use super::operation_context::{
dispatch_ctx_for_tool, memory_identity_for_tool, parent_agent_id_for_tool,
sandbox_mode_for_tool, task_recency_window_for_tool, turn_origin_for_tool,
diff --git a/crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs b/crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs
index c52fbc19eb..68b0f023a5 100644
--- a/crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs
+++ b/crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs
@@ -46,22 +46,6 @@ pub(crate) fn is_safe_endpoint_for_managed_bearer(endpoint: &str) -> bool {
is_loopback_host(&url)
}
-/// API keys belong to TinyHumans. A loopback endpoint is permitted for local
-/// development; an arbitrary TLS host is not a trusted key recipient.
-pub(crate) fn is_managed_endpoint_for_api_key(endpoint: &str) -> bool {
- let Ok(url) = url::Url::parse(endpoint) else {
- return false;
- };
- if !is_safe_endpoint_for_managed_bearer(endpoint) {
- return false;
- }
- matches!(
- url.host_str(),
- Some("api.tinyhumans.ai" | "staging-api.tinyhumans.ai")
- ) && url.scheme() == "https"
- || is_loopback_host(&url)
-}
-
/// Request-metadata key a caller sets (to `true`) to ask for no reasoning on
/// a call — see [`without_reasoning`].
pub const REASONING_OFF_METADATA_KEY: &str = "openhuman_reasoning_off";
diff --git a/crates/openhuman-core/src/modules/mod.rs b/crates/openhuman-core/src/modules/mod.rs
index b710821f95..480e7dd357 100644
--- a/crates/openhuman-core/src/modules/mod.rs
+++ b/crates/openhuman-core/src/modules/mod.rs
@@ -172,7 +172,10 @@ pub use types::{LoadPolicy, ModuleRecord, ModuleSource, ModuleState, ModuleStatu
/// Imports tinymcp's legacy SQLite files under `data_dir` into the module's
/// storage, once per directory. Never fails the caller: an error is logged and
/// the import is retried at the next open.
-pub async fn import_legacy_mcp(ctx: &crate::core::runtime::DispatchCtx, data_dir: &std::path::Path) {
+pub async fn import_legacy_mcp(
+ ctx: &crate::core::runtime::DispatchCtx,
+ data_dir: &std::path::Path,
+) {
#[cfg(feature = "modules")]
match storage_import_tinymcp::import_legacy(ctx, data_dir).await {
Ok(outcome) => log::debug!("[mcp] legacy storage import: {outcome:?}"),
diff --git a/crates/openhuman-core/src/security/egress/enforce_tests.rs b/crates/openhuman-core/src/security/egress/enforce_tests.rs
index 45d6fa4b9a..b39287796b 100644
--- a/crates/openhuman-core/src/security/egress/enforce_tests.rs
+++ b/crates/openhuman-core/src/security/egress/enforce_tests.rs
@@ -130,10 +130,8 @@ fn enforce_egress_blocks_under_local_only_and_allows_otherwise() {
"names the service: {msg}"
);
// A control-plane integration round-trip still flows.
- enforce_egress(
- &EgressDescriptor::integration("/connections").with_control_plane(true),
- )
- .expect("control-plane must be allowed under LocalOnly");
+ enforce_egress(&EgressDescriptor::integration("/connections").with_control_plane(true))
+ .expect("control-plane must be allowed under LocalOnly");
}
// Standard mode permits the same user-data transfer.
diff --git a/crates/openhuman-core/src/tools/ops_tests_execution_and_serde_tests.rs b/crates/openhuman-core/src/tools/ops_tests_execution_and_serde_tests.rs
index a9c453ec37..9400caf46c 100644
--- a/crates/openhuman-core/src/tools/ops_tests_execution_and_serde_tests.rs
+++ b/crates/openhuman-core/src/tools/ops_tests_execution_and_serde_tests.rs
@@ -343,4 +343,3 @@ fn all_tools_omits_search_surface_when_search_is_disabled() {
);
}
}
-
diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rs
index e73b2ddd95..2f8551de1a 100644
--- a/crates/openhuman-embed/src/host_internals.rs
+++ b/crates/openhuman-embed/src/host_internals.rs
@@ -236,10 +236,10 @@ pub mod security {
pub mod session_support {
pub use openhuman_core::security::credentials::session_support::{
build_session_state, classify_session_token, current_session_is_local,
- get_session_token, is_local_session_token, load_app_session_profile, publish_local_session_expiry,
- resolve_backend_credential, BackendCredential, SessionTokenCheck,
- SESSION_EXPIRES_AT_META,
- LOCAL_SESSION_BACKEND_UNAVAILABLE, LOCAL_SESSION_MANAGED_INFERENCE_UNAVAILABLE,
+ get_session_token, is_local_session_token, load_app_session_profile,
+ publish_local_session_expiry, resolve_backend_credential, BackendCredential,
+ SessionTokenCheck, LOCAL_SESSION_BACKEND_UNAVAILABLE,
+ LOCAL_SESSION_MANAGED_INFERENCE_UNAVAILABLE, SESSION_EXPIRES_AT_META,
};
}
pub mod api_key {
@@ -299,8 +299,8 @@ pub mod tool_sources {
/// Egress disclosure, for hosted calls that leave the machine.
pub mod egress {
pub use openhuman_core::security::egress::{
- emit_external_transfer, emit_external_transfer_in, enforce_egress, local_only_blocks, DataKind,
- EgressDescriptor, EgressLedger, EgressReason, IdentificationRisk,
+ emit_external_transfer, emit_external_transfer_in, enforce_egress, local_only_blocks,
+ DataKind, EgressDescriptor, EgressLedger, EgressReason, IdentificationRisk,
};
}
@@ -347,6 +347,7 @@ pub mod wallet_backend {
/// Model-provider registries: chat models, embeddings, catalogs.
pub mod inference_registry {
pub use openhuman_core::inference::provider::factory::PROVIDER_OPENHUMAN;
+ pub use openhuman_core::inference::provider::openhuman_backend_model::REASONING_OFF_METADATA_KEY;
pub use openhuman_core::inference::registry::{
register_catalog, register_catalog_in, register_chat_model, register_chat_model_in,
register_embedding, register_embedding_in, unregister_catalog, unregister_chat_model,
@@ -354,7 +355,6 @@ pub mod inference_registry {
ChatModelEntry, ChatModelFactory, ChatModelRequest, EmbeddingFactory, EmbeddingRequest,
ReadinessProbe,
};
- pub use openhuman_core::inference::provider::openhuman_backend_model::REASONING_OFF_METADATA_KEY;
}
/// Memory engines by id, and the free-background-work predicate.
@@ -381,6 +381,9 @@ pub mod channel_callback {
/// Voice provider registries: STT, TTS and live sessions by slug.
#[cfg(feature = "voice")]
pub mod voice_registry {
+ pub use openhuman_core::config::schema::voice_live::{
+ LIVE_PROVIDER_ELEVENLABS_HOSTED, LIVE_PROVIDER_GEMINI_HOSTED,
+ };
pub use openhuman_core::voice::factory::registry::{
register_stt_provider, register_stt_provider_in, register_tts_provider,
register_tts_provider_in, unregister_stt_provider, unregister_tts_provider,
@@ -393,9 +396,6 @@ pub mod voice_registry {
register_live_provider, register_live_provider_in, unregister_live_provider, ConfigureFn,
ConfiguredFn, LiveFuture, LiveProviderEntry, PrepareFn,
};
- pub use openhuman_core::config::schema::voice_live::{
- LIVE_PROVIDER_ELEVENLABS_HOSTED, LIVE_PROVIDER_GEMINI_HOSTED,
- };
pub use openhuman_core::voice::live::types::{LiveProviderInfo, LiveProviderKind};
pub use openhuman_core::voice::live::{
LiveVoiceError, PreparedProvider, GEMINI_LANGUAGES, GEMINI_VOICES,
diff --git a/crates/openhuman-tinyhumans/src/client/backend_channel_tests.rs b/crates/openhuman-tinyhumans/src/client/backend_channel_tests.rs
index e97db38a58..a3721492a9 100644
--- a/crates/openhuman-tinyhumans/src/client/backend_channel_tests.rs
+++ b/crates/openhuman-tinyhumans/src/client/backend_channel_tests.rs
@@ -309,10 +309,8 @@ async fn sdk_backed_channel_typing_surfaces_unauthorized_on_401() {
// The transport owns what a channel-message 404 means on the backend; these
// pin the recovery the client attaches to each variant.
-use crate::transport::{
- BackendTransport, BackendTransportError, TransportProfile,
-};
use crate::transport::{BackendRequest, BaseUrlPurpose};
+use crate::transport::{BackendTransport, BackendTransportError, TransportProfile};
/// A transport that answers every request with the error `make` builds.
struct FailingTransport(fn() -> BackendTransportError);
diff --git a/crates/openhuman-tinyhumans/src/client/backend_client.rs b/crates/openhuman-tinyhumans/src/client/backend_client.rs
index 63513e6d8b..3157161c8d 100644
--- a/crates/openhuman-tinyhumans/src/client/backend_client.rs
+++ b/crates/openhuman-tinyhumans/src/client/backend_client.rs
@@ -3,11 +3,11 @@
use std::sync::{Arc, Mutex};
-use anyhow::{Context, Result};
+use crate::transport::BackendRequest;
use crate::transport::{BackendTransport, TransportProfile};
+use anyhow::{Context, Result};
use openhuman_embed::__host::config::Config;
use openhuman_embed::__host::security::credentials::session_support::BackendCredential;
-use crate::transport::BackendRequest;
use reqwest::{Client, Method, Url};
use serde_json::Value;
diff --git a/crates/openhuman-tinyhumans/src/client/classify.rs b/crates/openhuman-tinyhumans/src/client/classify.rs
index 3b4647a818..fd8147612d 100644
--- a/crates/openhuman-tinyhumans/src/client/classify.rs
+++ b/crates/openhuman-tinyhumans/src/client/classify.rs
@@ -2,8 +2,8 @@
//! expected states (typed [`HostedApiError`]s), which are transient noise, and
//! which are reported.
-use anyhow::{Context, Result};
use crate::transport::BackendTransportError;
+use anyhow::{Context, Result};
use openhuman_embed::__host::core::observability::{
contains_transient_transport_phrase, is_transient_http_status_code, report_error,
};
diff --git a/crates/openhuman-tinyhumans/src/client/integrations_http.rs b/crates/openhuman-tinyhumans/src/client/integrations_http.rs
index 03c5154835..cc172afa7f 100644
--- a/crates/openhuman-tinyhumans/src/client/integrations_http.rs
+++ b/crates/openhuman-tinyhumans/src/client/integrations_http.rs
@@ -12,15 +12,13 @@
use std::sync::{Arc, OnceLock};
use std::time::Duration;
+use crate::transport::BackendRequest;
+use crate::transport::{BackendTransport, BackendTransportError, TransportProfile};
use anyhow::Result;
-use crate::transport::{
- BackendTransport, BackendTransportError, TransportProfile,
-};
use openhuman_embed::__host::security::credentials::session_support::BackendCredential;
use openhuman_embed::__host::util::redact_url_for_log;
use openhuman_embed::__host::util::tls::tls_client_builder;
use openhuman_embed::__host::util::url::{join_url, normalize_backend_api_base_url};
-use crate::transport::BackendRequest;
use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION};
use reqwest::Method;
use serde_json::Value;
diff --git a/crates/openhuman-tinyhumans/src/hosted/client.rs b/crates/openhuman-tinyhumans/src/hosted/client.rs
index d4f0498b94..e6d170a9c9 100644
--- a/crates/openhuman-tinyhumans/src/hosted/client.rs
+++ b/crates/openhuman-tinyhumans/src/hosted/client.rs
@@ -120,10 +120,12 @@ impl HostedClient {
/// Reject hosted calls when this crate's transport cannot be built.
fn require_transport() -> Result<(), String> {
- crate::client::shared_transport().map(|_| ()).map_err(|err| {
- log::debug!("{LOG_PREFIX} backend transport unavailable; skipping request: {err:#}");
- format!("{BACKEND_UNAVAILABLE_PREFIX} no backend transport installed")
- })
+ crate::client::shared_transport()
+ .map(|_| ())
+ .map_err(|err| {
+ log::debug!("{LOG_PREFIX} backend transport unavailable; skipping request: {err:#}");
+ format!("{BACKEND_UNAVAILABLE_PREFIX} no backend transport installed")
+ })
}
/// The backend origin with any path, query and fragment stripped — the same
diff --git a/crates/openhuman-tinyhumans/src/hosted/team/ops.rs b/crates/openhuman-tinyhumans/src/hosted/team/ops.rs
index b8176d1d7a..b11f0967e9 100644
--- a/crates/openhuman-tinyhumans/src/hosted/team/ops.rs
+++ b/crates/openhuman-tinyhumans/src/hosted/team/ops.rs
@@ -17,9 +17,9 @@ use tinyhumans_sdk::api::types::{CodeRequest, CreateTeamInviteRequest};
use crate::backend::url::effective_backend_api_url;
use crate::client::BackendClient;
+use crate::integrations::client::budget_gate;
use openhuman_embed::__host::config::Config;
use openhuman_embed::__host::core::Outcome;
-use crate::integrations::client::budget_gate;
use crate::hosted::client::HostedClient;
diff --git a/crates/openhuman-tinyhumans/src/integrations/client/requests_tests.rs b/crates/openhuman-tinyhumans/src/integrations/client/requests_tests.rs
index 656d6ca2f2..8bdfcb29ad 100644
--- a/crates/openhuman-tinyhumans/src/integrations/client/requests_tests.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/client/requests_tests.rs
@@ -61,8 +61,8 @@ fn control_plane_does_not_exempt_user_data_paths() {
#[test]
fn local_only_keeps_control_plane_flowing_and_blocks_user_data() {
- use openhuman_embed::__host::egress::local_only_blocks;
use openhuman_embed::__host::config::PrivacyMode;
+ use openhuman_embed::__host::egress::local_only_blocks;
let pricing = backend_egress_descriptor("/agent-integrations/pricing");
assert!(!local_only_blocks(PrivacyMode::LocalOnly, &pricing));
let execute = backend_egress_descriptor("/agent-integrations/composio/execute");
diff --git a/crates/openhuman-tinyhumans/src/lib.rs b/crates/openhuman-tinyhumans/src/lib.rs
index ee006f61dd..ab32e6f844 100644
--- a/crates/openhuman-tinyhumans/src/lib.rs
+++ b/crates/openhuman-tinyhumans/src/lib.rs
@@ -95,9 +95,6 @@ pub mod voice;
pub use backend::{product_identity, set_product_identity, ProductIdentity};
pub use hosted::extension as hosted_controllers;
pub use install::{install, is_installed, InstallError, InstallOptions};
-pub use transport::{
- BackendRequest, BackendTransport, BackendTransportError, BaseUrlPurpose, TransportProfile,
-};
pub use runtime::{RuntimeBuilder, RuntimeError};
pub use session::{
cache::{CachedUser, CurrentUserCache},
@@ -111,3 +108,6 @@ pub use session::{
manager::{SessionError, SessionEvent, SessionManager, SessionState},
};
pub use transport::{map_sdk_error, SdkBackendTransport};
+pub use transport::{
+ BackendRequest, BackendTransport, BackendTransportError, BaseUrlPurpose, TransportProfile,
+};
diff --git a/crates/openhuman-tinyhumans/src/transport/port.rs b/crates/openhuman-tinyhumans/src/transport/port.rs
index 0704dbd62c..b857492c16 100644
--- a/crates/openhuman-tinyhumans/src/transport/port.rs
+++ b/crates/openhuman-tinyhumans/src/transport/port.rs
@@ -129,7 +129,6 @@ pub enum BaseUrlPurpose {
Inference,
}
-
/// Failure of a single backend round-trip, as seen by the core.
#[derive(Debug, thiserror::Error)]
pub enum BackendTransportError {
diff --git a/crates/openhuman-tinyhumans/src/transport/transport_tests.rs b/crates/openhuman-tinyhumans/src/transport/transport_tests.rs
index 97f8317649..935d4bd773 100644
--- a/crates/openhuman-tinyhumans/src/transport/transport_tests.rs
+++ b/crates/openhuman-tinyhumans/src/transport/transport_tests.rs
@@ -2,9 +2,7 @@
//! code relies on, pinned against a mock backend.
use super::*;
-use crate::transport::{
- clear_backend_transport, resolve_backend_transport,
-};
+use crate::transport::{clear_backend_transport, resolve_backend_transport};
use serde_json::json;
use wiremock::matchers::{header, header_exists, method, path};
use wiremock::{Mock, MockServer, ResponseTemplate};