@bulwark-ai/gateway 0.1.2 → 0.1.3

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
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="banner.svg" alt="Bulwark AI" width="100%">
2
+ <img src="https://raw.githubusercontent.com/antonmacius-droid/bulwark-ai/main/banner.svg" alt="Bulwark AI" width="100%">
3
3
  </p>
4
4
 
5
5
  <p align="center">
@@ -20,10 +20,10 @@
20
20
  npm install @bulwark-ai/gateway
21
21
  ```
22
22
 
23
- **131 tests passing** (42 unit + 89 integration with real LLM calls) | **Zero type errors** | MIT + BSL 1.1
23
+ **136 tests passing** (42 unit + 94 integration with real LLM calls) | **Zero type errors** | MIT + BSL 1.1
24
24
 
25
25
  <p align="center">
26
- <img src="demo.svg" alt="Bulwark AI Pipeline" width="100%">
26
+ <img src="https://raw.githubusercontent.com/antonmacius-droid/bulwark-ai/main/demo.svg" alt="Bulwark AI Pipeline" width="100%">
27
27
  </p>
28
28
 
29
29
  ## Quick Start
@@ -31,6 +31,15 @@ npm install @bulwark-ai/gateway
31
31
  ```typescript
32
32
  import { AIGateway } from "@bulwark-ai/gateway";
33
33
 
