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

sas-audit-client

v0.2.0

Published

Node.js / TypeScript SDK for SAS - Symbiotic Autoprotection System

Readme

SAS Node SDK

CI npm License DOI Qeios

Node.js / TypeScript SDK for SAS - Symbiotic Autoprotection System.

κD = 0.56 · κR = 0.15 — Structural Coherence Auditing for Generative AI.

This package is the official JavaScript/TypeScript client for the SAS hosted API and self-hosted SAS deployments. Published on npm as sas-audit-client.

Naming

Repository: sas-js npm package: sas-audit-client Exported class: SASClient

Install

After publication:

npm install sas-audit-client

For local development:

npm install
npm run typecheck
npm test
npm run build

Requirements

Node.js 18+
TypeScript-first
Native fetch
No hidden telemetry
No API key storage

Quick start

import { SASClient } from "sas-audit-client";

const client = new SASClient({
  apiKey: process.env.SAS_API_KEY
});

const result = await client.diff({
  textA: "Paris is in France.",
  textB: "Paris is in Germany.",
  experimental: true
});

console.log(result.verdict);
console.log(result.isi);

Public demo without API key

import { SASClient } from "sas-audit-client";

const client = new SASClient();

const result = await client.demoAudit({
  source: "The Eiffel Tower is located in Paris, France.",
  response: "The Eiffel Tower is located in Berlin, Germany."
});

console.log(result);

Tribunal classification (v0.2.0+)

The SAS Multimetric Tribunal v1.1.0 classifies (source, response) pairs into 3 structural zones using 7 detection modules with cascading multiplicative penalty, plus an optional R3.1 Differential Guard (F1 0.833 ± 0.0055 on held-out data).

import { SASClient } from "sas-audit-client";

const client = new SASClient({
  apiKey: process.env.SAS_API_KEY
});

const result = await client.tribunal({
  source: "The Eiffel Tower is located in Paris, France.",
  response: "The Eiffel Tower is located in Berlin, Germany.",
});

console.log(result.zona);       // e.g. "RUPTURA_RECUPERABLE"
console.log(result.isi_final);  // e.g. 0.49
console.log(result.codigo_zona);// e.g. "B"
console.log(result.modulos_disparados);

Optional parameters:

const result = await client.tribunal({
  source: "...",
  response: "...",
  enableR3_1: false,   // Disable R3.1 Differential Guard
  kappaD: 0.50,        // Override κD threshold
  kappaR: 0.10,        // Override κR threshold
});

Methods

health()
readyz()
demoAudit()
whoami()
diff()
audit()
batch()
tribunal()          # v0.2.0 — SAS Multimetric Tribunal v1.1.0
publicStats()
publicActivity()
publicInteractionStats()
interactionStability()
interactionStabilityExample()

Examples

Examples import from dist, so build first:

npm run build
node examples/health.mjs

Authenticated examples require SAS_API_KEY:

SAS_API_KEY=sas_xxxxxxxxxxxxxxxxxxxxx node examples/whoami.mjs
SAS_API_KEY=sas_xxxxxxxxxxxxxxxxxxxxx node examples/diff.mjs
SAS_API_KEY=sas_xxxxxxxxxxxxxxxxxxxxx node examples/batch.mjs
SAS_API_KEY=sas_xxxxxxxxxxxxxxxxxxxxx node examples/tribunal.mjs

Tests

npm test

Integration tests are opt-in:

SAS_API_KEY=sas_xxxxxxxxxxxxxxxxxxxxx npm run test:integration

Security notes

  • Do not expose SAS API keys in browser-side code.
  • Do not log process.env.SAS_API_KEY.
  • Do not put API keys in query strings.
  • Use authenticated methods from trusted server-side Node.js environments.
  • Public endpoints do not send X-API-Key by default.

License

GPL-3.0-or-later + Durante Invariance License. See LICENSE.

Publish safety

Do not publish until all checks pass:

npm run typecheck
npm test
npm run build
npm run pack:check
npm audit --omit=dev

sas-audit-client requires npm scope availability. If the scope is unavailable, use the fallback package name sas-audit-client.

Retry configuration

Retries are disabled by default.

const client = new SASClient({
  retry: false
});

To enable retries, pass an explicit configuration:

const client = new SASClient({
  apiKey: process.env.SAS_API_KEY,
  retry: {
    attempts: 2,
    backoffMs: 500,
    respectRetryAfter: true,
    maxRetryDelayMs: 30_000
  }
});

When retry is enabled and retryOnStatuses is omitted, the SDK retries transient server errors by default:

500, 502, 503, 504

HTTP errors are never retried unless retry is explicitly enabled. Validation and authentication errors are not retried.

Interaction stability example

interactionStabilityExample() calls:

GET /v1/interaction/stability/example

This endpoint is feature-flag controlled by the backend. If the feature is disabled, the API may return 503, which the SDK exposes as SASServerError.

License

This package is distributed under GPL-3.0-or-later. See LICENSE.

The SDK is part of the SAS ecosystem and is intended to remain compatible with the attribution model of the main SAS repository.