from __future__ import annotations from typing import Dict from .dsl import LocalProblem, PlanDelta def verify_plan(local_problem: LocalProblem, plan_delta: PlanDelta) -> bool: """Lightweight safety verification hook. This is a minimal, deterministic verifier for the MVP: - If the plan delta carries a non-negative 'safe_buffer', and the local problem's risk_budget is compatible, accept the plan. - Otherwise, reject. This should be replaced with real formal verification hooks in a full build. """ buf = plan_delta.delta.get("safe_buffer", 0.0) try: risk = float(local_problem.risk_budget) except Exception: risk = 0.0 # Basic rule: safe if buffer does not exceed the risk budget. return float(buf) <= max(0.0, risk)