UNPKG

n8n

Version:

n8n Workflow Automation Tool

41 lines (40 loc) 2.29 kB
import type { InstanceAiEnsureThreadResponse, InstanceAiRichMessagesResponse, InstanceAiThreadInfo, InstanceAiThreadListResponse, InstanceAiThreadMessagesResponse } from '@n8n/api-types'; import { Logger } from '@n8n/backend-common'; import { GlobalConfig } from '@n8n/config'; import { type AgentTreeSnapshot } from '@n8n/instance-ai'; import { DbSnapshotStorage } from './storage/db-snapshot-storage'; import { TypeORMCompositeStore } from './storage/typeorm-composite-store'; export declare class InstanceAiMemoryService { private readonly logger; private readonly compositeStore; private readonly dbSnapshotStorage; private readonly instanceAiConfig; constructor(logger: Logger, globalConfig: GlobalConfig, compositeStore: TypeORMCompositeStore, dbSnapshotStorage: DbSnapshotStorage); listThreads(userId: string, page?: number, perPage?: number): Promise<InstanceAiThreadListResponse>; ensureThread(userId: string, threadId: string): Promise<InstanceAiEnsureThreadResponse>; getThreadMessages(userId: string, threadId: string, options?: { limit?: number; page?: number; }): Promise<InstanceAiThreadMessagesResponse>; getRichMessages(userId: string, threadId: string, options?: { limit?: number; page?: number; excludeRunIds?: string[]; }): Promise<Omit<InstanceAiRichMessagesResponse, 'nextEventId'>>; getLatestRunSnapshot(threadId: string, options?: { messageGroupId?: string; runId?: string; }): Promise<AgentTreeSnapshot | undefined>; validateThreadOwnership(userId: string, threadId: string): Promise<boolean>; checkThreadOwnership(userId: string, threadId: string): Promise<'owned' | 'not_found' | 'other_user'>; deleteThread(threadId: string): Promise<void>; renameThread(threadId: string, title: string): Promise<InstanceAiThreadInfo>; updateThread(threadId: string, updates: { title?: string; metadata?: Record<string, unknown>; }): Promise<InstanceAiThreadInfo>; getThreadMetadata(userId: string, threadId: string): Promise<Record<string, unknown> | undefined>; cleanupExpiredThreads(onThreadDeleted?: (threadId: string) => Promise<void>): Promise<number>; private createMemoryInstance; private toThreadInfo; }