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

@stylusnexus/agentarmor-ml

v0.1.2

Published

ML classifier add-on for Agent Armor. Downloads and runs a DeBERTa-v3-small ONNX model for agent trap detection.

Readme

@stylusnexus/agentarmor-ml

npm version License: MIT

ML classifier add-on for Agent Armor. Runs a DeBERTa-v3-small ONNX model locally for deeper agent trap detection that catches threats regex patterns miss.

Why Use the ML Classifier?

Regex-based detection handles the obvious attacks: hidden HTML instructions, known jailbreak patterns, blatant exfiltration triggers. But sophisticated attacks use natural language to manipulate agent behavior through biased framing, subtle persona shifts, or contextual learning traps. These don't have a regex signature.

The ML classifier catches what patterns can't. It's trained on the full AI Agent Traps taxonomy, runs locally (no API calls, no data leaves your machine), and adds meaningful detection coverage on the semantic manipulation categories where regex falls short.

Install

npm install @stylusnexus/agentarmor @stylusnexus/agentarmor-ml

Usage

import { AgentArmor } from '@stylusnexus/agentarmor';

const armor = await AgentArmor.create({
  ml: { enabled: true },
});

const result = await armor.scan(content);

// ML-detected threats have source: 'ml'
result.threats.filter(t => t.source === 'ml');

How It Works

On first use, the model (~140MB quantized ONNX) is downloaded from HuggingFace and cached locally:

  • macOS: ~/Library/Caches/agentarmor/v1/
  • Linux: ~/.cache/agentarmor/v1/
  • Custom: Set AGENTARMOR_CACHE_DIR or pass ml.modelDir in config

Subsequent runs load from cache with no network calls.

Configuration

const armor = await AgentArmor.create({
  ml: {
    enabled: true,
    // Point to a local model directory (skips download)
    modelDir: './models/agentarmor',
    // Behavior when model is unavailable
    onUnavailable: 'warn-and-skip', // 'throw' | 'warn-and-skip' | 'silent-skip'
    // Download options
    download: {
      timeoutMs: 120_000,
      retries: 2,
      onProgress: (received, total) => {
        console.log(`${Math.round(received / total * 100)}%`);
      },
    },
  },
});

CLI

Pre-download the model or manage the cache:

# Download model to cache (or custom directory)
agentarmor-ml download
agentarmor-ml download --dir ./models

# Show cache location and file sizes
agentarmor-ml cache-info

# Remove cached model
agentarmor-ml clear-cache

Inference Details

  • Tokenizes input to 512 tokens (WordPiece)
  • Runs ONNX inference with INT8 quantization via onnxruntime-node
  • Applies sigmoid on logits with strictness-based thresholds: strict=0.3, balanced=0.5, permissive=0.7
  • scan() (sync) returns empty — ML inference is async-only via scanAsync()

Deployment Notes

  • AWS Lambda: 140MB model + ~40MB onnxruntime = ~180MB, fits the 250MB limit but is tight. Use modelDir to bundle the model in your deployment package.
  • Vercel Edge: Not supported (ONNX runtime requires Node.js native bindings).

Requirements

  • Node.js >= 18
  • Peer dependency: @stylusnexus/agentarmor >= 0.2.0

License

MIT