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

@console-one/scope

v0.1.1

Published

Constraint-propagation kernel over multi-dimensional anchors. Patches walk a trie of latent constraints; merges resolve them with three-valued validity (met / unmet / undetermined) and a preempt-or-hoist protocol. The substrate underneath access control,

Readme

@console-one/scope

Constraint-propagation kernel over multi-dimensional anchors.

A patch is a (context, [walks]) batch. The kernel processes each walk in order against a trie of mounted constraints; later walks see facts mounted by earlier walks. Each constraint resolves to a three-valued validity — met / unmet / undetermined — and a per-validity policy decides whether to continue, preempt (halt the rest of the patch), or hoist (escalate the constraint to an outer scope to fill in).

The same kernel drives access control, type checking, gates, and lifecycle — it doesn't know the difference; the difference is in which evalShape a resolver is registered for.

Install

npm install @console-one/scope

Quick start

import {
  Kernel,
  literal, REFPATH, SCOPE, IDENTITY,
  StrictPolicy,
  type EvaluatorInput,
  Validity,
} from '@console-one/scope';

const k = new Kernel();

// Register a resolver for the 'check.type' shape.
k.registerResolver<EvaluatorInput, Validity>({
  shape: 'check.type',
  fn: (input) => {
    const expected = input.meta.expected as string;
    const v = (input.patch as any).value;
    return typeof v === expected ? 'met' : 'unmet';
  },
});

// Mount a type-check constraint at root/b.a.
k.mount({
  id: 'type:b.a:number',
  anchor: { [SCOPE]: literal('root'), [REFPATH]: literal('b.a') },
  policy: StrictPolicy,        // unmet → preempt
  evalShape: 'check.type',
  meta: { expected: 'number' },
});

// Apply a patch: two walks, one batch.
const result = k.applyPatch({
  context: { [SCOPE]: 'root', [IDENTITY]: 'alice' },
  walks: [
    { [REFPATH]: 'b.a', value: 10 },   // type-check passes
    { [REFPATH]: 'b.b', value: 20 },   // no constraint mounted there
  ],
});

result.walks carries the per-walk matches and validities. result.preempted flags whether a strict-policy unmet halted the patch. result.totalHoist collects the constraints the kernel couldn't resolve locally — the outer scope is expected to supply resolvers and re-run.

Concepts

  • Patch: { context, walks }. Multi-walk by design — one logical operation can touch several anchors atomically. Walks are processed in order; later walks see facts mounted by earlier ones.
  • Constraint: { id, anchor, policy, evalShape, emitShape?, inputs?, meta }. anchor is a per-dimension pattern (literal / wildcard / bind); evalShape names a resolver registered with the kernel.
  • Validity: three-valued — met, unmet, undetermined. undetermined is the kernel's way of saying "not enough info here; escalate".
  • Policy: Record<Validity, 'continue' | 'preempt' | 'hoist'>. The three built-ins: StrictPolicy, PermissivePolicy, GatePolicy.
  • Preempt: a single walk's unmet (under StrictPolicy) halts the rest of the patch.
  • Hoist: an undetermined (or any hoist policy entry) pushes the constraint upward — the kernel records it on totalHoist / totalUnresolvedHoists for an outer scope to satisfy.
  • Emit: a constraint's emitShape resolver returns more constraints to mount, hoist, or attach (used to build rules: head/where/body).

Layout

src/
  types.ts         Coord / Patch / Walk / Pattern / Validity / Policy
  dimension.ts     DefaultDimension + dim helpers
  constraint.ts    Constraint shape, InputQuery, EmittedConstraint
  trie.ts          Anchor-pattern trie (the matcher)
  merge.ts         Walk merging, validity resolution
  kernel.ts        Kernel.applyPatch + mount + registerResolver
  resolver.ts      EvaluatorInput / EmitterInput / Registry
  smoke.ts         End-to-end example: type checks, gates, rules, escalation
  test/            assessable test suite

Scripts

  • npm run buildtsc -p tsconfig.build.json
  • npm test — runs dist/test-runner.js (see @console-one/assessable)
  • npm run smokenode dist/smoke.js

Tests

5 cases via @console-one/assessable:

  • multi-walk patch with type checks (3)
  • rule head/where/body fires after second walk (1)
  • escalation: missing resolver → undetermined → hoisted with shape preserved (1)

License

MIT — see LICENSE.