UNPKG

@n8n-plus/n8n-plus

Version:

n8n Workflow Automation Tool (plus edition)

314 lines (313 loc) 12.7 kB
import { AgentBuildResumeDto, AgentChatMessageDto, type AgentBuilderMessagesResponse, type AgentIntegrationStatusResponse, type AgentPersistedMessageDto, type AgentScheduleConfig, type AgentSkill, type ChatIntegrationDescriptor, CreateSlackAgentAppDto, type CreateSlackAgentAppResponse, type SlackAgentAppManifestResponse, CreateAgentDto, CreateAgentSkillDto, UpdateAgentConfigDto, UpdateAgentDto, UpdateAgentScheduleDto, UpdateAgentSkillDto, AgentDisconnectIntegrationDto, PublishAgentDto } from '@n8n/api-types'; import type { 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 { SlackAppSetupService } from './integrations/slack-app-setup.service'; import { AgentRepository } from './repositories/agent.repository'; import type { Agent } from './entities/agent.entity'; 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; private readonly slackAppSetupService; constructor(agentsService: AgentsService, agentsBuilderService: AgentsBuilderService, credentialsService: CredentialsService, chatIntegrationService: ChatIntegrationService, agentScheduleService: AgentScheduleService, agentRepository: AgentRepository, agentExecutionService: AgentExecutionService, chatIntegrationRegistry: ChatIntegrationRegistry, slackAppSetupService: SlackAppSetupService); private validateIntegration; private withRunnableState; create(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, payload: CreateAgentDto): Promise<Agent & { isRunnable: boolean; }>; list(req: AuthenticatedRequest<{ projectId: string; }, unknown, unknown, { all?: string; }>): Promise<Agent[]>; getConfig(req: AuthenticatedRequest<{ projectId: string; agentId: string; }>): Promise<{ model: string; name: string; instructions: string; description?: string | undefined; credential?: string | undefined; memory?: { enabled: boolean; storage: "n8n"; lastMessages?: number | undefined; semanticRecall?: { topK: number; scope?: "thread" | "resource" | undefined; messageRange?: { before: number; after: number; } | undefined; embedder?: string | undefined; } | undefined; observationalMemory?: { enabled?: boolean | undefined; observerThresholdTokens?: number | undefined; reflectorThresholdTokens?: number | undefined; renderTokenBudget?: number | undefined; observationLogTailLimit?: number | undefined; lockTtlMs?: number | undefined; } | undefined; episodicMemory?: { enabled: false; } | { enabled: true; credential: string; topK?: number | undefined; maxEntriesPerRun?: number | undefined; } | undefined; } | undefined; tools?: ({ type: "custom"; id: string; requireApproval?: boolean | undefined; } | { type: "workflow"; workflow: string; description?: string | undefined; name?: string | undefined; requireApproval?: boolean | undefined; allOutputs?: boolean | undefined; } | { type: "node"; name: string; 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?: { type: "skill"; id: string; }[] | undefined; providerTools?: Record<string, Record<string, unknown>> | undefined; integrations?: ({ type: "schedule"; active: boolean; cronExpression: string; wakeUpPrompt: string; } | { type: "telegram"; credentialId: string; settings?: { accessMode: "private" | "public"; allowedUsers: string[]; } | undefined; } | { type: "slack"; credentialId: string; } | { type: "linear"; credentialId: string; })[] | undefined; config?: { thinking?: { provider: "anthropic" | "openai"; budgetTokens?: number | undefined; reasoningEffort?: string | undefined; } | undefined; toolCallConcurrency?: number | undefined; maxIterations?: number | undefined; nodeTools?: { enabled: boolean; } | undefined; } | undefined; }>; putConfig(req: AuthenticatedRequest<{ projectId: string; agentId: string; }>, _res: Response, agentId: string, payload: UpdateAgentConfigDto): Promise<{ config: import("@n8n/api-types").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; }>; 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<Agent & { isRunnable: boolean; }>; update(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string, payload: UpdateAgentDto): Promise<Agent & { isRunnable: boolean; }>; delete(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<{ success: boolean; }>; publish(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string, payload: PublishAgentDto): Promise<Agent & { isRunnable: boolean; }>; unpublish(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<Agent & { isRunnable: boolean; }>; revertToPublished(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<Agent & { isRunnable: boolean; }>; chat(req: AuthenticatedRequest<{ projectId: string; }>, res: FlushableResponse, agentId: string, payload: AgentChatMessageDto): Promise<void>; getChatMessages(req: AuthenticatedRequest<{ projectId: string; agentId: string; threadId: string; }>): Promise<AgentPersistedMessageDto[]>; 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): Promise<{ status: string; }>; createSlackApp(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string, payload: CreateSlackAgentAppDto): Promise<CreateSlackAgentAppResponse>; getSlackAppManifest(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string): Promise<SlackAgentAppManifestResponse>; handleSlackAppOAuthCallback(req: Request<{ projectId: string; agentId: string; }, unknown, unknown, { code?: string; state?: string; error?: string; error_description?: string; }>, res: Response, agentId: string): Promise<void>; disconnectIntegration(req: AuthenticatedRequest<{ projectId: string; }>, _res: Response, agentId: string, payload: AgentDisconnectIntegrationDto): 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>; }