import { AIError } from "../../errors/ai-error.mjs"; import { BaseResult } from "./base-result.type.mjs"; import { BaseReport } from "./base-report.type.mjs"; import { StepSnapshot } from "./step-result.type.mjs"; //#region ../ai/src/contracts/result/workflow-result.type.d.ts /** * Workflow-specific execution report — {@link BaseReport} plus * per-step snapshots and the final frozen `ctx.state`. * * `report.children[]` carries every executable (tool, agent, * sub-workflow, supervisor) any step invoked, in invocation order. * `report.steps` remains the authoritative record of workflow * structure — one entry per defined step — while `children` gives * the cross-cutting tree view shared with other primitives. */ type WorkflowReport = BaseReport & { /** Discriminator narrowed to the workflow primitive. */type: "workflow"; workflowName: string; /** Structural fingerprint — same value exposed on the workflow instance. */ signature: string; /** ISO-8601 timestamp when cancellation was observed, if any. */ cancelledAt?: string; /** Per-step snapshots keyed by step name. */ steps: Record; /** Frozen final `ctx.state` at the moment the workflow terminated. */ state: Readonly>; }; /** * Result returned by `workflow.execute()` / `workflow.resume()`. * * Canonical destructuring (mirrors `AgentResult` and * `SupervisorResult`): * * `const { data, report, usage, error } = await workflow.execute(...)` * * `data` is populated only when the workflow was defined with an * `output: { extract, schema? }` spec and completed successfully. On * failure or cancellation it is `undefined`; read `error` and * `report.status` instead. */ type WorkflowResult = BaseResult & { type: "workflow"; data?: TOutput; report: WorkflowReport; error?: AIError; }; //#endregion export { WorkflowReport, WorkflowResult }; //# sourceMappingURL=workflow-result.type.d.mts.map