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

mechbench-models

v0.107.0

Published

Shared TypeScript types for mechbench platform objects (User, Org, Project, Workspace, ApiKey, etc.). Consumed by mechbench-ui and mechbench-api. Distinct from mechbench-schema, which covers wire-format data records.

Readme

mechbench-models

Shared TypeScript types for mechbench platform objects — User, Org, Project, Workspace, ApiKey, Membership, Invitation. Consumed by mechbench-ui and mechbench-api.

What's in here (and what isn't)

This package holds the types that describe who uses the platform and how they're organized — users, orgs, workspaces, projects, memberships, API keys, invitations. It does not hold types for data records produced by the compute engine (experiment outputs, cache entries, emission shapes) — those live in mechbench-schema.

| | mechbench-schema | mechbench-models (this package) | |---|---|---| | Source of truth | Pydantic models | Hand-written TypeScript + Zod | | Content | Wire-format data records | Platform objects | | Publications | PyPI + npm | npm only | | Cross-language? | Yes — TS generated from Pydantic | TS-only today; Python bindings only if a real need arises | | Update cadence | With the emission protocol | With platform features (auth, billing, admin) | | Generated? | TS side generated from Pydantic | Hand-written |

If you're tempted to put a type in the wrong package, ask: does this shape describe a thing users/orgs/projects care about (→ models), or a shape that crosses the Python/TS boundary as experiment output (→ schema)?

Using it

import { UserSchema, type User, type Workspace, type ApiKey } from "mechbench-models";

// Validate an incoming payload at an API boundary:
const parsed: User = UserSchema.parse(request.body);

// Or use the inferred type for application-internal data:
function welcomeMessage(user: User): string {
  return `Hello, ${user.displayName ?? user.handle}`;
}

Every object is defined as a Zod schema with a derived TypeScript type via z.infer<typeof Schema>. Consumers pick whichever they need:

  • The schema (runtime) for validation at boundaries (request parsing, database roundtrip verification, form submission).
  • The type (compile-time) for application-internal code.

Both come from one definition, so they can't drift.

Current types

  • User — platform user. handle is authoritative as the owner segment of MechbenchPaths.
  • Org — organization. Owns workspaces; users become members via Membership.
  • Workspace — top-level organizational unit. Maps 1:1 to the <owner> segment of a MechbenchPath; either a user workspace or an org workspace.
  • Project — second path segment under a workspace. Contains charts, articles, experiments, probes, corpuses, cached intermediates.
  • Membership — user's access to an org or workspace with a role (owner | admin | editor | viewer).
  • ApiKey — issued to a user, optionally scoped to an org. Plaintext shown once at creation; only hash stored at rest.
  • Invitation — pending membership invitation. One-time-use token; transitions to an actual Membership on acceptance.

Relationship to MechbenchPath

The identity scheme (docs) addresses every object in the platform by a MechbenchPath like <owner>/<project>/<folders>/<leaf>. Platform objects in this package provide the grounding for those paths:

  • A User.handle or Org.handle is the <owner> segment.
  • A Project.slug is the <project> segment.
  • Everything under <owner>/<project>/… is a resource that (a) this package doesn't model directly and (b) permissions check against a Membership for the owning scope.

MechbenchPathSchema is re-exported from ./primitives as a Zod schema; it accepts any of the five categories from the identity doc (user-named, canonical, platform, global-hash, scoped-hash). The authoritative validator (deep structural checks) lives in mechbench-schema's Python identity module and its TS mirror in mechbench-ui/src/lib/mechbenchPath.ts; this package's schema is the lightweight version for platform-object boundary checks.

Status

v0.1.0. Scaffolded per task 000168 with an initial set of seven objects + three primitives. The next meaningful expansion is probably the auth/session types (token, refresh-token, session), which are close cousins to ApiKey but different enough to warrant their own file.

Open work tracked in the meta repo's tasks/mechbench-models/ directory.

License

MIT.