import { Logger } from '@n8n/backend-common'; import { ErrorReporter, StorageConfig } from 'n8n-core'; import type { AgentRunTelemetryType, IAgentConfigurationTelemetryProperties } from '../../interfaces'; import { Telemetry } from '../../telemetry'; import { AgentExecutionThread } from './entities/agent-execution-thread.entity'; import { AgentExecution } from './entities/agent-execution.entity'; import type { MessageRecord } from './execution-recorder'; import { AgentExecutionLogStore } from './execution-log/agent-execution-log-store'; import { N8nMemory } from './integrations/n8n-memory'; import { AgentExecutionThreadRepository } from './repositories/agent-execution-thread.repository'; import type { AgentExecutionThreadMetadata } from './repositories/agent-execution-thread.repository'; import { AgentExecutionRepository } from './repositories/agent-execution.repository'; export interface RecordMessageParams { threadId: string; agentId: string; agentName: string; projectId: string; userMessage: string | null; record: MessageRecord; hitlStatus?: 'suspended' | 'resumed'; source?: string; threadMetadata?: AgentExecutionThreadMetadata; taskId?: string; taskVersionId?: string; telemetry?: { runType: AgentRunTelemetryType; configuration: IAgentConfigurationTelemetryProperties; }; } export interface ThreadDetail { thread: AgentExecutionThread; executions: AgentExecution[]; } export interface ThreadListItem extends Omit { firstMessage: string | null; source: string | null; } export declare class AgentExecutionService { private readonly logger; private readonly agentExecutionRepository; private readonly agentExecutionThreadRepository; private readonly n8nMemory; private readonly telemetry; private readonly agentExecutionLogStore; private readonly storageConfig; private readonly errorReporter; private static readonly logDeletionBatchSize; constructor(logger: Logger, agentExecutionRepository: AgentExecutionRepository, agentExecutionThreadRepository: AgentExecutionThreadRepository, n8nMemory: N8nMemory, telemetry: Telemetry, agentExecutionLogStore: AgentExecutionLogStore, storageConfig: StorageConfig, errorReporter: ErrorReporter); recordMessage(params: RecordMessageParams): Promise; findLatestSuspendedRun(threadId: string): Promise; private backfillSuspendedExecutions; private syncTitleFromMemory; deleteThread(projectId: string, agentId: string, threadId: string): Promise; deleteExecutionLogsForAgent(agentId: string): Promise; getThreads(projectId: string, agentId: string, limit: number, cursor?: string): Promise<{ threads: ThreadListItem[]; nextCursor: string | null; }>; getThreadDetail(threadId: string, projectId: string, agentId: string): Promise; private hydrateTimelines; findThreadById(threadId: string): Promise; private toBlobRefs; } export declare function threadBelongsTo(thread: AgentExecutionThread, projectId: string, agentId: string): boolean;