Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@procedures/dag

Latest version: v0.68.7

Overview

Last scanned
24 Nov 2026
Published
24 Nov 2026
npm package Publisher: mark1russell7
0 Stars
0 Forks
112 Versions
20.7K Downloads
TypeScript Repo language

Scan summary

@procedures/dag was last scanned on 24 Nov 2026 at version 0.68.7. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 112 versions; the latest 5 were published on 24 Nov 2026.
  • Findings: No rules fired in version 0.68.7.
  • Downloads: 20,667 downloads.

Versions

112 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.68.7 LATEST 24 Nov 2026 No rules fired
0.68.6 24 Nov 2026 No rules fired
0.68.5 24 Nov 2026 No rules fired
0.68.4 24 Nov 2026 Not shown
0.68.3 24 Nov 2026 Not shown

No rules fired in 0.68.7

Findings

Findings for v0.68.7. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.68.7; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

@procedures/dag

npm

npm install @procedures/dag

License: MIT TypeScript Node.js

Generic DAG (Directed Acyclic Graph) utilities for dependency ordering and parallel execution. Powers the ecosystem's build system.

The pure DAG code is in the general package @mark1russell7/collections, which has no runtime dependencies. This package re-exports it.

Table of Contents

  • Overview
  • Installation
  • Architecture
  • Quick Start
  • API Reference
    • Types
    • Functions
    • buildDAG
    • executeDAG
    • hubBreadthFirstOrder
  • Use Cases
  • Integration
    • The generated procedures
  • Requirements
  • License

Overview

client-dag provides utilities for working with Directed Acyclic Graphs:

  • DAG Building - Topological sorting using Kahn's algorithm
  • Parallel Execution - Process nodes level-by-level with configurable concurrency
  • Traversal Utilities - Find roots, leaves, dependents, and dependencies
  • Progress Tracking - Callbacks for node start/complete events

Installation

npm install @procedures/dag

Architecture

