Skip to content

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

feat(storage): add block_on_anyhow helper

Steven Enamakelc4218be8880a
diff --git a/crates/openhuman-core/src/storage/mod.rs b/crates/openhuman-core/src/storage/mod.rs
index 52109954df..4ded733524 100644
--- a/crates/openhuman-core/src/storage/mod.rs
+++ b/crates/openhuman-core/src/storage/mod.rs
@@ -181,6 +181,21 @@ where
bridge.run(future)?
}
+/// [`block_on`] for a future whose error is an `anyhow::Error` — the stores
+/// tinyflows puts on the ports return those, with typed errors (such as
+/// `FlowUpdateError`) a caller may downcast, so they pass through unchanged.
+///
+/// # Errors
+///
+/// The future's own error, or the bridge's when it cannot start.
+pub fn block_on_anyhow<T, F>(future: F) -> anyhow::Result<T>
+where
+ F: Future<Output = anyhow::Result<T>> + Send + 'static,
+ T: Send + 'static,
+{
+ block_on(async move { Ok(future.await) })?
+}
+
/// Whether a backend with this driver name may be shared by several
/// processes at once. A MongoDB database can be; SQLite files, the memory
/// driver and plain files belong to the one process that opened them.