avantgate 1.2.1 → 1.3.0

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,7 +1,7 @@
1
1
  # 🛡️ AvantGate (`avantgate`)
2
2
 
3
- > **The Zero-Infrastructure, In-Process LLM Control Plane for TypeScript.**
4
- > Real-time cost control, token budgets, PII redaction, prompt guardrails, and multi-model failover **without hosting Docker, PostgreSQL, ClickHouse, or Redis.**
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
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-Strict-blue?logo=typescript)](https://www.typescriptlang.org/)
@@ -10,25 +10,25 @@
10
10
 
11
11
  ---
12
12
 
13
- ## ⚡ Why AvantGate? (The Problem with Heavy Observability)
13
+ ## ⚡ Why AvantGate? (Active Defense vs. Passive Proxies)
14
14
 
15
- Traditional LLM observability stacks like **Langfuse**, **Helicone**, or **LangSmith** are great, but for 90% of production apps, self-hosting them is a nightmare:
16
- - ❌ **Heavy Infrastructure**: Requires spinning up Next.js + PostgreSQL + ClickHouse + Redis + S3.
17
- - ❌ **VPS & Cloud Costs**: $30 to $100+/month just to monitor API calls.
18
- - ❌ **Passive / Post-Mortem**: They log errors and costs *after* you have already paid for the wasted tokens.
19
- - ❌ **Egress Latency & Privacy**: Sends user prompts over external HTTP networks.
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: Active In-Process Control
22
- **AvantGate runs entirely inside your existing application process.** No external containers, no database required, no network latency.
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[🛡️ Input & PII Guard]
27
- InputGuard --> TokenBudget[💰 Token Budget Guard]
28
- TokenBudget --> FallbackRouter[🔀 Fallback Router]
29
- FallbackRouter --> Providers["LLM Providers (DeepSeek / Mistral / Ollama)"]
30
- Providers --> JSONRepair[🔧 Zod JSON Self-Repair]
31
- JSONRepair --> Audit[📊 Local Cost Ledger & Telemetry]
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
- - 💰 **Pre-Flight Token Budgeting**: Rejects or truncates requests exceeding budget *before* invoking external APIs.
49
- - 🏷️ **Real-Time Cost Ledger**: Exact cent-level cost tracking calculated instantly across models (DeepSeek, Mistral, OpenAI, Anthropic, OpenRouter, and $0 local Ollama).
50
- - 🛡️ **Active Security & PII Redaction**: In-flight masking of emails, phone numbers, and French/EU identifiers before sending to cloud providers. Blocks prompt injection & jailbreaks.
51
- - 🔀 **Zero-Downtime Multi-Model Failover**: If DeepSeek or Mistral returns HTTP 429/500, seamlessly failover to a backup provider (or local Ollama) in milliseconds.
52
- - 🔧 **Self-Repairing Structured Outputs**: Strict Zod runtime validation with automated markdown/JSON repair if the LLM hallucinates formatting.
53
- - 🤖 **Durable Agent Harness & PII Shield (`avantgate/agent`)**: Serverless memoized step execution (`step.run()`), native Human-in-the-Loop approval (`step.waitForApproval()`), and Dual-Channel tool data isolation without Temporal or Redis.
54
- - 📡 **Zero-Dependency Telemetry Bridge (`HttpTelemetryExporter`, `PlatformStorageAdapter`)**: Mirror in-process executions and hierarchical tool traces asynchronously to any HTTP sink or observability endpoint with $0 external npm dependencies.
55
- - 📦 **100% Framework Agnostic**: Works in Next.js, Express, Fastify, NestJS, Cloudflare Workers, AWS Lambda, or CLI scripts.
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: Langfuse vs. AvantGate
60
-
61
- | Capability | Langfuse (Self-Hosted) | AvantGate (`avantgate`) |
62
- |---|:---:|:---:|
63
- | **Infrastructure Required** | Docker + Postgres + ClickHouse + Redis | **Zero Infrastructure** (Pure npm package) |
64
- | **Hosting Cost** | $30 - $100 / month | **$0 / month** (Runs inside your app) |
65
- | **Token Budget Enforcement** | ❌ Passive logging only | ✅ **Active Pre-Flight Guard** (Blocks before spending) |
66
- | **In-Flight PII Redaction** | ❌ Logs all raw data | ✅ **Automatic local masking** before API dispatch |
67
- | **Multi-Provider Failover** | ❌ No | ✅ **Built-in Fallback Router & Exponential Retry** |
68
- | **Zod Schema Auto-Repair** | ❌ No | ✅ **Built-in JSON Heuristic Repair** |
69
- | **Durable Workflow & HITL** | Requires Temporal / Inngest | ✅ **Built-in In-Process Step Runner & HITL** |
70
- | **Tool PII & Dual-Channel** | ❌ No | ✅ **Built-in `createIsolatedTool`** |
71
- | **Telemetry Network Latency** | ❌ +50ms - 200ms per trace call | ✅ **0 ms** (In-process memory accounting) |
72
- | **Central Web Dashboard** | Heavy self-hosted web app | ✅ **Optional Remote Sink** (Plug any HTTP endpoint via `PlatformStorageAdapter`) |
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)** | Full walkthroughs for cost tracking, Zod self-repair, multi-model failover, PII masking, pre-flight budgets, and the prompt engine. |
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
 
