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

spurvik

v1.0.18

Published

Runtime wrapper designed to support EU AI Act record-keeping, human oversight, and transparency work. It does not by itself mean a system meets the Act.

Readme

spurvik-sdk

Check a live site or a codebase (no API key)

npx spurvik scan yourdomain.com    # Art. 50(1) notice check (or 2–10 domains for an agency portfolio matrix); --json, --fail-on-gap for CI
npx spurvik report yourdomain.com  # shareable DPO & Art. 50(1)/50(2) Markdown brief (with offline fallback)
npx spurvik trust yourdomain.com   # offline /trust & /security Markdown + SVG card + CMP-exempt badge.js (0 network)
npx spurvik c2pa https://yourdomain.com/hero.png   # C2PA manifest & CDN-strip check; --json, --fail-on-missing for CI
npx spurvik audit .                # unwrapped OpenAI / Anthropic / Gemini / AI SDK calls as file:line
npx spurvik badge yourdomain.com   # badge.js tag, Cookiebot/Usercentrics (--cms cookiebot), and <AIDisclosureLabel /> (--lang <24 EU locales>)
npx spurvik rfp yourdomain.com --plan pro --provider openai   # vendor security questionnaire & DPO RFP answers; --json

npx spurvik folk.app is short for npx spurvik scan folk.app. spurvik-sdk ships the same CLI (npx spurvik-sdk scan ...). Exit codes: 0 ok, 1 gap found with --fail-on-gap, 2 usage or network error, or c2pa --fail-on-missing with no C2PA manifest or a signature that does not match. scan and c2pa send only the domain or URL you pass to console.spurvik.com; c2pa refuses non-https, non-443, credentialed, localhost, .local/.internal and private-IP URLs before any request, and it reads, never signs. audit runs locally and prints file:line and the provider, never source text, followed by Free (/signup), Pro and Done-For-You signup links. rfp makes no request: it prints Q1–Q5 EU AI Act questionnaire answers for --plan free|pro|team|concierge and --provider openai|anthropic|google-genai|vercel-ai-sdk|langgraph|openai-agents|mastra|custom, and drops a [domain] that is not a public hostname without printing it.

Wrap a client

npm install openai [email protected]
import OpenAI from "openai";
import { withSpurvik } from "spurvik";

const ai = withSpurvik(new OpenAI(), {
  apiKey: process.env.SPURVIK_API_KEY!, // spurvik_live_…
  signingSecret: process.env.SPURVIK_SIGNING_SECRET!,
  contentHash: { mode: "keyed", secret: process.env.SPURVIK_CONTENT_HASH_SECRET! },
  baseUrl: "https://console.spurvik.com",
  riskTier: "limited_art50", // your own classification
});
const reply = await ai.chat.completions.create({ model: "gpt-4o-mini", messages: [{ role: "user", content: "Hi" }] });

Reference

Runtime client for provenance records, telemetry, a live human-oversight queue, and the halt cache.

The public MIT release is [email protected] and [email protected] on npm (core is bundled; both names ship the same build), from https://github.com/spurvik/spurvik. This directory's package name is spurvik-sdk. spurvik-sdk/ai types against @ai-sdk/provider and is meant to be passed to the Vercel AI SDK (ai 7, optional peer). See the root LICENSE.

withSpurvik is the provider wrapper. An older name of that function was removed; use withSpurvik. That old name did not mean the wrapped client meets the Act. verifyChannelApprovalToken checks Spurvik's own approval-link token and returns true or false. From 1.0.5, verifySignedChannelCallback returns { ok: true, decision, gateId, actionHmac, issuedAtUnix, nonce } when that token matches, and false otherwise. A missing signature returns false and does not throw.

spurvikMiddleware wraps an AI SDK language model. Pass it to wrapLanguageModel. It takes the same SpurvikConfig object as withSpurvik. It records the call and stores the HMAC receipt on that language-model result under providerMetadata.spurvik. It does not mark content. Set marking only when you supply your own hook.

