Skip to content

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

feat(modules): add tinyflows module

Steven Enamakel9845a2b12876
diff --git a/crates/openhuman-core/src/modules/mod.rs b/crates/openhuman-core/src/modules/mod.rs
index 88dc3ebe00..508dd519de 100644
--- a/crates/openhuman-core/src/modules/mod.rs
+++ b/crates/openhuman-core/src/modules/mod.rs
@@ -123,6 +123,7 @@ mod storage_import_tinymcp;
mod storage_import_tinywallet;
#[cfg(feature = "modules")]
pub mod tinybox;
+pub(crate) mod tinyflows;
#[cfg(feature = "modules")]
mod tokenjuice_host;
pub mod types;
diff --git a/crates/openhuman-core/src/modules/tinyflows.rs b/crates/openhuman-core/src/modules/tinyflows.rs
index 27c4a6d355..0ff83b78a6 100644
--- a/crates/openhuman-core/src/modules/tinyflows.rs
+++ b/crates/openhuman-core/src/modules/tinyflows.rs
@@ -127,24 +127,25 @@ mod imp {
}
/// Stop serving `path`. Fire and forget: a call already admitted finishes.
+ /// Without a runtime to run on (a sync drop at exit) the object is left;
+ /// the process is ending anyway.
pub(crate) fn unserve(path: String) {
- let Some(Ok(runtime)) = runtime::is_started().then(|| Ok::<_, ()>(())).map(|_| {
- // `is_started` guarantees `runtime()` resolves without a build.
- Ok::<_, ()>(())
- }) else {
+ if !runtime::is_started() {
+ return;
+ }
+ let Ok(handle) = tokio::runtime::Handle::try_current() else {
return;
};
- let _ = runtime;
- tokio::spawn(async move {
+ handle.spawn(async move {
let Ok(runtime) = runtime::runtime().await else {
return;
};
let connection = runtime.connection().clone();
let _ = runtime
.spawn(async move {
- if let Ok(path) = ObjectPath::new(&path) {
- let removed = connection.unserve(&path).await;
- tracing::trace!(%path, removed, "[cron:bus] host object unserved");
+ if let Ok(object) = ObjectPath::new(&path) {
+ let removed = connection.unserve(&object).await;
+ tracing::trace!(path = %path, removed, "[cron:bus] host object unserved");
}
})
.await;
@@ -194,11 +195,6 @@ mod imp {
}
}
- pub(crate) struct Unavailable;
- impl Unavailable {
- pub(crate) fn call(&self) {}
- }
-
pub(crate) async fn proxy(config: &Config) -> Result<tinybus::Proxy, String> {
Err(unavailable(config))
}