import type { CommandReceipt, ManagedReadResult, WaitingReceipt, ManagedCommandMinePage } from 'openxiangda-contracts/browser'; export interface ManagedReadRecoveryOptions { /** * 含请求与繁忙退避的本调用总预算,默认 120 秒 / 12 次请求。 * 显式超过 120 秒时最多 30 分钟 / 120 次请求,超过上限按 30 分钟处理。 * 仅恢复已知只读繁忙;不会延长已提交申请的受理或观察期限。 */ budgetMs?: number; } export interface ManagedConcurrencyClient { /** Bound to the current application, environment and trusted user. */ readonly scope: string; read>(code: string, input: Record, signal?: AbortSignal, recovery?: ManagedReadRecoveryOptions): Promise>; enqueue(command: string, input: Record, requestKey: string, signal?: AbortSignal): Promise; mine(command: string, input: { resourceKey: string; cursor?: string; limit?: number; }, signal?: AbortSignal, recovery?: ManagedReadRecoveryOptions): Promise; join(command: string, input: Record, requestKey: string, signal?: AbortSignal): Promise; poll(ticket: string, signal?: AbortSignal): Promise; leave(ticket: string, signal?: AbortSignal): Promise<{ state: 'cancelled' | 'accepted'; requestKey: string; }>; accept(permit: string, signal?: AbortSignal): Promise; result(input: { operationId: string; } | { command: string; requestKey: string; }, signal?: AbortSignal, recovery?: ManagedReadRecoveryOptions): Promise; cancel(operationId: string, signal?: AbortSignal): Promise; allocation(allocationId: string, signal?: AbortSignal, recovery?: ManagedReadRecoveryOptions): Promise['allocation']>>; } export interface ManagedCommandSnapshot { state: 'idle' | 'waiting' | 'admitted' | 'recovering' | 'error' | CommandReceipt['state']; requestKey?: string; waiting?: WaitingReceipt; receipt?: CommandReceipt; errorCode?: string; } /** One durable request key per UI intent. Stopping the observer never cancels an accepted command. */ export declare class ManagedCommandController { private readonly options; private value; private readonly listeners; private recovery?; private abort?; private running?; private cancelling?; private submitRequested; private generation; private readonly key; private readonly input; constructor(options: { client: ManagedConcurrencyClient; command: string; input: Record; /** Stable name for this screen's operation, e.g. the selected resource ID. */ storageKey: string; storage: Pick; autoAccept?: boolean; sleep?: (ms: number, signal: AbortSignal) => Promise; random?: () => number; }); snapshot: () => ManagedCommandSnapshot; subscribe: (listener: () => void) => () => void; private update; private persist; private restore; /** Resume an existing intent without starting a new one on page mount. */ resume(): Promise; start(requestKey?: string): Promise; submit(): Promise; stop(): void; /** Explicitly begin a different intent only after a known terminal receipt. */ clear(): void; cancel(): Promise; private cancelOriginal; private findOriginal; private run; private observe; private pollDelay; } //# sourceMappingURL=managed-command.d.ts.map