import type { BatchOperation } from '../../storage/interface.ts'; import type { ContextOperationRequest } from '../context.ts'; import type { SearchAttributeValue, WorkflowTimelineEntry } from '../types.ts'; import type { EngineInternals } from './internals.ts'; type PendingTimelineEntryValue = { startedAt: number; entry: WorkflowTimelineEntry; }; export type PersistCheckpointOptions = { timeline?: 'record-operation' | 'preserve-pending'; }; export type PersistCheckpointCallbacks = { appendTimelineBatchOperations: (workflowId: string, operation: ContextOperationRequest, step: number, timestamp: number, operations: BatchOperation[]) => PendingTimelineEntryValue; swallowPromiseRejection: (promise: Promise) => void; validateAttributeValueSizes: (attributes: Record) => void; pruneCheckpointHistory: (workflowId: string, step: number) => Promise; dispatchEvent: (event: Event) => void; /** * Force the workflow to a terminal `timed-out` state because its event-log * record count breached the configured history circuit-breaker threshold. * Awaited synchronously on the commit path so no further checkpoint can be * written after the breaching one; a rejection propagates out of * {@link commitCheckpoint} (the checkpoint has already committed durably). */ enforceHistoryCircuitBreaker: (workflowId: string) => Promise; }; type DevelopmentCheckpointCallbacks = { dispatchEvent: (event: Event) => void; }; export declare function appendTimelineBatchOperations(internals: EngineInternals, workflowId: string, operation: ContextOperationRequest, step: number, timestamp: number, operations: BatchOperation[]): PendingTimelineEntryValue; /** Persist a workflow checkpoint, history entry, timeline record, and event log record. */ export declare function persistCheckpoint(internals: EngineInternals, workflowId: string, operation: ContextOperationRequest, workerCheckpointBytes: ArrayBuffer | undefined, callbacks: PersistCheckpointCallbacks, options?: PersistCheckpointOptions): Promise; /** Delete the single checkpoint history entry that overflows the retention limit. */ export declare function pruneCheckpointHistory(internals: EngineInternals, workflowId: string, currentStep: number): Promise; /** Validate checkpoint serialization in development mode and dispatch warnings. */ export declare function validateDevelopmentCheckpoint(internals: EngineInternals, workflowId: string, callbacks: DevelopmentCheckpointCallbacks): void; export {};