362e089be0
Der Nutzer hat recht: Der Ordner war voller Entwicklungs-Muell. Jetzt ist sauber getrennt: ROOT (was der Nutzer sieht und braucht): - run.py = das Programm - hms_app/ = der Anwendungscode - HMS MediaEngine.app = macOS Doppelklick-Starter - HMS-Start.vbs = Windows Doppelklick-Starter - HMS-Install.vbs = Windows Erst-Installation - HMS-Mac-Install.command = macOS Homebrew-Installation - HMS-Portable-Install.command = macOS Portable-Installation (16GB-Fix) - installer_gui.py = grafischer Installer - launcher.pyw + launcher_core.py = interne Start-Logik - LIESMICH.txt = 10-Zeilen-Kurzanleitung - .gitignore _entwicklung/ (alles andere, NICHT benoetigt): - packages/ apps/ native/ plugins/ tools/ schemas/ tests/ docs/ build/ fixture_profiles/ - PLAN.md STATUS.md ERRORS.md TEST_REPORT.md CHANGELOG.md README.md - pyproject.toml uv.lock setup_*.sh/ps1 make_mac_app.py Diese Trennung gilt ab sofort fuer alle Commits. Der Nutzer kann _entwicklung/ loeschen wenn er Platz braucht - die App laeuft ohne. Verifiziert: App startet nach Aufraeumen unveraendert (Health 200).
39 lines
1014 B
Python
39 lines
1014 B
Python
"""IPC-Nachrichten-Umschlag (PLAN.md §6.2)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import time
|
|
import uuid
|
|
from enum import StrEnum
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
PROTOCOL_VERSION = 1
|
|
|
|
|
|
class MessageType(StrEnum):
|
|
COMMAND = "command"
|
|
EVENT = "event"
|
|
SNAPSHOT = "snapshot"
|
|
ACK = "ack"
|
|
ERROR = "error"
|
|
TELEMETRY = "telemetry"
|
|
HEARTBEAT = "heartbeat"
|
|
|
|
|
|
class Envelope(BaseModel):
|
|
"""Jede IPC-Nachricht besitzt mindestens diese Felder (§6.2)."""
|
|
|
|
protocol_version: int = PROTOCOL_VERSION
|
|
message_id: str = Field(default_factory=lambda: str(uuid.uuid4()))
|
|
type: MessageType
|
|
revision: int = 0
|
|
monotonic_timestamp_ns: int = Field(default_factory=lambda: time.monotonic_ns())
|
|
payload: dict = Field(default_factory=dict)
|
|
|
|
def model_post_init(self, _ctx: object) -> None:
|
|
if self.protocol_version != PROTOCOL_VERSION:
|
|
raise ValueError(
|
|
f"protocol_version {self.protocol_version} != {PROTOCOL_VERSION}"
|
|
)
|