UNPKG

n8n

Version:

n8n Workflow Automation Tool

261 lines (260 loc) 10.9 kB
import { type AgentBuilderMessagesResponse, type AgentIntegrationStatusResponse, type AgentPersistedMessageDto, type AgentSkill, type AgentScheduleConfig, type ChatIntegrationDescriptor, AgentBuildResumeDto, AgentChatMessageDto, CreateAgentSkillDto, AgentIntegrationDto, CreateAgentDto, UpdateAgentSkillDto, UpdateAgentConfigDto, UpdateAgentScheduleDto, UpdateAgentDto } from '@n8n/api-types'; import { AuthenticatedRequest } from '@n8n/db'; import type { Request, Response } from 'express'; import { CredentialsService } from '../../credentials/credentials.service'; import { AgentExecutionService } from './agent-execution.service'; import { type FlushableResponse } from './agent-sse-stream'; import { AgentsService } from './agents.service'; import { AgentsBuilderService } from './builder/agents-builder.service'; import { ChatIntegrationRegistry } from './integrations/agent-chat-integration'; import { AgentScheduleService } from './integrations/agent-schedule.service'; import { ChatIntegrationService } from './integrations/chat-integration.service'; import { AgentRepository } from './repositories/agent.repository'; export declare class AgentsController { private readonly agentsService; private readonly agentsBuilderService; private readonly credentialsService; private readonly chatIntegrationService; private readonly agentScheduleService; private readonly agentRepository; private readonly agentExecutionService; private readonly chatIntegrationRegistry; constructor(agentsService: AgentsService, agentsBuilderService: AgentsBuilderService, credentialsService: CredentialsService, chatIntegrationService: ChatIntegrationService, agentScheduleService: AgentScheduleService, agentRepository: AgentRepository, agentExecutionService: AgentExecutionService, chatIntegrationRegistry: ChatIntegrationRegistry); create(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, payload: CreateAgentDto): Promise<import("./entities/agent.entity").Agent>; list(req: AuthenticatedRequest<{ projectId: string; }, unknown, unknown, { all?: string; }>): Promise<import("./entities/agent.entity").Agent[]>; getConfig(req: AuthenticatedRequest<{ projectId: string; agentId: string; }>): Promise<{ name: string; instructions: string; model: string; description?: string | undefined; credential?: string | undefined; memory?: { enabled: boolean; storage: "n8n" | "sqlite" | "postgres"; connection?: Record<string, unknown> | undefined; lastMessages?: number | undefined; semanticRecall?: { topK: number; scope?: "resource" | "thread" | undefined; messageRange?: { before: number; after: number; } | undefined; embedder?: string | undefined; } | undefined; } | undefined; config?: { thinking?: { provider: "anthropic" | "openai"; budgetTokens?: number | undefined; reasoningEffort?: string | undefined; } | undefined; toolCallConcurrency?: number | undefined; nodeTools?: { enabled: boolean; } | undefined; } | undefined; tools?: ({ id: string; type: "custom"; requireApproval?: boolean | undefined; } | { type: "workflow"; workflow: string; description?: string | undefined; name?: string | undefined; requireApproval?: boolean | undefined; allOutputs?: boolean | undefined; } | { name: string; type: "node"; node: { nodeType: string; nodeTypeVersion: number; nodeParameters: Record<string, unknown>; credentials?: Record<string, { id: string; name: string; }> | undefined; }; description?: string | undefined; requireApproval?: boolean | undefined; })[] | undefined; skills?: { id: string; type: "skill"; }[] | undefined; providerTools?: Record<string, Record<string, unknown>> | undefined; integrations?: ({ active: boolean; type: "schedule"; cronExpression: string; wakeUpPrompt: string; } | { type: string; credentialName: string; credentialId: string; })[] | undefined; }>; putConfig(req: AuthenticatedRequest<{ projectId: string; agentId: string; }>, _res: Response, agentId: string, payload: UpdateAgentConfigDto): Promise<{ config: import("./json-config/agent-json-config").AgentJsonConfig; updatedAt: string; versionId: string | null; }>; deleteTool(req: AuthenticatedRequest<{ projectId: string; agentId: string; toolId: string; }>, _res: Response, agentId: string, toolId: string): Promise<{ ok: boolean; }>; listSkills(req: AuthenticatedRequest<{ projectId: string; agentId: string; }>): Promise<Record<string, AgentSkill>>; getSkill(req: AuthenticatedRequest<{ projectId: string; agentId: string; skillId: string; }>, _res: Response, agentId: string, skillId: string): Promise<AgentSkill>; createSkill(req: AuthenticatedRequest<{ projectId: string; agentId: string; }>, _res: Response, agentId: string, payload: CreateAgentSkillDto): Promise<import("@n8n/api-types").AgentSkillMutationResponse>; updateSkill(req: AuthenticatedRequest<{ projectId: string; agentId: string; skillId: string; }>, _res: Response, agentId: string, skillId: string, payload: UpdateAgentSkillDto): Promise<import("@n8n/api-types").AgentSkillMutationResponse>; deleteSkill(req: AuthenticatedRequest<{ projectId: string; agentId: string; skillId: string; }>, _res: Response, agentId: string, skillId: string): Promise<{ ok: boolean; }>; listCredentials(req: AuthenticatedRequest<{ projectId: string; agentId: string; }>): Promise<import("@n8n/agents").CredentialListItem[]>; getModelCatalog(): Promise<import("@n8n/agents").ProviderCatalog>; listIntegrations(): ChatIntegrationDescriptor[]; listThreads(req: AuthenticatedRequest<{ projectId: string; }, {}, {}, { cursor?: string; limit?: string; agentId?: string; }>): Promise<{ threads: import("./agent-execution.service").ThreadListItem[]; nextCursor: string | null; }>; getThread(req: AuthenticatedRequest<{ projectId: string; threadId: string; }, {}, {}, { agentId?: string; }>): Promise<import("./agent-execution.service").ThreadDetail>; deleteThread(req: AuthenticatedRequest<{ projectId: string; threadId: string; }>): Promise<{ success: boolean; }>; get(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<import("./entities/agent.entity").Agent>; update(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string, payload: UpdateAgentDto): Promise<import("./entities/agent.entity").Agent | null>; delete(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<{ success: boolean; }>; publish(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<import("./entities/agent.entity").Agent>; unpublish(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<import("./entities/agent.entity").Agent>; revertToPublished(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<import("./entities/agent.entity").Agent>; chat(req: AuthenticatedRequest<{ projectId: string; }>, res: FlushableResponse, agentId: string, payload: AgentChatMessageDto): Promise<void>; getChatMessages(req: AuthenticatedRequest<{ projectId: string; agentId: string; threadId: string; }>): Promise<import("@n8n/agents").AgentDbMessage[]>; getBuilderMessages(req: AuthenticatedRequest<{ projectId: string; agentId: string; }>): Promise<AgentBuilderMessagesResponse>; clearBuilderMessages(req: AuthenticatedRequest<{ projectId: string; agentId: string; }>): Promise<{ ok: boolean; }>; getTestChatMessages(req: AuthenticatedRequest<{ projectId: string; agentId: string; }>): Promise<AgentPersistedMessageDto[]>; clearTestChatMessages(req: AuthenticatedRequest<{ projectId: string; agentId: string; }>): Promise<{ ok: boolean; }>; build(req: AuthenticatedRequest<{ projectId: string; }>, res: FlushableResponse, agentId: string, payload: AgentChatMessageDto): Promise<void>; buildResume(req: AuthenticatedRequest<{ projectId: string; }>, res: FlushableResponse, agentId: string, payload: AgentBuildResumeDto): Promise<void>; connectIntegration(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string, payload: AgentIntegrationDto): Promise<{ status: string; }>; disconnectIntegration(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string, payload: AgentIntegrationDto): Promise<{ status: string; }>; getScheduleIntegration(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<AgentScheduleConfig>; updateScheduleIntegration(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string, payload: UpdateAgentScheduleDto): Promise<AgentScheduleConfig>; activateScheduleIntegration(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<AgentScheduleConfig>; deactivateScheduleIntegration(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<AgentScheduleConfig>; integrationStatus(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<AgentIntegrationStatusResponse>; handleWebhook(req: Request<{ projectId: string; agentId: string; platform: string; }>, res: Response): Promise<void>; }