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
feat(web_chat): attach multimodal files to agent turns
Steven Enamakelbda7cdb3aa41
diff --git a/crates/openhuman-core/src/agent/multimodal_attachment_handling_tests.rs b/crates/openhuman-core/src/agent/multimodal_attachment_handling_tests.rsindex 447cbd9524..834038d4cb 100644--- a/crates/openhuman-core/src/agent/multimodal_attachment_handling_tests.rs+++ b/crates/openhuman-core/src/agent/multimodal_attachment_handling_tests.rs@@ -180,8 +180,8 @@ async fn stash_image_attachments_replaces_marker_with_placeholder() {}#[tokio::test]-async fn image_placeholder_rehydrates_to_disk_path_for_provider() {- // Ingress: stash the image to disk and leave a placeholder.+async fn image_placeholder_rehydrates_to_inline_data_uri_for_provider() {+ // Ingress: stash the image in the blob store and leave a placeholder.let msg = format!("describe [IMAGE:{TINY_PNG_DATA_URI}]");let placeholdered = stash_image_attachments(&msg, &MultimodalConfig::default()).await;let messages = vec![TranscriptMessage::user(placeholdered)];@@ -190,7 +190,7 @@ async fn image_placeholder_rehydrates_to_disk_path_for_provider() {// Dispatch (vision model): rehydrate to an inline [IMAGE:<path>] marker that// points at the on-disk attachment. The index is rebuilt from disk on every// call (no in-memory state), so this resolves even after a process restart.- let rehydrated = rehydrate_image_placeholders(&messages);+ let rehydrated = rehydrate_image_placeholders(&messages).await;assert_eq!(rehydrated.len(), 1);let content = rehydrated[0].content.clone();assert!(@@ -202,14 +202,10 @@ async fn image_placeholder_rehydrates_to_disk_path_for_provider() {"placeholder consumed: {content}");- // The marker points at a real file on disk.- let start = content.find("[IMAGE:").unwrap() + "[IMAGE:".len();- let end = content[start..].find(']').unwrap() + start;- let path = &content[start..end];- assert!(path.ends_with(".png"), "disk path carries ext: {path}");+ // The marker carries the stashed bytes as an inline data URI.assert!(- std::path::Path::new(path).is_file(),- "attachment persisted to disk: {path}"+ content.contains("[IMAGE:data:image/png;base64,"),+ "stashed attachment rehydrated inline: {content}");// Round-trip: the provider prep step re-reads the file back into a data URI,@@ -230,14 +226,14 @@ async fn image_placeholder_rehydrates_to_disk_path_for_provider() {);}-#[test]-fn rehydrate_missing_stash_id_keeps_placeholder_text() {+#[tokio::test]+async fn rehydrate_missing_stash_id_keeps_placeholder_text() {// A placeholder whose id is absent from the stash (e.g. after a restart) is// left verbatim rather than dropped — the model still sees a text mention.let messages = vec![TranscriptMessage::user("see [Image: image #att:deadbeefdeadbeef]".to_string(),)];- let out = rehydrate_image_placeholders(&messages);+ let out = rehydrate_image_placeholders(&messages).await;assert!(out[0].content.contains("[Image: image #att:deadbeefdeadbeef]"));@@ -296,7 +292,7 @@ fn extract_image_placeholders_pulls_att_tokens_in_order() {#[tokio::test]async fn sweep_keeps_fresh_attachments() {// A freshly-written attachment (age < TTL) survives the startup sweep, and- // the disk index resolves it — the core of restart-survival.+ // the index resolves it — the core of restart-survival.let msg = format!("[IMAGE:{TINY_PNG_DATA_URI}]");let placeholdered = stash_image_attachments(&msg, &MultimodalConfig::default()).await;let id = placeholdered@@ -308,7 +304,7 @@ async fn sweep_keeps_fresh_attachments() {sweep_stale_attachments().await;- let index = build_attachment_index();+ let index = build_attachment_index(&[TranscriptMessage::user(placeholdered.clone())]).await;assert!(index.contains_key(&id),"fresh attachment {id} retained after sweep"diff --git a/crates/openhuman-core/src/threads/turn_state/mod.rs b/crates/openhuman-core/src/threads/turn_state/mod.rsindex 877fce3f78..06684020e6 100644--- a/crates/openhuman-core/src/threads/turn_state/mod.rs+++ b/crates/openhuman-core/src/threads/turn_state/mod.rs@@ -1,9 +1,10 @@//! Restart-survivable snapshots of in-flight agent turns.//!-//! [`store::TurnStateStore`] is the persistence layer: one JSON file per-//! turn under the workspace, written atomically and serialized through a-//! process-wide mutex; `mark_all_interrupted` flags any non-terminal-//! snapshot left over from an unclean shutdown at cold boot.+//! The `tinyagents_session::port::TurnStates` port is the persistence layer+//! (reached through `agent::session_store::turn_states_for`): one snapshot per+//! turn in the storage backend, so a thread's turn state survives a restart;+//! `mark_all_interrupted` flags any non-terminal snapshot left over from an+//! unclean shutdown at cold boot.//! `tinyagents_session::turn_state::TurnStateMirror` is the writer — it is driven by//! [`mirror::ObserveProgress`], which translates//! [`crate::agent::progress::AgentProgress`] events into [`types::TurnState`]diff --git a/crates/openhuman-core/src/web_chat/README.md b/crates/openhuman-core/src/web_chat/README.mdindex deb6aba4da..3d3f989cca 100644--- a/crates/openhuman-core/src/web_chat/README.md+++ b/crates/openhuman-core/src/web_chat/README.md@@ -98,7 +98,7 @@ subscriber all listen to.6. While the turn runs, `spawn_progress_bridge` turns each `AgentProgress`event into `WebChannelEvent`s (`text_delta`, `thinking_delta`,`tool_call`, `tool_result`, `chat_interim`, `turn_cost`, sub-agent events- and so on), mirrors turn state into `threads::turn_state::TurnStateStore`,+ and so on), mirrors turn state into the `TurnStates` port,and emits an `inference_heartbeat` every `INFERENCE_HEARTBEAT_SECS` (20 s)so a long silent prefill does not trip the frontend's roughly 120 ssilence timeout (#4270). Sub-agent arms live in