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

@globiguard/js

v0.3.0

Published

Official dependency-minimal vanilla JavaScript SDK for GlobiGuard.

Readme

globiguard-js

Official dependency-minimal vanilla JavaScript SDK for GlobiGuard.

This package is plain ESM JavaScript with no runtime dependencies. It mirrors the TypeScript SDK wire contract while staying usable from modern browsers, Node, and workers.

Install

npm install @globiguard/js

Server client

import { createServerClient, secretCredential } from "@globiguard/js";

const client = createServerClient({
  environment: "sandbox",
  services: { controlPlane: "https://api.globiguard.com" },
  credential: secretCredential("proj_123", "ggsk_test_...", "sandbox")
});

const decision = await client.governedActions.authorizeActionOrThrow({
  context: {
    actionType: "refund.create",
    destination: {
      type: "custom",
      name: "payments-production"
    },
    dataClasses: ["CONFIDENTIAL"],
    actor: {
      id: "support-agent-123",
      type: "agent"
    },
    purpose: "Resolve an approved customer escalation",
    correlationId: "case_456",
    idempotencyKey: "case_456:refund:v1"
  }
});

authorizeActionOrThrow returns only a current, short-lived, obligation-free ALLOW that explicitly authorizes the exact action once. MODIFY, QUEUE, BLOCK, dry-run, expired, and incomplete responses raise a GlobiguardAuthorityError; the downstream business action must remain stopped. Use client.audit.getIncidentReplay(...) and client.audit.getEvidencePackageSummary(...) to retrieve the metadata-only history and evidence linked to the authorization.

AI intercept

createAiIntercept wraps any AI provider call with a GlobiGuard governance checkpoint. Input is authorized before the model is called; output is classified and authorized if sensitive.

import { createServerClient, secretCredential, createAiIntercept } from '@globiguard/js';
import OpenAI from 'openai';

const client = createServerClient({
  environment: 'live',
  services: {
    controlPlane: 'https://api.globiguard.com',
    brain: 'https://brain.globiguard.com',
  },
  credential: secretCredential('proj_123', 'sk_...', 'live'),
});

const intercept = createAiIntercept(client.governedActions);

// OpenAI — returns a Proxy, call exactly like the original client
const governed = intercept.openai(new OpenAI());
const response = await governed.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: 'Summarise this contract...' }],
});

// Anthropic
import Anthropic from '@anthropic-ai/sdk';
const governed = intercept.anthropic(new Anthropic());
const msg = await governed.messages.create({ model: 'claude-opus-4-8', max_tokens: 1024, messages: [...] });

// Google GenAI
import { GoogleGenerativeAI } from '@google/generative-ai';
const model = new GoogleGenerativeAI('api-key').getGenerativeModel({ model: 'gemini-1.5-pro' });
const governed = intercept.google(model);
const result = await governed.generateContent('Draft a privacy policy...');

// AWS Bedrock
import { BedrockRuntimeClient } from '@aws-sdk/client-bedrock-runtime';
const governed = intercept.bedrock(new BedrockRuntimeClient({ region: 'us-east-1' }));
const out = await governed.send(command);

// Cohere
import { CohereClient } from 'cohere-ai';
const governed = intercept.cohere(new CohereClient({ token: '...' }));
const res = await governed.chat({ message: 'Summarise...' });

// Mistral
import { Mistral } from '@mistralai/mistralai';
const governed = intercept.mistral(new Mistral({ apiKey: '...' }));
const res = await governed.chat.complete({ model: 'mistral-large-latest', messages: [...] });

// Ollama
import { Ollama } from 'ollama';
const governed = intercept.ollama(new Ollama());
const res = await governed.chat({ model: 'llama3', messages: [{ role: 'user', content: 'Hello' }] });

// Vercel AI SDK
import { openai } from '@ai-sdk/openai';
const governed = intercept.vercel(openai('gpt-4o'));
const { text } = await generateText({ model: governed, prompt: '...' });

// LangChain JS
import { ChatOpenAI } from '@langchain/openai';
const governed = intercept.langchain(new ChatOpenAI({ model: 'gpt-4o' }));
const result = await governed.invoke('Draft a contract...');

// Any provider via generic()
const governed = intercept.generic(myProviderFn, { extractInput: (params) => params.prompt });
const result = await governed({ prompt: 'Hello' });

createAiIntercept accepts an optional second argument { mode, actionType, destination, onBlock }. Default mode is "scan_both". When a governance decision is BLOCK, GlobiguardAuthorityError is thrown; pass onBlock to handle it yourself.

Webhooks

const result = await verifyTrustWebhook({
  headers: request.headers,
  rawBody,
  signingSecret: "whsec_..."
});

Always pass the exact raw request body bytes/string.

Bootstrap and entitlements

The SDK includes hosted/self-hosted/sovereign bootstrap request builders and offline entitlement manifest verification. Node verifies Ed25519 through node:crypto; browsers use Web Crypto where Ed25519 is available.

Security posture

  • Runtime dependencies: zero.
  • HTTPS is required outside local.
  • Local credentials require localhost or loopback service URLs.
  • Reserved GlobiGuard auth headers cannot be overridden per request.
  • Request paths reject absolute URLs, query strings, fragments, backslashes, invalid percent encoding, and dot segments.
  • Trust webhooks require raw-body HMAC verification.

Development

npm test