import { type AgentCapabilitySummary, type AgentActor, type AgentCreationState, type AgentChatListResponse, type AgentJsonConfig, type AgentModelCredentialConfig, type AgentN8nChatAgentDetails, type AgentN8nChatThreadSummary, type AgentN8nChatThreadsResponse, type AgentSkill, type ListAgentsQueryDto } from '@n8n/api-types'; import { Logger } from '@n8n/backend-common'; import { EventService, ProjectScopeService } from '@n8n/backend-services'; import { ProjectRelationRepository, TransactionRunner, type User } from '@n8n/db'; import { CredentialsService } from '../../credentials/credentials.service'; import type { PolicyActor } from '../../policy/policy-enforcement-backend'; import { AgentDefinitionService } from './agent-definition.service'; import { AgentConfigPreparationService } from './agent-config-preparation.service'; import { AgentSaveCompletionService } from './agent-save-completion.service'; import { AgentSetupCompletionService } from './agent-setup-completion.service'; import { AgentChatAttachmentService } from './agent-chat-attachment.service'; import { AgentExecutionService } from './agent-execution.service'; import { AgentKnowledgeService } from './agent-knowledge.service'; import { AgentPolicyService } from './agent-policy.service'; import { AgentRuntimeCacheService } from './agent-runtime-cache.service'; import { AgentSkillRefsService } from './agent-skill-refs.service'; import { AgentTestChatService } from './agent-test-chat.service'; import { AgentsSettingsService } from './agents-settings.service'; import { Agent, type ProjectAgent } from './entities/agent.entity'; import { N8nChatFlagService } from './integrations/platforms/n8n-chat/n8n-chat-flag.service'; import { AgentTaskRepository } from './repositories/agent-task.repository'; import { AgentRepository, type AgentImportIdentity, type AgentSummary, type AgentListResult, type AgentSummaryFilters } from './repositories/agent.repository'; import { SubAgentCleanupService } from './sub-agents/sub-agent-cleanup.service'; import type { CompleteAgentDefinition, AgentDefinitionMetadata, AgentSkillWriter, PlannedAgentDestinations } from './utils/agent-definition'; type CreateAgentOptions = DraftAgentCreateOptions | { actor: PolicyActor; id: string; definition: CompleteAgentDefinition; user: User; metadata?: AgentDefinitionMetadata; plannedDestinations?: PlannedAgentDestinations; writeSkills?: AgentSkillWriter; }; type DraftAgentCreateOptions = { actor: PolicyActor; availableInMCP?: boolean; id?: string; adoptOnCollision?: boolean; defaultModel?: AgentModelCredentialConfig; config?: Record; createdBy?: AgentActor; pushRef?: string; schema?: AgentJsonConfig; skills?: Record; skillCreator?: User; tools?: Record; user?: User; }; export type AgentCreationResult = AgentCreationState & { agent: ProjectAgent; }; export declare class AgentsService { private readonly logger; private readonly agentRepository; private readonly projectRelationRepository; private readonly agentChatAttachmentService; private readonly agentKnowledgeService; private readonly runtimeCacheService; private readonly testChatService; private readonly agentTaskRepository; private readonly subAgentCleanupService; private readonly eventService; private readonly agentExecutionService; private readonly credentialsService; private readonly projectScopeService; private readonly settingsService; private readonly agentPolicyService; private readonly agentSkillRefs; private readonly transactionRunner; private readonly configPreparation; private readonly saveCompletion; private readonly setupCompletion; private readonly n8nChatFlag; private readonly definitionService; constructor(logger: Logger, agentRepository: AgentRepository, projectRelationRepository: ProjectRelationRepository, agentChatAttachmentService: AgentChatAttachmentService, agentKnowledgeService: AgentKnowledgeService, runtimeCacheService: AgentRuntimeCacheService, testChatService: AgentTestChatService, agentTaskRepository: AgentTaskRepository, subAgentCleanupService: SubAgentCleanupService, eventService: EventService, agentExecutionService: AgentExecutionService, credentialsService: CredentialsService, projectScopeService: ProjectScopeService, settingsService: AgentsSettingsService, agentPolicyService: AgentPolicyService, agentSkillRefs: AgentSkillRefsService, transactionRunner: TransactionRunner, configPreparation: AgentConfigPreparationService, saveCompletion: AgentSaveCompletionService, setupCompletion: AgentSetupCompletionService, n8nChatFlag: N8nChatFlagService, definitionService: AgentDefinitionService); create(projectId: string, name: string, options: CreateAgentOptions): Promise; createOrAdopt(projectId: string, name: string, options: CreateAgentOptions): Promise; getCreationResult(agent: ProjectAgent, adopted: boolean): Promise; private assertCreateOptions; private prepareAgentCreation; private insertAgent; private completeCreation; recordSavedSetupComplete(agent: ProjectAgent, user: User): Promise; private createCompleteDefinition; private prepareDuplicateConfig; findByProjectId(projectId: string): Promise; findByProjectIdPaginated(projectId: string, options: ListAgentsQueryDto): Promise; findById(agentId: string, projectId: string): Promise; findImportCandidates(projectId: string, sourceAgentIds: string[]): Promise; findImportIdOwners(agentIds: string[]): Promise>>; isN8nChatPublished(agentId: string, projectId: string): Promise; getCapabilitySummary(agentId: string, projectId: string): Promise; findByUser(userId: string): Promise; findSummariesInProjects(projectIds: string[] | null, options?: AgentSummaryFilters): Promise; findByIdForUser(agentId: string, user: User): Promise; findChatReachableByUserPaginated(user: User, options: ListAgentsQueryDto): Promise; findChatReachableAgentForUser(agentId: string, user: User): Promise; findN8nChatThreadsForUser(user: User, options: { limit: number; cursor?: string; agentId?: string; search?: string; }): Promise; private reachableAgentIds; findN8nChatThreadForUser(user: User, threadId: string): Promise; findListableByUserPaginated(user: User, options: ListAgentsQueryDto): Promise; findPublishedByUser(userId: string): Promise; delete(agentId: string, projectId: string): Promise; private prepareInitialConfig; private adoptExistingAgent; private getCapabilityTools; private getCapabilityTasks; private deleteKnowledgeFiles; private deleteChatAttachments; private stopDeletedAgentTasks; private clearDeletedAgentTestChats; } export {};