avantgate 1.2.1 → 1.2.2
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 +41 -41
- package/dist/index.mjs +3 -3
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# 🛡️ AvantGate (`avantgate`)
|
|
2
2
|
|
|
3
|
-
> **The Zero-Infrastructure, In-Process
|
|
4
|
-
> Real-time
|
|
3
|
+
> **The Zero-Infrastructure, In-Process AI Application Firewall (AI-WAF) & Privacy Guard for TypeScript.**
|
|
4
|
+
> Real-time prompt guardrails, zero-egress PII redaction, anti-IDOR tool boundary, and pre-flight token defense **without hosting Docker, proxies, PostgreSQL, ClickHouse, or Redis.**
|
|
5
5
|
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
@@ -10,25 +10,25 @@
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
## ⚡ Why AvantGate? (
|
|
13
|
+
## ⚡ Why AvantGate? (Active Defense vs. Passive Proxies)
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
- ❌ **
|
|
17
|
-
- ❌ **
|
|
18
|
-
- ❌ **Passive
|
|
19
|
-
- ❌ **
|
|
15
|
+
Most LLM security and observability solutions force you into an unacceptable trade-off:
|
|
16
|
+
- ❌ **Data Egress & Privacy Hazards**: Cloud AI proxies (Helicone, Portkey) require routing your raw prompts through external third-party servers, creating compliance headaches and data leakage risks.
|
|
17
|
+
- ❌ **Network Latency Tax**: External proxies inject **+50ms to 250ms of network overhead** on every single LLM call.
|
|
18
|
+
- ❌ **Passive & Post-Mortem**: Traditional observability platforms (Langfuse, LangSmith) log token leaks and PII exposure *after* the damage is done and the money is spent.
|
|
19
|
+
- ❌ **Heavy Infrastructure**: Self-hosting requires spinning up Next.js + PostgreSQL + ClickHouse + Redis + S3 just to inspect prompt traffic.
|
|
20
20
|
|
|
21
|
-
### 🛡️ The AvantGate Philosophy:
|
|
22
|
-
**AvantGate runs entirely inside your existing application process.** No external
|
|
21
|
+
### 🛡️ The AvantGate Philosophy: In-Process Security Boundary
|
|
22
|
+
**AvantGate runs entirely inside your existing application process.** No external proxy, no raw prompts leaving your perimeter unredacted, and 0 ms network latency.
|
|
23
23
|
|
|
24
24
|
```mermaid
|
|
25
25
|
flowchart LR
|
|
26
|
-
App[Your Application] --> InputGuard[🛡️
|
|
27
|
-
InputGuard -->
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Providers -->
|
|
31
|
-
|
|
26
|
+
App[Your Application / Agent] --> InputGuard[🛡️ Ingress Guard<br/>Prompt Injection & Jailbreaks]
|
|
27
|
+
InputGuard --> PIIShield[🔒 In-Flight PII Redactor<br/>EU NIR, SPI, IBAN, Emails]
|
|
28
|
+
PIIShield --> TokenBudget[💰 Denial-of-Wallet Guard<br/>Pre-Flight Budget Bounds]
|
|
29
|
+
TokenBudget --> Providers["External LLM Providers<br/>(DeepSeek / Mistral / OpenAI)"]
|
|
30
|
+
Providers --> ToolBoundary[🛑 Tool Boundary & Anti-IDOR<br/>Dual-Channel DTO + Cycle Shield]
|
|
31
|
+
ToolBoundary --> SafeOutput[✅ Safe, Sanitized Execution]
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
---
|
|
@@ -43,34 +43,34 @@ Available as a **Managed Cloud Control Plane** or an **Out-of-Process High-Avail
|
|
|
43
43
|
|
|
44
44
|
---
|
|
45
45
|
|
|
46
|
-
## 🚀 Key Features
|
|
46
|
+
## 🚀 Key Security & Defense Features
|
|
47
47
|
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
48
|
+
- 🛡️ **Active Threat Defense & Prompt Guardrails**: Blocks prompt injections, DAN jailbreaks, adversarial noise, and system prompt exfiltration *before* external API invocation.
|
|
49
|
+
- 🔒 **Zero-Egress Data Loss Prevention (DLP)**: Automated local redaction of emails, phone numbers, IBAN/BIC, and French/EU identifiers (NIR SSN, SPI tax ID) before network egress.
|
|
50
|
+
- 🎭 **Dual-Channel Tool Isolation (`avantgate/agent`)**: Decouples sensitive database records (streamed out-of-band directly to client UIs) from minimal cognitive LLM context (`llmDto`), keeping confidential fields out of context windows.
|
|
51
|
+
- 🛑 **Anti-IDOR & Access Governance**: Enforces Row-Level Security (`dataAccessGuard`), business domain partitioning, and granular role-based permissions at the agent tool boundary.
|
|
52
|
+
- 💰 **Denial-of-Wallet & Pre-Flight Budgeting**: Enforces strict token and cent-level USD budget limits, rejecting abusive requests before paying for upstream inference.
|
|
53
|
+
- 🔀 **Zero-Downtime Multi-Model Failover**: Seamless client-side failover to fallback providers (or local zero-cost Ollama) when upstream APIs return HTTP 429/500 errors.
|
|
54
|
+
- 🔧 **Self-Repairing Structured Outputs**: Strict Zod schema compliance with automated heuristic markdown/JSON repair if the model hallucinates formatting.
|
|
55
|
+
- 📡 **Zero-Dependency Telemetry Bridge (`HttpTelemetryExporter`, `PlatformStorageAdapter`)**: Mirror execution audits and hierarchical tool traces asynchronously without adding heavy external dependencies.
|
|
56
|
+
- 📦 **100% Framework Agnostic**: Works seamlessly in Next.js, Express, Fastify, NestJS, Cloudflare Workers, AWS Lambda, or CLI scripts.
|
|
56
57
|
|
|
57
58
|
---
|
|
58
59
|
|
|
59
|
-
## 📊 Comparison:
|
|
60
|
-
|
|
61
|
-
| Capability |
|
|
62
|
-
|
|
63
|
-
| **
|
|
64
|
-
| **
|
|
65
|
-
| **
|
|
66
|
-
| **
|
|
67
|
-
| **
|
|
68
|
-
| **
|
|
69
|
-
| **
|
|
70
|
-
| **
|
|
71
|
-
| **
|
|
72
|
-
| **
|
|
73
|
-
| **Hierarchical Session Replay** | ❌ Flat span waterfall | ✅ **Causality Tree + Dual-Channel Isolation** |
|
|
60
|
+
## 📊 Comparison: Direct LLM vs. Cloud AI Proxy vs. AvantGate
|
|
61
|
+
|
|
62
|
+
| Capability & Security Boundary | Direct LLM Calls | Cloud AI Proxy (Helicone / Portkey) | 🛡️ **AvantGate (`avantgate`)** |
|
|
63
|
+
|---|:---:|:---:|:---:|
|
|
64
|
+
| **Security Architecture** | None (Direct HTTP) | External Cloud Proxy | **In-Process Security Boundary** |
|
|
65
|
+
| **Data Privacy & DLP** | ❌ Raw PII leaves perimeter | ⚠️ Unencrypted prompts transit proxy | ✅ **Sanitized in-flight locally (Zero Egress)** |
|
|
66
|
+
| **Network Latency Overhead** | 0 ms | ❌ +50ms - 250ms (Extra hop) | ✅ **0 ms (In-process execution)** |
|
|
67
|
+
| **Prompt Injection Defense** | ❌ None | ⚠️ Passive detection | ✅ **Active Pre-Flight Guard (Blocks before spend)** |
|
|
68
|
+
| **Agent Tool Data Isolation** | ❌ Entire DB entity in LLM | ❌ No agent tool awareness | ✅ **Dual-Channel DTO (`clientDto` vs `llmDto`)** |
|
|
69
|
+
| **Row-Level Security & Anti-IDOR** | ❌ Manual code | ❌ Not supported | ✅ **Native `dataAccessGuard` & Domain Boundary** |
|
|
70
|
+
| **Infrastructure Overhead** | None | SaaS Subscription | ✅ **$0 / Zero Servers (Pure npm package)** |
|
|
71
|
+
| **Multi-Model Failover** | ❌ App crashes | ⚠️ Proxy-dependent | ✅ **Built-in Fallback Router & Exponential Retry** |
|
|
72
|
+
| **Zod Schema Auto-Repair** | ❌ No | ❌ No | ✅ **Built-in JSON Heuristic Repair** |
|
|
73
|
+
| **Hierarchical Session Replay** | ❌ None | ⚠️ Flat span waterfall | ✅ **Causality Tree + Dual-Channel Isolation** |
|
|
74
74
|
|
|
75
75
|
---
|
|
76
76
|
|
|
@@ -100,7 +100,7 @@ Comprehensive guides, copy-pasteable integration recipes, and architectural refe
|
|
|
100
100
|
|
|
101
101
|
| Guide | Description |
|
|
102
102
|
|---|---|
|
|
103
|
-
| **[Code Examples & Recipes](docs/examples.md)** |
|
|
103
|
+
| **[Code Examples & Recipes](docs/examples.md)** | End-to-end security guardrails, PII redaction, anti-IDOR tool boundaries, cost tracking, Zod self-repair, and multi-model failover. |
|
|
104
104
|
| **[Decoupled Pricing & DB Adapters](docs/pricing.md)** | Dynamic token pricing, database integration (Prisma / PostgreSQL / Drizzle), in-memory TTL caching, and runtime overrides. |
|
|
105
105
|
| **[Durable Agent Harness & Tool Isolation](docs/agent.md)** | Serverless durable step execution, Human-in-the-Loop suspension, dual-channel DTO tool isolation, and telemetry streaming. |
|
|
106
106
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sanitizePII
|
|
3
|
+
} from "./chunk-DVCF4CSV.mjs";
|
|
1
4
|
import {
|
|
2
5
|
extractAndCleanJSON,
|
|
3
6
|
validateWithZod
|
|
4
7
|
} from "./chunk-CO26LNFD.mjs";
|
|
5
|
-
import {
|
|
6
|
-
sanitizePII
|
|
7
|
-
} from "./chunk-DVCF4CSV.mjs";
|
|
8
8
|
|
|
9
9
|
// src/types.ts
|
|
10
10
|
var ConfigurationError = class extends Error {
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "avantgate",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "Zero-infrastructure, in-process
|
|
3
|
+
"version": "1.2.2",
|
|
4
|
+
"description": "Zero-infrastructure, in-process AI Application Firewall (AI-WAF) & privacy control plane for TypeScript: real-time prompt guardrails, zero-egress PII redaction, agent tool isolation, anti-IDOR defense, pre-flight token budgets, and multi-model failover.",
|
|
5
5
|
"author": "Antigravity & LexTalk Team",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"avantgate",
|
|
9
|
+
"ai-waf",
|
|
10
|
+
"guardrails",
|
|
11
|
+
"prompt-injection",
|
|
12
|
+
"pii-redaction",
|
|
13
|
+
"data-privacy",
|
|
14
|
+
"cybersecurity",
|
|
9
15
|
"llm",
|
|
10
16
|
"ai",
|
|
11
17
|
"agent",
|
|
18
|
+
"dual-channel",
|
|
19
|
+
"token-budget",
|
|
20
|
+
"cost-control",
|
|
21
|
+
"durable-execution",
|
|
22
|
+
"human-in-the-loop",
|
|
12
23
|
"observability",
|
|
13
24
|
"telemetry",
|
|
14
25
|
"session-replay",
|
|
15
26
|
"helicone-alternative",
|
|
16
|
-
"agentops-alternative",
|
|
17
|
-
"durable-execution",
|
|
18
|
-
"human-in-the-loop",
|
|
19
|
-
"dual-channel",
|
|
20
|
-
"cost-control",
|
|
21
|
-
"token-budget",
|
|
22
|
-
"guardrails",
|
|
23
|
-
"langfuse-alternative",
|
|
24
27
|
"failover",
|
|
25
|
-
"pii-redaction",
|
|
26
28
|
"finance",
|
|
27
29
|
"accounting",
|
|
28
|
-
"prompt-builder",
|
|
29
|
-
"prompt-template",
|
|
30
30
|
"deepseek",
|
|
31
31
|
"mistral",
|
|
32
32
|
"openai",
|