from __future__ import annotations

from app.modules.agent.orchestration.context.execution_context import ExecutionContext


class FinalizeStep:
    async def run(self, context: ExecutionContext) -> None:
        request = context.request
        context.trace.module("orchestrator").log("finalize", {"status": "started"})
        await context.publisher.publish_user(
            request.request_id,
            "agent",
            request.answer or "",
        )
        await context.publisher.publish_status(
            request.request_id,
            "orchestrator",
            "Обработка запроса завершена.",
        )
        context.trace.module("orchestrator").log("finalize", {"status": "completed"})
