import type { PresentationRecord } from "./presentation-record.js"; import { type RuntimeDeliveredConversationSubject, type RuntimeEndpointClientReport, type RuntimeExactTargetPresentationEnvelopeV1, type RuntimeServicesDisclosedParticipant } from "./services-client/index.js"; export interface ServicesRetainedRecipientPresentation { contentType: string; envelope: RuntimeExactTargetPresentationEnvelopeV1; subject: RuntimeDeliveredConversationSubject; speaker: RuntimeServicesDisclosedParticipant; possibleRepeat: boolean; } export type ServicesRetainedPresentOutcome = { kind: "not_placed"; } | { kind: "seen"; replyText?: string; } | { kind: "unknown"; }; export interface ServicesRetainedRecipientLogger { info(message: string): void; warn(message: string): void; error(message: string, error?: unknown): void; } export interface ServicesRetainedRecipientOptions { apiHost: string; runtimeKey: string; present: (message: ServicesRetainedRecipientPresentation) => Promise; reply: (message: { subject: RuntimeDeliveredConversationSubject; messageRef: string; sender: RuntimeExactTargetPresentationEnvelopeV1["sender"]; }, text: string) => Promise; record: PresentationRecord; logger: ServicesRetainedRecipientLogger; endpointNonce?: string; retryDelayMs?: number; fetch?: typeof fetch; client?: RuntimeEndpointClientReport; controlStream?: { start(nodeId: string): void; stop(): void; }; timing?: { presentationBoundMs?: number; retryInitialMs?: number; retryMaxMs?: number; stopWaitMs?: number; typingIntervalMs?: number; }; } export declare function defaultEndpointNoncePath(accountId: string): string; export declare function loadEndpointNonce(path: string, runtimeKey: string): Promise; export declare class ServicesRetainedRecipientConsumer { private readonly clientConfig; private readonly runtimeKey; private readonly client; private readonly controlStream; private readonly present; private readonly reply; private readonly record; private readonly logger; private readonly endpointNonce; private readonly retryDelayMs; private readonly presentationBoundMs; private readonly retryInitialMs; private readonly retryMaxMs; private readonly stopWaitMs; private readonly typingIntervalMs; private endpoint; private stopped; private stoodDown; private activationPromise; private activationRetryTimer; private stopPromise; private readonly queue; private readonly held; private readonly pending; private readonly inFlight; private processing; private readonly retry; private retryTimer; private retryDelay; private retirementCheck; currentEndpoint(): { id: string; nonce: string; } | null; constructor(options: ServicesRetainedRecipientOptions); start(): Promise; stop(): Promise; whenIdle(): Promise; readonly onFrame: (raw: unknown) => void; readonly onStreamOpen: () => void; readonly onRegistrationRetired: (endpointId: string) => void; readonly onForceUnregister: (row: Record) => boolean; private dropQueued; private enqueue; private processQueue; private handleFrame; private afterAttached; private presentFrame; private startTyping; private sendReceipt; private scheduleRetry; private checkRetirement; private registerAgain; private standDown; private activate; private scheduleActivationRetry; private clearActivationRetryTimer; } //# sourceMappingURL=services-retained-recipient.d.ts.map