refactor(automations): vertical-slice actions and triggers by domain

This commit is contained in:
CREDO23 2026-05-27 17:07:20 +02:00
parent ce45e11009
commit 8c32455818
24 changed files with 86 additions and 108 deletions

View file

@ -1,23 +0,0 @@
"""In-memory action registry. Populated once at process startup."""
from __future__ import annotations
from .types import ActionDefinition
_REGISTRY: dict[str, ActionDefinition] = {}
def register_action(action: ActionDefinition) -> None:
"""Register an action. Raises on duplicate type."""
if action.type in _REGISTRY:
raise ValueError(f"Action already registered: {action.type!r}")
_REGISTRY[action.type] = action
def get_action(action_type: str) -> ActionDefinition | None:
return _REGISTRY.get(action_type)
def all_actions() -> dict[str, ActionDefinition]:
"""Defensive snapshot of the registry."""
return dict(_REGISTRY)