310c0244df
- Resolve the Hermes gateway API lazily via get_adapter_class() so the adapter
always inherits the real gateway.platforms.base.BasePlatformAdapter instead
of the ImportError fallback stub (root cause of the AttributeError:
'set_message_handler' crash at gateway startup).
- Pass Platform('meshtastic') enum to super().__init__ and align
connect(*, is_reconnect=False) -> bool with the gateway contract.
- Split pure formatting utils into formatting.py; remove the stub fallback.
- Add tests/contract (L0-L3): real-base binding, ABC instantiation, gateway
run.py wiring replay, signature and event-shape conformance, run against
hermes-agent pinned to the deployed image source (v2026.8.31).
- Add scripts/contract-test.sh and a contract-test CI job; release publish
now requires contract tests to pass.
- Untrack stray __pycache__ artifacts.
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
"""Meshtastic Platform Adapter plugin for Hermes Agent.
|
|
|
|
The ``register(ctx)`` entry point resolves the adapter class lazily so the real
|
|
Hermes gateway API (``gateway.platforms.base``) is imported only at registration
|
|
time — never at plugin-discovery import time (see ``adapter.get_adapter_class``).
|
|
"""
|
|
|
|
from .formatting import MAX_LORA_MESSAGE_LENGTH
|
|
|
|
|
|
def register(ctx):
|
|
"""Hermes plugin entrypoint."""
|
|
from .adapter import check_requirements, get_adapter_class
|
|
|
|
adapter_cls = get_adapter_class()
|
|
|
|
ctx.register_platform(
|
|
name="meshtastic",
|
|
label="Meshtastic LoRa",
|
|
adapter_factory=lambda config: adapter_cls(config),
|
|
check_fn=check_requirements,
|
|
max_message_length=MAX_LORA_MESSAGE_LENGTH,
|
|
emoji="📻",
|
|
platform_hint=(
|
|
"You are chatting over Meshtastic LoRa radio. LoRa bandwidth is very low. "
|
|
"Respond in concise plain text without markdown, bold, tables, or lists. "
|
|
"Keep answers strictly under 140 characters whenever possible."
|
|
),
|
|
)
|