Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(storage): serve host storage objects through bus proxy

Steven Enamakel935633f93a1e
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index d630919b8b..21855043de 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -159,6 +159,10 @@ tinystoragedrivers = { path = "../../vendor/tinyagents/vendor/tinystoragedrivers
# `modules::storage_host` interface answers loaded modules with. Modules only.
tinystoragedrivers-bus = { path = "../../vendor/tinyagents/vendor/tinystoragedrivers/crates/tinystoragedrivers-bus", optional = true }
tinystoragedrivers-client = { path = "../../vendor/tinyagents/vendor/tinystoragedrivers/crates/tinystoragedrivers-client", optional = true }
+# The host half of the storage bus transport: registers the four `Storage`
+# objects and binds blob streams and watch signals to the calling peer
+# (`Connection::accept_stream_from` / `emit_to`).
+tinystoragedrivers-busproxy = { path = "../../vendor/tinyagents/vendor/tinystoragedrivers/crates/tinystoragedrivers-busproxy", optional = true }
# The module-side export macro, used only to wrap the host's own storage server
# as a *linked* module (`modules/storage_host_linked.rs`): a linked module is the
# one in-process recipient the bus attests, so it is how `Secrets` can be served.
@@ -690,6 +694,7 @@ modules = [
"dep:tinywallet-bus",
"dep:tinystoragedrivers-bus",
"dep:tinystoragedrivers-client",
+ "dep:tinystoragedrivers-busproxy",
"dep:tinybus-module",
]
# Voice domain: STT/TTS providers, the standalone dictation
diff --git a/crates/openhuman-core/src/modules/storage_host_linked.rs b/crates/openhuman-core/src/modules/storage_host_linked.rs
index 03cd870354..fdaf6a1a0b 100644
--- a/crates/openhuman-core/src/modules/storage_host_linked.rs
+++ b/crates/openhuman-core/src/modules/storage_host_linked.rs
@@ -15,7 +15,7 @@
//! a request.
//!
//! The module runs on its own runtime, so each call is handed back to the
-//! host's runtime (`ObjectService::runtime`), where the backend was opened.
+//! host's runtime (`HostEndpoint`'s runtime), where the backend was opened.
use std::sync::{Arc, Mutex};
use std::time::Duration;
@@ -50,7 +50,11 @@ async fn setup(connection: tinybus::Connection) -> tinybus::Result<()> {
.unwrap_or_else(|poison| poison.into_inner())
.clone()
.ok_or_else(|| tinybus::Error::failed("storage host has nothing to serve"))?;
- serve_objects(&connection, &host, Some(runtime)).await
+ // Dropping the handle leaves the objects registered for the life of the
+ // module's connection.
+ serve_objects(&connection, &host, Some(runtime))
+ .await
+ .map(drop)
}
mod export {