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

consensus-sentry

v2.0.0

Published

[![npm version](https://img.shields.io/npm/v/consensus-sentry)](https://www.npmjs.com/package/consensus-sentry) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Readme

Consensus Sentry 🛡️

npm version License: MIT

A robust content moderation SDK for AI applications, providing multi-layered content safety checks including rule-based pattern matching, semantic analysis, and machine learning toxicity classification.

Features

  • 🚦 Content Validation: Check text against customizable rules and AI models
  • Batch Processing: Validate multiple content items in parallel
  • 🔍 Detailed Violations: Get specific rule violations with confidence scores
  • 🧪 Toxicity Scoring: Built-in toxicity classification (sexual, hate, threat, etc.)
  • 📦 Caching: Redis-powered caching for improved performance
  • ⚙️ Configurable Thresholds: Adjust similarity and toxicity thresholds

Installation

npm install consensus-sentry

Usage

Basic Usage

import { ConsensusSentry } from 'consensus-sentry';

// Initialize client
const sentry = new ConsensusSentry({
  apiKey: 'your_api_key',
  environment: 'production' // or 'staging'
});

// Validate content
async function checkContent(text: string) {
  try {
    const result = await sentry.validate(text);
    
    if (result.valid) {
      console.log('✅ Safe content');
    } else {
      console.log('❌ Violations:', result.violations);
    }
    
    return result;
  } catch (error) {
    console.error('Validation error:', error);
    throw error;
  }
}

// Example usage
checkContent('This is some user-generated content');

Batch Validation

async function checkBatchContent(texts: string[]) {
  try {
    const batchResult = await sentry.validateBatch(texts);
    console.log(`Processed ${batchResult.totalItems} items`);
    return batchResult.results;
  } catch (error) {
    console.error('Batch validation error:', error);
    throw error;
  }
}

// Example usage
checkBatchContent(['First content', 'Second content']);

Response Structure

interface CheckResult {
  valid: boolean;
  violations: Violation[];
  requestId: string;
  status: 'safe' | 'violation' | 'warning' | 'invalid';
  message?: string;
  metadata?: {
    processingTimeMs?: number;
    toxicityScores?: Record<string, number>;
    classifierError?: string;
  };
  ruleDetails?: Record<string, {
    description: string;
    response: string;
  }>;
}

Error Handling

try {
  await sentry.validate(content);
} catch (error) {
  if (error.message.startsWith('API Error')) {
    // Handle API errors (4xx/5xx responses)
  } else if (error.message.startsWith('Network Error')) {
    // Handle network connectivity issues
  } else if (error.message.includes('timeout')) {
    // Handle request timeouts
  }
}

Advanced Usage

// Example rule configuration (server-side)
{
  "rules": [{
    "id": "profanity-filter",
    "keywords": ["badword1", "badword2"],
    "threshold": 0.85,
    "response": "Content contains prohibited language"
  }]
}

Contributing

We welcome contributions! Please follow these steps:

Fork the repository

Create a feature branch (git checkout -b feature/amazing-feature)

Commit your changes (git commit -m 'Add amazing feature')

Push to the branch (git push origin feature/amazing-feature)

Open a Pull Request

See our Contribution Guidelines for more details.

Consensus Sentry is maintained by Consensus Sentry. For support contact [email protected]