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
fix(attachments): keep voice-note audio out of model text
Steven Enamakeld48a8e351bf3
diff --git a/crates/openhuman-core/src/agent/attachments/parts.rs b/crates/openhuman-core/src/agent/attachments/parts.rsindex 77c59c0db9..f98a0eaf1e 100644--- a/crates/openhuman-core/src/agent/attachments/parts.rs+++ b/crates/openhuman-core/src/agent/attachments/parts.rs@@ -91,8 +91,9 @@ fn source_of(media: &MediaReference, index: usize) -> Result<&str, AttachmentPar/// Render `parts` after `text` as the staging markers, in order.///-/// `Text` parts join the message text. Images become `[IMAGE:…]`; video,-/// audio, voice notes and files become `[FILE:…]`. Any other part kind is refused.+/// `Text` parts join the message text. Images become `[IMAGE:…]`; video, audio+/// and files become `[FILE:…]`. Voice notes retain their typed audio payload+/// at this boundary and contribute no marker to the model text.pub fn fold_into_message(text: &str, parts: &[ContentPart]) -> Result<String, AttachmentPartError> {if parts.is_empty() {return Ok(text.to_string());@@ -110,12 +111,14 @@ pub fn fold_into_message(text: &str, parts: &[ContentPart]) -> Result<String, At}ContentPart::Video { media, .. }| ContentPart::Audio { media, .. }- | ContentPart::VoiceNote {- voice_note: tinychannels_bus::VoiceNote { media, .. },- }| ContentPart::File { media, .. } => {markers.push(format!("[FILE:{}]", source_of(media, index)?));}+ ContentPart::VoiceNote { voice_note } => {+ // The audio already has a durable voice-note sidecar. Validate+ // the typed wire reference, but never splice it into model text.+ source_of(&voice_note.media, index)?;+ }other => {return Err(AttachmentPartError::UnsupportedKind {index,diff --git a/crates/openhuman-core/src/agent/attachments/parts_tests.rs b/crates/openhuman-core/src/agent/attachments/parts_tests.rsindex f65676e45a..c7eadfaa30 100644--- a/crates/openhuman-core/src/agent/attachments/parts_tests.rs+++ b/crates/openhuman-core/src/agent/attachments/parts_tests.rs@@ -74,7 +74,7 @@ fn video_and_audio_ride_the_file_marker() {}#[test]-fn typed_voice_notes_are_staged_as_their_audio_media() {+fn typed_voice_notes_keep_audio_out_of_model_text() {let part = ContentPart::VoiceNote {voice_note: tinychannels_bus::VoiceNote {media: media("data:audio/wav;base64,AAA"),@@ -84,7 +84,7 @@ fn typed_voice_notes_are_staged_as_their_audio_media() {};assert_eq!(fold_into_message("heard words", &[part]).unwrap(),- "heard words [FILE:data:audio/wav;base64,AAA]"+ "heard words");}