This commit is contained in:
2026-03-27 15:51:10 +03:00
parent 15586f9a8c
commit 0bff171936
1245 changed files with 99621 additions and 543076 deletions
@@ -0,0 +1,24 @@
from __future__ import annotations
from app.modules.agent_api.infrastructure.logging.request_trace_logger import RequestTraceLogger
from app.modules.agent_api.infrastructure.streaming.sse_event_channel import SseEventChannel
from app.modules.orchestration.messaging.status_message_factory import StatusMessageFactory
from app.modules.orchestration.messaging.user_message_factory import UserMessageFactory
class ClientMessagePublisher:
def __init__(self, channel: SseEventChannel, trace_logger: RequestTraceLogger) -> None:
self._channel = channel
self._trace_logger = trace_logger
self._status = StatusMessageFactory()
self._user = UserMessageFactory()
async def publish_status(self, request_id: str, source: str, text: str, payload: dict | None = None) -> None:
event = self._status.create(request_id, source, text, payload)
self._trace_logger.log_event(event)
await self._channel.publish(event)
async def publish_user(self, request_id: str, source: str, text: str, payload: dict | None = None) -> None:
event = self._user.create(request_id, source, text, payload)
self._trace_logger.log_event(event)
await self._channel.publish(event)