mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-05 01:48:44 +00:00
Show first-run installation guidance in the browser panel and tool preview, report real startup stages, and preserve pending launches through reconnects. Use a theme-aware monochrome Tuxee emblem for the Desktop surface.
45 lines
2.0 KiB
Python
45 lines
2.0 KiB
Python
import asyncio
|
|
|
|
from helpers.api import ApiHandler, Request
|
|
from plugins._browser.helpers.config import build_browser_launch_config, get_browser_config
|
|
from plugins._browser.helpers.interactive_view import collect_status as collect_interactive_status
|
|
from plugins._browser.helpers.sandbox import worker
|
|
|
|
from plugins._browser.helpers.runtime import known_context_ids, browser_startup_status
|
|
|
|
|
|
class Status(ApiHandler):
|
|
async def process(self, input: dict, request: Request) -> dict:
|
|
browser_config = get_browser_config()
|
|
launch_config = build_browser_launch_config(browser_config)
|
|
runtime_binary = "/opt/browsers" if worker.ready else ""
|
|
chromium_binary = runtime_binary
|
|
try:
|
|
from plugins._a0_connector.helpers.ws_runtime import all_host_browser_metadata
|
|
except ImportError:
|
|
host_browser = {"connectors": []}
|
|
else:
|
|
host_browser = {"connectors": all_host_browser_metadata()}
|
|
return {
|
|
"plugin": "_browser",
|
|
"startup": await asyncio.to_thread(browser_startup_status, str(input.get('context_id') or '')),
|
|
"playwright": {
|
|
"cache_dir": "sandbox:/opt/browsers",
|
|
"cache_dirs": ["sandbox:/opt/browsers"],
|
|
"binary_found": bool(runtime_binary),
|
|
"install_required": not worker.ready,
|
|
"sandbox": True,
|
|
"binary_path": str(runtime_binary) if runtime_binary else "",
|
|
"chromium_binary_path": str(chromium_binary) if chromium_binary else "",
|
|
"launch_mode": launch_config["browser_mode"],
|
|
},
|
|
"extensions": {
|
|
**launch_config["extensions"],
|
|
"launch_mode": launch_config["browser_mode"],
|
|
"requires_full_browser": launch_config["requires_full_browser"],
|
|
},
|
|
"host_browser": host_browser,
|
|
"interactive_view": collect_interactive_status(),
|
|
"contexts": known_context_ids(),
|
|
}
|