mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-04 03:58:09 +00:00
The subordinate, unknown, MCP, and generic fallback tool log headlines no longer repeat the agent name. The unknown tool inherits the prefix-free base heading and takes the class-level blank line used by sibling tools, MCP keeps the tool name visible as an argument row, parallel children without a resolvable dedicated tool log through the prefix-free fallback, and the input and text editor fallback headings drop the prefix too. Framework helper DOX and both plugin AGENTS files document the prefix-free fallback rows, and regression tests cover the named headings for method and no-method calls, the generic fallback rows, and source guards for the plugin fallbacks. Validation: pytest tests/test_tool_heading_prefixes.py tests/test_text_editor_message_handler.py tests/test_parallel_tool.py
24 lines
722 B
Python
24 lines
722 B
Python
"""Shared local and remote editor log presentation."""
|
|
|
|
import uuid
|
|
|
|
|
|
def create_editor_log(tool, *, remote: bool = False):
|
|
action = str(tool.args.get("action") or "")
|
|
path = str(tool.args.get("path") or "")
|
|
verb = {"read": "Reading", "write": "Writing", "patch": "Patching"}.get(action)
|
|
suffix = " (remote)" if remote else ""
|
|
heading = (
|
|
f"icon://construction {verb} {path}{suffix}".strip()
|
|
if verb and path
|
|
else f"icon://construction Using tool '{tool.name}'{suffix}"
|
|
)
|
|
return tool.agent.context.log.log(
|
|
type="text_editor",
|
|
heading=heading,
|
|
content="",
|
|
kvps=tool.args,
|
|
_tool_name=tool.name,
|
|
id=str(uuid.uuid4()),
|
|
)
|