UNPKG

agentic-qe

Version:

Agentic Quality Engineering Fleet System - AI-driven quality management platform

119 lines 3.09 kB
/** * MemoryManager - Intelligent memory management for AQE Fleet * * Provides in-memory storage with TTL support, namespacing, and optional * SQLite persistence for cross-session memory and agent coordination. */ /// <reference types="node" /> import { EventEmitter } from 'events'; import { Database } from '../utils/Database'; import { MemoryRecord } from '../types'; export interface MemoryOptions { ttl?: number; namespace?: string; metadata?: Record<string, any>; persist?: boolean; } export interface MemorySearchOptions { namespace?: string; pattern?: string; limit?: number; includeExpired?: boolean; } export interface MemoryStats { totalKeys: number; totalSize: number; namespaces: string[]; expiredKeys: number; persistentKeys: number; } export declare class MemoryManager extends EventEmitter { private readonly storage; private readonly database; private readonly logger; private readonly cleanupInterval; private readonly defaultTTL; private initialized; constructor(database?: Database); /** * Initialize the memory manager */ initialize(): Promise<void>; /** * Store a value in memory */ store(key: string, value: any, options?: MemoryOptions): Promise<void>; /** * Retrieve a value from memory */ retrieve(key: string, namespace?: string): Promise<any>; /** * Delete a key from memory */ delete(key: string, namespace?: string): Promise<boolean>; /** * Check if a key exists */ exists(key: string, namespace?: string): Promise<boolean>; /** * List all keys in a namespace */ list(namespace?: string): Promise<string[]>; /** * Search for keys by pattern */ search(options?: MemorySearchOptions): Promise<MemoryRecord[]>; /** * Clear all keys in a namespace */ clear(namespace?: string): Promise<number>; /** * Get memory statistics */ getStats(): MemoryStats; /** * Set TTL for an existing key */ setTTL(key: string, ttl: number, namespace?: string): Promise<boolean>; /** * Get TTL for a key */ getTTL(key: string, namespace?: string): Promise<number | undefined>; /** * Export memory data for backup */ export(namespace?: string): Promise<MemoryRecord[]>; /** * Import memory data from backup */ import(records: MemoryRecord[]): Promise<number>; /** * Cleanup expired keys */ cleanupExpired(): void; /** * Shutdown memory manager */ shutdown(): Promise<void>; /** * Create full key with namespace */ private createFullKey; /** * Check if a record is expired */ private isExpired; /** * Load a record from database */ private loadFromDatabase; /** * Load persistent memory from database */ private loadPersistentMemory; /** * Save memory to persistence */ private saveToPersistence; } //# sourceMappingURL=MemoryManager.d.ts.map