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
chore: I don't see an actual diff in your message — the "Diff:" section is empty, and the stat is bl
Steven Enamakel458315988e5a
diff --git a/crates/openhuman-embed/tests/turn_attachments.rs b/crates/openhuman-embed/tests/turn_attachments.rsnew file mode 100644index 0000000000..e931889c84--- /dev/null+++ b/crates/openhuman-embed/tests/turn_attachments.rs@@ -0,0 +1,80 @@+//! Files a host attaches to a turn as bytes reach the model with the+//! message, and a turn that cannot carry them is refused rather than run+//! without them.++mod common;+use common::{chat_requests, offline_config, provider, route, runtime, stub_backend};+use openhuman_embed::{AgentSpec, CoreError, HostAttachment, Runtime, Workspace};++const PNG: &[u8] = b"\x89PNG\r\n\x1a\n\0\0\0\rIHDRpixels";+const PDF: &[u8] = b"%PDF-1.7\n1 0 obj\n<<>>\nendobj\n";++#[test]+fn attached_files_reach_the_model_and_the_orchestrator_refuses_them() {+ runtime().block_on(async {+ tokio::spawn(async {+ let backend = stub_backend().await;+ let model = provider("seen").await;+ let runtime = Runtime::builder()+ .config(offline_config())+ .workspace(Workspace::Ephemeral)+ .backend_url(backend.uri())+ .build()+ .await+ .unwrap();+ let agent = runtime+ .agent(AgentSpec::new("viewer").provider(route(&model, "fixture")))+ .unwrap();++ let outcome = agent+ .turn("what are these?")+ .session("with-files")+ .attach(HostAttachment::new(PNG, "image/png").named("photo.png"))+ .attachments([HostAttachment::new(PDF, "application/pdf").named("q3.pdf")])+ .send()+ .await+ .unwrap();+ assert_eq!(outcome.reply, "seen");++ // Both files are named to the model, in order and ahead of the+ // caption; their bytes never ride the reference text.+ let requests = chat_requests(&model).await;+ let body = String::from_utf8_lossy(&requests.last().unwrap().body).into_owned();+ let photo = body.find("photo.png").expect("the image reached the model");+ let report = body.find("q3.pdf").expect("the document reached the model");+ let caption = body.find("what are these?").expect("the caption too");+ assert!(photo < report && report < caption, "{body}");+ assert!(body.contains("image/png") && body.contains("application/pdf"));+ assert!(!body.contains("IHDRpixels"), "raw bytes in the transcript text");++ // Over the configured limit: the turn fails before it runs.+ let before = chat_requests(&model).await.len();+ let crowd = (0..17).map(|_| HostAttachment::new(PNG, "image/png"));+ let refused = agent+ .turn("too many")+ .session("with-files")+ .attachments(crowd)+ .send()+ .await+ .unwrap_err();+ assert!(refused.to_string().contains("count exceeds"), "{refused}");+ assert_eq!(chat_requests(&model).await.len(), before);++ // `AGENT_CHAT` carries a string: the orchestrator path refuses.+ let refused = runtime+ .core()+ .agent()+ .turn("look")+ .attach(HostAttachment::new(PNG, "image/png"))+ .send()+ .await+ .unwrap_err();+ assert!(+ matches!(&refused, CoreError::Domain { kind: Some(kind), .. } if kind == "attachments_unsupported"),+ "{refused:?}"+ );+ })+ .await+ .unwrap();+ });+}