Files
hermes-agent/browser/__init__.py
alt-glitch 55866ee0fb refactor(browser): browser sessions, launcher and supervisor move from tools/ to browser/
tools/ holds model tools. These 15 files register none: they launch and
track Chromium, hold the per-task browser sessions and run the CDP
supervisor the browser tools call. They move to a new root package:

  tools/browser_session*.py          -> browser/session*.py
  tools/browser_launcher{,_holders}  -> browser/launcher{,_holders}.py
  tools/browser_lightpanda.py        -> browser/lightpanda.py
  tools/browser_supervisor*.py       -> browser/supervisor*.py
  tools/browser_real_profile_logins  -> browser/real_profile_logins.py
  tools/bot_desktop/browser.py       -> browser/desktop_profile.py

browser/__init__.py is a docstring only. tools/browser_tool.py and every
tool file stay. 38 tests and one helper move to tests/browser/; its
conftest.py imports the autouse fixtures of tests/tools/conftest.py they
ran under.

Old-path files, each a MOVES key, a REQUIRED_NAMES row and a file
written by scripts/move/generate_shims.py:
- tools.browser_supervisor and tools.browser_supervisor_capture are on
  the published plugin API (hermes_cli/data/plugin_api.json), so a
  plugin's import gives the same module object.
- tools.browser_session and tools.browser_session_cloud are imported
  inside functions on every turn by a process started on v0.22.7 to
  v0.23.5 (the per-turn browser cleanup), which keeps running its old
  code after an update swaps the checkout.

Function bodies are unchanged and every import stays where it was.
Loggers follow their modules: every moved file keeps
getLogger(__name__), and the two literal supervisor loggers name
browser.supervisor. browser joins the tools entry of
hermes_logging.COMPONENT_PREFIXES, so `hermes logs --component tools`
shows the same lines. browser also joins packages.find,
FIRST_PARTY_MODULE_ROOTS, _KNOWN_LOGGER_ROOTS, the plugin isolation
audit, six check scripts, the P33 profile-scope pattern, the gateway's
stop-path preload list and the test fixtures that list root packages.

The import and docs rewrites were made by scripts/move/rewrite_imports.py
and rewrite_docs.py; split imports, imports inside child-process code
strings, boundary-lint baseline keys, two resolution-allowlist rows and
docs globs were fixed by hand.

Pinned catalog plugins import these moved modules by the old name, so each has a key in
hermes_agent/compat/moves.py and the plugin guide lists it with the release
that may remove it (no earlier than v0.27.0):
  tools.browser_session_cdp
  tools.browser_session_lifecycle
2026-11-30 16:47:24 +05:30

18 lines
1.3 KiB
Python

"""Browser launch, sessions and the CDP supervisor behind the browser tools.
- ``session``: one browser session per task for ``browser_exec``, always carrying a ``cdp_url``.
- ``session_lifecycle``: inactivity janitor, orphan reap, per-session teardown and the exit sweep.
- ``session_cdp``: user-supplied CDP endpoints (``/browser connect``), dialog policy, supervisor start and stop.
- ``session_cloud``: ``browser.*`` config knobs and cloud browser provider resolution.
- ``session_sandbox``: the bot's Chromium inside the terminal backend's sandbox.
- ``session_real_profile``: a snapshot of the user's Chromium profile and the real browser launched on it.
- ``launcher``: launch, track and stop local Chromium processes.
- ``launcher_holders``: cross-process holders of a shared-profile Chromium.
- ``lightpanda``: the Lightpanda local engine.
- ``supervisor``: the persistent CDP supervisor (dialogs and frames); ``supervisor_dialogs`` and
``supervisor_frames`` are its two halves.
- ``supervisor_capture``: the captured CDP handle for trusted in-process plugins.
- ``real_profile_logins``: reads the real-profile browser's saved logins for the vault's ``browser:`` backend.
- ``desktop_profile``: the Bot Desktop's Chromium: its executable, persistent user-data-dir and dock launch line.
"""