Fix Hermes adapter integration and recovery
This commit is contained in:
@@ -9,12 +9,11 @@ set ``PHEBY_SECRET`` in ``~/.hermes/.env``, and restart the gateway.
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import os
|
||||
from typing import Any
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
__version__ = "1.0.0"
|
||||
__version__ = "1.0.1"
|
||||
|
||||
|
||||
def register(ctx: Any) -> None:
|
||||
@@ -47,8 +46,6 @@ def register(ctx: Any) -> None:
|
||||
env_enablement_fn=env_enablement,
|
||||
# Home channel for cron / notification delivery when configured.
|
||||
cron_deliver_env_var="PHEBY_HOME_CHANNEL",
|
||||
allowed_users_env="PHEBY_ALLOWED_USERS",
|
||||
allow_all_env="PHEBY_ALLOW_ALL_USERS",
|
||||
emoji="🐱",
|
||||
pii_safe=True, # single-user private platform; no PII in routing IDs
|
||||
allow_update_command=True,
|
||||
@@ -61,15 +58,21 @@ def register(ctx: Any) -> None:
|
||||
),
|
||||
)
|
||||
|
||||
# post_tool_call observer → structured tool-result events. Registered
|
||||
# against the plugin context so it loads with the plugin, before any
|
||||
# adapter is constructed (the hook is a no-op until the adapter serves).
|
||||
# Tool observers provide authoritative session_id + tool_call_id values.
|
||||
# The adapter's presentation-only format_tool_event hook deliberately eats
|
||||
# Hermes's generic tool chrome to avoid duplicate/ambiguous events.
|
||||
def _pre_tool_call(**kwargs: Any) -> None:
|
||||
adapter = adapter_holder.get("adapter")
|
||||
if adapter is not None:
|
||||
adapter.on_pre_tool_call(**kwargs)
|
||||
|
||||
def _post_tool_call(**kwargs: Any) -> None:
|
||||
adapter = adapter_holder.get("adapter")
|
||||
if adapter is not None:
|
||||
adapter.on_post_tool_call(**kwargs)
|
||||
|
||||
try:
|
||||
ctx.register_hook("pre_tool_call", _pre_tool_call)
|
||||
ctx.register_hook("post_tool_call", _post_tool_call)
|
||||
except Exception:
|
||||
logger.debug("[pheby] post_tool_call hook registration failed",
|
||||
|
||||
Reference in New Issue
Block a user