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

@sentinelseed/core

v2.25.0

Published

Core validation module for Sentinel - THSP Protocol implementation

Readme

@sentinelseed/core

Core validation module for Sentinel. Implements the THSP Protocol (Truth, Harm, Scope, Purpose) with pattern-based heuristic validation and optional semantic analysis via API.

Features

| Feature | Description | |---------|-------------| | THSP Protocol | Five-gate validation system (Truth, Harm, Scope, Purpose, Jailbreak) | | Heuristic Validation | Pattern-based detection, runs offline, sub-millisecond latency | | Semantic Validation | LLM-powered analysis via API for nuanced cases | | 580+ Patterns | Comprehensive pattern library synchronized with Python core | | TypeScript Native | Full type definitions included |

Installation

npm install @sentinelseed/core

Quick Start

Heuristic Validation (Offline)

import { validateTHSP, quickCheck } from '@sentinelseed/core';

// Full validation with detailed results
const result = validateTHSP("Hello, how can I help you?");

if (result.overall) {
  console.log("Content is safe");
} else {
  console.log("Blocked:", result.summary);
  console.log("Risk level:", result.riskLevel);
}

// Quick boolean check
if (quickCheck("Some user input")) {
  // Process input
} else {
  // Block input
}

Semantic Validation (API)

import { configureApi, validateWithFallback } from '@sentinelseed/core';

// Configure API endpoint
configureApi({
  endpoint: 'https://api.sentinelseed.dev',
  apiKey: process.env.SENTINEL_API_KEY,
});

// Validate with heuristic first, API fallback for edge cases
const result = await validateWithFallback("Complex content to analyze");

console.log("Safe:", result.is_safe);
console.log("Layer:", result.layer); // "heuristic" or "semantic"

API Reference

Core Functions

| Function | Description | Returns | |----------|-------------|---------| | validateTHSP(text) | Full THSP validation through all gates | THSPResult | | quickCheck(text) | Fast boolean safety check | boolean | | checkJailbreak(text) | Jailbreak detection only | GateResult | | checkHarm(text) | Harm detection only | GateResult | | validateWithFallback(text) | Heuristic with API fallback | Promise<ValidateResponse> |

Types

interface THSPResult {
  truth: GateResult;
  harm: GateResult;
  scope: GateResult;
  purpose: GateResult;
  jailbreak: GateResult;
  overall: boolean;
  summary: string;
  riskLevel: 'low' | 'medium' | 'high' | 'critical';
}

interface GateResult {
  passed: boolean;
  score: number;
  violations: string[];
}

Gate Descriptions

| Gate | Function | Examples | |------|----------|----------| | Truth | Detects deception and misinformation | Impersonation, false claims | | Harm | Identifies harmful content and sensitive data | Violence, malware, credentials | | Scope | Catches boundary violations | Unauthorized access, excessive permissions | | Purpose | Flags purposeless destruction | Actions without legitimate benefit | | Jailbreak | Detects prompt injection attacks | Instruction override, DAN mode, roleplay manipulation |

Pattern Categories

The package includes 580+ patterns organized by category:

Jailbreak Detection

  • Instruction override patterns
  • Role manipulation patterns
  • Prompt extraction patterns
  • Filter bypass patterns
  • Roleplay manipulation patterns
  • System injection patterns

Harm Detection

  • Violence and weapons
  • Malware and hacking
  • Illegal activities
  • Self-harm content

Sensitive Data

  • API keys (OpenAI, AWS, GitHub)
  • Passwords and credentials
  • PII (emails, phone numbers)

Usage in Browser Extensions

import { validateTHSP } from '@sentinelseed/core';

// Validate user input before sending to AI
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
  if (message.type === 'VALIDATE') {
    const result = validateTHSP(message.text);
    sendResponse({
      safe: result.overall,
      violations: result.summary,
    });
  }
});

Usage in Node.js

import { validateTHSP, configureApi, validateSemantic } from '@sentinelseed/core';

// Heuristic validation (no network required)
const heuristicResult = validateTHSP(userInput);

if (!heuristicResult.overall) {
  // Blocked by heuristic
  return { blocked: true, reason: heuristicResult.summary };
}

// Optional: semantic validation for edge cases
configureApi({ endpoint: 'https://api.sentinelseed.dev' });
const semanticResult = await validateSemantic({
  content: userInput,
  context: { source: 'user' },
});

Performance

| Operation | Latency | Cost | |-----------|---------|------| | Heuristic validation | < 1ms | Free | | Semantic validation | 500ms to 2s | API usage |

Development

# Build
npm run build

# Test
npm run test

# Lint
npm run lint

# Type check
npm run typecheck

License

MIT

Links

| Resource | URL | |----------|-----| | Website | https://sentinelseed.dev | | Documentation | https://sentinelseed.dev/docs | | GitHub | https://github.com/sentinel-seed/sentinel | | Issues | https://github.com/sentinel-seed/sentinel/issues |