@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
118 lines • 5.1 kB
TypeScript
import type { IMastraLogger } from '../logger/index.js';
import type { RequestContext } from '../request-context/index.js';
import type { ExecutionGraph } from './execution-engine.js';
import type { Step } from './step.js';
import type { RestartExecutionParams, StepFlowEntry, TimeTravelContext, TimeTravelExecutionParams, WorkflowRunState } from './types.js';
export declare function validateStepInput({ prevOutput, step, validateInputs, }: {
prevOutput: any;
step: Step<string, any, any>;
validateInputs: boolean;
}): Promise<{
inputData: any;
validationError: Error | undefined;
}>;
export declare function validateStepResumeData({ resumeData, step }: {
resumeData?: any;
step: Step<string, any, any>;
}): Promise<{
resumeData: any;
validationError: Error | undefined;
}>;
export declare function validateStepSuspendData({ suspendData, step, validateInputs, }: {
suspendData?: any;
step: Step<string, any, any>;
validateInputs: boolean;
}): Promise<{
suspendData: any;
validationError: Error | undefined;
}>;
export declare function validateStepStateData({ stateData, step, validateInputs, }: {
stateData?: any;
step: Step<string, any, any>;
validateInputs: boolean;
}): Promise<{
stateData: any;
validationError: Error | undefined;
}>;
export declare function validateStepRequestContext({ requestContext, step, validateInputs, }: {
requestContext?: RequestContext;
step: Step<string, any, any>;
validateInputs: boolean;
}): Promise<{
validationError: Error | undefined;
}>;
export declare function getResumeLabelsByStepId(resumeLabels: Record<string, {
stepId: string;
foreachIndex?: number;
}>, stepId: string): Record<string, {
stepId: string;
foreachIndex?: number;
}>;
export declare const runCountDeprecationMessage = "Warning: 'runCount' is deprecated and will be removed on November 4th, 2025. Please use 'retryCount' instead.";
/**
* Creates a Proxy that wraps execute function parameters to show deprecation warnings
* when accessing deprecated properties.
*
* Currently handles:
* - `runCount`: Deprecated in favor of `retryCount`, will be removed on November 4th, 2025
*/
export declare function createDeprecationProxy<T extends Record<string, any>>(params: T, { paramName, deprecationMessage, logger, }: {
paramName: string;
deprecationMessage: string;
logger: IMastraLogger;
}): T;
export declare const getStepIds: (entry: StepFlowEntry) => string[];
export declare const createTimeTravelExecutionParams: (params: {
steps: string[];
inputData?: any;
resumeData?: any;
context?: TimeTravelContext<any, any, any, any>;
nestedStepsContext?: Record<string, TimeTravelContext<any, any, any, any>>;
snapshot: WorkflowRunState;
initialState?: any;
graph: ExecutionGraph;
perStep?: boolean;
}) => TimeTravelExecutionParams;
export declare const createRestartExecutionParams: ({ snapshot, graph, }: {
snapshot: WorkflowRunState;
graph: ExecutionGraph;
}) => RestartExecutionParams;
/**
* Re-hydrates serialized errors in step results back into proper Error instances.
* This is useful when errors have been serialized through an event system (e.g., evented engine, Inngest)
* and need to be converted back to Error instances with their custom properties preserved.
*
* @param steps - The workflow step results (context) that may contain serialized errors
* @returns The same steps object with errors hydrated as Error instances
*/
export declare function hydrateSerializedStepErrors(steps: WorkflowRunState['context']): {
input?: Record<string, any>;
} & Record<string, import("./types").SerializedStepResult<any, any, any, any>>;
/**
* Cleans step result data by removing internal properties at known structural levels.
*
* Removes:
* - `__state` properties (internal workflow state for state propagation)
* - `nestedRunId` from `metadata` objects (internal tracking for nested workflow retrieval)
*
* ## Why targeted cleaning instead of recursive?
*
* Internal properties only appear at specific, known locations:
*
* 1. **`__state`** - Added by step-executor.ts to every step result. For forEach,
* suspended iterations store the full result (including __state) while completed
* iterations only store the output value. See workflow-event-processor/index.ts:1227-1230.
*
* 2. **`metadata.nestedRunId`** - Added when nested workflows complete, stored at the
* step result level. For forEach with nested workflows, each iteration result can
* have this. See workflow-event-processor/index.ts:1449-1453.
*
* By only cleaning at the step result level and forEach iteration level, we avoid
* accidentally stripping user data that happens to use `__state` as a property name
* in their actual output values.
*
* @param stepResult - A step result object, or an array of iteration results (forEach)
* @returns The cleaned step result with internal properties removed
*/
export declare function cleanStepResult(stepResult: unknown): unknown;
//# sourceMappingURL=utils.d.ts.map