Skip to content

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

chore: files changed crates/openhuman-core/src/modules/runtime.rs

Steven Enamakel0361a1a4e909
diff --git a/crates/openhuman-core/src/modules/runtime.rs b/crates/openhuman-core/src/modules/runtime.rs
index 796fcb66b8..a256e49453 100644
--- a/crates/openhuman-core/src/modules/runtime.rs
+++ b/crates/openhuman-core/src/modules/runtime.rs
@@ -113,6 +113,23 @@ pub fn is_started() -> bool {
RUNTIME.get().is_some_and(Result::is_ok)
}
+/// Whether `id` is admitted and currently serving on an already-started
+/// module runtime. This is a read-only snapshot; it never starts the runtime.
+#[must_use]
+pub fn is_module_serving(id: &str) -> bool {
+ let Some(Ok(runtime)) = RUNTIME.get() else {
+ return false;
+ };
+ runtime.host().list().into_iter().any(|module| {
+ module.name == id
+ && module.enabled
+ && matches!(
+ module.state,
+ tinybus::module::ModuleState::Ready | tinybus::module::ModuleState::Serving
+ )
+ })
+}
+
#[cfg(test)]
#[path = "runtime_tests.rs"]
mod tests;