build(agent): new-agents-4#58ba63 iteration

This commit is contained in:
agent-58ba63c88b4c9625 2026-04-20 16:45:20 +02:00
parent 28782f593f
commit 1e5f4179ec
1 changed files with 23 additions and 34 deletions

View File

@ -1,48 +1,37 @@
"""Lightweight Graph-of-Contracts (GoC) registry for MVP.
This module provides a minimal, production-friendly skeleton that other
parts of the EquiCompiler can import and use. It is intentionally small
and dependency-free, designed to be extended in future sprint cycles.
"""Lightweight Graph-of-Contracts (GoC) registry scaffold.
Minimal, production-safe placeholder that enables import-time hooks and a
verifiable skeleton for the MVP.
"""
from __future__ import annotations
from typing import Dict, Any
from typing import Dict
import hashlib
import time
class GoCRegistry:
"""Very small in-process registry for GoC contracts/adapters."""
"""Very small in-process registry for adapters and contracts."""
def __init__(self):
self.adapters = {}
self.contracts = {}
def __init__(self) -> None:
self._registry: Dict[str, Dict[str, Any]] = {}
def register_adapter(self, name: str, details: Dict[str, object]):
self.adapters[name] = details
return name
def register(self, name: str, contract: Dict[str, Any]) -> None:
"""Register a contract descriptor by name."""
self._registry[name] = contract
def register_contract(self, contract_id: str, details: Dict[str, object]):
self.contracts[contract_id] = details
return contract_id
def get(self, name: str) -> Dict[str, Any]:
"""Retrieve a registered contract descriptor by name, or empty if not found."""
return self._registry.get(name, {})
def list(self) -> Dict[str, Dict[str, Any]]:
"""Return the whole registry mapping."""
return dict(self._registry)
def build_minimal_goC_skeleton(digest: str, timestamp: str) -> Dict[str, Any]:
"""Return a minimal Graph-of-Contracts skeleton for the given digest.
This is a tiny, replay-friendly structure that can be extended with
actual contract metadata in later MVP iterations.
"""
def build_minimal_goC_skeleton(registry_digest: str, timestamp: str) -> Dict[str, object]:
"""Return a minimal, reproducible GoC skeleton."""
# Simple, deterministic hash to seed the GoC's identity
seed = hashlib.sha256(f"{registry_digest}:{timestamp}".encode("utf-8")).hexdigest()
return {
"version": "0.1",
"contracts": [],
"metadata": {
"generated_at": timestamp,
"source_digest": digest,
},
"registry_digest": registry_digest,
"generated_at": timestamp,
"registry_seed": seed,
}
__all__ = ["GoCRegistry", "build_minimal_goC_skeleton"]