UNPKG

@mastra/core

Version:
26 lines • 1.58 kB
import type { IMastraLogger } from '../../logger/index.js'; import type { MastraMemory } from '../../memory/memory.js'; import type { MemoryConfigInternal } from '../../memory/types.js'; import type { MastraDBMessage, MessageList } from '../message-list/index.js'; import type { SaveQueueManager } from './index.js'; /** * A processOutputResult tripwire skips the run-level save, but response messages may already * be stored: flushed before a tool-approval suspension, or per step with savePerStep. Undo * those writes so a blocked reply never reaches the thread (and the model on the next turn). * Messages that arrived from memory or as input (e.g. a client re-sending an earlier assistant * message with a tool result) belong to earlier turns and are never deleted. New output can * merge into such a message, so a stored copy that changed during this run is put back to * `earlierTurnSnapshot`, the content it had when the run started. Only ids actually found in * storage are touched, so runs that saved nothing early never write. */ export declare function undoSavedResponseMessages({ memory, threadId, memoryConfig, messageList, saveQueueManager, earlierTurnSnapshot, logger, runId, }: { memory: MastraMemory | undefined; threadId: string | undefined; memoryConfig: MemoryConfigInternal | undefined; messageList: MessageList; saveQueueManager: SaveQueueManager | undefined; earlierTurnSnapshot?: MastraDBMessage; logger: IMastraLogger; runId: string; }): Promise<void>; //# sourceMappingURL=undo-saved-response-messages.d.ts.map