Skip to content

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

style: apply rustfmt formatting across openhuman-rpc

Steven Enamakel2123403f35f2
diff --git a/crates/openhuman-rpc/src/host.rs b/crates/openhuman-rpc/src/host.rs
index 482e19ce7c..e6fd212f0c 100644
--- a/crates/openhuman-rpc/src/host.rs
+++ b/crates/openhuman-rpc/src/host.rs
@@ -187,8 +187,8 @@ pub fn tui_builder() -> RuntimeBuilder {
///
/// The transport or runtime could not be built.
#[cfg(feature = "session-store")]
-pub async fn tui() -> Result<openhuman_tinyhumans::embed::Runtime, openhuman_tinyhumans::RuntimeError>
-{
+pub async fn tui(
+) -> Result<openhuman_tinyhumans::embed::Runtime, openhuman_tinyhumans::RuntimeError> {
log::debug!("[rpc:host] tui: building connected runtime");
let runtime = tui_builder().build().await?;
log::info!("[rpc:host] tui: core built (DomainSet::full, ServiceSet::none)");
diff --git a/crates/openhuman-rpc/src/host_tests.rs b/crates/openhuman-rpc/src/host_tests.rs
index 0287b89326..947abfada3 100644
--- a/crates/openhuman-rpc/src/host_tests.rs
+++ b/crates/openhuman-rpc/src/host_tests.rs
@@ -11,7 +11,10 @@ fn cli_builder_is_the_cli_preset_with_server_and_http_host() {
assert_eq!(summary.host_kind, HostKind::detect_standalone());
assert_eq!(summary.domains, Some(DomainSet::full()));
assert_eq!(summary.services, Some(ServiceSet::desktop()));
- assert!(!summary.fixed_token, "the CLI reads its bearer from env/file");
+ assert!(
+ !summary.fixed_token,
+ "the CLI reads its bearer from env/file"
+ );
assert!(summary.has_server_launcher, "`run`/`serve` need the server");
assert_eq!(summary.controller_extensions, vec![DomainGroup::Platform]);
}
@@ -75,7 +78,9 @@ fn desktop_connected_builder_binds_the_transport_and_hosted_controllers() {
.summary();
assert!(summary.has_backend_transport);
assert!(summary.controller_extensions.contains(&DomainGroup::Hosted));
- assert!(summary.controller_extensions.contains(&DomainGroup::Platform));
+ assert!(summary
+ .controller_extensions
+ .contains(&DomainGroup::Platform));
}
#[cfg(feature = "session-store")]
diff --git a/crates/openhuman-rpc/src/http_host/auth.rs b/crates/openhuman-rpc/src/http_host/auth.rs
index f050be243c..95cae22852 100644
--- a/crates/openhuman-rpc/src/http_host/auth.rs
+++ b/crates/openhuman-rpc/src/http_host/auth.rs
@@ -3,10 +3,10 @@ use axum::response::{IntoResponse, Response};
use base64::Engine as _;
use rand::RngExt as _;
-use crate::http_host::types::HostedDirAuth;
-use crate::http_host::LOG_PREFIX;
use crate::core_host::config;
use crate::core_host::security::credentials::session_support;
+use crate::http_host::types::HostedDirAuth;
+use crate::http_host::LOG_PREFIX;
// The `Err` is the ready-to-send 401 `Response`; the core crate allows this
// lint crate-wide, and boxing it would only add an allocation per rejection.
diff --git a/crates/openhuman-rpc/src/http_host/mod.rs b/crates/openhuman-rpc/src/http_host/mod.rs
index 80b246c66c..e2a1e76b65 100644
--- a/crates/openhuman-rpc/src/http_host/mod.rs
+++ b/crates/openhuman-rpc/src/http_host/mod.rs
@@ -28,7 +28,9 @@ pub use schemas::{
pub(crate) const LOG_PREFIX: &str = "[http_host]";
-use crate::core_host::core::all::{register_controller_extension, ControllerExtension, DomainGroup};
+use crate::core_host::core::all::{
+ register_controller_extension, ControllerExtension, DomainGroup,
+};
const NAMESPACES: &[(&str, &str)] = &[(
"http_host",
diff --git a/crates/openhuman-rpc/src/http_host/rpc.rs b/crates/openhuman-rpc/src/http_host/rpc.rs
index 6e3f863230..bcf241e445 100644
--- a/crates/openhuman-rpc/src/http_host/rpc.rs
+++ b/crates/openhuman-rpc/src/http_host/rpc.rs
@@ -1,11 +1,11 @@
//! RPC adapters for the `http_host` domain.
+use crate::core_host::core::Outcome;
use crate::http_host::ops;
use crate::http_host::types::{
HostedDirGetResult, HostedDirListResult, HostedDirLookupParams, HostedDirStartResult,
HostedDirStopResult, StartHostedDirParams,
};
-use crate::core_host::core::Outcome;
pub async fn start(params: StartHostedDirParams) -> Result<Outcome<HostedDirStartResult>, String> {
let server = ops::start_hosted_dir_server(params).await?;
diff --git a/crates/openhuman-rpc/src/lib.rs b/crates/openhuman-rpc/src/lib.rs
index 6acf571da5..2d6534e612 100644
--- a/crates/openhuman-rpc/src/lib.rs
+++ b/crates/openhuman-rpc/src/lib.rs
@@ -38,9 +38,9 @@ pub(crate) use openhuman_tinyhumans::embed::__host as core_host;
#[cfg(feature = "http-client")]
mod client;
+mod envelope;
#[cfg(any(feature = "server", feature = "session-store"))]
pub mod host;
-mod envelope;
#[cfg(feature = "server")]
pub mod http_host;
mod origin;
@@ -49,11 +49,11 @@ pub mod server;
#[cfg(feature = "session-store")]
pub mod session_store;
+pub use crate::core_host::core::unwrap_rpc;
#[cfg(feature = "http-client")]
pub use client::{bearer_header, post_json_rpc, redact_url_for_log, HttpRpcResponse};
pub use envelope::{
decode_response, request_body, RpcError, RpcFailure, RpcRequest, RpcSuccess, JSONRPC_VERSION,
SERVER_ERROR_CODE,
};
-pub use crate::core_host::core::unwrap_rpc;
pub use origin::{is_origin_allowed_with_extra, ALLOWED_ORIGINS_ENV};
diff --git a/crates/openhuman-rpc/src/server/auth.rs b/crates/openhuman-rpc/src/server/auth.rs
index 3df2bd2c84..6c0fcc0fa5 100644
--- a/crates/openhuman-rpc/src/server/auth.rs
+++ b/crates/openhuman-rpc/src/server/auth.rs
@@ -182,7 +182,9 @@ fn verify_external_inference_bearer_for_config(config: &Config, supplied: &str)
let auth = AuthService::from_config(config);
match auth.get_provider_bearer_token(EXTERNAL_OPENAI_COMPAT_PROVIDER, None) {
- Ok(Some(expected)) => crate::core_host::core::auth::bearer_matches(supplied, expected.trim()),
+ Ok(Some(expected)) => {
+ crate::core_host::core::auth::bearer_matches(supplied, expected.trim())
+ }
Ok(None) => false,
Err(err) => {
log::warn!("[auth] failed to read external inference bearer: {err}");
diff --git a/crates/openhuman-rpc/src/server/cli.rs b/crates/openhuman-rpc/src/server/cli.rs
index ecc65fb81f..b9391694c1 100644
--- a/crates/openhuman-rpc/src/server/cli.rs
+++ b/crates/openhuman-rpc/src/server/cli.rs
@@ -16,7 +16,9 @@ pub fn install_cli_server() {
/// The [`ServerLauncher`](openhuman_tinyhumans::embed::seams::ServerLauncher)
/// behind `run` / `serve`: the standalone server shims.
-pub(crate) fn launch(request: ServeRequest) -> Pin<Box<dyn Future<Output = anyhow::Result<()>> + Send>> {
+pub(crate) fn launch(
+ request: ServeRequest,
+) -> Pin<Box<dyn Future<Output = anyhow::Result<()>> + Send>> {
Box::pin(async move {
log::debug!(
"[rpc:cli] starting server host={:?} port={:?} socketio={} headless_api={}",
diff --git a/crates/openhuman-rpc/src/server/http/events.rs b/crates/openhuman-rpc/src/server/http/events.rs
index 8f66ae2951..c46d97c364 100644
--- a/crates/openhuman-rpc/src/server/http/events.rs
+++ b/crates/openhuman-rpc/src/server/http/events.rs
@@ -1,11 +1,11 @@
//! Server-Sent Event streams: `/events`, `/events/webhooks`, `/events/domain`.
+use crate::core_host::core::events::DomainEvent;
use axum::extract::Query;
use axum::http::{header, StatusCode};
use axum::response::sse::{Event, KeepAlive, Sse};
use axum::response::{IntoResponse, Response};
use axum::Json;
-use crate::core_host::core::events::DomainEvent;
use serde_json::json;
use tokio_stream::StreamExt;
diff --git a/crates/openhuman-rpc/src/server/http/events_tests.rs b/crates/openhuman-rpc/src/server/http/events_tests.rs
index 0ebcab7f78..c5f3f18bda 100644
--- a/crates/openhuman-rpc/src/server/http/events_tests.rs
+++ b/crates/openhuman-rpc/src/server/http/events_tests.rs
@@ -139,8 +139,8 @@ async fn domain_events_require_a_bearer() {
#[tokio::test(flavor = "current_thread")]
async fn domain_events_stream_config_then_published_events() {
- use futures::StreamExt;
use crate::core_host::core::events::DomainEvent;
+ use futures::StreamExt;
use std::ffi::OsString;
let workspace = tempfile::tempdir().expect("workspace tempdir");
diff --git a/crates/openhuman-rpc/src/server/http/rpc_handler_tests.rs b/crates/openhuman-rpc/src/server/http/rpc_handler_tests.rs
index 337b96eb3a..43f22315cf 100644
--- a/crates/openhuman-rpc/src/server/http/rpc_handler_tests.rs
+++ b/crates/openhuman-rpc/src/server/http/rpc_handler_tests.rs
@@ -3,8 +3,8 @@ use serde_json::json;
use std::sync::Arc;
use super::rpc_handler;
-use crate::server::testing::EnvVarGuard;
use crate::core_host::core::invoke::default_state;
+use crate::server::testing::EnvVarGuard;
#[tokio::test(flavor = "current_thread")]
async fn structured_rpc_error_envelope_passes_through_generic_dispatch() {
@@ -80,7 +80,8 @@ async fn thread_not_found_rpc_error_does_not_report_to_sentry() {
// `report_error_message` are captured directly via
// `sentry::capture_message` and must not be picked up here too
// (otherwise this test sees double events).
- if metadata.target() == crate::core_host::core::observability::REPORT_ERROR_TRACING_TARGET
+ if metadata.target()
+ == crate::core_host::core::observability::REPORT_ERROR_TRACING_TARGET
{
return sentry::integrations::tracing::EventFilter::Ignore;
}
@@ -198,7 +199,8 @@ async fn unknown_method_severity_split_by_probe_allow_list() {
// Mirror production: diagnostics from the report_* helpers are
// captured directly via `sentry::capture_message`, so the bridge
// must ignore their marker target to avoid double events.
- if metadata.target() == crate::core_host::core::observability::REPORT_ERROR_TRACING_TARGET
+ if metadata.target()
+ == crate::core_host::core::observability::REPORT_ERROR_TRACING_TARGET
{
return sentry::integrations::tracing::EventFilter::Ignore;
}
@@ -308,7 +310,8 @@ async fn invalid_memory_ingest_is_not_reported_to_sentry() {
let subscriber = tracing_subscriber::registry().with(
sentry::integrations::tracing::layer().event_filter(|metadata| {
- if metadata.target() == crate::core_host::core::observability::REPORT_ERROR_TRACING_TARGET
+ if metadata.target()
+ == crate::core_host::core::observability::REPORT_ERROR_TRACING_TARGET
{
return sentry::integrations::tracing::EventFilter::Ignore;
}