@mastra/core
Version:
25 lines • 1.36 kB
TypeScript
import type { CoreMessage as CoreMessageV4 } from '../../../_types/@internal_ai-sdk-v4@0.0.98/dist/index.js';
import type { MastraDBMessage } from '../state/types.js';
import type { MessageInput } from '../types.js';
/**
* Convert CoreMessage content to a plain string.
* Extracts text from text parts and concatenates them.
*/
export declare function coreContentToString(content: CoreMessageV4['content']): string;
/**
* Compare two messages for equality based on their content.
* Uses cache keys for efficient comparison across different message formats.
*/
export declare function messagesAreEqual(one: MessageInput, two: MessageInput): boolean;
/**
* Whether `stored` is the persisted copy of `live`: the same id, and the same parts once
* both go through the cleanup memory applies when it saves a message. That cleanup makes
* `messagesAreEqual` treat a stored copy as a different message, for example when the live
* text ends in a newline.
*
* Saves through `MessageHistory` (observational memory's buffering) and the agent's save
* queue first run `filterMessagesForPersistence`, which also drops streaming `partial-call`
* tool parts, so the live message is matched with and without that filter.
*/
export declare function isPersistedCopy(live: MastraDBMessage, stored: MastraDBMessage): boolean;
//# sourceMappingURL=utils.d.ts.map