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
refactor(core): extract surface visibility check into helper
Steven Enamakel0bfc7184704d
diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rsindex 67ae11eea6..3c400bee05 100644--- a/crates/openhuman-core/src/core/all.rs+++ b/crates/openhuman-core/src/core/all.rs@@ -89,11 +89,12 @@ fn group_allowed(group: DomainGroup) -> bool {/// Whether `g` is live in the ambient scope: its family is enabled and, for a/// SaaS user, the method is on the user surface (`user_agents::surface`).fn visible(g: &GroupedController) -> bool {- group_allowed(g.group)- && crate::user_agents::surface::method_visible(- &g.controller.rpc_method_name(),- g.group == DomainGroup::Operator,- )+ group_allowed(g.group) && on_surface(g)+}++fn on_surface(g: &GroupedController) -> bool {+ let operator = g.group == DomainGroup::Operator;+ crate::user_agents::surface::method_visible(&g.controller.rpc_method_name(), operator)}/// The global static registry of all controllers, initialized once on first access.diff --git a/crates/openhuman-core/src/user_agents/surface_tests.rs b/crates/openhuman-core/src/user_agents/surface_tests.rsindex 89d03bbcd6..41ebf47783 100644--- a/crates/openhuman-core/src/user_agents/surface_tests.rs+++ b/crates/openhuman-core/src/user_agents/surface_tests.rs@@ -4,10 +4,13 @@ use super::*;fn single_user_processes_are_not_narrowed() {let unlisted = "openhuman.config_update_autonomy_settings";assert!(- visible_in(false, false, unlisted, false),+ visible_in(false, Scope::Operator, unlisted, false),"single-user core");- assert!(visible_in(false, true, unlisted, false), "embedded agent");+ assert!(+ visible_in(false, Scope::User, unlisted, false),+ "embedded agent"+ );}#[test]@@ -15,19 +18,19 @@ fn the_saas_planes_never_overlap() {let provision = "openhuman.user_agents_provision";let threads = "openhuman.threads_list";assert!(- visible_in(true, false, provision, true),+ visible_in(true, Scope::Operator, provision, true),"operator reaches its plane");assert!(- !visible_in(true, false, threads, false),+ !visible_in(true, Scope::Operator, threads, false),"operator never serves user methods");assert!(- visible_in(true, true, threads, false),+ visible_in(true, Scope::User, threads, false),"user reaches the allowlist");assert!(- !visible_in(true, true, provision, true),+ !visible_in(true, Scope::User, provision, true),"user never reaches the operator plane");assert!(!visible_in(@@ -45,7 +48,7 @@ fn turn_starting_thread_methods_stay_closed_for_now() {"openhuman.threads_edit_message","openhuman.threads_regenerate",] {- assert!(!visible_in(true, true, method, false), "{method}");+ assert!(!visible_in(true, Scope::User, method, false), "{method}");}}@@ -82,3 +85,14 @@ fn user_thread_ids() {assert!(validate_user_thread_id(bad).is_err(), "{bad:?}");}}++#[test]+fn a_saas_task_without_scope_sees_nothing() {+ for (method, operator) in [+ ("openhuman.user_agents_provision", true),+ ("openhuman.threads_list", false),+ ] {+ assert!(!visible_in(true, Scope::None, method, operator), "{method}");+ assert!(visible_in(false, Scope::None, method, operator), "{method}");+ }+}