UNPKG

@mastra/core

Version:
33 lines • 1.68 kB
import type { StepResult, WorkflowRunState } from '../workflows/index.js'; export type WorkflowStepStartGuard = { eventId: string; expectedStartedBy?: string; /** Prune the predecessor only after this delivery has durably claimed its input. */ previousStep?: { stepId: string; eventId: string; result: StepResult<any, any, any, any>; }; }; export type WorkflowStepCompletionGuard = { eventId: string; /** The continuation event durably holds the full input; only prune its predecessor. */ pruneOnly?: boolean; }; export declare class WorkflowStepConflictError extends Error { readonly reason: 'stale' | 'completed' | 'missing'; readonly storedResult?: StepResult<any, any, any, any> | undefined; readonly storedRequestContext?: Record<string, any> | undefined; readonly storedSnapshot?: WorkflowRunState | undefined; readonly code = "WORKFLOW_STEP_CONFLICT"; constructor(reason: 'stale' | 'completed' | 'missing', storedResult?: StepResult<any, any, any, any> | undefined, storedRequestContext?: Record<string, any> | undefined, storedSnapshot?: WorkflowRunState | undefined); } export declare function isWorkflowStepConflictError(error: unknown): error is WorkflowStepConflictError; /** Call inside the adapter's snapshot lock, before mutating results, state, or request context. */ export declare function assertWorkflowStepGuard({ snapshot, stepId, startGuard, completionGuard, }: { snapshot: WorkflowRunState | null; stepId: string; startGuard?: WorkflowStepStartGuard; completionGuard?: WorkflowStepCompletionGuard; }): void; //# sourceMappingURL=workflow-step-guard.d.ts.map