Skip to content

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

feat(profiles): add capability and tool profile definitions

Steven Enamakel8463f1b36e55
diff --git a/crates/openhuman-core/src/profiles/capabilities.rs b/crates/openhuman-core/src/profiles/capabilities.rs
index fa0041cfcb..003592efdc 100644
--- a/crates/openhuman-core/src/profiles/capabilities.rs
+++ b/crates/openhuman-core/src/profiles/capabilities.rs
@@ -65,6 +65,14 @@ impl ProfileCapabilities {
);
}
+ /// Whether the operator named `name` in its tool scope and it is one of
+ /// [`OPERATOR_ADMITTABLE`](super::tools::OPERATOR_ADMITTABLE), the tools
+ /// registered although their domain family is off for profiles.
+ pub fn names_admittable(&self, name: &str) -> bool {
+ super::tools::OPERATOR_ADMITTABLE.contains(&name)
+ && self.names.as_ref().is_some_and(|names| names.contains(name))
+ }
+
/// Whether a selected name may reach the host permission decision.
pub fn admits(&self, name: &str) -> bool {
let binding = super::provider_settings::ProfileProviderSettings::current();
diff --git a/crates/openhuman-core/src/profiles/tools.rs b/crates/openhuman-core/src/profiles/tools.rs
index 952d7ccd9a..ad25a2e9d3 100644
--- a/crates/openhuman-core/src/profiles/tools.rs
+++ b/crates/openhuman-core/src/profiles/tools.rs
@@ -109,6 +109,14 @@ pub const HARD_DENIED: &[&str] = &[
"pushover",
];
+/// Tools outside a profile's domain families that an operator may still admit
+/// by naming them in `tool_scope(ToolScopeSpec::Named(..))`: the scheduler
+/// (`cron`, an Automation tool, bounded by `[cron] agent_jobs_only`) and the
+/// two clock tools (`current_time`, `resolve_time`, Platform tools with no
+/// reach beyond the wall clock). Nothing else in those families qualifies, and
+/// a name not in the operator's scope is never registered.
+pub const OPERATOR_ADMITTABLE: &[&str] = &["cron", "current_time", "resolve_time"];
+
/// Whether `tool` is hard-denied to users.
pub fn is_hard_denied(tool: &str) -> bool {
HARD_DENIED.contains(&tool)
@@ -161,7 +169,15 @@ pub fn admits(tool: &str, domain_ok: bool) -> bool {
if !is_saas() {
return domain_ok;
}
- let admitted = admits_with(tool, domain_ok, &allowlisted());
+ let mut admitted = admits_with(tool, domain_ok, &allowlisted());
+ if !admitted
+ && !domain_ok
+ && !is_hard_denied(tool)
+ && super::capabilities::ProfileCapabilities::current()
+ .is_some_and(|caps| caps.names_admittable(tool))
+ {
+ admitted = true;
+ }
if !admitted && domain_ok {
log::debug!("[profiles][tools] withholding `{tool}` from profiles");
}