diff --git a/mercurymesh_federated_reproducible_marke/wiring.py b/mercurymesh_federated_reproducible_marke/wiring.py new file mode 100644 index 0000000..65cd218 --- /dev/null +++ b/mercurymesh_federated_reproducible_marke/wiring.py @@ -0,0 +1,38 @@ +"""Simple MVP wiring helpers for MercuryMesh. + +This module provides tiny, self-contained adapters and a run loop to demonstrate +the federated delta synchronization flow in Phase 0 MVP wiring. +""" +from __future__ import annotations + +from typing import Dict, List +from .core import MarketStateSnapshot, PlanDelta +from .core import FederatedCoordinator + + +class StaticSignalSource: + """A simple static signal provider for testing/education purposes.""" + def __init__(self, signals: Dict[str, float], source: str): + self._signals = signals + self.source = source + + def collect(self) -> List[Dict[str, float]]: + # Return a single-list wrapper to mimic a stream of signal dicts + return [self._signals] + + +def simulate_mvp_run(): + """Run a tiny end-to-end delta aggregation using two static signal sources. + + This is a no-network, in-process demonstration of the MVP wiring. + """ + a = StaticSignalSource({"A": 1.0, "B": -0.5}, source="venue-1") + b = StaticSignalSource({"A": -0.2, "B": 0.8}, source="venue-2") + + signals = [] + for s in [a, b]: + signals.extend(s.collect()) + + # Use the FederatedCoordinator to compute a delta + delta = FederatedCoordinator.aggregate_signals(signals) + return delta