import type { Agent as RuntimeAgent, ExecutionOptions, ResumeOptions, RunOptions, StreamChunk } from '@n8n/agents'; import type { AgentBackgroundJobSignal } from '@n8n/api-types'; import { Logger } from '@n8n/backend-common'; import { AgentExecutionService, type RecordMessageParams, type StartExecutionParams } from './agent-execution.service'; import { ExecutionRecorder } from './execution-recorder'; import type { ToolRegistry } from './tool-registry'; type RecordingContext = Pick; type AgentTurnRequest = { recording: StartExecutionParams; } & ({ type: 'start'; input: Parameters[0]; options: RunOptions & ExecutionOptions; } | { type: 'resume'; resumeData: unknown; options: ResumeOptions & ExecutionOptions; }); interface ExecuteTurnConfig { agentInstance: RuntimeAgent; toolRegistry: ToolRegistry; mcpServerAttributions: Map; context: RecordingContext; prepare: () => Promise; includeHitlToolDetails?: boolean; backgroundJobSignal?: AgentBackgroundJobSignal; onExecutionRecorded?: (executionId: string) => void; onSettled?: (suspended: boolean) => Promise; } export declare class AgentTurnExecutionService { private readonly logger; private readonly agentExecutionService; constructor(logger: Logger, agentExecutionService: AgentExecutionService); execute(config: ExecuteTurnConfig): AsyncGenerator; private startTurn; private streamTurn; private finalizeTurn; createRecorder(toolRegistry?: ToolRegistry, getExecutionId?: () => string | undefined, context?: RecordingContext, backgroundJobSignal?: AgentBackgroundJobSignal): ExecutionRecorder; startExecution(params: StartExecutionParams, startedAt: Date, executionError?: unknown): Promise; finalizeExecution(args: { executionId: string; executionStarted: boolean; executionError?: unknown; onExecutionRecorded?: (executionId: string) => void; params: RecordMessageParams; }): Promise; recordFailedStart(params: StartExecutionParams, executionError: unknown, onExecutionRecorded?: (executionId: string) => void): Promise; } export {};