@continum/sdk 0.0.3 → 0.0.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/README.md CHANGED
@@ -85,8 +85,8 @@ const continum = new Continum({
85
85
  apiKeys: { openai: process.env.OPENAI_API_KEY },
86
86
  guardianConfig: {
87
87
  enabled: true, // Enable pre-LLM protection
88
- blockHighRisk: true, // Block SSN, credit cards, etc.
89
- redactMediumRisk: true, // Redact emails, phones, etc.
88
+ action: 'REDACT_AND_CONTINUE', // Guardian action mode
89
+ // Options: 'BLOCK_ON_DETECT', 'REDACT_AND_CONTINUE', 'ALLOW_ALL'
90
90
  localOnly: false, // Use remote ML for complex cases
91
91
  customPatterns: [
92
92
  {
@@ -99,6 +99,12 @@ const continum = new Continum({
99
99
  });
100
100
  ```
101
101
 
102
+ #### Guardian Action Modes
103
+
104
+ - **BLOCK_ON_DETECT**: Block request immediately if any PII is detected
105
+ - **REDACT_AND_CONTINUE**: Redact PII and continue with LLM call (default)
106
+ - **ALLOW_ALL**: Disable Guardian protection (allow everything)
107
+
102
108
  ### Shadow Audit Configuration
103
109
 
104
110
  ```typescript
@@ -54,8 +54,9 @@ class GuardianClient {
54
54
  // Tier 1: Fast local pattern matching
55
55
  const localResult = this.scanLocalPatterns(request.userInput);
56
56
  if (localResult.detectedEntities.length > 0) {
57
- // Found PII locally - apply redaction
58
- return this.buildGuardianResult(localResult, request);
57
+ // Found PII locally - apply action based on sandbox config
58
+ // Note: guardianAction should come from sandbox config in production
59
+ return this.buildGuardianResult(localResult, request, 'REDACT_AND_CONTINUE');
59
60
  }
60
61
  // Tier 2: Remote ML scan for complex cases (optional)
61
62
  // Only if local scan found nothing but we want deeper analysis
@@ -133,7 +134,7 @@ class GuardianClient {
133
134
  return '****';
134
135
  }
135
136
  }
136
- buildGuardianResult(localResult, request) {
137
+ buildGuardianResult(localResult, request, guardianAction = 'REDACT_AND_CONTINUE') {
137
138
  let cleanPrompt = request.userInput;
138
139
  const violations = [];
139
140
  const reasoningParts = [];
@@ -143,10 +144,22 @@ class GuardianClient {
143
144
  violations.push(`${entity.type}_DETECTED`);
144
145
  reasoningParts.push(`${entity.type.toLowerCase()} ${entity.redactedValue} detected`);
145
146
  }
146
- // Determine action based on entity types
147
- const hasHighRiskPII = localResult.detectedEntities.some(e => ['SSN', 'CREDIT_CARD', 'PASSPORT', 'HEALTH_ID'].includes(e.type));
147
+ // Determine action based on guardianAction configuration
148
+ let action = 'ALLOW';
149
+ if (guardianAction === 'ALLOW_ALL') {
150
+ // Guardian disabled - allow everything
151
+ action = 'ALLOW';
152
+ }
153
+ else if (guardianAction === 'BLOCK_ON_DETECT') {
154
+ // Block if any PII detected
155
+ action = 'BLOCK';
156
+ }
157
+ else if (guardianAction === 'REDACT_AND_CONTINUE') {
158
+ // Redact PII and continue with LLM call
159
+ action = 'REDACT';
160
+ }
148
161
  return {
149
- action: hasHighRiskPII ? 'BLOCK' : 'REDACT',
162
+ action,
150
163
  violations,
151
164
  reasoning: reasoningParts.join(', '),
152
165
  cleanPrompt,
@@ -29,6 +29,7 @@ function resolveModelId(provider, snakeKey) {
29
29
  'sonnet-4': 'claude-sonnet-4-5',
30
30
  'haiku-3-5': 'claude-haiku-3-5-20241022',
31
31
  'sonnet-3-7': 'claude-sonnet-3-7-20250219',
32
+ 'claude-3-5-sonnet': 'claude-3-5-sonnet-20241022',
32
33
  };
33
34
  return anthropicMap[hyphenated] ?? `claude-${hyphenated}`;
34
35
  }
@@ -51,6 +51,7 @@ export interface ContinumConfig {
51
51
  defaultSandbox?: string;
52
52
  guardianConfig?: {
53
53
  enabled?: boolean;
54
+ action?: 'BLOCK_ON_DETECT' | 'REDACT_AND_CONTINUE' | 'ALLOW_ALL';
54
55
  blockHighRisk?: boolean;
55
56
  redactMediumRisk?: boolean;
56
57
  localOnly?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@continum/sdk",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Zero-latency compliance auditing for every LLM call in your application",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",