eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
35 lines • 1.8 kB
TypeScript
/**
* Default threshold for ULID timestamps in the past (24 hours).
*
* Set to 24 hours to support the resilient start path: when start() fails to
* create run_created, the queue carries the run input and the runtime creates
* the run on run_started. VQS supports delayed messages up to 24 hours.
*/
export declare const DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS: number;
/**
* Default threshold for ULID timestamps in the future (5 minutes).
*
* Kept tight to prevent abuse from client-generated ULIDs with manipulated
* future timestamps while still tolerating minor clock skew.
*/
export declare const DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS: number;
/** @deprecated Use DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS instead */
export declare const DEFAULT_TIMESTAMP_THRESHOLD_MS: number;
/**
* Extracts a Date from a ULID string, or null if the string is not a valid ULID.
*/
export declare function ulidToDate(maybeUlid: string): Date | null;
/**
* Validates that a prefixed ULID's embedded timestamp is within acceptable thresholds
* of the current server time. Uses asymmetric thresholds: 24h in the past (to support
* resilient start with queue delays) and 5min in the future (to prevent abuse while
* tolerating clock skew).
*
* @param prefixedUlid - The prefixed ULID to validate (e.g., "wrun_01ARYZ...")
* @param prefix - The prefix to strip (e.g., "wrun_")
* @param pastThresholdMs - Maximum allowed age in the past (default: 24 hours)
* @param futureThresholdMs - Maximum allowed distance in the future (default: 5 minutes)
* @returns null if valid, or an error message string if invalid
*/
export declare function validateUlidTimestamp(prefixedUlid: string, prefix: string, pastThresholdMs?: number, futureThresholdMs?: number): string | null;
//# sourceMappingURL=ulid.d.ts.map