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

@tessar/mongodb

v0.1.3

Published

Transactional MongoDB persistence for Tessar state and checkpoints.

Readme

@tessar/mongodb

MongoDB storage for Tessar using the native mongodb driver. Requires a replica set or sharded MongoDB deployment supporting transactions; standalone servers are rejected during setup. Repository CI is configured to test a MongoDB 8 replica set.

import { MongoDBStoragePlugin } from "@tessar/mongodb";

const storage = new MongoDBStoragePlugin({
  uri: process.env.MONGODB_URL!,
  databaseName: "my_agent",
  clientOptions: { maxPoolSize: 10 },
});
// Include storage in your Tessar plugins configuration.

createMongoDBBackend(options) exposes the same backend directly. The plugin registers it with tessar.storage.register; the backend owns its MongoClient and its idempotent close() closes that client. Initialization failures close it too. Use clientOptions for native TLS and connection-pool configuration.

The database contains tessar_* collections for sessions, plugin state, thread heads, checkpoints, version intervals, staging and commit receipts. Messages and execution records are versioned individually; unchanged messages are not copied into each checkpoint. Staging uses separate message and record documents, so a conversation can exceed MongoDB's 16 MiB document limit. Each individual message, record, checkpoint metadata or plugin state must still fit that native limit. Large commits are also subject to MongoDB transaction resource/time limits.

Publication uses snapshot transactions and majority acknowledgement. Lease expiry uses server time. Lease documents retain monotonic fencing tokens after release and purge. Thread coordination writes serialize publication, takeover, session selection, fork-source validation and purge across clients.

Set TESSAR_TEST_MONGODB_URL in the repository's ignored .env.storage, then run pnpm test:storage. Tests skip explicitly without a URL. Each test creates and drops only its generated tessar_test_<uuid> database. The database user needs collection/index creation and database deletion privileges; the rollback test also uses collMod on its generated collection. Never put credentials in tracked files. No external Docker setup is required when using an existing replica set.

The physical schema is versioned in tessar_schema (version 1). Unsupported versions fail before creating application collections or indexes. Initial unversioned data is retained. Metadata is stamped only after initialization finishes, so an interrupted initial setup can be retried without a reset.

The adapter separates schema.ts, ownership.ts, versions.ts, queries.ts, connection/transaction lifecycle in database.ts, and contract wiring in backend.ts. It follows the same logical storage rules as SQLite/PostgreSQL; native collections and transactions implement those rules.