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

@acpjs/registry

v0.2.1

Published

acpjs registry index fetch/cache, AgentDefinition resolution, and ensureInstalled.

Downloads

55

Readme

@acpjs/registry

ACP registry index fetch/cache, AgentDefinition resolution, and ensureInstalled install flow. Node-only, ESM-only, node >= 24.

Default data source: https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json (/latest/ is the only published path).

Install

pnpm add @acpjs/registry

Usage

import { createRegistryClient } from '@acpjs/registry'
import { createAcpHost } from '@acpjs/core'

const registry = createRegistryClient()

const unsubscribe = registry.subscribe((event) => {
  if (event.type === 'install-progress' && 'downloadedBytes' in event.payload) {
    console.log(
      `downloading ${event.payload.downloadedBytes}/${event.payload.totalBytes ?? '?'}`,
    )
  }
})

const definition = await registry.ensureInstalled('claude-acp')
unsubscribe()

const host = createAcpHost()
await host.spawnAgent(definition) // AgentDefinition is isomorphic to hand-written config

Exports

  • createRegistryClient(options?): RegistryClient
  • RegistryError (carries a code: RegistryErrorCode)
  • Constants: DEFAULT_INDEX_URL, DEFAULT_INDEX_TTL_MS
  • Types: RegistryClient, RegistryClientOptions, EnsureInstalledOptions, RegistryEvent, RegistryEventListener, FetchLike, PathProbe, RegistryIndex, RegistryEntry, RegistryDistribution, PackageDistribution, BinaryTarget, PlatformKey, AgentDefinition, InstallArtifact, RegistryError, RegistryErrorCode.

RegistryClient

  • getIndex(): Promise<RegistryIndex> — cached { version?, entries }.
  • getEntry(agentId): Promise<RegistryEntry | undefined>
  • ensureInstalled(agentId, options?): Promise<AgentDefinition> — four-tier resolution + install.
  • getInstallArtifact(agentId): Promise<InstallArtifact | undefined>
  • subscribe(listener): () => voidinstall-progress + diagnostic events (@acpjs/protocol host shapes, one monotonic seq).

RegistryClientOptions (all injectable)

| Option | Default | | ------------------- | -------------------------------------- | | fetch | globalThis.fetch | | cacheDir | platform cache dir (acpjs namespace) | | indexUrl | DEFAULT_INDEX_URL | | indexTtlMs | DEFAULT_INDEX_TTL_MS (1 hour) | | now | Date.now | | platform / arch | process.platform / process.arch | | pathProbe | PATH executable probe |

ensureInstalled resolution order

  1. Explicit commandensureInstalled(id, { command, args?, env? })AgentDefinition directly (no network/index/meta).
  2. Executable on PATH — probe finds candidate; args/env from the matching distribution form.
  3. Package-manager runnpx/uvx distribution → command: 'npx'|'uvx', args: [package, ...args] (npx preferred when both exist; no injected flags).
  4. Binary download/install — map platform/arch to one of six keys ({darwin|linux|windows}-{aarch64|x86_64}) → download → extract → chmod 755 → write artifact.json. Target cmd/args/env flow into the AgentDefinition.

Install state machine: resolving → (cache-hit → installed) or resolving → downloading → extracting → installed; any failure → failed (payload carries reason); the install dir is removed so no half-written artifacts remain. Idempotent per (agentId, version, platform).

Index cache

  • Cached at <cacheDir>/registry-index.json; served within TTL (1h default), shared across processes.
  • Network failure with cache → stale cache + diagnostic (warn, registry/index-stale-fallback); no cache → RegistryError('registry/index-unavailable').
  • Index body must be an object with an agents array, else registry/index-invalid. Unparseable entries are skipped individually (registry/entry-invalid).

Archive formats

  • Extracted: .tar.gz, .tgz (gzip tar), .zip (pure-JS reader; store/deflate only).
  • Raw binary (any other suffix, e.g. .exe) → written directly, no extracting stage.
  • Rejected before download: .dmg, .pkg, .deb, .rpm, .tar.bz2, .tbz2registry/unsupported-archive.
  • Tar extraction via node-tar in-process (security defaults on: leading / stripped, .. refused, no write through symlinks). Downloads capped at 1 GiB; each zip entry capped at 256 MiB inflated; zip-slip guarded.

Diagnostics & error codes

| Channel | Code | Meaning | | ------------------- | ------------------------------- | ------------------------------------------ | | diagnostic (warn) | registry/index-stale-fallback | network failure, stale cache served | | diagnostic (warn) | registry/entry-invalid | skipped unparseable entry | | RegistryError | registry/index-unavailable | network failure, no cache | | RegistryError | registry/index-invalid | index not { agents: [] } | | RegistryError | registry/agent-not-found | no entry for agentId | | RegistryError | registry/no-distribution | entry has no usable distribution | | RegistryError | registry/platform-unsupported | no binary target / unmappable platform | | RegistryError | registry/unsupported-archive | unsupported format | | RegistryError | registry/download-failed | download threw / non-2xx | | RegistryError | registry/install-failed | post-extraction error (e.g. cmd missing) |

Known constraints

  • No checksum/signature verification — the index carries no integrity values; integrity relies on TLS + the official CDN. The verifying stage is skipped.
  • PATH probe candidates (in order): basename of the platform's binary cmd, then entry id; default walks PATH for execute permission (windows tries .exe/.cmd).
  • meta pass-through — registry-sourced AgentDefinitions carry meta: { name, version, registryId, icon? }.
  • Windows binaries are written + chmod'd like any platform; execution depends on the published cmd.