/** * High-precision deterministic mutation-intent hint. * * This is ONLY a hint. It does not choose operations, does not bypass the * router, and does not authorize anything. False negatives are acceptable * because the semantic router also detects edit intent. False positives must * never authorize a mutation — they may only cause the safe fallback to * require confirmation or clarification when routing fails. */ // Obvious edit/redline/rewrite/replace/update language only. Kept narrow for // high precision: a broad regex here would re-introduce the fragile // short-circuit behavior this architecture removes. const MUTATION_INTENT_RE = /\b(redline|red-lines?|tracked changes?|apply the edit|make the edit|rewrite the clause|replace the clause|update the clause|revise the clause|insert the clause|delete the clause|strike through|strikethrough)\b/i; export function detectMutationIntentHint( latestUserMessage: string, ): boolean { if (typeof latestUserMessage !== "string") return false; return MUTATION_INTENT_RE.test(latestUserMessage); }