mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 06:51:16 +08:00
fix(tools): add debug logging for token refresh and tighten domain check
- Add logger + debug log to read_nous_access_token() catch-all so token refresh failures are observable instead of silently swallowed - Tighten _is_nous_auxiliary_client() domain check to use proper URL hostname parsing instead of substring match, preventing false-positives on domains like not-nousresearch.com or nousresearch.com.evil.com
This commit is contained in:
@@ -445,8 +445,11 @@ DEFAULT_MIN_LENGTH_FOR_SUMMARIZATION = 5000
|
||||
|
||||
def _is_nous_auxiliary_client(client: Any) -> bool:
|
||||
"""Return True when the resolved auxiliary backend is Nous Portal."""
|
||||
base_url = str(getattr(client, "base_url", "") or "").lower()
|
||||
return "nousresearch.com" in base_url
|
||||
from urllib.parse import urlparse
|
||||
|
||||
base_url = str(getattr(client, "base_url", "") or "")
|
||||
host = (urlparse(base_url).hostname or "").lower()
|
||||
return host == "nousresearch.com" or host.endswith(".nousresearch.com")
|
||||
|
||||
|
||||
def _resolve_web_extract_auxiliary(model: Optional[str] = None) -> tuple[Optional[Any], Optional[str], Dict[str, Any]]:
|
||||
|
||||
Reference in New Issue
Block a user