@autobe/agent
Version:
AI backend server code generator
28 lines (27 loc) • 1.14 kB
TypeScript
import { IValidation } from "typia";
/**
* Validates that AI-generated code contains the expected function name.
*
* Detects two common AI failure modes: (1) returning empty code snippets
* instead of actual implementations, and (2) hallucinating different function
* names than requested. By checking function name presence early, this prevents
* wasting compiler resources on obviously broken code and provides clearer
* error messages to the correction orchestrator.
*
* Used extensively in Test and Realize phases where AI generates test functions
* and API operation implementations. Without this validation, empty or misnamed
* functions would pass to TypeScript compiler, generating confusing "not found"
* errors instead of actionable "you forgot to write the function" feedback.
*
* @param props Function name to validate and code strings to check
* @returns Array of validation errors (empty if valid)
*/
export declare const validateEmptyCode: (props: {
path: string;
asynchronous: boolean;
name: string;
draft: string;
revise: {
final: string | null;
};
}) => IValidation.IError[];