mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-03 07:21:54 +00:00
feat: auto-launch Chromium-family browser for CDP
Add browser CDP launch candidates for Chrome, Chromium, Brave, and Edge while preserving Chrome-first selection. Retry candidate launch failures instead of giving up after the first executable. Update /browser CLI and TUI messaging, docs, and tool descriptions from Chrome-only wording to Chromium-family browser support. Add regression coverage for Brave/Edge paths, Chrome-first precedence, fallback launches, and CDP endpoint probing.
This commit is contained in:
parent
340d2b6de0
commit
697d38a3f4
19 changed files with 373 additions and 149 deletions
|
|
@ -56,7 +56,7 @@ def get_camofox_url() -> str:
|
|||
def is_camofox_mode() -> bool:
|
||||
"""True when Camofox backend is configured and no CDP override is active.
|
||||
|
||||
When the user has explicitly connected to a live Chrome instance via
|
||||
When the user has explicitly connected to a live Chromium-family browser via
|
||||
``/browser connect`` (which sets ``BROWSER_CDP_URL``), the CDP connection
|
||||
takes priority over Camofox so the browser tools operate on the real
|
||||
browser instead of being silently routed to the Camofox backend.
|
||||
|
|
|
|||
|
|
@ -358,8 +358,9 @@ def browser_cdp(
|
|||
if not endpoint:
|
||||
return tool_error(
|
||||
"No CDP endpoint is available. Run '/browser connect' to attach "
|
||||
"to a running Chrome, or set 'browser.cdp_url' in config.yaml. "
|
||||
"The Camofox backend is REST-only and does not expose CDP.",
|
||||
"to a running Chrome, Brave, Chromium, or Edge browser, or set "
|
||||
"'browser.cdp_url' in config.yaml. The Camofox backend is REST-only "
|
||||
"and does not expose CDP.",
|
||||
cdp_docs=CDP_DOCS_URL,
|
||||
)
|
||||
|
||||
|
|
@ -367,8 +368,8 @@ def browser_cdp(
|
|||
return tool_error(
|
||||
f"CDP endpoint is not a WebSocket URL: {endpoint!r}. "
|
||||
"Expected ws://... or wss://... — the /browser connect "
|
||||
"resolver should have rewritten this. Check that Chrome is "
|
||||
"actually listening on the debug port."
|
||||
"resolver should have rewritten this. Check that a Chromium-family "
|
||||
"browser is actually listening on the debug port."
|
||||
)
|
||||
|
||||
call_params: Dict[str, Any] = params or {}
|
||||
|
|
@ -431,12 +432,12 @@ BROWSER_CDP_SCHEMA: Dict[str, Any] = {
|
|||
"browser operations not covered by browser_navigate, browser_click, "
|
||||
"browser_console, etc.\n\n"
|
||||
"**Requires a reachable CDP endpoint.** Available when the user has "
|
||||
"run '/browser connect' to attach to a running Chrome, or when "
|
||||
"'browser.cdp_url' is set in config.yaml. Not currently wired up for "
|
||||
"cloud backends (Browserbase, Browser Use, Firecrawl) — those expose "
|
||||
"CDP per session but live-session routing is a follow-up. Camofox is "
|
||||
"REST-only and will never support CDP. If the tool is in your toolset "
|
||||
"at all, a CDP endpoint is already reachable.\n\n"
|
||||
"run '/browser connect' to attach to a running Chrome, Brave, Chromium, "
|
||||
"or Edge browser, or when 'browser.cdp_url' is set in config.yaml. "
|
||||
"Not currently wired up for cloud backends (Browserbase, Browser Use, "
|
||||
"Firecrawl) — those expose CDP per session but live-session routing is "
|
||||
"a follow-up. Camofox is REST-only and will never support CDP. If the "
|
||||
"tool is in your toolset at all, a CDP endpoint is already reachable.\n\n"
|
||||
f"**CDP method reference:** {CDP_DOCS_URL} — use web_extract on a "
|
||||
"method's URL (e.g. '/tot/Page/#method-handleJavaScriptDialog') "
|
||||
"to look up parameters and return shape.\n\n"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ accept or dismiss.
|
|||
|
||||
Gated on the same ``_browser_cdp_check`` as ``browser_cdp`` so it only
|
||||
appears when a CDP endpoint is reachable (Browserbase with a
|
||||
``connectUrl``, local Chrome via ``/browser connect``, or
|
||||
``connectUrl``, local Chromium-family browser via ``/browser connect``, or
|
||||
``browser.cdp_url`` set in config).
|
||||
|
||||
See ``website/docs/developer-guide/browser-supervisor.md`` for the full
|
||||
|
|
@ -40,7 +40,7 @@ BROWSER_DIALOG_SCHEMA: Dict[str, Any] = {
|
|||
"happens when a second dialog fires while the first is still open), "
|
||||
"pass ``dialog_id`` from the snapshot to disambiguate.\n\n"
|
||||
"**Availability:** only present when a CDP-capable backend is "
|
||||
"attached — Browserbase sessions, local Chrome via "
|
||||
"attached — Browserbase sessions, local Chromium-family browser via "
|
||||
"``/browser connect``, or ``browser.cdp_url`` in config.yaml. "
|
||||
"Not available on Camofox (REST-only) or the default Playwright "
|
||||
"local browser (CDP port is hidden)."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue