n8n
Version:
n8n Workflow Automation Tool
46 lines (45 loc) • 2.04 kB
TypeScript
import type { Agent as RuntimeAgent } from '@n8n/agents';
import { Logger } from '@n8n/backend-common';
import { GlobalConfig } from '@n8n/config';
import type { User } from '@n8n/db';
import { CredentialsService } from '../../credentials/credentials.service';
import type { IAgentConfigurationTelemetryProperties } from '../../interfaces';
import type { PubSubCommandMap } from '../../scaling/pubsub/pubsub.event-map';
import { Publisher } from '../../scaling/pubsub/publisher.service';
import { AgentRuntimeReconstructionService } from './agent-runtime-reconstruction.service';
import { AgentRepository } from './repositories/agent.repository';
import type { ToolRegistry } from './tool-registry';
export interface GetRuntimeParams {
agentId: string;
projectId: string;
integrationType?: string;
usePublishedVersion?: boolean;
user?: User;
}
export interface AgentRuntime {
agent: RuntimeAgent;
agentId: string;
toolRegistry: ToolRegistry;
projectId: string;
telemetryConfiguration: IAgentConfigurationTelemetryProperties;
}
export declare class AgentRuntimeCacheService {
private readonly logger;
private readonly agentRepository;
private readonly publisher;
private readonly globalConfig;
private readonly agentRuntimeReconstructionService;
private readonly credentialsService;
private readonly runtimes;
private readonly runtimeInitializations;
constructor(logger: Logger, agentRepository: AgentRepository, publisher: Publisher, globalConfig: GlobalConfig, agentRuntimeReconstructionService: AgentRuntimeReconstructionService, credentialsService: CredentialsService);
private computeRuntimeCacheKey;
private isRuntimeCacheKeyForAgent;
clearRuntimes(agentId: string, options?: {
skipBroadcast?: boolean;
}): void;
handleAgentConfigChanged(payload: PubSubCommandMap['agent-config-changed']): void;
private closeAgentResources;
getRuntime(params: GetRuntimeParams): Promise<AgentRuntime>;
private reconstructRuntime;
}