/** * Workflow execution engine. * * Loads a workflow's structured steps, resolves their dependency order, * executes each step by spawning the target plugin's MCP server, passes * outputs between steps via named template variables, and records the run * as WorkflowRun + StepResult nodes. * * After task 127 the engine handles only `type:'tool'` steps. Plugins that * want LLM reasoning own their own SDK call inside a tool. * * LOAD WORKFLOW + STEPS * │ * v * CREATE WorkflowRun (status: running) * │ * v * RESOLVE ORDER (topological sort) * │ * v * FOR EACH STEP: * ├─ resolve {{templates}} in params → spawn MCP server → call tool * ├─ parse output (JSON or _raw fallback, strips markdown fences) * ├─ store output under step's outputKey * ├─ create StepResult node (status: completed | skipped | failed) * └─ on failure: abort | skip | retry (per step config) * │ * v * UPDATE WorkflowRun status: * any failed → "failed" * any skipped → "partial" * else → "completed" */ import type { WorkflowInput } from "./workflow-create.js"; export interface WorkflowExecuteParams { workflowId: string; accountId: string; context?: Record; trigger?: "conversational" | "schedule" | "manual"; } export interface WorkflowExecuteResult { runId: string; status: "completed" | "partial" | "failed" | "incomplete"; stepsCompleted: number; stepsDegraded: number; stepsSkipped: number; stepsFailed: number; stepsTotal: number; error?: string; /** Set only when status is "incomplete": required inputs absent at pre-flight. */ missingInputs?: string[]; } export interface PreflightResult { /** Required declared inputs still absent after defaults were applied. */ missingInputs: string[]; /** Keys filled from a declared default because the caller did not supply them. */ defaultedKeys: string[]; /** The caller's context with declared defaults applied. */ effectiveContext: Record; } /** * Collapse the declared contract against the caller's context: apply defaults * for absent inputs, then determine which required inputs are still missing. * A required input with a default is never missing — the default fills it. */ export declare function computePreflight(inputs: WorkflowInput[], provided: Record | undefined): PreflightResult; /** * Seed the step-resolution context from the (defaulted) input context. * A declared contract key holding a scalar seeds directly, so `{{key}}` * resolves to the value. A non-contract scalar keeps the legacy `{ _raw }` * wrapping — the regression boundary. Objects always pass through. */ export declare function seedOutputContext(effectiveContext: Record, contractKeys: Set): Record; export declare function workflowExecute(params: WorkflowExecuteParams): Promise; //# sourceMappingURL=workflow-execute.d.ts.map