import { type StreamChunk } from '@n8n/agents'; import { type AgentIntegrationConfig } from '@n8n/api-types'; import { type HttpRequestClient } from '@n8n/backend-network'; import type { Chat } from 'chat'; import { type Logger } from 'n8n-workflow'; import { AgentChatAttachmentService } from '../agent-chat-attachment.service'; import type { AgentExecutionOrchestratorService, ExecuteForChatPublishedConfig } from '../agent-execution-orchestrator.service'; import { type CallbackMetadata } from './callback-store'; import type { ComponentMapper, ShortenCallback } from './component-mapper'; import { IntegrationMessageContextService } from './integration-message-context.service'; import type { IntegrationMessageContext } from './integration-tools'; import { type InternalThread } from './types'; interface AgentExecutor extends Pick { executeForChatPublished(config: Omit & { memory: { threadId: InternalThread; resourceId: string; }; }): AsyncGenerator; findOpenSuspension?(config: { agentId: string; threadId: string; }): Promise; } interface OpenSuspension { suspendPayload?: unknown; } export declare class AgentChatBridge { private readonly chat; private readonly agentId; private readonly agentService; private readonly componentMapper; private readonly logger; private readonly n8nProjectId; private readonly integration; private readonly attachmentService?; private readonly discordHttpClient?; private readonly callbackStore?; private readonly integrationImpl; private readonly messageContextBridge; private readonly streamConsumer; private readonly hitlResumeHandler; constructor(chat: Chat, agentId: string, agentService: AgentExecutor, componentMapper: ComponentMapper, logger: Logger, n8nProjectId: string, integration: AgentIntegrationConfig, messageContextStore?: IntegrationMessageContextService, attachmentService?: AgentChatAttachmentService | undefined, discordHttpClient?: HttpRequestClient | undefined); static create(chat: Chat, agentId: string, agentService: AgentExecutionOrchestratorService, componentMapper: ComponentMapper, logger: Logger, n8nProjectId: string, integration: AgentIntegrationConfig): AgentChatBridge; private registerHandlers; private canUserAccess; private anchorInboundThread; resumeInAgentThread(agentThreadId: string, runId: string, toolCallId: string, resumeData: unknown, context?: { messageContext: IntegrationMessageContext | null; allowLegacyThreadId: boolean; }): Promise; deliverWakeResponse(threadId: string, chunks: StreamChunk[]): Promise; private resolvePlatformThreadId; private toAgentThreadId; private baseThreadId; private resolveActiveThreadId; private handleResetCommand; private resetSession; private withSessionLock; private computeGeneration; private hasOpenSuspension; private sessionGenerationCacheKey; getShortenCallback(metadata?: CallbackMetadata): ShortenCallback | undefined; private executeAndStream; private postStillWaitingReply; private storeInboundAttachments; private fetchAttachmentData; private resolveBridgeExecutionContext; private handleSuspension; private handleMessage; private getPlatformAgentContext; private getInboundText; private prepareInboundText; private postErrorToThread; } export {};