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

@sema-agent/mods-kernel

v7.68.3

Published

The sema mods kernel: one extension bus (registration, admission, chain, failure and budget law) shared by the engine and the shell. Zero dependencies.

Readme

@sema-agent/mods-kernel

The mods kernel of the sema engine: one extension bus — registration and its two seats, tiers, admission through plugin.register, the ($, e, next) chain with next.to, re-entry frames, site rules, the failure / abort columns, .catch and the self budget. It is compiled from the same source the engine embeds, so a shell or a client can run the same rules on its own bus. Zero dependencies; runs in Node and in browsers; ships its own types.

Install

npm install @sema-agent/mods-kernel

ES modules only ("type": "module"), Node >= 20.18.1 where Node is used. One entry, .; there are no deep paths.

Version

@sema-agent/[email protected] is cut with @sema-agent/[email protected]: the same version number, built from the same commit. A package version moves with every core release whether or not the kernel changed; it says which core it was cut with, not whether the contract moved.

Two copies: KERNEL_CONTRACT_VERSION

Two copies of the kernel interoperate on plain objects (no instanceof, no module identity). A host that loads one copy beside another compares KERNEL_CONTRACT_VERSION for equality. Nothing in the kernel or the engine reads it, so two copies that differ are told apart only by a host that compares them. The number is an integer independent of the package version; it moves only when the chain semantics, the registration form, the event closed set (names and side) or the failure columns (failure, abort, pinned keys, an event's own budget ceiling, whether $ may call it) change — once per release, however many of them change in it.

@sema-agent/core does not depend on this package: it compiles the same source into its own build, so a process that installs both holds two copies. This package is for a host that runs its own bus; the engine does not need it installed.

Which side raises an event

Every name in MOD_EVENT_TABLE carries a side — engine, surface or both, the closed set MOD_EVENT_SIDES — and that is the one place the answer lives: readOnSide(name, side) and stationOn(name, side) read the same row.

import { KERNEL_CONTRACT_VERSION, MOD_EVENT_SIDES, MOD_EVENT_TABLE, readOnSide } from "@sema-agent/mods-kernel";

console.log(KERNEL_CONTRACT_VERSION);                  // an integer
console.log(MOD_EVENT_SIDES);                          // [ 'engine', 'surface', 'both' ]
console.log(MOD_EVENT_TABLE["tool.check"].side);       // engine
console.log(MOD_EVENT_TABLE["ui.render"].side);        // surface
console.log(readOnSide("plugin.register", "surface")); // true: its side is both

Exports

Each name below is a runtime value or a type exported from the package root. The root's declarations are the contract; a removed or re-kinded export is named as breaking in the @sema-agent/core release notes.

| Group | Names | | --- | --- | | Contract and closed sets | KERNEL_CONTRACT_VERSION MOD_TIERS MOD_SEATS MOD_EVENT_SIDES MOD_FAILURE_ANSWERS MOD_ABORT_POSTURES NEXT_TO_TABLE SEAT_TIER_TABLE | | Event table and readers | MOD_EVENT_TABLE isModEventName expandModPattern expandOnSide stationOn readOnSide failureRefuses nextToRefusal | | Event table types | ModTier ModRegistrationTier ModSeat ModEventSide ModBusSide ModFailureAnswer ModAbortPosture ModStation ModEventRow ModEventName | | Budgets | DEFAULT_MOD_BUDGET_MS CATCH_BUDGET_MS RUNAWAY_AFTER_MS POST_ABORT_GRACE_MS MAX_TIMER_MS clockMsRefusal resolveModBudgetMs ModBudgetReading | | Failure causes and site rules | MOD_FAILURE_CAUSES ModFailureCause ModEventPayload ModAnswerCheck ModAnswerRanks ModDispatchRun ModAnswerer ModMatcher ModSkip | | Registration | ENGINE_ORIGIN MODS_INVALID_CODE MODS_REGISTRATION_REFUSED_CODE MOD_TRACE_OUTCOMES ModTraceOutcome ModUses ModOrigin ModPluginFacts ModDollarBase ModTraceEntry ModCaughtError ModNext ModHandler ModHandlerOptions On ModRegistration ModAdmissionRecord ModSeats | | Typed event maps | ModEventPair ModEventMap ModTypedNext ModTypedHandler MappedOn | | Admission and the bus | admitMods ModFrame ModBottomContext ModMethodBottom ModMethodSeat ModMethodBottoms ModCallEntry ModCallEntries ModDispatchOutcome ModDispatchOptions ModParticipant ModBus ModMountedHandler ModBusInput ModTimer |

License

Business Source License 1.1, the same terms as @sema-agent/core; the licence text is the LICENSE file in this package.