@mastra/core
Version:
59 lines • 2.88 kB
TypeScript
import type { Mastra } from '../mastra/index.js';
import type { Step } from './step.js';
import type { SingleStepEntry } from './types.js';
import type { Workflow } from './workflow.js';
/**
* Accessors for the {@link SingleStepEntry} union.
*
* This module is the single place allowed to pattern-match the union's shape.
* Everything else (both engines, handlers, utils) should go through these
* helpers so that adding a new variant means changing exactly one file.
*
* Union *shape* questions (id, retries, schemas, …) live here; how each
* declarative kind is *interpreted* at run time lives in `./entry-executors`.
*/
/**
* The id of a single step-like entry. Plain `step` entries key off the wrapped
* step's id; declarative variants (agent / tool / mapping) carry their own `id`.
*/
export declare function getEntryId(entry: SingleStepEntry): string;
/**
* The effective retry count for an entry, falling back to the provided
* workflow-level default when the entry doesn't declare its own.
*
* - `step` — the step's own `retries`
* - `agent` / `tool` — the declarative `options.retries`
* - `mapping` — never declares retries; always the fallback
*/
export declare function getEntryRetries(entry: SingleStepEntry, fallback?: number): number | undefined;
/**
* The `component` discriminator of the entry, if any. Only plain `step`
* entries can carry one (notably `'WORKFLOW'` for nested workflows);
* declarative variants have none.
*/
export declare function getEntryComponent(entry: SingleStepEntry): string | undefined;
/**
* Probes an entry for a nested workflow. Only the `type: 'step'` variant can
* wrap a live `Workflow` (identified by its `component === 'WORKFLOW'`
* discriminator from MastraBase); declarative variants never nest one.
*/
export declare function getEntryWorkflow(entry: SingleStepEntry): Workflow | null;
/**
* The human-readable description of the entry, if any. Declarative variants
* don't carry a live description (agent descriptions live on the agent itself).
*/
export declare function getEntryDescription(entry: SingleStepEntry): string | undefined;
/**
* The validation schemas of an entry, used by the engines to validate step
* input / suspend / resume data without materializing a live Step.
*
* - `step` — the step's own schemas
* - `agent` — the fixed `{ prompt: string }` input contract (mirrors `createStepFromAgent`)
* - `tool` — the resolved tool's schemas
* - `mapping` — none (mappings accept and return anything)
*
* Never throws: when a tool can't be resolved the schemas are simply empty and
* the run path surfaces the actionable not-found error.
*/
export declare function getEntrySchemas(entry: SingleStepEntry, mastra?: Mastra): Partial<Pick<Step<string, any, any>, 'inputSchema' | 'resumeSchema' | 'suspendSchema'>>;
//# sourceMappingURL=step-entry.d.ts.map