import type { SynthEvent } from "../types/index.js"; import { type AggregateGraphNode } from "./replay.js"; import type { HistoricalAliasRegistry } from "./historical-aliases.js"; export type NormalizationKind = "duplicate-identity" | "cross-kind-conflict" | "malformed-creation"; export type NormalizationNotice = { kind: NormalizationKind; severity: "warning" | "error"; aggregateKind: AggregateGraphNode["kind"]; aggregateId: string; message: string; provenance: { /** Event ids that contributed to this notice */ eventIds: string[]; /** Original references observed, if any */ references?: Record; }; }; export type HistoricalNormalizationResult = { /** Events with duplicate creations collapsed */ events: SynthEvent[]; /** Notices describing historical deviations */ notices: NormalizationNotice[]; /** Canonical identity entries: key = `${kind}:${id}` */ canonicalIdentities: Map; }; /** * Normalize a raw event stream for canonical state derivation. * * Duplicate creation events for the same aggregate identity are collapsed. * The first occurrence is kept as the canonical creation; subsequent * identical occurrences are recorded as duplicate-identity notices. * * When a historical alias registry is provided, duplicate events whose * event ids are registered aliases of the same canonical identity do not * produce warnings. This lets the resolver interpret legacy genesis seed * events without mutating the event log. */ export declare function normalizeHistoricalEvents(events: SynthEvent[], aliasRegistry?: HistoricalAliasRegistry): HistoricalNormalizationResult;