@chatpanel/pii 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/tool-harness.js +24 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/pii",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "The canonical ChatPanel privacy engine — reversible PII redaction + pseudonymization with local entity detection. Pure, dependency-free ESM shared by the ChatPanel extension, gateway, and bridge.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
package/tool-harness.js
CHANGED
|
@@ -41,6 +41,30 @@ export function restoreToolArgs(value, vault) {
|
|
|
41
41
|
return value;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
// System-prompt note that tells the model how to behave around placeholders when
|
|
45
|
+
// tools are armed. WITHOUT this, privacy-aware models (Codex, Claude) recognize a
|
|
46
|
+
// [[LOCATION_1]] token as redacted and REFUSE to use it for a lookup ("I can't see
|
|
47
|
+
// your real city") — the opposite of what we want. Weak models call the tool blindly
|
|
48
|
+
// and it works (the harness restores the real value), so the note levels them up.
|
|
49
|
+
export function placeholderToolNote({ toolData = 'real' } = {}) {
|
|
50
|
+
const intro =
|
|
51
|
+
'PRIVACY PLACEHOLDERS: some values in this conversation are tokens like [[PERSON_1]], '
|
|
52
|
+
+ '[[LOCATION_1]], [[ORG_1]] that stand in for the user\'s real private data. ';
|
|
53
|
+
const remote = toolData === 'redactRemote'
|
|
54
|
+
? 'When you call a LOCAL tool the placeholder is automatically replaced with the real '
|
|
55
|
+
+ 'value before the tool runs; REMOTE (MCP) tools deliberately receive the placeholder '
|
|
56
|
+
+ 'to keep private data off third-party servers. '
|
|
57
|
+
: 'When you call ANY tool, these placeholders are AUTOMATICALLY replaced with the real '
|
|
58
|
+
+ 'values before the tool executes — the tool receives the TRUE value and returns correct '
|
|
59
|
+
+ 'results. ';
|
|
60
|
+
const rules =
|
|
61
|
+
'So: CALL THE TOOL using the placeholder exactly as written, as if it were the real value. '
|
|
62
|
+
+ 'Do NOT say you cannot see the real value, do NOT ask the user to re-type it, and do NOT '
|
|
63
|
+
+ 'refuse on privacy grounds — the lookup will work. The real values are restored in your '
|
|
64
|
+
+ 'final answer automatically, so write your answer using the placeholders too.';
|
|
65
|
+
return intro + remote + rules;
|
|
66
|
+
}
|
|
67
|
+
|
|
44
68
|
export function makeToolHarness({ vault = null, toolData = 'real', redactOpts = null, redactResults = true } = {}) {
|
|
45
69
|
const on = !!vault; // privacy enabled for this turn?
|
|
46
70
|
const redactRemote = toolData === 'redactRemote';
|