@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
44 lines • 1.76 kB
TypeScript
import type { UIMessage as UIMessageV4 } from '../../../_types/@internal_ai-sdk-v4/dist/index.js';
import type { AIV5Type, CoreMessageV4 } from '../types.js';
import type { MastraMessagePart } from './types.js';
/**
* CacheKeyGenerator - Centralized cache key generation for message equality checks
*
* This class provides consistent cache key generation across all message formats,
* which is critical for:
* - Deduplication of messages
* - Detecting when messages have been updated
* - Comparing messages across different formats
*
* Cache key invariants:
* - Same message content should always produce the same key
* - Different content should produce different keys
* - Provider metadata (e.g., OpenAI/Azure OpenAI text, reasoning, and tool itemId) must be included for proper distinction
*/
export declare class CacheKeyGenerator {
/**
* Generate cache key from AIV4 UIMessage parts
*/
static fromAIV4Parts(parts: UIMessageV4['parts']): string;
/**
* Generate cache key from a single AIV4 UIMessage part
*/
static fromAIV4Part(part: UIMessageV4['parts'][number]): string;
/**
* Generate cache key from MastraDB message parts
*/
static fromDBParts(parts: MastraMessagePart[]): string;
/**
* Generate cache key from AIV4 CoreMessage content
*/
static fromAIV4CoreMessageContent(content: CoreMessageV4['content']): string;
/**
* Generate cache key from AIV5 UIMessage parts
*/
static fromAIV5Parts(parts: AIV5Type.UIMessage['parts']): string;
/**
* Generate cache key from AIV5 ModelMessage content
*/
static fromAIV5ModelMessageContent(content: AIV5Type.ModelMessage['content']): string;
}
//# sourceMappingURL=CacheKeyGenerator.d.ts.map