34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
"""Layer 6 — Machine Binding & Personality Profiles."""
|
|
|
|
from typing import Any
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class MachineProfile(BaseModel):
|
|
"""Machine personality profile: limits, historical deviation models."""
|
|
|
|
machine_id: str = Field(..., description="Bound machine id")
|
|
limits_ref: str | None = Field(default=None)
|
|
deviation_model_ref: str | None = Field(default=None)
|
|
metadata: dict[str, Any] = Field(default_factory=dict)
|
|
|
|
|
|
class MachineBinding:
|
|
"""Each design binds to a specific machine with known limits. No abstraction without binding."""
|
|
|
|
def __init__(self) -> None:
|
|
self._profiles: dict[str, MachineProfile] = {}
|
|
|
|
def register(self, profile: MachineProfile) -> None:
|
|
"""Register a machine profile."""
|
|
self._profiles[profile.machine_id] = profile
|
|
|
|
def get(self, machine_id: str) -> MachineProfile | None:
|
|
"""Return profile for machine or None."""
|
|
return self._profiles.get(machine_id)
|
|
|
|
def resolve(self, machine_id: str) -> MachineProfile | None:
|
|
"""Resolve machine binding; reject if unknown (no abstraction)."""
|
|
return self.get(machine_id)
|