System Overview
graph TB
    subgraph "Input"
        Nodes[DAGNode Array<br/>id + dependencies]
    end

    subgraph "client-dag"
        subgraph "DAG Builder"
            Kahn[Kahn's Algorithm]
            Topo[Topological Sort]
            Level[Level Assignment]
        end

        subgraph "DAG Executor"
            Queue[Level Queue]
            Pool[Concurrency Pool]
            Process[Node Processor]
        end

        subgraph "Traversal"
            Roots[getRoots]
            Leaves[getLeaves]
            Deps[getDependents]
            Reqs[getDependencies]
        end
    end

    subgraph "Output"
        DAG[DependencyDAG<br/>nodes + levels]
        Result[DAGResult<br/>success + results]
    end

    Nodes --> Kahn
    Kahn --> Topo
    Topo --> Level
    Level --> DAG

    DAG --> Queue
    Queue --> Pool
    Pool --> Process
    Process --> Result

    DAG --> Roots
    DAG --> Leaves
    DAG --> Deps
    DAG --> Reqs
Execution Flow
sequenceDiagram
    participant App as Application
    participant DAG as client-dag
    participant Build as buildDAG
    participant Exec as executeDAG
    participant Proc as NodeProcessor

    App->>Build: buildDAG(nodes)
    Build->>Build: Kahn's algorithm
    Build->>Build: Assign levels
    Build-->>App: DependencyDAG

    App->>Exec: executeDAG(dag, processor, options)

    loop For each level
        Exec->>Exec: Get nodes at level
        par Parallel execution (concurrency)
            Exec->>Proc: process(node1)
            Proc-->>Exec: NodeResult
            Exec->>Proc: process(node2)
            Proc-->>Exec: NodeResult
        end
        Exec->>Exec: Check failFast
    end

    Exec-->>App: DAGResult
Topological Sorting (Kahn's Algorithm)
graph LR
    subgraph "Input Graph"
        A1[A depends on B,C]
        B1[B depends on D]
        C1[C depends on D]
        D1[D no deps]
    end

    subgraph "Processing"
        K[Kahn's Algorithm]
    end

    subgraph "Output Levels"
        L0[Level 0: D]
        L1[Level 1: B, C]
        L2[Level 2: A]
    end

    A1 --> K
    B1 --> K
    C1 --> K
    D1 --> K
    K --> L0
    K --> L1
    K --> L2
DAG Structure Visualization
graph TB
    subgraph "Level 2 (Roots)"
        App[app]
    end

    subgraph "Level 1"
        LibA[lib-a]
        LibB[lib-b]
        LibC[lib-c]
    end

    subgraph "Level 0 (Leaves)"
        Core[core]
    end

    App --> LibA
    App --> LibB
    App --> LibC
    LibA --> Core
    LibB --> Core
    LibC --> Core

    style App fill:#f9f,stroke:#333
    style Core fill:#9f9,stroke:#333

Quick Start

import {
  buildDAG,
  executeDAG,
  type DAGNode,
  type NodeProcessor,
} from "@procedures/dag";

// Define nodes
const nodes: DAGNode[] = [
  { id: "app", dependencies: ["lib-a", "lib-b"] },
  { id: "lib-a", dependencies: ["core"] },
  { id: "lib-b", dependencies: ["core"] },
  { id: "core", dependencies: [] },
];

// Build the DAG
const dag = buildDAG(nodes);
// Levels: [["core"], ["lib-a", "lib-b"], ["app"]]

// Define a processor
const processor: NodeProcessor = async (node) => {
  console.log(`Processing ${node.id}`);
  // Do work...
  return {
    node,
    success: true,
    duration: 100,
    logs: [`Built ${node.id}`],
  };
};

// Execute with parallel processing per level
const result = await executeDAG(dag, processor, {
  concurrency: 4,
  failFast: true,
  onNodeStart: (node) => console.log(`Starting: ${node.id}`),
  onNodeComplete: (result) => console.log(`Done: ${result.node.id}`),
});

API Reference

Types
interface DAGNode<TData = unknown> {
  id: string;                    // Unique identifier
  dependencies: string[];        // IDs of dependencies
  level?: number;                // Topological level (computed)
  data?: TData;                  // Optional user data
}

interface DependencyDAG<TNode extends DAGNode = DAGNode> {
  nodes: Map<string, TNode>;     // All nodes
  levels: TNode[][];             // Nodes by level
  roots: string[];               // No dependents (end nodes)
  leaves: string[];              // No dependencies (start nodes)
}

interface DAGExecutionOptions<TNode extends DAGNode = DAGNode> {
  concurrency?: number;          // Max parallel per level (default: 4)
  failFast?: boolean;            // Stop on first error (default: true)
  onNodeStart?: (node: TNode) => void;
  onNodeComplete?: (result: NodeResult<TNode>) => void;
}

interface NodeResult<TNode extends DAGNode = DAGNode> {
  node: TNode;
  success: boolean;
  error?: Error;
  duration: number;              // ms
  logs: string[];
  output?: unknown;
}

interface DAGResult<TNode extends DAGNode = DAGNode> {
  success: boolean;
  results: Map<string, NodeResult<TNode>>;
  failedNodes: string[];
  totalDuration: number;
}

type NodeProcessor<TNode extends DAGNode = DAGNode> = (
  node: TNode
) => Promise<NodeResult<TNode>>;
Functions
Function Description
buildDAG(nodes) Build a DAG from nodes with dependencies
executeDAG(dag, processor, options) Execute DAG with parallel processing
getRoots(dag) Get nodes with no dependents
getLeaves(dag) Get nodes with no dependencies
getDependents(dag, id) Get nodes that depend on this node
getDependencies(dag, id) Get this node's dependencies

buildDAG

Build a leveled DAG using Kahn's algorithm.

import { buildDAG } from "@procedures/dag";

const nodes = [
  { id: "a", dependencies: ["b", "c"] },
  { id: "b", dependencies: ["d"] },
  { id: "c", dependencies: ["d"] },
  { id: "d", dependencies: [] },
];

const dag = buildDAG(nodes);
// dag.levels = [
//   [{ id: "d", ... }],      // Level 0: process first
//   [{ id: "b" }, { id: "c" }], // Level 1: parallel
//   [{ id: "a", ... }],      // Level 2: process last
// ]

Cycle Detection:

// Throws if cycles detected
const cyclic = [
  { id: "a", dependencies: ["b"] },
  { id: "b", dependencies: ["a"] }, // Cycle!
];
buildDAG(cyclic); // Error: Cycle detected

executeDAG

Execute nodes level by level with configurable parallelism.

import { executeDAG } from "@procedures/dag";

const result = await executeDAG(dag, processor, {
  concurrency: 4,        // Process up to 4 nodes in parallel per level
  failFast: true,        // Stop immediately on first failure
  onNodeStart: (node) => console.log(`Starting: ${node.id}`),
  onNodeComplete: (r) => console.log(`${r.node.id}: ${r.success ? "OK" : "FAIL"}`),
});

if (result.success) {
  console.log("All nodes processed successfully");
} else {
  console.log("Failed nodes:", result.failedNodes);
}

Execution Order:

graph LR
    subgraph "Level 0"
        D[core]
    end

    subgraph "Level 1 (parallel)"
        B[lib-a]
        C[lib-b]
    end

    subgraph "Level 2"
        A[app]
    end

    D -->|then| B
    D -->|then| C
    B -->|then| A
    C -->|then| A

hubBreadthFirstOrder

The entry @procedures/dag/graph holds pure graph functions. It imports no other package.

import { hubBreadthFirstOrder } from "@procedures/dag/graph";

const sizes = [4, 9, 1];
const order = hubBreadthFirstOrder(3, [{ a: 0, b: 1, weight: 2 }, { a: 1, b: 2 }], (i, j) => sizes[j]! - sizes[i]!);
// order: [1, 0, 2]

The function reads an undirected weighted graph with the nodes 0 to n - 1. It starts at the node with the largest sum of edge weights, and goes breadth-first. The comparator, then the lower index, breaks each tie. Each next component starts at its own hub.

Use Cases

Package Build Order

Build packages in dependency order (the procedure dag.traverse of this package does this):

const packages = [
  { id: "app", dependencies: ["@org/lib-ui", "@org/lib-core"] },
  { id: "@org/lib-ui", dependencies: ["@org/lib-core"] },
  { id: "@org/lib-core", dependencies: [] },
];

const dag = buildDAG(packages);
await executeDAG(dag, async (pkg) => {
  await runBuild(pkg.id);
  return { node: pkg, success: true, duration: 0, logs: [] };
});
Task Scheduling

Execute dependent tasks:

const tasks = [
  { id: "deploy", dependencies: ["test", "build"] },
  { id: "test", dependencies: ["build"] },
  { id: "build", dependencies: [] },
];

const dag = buildDAG(tasks);
await executeDAG(dag, async (task) => {
  await runTask(task.id);
  return { node: task, success: true, duration: 0, logs: [] };
});
Module Loading

Load modules respecting dependencies:

const modules = [
  { id: "app", dependencies: ["router", "store"] },
  { id: "router", dependencies: ["utils"] },
  { id: "store", dependencies: ["utils"] },
  { id: "utils", dependencies: [] },
];

const dag = buildDAG(modules);
await executeDAG(dag, async (mod) => {
  await import(mod.id);
  return { node: mod, success: true, duration: 0, logs: [] };
});

Integration

The procedure dag.traverse

The hand-written procedure dag.traverse came from client-lib in version 0.4.0, and its name stays the same. The graph algorithms of the package root do not need it.

dag.traverse starts the visit procedure once for each package, with cwd set to the folder of the package. A package starts after the packages that it depends on.

Field Default Function
visit A procedure path, or a call with $when: "$parent" (or $never)
filter Only these package names
root Only this package and the packages that it depends on
rootPath the workspace The workspace root
concurrency 4 The number of visits at the same time
serialize auto When the visits in one git repository start one at a time: auto (when the visit uses a git procedure), repository (always) or none
continueOnError false Continue after a failed visit, without the dependents of the failed package
dryRun false Give the plan only

All packages of the monorepo are in one git repository. Concurrent git add commands fail on index.lock, so auto starts git visits one at a time (deep dive DATA-17).

The output has one result for each package of the graph. A failed visit stops the traversal after its level when continueOnError is false. Each package that the traversal did not visit then has a result with skipped: true, success: false and a reason.

With continueOnError, the visit of a package whose dependency failed or was skipped does not start. Its result has skipped: true and a reason with the error of the dependency. These results come after the results of the visits. visited counts the visits that succeeded, failed counts the visits that failed, and skipped counts the packages without a visit.

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/lib/register"; // lib.scan, and the fs and git procedures that it uses
import "@procedures/dag/register"; // dag.traverse

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));

await client.exec(["dag", "traverse"], {
  visit: { $proc: ["pnpm", "run"], input: { script: "build" }, $when: "$parent" },
  root: "@procedures/fs",
});
  • dag.traverse gets the packages from lib.scan of @procedures/lib, through ctx.client. Its metadata declares the call (calls: ["lib.scan"]).
  • @procedures/lib depends on this package. Thus this package does not import @procedures/lib, and the module of this package does not list the module of @procedures/lib as a dependency. A host registers the two modules. bundle-dev, bundle-mcp and mark do.
  • dag.traverse has the tag runs-refs: it starts the refs of its input. Thus a server with an expose rule lets it use only exposed procedures, lib.scan too.
  • A call in visit with $when: "dag.traverse" waits for this runner (PROGRAM-FORMAT.md, section 5).
  • bundle-mcp registers the procedure, but dag is not a tool namespace of the MCP server.
graph TB
    subgraph "client-dag"
        Traverse[dag.traverse<br/>Visit in dependency order]
        Build[buildLeveledDAG]
        Execute[executeDAG]
    end

    subgraph "client-lib"
        Scan[lib.scan<br/>Find the packages]
    end

    subgraph "Packages"
        P1[Package A]
        P2[Package B]
        P3[Package C]
    end

    Traverse -->|ctx.client| Scan
    Traverse --> Build
    Build --> Execute
    Execute --> P1
    Execute --> P2
    Execute --> P3
The generated procedures

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @procedures/dag

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Vulnerability Insights

OpenSSH Password Authentication Bypass on Alpine Linux (*sshole) – CVE-2026-123158

PolinRider Returns
Research

PolinRider Returns: Hijacked npm Packages Use Ethereum Blockchain to Conceal Malware Infrastructure

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

Frame 2085668439 (1)
Group 1261154229