34
+ // Option A: Use a preset (recommended)
35
+ const gateway = new AIGateway({
36
+ mode: "balanced", // "strict" | "balanced" | "dev"
37
+ failMode: "fail-closed", // "fail-closed" | "fail-open"
38
+ providers: { openai: { apiKey: process.env.OPENAI_API_KEY! } },
39
+ database: "bulwark.db",
40
+ });
41
+
42
+ // Option B: Full control
34
43
  const gateway = new AIGateway({
35
44
  providers: {
36
45
  openai: { apiKey: process.env.OPENAI_API_KEY! },
@@ -56,13 +65,30 @@ const response = await gateway.chat({
56
65
 
57
66
  | Problem | Solution |
58
67
  |---------|---------|
59
- | Employees send PII to ChatGPT | Auto-detect & redact 15 PII types (input AND output) |
68
+ | Employees send PII to ChatGPT | Auto-detect & redact 14 PII types (input AND output) |
60
69
  | No visibility into AI spend | Per-user/team budgets with real-time cost tracking |
61
70
  | Prompt injection attacks | Built-in guard with 20+ detection patterns |
62
71
  | No audit trail | Every request logged — user, model, tokens, cost, duration |
63
72
  | GDPR/SOC 2 compliance | Right to erasure, data export, retention, anomaly detection |
64
73
  | Different teams use different tools | One gateway, 6 LLM providers, unified policies |
65
74
 
75
+ ## Config Presets
76
+
77
+ | Mode | PII | Budgets | Injection Guard | Best For |
78
+ |------|-----|---------|----------------|----------|
79
+ | `strict` | Block | 100K tokens, block | High sensitivity | Healthcare, finance, regulated |
80
+ | `balanced` | Redact | 500K tokens | Medium sensitivity | General production use |
81
+ | `dev` | Off | Off | On (audit only) | Development and testing |
82
+
83
+ ```typescript
84
+ // Strict mode — blocks PII, tight budgets, aggressive injection detection
85
+ new AIGateway({ mode: "strict", providers: { ... }, database: "bulwark.db" });
86
+
87
+ // Fail strategy — what happens when governance itself breaks
88
+ new AIGateway({ failMode: "fail-open", ... }); // availability-first (log failure, allow request)
89
+ new AIGateway({ failMode: "fail-closed", ... }); // security-first (block request if governance fails)
90
+ ```
91
+
66
92
  ## Features
67
93
 
68
94
  ### 6 LLM Providers — Auto-Routing
@@ -88,6 +114,8 @@ await gateway.chat({ model: "llama3.2", ... }); // → Ollama
88
114
 
89
115
  Azure OpenAI also supported via `AzureOpenAIProvider`.
90
116
 
117
+ **SSRF Protection**: All provider `baseUrl` values are validated — private IPs, cloud metadata endpoints (169.254.169.254), and non-HTTPS URLs are blocked automatically.
118
+
91
119
  ### Retry + Fallback
92
120
 
93
121
  ```typescript
@@ -117,7 +145,7 @@ pii: {
117
145
  action: "redact", // "block" | "redact" | "warn"
118
146
  types: ["email", "phone", "ssn", "credit_card", "iban",
119
147
  "ip_address", "passport", "name", "vat_number",
120
- "national_id", "medical_id"], // 15 built-in types
148
+ "national_id", "medical_id"], // 14 built-in types
121
149
  customPatterns: [
122
150
  { name: "employee_id", pattern: "EMP-\\d{6}", action: "redact" },
123
151
  ],
@@ -126,7 +154,9 @@ pii: {
126
154
 
127
155
  **Input**: PII redacted before sending to LLM. `"Contact john@test.com"` → `"Contact [EMAIL]"`
128
156
  **Output**: LLM response scanned and PII redacted before returning to user.
157
+ **Credit card Luhn validation**: Only real card numbers are flagged (rejects random digit sequences).
129
158
  **ReDoS protected**: Malicious regex patterns (nested quantifiers) automatically rejected.
159
+ **Security**: PII values are never stored in match objects or error responses — only type and position are recorded.
130
160
 
131
161
  ### Prompt Injection Guard
132
162
 
@@ -177,6 +207,8 @@ for await (const event of stream) {
177
207
  }
178
208
  ```
179
209
 
210
+ Streaming runs the identical governance pipeline as non-streaming — all messages scanned for PII and injection, system prompts hardened.
211
+
180
212
  ### Budget Enforcement + Rate Limiting
181
213
 
182
214
  ```typescript
@@ -306,6 +338,117 @@ curl http://localhost:3100/v1/chat \
306
338
  -d '{"model": "gpt-4o", "messages": [{"role": "user", "content": "Hello"}]}'
307
339
  ```
308
340
 
341
+ ## Integration Guides
342
+
343
+ ### Add to Existing Express App (5 min)
344
+
345
+ ```typescript
346
+ // 1. Install
347
+ // npm install @bulwark-ai/gateway
348
+
349
+ // 2. Create gateway (once, at app startup)
350
+ import { AIGateway, bulwarkRouter } from "@bulwark-ai/gateway";
351
+
352
+ const gateway = new AIGateway({
353
+ providers: { openai: { apiKey: process.env.OPENAI_API_KEY! } },
354
+ database: "bulwark.db",
355
+ pii: { enabled: true, action: "redact" },
356
+ budgets: { enabled: true, defaultUserLimit: 500_000 },
357
+ audit: true,
358
+ });
359
+
360
+ // 3. Mount (one line)
361
+ app.use("/api/ai", bulwarkRouter(gateway, {
362
+ auth: (req) => ({ userId: req.user.id, teamId: req.user.team }),
363
+ }));
364
+
365
+ // That's it. POST /api/ai/chat now has full governance.
366
+ ```
367
+
368
+ ### Add to Next.js App Router (5 min)
369
+
370
+ ```typescript
371
+ // app/api/ai/chat/route.ts
372
+ import { AIGateway, createNextHandler } from "@bulwark-ai/gateway";
373
+
374
+ const gateway = new AIGateway({ /* same config */ });
375
+
376
+ export const POST = createNextHandler(gateway, {
377
+ auth: (req) => ({
378
+ userId: req.headers.get("x-user-id") || undefined,
379
+ }),
380
+ });
381
+ ```
382
+
383
+ ### Add to Fastify (5 min)
384
+
385
+ ```typescript
386
+ import { AIGateway, bulwarkPlugin } from "@bulwark-ai/gateway";
387
+
388
+ const gateway = new AIGateway({ /* same config */ });
389
+
390
+ app.register(bulwarkPlugin, {
391
+ gateway,
392
+ prefix: "/api/ai",
393
+ auth: (req) => ({ userId: req.headers["x-user-id"] }),
394
+ });
395
+ ```
396
+
397
+ ### Programmatic Usage (No Framework)
398
+
399
+ ```typescript
400
+ // Use the gateway directly — no HTTP framework needed
401
+ const gateway = new AIGateway({ /* config */ });
402
+ await gateway.init();
403
+
404
+ const response = await gateway.chat({
405
+ model: "gpt-4o",
406
+ userId: "user-123",
407
+ messages: [{ role: "user", content: "Hello" }],
408
+ });
409
+
410
+ // Streaming
411
+ for await (const event of gateway.chatStream({ /* same params */ })) {
412
+ if (event.type === "delta") process.stdout.write(event.content);
413
+ }
414
+ ```
415
+
416
+ ## Best Practices
417
+
418
+ **Start small, add incrementally:**
419
+ 1. Start with `pii` + `audit` — instant visibility into what data flows through your AI
420
+ 2. Add `budgets` when you need cost control — set generous limits first, tighten later
421
+ 3. Add `policies` for specific compliance needs (block secrets, restrict topics)
422
+ 4. Add `rag` when you need document-grounded answers
423
+ 5. Add `fallbacks` for production reliability
424
+
425
+ **Multi-tenant SaaS:**
426
+ - Always pass `tenantId` from your auth layer — never from the request body
427
+ - Each tenant's data is isolated: RAG, audit, budgets, usage
428
+ - Use `gateway.tenants` API to manage tenant lifecycle
429
+
430
+ **Production checklist:**
431
+ - [ ] SQLite database with regular backups (Postgres support is experimental)
432
+ - [ ] PII detection enabled with `action: "redact"`
433
+ - [ ] Budget limits set per user and team
434
+ - [ ] Auth function validates tokens (never trust request body for identity)
435
+ - [ ] `BULWARK_LICENSE_KEY` set if using RAG/compliance modules commercially
436
+ - [ ] Graceful shutdown: `process.on("SIGTERM", () => gateway.shutdown())`
437
+ - [ ] Monitor audit logs for anomalies (see SOC 2 module)
438
+
439
+ ## Use Cases
440
+
441
+ | Use Case | Key Features |
442
+ |----------|-------------|
443
+ | **Internal AI chatbot** | PII redaction, audit trail, budget per department |
444
+ | **Customer-facing AI** | Prompt injection guard, content policies, rate limiting |
445
+ | **Multi-tenant SaaS** | Tenant isolation, per-org budgets, separate KB per tenant |
446
+ | **Healthcare AI** | HIPAA PHI logging, PII blocking, audit immutability |
447
+ | **EU compliance** | GDPR erasure/export, data residency checks, PII redaction |
448
+ | **Document Q&A** | RAG knowledge base, source citations, chunking strategies |
449
+ | **AI cost management** | Per-user budgets, alert thresholds, cost tracking per model |
450
+ | **Security-first AI** | Prompt hardening, injection guard, SSRF protection |
451
+
309
452
  ## Architecture
310
453
 
311
454
  ```
@@ -340,13 +483,13 @@ Your App
340
483
  | Store | Use Case | Config |
341
484
  |-------|----------|--------|
342
485
  | **SQLite** | Development, single instance | `database: "bulwark.db"` |
343
- | **PostgreSQL** | Production, pgvector for RAG | `database: "postgres://..."` |
486
+ | **PostgreSQL** | Production, pgvector for RAG (experimental — use SQLite for production) | `database: "postgres://..."` |
344
487
  | **Redis** | Rate limiting, response caching | `cache: new RedisCacheStore(redis)` |
345
488
  | **In-Memory** | Testing | Default |
346
489
 
347
490
  ## Test Suite
348
491
 
349
- **131 tests, 100% pass rate.**
492
+ **136 tests, 100% pass rate.**
350
493
 
351
494
  | Suite | Tests | What |
352
495
  |-------|-------|------|
@@ -377,6 +520,7 @@ Your App
377
520
  | Integration: RAG E2E | 3 | Ingest → search → chat with KB, tenant isolation, delete |
378
521
  | Integration: Retry + Fallback | 3 | Provider fallback, retry success, exhaustion |
379
522
  | Integration: Runtime Policies | 2 | Add/remove at runtime |
523
+ | Integration: Security Regression | 5 | Streaming PII/injection scan, prompt hardening, PII value protection |
380
524
 
381
525
  Run integration tests: `OPENAI_API_KEY=sk-xxx npx vitest run src/__tests__/integration.test.ts`
382
526
 
@@ -389,6 +533,7 @@ Run integration tests: `OPENAI_API_KEY=sk-xxx npx vitest run src/__tests__/integ
389
533
  | Embeddable | Yes (`npm install`) | No (proxy) | No | No |
390
534
  | PII Detection | 15 types + custom | Plugin | Partial | No |
391
535
  | Output PII Scan | Yes | No | No | No |
536
+ | Output PII Protection | Yes (non-streaming) | No | No | No |
392
537
  | Prompt Injection Guard | 20+ patterns | No | No | No |
393
538
  | Budget Control | Per-user/team | Yes | Yes | No |
394
539
  | Audit Log | Yes | Yes | Yes | Yes |
@@ -402,7 +547,7 @@ Run integration tests: `OPENAI_API_KEY=sk-xxx npx vitest run src/__tests__/integ
402
547
  | Redis Support | Yes | No | N/A | N/A |
403
548
  | Providers | 6 | 100+ | Many | Many |
404
549
  | Retry + Fallback | Yes | Yes | Yes | No |
405
- | Test Suite | 131 tests | ? | ? | ? |
550
+ | Test Suite | 136 tests | ? | ? | ? |
406
551
 
407
552
  ## License
408
553
 
package/dist/index.d.ts CHANGED
@@ -134,7 +134,26 @@ interface ProviderConfig {
134
134
  defaultModel?: string;
135
135
  }
136
136
  type GatewayProvider = "openai" | "anthropic" | "mistral" | "google" | "ollama" | "azure" | "custom";
137
+ /**
138
+ * Quick-start presets — use instead of manual config.
139
+ * - `strict`: All protections on, PII blocked, low budgets, injection guard high sensitivity
140
+ * - `balanced`: PII redacted, moderate budgets, injection guard medium (default behavior)
141
+ * - `dev`: Minimal protections, no budgets, audit only — for development/testing
142
+ */
143
+ type GatewayMode = "strict" | "balanced" | "dev";
144
+ /**
145
+ * What happens when the governance system itself fails (e.g., DB down, PII scan crashes).
146
+ * - `fail-closed`: Block the request (safe default — no request passes without governance)
147
+ * - `fail-open`: Allow the request through (availability-first — log the failure, don't block users)
148
+ */
149
+ type FailMode = "fail-closed" | "fail-open";
137
150
  interface GatewayConfig {
151
+ /** Quick-start preset — sets sensible defaults for all options. Individual settings override. */
152
+ mode?: GatewayMode;
153
+ /** What happens when governance checks fail (default: "fail-closed") */
154
+ failMode?: FailMode;
155
+ /** Global kill switch — set to false to block ALL requests instantly */
156
+ enabled?: boolean;
138
157
  /** LLM provider credentials */
139
158
  providers: Partial<Record<GatewayProvider, ProviderConfig>>;
140
159
  /** Database connection — SQLite path or Postgres URL */
@@ -158,6 +177,23 @@ interface GatewayConfig {
158
177
  input: number;
159
178
  output: number;
160
179
  }>;
180
+ /** Prompt injection guard config */
181
+ promptGuard?: {
182
+ enabled?: boolean;
183
+ action?: "block" | "warn";
184
+ sensitivity?: "low" | "medium" | "high";
185
+ };
186
+ /** LLM call timeout in ms (default: 120000) */
187
+ timeoutMs?: number;
188
+ /** Cache store for rate limiting + response caching */
189
+ cache?: unknown;
190
+ /** Rate limiting config */
191
+ rateLimit?: {
192
+ enabled?: boolean;
193
+ maxRequests?: number;
194
+ windowSeconds?: number;
195
+ scope?: "user" | "team" | "tenant" | "ip";
196
+ };
161
197
  /** Retry config for failed LLM calls */
162
198
  retry?: {
163
199
  /** Max retry attempts (default: 2) */
@@ -196,14 +232,18 @@ interface ChatRequest {
196
232
  teamId?: string;
197
233
  /** Tenant ID for multi-tenant isolation */
198
234
  tenantId?: string;
199
- /** RAG knowledge base to search */
200
- knowledgeBase?: string;
235
+ /** RAG knowledge base — set to true to enable, or pass a source ID to search specific source */
236
+ knowledgeBase?: boolean | string;
201
237
  /** Override PII settings for this request */
202
238
  pii?: boolean;
203
239
  /** Override policies for this request */
204
240
  skipPolicies?: boolean;
205
241
  /** Streaming */
206
242
  stream?: boolean;
243
+ /** Debug mode — returns pipeline trace showing what each governance step did */
244
+ debug?: boolean;
245
+ /** Custom metadata — stored in audit log for analytics (e.g., feature, product, environment) */
246
+ metadata?: Record<string, string | number | boolean>;
207
247
  /** Pass-through params (temperature, max_tokens, etc) */
208
248
  temperature?: number;
209
249
  maxTokens?: number;
@@ -233,6 +273,7 @@ interface ChatResponse {
233
273
  piiDetections?: {
234
274
  type: string;
235
275
  redacted: boolean;
276
+ direction?: "input" | "output";
236
277
  }[];
237
278
  /** Policy violations (if any) */
238
279
  policyViolations?: {
@@ -249,6 +290,13 @@ interface ChatResponse {
249
290
  auditId?: string;
250
291
  /** Request duration in ms */
251
292
  durationMs: number;
293
+ /** Debug trace — only present when `debug: true` in request */
294
+ trace?: {
295
+ stage: string;
296
+ result: string;
297
+ durationMs: number;
298
+ details?: unknown;
299
+ }[];
252
300
  }
253
301
 
254
302
  interface PolicyViolation {
@@ -416,7 +464,7 @@ declare class TenantManager {
416
464
  name?: string;
417
465
  settings?: Record<string, unknown>;
418
466
  }): void;
419
- /** Delete a tenant and ALL its data */
467
+ /** Delete a tenant and ALL its data (transactional) */
420
468
  delete(id: string): void;
421
469
  /** Get usage stats for a tenant */
422
470
  getUsage(id: string): {
@@ -466,6 +514,8 @@ declare class AIGateway {
466
514
  private readonly timeoutMs;
467
515
  private readonly retryConfig;
468
516
  private readonly fallbacks;
517
+ private readonly failMode;
518
+ private _enabled;
469
519
  private initialized;
470
520
  private shutdownRequested;
471
521
  private activeRequests;
@@ -526,6 +576,9 @@ declare class AIGateway {
526
576
  get policies(): PolicyEngine;
527
577
  /** Get the tenant manager (multi-tenant mode only) */
528
578
  get tenants(): TenantManager | null;
579
+ /** Kill switch — disable/enable the gateway at runtime */
580
+ get enabled(): boolean;
581
+ set enabled(value: boolean);
529
582
  }
530
583
  /** Bulwark-specific error with code and metadata */
531
584
  declare class BulwarkError extends Error {
@@ -551,9 +604,11 @@ interface ScanResult {
551
604
  redacted: boolean;
552
605
  }
553
606
  declare class PIIDetector {
554
- private config;
607
+ private _config;
555
608
  private activeTypes;
556
609
  constructor(config: PIIConfig);
610
+ /** Whether PII detection is enabled */
611
+ get config(): PIIConfig;
557
612
  /** Scan text for PII. Returns matches and optionally redacted text. */
558
613
  scan(text: string): ScanResult;
559
614
  }
@@ -608,6 +663,8 @@ declare class CostCalculator {
608
663
  }>);
609
664
  /** Calculate cost for a request. Returns USD amounts. */
610
665
  calculate(model: string, inputTokens: number, outputTokens: number): CostRecord;
666
+ /** Detect provider from model name */
667
+ private detectProvider;
611
668
  /** Update pricing for a model */
612
669
  setModelPrice(model: string, input: number, output: number): void;
613
670
  }
@@ -622,6 +679,8 @@ declare class BudgetManager {
622
679
  enabled: boolean;
623
680
  private config;
624
681
  private db;
682
+ /** Tracks which thresholds have already been crossed per scope to avoid duplicate alerts */
683
+ private crossedThresholds;
625
684
  constructor(db: Database, config: BudgetConfig);
626
685
  /** Check if a user/team has budget remaining this month */
627
686
  checkBudget(scope: {
@@ -678,6 +737,7 @@ declare function parsePDF(buffer: Buffer): Promise<string>;
678
737
  declare function parseHTML(html: string): string;
679
738
  /**
680
739
  * Parse a CSV string into text (row per line).
740
+ * Handles quoted fields containing commas.
681
741
  */
682
742
  declare function parseCSV(csv: string): string;
683
743
  /**
@@ -734,7 +794,10 @@ declare class MemoryCacheStore implements CacheStore {
734
794
  private store;
735
795
  private counters;
736
796
  private cleanupTimer;
737
- constructor();
797
+ private maxEntries;
798
+ constructor(options?: {
799
+ maxEntries?: number;
800
+ });
738
801
  /** Stop background cleanup — call on shutdown */
739
802
  close(): void;
740
803
  private cleanup;
@@ -869,19 +932,6 @@ interface StreamEvent {
869
932
  durationMs?: number;
870
933
  };
871
934
  }
872
- /**
873
- * Creates an async iterable of stream events.
874
- * Pre-flight checks (PII, policies, budget, rate limit) run before streaming starts.
875
- * Token counting and audit logging happen after stream completes.
876
- */
877
- declare function createStreamAdapter(providerStream: AsyncIterable<string>, metadata: {
878
- piiWarnings?: string[];
879
- sources?: {
880
- content: string;
881
- source: string;
882
- score: number;
883
- }[];
884
- }): AsyncGenerator<StreamEvent>;
885
935
 
886
936
  /**
887
937
  * GDPR Compliance Module
@@ -1419,7 +1469,13 @@ declare function createNextHandler(gateway: AIGateway, options?: {
1419
1469
  tenantId?: string;
1420
1470
  } | null;
1421
1471
  }): (req: RequestLike) => Promise<Response>;
1422
- declare function createNextAuditHandler(gateway: AIGateway): (req: RequestLike) => Promise<Response>;
1472
+ declare function createNextAuditHandler(gateway: AIGateway, options?: {
1473
+ auth?: (req: RequestLike) => {
1474
+ userId?: string;
1475
+ teamId?: string;
1476
+ tenantId?: string;
1477
+ } | null;
1478
+ }): (req: RequestLike) => Promise<Response>;
1423
1479
 
1424
1480
  /**
1425
1481
  * Fastify plugin for Bulwark AI.
@@ -1487,4 +1543,4 @@ declare function createAdminRouter(gateway: AIGateway, options: {
1487
1543
  auth: (req: unknown) => boolean;
1488
1544
  }): any;
1489
1545
 
1490
- export { AIGateway, type AdminDashboard, type AnomalyEvent, AnthropicProvider, type AuditEntry, type AuditQuery, type AuditStore, AzureOpenAIProvider, type BreachEvent, type BudgetAlert, type BudgetConfig, BudgetManager, BulwarkError, type CCPAConfig, CCPAManager, type CacheStore, type ChangeLogEntry, type ChatMessage, type ChatRequest, type ChatResponse, type Chunk, type ConsumerRequest, type ContentPolicy, CostCalculator, type CostRecord, type DataResidencyConfig, DataResidencyManager, type Database, type GDPRConfig, GDPRManager, type GatewayConfig, type GatewayProvider, GoogleProvider, type HIPAAConfig, HIPAAManager, HIPAA_IDENTIFIERS, type HealthStatus, KnowledgeBase, type KnowledgeSource, type LLMProvider, type LLMRequest, type LLMResponse, MODEL_PRICING, MemoryCacheStore, MistralProvider, OllamaProvider, OpenAIEmbeddings, OpenAIProvider, type PHIAccessLog, type PIIConfig, PIIDetector, type PIIMatch, type PIIType, PROVIDER_REGIONS, PolicyEngine, type ProcessingReport, PromptGuard, type PromptGuardConfig, type PromptGuardResult, type ProviderConfig, type RAGConfig, type RateLimitConfig, type RateLimitResult, RateLimiter, RedisCacheStore, ResponseCache, type ResponseCacheConfig, type SOC2Config, SOC2Manager, type SearchResult, type StreamEvent, type TenantConfig, TenantManager, type TransferAssessment, type UsageRecord, type UserDataExport, type VendorReport, bulwarkMiddleware, bulwarkPlugin, bulwarkRouter, chunkText, cosineSimilarity, createAdminRouter, createAuditStore, createDatabase, createNextAuditHandler, createNextHandler, createStreamAdapter, getDashboard, hardenSystemPrompt, parseCSV, parseDocument, parseHTML, parseMarkdown, parsePDF };
1546
+ export { AIGateway, type AdminDashboard, type AnomalyEvent, AnthropicProvider, type AuditEntry, type AuditQuery, type AuditStore, AzureOpenAIProvider, type BreachEvent, type BudgetAlert, type BudgetConfig, BudgetManager, BulwarkError, type CCPAConfig, CCPAManager, type CacheStore, type ChangeLogEntry, type ChatMessage, type ChatRequest, type ChatResponse, type Chunk, type ConsumerRequest, type ContentPolicy, CostCalculator, type CostRecord, type DataResidencyConfig, DataResidencyManager, type Database, type FailMode, type GDPRConfig, GDPRManager, type GatewayConfig, type GatewayMode, type GatewayProvider, GoogleProvider, type HIPAAConfig, HIPAAManager, HIPAA_IDENTIFIERS, type HealthStatus, KnowledgeBase, type KnowledgeSource, type LLMProvider, type LLMRequest, type LLMResponse, MODEL_PRICING, MemoryCacheStore, MistralProvider, OllamaProvider, OpenAIEmbeddings, OpenAIProvider, type PHIAccessLog, type PIIConfig, PIIDetector, type PIIMatch, type PIIType, PROVIDER_REGIONS, PolicyEngine, type ProcessingReport, PromptGuard, type PromptGuardConfig, type PromptGuardResult, type ProviderConfig, type RAGConfig, type RateLimitConfig, type RateLimitResult, RateLimiter, RedisCacheStore, ResponseCache, type ResponseCacheConfig, type SOC2Config, SOC2Manager, type SearchResult, type StreamEvent, type TenantConfig, TenantManager, type TransferAssessment, type UsageRecord, type UserDataExport, type VendorReport, bulwarkMiddleware, bulwarkPlugin, bulwarkRouter, chunkText, cosineSimilarity, createAdminRouter, createAuditStore, createDatabase, createNextAuditHandler, createNextHandler, getDashboard, hardenSystemPrompt, parseCSV, parseDocument, parseHTML, parseMarkdown, parsePDF };