/** * Generic topological sort using Kahn's algorithm. * * Orders items so that dependencies come before dependents. * Works with any item type that has `id` and optional `depends_on`. * * @module */ /** * Minimum shape required for topological sorting. */ export interface Sortable { id: string; depends_on?: Array; } /** * Result of topological sort. */ export type TopologicalSortResult = { ok: true; sorted: Array; } | { ok: false; error: string; cycle?: Array; }; /** * Sort items by their dependencies using Kahn's algorithm. * * Returns items ordered so that dependencies come before dependents. * If a cycle is detected, returns an error with the cycle path. * * @param items - array of items to sort * @param label - label for error messages (e.g. "resource", "step") * @returns sorted items or error if cycle detected */ export declare const topological_sort: (items: Array, label?: string) => TopologicalSortResult; //# sourceMappingURL=sort.d.ts.map