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

@vivariumjs/changeset

v0.3.0

Published

Reference TypeScript SDK for the Vivarium Changeset specification — construct, canonicalize, fingerprint, and validate changesets. No apply logic.

Readme

@vivariumjs/changeset — TypeScript reference SDK

Construct, canonicalize, fingerprint, and validate Vivarium Changeset documents. Contains no apply logic — appliers (e.g. vivarium-stage) are consumers of this format, not part of this SDK.

Zero runtime dependencies. The package ships built ES modules (dist/, emitted by npm run build / prepack); working in this repo runs the TypeScript source directly and requires Node ≥ 23.6.

Usage

import {
  createChangeset, addSchemaOp, addUiPatch, finalize,
  validate, verifyFingerprint,
} from "@vivariumjs/changeset";

// the artifact's current source, and the source the agent proposes
const currentSource = "export function LoanScreen() { /* current */ }";
const nextSource = "export function LoanScreen() { /* renders dueDate */ }";

let draft = createChangeset({
  intent: "Add a due-date to the loan screen",
  producedBy: "my-agent",
  createdAt: new Date().toISOString(),
});

draft = addSchemaOp(draft, {
  op: "field.add",
  entity: "loan",
  field: { name: "dueDate", type: "date" },
  explanation: "Stores the loan's due date",
});

draft = addUiPatch(draft, {
  artifactId: "screen-loans",
  baseContent: currentSource,   // null for creation
  newContent: nextSource,       // review diff + base fingerprint are derived, never hand-written
  explanation: "Renders the due-date field",
});

const doc = finalize(draft);    // validates, stamps fingerprint — or throws with structured errors

Verifying on the consuming side. Unlike finalize, these APIs report — they do not throw; a conforming applier checks the results and refuses on failure (spec §7):

const result = validate(doc);   // spec §8 layer 1 — structure, vocabulary, diff consistency
if (!result.valid) {
  throw new Error(`refusing changeset: ${result.errors.map((e) => e.path).join(", ")}`);
}
if (!verifyFingerprint(doc)) {  // spec §6 — content-addressed integrity
  throw new Error("refusing changeset: fingerprint mismatch");
}

verified-diff@0 UI patches (spec 0.2)

Surgical edits ride as a strict-dialect unified diff instead of a full artifact re-emission. validate covers the document-only layer; before applying, an applier MUST run the base-supplied layer (spec §8 layer 2):

import { createVerifiedDiff, verifyAgainstBase, artifactFingerprint } from "@vivariumjs/changeset";

const base = "const title = \"Loans\";\n";
const next = "const title = \"Active loans\";\n";
const patch = {
  profile: "verified-diff@0" as const,
  artifactId: "screen-loans",
  baseFingerprint: artifactFingerprint(base),
  diff: createVerifiedDiff(base, next), // deterministic, fail-closed dialect (spec §5.2.2)
  newFingerprint: artifactFingerprint(next),
  explanation: "Rename the title only",
};

const verdict = verifyAgainstBase(patch, base); // ① base fingerprint ② apply + result fingerprint
if (!verdict.ok) throw new Error("refusing patch: " + verdict.errors[0].message);
verdict.newContent; // exactly what the reviewer's diff described

Surface

| Module | Exports | | --- | --- | | canonicalize | canonicalize, canonicalBytes — RFC 8785 (JCS) | | fingerprint | fingerprintOf, stampFingerprint, verifyFingerprint, FINGERPRINT_PREFIX | | diff | createUnifiedDiff, applyUnifiedDiff, reverseApplyUnifiedDiff | | verified-diff | createVerifiedDiff, applyVerifiedDiff, parseVerifiedDiff, verifyAgainstBase — spec §5.2.2 dialect | | validate | validate, SUPPORTED_SPEC_VERSIONS, BASE_STATE_KINDS | | builder | createChangeset, addSchemaOp, addUiPatch, addDataPatch, finalize, artifactFingerprint |

Conformance

npm test runs the unit suite plus the shared spec/fixtures/ corpus. Independent implementations should reproduce those fixtures exactly; npm run generate-fixtures regenerates them from this reference implementation.