import { type CustomizationResourceLimits, type JsonValue } from "@actuarial-ts/core"; export type CustomizationExecutionErrorCode = "CANCELLED" | "RESOURCE_LIMIT" | "EXTERNAL_STATE_FAILURE" | "EXTERNAL_STATE_ORDER" | "EXTERNAL_STATE_TRUNCATED"; export declare class CustomizationExecutionError extends Error { readonly code: CustomizationExecutionErrorCode; constructor(code: CustomizationExecutionErrorCode, message: string); } export interface CustomizationExternalRecord { readonly id: string; readonly partitionKey: string; readonly orderKey: string; readonly value: T; } export interface CustomizationExternalStateSession { /** Trusted host accounting of retained working bytes and all spill files. Required for grouped history. */ readonly resourceUsage?: () => { readonly workingBytes: number; readonly spillBytes: number; }; /** Store one SDK-owned record. The adapter must not mutate it. */ readonly append: (record: CustomizationExternalRecord) => void | Promise; /** Finish writes before reads begin. */ readonly seal: () => void | Promise; /** Reopen all records exactly once in partitionKey/orderKey/id order. */ readonly read: () => AsyncIterable>; /** Release the run's temporary namespace for every terminal outcome. */ readonly dispose: (outcome: "completed" | "failed" | "cancelled") => void | Promise; } export interface CustomizationExternalStateAdapter { readonly open: (request: { readonly runId: string; readonly signal?: AbortSignal; }) => CustomizationExternalStateSession | Promise>; } export interface ExternalSortCustomizationRecordsInput { readonly runId: string; readonly records: Iterable> | AsyncIterable>; readonly adapter: CustomizationExternalStateAdapter; readonly limits: CustomizationResourceLimits; readonly signal?: AbortSignal; } /** * Validates, owns, externally stages, and deterministically rereads records. * The adapter supplies storage mechanics only; it cannot choose actuarial * ordering or publish a completed run. Early consumer return is cancellation. */ export declare function externalSortCustomizationRecords(input: ExternalSortCustomizationRecordsInput): AsyncGenerator>; //# sourceMappingURL=customizationExternalState.d.ts.map