spurvik-sdk/mastra and spurvik-sdk/openai-agents are the Mastra and OpenAI Agents adapters. Both take the same SpurvikConfig. Neither reads SPURVIK_ environment variables. The constructor throws when apiKey or signingSecret is missing. Article 12 (record-keeping) and Article 14 (human oversight) apply to high-risk AI systems. These adapters are designed to support that work. They do not mark content. A marking hook runs only when you set marking.

generateText and streamText do not put that receipt on _spurvik_provenance, and provenanceOf does not read their results. Read it with provenanceFromMetadata(result.providerMetadata). For a stream, await providerMetadata first. provenanceOf is for a withSpurvik response or stream. Check a receipt with verifyProvenanceSignature. A match shows the signed fields still match the HMAC-SHA-256 signature made with your signing secret. It does not show that a notice was shown, that output is marked, or that your system meets the Act.

Telemetry is queued. The queue sends when the batch is full, on its interval, on flush(), and once as the process is about to exit when process hooks are on. A call does not flush the queue by itself. One process-wide exit listener serves every client, so constructing the middleware again does not add another listener. An idle empty queue is dropped from that registry. Each control-plane request ends after telemetry.requestTimeoutMs (default 5 seconds). flush() stops retrying after telemetry.flushTimeoutMs (default 8 seconds). Callers that share an in-flight flush share that deadline. If that flush failed and nothing new is queued, process exit keeps only the time left on that deadline, so a slow error still ends in about 8 seconds and does not open a second window. A new event queued while that flush is still running, or after it has returned, gets a fresh deadline once the in-flight flush has finished. A timed-out flush, then a new event, then exit can therefore take up to about 16 seconds. An event recorded after a flush that finished still goes out on exit, under a new deadline. flush() then settles, and onTelemetryError receives a TimeoutError.

Decision and oversight calls send reviewerToken as x-spurvik-reviewer. They do not take a free-text reviewer id. Any organisation member can halt or decide in the console. Deciding through the API needs a reviewer token, which only an organisation owner can issue. You choose who in your organisation does human oversight (Art. 26(2), for high-risk AI systems). Image C2PA marking lives in packages/c2pa (build from source; it is not published on npm) so this package does not load a native addon.

What withSpurvik records

The output fingerprint is assistant-visible text. Tool-call argument strings are not included. Snapshot events are not counted again: an OpenAI response.output_text.done event repeats the full string, and a Gemini chunk's text getter repeats candidates. A thrown provider call does not produce a record. chats.create is a session factory, not a model call. The returned chat records sendMessage and sendMessageStream.

withResponse() records the parsed data and leaves the helper in place. asResponse() returns the raw Response and does not by itself create a record. Awaiting that same call, or calling withResponse(), does.

| Call | Recorded | | --- | --- | | OpenAI chat.completions.create | Yes. await, withResponse(), and asResponse() then await keep the helper methods. | | OpenAI chat.completions.parse | Yes. The helper calls the raw client, so the outer call is recorded once. | | OpenAI chat.completions.create({ stream: true }) | Yes, when consumed with for await. The full text is hashed once. | | OpenAI chat.completions.stream | Yes, via for await, finalChatCompletion(), or .on('content') then done(). | | OpenAI responses.create | Yes, including await of a non-stream response. | | OpenAI responses.create({ stream: true }) | Yes, when consumed with for await. Delta text is hashed once. The done event is not added again. | | OpenAI responses.parse | Yes. Recorded once on the outer call. | | OpenAI responses.stream | Yes, via finalResponse(). for await and done() use the same wrapper. | | Anthropic messages.create | Yes. await, withResponse(), and asResponse() then await. | | Anthropic messages.parse | Yes. Recorded once on the outer call. | | Anthropic messages.create({ stream: true }) | Yes, when consumed with for await. | | Anthropic messages.stream | Yes, via for await, or .on('text') then done(). | | Gemini models.generateContent | Yes. | | Gemini models.generateContentStream | Yes, when consumed with for await. Each chunk is counted once. | | Gemini chats.sendMessage / sendMessageStream | Yes. The model id and session temperature are taken from the chat when the call omits them. |

