2 Commits
Author SHA1 Message Date
Pierre Tachoire f4c7fe2c91 feat(browser): add Lightpanda backend support
Lightpanda requires one CDP connection per tab (vs Chrome's shared-WS
model). Add a Backend selector in pkg/browser/, branched lifecycle, and
per-tab connection tracking via pageConns.

- Backend type (chrome | lightpanda), WithBackend option, Backend()
  accessor. Auto-detected from /json/version when unset.
- Lightpanda OpenTab mints a fresh conn, calls
  Target.createBrowserContext (required per-conn) + createTarget.
- ListTabs / getPage are local-map only on Lightpanda (no /json/list,
  no auto-reconnect).
- Shared closeManagedPageLocked helper used by CloseTab, evict, and
  the idle-page reaper.
- Screenshot tool action errors out on Lightpanda (returns a
  placeholder image upstream; route the agent to snapshot instead).
2026-07-01 10:23:03 +02:00
viettranx ee4d34ae28 feat(browser): add timeout, idle auto-close, and max-pages safety mechanisms
Prevent resource leaks and hanging actions in the browser tool:
- Per-action context timeout (default 30s, configurable via timeoutMs param or config)
- Idle page reaper goroutine closes pages unused for 10min (configurable)
- Max pages per tenant (default 5) with LRU eviction
- RefStore cleanup on page close/evict/reap to prevent memory leaks
2026-03-25 13:55:33 +07:00