@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
61 lines • 2.32 kB
TypeScript
import type { BackgroundTaskManager } from './manager.js';
export { BACKGROUND_TASK_WORKFLOW_ID } from './workflow-id.js';
/**
* Builds the per-task evented workflow that owns executor + retries.
*
* Shape: outer workflow runs an inner `[run-attempt, classify-outcome]`
* workflow inside a `dountil` loop. `run-attempt` invokes the executor and
* categorises the outcome; `classify-outcome` persists final state, advances
* retry bookkeeping, and decides whether the loop is done. The dountil
* predicate exits on `done === true`.
*
* The nested-workflow-as-loop-body path lives in
* `processWorkflowEnd → processWorkflowLoop` and was fixed in PR #16312.
* Suspend/resume routes through the runtime's nested-workflow auto-detect
* (`processWorkflowStepRun` resume branch).
*
* Step bodies close over `manager` directly — the bg-tasks layer is the only
* consumer of the `@internal` private fields.
*/
export declare function buildBackgroundTaskWorkflow(manager: BackgroundTaskManager): import("../workflows").Workflow<import("../workflows/evented").EventedEngineType, import("../workflows").Workflow<import("../workflows/evented").EventedEngineType, (import("../workflows").Step<"run-attempt", unknown, {
taskId: string;
done?: boolean | undefined;
result?: unknown;
}, {
taskId: string;
outcome: "success" | "cancelled" | "timed_out" | "retry";
result?: unknown;
error?: any;
}, unknown, unknown, import("../workflows").DefaultEngineType, unknown> | import("../workflows").Step<"classify-outcome", unknown, {
taskId: string;
outcome: "success" | "cancelled" | "timed_out" | "retry";
result?: unknown;
error?: any;
}, {
taskId: string;
done: boolean;
result?: unknown;
}, unknown, unknown, import("../workflows").DefaultEngineType, unknown>)[], "__background-task__attempt", unknown, {
taskId: string;
done?: boolean | undefined;
result?: unknown;
}, {
taskId: string;
done: boolean;
result?: unknown;
}, {
taskId: string;
done: boolean;
result?: unknown;
}, unknown>[], "__background-task", unknown, {
taskId: string;
}, {
taskId: string;
done: boolean;
result?: unknown;
}, {
taskId: string;
done: boolean;
result?: unknown;
}, unknown>;
//# sourceMappingURL=workflow.d.ts.map