Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions agent/anthropic_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,6 @@ def _read_claude_code_credentials_from_keychain() -> Optional[Dict[str, Any]]:

Returns dict with {accessToken, refreshToken?, expiresAt?} or None.
"""
import platform
import subprocess

if platform.system() != "Darwin":
return None

Expand Down
1 change: 0 additions & 1 deletion agent/credential_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import threading
import time
import uuid
import os
import re
from dataclasses import dataclass, fields, replace
from datetime import datetime
Expand Down
1 change: 0 additions & 1 deletion agent/credential_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

import os
from dataclasses import dataclass, field
from pathlib import Path
from typing import Callable, List, Optional


Expand Down
2 changes: 0 additions & 2 deletions agent/gemini_cloudcode_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

import json
import logging
import os
import time
import uuid
from types import SimpleNamespace
Expand All @@ -42,7 +41,6 @@
from agent.gemini_schema import sanitize_gemini_tool_parameters
from agent.google_code_assist import (
CODE_ASSIST_ENDPOINT,
FREE_TIER_ID,
CodeAssistError,
ProjectContext,
resolve_project_context,
Expand Down
2 changes: 1 addition & 1 deletion agent/gemini_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Any, Dict, List
from typing import Any, Dict

# Gemini's ``FunctionDeclaration.parameters`` field accepts the ``Schema``
# object, which is only a subset of OpenAPI 3.0 / JSON Schema. Strip fields
Expand Down
1 change: 0 additions & 1 deletion agent/google_code_assist.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import json
import logging
import os
import time
import urllib.error
import urllib.parse
Expand Down
3 changes: 1 addition & 2 deletions agent/google_oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@
import logging
import os
import secrets
import socket
import stat
import threading
import time
import urllib.error
import urllib.parse
import urllib.request
from dataclasses import dataclass, field
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict, Optional, Tuple

Expand Down
1 change: 0 additions & 1 deletion agent/memory_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

from __future__ import annotations

import json
import logging
import re
import inspect
Expand Down
4 changes: 1 addition & 3 deletions agent/transports/codex.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Any, Dict, List, Optional

from agent.transports.base import ProviderTransport
from agent.transports.types import NormalizedResponse, ToolCall, Usage
from agent.transports.types import NormalizedResponse, ToolCall


class ResponsesApiTransport(ProviderTransport):
Expand Down Expand Up @@ -151,8 +151,6 @@ def normalize_response(self, response: Any, **kwargs) -> NormalizedResponse:
"""Normalize Codex Responses API response to NormalizedResponse."""
from agent.codex_responses_adapter import (
_normalize_codex_response,
_extract_responses_message_text,
_extract_responses_reasoning_text,
)

# _normalize_codex_response returns (SimpleNamespace, finish_reason_str)
Expand Down
2 changes: 1 addition & 1 deletion gateway/platforms/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def _on_packet(self, data: bytes):
encrypted = bytes(payload_with_nonce[:-4])

try:
import nacl.secret # noqa: delayed import only in voice path
import nacl.secret # noqa: E402 — delayed import, only in voice path
box = nacl.secret.Aead(self._secret_key)
decrypted = box.decrypt(encrypted, header, bytes(nonce))
except Exception as e:
Expand Down
1 change: 0 additions & 1 deletion gateway/platforms/feishu_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,6 @@ def build_whole_comment_prompt(

def _resolve_model_and_runtime() -> Tuple[str, dict]:
"""Resolve model and provider credentials, same as gateway message handling."""
import os
from gateway.run import _load_gateway_config, _resolve_gateway_model

user_config = _load_gateway_config()
Expand Down
4 changes: 2 additions & 2 deletions gateway/platforms/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import re
import time
from pathlib import Path
from typing import TYPE_CHECKING, Dict, Optional
from typing import TYPE_CHECKING, Dict

if TYPE_CHECKING:
from gateway.platforms.base import BasePlatformAdapter, MessageEvent
from gateway.platforms.base import MessageEvent

logger = logging.getLogger(__name__)

Expand Down
1 change: 0 additions & 1 deletion gateway/platforms/mattermost.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ async def _send_url_as_file(

import aiohttp

last_exc = None
file_data = None
ct = "application/octet-stream"
fname = url.rsplit("/", 1)[-1].split("?")[0] or f"{kind}.png"
Expand Down
9 changes: 2 additions & 7 deletions gateway/platforms/qqbot/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ async def _send_c2c_text(
self, openid: str, content: str, reply_to: Optional[str] = None
) -> SendResult:
"""Send text to a C2C user via REST API."""
msg_seq = self._next_msg_seq(reply_to or openid)
self._next_msg_seq(reply_to or openid)
body = self._build_text_body(content, reply_to)
if reply_to:
body["msg_id"] = reply_to
Expand All @@ -1970,7 +1970,7 @@ async def _send_group_text(
self, group_openid: str, content: str, reply_to: Optional[str] = None
) -> SendResult:
"""Send text to a group via REST API."""
msg_seq = self._next_msg_seq(reply_to or group_openid)
self._next_msg_seq(reply_to or group_openid)
body = self._build_text_body(content, reply_to)
if reply_to:
body["msg_id"] = reply_to
Expand Down Expand Up @@ -2135,11 +2135,6 @@ async def _send_media(

# Route
chat_type = self._guess_chat_type(chat_id)
target_path = (
f"/v2/users/{chat_id}/files"
if chat_type == "c2c"
else f"/v2/groups/{chat_id}/files"
)

if chat_type == "guild":
# Guild channels don't support native media upload in the same way
Expand Down
4 changes: 2 additions & 2 deletions gateway/platforms/yuanbao.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
encode_get_group_member_list,
next_seq_no,
)
from gateway.session import SessionSource, build_session_key
from gateway.session import build_session_key

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -1897,7 +1897,7 @@ def _detect_owner_command(
return None, None, False

# Sender identity check: bot owner <-> push.from_account == push.bot_owner_id
owner_id = (push or {}).get("bot_owner_id") or ""
# owner_id = (push or {}).get("bot_owner_id") or ""
# is_owner = bool(owner_id) and owner_id == from_account
is_owner = True
return cmd, cmd_line, is_owner
Expand Down
2 changes: 0 additions & 2 deletions gateway/platforms/yuanbao_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
import hmac
import logging
import os
import re
import secrets
import struct
import time
import urllib.parse
from datetime import datetime, timezone, timedelta
from typing import Optional, Any

import httpx
Expand Down
3 changes: 1 addition & 2 deletions gateway/platforms/yuanbao_proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
from __future__ import annotations

import logging
import struct
import threading
from typing import Optional, Union
from typing import Optional

logger = logging.getLogger(__name__)

Expand Down
1 change: 0 additions & 1 deletion gateway/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7475,7 +7475,6 @@ async def _handle_compress_command(self, event: MessageEvent) -> str:
for m in history
if m.get("role") in ("user", "assistant") and m.get("content")
]
original_count = len(msgs)
approx_tokens = estimate_messages_tokens_rough(msgs)

tmp_agent = AIAgent(
Expand Down
1 change: 0 additions & 1 deletion gateway/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def _hash_chat_id(value: str) -> str:
)
from .whatsapp_identity import (
canonical_whatsapp_identifier,
normalize_whatsapp_identifier,
)
from utils import atomic_replace

Expand Down
2 changes: 1 addition & 1 deletion hermes_cli/azure_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from typing import Optional
from urllib import request as urllib_request
from urllib.error import HTTPError, URLError
from urllib.parse import urlparse, urlunparse
from urllib.parse import urlparse

logger = logging.getLogger(__name__)

Expand Down
1 change: 0 additions & 1 deletion hermes_cli/banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ def build_welcome_banner(console: Console, model: str, cwd: str,
right_content = "\n".join(right_lines)
layout_table.add_row(left_content, right_content)

agent_name = _skin_branding("agent_name", "Hermes Agent")
title_color = _skin_color("banner_title", "#FFD700")
border_color = _skin_color("banner_border", "#CD7F32")
version_label = format_banner_version_label()
Expand Down
1 change: 0 additions & 1 deletion hermes_cli/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import io
import json
import os
import sys
import time
import urllib.error
Expand Down
1 change: 0 additions & 1 deletion hermes_cli/dingtalk_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from __future__ import annotations

import io
import os
import sys
import time
Expand Down
5 changes: 1 addition & 4 deletions hermes_cli/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -2953,7 +2953,7 @@ def _setup_sms():
def _setup_dingtalk():
"""Configure DingTalk — QR scan (recommended) or manual credential entry."""
from hermes_cli.setup import (
prompt_choice, prompt_yes_no, print_info, print_success, print_warning,
prompt_choice, prompt_yes_no, print_success, print_warning,
)

dingtalk_platform = next(p for p in _PLATFORMS if p["key"] == "dingtalk")
Expand Down Expand Up @@ -3504,7 +3504,6 @@ def _setup_qqbot():
method_idx = prompt_choice(" How would you like to set up QQ Bot?", method_choices, 0)

credentials = None
used_qr = False

if method_idx == 0:
# ── QR scan-to-configure ──
Expand All @@ -3515,8 +3514,6 @@ def _setup_qqbot():
print()
print_warning(" QQ Bot setup cancelled.")
return
if credentials:
used_qr = True
if not credentials:
print_info(" QR setup did not complete. Continuing with manual input.")

Expand Down
3 changes: 1 addition & 2 deletions hermes_cli/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
from __future__ import annotations

import json
import os
from pathlib import Path
from typing import Any, Dict, List, Optional
from typing import Any, Dict, List


def hooks_command(args) -> None:
Expand Down
3 changes: 1 addition & 2 deletions hermes_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4732,7 +4732,6 @@ def _model_flow_anthropic(config, current_model=""):
read_claude_code_credentials,
is_claude_code_token_valid,
_is_oauth_token,
_resolve_claude_code_token_from_credentials,
)

cc_creds = read_claude_code_credentials()
Expand Down Expand Up @@ -7137,7 +7136,7 @@ def _service_restart_sec(
print(
f" ⚠ {svc_name} died after restart, retrying..."
)
retry = subprocess.run(
subprocess.run(
scope_cmd + ["restart", svc_name],
capture_output=True,
text=True,
Expand Down
1 change: 0 additions & 1 deletion hermes_cli/model_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

import json
import logging
import os
import time
import urllib.error
import urllib.request
Expand Down
1 change: 0 additions & 1 deletion hermes_cli/plugins_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,6 @@ def _draw(stdscr):
# We need to map logical cursor positions to screen rows
# accounting for non-navigable separator/headers

draw_row = 0 # tracks navigable item index

# --- General Plugins section ---
if n_plugins > 0:
Expand Down
2 changes: 0 additions & 2 deletions hermes_cli/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,6 @@ def setup_model_provider(config: dict, *, quick: bool = False):
if isinstance(_m, dict):
selected_provider = _m.get("provider")

nous_subscription_selected = selected_provider == "nous"

# ── Same-provider fallback & rotation setup (full setup only) ──
if not quick and _supports_same_provider_pool_setup(selected_provider):
try:
Expand Down
2 changes: 1 addition & 1 deletion hermes_cli/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import os
import sys
import subprocess
import subprocess # noqa: F401 — re-exported for tests that monkeypatch status.subprocess to guard against regressions
from pathlib import Path

PROJECT_ROOT = Path(__file__).parent.parent.resolve()
Expand Down
9 changes: 4 additions & 5 deletions hermes_cli/web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ async def get_sessions(limit: int = 20, offset: int = 0):
return {"sessions": sessions, "total": total, "limit": limit, "offset": offset}
finally:
db.close()
except Exception as e:
except Exception:
_log.exception("GET /api/sessions failed")
raise HTTPException(status_code=500, detail="Internal server error")

Expand Down Expand Up @@ -968,7 +968,7 @@ async def update_config(body: ConfigUpdate):
try:
save_config(_denormalize_config_from_web(body.config))
return {"ok": True}
except Exception as e:
except Exception:
_log.exception("PUT /api/config failed")
raise HTTPException(status_code=500, detail="Internal server error")

Expand Down Expand Up @@ -997,7 +997,7 @@ async def set_env_var(body: EnvVarUpdate):
try:
save_env_value(body.key, body.value)
return {"ok": True, "key": body.key}
except Exception as e:
except Exception:
_log.exception("PUT /api/env failed")
raise HTTPException(status_code=500, detail="Internal server error")

Expand All @@ -1011,7 +1011,7 @@ async def remove_env_var(body: EnvVarDelete):
return {"ok": True, "key": body.key}
except HTTPException:
raise
except Exception as e:
except Exception:
_log.exception("DELETE /api/env failed")
raise HTTPException(status_code=500, detail="Internal server error")

Expand Down Expand Up @@ -1568,7 +1568,6 @@ async def _start_device_code_flow(provider_id: str) -> Dict[str, Any]:
then spawns a background poller. Returns the user-facing display fields
so the UI can render the verification page link + user code.
"""
from hermes_cli import auth as hauth
if provider_id == "nous":
from hermes_cli.auth import _request_device_code, PROVIDER_REGISTRY
import httpx
Expand Down
1 change: 0 additions & 1 deletion hermes_cli/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""

import json
import os
import re
import secrets
import time
Expand Down
Loading
Loading