@skillsregistry/dag
v1.1.0
Published
Portable workflow DAG schema, validation, and interpreter for SkillsRegistry
Maintainers
Readme
@skillsregistry/dag
Portable workflow DAG schema, validation, and interpreter for SkillsRegistry.
Zero-dependency (modulo zod) primitives for declaring multi-step skill workflows as a directed acyclic graph, validating them, computing parallel execution layers via topological sort, and resolving step inputs from upstream outputs.
Install
npm install @skillsregistry/dagUsage
import {
WorkflowDAG,
validateDAG,
toExecutionLayers,
resolveInputs,
} from "@skillsregistry/dag";
const dag = WorkflowDAG.parse({
schemaVersion: "1.0",
steps: [
{ id: "fetch", skill: "@cognium/http-get", inputs: {} },
{ id: "summary", skill: "@cognium/summarize", inputs: { text: "$fetch.body" }, dependsOn: ["fetch"] },
],
});
const result = validateDAG(dag);
if (!result.valid) throw new Error(result.errors.join("\n"));
const layers = toExecutionLayers(dag); // [["fetch"], ["summary"]]Exports
| Export | Kind | Purpose |
| --- | --- | --- |
| DAG_SCHEMA_VERSION | const | Current schema version string |
| RetryPolicy, InputMapping, WorkflowStep, WorkflowDAG | Zod schemas | Runtime validation. InputMapping accepts Record<string, unknown> since 1.1.0 — nested objects, arrays, and primitives are opaque pass-throughs (resolveInputs does not recurse). |
| RetryPolicyType, InputMappingType, WorkflowStepType, WorkflowDAGType | TS types | Inferred from Zod |
| ValidationResult, ExecutionLayer | TS types | Helper return types |
| validateDAG(dag) | fn | Full structural + cycle validation |
| hasCycle(dag) | fn | Cycle check only |
| toExecutionLayers(dag) | fn | Topological sort into parallel layers |
| resolveInputs(step, ctx) | fn | Substitute $stepId.field references |
| evaluateCondition(expr, ctx) | fn | Evaluate guard expressions |
History
Originally published as @runics/dag under the OpenMason monorepo. Renamed to @skillsregistry/dag in June 2026 when Runics became SkillsRegistry. The legacy @runics/dag package is deprecated — see CHANGELOG.
License
MIT © Cognium Labs
