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

@runtime-digital-twin/core

v1.0.1

Published

Core contracts and types for Runtime Digital Twin Platform

Downloads

215

Readme

@runtime-digital-twin/core

Core contracts and types for the Runtime Digital Twin Platform.

Overview

This package defines the three core JSON contracts used throughout the platform:

  • ReplayResult: Result of a single trace replay execution
  • SuiteResult: Aggregated result of multiple trace replays
  • TwinPlan: Plan for executing multiple trace replays

All contracts include:

  • TypeScript type definitions
  • Runtime validation using Zod schemas
  • JSON schema documentation

Installation

npm install @runtime-digital-twin/core

Usage

ReplayResult

import { validateReplayResult, type ReplayResult } from "@runtime-digital-twin/core";

const result: ReplayResult = {
  success: true,
  exitCode: 0,
  traceId: "trace-123",
  replayedStatus: 200,
  recordedStatus: 200,
  statusMatch: true,
  bodyMatch: true,
  outboundCallsMatch: true,
  dbQueriesMatch: true,
  errors: [],
  artifacts: [],
};

// Validate at runtime
const validated = validateReplayResult(result);

SuiteResult

import { validateSuiteResult, type SuiteResult } from "@runtime-digital-twin/core";

const suite: SuiteResult = {
  suiteId: "suite-123",
  startedAt: Date.now(),
  completedAt: Date.now(),
  status: "pass",
  totalReplays: 5,
  passedReplays: 5,
  failedReplays: 0,
  errorReplays: 0,
  results: [/* ReplayResult[] */],
  summary: {
    durationMs: 1000,
    statusMatches: 5,
    bodyMatches: 5,
    outboundCallsMatches: 5,
    dbQueriesMatches: 5,
    totalErrors: 0,
    totalArtifacts: 0,
  },
};

const validated = validateSuiteResult(suite);

TwinPlan

import { validateTwinPlan, type TwinPlan } from "@runtime-digital-twin/core";

const plan: TwinPlan = {
  planId: "plan-123",
  name: "Test Plan",
  version: "1.0.0",
  createdAt: Date.now(),
  tasks: [
    {
      taskId: "task-1",
      traceId: "trace-123",
    },
  ],
};

const validated = validateTwinPlan(plan);

Type Guards

import { isReplayResult, isSuiteResult, isTwinPlan } from "@runtime-digital-twin/core";

if (isReplayResult(data)) {
  // TypeScript knows data is ReplayResult
  console.log(data.traceId);
}

Error Formatting

import { validateReplayResult, formatValidationError } from "@runtime-digital-twin/core";
import { z } from "zod";

try {
  validateReplayResult(invalidData);
} catch (error) {
  if (error instanceof z.ZodError) {
    console.error(formatValidationError(error));
  }
}

Documentation

See /docs/contracts.md for complete JSON schema documentation and examples.

Development

# Build
npm run build

# Test
npm test

# Watch mode
npm run dev