Spaces:
Sleeping
Sleeping
Download backend/src/lib/assistantRouting/mutationHint.ts from bardd/mike-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/spaces/bardd/mike-backend/resolve/main/backend/src/lib/assistantRouting/mutationHint.ts
- Command line
-
hf download hf://spaces/bardd/mike-backend/backend/src/lib/assistantRouting/mutationHint.ts
-
curl -L -o mutationHint.ts https://huggingface.co/spaces/bardd/mike-backend/resolve/main/backend/src/lib/assistantRouting/mutationHint.ts
1.08 kB
| /** | |
| * 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); | |
| } | |