mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-10-20 05:15:31 +00:00
fix: retarget _send_dingtalk/_send_matrix tests to plugin _standalone_send + restore dingtalk token redaction
CI (test shard 6) caught tests/tools/test_send_message_missing_platforms.py importing the removed _send_dingtalk/_send_matrix helpers. Added thin pre-migration-shaped shims around the plugins' _standalone_send (same pattern mattermost/HA used in this file). Also restored access_token redaction in the dingtalk plugin's _standalone_send error path (the legacy _send_dingtalk returned via _error() which redacts URL secrets; the bare plugin return leaked the webhook access_token in exception text) by reusing send_message_tool._error via lazy import.
This commit is contained in:
parent
f2a7adba54
commit
91da240eb8
2 changed files with 31 additions and 4 deletions
|
|
@ -5,10 +5,29 @@ import os
|
|||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
from tools.send_message_tool import (
|
||||
_send_dingtalk,
|
||||
_send_matrix,
|
||||
# ``_send_dingtalk`` and ``_send_matrix`` moved into their bundled plugins
|
||||
# (``plugins/platforms/<x>/adapter.py::_standalone_send``) in #41112. Keep
|
||||
# thin pre-migration-shaped shims so existing test bodies work unchanged.
|
||||
from plugins.platforms.dingtalk.adapter import (
|
||||
_standalone_send as _dingtalk_standalone_send,
|
||||
)
|
||||
from plugins.platforms.matrix.adapter import (
|
||||
_standalone_send as _matrix_standalone_send,
|
||||
)
|
||||
|
||||
|
||||
async def _send_dingtalk(extra, chat_id, message):
|
||||
"""Pre-migration ``(extra, chat_id, message)`` shim around the dingtalk
|
||||
plugin's ``_standalone_send(pconfig, chat_id, message)``."""
|
||||
pconfig = SimpleNamespace(token=None, extra=extra or {})
|
||||
return await _dingtalk_standalone_send(pconfig, chat_id, message)
|
||||
|
||||
|
||||
async def _send_matrix(token, extra, chat_id, message):
|
||||
"""Pre-migration ``(token, extra, chat_id, message)`` shim around the matrix
|
||||
plugin's ``_standalone_send(pconfig, chat_id, message)``."""
|
||||
pconfig = SimpleNamespace(token=token, extra=extra or {})
|
||||
return await _matrix_standalone_send(pconfig, chat_id, message)
|
||||
|
||||
# ``_send_mattermost`` moved into the mattermost plugin
|
||||
# (``plugins/platforms/mattermost/adapter.py::_standalone_send``). Keep a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue