build(agent): new-agents#a6e6ec iteration
This commit is contained in:
parent
c6a59ae272
commit
031d252eaf
|
|
@ -11,3 +11,4 @@ __all__ = [
|
||||||
"AuditLog",
|
"AuditLog",
|
||||||
"GraphOfContracts",
|
"GraphOfContracts",
|
||||||
]
|
]
|
||||||
|
from .canonical_bridge import map_to_ir # re-export for MVP bridge wiring
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Compatibility shim: re-export map_to_ir from the underscored package path
|
||||||
|
from cosmosmesh_privacy_preserving_federated_ import canonical_bridge as _cb
|
||||||
|
|
||||||
|
map_to_ir = _cb.map_to_ir
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class IRPrimitive:
|
||||||
|
name: str
|
||||||
|
payload: Dict[str, Any]
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class CanonicalBridgeIR:
|
||||||
|
objects: List[IRPrimitive]
|
||||||
|
morphisms: List[IRPrimitive]
|
||||||
|
plan_delta: IRPrimitive
|
||||||
|
privacy_budget: IRPrimitive
|
||||||
|
audit_log: IRPrimitive
|
||||||
|
version: str = "1.0"
|
||||||
|
|
||||||
|
|
||||||
|
def map_to_ir(local_problem: Dict[str, Any]) -> CanonicalBridgeIR:
|
||||||
|
"""
|
||||||
|
Lightweight mapper that canonicalizes CosmosMesh primitives to a vendor-agnostic IR.
|
||||||
|
This is intentionally small and focused to bootstrap cross-domain adapters during MVP.
|
||||||
|
"""
|
||||||
|
obj = IRPrimitive(name="LocalProblem", payload=local_problem)
|
||||||
|
morph = IRPrimitive(name="SharedVariables", payload={"forecasts": [], "priors": {}, "version": 1})
|
||||||
|
plan = IRPrimitive(name="PlanDelta", payload={"delta": {}, "timestamp": local_problem.get("timestamp")})
|
||||||
|
privacy = IRPrimitive(name="PrivacyBudget", payload={"budget": local_problem.get("privacy_budget", {})})
|
||||||
|
audit = IRPrimitive(name="AuditLog", payload={"entries": []})
|
||||||
|
return CanonicalBridgeIR(
|
||||||
|
objects=[obj],
|
||||||
|
morphisms=[morph],
|
||||||
|
plan_delta=plan,
|
||||||
|
privacy_budget=privacy,
|
||||||
|
audit_log=audit,
|
||||||
|
)
|
||||||
Loading…
Reference in New Issue