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

@inbrowser/resumable

v0.2.0

Published

Resumable streaming-job engine: a pluggable JobStore contract + JobEngine that lets producers stream events into a durable log a subscriber can tail and resume. Backend-agnostic, with memory and Firebase RTDB stores plus durability and TTL probes.

Readme

@inbrowser/resumable

@inbrowser/resumable is a generic engine for resumable streaming jobs. A producer yields typed events, a JobStore appends those events to an ordered log, and subscribers can tail the log again from a known offset after a network drop, route handoff, or page reload.

The package has no LLM knowledge. LLM inference is one consumer through @inbrowser/relay; the same engine can back any long-running job that reports incremental events.

What It Provides

  • createJobEngine, which starts producers, appends their events, exposes snapshots, and returns a terminal marker when work finishes.
  • A JobStore<TEvent> contract for durable backends.
  • createMemoryJobStore for tests and local development.
  • createRtdbJobStore for Firebase Realtime Database persistence through REST writes and RTDB SSE watches.
  • Post-terminal TTL support through ttlMs, expiresAt, and sweepExpired.
  • @inbrowser/resumable/testing probes for durability and TTL sweep behaviour.

Quick Start

import { createJobEngine } from '@inbrowser/resumable';
import { createMemoryJobStore } from '@inbrowser/resumable/memory';

type ChunkEvent = { kind: 'chunk'; text: string };

const engine = createJobEngine<ChunkEvent>({
  store: createMemoryJobStore<ChunkEvent>(),
});

const { jobId } = await engine.start(async function* () {
  yield { kind: 'chunk', text: 'hello ' };
  yield { kind: 'chunk', text: 'world' };
});

for await (const item of engine.subscribe(jobId)) {
  if (item.kind === 'event') {
    console.log(item.seq, item.value);
  }
  if (item.kind === 'terminal') {
    console.log(item.status);
  }
}

await engine.stop();

Use subscribe(jobId, { from }) to resume from an offset. Events before from are skipped, so a client that has consumed events 0 and 1 reconnects with from: 2.

Durable Store

Use RTDB when the event log must survive process restart or a subscriber reconnecting through another server instance:

import { createJobEngine } from '@inbrowser/resumable';
import {
  createRtdbJobStore,
  serviceAccountTokenProvider,
} from '@inbrowser/resumable/rtdb';

type ChunkEvent = { kind: 'chunk'; text: string };

const store = createRtdbJobStore<ChunkEvent>({
  url: process.env.RTDB_URL!,
  auth: serviceAccountTokenProvider({ keyFile: './service-account.json' }),
  rootPath: 'resumable_jobs',
  defaultTtlMs: 7 * 24 * 60 * 60 * 1000,
});

const engine = createJobEngine<ChunkEvent>({
  store,
  sweep: { intervalMs: 60 * 60 * 1000 },
});

The durable store preserves the event log. It does not automatically restart a producer if the process running that producer is killed.

For efficient RTDB sweeps, add an index on the store root path:

{
  "rules": {
    "resumable_jobs": {
      ".indexOn": ["expiresAt"]
    }
  }
}

Documentation

The documentation follows the Diataxis approach: each page serves one kind of user need.

Package Exports

  • @inbrowser/resumable - createJobEngine plus core types.
  • @inbrowser/resumable/memory - in-process JobStore.
  • @inbrowser/resumable/rtdb - Firebase RTDB JobStore and token providers.
  • @inbrowser/resumable/testing - durability and TTL probe helpers.

Relationship To @inbrowser/relay

@inbrowser/relay uses this package to keep an LLM generation running on the server while browsers disconnect and reconnect. This package intentionally stops below HTTP framework concerns and below any LLM provider protocol.