Skip to content

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

style: reorder imports and wrap long lines to satisfy rustfmt

Steven Enamakelc8fa2d0b8c0a
diff --git a/crates/openhuman-core/src/modules/schemas_tests.rs b/crates/openhuman-core/src/modules/schemas_tests.rs
index 842f2419cb..7ca3759ed2 100644
--- a/crates/openhuman-core/src/modules/schemas_tests.rs
+++ b/crates/openhuman-core/src/modules/schemas_tests.rs
@@ -1,9 +1,9 @@
use super::{
all_controller_schemas, all_registered_controllers, controller_value, schemas, string_param,
};
-use crate::core::runtime::context::CoreContext;
use crate::core::runtime::DispatchCtx;
use crate::core::runtime::DomainSet;
+use crate::core::runtime::context::CoreContext;
use serde_json::{Map, Value};
#[test]
diff --git a/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs b/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs
index 8cf11e7072..f8445b640a 100644
--- a/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::modules::storage_grants::{authorize, declared, Denied, Object, Plan};
+use crate::modules::storage_grants::{Denied, Object, Plan, authorize, declared};
use serde_json::json;
fn allowed(
diff --git a/crates/openhuman-core/src/modules/storage_import_tinywallet.rs b/crates/openhuman-core/src/modules/storage_import_tinywallet.rs
index 63832e4c39..f44544d9c1 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinywallet.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinywallet.rs
@@ -22,7 +22,7 @@
use std::path::Path;
-use anyhow::{anyhow, Context, Result};
+use anyhow::{Context, Result, anyhow};
use tinystoragedrivers::ScopedStorage;
use super::storage_grant_schemas::tinywallet::{MODULE_ID, PAYMENTS_STREAM};
diff --git a/crates/openhuman-tinyhumans/src/channels/delivery.rs b/crates/openhuman-tinyhumans/src/channels/delivery.rs
index 7c0323bfa9..ed5d49b524 100644
--- a/crates/openhuman-tinyhumans/src/channels/delivery.rs
+++ b/crates/openhuman-tinyhumans/src/channels/delivery.rs
@@ -6,7 +6,7 @@
use openhuman_embed::__host::channel_callback::ChannelCallbackCtx;
use openhuman_embed::__host::security::credentials::session_support::{
- get_session_token, is_local_session_token, BackendCredential,
+ BackendCredential, get_session_token, is_local_session_token,
};
use serde_json::json;
use tinychannels_bus::module_progressive::{
diff --git a/crates/openhuman-tinyhumans/src/channels/messaging.rs b/crates/openhuman-tinyhumans/src/channels/messaging.rs
index dc183f574d..09255a5ac2 100644
--- a/crates/openhuman-tinyhumans/src/channels/messaging.rs
+++ b/crates/openhuman-tinyhumans/src/channels/messaging.rs
@@ -6,14 +6,14 @@
use openhuman_embed::__host::config::Config;
use openhuman_embed::__host::security::credentials::session_support::{
- resolve_backend_credential, BackendCredential,
+ BackendCredential, resolve_backend_credential,
};
use serde_json::Value;
use tinychannels_bus::controllers::{
ChannelReactionResult, ChannelThreadListResult, ChannelThreadResult,
};
-use crate::client::{flatten_authed_error, BackendClient};
+use crate::client::{BackendClient, flatten_authed_error};
/// A result type that keeps the backend payload when its shape is unknown.
pub(super) trait RawFallback {
diff --git a/crates/openhuman-tinyhumans/src/channels/mod.rs b/crates/openhuman-tinyhumans/src/channels/mod.rs
index f8e2c9d26a..5592739a36 100644
--- a/crates/openhuman-tinyhumans/src/channels/mod.rs
+++ b/crates/openhuman-tinyhumans/src/channels/mod.rs
@@ -19,7 +19,7 @@ mod messaging;
#[cfg(feature = "channels")]
use openhuman_embed::__host::channel_callback::{
- register_channel_callback, CallbackFuture, ChannelCallbackCtx,
+ CallbackFuture, ChannelCallbackCtx, register_channel_callback,
};
#[cfg(feature = "channels")]
use tinychannels_bus::{ChannelBackendRequest, ChannelBackendResult};
diff --git a/crates/openhuman-tinyhumans/src/integrations/composio.rs b/crates/openhuman-tinyhumans/src/integrations/composio.rs
index eb459a7888..912d58f128 100644
--- a/crates/openhuman-tinyhumans/src/integrations/composio.rs
+++ b/crates/openhuman-tinyhumans/src/integrations/composio.rs
@@ -6,20 +6,19 @@
//! ([`register`]). With this crate absent the mode answers
//! `BACKEND_UNAVAILABLE:`.
-use openhuman_embed::__host::composio::{register_composio_route_builder, ComposioRoute};
+use openhuman_embed::__host::composio::{ComposioRoute, register_composio_route_builder};
#[cfg(feature = "modules")]
-use openhuman_embed::__host::composio::{register_proxy_target, ProxyTarget};
-use openhuman_embed::__host::config::schema::COMPOSIO_MODE_BACKEND;
+use openhuman_embed::__host::composio::{ProxyTarget, register_proxy_target};
#[cfg(feature = "modules")]
use openhuman_embed::__host::config::Config;
+use openhuman_embed::__host::config::schema::COMPOSIO_MODE_BACKEND;
use super::build_client;
/// The message when the backend mode has no usable credential. Wording is
/// load-bearing: the core's session-expiry classifier recognises "no backend
/// session token" and demotes it to an expected user-state error.
-const NO_SESSION: &str =
- "composio backend mode unavailable: no backend session token. Sign in or set a TinyHumans API key.";
+const NO_SESSION: &str = "composio backend mode unavailable: no backend session token. Sign in or set a TinyHumans API key.";
/// The proxy target for `config`: the backend origin and the credential secret.
#[cfg(feature = "modules")]
diff --git a/scripts/debug/web-scripts/voice-stt-roundtrip.mjs b/scripts/debug/web-scripts/voice-stt-roundtrip.mjs
new file mode 100644
index 0000000000..82a79b883d
--- /dev/null
+++ b/scripts/debug/web-scripts/voice-stt-roundtrip.mjs
@@ -0,0 +1,49 @@
+// Prove the hosted STT RPC sends valid audio to the local mock and returns its
+// transcript through the canonical wire method.
+const TRANSCRIPT = "mocked voice transcript from valid PCM audio";
+
+function silentWavBase64() {
+ const sampleRate = 16_000;
+ const samples = 160;
+ const payload = Buffer.alloc(44 + samples * 2);
+ payload.write("RIFF", 0);
+ payload.writeUInt32LE(36 + samples * 2, 4);
+ payload.write("WAVEfmt ", 8);
+ payload.writeUInt32LE(16, 16);
+ payload.writeUInt16LE(1, 20);
+ payload.writeUInt16LE(1, 22);
+ payload.writeUInt32LE(sampleRate, 24);
+ payload.writeUInt32LE(sampleRate * 2, 28);
+ payload.writeUInt16LE(2, 32);
+ payload.writeUInt16LE(16, 34);
+ payload.write("data", 36);
+ payload.writeUInt32LE(samples * 2, 40);
+ return payload.toString("base64");
+}
+
+export default async function voiceSttRoundtrip({ mock, rpc, log }) {
+ mock.set("audioTranscriptionText", TRANSCRIPT);
+ const result = await rpc("openhuman.voice_stt_dispatch", {
+ audio_base64: silentWavBase64(),
+ mime_type: "audio/wav",
+ file_name: "retained-stt.wav",
+ language: "en",
+ provider: "cloud",
+ });
+ if (result.text !== TRANSCRIPT) {
+ throw new Error(`STT returned an unexpected transcript: ${JSON.stringify(result)}`);
+ }
+ const requests = mock.requests();
+ const request = requests.find(
+ entry =>
+ entry.method === "POST" &&
+ /^\/openai\/v1\/audio\/transcriptions\/?$/.test(entry.url),
+ );
+ if (!request) {
+ throw new Error("STT returned text without sending a transcription request to the mock");
+ }
+ if (!request.body.includes("retained-stt.wav")) {
+ throw new Error("the mock transcription request did not contain the submitted audio file");
+ }
+ log("canonical STT RPC returned the mock transcript after posting valid PCM WAV to local mock");
+}
diff --git a/tests/legacy_voice_config_boot_e2e.rs b/tests/legacy_voice_config_boot_e2e.rs
index 3c6ae44722..d2c14cb1cf 100644
--- a/tests/legacy_voice_config_boot_e2e.rs
+++ b/tests/legacy_voice_config_boot_e2e.rs
@@ -1,7 +1,7 @@
//! A real CLI host boot must tolerate pre-removal voice settings without
//! starting the retired always-on listeners.
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use std::io::{Read, Write};
use std::net::{TcpListener, TcpStream};
use std::path::Path;
@@ -65,7 +65,10 @@ fn wait_healthy(server: &mut Server, base: &str) {
if let Ok(Some(status)) = server.0.try_wait() {
panic!("openhuman-core exited before health: {status}");
}
- assert!(Instant::now() < deadline, "openhuman-core did not become healthy");
+ assert!(
+ Instant::now() < deadline,
+ "openhuman-core did not become healthy"
+ );
std::thread::sleep(Duration::from_millis(100));
}
}
@@ -143,7 +146,9 @@ fn legacy_voice_settings_boot_without_starting_retired_listeners() {
"the fake credential must exercise credential-gated startup: {logs}"
);
assert!(
- !logs.contains("[voice::") && !logs.contains("dictation listener") && !logs.contains("hotkey listener"),
+ !logs.contains("[voice::")
+ && !logs.contains("dictation listener")
+ && !logs.contains("hotkey listener"),
"retired voice listener started during boot: {logs}"
);
}
diff --git a/tests/mcp_registry_multi_server.rs b/tests/mcp_registry_multi_server.rs
index 3d34138f9d..905b13a69e 100644
--- a/tests/mcp_registry_multi_server.rs
+++ b/tests/mcp_registry_multi_server.rs
@@ -7,10 +7,10 @@
#![cfg(feature = "mcp")]
use openhuman_core::config::{
- schema::{ModuleOverride, ModulesConfig},
Config,
+ schema::{ModuleOverride, ModulesConfig},
};
-use serde_json::{json, Map, Value};
+use serde_json::{Map, Value, json};
const MODULE_ARTIFACT_ENV: &str = "OPENHUMAN_TINYMCP_TEST_MODULE";
@@ -18,9 +18,7 @@ fn fresh_workspace_config() -> (tempfile::TempDir, Config) {
let workspace = tempfile::tempdir().expect("temporary MCP workspace");
let artifact = std::env::var_os(MODULE_ARTIFACT_ENV)
.map(std::path::PathBuf::from)
- .or_else(|| {
- openhuman_core::modules::local_artifact("tinymcp")
- })
+ .or_else(|| openhuman_core::modules::local_artifact("tinymcp"))
.expect("the MCP test runner supplies the verified TinyMCP artifact")
.canonicalize()
.expect("TinyMCP artifact exists");
@@ -240,18 +238,22 @@ async fn failed_connect_does_not_block_healthy_peer() {
.expect("server remains visible after connect attempt")
};
assert_eq!(status_for(bad)["status"], "error");
- assert!(status_for(bad)["last_error"]
- .as_str()
- .is_some_and(|error| !error.is_empty()));
+ assert!(
+ status_for(bad)["last_error"]
+ .as_str()
+ .is_some_and(|error| !error.is_empty())
+ );
assert_eq!(status_for(good)["status"], "connected");
assert!(status_for(good)["last_error"].is_null());
let all_tools =
openhuman_core::mcp::registry::connections::all_connected_tools_for_config(&config).await;
assert!(all_tools.iter().all(|(id, _, _)| id != bad));
- assert!(all_tools
- .iter()
- .any(|(id, _, tool)| id == good && tool.name == "echo"));
+ assert!(
+ all_tools
+ .iter()
+ .any(|(id, _, tool)| id == good && tool.name == "echo")
+ );
assert_eq!(
call_echo(&config, good, "isolation-check").await,
"isolation-check"
@@ -293,9 +295,11 @@ async fn disabled_server_contributes_no_tools_to_agent_surface() {
let all_tools =
openhuman_core::mcp::registry::connections::all_connected_tools_for_config(&config).await;
- assert!(all_tools
- .iter()
- .any(|(id, _, tool)| id == live && tool.name == "echo"));
+ assert!(
+ all_tools
+ .iter()
+ .any(|(id, _, tool)| id == live && tool.name == "echo")
+ );
assert!(all_tools.iter().all(|(id, _, _)| id != quiet));
assert_eq!(
call_echo(&config, live, "live-while-quiet").await,