These rows were exercised with the installed openai, @anthropic-ai/sdk, and @google/genai packages. Tests replace HTTP. They do not replace the SDK clients.

What is not recorded

| Call | Why | | --- | --- | | Embeddings, images, audio, speech, transcriptions, moderations | Not an inference method this wrapper records. | | Batches, files, uploads, fine-tuning, assistants, threads, runs, vector stores | Not an inference method this wrapper records. | | OpenAI Realtime and Gemini Live | Not wrapped. | | responses.retrieve, responses.cancel, models.list, and other reads | Not an inference call. | | chats.create by itself | Session factory. The later sendMessage is the model call. | | toReadableStream() as the only consumer of a raw SSE stream | The helper iterates the original stream, so the wrapper's iterator never runs. Event helpers such as chat.completions.stream still record from their end event. | | Early break from for await | The text seen so far can be recorded. If the provider aborts the stream, the receipt is rejected instead of stored as a success. | | A provider method that throws before a body exists | No record. |

The middleware does not see provider HTTP. Its output fingerprint is the concatenated text parts, or text deltas, not tool-call arguments. Tool-only output leaves outputHash null.

Halt checks

releaseKillSwitch({ reason, actionName }) releases a project halt, or one action when actionName is set. Pass a reason when you have one. The argument is optional. When the reason is missing or blank, the client sends Released via SDK (no reason given) and reasonSource: "sdk_default" before the request. A reason you pass is sent with reasonSource: "caller". reasonSource is client-asserted. The server does not verify it. Console writes store NULL. A raw API call that omits the field stores NULL. The control plane does not fill that in. The returned reason is the reason just recorded. The halt reason that was in effect is previousReason. A halt response sets previousReason to null. engageKillSwitch still takes a reason. When that reason is missing or blank, the client sends Halted via SDK (no reason given) and reasonSource: "sdk_default", because the control plane refuses a halt that arrives with no reason. Both calls need reviewerToken. The signed oversight.changed webhook posts the response: reason is the new reason, previousReason is null on a halt and the halt reason on a release. A later read of the same stop keeps the halt reason and sets previousReason to null.

enforceHaltOnInference defaults to on for high_annex3. The provider request is not sent until that check passes. Stream helpers stay synchronous: .on, .done, final*, for await, and toReadableStream() keep their usual shapes, and getters such as ended and currentMessage stay values. A stop emits error and then end with SpurvikHaltedError, and done() rejects with that error. The provider is not called. A halt check that accepts and then stays silent rejects with SpurvikOversightTimeoutError, which is a SpurvikHaltedError, and the provider request is still not sent. abort() before the provider request starts sends nothing, and done() rejects at once with AbortError. It does not wait for a halt check that is still in flight. A non-2xx oversight response is an error, and the provider request is not sent. The background halt refresh does not start a second request while one is in flight. On Node that poll, and the oversight push stream, use an unref'd node:http request so a silent server does not keep the process alive. Those two requests do not go through config.fetch, because a fetch socket stays referenced until the body ends. Halt checks the caller awaits, telemetry, and the push stream off Node still use config.fetch.

create(), parse, and the other promise methods do not start that check until the caller awaits the promise or calls withResponse() or asResponse(). An un-awaited call sends nothing. That includes a halted project: nothing is sent because the check never runs. Await the call, or use withResponse() / asResponse(), when a stop must be observed. .stream() starts the check immediately and still waits for it before the provider request.

AI SDK middleware

import { generateText, streamText, wrapLanguageModel } from "ai";
import { provenanceFromMetadata, spurvikMiddleware } from "spurvik-sdk/ai";

