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

@xemahq/capability-projection

v0.1.1

Published

Xema OS capability projection framework. CapabilityProjector is the shared reconcile engine every capability producer drives: serialized reconciles, content-aware fingerprint short-circuit, idempotent register-then-prune scoped to the refs a source previo

Downloads

3,567

Readme

@xemahq/capability-projection

This package belongs to Layer 1 — an SDK that depends only on Layer-0 contracts (@xemahq/kernel-contracts) plus npm libraries. It owns the shared reconcile engine behind capability projection: deriving capabilities from metadata a producer already has, instead of hand-authoring one descriptor at a time.

What it is

Two things, and nothing else:

  • CapabilitySource — the single interface a producer implements. It answers one question, "which capabilities should exist right now?", and has no other responsibility.
  • CapabilityProjector — the engine that turns that answer into a converged registry: serialized reconciles, content-aware fingerprint short-circuit, idempotent register-then-prune, and loud-and-retry error handling.

CapabilityRegistryProjectionClient is the shipped CapabilityProjectionSink — a registry-resolved, service-bearer-authenticated client for capability-registry-api. The sink is a port, so tests drive an in-memory double and the engine stays transport-free.

The projected shape (ProjectedCapability, CapabilityInvocationBinding) is a Layer-0 contract and lives in @xemahq/kernel-contracts/capability-projection — it crosses service boundaries, so it belongs with the protocol, not with the engine.

Invariants

  • Reconciles are serialized. Boot, post-sync and interval triggers queue on one chain; a register can never interleave with another pass's prune.
  • An unchanged fingerprint short-circuits. The fingerprint hashes target content, not just the ref set, so an edited descriptor is never silently elided while the steady-state tick still costs zero writes.
  • A projector prunes only refs it previously projected, and only those that no source currently claims. Two projectors share no state; two sources on one projector are differenced against the union, so neither can prune the other.
  • A failed reconcile retries the whole set. lastProjectedRefs and the fingerprint advance only after a fully successful pass, so a partial write is never mistaken for the new steady state.
  • Two sources emitting the same CapabilityRef is a fail-fast error naming both sourceKeys. Never last-writer-wins.
  • Provenance must name the emitting source. A target whose provenance.sourceKey disagrees with its source, or whose map key disagrees with its own ref, is rejected rather than absorbed.

Usage

class MySource implements CapabilitySource {
  readonly sourceKey = 'my-service:my-producer';

  async collectTargets(): Promise<Map<CapabilityRef, ProjectedCapability>> {
    /* derive from metadata you already have */
  }
}

const projector = new CapabilityProjector({
  label: 'my producer',
  sink: capabilityRegistryProjectionClient,
  logger: new Logger('MyProjector'),
  sources: [new MySource()],
});

await projector.bootReconcile(); // best-effort at boot
await projector.tickReconcile(); // on an interval; converges after an outage

License

Apache-2.0