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

@oh-my-ai-sdk/sessions

v0.0.1

Published

The durable conversation record for AI SDK agents: provenance-cited derive-at-write append, ghost-guard reply extraction, turn fencing, fail-loud reads.

Readme

sessions

The durable conversation record for AI SDK agents. Full design: docs/sessions.md (repo root).

import { createSessionStore, MemoryStorage } from "sessions";

const store = createSessionStore({ storage: new MemoryStorage() });
const s = await store.open("thread-42");

await s.say("hello");
const row = await s.turn((t) => generateText({ model, messages: t.messages }));
// row.content derived from a persisted raw turn record, citing row.sourceRef
await store.verifyRow("thread-42", row.seq); // { ok: true } — the mini-terra
  • Two-phase append: raw turn record persisted first; the display row is derived FROM it and cites it (sourceRef). verifyRow re-derives and compares — ghost-class drift (a displayed reply not derivable from its source) is mechanically detectable.
  • Ghost-guard extraction: reply text comes from the turn's NEW messages only; a text-less final message (finishReason=length, reasoning-only) yields an honest (no text reply) placeholder with finishReason surfaced — never a walk into history.
  • Fencing: epoch/nextTurn CAS; concurrent turns lose loudly.
  • Fail-loud reads: waitReply returns placeholder rows (caller sees placeholder: true), throws on failed sessions, never silently filters.
  • Two provenance drivers, one surface: ownTurnRecord() (plain tool-loop agents — the package persists the truth) and workflowJournal() (workflow agents — cite the journal step, store nothing twice).
  • Storage SPI: MemoryStorage shipped; PostgresStorage takes any injected sql.unsafe-capable driver (Bun.SQL, postgres.js) — no driver dependency.

Proofs: bun test (11 contract tests, incident shapes pinned); bun smoke/live-glm.ts (real model through plain-loop mode); SESSIONS_PG_URL=… bun smoke/pg-smoke.ts (real Postgres).

Lineage: ria's chat store (fencing, the ghost-reply incident and fix), skill-ai-backend's transcript lessons (empty-assistant prune as a PROMPT projection — placeholder rows never enter the derived prompt but never leave the record; "the session is the only source of truth"). Deliberately out of scope: client-executable operations, UI chat state (wrap the SDK's own Chat/useChat), memory consolidation (the memory standard's job).