Files
Hayden Bleasel 67e0e1ba23 Fix Redis state typings for url and client options (#303)
* Fix Redis state typings for url and client options

* Wait for injected Redis clients to become ready

* Simplify Redis readiness guard

* Stabilize memory state TTL test with fake timers

* Handle Redis reconnect errors until client is ready

* Handle injected Redis client reconnects correctly
2026-03-28 11:18:03 +11:00
..
2026-03-25 21:36:16 -04:00
2026-03-25 21:36:16 -04:00
2026-03-09 16:09:42 -07:00
2025-12-21 20:48:14 -08:00
2026-02-27 09:58:28 -08:00

@chat-adapter/state-memory

npm version npm downloads

In-memory state adapter for Chat SDK. For development and testing only — state is lost on restart.

Warning: Only use the memory adapter for local development and testing. State is lost on restart and locks don't work across multiple instances. For production, use @chat-adapter/state-redis, @chat-adapter/state-ioredis, or @chat-adapter/state-pg.

Installation

pnpm add @chat-adapter/state-memory

Usage

import { Chat } from "chat";
import { createMemoryState } from "@chat-adapter/state-memory";

const bot = new Chat({
  userName: "mybot",
  adapters: { /* ... */ },
  state: createMemoryState(),
});

No configuration options are needed.

Features

Feature Supported
Persistence No
Multi-instance No
Subscriptions Yes (in-memory)
Locking Yes (single-process only)
Key-value caching Yes (in-memory)
Zero configuration Yes

Limitations

  • Not suitable for production — state is lost on restart
  • Single process only — locks don't work across multiple instances
  • No persistence — subscriptions reset when the process restarts

When to use

  • Local development
  • Unit testing
  • Quick prototyping

License

MIT