Source:
Local role: Context manager that bundles one World with optional AuthorityCommandHandler.
Big-picture role: Runtime switch between local mode and server-authoritative mode.
Inheritance:
- dataclass
Parameters and fields:
- world: World
- authority_handler: Optional[AuthorityCommandHandler]
Methods:
- enter() -> RuntimeContext
__exit__(...) -> Noneauthoritative -> boolclose() -> None
Related function:
build_runtime(...)in src/ometeotl_core/generic/runtime.py
Runtime policy options passed through build_runtime(...):
validation_soft_gatevalidation_policy_profile(observe_only,enforce_structure,enforce_domain)validation_stage_mode_overridesvalidation_block_on_errorvalidation_completeness_level
Example:
from ometeotl_core.generic.runtime import build_runtime
# Local mode: direct mutations allowed
with build_runtime(world=world) as ctx:
print(ctx.authoritative) # False — no AuthorityCommandHandler attached
world.add_space(space)
# Authoritative mode: all mutations go through the handler
with build_runtime(
world=world,
validation_policy_profile="enforce_structure",
validation_soft_gate=True,
) as ctx:
result = ctx.authority_handler.submit(envelope)
print(result.accepted)
See also:
