import { type Driver } from "neo4j-driver";
export interface EmailData {
    messageId: string | null;
    inReplyTo: string | null;
    toAddresses: string[];
    ccAddresses: string[];
    uid: number;
    uidValidity: number;
    mailbox: string;
    recipientAddress: string;
    fromAddress: string;
    fromName: string | null;
    subject: string;
    bodyPreview: string;
    receivedAt: string;
    accountId: string;
    screening?: "clean" | "suspicious" | "discarded";
    screeningReason?: string;
    promptInjectionFlag?: boolean;
}
export interface OutboundEmailData {
    messageId: string;
    inReplyTo: string;
    toAddresses: string[];
    fromAddress: string;
    subject: string;
    bodyPreview: string;
    accountId: string;
    originalEmailId: string;
}
/**
 * Strip RFC 2822 angle brackets from a Message-ID or In-Reply-To header.
 * "<abc@host>" → "abc@host". Already-clean values pass through unchanged.
 */
export declare function stripAngleBrackets(value: string | null): string | null;
/**
 * Derive a deterministic emailId for deduplication.
 * Uses RFC 2822 Message-ID when available (stable across UIDVALIDITY resets).
 * Falls back to SHA-256 of UID + UIDVALIDITY + mailbox + recipientAddress.
 */
export declare function deriveEmailId(data: EmailData): string;
/**
 * Store an email in the graph. Uses MERGE on emailId for idempotent writes.
 * Creates the RECEIVED_BY relationship to the EmailAccount in the same transaction.
 * Embedding is computed inline — if Ollama is down, the email is stored without one.
 *
 * After storing, creates REPLY_TO edges:
 *   - If this email has inReplyTo, links to the parent (if it exists in the graph)
 *   - Back-fills any orphaned emails whose inReplyTo references this email's messageId
 */
export declare function storeEmail(data: EmailData): Promise<{
    emailId: string;
    created: boolean;
}>;
/**
 * Store multiple emails. Returns counts of created and skipped (duplicate) emails.
 */
export declare function storeEmails(emails: EmailData[]): Promise<{
    created: number;
    skipped: number;
}>;
/**
 * Store an outbound auto-respond reply as an Email node.
 * Creates the Email node with direction:"outbound" and a REPLY_TO edge
 * to the original inbound email. Accepts a Driver parameter because
 * email-auto-respond.ts manages its own standalone Neo4j connection.
 *
 * Embedding is computed inline — if Ollama is down, stored without one.
 */
export declare function storeOutboundEmail(data: OutboundEmailData, driver: Driver): Promise<{
    emailId: string;
}>;
export interface ThreadInfo {
    messageId: string;
    threadDepth: number;
    threadId: string;
}
/**
 * Batch-query thread info for a set of messageIds.
 * For each email, traverses the REPLY_TO chain (capped at 50 hops) to find
 * the thread root. Returns threadDepth (number of hops to root) and
 * threadId (emailId of the root message).
 *
 * Emails not found in the graph or without REPLY_TO edges return null.
 */
export declare function getThreadInfo(messageIds: string[], accountId: string): Promise<Map<string, ThreadInfo>>;
//# sourceMappingURL=graph.d.ts.map