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(profiles): add capability and tool profile definitions
Steven Enamakela352ecb059d9
diff --git a/crates/openhuman-core/src/profiles/capabilities.rs b/crates/openhuman-core/src/profiles/capabilities.rsindex 7e0c313f94..ea1b680a9c 100644--- a/crates/openhuman-core/src/profiles/capabilities.rs+++ b/crates/openhuman-core/src/profiles/capabilities.rs@@ -7,7 +7,7 @@use crate::agent::hooks::{ToolHook, ToolHookContext, ToolHookDecision};use crate::agent::{HostTools, HostTurnTools, TurnContext};use crate::config::Config;-use crate::core::runtime::{ContextOverlay, CoreContext};+use crate::core::runtime::{ContextOverlay, CoreContext, DispatchCtx};use crate::tools::toolpacks::{GroupMode, ToolGroups};use std::collections::{HashMap, HashSet};use std::sync::Arc;@@ -91,7 +91,7 @@ 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, ctx: &DispatchCtx, name: &str) -> bool {+ pub fn names_admittable(&self, name: &str) -> bool {super::tools::OPERATOR_ADMITTABLE.contains(&name)&& self.namesdiff --git a/crates/openhuman-core/src/profiles/tools.rs b/crates/openhuman-core/src/profiles/tools.rsindex 770bffb948..d4a8c795ba 100644--- a/crates/openhuman-core/src/profiles/tools.rs+++ b/crates/openhuman-core/src/profiles/tools.rs@@ -170,14 +170,20 @@ pub fn allowlisted() -> Vec<SaasToolGroup> {/// The tool-list filter. Outside SaaS this is the domain filter, plus the/// [`OPERATOR_ADMITTABLE`] tools the current agent names in its scope.pub fn admits(tool: &str, domain_ok: bool) -> bool {+ // Transitional (#7801): the tool-list filter has no context of its own yet.+ admits_in(&DispatchCtx::ambient(), tool, domain_ok)+}++/// [`admits`] for the agent `ctx` runs for.+pub fn admits_in(ctx: &DispatchCtx, tool: &str, domain_ok: bool) -> bool {if !is_saas() {- return domain_ok || admitted_by_name(tool, current_named_tools().as_deref());+ return domain_ok || admitted_by_name(tool, current_named_tools(ctx).as_deref());}let mut admitted = admits_with(tool, domain_ok, &allowlisted());if !admitted&& !domain_ok&& !is_hard_denied(tool)- && super::capabilities::ProfileCapabilities::current()+ && super::capabilities::ProfileCapabilities::in_ctx(ctx).is_some_and(|caps| caps.names_admittable(tool)){admitted = true;@@ -199,11 +205,11 @@ pub fn admitted_by_name(tool: &str, named: Option<&std::collections::HashSet<Stradmitted}-/// The named tool scope of the agent the current context serves, if any.-fn current_named_tools() -> Option<std::sync::Arc<std::collections::HashSet<String>>> {- crate::core::runtime::context::CoreContext::current()?- .host_overrides()?- .named_tools()+/// The named tool scope of the agent `ctx` serves, if any.+fn current_named_tools(+ ctx: &DispatchCtx,+) -> Option<std::sync::Arc<std::collections::HashSet<String>>> {+ ctx.host_overrides()?.named_tools()}/// The approval gate's answer in SaaS, where it never parks: `Ok` for a tool@@ -219,8 +225,8 @@ pub fn gate_verdict_with(tool: &str, groups: &[SaasToolGroup]) -> Result<(), Str/// [`gate_verdict_with`] for the running deployment.pub fn gate_verdict(ctx: &crate::core::runtime::DispatchCtx, tool: &str) -> Result<(), String> {- let verdict = if super::capabilities::ProfileCapabilities::current()- .is_some_and(|caps| caps.authorizes_approval(tool))+ let verdict = if super::capabilities::ProfileCapabilities::in_ctx(ctx)+ .is_some_and(|caps| caps.authorizes_approval(ctx, tool)){super::host::ensure_hosted(ctx)} else {