monofence-ai 1.0.7 → 2.24.1
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/README.md +10 -9
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[](https://github.com/monoes/monomind/blob/main/LICENSE)
|
|
9
9
|
[](https://nodejs.org)
|
|
10
10
|
|
|
11
|
-
**AI manipulation defense** — prompt injection, jailbreak, homoglyph evasion, base64 encoding, multi-turn escalation, and PII detection. Sub-millisecond, 50+ patterns,
|
|
11
|
+
**AI manipulation defense** — prompt injection, jailbreak, homoglyph evasion, base64 encoding, multi-turn escalation, and PII detection. Sub-millisecond, 50+ patterns, optional pattern learning (`enableLearning` stores detections and mitigation outcomes you record).
|
|
12
12
|
|
|
13
13
|
> Part of the [Monomind](https://github.com/monoes/monomind) ecosystem.
|
|
14
14
|
|
|
@@ -43,11 +43,12 @@ if (!result.safe) {
|
|
|
43
43
|
|
|
44
44
|
```typescript
|
|
45
45
|
const fence = createMonoDefence({
|
|
46
|
-
enableLearning: true, //
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
confidenceThreshold: 0.5, //
|
|
46
|
+
enableLearning: true, // learn from detections (default: false)
|
|
47
|
+
vectorStore, // optional custom VectorStore (default: in-memory)
|
|
48
|
+
trackContext: true, // track multi-turn context (default: true)
|
|
49
|
+
enablePIIDetection: true, // detect PII
|
|
50
|
+
confidenceThreshold: 0.5, // drop threats below this confidence (default: no filtering)
|
|
51
|
+
allowlistRules: [], // rules that bypass detection for known-safe inputs
|
|
51
52
|
});
|
|
52
53
|
```
|
|
53
54
|
|
|
@@ -57,7 +58,7 @@ const fence = createMonoDefence({
|
|
|
57
58
|
|--------|---------|-------------|
|
|
58
59
|
| `fence.detect(input)` | `Promise<DetectionResult>` | Full async scan with threats, risk score, timing |
|
|
59
60
|
| `fence.quickScan(input)` | `{ threat, confidence }` | Synchronous sub-millisecond check |
|
|
60
|
-
| `fence.hasPII(input)` | `boolean` | Check for emails, SSNs, API keys, passwords |
|
|
61
|
+
| `fence.hasPII(input)` | `boolean` | Check for emails, SSNs, credit cards, API keys, tokens, passwords |
|
|
61
62
|
| `fence.scanOutput(output, prompt?)` | `Promise<OutputScanResult>` | Scan LLM output for leakage/echo/policy violations |
|
|
62
63
|
| `fence.isAllowed(input)` / `fence.addAllowlistRule(rule)` | — | Allowlist bypass for known-safe inputs |
|
|
63
64
|
| `fence.getStats()` | `Promise<Stats>` | Detection + learning statistics |
|
|
@@ -94,7 +95,7 @@ const strategy = await fence.getBestMitigation('prompt_injection');
|
|
|
94
95
|
- Homoglyph substitution (Cyrillic, Unicode lookalikes)
|
|
95
96
|
- Base64 encoded payloads
|
|
96
97
|
- Multi-turn escalation patterns
|
|
97
|
-
- PII (emails, SSNs, API keys, passwords)
|
|
98
|
+
- PII (emails, SSNs, credit cards, API keys, tokens, passwords)
|
|
98
99
|
- Role-play manipulation
|
|
99
100
|
- Context window abuse
|
|
100
101
|
|
|
@@ -106,4 +107,4 @@ const strategy = await fence.getBestMitigation('prompt_injection');
|
|
|
106
107
|
|
|
107
108
|
## License
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monofence-ai",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.24.1",
|
|
4
4
|
"description": "AI Manipulation Defense System — evasion detection, multi-turn context, output scanning, hook wiring",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"README.md"
|
|
29
29
|
],
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@types/node": "^
|
|
31
|
+
"@types/node": "^26.6.6",
|
|
32
32
|
"typescript": "^7.0.2",
|
|
33
|
-
"vitest": "^
|
|
33
|
+
"vitest": "^5.1.0"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
36
36
|
"ai-security",
|