import { LockService } from '@n8n/backend-common'; import { type PubSubCommandMap } from '@n8n/decorators'; import { InstanceSettings } from 'n8n-core'; import { Publisher } from '@n8n/backend-services'; import { AgentExecutionService } from './agent-execution.service'; import { AgentMessageSteeringService } from './agent-message-steering.service'; import { AgentExecutionUpdateBroadcaster } from './agent-execution-update-broadcaster'; import { AgentBackgroundJobService } from './background/agent-background-job.service'; import { N8NCheckpointStorage } from './integrations/n8n-checkpoint-storage'; import { AgentExecutionRepository } from './repositories/agent-execution.repository'; import { SystemAgentRegistry } from './system-agents/system-agent-registry'; import { type AgentChatSurface } from './utils/agent-thread-access'; type CancelExecutionPayload = PubSubCommandMap['cancel-agent-chat-execution']; type ExecutionContext = Omit & { surface: AgentChatSurface; scope?: 'foreground' | 'all'; }; export interface CancelSuspendedRunParams { agentId: string; runId: string; resourceId: string; cancelBackgroundJobs?: boolean; } export { AgentTurnAlreadyRunningError } from './agent-turn-already-running.error'; export declare class AgentChatExecutionService { private readonly lockService; private readonly executionRepository; private readonly executionService; private readonly checkpointStorage; private readonly publisher; private readonly instanceSettings; private readonly executionUpdates; private readonly steering; private readonly backgroundJobService; private readonly systemAgents; private readonly executions; constructor(lockService: LockService, executionRepository: AgentExecutionRepository, executionService: AgentExecutionService, checkpointStorage: N8NCheckpointStorage, publisher: Publisher, instanceSettings: InstanceSettings, executionUpdates: AgentExecutionUpdateBroadcaster, steering: AgentMessageSteeringService, backgroundJobService: AgentBackgroundJobService, systemAgents: SystemAgentRegistry); withTurnLock(threadId: string, action: (signal: AbortSignal) => Promise): Promise; register(context: ExecutionContext, controller: AbortController): void; settle(executionId: string, finalize: () => Promise, suspendedRunId?: string): Promise; private release; requestCancel(context: ExecutionContext): Promise; onCancelExecution(payload: CancelExecutionPayload): Promise; onCancelForegroundExecution(payload: CancelExecutionPayload): Promise; private cancelExecution; private cancelLocalWithChildren; private cancelLocal; private getOwnedExecution; private canAccessExecution; private cancelRecordedSuspension; stopSessionExecutions(agentId: string, threadId: string, executionIds: string[]): void; cancelSessionWork(agentId: string, threadId: string, executionIds: string[]): Promise; cancelProjectSessionWork(agentId: string, threadId: string): Promise; cancelSessionSuspension(agentId: string, threadId: string, executionId: string): Promise; private clearSessionSuspension; cancelSuspended(params: CancelSuspendedRunParams): Promise; private clearSuspendedRun; }