From 5d5abba002f05fc6f29ee8a44ab4f241b9df0c10 Mon Sep 17 00:00:00 2001 From: agent-ed374b2a16b664d2 Date: Wed, 15 Apr 2026 22:25:01 +0200 Subject: [PATCH] build(agent): molt-x#ed374b iteration --- nova_plan/adapters/satellite_adapter.py | 24 +++++++++++++++++ nova_plan/examples/toy_two_asset_bridge.py | 31 ++++++++++++++++++++++ test.sh | 0 3 files changed, 55 insertions(+) create mode 100644 nova_plan/adapters/satellite_adapter.py create mode 100644 nova_plan/examples/toy_two_asset_bridge.py mode change 100644 => 100755 test.sh diff --git a/nova_plan/adapters/satellite_adapter.py b/nova_plan/adapters/satellite_adapter.py new file mode 100644 index 0000000..aa31483 --- /dev/null +++ b/nova_plan/adapters/satellite_adapter.py @@ -0,0 +1,24 @@ +"""Lightweight satellite domain adapter stub for NovaPlan MVP.""" +from __future__ import annotations + +class SatelliteAdapter: + """Minimal adapter representing a satellite-domain planner domain. + + This is a very small stub intended to illustrate how a cross-domain + adapter can plug into the CatOpt bridge workflow. It mirrors the interface + of the Rover/Habitat adapters but targets a hypothetical orbital domain. + """ + + def __init__(self, domain_id: str): + self.domain_id = domain_id + + def get_status(self) -> dict: + """Return a simple status payload for the satellite domain.""" + return {"domain_id": self.domain_id, "status": "operational"} + + def plan_task(self, task: dict) -> dict: + """Accept a planning task and return an acknowledgement.""" + # In a real adapter this would translate the task to the satellite's + # internal planning representation and run a local solver. Here we + # simply echo back the task with an acceptance flag to illustrate flow. + return {"domain_id": self.domain_id, "accepted": True, "task": task} diff --git a/nova_plan/examples/toy_two_asset_bridge.py b/nova_plan/examples/toy_two_asset_bridge.py new file mode 100644 index 0000000..553f0c3 --- /dev/null +++ b/nova_plan/examples/toy_two_asset_bridge.py @@ -0,0 +1,31 @@ +"""Toy example to demonstrate CatOpt bridge usage for a two-asset NovaPlan setup.""" +from __future__ import annotations +import time + +from nova_plan.planner import LocalProblem +from nova_plan.contracts import PlanDelta +from nova_plan.catopt_bridge import to_object, delta_to_morphism + + +def demo_two_asset_catopt_bridge(): + # Asset 1: local problem for agent A + lp1 = LocalProblem( + id="asset-A", + objective=lambda v, s: sum(v.values()) + sum(s.values()), + variables={"x": 1.0}, + constraints={}, + ) + obj1 = to_object(lp1) + + # Create a delta from asset-A to global objective + delta = {"x": 0.25} + d = PlanDelta(agent_id=lp1.id, delta=delta, timestamp=time.time()) + morph = delta_to_morphism(d, source=lp1.id, target="global", contract_id="toy-contract") + + return obj1, morph + + +if __name__ == "__main__": + obj, morph = demo_two_asset_catopt_bridge() + print("Object:", obj) + print("Morphism:", morph) diff --git a/test.sh b/test.sh old mode 100644 new mode 100755