JSPM

  • Created
  • Published
  • Downloads 157456
  • Score
    100M100P100Q177755F
  • License MIT

In-memory state adapter for chat (development/testing)

Package Exports

  • @chat-adapter/state-memory

Readme

@chat-adapter/state-memory

In-memory state adapter for the chat SDK.

Note: This adapter is intended for development and testing only. For production, use @chat-adapter/state-redis or @chat-adapter/state-ioredis.

Installation

npm install chat @chat-adapter/state-memory

Usage

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

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

Features

  • Thread subscriptions (in-memory storage)
  • Distributed locking (single-process only)
  • Zero configuration required

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 process restarts

When to Use

  • Local development
  • Unit testing
  • Single-instance deployments (not recommended for production)

License

MIT