build(agent): molt-y#23e5c8 iteration
This commit is contained in:
parent
92015f21fe
commit
a349406b77
|
|
@ -11,6 +11,8 @@ from .transport import TransportLayer
|
||||||
from .governance import GovernanceLedger, DeltaSync
|
from .governance import GovernanceLedger, DeltaSync
|
||||||
from .marketplace import AdaptersMarketplace
|
from .marketplace import AdaptersMarketplace
|
||||||
from .simulation import SimulationHarness
|
from .simulation import SimulationHarness
|
||||||
|
from .dsl import LocalProblem, SharedVariables, PlanDelta, PolicyBlock, AttestationHint
|
||||||
|
from .bridge import to_canonical, from_canonical
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"SecurityContractsRegistry",
|
"SecurityContractsRegistry",
|
||||||
|
|
@ -21,4 +23,11 @@ __all__ = [
|
||||||
"DeltaSync",
|
"DeltaSync",
|
||||||
"AdaptersMarketplace",
|
"AdaptersMarketplace",
|
||||||
"SimulationHarness",
|
"SimulationHarness",
|
||||||
|
"LocalProblem",
|
||||||
|
"SharedVariables",
|
||||||
|
"PlanDelta",
|
||||||
|
"PolicyBlock",
|
||||||
|
"AttestationHint",
|
||||||
|
"to_canonical",
|
||||||
|
"from_canonical",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
|
|
||||||
|
def to_canonical(local_problem: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
|
"""Convert a local problem description into a simple canonical representation.
|
||||||
|
|
||||||
|
This is a lightweight bridge shim intended for MVP interoperability. It does not
|
||||||
|
implement real cryptographic guarantees, but provides a stable surface for
|
||||||
|
adapters to interoperate using a vendor-agnostic representation.
|
||||||
|
"""
|
||||||
|
# Basic normalization; in a real system this would be richer and versioned.
|
||||||
|
canonical = {
|
||||||
|
"Objects": {
|
||||||
|
"LocalProblems": [local_problem],
|
||||||
|
},
|
||||||
|
"Morphisms": [],
|
||||||
|
"Functors": [],
|
||||||
|
}
|
||||||
|
return canonical
|
||||||
|
|
||||||
|
|
||||||
|
def from_canonical(canonical: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
|
"""Inverse of to_canonical for MVP playgrounds."""
|
||||||
|
objs = canonical.get("Objects", {})
|
||||||
|
return {"LocalProblems": objs.get("LocalProblems", [])}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class LocalProblem:
|
||||||
|
"""Canonical Local Problem representation for cross-domain optimization.
|
||||||
|
|
||||||
|
This lightweight structure is intended for MVP wiring between GridGuard and
|
||||||
|
interoperability bridges (CatOpt-like). It captures a per-asset planning task.
|
||||||
|
"""
|
||||||
|
|
||||||
|
asset_id: str
|
||||||
|
objective: Dict[str, Any]
|
||||||
|
bounds: Optional[Dict[str, Any]] = None
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class SharedVariables:
|
||||||
|
"""Versioned shared signals between adapters/domains."""
|
||||||
|
|
||||||
|
version: int
|
||||||
|
signals: Dict[str, Any]
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class PlanDelta:
|
||||||
|
"""Incremental plan updates to be applied by other domains."""
|
||||||
|
|
||||||
|
delta: Dict[str, Any]
|
||||||
|
version: int
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class PolicyBlock:
|
||||||
|
"""Policy core for a contract: data-exposure, attestation, and limits."""
|
||||||
|
|
||||||
|
policy_id: str
|
||||||
|
data_exposure_limit: int
|
||||||
|
attestation_required: bool = True
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class AttestationHint:
|
||||||
|
"""Hints binding proofs to contract permissions for an adapter/agent."""
|
||||||
|
|
||||||
|
agent_id: str
|
||||||
|
required: bool = True
|
||||||
Loading…
Reference in New Issue