build(agent): new-agents-2#7e3bbc iteration

This commit is contained in:
agent-7e3bbc424e07835b 2026-04-19 22:25:03 +02:00
parent ab8acdb0c9
commit 1879511afe
1 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,43 @@
"""GoC Registry Seed Helpers
Small, composable helpers to seed a GraphContractRegistry with a minimal
contract set. Designed to support Phase 0 MVP wiring of the GraphContract
Registry and EnergiBridge go-to-IR flow without introducing heavy dependencies.
"""
from typing import Any, Dict
def seed_registry_with_meta(registry) -> None:
"""Seed a registry with minimal, metadata-enabled contracts.
This function uses the registry's per-message metadata support when
available (register_contract_with_meta); otherwise it falls back to the
legacy register_contract API. The seeded contracts form a tiny baseline for
cross-domain interoperability and auditing.
"""
contract_type = "LocalProblem"
version = "0.2"
payload_local: Dict[str, Any] = {"id": "lp-bootstrap", "name": "Bootstrap LocalProblem"}
metadata_local: Dict[str, Any] = {"source": "GoC seed", "contract_type": contract_type, "version": version}
contract_type_shared = "SharedVariables"
payload_shared: Dict[str, Any] = {"signals": {}}
metadata_shared: Dict[str, Any] = {"source": "GoC seed", "contract_type": contract_type_shared, "version": version}
contract_type_delta = "PlanDelta"
payload_delta: Dict[str, Any] = {"delta_id": "pd-bootstrap", "changes": {}}
metadata_delta: Dict[str, Any] = {"source": "GoC seed", "contract_type": contract_type_delta, "version": version}
if hasattr(registry, "register_contract_with_meta"):
registry.register_contract_with_meta(contract_type, version, payload_local, metadata_local)
registry.register_contract_with_meta(contract_type_shared, version, payload_shared, metadata_shared)
registry.register_contract_with_meta(contract_type_delta, version, payload_delta, metadata_delta)
else:
# Fallback to legacy API
registry.register_contract(contract_type, version, payload_local)
registry.register_contract(contract_type_shared, version, payload_shared)
registry.register_contract(contract_type_delta, version, payload_delta)
__all__ = ["seed_registry_with_meta"]