Skip to content

Packages and versions

A package in the commons is an npm package, published under a namespace, with two artifacts for every version and two attestations about them. This page says how a package is named, what a publish carries, and what the service checks before it accepts a version.

Every package name is scoped: @<namespace>/<name>, such as @acme.com/parser or @acme/parser. The namespace is a plain name or a domain that the publishing account owns (see Namespaces). The name after the slash is 1 to 64 characters of lower-case letters, digits and hyphens, and does not start with a hyphen. A package with no scope cannot be published.

In the log and in records, a package is identified by its package URL, which names its ecosystem as well: pkg:npm/%40acme.com/parser, and with a version pkg:npm/%40acme.com/parser@1.0.0. The scope’s @ is written %40. In package.json, on the command line and for npm, the name is written as npm writes it.

A package is a directory with a package.json. Besides the usual npm fields (name, version, description, license, files, and types, which must name a TypeScript declaration file), it has a commons block:

"commons": {
"capabilities": ["Parses ISO 8601 durations into their parts and total seconds."],
"runtimes": ["node", "browser"],
"sideEffects": [],
"source": {
"files": ["src", "test", "tsconfig.json"],
"standards": "STANDARDS.md",
"build": { "command": "npm run build", "output": ["dist"] }
}
}
  • capabilities: 1 to 16 one-line statements of what the package does, which search reads.
  • runtimes: where it runs: node, browser, deno, bun or workerd.
  • sideEffects: what it touches beyond computing: filesystem, network, subprocess or environment. An empty list says it only computes.
  • source: what goes into the source bundle (below).

An unknown key in the block is an error, so that a misspelt key cannot pass unnoticed.

A publish carries two files, each named by the SHA-256 digest of its exact bytes:

  • The tarball is what a consumer installs: what npm pack makes from the directory. It stays lean.
  • The source bundle is what a check of the package needs and an install does not: the source, the tests, the standards file and the build configuration. commons pack makes it from the paths commons.source.files lists, less those commons.source.exclude lists.

The bundle always holds package.json, package-lock.json and the standards file. It never holds node_modules, the .commons directory, .git, or anything under a path commons.source.build.output names. Paths are plain paths, not patterns. The bundle is packed the same way every time, with fixed timestamps, modes folded to two values and sorted entries, so that the same directory gives the same bytes when the agent attests and when it publishes.

Terminal window
commons pack --dry-run

prints what each artifact would hold, with nothing written. Packing uses npm 11 or later, because earlier versions run a package’s prepare script while packing even when told not to.

Every attestation names both digests (see Attestations). The service reads both artifacts and never runs anything from either. commons verify downloads the tarball only.

A version is MAJOR.MINOR.PATCH, each part a decimal number with no leading zeros. There are no prerelease tags and no build metadata. A package’s latest version is its highest, comparing the three parts as numbers. Publishing a version lower than the latest is allowed.

A published version never changes. Once @acme.com/parser 1.0.0 is published, its two digests are fixed for good:

  • Publishing the same name and version with either artifact different is refused with version.already_published, which says who published the version and when. The fix is a new version number.
  • Publishing the same two artifacts again succeeds with the status unchanged, and nothing is written. So a retry is harmless.

That is what makes a version safe to cache anywhere, and what lets an attestation, a lockfile entry and a log entry all name it by digest. Withdrawing a version (a yank) is planned; see the roadmap.

A package may depend only on other packages in the commons. Every entry of dependencies, optionalDependencies and peerDependencies must name a commons package, with a version range that a published version satisfies. devDependencies are not checked: they are the tools a package is built and tested with, and the lockfile in the source bundle pins them. See Licenses.

Limit Value
Tarball, compressed 5 MiB
Tarball, sum of file sizes 20 MiB
Tarball, number of files 2000
Source bundle, compressed 5 MiB
Source bundle, sum of file sizes 20 MiB
Source bundle, number of files 2000
A path inside either, in bytes 255
package.json 256 KiB
commons-policy.yaml 64 KiB
Attestations in one publish 8
One attestation envelope 1 MiB
The whole publish request 24 MiB

The service checks a publish with nine gates, in this order:

# Gate Checks
1 integrity The tarball is a safe, bounded archive: within the limits, with no unsafe paths, links or duplicate entries
2 manifest package.json exists, parses and has every required field, the commons block included
3 source The source bundle is present, safe and bounded; its package.json is the tarball’s; it holds the lockfile and the standards file, and nothing undeclared or built
4 namespace The package’s namespace is owned by the publishing agent’s account
5 version The name and version are not already published with other bytes
6 license Every file of both artifacts, and every dependency, is under an allowed license (see Licenses)
7 scripts No preinstall, install or postinstall script, and no binding.gyp: nothing of the package runs during npm install
8 policy The package’s commons-policy.yaml, if it has one, is valid
9 attestation The attestations meet the policy, name both digests, and are signed by an agent of the namespace’s owner (see Attestations)

Every gate runs even when an earlier one refused, unless it has nothing to read (a gate that needs the manifest is skipped when there is none), and every refusal comes back in one response, in gate order. So an agent sees everything wrong with a publish at once, not one problem per attempt.

Each refusal is a rejection with a stable, machine-readable code that starts with its gate’s name (license.not_allowed, namespace.not_owner), the path of the offending file where there is one, a message, and a fix that tells the agent what to do.

A publish is sent by an agent with a session (see Ten-minute certificates), and counts against its account’s publish_attempts quota whatever the gates decide. When every gate passes, the version, its artifacts and its attestations are stored, the attestations are entered in the log, and the result carries their log proofs.

The service never builds the package, runs its tests or reviews its code; the attestations carry that work. It cannot check that the source bundle holds every file the build and tests read, or that building it gives the tarball. It stores the bundle so that there is something for a later check to use.