refactor: inject plugin interaction event publisher

This commit is contained in:
jxxghp
2026-08-24 07:36:50 +08:00
parent 85d8c58a76
commit c03b45eed7
7 changed files with 65 additions and 20 deletions
+8 -2
View File
@@ -7,10 +7,14 @@ from types import SimpleNamespace
from unittest.mock import AsyncMock, Mock, patch
from app.agent import AgentManager, _MessageTask, _async_start_processing_status
from app.agent import ( # pylint: disable=no-name-in-module
AgentManager,
_MessageTask,
_async_start_processing_status,
)
from app.chain.message import MessageChain
from app.command import Command, _finish_command_processing_status
from app.modules.telegram import TelegramModule
from app.modules.telegram import TelegramModule # pylint: disable=no-name-in-module
from app.modules.telegram.telegram import Telegram
from app.runtime.config import global_vars
from app.schemas.types import NotificationChannel
@@ -259,6 +263,7 @@ class TestTelegramTypingLifecycle(unittest.TestCase):
def test_async_agent_leaves_processing_status_to_worker(self):
chain = MessageChain.__new__(MessageChain)
chain.eventmanager = Mock()
chain.runtime_config = replace(
chain.runtime_config,
ai_agent_enable=True,
@@ -373,6 +378,7 @@ class TestTelegramTypingLifecycle(unittest.TestCase):
def test_callback_stops_typing_when_message_handler_returns(self):
chain = MessageChain.__new__(MessageChain)
chain.eventmanager = Mock()
status = MessageChain._ProcessingStatus(
channel=NotificationChannel.Telegram,
source="telegram-test",