@vpdeva/blackwall-llm-shield-js 0.1.7 → 0.1.8

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 +45 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -81,6 +81,10 @@ Use `shadowMode` with `shadowPolicyPacks` or `comparePolicyPacks` to record what
81
81
 
82
82
  Use `createOpenAIAdapter()`, `createAnthropicAdapter()`, `createGeminiAdapter()`, or `createOpenRouterAdapter()` with `protectWithAdapter()` when you want Blackwall to wrap the provider call end to end.
83
83
 
84
+ ### Controlled-pilot rollout
85
+
86
+ The current recommendation for enterprise teams is a controlled pilot first: start in shadow mode, aggregate route-level telemetry, tune suppressions explicitly, then promote the cleanest routes to enforcement.
87
+
84
88
  ### Observability and control-plane support
85
89
 
86
90
  Use `summarizeOperationalTelemetry()` with emitted telemetry events when you want route-level summaries, blocked-event counts, and rollout visibility for operators.
@@ -181,6 +185,22 @@ const result = await shield.protectWithAdapter({
181
185
  console.log(result.stage, result.allowed);
182
186
  ```
183
187
 
188
+ ### Wrap Blackwall behind your own app adapter
189
+
190
+ ```js
191
+ function createModelShield(shield) {
192
+ return {
193
+ async run({ messages, metadata, callProvider }) {
194
+ return shield.protectModelCall({
195
+ messages,
196
+ metadata,
197
+ callModel: callProvider,
198
+ });
199
+ },
200
+ };
201
+ }
202
+ ```
203
+
184
204
  ### Protect a strict JSON workflow
185
205
 
186
206
  ```js
@@ -218,6 +238,18 @@ const shield = new BlackwallShield({
218
238
  });
219
239
  ```
220
240
 
241
+ ### Next.js App Router plus Gemini pattern
242
+
243
+ For App Router route handlers, the cleanest production shape is:
244
+
245
+ - parse the request in `app/api/.../route.ts`
246
+ - use `preset: 'shadowFirst'` or a route-specific preset like `agentPlanner` or `documentReview`
247
+ - attach `route`, `feature`, and `tenantId` metadata
248
+ - wrap the Gemini SDK call with `createGeminiAdapter()` plus `protectWithAdapter()`
249
+ - ship `report.telemetry` and `onTelemetry` into a route-level log sink
250
+
251
+ That keeps request guarding, output review, and operator reporting in one path without scattering policy logic across the route.
252
+
221
253
  ### Route and domain examples
222
254
 
223
255
  For RAG:
@@ -273,6 +305,13 @@ const shield = new BlackwallShield({
273
305
  - Full provider wrapper: `protectWithAdapter()`
274
306
  - Tool firewall + RAG sanitizer: `ToolPermissionFirewall` + `RetrievalSanitizer`
275
307
 
308
+ ### False-positive tuning
309
+
310
+ - Start with route-level `shadowMode: true`
311
+ - Add `suppressPromptRules` only per route, not globally, so the reason for each suppression stays obvious
312
+ - Log `report.promptInjection.matches` and `report.telemetry.promptInjectionRuleHits` to explain why a request was flagged
313
+ - Review `summary.noisiestRoutes`, `summary.byFeature`, and `summary.weeklyBlockEstimate` before raising enforcement
314
+
276
315
  ### Operational telemetry summaries
277
316
 
278
317
  ```js
@@ -328,6 +367,12 @@ For Next.js, the most production-real patterns are App Router route handlers, se
328
367
 
329
368
  For Gemini-heavy apps, the bundled adapter now preserves system instructions plus mixed text/image/file parts so App Router handlers can wrap direct `@google/generative-ai` calls with less translation glue.
330
369
 
370
+ ## Enterprise Adoption Notes
371
+
372
+ - A controlled pilot is a good fit today when you want shadow-mode prompt and output protection without forcing hard blocking on every route immediately.
373
+ - If you prefer not to depend on Blackwall directly everywhere, wrap it behind your own internal model-security abstraction and expose only the contract your app teams need.
374
+ - For broader approval, focus rollout reviews on false-positive rates, noisiest routes, and latency budgets alongside jailbreak coverage.
375
+
331
376
  ## Release Commands
332
377
 
333
378
  - `npm run release:check` runs the JS test suite before release
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpdeva/blackwall-llm-shield-js",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Open-source JavaScript enterprise LLM protection toolkit for Node.js and Next.js",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Vish <hello@vish.au> (https://vish.au)",