Skip to content

The agent that grows with you

refactor(browser): lifecycle module imports hermes_constants directly; drop origin imports left unused by the move

Teknium70282b6baf8c
diff --git a/tools/browser_tool.py b/tools/browser_tool.py
index 6c3dd53b3a6..96bed4f8b59 100644
--- a/tools/browser_tool.py
+++ b/tools/browser_tool.py
@@ -19,19 +19,16 @@ real-profile CDP, snapshot store); their names are re-imported here so
"""
import atexit
-import contextlib
import functools
import json
import logging
import os
-import signal
import subprocess
import shutil
import sys
import tempfile
import threading
import time
-from datetime import datetime, timezone
from typing import Dict, Any, Optional, List, Tuple, Union
from pathlib import Path
from agent.redact import redact_cdp_url
@@ -41,8 +38,6 @@ from hermes_constants import (
get_hermes_home_override,
hermes_home_key,
node_tool_runnable,
- reset_hermes_home_override,
- set_hermes_home_override,
)
from utils import env_int, is_truthy_value
from hermes_cli.config import DEFAULT_CONFIG, cfg_get
diff --git a/tools/browser_tool_lifecycle.py b/tools/browser_tool_lifecycle.py
index 04b4c84ab31..a6325a7278a 100644
--- a/tools/browser_tool_lifecycle.py
+++ b/tools/browser_tool_lifecycle.py
@@ -18,6 +18,7 @@ from datetime import datetime, timezone
from pathlib import Path
from typing import Any, Dict, Optional, Tuple
+from hermes_constants import get_hermes_home, reset_hermes_home_override, set_hermes_home_override
from tools.browser_tool_origin import origin_module as _origin
@@ -136,7 +137,7 @@ def _session_owner_scope(task_id: str):
)
from hermes_cli.env_loader import hydrate_profile_secret_sources
- home_token = _bt.set_hermes_home_override(owner_home)
+ home_token = set_hermes_home_override(owner_home)
try:
hydrate_profile_secret_sources(Path(owner_home))
secret_token = set_secret_scope(build_profile_secret_scope(Path(owner_home)))
@@ -145,7 +146,7 @@ def _session_owner_scope(task_id: str):
finally:
reset_secret_scope(secret_token)
finally:
- _bt.reset_hermes_home_override(home_token)
+ reset_hermes_home_override(home_token)
def _cleanup_inactive_browser_sessions():
@@ -513,7 +514,7 @@ def _update_session_activity(task_id: str):
_bt = _origin()
with _bt._cleanup_lock:
_bt._session_last_activity[task_id] = time.time()
- _bt._session_owner_homes.setdefault(task_id, str(_bt.get_hermes_home()))
+ _bt._session_owner_homes.setdefault(task_id, str(get_hermes_home()))
def _kill_process_tree(proc: "subprocess.Popen") -> None:
@@ -626,7 +627,7 @@ def _cleanup_old_recordings(max_age_hours=72):
"""Remove browser recordings older than max_age_hours to prevent disk bloat."""
_bt = _origin()
try:
- hermes_home = _bt.get_hermes_home()
+ hermes_home = get_hermes_home()
recordings_dir = hermes_home / "browser_recordings"
if not recordings_dir.exists():
return