import type { BackendContext } from "../core"; export type BackendIntentMap = Record; export type BackendIntent = (context: BackendContext, payload: P) => void | Promise; export type BackendIntents = { [K in keyof M]: BackendIntent; }; export type BackendEffect = (context: BackendContext, payload: P) => void | Promise; export type BackendRuntime = { state(): Readonly; reset(): void; emit(intent: K, payload: M[K]): Promise; registerIntents(intents: BackendIntents): void; effect(intent: K, effect: BackendEffect): () => void; onError(handler: (error: unknown, intent: keyof M) => void): () => void; onBefore(fn: (intent: K, payload: M[K]) => void): () => void; onAfter(fn: (intent: K, payload: M[K]) => void): () => void; destroy(): void; }; export declare function createBackendRuntime(initial: S): BackendRuntime;