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

@m4ike1/ion-session-backend-sqlite-node

v0.1.1

Published

Node sqlite session backend for @m4ike1/ion-agent-core sessions

Readme

@m4ike1/ion-session-backend-sqlite-node

SQLite session storage backend for @m4ike1/ion-agent-core, built on node:sqlite (node >= 22.19).

import { BACKGROUND_CONTEXT } from "@m4ike1/ion-agent-core";
import {
  createNodeSqliteFactory,
  SqliteSessionRepo,
} from "@m4ike1/ion-session-backend-sqlite-node";

const repository = new SqliteSessionRepo({
  directory: "/var/lib/ion/sessions",
  databaseFactory: createNodeSqliteFactory(),
});

const session = await repository.create({}, BACKGROUND_CONTEXT);
const main = await session.createBranch("main", null, BACKGROUND_CONTEXT);
await main.appendMessage(
  { role: "user", content: "hello", timestamp: Date.now() },
  BACKGROUND_CONTEXT,
);
await session.close(BACKGROUND_CONTEXT);
await repository.close(BACKGROUND_CONTEXT);

Layout

  • Default: one file per session under directory. Safe IDs ([A-Za-z0-9_-]+) map to {sessionId}.sqlite; all other IDs use a ~-prefixed base64url encoding of the UTF-16LE bytes. The durable session ID is unchanged; metadata.path carries the canonical physical path.
  • databasePath option: store multiple sessions in one shared container. Its parent directory is created on demand.

Lifecycle and ownership

  • open() and delete() reject metadata whose path is outside the configured repository, and never create a missing database.
  • list() is read-only and best-effort: corrupt files, version mismatches, and unrelated *.sqlite files are skipped.
  • One writable owner per session is the host's responsibility. The repo rejects overlapping local create/open/fork/delete for one ID but provides no cross-process lease, lock, fence, heartbeat, or takeover. Close a worker before deletion.
  • fork() of a source open in the same repo queues its snapshot on that source's commit queue. Any other source uses an independent read-only connection with one deferred WAL transaction; later worker commits may land while the snapshot is open. Forks copy entries and scalar/list values, not usage ledger rows.
  • repository.close() waits for every open session cleanup attempt before reporting errors (single error rethrown, multiple aggregated).
  • No search service or FTS index is exported; search is a separate projection.

Further reading

  • Setup and tasks — layout choice, open/list/delete/fork recipes, custom factories, shutdown order.
  • Reference — public API: repo, sessions, factory, database capability, sql helper, constants.
  • Concepts — file layout and ID encoding, ownership model, fork snapshots, version gate, schema.