@sandrobuilds/tracerney 0.9.19 → 0.9.21

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 (2) hide show
  1. package/README.md +130 -7
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Lightweight prompt injection detection for LLM applications. Runs 100% locally with zero data leaving your server.
4
4
 
5
+ > 🚀 **Explore the full platform at [tracerney.com](https://www.tracerney.com)** — includes dashboard, analytics, API management, and team collaboration tools.
6
+
5
7
  ## Install
6
8
 
7
9
  ```bash
@@ -72,16 +74,137 @@ if (result.suspicious) {
72
74
  - Detects: instruction overrides, role-play jailbreaks, context confusion, code execution risks, data extraction attempts, and more
73
75
 
74
76
  **Layer 2:** LLM Sentinel (Pro - $9/month)
75
- - AI-powered response verification system
76
- - Analyzes LLM responses for injection patterns
77
- - Validates output safety with context-aware scanning
78
- - Delimiter salting for enhanced protection
79
- - Returns structured threat metadata (class, fingerprint, confidence)
77
+ - **AI-powered response verification** — LLM-based analysis for novel attack patterns
78
+ - **Context-aware scanning** understands your application's specific security policies
79
+ - **Delimiter salting** prevents prompt injection through response boundaries
80
+ - **Zero prompt storage** responses are analyzed in-memory, never saved or logged
81
+ - **Structured threat metadata** detailed fingerprints for audit trails and tracking
82
+ - **Advanced rate limiting** — prevents cost spikes with intelligent throttling
83
+
84
+ ## Layer 2: LLM Sentinel Deep Dive
85
+
86
+ Layer 2 adds advanced security with LLM Sentinel, an AI-powered verification system that analyzes LLM responses for injection patterns and validates output safety. Combines local pattern detection (Layer 1) with server-side verification for defense-in-depth protection.
87
+
88
+ ### How Layer 1 & Layer 2 Work Together
89
+
90
+ | **Layer 1: Pattern Detection (Free SDK)** | **Layer 2: LLM Sentinel (Pro)** |
91
+ |---|---|
92
+ | Local pattern matching | Server-side verification |
93
+ | 258 attack patterns | Output validation |
94
+ | <5ms latency | JSON safety checks |
95
+ | No data leaves device | Delimiter salting |
96
+ | Zero network calls | Context-aware analysis |
97
+
98
+ ### Enabling Layer 2
99
+
100
+ Initialize Tracerney with Layer 2 LLM Sentinel (Pro plan required):
101
+
102
+ ```typescript
103
+ const tracer = new Tracerney({
104
+ apiKey: process.env.TRACERNEY_API_KEY,
105
+ sentinelEnabled: true,
106
+ });
107
+ ```
108
+
109
+ That's it! Layer 2 is automatically configured to use the hosted LLM Sentinel service. Your API key authenticates requests and verifies your Pro subscription.
110
+
111
+ ### Custom Layer 2 Configuration (Advanced)
112
+
113
+ Want to self-host Layer 2 or use a custom implementation? Override the sentinel endpoint:
114
+
115
+ ```typescript
116
+ const tracer = new Tracerney({
117
+ apiKey: process.env.TRACERNEY_API_KEY,
118
+ sentinelEnabled: true,
119
+ baseUrl: process.env.TRACERNEY_BASE_URL, // e.g., http://localhost:3000 or https://myapp.com
120
+ sentinelEndpoint: process.env.TRACERNEY_SENTINEL_ENDPOINT, // e.g., /api/v1/verify-prompt
121
+ });
122
+ ```
123
+
124
+ **Self-hosting Layer 2?** You can build your own verification endpoint using the same pattern as our hosted service. Contact support for self-hosting guidance.
125
+
126
+ ### Scanning with Layer 2
127
+
128
+ With Layer 2 enabled, `scanPrompt` validates both input and LLM responses. Handle errors appropriately:
129
+
130
+ ```typescript
131
+ try {
132
+ // Scan input (Layer 1 + Layer 2)
133
+ const result = await tracer.scanPrompt(userInput);
134
+ // If we get here, input is safe. Call LLM
135
+ const llmResponse = await llm.chat(userInput);
136
+ // Verify LLM output wasn't compromised
137
+ const outputCheck = await tracer.verifyOutput(llmResponse);
138
+ return llmResponse;
139
+ } catch (err) {
140
+ if (err instanceof ShieldBlockError) {
141
+ return NextResponse.json(
142
+ { error: "Input content is flagged as suspicious" },
143
+ { status: 400 }
144
+ );
145
+ }
146
+ throw err;
147
+ }
148
+ ```
149
+
150
+ ### API Response Format
151
+
152
+ The verify-prompt endpoint returns structured responses. Success (HTTP 200) includes classification, confidence, and fingerprint. Errors include specific error codes and messages.
153
+
154
+ #### ✅ Content is Safe (HTTP 200)
155
+ ```json
156
+ {
157
+ "action": "ALLOW",
158
+ "confidence": 0.15,
159
+ "class": "safe_content",
160
+ "fingerprint": "a3f7k2"
161
+ }
162
+ ```
163
+
164
+ #### 🔴 Content is Blocked (HTTP 200)
165
+ ```json
166
+ {
167
+ "action": "BLOCK",
168
+ "confidence": 0.99,
169
+ "class": "jailbreak_semantic_pattern",
170
+ "fingerprint": "c1p5n3"
171
+ }
172
+ ```
80
173
 
81
- ## Pricing
174
+ #### ⚠️ Quota Exceeded (HTTP 402)
175
+ ```json
176
+ {
177
+ "blocked": true,
178
+ "reason": "scan_limit_exceeded",
179
+ "scansUsed": 50,
180
+ "limit": 50,
181
+ "message": "Free plan limit reached (50/month)..."
182
+ }
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Pricing & Usage
82
188
 
83
189
  - **Free Tier:** 50 scans/month with Layer 1 pattern detection
84
- - **Pro Tier:** 2,500 scans/month with Layer 1 + Layer 2 LLM verification
190
+ - **Pro Tier:** 2,500 scans/month with Layer 1 + Layer 2 LLM verification ($9/month)
191
+
192
+ ---
193
+
194
+ ## Ready for Advanced Protection?
195
+
196
+ Layer 2 (LLM Sentinel) adds AI-powered verification with **context-aware** threat detection and **zero prompt storage** — all responses are analyzed in-memory and immediately discarded.
197
+
198
+ **[Start Your Free Trial or Upgrade to Pro](https://www.tracerney.com/docs)** at tracerney.com
199
+
200
+ Includes:
201
+ - Dashboard with threat analytics
202
+ - API key management
203
+ - Team collaboration features
204
+ - Detailed threat fingerprints for compliance
205
+ - Priority support for Pro members
206
+
207
+ ---
85
208
 
86
209
  ## License
87
210
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sandrobuilds/tracerney",
3
- "version": "0.9.19",
4
- "description": "Lightweight prompt injection detection for LLM applications. Runs 100% locally with 258 embedded attack patterns.",
3
+ "version": "0.9.21",
4
+ "description": "Lightweight prompt injection detection with Layer 1 (258 patterns) + Layer 2 (AI verification). Runs locally with zero data storage. Upgrade to Pro for context-aware threat analysis at tracerney.com",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",