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

@redtuma/store-do

v0.1.0

Published

Redtuma store adapter backed by a Cloudflare Durable Object — edge-native agent memory with no external database.

Readme

@redtuma/store-do

Edge-native agent memory for Redtuma, backed by a Cloudflare Durable Object. No external database: each conversation thread lives in its own strongly consistent, co-located DO instance that hibernates when idle and wakes on the next request — the natural home for agent state and human-in-the-loop workflows.

It implements the standard Redtuma Store interface, so anything that takes a Store (memory, workflow snapshots) works unchanged.

Install

pnpm add @redtuma/store-do

Define the Durable Object

// src/memory.ts
import { RedtumaMemoryObject, type KVStorage } from '@redtuma/store-do'

export class Memory extends RedtumaMemoryObject {
  constructor(state: DurableObjectState) {
    super(state.storage as unknown as KVStorage)
  }
}

Use it from a Worker

// src/worker.ts
import { Agent } from '@redtuma/core'
import { durableObjectStoreClient } from '@redtuma/store-do'
export { Memory } from './memory'

interface Env {
  MEMORY: DurableObjectNamespace
  ANTHROPIC_API_KEY: string
}

export default {
  async fetch(req: Request, env: Env): Promise<Response> {
    const { threadId, message } = await req.json<{ threadId: string; message: string }>()

    // One Durable Object per thread → strongly consistent per-conversation memory.
    const stub = env.MEMORY.get(env.MEMORY.idFromName(threadId))
    const store = durableObjectStoreClient(stub)

    const agent = new Agent({
      id: 'assistant',
      instructions: 'You are helpful.',
      model: 'anthropic/claude-opus-4-8',
    })

    // Persist this turn, then answer using prior history from the DO.
    await store.saveThread({
      id: threadId, resourceId: 'user', createdAt: new Date(), updatedAt: new Date(),
    })
    const history = await store.getMessages({ threadId, last: 20 })
    const res = await agent.generate([
      ...history.map((m) => ({ role: m.role, content: m.content })),
      { role: 'user', content: message },
    ])

    await store.saveMessages([
      { id: crypto.randomUUID(), role: 'user', content: message, createdAt: new Date(), threadId, resourceId: 'user' },
      { id: crypto.randomUUID(), role: 'assistant', content: res.text, createdAt: new Date(), threadId, resourceId: 'user' },
    ])
    return Response.json({ text: res.text })
  },
}

See wrangler.example.toml for the binding + migration.

Local development & testing

MemoryKVStorage mirrors the DO storage semantics (structured-clone writes, lexicographic key ordering) with no Workers runtime — ideal for unit tests and local runs:

import { DurableObjectStore, MemoryKVStorage } from '@redtuma/store-do'
const store = new DurableObjectStore(new MemoryKVStorage())

This adapter passes the shared runStoreConformance suite — the same contract the reference InMemoryStore satisfies.

API

  • DurableObjectStore(storage: KVStorage) — the Store implementation.
  • MemoryKVStorage — in-memory KVStorage for dev/test.
  • RedtumaMemoryObject — base Durable Object class exposing the store over JSON-RPC.
  • durableObjectStoreClient(fetcher) — a Store that forwards to a DO stub.