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(agent): register harness definitions from the saas runtime
Steven Enamakel3ca3356b9c25
diff --git a/crates/openhuman-core/src/agent/harness/definition/registry.rs b/crates/openhuman-core/src/agent/harness/definition/registry.rsindex 0355f88481..e820f3623c 100644--- a/crates/openhuman-core/src/agent/harness/definition/registry.rs+++ b/crates/openhuman-core/src/agent/harness/definition/registry.rs@@ -108,6 +108,17 @@ impl AgentDefinitionRegistry {self.by_id.is_empty()}+ /// Whether this registry is exactly the built-in set: the same ids as+ /// [`Self::builtins_only`] and no definition loaded from a file or+ /// synthesized from a user entry. SaaS boot refuses anything else.+ pub fn holds_builtins_only(&self) -> bool {+ let builtins = Self::builtins_only();+ self.len() == builtins.len()+ && self.list().iter().all(|def| {+ def.source == super::DefinitionSource::Builtin && builtins.get(&def.id).is_some()+ })+ }+// ── singleton API ──────────────────────────────────────────────────/// Initialise the global registry. Subsequent calls are no-ops (thediff --git a/crates/openhuman-core/src/core/runtime/saas.rs b/crates/openhuman-core/src/core/runtime/saas.rsindex 3aeac5d555..dd0f4fe04b 100644--- a/crates/openhuman-core/src/core/runtime/saas.rs+++ b/crates/openhuman-core/src/core/runtime/saas.rs@@ -267,6 +267,12 @@ pub async fn build(config.idle_evict_secs);+ // Built-in agent definitions only. The registry is process-wide and the+ // first initialiser wins, so seed it before the core builds: a lazy init+ // during the build would otherwise load one user's workspace definitions+ // for everyone.+ crate::agent::harness::AgentDefinitionRegistry::init_global_builtins()?;+let mut builder = CoreBuilder::new(HostKind::Saas).token(TokenSource::Fixed(Arc::new(bearer))).services(services)@@ -280,16 +286,9 @@ pub async fn build(builder = builder.port(port);}let runtime = builder.build().await?;- // Built-in agent definitions only. The registry is process-wide and the- // first initialiser wins, so seeding it here also stops a lazy init from- // loading one user's workspace definitions for everyone.- crate::agent::harness::AgentDefinitionRegistry::init_global_builtins()?;- log::info!(- "[saas] agent definitions: {} built-in(s), no workspace or home overrides",- crate::agent::harness::AgentDefinitionRegistry::global()- .map(|r| r.len())- .unwrap_or(0)- );+ // Whoever initialised first won; refuse to serve users from a registry+ // that holds anything but the built-ins.+ verify_builtin_definitions(crate::agent::harness::AgentDefinitionRegistry::global())?;let host = Arc::new(crate::user_agents::AgentHost::new(config,runtime.context().clone(),@@ -299,6 +298,26 @@ pub async fn build(Ok(runtime)}+/// Refuse boot unless the process-wide agent definition registry is seeded and+/// holds the built-ins only.+pub(crate) fn verify_builtin_definitions(+ registry: Option<&crate::agent::harness::AgentDefinitionRegistry>,+) -> anyhow::Result<()> {+ let Some(registry) = registry else {+ anyhow::bail!("[saas] the agent definition registry was not seeded");+ };+ if !registry.holds_builtins_only() {+ anyhow::bail!(+ "[saas] the agent definition registry holds workspace or home definitions; a SaaS core serves the built-ins only"+ );+ }+ log::info!(+ "[saas] agent definitions: {} built-in(s), no workspace or home overrides",+ registry.len()+ );+ Ok(())+}+#[cfg(test)]#[path = "saas_tests.rs"]mod tests;