const spurvik = spurvikMiddleware({
  apiKey: process.env.SPURVIK_API_KEY!,
  signingSecret: process.env.SPURVIK_SIGNING_SECRET!,
  contentHash: { mode: "keyed", secret: process.env.SPURVIK_CONTENT_HASH_SECRET! },
  baseUrl: process.env.SPURVIK_BASE_URL, // required when NODE_ENV is production
  riskTier: "limited_art50", // Sample value. Set your own classification (as provider or deployer); Spurvik does not classify your use case.
});

const model = wrapLanguageModel({
  model: yourLanguageModel,
  middleware: spurvik,
});

const generated = await generateText({ model, prompt: "Hello" });
const generatedRecord = provenanceFromMetadata(generated.providerMetadata);

const streamed = streamText({ model, prompt: "Hello" });
const streamedRecord = provenanceFromMetadata(await streamed.providerMetadata);

spurvik.flush(): Promise<void> sends this middleware's queued telemetry and leaves the client running. wrapLanguageModel accepts the same object.

Create that middleware once at module scope. A serverless isolate can return the response and freeze before the process-exit hook runs. Pass flush() to one platform wait helper:

import { after } from "next/server";

after(() => spurvik.flush());

Vercel handlers call waitUntil(spurvik.flush()) from @vercel/functions. Install @vercel/functions in the app that calls it. Supabase Edge calls EdgeRuntime.waitUntil(spurvik.flush()). A handler that can wait calls await spurvik.flush().

registerProcessHooks can stay off in those handlers. With the default on, further requests still share one exit listener, and an idle empty queue is dropped from it. Flush from the wait helper either way, because the isolate may not reach beforeExit.

ai is an optional peer (^7.0.0). Install it in the app that calls wrapLanguageModel. The subpath import spurvik-sdk/ai is the middleware entry.

Mastra

Checked against @mastra/core 1.79.0. Mastra's MastraModelConfig includes an AI SDK language model (LanguageModelV2, LanguageModelV3, or LanguageModelV4 from @ai-sdk/provider). resolveModelConfig keeps a specificationVersion: "v4" model and calls doGenerate / doStream (AISDKV7LanguageModel). Agent's model field is a DynamicArgument, so it accepts that object or a function that returns it. withSpurvikMastra returns the function. Mastra calls it from Agent.getLLM before stream() starts. A halt there rejects agent.stream and agent.generate with SpurvikHaltedError. A thrown doStream inside the stream loop becomes an empty text stream, so the check does not wait until doStream. The function's return value is what spurvikMiddleware records.

@mastra/core 1.79.0 nests its own copy of @ai-sdk/provider. That copy is a different type identity from the @ai-sdk/provider this package depends on, so spurvik.model is not assignable to Agent's model without a cast. The example below is the form that typechecks against @mastra/core 1.79.0. generate() returns providerMetadata as a promise; await it before reading the receipt.

Model-router strings such as openai/gpt-4o are not wrapped. Pass a model object.

import { Agent } from "@mastra/core/agent";
import { provenanceFromMetadata, withSpurvikMastra } from "spurvik-sdk/mastra";

const spurvik = withSpurvikMastra(yourLanguageModel, {
  apiKey: process.env.SPURVIK_API_KEY!,
  signingSecret: process.env.SPURVIK_SIGNING_SECRET!,
  contentHash: { mode: "keyed", secret: process.env.SPURVIK_CONTENT_HASH_SECRET! },
  baseUrl: process.env.SPURVIK_BASE_URL, // required when NODE_ENV is production
  riskTier: "limited_art50", // Sample value. Set your own classification (as provider or deployer); Spurvik does not classify your use case.
});

const agent = new Agent({
  id: "assistant",
  name: "Assistant",
  instructions: "Reply briefly.",
  model: spurvik.model as ConstructorParameters<typeof Agent>[0]["model"],
});

