/** * Requires-graph extraction and cycle detection. * * Extracts cross-asset dependency edges from typed manifest fields: * - agent: skills[], composes[].ref, extends * - flow: nodes[].run.assets, with legacy data.skill / data.flow fallbacks * - preset: items[].ref, items[].composes[].ref * - skill: metadata.artifacts.requires[].id * * Cycle detection uses Kahn's algorithm (topological sort). */ /** * A directed dependency edge from one asset ref to another, annotated with the manifest * field that declared the dependency. * * @docLink packages/discovery/concepts#requires-edge */ export interface RequiresEdge { /** Asset ref of the requiring asset. */ from: string; /** Asset ref of the required asset. */ to: string; /** Manifest field that produced this edge. */ field: string; } /** * The complete requires graph for a discovered asset tree: all dependency edges plus * the result of cycle detection. * * @docLink packages/discovery/concepts#requires-graph */ export interface RequiresGraph { edges: RequiresEdge[]; /** True if the graph contains no cycles. */ acyclic: boolean; /** If cycles exist, one example cycle path. */ cyclePath?: string[]; } /** * Extract requires edges from a single asset's manifest. * * @param assetRef - The canonical ref of the asset being examined (the `from` side) * @param kind - Asset kind, used to select the correct manifest field extractor * @param manifest - Parsed manifest object * @returns Array of {@link RequiresEdge} declared by this asset * @docLink packages/discovery/concepts#extract-requires */ export declare function extractRequires(assetRef: string, kind: string, manifest: Record): RequiresEdge[]; /** * Build a complete {@link RequiresGraph} from multiple assets' edges by running cycle detection. * * @param allEdges - All {@link RequiresEdge} values collected across all assets in the tree * @returns A {@link RequiresGraph} with `acyclic` status and optional `cyclePath` * @docLink packages/discovery/concepts#build-requires-graph */ export declare function buildRequiresGraph(allEdges: RequiresEdge[]): RequiresGraph; /** * Detect cycles in a set of requires edges using Kahn's topological sort algorithm. * * If a cycle is found, DFS is used to recover one example cycle path for diagnostics. * * @param edges - Directed dependency edges to analyse * @returns `{ acyclic: true }` if the graph is a DAG, or `{ acyclic: false, cyclePath }` otherwise * @docLink packages/discovery/concepts#detect-cycles */ export declare function detectCycles(edges: RequiresEdge[]): { acyclic: boolean; cyclePath?: string[]; }; //# sourceMappingURL=requires-graph.d.ts.map