mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
- Refactor gateway/platforms/qqbot.py into gateway/platforms/qqbot/ package: - adapter.py: core QQAdapter (unchanged logic, constants from shared module) - constants.py: shared constants (API URLs, timeouts, message types) - crypto.py: AES-256-GCM key generation and secret decryption - onboard.py: QR-code scan-to-configure API (create_bind_task, poll_bind_result) - utils.py: User-Agent builder, HTTP headers, config helpers - __init__.py: re-exports all public symbols for backward compatibility - Add interactive QR-code setup flow in hermes_cli/gateway.py: - Terminal QR rendering via qrcode package (graceful fallback to URL) - Auto-refresh on QR expiry (up to 3 times) - AES-256-GCM encrypted credential exchange - DM security policy selection (pairing/allowlist/open) - Update hermes_cli/setup.py to delegate to gateway's _setup_qqbot() - Add qrcode>=7.4 dependency to pyproject.toml and requirements.txt
55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
"""
|
|
QQBot platform package.
|
|
|
|
Re-exports the main adapter symbols from ``adapter.py`` (the original
|
|
``qqbot.py``) so that **all existing import paths remain unchanged**::
|
|
|
|
from gateway.platforms.qqbot import QQAdapter # works
|
|
from gateway.platforms.qqbot import check_qq_requirements # works
|
|
|
|
New modules:
|
|
- ``constants`` — shared constants (API URLs, timeouts, message types)
|
|
- ``utils`` — User-Agent builder, config helpers
|
|
- ``crypto`` — AES-256-GCM key generation and decryption
|
|
- ``onboard`` — QR-code scan-to-configure flow
|
|
"""
|
|
|
|
# -- Adapter (original qqbot.py) ------------------------------------------
|
|
from .adapter import ( # noqa: F401
|
|
QQAdapter,
|
|
QQCloseError,
|
|
check_qq_requirements,
|
|
_coerce_list,
|
|
)
|
|
|
|
# -- Onboard (QR-code scan-to-configure) -----------------------------------
|
|
from .onboard import ( # noqa: F401
|
|
BindStatus,
|
|
create_bind_task,
|
|
poll_bind_result,
|
|
build_connect_url,
|
|
)
|
|
from .crypto import decrypt_secret, generate_bind_key # noqa: F401
|
|
|
|
# -- Utils -----------------------------------------------------------------
|
|
from .utils import build_user_agent, get_api_headers, coerce_list # noqa: F401
|
|
|
|
__all__ = [
|
|
# adapter
|
|
"QQAdapter",
|
|
"QQCloseError",
|
|
"check_qq_requirements",
|
|
"_coerce_list",
|
|
# onboard
|
|
"BindStatus",
|
|
"create_bind_task",
|
|
"poll_bind_result",
|
|
"build_connect_url",
|
|
# crypto
|
|
"decrypt_secret",
|
|
"generate_bind_key",
|
|
# utils
|
|
"build_user_agent",
|
|
"get_api_headers",
|
|
"coerce_list",
|
|
]
|