import { type ConnectorClient, type SendOutcomeUnknownReason } from "./connector-client.js"; import { type SentMessage } from "./sent-message-buffer.js"; import type { SendAckEvent } from "./types.js"; export interface OpenConversation { replyRef: number; conversationRef: string; lastActivityAt: string; peer: { kind: "node" | "session"; nodeHandle?: string; nickname?: string; hostLabel?: string; }; } export interface ConversationContinuation { replyTo(replyRef: number, content: string): Promise; conversationByReplyRef(replyRef: number): OpenConversation | undefined; openConversationsWith(nodeAddress: string): OpenConversation[]; } export interface DirectedSessionSender { isDirectedSessionTarget(to: string): boolean; send(to: string, content: string): Promise; } export type SendResult = { status: "sent"; messageId: string; acknowledgementStatus: string; messageRef?: string; addressedTarget?: NonNullable; directed?: { nodeHandle: string; sessionLabel: string; replyRef?: number; }; } | { status: "unknown"; messageId: string; attempts: 1; retryable: false; reason: SendOutcomeUnknownReason; error: string; errorCode: "SEND_OUTCOME_UNKNOWN"; } | { status: "failed"; error?: string; errorCode?: string; }; export interface ConversationEntry { contact: string; address: string; lastMessageAt: number; initiatedBy: "local" | "remote"; inboundEnvelope?: InboundEnvelope; } export interface ConversationSummary { contact: string; address: string; lastMessageAt: number; initiatedBy: "local" | "remote"; } export interface InboundEnvelope { traceparent?: string; correlationId?: string; messageId?: string; receivedAt: number; } export declare const REPLY_CORRELATION_MAX_AGE_MS: number; export declare class ConversationManager { private continuation?; private directedSessionSender?; setDirectedSessionSender(sender: DirectedSessionSender | undefined): void; private presentedConversationRef; presentConversation(conversationRef: string | null): void; reply(replyRef: number, content: string): Promise; openConversationsWith(nodeAddress: string): OpenConversation[]; conversationByReplyRef(replyRef: number): OpenConversation | undefined; setContinuation(continuation: ConversationContinuation | undefined): void; private readonly client; private readonly sentMessageBuffer; private readonly conversations; private readonly conversationAliases; private readonly pendingOutreach; constructor(client: ConnectorClient); recordOutboundContext(peerAddress: string, content: string): void; getRecentOutboundContext(peerAddress: string): SentMessage[]; send(contact: string, content: string, metadata?: Record): Promise; registerInbound(contact: string, address: string): void; refreshInboundPortrayal(contact: string, address: string): boolean; recordInboundEnvelope(address: string, envelope: Omit): void; getContactByAddress(address: string): string | undefined; listConversations(): ConversationSummary[]; hasConversation(contact: string): boolean; resolveAddress(contact: string): string; private resolveContactForSend; extractHandle(address: string): string; private resolveConversationAlias; private recordConversationAlias; private fileResolvedConversation; private ensureConversationEntry; _resetForTesting(): void; } //# sourceMappingURL=conversation-manager.d.ts.map