import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment'; import { type PermissionDispatchRecovery } from './session-commands.js'; import { type DeliveryStore, type OwnerRouteDispatchGuard } from './store.js'; import type { AdapterSendResult, DeliveryAdapter, DeliveryAdapterContext, ConversationBinding, InboundEnvelope, ModelRouteRef, OutboxRecord } from './types.js'; export declare class DeliveryAdapterRegistryStoppedError extends Error { constructor(); } export declare class DeliveryAdapterRegistry { private readonly context; private readonly adapters; private readonly starting; private readonly stopSignal; private resolveStop; private stopped; constructor(context: DeliveryAdapterContext); register(adapter: DeliveryAdapter): Promise<() => Promise>; get(channel: string, account: string): DeliveryAdapter | undefined; reconcilableUnknownRoutes(): ReadonlyArray<{ channel: string; account: string; }>; size(): number; stop(): Promise; private cleanupStarting; } interface DeliveryCoordinatorOptions { store: DeliveryStore; registry: DeliveryAdapterRegistry; ownerId: string; leaseMs: number; maxAttempts: number; maxConcurrency: number; retryBaseMs: number; retryMaxMs: number; /** Host-owned route authority and exact Policy recheck used at claim and immediately before send. */ ownerRouteGuard?: Readonly; notificationGuard?: (record: Readonly) => Extract | undefined; tickIntervalMs?: number; now?: () => number; random?: () => number; } export declare class DeliveryCoordinator { private readonly options; private readonly active; private readonly now; private readonly random; private timer; private stopping; constructor(options: DeliveryCoordinatorOptions); tick(): Promise; start(): void; stop(): Promise; whenIdle(): Promise; private startLeaseHeartbeat; private process; private finish; private finishReconcile; } export type InboundProcessResult = { outcome: 'processed'; } | { outcome: 'not-processed'; failureCode: string; retryable: boolean; retryAfterMs?: number; }; export type InboundNotProcessedResult = Extract; /** Durable inputs admitted before an Agent turn becomes dispatch-ambiguous. */ export interface PreparedInboundMessage { imageAttachments: readonly ImageAttachmentRef[]; /** Exact route admitted for this claimed turn; runtimes may omit it when they do no LLM dispatch. */ modelRoute?: Readonly; /** Durable reconciliation mode for a permission command interrupted after its dispatch fence. */ permissionDispatchRecovery?: PermissionDispatchRecovery; } /** Identifies the live inbox claim that owns preparation side effects. */ export interface InboundPrepareContext { inboxId: string; ownerId: string; fencingToken: number; /** Present only when the Inbox itself proves an interrupted permission dispatch. */ permissionDispatchRecovery?: PermissionDispatchRecovery; } export type InboundPrepareResult = { outcome: 'prepared'; message: Readonly; } | InboundNotProcessedResult; export type MarkInboundDispatching = () => void; export interface InboundMessageProcessor { /** * Lets the processor place the durable marker immediately before its first external dispatch. * Explicit processors must let gate errors abort dispatch and must never dispatch after a gate error. */ readonly dispatchControl?: 'explicit'; /** Prepare durable inputs without dispatching the turn to the external Agent runtime. */ prepare?(binding: Readonly, envelope: Readonly, signal: AbortSignal, context: Readonly): Promise; process(binding: Readonly, envelope: Readonly, signal: AbortSignal, prepared?: Readonly, markDispatching?: MarkInboundDispatching): Promise; } interface InboundCoordinatorOptions { store: DeliveryStore; processor: () => InboundMessageProcessor | undefined; ownerId: string; leaseMs: number; maxAttempts: number; maxConcurrency: number; retryBaseMs: number; retryMaxMs: number; now?: () => number; random?: () => number; } export declare class InboundCoordinator { private readonly options; private readonly active; private readonly now; private readonly random; private stopping; constructor(options: InboundCoordinatorOptions); tick(): Promise; stop(): Promise; /** Abort and drain exact claims that a durable command fence made terminal. */ cancelUndispatchedClaims(inboxIds: readonly string[], command: 'new' | 'stop'): Promise; whenIdle(): Promise; private startLeaseHeartbeat; private process; private finishInbound; } export {}; //# sourceMappingURL=coordinator.d.ts.map