CommandEnvelope

Source:

Local role: Canonical command payload consumed by AuthorityCommandHandler.

Big-picture role: Transport object that standardizes authoritative world mutation requests targeting World.

Inheritance:

  • frozen dataclass

Parameters and fields:

  • command_id: str
  • actor_id: ObjectId
  • command_type: str
  • payload: JsonMap
  • sequence: int
  • issued_at: str

Methods:

Example:

from ometeotl_core.generic.authority import CommandEnvelope
import datetime

envelope = CommandEnvelope(
    command_id="cmd-001",
    actor_id="actor-1",
    command_type="add_space",
    payload={"space": space.to_dict()},
    sequence=1,
    issued_at=datetime.datetime.utcnow().isoformat(),
)
data = envelope.to_dict()
envelope2 = CommandEnvelope.from_dict(data)

See also:

Ometeotl

A Python library to build complex multi-agent simulations, wargames, and AI-driven strategies