UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

50 lines 2.65 kB
import { z } from '#compiled/zod/index.js'; /** * A workflow run ID: the `wrun_` prefix followed by a 26-char ULID (minted * client-side in core's `start()`). Validates the exact shape (prefix plus a * well-formed ULID) rather than a loose length bound, so callers can't smuggle * arbitrary strings through APIs that persist a run ID verbatim. */ export declare const workflowRunIdSchema: z.ZodTemplateLiteral<`wrun_${string}`>; export type WorkflowRunId = z.infer<typeof workflowRunIdSchema>; /** * 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. * * A slot-numbered event id is syntactically a valid ULID (26 zero-padded * decimal digits are all Crockford characters) whose timestamp component is * zero, so decoding one would silently yield the Unix epoch. Slots carry no * time at all, so this returns null for them and callers fall back to a real * `createdAt`. See `slot-identity.ts`. */ 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