llm-entropy-filter 1.1.0 → 1.2.0
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/CHANGELOG.md +155 -51
- package/LICENSE +93 -93
- package/README.md +297 -352
- package/dist/index.cjs +104 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +104 -70
- package/dist/index.js.map +1 -1
- package/integrations/express.mjs +117 -117
- package/integrations/fastify.mjs +106 -106
- package/integrations/langchain.mjs +98 -98
- package/integrations/vercel-ai-sdk.mjs +44 -44
- package/package.json +99 -59
- package/rulesets/default.js +8 -0
- package/rulesets/default.json +77 -73
- package/rulesets/public-api.js +7 -0
- package/rulesets/public-api.json +179 -27
- package/rulesets/schema +24 -24
- package/rulesets/strict.js +7 -0
- package/rulesets/strict.json +173 -25
- package/rulesets/support.js +7 -0
- package/rulesets/support.json +22 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,51 +1,155 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
[1.2.0] – 2026-01-29
|
|
2
|
+
Major Improvements
|
|
3
|
+
|
|
4
|
+
Introduced policy-based deterministic overrides
|
|
5
|
+
|
|
6
|
+
block_flags
|
|
7
|
+
|
|
8
|
+
warn_flags
|
|
9
|
+
|
|
10
|
+
Implemented hard escalation independent of entropy score.
|
|
11
|
+
|
|
12
|
+
Eliminated BLOCK → ALLOW leaks in benchmark dataset.
|
|
13
|
+
|
|
14
|
+
Improved logical signal clustering behavior.
|
|
15
|
+
|
|
16
|
+
Refactored gate.ts decision flow for clearer policy precedence.
|
|
17
|
+
|
|
18
|
+
Decision Flow Order (Updated)
|
|
19
|
+
|
|
20
|
+
Score calculation
|
|
21
|
+
|
|
22
|
+
Policy overrides
|
|
23
|
+
|
|
24
|
+
Threshold comparison
|
|
25
|
+
|
|
26
|
+
Final action resolution
|
|
27
|
+
|
|
28
|
+
Security Improvements
|
|
29
|
+
|
|
30
|
+
Deterministic phishing escalation (phishing_2fa_code)
|
|
31
|
+
|
|
32
|
+
Fraud payment request detection
|
|
33
|
+
|
|
34
|
+
Scam work-from-home detection
|
|
35
|
+
|
|
36
|
+
Strong spam clustering logic
|
|
37
|
+
|
|
38
|
+
Shouting + money signal amplification
|
|
39
|
+
|
|
40
|
+
Metrics (public-api preset)
|
|
41
|
+
|
|
42
|
+
Recall improved from 33% → 50%
|
|
43
|
+
|
|
44
|
+
F1 improved to 66.67%
|
|
45
|
+
|
|
46
|
+
BLOCK→ALLOW leaks: 0
|
|
47
|
+
|
|
48
|
+
Deterministic behavior confirmed
|
|
49
|
+
|
|
50
|
+
Internal Refactors
|
|
51
|
+
|
|
52
|
+
Cleaned entropy.ts
|
|
53
|
+
|
|
54
|
+
Cleaned gate.ts decision logic
|
|
55
|
+
|
|
56
|
+
Clarified ruleset schema
|
|
57
|
+
|
|
58
|
+
Improved type safety
|
|
59
|
+
|
|
60
|
+
[1.1.0] – 2026-01-28
|
|
61
|
+
Added
|
|
62
|
+
|
|
63
|
+
Configurable strong_spam_block policy option
|
|
64
|
+
|
|
65
|
+
Initial policy override support
|
|
66
|
+
|
|
67
|
+
Ruleset-level normalization controls
|
|
68
|
+
|
|
69
|
+
Benchmark CLI metrics runner
|
|
70
|
+
|
|
71
|
+
Improvements
|
|
72
|
+
|
|
73
|
+
Improved spam keyword coverage
|
|
74
|
+
|
|
75
|
+
Added urgency detection
|
|
76
|
+
|
|
77
|
+
Added fraud signal hints
|
|
78
|
+
|
|
79
|
+
Added link detection patterns
|
|
80
|
+
|
|
81
|
+
Known Limitations
|
|
82
|
+
|
|
83
|
+
Contextual false negatives on isolated phishing patterns
|
|
84
|
+
|
|
85
|
+
No cluster-based deterministic override
|
|
86
|
+
|
|
87
|
+
Score-only dependency in some edge cases
|
|
88
|
+
|
|
89
|
+
[1.0.0] – Initial Release
|
|
90
|
+
Features
|
|
91
|
+
|
|
92
|
+
Deterministic entropy scoring engine
|
|
93
|
+
|
|
94
|
+
Hard trigger system
|
|
95
|
+
|
|
96
|
+
Topic hint architecture
|
|
97
|
+
|
|
98
|
+
Threshold-based decisions (warn / block)
|
|
99
|
+
|
|
100
|
+
Public API preset
|
|
101
|
+
|
|
102
|
+
Strict preset
|
|
103
|
+
|
|
104
|
+
CLI benchmark tool
|
|
105
|
+
|
|
106
|
+
Philosophy
|
|
107
|
+
|
|
108
|
+
Linguistic entropy detection
|
|
109
|
+
|
|
110
|
+
Deterministic filtering
|
|
111
|
+
|
|
112
|
+
Middleware-first design
|
|
113
|
+
|
|
114
|
+
Roadmap (Next Minor Versions)
|
|
115
|
+
Planned for 1.3.x
|
|
116
|
+
|
|
117
|
+
Flag cluster policies (block on combination)
|
|
118
|
+
|
|
119
|
+
Configurable signal groups
|
|
120
|
+
|
|
121
|
+
Weighted cluster escalation
|
|
122
|
+
|
|
123
|
+
Expanded multilingual patterns
|
|
124
|
+
|
|
125
|
+
Subject/intent classification layer
|
|
126
|
+
|
|
127
|
+
Future (Enterprise Layer – Separate Project)
|
|
128
|
+
|
|
129
|
+
Context memory
|
|
130
|
+
|
|
131
|
+
Behavioral pattern tracking
|
|
132
|
+
|
|
133
|
+
Secondary AI review pipeline
|
|
134
|
+
|
|
135
|
+
Adaptive thresholding
|
|
136
|
+
|
|
137
|
+
Admin dashboard
|
|
138
|
+
|
|
139
|
+
Threat intelligence feeds
|
|
140
|
+
|
|
141
|
+
Versioning Philosophy
|
|
142
|
+
|
|
143
|
+
This project evolves by:
|
|
144
|
+
|
|
145
|
+
Increasing determinism
|
|
146
|
+
|
|
147
|
+
Improving recall without sacrificing precision
|
|
148
|
+
|
|
149
|
+
Strengthening policy clarity
|
|
150
|
+
|
|
151
|
+
Maintaining reproducibility
|
|
152
|
+
|
|
153
|
+
No hidden behavior.
|
|
154
|
+
No silent escalation.
|
|
155
|
+
No model dependency.
|
package/LICENSE
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
Copyright 2026 Ernesto Rosati
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|
|
18
|
-
|
|
19
|
-
--------------------------------------------------------------------
|
|
20
|
-
|
|
21
|
-
Apache License
|
|
22
|
-
Version 2.0, January 2004
|
|
23
|
-
|
|
24
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
25
|
-
|
|
26
|
-
1. Definitions.
|
|
27
|
-
|
|
28
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
29
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
30
|
-
|
|
31
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
32
|
-
the copyright owner that is granting the License.
|
|
33
|
-
|
|
34
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
35
|
-
other entities that control, are controlled by, or are under common
|
|
36
|
-
control with that entity.
|
|
37
|
-
|
|
38
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
39
|
-
exercising permissions granted by this License.
|
|
40
|
-
|
|
41
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
42
|
-
including but not limited to software source code.
|
|
43
|
-
|
|
44
|
-
"Object" form shall mean any form resulting from mechanical
|
|
45
|
-
transformation or translation of a Source form.
|
|
46
|
-
|
|
47
|
-
"Work" shall mean the work of authorship made available under the License.
|
|
48
|
-
|
|
49
|
-
"Derivative Works" shall mean any work based upon the Work.
|
|
50
|
-
|
|
51
|
-
2. Grant of Copyright License.
|
|
52
|
-
|
|
53
|
-
Subject to the terms and conditions of this License, each Contributor
|
|
54
|
-
hereby grants You a perpetual, worldwide, non-exclusive, no-charge,
|
|
55
|
-
royalty-free, irrevocable copyright license to reproduce, prepare
|
|
56
|
-
Derivative Works of, publicly display, publicly perform, sublicense,
|
|
57
|
-
and distribute the Work.
|
|
58
|
-
|
|
59
|
-
3. Grant of Patent License.
|
|
60
|
-
|
|
61
|
-
Each Contributor hereby grants You a perpetual, worldwide,
|
|
62
|
-
non-exclusive, no-charge, royalty-free, irrevocable patent license
|
|
63
|
-
to make, use, sell, offer to sell, import, and otherwise transfer
|
|
64
|
-
the Work.
|
|
65
|
-
|
|
66
|
-
4. Redistribution.
|
|
67
|
-
|
|
68
|
-
You may reproduce and distribute copies of the Work provided that
|
|
69
|
-
You give recipients a copy of this License and retain attribution notices.
|
|
70
|
-
|
|
71
|
-
5. Submission of Contributions.
|
|
72
|
-
|
|
73
|
-
Unless You explicitly state otherwise, any Contribution intentionally
|
|
74
|
-
submitted for inclusion in the Work shall be under the terms of this License.
|
|
75
|
-
|
|
76
|
-
6. Trademarks.
|
|
77
|
-
|
|
78
|
-
This License does not grant permission to use the trade names,
|
|
79
|
-
trademarks, service marks, or product names of the Licensor.
|
|
80
|
-
|
|
81
|
-
7. Disclaimer of Warranty.
|
|
82
|
-
|
|
83
|
-
The Work is provided "AS IS", WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
|
|
84
|
-
|
|
85
|
-
8. Limitation of Liability.
|
|
86
|
-
|
|
87
|
-
In no event shall any Contributor be liable for damages arising from
|
|
88
|
-
the use of the Work.
|
|
89
|
-
|
|
90
|
-
9. Accepting Warranty or Additional Liability.
|
|
91
|
-
|
|
92
|
-
You may offer support or warranty protection for a fee, but only
|
|
93
|
-
on Your own behalf and responsibility.
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2026 Ernesto Rosati
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
--------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
Apache License
|
|
22
|
+
Version 2.0, January 2004
|
|
23
|
+
|
|
24
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
25
|
+
|
|
26
|
+
1. Definitions.
|
|
27
|
+
|
|
28
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
29
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
30
|
+
|
|
31
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
32
|
+
the copyright owner that is granting the License.
|
|
33
|
+
|
|
34
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
35
|
+
other entities that control, are controlled by, or are under common
|
|
36
|
+
control with that entity.
|
|
37
|
+
|
|
38
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
39
|
+
exercising permissions granted by this License.
|
|
40
|
+
|
|
41
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
42
|
+
including but not limited to software source code.
|
|
43
|
+
|
|
44
|
+
"Object" form shall mean any form resulting from mechanical
|
|
45
|
+
transformation or translation of a Source form.
|
|
46
|
+
|
|
47
|
+
"Work" shall mean the work of authorship made available under the License.
|
|
48
|
+
|
|
49
|
+
"Derivative Works" shall mean any work based upon the Work.
|
|
50
|
+
|
|
51
|
+
2. Grant of Copyright License.
|
|
52
|
+
|
|
53
|
+
Subject to the terms and conditions of this License, each Contributor
|
|
54
|
+
hereby grants You a perpetual, worldwide, non-exclusive, no-charge,
|
|
55
|
+
royalty-free, irrevocable copyright license to reproduce, prepare
|
|
56
|
+
Derivative Works of, publicly display, publicly perform, sublicense,
|
|
57
|
+
and distribute the Work.
|
|
58
|
+
|
|
59
|
+
3. Grant of Patent License.
|
|
60
|
+
|
|
61
|
+
Each Contributor hereby grants You a perpetual, worldwide,
|
|
62
|
+
non-exclusive, no-charge, royalty-free, irrevocable patent license
|
|
63
|
+
to make, use, sell, offer to sell, import, and otherwise transfer
|
|
64
|
+
the Work.
|
|
65
|
+
|
|
66
|
+
4. Redistribution.
|
|
67
|
+
|
|
68
|
+
You may reproduce and distribute copies of the Work provided that
|
|
69
|
+
You give recipients a copy of this License and retain attribution notices.
|
|
70
|
+
|
|
71
|
+
5. Submission of Contributions.
|
|
72
|
+
|
|
73
|
+
Unless You explicitly state otherwise, any Contribution intentionally
|
|
74
|
+
submitted for inclusion in the Work shall be under the terms of this License.
|
|
75
|
+
|
|
76
|
+
6. Trademarks.
|
|
77
|
+
|
|
78
|
+
This License does not grant permission to use the trade names,
|
|
79
|
+
trademarks, service marks, or product names of the Licensor.
|
|
80
|
+
|
|
81
|
+
7. Disclaimer of Warranty.
|
|
82
|
+
|
|
83
|
+
The Work is provided "AS IS", WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
|
|
84
|
+
|
|
85
|
+
8. Limitation of Liability.
|
|
86
|
+
|
|
87
|
+
In no event shall any Contributor be liable for damages arising from
|
|
88
|
+
the use of the Work.
|
|
89
|
+
|
|
90
|
+
9. Accepting Warranty or Additional Liability.
|
|
91
|
+
|
|
92
|
+
You may offer support or warranty protection for a fee, but only
|
|
93
|
+
on Your own behalf and responsibility.
|