Add M7.6 provider tool access control and M7.7 agent delegation for ToolStep

This commit is contained in:
rob
2026-07-20 02:08:47 -03:00
parent 8d38bdd83a
commit 93ea80950e
5 changed files with 134 additions and 5 deletions
+38 -1
View File
@@ -8,7 +8,7 @@ import pytest
import yaml
from cmdforge.tool import (
Tool, ToolArgument, PromptStep, CodeStep,
Tool, ToolArgument, PromptStep, CodeStep, ToolStep,
validate_tool_name, load_tool, save_tool, delete_tool,
list_tools, tool_exists, create_wrapper_script,
DEFAULT_CATEGORIES
@@ -579,3 +579,40 @@ class TestDefaultCategories:
assert "Developer" in DEFAULT_CATEGORIES
assert "Data" in DEFAULT_CATEGORIES
assert "Other" in DEFAULT_CATEGORIES
class TestAgentContext:
def test_toolstep_profile_roundtrip(self):
step = ToolStep(tool="my-tool", output_var="out", profile="architect")
d = step.to_dict()
assert d["profile"] == "architect"
restored = ToolStep.from_dict(d)
assert restored.profile == "architect"
def test_toolstep_skills_roundtrip(self):
step = ToolStep(tool="my-tool", output_var="out", skills=["python"])
d = step.to_dict()
assert d["skills"] == ["python"]
restored = ToolStep.from_dict(d)
assert restored.skills == ["python"]
def test_toolstep_empty_skills_serialized(self):
step = ToolStep(tool="my-tool", output_var="out", skills=[])
d = step.to_dict()
assert d["skills"] == []
restored = ToolStep.from_dict(d)
assert restored.skills == []
def test_toolstep_no_skills_not_serialized(self):
step = ToolStep(tool="my-tool", output_var="out")
d = step.to_dict()
assert "skills" not in d
assert "profile" not in d
def test_promptstep_skills_roundtrip(self):
step = PromptStep(
prompt="Test", provider="claude", output_var="out",
skills=["python"],
)
restored = PromptStep.from_dict(step.to_dict())
assert restored.skills == ["python"]