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

@exellix/narrix-adapters-core

v2.0.0

Published

Deterministic, crypto-only core for Narrix adapters

Readme

@exellix/narrix-adapters-core

Deterministic, crypto-only core for Narrix adapters. Produces CNI v1.1–compatible output with no LLM, network, or filesystem use. Built for use by thin adapter packages (text, chat, docs, records).


Where This Package Fits

┌─────────────────────────────────────────────────────────────────────────┐
│  NARRIX ECOSYSTEM                                                        │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                          │
│   @exellix/narrix-cni          Schema & types (CNI v1.1)                │
│            ▲                                                             │
│            │                                                             │
│   @exellix/narrix-adapters-core ◄── YOU ARE HERE                         │
│   (this package)                 Shared algorithms: normalize, chunk,     │
│            ▲                     entities, hash, evidence, diagnostics   │
│            │                                                             │
│   ┌────────┴────────┬─────────────────┬─────────────────┐                │
│   │                 │                 │                 │                │
│   narrix-adapter-   narrix-adapter-   narrix-adapter-   narrix-adapter-  │
│   text              chat              docs              records          │
│   (separate pkgs)   (separate pkgs)   (separate pkgs)   (separate pkgs)   │
│                                                                          │
└─────────────────────────────────────────────────────────────────────────┘

This package provides the shared foundation. Adapter packages (text, chat, docs, records) depend on it and implement NarrixAdapter.toCni() for their input types. Golden tests (T1–T7, C1–C6, D1–D6) live in those adapter packages, not here.


Install

npm install @exellix/narrix-adapters-core

Registry: This package is published to GitHub Packages. Ensure your .npmrc includes:

@exellix:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=<YOUR_TOKEN>

Constraints

  • No LLM calls — pure functions only
  • No network or fs — Node built-in crypto only
  • No timestamps in IDs or hashes
  • Deterministic — same input ⇒ same output (stable IDs, sorted diagnostics/entities)

Adapter-specific logic (chat/docs/records) lives in adapter packages; this package provides shared contracts, normalization, chunking, entity extraction, and evidence helpers.

API

Contracts and options

  • AdapterKind, AdapterOptions, AdapterResult, AdapterDiagnostics — adapter contracts and result shape
  • NarrixAdapter<TInput> — interface adapters implement
  • NormalizationPolicy, ChunkingConfig, EntityExtractionPolicy — policy types
  • applyDefaults(partial) — fill in deterministic defaults for AdapterOptions

Algorithms

  • normalizeText(input, policy?) — newline normalization, zero-width removal, optional trim/collapse
  • chunkText(text, config?, limits?) — paragraph or hard chunking with overlap; surrogate-safe
  • extractEntities(text, policy?, limits?) — CVE, IP, URL, email, etc. with dedupe and priority
  • sha256(input), stableStringify(value) — hashing and canonical JSON
  • computeSubjectId(parts), computeContentId(parts) — deterministic IDs for CNI subject/content
  • createSpanEvidence(...), createPathEvidence(...) — build EvidencePointerV11 for CNI
  • createRoleMapRegistry(config) — tiered role-map resolution (Tier 1: collection, Tier 2: record type, Tier 3: generic field-name matching) for the record adapter; returns { resolve(params) } with ResolveResult { map, tiersApplied }

Diagnostics

  • DiagnosticsCollectorwarn(), error(), stat(), finalize({ sort })
  • Warning codes: TEXT_EMPTY, TEXT_TRUNCATED, CHAT_*, DOCS_*, ENTITY_LIMIT_REACHED
  • Role-map registry types: RoleMap, ResolvedRoleMap, TiersApplied, RoleMapRegistry, RoleMapRegistryConfig, ResolveParams, ResolveResult, FactEntry, GenericRoleMap

Example

import {
  normalizeText,
  chunkText,
  extractEntities,
  computeSubjectId,
  computeContentId,
  createSpanEvidence,
  applyDefaults,
} from "@exellix/narrix-adapters-core";

const opts = applyDefaults({ kind: "text", adapterId: "my-adapter", adapterVersion: "1.0.0" });
const { text } = normalizeText(input, opts.normalization);
const { chunks, truncated } = chunkText(text, opts.chunking, opts.limits);
const { entities } = extractEntities(text, opts.entities, opts.limits);

const subjectId = computeSubjectId({ kind: "text", stableKey: "source-1", normalizedText: text });
const contentIds = chunks.map((ch, i) =>
  computeContentId({ subjectId, chunkIndex: i, chunkText: ch.text })
);

Scripts

  • npm run build — compile TypeScript to dist/
  • npm test — build and run tests (Node node:test)

Publishing (private GitHub package)

  1. Ensure .npmrc exists with @exellix:registry and _authToken (or copy from .npmrc.example and add your token). .npmrc is gitignored to avoid committing secrets.
  2. Run npm run build then npm publish. The package will be published to GitHub Packages as a private package for the @exellix scope.

Status & Gap Analysis

| Status | Description | |--------|-------------| | ✅ Complete | All core modules implemented per spec | | ✅ No open issues | No TODOs, FIXMEs, or known bugs | | ✅ Tests passing | 31 unit tests (hash, chunk, entities, normalize, diagnostics) |

Gap analysis: See GAP_ANALYSIS.md for a detailed comparison against the NARRIX Adapters spec. Summary: one gap (entity kind default order) was fixed; the core is otherwise complete and ready for adapter consumption.


License

See repository license file.