import type { ContextInternals } from './internals.ts'; /** * Durable per-step retry bookkeeping for `ctx.run`, stored in the workflow's * `checkpointLocals` so it survives crash/replay. One slot holds, per step: the * current attempt number, how many backoff sleeps already completed, and the * first-dispatch timestamp anchoring `scheduleToCloseTimeout`. Every mutator * rebuilds the slot through {@link writeRetryStateSlot} so no sub-map is silently * erased when another is updated. */ export declare const ACTIVITY_RETRY_STATE_LOCAL_KEY = "__weftActivityRetryState"; declare const ACTIVITY_RETRY_STATE_VERSION = 1; export declare const MAX_CHECKPOINTED_RETRY_ATTEMPT = 10000; export type ActivityRetryStateKey = number | string; export interface ActivityRetryState { version: typeof ACTIVITY_RETRY_STATE_VERSION; attempts: Record; completedRetrySleeps?: Record; /** * First-dispatch engine-clock timestamp per step, the anchor for * `scheduleToCloseTimeout`. Written ONCE on the first dispatch of a step and * never overwritten, so the wall-clock budget is measured from the original * dispatch even across crash/replay. Like `completedRetrySleeps`, it must be * preserved whenever the retry-state slot is rebuilt. */ dispatchedAt?: Record; } export declare function isActivityRetryState(value: unknown): value is ActivityRetryState; export declare function readActivityRetryAttempt(internals: ContextInternals, key: ActivityRetryStateKey): number | undefined; export declare function readCompletedRetrySleepCount(internals: ContextInternals, key: ActivityRetryStateKey): number; export declare function writeActivityRetryAttempt(internals: ContextInternals, key: ActivityRetryStateKey, attempt: number): void; export declare function completeActivityRetryAttempt(internals: ContextInternals, key: ActivityRetryStateKey, completedRetrySleepCount: number): void; /** * Read the first-dispatch anchor for a step's `scheduleToCloseTimeout`, writing * `now` on the first dispatch. Read-first so a crash/replay never resets the * window: the budget is measured from the original dispatch, and the anchor * lands in the checkpoint committed at the dispatch `yield` that follows. */ export declare function readOrInitActivityDispatchedAt(internals: ContextInternals, key: ActivityRetryStateKey, now: number): number; export {};