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

@intx/db

v0.5.0

Published

Client, schema, migrations, and row parsers for the hub's PostgreSQL database

Readme

@intx/db

Drizzle ORM client, schema, migrations, and row parsers for the hub's PostgreSQL database. Owns the database-backed GrantStore, the tenant hierarchy walk, the credential resolution layer, the model catalog and its resolution into ordered inference sources, and the parseRow family that validates jsonb columns at the database boundary so internal code never re-checks them.

Consumed by @intx/hub-api (HTTP request handlers and grant middleware) and @intx/hub-sessions (session orchestration and agent repo metadata).

Surface

  • @intx/db — the client (createDB), config validator, migration runner, grant store, credential resolution, tenant hierarchy helpers, and the parseRow functions.
  • @intx/db/schema — the Drizzle table exports, used by callers that compose queries against the schema directly.
import { createDB } from "@intx/db";
import { agent } from "@intx/db/schema";
import { eq } from "drizzle-orm";

const { db } = createDB(process.env);

const row = await db.query.agent.findFirst({
  where: eq(agent.id, agentId),
});

The parseRow functions (parseWorkflowDefinitionRow, parseGrantRow, and so on) validate each table's jsonb columns once and return fully typed values; downstream code uses those values without re-casting. See CONVENTIONS.md for the project-wide rule against cast-at-callsite in DB consumers.

canExecuteWorkflowRun checks a loaded run's status, cancellation request, and lifetime deadline. For delivery, use withExecutableWorkflowRun with the authenticated allocation identity and a synchronous send callback. It locks the anchor run, which cancellation and retirement of a runnable deployment's allocation also write, then reads the allocation and checks the current time. It takes no lock on the allocation, so a pack receive holding that row does not delay delivery. Finish asynchronous message preparation before calling it; the callback queues frames on the socket and must not wait for a worker acknowledgement. An ineligible run throws WorkflowRunNotExecutableError; database failures remain errors so callers can retry them.

Connections created by createDB set PostgreSQL's statement_timeout to 60,000 milliseconds. Override it with statementTimeoutMs in DBConfig (a positive integer up to 2,147,483,647 milliseconds). The Hub and the bin/ database scripts read this override from DB_STATEMENT_TIMEOUT_MS.

PostgreSQL cancels statements that exceed the deadline, including time waiting for locks. An uncaught timeout rolls back the enclosing transaction. This bounds individual statements once they reach PostgreSQL; pool waits, network stalls, and time between statements in an open transaction remain outside that deadline. Migration clients use their own connection settings.

Model catalog

The model, model_provider, model_offering, and model_pricing tables hold a tenant-scoped catalog of models, the providers that serve them, their pairings (offerings), and append-only multi-currency pricing. catalog-resolution lists the models, providers, and offerings visible to a tenant after walking the ancestor chain leaf-to-root: the nearest tenant to define an entry wins (shadowing), and a disabled entry suppresses it for that tenant and its descendants. model-source-resolution turns an agent's model requirements plus a launch's invoker preferences into an ordered InferenceSource[] — the head is the active source, the tail is the failover chain — dereferencing each offering's provider credential to the secret. pricing.resolveActivePrice selects, per currency, the row in effect at a given time from the append-only history, and getDescendantTenants walks the subtree so a catalog edit can be pushed to every affected running instance.