@n8n-plus/n8n-plus
Version:
n8n Workflow Automation Tool (plus edition)
41 lines (40 loc) • 2.27 kB
TypeScript
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 { TypeORMAgentMemory } from './storage/typeorm-agent-memory';
export declare class InstanceAiMemoryService {
private readonly logger;
private readonly agentMemory;
private readonly dbSnapshotStorage;
private readonly instanceAiConfig;
constructor(logger: Logger, globalConfig: GlobalConfig, agentMemory: TypeORMAgentMemory, 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 toThreadInfo;
private toThreadMessage;
}