mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-17 04:31:55 +00:00
refactor(restructure): rewrite all imports for hermes_agent package
Rewrite all import statements, patch() targets, sys.modules keys, importlib.import_module() strings, and subprocess -m references to use hermes_agent.* paths. Strip sys.path.insert hacks from production code (rely on editable install). Update COMPONENT_PREFIXES for logger filtering. Fix 3 hardcoded getLogger() calls to use __name__. Update transport and tool registry discovery paths. Update plugin module path strings. Add legacy process-name patterns for gateway PID detection. Add main() to skills_sync for console_script entry point. Fix _get_bundled_dir() path traversal after move. Part of #14182, #14183
This commit is contained in:
parent
65ca3ba93b
commit
4b16341975
898 changed files with 12494 additions and 12019 deletions
|
|
@ -45,15 +45,15 @@ from typing import List, Dict, Any, Optional, Tuple, Callable, cast
|
|||
from dataclasses import dataclass, field
|
||||
from datetime import datetime
|
||||
|
||||
from utils import base_url_host_matches, base_url_hostname
|
||||
from hermes_agent.utils import base_url_host_matches, base_url_hostname
|
||||
import fire
|
||||
from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn, TimeElapsedColumn, TimeRemainingColumn
|
||||
from rich.console import Console
|
||||
from hermes_constants import OPENROUTER_BASE_URL, get_hermes_home
|
||||
from agent.retry_utils import jittered_backoff
|
||||
from hermes_agent.constants import OPENROUTER_BASE_URL, get_hermes_home
|
||||
from hermes_agent.providers.retry import jittered_backoff
|
||||
|
||||
# Load .env from HERMES_HOME first, then project root as a dev fallback.
|
||||
from hermes_cli.env_loader import load_hermes_dotenv
|
||||
from hermes_agent.cli.env_loader import load_hermes_dotenv
|
||||
|
||||
_hermes_home = get_hermes_home()
|
||||
_project_env = Path(__file__).parent.parent / ".env"
|
||||
|
|
@ -71,7 +71,7 @@ def _effective_temperature_for_model(
|
|||
callers must omit the ``temperature`` kwarg entirely in that case.
|
||||
"""
|
||||
try:
|
||||
from agent.auxiliary_client import _fixed_temperature_for_model, OMIT_TEMPERATURE
|
||||
from hermes_agent.providers.auxiliary import _fixed_temperature_for_model, OMIT_TEMPERATURE
|
||||
except Exception:
|
||||
return requested_temperature
|
||||
|
||||
|
|
@ -389,7 +389,7 @@ class TrajectoryCompressor:
|
|||
self._llm_provider = provider
|
||||
self._use_call_llm = True
|
||||
# Verify the provider is available
|
||||
from agent.auxiliary_client import resolve_provider_client
|
||||
from hermes_agent.providers.auxiliary import resolve_provider_client
|
||||
client, _ = resolve_provider_client(
|
||||
provider, model=self.config.summarization_model)
|
||||
if client is None:
|
||||
|
|
@ -407,7 +407,7 @@ class TrajectoryCompressor:
|
|||
f"Missing API key. Set {self.config.api_key_env} "
|
||||
f"environment variable.")
|
||||
from openai import OpenAI
|
||||
from agent.auxiliary_client import _to_openai_base_url
|
||||
from hermes_agent.providers.auxiliary import _to_openai_base_url
|
||||
self.client = OpenAI(
|
||||
api_key=api_key, base_url=_to_openai_base_url(self.config.base_url))
|
||||
# AsyncOpenAI is created lazily in _get_async_client() so it
|
||||
|
|
@ -428,7 +428,7 @@ class TrajectoryCompressor:
|
|||
avoiding "Event loop is closed" errors on repeated calls.
|
||||
"""
|
||||
from openai import AsyncOpenAI
|
||||
from agent.auxiliary_client import _to_openai_base_url
|
||||
from hermes_agent.providers.auxiliary import _to_openai_base_url
|
||||
# Always create a fresh client so it binds to the running loop.
|
||||
self.async_client = AsyncOpenAI(
|
||||
api_key=self._async_client_api_key,
|
||||
|
|
@ -610,7 +610,7 @@ Write only the summary, starting with "[CONTEXT SUMMARY]:" prefix."""
|
|||
)
|
||||
|
||||
if getattr(self, '_use_call_llm', False):
|
||||
from agent.auxiliary_client import call_llm
|
||||
from hermes_agent.providers.auxiliary import call_llm
|
||||
_call_llm_kwargs: dict = {}
|
||||
if summary_temperature is not None:
|
||||
_call_llm_kwargs["temperature"] = summary_temperature
|
||||
|
|
@ -683,7 +683,7 @@ Write only the summary, starting with "[CONTEXT SUMMARY]:" prefix."""
|
|||
)
|
||||
|
||||
if getattr(self, '_use_call_llm', False):
|
||||
from agent.auxiliary_client import async_call_llm
|
||||
from hermes_agent.providers.auxiliary import async_call_llm
|
||||
_async_llm_kwargs: dict = {}
|
||||
if summary_temperature is not None:
|
||||
_async_llm_kwargs["temperature"] = summary_temperature
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue