import type { DshRemoteHistoryEntry } from './dsh-event-contract.js'; import type { DshRemoteControlPlane, DshRemoteRuntimeProjection } from './types.js'; export type DshRemoteTurnUploadState = 'OPEN' | 'SEALED' | 'PREPARED' | 'UPLOADED' | 'COMMITTED'; export interface DshRemoteTurnUploadOutboxStats { OPEN: number; SEALED: number; PREPARED: number; UPLOADED: number; COMMITTED: number; } export interface DshRemoteTurnUploadOutboxOptions { directory: string; profileRef: string; key: Uint8Array; controlPlane: DshRemoteControlPlane; now?: () => number; fetch?: typeof fetch; retryBaseMillis?: number; maxObjectBytes?: number; maxPendingSpoolBytes?: number; onError?: (error: unknown, sessionRef?: string) => void; onFinalized?: (sessionRef: string) => void; } /** * Account-scoped durable owner for completed Turn uploads. * * Raw events are appended one JSON record at a time. The final gzip object is * streamed from disk, so a large Turn never becomes one in-memory JSON value. */ export declare class DshRemoteTurnUploadOutbox { private readonly options; private readonly database; private readonly spoolDirectory; private readonly now; private readonly fetcher; private readonly retryBaseMillis; private readonly maxObjectBytes; private readonly maxPendingSpoolBytes; private readonly key; private readonly databasePath; private readonly recovery; private runtime; private captureTail; private drainFlight; private bindingFlight; private retryTimer; private controller; private closed; private pendingSpoolBytes; constructor(options: DshRemoteTurnUploadOutboxOptions); activate(runtime: DshRemoteRuntimeProjection): Promise; /** Reset only derived receipts after the server binds this exact source. * Pending payloads survive; a repeated binding (including after restart) is free. * Stop the journal reader before discarding its checkpoint, and let an active * upload finish before resetting credentials. This never gates metadata ACKs. */ isReconcilingSourceBindings(): boolean; reconcileSourceBindings(bindings: Record, quiesce: () => Promise): Promise; capture(sessionRef: string, entries: readonly DshRemoteHistoryEntry[], historyTurnStart?: number): Promise; private captureEntries; stats(): DshRemoteTurnUploadOutboxStats; needsHistoryRevision(sessionRef: string, sourceRevision: string): boolean; /** Only a finalized full-journal scan may skip the immutable source prefix. */ historyResumeSeq(sessionRef: string): number; restoreHistoryReceipts(sessionRef: string, signal: AbortSignal): Promise; /** Immutable old objects may end before the source Turn; upload that tail as raw events. */ historyUncoveredFrom(sessionRef: string, startSeq: number, endSeq: number): number; queueHistoryFinalization(sessionRef: string, sourceRevision: string, throughSeq: number): void; drain(): Promise; close(): Promise; private createOpenTurn; private seal; private openTurn; private requireRow; private nextReady; private nextFinalizationReady; private committedHistoryProof; private deferFinalization; private finalizeHistory; private performDrain; private advance; private prepareObjectFile; private objectJson; private spoolSummary; private spoolLines; private putObject; private hashFile; private spoolPath; private objectPath; private removePayloadFiles; private scheduleDrain; private cleanupCommitted; private recoverOpenTurnsFromDisk; private discardUnrecoverableRow; private secureDatabaseFiles; } //# sourceMappingURL=turn-upload-outbox.d.ts.map