UNPKG

n8n

Version:

n8n Workflow Automation Tool

55 lines (54 loc) 3.34 kB
import type { AgentTaskDto, CreateAgentTaskDto, UpdateAgentTaskDto } from '@n8n/api-types'; import { Logger } from '@n8n/backend-common'; import { GlobalConfig } from '@n8n/config'; import type { User } from '@n8n/db'; import { InstanceSettings, ScheduledTaskManager } from 'n8n-core'; import type { PubSubCommandMap } from '../../scaling/pubsub/pubsub.event-map'; import { Publisher } from '../../scaling/pubsub/publisher.service'; import { AgentModificationTelemetryService, type AgentMutationTelemetryContext } from './agent-modification-telemetry.service'; import { AgentExecutionOrchestratorService } from './agent-execution-orchestrator.service'; 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 publisher; private readonly modificationTelemetry; constructor(logger: Logger, globalConfig: GlobalConfig, taskRepository: AgentTaskRepository, taskSnapshotRepository: AgentTaskSnapshotRepository, taskRunLockRepository: AgentTaskRunLockRepository, agentRepository: AgentRepository, agentExecutionOrchestratorService: AgentExecutionOrchestratorService, instanceSettings: InstanceSettings, scheduledTaskManager: ScheduledTaskManager, publisher: Publisher, modificationTelemetry: AgentModificationTelemetryService); list(agentId: string): Promise<AgentTaskDto[]>; create(agentId: string, projectId: string, dto: CreateAgentTaskDto, context: AgentMutationTelemetryContext): Promise<AgentTaskDto>; createTasks(agentId: string, projectId: string, dtos: CreateAgentTaskDto[], context: AgentMutationTelemetryContext): Promise<AgentTaskDto[]>; private createTasksBatch; update(agentId: string, projectId: string, taskId: string, dto: UpdateAgentTaskDto, context: AgentMutationTelemetryContext): Promise<AgentTaskDto>; delete(agentId: string, projectId: string, taskId: string, context: AgentMutationTelemetryContext): Promise<void>; private attachTaskRef; requestReconcile(agentId: string): Promise<void>; registerEnabledForAgent(agentId: string): Promise<void>; handleTasksChanged(payload: PubSubCommandMap['agent-tasks-changed']): Promise<void>; private broadcastTasksChanged; deregisterAgentTasks(agentId: string): void; reconnectAll(): Promise<void>; stopAll(): void; private reconcileAgent; private registerOrRefresh; private deregister; private runScheduledTask; private startTaskRunLockRenewal; private runTask; private buildTaskRunMessage; private consumeTaskRun; runNow(agentId: string, taskId: string, user: User): Promise<void>; private executeNow; private getOrThrow; private assertValidCron; private toDto; }