mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-04 09:28:56 +00:00
The streamed step labels refactor dropped the trailing ellipsis on four extension labels, so the browser evaluate, text editor, parallel and call_subordinate steps read as bare phrases while the default and code execution labels kept their dots. Each extension owns its full label text and appends the ellipsis itself, matching how the default and code execution labels are written, while the argument length counter stays centrally appended. The browser extension now also labels its long multi and cdp actions and names the tool in every label, so Evaluating alone no longer hides which tool runs. Validation: pytest tests/test_tool_step_description.py tests/test_plugin_tool_step_descriptions.py tests/test_plain_response_logging.py -q (86 passed); git diff --check
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
import json
|
|
|
|
from helpers.extension import Extension
|
|
|
|
|
|
class ParallelStep(Extension):
|
|
def execute(self, ctx: dict | None = None, **kwargs) -> None:
|
|
if not isinstance(ctx, dict) or ctx.get("tool_name") != "parallel":
|
|
return
|
|
args = ctx.get("tool_args")
|
|
if not isinstance(args, dict):
|
|
return
|
|
raw_calls = next((args[key] for key in ("tool_calls", "calls", "items") if key in args), None)
|
|
if isinstance(raw_calls, str):
|
|
try:
|
|
raw_calls = json.loads(raw_calls)
|
|
except json.JSONDecodeError:
|
|
return
|
|
if not isinstance(raw_calls, list) or not raw_calls:
|
|
return
|
|
head = ""
|
|
if isinstance(raw_calls[0], dict):
|
|
name = raw_calls[0].get("tool_name") or raw_calls[0].get("tool") or raw_calls[0].get("name")
|
|
if isinstance(name, str) and name:
|
|
head = name.replace("_", " ")
|
|
if not head:
|
|
return
|
|
more = len(raw_calls) - 1
|
|
if more > 0:
|
|
ctx["step"] = f"Using in parallel {head} and {more} more tools..."
|
|
else:
|
|
ctx["step"] = f"Using in parallel {head}..."
|