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 touched files

Steven Enamakelbfd7af70d5a6
diff --git a/crates/openhuman-core/src/agent/attachments/parts.rs b/crates/openhuman-core/src/agent/attachments/parts.rs
index ff3d75b620..dd97214fa2 100644
--- a/crates/openhuman-core/src/agent/attachments/parts.rs
+++ b/crates/openhuman-core/src/agent/attachments/parts.rs
@@ -93,10 +93,7 @@ fn source_of(media: &MediaReference, index: usize) -> Result<&str, AttachmentPar
///
/// `Text` parts join the message text. Images become `[IMAGE:…]`; video,
/// audio and files become `[FILE:…]`. Any other part kind is refused.
-pub fn fold_into_message(
- text: &str,
- parts: &[ContentPart],
-) -> Result<String, AttachmentPartError> {
+pub fn fold_into_message(text: &str, parts: &[ContentPart]) -> Result<String, AttachmentPartError> {
if parts.is_empty() {
return Ok(text.to_string());
}
@@ -125,7 +122,11 @@ pub fn fold_into_message(
}
}
let mut out = text.trim().to_string();
- for chunk in words.into_iter().filter(|chunk| !chunk.is_empty()).chain(markers) {
+ for chunk in words
+ .into_iter()
+ .filter(|chunk| !chunk.is_empty())
+ .chain(markers)
+ {
if !out.is_empty() {
out.push(' ');
}
diff --git a/crates/openhuman-core/src/agent/attachments/parts_tests.rs b/crates/openhuman-core/src/agent/attachments/parts_tests.rs
index cad2e2bc20..e4ab7b8e24 100644
--- a/crates/openhuman-core/src/agent/attachments/parts_tests.rs
+++ b/crates/openhuman-core/src/agent/attachments/parts_tests.rs
@@ -33,7 +33,10 @@ fn no_parts_returns_text_untouched() {
fn images_and_files_become_markers_after_the_trimmed_text() {
let out = fold_into_message(
" look ",
- &[image("data:image/png;base64,AAA"), file("https://x.test/a.pdf")],
+ &[
+ image("data:image/png;base64,AAA"),
+ file("https://x.test/a.pdf"),
+ ],
)
.unwrap();
assert_eq!(
@@ -163,7 +166,9 @@ fn non_media_parts_are_unsupported() {
#[test]
fn too_many_parts_are_refused() {
- let parts: Vec<ContentPart> = (0..33).map(|_| image("data:image/png;base64,AAA")).collect();
+ let parts: Vec<ContentPart> = (0..33)
+ .map(|_| image("data:image/png;base64,AAA"))
+ .collect();
assert_eq!(
fold_into_message("", &parts),
Err(AttachmentPartError::TooMany { count: 33 })
diff --git a/crates/openhuman-core/src/channels/runtime/startup_email_secret_tests_tests.rs b/crates/openhuman-core/src/channels/runtime/startup_email_secret_tests_tests.rs
index 35914a40e5..a0d6379cd5 100644
--- a/crates/openhuman-core/src/channels/runtime/startup_email_secret_tests_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup_email_secret_tests_tests.rs
@@ -1,8 +1,8 @@
use super::*;
-use tinychannels::providers::email_channel::EmailConfig;
use crate::security::credentials::AuthService;
use std::collections::HashMap;
use tempfile::tempdir;
+use tinychannels::providers::email_channel::EmailConfig;
use crate::channels::credentials::resolve_email_password;
fn isolated_config() -> (tempfile::TempDir, Config) {
diff --git a/crates/openhuman-core/src/channels/runtime/startup_yuanbao_secret_tests_tests.rs b/crates/openhuman-core/src/channels/runtime/startup_yuanbao_secret_tests_tests.rs
index 36bf78af5c..eb646e999a 100644
--- a/crates/openhuman-core/src/channels/runtime/startup_yuanbao_secret_tests_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup_yuanbao_secret_tests_tests.rs
@@ -1,8 +1,8 @@
use super::*;
-use tinychannels::providers::yuanbao::YuanbaoConfig;
use crate::security::credentials::AuthService;
use std::collections::HashMap;
use tempfile::tempdir;
+use tinychannels::providers::yuanbao::YuanbaoConfig;
fn isolated_config() -> (tempfile::TempDir, Config) {
let tmp = tempdir().expect("tempdir");
diff --git a/crates/openhuman-core/src/web_chat/schemas.rs b/crates/openhuman-core/src/web_chat/schemas.rs
index e21b41d154..7f1db439e3 100644
--- a/crates/openhuman-core/src/web_chat/schemas.rs
+++ b/crates/openhuman-core/src/web_chat/schemas.rs
@@ -193,8 +193,9 @@ pub fn schemas(function: &str) -> ControllerSchema {
fn handle_chat(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p = deserialize_params::<WebChatParams>(params)?;
- let message = crate::agent::attachments::parts::fold_into_message(&p.message, &p.attachments)
- .map_err(|e| e.to_string())?;
+ let message =
+ crate::agent::attachments::parts::fold_into_message(&p.message, &p.attachments)
+ .map_err(|e| e.to_string())?;
// Recorded before the turn starts so it reads the new choice.
crate::agent::tinyagents::apply_requested_effort(
&ctx,
diff --git a/crates/openhuman-tui/src/state_events_tests.rs b/crates/openhuman-tui/src/state_events_tests.rs
index 57d4cdd40e..212049d4d7 100644
--- a/crates/openhuman-tui/src/state_events_tests.rs
+++ b/crates/openhuman-tui/src/state_events_tests.rs
@@ -37,7 +37,10 @@ fn every_contract_event_is_classified() {
fn classified_tags_exist_in_the_contract() {
let tags = contract_tags();
for tag in REDUCED.iter().chain(IGNORED) {
- assert!(tags.iter().any(|t| t == tag), "{tag} is not in the contract");
+ assert!(
+ tags.iter().any(|t| t == tag),
+ "{tag} is not in the contract"
+ );
}
}