mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-11-16 21:37:01 +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
26 lines
No EOL
1.1 KiB
Python
26 lines
No EOL
1.1 KiB
Python
from helpers.tool import Tool, Response
|
|
from plugins._code_execution.tools.code_execution_tool import CodeExecution
|
|
|
|
|
|
class Input(Tool):
|
|
|
|
async def execute(self, keyboard="", **kwargs):
|
|
# normalize keyboard input
|
|
keyboard = keyboard.rstrip()
|
|
# keyboard += "\n" # no need to, code_exec does that
|
|
|
|
# terminal session number
|
|
session = int(self.args.get("session", 0))
|
|
|
|
# forward keyboard input to code execution tool
|
|
args = {"runtime": "terminal", "code": keyboard, "session": session, "allow_running": True}
|
|
cet = CodeExecution(self.agent, "code_execution_tool", "", args, self.message, self.loop_data)
|
|
cet.log = self.log
|
|
return await cet.execute(**args)
|
|
|
|
def get_log_object(self):
|
|
import uuid
|
|
return self.agent.context.log.log(type="code_exe", heading=f"icon://keyboard Using tool '{self.name}'", content="", kvps=self.args, id=str(uuid.uuid4()))
|
|
|
|
async def after_execution(self, response, **kwargs):
|
|
self.agent.hist_add_tool_result(self.name, response.message, id=self.log.id if self.log else "", **(response.additional or {})) |