import { AlignmentPlan, FingerprintedBlock } from "./types.js"; import { SegmentToReview, mergeReviewedSegments } from "./rebuildDocument.js"; //#region src/docReview/pipeline.d.ts export type BuildAlignmentPlanInput = { /** The base (source) document, used as the translation reference. */ baseText: string; /** The existing target (translated) document, possibly empty. */ targetText: string; /** * 1-based line numbers that changed in the base document. * * `undefined` means the changed lines are unknown (no git history available): * every section is then compared block by block. An empty array means nothing * changed, and every aligned block is reused. */ changedLines: number[] | undefined; }; export type BuildAlignmentPlanOutput = { baseBlocks: FingerprintedBlock[]; targetBlocks: FingerprintedBlock[]; plan: AlignmentPlan; segmentsToReview: SegmentToReview[]; }; /** * Build the block-aware alignment plan between a base document and its * translation, in two levels. * * 1. **Sections** (heading-anchored) are aligned first. Because a document and * its translation share the same heading structure, this alignment is robust * and never drops a section just because the prose was split into a different * number of paragraphs. * 2. Only the sections **touched by a changed line** are then re-segmented into * fine blocks (paragraphs, code fences) and aligned within the section, so a * small edit re-translates only the affected paragraph(s) instead of the * whole section. Within a changed section a target block with no base * counterpart is **kept as-is** (reused) rather than deleted, so a translation * that has extra paragraphs never loses content. * When `changedLines` is `undefined` the changed lines are simply unknown, so * **every** section is inspected instead of none: aligned blocks are still * reused (there is no way to tell which translation went stale), but blocks * living on one side only are reported as `insert_new` / `delete`. This is * what makes a plain "compare this document with its translation" run — one * with no git history behind it — report anything at all. * * Section-level insertions and deletions stay whole: a brand-new section is * translated as one unit, and a target section with no base counterpart is * reported as `delete` for visibility but never dropped by the merge (see * {@link mergeReviewedSegments}), so a review can never lose translated content. * * @param input - The base/target texts and optional changed lines. * @returns The (flattened) blocks, the plan, and the segments that need translation. */ export declare const buildAlignmentPlan: ({ baseText, targetText, changedLines }: BuildAlignmentPlanInput) => BuildAlignmentPlanOutput; //#endregion export { type SegmentToReview, mergeReviewedSegments }; //# sourceMappingURL=pipeline.d.ts.map