fix(browser): stability enhancements + MCP frontend client
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

S7 Browser Hand:
- Remove dead code: browser/actions.rs (314 lines of unused BrowserAction/ActionResult types)
- Fix browser_scrape_page: log failed selector matches instead of silently swallowing errors
- Fix element_to_info: document known limitation for always-None location/size fields
- Fix browserHandStore: reuse activeSessionId in executeScript/takeScreenshot/executeTemplate
  instead of creating orphan Browser sessions
- Add Browser.connect(sessionId) method for session reuse

MCP Frontend:
- Add desktop/src/lib/mcp-client.ts (77 lines) — typed client for MCP Tauri commands
  (startMcpService, stopMcpService, listMcpServices, callMcpTool)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-04-03 22:16:12 +08:00
parent 943afe3b6b
commit 1c99e5f3a3
8 changed files with 133 additions and 335 deletions

View File

@@ -407,8 +407,15 @@ impl BrowserClient {
let is_displayed = element.is_displayed().await.unwrap_or(false);
let is_enabled = element.is_enabled().await.unwrap_or(false);
let is_selected = element.is_selected().await.unwrap_or(false);
// Note: location() and size() may not be available in all fantoccini versions
// Using placeholder values if not available
// KNOWN LIMITATION: location and size are always None.
// The fantoccini Element type does not expose a synchronous bounding-box
// helper; retrieving geometry requires a separate execute_script call
// (e.g. element.getBoundingClientRect()). Since no current caller relies
// on these fields, they are intentionally left as None rather than adding
// an extra round-trip. If bounding-box data is needed in the future,
// add a dedicated browser_element_rect command that calls
// execute_script("return arguments[0].getBoundingClientRect()") and
// deprecate the location/size fields on ElementInfo entirely.
let location = None;
let size = None;