import { DshRemoteError } from './errors.js'; import type { DshRemoteOperation } from './types.js'; export type DshRemoteLedgerState = 'pending' | 'completed' | 'outcome_unknown'; export interface DshRemoteLedgerIdentity { accountId: string; runtimeRef: string; requestRef: string; operation: DshRemoteOperation; arguments: Record; executeBeforeMillis: number; } export interface DshRemoteLedgerEntry extends Omit { argumentsHash: string; state: DshRemoteLedgerState; dshRpcId: string; payload: Record; createdAtMillis: number; updatedAtMillis: number; } /** Cross-client identity: mobile writes it before send and DSH echoes it in canonical history. */ export declare function dshRemoteCommandRpcId(input: Pick): string; export declare class DshRemoteCommandLedger { private readonly path; private readonly database; private readonly key; private readonly now; constructor(directory: string, key: Uint8Array, options?: { now?: () => number; }); begin(input: DshRemoteLedgerIdentity): { duplicate: boolean; entry: DshRemoteLedgerEntry; }; complete(identity: Pick, result: Record): DshRemoteLedgerEntry; completeRejected(identity: Pick, error: Pick): DshRemoteLedgerEntry; markOutcomeUnknown(identity: Pick, reason: string): DshRemoteLedgerEntry; get(identity: Pick): DshRemoteLedgerEntry | undefined; pending(accountId: string, nowMillis?: number): DshRemoteLedgerEntry[]; /** * Returns every unsettled command still inside the v4 reconciliation window. * * An expired execute_before only prevents executing the command again. It must * not hide the crash window where DSH accepted the stable rpcId before the Host * persisted the result. Callers must inspect DSH history and either complete * the entry or mark outcome_unknown; they must never re-dispatch these rows. */ unsettledForReconciliation(accountId: string, nowMillis?: number, reconciliationWindowMillis?: number): DshRemoteLedgerEntry[]; cleanup(options?: { retentionMillis?: number; maxCommands?: number; }): number; get isOpen(): boolean; close(): void; private validateIdentity; private identity; private requireIdentity; private entry; private appendEvent; private eventAad; private transaction; private secureFiles; } //# sourceMappingURL=command-ledger.d.ts.map