hermes-platform-molecule-a2a/tests/conftest.py
Hongming Wang 8c4f2b7569 Initial: hermes-platform-molecule-a2a v0.1.0
Hermes-agent platform adapter that delivers Molecule A2A peer-agent
messages to a running hermes daemon over HTTP, and POSTs agent replies
back to the molecule-runtime callback URL.

Closes the MCP-style push parity gap for hermes workspaces:
- Single long-lived adapter session (no subprocess per message)
- MessageEvent(internal=True) bypasses per-platform user allowlist
  for trusted A2A peer messages
- Optional shared-secret HMAC enforcement
- Per-chat callback URL learned from inbound payload

Requires hermes-agent ≥ the upstream PR
NousResearch/hermes-agent#18775 (PluginContext.register_platform_adapter
+ GatewayConfig plugin_platforms wiring + PluginPlatformIdentifier
helper + resolve_platform_id deserialization).
2026-05-02 03:06:56 -07:00

30 lines
1.0 KiB
Python

"""Make hermes-agent importable for tests.
The plugin imports `gateway.config` and `hermes_cli.plugins` directly.
Those live in the local hermes fork at ~/.hermes/hermes-agent (the
checkout that hosts the patched ``feat/platform-adapter-plugins``
branch). Tests inject that on sys.path so the adapter resolves the
real BasePlatformAdapter contract — no mock substitutes here, since
the whole point is to exercise the real subclass relationship.
"""
import os
import sys
from pathlib import Path
HERMES_REPO = Path.home() / ".hermes" / "hermes-agent"
if HERMES_REPO.exists():
sys.path.insert(0, str(HERMES_REPO))
# Make the package itself importable when tests are run from the repo
# root without a prior `pip install -e .`.
PKG_ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(PKG_ROOT))
# Hermes plugin discovery uses HERMES_HOME for the user plugin dir.
# Point it at a scratch location so test runs don't pick up the
# user's real ~/.hermes/.
os.environ.setdefault(
"HERMES_HOME", str(PKG_ROOT / "tests" / ".hermes_test_home")
)