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(presentation): build slide specs through shared contract
Steven Enamakel051d056f32ac
diff --git a/Cargo.lock b/Cargo.lockindex 55e6cfb3ff..11d6c97bd4 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -7756,7 +7756,7 @@ dependencies = [[[package]]name = "tinydocs"-version = "0.2.2"+version = "0.2.3"dependencies = ["calamine","docx-rs",@@ -7770,7 +7770,7 @@ dependencies = [[[package]]name = "tinydocs-bus"-version = "0.2.2"+version = "0.2.3"dependencies = ["serde","thiserror 2.0.20",@@ -7778,7 +7778,7 @@ dependencies = [[[package]]name = "tinydocs-module"-version = "0.2.2"+version = "0.2.3"dependencies = ["base64 0.23.1","getrandom 0.4.3",diff --git a/crates/openhuman-core/src/tools/impl/presentation/engine.rs b/crates/openhuman-core/src/tools/impl/presentation/engine.rsindex 90c64ef9a9..54685493ff 100644--- a/crates/openhuman-core/src/tools/impl/presentation/engine.rs+++ b/crates/openhuman-core/src/tools/impl/presentation/engine.rs@@ -141,8 +141,17 @@ fn build_request(for (index, slide) in input.slides.iter().enumerate() {let resolved = images.get(index).map(Vec::as_slice).unwrap_or(&[]);- let mut wire_images = Vec::with_capacity(resolved.len());- for image in resolved {+ // The contract builds the slide from already-resolved images; only the+ // wire projection (lengths instead of bytes) is made here.+ let spec = SlideSpec::new(+ slide.title.clone(),+ slide.body.clone(),+ slide.bullets.clone(),+ slide.speaker_notes.clone(),+ resolved.to_vec(),+ );+ let mut wire_images = Vec::with_capacity(spec.images.len());+ for image in &spec.images {payload.extend_from_slice(&image.bytes);wire_images.push(WireSlideImage {byte_len: image.bytes.len() as u64,@@ -150,10 +159,10 @@ fn build_request(});}slides.push(WireSlideSpec {- title: slide.title.clone(),- body: slide.body.clone(),- bullets: slide.bullets.clone(),- speaker_notes: slide.speaker_notes.clone(),+ title: spec.title,+ body: spec.body,+ bullets: spec.bullets,+ speaker_notes: spec.speaker_notes,images: wire_images,});}diff --git a/crates/openhuman-core/src/tools/impl/presentation/engine_tests.rs b/crates/openhuman-core/src/tools/impl/presentation/engine_tests.rsindex 71b1d5baf1..7b0211ca16 100644--- a/crates/openhuman-core/src/tools/impl/presentation/engine_tests.rs+++ b/crates/openhuman-core/src/tools/impl/presentation/engine_tests.rs@@ -9,10 +9,11 @@//! call. That agreement is this file's job.use super::*;-use crate::tools::implementations::presentation::types::SlideSpec;+use crate::tools::implementations::presentation::types::SlideRequest;+use crate::tools::implementations::document::format::spec::SlideImage;-fn slide(title: &str) -> SlideSpec {- SlideSpec {+fn slide(title: &str) -> SlideRequest {+ SlideRequest {title: title.to_string(),body: Some("Body".to_string()),bullets: vec!["Bullet".to_string()],@@ -21,7 +22,7 @@ fn slide(title: &str) -> SlideSpec {}}-fn input(slides: Vec<SlideSpec>) -> GeneratePresentationInput {+fn input(slides: Vec<SlideRequest>) -> GeneratePresentationInput {GeneratePresentationInput {title: "Quarterly".to_string(),author: Some("Alice".to_string()),@@ -30,8 +31,8 @@ fn input(slides: Vec<SlideSpec>) -> GeneratePresentationInput {}}-fn resolved(bytes: &[u8], caption: Option<&str>) -> ResolvedSlideImage {- ResolvedSlideImage {+fn resolved(bytes: &[u8], caption: Option<&str>) -> SlideImage {+ SlideImage {bytes: bytes.to_vec(),format: crate::tools::implementations::document::format::spec::ImageFormat::Png,width_px: 4,diff --git a/crates/openhuman-core/src/tools/impl/presentation/mod.rs b/crates/openhuman-core/src/tools/impl/presentation/mod.rsindex 3181ef9a29..605c49a360 100644--- a/crates/openhuman-core/src/tools/impl/presentation/mod.rs+++ b/crates/openhuman-core/src/tools/impl/presentation/mod.rs@@ -47,6 +47,8 @@ mod types;#[path = "presentation_tests.rs"]mod tests;+use crate::tools::implementations::document::format::spec::SlideImage;+use self::types::{validate_input, GeneratePresentationInput, GeneratePresentationOutput, SlideImageRequest,SlideImageSource, MAX_IMAGE_BYTES,