UNPKG

n8n

Version:

n8n Workflow Automation Tool

43 lines (42 loc) 2 kB
import { Logger } from '@n8n/backend-common'; import { AgentExecution } from './entities/agent-execution.entity'; import { AgentExecutionThread } from './entities/agent-execution-thread.entity'; import type { MessageRecord } from './execution-recorder'; import { N8nMemory } from './integrations/n8n-memory'; import { AgentExecutionRepository } from './repositories/agent-execution.repository'; import { AgentExecutionThreadRepository } from './repositories/agent-execution-thread.repository'; export interface RecordMessageParams { threadId: string; agentId: string; agentName: string; projectId: string; userMessage: string; record: MessageRecord; hitlStatus?: 'suspended' | 'resumed'; source?: string; } export interface ThreadDetail { thread: AgentExecutionThread; executions: AgentExecution[]; } export interface ThreadListItem extends AgentExecutionThread { firstMessage: string | null; } export declare class AgentExecutionService { private readonly logger; private readonly agentExecutionRepository; private readonly agentExecutionThreadRepository; private readonly n8nMemory; constructor(logger: Logger, agentExecutionRepository: AgentExecutionRepository, agentExecutionThreadRepository: AgentExecutionThreadRepository, n8nMemory: N8nMemory); recordMessage(params: RecordMessageParams): Promise<string>; private backfillSuspendedExecutions; private syncTitleFromMemory; deleteThread(projectId: string, threadId: string): Promise<boolean>; getThreads(projectId: string, limit: number, cursor?: string, agentId?: string): Promise<{ threads: ThreadListItem[]; nextCursor: string | null; }>; getThreadDetail(threadId: string, projectId: string, agentId?: string): Promise<ThreadDetail | null>; findThreadById(threadId: string): Promise<AgentExecutionThread | null>; } export declare function threadBelongsTo(thread: AgentExecutionThread, projectId: string, agentId?: string): boolean;