""" ==================================================================================================== LAYA BROWSER AGENT MCP SERVER ==================================================================================================== This module implements a Hugging Face Gradio Space exposing a Laya-powered browser agent as an MCP (Model Context Protocol) server running on ZeroGPU with persistent Storage Bucket support. Dual Operation Mode: 1. Live Browser Extension Mode: Controls the user's real browser (Chrome & Firefox) via an active WebSocket bridge. Allows the agent to browse using the user's authentic desktop session, avoiding anti-bot blocks and utilizing active logins. 2. Headless Playwright Fallback: If no browser extension is paired, actions automatically execute inside the Space container's headless Chromium instance. ---------------------------------------------------------------------------------------------------- 1. LAYA DECISION MODEL SCHEMA & SPECIFICATION ---------------------------------------------------------------------------------------------------- Laya is a non-autoregressive "System-1" decision model (322M-421M parameters) designed for rapid, calibrated browser decision making. Instead of autoregressively generating arbitrary text, it answers typed questions (choice / noul / score) over candidate actions in a single forward pass. * STATE SCHEMA: { "fields": "", "page": { "url": "", "title": "", "text": "" }, "recent_actions": [ {"action": "