mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-04 17:38:45 +00:00
The goal tool logs its message as its own `goal` type with an `icon://flag` verb headline such as `Setting goal` that names the action without quoting argument text, and a plugin message handler renders it as an AIM badge with green accent styles distinct from the teal response family so goal activity reads like the other dedicated tool surfaces. Regression tests cover the log entry and headline. Validation: pytest plugins/_goal/tests/test_goal_tool_ui.py plugins/_goal/tests/test_goal_plugin.py
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
from types import SimpleNamespace
|
|
|
|
from plugins._goal.tools.goal import GoalTool
|
|
|
|
|
|
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) -> GoalTool:
|
|
return GoalTool(
|
|
agent=_FakeAgent(), name="goal", method="execute", args=args, message="", loop_data=None
|
|
)
|
|
|
|
|
|
def test_log_object_passes_action_through():
|
|
tool = _make_tool({"action": "create", "objective": "Ship the release"})
|
|
|
|
entry = tool.get_log_object()
|
|
|
|
assert entry["type"] == "goal"
|
|
assert entry["heading"] == "icon://flag Setting goal"
|
|
assert entry["kvps"]["action"] == "create"
|
|
assert entry["kvps"]["objective"] == "Ship the release"
|
|
|
|
|
|
def test_get_headings_follow_action_verbs_without_arg_text():
|
|
assert _make_tool({}).get_heading() == "icon://flag Checking goal"
|
|
assert _make_tool({"action": "show"}).get_heading() == "icon://flag Checking goal"
|
|
assert _make_tool({"action": "update", "objective": "Ship it"}).get_heading() == "icon://flag Updating goal"
|
|
assert _make_tool({"action": "complete", "objective": "Ship it"}).get_heading() == "icon://flag Completing goal"
|
|
assert _make_tool({"action": "update", "status": "blocked"}).get_heading() == "icon://flag Blocking goal"
|