@mastra/core
Version:
32 lines • 1.17 kB
TypeScript
import { ThreadStateStorage } from './base.js';
/**
* In-memory implementation of {@link ThreadStateStorage}.
*
* Holds each thread's state in a `Map<threadId, Map<type, value>>`. Stored
* values are cloned on read and write so callers cannot mutate the backing
* value.
*
* This is the default thread-state store wired by the composite store: task
* tracking works out of the box without a configured backend. It is **not**
* durable across process restarts — configure a durable backend (e.g.
* `@mastra/libsql`) for state that must survive a restart.
*/
export declare class InMemoryThreadStateStorage extends ThreadStateStorage {
private readonly stateByThread;
init(): Promise<void>;
getState<T = unknown>({ threadId, type }: {
threadId: string;
type: string;
}): Promise<T | undefined>;
setState<T = unknown>({ threadId, type, value }: {
threadId: string;
type: string;
value: T;
}): Promise<void>;
deleteState({ threadId, type }: {
threadId: string;
type: string;
}): Promise<void>;
dangerouslyClearAll(): Promise<void>;
}
//# sourceMappingURL=inmemory.d.ts.map