Actions¶
Actions are immutable commands named with category:verb, for example stack:draw, space:place, agent:create, and game:setState. engine.dispatch() constructs the action, runs the TypeScript ActionRegistry handler, records the successful action, emits lifecycle events, and evaluates registered policies.
Dispatch is asynchronous:
await engine.dispatch("stack:shuffle", { seed: 12345 });
const card = await engine.dispatch("stack:draw", { count: 1 });
await engine.dispatch("game:setState", {
key: "game",
patches: [{ path: ["turn"], value: 1 }],
});
Handlers mutate the Chronicle through their execution context. Caller code must not bypass dispatch with a direct document transaction. An unknown action or handler failure is reported as a dispatch error; post-commit observer failures do not turn a committed state change into a different mutation path.