Skip to content

Rulvar API reference


Rulvar API reference / @rulvar/core / applyFinishRepairHints

Function: applyFinishRepairHints()

ts
function applyFinishRepairHints(text, hints): string | undefined;

Defined in: packages/core/src/orchestrator/finish-validators.ts:662

Applies insert-run-id repair hints to a judged text (RV3801): each [start, end) window is replaced by insertRunIdIntoSentence(window, insert), right to left so earlier offsets stay valid, every other byte identical. Fail closed: undefined (never a partial patch) when the set is empty, any window is out of bounds or empty, or two windows overlap; the caller treats a refused patch exactly like an absent one and proceeds to the model repair pool.

Parameters

ParameterType
textstring
hintsreadonly { end: number; insert: string; start: number; }[]

Returns

string | undefined