idea15-edgemind-verifiable-.../src/idea15_edgemind_verifiable_.../contracts.py

22 lines
620 B
Python

from __future__ import annotations
from dataclasses import dataclass
from typing import List
from .planner import Action
@dataclass
class SafetyContract:
pre_conditions: List[str] = None
post_conditions: List[str] = None
def validate_plan(self, actions: List[Action]) -> bool:
# Very small stub: ensure there is at least one action and no explicitly unsafe actions
if not actions:
return False
# If any action name contains 'unsafe', reject the plan
for a in actions:
if "unsafe" in a.name.lower():
return False
return True