import { z } from '#compiled/zod/index.js';
import type { PaginationOptions, ResolveData } from './shared.js';
export declare const EventTypeSchema: z.ZodEnum<{
    run_created: "run_created";
    run_started: "run_started";
    run_completed: "run_completed";
    run_failed: "run_failed";
    run_cancelled: "run_cancelled";
    attr_set: "attr_set";
    step_created: "step_created";
    step_completed: "step_completed";
    step_failed: "step_failed";
    step_retrying: "step_retrying";
    step_started: "step_started";
    hook_created: "hook_created";
    hook_received: "hook_received";
    hook_disposed: "hook_disposed";
    hook_conflict: "hook_conflict";
    wait_created: "wait_created";
    wait_completed: "wait_completed";
}>;
export type EventType = z.infer<typeof EventTypeSchema>;
declare const RunEventTypeSchema: z.ZodEnum<{
    run_created: "run_created";
    run_started: "run_started";
    run_completed: "run_completed";
    run_failed: "run_failed";
    run_cancelled: "run_cancelled";
}>;
export type RunEventType = z.infer<typeof RunEventTypeSchema>;
export declare const RUN_EVENT_TYPES: ("run_created" | "run_started" | "run_completed" | "run_failed" | "run_cancelled")[];
export declare function isRunEventType(eventType: string): eventType is RunEventType;
export declare const TerminalRunEventTypeSchema: z.ZodEnum<{
    run_completed: "run_completed";
    run_failed: "run_failed";
    run_cancelled: "run_cancelled";
}>;
export type TerminalRunEventType = z.infer<typeof TerminalRunEventTypeSchema>;
export declare const TERMINAL_RUN_EVENT_TYPES: ("run_completed" | "run_failed" | "run_cancelled")[];
export declare function isTerminalRunEventType(eventType: string): eventType is TerminalRunEventType;
declare const StepEventTypeSchema: z.ZodEnum<{
    step_created: "step_created";
    step_completed: "step_completed";
    step_failed: "step_failed";
    step_retrying: "step_retrying";
    step_started: "step_started";
}>;
export type StepEventType = z.infer<typeof StepEventTypeSchema>;
export declare const STEP_EVENT_TYPES: ("step_created" | "step_completed" | "step_failed" | "step_retrying" | "step_started")[];
export declare function isStepEventType(eventType: string): eventType is StepEventType;
declare const TerminalStepEventTypeSchema: z.ZodEnum<{
    step_completed: "step_completed";
    step_failed: "step_failed";
}>;
export type TerminalStepEventType = z.infer<typeof TerminalStepEventTypeSchema>;
export declare const TERMINAL_STEP_EVENT_TYPES: ("step_completed" | "step_failed")[];
export declare function isTerminalStepEventType(eventType: string): eventType is TerminalStepEventType;
declare const HookLifecycleEventTypeSchema: z.ZodEnum<{
    hook_created: "hook_created";
    hook_received: "hook_received";
    hook_disposed: "hook_disposed";
}>;
export type HookLifecycleEventType = z.infer<typeof HookLifecycleEventTypeSchema>;
export declare const HOOK_LIFECYCLE_EVENT_TYPES: ("hook_created" | "hook_received" | "hook_disposed")[];
export declare function isHookLifecycleEventType(eventType: string): eventType is HookLifecycleEventType;
declare const HookEventRequiringExistenceTypeSchema: z.ZodEnum<{
    hook_received: "hook_received";
    hook_disposed: "hook_disposed";
}>;
export type HookEventRequiringExistenceType = z.infer<typeof HookEventRequiringExistenceTypeSchema>;
export declare const HOOK_EVENTS_REQUIRING_EXISTENCE: ("hook_received" | "hook_disposed")[];
export declare function isHookEventRequiringExistence(eventType: string): eventType is HookEventRequiringExistenceType;
declare const WaitEventTypeSchema: z.ZodEnum<{
    wait_created: "wait_created";
    wait_completed: "wait_completed";
}>;
export type WaitEventType = z.infer<typeof WaitEventTypeSchema>;
export declare const WAIT_EVENT_TYPES: ("wait_created" | "wait_completed")[];
export declare function isWaitEventType(eventType: string): eventType is WaitEventType;
declare const ChildEntityCreationEventTypeSchema: z.ZodEnum<{
    step_created: "step_created";
    hook_created: "hook_created";
    wait_created: "wait_created";
}>;
export type ChildEntityCreationEventType = z.infer<typeof ChildEntityCreationEventTypeSchema>;
export declare const CHILD_ENTITY_CREATION_EVENT_TYPES: ("step_created" | "hook_created" | "wait_created")[];
export declare function isChildEntityCreationEventType(eventType: string): eventType is ChildEntityCreationEventType;
/**
 * Field within eventData that carries the opaque user payload for event types
 * that have one. V4 worlds split this field into the wire body while keeping
 * the remaining eventData fields in metadata.
 */