const generated = await agent.generate("Hello");
const record = provenanceFromMetadata(await generated.providerMetadata);

withSpurvikMastra calls wrapLanguageModel with spurvikMiddleware. It does not keep a second copy of the recorder. flush() sends that middleware's queue.

What it does:

  • Records doGenerate and doStream on the language model you pass in.
  • Stores the HMAC receipt on providerMetadata.spurvik. Agent.generate keeps that object on its result when the step keeps the finish chunk. provenanceOf does not read a Mastra FullOutput. Read provenanceFromMetadata.
  • Checks the halt state when Mastra resolves model, before agent.stream or agent.generate starts, when halt enforcement is on. The same oversight options as withSpurvik apply. A stop throws SpurvikHaltedError from that call.
  • Sends keyed HMAC fingerprints. The control-plane body does not include the prompt or the output text.

What it does not do:

  • Model-router strings such as openai/gpt-4o are not wrapped. Pass a model object. Mastra resolves that string in its own router, and this helper never receives the call.
  • It does not record embeddings, voice, workflows, or any call that does not go through the wrapped model.
  • It does not mark content. A marking hook runs only when you set marking.
  • It does not turn Mastra's own telemetry off. Set MASTRA_TELEMETRY_DISABLED in the app if you do not want that.

@mastra/core is an optional peer (^1.79.0). ai stays an optional peer. Install both in the app that calls withSpurvikMastra.

OpenAI Agents SDK

Checked against @openai/agents 0.21.0. A model call is Model.getResponse or Model.getStreamedResponse (@openai/agents-core model.d.ts). ModelProvider.getModel resolves a string name to a Model. Runner takes modelProvider. Agent.model is string | Model. TracingProcessor runs when a trace or span starts and ends. It does not run before the model request, so a halt check there cannot stop the call. This adapter wraps Model and ModelProvider. It does not register a tracing processor.

import { Agent, OpenAIProvider, Runner } from "@openai/agents";
import { provenanceFromAgentsResponse, withSpurvikModelProvider } from "spurvik-sdk/openai-agents";

const spurvik = withSpurvikModelProvider(
  new OpenAIProvider({ apiKey: process.env.OPENAI_API_KEY, useResponses: true }),
  {
    apiKey: process.env.SPURVIK_API_KEY!,
    signingSecret: process.env.SPURVIK_SIGNING_SECRET!,
    contentHash: { mode: "keyed", secret: process.env.SPURVIK_CONTENT_HASH_SECRET! },
    baseUrl: process.env.SPURVIK_BASE_URL, // required when NODE_ENV is production
    riskTier: "limited_art50", // Sample value. Set your own classification (as provider or deployer); Spurvik does not classify your use case.
  },
);

const runner = new Runner({ modelProvider: spurvik, tracingDisabled: true, traceIncludeSensitiveData: false });
const agent = new Agent({
  name: "Assistant",
  instructions: "Reply briefly.",
  model: "gpt-4o-mini",
});

const result = await runner.run(agent, "Hello");

getModel("gpt-4o-mini") wraps the inner model and stores that name on the receipt. The Model interface does not expose the id the provider selected, so a call with no name is stored as unknown. Pass a Model instance with withSpurvikModel(model, config, { modelId }) when Agent.model is already a model object. Models from one provider share one client. flush() sends that queue.

