mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-04 09:28:56 +00:00
The office artifact tool logs gerund headlines like Office: Reading report.odt naming the action and document name instead of the agent-name prefix, and stops showing its internal tool-name argument as a log row. A plugin page-head extension loads the OFF badge accent shared with the DOC family, and the message handler drops the internal argument before rendering. Regression tests cover the log entry and the headlines. Validation: pytest plugins/_office/tests/test_office_tool_ui.py
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
from types import SimpleNamespace
|
|
|
|
from plugins._office.tools.office_artifact import OfficeArtifact
|
|
|
|
|
|
class _FakeLog:
|
|
def log(self, **kwargs) -> dict:
|
|
return kwargs
|
|
|
|
|
|
class _FakeAgent:
|
|
def __init__(self) -> None:
|
|
self.context = SimpleNamespace(log=_FakeLog())
|
|
|
|
|
|
def _make(args: dict) -> OfficeArtifact:
|
|
return OfficeArtifact(
|
|
agent=_FakeAgent(), name="office_artifact", method="execute", args=args, message="", loop_data=None
|
|
)
|
|
|
|
|
|
def test_log_object_drops_agent_prefix_and_internal_kvp():
|
|
entry = _make({"action": "status", "_tool_name": "office_artifact"}).get_log_object()
|
|
|
|
assert entry["heading"] == "icon://description Office: Checking status"
|
|
assert entry["kvps"] == {"action": "status"}
|
|
|
|
|
|
def test_get_headings_name_action_and_document():
|
|
assert _make({"action": "read", "path": "/tmp/report.odt"}).get_heading() == "icon://description Office: Reading report.odt"
|
|
assert _make({"action": "create", "title": "Notes"}).get_heading() == "icon://description Office: Creating Notes"
|
|
assert _make({}).get_heading() == "icon://description Office"
|