#!/usr/bin/env python3 """Review Studio waiver candidate rendering helpers.""" import html from typing import Any SCRIPT_INTERFACE = "internal-module" SCRIPT_INTERFACE_REASON = "Imported by render_review_studio.py to keep waiver candidate layout out of the main renderer." def render_waiver_candidates_panel(review_waivers: dict[str, Any]) -> str: candidates = review_waivers.get("waiver_candidates", []) if isinstance(review_waivers, dict) else [] if not candidates: return "

当前没有需要 reviewer 处理的批准候选。

" cards = [] for item in candidates: allowed = bool(item.get("waiver_allowed")) allowed_label = "可批准" if allowed else "不可批准" status = str(item.get("status", "unknown")) required_review = item.get("required_review", []) required_html = "".join( f"
  • {html.escape(str(review_item))}
  • " for review_item in required_review ) or "
  • 证据不足,需要先补充审查条件。
  • " decision_options = item.get("decision_options", []) decision_options_label = ", ".join(str(option) for option in decision_options) if decision_options else "无" cards.append( "
    " f"
    {html.escape(allowed_label)} · {html.escape(status)}" f"

    {html.escape(str(item.get('label') or item.get('gate_key') or 'Waiver Candidate'))}

    " f"

    {html.escape(str(item.get('risk_summary') or '证据不足'))}

    " "
    " f"
    Gate
    {html.escape(str(item.get('gate_key', '')))}
    " f"
    证据
    {html.escape(str(item.get('suggested_evidence', '')))}
    " f"
    选项
    {html.escape(decision_options_label)}
    " f"
    边界
    {html.escape(str(item.get('world_class_boundary', '')))}
    " "
    " "

    审查条件

    " f"
    " "
    建议命令" f"{html.escape(str(item.get('suggested_command', '')))}
    " "
    " ) return "
    " + "".join(cards) + "
    "