UNPKG

@mastra/core

Version:
63 lines 2.49 kB
import type { BackgroundTaskManager } from './manager.js'; export { BACKGROUND_TASK_WORKFLOW_ID } from './workflow-id.js'; /** * Builds the per-task workflow that owns executor + retries. * * Uses the standard (default) execution engine so the workflow runs entirely * in-process on whatever host calls `run.start()`. This is critical for * distributed deployments where the background-task worker must * execute tools locally — routing through the evented pipeline would send * step execution to the orchestration worker / API, which don't have the * internal workflow or task contexts registered. * * 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`. * * 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").DefaultEngineType, import("../workflows").Workflow<import("../workflows").DefaultEngineType, (import("../workflows").Step<"run-attempt", unknown, { taskId: string; done?: boolean | undefined; result?: unknown; }, { taskId: string; outcome: "success" | "failed" | "cancelled" | "timed_out" | "retry"; result?: unknown; error?: any; }, unknown, unknown, import("../workflows").DefaultEngineType, unknown> | import("../workflows").Step<"classify-outcome", unknown, { taskId: string; outcome: "success" | "failed" | "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