Skip to content

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

test(agent): add tool_rules field to registry test fixtures

Steven Enamakel7cf3b53adbe4
diff --git a/crates/openhuman-core/src/agent/registry/defaults_tests.rs b/crates/openhuman-core/src/agent/registry/defaults_tests.rs
index c49e62157d..2934fa0a6b 100644
--- a/crates/openhuman-core/src/agent/registry/defaults_tests.rs
+++ b/crates/openhuman-core/src/agent/registry/defaults_tests.rs
@@ -38,6 +38,7 @@ fn custom_entry(id: &str) -> AgentRegistryEntry {
system_prompt: Some("You are a meticulous finance analyst.".to_string()),
tool_allowlist: vec!["memory".to_string(), "web_search".to_string()],
tool_denylist: vec!["file_write".to_string()],
+ tool_rules: None,
subagents: AgentSubagentPolicy::from_allowlist(vec!["researcher".to_string()]),
tags: vec!["finance".to_string()],
metadata: Value::Null,
@@ -122,6 +123,7 @@ fn entry_to_definition_to_entry_round_trip_preserves_key_fields() {
system_prompt: None,
tool_allowlist: tools_to_allowlist(&def.tools, &def.extra_tools),
tool_denylist: def.disallowed_tools.clone(),
+ tool_rules: None,
subagents: AgentSubagentPolicy::from_allowlist(
def.subagents
.iter()
diff --git a/crates/openhuman-core/src/agent/registry/ops_tests.rs b/crates/openhuman-core/src/agent/registry/ops_tests.rs
index c87297c689..a3b4525a7a 100644
--- a/crates/openhuman-core/src/agent/registry/ops_tests.rs
+++ b/crates/openhuman-core/src/agent/registry/ops_tests.rs
@@ -14,6 +14,7 @@ fn custom_agent(id: &str, enabled: bool) -> AgentRegistryEntry {
system_prompt: Some("Do custom work.".to_string()),
tool_allowlist: vec!["memory".to_string()],
tool_denylist: Vec::new(),
+ tool_rules: None,
subagents: AgentSubagentPolicy::default(),
tags: vec!["custom".to_string()],
metadata: Value::Null,
@@ -32,6 +33,7 @@ fn merge_entries_applies_default_overrides_and_filters_disabled() {
system_prompt: None,
tool_allowlist: vec!["*".to_string()],
tool_denylist: Vec::new(),
+ tool_rules: None,
subagents: AgentSubagentPolicy::default(),
tags: Vec::new(),
metadata: Value::Null,
diff --git a/crates/openhuman-core/src/agent/registry/types_tests.rs b/crates/openhuman-core/src/agent/registry/types_tests.rs
index 3a856b9db9..c0399b233c 100644
--- a/crates/openhuman-core/src/agent/registry/types_tests.rs
+++ b/crates/openhuman-core/src/agent/registry/types_tests.rs
@@ -31,6 +31,7 @@ fn subagent_policy_serializes_as_section() {
system_prompt: None,
tool_allowlist: Vec::new(),
tool_denylist: Vec::new(),
+ tool_rules: None,
subagents: AgentSubagentPolicy::from_allowlist(vec!["researcher".to_string()]),
tags: Vec::new(),
metadata: Value::Null,
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry_tests.rs
index 03761a59fe..df1aeaa6be 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry_tests.rs
@@ -19,6 +19,7 @@ fn synthetic(id: &str, tier: AgentTier, subagents: &[&str]) -> HostAgentDefiniti
system_prompt: None,
tool_allowlist: Vec::new(),
tool_denylist: Vec::new(),
+ tool_rules: None,
subagents: AgentSubagentPolicy::from_allowlist(
subagents.iter().map(|s| s.to_string()).collect(),
),
@@ -223,9 +224,9 @@ fn skills_wildcard_entries_are_not_agent_ids() {
#[test]
fn denylist_supports_exact_and_prefix_forms() {
let denied = vec!["file_write".to_string(), "storage_*".to_string()];
- assert!(disallows_tool(&denied, "file_write"));
- assert!(disallows_tool(&denied, "storage_delete_file"));
- assert!(!disallows_tool(&denied, "file_read"));
+ assert!(crate::tools::rules::glob_list_matches(&denied, "file_write"));
+ assert!(crate::tools::rules::glob_list_matches(&denied, "storage_delete_file"));
+ assert!(!crate::tools::rules::glob_list_matches(&denied, "file_read"));
}
/// A wildcard scope materializes the session's registered tool surface.
@@ -394,6 +395,7 @@ fn custom_entry(id: &str, enabled: bool) -> AgentRegistryEntry {
system_prompt: Some("Do finance work.".to_string()),
tool_allowlist: vec!["memory_recall".to_string()],
tool_denylist: Vec::new(),
+ tool_rules: None,
subagents: AgentSubagentPolicy::default(),
tags: Vec::new(),
metadata: serde_json::Value::Null,
diff --git a/crates/openhuman-core/src/flows/ops_inference_gate_tests.rs b/crates/openhuman-core/src/flows/ops_inference_gate_tests.rs
index ec1d7cbf65..f4ce23538b 100644
--- a/crates/openhuman-core/src/flows/ops_inference_gate_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_inference_gate_tests.rs
@@ -195,6 +195,7 @@ fn agent_node_role_prefers_custom_registry_entry_model_pin_over_default() {
system_prompt: None,
tool_allowlist: Vec::new(),
tool_denylist: Vec::new(),
+ tool_rules: None,
subagents: Default::default(),
tags: Vec::new(),
metadata: Value::Null,
diff --git a/crates/openhuman-core/src/flows/tinyflows/tinyflows_tests.rs b/crates/openhuman-core/src/flows/tinyflows/tinyflows_tests.rs
index 405fb2ba8c..5ebb6427dc 100644
--- a/crates/openhuman-core/src/flows/tinyflows/tinyflows_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/tinyflows_tests.rs
@@ -145,6 +145,7 @@ fn custom_registry_entry(enabled: bool) -> crate::agent::registry::AgentRegistry
system_prompt: Some("You are a meticulous finance analyst.".to_string()),
tool_allowlist: vec!["memory_search".to_string()],
tool_denylist: Vec::new(),
+ tool_rules: None,
subagents: AgentSubagentPolicy::default(),
tags: Vec::new(),
metadata: json!(null),