Skip to content

dizzy.simulate.executor

dizzy.simulate.executor

Executor interfaces — procedures emit events; policies dispatch commands; never both.

execute(component, trigger) -> ProcedureResult | PolicyResult

component — name of a procedure or policy in the feature file trigger — the activating input: a natural-language string (sim) or a structured dict payload (lib); implementors decide how to use it

ExampleProcedureExecutor

Mirrors the 'example emits' stub: emits each declared event with placeholder data.

Source code in dizzy/src/dizzy/simulate/executor.py
40
41
42
43
44
45
46
47
48
49
class ExampleProcedureExecutor:
    """Mirrors the 'example emits' stub: emits each declared event with placeholder data."""

    def __init__(self, feat: dict):
        self._feat = feat

    def execute(self, component: str, trigger: str | dict, event_store: list) -> ProcedureResult:
        procedure = self._feat["procedures"][component]
        events = [{name: "example"} for name in procedure.get("emits", [])]
        return ProcedureResult(events=events)

ExamplePolicyExecutor

Mirrors the 'example emits' stub: dispatches each declared command with placeholder data.

Source code in dizzy/src/dizzy/simulate/executor.py
52
53
54
55
56
57
58
59
60
61
class ExamplePolicyExecutor:
    """Mirrors the 'example emits' stub: dispatches each declared command with placeholder data."""

    def __init__(self, feat: dict):
        self._feat = feat

    def execute(self, component: str, trigger: str | dict, event_store: list) -> PolicyResult:
        policy = self._feat["policies"][component]
        commands = [{name: "example"} for name in policy.get("emits", [])]
        return PolicyResult(commands=commands)