+
    iHàjÀ
  ã                  óL   € R t ^ RIHt ^ RIt^ RIHt ^ RIHt  ! R R]4      tR# )u0  Browser Provider ABC: pluggable cloud browser backends (Browserbase, Browser Use, Firecrawl, â€¦).

Providers register via :meth:`PluginContext.register_browser_provider`; the active one (selected by
``browser.cloud_provider``) services every cloud-mode ``browser_*`` tool call. They live in
``<repo>/plugins/browser/<name>/`` (built-in) or ``~/.hermes/plugins/browser/<name>/`` (user).

Session metadata contract (legacy ``CloudBrowserProvider`` shape; ``tools.browser_tool`` needs no
translation). ``bb_session_id`` is a legacy key name kept verbatim â€” it holds the provider's session ID
regardless of provider::

    {
        "session_name": str,        # unique name for agent-browser --session
        "bb_session_id": str,       # provider session ID (for close/cleanup)
        "cdp_url": str,             # CDP websocket URL
        "expires_at": str,          # optional provider-authoritative ISO timestamp
        "features": dict,           # feature flags that were enabled
        "external_call_id": str,    # optional, managed-gateway billing key
    }
)ÚannotationsN)ÚDict)ÚProviderBasec                  óÂ   € ] tR t^tRt]P                  R R l4       t]P                  R R l4       t]P                  R R l4       t	]P                  R R	 l4       t
R
tR# )ÚBrowserProvidera[  Abstract base class for a cloud browser backend.

Subclasses implement :attr:`name` (the ``browser.cloud_provider`` value), :meth:`is_available`, and
the lifecycle trio :meth:`create_session` / :meth:`close_session` / :meth:`emergency_cleanup`.
``get_setup_schema`` may add ``"post_setup"`` (e.g. ``"agent_browser"``) to trigger the install hook.
c               ó   € V ^8„  d   QhRR/# )é   ÚreturnÚbool© )Úformats   "Ú;/home/ubuntu/.hermes/hermes-agent/agent/browser_provider.pyÚ__annotate__ÚBrowserProvider.__annotate__&   s   € ÷ #ñ #˜dñ #ó    c                ó   € R# )uÊ   True when this provider can service calls. Cheap check only (env var, token readable, dep
importable) â€” must NOT make network calls; runs at tool-registration time and on every
``hermes tools`` paint.Nr   )Úselfs   &r   Úis_availableÚBrowserProvider.is_available%   ó   ‚ r   c               ó    € V ^8„  d   QhRRRR/# )r   Útask_idÚstrr	   zdict[str, object]r   )r   s   "r   r   r   ,   s   € ÷ 6ñ 6 cð 6Ð.?ñ 6r   c                ó   € R# )zÝCreate a cloud browser session and return the metadata dict from the module docstring.
May raise ``ValueError`` (missing credentials) or ``RuntimeError`` (network / API failure);
the dispatcher surfaces these to the user.Nr   )r   r   s   &&r   Úcreate_sessionÚBrowserProvider.create_session+   r   r   c               ó    € V ^8„  d   QhRRRR/# )r   Ú
session_idr   r	   r
   r   )r   s   "r   r   r   2   s   € ÷ bñ b¨ð b°ñ br   c                ó   € R# )z±Release a cloud session by provider session ID. Returns True on success, False on failure;
should not raise (log and return False so the dispatcher's cleanup loop keeps moving).Nr   ©r   r   s   &&r   Úclose_sessionÚBrowserProvider.close_session1   r   r   c               ó    € V ^8„  d   QhRRRR/# )r   r   r   r	   ÚNoner   )r   s   "r   r   r   7   s   € ÷ +ñ +¨Cð +°Dñ +r   c                ó   € R# )zyBest-effort teardown from atexit / signal handlers. Must tolerate missing credentials and
network errors; must not raise.Nr   r   s   &&r   Úemergency_cleanupÚ!BrowserProvider.emergency_cleanup6   r   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚabcÚabstractmethodr   r   r    r%   Ú__static_attributes__r   r   r   r   r      sq   † ñð 	×Ñô#ó ð#ð
 	×Ñô6ó ð6ð
 	×Ñôbó ðbð 	×Ñô+ó ô+r   r   )	r+   Ú
__future__r   r,   Útypingr   Úagent.provider_baser   r   r   r   r   Ú<module>r2      s$   ðñõ( #ã 
Ý å ,ô+�lö +r   