/** * v1.3.2 §6 — `validateWorkflow`: static validation of a `workflow.yaml` * template/instance. Shares the graph core (`util/graph`, §9.2) with * `validateAgents` — but here a cycle is an ERROR: a static workflow is a true * acyclic DAG (handoff_to / depends_on form precedence edges), so a cycle is a * genuine infinite-loop bug, unlike the agent peer mesh. * * Finding shape mirrors `validateSkill`/`validateAgents` ({code, message, * field}) plus `stage` for stage-scoped findings. */ export interface WorkflowFinding { code: string; message: string; /** stage id when the finding is scoped to one stage. */ stage?: string; field?: string; } export interface WorkflowValidationResult { ok: boolean; errors: WorkflowFinding[]; warnings: WorkflowFinding[]; } export interface ValidateWorkflowOptions { /** Canonical agent ids ("/") — when set, agent refs are resolved. */ knownAgents?: Set; /** * v1.3.5 §3.3 — known workflow ids; when set, `_workflow/` sub-workflow * stage refs are resolved against it (existence check). */ knownWorkflows?: Set; /** This workflow's own id — used to reject a direct self sub-workflow ref. */ selfId?: string; } export declare function validateWorkflow(doc: unknown, opts?: ValidateWorkflowOptions): WorkflowValidationResult; /** Extract the `_workflow/` sub-workflow ids referenced by a workflow doc's stages. */ export declare function subworkflowRefs(doc: unknown): string[]; export interface WorkflowSubrefs { id: string; /** sub-workflow ids this workflow calls via `_workflow/` stages. */ subworkflows: string[]; } /** * Detect cycles across the sub-workflow reference graph (A → _workflow/B → * _workflow/A …). Reuses the shared Kahn cycle core — same engine as the * per-workflow stage DAG and `agent validate --graph`. Returns each cycle as an * ordered id list (empty = acyclic). */ export declare function detectSubworkflowCycles(workflows: WorkflowSubrefs[]): string[][]; /** * Max nesting depth of the sub-workflow graph rooted at each workflow. PRD §3.3 * recommends ≤2 (parent main → sub-workflow → skill/agent). Assumes an acyclic * graph (run `detectSubworkflowCycles` first). Returns id → depth. */ export declare function subworkflowDepths(workflows: WorkflowSubrefs[]): Map;