@@ -27,11 +27,13 @@ __export(agent_exports, {
27
27
  DtoValidationError: () => DtoValidationError,
28
28
  HttpTelemetryExporter: () => HttpTelemetryExporter,
29
29
  KeyValueStorageAdapter: () => KeyValueStorageAdapter,
30
+ MaxImpactToolStrategy: () => MaxImpactToolStrategy,
30
31
  MemoryStorageAdapter: () => MemoryStorageAdapter,
31
32
  PhaseBasedToolStrategy: () => PhaseBasedToolStrategy,
32
33
  PiiLeakError: () => PiiLeakError,
33
34
  PlatformStorageAdapter: () => PlatformStorageAdapter,
34
35
  PrismaStorageAdapter: () => PrismaStorageAdapter,
36
+ ReadOnlyToolStrategy: () => ReadOnlyToolStrategy,
35
37
  RoleBasedToolStrategy: () => RoleBasedToolStrategy,
36
38
  SQLiteStorageAdapter: () => SQLiteStorageAdapter,
37
39
  StepExecutionError: () => StepExecutionError,
@@ -329,6 +331,8 @@ function createIsolatedTool(config) {
329
331
  const toolAlias = config.alias;
330
332
  const clientCallback = config.clientDto;
331
333
  const toolIdentifier = toolAlias || config.name;
334
+ const toolImpact = config.impact ?? "READ_ONLY";
335
+ const requireApproval = config.requireApproval ?? toolImpact === "DESTRUCTIVE";
332
336
  const tool = {
333
337
  description: config.description,
334
338
  parameters: config.parameters,
@@ -340,8 +344,8 @@ function createIsolatedTool(config) {
340
344
  _domain: config.domain,
341
345
  _resource: config.resource,
342
346
  _roles: config.roles ? Object.freeze([...config.roles]) : void 0,
343
- _permissions: config.permissions ? Object.freeze([...config.permissions]) : void 0,
344
- _requireApproval: config.requireApproval ?? false,
347
+ _impact: toolImpact,
348
+ _requireApproval: requireApproval,
345
349
  _lastPiiFilteredCount: 0,
346
350
  _lastInvalidationTags: void 0,
347
351
  async execute(args, context) {
@@ -475,7 +479,7 @@ function normalizeToolDefinition(toolDef) {
475
479
  domain: toolDef._domain,
476
480
  resource: toolDef._resource,
477
481
  roles: toolDef._roles ? Array.from(toolDef._roles) : void 0,
478
- permissions: toolDef._permissions ? Array.from(toolDef._permissions) : void 0,
482
+ impact: toolDef._impact ?? "READ_ONLY",
479
483
  requireApproval: toolDef._requireApproval,
480
484
  tool: toolDef
481
485
  };
@@ -483,7 +487,7 @@ function normalizeToolDefinition(toolDef) {
483
487
  const id = toolDef.id || toolDef.name || toolDef.tool?._toolId;
484
488
  const publicName = toolDef.alias || toolDef.name || toolDef.tool?._toolAlias || toolDef.tool?._toolName;
485
489
  const roles = toolDef.roles ?? (toolDef.tool?._roles ? Array.from(toolDef.tool._roles) : toolDef.requiredRoles);
486
- const permissions = toolDef.permissions ?? (toolDef.tool?._permissions ? Array.from(toolDef.tool._permissions) : void 0);
490
+ const impact = toolDef.impact ?? toolDef.tool?._impact ?? "READ_ONLY";
487
491
  return {
488
492
  ...toolDef,
489
493
  id,
@@ -492,7 +496,7 @@ function normalizeToolDefinition(toolDef) {
492
496
  domain: toolDef.domain ?? toolDef.tool?._domain,
493
497
  resource: toolDef.resource ?? toolDef.tool?._resource,
494
498
  roles,
495
- permissions,
499
+ impact,
496
500
  requireApproval: toolDef.requireApproval ?? toolDef.tool?._requireApproval
497
501
  };
498
502
  }
@@ -515,7 +519,7 @@ function toDescriptor(tool) {
515
519
  domain: tool.domain,
516
520
  resource: tool.resource,
517
521
  roles: tool.roles ?? tool.requiredRoles,
518
- permissions: tool.permissions,
522
+ impact: tool.impact ?? "READ_ONLY",
519
523
  requireApproval: tool.requireApproval,
520
524
  cacheTTL: tool.tool._cacheTTL,
521
525
  tags: tool.tags
@@ -603,6 +607,12 @@ var ToolRegistry = class _ToolRegistry {
603
607
  return roles.some((role) => roleSet.has(role));
604
608
  });
605
609
  }
610
+ /**
611
+ * Filters tools matching a specific physical impact profile (READ_ONLY, MUTATIVE, DESTRUCTIVE).
612
+ */
613
+ getByImpact(impact) {
614
+ return this.getAll().filter((item) => (item.impact ?? "READ_ONLY") === impact);
615
+ }
606
616
  /**
607
617
  * Exports headless technical descriptors without UI rendering coupling.
608
618
  */
@@ -614,6 +624,9 @@ var ToolRegistry = class _ToolRegistry {
614
624
  if (filter?.role) {
615
625
  list = list.filter((item) => matchesRoleFilter(item, filter.role));
616
626
  }
627
+ if (filter?.impact) {
628
+ list = list.filter((item) => (item.impact ?? "READ_ONLY") === filter.impact);
629
+ }
617
630
  return list.map(toDescriptor);
618
631
  }
619
632
  /**
@@ -641,6 +654,18 @@ var ToolRegistry = class _ToolRegistry {
641
654
  };
642
655
 
643
656
  // src/agent/strategy.ts
657
+ var IMPACT_WEIGHTS = {
658
+ READ_ONLY: 1,
659
+ MUTATIVE: 2,
660
+ DESTRUCTIVE: 3
661
+ };
662
+ function matchesMaxImpact(tool, maxImpact) {
663
+ if (!maxImpact) {
664
+ return true;
665
+ }
666
+ const toolImpact = tool.impact ?? "READ_ONLY";
667
+ return IMPACT_WEIGHTS[toolImpact] <= IMPACT_WEIGHTS[maxImpact];
668
+ }
644
669
  var PhaseBasedToolStrategy = class {
645
670
  selectTools(tools, context) {
646
671
  if (!context.phase) {
@@ -673,6 +698,24 @@ var RoleBasedToolStrategy = class {
673
698
  });
674
699
  }
675
700
  };
701
+ var ReadOnlyToolStrategy = class {
702
+ selectTools(tools, _context) {
703
+ return tools.filter((tool) => (tool.impact ?? "READ_ONLY") === "READ_ONLY");
704
+ }
705
+ };
706
+ var MaxImpactToolStrategy = class {
707
+ maxImpact;
708
+ constructor(maxImpact) {
709
+ this.maxImpact = maxImpact;
710
+ }
711
+ selectTools(tools, _context) {
712
+ const maxWeight = IMPACT_WEIGHTS[this.maxImpact];
713
+ return tools.filter((tool) => {
714
+ const toolImpact = tool.impact ?? "READ_ONLY";
715
+ return IMPACT_WEIGHTS[toolImpact] <= maxWeight;
716
+ });
717
+ }
718
+ };
676
719
  function matchesDomain(tool, allowedDomains) {
677
720
  if (!allowedDomains) {
678
721
  return true;
@@ -696,23 +739,18 @@ function matchesRoles(tool, context) {
696
739
  }
697
740
  return toolRoles.some((roleName) => userRoles.includes(roleName));
698
741
  }
699
- function matchesPermissions(tool, context) {
700
- if (!tool.permissions || tool.permissions.length === 0) {
701
- return true;
702
- }
703
- const userPermissions = context.permissions ?? [];
704
- return tool.permissions.every((permissionName) => userPermissions.includes(permissionName));
705
- }
706
742
  var AccessControlToolStrategy = class {
707
743
  allowedDomains;
744
+ maxImpact;
708
745
  constructor(options) {
709
746
  if (options?.allowedDomains) {
710
747
  this.allowedDomains = new Set(options.allowedDomains);
711
748
  }
749
+ this.maxImpact = options?.maxImpact;
712
750
  }
713
751
  selectTools(tools, context) {
714
752
  return tools.filter(
715
- (tool) => matchesDomain(tool, this.allowedDomains) && matchesRoles(tool, context) && matchesPermissions(tool, context)
753
+ (tool) => matchesDomain(tool, this.allowedDomains) && matchesRoles(tool, context) && matchesMaxImpact(tool, this.maxImpact)
716
754
  );
717
755
  }
718
756
  };
@@ -1971,11 +2009,13 @@ var HttpTelemetryExporter = class {
1971
2009
  DtoValidationError,
1972
2010
  HttpTelemetryExporter,
1973
2011
  KeyValueStorageAdapter,
2012
+ MaxImpactToolStrategy,
1974
2013
  MemoryStorageAdapter,
1975
2014
  PhaseBasedToolStrategy,
1976
2015
  PiiLeakError,
1977
2016
  PlatformStorageAdapter,
1978
2017
  PrismaStorageAdapter,
2018
+ ReadOnlyToolStrategy,
1979
2019
  RoleBasedToolStrategy,
1980
2020
  SQLiteStorageAdapter,
1981
2021
  StepExecutionError,
@@ -226,6 +226,8 @@ function createIsolatedTool(config) {
226
226
  const toolAlias = config.alias;
227
227
  const clientCallback = config.clientDto;
228
228
  const toolIdentifier = toolAlias || config.name;
229
+ const toolImpact = config.impact ?? "READ_ONLY";
230
+ const requireApproval = config.requireApproval ?? toolImpact === "DESTRUCTIVE";
229
231
  const tool = {
230
232
  description: config.description,
231
233
  parameters: config.parameters,
@@ -237,8 +239,8 @@ function createIsolatedTool(config) {
237
239
  _domain: config.domain,
238
240
  _resource: config.resource,
239
241
  _roles: config.roles ? Object.freeze([...config.roles]) : void 0,
240
- _permissions: config.permissions ? Object.freeze([...config.permissions]) : void 0,
241
- _requireApproval: config.requireApproval ?? false,
242
+ _impact: toolImpact,
243
+ _requireApproval: requireApproval,
242
244
  _lastPiiFilteredCount: 0,
243
245
  _lastInvalidationTags: void 0,
244
246
  async execute(args, context) {
@@ -372,7 +374,7 @@ function normalizeToolDefinition(toolDef) {
372
374
  domain: toolDef._domain,
373
375
  resource: toolDef._resource,
374
376
  roles: toolDef._roles ? Array.from(toolDef._roles) : void 0,
375
- permissions: toolDef._permissions ? Array.from(toolDef._permissions) : void 0,
377
+ impact: toolDef._impact ?? "READ_ONLY",
376
378
  requireApproval: toolDef._requireApproval,
377
379
  tool: toolDef
378
380
  };
@@ -380,7 +382,7 @@ function normalizeToolDefinition(toolDef) {
380
382
  const id = toolDef.id || toolDef.name || toolDef.tool?._toolId;
381
383
  const publicName = toolDef.alias || toolDef.name || toolDef.tool?._toolAlias || toolDef.tool?._toolName;
382
384
  const roles = toolDef.roles ?? (toolDef.tool?._roles ? Array.from(toolDef.tool._roles) : toolDef.requiredRoles);
383
- const permissions = toolDef.permissions ?? (toolDef.tool?._permissions ? Array.from(toolDef.tool._permissions) : void 0);
385
+ const impact = toolDef.impact ?? toolDef.tool?._impact ?? "READ_ONLY";
384
386
  return {
385
387
  ...toolDef,
386
388
  id,
@@ -389,7 +391,7 @@ function normalizeToolDefinition(toolDef) {
389
391
  domain: toolDef.domain ?? toolDef.tool?._domain,
390
392
  resource: toolDef.resource ?? toolDef.tool?._resource,
391
393
  roles,
392
- permissions,
394
+ impact,
393
395
  requireApproval: toolDef.requireApproval ?? toolDef.tool?._requireApproval
394
396
  };
395
397
  }
@@ -412,7 +414,7 @@ function toDescriptor(tool) {
412
414
  domain: tool.domain,
413
415
  resource: tool.resource,
414
416
  roles: tool.roles ?? tool.requiredRoles,
415
- permissions: tool.permissions,
417
+ impact: tool.impact ?? "READ_ONLY",
416
418
  requireApproval: tool.requireApproval,
417
419
  cacheTTL: tool.tool._cacheTTL,
418
420
  tags: tool.tags
@@ -500,6 +502,12 @@ var ToolRegistry = class _ToolRegistry {
500
502
  return roles.some((role) => roleSet.has(role));
501
503
  });
502
504
  }
505
+ /**
506
+ * Filters tools matching a specific physical impact profile (READ_ONLY, MUTATIVE, DESTRUCTIVE).
507
+ */
508
+ getByImpact(impact) {
509
+ return this.getAll().filter((item) => (item.impact ?? "READ_ONLY") === impact);
510
+ }
503
511
  /**
504
512
  * Exports headless technical descriptors without UI rendering coupling.
505
513
  */
@@ -511,6 +519,9 @@ var ToolRegistry = class _ToolRegistry {
511
519
  if (filter?.role) {
512
520
  list = list.filter((item) => matchesRoleFilter(item, filter.role));
513
521
  }
522
+ if (filter?.impact) {
523
+ list = list.filter((item) => (item.impact ?? "READ_ONLY") === filter.impact);
524
+ }
514
525
  return list.map(toDescriptor);
515
526
  }
516
527
  /**
@@ -538,6 +549,18 @@ var ToolRegistry = class _ToolRegistry {
538
549
  };
539
550
 
540
551
  // src/agent/strategy.ts
552
+ var IMPACT_WEIGHTS = {
553
+ READ_ONLY: 1,
554
+ MUTATIVE: 2,
555
+ DESTRUCTIVE: 3
556
+ };
557
+ function matchesMaxImpact(tool, maxImpact) {
558
+ if (!maxImpact) {
559
+ return true;
560
+ }
561
+ const toolImpact = tool.impact ?? "READ_ONLY";
562
+ return IMPACT_WEIGHTS[toolImpact] <= IMPACT_WEIGHTS[maxImpact];
563
+ }
541
564
  var PhaseBasedToolStrategy = class {
542
565
  selectTools(tools, context) {
543
566
  if (!context.phase) {
@@ -570,6 +593,24 @@ var RoleBasedToolStrategy = class {
570
593
  });
571
594
  }
572
595
  };
596
+ var ReadOnlyToolStrategy = class {
597
+ selectTools(tools, _context) {
598
+ return tools.filter((tool) => (tool.impact ?? "READ_ONLY") === "READ_ONLY");
599
+ }
600
+ };
601
+ var MaxImpactToolStrategy = class {
602
+ maxImpact;
603
+ constructor(maxImpact) {
604
+ this.maxImpact = maxImpact;
605
+ }
606
+ selectTools(tools, _context) {
607
+ const maxWeight = IMPACT_WEIGHTS[this.maxImpact];
608
+ return tools.filter((tool) => {
609
+ const toolImpact = tool.impact ?? "READ_ONLY";
610
+ return IMPACT_WEIGHTS[toolImpact] <= maxWeight;
611
+ });
612
+ }
613
+ };
573
614
  function matchesDomain(tool, allowedDomains) {
574
615
  if (!allowedDomains) {
575
616
  return true;
@@ -593,23 +634,18 @@ function matchesRoles(tool, context) {
593
634
  }
594
635
  return toolRoles.some((roleName) => userRoles.includes(roleName));
595
636
  }
596
- function matchesPermissions(tool, context) {
597
- if (!tool.permissions || tool.permissions.length === 0) {
598
- return true;
599
- }
600
- const userPermissions = context.permissions ?? [];
601
- return tool.permissions.every((permissionName) => userPermissions.includes(permissionName));
602
- }
603
637
  var AccessControlToolStrategy = class {
604
638
  allowedDomains;
639
+ maxImpact;
605
640
  constructor(options) {
606
641
  if (options?.allowedDomains) {
607
642
  this.allowedDomains = new Set(options.allowedDomains);
608
643
  }
644
+ this.maxImpact = options?.maxImpact;
609
645
  }
610
646
  selectTools(tools, context) {
611
647
  return tools.filter(
612
- (tool) => matchesDomain(tool, this.allowedDomains) && matchesRoles(tool, context) && matchesPermissions(tool, context)
648
+ (tool) => matchesDomain(tool, this.allowedDomains) && matchesRoles(tool, context) && matchesMaxImpact(tool, this.maxImpact)
613
649
  );
614
650
  }
615
651
  };
@@ -1867,11 +1903,13 @@ export {
1867
1903
  DtoValidationError,
1868
1904
  HttpTelemetryExporter,
1869
1905
  KeyValueStorageAdapter,
1906
+ MaxImpactToolStrategy,
1870
1907
  MemoryStorageAdapter,
1871
1908
  PhaseBasedToolStrategy,
1872
1909
  PiiLeakError,
1873
1910
  PlatformStorageAdapter,
1874
1911
  PrismaStorageAdapter,
1912
+ ReadOnlyToolStrategy,
1875
1913
  RoleBasedToolStrategy,
1876
1914
  SQLiteStorageAdapter,
1877
1915
  StepExecutionError,
@@ -1 +1 @@
1
- {"version":3,"file":"isolated-tool.d.ts","sourceRoot":"","sources":["../../src/agent/isolated-tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAElB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAoHjB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,GAAG,GAAG,EACX,OAAO,GAAG,GAAG,EACb,OAAO,GAAG,OAAO,EACjB,UAAU,GAAG,OAAO,EAEpB,MAAM,EAAE,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,GAC9D,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CA8DlC"}
1
+ {"version":3,"file":"isolated-tool.d.ts","sourceRoot":"","sources":["../../src/agent/isolated-tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAElB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAoHjB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,GAAG,GAAG,EACX,OAAO,GAAG,GAAG,EACb,OAAO,GAAG,OAAO,EACjB,UAAU,GAAG,OAAO,EAEpB,MAAM,EAAE,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,GAC9D,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAgElC"}
@@ -1,4 +1,4 @@
1
- import type { RegisteredTool, ToolDescriptor, VercelAiCoreTool } from "./types";
1
+ import type { RegisteredTool, ToolDescriptor, ToolImpact, VercelAiCoreTool } from "./types";
2
2
  export interface ToRecordOptions {
3
3
  anonymize?: boolean;
4
4
  domain?: string;
@@ -6,9 +6,10 @@ export interface ToRecordOptions {
6
6
  export interface ToolDescriptorFilter {
7
7
  domain?: string;
8
8
  role?: string;
9
+ impact?: ToolImpact;
9
10
  }
10
11
  /**
11
- * Centralized catalog for managing and filtering tools with permissions, domains and metadata.
12
+ * Centralized catalog for managing and filtering tools with roles, domains, impact and metadata.
12
13
  * Supports O(1) Key-Value lookup by technical ID and by public alias.
13
14
  */
14
15
  export declare class ToolRegistry {
@@ -54,6 +55,10 @@ export declare class ToolRegistry {
54
55
  * Filters tools matching the user's roles (RBAC).
55
56
  */
56
57
  filterByRoles(userRoles: string[]): RegisteredTool[];
58
+ /**
59
+ * Filters tools matching a specific physical impact profile (READ_ONLY, MUTATIVE, DESTRUCTIVE).
60
+ */
61
+ getByImpact(impact: ToolImpact): RegisteredTool[];
57
62
  /**
58
63
  * Exports headless technical descriptors without UI rendering coupling.
59
64
  */
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/agent/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhF,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAoED;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqC;IAC/D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAqC;IAEvE;;OAEG;IACI,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,gBAAgB,GAAG,IAAI;IASjE;;OAEG;IACI,YAAY,CAAC,KAAK,EAAE,CAAC,cAAc,GAAG,gBAAgB,CAAC,EAAE,GAAG,IAAI;IAOvE;;OAEG;IACI,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,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+ import type { RegisteredTool, ToolContext, ToolImpact, ToolSelectionStrategy, VercelAiCoreTool } from "./types";
2
2
  /**
3
3
  * Strategy selecting tools that match the current workflow phase.
4
4
  */
@@ -11,14 +11,30 @@ export declare class PhaseBasedToolStrategy implements ToolSelectionStrategy {
11
11
  export declare class RoleBasedToolStrategy implements ToolSelectionStrategy {
12
12
  selectTools(tools: RegisteredTool[], context: ToolContext): RegisteredTool[];
13
13
  }
14
+ /**
15
+ * Strategy selecting exclusively observation/read-only tools (ideal for auditors, critics, reflection).
16
+ */
17
+ export declare class ReadOnlyToolStrategy implements ToolSelectionStrategy {
18
+ selectTools(tools: RegisteredTool[], _context: ToolContext): RegisteredTool[];
19
+ }
20
+ /**
21
+ * Strategy capping maximum permitted impact level for autonomous agents.
22
+ */
23
+ export declare class MaxImpactToolStrategy implements ToolSelectionStrategy {
24
+ private readonly maxImpact;
25
+ constructor(maxImpact: ToolImpact);
26
+ selectTools(tools: RegisteredTool[], _context: ToolContext): RegisteredTool[];
27
+ }
14
28
  export interface AccessControlToolStrategyOptions {
15
29
  allowedDomains?: string[];
30
+ maxImpact?: ToolImpact;
16
31
  }
17
32
  /**
18
- * Unified strategy evaluating role, permissions and allowed business domains in a single pass.
33
+ * Unified strategy evaluating user roles, allowed business domains and maximum impact in a single pass.
19
34
  */
20
35
  export declare class AccessControlToolStrategy implements ToolSelectionStrategy {
21
36
  private readonly allowedDomains?;
37
+ private readonly maxImpact?;
22
38
  constructor(options?: AccessControlToolStrategyOptions);
23
39
  selectTools(tools: RegisteredTool[], context: ToolContext): RegisteredTool[];
24
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../../src/agent/strategy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,qBAAa,sBAAuB,YAAW,qBAAqB;IAC3D,WAAW,CAChB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AqB,EAC/B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAG3C"}
@@ -122,6 +122,10 @@ export interface ToolExecutionContext {
122
122
  onInvalidationTags?: (tags: string[]) => void | Promise<void>;
123
123
  [key: string]: unknown;
124
124
  }
125
+ /**
126
+ * Nature physique d'effet de bord et rayon d'action de l'outil pour le confinement du LLM.
127
+ */
128
+ export type ToolImpact = "READ_ONLY" | "MUTATIVE" | "DESTRUCTIVE";
125
129
  /**
126
130
  * User and environment context injected into tools.
127
131
  */
@@ -130,7 +134,6 @@ export interface ToolContext {
130
134
  tenantId?: string;
131
135
  role?: string;
132
136
  roles?: string[];
133
- permissions?: string[];
134
137
  phase?: string;
135
138
  metadata?: Record<string, unknown>;
136
139
  [key: string]: unknown;
@@ -154,7 +157,7 @@ export type InvalidationTagsResolver<TArgs = any, TResult = any> = string[] | ((
154
157
  export type DataAccessGuard<TArgs = any> = (args: TArgs, context?: ToolExecutionContext) => boolean | Promise<boolean>;
155
158
  /**
156
159
  * Configuration for creating an isolated tool with PII protection, Dual-Channel DTO,
157
- * access governance, stable ID, aliasing and caching.
160
+ * access governance, stable ID, aliasing, impact categorization and caching.
158
161
  */
159
162
  export interface IsolatedToolConfig<TArgs = any, TResult = any, TLLMDto = unknown, TClientDto = TResult> {
160
163
  id?: string;
@@ -164,7 +167,7 @@ export interface IsolatedToolConfig<TArgs = any, TResult = any, TLLMDto = unknow
164
167
  domain?: string;
165
168
  resource?: string;
166
169
  roles?: string[];
167
- permissions?: string[];
170
+ impact?: ToolImpact;
168
171
  requireApproval?: boolean;
169
172
  dataAccessGuard?: DataAccessGuard<TArgs>;
170
173
  invalidationTags?: InvalidationTagsResolver<TArgs, TResult>;
@@ -195,7 +198,7 @@ export interface VercelAiCoreTool<TArgs = any, TResult = any> {
195
198
  readonly _domain?: string;
196
199
  readonly _resource?: string;
197
200
  readonly _roles?: readonly string[];
198
- readonly _permissions?: readonly string[];
201
+ readonly _impact?: ToolImpact;
199
202
  readonly _requireApproval?: boolean;
200
203
  _lastPiiFilteredCount?: number;
201
204
  _lastInvalidationTags?: string[];
@@ -211,7 +214,7 @@ export interface RegisteredTool<TArgs = any, TResult = any> {
211
214
  domain?: string;
212
215
  resource?: string;
213
216
  roles?: string[];
214
- permissions?: string[];
217
+ impact?: ToolImpact;
215
218
  phases?: string[];
216
219
  requiredRoles?: string[];
217
220
  tags?: string[];
@@ -229,7 +232,7 @@ export interface ToolDescriptor {
229
232
  domain?: string;
230
233
  resource?: string;
231
234
  roles?: string[];
232
- permissions?: string[];
235
+ impact?: ToolImpact;
233
236
  requireApproval?: boolean;
234
237
  cacheTTL?: number;
235
238
  tags?: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,SAAS,GACT,WAAW,GACX,QAAQ,GACR,kBAAkB,CAAC;AAEvB;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,OAAO,GAAG,OAAO;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,C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B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,CACT,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,WAAW,GACnB,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CACjD"}
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,35 @@
1
1
  {
2
2
  "name": "avantgate",
3
- "version": "1.2.1",
4
- "description": "Zero-infrastructure, in-process LLM control plane & SaaS observability bridge: real-time cost control, token budgets, PII redaction, prompt guardrails, multi-model failover, durable agent workflow harness, and HTTP telemetry without hosting heavy servers.",
3
+ "version": "1.3.0",
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
+ "tool-governance",
20
+ "blast-radius",
21
+ "impact-control",
22
+ "token-budget",
23
+ "cost-control",
24
+ "durable-execution",
25
+ "human-in-the-loop",
12
26
  "observability",
13
27
  "telemetry",
14
28
  "session-replay",
15
29
  "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
30
  "failover",
25
- "pii-redaction",
26
31
  "finance",
27
32
  "accounting",
28
- "prompt-builder",
29
- "prompt-template",
30
33
  "deepseek",
31
34
  "mistral",
32
35
  "openai",
@@ -64,7 +67,7 @@
64
67
  "test:finance": "tsx tests/financial-normalizer.test.ts",
65
68
  "test:prompts": "tsx tests/prompt-builder.test.ts",
66
69
  "test:pii": "tsx tests/pii-extended.test.ts",
67
- "test:agent": "tsx tests/agent/step-runner.test.ts && tsx tests/agent/isolated-tool.test.ts && tsx tests/agent/dto-pattern.test.ts && tsx tests/agent/tool-patterns.test.ts && tsx tests/agent/storage-adapters.test.ts && tsx tests/agent/tool-aliasing.test.ts && tsx tests/agent/tool-chaining.test.ts && tsx tests/agent/tool-storage.test.ts && tsx tests/agent/telemetry-exporter.test.ts && tsx tests/agent/platform-adapter.test.ts && tsx tests/agent/tool-governance.test.ts",
70
+ "test:agent": "tsx tests/agent/step-runner.test.ts && tsx tests/agent/isolated-tool.test.ts && tsx tests/agent/dto-pattern.test.ts && tsx tests/agent/tool-patterns.test.ts && tsx tests/agent/storage-adapters.test.ts && tsx tests/agent/tool-aliasing.test.ts && tsx tests/agent/tool-chaining.test.ts && tsx tests/agent/tool-storage.test.ts && tsx tests/agent/telemetry-exporter.test.ts && tsx tests/agent/platform-adapter.test.ts && tsx tests/agent/tool-governance.test.ts && tsx tests/agent/tool-impact.test.ts",
68
71
  "lint": "tsc --noEmit",
69
72
  "prepublishOnly": "npm run build && npm test"
70
73
  },