"""Answers from pre_process: the report comes from app/report.py, so no model is called.""" import json from typing import Any, Optional from kyndryl_agent_runtime.request_cycle import Reply from app import report # This step runs before the approval gate, so its page is never the released copy. DRAFT = "Draft. Not for release until the Engagement Lead approves it." def pre_process(payload: dict) -> Optional[Any]: """Render the report from the step outputs in the request.""" return Reply(json.dumps({"engagement_id": payload["engagement_id"], "run_id": payload["run_id"], "verdict": payload.get("verdict") or "not supplied", "counts": report.counts(payload), "report_markdown": report.render(payload), "report_html": report.render_html(payload, DRAFT), "final_html": report.render_html(payload)}))