@autobe/agent
Version:
AI backend server code generator
53 lines (52 loc) • 2.25 kB
TypeScript
import { AutoBeInterfaceSchemaDecoupleCycle, AutoBeInterfaceSchemaDecoupleRemoval, AutoBeOpenApi } from "@autobe/interface";
import { ILlmApplication, IValidation } from "typia";
export declare namespace AutoBeInterfaceSchemaDecoupleProgrammer {
/**
* Detect cross-type circular references in the schema graph.
*
* Builds a directed graph of `$ref` relationships between types, then finds
* strongly connected components (SCCs) using Tarjan's algorithm.
* Self-references (A → A) are excluded — they represent legitimate tree
* structures.
*/
const detectCycles: (schemas: Record<string, AutoBeOpenApi.IJsonSchema>) => AutoBeInterfaceSchemaDecoupleCycle[];
/**
* Fix LLM application schema by injecting valid edge pairs into the removal
* object's description.
*
* Listing valid `typeName.propertyName` pairs on the removal object guides
* the LLM to choose a correct cycle edge without the independent- enum
* problem (where `typeName` and `propertyName` enums are checked separately,
* allowing invalid cross-combinations).
*/
const fixApplication: (props: {
application: ILlmApplication;
cycle: AutoBeInterfaceSchemaDecoupleCycle;
}) => void;
/**
* Execute one property removal and apply inline documentation updates.
*
* Step 1: Delete the named property from its schema. Step 2: Apply
* description/specification updates from the removal if provided (non-null
* fields on the removal object itself).
*/
const execute: (props: {
schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
removal: AutoBeInterfaceSchemaDecoupleRemoval;
}) => void;
/**
* Validate that the LLM's removal decision is correct.
*
* Checks:
*
* 1. The removal references a valid typeName + propertyName
* 2. The removal corresponds to an actual edge in this cycle
*/
const validate: (props: {
schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
cycle: AutoBeInterfaceSchemaDecoupleCycle;
removal: AutoBeInterfaceSchemaDecoupleRemoval;
errors: IValidation.IError[];
path: string;
}) => void;
}