//! The Browser abstraction — the whole product sits behind this trait. /// One click/type/navigation step. The mock implements it; a real /// Chromium/CDP adapter lands later behind the same contract. pub trait Browser: Send { fn goto(&mut self, url: &str) -> Result; fn click(&mut self, selector: &str) -> Result; fn typing(&mut self, selector: &str, text: &str) -> Result; fn screenshot(&mut self) -> Result, BrowserError>; /// Naive text snapshot for the agent's working memory. fn text(&self) -> String; } #[derive(Debug, Clone)] pub struct Page { pub url: String, pub title: String, pub links: Vec, pub screenshot: Option>, } #[derive(Debug, Clone)] pub enum BrowserError { // Failures are variants, never strings: agents act on what they can match. Navigation(String), NoSuchElement(String), Budget, }