import type { AgentTaskDto, CreateAgentTaskDto, UpdateAgentTaskDto } from '@n8n/api-types'; import { Logger } from '@n8n/backend-common'; import { GlobalConfig } from '@n8n/config'; import { TransactionRunner, type User } from '@n8n/db'; import { type PubSubCommandMap } from '@n8n/decorators'; import { InstanceSettings, ScheduledTaskManager } from 'n8n-core'; import { type AgentMutationTelemetryContext } from './agent-modification-telemetry.service'; import { AgentDefinitionService } from './agent-definition.service'; import { AgentExecutionOrchestratorService } from './agent-execution-orchestrator.service'; import { AgentChangePublisher } from './agent-change-publisher.service'; import { AgentSaveCompletionService } from './agent-save-completion.service'; import { AgentSkillRefsService } from './agent-skill-refs.service'; import { AgentsSettingsService } from './agents-settings.service'; import { AgentTaskJobRegistrar } from './scheduling/agent-task-job-registrar'; import { AgentTask } from './entities/agent-task.entity'; import { AgentRepository } from './repositories/agent.repository'; import { AgentTaskRunLockRepository } from './repositories/agent-task-run-lock.repository'; import { AgentTaskSnapshotRepository } from './repositories/agent-task-snapshot.repository'; import { AgentTaskRepository } from './repositories/agent-task.repository'; export declare class AgentTaskService { private readonly logger; private readonly globalConfig; private readonly taskRepository; private readonly taskSnapshotRepository; private readonly taskRunLockRepository; private readonly agentRepository; private readonly agentExecutionOrchestratorService; private readonly instanceSettings; private readonly scheduledTaskManager; private readonly changePublisher; private readonly durableJobRegistrar; private readonly saveCompletion; private readonly settingsService; private readonly transactionRunner; private readonly agentSkillRefs; private readonly definitionService; constructor(logger: Logger, globalConfig: GlobalConfig, taskRepository: AgentTaskRepository, taskSnapshotRepository: AgentTaskSnapshotRepository, taskRunLockRepository: AgentTaskRunLockRepository, agentRepository: AgentRepository, agentExecutionOrchestratorService: AgentExecutionOrchestratorService, instanceSettings: InstanceSettings, scheduledTaskManager: ScheduledTaskManager, changePublisher: AgentChangePublisher, durableJobRegistrar: AgentTaskJobRegistrar, saveCompletion: AgentSaveCompletionService, settingsService: AgentsSettingsService, transactionRunner: TransactionRunner, agentSkillRefs: AgentSkillRefsService, definitionService: AgentDefinitionService); list(agentId: string): Promise; findImportIdOwners(taskIds: string[]): Promise>>; create(agentId: string, projectId: string, dto: CreateAgentTaskDto, context: AgentMutationTelemetryContext): Promise; createTasks(agentId: string, projectId: string, dtos: CreateAgentTaskDto[], context: AgentMutationTelemetryContext): Promise<{ tasks: AgentTaskDto[]; configHash: string | null; }>; private createTasksBatch; update(agentId: string, projectId: string, taskId: string, dto: UpdateAgentTaskDto, context: AgentMutationTelemetryContext): Promise; updateWithChange(agentId: string, projectId: string, taskId: string, dto: UpdateAgentTaskDto, context: AgentMutationTelemetryContext): Promise<{ task: AgentTaskDto; changed: boolean; }>; delete(agentId: string, projectId: string, taskId: string, context: AgentMutationTelemetryContext): Promise; private attachTaskRef; requestReconcile(agentId: string): Promise; registerEnabledForAgent(agentId: string): Promise; handleTasksChanged(payload: PubSubCommandMap['agent-tasks-changed']): Promise; private broadcastTasksChanged; deregisterAgentTasks(agentId: string): void; reconnectAll(): Promise; stopAll(): void; private reconcileAgent; private registerOrRefresh; private deregister; startScheduledRun(agentId: string, taskId: string): Promise<'started' | 'skipped-active' | 'skipped-disabled' | 'stale'>; private startTaskRunLockRenewal; private runTask; private buildTaskRunMessage; private consumeTaskRun; runNow(agentId: string, taskId: string, user: User): Promise; private executeNow; private getOrThrow; validateTasks(tasks: Array<{ cronExpression: string; timezone?: string | null; }>): void; assertAgentHasConfig(hasConfig: boolean): void; private validateTask; private assertValidCron; private assertValidTimezone; private resolveTaskTimezone; private toDto; private applyTaskUpdates; private runScheduledTask; }