export declare const EVENT_DATA_PAYLOAD_FIELD_BY_EVENT_TYPE: {
    readonly run_created: "input";
    readonly run_started: "input";
    readonly run_completed: "output";
    readonly run_failed: "error";
    readonly step_created: "input";
    readonly step_started: "input";
    readonly step_completed: "result";
    readonly step_failed: "error";
    readonly step_retrying: "error";
    readonly hook_created: "metadata";
    readonly hook_received: "payload";
};
export type EventDataPayloadField = (typeof EVENT_DATA_PAYLOAD_FIELD_BY_EVENT_TYPE)[keyof typeof EVENT_DATA_PAYLOAD_FIELD_BY_EVENT_TYPE];
/**
 * 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<string, readonly EventDataPayloadField[]>;
export declare function getEventDataRefFields(eventType: string): readonly string[];
export declare function getEventDataPayloadField(eventType: string): EventDataPayloadField | undefined;
/**
 * 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 BaseEventSchema: z.ZodObject<{
    eventType: z.ZodEnum<{
        run_created: "run_created";
        run_started: "run_started";
        run_completed: "run_completed";
        run_failed: "run_failed";
        run_cancelled: "run_cancelled";
        attr_set: "attr_set";
        step_created: "step_created";
        step_completed: "step_completed";
        step_failed: "step_failed";
        step_retrying: "step_retrying";
        step_started: "step_started";
        hook_created: "hook_created";
        hook_received: "hook_received";
        hook_disposed: "hook_disposed";
        hook_conflict: "hook_conflict";
        wait_created: "wait_created";
        wait_completed: "wait_completed";
    }>;
    correlationId: z.ZodOptional<z.ZodString>;
    specVersion: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
/**
 * Event created when a hook is first invoked. The World implementation
 * atomically creates both the event and the hook entity.
 */
