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 embed crate

Steven Enamakel9d9c36f23c0b
diff --git a/crates/openhuman-embed/src/lib.rs b/crates/openhuman-embed/src/lib.rs
index d5b5c06f3f..641d363d94 100644
--- a/crates/openhuman-embed/src/lib.rs
+++ b/crates/openhuman-embed/src/lib.rs
@@ -110,9 +110,9 @@ pub mod __host;
/// Look up the schema of a registered RPC method (`openhuman.<ns>_<fn>`).
pub use openhuman_core::core::all::schema_for_rpc_method;
-pub use openhuman_core::core::ControllerSchema;
/// Whether this build carries the HTTP server surface the router mounts.
pub use openhuman_core::core::http_server_status::HTTP_SERVER_COMPILED_IN;
+pub use openhuman_core::core::ControllerSchema;
/// Why a listen-port pick failed (another live core holds the port, ...).
pub use openhuman_core::platform::connectivity::rpc::PickListenPortError;
/// Whether this build carries the voice domain.
diff --git a/crates/openhuman-embed/src/process_sentry.rs b/crates/openhuman-embed/src/process_sentry.rs
index 7701758018..80702f4959 100644
--- a/crates/openhuman-embed/src/process_sentry.rs
+++ b/crates/openhuman-embed/src/process_sentry.rs
@@ -105,22 +105,49 @@ type NoiseFilter = (&'static str, fn(&Event<'static>) -> bool);
/// drop log line. Rationale for each lives on the core predicate.
const NOISE_FILTERS: &[NoiseFilter] = &[
("localhost-dev-fetch", is_localhost_dev_fetch_noise),
- ("transient-provider-http", obs::is_transient_provider_http_failure),
- ("provider-exhaustion", obs::is_all_transient_provider_exhaustion_event),
+ (
+ "transient-provider-http",
+ obs::is_transient_provider_http_failure,
+ ),
+ (
+ "provider-exhaustion",
+ obs::is_all_transient_provider_exhaustion_event,
+ ),
("backend-error-code", obs::is_backend_error_code_event),
- ("provider-transport", obs::is_transient_provider_transport_failure),
+ (
+ "provider-transport",
+ obs::is_transient_provider_transport_failure,
+ ),
("budget", obs::is_budget_event),
("insufficient-credits", obs::is_insufficient_credits_event),
("quota-exhausted", obs::is_quota_exhausted_event),
("ollama-cloud-500", obs::is_ollama_cloud_internal_500_event),
- ("fs-limitation", obs::is_windows_file_system_limitation_event),
+ (
+ "fs-limitation",
+ obs::is_windows_file_system_limitation_event,
+ ),
("max-iterations", obs::is_max_iterations_event),
- ("transient-backend-api", obs::is_transient_backend_api_failure),
- ("transient-integrations", obs::is_transient_integrations_failure),
+ (
+ "transient-backend-api",
+ obs::is_transient_backend_api_failure,
+ ),
+ (
+ "transient-integrations",
+ obs::is_transient_integrations_failure,
+ ),
("updater-transient", obs::is_updater_transient_event),
- ("skill-install-fetch", obs::is_skill_install_user_fetch_failure),
- ("skills-install-4xx", obs::is_skills_install_client_error_event),
- ("channel-message-404", obs::is_channel_message_not_found_event),
+ (
+ "skill-install-fetch",
+ obs::is_skill_install_user_fetch_failure,
+ ),
+ (
+ "skills-install-4xx",
+ obs::is_skills_install_client_error_event,
+ ),
+ (
+ "channel-message-404",
+ obs::is_channel_message_not_found_event,
+ ),
("user-config-provider", obs::is_user_config_provider_event),
("connectivity", obs::is_connectivity_event),
("stale-release", obs::is_stale_release_event),
diff --git a/crates/openhuman-embed/src/process_sentry_tests.rs b/crates/openhuman-embed/src/process_sentry_tests.rs
index a84996f57a..24277e7f3d 100644
--- a/crates/openhuman-embed/src/process_sentry_tests.rs
+++ b/crates/openhuman-embed/src/process_sentry_tests.rs
@@ -28,7 +28,11 @@ fn the_chain_is_the_union_of_both_hosts_with_unique_names() {
let mut names: Vec<_> = NOISE_FILTERS.iter().map(|(name, _)| *name).collect();
names.sort_unstable();
names.dedup();
- assert_eq!(names.len(), NOISE_FILTERS.len(), "filter names must be unique");
+ assert_eq!(
+ names.len(),
+ NOISE_FILTERS.len(),
+ "filter names must be unique"
+ );
}
#[test]
@@ -36,19 +40,23 @@ fn each_known_noise_class_is_dropped() {
let cases = [
(
"localhost-dev-fetch",
- event("Failed to request http://localhost:1420/index.html: refused", &[]),
+ event(
+ "Failed to request http://localhost:1420/index.html: refused",
+ &[],
+ ),
),
(
"transient-provider-http",
event(
"provider failed",
- &[("domain", "llm_provider"), ("failure", "non_2xx"), ("status", "503")],
+ &[
+ ("domain", "llm_provider"),
+ ("failure", "non_2xx"),
+ ("status", "503"),
+ ],
),
),
- (
- "fs-limitation",
- event("write failed (os error 665)", &[]),
- ),
+ ("fs-limitation", event("write failed (os error 665)", &[])),
(
"max-iterations",
event(
@@ -73,7 +81,10 @@ fn each_known_noise_class_is_dropped() {
),
(
"session-expired",
- event("Session expired. Please log in again.", &[("domain", "rpc")]),
+ event(
+ "Session expired. Please log in again.",
+ &[("domain", "rpc")],
+ ),
),
];
for (expected, event) in cases {
@@ -94,7 +105,10 @@ fn a_real_error_is_kept_scrubbed_and_attributed() {
let kept = before_send(event, fixed_user).expect("a real error reaches Sentry");
assert_eq!(kept.server_name, None, "hostname stripped");
- assert_eq!(kept.message.as_deref(), Some("upload failed: api_key=[REDACTED]"));
+ assert_eq!(
+ kept.message.as_deref(),
+ Some("upload failed: api_key=[REDACTED]")
+ );
assert_eq!(kept.user.and_then(|u| u.id).as_deref(), Some("user-123"));
}
diff --git a/crates/openhuman-embed/src/process_tests.rs b/crates/openhuman-embed/src/process_tests.rs
index 3320acc500..fc8cab8768 100644
--- a/crates/openhuman-embed/src/process_tests.rs
+++ b/crates/openhuman-embed/src/process_tests.rs
@@ -21,7 +21,10 @@ fn the_worker_stack_is_sized_for_nested_turns() {
let sum = runtime.block_on(async {
tokio::spawn(async {
let buf = [1u8; 4 * 1024 * 1024];
- std::hint::black_box(&buf).iter().map(|b| *b as usize).sum::<usize>()
+ std::hint::black_box(&buf)
+ .iter()
+ .map(|b| *b as usize)
+ .sum::<usize>()
})
.await
.expect("join")
diff --git a/crates/openhuman-embed/src/runtime/build.rs b/crates/openhuman-embed/src/runtime/build.rs
index 7f011ed54a..20b5c1b487 100644
--- a/crates/openhuman-embed/src/runtime/build.rs
+++ b/crates/openhuman-embed/src/runtime/build.rs
@@ -232,7 +232,10 @@ impl RuntimeBuilder {
}
/// The config a [`ConfigSource::Resolved`] runtime hands the core.
- async fn resolve_config(&mut self, resolved: &ResolvedWorkspace) -> Result<Config, RuntimeError> {
+ async fn resolve_config(
+ &mut self,
+ resolved: &ResolvedWorkspace,
+ ) -> Result<Config, RuntimeError> {
let mut config = match (&self.workspace, self.config.take()) {
(Workspace::Inherit, Some(config)) => config,
(Workspace::Inherit, None) => {
diff --git a/crates/openhuman-embed/src/runtime/builder_tests.rs b/crates/openhuman-embed/src/runtime/builder_tests.rs
index bc19483b12..f891247304 100644
--- a/crates/openhuman-embed/src/runtime/builder_tests.rs
+++ b/crates/openhuman-embed/src/runtime/builder_tests.rs
@@ -69,7 +69,10 @@ async fn a_blank_api_key_is_refused_before_the_slot_is_claimed() {
#[test]
fn token_defaults_to_env_or_file_and_is_overridable() {
- assert!(matches!(RuntimeBuilder::new().token, TokenSource::EnvOrFile));
+ assert!(matches!(
+ RuntimeBuilder::new().token,
+ TokenSource::EnvOrFile
+ ));
let fixed = RuntimeBuilder::new().token(TokenSource::Fixed(Arc::new("bearer".into())));
assert!(matches!(&fixed.token, TokenSource::Fixed(t) if t.as_str() == "bearer"));
}
@@ -77,12 +80,18 @@ fn token_defaults_to_env_or_file_and_is_overridable() {
#[test]
fn listen_records_host_and_port_for_the_transport() {
let builder = RuntimeBuilder::new();
- assert_eq!((builder.listen_host.as_deref(), builder.listen_port), (None, None));
+ assert_eq!(
+ (builder.listen_host.as_deref(), builder.listen_port),
+ (None, None)
+ );
let builder = RuntimeBuilder::new().listen("0.0.0.0", 9000);
assert_eq!(builder.listen_host.as_deref(), Some("0.0.0.0"));
assert_eq!(builder.listen_port, Some(9000));
let port_only = RuntimeBuilder::new().listen_port(7799);
- assert_eq!((port_only.listen_host, port_only.listen_port), (None, Some(7799)));
+ assert_eq!(
+ (port_only.listen_host, port_only.listen_port),
+ (None, Some(7799))
+ );
}
#[test]
@@ -92,8 +101,14 @@ fn raw_paths_are_recorded_beside_the_workspace_variant() {
.workspace_dir("/srv/oh/state")
.action_dir("/srv/oh/action");
assert!(matches!(builder.workspace, Workspace::Dir(_)));
- assert_eq!(builder.workspace_dir.as_deref(), Some(std::path::Path::new("/srv/oh/state")));
- assert_eq!(builder.action_dir.as_deref(), Some(std::path::Path::new("/srv/oh/action")));
+ assert_eq!(
+ builder.workspace_dir.as_deref(),
+ Some(std::path::Path::new("/srv/oh/state"))
+ );
+ assert_eq!(
+ builder.action_dir.as_deref(),
+ Some(std::path::Path::new("/srv/oh/action"))
+ );
assert!(builder.validate().is_ok(), "Resolved accepts raw paths");
}
@@ -108,7 +123,10 @@ fn discovered_config_needs_the_inherited_workspace() {
.config_source(ConfigSource::Discovered)
.validate()
.expect_err("ephemeral + discovered");
- assert!(matches!(err, RuntimeError::Invalid(ref m) if m.contains("Workspace::Inherit")), "{err:?}");
+ assert!(
+ matches!(err, RuntimeError::Invalid(ref m) if m.contains("Workspace::Inherit")),
+ "{err:?}"
+ );
}
#[test]
@@ -120,9 +138,18 @@ fn discovered_config_refuses_every_knob_that_edits_the_boot_config() {
};
assert!(discovered().validate().is_ok());
let cases: Vec<(&str, RuntimeBuilder)> = vec![
- ("config", discovered().config(openhuman_core::config::Config::default())),
- ("backend_url", discovered().backend_url("http://127.0.0.1:1")),
- ("workspace_dir", discovered().workspace_dir("/tmp/never-created")),
+ (
+ "config",
+ discovered().config(openhuman_core::config::Config::default()),
+ ),
+ (
+ "backend_url",
+ discovered().backend_url("http://127.0.0.1:1"),
+ ),
+ (
+ "workspace_dir",
+ discovered().workspace_dir("/tmp/never-created"),
+ ),
("action_dir", discovered().action_dir("/tmp/never-created")),
("api_key", discovered().api_key("th_live_x")),
];
diff --git a/crates/openhuman-embed/src/runtime/presets.rs b/crates/openhuman-embed/src/runtime/presets.rs
index 4262884ff3..e180e66cfd 100644
--- a/crates/openhuman-embed/src/runtime/presets.rs
+++ b/crates/openhuman-embed/src/runtime/presets.rs
@@ -41,8 +41,7 @@ impl RuntimeBuilder {
/// core. Pair with [`token`](Self::token)`(TokenSource::Fixed(..))` and
/// [`listen`](Self::listen) as the shell does.
pub fn desktop() -> Self {
- Self::operator_host(HostKind::TauriShell, ServiceSet::desktop())
- .with_e2e_tool_groups()
+ Self::operator_host(HostKind::TauriShell, ServiceSet::desktop()).with_e2e_tool_groups()
}
/// The standalone CLI server preset (`openhuman-core run` / `serve`):
@@ -63,9 +62,7 @@ impl RuntimeBuilder {
}
fn operator_host(host_kind: HostKind, services: ServiceSet) -> Self {
- log::debug!(
- "[embed][preset] operator host host_kind={host_kind:?} services={services:?}"
- );
+ log::debug!("[embed][preset] operator host host_kind={host_kind:?} services={services:?}");
Self {
workspace: Workspace::Inherit,
config_source: ConfigSource::Discovered,
diff --git a/crates/openhuman-embed/src/runtime/presets_tests.rs b/crates/openhuman-embed/src/runtime/presets_tests.rs
index 6030e36289..b11131423e 100644
--- a/crates/openhuman-embed/src/runtime/presets_tests.rs
+++ b/crates/openhuman-embed/src/runtime/presets_tests.rs
@@ -64,7 +64,10 @@ fn tui_runs_every_domain_and_no_services() {
);
assert!(matches!(tui.workspace, Workspace::Inherit));
assert_eq!(tui.config_source, ConfigSource::Discovered);
- assert!(tui.tool_groups.is_none(), "the TUI keeps the withheld default");
+ assert!(
+ tui.tool_groups.is_none(),
+ "the TUI keeps the withheld default"
+ );
assert!(tui.validate().is_ok());
}
diff --git a/crates/openhuman-embed/src/runtime/run.rs b/crates/openhuman-embed/src/runtime/run.rs
index 25ce339869..94ef82e7ea 100644
--- a/crates/openhuman-embed/src/runtime/run.rs
+++ b/crates/openhuman-embed/src/runtime/run.rs
@@ -30,7 +30,10 @@ impl RuntimeBuilder {
/// returns.
pub fn run_from_args(mut self, args: &[String]) -> anyhow::Result<()> {
let command = args.first().map(String::as_str).unwrap_or("<none>");
- log::debug!("[embed][cli] run_from_args command={command} argc={}", args.len());
+ log::debug!(
+ "[embed][cli] run_from_args command={command} argc={}",
+ args.len()
+ );
if let Some(transport) = self.backend_transport.take() {
openhuman_core::backend::install_backend_transport(transport);
diff --git a/crates/openhuman-embed/src/runtime/seams_tests.rs b/crates/openhuman-embed/src/runtime/seams_tests.rs
index 985363dd9e..85a205e969 100644
--- a/crates/openhuman-embed/src/runtime/seams_tests.rs
+++ b/crates/openhuman-embed/src/runtime/seams_tests.rs
@@ -3,7 +3,9 @@
use super::*;
use openhuman_core::agent::hooks::{ToolHookContext, TurnContext};
-use openhuman_core::agent::tinyagents::discovery::{RankCandidate, RankContext, RankError, RankHit};
+use openhuman_core::agent::tinyagents::discovery::{
+ RankCandidate, RankContext, RankError, RankHit,
+};
static RANKER_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
@@ -134,7 +136,10 @@ fn persisted_seams_survive_the_guard() {
#[test]
fn post_turn_hooks_are_removed_and_a_replaced_one_restored() {
- replace_embedder_post_turn_hook("seams-replaced-hook", Some(Arc::new(NamedPostTurn("seams-replaced-hook"))));
+ replace_embedder_post_turn_hook(
+ "seams-replaced-hook",
+ Some(Arc::new(NamedPostTurn("seams-replaced-hook"))),
+ );
let seams = HostSeams {
post_turn_hooks: vec![
Arc::new(NamedPostTurn("seams-replaced-hook")),
@@ -150,7 +155,11 @@ fn post_turn_hooks_are_removed_and_a_replaced_one_restored() {
drop(seams);
assert_eq!(post_turn_marker("seams-new-hook"), None, "ours removed");
- assert_eq!(post_turn_marker("seams-replaced-hook"), Some(1), "predecessor restored");
+ assert_eq!(
+ post_turn_marker("seams-replaced-hook"),
+ Some(1),
+ "predecessor restored"
+ );
replace_embedder_post_turn_hook("seams-replaced-hook", None);
}
@@ -176,7 +185,10 @@ fn a_live_policy_waits_for_the_core_to_boot() {
}
.install()
.expect("install");
- assert!(seams.has_pending_live_policy(), "installed after boot, not before");
+ assert!(
+ seams.has_pending_live_policy(),
+ "installed after boot, not before"
+ );
}
#[test]