import { MutationStep, AssertStep, TextAddress } from '../../../../../../document-api/src/index.js'; import { Editor } from '../../core/Editor.js'; import { CompiledTarget } from './executor-registry.types.js'; import { TextOffsetModel } from '../helpers/text-offset-resolver.js'; export interface CompiledStep { step: MutationStep; targets: CompiledTarget[]; } export interface CompiledPlan { mutationSteps: CompiledStep[]; assertSteps: AssertStep[]; /** Document revision captured at compile start — used by executor to detect drift. */ compiledRevision: string; } export interface CompilePlanOptions { /** * Text model used only for `where.by = "select"` text selectors. * * Public discovery refs and explicit SelectionTargets stay visible-offset * based. Tracked authoring selectors can opt into raw/review text so they * can address unresolved deletion text without changing public read APIs. */ selectTextModel?: TextOffsetModel; /** * When true, the duplicate block-identity repair pass does NOT dispatch a * transaction. The compiler still detects duplicates and throws * `DOCUMENT_IDENTITY_CONFLICT` if any are found, so callers that need a * read-only signal (notably `previewPlan`, which must never mutate the * editor) can surface the conflict without rewriting paraIds. * * The production mutation path (`executeCompiledPlan` → `mutations.apply`) * leaves this unset / false so the repair runs and the mutation succeeds. */ skipIdentityRepair?: boolean; } /** * Coalesces text ranges from a single logical match into one contiguous range. * All ranges must belong to the same block. */ export declare function normalizeMatchRanges(stepId: string, ranges: TextAddress[]): { blockId: string; from: number; to: number; }; type SingleBlockSpan = { kind: 'single-block'; blockId: string; from: number; to: number; }; type CrossBlockSpan = { kind: 'cross-block'; segments: Array<{ blockId: string; from: number; to: number; }>; }; type NormalizedSpan = SingleBlockSpan | CrossBlockSpan; /** * Normalizes an array of text ranges from a single logical match into either * a contiguous single-block range or ordered cross-block segments. * * Validation rules: * - Per-range bounds must be valid (non-negative, start <= end). * - Within each block, ranges must be contiguous (no gaps). */ export declare function normalizeMatchSpan(stepId: string, ranges: TextAddress[]): NormalizedSpan; type InteractionVerdict = 'allow' | 'reject'; /** * Canonical step interaction matrix. This is the single source of truth for * overlap verdicts when two steps target non-disjoint ranges. * * Key format: `${opA}::${opB}::${overlapClass}` * - Order is significant: (A, B) means A appears before B in plan order. * - Unlisted pairs are rejected by default (allowlist model). */ export declare const STEP_INTERACTION_MATRIX: ReadonlyMap; /** Operations exempt from matrix lookup (non-mutating). */ export declare const MATRIX_EXEMPT_OPS: Set; export declare function compilePlan(editor: Editor, steps: MutationStep[], options?: CompilePlanOptions): CompiledPlan; export {}; //# sourceMappingURL=compiler.d.ts.map