export declare const HookCreatedEventSchema: z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"hook_created">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        token: z.ZodString;
        tokenRetentionUntil: z.ZodOptional<z.ZodCoercedDate<unknown>>;
        metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
        isWebhook: z.ZodOptional<z.ZodBoolean>;
        isSystem: z.ZodOptional<z.ZodBoolean>;
    }, z.core.$strip>;
}, z.core.$strip>;
declare const HookReceivedEventSchema: z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"hook_received">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        token: z.ZodOptional<z.ZodString>;
        payload: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
    }, 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<z.ZodNumber>;
    eventType: z.ZodLiteral<"hook_conflict">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        token: z.ZodString;
        conflictingRunId: z.ZodOptional<z.ZodString>;
    }, 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<z.ZodString>;
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"run_created">;
    eventData: z.ZodObject<{
        deploymentId: z.ZodString;
        workflowName: z.ZodString;
        input: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
        executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
        allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
    }, z.core.$strip>;
}, z.core.$strip>;
export declare const CreateEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
    correlationId: z.ZodOptional<z.ZodString>;
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"run_created">;
    eventData: z.ZodObject<{
        deploymentId: z.ZodString;
        workflowName: z.ZodString;
        input: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
        executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
        allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    correlationId: z.ZodOptional<z.ZodString>;
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"run_started">;
    eventData: z.ZodOptional<z.ZodObject<{
        input: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
        deploymentId: z.ZodOptional<z.ZodString>;
        workflowName: z.ZodOptional<z.ZodString>;
        executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
        allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
    }, z.core.$strip>>;
}, z.core.$strip>, z.ZodObject<{
    correlationId: z.ZodOptional<z.ZodString>;
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"run_completed">;
    eventData: z.ZodObject<{
        output: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    correlationId: z.ZodOptional<z.ZodString>;
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"run_failed">;
    eventData: z.ZodObject<{
        error: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
        errorCode: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    correlationId: z.ZodOptional<z.ZodString>;
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"run_cancelled">;
    eventData: z.ZodOptional<z.ZodObject<{
        cancelReason: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"attr_set">;
    correlationId: z.ZodOptional<z.ZodString>;
    eventData: z.ZodObject<{
        changes: z.ZodArray<z.ZodObject<{
            key: z.ZodString;
            value: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
        }, 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.ZodLiteral<true>>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"step_created">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        stepName: z.ZodString;
        workflowName: z.ZodOptional<z.ZodString>;
        input: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"step_completed">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        ttfs: z.ZodOptional<z.ZodNumber>;
        stso: z.ZodOptional<z.ZodNumber>;
        stepCount: z.ZodOptional<z.ZodNumber>;
        eventCount: z.ZodOptional<z.ZodNumber>;
        rsfs: z.ZodOptional<z.ZodNumber>;
        finalSchedulingReplay: z.ZodOptional<z.ZodNumber>;
        optimizations: z.ZodOptional<z.ZodArray<z.ZodString>>;
        stepName: z.ZodOptional<z.ZodString>;
        workflowName: z.ZodOptional<z.ZodString>;
        result: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"step_failed">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        ttfs: z.ZodOptional<z.ZodNumber>;
        stso: z.ZodOptional<z.ZodNumber>;
        stepCount: z.ZodOptional<z.ZodNumber>;
        eventCount: z.ZodOptional<z.ZodNumber>;
        rsfs: z.ZodOptional<z.ZodNumber>;
        finalSchedulingReplay: z.ZodOptional<z.ZodNumber>;
        optimizations: z.ZodOptional<z.ZodArray<z.ZodString>>;
        stepName: z.ZodOptional<z.ZodString>;
        error: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"step_retrying">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        stepName: z.ZodOptional<z.ZodString>;
        error: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
        retryAfter: z.ZodOptional<z.ZodCoercedDate<unknown>>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"step_started">;
    correlationId: z.ZodString;
    eventData: z.ZodOptional<z.ZodObject<{
        stepName: z.ZodOptional<z.ZodString>;
        attempt: z.ZodOptional<z.ZodNumber>;
        workflowName: z.ZodOptional<z.ZodString>;
        input: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
        ownerMessageId: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"hook_created">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        token: z.ZodString;
        tokenRetentionUntil: z.ZodOptional<z.ZodCoercedDate<unknown>>;
        metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
        isWebhook: z.ZodOptional<z.ZodBoolean>;
        isSystem: z.ZodOptional<z.ZodBoolean>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"hook_received">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        token: z.ZodOptional<z.ZodString>;
        payload: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"hook_disposed">;
    correlationId: z.ZodString;
    eventData: z.ZodOptional<z.ZodObject<{
        token: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"wait_created">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        resumeAt: z.ZodCoercedDate<unknown>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"wait_completed">;
    correlationId: z.ZodString;
    eventData: z.ZodOptional<z.ZodObject<{
        resumeAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
    }, z.core.$strip>>;
}, z.core.$strip>], "eventType">;
export declare const EventSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
    correlationId: z.ZodOptional<z.ZodString>;
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"run_created">;
    eventData: z.ZodObject<{
        deploymentId: z.ZodString;
        workflowName: z.ZodString;
        input: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
        executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
        allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    correlationId: z.ZodOptional<z.ZodString>;
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"run_started">;
    eventData: z.ZodOptional<z.ZodObject<{
        input: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
        deploymentId: z.ZodOptional<z.ZodString>;
        workflowName: z.ZodOptional<z.ZodString>;
        executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
        allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
    }, z.core.$strip>>;
}, z.core.$strip>, z.ZodObject<{
    correlationId: z.ZodOptional<z.ZodString>;
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"run_completed">;
    eventData: z.ZodObject<{
        output: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    correlationId: z.ZodOptional<z.ZodString>;
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"run_failed">;
    eventData: z.ZodObject<{
        error: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
        errorCode: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    correlationId: z.ZodOptional<z.ZodString>;
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"run_cancelled">;
    eventData: z.ZodOptional<z.ZodObject<{
        cancelReason: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"attr_set">;
    correlationId: z.ZodOptional<z.ZodString>;
    eventData: z.ZodObject<{
        changes: z.ZodArray<z.ZodObject<{
            key: z.ZodString;
            value: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
        }, 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.ZodLiteral<true>>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"step_created">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        stepName: z.ZodString;
        workflowName: z.ZodOptional<z.ZodString>;
        input: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"step_completed">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        ttfs: z.ZodOptional<z.ZodNumber>;
        stso: z.ZodOptional<z.ZodNumber>;
        stepCount: z.ZodOptional<z.ZodNumber>;
        eventCount: z.ZodOptional<z.ZodNumber>;
        rsfs: z.ZodOptional<z.ZodNumber>;
        finalSchedulingReplay: z.ZodOptional<z.ZodNumber>;
        optimizations: z.ZodOptional<z.ZodArray<z.ZodString>>;
        stepName: z.ZodOptional<z.ZodString>;
        workflowName: z.ZodOptional<z.ZodString>;
        result: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"step_failed">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        ttfs: z.ZodOptional<z.ZodNumber>;
        stso: z.ZodOptional<z.ZodNumber>;
        stepCount: z.ZodOptional<z.ZodNumber>;
        eventCount: z.ZodOptional<z.ZodNumber>;
        rsfs: z.ZodOptional<z.ZodNumber>;
        finalSchedulingReplay: z.ZodOptional<z.ZodNumber>;
        optimizations: z.ZodOptional<z.ZodArray<z.ZodString>>;
        stepName: z.ZodOptional<z.ZodString>;
        error: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"step_retrying">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        stepName: z.ZodOptional<z.ZodString>;
        error: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
        retryAfter: z.ZodOptional<z.ZodCoercedDate<unknown>>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"step_started">;
    correlationId: z.ZodString;
    eventData: z.ZodOptional<z.ZodObject<{
        stepName: z.ZodOptional<z.ZodString>;
        attempt: z.ZodOptional<z.ZodNumber>;
        workflowName: z.ZodOptional<z.ZodString>;
        input: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
        ownerMessageId: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"hook_created">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        token: z.ZodString;
        tokenRetentionUntil: z.ZodOptional<z.ZodCoercedDate<unknown>>;
        metadata: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
        isWebhook: z.ZodOptional<z.ZodBoolean>;
        isSystem: z.ZodOptional<z.ZodBoolean>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"hook_received">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        token: z.ZodOptional<z.ZodString>;
        payload: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"hook_disposed">;
    correlationId: z.ZodString;
    eventData: z.ZodOptional<z.ZodObject<{
        token: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"hook_conflict">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        token: z.ZodString;
        conflictingRunId: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"wait_created">;
    correlationId: z.ZodString;
    eventData: z.ZodObject<{
        resumeAt: z.ZodCoercedDate<unknown>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    specVersion: z.ZodOptional<z.ZodNumber>;
    eventType: z.ZodLiteral<"wait_completed">;
    correlationId: z.ZodString;
    eventData: z.ZodOptional<z.ZodObject<{
        resumeAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
    }, z.core.$strip>>;
}, z.core.$strip>], "eventType">, z.ZodObject<{
    runId: z.ZodString;
    eventId: z.ZodString;
    createdAt: z.ZodCoercedDate<unknown>;
    occurredAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
    specVersion: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>>;
export type Event = z.infer<typeof EventSchema>;
export type EventOfType<T extends EventType> = Extract<Event, {
    eventType: T;
}>;
export type EventRequestOfType<T extends EventType> = Extract<AnyEventRequest, {
    eventType: T;
}>;
export type HookCreatedEvent = EventOfType<'hook_created'>;
export type HookCreatedEventRequest = EventRequestOfType<'hook_created'>;
export type HookReceivedEvent = z.infer<typeof HookReceivedEventSchema>;
export type HookConflictEvent = z.infer<typeof HookConflictEventSchema>;
/**
 * Union of all possible event request types.
 * @internal Use CreateEventRequest or RunCreatedEventRequest instead.
 */
export type AnyEventRequest = z.infer<typeof CreateEventSchema>;
type ChildEntityCreationEventRequest = EventRequestOfType<ChildEntityCreationEventType> | (EventRequestOfType<'step_started'> & {
    eventData: {
        stepName: string;
        input: unknown;
    };
});
/** Includes lazy step_started requests that create their step on demand. */
export declare function isChildEntityCreationEvent(event: AnyEventRequest): event is ChildEntityCreationEventRequest;
/**
 * 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<typeof RunCreatedEventSchema>;
/**
 * Event request types that require an existing runId.
 * This is the common case for all events except run_created.
 */
export type CreateEventRequest = Exclude<AnyEventRequest, RunCreatedEventRequest>;
export interface CreateEventParams {
    v1Compat?: boolean;
    resolveData?: ResolveData;
    /** Request ID (x-vercel-id when on Vercel) for correlating request logs with workflow events. */
    requestId?: string;
    /**
     * Epoch ms (the ULID time of the latest event the runtime has loaded during
     * replay). Sent by replay-context creates so the backend can reject the event
     * when a newer out-of-band event was recorded after this snapshot, enabling
     * an optimistic-concurrency guard. Omitted by callers without a loaded event
     * log.
     *
     * Backend contract (for World implementers who want to support the guard):
     * maintain a per-run marker holding the ULID time of the most recent
     * *externally-originated* event — a `hook_received` or `step_completed`
     * created **without** a `stateUpdatedAt` (replay-origin events carry one and
     * must not advance the marker). On a create that carries `stateUpdatedAt`,
     * reject with 412 when `stateUpdatedAt < marker` (strictly older); an equal
     * timestamp must pass (anti-livelock, so an up-to-date client is never
     * rejected). A backend that ignores this field simply disables the guard —
     * the client falls open and behaves as before.
     */
    stateUpdatedAt?: number;
    /**
     * Timestamp for when the event occurred on the client side. Worlds that
     * support this can persist it separately from `createdAt`, which represents
     * when the backing service accepted or stored the event.
     */
    occurredAt?: Date;
    /**
     * Inline-delta optimization (opt-in). When set, the World MAY return,
     * on the resulting {@link EventResult}, the first page of events written
     * strictly after this cursor (via `events`/`cursor`/`hasMore`) — the
     * same page an `events.list({ cursor: sinceCursor, sortOrder: 'asc' })`
     * call would return immediately after this write. The inline runtime
     * loop uses this to skip a redundant `events.list` round-trip between
     * sequential steps: instead of re-reading its own just-written events
     * (and any events interleaved in-band, such as `hook_received`), it
     * consumes the authoritative delta the write already had to compute.
     *
     * The cursor MUST share `events.list` semantics: the returned `events`
     * are everything sorted strictly after `sinceCursor`, `cursor` is the
     * position past the last returned event, and `hasMore` indicates a
     * further page exists. A World MAY return a single page and set
     * `hasMore: true` rather than paginating to exhaustion — the runtime
     * does not consume a truncated delta, it falls back to a full
     * incremental fetch whenever `hasMore` is true. (For that reason a step
     * body emitting more in-band events than one page silently bypasses this
     * fast path, which is correct but forgoes the saved round-trip.)
     * Returning these fields at all is OPTIONAL — a World that omits them is
     * fully supported; the runtime falls back to `events.list`. This
     * preserves the same divergence guarantees as the fetch path because the
     * delta is computed atomically against the same log the fetch would read.
     */
    sinceCursor?: string;
    /**
     * Run-started preload opt-out (advisory). On a `run_started` write a World
     * MAY preload the run's event log onto the {@link EventResult}
     * (`events`/`cursor`/`hasMore`) so the runtime can skip its initial
     * `events.list`. The turbo first invocation backgrounds `run_started`
     * purely as a write barrier and never reads that preload, so it sets this
     * to tell the World to skip the wasted list+resolve — trimming the
     * `run_started` round-trip that the chained first `step_started` waits on.
     * A World that ignores it (or doesn't preload) remains fully correct: the
     * runtime falls back to `events.list` whenever it actually needs the log.
     * Only honored for `run_started`; ignored for other event types.
     *
     * Named to match the World boundary, the wire frame meta, and the backend
     * option end-to-end (cf. {@link sinceCursor}) so the single name greps
     * across the SDK and the backend.
     */
    skipPreload?: boolean;
}
/**
 * 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;
    /**
     * Events with data resolved. Two producers populate this:
     *
     * - On a `run_started` response: all events up to this point, so the
     *   runtime can skip the initial `events.list` call and reduce TTFB.
     * - On a step-terminal write (`step_completed` / `step_failed`) when
     *   the caller passed {@link CreateEventParams.sinceCursor}: the delta
     *   of events written strictly after that cursor, so the inline loop
     *   can skip the per-step incremental `events.list` round-trip.
     */
    events?: Event[];
    /** Pagination cursor for `events`, matching events.list semantics. */
    cursor?: string | null;
    /** Whether additional event pages are available for `events`. */
    hasMore?: boolean;
    /**
     * Lazy step start: set to `true` only when a `step_started` event with
     * step-creation data atomically *created* the step on this call (the
     * caller won the create-claim), as opposed to transitioning a step that
     * already existed. The owned-inline runtime path uses this as the
     * exactly-once ownership signal — it runs the step body inline only when
     * it created the step, so a concurrent handler that lost the create race
     * (and gets `EntityConflictError`/skipped) never double-executes. Absent
     * (undefined) on the legacy path and from older servers/worlds, which is
     * the safe default (treated as "not the lazy creator").
     */
    stepCreated?: boolean;
    /** Server-owned max event count for the run (run-lifecycle responses); the runtime enforces it. */
    maxEvents?: number;
}
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