import { type AgentSessionFile, type AgentToolOutputFile } from '@n8n/api-types'; import { Logger } from '@n8n/backend-common'; import { AgentsConfig } from '@n8n/config'; import type { BuiltFileStore } from '@n8n/agents'; import { BinaryDataService } from 'n8n-core'; import { UserError } from '@n8n/errors'; import type { Readable } from 'node:stream'; import { AgentChatAttachment } from './entities/agent-chat-attachment.entity'; import { AgentProjectDeletionRepository } from './repositories/agent-project-deletion.repository'; import { AgentChatAttachmentRepository } from './repositories/agent-chat-attachment.repository'; import { AgentExecutionThreadRepository } from './repositories/agent-execution-thread.repository'; import { AgentFileGrantRepository } from './repositories/agent-file-grant.repository'; export declare class AgentFileLimitError extends UserError { } export interface StoreInboundAttachmentParams { id?: string; agentId: string | null; projectId: string; threadId: string; resourceId?: string; source: string; fileName: string; mimeType: string; data: Buffer; contentHash?: string; } export declare function hashFileContent(data: Buffer): string; export declare class AgentChatAttachmentService { private readonly logger; private readonly binaryDataService; private readonly repository; private readonly threadRepository; private readonly grantRepository; private readonly projectDeletion; private readonly agentsConfig; constructor(logger: Logger, binaryDataService: BinaryDataService, repository: AgentChatAttachmentRepository, threadRepository: AgentExecutionThreadRepository, grantRepository: AgentFileGrantRepository, projectDeletion: AgentProjectDeletionRepository, agentsConfig: AgentsConfig); get maxGeneratedFileBytes(): number; get maxStoredFileBytes(): number; storeInbound(params: StoreInboundAttachmentParams): Promise; getReadable(attachmentId: string, scope: { projectId: string; threadId: string; }): Promise; listForSession(scope: { projectId: string; threadId: string; }, excludeSource?: string): Promise; findReadableByHashes(hashes: string[], scope: { projectId: string; threadId: string; }): Promise>; grantToSubAgent(attachmentIds: string[], scope: { projectId: string; parentThreadId: string; childThreadId: string; }): Promise; returnToParent(scope: { projectId: string; parentThreadId: string; childThreadId: string; }): Promise; private checkLimits; private findRootThread; private findReadable; getForSystemAgent(attachmentId: string, scope: { agentId: string; resourceId: string; source: string; }): Promise; getForAgent(attachmentId: string, scope: { agentId: string; projectId: string; userId: string; threadId?: string; }): Promise; hasStoredData(attachment: AgentChatAttachment): Promise; getBuffer(attachment: AgentChatAttachment): Promise; getStream(attachment: AgentChatAttachment): Promise; deleteByIds(attachmentIds: string[]): Promise; deleteByThread(threadId: string, scope: { projectId: string; } | { agentId: string; }): Promise; deleteByAgent(agentId: string): Promise; deleteByProject(projectId: string): Promise; deleteFromSourceCreatedBefore(scope: { agentId: string; source: string; }, before: Date, signal?: AbortSignal): Promise; deleteStoredData(binaryDataIds: string[], logContext: Record): Promise; private deleteAttachments; getFileStore(scope: { agentId: string; projectId: string; }, provider: string): BuiltFileStore; }