import { type AgentDbMessage, type BuiltEpisodicMemoryCaptureStore, type BuiltEpisodicMemoryStore, type BuiltMemory, type BuiltObservationLogStore, type BuiltObservationLogTaskLockStore, type MemoryDescriptor, type NewObservationLogEntry, type ObservationCursor, type ObservationLogEntry, type ObservationLogReadOptions, type ObservationLogReflection, type ObservationLogReflectionResult, type ObservationLogScope, type ObservationLogTaskKind, type ObservationLogTaskLockHandle, type Thread } from '@n8n/agents'; import { AgentMemoryEntryCandidateRepository } from '../repositories/agent-memory-entry-candidate.repository'; import { AgentMemoryEntryLockRepository } from '../repositories/agent-memory-entry-lock.repository'; import { AgentMemoryEntrySourceRepository } from '../repositories/agent-memory-entry-source.repository'; import { AgentMemoryEntryRepository } from '../repositories/agent-memory-entry.repository'; import { AgentMessageRepository } from '../repositories/agent-message.repository'; import { AgentObservationCursorRepository } from '../repositories/agent-observation-cursor.repository'; import { AgentObservationLockRepository } from '../repositories/agent-observation-lock.repository'; import { AgentObservationRepository } from '../repositories/agent-observation.repository'; import { AgentResourceRepository } from '../repositories/agent-resource.repository'; import { AgentThreadRepository } from '../repositories/agent-thread.repository'; export declare class N8nMemory { private readonly threadRepository; private readonly messageRepository; private readonly resourceRepository; private readonly observationRepository; private readonly observationCursorRepository; private readonly observationLockRepository; private readonly memoryEntryRepository; private readonly memoryEntryCandidateRepository; private readonly memoryEntryLockRepository; private readonly memoryEntrySourceRepository; constructor(threadRepository: AgentThreadRepository, messageRepository: AgentMessageRepository, resourceRepository: AgentResourceRepository, observationRepository: AgentObservationRepository, observationCursorRepository: AgentObservationCursorRepository, observationLockRepository: AgentObservationLockRepository, memoryEntryRepository: AgentMemoryEntryRepository, memoryEntryCandidateRepository: AgentMemoryEntryCandidateRepository, memoryEntryLockRepository: AgentMemoryEntryLockRepository, memoryEntrySourceRepository: AgentMemoryEntrySourceRepository); getImplementation(agentId: string): N8nMemoryImpl; } export declare class N8nMemoryImpl implements BuiltMemory, BuiltObservationLogStore, BuiltObservationLogTaskLockStore, BuiltEpisodicMemoryStore, BuiltEpisodicMemoryCaptureStore { private readonly agentId; private readonly threadRepository; private readonly messageRepository; private readonly resourceRepository; private readonly observationRepository; private readonly observationCursorRepository; private readonly observationLockRepository; private readonly memoryEntryRepository; private readonly memoryEntryCandidateRepository; private readonly memoryEntryLockRepository; private readonly memoryEntrySourceRepository; constructor(agentId: string, threadRepository: AgentThreadRepository, messageRepository: AgentMessageRepository, resourceRepository: AgentResourceRepository, observationRepository: AgentObservationRepository, observationCursorRepository: AgentObservationCursorRepository, observationLockRepository: AgentObservationLockRepository, memoryEntryRepository: AgentMemoryEntryRepository, memoryEntryCandidateRepository: AgentMemoryEntryCandidateRepository, memoryEntryLockRepository: AgentMemoryEntryLockRepository, memoryEntrySourceRepository: AgentMemoryEntrySourceRepository); readonly episodic: BuiltEpisodicMemoryCaptureStore['episodic']; getThread(threadId: string): Promise; saveThread(thread: Omit): Promise; private ensureResource; deleteThread(threadId: string): Promise; deleteThreadsByPrefix(threadIdPrefix: string): Promise; private dropEpisodicEntriesWithoutSources; getMessages(threadId: string, opts?: { limit?: number; before?: Date; resourceId?: string; }): Promise; saveMessages(args: { threadId: string; resourceId: string; messages: AgentDbMessage[]; }): Promise; deleteMessages(messageIds: string[]): Promise; deleteMessagesByThread(threadId: string, resourceId?: string): Promise; appendObservationLogEntries(rows: NewObservationLogEntry[]): Promise; getActiveObservationLog(scope: ObservationLogScope & { limit?: number; order?: 'asc' | 'desc'; }): Promise; getObservationLog(opts: ObservationLogReadOptions): Promise; getMessagesForObservationScope(observationScopeId: string, opts?: { since?: { sinceCreatedAt: Date; sinceMessageId: string; }; }): Promise; dropObservationLogEntries(ids: string[]): Promise; supersedeObservationLogEntries(ids: string[], supersededBy: string): Promise; applyObservationLogReflection(scope: ObservationLogScope, reflection: ObservationLogReflection): Promise; getCursor(observationScopeId: string): Promise; setCursor(cursor: ObservationCursor): Promise; acquireObservationLogTaskLock(observationScopeId: string, taskKind: ObservationLogTaskKind, opts: { ttlMs: number; holderId: string; }): Promise; releaseObservationLogTaskLock(handle: ObservationLogTaskLockHandle): Promise; private releaseScopeLock; private enqueueEpisodicMemoryCaptureCandidate; private getPendingEpisodicMemoryCaptureCandidates; private completeEpisodicMemoryCaptureCandidates; private recordEpisodicMemoryCaptureCandidateFailure; private acquireEpisodicMemoryTaskLock; private releaseEpisodicMemoryTaskLock; private saveEpisodicMemoryEntryWithSources; private searchEpisodicMemoryEntries; private episodicMemoryReadScopeIds; private getEpisodicMemoryEntrySources; private applyEpisodicMemoryReflection; describe(): MemoryDescriptor; private toAgentDbMessage; private toObservationLogEntry; private toEpisodicMemoryEntry; private toEpisodicMemoryCaptureCandidate; private toEpisodicMemoryEntrySource; private mergeThreadMetadata; private parseThreadMetadata; private toThread; }