@stackone/defender 0.4.3 → 0.4.5

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/dist/index.d.cts CHANGED
@@ -74,11 +74,11 @@ interface PromptDefenseConfig {
74
74
  patterns: number;
75
75
  };
76
76
  tier2: {
77
- enabled: boolean;
78
77
  mode?: "mlp" | "onnx";
79
78
  highRiskThreshold: number;
80
79
  mediumRiskThreshold: number;
81
80
  skipBelowSize: number;
81
+ tier2Fields?: string[];
82
82
  };
83
83
  blockHighRisk: boolean;
84
84
  }
@@ -111,6 +111,7 @@ interface DefenseResult {
111
111
  fieldsSanitized: string[];
112
112
  patternsByField: Record<string, string[]>;
113
113
  tier2Score?: number;
114
+ tier2SkipReason?: string;
114
115
  maxSentence?: string;
115
116
  latencyMs: number;
116
117
  }
@@ -123,12 +124,14 @@ interface PromptDefenseOptions {
123
124
  blockHighRisk?: boolean;
124
125
  defaultRiskLevel?: RiskLevel;
125
126
  useDefaultToolRules?: boolean;
127
+ tier2Fields?: string[];
126
128
  }
127
129
  declare class PromptDefense {
128
130
  private config;
129
131
  private toolResultSanitizer;
130
132
  private patternDetector;
131
133
  private tier2Classifier;
134
+ private tier2Fields;
132
135
  constructor(options?: PromptDefenseOptions);
133
136
  loadTier2Weights(weights: MLPWeights): void;
134
137
  warmupTier2(): Promise<void>;
@@ -143,4 +146,4 @@ declare class PromptDefense {
143
146
  }
144
147
  declare function createPromptDefense(options?: PromptDefenseOptions): PromptDefense;
145
148
  //#endregion
146
- export { type DefenseResult, MLP_WEIGHTS, PromptDefense, type PromptDefenseOptions, type RiskLevel, type Tier1Result, createPromptDefense };
149
+ export { type DefenseResult, MLP_WEIGHTS, PromptDefense, type PromptDefenseOptions, type RiskLevel, type Tier1Result, type ToolSanitizationRule, createPromptDefense };
package/dist/index.d.mts CHANGED
@@ -75,11 +75,11 @@ interface PromptDefenseConfig {
75
75
  patterns: number;
76
76
  };
77
77
  tier2: {
78
- enabled: boolean;
79
78
  mode?: "mlp" | "onnx";
80
79
  highRiskThreshold: number;
81
80
  mediumRiskThreshold: number;
82
81
  skipBelowSize: number;
82
+ tier2Fields?: string[];
83
83
  };
84
84
  blockHighRisk: boolean;
85
85
  }
@@ -112,6 +112,7 @@ interface DefenseResult {
112
112
  fieldsSanitized: string[];
113
113
  patternsByField: Record<string, string[]>;
114
114
  tier2Score?: number;
115
+ tier2SkipReason?: string;
115
116
  maxSentence?: string;
116
117
  latencyMs: number;
117
118
  }
@@ -124,12 +125,14 @@ interface PromptDefenseOptions {
124
125
  blockHighRisk?: boolean;
125
126
  defaultRiskLevel?: RiskLevel;
126
127
  useDefaultToolRules?: boolean;
128
+ tier2Fields?: string[];
127
129
  }
128
130
  declare class PromptDefense {
129
131
  private config;
130
132
  private toolResultSanitizer;
131
133
  private patternDetector;
132
134
  private tier2Classifier;
135
+ private tier2Fields;
133
136
  constructor(options?: PromptDefenseOptions);
134
137
  loadTier2Weights(weights: MLPWeights): void;
135
138
  warmupTier2(): Promise<void>;
@@ -144,4 +147,4 @@ declare class PromptDefense {
144
147
  }
145
148
  declare function createPromptDefense(options?: PromptDefenseOptions): PromptDefense;
146
149
  //#endregion
147
- export { type DefenseResult, MLP_WEIGHTS, PromptDefense, type PromptDefenseOptions, type RiskLevel, type Tier1Result, createPromptDefense };
150
+ export { type DefenseResult, MLP_WEIGHTS, PromptDefense, type PromptDefenseOptions, type RiskLevel, type Tier1Result, type ToolSanitizationRule, createPromptDefense };