n8n
Version:
n8n Workflow Automation Tool
45 lines (44 loc) • 1.83 kB
TypeScript
import type { StreamChunk } from '@n8n/agents';
import type { AgentIntegrationConfig } from '@n8n/api-types';
import type { ActionEvent, Thread } from 'chat';
import type { Logger } from 'n8n-workflow';
import type { BridgeResumeExecutionContext, PlatformAgentContext } from './agent-chat-integration';
import type { AgentChatMessageContextBridge } from './agent-chat-message-context';
import type { AgentChatStreamConsumer } from './agent-chat-stream-consumer';
import type { CallbackStore } from './callback-store';
import type { InternalThread } from './types';
interface ResumeExecutor {
resumeForChat(config: {
agentId: string;
projectId: string;
runId: string;
toolCallId: string;
resumeData: unknown;
integrationType?: string;
}): AsyncGenerator<StreamChunk>;
}
interface AgentChatHitlResumeHandlerOptions {
agentId: string;
projectId: string;
integration: AgentIntegrationConfig;
agentService: ResumeExecutor;
logger: Logger;
callbackStore?: CallbackStore;
resolvePlatformThreadId: (thread: Thread<unknown, unknown>) => string;
toAgentThreadId: (platformThreadId: string) => InternalThread;
getPlatformAgentContext: () => PlatformAgentContext;
messageContextBridge: AgentChatMessageContextBridge;
streamConsumer: AgentChatStreamConsumer;
createResumeExecutionContext: (thread: Thread<unknown, unknown>) => Promise<BridgeResumeExecutionContext>;
}
export declare class AgentChatHitlResumeHandler {
private readonly options;
private readonly activeResumedRuns;
constructor(options: AgentChatHitlResumeHandlerOptions);
handleAction(event: ActionEvent): Promise<void>;
private parseActionId;
private resolveCallbackData;
private cleanUpBeforeResume;
private executeResume;
}
export {};