@mastra/core
Version:
28 lines • 1.18 kB
TypeScript
import type { RequestContext } from '../request-context/index.js';
import type { StorageThreadType } from './types.js';
export type MemoryRunStateAccessor = () => MemoryRunState | undefined;
export interface MemoryRunStateOptions {
memory: object;
threadId?: string;
resourceId?: string;
thread?: StorageThreadType | null;
ownershipValidated?: boolean;
}
/**
* Non-serializable memory state shared by consumers within one agent run.
*/
export declare class MemoryRunState {
#private;
readonly memory: object;
readonly threadId?: string;
readonly resourceId?: string;
constructor(options: MemoryRunStateOptions);
matches(memory: object, threadId?: string, resourceId?: string): boolean;
get threadLoaded(): boolean;
get thread(): StorageThreadType | null | undefined;
get ownershipValidated(): boolean;
load<T>(key: string, loader: () => Promise<T>): Promise<T>;
set<T>(key: string, value: T): void;
}
export declare function getMemoryRunState(requestContext: RequestContext | undefined, memory: object, threadId?: string, resourceId?: string): MemoryRunState | undefined;
//# sourceMappingURL=run-state.d.ts.map