nebulaforge-offline-resilie.../nebulaforge/nebula_bridge.py

35 lines
1.1 KiB
Python

from __future__ import annotations
"""NebulaBridge compatibility layer.
This module provides a tiny, production-friendly wrapper that converts
NebulaForge high-level contract objects into the EnergiBridge canonical
interoperability blocks. It delegates to the existing energibridge.to_energi_blocks
function, ensuring consistent mappings and replayable delta logs.
Usage (example):
- fm_blocks = nebula_bridge.nebula_to_energi_blocks(lp, sv, pd, pb, al, adapter_id="rover-runtime")
"""
from typing import Dict, Any
from nebulaforge.contracts import LocalProblem, SharedVariables, PlanDelta, PrivacyBudget, AuditLog
from nebulaforge.energibridge import to_energi_blocks as _to_energi_blocks
def nebula_to_energi_blocks(
lp: LocalProblem,
sv: SharedVariables,
pd: PlanDelta,
pb: PrivacyBudget,
al: AuditLog,
adapter_id: str = "unknown",
) -> Dict[str, Any]:
"""Convert NebulaForge contracts into EnergiBridge DSL blocks.
This is a thin wrapper around the existing to_energi_blocks function to
keep usage consistent from the NebulaForge side of the ecosystem.
"""
return _to_energi_blocks(lp, sv, pd, pb, al, adapter_id)