build(agent): jabba#56a767 iteration
This commit is contained in:
parent
9634a67dc0
commit
6734e8dcb5
|
|
@ -7,3 +7,4 @@
|
||||||
{"contract_id": "guard-001", "plan": {"action": "move", "costs": {"time": 2.0}, "speed": 0.8}, "state": {"speed": 0.8, "distance_to_obstacle": 5}, "decision": "allow"}
|
{"contract_id": "guard-001", "plan": {"action": "move", "costs": {"time": 2.0}, "speed": 0.8}, "state": {"speed": 0.8, "distance_to_obstacle": 5}, "decision": "allow"}
|
||||||
{"contract_id": "guard-001", "plan": {"action": "move", "costs": {"time": 2.0}, "speed": 0.8}, "state": {"speed": 0.8, "distance_to_obstacle": 5}, "decision": "allow"}
|
{"contract_id": "guard-001", "plan": {"action": "move", "costs": {"time": 2.0}, "speed": 0.8}, "state": {"speed": 0.8, "distance_to_obstacle": 5}, "decision": "allow"}
|
||||||
{"contract_id": "guard-001", "plan": {"action": "move", "costs": {"time": 2.0}, "speed": 0.8}, "state": {"speed": 0.8, "distance_to_obstacle": 5}, "decision": "allow"}
|
{"contract_id": "guard-001", "plan": {"action": "move", "costs": {"time": 2.0}, "speed": 0.8}, "state": {"speed": 0.8, "distance_to_obstacle": 5}, "decision": "allow"}
|
||||||
|
{"contract_id": "guard-001", "plan": {"action": "move", "costs": {"time": 2.0}, "speed": 0.8}, "state": {"speed": 0.8, "distance_to_obstacle": 5}, "decision": "allow"}
|
||||||
|
|
|
||||||
|
|
@ -56,11 +56,14 @@ class SafetyContract:
|
||||||
def evaluate_pre(self, context: Dict[str, Any]) -> (bool, str):
|
def evaluate_pre(self, context: Dict[str, Any]) -> (bool, str):
|
||||||
engine = PolicyEngine(self)
|
engine = PolicyEngine(self)
|
||||||
# Pass a neutral action payload; tests use only context.
|
# Pass a neutral action payload; tests use only context.
|
||||||
return engine.evaluate_pre({"action": None}, context)
|
ok, _reason = engine.evaluate_pre({"action": None}, context)
|
||||||
|
# Legacy API expected a boolean result.
|
||||||
|
return bool(ok)
|
||||||
|
|
||||||
def evaluate_post(self, action: Dict[str, Any], context: Dict[str, Any]) -> (bool, str):
|
def evaluate_post(self, action: Dict[str, Any], context: Dict[str, Any]) -> (bool, str):
|
||||||
engine = PolicyEngine(self)
|
engine = PolicyEngine(self)
|
||||||
return engine.evaluate_post(action, context)
|
ok, _reason = engine.evaluate_post(action, context)
|
||||||
|
return bool(ok)
|
||||||
|
|
||||||
def to_dict(self) -> Dict[str, Any]:
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue