UNPKG

@autobe/agent

Version:

AI backend server code generator

28 lines (27 loc) 1.32 kB
import { AutoBeOpenApi } from "@autobe/interface"; import { AutoBeContext } from "../../context/AutoBeContext"; /** * Detect and resolve cross-type circular references in schemas. * * Uses a while loop with parallel processing per round: * * - Each round: detect remaining cycles → process ALL in parallel (one LLM call * per cycle) → re-detect → repeat until no cycles remain. * * WHY parallel within a round: Tarjan's SCCs are mathematically disjoint. Two * detected SCCs share no nodes, so fixing SCC-A never creates or destroys edges * in SCC-B. Parallel execution is safe. * * WHY while loop across rounds: a large SCC (3+ nodes with multiple independent * internal cycles) may not be fully resolved in one pass — validate only * requires "at least one edge removed" per SCC. After that partial fix, the SCC * may split into smaller cycles that re-detect in the next round. Convergence * is guaranteed: each round removes ≥1 edge, so the total cycle-edge count * decreases monotonically to zero. * * Mutates `props.schemas` in-place. Dispatches one event per cycle. */ export declare const orchestrateInterfaceSchemaDecouple: (ctx: AutoBeContext, props: { schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>; operations: AutoBeOpenApi.IOperation[]; }) => Promise<void>;