@mastra/core
Version:
1 lines • 21.3 kB
Source Map (JSON)
{"version":3,"file":"index.cjs","names":["getSingleStepEntryId","_exhaustive"],"sources":["../../src/workflows/stored/serialize.ts","../../src/workflows/state-reader.ts"],"sourcesContent":["/**\n * Live → Storable half of the workflow round-trip: walk a live `stepFlow`\n * (runtime references, closures) and emit the JSON-safe storable form\n * (ids + serialized mapping configs, no closures).\n *\n * The static subset that round-trips:\n * - agent / tool by id\n * - mapping with `value`, `step`, `initData`, `requestContextPath`, `template`,\n * `state` sources (no `fn` source — closures don't round-trip)\n * - sleep / sleepUntil with literal duration/date\n * - parallel (inner entries must themselves be static)\n * - foreach with literal concurrency\n * - conditional / loop with declarative predicates (closure predicates throw)\n * - generic `.then(step)` falls back to a minimal step descriptor — usable\n * only when the step's id resolves on the live Mastra at load time\n *\n * Anything outside the subset throws at `toStorableGraph` time: silent loss\n * would ship broken workflows unnoticed.\n */\nimport { standardSchemaToJSONSchema, toStandardSchema } from '../../schema';\nimport type {\n SerializedSingleStepEntry,\n SerializedStepFlowEntry,\n SerializedStepOptions,\n SingleStepEntry,\n StepFlowEntry,\n} from '../types';\nimport { getSingleStepEntryId } from '../utils';\n\n/**\n * Walk a live `stepFlow` and emit a JSON-safe `SerializedStepFlowEntry[]` with\n * full (un-truncated) mapping configs and all step/agent/tool references stored\n * as ids. Throws on entries that can't round-trip (closures, closure predicates).\n */\nexport function toStorableGraph(stepFlow: StepFlowEntry[]): SerializedStepFlowEntry[] {\n return stepFlow.map(entry => serializeEntry(entry));\n}\n\nfunction serializeEntry(entry: StepFlowEntry): SerializedStepFlowEntry {\n switch (entry.type) {\n case 'step':\n case 'agent':\n case 'tool':\n case 'mapping':\n return serializeSingleEntry(entry);\n case 'sleep':\n if (typeof entry.duration !== 'number') {\n throw new Error(`Sleep step \"${entry.id}\" cannot be stored: dynamic duration (function) is not supported.`);\n }\n return { type: 'sleep', id: entry.id, duration: entry.duration };\n case 'sleepUntil':\n if (!(entry.date instanceof Date)) {\n throw new Error(`SleepUntil step \"${entry.id}\" cannot be stored: dynamic date (function) is not supported.`);\n }\n return { type: 'sleepUntil', id: entry.id, date: entry.date };\n case 'parallel':\n return { type: 'parallel', steps: entry.steps.map(s => serializeSingleEntry(s)) };\n case 'foreach':\n if (entry.step.type === 'mapping') {\n throw new Error(\n `Foreach step cannot iterate a mapping: mappings project data, they don't execute per item. Use an agent, tool, or plain step as the foreach body.`,\n );\n }\n return {\n type: 'foreach',\n step: serializeSingleEntry(entry.step),\n opts:\n typeof entry.opts.concurrency === 'function'\n ? { fn: entry.opts.concurrency.toString() }\n : { concurrency: entry.opts.concurrency },\n };\n case 'conditional': {\n const predicates = entry.predicates;\n if (!predicates || predicates.some(p => !p || typeof p !== 'object')) {\n throw new Error(\n `Conditional (branch) step cannot be stored: closure predicates do not round-trip. Use the declarative form ({ predicate: {...} }) for each branch.`,\n );\n }\n return {\n type: 'conditional',\n steps: entry.steps.map(s => serializeSingleEntry(s)),\n serializedConditions: entry.serializedConditions,\n predicates,\n };\n }\n case 'loop': {\n const predicate = entry.predicate;\n if (!predicate || typeof predicate !== 'object') {\n throw new Error(\n `Loop step \"${getSingleStepEntryId(entry.step)}\" cannot be stored: closure predicates do not round-trip. Use the declarative form ({ predicate: {...} }).`,\n );\n }\n return {\n type: 'loop',\n step: serializeSingleEntry(entry.step),\n serializedCondition: entry.serializedCondition,\n loopType: entry.loopType,\n predicate,\n };\n }\n default: {\n const _exhaustive: never = entry;\n throw new Error(`Unknown step entry type: ${JSON.stringify(_exhaustive)}`);\n }\n }\n}\n\nfunction serializeSingleEntry(entry: SingleStepEntry): SerializedSingleStepEntry {\n if (entry.type === 'agent') {\n const options = pickSerializableStepOptions(entry.options, entry.id, 'agent');\n const outputSchema = extractStructuredOutputJsonSchema(entry.options, entry.id);\n return {\n type: 'agent',\n id: entry.id,\n agentId: entry.agentId,\n description: entry.agent?.description,\n ...(outputSchema ? { outputSchema } : {}),\n ...(options ? { options } : {}),\n };\n }\n if (entry.type === 'tool') {\n const options = pickSerializableStepOptions(entry.options, entry.id, 'tool');\n return {\n type: 'tool',\n id: entry.id,\n toolId: entry.toolId,\n description: entry.tool?.description,\n ...(options ? { options } : {}),\n };\n }\n if (entry.type === 'mapping') {\n if (typeof entry.mapConfig === 'function') {\n throw new Error(\n `Mapping step \"${entry.id}\" cannot be stored: the function form does not round-trip. Use the declarative form (template / step / initData / value).`,\n );\n }\n const serialized: Record<string, any> = {};\n for (const [key, mapping] of Object.entries(entry.mapConfig as Record<string, any>)) {\n const m: any = mapping;\n if (m.fn !== undefined) {\n throw new Error(`Mapping step \"${entry.id}\" key \"${key}\" cannot be stored: source is a function.`);\n }\n if (m.value !== undefined) {\n serialized[key] = { value: m.value };\n } else if (m.requestContextPath) {\n serialized[key] = { requestContextPath: m.requestContextPath };\n } else if (typeof m.template === 'string') {\n serialized[key] = { template: m.template };\n } else if (m.initData) {\n serialized[key] = { initData: m.initData?.id, path: m.path };\n } else if (m.step) {\n serialized[key] = {\n step: Array.isArray(m.step) ? m.step.map((s: any) => s?.id) : m.step?.id,\n path: m.path,\n };\n } else {\n serialized[key] = m;\n }\n }\n return { type: 'mapping', id: entry.id, mapConfig: JSON.stringify(serialized) };\n }\n // A nested Workflow reached the generic `.then(step)` fallback (its\n // component discriminator is 'WORKFLOW'). Emit a declarative `workflow`\n // entry so the rehydrator can rebuild it by id. Inline the nested graph\n // when present so Studio/API consumers can expand it (same role the old\n // `type:'step' + component:'WORKFLOW'` shape played).\n if ((entry.step as any)?.component === 'WORKFLOW') {\n // Prefer the public getter (serializedStepGraph); fall back to the\n // protected/legacy serializedStepFlow field.\n const nestedFlow =\n ((entry.step as any).serializedStepGraph as SerializedStepFlowEntry[] | undefined) ??\n ((entry.step as any).serializedStepFlow as SerializedStepFlowEntry[] | undefined);\n return {\n type: 'workflow',\n id: (entry.step as any).id,\n workflowId: (entry.step as any).id,\n ...((entry.step as any).description ? { description: (entry.step as any).description } : {}),\n ...(nestedFlow ? { serializedStepFlow: nestedFlow } : {}),\n };\n }\n // generic `.then(step)` — descriptor only; rehydration looks the step up\n // by id on the live Mastra instance.\n return { type: 'step', step: stepDescriptor(entry.step) };\n}\n\nfunction stepDescriptor(step: any) {\n return {\n id: step.id,\n description: step.description,\n metadata: step.metadata,\n component: step.component,\n canSuspend: Boolean(step.suspendSchema || step.resumeSchema),\n };\n}\n\n/**\n * Pull the JSON-safe fields (`retries`, `metadata`) out of the options bag\n * carried on a live agent/tool `SingleStepEntry`. Closure-valued fields must\n * hard-crash here rather than silently vanish through storage.\n */\nfunction pickSerializableStepOptions(\n options: any,\n entryId: string,\n kind: 'agent' | 'tool',\n): SerializedStepOptions | undefined {\n if (!options || typeof options !== 'object') return undefined;\n\n // Closure-valued options don't round-trip. Fail loudly at serialize time so\n // the workflow author immediately learns their step won't persist rather\n // than discovering it in production when the callback silently no-ops.\n const forbidden: Array<{ key: string; hint: string }> = [\n { key: 'onFinish', hint: 'callback closure' },\n { key: 'onChunk', hint: 'callback closure' },\n { key: 'onError', hint: 'callback closure' },\n { key: 'onStepFinish', hint: 'callback closure' },\n { key: 'onAbort', hint: 'callback closure' },\n { key: 'toolChoice', hint: 'may be a function' },\n ];\n for (const { key, hint } of forbidden) {\n if (typeof options[key] === 'function') {\n throw new Error(\n `${kind === 'agent' ? 'Agent' : 'Tool'} step \"${entryId}\" cannot be stored: option \"${key}\" is a ${hint} that does not round-trip. Remove it or move that logic outside the persisted workflow.`,\n );\n }\n }\n if (typeof options.scorers === 'function') {\n throw new Error(\n `${kind === 'agent' ? 'Agent' : 'Tool'} step \"${entryId}\" cannot be stored: \"scorers\" is a function; only the static array form round-trips.`,\n );\n }\n\n const out: SerializedStepOptions = {};\n if (typeof options.retries === 'number') out.retries = options.retries;\n if (options.metadata && typeof options.metadata === 'object') {\n out.metadata = options.metadata as Record<string, any>;\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\n/**\n * If the agent-step options carry `structuredOutput.schema`, that schema IS\n * the step's output shape (see `createStepFromAgent`). Emit it as JSON Schema\n * so rehydration can wire the same structured output back in.\n */\nfunction extractStructuredOutputJsonSchema(options: any, entryId: string): Record<string, any> | undefined {\n const raw = options?.structuredOutput?.schema;\n if (raw === undefined || raw === null) return undefined;\n try {\n // `.agent()`'s typed overload requires a StandardSchemaWithJSON, but the\n // any-form accepts a raw Zod schema. Normalize either shape here so the\n // storage form is consistent.\n const standard = toStandardSchema(raw);\n return standardSchemaToJSONSchema(standard) as Record<string, any>;\n } catch (e) {\n throw new Error(\n `Agent step \"${entryId}\" cannot be stored: structuredOutput.schema is not convertible to JSON Schema (${(e as Error).message}).`,\n );\n }\n}\n","import type {\n WorkflowResumeLabel,\n WorkflowState,\n WorkflowStateSingleStepResult,\n WorkflowStateStepResult,\n} from './types';\n\nexport type WorkflowSuspendedStep = {\n stepId: string;\n path: string[];\n executionPath?: number[];\n step?: WorkflowStateStepResult;\n payload?: any;\n suspendPayload?: any;\n suspendOutput?: any;\n resumeLabels: Record<string, WorkflowResumeLabel>;\n};\n\nexport type WorkflowStateReader = {\n getStatus: () => WorkflowState['status'];\n getResult: () => WorkflowState['result'];\n getError: () => WorkflowState['error'];\n getStepOutput: <T = any>(stepId: string) => T | Array<T | undefined> | undefined;\n getStepPayload: <T = any>(stepId: string) => T | Array<T | undefined> | undefined;\n getSuspendedStep: () => WorkflowSuspendedStep | undefined;\n getSuspendedSteps: () => WorkflowSuspendedStep[];\n getResumeLabel: (label: string) => WorkflowResumeLabel | undefined;\n getResumeLabels: () => Record<string, WorkflowResumeLabel>;\n};\n\nconst getStep = (state: WorkflowState, stepId: string) => state.steps?.[stepId];\n\nconst getFirstStepResult = (step?: WorkflowStateStepResult): WorkflowStateSingleStepResult | undefined => {\n return Array.isArray(step) ? (step.find(result => result?.status === 'suspended') ?? step[0]) : step;\n};\n\nconst getNestedSuspendPath = (step?: WorkflowStateStepResult): string[] => {\n const path = getFirstStepResult(step)?.suspendPayload?.__workflow_meta?.path;\n return Array.isArray(path) ? path.filter((part): part is string => typeof part === 'string') : [];\n};\n\nexport function getWorkflowStepOutput<T = any>(\n state: WorkflowState,\n stepId: string,\n): T | Array<T | undefined> | undefined {\n const step = getStep(state, stepId);\n return Array.isArray(step) ? step.map(result => result?.output as T | undefined) : (step?.output as T | undefined);\n}\n\nexport function getWorkflowStepPayload<T = any>(\n state: WorkflowState,\n stepId: string,\n): T | Array<T | undefined> | undefined {\n const step = getStep(state, stepId);\n return Array.isArray(step) ? step.map(result => result?.payload as T | undefined) : (step?.payload as T | undefined);\n}\n\nexport function getWorkflowResumeLabel(state: WorkflowState, label: string) {\n const resumeLabel = state.resumeLabels?.[label];\n return resumeLabel ? { ...resumeLabel } : undefined;\n}\n\nexport function getWorkflowResumeLabels(state: WorkflowState): Record<string, WorkflowResumeLabel> {\n return Object.entries(state.resumeLabels ?? {}).reduce(\n (labels, [label, value]) => {\n labels[label] = { ...value };\n return labels;\n },\n {} as Record<string, WorkflowResumeLabel>,\n );\n}\n\nexport function getWorkflowSuspendedSteps(state: WorkflowState): WorkflowSuspendedStep[] {\n return Object.entries(state.suspendedPaths ?? {}).map(([stepId, executionPath]) => {\n const step = getStep(state, stepId);\n const firstStepResult = getFirstStepResult(step);\n const nestedPath = getNestedSuspendPath(step);\n const path = nestedPath.length > 0 ? (nestedPath[0] === stepId ? nestedPath : [stepId, ...nestedPath]) : [stepId];\n const resumeLabels = Object.entries(state.resumeLabels ?? {}).reduce(\n (labels, [label, value]) => {\n if (value.stepId === stepId) {\n labels[label] = { ...value };\n }\n return labels;\n },\n {} as Record<string, WorkflowResumeLabel>,\n );\n\n return {\n stepId,\n path,\n executionPath,\n step,\n payload: Array.isArray(step) ? step.map(result => result?.payload) : step?.payload,\n suspendPayload: firstStepResult?.suspendPayload,\n suspendOutput: firstStepResult?.suspendOutput,\n resumeLabels,\n };\n });\n}\n\nexport function getWorkflowSuspendedStep(state: WorkflowState): WorkflowSuspendedStep | undefined {\n return getWorkflowSuspendedSteps(state)[0];\n}\n\nexport function createWorkflowStateReader(state: WorkflowState): WorkflowStateReader {\n return {\n getStatus: () => state.status,\n getResult: () => state.result,\n getError: () => state.error,\n getStepOutput: stepId => getWorkflowStepOutput(state, stepId),\n getStepPayload: stepId => getWorkflowStepPayload(state, stepId),\n getSuspendedStep: () => getWorkflowSuspendedStep(state),\n getSuspendedSteps: () => getWorkflowSuspendedSteps(state),\n getResumeLabel: label => getWorkflowResumeLabel(state, label),\n getResumeLabels: () => getWorkflowResumeLabels(state),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,gBAAgB,UAAsD;CACpF,OAAO,SAAS,KAAI,UAAS,eAAe,KAAK,CAAC;AACpD;AAEA,SAAS,eAAe,OAA+C;CACrE,QAAQ,MAAM,MAAd;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,WACH,OAAO,qBAAqB,KAAK;EACnC,KAAK;GACH,IAAI,OAAO,MAAM,aAAa,UAC5B,MAAM,IAAI,MAAM,eAAe,MAAM,GAAG,kEAAkE;GAE5G,OAAO;IAAE,MAAM;IAAS,IAAI,MAAM;IAAI,UAAU,MAAM;GAAS;EACjE,KAAK;GACH,IAAI,EAAE,MAAM,gBAAgB,OAC1B,MAAM,IAAI,MAAM,oBAAoB,MAAM,GAAG,8DAA8D;GAE7G,OAAO;IAAE,MAAM;IAAc,IAAI,MAAM;IAAI,MAAM,MAAM;GAAK;EAC9D,KAAK,YACH,OAAO;GAAE,MAAM;GAAY,OAAO,MAAM,MAAM,KAAI,MAAK,qBAAqB,CAAC,CAAC;EAAE;EAClF,KAAK;GACH,IAAI,MAAM,KAAK,SAAS,WACtB,MAAM,IAAI,MACR,mJACF;GAEF,OAAO;IACL,MAAM;IACN,MAAM,qBAAqB,MAAM,IAAI;IACrC,MACE,OAAO,MAAM,KAAK,gBAAgB,aAC9B,EAAE,IAAI,MAAM,KAAK,YAAY,SAAS,EAAE,IACxC,EAAE,aAAa,MAAM,KAAK,YAAY;GAC9C;EACF,KAAK,eAAe;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