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

This commit is contained in:
agent-58ba63c88b4c9625 2026-04-20 16:23:24 +02:00
parent 10a5c36315
commit 2a22b95e71
3 changed files with 77 additions and 0 deletions

View File

@ -36,6 +36,21 @@ Development notes
- Ensure tests cover the new functionality and avoid sensitive data in tests.
Next steps
- Extend the DSL with richer constraints (VaR, VaR-CVaR, liquidity, latency) and ExecutionPolicy primitives.
- Integrate the GoC registry and build a canonical EquiIR representation with per-message metadata for replay/verification.
- Add a lightweight delta-sync coordinator and starter adapters for data feeds and brokers.
- Expand the test suite to exercise the new backtester and Graph-of-Contracts scaffolds.
- Improve packaging and docs to support publishing to a Python package index.
- Implement a more expressive DSL and a richer IR (EquiIR) representation.
- Add more tests for edge cases and simple integration tests for the CLI.
- Expand packaging metadata and README with a longer developer and user guide.
- Add a first-pass Graph-of-Contracts registry scaffold (GoC) and a minimal adapter registry.
- Documentation: GoC overview and how to plug in new adapters.
Extensibility notes
- The repository now includes a small GoC registry module (equicompiler_algebraic_portfolio_dsl_to_/goc_registry.py) and a registry-aware GoC skeleton integrated into the IR formation flow. This provides a stable extension point for future adapters (data feeds, brokers) and verifiable contract graphs.
- You can register adapters via the GoCRegistry class and view a digest that helps ensure reproducible builds and auditability.
- Extend the DSL with richer constraints (VaR, VaR-CVaR, liquidity, latency) and ExecutionPolicy primitives.
- Integrate the GoC registry and build a canonical EquiIR representation with per-message metadata for replay/verification.
- Add a lightweight delta-sync coordinator and starter adapters for data feeds and brokers.

View File

@ -7,6 +7,13 @@ import copy
from datetime import datetime
import hashlib
# Optional GoC registry integration (extensible adapters in the future)
try:
from .goc_registry import GoCRegistry, build_minimal_goC_skeleton
except Exception:
GoCRegistry = None # type: ignore
build_minimal_goC_skeleton = None # type: ignore
def parse_dsl_to_ir(dsl: str) -> Dict[str, object]:
"""Parse a tiny, human-friendly DSL into a canonical IR dict.
@ -95,6 +102,15 @@ def _build_goC_skeleton(ir_with_attestations: Dict[str, object], base_digest: st
digest = hashlib.sha256(json.dumps(base_for_goct, sort_keys=True).encode("utf-8")).hexdigest()
except Exception:
digest = base_digest
# Prefer a registry-driven skeleton when available
if build_minimal_goC_skeleton is not None:
try:
return build_minimal_goC_skeleton(digest, base_timestamp)
except Exception:
pass
# Fallback to a lightweight, self-contained skeleton
return {
"version": "0.1",
"contracts": [],

View File

@ -0,0 +1,46 @@
"""Graph-of-Contracts (GoC) registry placeholder.
This module provides a tiny, production-friendly scaffold for a versioned
adapter registry and a minimal Graph-of-Contracts skeleton. It's designed as
an extension point for future adapters (data feeds, brokers) while keeping
the MVP lightweight and auditable.
"""
from __future__ import annotations
import json
import hashlib
from typing import Dict, Any
class GoCRegistry:
"""Lightweight in-process registry of adapters/contracts."""
def __init__(self) -> None:
self.adapters: Dict[str, Dict[str, Any]] = {}
def register_adapter(self, name: str, info: Dict[str, Any]) -> None:
self.adapters[name] = info
def to_digest(self) -> str:
# Deterministic digest of the current adapters mapping
return hashlib.sha256(json.dumps(self.adapters, sort_keys=True).encode("utf-8")).hexdigest()
def overview(self) -> Dict[str, Any]:
return {"adapters": self.adapters, "digest": self.to_digest()}
def build_minimal_goC_skeleton(registry_digest: str, generated_at: str) -> Dict[str, Any]:
"""Return a minimal GoC skeleton including registry digest metadata.
The skeleton is intentionally tiny and can be extended as adapters are
added. It provides a stable shape for downstream consumers to validate
contract integrity and replay provenance.
"""
return {
"version": "0.1",
"contracts": [],
"metadata": {
"generated_at": generated_at,
"registry_digest": registry_digest,
},
}