Skip to content

Engine

engine/Engine.ts is the application-facing coordinator. It resolves one canonical IChronicle session for supplied Stack, Space, and Source instances, rejects mismatched sessions, and exposes dispatch, event, networking, storage, history, compaction, fork, and merge operations.

engine/actions.ts contains the TypeScript ActionRegistry. Built-in handlers cover stack, space, source, agent, token, batch, game, rule, and debug operations. registerAction() is the extension point, but a custom action still needs a TypeScript handler and should preserve the dispatch mutation boundary.

The dispatch lifecycle is:

  1. Construct an immutable Action.
  2. Take a checkpoint when the history interval requires one.
  3. Invoke the registry handler and its Chronicle mutation.
  4. Record the successful action and emit engine:action.
  5. Evaluate policies and downstream rule or loop observers.

Action profiling is opt-in through EngineOptions.profiler; ordinary engines do not profile implicitly.