22 lines
817 B
Python
22 lines
817 B
Python
"""OnboardRuntime: minimal deterministic planner runtime scaffold."""
|
|
from __future__ import annotations
|
|
|
|
from typing import List, Dict, Any
|
|
from time import time
|
|
|
|
from .dsl import LocalProblem, PlanDelta, SharedVariables, to_nir
|
|
|
|
|
|
class OnboardRuntime:
|
|
def __init__(self, backend) -> None:
|
|
# backend expected to implement run(nir: dict, time_budget_s: float) -> dict
|
|
self.backend = backend
|
|
|
|
def plan(self, local_problems: List[LocalProblem], deltas: List[PlanDelta], shared: SharedVariables, time_budget_s: float) -> Dict[str, Any]:
|
|
nir = to_nir(local_problems, deltas, shared)
|
|
result = self.backend.run(nir, time_budget_s)
|
|
# Attach some provenance-like fields for auditing in MVP
|
|
result["timestamp"] = time()
|
|
result["nir"] = nir
|
|
return result
|