mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-04 09:28:56 +00:00
Declare the Browser callable in the browser-automation skill and bind it through shared skill registration. Remove the standalone tool entry point and prompt while keeping the Browser backend and native parameters. Preserve saved whole-tool and per-action Tool Access denials in the Browser plugin. Verify on-demand discovery and host dispatch with live Chromium and focused regression tests.
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
from types import SimpleNamespace
|
|
|
|
from plugins._browser.helpers.browser_handler import Browser
|
|
|
|
|
|
class _FakeLog:
|
|
def log(self, **kwargs) -> dict:
|
|
return kwargs
|
|
|
|
|
|
class _FakeAgent:
|
|
def __init__(self) -> None:
|
|
self.context = SimpleNamespace(log=_FakeLog())
|
|
|
|
|
|
def _make(args: dict) -> Browser:
|
|
return Browser(
|
|
agent=_FakeAgent(), name="browser", method="execute", args=args, message="", loop_data=None
|
|
)
|
|
|
|
|
|
def test_log_object_names_action_without_agent_prefix():
|
|
entry = _make({"action": "list"}).get_log_object()
|
|
|
|
assert entry["heading"] == "icon://captive_portal Browser: Listing tabs"
|
|
assert entry["kvps"] == {"action": "list"}
|
|
|
|
|
|
def test_get_headings_name_action_and_target():
|
|
assert _make({"action": "open", "url": "https://example.com"}).get_heading() == "icon://captive_portal Browser: Opening https://example.com"
|
|
assert _make({"action": "type_submit", "ref": 5, "text": "hi"}).get_heading() == "icon://captive_portal Browser: Typing"
|
|
assert _make({"action": "screenshot"}).get_heading() == "icon://captive_portal Browser: Taking screenshot"
|
|
assert _make({"action": "setactive"}).get_heading() == "icon://captive_portal Browser: Selecting tab"
|
|
assert _make({}).get_heading() == "icon://captive_portal Browser"
|