"""Canonical IR schemas for EnergiBridge-like representation. This module exposes minimal JSON Schema-like Python dictionaries for the core primitives used by the orchestrator: LocalProblem, SharedVariables, PlanDelta, DualVariables, PrivacyBudget, and AuditLog. The schemas are lightweight and intended for machine- and human-review during early integration. """ from typing import Dict SCHEMAS: Dict[str, Dict] = { "LocalProblem": { "$id": "https://example.invalid/schemas/local_problem.json", "type": "object", "required": ["id", "domain", "state", "objective"], "properties": { "id": {"type": "string"}, "domain": {"type": "string"}, "state": {"type": "object"}, "objective": {"type": "object"}, "constraints": {"type": "array"}, }, }, "SharedVariables": { "$id": "https://example.invalid/schemas/shared_variables.json", "type": "object", "additionalProperties": {"type": ["number", "string", "object", "array", "boolean", "null"]}, }, "PlanDelta": { "$id": "https://example.invalid/schemas/plan_delta.json", "type": "object", "required": ["delta_id", "author", "contract_id", "timestamp", "ops", "version_vector"], "properties": { "delta_id": {"type": "string"}, "author": {"type": "string"}, "contract_id": {"type": "string"}, "timestamp": {"type": "string", "format": "date-time"}, "ops": {"type": "array"}, "version_vector": {"type": "object"}, "signature": {"type": "string"}, }, }, "DualVariables": { "$id": "https://example.invalid/schemas/dual_variables.json", "type": "object", "additionalProperties": {"type": "number"}, }, "PrivacyBudget": { "$id": "https://example.invalid/schemas/privacy_budget.json", "type": "object", "properties": { "epsilon": {"type": "number"}, "delta": {"type": "number"}, "consumed": {"type": "number"}, }, }, "AuditLog": { "$id": "https://example.invalid/schemas/audit_log.json", "type": "array", "items": {"type": "object"}, }, } def get_schema(name: str) -> Dict: """Return the schema dict for a primitive name. Raises KeyError if not found. """ return SCHEMAS[name]