@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
30 lines • 1.54 kB
TypeScript
export declare const WORKING_MEMORY_START_TAG = "<working_memory>";
export declare const WORKING_MEMORY_END_TAG = "</working_memory>";
export declare const SYSTEM_REMINDER_START_TAG = "<system-reminder>";
export declare const SYSTEM_REMINDER_END_TAG = "</system-reminder>";
/**
* Extracts all working memory tag contents from text using indexOf-based parsing.
* This avoids ReDoS vulnerability that exists with regex-based approaches.
* @returns Array of full matches (including tags) or null if no matches
*/
export declare function extractWorkingMemoryTags(text: string): string[] | null;
/**
* Removes all working memory tags and their contents from text.
* Uses indexOf-based parsing to avoid ReDoS vulnerability.
*/
export declare function removeWorkingMemoryTags(text: string): string;
/**
* Extracts the content of the first working memory tag (without the tags themselves).
* Uses indexOf-based parsing to avoid ReDoS vulnerability.
* @returns The content between the tags, or null if no valid tag pair found
*/
export declare function extractWorkingMemoryContent(text: string): string | null;
/**
* Removes all system-reminder tags and their contents from text.
* Uses indexOf-based parsing to avoid ReDoS vulnerability.
*
* Note: system-reminder tags can have attributes like `<system-reminder type="...">`,
* so we match from `<system-reminder` to the closing `>` for the start tag.
*/
export declare function removeSystemReminderTags(text: string): string;
//# sourceMappingURL=working-memory-utils.d.ts.map