build(agent): molt-z#db0ec5 iteration
This commit is contained in:
parent
3c634384d8
commit
3b804b97c5
|
|
@ -6,6 +6,7 @@ replay, and privacy primitives placeholders.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from .schema import SignalNode, Edge, Scenario, HedgePlan, AuditLog, PrivacyBudget
|
from .schema import SignalNode, Edge, Scenario, HedgePlan, AuditLog, PrivacyBudget
|
||||||
|
from .dsl import LocalProblem, SharedVariables, PlanDelta, AuditLog as DSLAuditLog
|
||||||
from .registry import GraphRegistry
|
from .registry import GraphRegistry
|
||||||
from .replay import DeterministicReplayEngine
|
from .replay import DeterministicReplayEngine
|
||||||
from .privacy import SecureAggregator, DPBudget
|
from .privacy import SecureAggregator, DPBudget
|
||||||
|
|
@ -19,6 +20,10 @@ __all__ = [
|
||||||
"HedgePlan",
|
"HedgePlan",
|
||||||
"AuditLog",
|
"AuditLog",
|
||||||
"PrivacyBudget",
|
"PrivacyBudget",
|
||||||
|
"LocalProblem",
|
||||||
|
"SharedVariables",
|
||||||
|
"PlanDelta",
|
||||||
|
"DSLAuditLog",
|
||||||
"GraphRegistry",
|
"GraphRegistry",
|
||||||
"DeterministicReplayEngine",
|
"DeterministicReplayEngine",
|
||||||
"SecureAggregator",
|
"SecureAggregator",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from dataclasses import dataclass, field
|
||||||
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class LocalProblem:
|
||||||
|
id: str
|
||||||
|
asset: str
|
||||||
|
objective: str
|
||||||
|
constraints: Dict[str, object] = field(default_factory=dict)
|
||||||
|
version: int = 1
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class SharedVariables:
|
||||||
|
contract_id: str
|
||||||
|
variables: Dict[str, object] = field(default_factory=dict)
|
||||||
|
version: int = 1
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class PlanDelta:
|
||||||
|
delta: Dict[str, object]
|
||||||
|
timestamp: int
|
||||||
|
author: Optional[str] = None
|
||||||
|
contract_id: Optional[str] = None
|
||||||
|
privacy_budget: Optional[float] = None
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class AuditLog:
|
||||||
|
entries: List[str] = field(default_factory=list)
|
||||||
|
signer: Optional[str] = None
|
||||||
|
timestamp: Optional[int] = None
|
||||||
|
contract_id: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
# Backwards-compat alias for external imports
|
||||||
|
DSLAuditLog = AuditLog
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
import time
|
||||||
|
from signalvault_verifiable_privacy_preservin.dsl import LocalProblem, SharedVariables, PlanDelta, DSLAuditLog
|
||||||
|
|
||||||
|
|
||||||
|
def test_basic_dsl_instantiation():
|
||||||
|
lp = LocalProblem(id="lp1", asset="ETH", objective="maximize", version=2)
|
||||||
|
sv = SharedVariables(contract_id="contract-1", variables={"lambda": 0.5})
|
||||||
|
pd = PlanDelta(delta={"action": "adjust"}, timestamp=int(time.time()), author="tester", contract_id="c-1")
|
||||||
|
alog = DSLAuditLog(entries=["created"], signer="tester", timestamp=int(time.time()))
|
||||||
|
|
||||||
|
assert lp.id == "lp1"
|
||||||
|
assert lp.asset == "ETH"
|
||||||
|
assert sv.contract_id == "contract-1"
|
||||||
|
assert pd.timestamp > 0
|
||||||
|
assert isinstance(alog.entries, list)
|
||||||
Loading…
Reference in New Issue