- Sessions for RAG:
shield.session() shares one set of placeholders across the question, passages, history and the restored answer. detectAll() / redactAll() scan several texts first.
- Known values are masked everywhere: once a value is found, later occurrences are masked even with no clue around them, including parts of names ("rahul" after "Rahul Sharma"), mapped to the same placeholder. Turn off with
propagate: false.
- Placeholders ignore case and spacing again ("Rahul Sharma" = "rahul sharma",
9123456780 = +91 91234 56780); restore uses the best-capitalised spelling. matchCase: true keeps the 0.2.1 behaviour.
- Streaming restore:
createRestoreStream() / restoreStream() hold back a placeholder split across chunks, in every form piilite restores.
restore() understands spaces inside type names ("[PHONE IN 1]") and has fuzzy: "brackets" to leave bare words like EMAIL_1 alone.
- Company addresses are masked again by default (a home address can follow an employer's name);
keepCompanyAddresses: true leaves them.
- Masking a question with 8 passages and 2 KB of history (about 9 KB) takes about 8 ms (p95 13 ms) on a 4-core server.
npm install piilite@0.3.0