import { z } from '#compiled/zod/index.js'; import { type SerializedData } from './serialization.js'; import type { PaginationOptions, ResolveData } from './shared.js'; export declare const WorkflowRunStatusSchema: z.ZodEnum<{ pending: "pending"; running: "running"; completed: "completed"; failed: "failed"; cancelled: "cancelled"; }>; export type WorkflowRunStatus = z.infer; export declare const TerminalWorkflowRunStatusSchema: z.ZodEnum<{ completed: "completed"; failed: "failed"; cancelled: "cancelled"; }>; export type TerminalWorkflowRunStatus = z.infer; export declare const TERMINAL_WORKFLOW_RUN_STATUSES: ("completed" | "failed" | "cancelled")[]; export declare function isTerminalWorkflowRunStatus(status: string): status is TerminalWorkflowRunStatus; /** * Base schema for the Workflow runs. Prefer using WorkflowRunSchema * which implements a discriminatedUnion for various states. * * Note: input/output use SerializedDataSchema to support both: * - specVersion >= 2: Uint8Array (binary devalue format) * - specVersion 1: any (legacy JSON format) */ export declare const WorkflowRunBaseSchema: z.ZodObject<{ runId: z.ZodString; status: z.ZodEnum<{ pending: "pending"; running: "running"; completed: "completed"; failed: "failed"; cancelled: "cancelled"; }>; deploymentId: z.ZodString; workflowName: z.ZodString; specVersion: z.ZodOptional; executionContext: z.ZodOptional>; input: z.ZodOptional>, z.ZodType>]>>; output: z.ZodOptional>, z.ZodType>]>>; error: z.ZodOptional>, z.ZodType>]>>; errorCode: z.ZodOptional; attributes: z.ZodDefault>; encryptionPublicKey: z.ZodOptional; expiredAt: z.ZodOptional>; startedAt: z.ZodOptional>; completedAt: z.ZodOptional>; createdAt: z.ZodCoercedDate; updatedAt: z.ZodCoercedDate; }, z.core.$strip>; export declare const WorkflowRunSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ runId: z.ZodString; deploymentId: z.ZodString; workflowName: z.ZodString; specVersion: z.ZodOptional; executionContext: z.ZodOptional>; input: z.ZodOptional>, z.ZodType>]>>; errorCode: z.ZodOptional; attributes: z.ZodDefault>; encryptionPublicKey: z.ZodOptional; expiredAt: z.ZodOptional>; startedAt: z.ZodOptional>; createdAt: z.ZodCoercedDate; updatedAt: z.ZodCoercedDate; status: z.ZodEnum<{ pending: "pending"; running: "running"; }>; output: z.ZodOptional; error: z.ZodOptional; completedAt: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ runId: z.ZodString; deploymentId: z.ZodString; workflowName: z.ZodString; specVersion: z.ZodOptional; executionContext: z.ZodOptional>; input: z.ZodOptional>, z.ZodType>]>>; errorCode: z.ZodOptional; attributes: z.ZodDefault>; encryptionPublicKey: z.ZodOptional; expiredAt: z.ZodOptional>; startedAt: z.ZodOptional>; createdAt: z.ZodCoercedDate; updatedAt: z.ZodCoercedDate; status: z.ZodLiteral<"cancelled">; output: z.ZodOptional; error: z.ZodOptional; completedAt: z.ZodCoercedDate; }, z.core.$strip>, z.ZodObject<{ runId: z.ZodString; deploymentId: z.ZodString; workflowName: z.ZodString; specVersion: z.ZodOptional; executionContext: z.ZodOptional>; input: z.ZodOptional>, z.ZodType>]>>; errorCode: z.ZodOptional; attributes: z.ZodDefault>; encryptionPublicKey: z.ZodOptional; expiredAt: z.ZodOptional>; startedAt: z.ZodOptional>; createdAt: z.ZodCoercedDate; updatedAt: z.ZodCoercedDate; status: z.ZodLiteral<"completed">; output: z.ZodUnion>, z.ZodType>]>; error: z.ZodOptional; completedAt: z.ZodCoercedDate; }, z.core.$strip>, z.ZodObject<{ runId: z.ZodString; deploymentId: z.ZodString; workflowName: z.ZodString; specVersion: z.ZodOptional; executionContext: z.ZodOptional>; input: z.ZodOptional>, z.ZodType>]>>; errorCode: z.ZodOptional; attributes: z.ZodDefault>; encryptionPublicKey: z.ZodOptional; expiredAt: z.ZodOptional>; startedAt: z.ZodOptional>; createdAt: z.ZodCoercedDate; updatedAt: z.ZodCoercedDate; status: z.ZodLiteral<"failed">; output: z.ZodOptional; error: z.ZodUnion>, z.ZodType>]>; completedAt: z.ZodCoercedDate; }, z.core.$strip>], "status">; export type WorkflowRun = z.infer; /** * WorkflowRun with input/output fields excluded (when resolveData='none'). * Used for listing runs without fetching the full serialized data. */ export type WorkflowRunWithoutData = Omit & { input: undefined; output: undefined; }; export interface CreateWorkflowRunRequest { deploymentId: string; workflowName: string; input: SerializedData; executionContext?: SerializedData; specVersion?: number; /** Plaintext attributes to seed when the run is created. */ attributes?: Record; } export interface GetWorkflowRunParams { resolveData?: ResolveData; } export interface ListWorkflowRunsParams { workflowName?: string; status?: WorkflowRunStatus; pagination?: PaginationOptions; resolveData?: ResolveData; } export interface CancelWorkflowRunParams { resolveData?: ResolveData; } /** * Maximum number of run IDs that a single bulk cancellation request may * carry. Kept small enough that the backend can process one request * synchronously without an asynchronous job or cursor. */ export declare const BULK_CANCEL_MAX_RUN_IDS = 500; /** * Request payload for cancelling many runs in a single operation. * * `runIds` must contain 1–{@link BULK_CANCEL_MAX_RUN_IDS} unique IDs. * `cancelReason` (max 512 chars) is recorded on each run_cancelled event, * mirroring the single-run {@link CancelRunOptions.cancelReason}. */ export declare const BulkCancelWorkflowRunsRequestSchema: z.ZodObject<{ runIds: z.ZodArray; cancelReason: z.ZodOptional; }, z.core.$strip>; export type BulkCancelWorkflowRunsRequest = z.infer; /** * Per-run outcome of a bulk cancellation. * * - `cancelled`: the run was transitioned to cancelled by this request. * - `already_cancelled`: the run was already cancelled (idempotent success). * - `not_cancellable`: the run is in a terminal, non-cancellable state * (e.g. `completed`/`failed`); `status` reports the observed status. * - `not_found`: no run exists for this ID. * - `failed`: cancellation failed; `code` is a machine-readable error code * and `retryable` indicates whether retrying may succeed. */ export declare const BulkCancelWorkflowRunResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ runId: z.ZodString; outcome: z.ZodLiteral<"cancelled">; }, z.core.$strip>, z.ZodObject<{ runId: z.ZodString; outcome: z.ZodLiteral<"already_cancelled">; }, z.core.$strip>, z.ZodObject<{ runId: z.ZodString; outcome: z.ZodLiteral<"not_cancellable">; status: z.ZodString; }, z.core.$strip>, z.ZodObject<{ runId: z.ZodString; outcome: z.ZodLiteral<"not_found">; }, z.core.$strip>, z.ZodObject<{ runId: z.ZodString; outcome: z.ZodLiteral<"failed">; code: z.ZodString; retryable: z.ZodBoolean; }, z.core.$strip>], "outcome">; export type BulkCancelWorkflowRunResult = z.infer; /** * Aggregate result of a bulk cancellation. `results` preserves the order of * the requested `runIds`; `summary` counts each outcome. */ export declare const BulkCancelWorkflowRunsResultSchema: z.ZodObject<{ summary: z.ZodObject<{ requested: z.ZodNumber; cancelled: z.ZodNumber; alreadyCancelled: z.ZodNumber; notCancellable: z.ZodNumber; notFound: z.ZodNumber; failed: z.ZodNumber; }, z.core.$strip>; results: z.ZodArray; }, z.core.$strip>, z.ZodObject<{ runId: z.ZodString; outcome: z.ZodLiteral<"already_cancelled">; }, z.core.$strip>, z.ZodObject<{ runId: z.ZodString; outcome: z.ZodLiteral<"not_cancellable">; status: z.ZodString; }, z.core.$strip>, z.ZodObject<{ runId: z.ZodString; outcome: z.ZodLiteral<"not_found">; }, z.core.$strip>, z.ZodObject<{ runId: z.ZodString; outcome: z.ZodLiteral<"failed">; code: z.ZodString; retryable: z.ZodBoolean; }, z.core.$strip>], "outcome">>; }, z.core.$strip>; export type BulkCancelWorkflowRunsResult = z.infer; //# sourceMappingURL=runs.d.ts.map