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

@pyhall/core

v0.2.0

Published

PyHall TypeScript — WCP Worker Class Protocol reference implementation

Downloads

13

Readme

@pyhall/core — TypeScript WCP Reference Implementation

The TypeScript/Node.js port of PyHall — the Worker Class Protocol reference implementation.

WCP version: 0.1 Package version: 0.1.0

Install

npm install @pyhall/core

Quick start

import { makeDecision, Registry, loadRulesFromDoc } from "@pyhall/core";

const rules = loadRulesFromDoc({
  rules: [
    {
      rule_id: "rr_hello_dev_001",
      match: { capability_id: "cap.hello.greet", env: { in: ["dev", "stage"] } },
      decision: {
        candidate_workers_ranked: [
          { worker_species_id: "wrk.hello.greeter", score_hint: 1.0 }
        ],
        required_controls_suggested: ["ctrl.obs.audit-log-append-only"],
        escalation: { policy_gate: false },
        preconditions: {},
      },
    }
  ]
});

const registry = new Registry();
registry.enroll({
  worker_id: "org.example.hello-greeter",
  worker_species_id: "wrk.hello.greeter",
  capabilities: ["cap.hello.greet"],
  currently_implements: ["ctrl.obs.audit-log-append-only"],
});

const decision = makeDecision({
  inp: {
    capability_id: "cap.hello.greet",
    env: "dev",
    data_label: "PUBLIC",
    tenant_risk: "low",
    qos_class: "P2",
    tenant_id: "demo",
    correlation_id: "550e8400-e29b-41d4-a716-446655440000",
  },
  rules,
  registryControlsPresent: registry.controlsPresent(),
  registryWorkerAvailable: (id) => registry.workerAvailable(id),
});

console.log(decision.denied);                      // false
console.log(decision.selected_worker_species_id);  // "wrk.hello.greeter"
console.log(decision.telemetry_envelopes.length);  // 3

Build

npm run build    # tsc → dist/
npm test         # jest (21 tests)
npm run typecheck  # tsc --noEmit

Package structure

src/
  models.ts       — TypeScript interfaces for RouteInput, RouteDecision, etc.
  router.ts       — makeDecision() — the routing engine
  rules.ts        — Rule type, loadRulesFromDoc(), routeFirstMatch()
  registry.ts     — Registry class
  policyGate.ts   — PolicyGate stub
  telemetry.ts    — telemetry envelope builders
  conformance.ts  — conformance validation
  common.ts       — nowUtc(), sha256Hex(), ok/err/partial helpers
  index.ts        — public API exports
workers/examples/
  hello-worker/   — minimal canonical worker example
tests/
  router.test.ts  — Jest test suite (21 tests, mirrors Python)

Design choices vs Python

| Concern | Python | TypeScript | |---------|--------|------------| | Data models | Pydantic BaseModel | TypeScript interface | | makeDecision() signature | Positional args | Single options object | | UUID | uuid.uuid4() | crypto.randomUUID() with fallback | | SHA-256 | hashlib.sha256 | Node crypto.createHash / SubtleCrypto for browser | | Runtime validation | Pydantic | Optional Zod (peer dep) | | Browser compat | N/A | src/ has no Node-only APIs except sha256Hex |

See WCP_SPEC.md for the protocol specification.