Skip to content

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

test(toolpacks): add scoping and visibility tests for toolpacks

Steven Enamakelfbf331ef7891
diff --git a/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests_scoping_and_visibility_tests.rs b/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests_scoping_and_visibility_tests.rs
index 76f08a292f..da1e7fe1d0 100644
--- a/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests_scoping_and_visibility_tests.rs
+++ b/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests_scoping_and_visibility_tests.rs
@@ -186,12 +186,12 @@ fn rebinding_a_pack_handle_repoints_it_at_the_new_registry() {
// allocation went away the upgrade failed and every `use_skill` call
// reported the registry as unavailable for the rest of the session.
// Last write must win.
- let name = pack("crypto").unwrap().tools[0];
+ let name = pack("web3").unwrap().tools[0];
// The agent's first tool `Arc`, with the packed tool marked Dangerous.
let first = registry_with(name, PermissionLevel::Dangerous);
let use_skill = find(&first, USE_SKILL);
- let args = json!({"skill": "crypto", "tool": name});
+ let args = json!({"skill": "web3", "tool": name});
assert_eq!(
use_skill.permission_level_with_args(&args),
PermissionLevel::Dangerous,
@@ -340,11 +340,11 @@ fn a_direct_hand_off_closes_its_owners_pack_and_nothing_else() {
};
let delegates = vec![
delegate("setup_skills", "skill_setup"),
- delegate("create_skill", "skill_creator"),
- delegate("do_crypto", "crypto_agent"),
+ delegate("create_image", "image_agent"),
];
let raw = registry_with_all(&[
"skill_registry_install",
+ "media_generate_image",
"wallet_status",
"mcp_registry_tool_call",
]);
@@ -354,19 +354,19 @@ fn a_direct_hand_off_closes_its_owners_pack_and_nothing_else() {
.chain(delegates.iter().map(|t| t.as_ref()))
.collect();
// `setup_skills` is unpacked, so the orchestrator advertises it by
- // construction; `create_skill` and `do_crypto` are packed.
+ // construction; `create_image` is packed.
let closed = closed_by_direct_handoff("orchestrator", &tools);
assert!(
closed.contains(&"skill_registry_install"),
"a raw tool of the pack `setup_skills` hands off to must close: {closed:?}"
);
assert!(
- !closed.contains(&"create_skill"),
- "a hand-off inside a closed pack is a route and stays open: {closed:?}"
+ !closed.contains(&"media_generate_image"),
+ "`create_image` is withheld, so the media pack stays open: {closed:?}"
);
assert!(
!closed.contains(&"wallet_status"),
- "`do_crypto` is withheld, so the crypto pack stays open: {closed:?}"
+ "no hand-off owns the web3 skill, so it stays open: {closed:?}"
);
assert!(
!closed.contains(&"mcp_registry_tool_call"),
@@ -459,11 +459,10 @@ fn a_named_scope_session_closes_the_pack_its_visible_list_never_mentions() {
///
/// It is the only create-capable file tool anywhere (`apply_patch` and `edit`
/// both canonicalize an existing target; `shell` means a heredoc). While it was
-/// a member of the `files` pack, every one of that pack's owners —
-/// `code_executor`, `planner`, `critic`, … — was one synthesised delegate away
-/// on the orchestrator's belt, so `closed_by_direct_handoff` DENIED the pack
-/// and `use_skill { skill: "files" }` answered "has no tools available in this
-/// session". The agent's own `agent.toml` names `file_write` and says it
+/// a member of the `files` pack (now `coding`), that pack's owners were one
+/// synthesised delegate away on the orchestrator's belt, so
+/// `closed_by_direct_handoff` DENIED the pack and `use_skill` answered "has no
+/// tools available in this session". The agent's own `agent.toml` names `file_write` and says it
/// "creates new files"; this pins that the pack table no longer contradicts it.
///
/// `file_read` is held to the same rule for a different reason: every
@@ -473,9 +472,10 @@ fn a_named_scope_session_closes_the_pack_its_visible_list_never_mentions() {
fn the_orchestrators_only_file_creator_is_never_closed() {
use crate::agent::orchestration::tools::{ArchetypeDelegationTool, DelegationTarget};
- let delegates: Vec<Box<dyn tinytools::Tool>> = ["run_code", "plan", "review_code"]
+ // A hypothetical unpacked hand-off to a `coding` owner closes that pack.
+ let delegates: Vec<Box<dyn tinytools::Tool>> = ["review_code"]
.iter()
- .zip(["code_executor", "planner", "critic"])
+ .zip(["critic"])
.map(|(name, target)| {
Box::new(ArchetypeDelegationTool {
tool_name: (*name).to_string(),
@@ -502,7 +502,7 @@ fn the_orchestrators_only_file_creator_is_never_closed() {
);
assert!(
closed.contains(&"grep"),
- "the rest of the `files` pack is still the specialists' belt: {closed:?}"
+ "the rest of the `coding` pack is still the owners' belt: {closed:?}"
);
for tool in ["file_write", "file_read"] {
assert!(