The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(attachments): improve formatting in attachment handling
Steven Enamakel6cd0cfd7e404
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/native_media_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/native_media_tests.rsindex e6ce66d749..7cd7004aaa 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/native_media_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/native_media_tests.rs@@ -213,8 +213,7 @@ fn native_typed_message_keeps_context_prefix_and_interleaved_part_order() {"[Channel context] Telegram private chat",&parts,)- .unwrap()- else {+ .unwrap() else {panic!("user message expected")};assert_eq!(user.content.len(), 6);diff --git a/crates/openhuman-core/src/threads/attachments/staged.rs b/crates/openhuman-core/src/threads/attachments/staged.rsindex ee8bb7cf03..8ce314c5a3 100644--- a/crates/openhuman-core/src/threads/attachments/staged.rs+++ b/crates/openhuman-core/src/threads/attachments/staged.rs@@ -466,8 +466,8 @@ pub(crate) async fn read_authorized_native_attachment(let path = crate::agent::attachments::resolve_path(config, &entry.path, &scope).await.map_err(|_| "native attachment workspace path is invalid".to_owned())?;- let media = opaque_media(&entry.part)- .ok_or_else(|| "native attachment kind is invalid".to_owned())?;+ let media =+ opaque_media(&entry.part).ok_or_else(|| "native attachment kind is invalid".to_owned())?;let mime = media.content_type.clone()@@ -487,15 +487,18 @@ fn validate_native_attachment_policy(entry: &StoredAttachment,config: &crate::config::Config,) -> Result<(), String> {- let media = opaque_media(&entry.part)- .ok_or_else(|| "native attachment kind is invalid".to_owned())?;+ let media =+ opaque_media(&entry.part).ok_or_else(|| "native attachment kind is invalid".to_owned())?;let mime = media.content_type.as_deref().ok_or_else(|| "native attachment MIME is unavailable".to_owned())?;let is_image = matches!(entry.part, ContentPart::Image { .. });let allowed = if is_image {- matches!(mime, "image/png" | "image/jpeg" | "image/webp" | "image/gif")+ matches!(+ mime,+ "image/png" | "image/jpeg" | "image/webp" | "image/gif"+ )} else {config.multimodal_files@@ -514,8 +517,7 @@ fn validate_native_attachment_size(actual_bytes: usize,config: &crate::config::Config,) -> Result<(), String> {- let media = opaque_media(part)- .ok_or_else(|| "native attachment kind is invalid".to_owned())?;+ let media = opaque_media(part).ok_or_else(|| "native attachment kind is invalid".to_owned())?;let is_image = matches!(part, ContentPart::Image { .. });let declared = media.size_bytesdiff --git a/tests/native_channel_session_restart_e2e.rs b/tests/native_channel_session_restart_e2e.rsindex a9fa5d118e..6b399645ae 100644--- a/tests/native_channel_session_restart_e2e.rs+++ b/tests/native_channel_session_restart_e2e.rs@@ -623,12 +623,16 @@ fn assert_model_received_file_content(request: &Value) {fn find_block_type<'a>(value: &'a Value, expected: &str) -> Option<&'a Value> {match value {- Value::Array(items) => items.iter().find_map(|item| find_block_type(item, expected)),+ Value::Array(items) => items+ .iter()+ .find_map(|item| find_block_type(item, expected)),Value::Object(fields) => {if fields.get("type").and_then(Value::as_str) == Some(expected) {return Some(value);}- fields.values().find_map(|item| find_block_type(item, expected))+ fields+ .values()+ .find_map(|item| find_block_type(item, expected))}_ => None,}@@ -974,7 +978,10 @@ async fn native_telegram_typed_media_reaches_the_model_without_provider_paths()file_mixed.find(std::str::from_utf8(NATIVE_FILE_BYTES).expect("fixture is UTF-8"))});let file_position = file_position.expect("file reaches model as a document or extracted text");- assert!(file_caption < file_position, "file part order: {file_mixed}");+ assert!(+ file_caption < file_position,+ "file part order: {file_mixed}"+ );for request in &requests {let serialized = serde_json::to_string(request).unwrap();assert!(!serialized.contains("typed-image-file"));