/** * Build Writeback Plan — Convert evaluation results into a WritebackPlan. * * This module takes the evaluation results from the evaluator and * produces a declarative `WritebackPlan` that describes all cell mutations. * The plan is then applied by `apply-writeback-plan.ts`. * * ## Responsibilities * * 1. Classify each formula's result as scalar, CSE, or dynamic-array. * 2. Check spill availability and detect #SPILL! conflicts. * 3. Generate cleanup operations for stale ghost cells. * 4. Track spill regions and ghost snapshots for persistence. * * ## Key Principle * * This module does NOT touch any live workbook objects. It reads only * from the `WorkbookSnapshot` and the evaluation results. */ import type { CompiledFormula } from "../compile/compiled-formula.js"; import type { WorkbookSnapshot } from "../integration/workbook-snapshot.js"; import type { RuntimeValue } from "../runtime/values.js"; import type { SpillRegion } from "./types.js"; import type { WritebackPlan } from "./writeback-plan.js"; /** * Build a complete `WritebackPlan` from evaluation results. * * @param snapshot - The workbook snapshot * @param compiled - All compiled formulas in evaluation order * @param results - Raw evaluation results, keyed by formula cell key * @param previousSpills - Persistent spill regions from previous calculation * @param previousGhosts - Persistent ghost snapshots from previous calculation */ export declare function buildWritebackPlan(snapshot: WorkbookSnapshot, compiled: readonly CompiledFormula[], results: ReadonlyMap, previousSpills: ReadonlyMap, previousGhosts: ReadonlyMap): WritebackPlan;