import { z } from '#compiled/zod/index.js'; import type { PaginationOptions, ResolveData } from './shared.js'; /** * Fields within eventData that hold ref/payload data per event type. * When resolveData is 'none', only these fields are stripped — all other * metadata (stepName, workflowName, etc.) is preserved. */ export declare const EVENT_DATA_REF_FIELDS: Record; /** * Strip ref/payload fields from eventData based on resolveData setting. * When resolveData is 'none', removes only large data fields (refs) from * eventData while preserving metadata like stepName, workflowName, etc. */ export declare function stripEventDataRefs(event: Event, resolveData: ResolveData): Event; export declare const EventTypeSchema: z.ZodEnum<{ run_created: "run_created"; run_completed: "run_completed"; run_failed: "run_failed"; step_created: "step_created"; step_completed: "step_completed"; step_failed: "step_failed"; step_retrying: "step_retrying"; hook_created: "hook_created"; hook_received: "hook_received"; run_started: "run_started"; run_cancelled: "run_cancelled"; attr_set: "attr_set"; step_started: "step_started"; hook_disposed: "hook_disposed"; hook_conflict: "hook_conflict"; wait_created: "wait_created"; wait_completed: "wait_completed"; }>; export declare const BaseEventSchema: z.ZodObject<{ eventType: z.ZodEnum<{ run_created: "run_created"; run_completed: "run_completed"; run_failed: "run_failed"; step_created: "step_created"; step_completed: "step_completed"; step_failed: "step_failed"; step_retrying: "step_retrying"; hook_created: "hook_created"; hook_received: "hook_received"; run_started: "run_started"; run_cancelled: "run_cancelled"; attr_set: "attr_set"; step_started: "step_started"; hook_disposed: "hook_disposed"; hook_conflict: "hook_conflict"; wait_created: "wait_created"; wait_completed: "wait_completed"; }>; correlationId: z.ZodOptional; specVersion: z.ZodOptional; }, z.core.$strip>; declare const HookReceivedEventSchema: z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"hook_received">; correlationId: z.ZodString; eventData: z.ZodObject<{ token: z.ZodOptional; payload: z.ZodUnion>, z.ZodType>]>; }, z.core.$strip>; }, z.core.$strip>; /** * Event created by World implementations when a hook_created request * conflicts with an existing hook token. This event is NOT user-creatable - * it is only returned by the World when a token conflict is detected. * * When the hook consumer sees this event, it should reject any awaited * promises with a HookTokenConflictError. */ declare const HookConflictEventSchema: z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"hook_conflict">; correlationId: z.ZodString; eventData: z.ZodObject<{ token: z.ZodString; conflictingRunId: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>; /** * Event created when a workflow run is first created. The World implementation * atomically creates both the event and the run entity with status 'pending'. */ declare const RunCreatedEventSchema: z.ZodObject<{ correlationId: z.ZodOptional; specVersion: z.ZodOptional; eventType: z.ZodLiteral<"run_created">; eventData: z.ZodObject<{ deploymentId: z.ZodString; workflowName: z.ZodString; input: z.ZodUnion>, z.ZodType>]>; executionContext: z.ZodOptional>; attributes: z.ZodOptional>; allowReservedAttributes: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>; export declare const CreateEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ correlationId: z.ZodOptional; specVersion: z.ZodOptional; eventType: z.ZodLiteral<"run_created">; eventData: z.ZodObject<{ deploymentId: z.ZodString; workflowName: z.ZodString; input: z.ZodUnion>, z.ZodType>]>; executionContext: z.ZodOptional>; attributes: z.ZodOptional>; allowReservedAttributes: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ correlationId: z.ZodOptional; specVersion: z.ZodOptional; eventType: z.ZodLiteral<"run_started">; eventData: z.ZodOptional>, z.ZodType>]>>; deploymentId: z.ZodOptional; workflowName: z.ZodOptional; executionContext: z.ZodOptional>; attributes: z.ZodOptional>; allowReservedAttributes: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ correlationId: z.ZodOptional; specVersion: z.ZodOptional; eventType: z.ZodLiteral<"run_completed">; eventData: z.ZodObject<{ output: z.ZodOptional>, z.ZodType>]>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ correlationId: z.ZodOptional; specVersion: z.ZodOptional; eventType: z.ZodLiteral<"run_failed">; eventData: z.ZodObject<{ error: z.ZodUnion>, z.ZodType>]>; errorCode: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ correlationId: z.ZodOptional; specVersion: z.ZodOptional; eventType: z.ZodLiteral<"run_cancelled">; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"attr_set">; correlationId: z.ZodOptional; eventData: z.ZodObject<{ changes: z.ZodArray; }, z.core.$strip>>; writer: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"workflow">; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"step">; stepId: z.ZodString; attempt: z.ZodNumber; }, z.core.$strip>], "type">; allowReservedAttributes: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"step_created">; correlationId: z.ZodString; eventData: z.ZodObject<{ stepName: z.ZodString; input: z.ZodUnion>, z.ZodType>]>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"step_completed">; correlationId: z.ZodString; eventData: z.ZodObject<{ stepName: z.ZodOptional; result: z.ZodUnion>, z.ZodType>]>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"step_failed">; correlationId: z.ZodString; eventData: z.ZodObject<{ stepName: z.ZodOptional; error: z.ZodUnion>, z.ZodType>]>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"step_retrying">; correlationId: z.ZodString; eventData: z.ZodObject<{ stepName: z.ZodOptional; error: z.ZodUnion>, z.ZodType>]>; retryAfter: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"step_started">; correlationId: z.ZodString; eventData: z.ZodOptional; attempt: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"hook_created">; correlationId: z.ZodString; eventData: z.ZodObject<{ token: z.ZodString; metadata: z.ZodOptional>, z.ZodType>]>>; isWebhook: z.ZodOptional; isSystem: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"hook_received">; correlationId: z.ZodString; eventData: z.ZodObject<{ token: z.ZodOptional; payload: z.ZodUnion>, z.ZodType>]>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"hook_disposed">; correlationId: z.ZodString; eventData: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"wait_created">; correlationId: z.ZodString; eventData: z.ZodObject<{ resumeAt: z.ZodCoercedDate; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"wait_completed">; correlationId: z.ZodString; eventData: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>], "eventType">; export declare const EventSchema: z.ZodIntersection; specVersion: z.ZodOptional; eventType: z.ZodLiteral<"run_created">; eventData: z.ZodObject<{ deploymentId: z.ZodString; workflowName: z.ZodString; input: z.ZodUnion>, z.ZodType>]>; executionContext: z.ZodOptional>; attributes: z.ZodOptional>; allowReservedAttributes: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ correlationId: z.ZodOptional; specVersion: z.ZodOptional; eventType: z.ZodLiteral<"run_started">; eventData: z.ZodOptional>, z.ZodType>]>>; deploymentId: z.ZodOptional; workflowName: z.ZodOptional; executionContext: z.ZodOptional>; attributes: z.ZodOptional>; allowReservedAttributes: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ correlationId: z.ZodOptional; specVersion: z.ZodOptional; eventType: z.ZodLiteral<"run_completed">; eventData: z.ZodObject<{ output: z.ZodOptional>, z.ZodType>]>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ correlationId: z.ZodOptional; specVersion: z.ZodOptional; eventType: z.ZodLiteral<"run_failed">; eventData: z.ZodObject<{ error: z.ZodUnion>, z.ZodType>]>; errorCode: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ correlationId: z.ZodOptional; specVersion: z.ZodOptional; eventType: z.ZodLiteral<"run_cancelled">; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"attr_set">; correlationId: z.ZodOptional; eventData: z.ZodObject<{ changes: z.ZodArray; }, z.core.$strip>>; writer: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"workflow">; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"step">; stepId: z.ZodString; attempt: z.ZodNumber; }, z.core.$strip>], "type">; allowReservedAttributes: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"step_created">; correlationId: z.ZodString; eventData: z.ZodObject<{ stepName: z.ZodString; input: z.ZodUnion>, z.ZodType>]>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"step_completed">; correlationId: z.ZodString; eventData: z.ZodObject<{ stepName: z.ZodOptional; result: z.ZodUnion>, z.ZodType>]>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"step_failed">; correlationId: z.ZodString; eventData: z.ZodObject<{ stepName: z.ZodOptional; error: z.ZodUnion>, z.ZodType>]>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"step_retrying">; correlationId: z.ZodString; eventData: z.ZodObject<{ stepName: z.ZodOptional; error: z.ZodUnion>, z.ZodType>]>; retryAfter: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"step_started">; correlationId: z.ZodString; eventData: z.ZodOptional; attempt: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"hook_created">; correlationId: z.ZodString; eventData: z.ZodObject<{ token: z.ZodString; metadata: z.ZodOptional>, z.ZodType>]>>; isWebhook: z.ZodOptional; isSystem: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"hook_received">; correlationId: z.ZodString; eventData: z.ZodObject<{ token: z.ZodOptional; payload: z.ZodUnion>, z.ZodType>]>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"hook_disposed">; correlationId: z.ZodString; eventData: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"hook_conflict">; correlationId: z.ZodString; eventData: z.ZodObject<{ token: z.ZodString; conflictingRunId: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"wait_created">; correlationId: z.ZodString; eventData: z.ZodObject<{ resumeAt: z.ZodCoercedDate; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ specVersion: z.ZodOptional; eventType: z.ZodLiteral<"wait_completed">; correlationId: z.ZodString; eventData: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>], "eventType">, z.ZodObject<{ runId: z.ZodString; eventId: z.ZodString; createdAt: z.ZodCoercedDate; specVersion: z.ZodOptional; }, z.core.$strip>>; export type Event = z.infer; export type HookReceivedEvent = z.infer; export type HookConflictEvent = z.infer; /** * Union of all possible event request types. * @internal Use CreateEventRequest or RunCreatedEventRequest instead. */ export type AnyEventRequest = z.infer; /** * Event request for creating a new workflow run. * Can be used with a client-generated runId or null for server-generated. */ export type RunCreatedEventRequest = z.infer; /** * Event request types that require an existing runId. * This is the common case for all events except run_created. */ export type CreateEventRequest = Exclude; export interface CreateEventParams { v1Compat?: boolean; resolveData?: ResolveData; /** Request ID (x-vercel-id when on Vercel) for correlating request logs with workflow events. */ requestId?: string; } /** * Result of creating an event. Includes the created event and optionally * the entity that was created or updated as a result of the event, with any updates applied to it. * * Note: `event` is optional to support legacy runs where event storage is skipped. */ export interface EventResult { /** The created event (optional for legacy compatibility) */ event?: Event; /** The workflow run entity (for run_* events) */ run?: import('./runs.js').WorkflowRun; /** The step entity (for step_* events) */ step?: import('./steps.js').Step; /** The hook entity (for hook_created events) */ hook?: import('./hooks.js').Hook; /** The wait entity (for wait_created/wait_completed events) */ wait?: import('./waits.js').Wait; /** * All events up to this point, with data resolved. When populated * on a run_started response, the runtime uses these to skip the * initial events.list call and reduce TTFB. */ events?: Event[]; /** Pagination cursor for `events`, matching events.list semantics. */ cursor?: string | null; /** Whether additional event pages are available for `events`. */ hasMore?: boolean; } export interface GetEventParams { resolveData?: ResolveData; } export interface ListEventsParams { runId: string; pagination?: PaginationOptions; resolveData?: ResolveData; } export interface ListEventsByCorrelationIdParams { correlationId: string; pagination?: PaginationOptions; resolveData?: ResolveData; } export {}; //# sourceMappingURL=events.d.ts.map