@mastra/core
Version:
96 lines • 4.33 kB
TypeScript
import type { ActorSignal } from '../../auth/ee/index.js';
import type { RequestContext } from '../../di/index.js';
import type { SerializedError } from '../../error/index.js';
import type { PubSub } from '../../events/pubsub.js';
import type { ObservabilityContext } from '../../observability/index.js';
import type { DefaultExecutionEngine } from '../default.js';
import type { RunJournal } from '../run-journal.js';
import type { EntryExecutionResult, ExecutionContext, OutputWriter, RestartExecutionParams, SerializedStepFlowEntry, StepFlowEntry, StepResult, TimeTravelExecutionParams, WorkflowRunStatus } from '../types.js';
export interface PersistStepUpdateParams {
workflowId: string;
runId: string;
resourceId?: string;
stepResults: Record<string, StepResult<any, any, any, any>>;
serializedStepGraph: SerializedStepFlowEntry[];
executionContext: ExecutionContext;
workflowStatus: WorkflowRunStatus;
result?: Record<string, any>;
error?: SerializedError;
requestContext: RequestContext;
/**
* Tracing context for span continuity during suspend/resume.
* When provided, this will be persisted to the snapshot for use on resume.
*/
tracingContext?: {
traceId?: string;
spanId?: string;
parentSpanId?: string;
};
/**
* Phase suffix appended to the durable operation ID to prevent duplicate
* step IDs when persistStepUpdate is called multiple times for the same
* execution path (e.g. 'start' before execution, 'entry-end' after).
*
* Every call site must pass a phase that is unique among the persists that
* can run for one execution path in a single execution; otherwise replay
* engines (Inngest) see duplicate step IDs. Optional only for backward
* compatibility with external callers.
*/
phase?: string;
/**
* Persist the `running` update even if the last persisted status was `suspended`.
* Used when a resumed step starts, so its resume data survives a crash mid-step.
*/
recordResumedStepStart?: boolean;
/**
* Storage v2: set by a step's start write, which can be in flight together with the start writes
* of other steps of a parallel or branch block. Only these steps' results are written, and no
* other write in flight may name them. Unset, the write sends every change.
*/
stepIds?: string[];
/**
* Storage v2: set by a running foreach's progress write. The foreach's result differs from the
* one it last wrote only by these indices' `metadata.foreachProgress` entries, so the journal can
* send just those (see `RunJournal.write`).
*/
foreachItems?: {
stepId: string;
indices: readonly number[];
};
/**
* Storage v2: the journal of the execution this write belongs to, set by the engine's own writes,
* which aren't made from one of the execution's entries. Unset, the write uses the journal of the
* execution it is made from (see `getRunJournal`).
*/
journal?: RunJournal;
}
export declare function isWorkflowRunCanceled(engine: DefaultExecutionEngine, workflowId: string, runId: string): Promise<boolean>;
export declare function persistStepUpdate(engine: DefaultExecutionEngine, params: PersistStepUpdateParams): Promise<void>;
export interface ExecuteEntryParams extends ObservabilityContext {
workflowId: string;
runId: string;
resourceId?: string;
entry: StepFlowEntry;
prevStep: StepFlowEntry;
serializedStepGraph: SerializedStepFlowEntry[];
stepResults: Record<string, StepResult<any, any, any, any>>;
restart?: RestartExecutionParams;
timeTravel?: TimeTravelExecutionParams;
resume?: {
steps: string[];
stepResults: Record<string, StepResult<any, any, any, any>>;
resumePayload: any;
resumePath: number[];
forEachIndex?: number;
};
executionContext: ExecutionContext;
pubsub: PubSub;
abortController: AbortController;
requestContext: RequestContext;
actor?: ActorSignal;
outputWriter?: OutputWriter;
disableScorers?: boolean;
perStep?: boolean;
}
export declare function executeEntry(engine: DefaultExecutionEngine, params: ExecuteEntryParams): Promise<EntryExecutionResult>;
//# sourceMappingURL=entry.d.ts.map