npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@aegis-kernel/core

v1.5.0

Published

Core deterministic invariant clearance engine for AI agent tool execution

Readme

🛡️ @aegis-kernel/core

Core Deterministic Invariant Clearance Engine for AI Agent Tool Calls
Sub-1.5ms Latency • Zero Network Egress • Deterministic AST & State Invariants

License: MIT TypeScript Node.js


🚀 Overview

@aegis-kernel/core is the foundational TypeScript/Node.js engine of the Aegis Invariant Kernel. It intercepts LLM agent tool calls and enforces deterministic security, data integrity, and compliance policies in-process before actions reach databases or third-party APIs.

Core Capabilities:

  • Multi-Dialect SQL AST Guard: Blocks destructive DDL (DROP, TRUNCATE, ALTER TABLE ... DROP), mass DELETE/UPDATE without WHERE, comment splits (DEL/**/ETE), zero-width Unicode injection, and nested CTE mutations.
  • Deep Tautology Constant-Folding Engine: Detects constant-folding (WHERE 1, WHERE 1=1, WHERE 2>1), lower-bound identity tautologies (WHERE id > 0, WHERE id != -1), and unconstrained subqueries.
  • Numeric & Financial Ceilings: Strips formatted currency strings ($5,000.00, €10,000) and normalizes parameter aliases (amount, total, price, payout, value).
  • Salted PII Token Vault: Session-salted deterministic HMAC-SHA256 tokenization and detokenization (<US_SSN_...>, <CREDIT_CARD_...>).
  • Causal Execution DAG & Drift Tracking: Multi-turn exfiltration chain detection and exponential decay risk drift tracking.
  • Cryptographic Audit Ledger: Immutable SHA-256 proofHash commitments and Ed25519/HMAC signed Merkle root event chains.

📦 Installation

npm install @aegis-kernel/core

⚡ Quickstart

1. Basic Invariant Evaluation

import { AegisEngine } from '@aegis-kernel/core';

const engine = new AegisEngine({
  mode: 'enforce',
  failPolicy: 'fail-closed',
  packs: ['@aegis/sql-guard', '@aegis/finance-guard', '@aegis/data-guard'],
});

// 1. Evaluate a dangerous mass DELETE
const verdict = engine.evaluate({
  tool: 'database_query',
  params: { sql: 'DELETE FROM accounts WHERE 1=1;' },
});

console.log(verdict.allowed); // false
console.log(verdict.violations); // [{ ruleId: 'SQL-001', message: 'SQL DELETE contains constant tautology WHERE clause' }]
console.log(verdict.proofHash); // SHA-256 cryptographic receipt

// 2. Evaluate a safe targeted query
const safeVerdict = engine.evaluate({
  tool: 'database_query',
  params: { sql: 'SELECT id, balance FROM accounts WHERE id = 1001 LIMIT 1;' },
});

console.log(safeVerdict.allowed); // true

2. Streaming Token Interceptor

import { AegisEngine, AegisStreamInterceptor } from '@aegis-kernel/core';

const engine = new AegisEngine();
const interceptor = new AegisStreamInterceptor(engine, {
  maxPatternLength: 256,
  abortOnMatch: true,
});

for await (const chunk of interceptor.intercept(llmTokenStream)) {
  if (chunk.action === 'ABORT') {
    console.error('Stream aborted: Secret or PII leak detected!');
    break;
  }
  process.stdout.write(chunk.text);
}

3. Salted PII Token Vault

import { PiiTokenVault } from '@aegis-kernel/core';

const vault = new PiiTokenVault({ salt: 'secure-session-salt-128bit' });

const masked = vault.tokenize('User SSN is 000-12-3456');
// Output: 'User SSN is <US_SSN_a9f8c7...>'

const original = vault.detokenize(masked);
// Output: 'User SSN is 000-12-3456'

📄 License

Distributed under the MIT License. Copyright (c) 2026 Sneh Gabani.