mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-04 01:18:39 +00:00
Move the behavior adjustment tool, rules prompt, merge templates, and DOX into a _behavior_adjustment plugin so durable behavior, personality, style, and response-format rules ship as a standard plugin. Rules persist in the memory subdirectory, the system-prompt extension injects them at the front, and normalization keeps merged rulesets deduplicated. The tool prompt drops the stale promptinclude guidance that no longer matches how the tool writes rules. The tool logs its message as its own `behavior_adjustment` type with an `icon://psychology Adjusting behavior` headline rendered through a BEH badge handler in the brain pink accent. Validation: pytest tests/test_tool_action_contracts.py tests/test_responses_tools.py tests/test_behavior_tool_ui.py
30 lines
850 B
Python
30 lines
850 B
Python
from types import SimpleNamespace
|
|
|
|
from plugins._behavior_adjustment.tools.behavior_adjustment import UpdateBehavior
|
|
|
|
|
|
class _FakeLog:
|
|
def log(self, **kwargs) -> dict:
|
|
return kwargs
|
|
|
|
|
|
class _FakeAgent:
|
|
def __init__(self) -> None:
|
|
self.context = SimpleNamespace(log=_FakeLog())
|
|
|
|
|
|
def _make_tool(args: dict) -> UpdateBehavior:
|
|
return UpdateBehavior(
|
|
agent=_FakeAgent(), name="behavior_adjustment", method="execute", args=args, message="", loop_data=None
|
|
)
|
|
|
|
|
|
def test_log_object_uses_behavior_type_and_static_heading():
|
|
tool = _make_tool({"adjustments": "always answer in Russian"})
|
|
|
|
entry = tool.get_log_object()
|
|
|
|
assert entry["type"] == "behavior_adjustment"
|
|
assert entry["heading"] == "icon://psychology Adjusting behavior"
|
|
assert entry["kvps"]["adjustments"] == "always answer in Russian"
|