import type { RuntimeClaimCandidate, RuntimeSelfClaimOutcome, RuntimeSelfClaimResponse } from "../runtime-endpoint-client.js"; export interface MailroomEndpointSnapshot { endpoint_id: string; endpoint_nonce: string; state: string; } export interface MailroomLogger { info(event: string, fields?: Record): void; warn(event: string, fields?: Record): void; } export interface MailroomPort { listRuntimeClaimCandidates(params: { endpoint_id: string; endpoint_nonce: string; limit?: number; }): Promise<{ items: RuntimeClaimCandidate[]; }>; claimRuntimeSelfAssignment(params: { undispatched_id: string; target_endpoint_id: string; endpoint_nonce: string; assignment_mode?: "staged"; recover_existing?: boolean; }): Promise; } export interface StagedItem { endpoint_id: string; undispatched_id: string; assignment_id: string; source_message_id: string; target_ref: RuntimeSelfClaimResponse["target_ref"]; broker_projection_token: string; assigned_at: number; message: RuntimeSelfClaimResponse["message"]; staged_at: Date; deliveryAttempts: number; } export interface MailroomDeps { port: MailroomPort; listActiveEndpoints: () => MailroomEndpointSnapshot[]; logger: MailroomLogger; now?: () => Date; intervalMs?: number; listLimit?: number; } export declare const MAILROOM_DEFAULT_INTERVAL_MS = 20000; export declare class Mailroom { private readonly port; private readonly listActiveEndpoints; private readonly logger; private readonly now; private readonly intervalMs; private readonly listLimit; private readonly staged; private readonly waiters; private timer; private tickInFlight; constructor(deps: MailroomDeps); start(): void; stop(): void; isStarted(): boolean; tick(): Promise; private tickEndpoint; private claimAndStage; private stageClaim; peekStaged(endpointId: string): StagedItem[]; ackStaged(endpointId: string, sourceMessageId: string): boolean; dropStaged(endpointId: string, sourceMessageId: string): boolean; markDeliveryAttempt(endpointId: string, sourceMessageId: string): number; awaitStaged(endpointId: string, timeoutMs: number): Promise; recoverStaged(): Promise; private resolveWaiters; private removeWaiter; takeStaged(endpointId: string): StagedItem[]; onEndpointUnregistered(endpointId: string): void; dutyStatus(): { endpoints: number; staged_items: number; }; } //# sourceMappingURL=mailroom.d.ts.map