n8n
Version:
n8n Workflow Automation Tool
63 lines (62 loc) • 2.26 kB
TypeScript
import type { StreamChunk } from '@n8n/agents';
import type { Chat } from 'chat';
import type { Logger } from 'n8n-workflow';
import type { AgentsService } from '../agents.service';
import type { ComponentMapper } from './component-mapper';
import { type InternalThread } from './types';
interface AgentExecutor {
executeForChatPublished(config: {
agentId: string;
projectId: string;
message: string;
memory: {
threadId: InternalThread;
resourceId: string;
};
integrationType?: string;
}): AsyncGenerator<StreamChunk>;
resumeForChat(config: {
agentId: string;
projectId: string;
runId: string;
toolCallId: string;
resumeData: unknown;
integrationType?: string;
}): AsyncGenerator<StreamChunk>;
}
export declare class AgentChatBridge {
private readonly chat;
private readonly agentId;
private readonly agentService;
private readonly componentMapper;
private readonly logger;
private readonly n8nProjectId;
private readonly integrationType;
private readonly activeResumedRuns;
private readonly callbackStore?;
private readonly disableStreaming;
private readonly integration;
private readonly richInteractionInputs;
constructor(chat: Chat, agentId: string, agentService: AgentExecutor, componentMapper: ComponentMapper, logger: Logger, n8nProjectId: string, integrationType: string);
static create(chat: Chat, agentId: string, agentService: AgentsService, componentMapper: ComponentMapper, logger: Logger, n8nProjectId: string, integrationType: string): AgentChatBridge;
private registerHandlers;
dispose(): void;
private resolveThreadId;
private getShortenCallback;
private executeAndStream;
private consumeStream;
private consumeStreamBuffered;
private handleSuspension;
private handleRichInteraction;
private stashRichInteractionInput;
private isRichInteractionDisplayOnly;
private handleDisplayOnly;
private handleMessage;
private parseActionId;
private resolveCallbackData;
private cleanUpBeforeResume;
private executeResume;
private handleAction;
private postErrorToThread;
}
export {};