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

@nightseam/session

v0.4.0

Published

A session over the seam's connections: the relay, the registry, the holder of control, an in-memory log.

Downloads

298

Readme

@nightseam/session

npm install @nightseam/session

A session as a thing that outlives connections, over a tunnel's channels: one up channel the machine speaks the family on, any number of down channels the consumers speak it on in a role each, one holder of control, an ask routed to the holder, and a log of every frame in one order, replayed from a sequence. It is generic over the family: what a family governs reaches it as the decides and asks the generator renders for its session tier.

import { Registry, memoryLog } from '@nightseam/session';
import { decides, asks } from '@example/chat-client';

const registry = new Registry();
registry.bind('s-1', up, { decides: m => decides.has(m), asks: m => asks.has(m) }, memoryLog(1 << 20));
const attachment = registry.attach('s-1', down, 'participant', 'consumer:7', 0);
registry.control('s-1', attachment);
registry.attention();     // every session with an unanswered ask

const stop = registry.onChange(change => {
  change.kind;            // bound, attached, ask_routed, frame_appended, …
});
stop();                   // that registration, and no other

Every domain change of the registry goes two ways. Through onChange — one Change per change, carrying the session, whom it concerns, the method it names, the sequence the log reached and the trace of the frame it concerns — which is the hook a consumer builds its own events from, and the one place such events are computed. And to the observer of the peer the session's up channel runs over, as session.bound, session.unbound, session.attached, session.detached, ask.raised, ask.routed, ask.answered, control.changed, frame.appended and session.refused, declared into the runtime's ObserverEvents so that a consumer's switch (event.type) covers them beside the runtime's and the tunnel's. The session takes no observer of its own.

Both say names, ids, origins, sequences and sizes, and never a payload: frame.appended says which sequence, which direction, whose origin and how many bytes, and what the frame carried stays in the log.

The rules it holds, one test each in both languages: a response reaches the one consumer that asked and an event every attached one; a deciding frame is the holder's alone, refused with not_controlling from anyone else; an ask reaches the holder and follows a transfer while open; the session's ids are its own across consumers that both mint c:1; a consumer resumes from the log before any live frame; a frame's members the relay does not know arrive with it; the machine's channel ending ends every consumer, a consumer's only itself.

It has no authentication, no rule about who may take control or for how long, no durable store and no lifecycle of its own: those are the consumer's, called in. Log is the interface a durable store implements; memoryLog is the one shipped. The full description is docs/wire/session.md, and the surface in both languages docs/runtime/session.md.

Apache-2.0, with NOTICE beside it. The repository is Bitspark/nightseam.