The receipt is on providerData.spurvik and on _spurvik_provenance. Read it with provenanceFromAgentsResponse or provenanceOf. On a stream, response_done.response carries the receipt, and provenanceOf on the iterable is a promise. The input fingerprint includes system instructions, string input, input_text, output_text, and reasoning_text (including a reasoning item's rawContent). It does not include tool results (function_call_result and its output) or tool-call items (function_call, hosted_tool_call, tool_search_call). The output hash is assistant output_text only and leaves out tool-call arguments. A thrown model call does not produce a receipt.

getResponse checks the halt state before the inner model is called when halt enforcement is on. getStreamedResponse starts that check when it is called and calls the inner model only after the check passes and the caller reads the stream. The oversight options are the same ones withSpurvik uses.

What it does not do:

  • It does not mark content. A marking hook runs only when you set marking. With applyToMessageContent, the first assistant output_text is replaced with the hook output. That hook is yours.
  • It does not turn off the Agents SDK's own tracing. Set tracingDisabled on the Runner when you do not want that export. This adapter still does not send the prompt or the output text to the control plane.
  • It does not wrap @openai/agents/realtime.
  • It does not replace the OpenAI client. The inner Model still performs the provider request.

@openai/agents is an optional peer (^0.21.0). Install it for the Agents SDK. The adapter does not check for it.

Deno

Deno can import the built package. The on-disk telemetry buffer and the unref'd node:http halt poll are Node-only. On Deno, pass DurableTelemetryBuffer or KvTelemetryBuffer. MemoryTelemetryBuffer stays in memory for either runtime.

Channels

spurvik-sdk/channels sends an ask_human() approval request on Slack, Telegram, Email (Resend), Discord, Microsoft Teams, Linear, Jira, Monday.com, and Asana. Monday.com only creates a board item. It does not send Approve or Block links.

verifyChannelApprovalToken checks Spurvik's own approval-link token and returns true or false. It does not verify a Slack, Telegram, Discord, or other platform webhook signature. Approvers click signed links. The SDK does not receive platform webhooks. From 1.0.5, verifySignedChannelCallback returns { ok: true, decision, gateId, actionHmac, issuedAtUnix, nonce } when that token matches, and false otherwise. A missing signature returns false and does not throw.

From 1.0.5, callbackBaseUrl is required. Pass a URL that accepts GET clicks. The SDK does not default to the console HITL create route. New links include a nonce. The default validity stays 24 hours (86400 seconds). Pass maxAgeSeconds: 900 for a 15-minute window. A link can be reused until it expires. The receiver must record the nonce and refuse a repeat. A 1.0.4 token has no nonce and still verifies when the nonce is omitted. maxAgeSeconds: 0 throws. Omit it to keep 86400 seconds. NaN, Infinity, and negative values still use 86400 seconds.

The published spurvik and spurvik-sdk packages do not read SPURVIK_* or AEGIS_* environment variables at runtime. Pass apiKey, signingSecret, contentHash.secret, and baseUrl in code. These reads exist only in this repository: vendorTelemetryMode() in packages/core/src/telemetry-policy.ts reads SPURVIK_TELEMETRY, then AEGIS_TELEMETRY, and the published packages do not call it. packages/c2pa/src/index.ts reads SPURVIK_C2PA_CERT_PEM then AEGIS_C2PA_CERT_PEM, and SPURVIK_C2PA_KEY_PEM then AEGIS_C2PA_KEY_PEM. That directory is build-from-source and is not in the published tarball. packages/sdk/src/telemetry-exit.child.ts is a repository test script and reads only SPURVIK_BASE_URL. packages/sdk/tsup.config.ts reads SPURVIK_SDK_DIST during the repository build. packages/mcp reads SPURVIK_MCP_ROOT and SPURVIK_SIGNING_SECRET. Those reads are not in spurvik or spurvik-sdk.

The same build is published as spurvik and spurvik-sdk. spurvik/react is the disclosure-label entry. Neither package depends on the other.

Disclosure labels

Import <AIDisclosureLabel /> from spurvik/react (or spurvik-sdk/react). attribution is off by default. Pass attribution={true} to show a small "Art. 50 · Spurvik" link to https://spurvik.com after the disclosure text. The disclosure text stays first in the DOM and reading order. The link has no query parameters and does not set cookies or make a network call.

AIDisclosureLabel does not write browser storage or call the disclosure endpoint unless beacon.consent is true.