import type { CommandReceipt } from 'openxiangda-contracts/browser'; import type { ManagedConcurrencyClient } from './managed-command'; type StorageLike = Pick; export interface DurableCommandSnapshot { state: 'idle' | 'recovering' | 'error' | CommandReceipt['state']; initialized: boolean; isObserving: boolean; /** A scoped durable receipt has been confirmed; an unknown intake is not safe to promise as accepted. */ acceptanceConfirmed: boolean; input?: Readonly>; requestKey?: string; receipt?: CommandReceipt; errorCode?: string; } export interface DurableCommandOptions { client: ManagedConcurrencyClient; command: string; resourceKey: string; storageKey?: string; storage: StorageLike; /** Total automatic intake recovery budget from the original explicit submit. */ acceptanceRecoveryMs?: number; /** Total read-only discovery budget per refresh; default 120s, explicitly at most 30min. Never renews the original intent. */ discoveryRecoveryMs?: number; sleep?: (ms: number, signal: AbortSignal) => Promise; random?: () => number; } /** Mount only reads mine/original receipt. Enqueue always requires explicit submit. */ export declare class DurableCommandController { private readonly options; private value; private listeners; private intent?; private generation; private abort?; private submitting?; private refreshing?; private readonly storageKey; constructor(options: DurableCommandOptions); snapshot: () => DurableCommandSnapshot; subscribe: (listener: () => void) => () => void; private update; private remainingRecoveryMs; private remainingObservationMs; private readRecovery; private persist; private intentSnapshot; private restore; private assertReceipt; private remember; private accept; stop(): void; refresh(): Promise; private discover; /** Explicit user action: retry the frozen local intent, never today's edited form. */ resume(): Promise; /** A known terminal result permits a new explicitly requested business cycle. */ submit(input: Record): Promise; private enqueue; private enqueueWithRecovery; private observe; private poll; } export {}; //# sourceMappingURL=durable-command.d.ts.map