diff --git a/src/gridguard_secure_attested_cross_domain_e/__init__.py b/src/gridguard_secure_attested_cross_domain_e/__init__.py index 1b06519..5b20ae5 100644 --- a/src/gridguard_secure_attested_cross_domain_e/__init__.py +++ b/src/gridguard_secure_attested_cross_domain_e/__init__.py @@ -11,6 +11,8 @@ from .transport import TransportLayer from .governance import GovernanceLedger, DeltaSync from .marketplace import AdaptersMarketplace from .simulation import SimulationHarness +from .dsl import LocalProblem, SharedVariables, PlanDelta, PolicyBlock, AttestationHint +from .bridge import to_canonical, from_canonical __all__ = [ "SecurityContractsRegistry", @@ -21,4 +23,11 @@ __all__ = [ "DeltaSync", "AdaptersMarketplace", "SimulationHarness", + "LocalProblem", + "SharedVariables", + "PlanDelta", + "PolicyBlock", + "AttestationHint", + "to_canonical", + "from_canonical", ] diff --git a/src/gridguard_secure_attested_cross_domain_e/bridge.py b/src/gridguard_secure_attested_cross_domain_e/bridge.py new file mode 100644 index 0000000..eb52487 --- /dev/null +++ b/src/gridguard_secure_attested_cross_domain_e/bridge.py @@ -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", [])} diff --git a/src/gridguard_secure_attested_cross_domain_e/dsl.py b/src/gridguard_secure_attested_cross_domain_e/dsl.py new file mode 100644 index 0000000..20e6aa9 --- /dev/null +++ b/src/gridguard_secure_attested_cross_domain_e/dsl.py @@ -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