agentshield-sdk 7.2.1 → 7.4.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +125 -1
  2. package/README.md +68 -7
  3. package/bin/agent-shield.js +19 -0
  4. package/package.json +10 -3
  5. package/src/agent-protocol.js +4 -0
  6. package/src/allowlist.js +605 -603
  7. package/src/attack-genome.js +536 -0
  8. package/src/attack-replay.js +246 -0
  9. package/src/audit-streaming.js +486 -469
  10. package/src/audit.js +619 -0
  11. package/src/behavior-profiling.js +299 -289
  12. package/src/behavioral-dna.js +757 -0
  13. package/src/canary.js +273 -271
  14. package/src/compliance-authority.js +803 -0
  15. package/src/compliance.js +619 -617
  16. package/src/confidence-tuning.js +328 -324
  17. package/src/context-scoring.js +362 -360
  18. package/src/cost-optimizer.js +1024 -1024
  19. package/src/detector-core.js +186 -0
  20. package/src/distributed.js +7 -2
  21. package/src/embedding.js +310 -307
  22. package/src/errors.js +9 -0
  23. package/src/evolution-simulator.js +650 -0
  24. package/src/flight-recorder.js +379 -0
  25. package/src/herd-immunity.js +521 -0
  26. package/src/honeypot.js +332 -328
  27. package/src/index.js +6 -5
  28. package/src/integrations.js +1 -2
  29. package/src/intent-firewall.js +775 -0
  30. package/src/llm-redteam.js +678 -670
  31. package/src/main.js +139 -0
  32. package/src/mcp-security-runtime.js +6 -5
  33. package/src/middleware.js +11 -5
  34. package/src/model-fingerprint.js +1059 -1042
  35. package/src/multi-agent-trust.js +459 -453
  36. package/src/multi-agent.js +1 -1
  37. package/src/normalizer.js +734 -0
  38. package/src/pii.js +8 -1
  39. package/src/policy-dsl.js +775 -775
  40. package/src/presets.js +409 -409
  41. package/src/production.js +22 -9
  42. package/src/real-attack-datasets.js +246 -0
  43. package/src/redteam.js +475 -475
  44. package/src/report-generator.js +640 -0
  45. package/src/response-handler.js +436 -429
  46. package/src/scanners.js +358 -357
  47. package/src/self-healing.js +368 -363
  48. package/src/semantic.js +339 -339
  49. package/src/shield-score.js +250 -250
  50. package/src/soc-dashboard.js +394 -0
  51. package/src/sso-saml.js +8 -4
  52. package/src/supply-chain.js +667 -0
  53. package/src/testing.js +24 -2
  54. package/src/threat-intel-federation.js +343 -0
  55. package/src/tool-guard.js +412 -412
  56. package/src/watermark.js +242 -235
  57. package/src/worker-scanner.js +608 -601
package/src/pii.js CHANGED
@@ -8,6 +8,8 @@
8
8
  * - Content Policies: Block agents from generating certain content categories.
9
9
  */
10
10
 
11
+ const { createShieldError } = require('./errors');
12
+
11
13
  // =========================================================================
12
14
  // PII PATTERNS
13
15
  // =========================================================================
@@ -196,6 +198,7 @@ class DLPEngine {
196
198
  this.rules = options.rules || [];
197
199
  this.onViolation = options.onViolation || null;
198
200
  this.violations = [];
201
+ this._maxViolations = options.maxViolations || 1000;
199
202
  }
200
203
 
201
204
  /**
@@ -215,7 +218,8 @@ class DLPEngine {
215
218
  try {
216
219
  pattern = new RegExp(rule.pattern, 'gi');
217
220
  } catch (err) {
218
- console.error(`[Agent Shield] DLPEngine.addRule(): invalid regex pattern "${rule.pattern}": ${err.message}`);
221
+ const shieldErr = createShieldError('AS-CFG-005', { pattern: rule.pattern, reason: err.message });
222
+ console.error(`[Agent Shield] ${shieldErr.message}`);
219
223
  return this;
220
224
  }
221
225
  } else {
@@ -262,6 +266,9 @@ class DLPEngine {
262
266
  violations.push(violation);
263
267
  this.violations.push(violation);
264
268
  }
269
+ if (this.violations.length > this._maxViolations) {
270
+ this.violations = this.violations.slice(-this._maxViolations);
271
+ }
265
272
 
266
273
  if (rule.action === 'redact') {
267
274
  if (rule.pattern.global) rule.pattern.lastIndex = 0;