"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createAutoBeController = void 0;
const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
const utils_1 = require("@autobe/utils");
const typia_1 = __importDefault(require("typia"));
const assertSchemaModel_1 = require("../context/assertSchemaModel");
const orchestrateAnalyze_1 = require("../orchestrate/analyze/orchestrateAnalyze");
const orchestrateInterface_1 = require("../orchestrate/interface/orchestrateInterface");
const orchestratePrisma_1 = require("../orchestrate/prisma/orchestratePrisma");
const orchestrateRealize_1 = require("../orchestrate/realize/orchestrateRealize");
const orchestrateTest_1 = require("../orchestrate/test/orchestrateTest");
const createAutoBeController = (props) => {
    (0, assertSchemaModel_1.assertSchemaModel)(props.model);
    const application = collection[props.model];
    return {
        protocol: "class",
        name: "autobe",
        application,
        execute: {
            analyze: (next) => __awaiter(void 0, void 0, void 0, function* () {
                const r = yield (0, orchestrateAnalyze_1.orchestrateAnalyze)(props.context)(next);
                if (r.type === "analyze")
                    return {
                        type: "success",
                        description: "Analysis completed successfully, and report has been published.",
                    };
                else
                    return {
                        type: "in-progress",
                        description: utils_1.StringUtil.trim `
              Requirements are not yet fully elicited, 
              therefore additional questions will be made to the user.
            `,
                    };
            }),
            prisma: (next) => __awaiter(void 0, void 0, void 0, function* () {
                const r = yield (0, orchestratePrisma_1.orchestratePrisma)(props.context, next);
                if (r.type === "prisma")
                    return {
                        type: r.compiled.type,
                        description: r.compiled.type === "success"
                            ? "Prisma schemas have been generated successfully."
                            : r.result.success === false || r.compiled.type === "failure"
                                ? "Prisma schemas are generated, but compilation failed."
                                : "Unexpected error occurred while generating Prisma schemas.",
                    };
                else
                    return {
                        type: "prerequisites-not-satisfied",
                        description: "Requirement analysis is not yet completed.",
                    };
            }),
            interface: (next) => __awaiter(void 0, void 0, void 0, function* () {
                const r = yield (0, orchestrateInterface_1.orchestrateInterface)(props.context)(next);
                if (r.type === "interface")
                    return {
                        type: "success",
                        description: "API interfaces have been designed successfully.",
                    };
                else
                    return {
                        type: "prerequisites-not-satisfied",
                        description: "Prisma schemas are not yet completed.",
                    };
            }),
            test: (next) => __awaiter(void 0, void 0, void 0, function* () {
                const r = yield (0, orchestrateTest_1.orchestrateTest)(props.context)(next);
                if (r.type === "test")
                    return {
                        type: r.compiled.type,
                        description: r.compiled.type === "success"
                            ? "Test functions have been generated successfully."
                            : r.compiled.type === "failure"
                                ? "Test functions are written, but compilation failed."
                                : "Unexpected error occurred while writing test functions.",
                    };
                else
                    return {
                        type: "prerequisites-not-satisfied",
                        description: "API interfaces are not yet completed.",
                    };
            }),
            realize: (next) => __awaiter(void 0, void 0, void 0, function* () {
                const r = yield (0, orchestrateRealize_1.orchestrateRealize)(props.context)(next);
                if (r.type === "realize")
                    return {
                        type: r.compiled.type,
                        description: r.compiled.type === "success"
                            ? "API implementation codes have been generated successfully."
                            : r.compiled.type === "failure"
                                ? "Implementation codes are composed, but compilation failed."
                                : "Unexpected error occurred while writing implementation codes.",
                    };
                else
                    return {
                        type: "prerequisites-not-satisfied",
                        description: "API interfaces are not yet completed.",
                    };
            }),
        },
    };
};
exports.createAutoBeController = createAutoBeController;
const claude = {
    model: "claude",
    options: {
        reference: true,
        separate: null
    },
    functions: [
        {
            name: "analyze",
            parameters: {
                type: "object",
                properties: {
                    instruction: {
                        description: "Requirements-focused instructions extracted from user utterances.\n\nContains AI-interpreted guidance specifically for the requirements\nanalysis phase. Should focus ONLY on features, business rules, user\nstories, and functional specifications. Must NOT include database design,\nAPI patterns, or implementation details which belong to other phases.\n\n**CRITICAL**: Only include what the user actually said. NEVER fabricate\nor invent requirements the user didn't mention.\n\nExamples:\n\n- \"Focus on inventory management with real-time stock tracking\"\n- \"Prioritize user authentication with role-based permissions\"\n- \"Emphasize order processing workflow with approval stages\"",
                        type: "string"
                    }
                },
                required: [
                    "instruction"
                ],
                additionalProperties: false,
                $defs: {
                    IAutoBeApplicationResult: {
                        type: "object",
                        properties: {
                            type: {
                                oneOf: [
                                    {
                                        "const": "success"
                                    },
                                    {
                                        "const": "failure"
                                    },
                                    {
                                        "const": "exception"
                                    },
                                    {
                                        "const": "in-progress"
                                    },
                                    {
                                        "const": "prerequisites-not-satisfied"
                                    }
                                ]
                            },
                            description: {
                                type: "string"
                            }
                        },
                        required: [
                            "type",
                            "description"
                        ]
                    }
                }
            },
            output: {
                $ref: "#/$defs/IAutoBeApplicationResult"
            },
            description: "Run Analyze Agent.\n\nExecutes the Analyze agent to process user requirements and generate a\nstructured specification document. This agent analyzes all conversation\nhistory between users and AI, separates business logic from technical\nrequirements, and establishes development priorities and scope.\n\n**IMPORTANT**: Only call this function when sufficient requirements have\nbeen discussed to generate a comprehensive specification. The context must\ncontain enough detail about the system's purpose, core features, data\nmodels, and business rules. If requirements are unclear or incomplete,\ncontinue gathering information through conversation instead.\n\nThe agent will automatically generate follow-up questions for any ambiguous\nrequirements and continuously refine its understanding through iterative\nconversation. When executed after other agents have generated code, it can\nalso interpret change requests in the context of existing implementations.",
            validate: (() => { const _io0 = input => "string" === typeof input.instruction; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.instruction || _report(_exceptionable, {
                    path: _path + ".instruction",
                    expected: "string",
                    value: input.instruction
                })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
                if (false === __is(input)) {
                    errors = [];
                    _report = __typia_transform__validateReport._validateReport(errors);
                    ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
                        path: _path + "",
                        expected: "__type",
                        value: input
                    })) && _vo0(input, _path + "", true) || _report(true, {
                        path: _path + "",
                        expected: "__type",
                        value: input
                    }))(input, "$input", true);
                    const success = 0 === errors.length;
                    return success ? {
                        success,
                        data: input
                    } : {
                        success,
                        errors,
                        data: input
                    };
                }
                return {
                    success: true,
                    data: input
                };
            }; })()
        },
        {
            name: "prisma",
            parameters: {
                type: "object",
                properties: {
                    instruction: {
                        description: "Database design instructions extracted from user utterances.\n\nContains AI-interpreted guidance specifically for the database schema\ndesign phase. Should focus ONLY on schema structure, relationships,\nconstraints, and indexing strategies. Must NOT include API design or\nbusiness logic implementation details.\n\n**CRITICAL**: Only include what the user actually said. NEVER fabricate\nor invent requirements the user didn't mention.\n\nExamples:\n\n- \"Design flexible product catalog with variant support\"\n- \"Optimize for high-volume transaction queries\"\n- \"Implement strict referential integrity for financial data\"",
                        type: "string"
                    }
                },
                required: [
                    "instruction"
                ],
                additionalProperties: false,
                $defs: {
                    IAutoBeApplicationResult: {
                        type: "object",
                        properties: {
                            type: {
                                oneOf: [
                                    {
                                        "const": "success"
                                    },
                                    {
                                        "const": "failure"
                                    },
                                    {
                                        "const": "exception"
                                    },
                                    {
                                        "const": "in-progress"
                                    },
                                    {
                                        "const": "prerequisites-not-satisfied"
                                    }
                                ]
                            },
                            description: {
                                type: "string"
                            }
                        },
                        required: [
                            "type",
                            "description"
                        ]
                    }
                }
            },
            output: {
                $ref: "#/$defs/IAutoBeApplicationResult"
            },
            description: "Run prisma agent.\n\nExecutes the Prisma agent to generate database schema files and ERD\ndocumentation. This agent reads the requirements specification created by\nthe {@link analyze Analyze agent} and produces a complete Prisma schema with\ncomprehensive documentation for each entity and attribute.\n\n**PREREQUISITE**: Only call this function after the {@link analyze} function\nhas been successfully executed and a requirements specification document\nhas been generated. The Prisma agent depends on the structured requirements\nanalysis to design the database schema properly. Without a completed\nrequirements specification, this function should NOT be called.\n\nThe agent will automatically validate the generated schema using the Prisma\ncompiler, self-correct any compilation errors through feedback loops, and\ngenerate ERD documentation using prisma-markdown. An internal review\nprocess ensures schema quality and optimization.",
            validate: (() => { const _io0 = input => "string" === typeof input.instruction; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.instruction || _report(_exceptionable, {
                    path: _path + ".instruction",
                    expected: "string",
                    value: input.instruction
                })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
                if (false === __is(input)) {
                    errors = [];
                    _report = __typia_transform__validateReport._validateReport(errors);
                    ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
                        path: _path + "",
                        expected: "__type",
                        value: input
                    })) && _vo0(input, _path + "", true) || _report(true, {
                        path: _path + "",
                        expected: "__type",
                        value: input
                    }))(input, "$input", true);
                    const success = 0 === errors.length;
                    return success ? {
                        success,
                        data: input
                    } : {
                        success,
                        errors,
                        data: input
                    };
                }
                return {
                    success: true,
                    data: input
                };
            }; })()
        },
        {
            name: "interface",
            parameters: {
                type: "object",
                properties: {
                    instruction: {
                        description: "API design instructions extracted from user utterances.\n\nContains AI-interpreted guidance specifically for the API interface\ndesign phase. Should focus ONLY on endpoint patterns, request/response\nformats, DTO schemas, and operation specifications. Must NOT include\ndatabase details or implementation logic.\n\n**CRITICAL**: Only include what the user actually said. NEVER fabricate\nor invent requirements the user didn't mention.\n\nExamples:\n\n- \"Create RESTful endpoints with pagination for all list operations\"\n- \"Design mobile-friendly APIs with minimal response payloads\"\n- \"Follow OpenAPI 3.0 patterns with comprehensive error responses\"",
                        type: "string"
                    }
                },
                required: [
                    "instruction"
                ],
                additionalProperties: false,
                $defs: {
                    IAutoBeApplicationResult: {
                        type: "object",
                        properties: {
                            type: {
                                oneOf: [
                                    {
                                        "const": "success"
                                    },
                                    {
                                        "const": "failure"
                                    },
                                    {
                                        "const": "exception"
                                    },
                                    {
                                        "const": "in-progress"
                                    },
                                    {
                                        "const": "prerequisites-not-satisfied"
                                    }
                                ]
                            },
                            description: {
                                type: "string"
                            }
                        },
                        required: [
                            "type",
                            "description"
                        ]
                    }
                }
            },
            output: {
                $ref: "#/$defs/IAutoBeApplicationResult"
            },
            description: "Run interface agent.\n\nExecutes the Interface agent to design and generate API interfaces. This\nagent creates OpenAPI schemas and TypeScript/NestJS code based on the\nrequirements specification and ERD documentation from previous agents.\n\nThe agent follows a sophisticated pipeline: first constructing formal\nOpenAPI Operation Schemas and JSON Schemas, then validating these schemas,\nand finally transforming them into NestJS controllers and DTOs. Each\ngenerated interface includes comprehensive JSDoc comments and undergoes\ninternal review for consistency.",
            validate: (() => { const _io0 = input => "string" === typeof input.instruction; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.instruction || _report(_exceptionable, {
                    path: _path + ".instruction",
                    expected: "string",
                    value: input.instruction
                })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
                if (false === __is(input)) {
                    errors = [];
                    _report = __typia_transform__validateReport._validateReport(errors);
                    ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
                        path: _path + "",
                        expected: "__type",
                        value: input
                    })) && _vo0(input, _path + "", true) || _report(true, {
                        path: _path + "",
                        expected: "__type",
                        value: input
                    }))(input, "$input", true);
                    const success = 0 === errors.length;
                    return success ? {
                        success,
                        data: input
                    } : {
                        success,
                        errors,
                        data: input
                    };
                }
                return {
                    success: true,
                    data: input
                };
            }; })()
        },
        {
            name: "test",
            parameters: {
                type: "object",
                properties: {
                    instruction: {
                        description: "Testing strategy instructions extracted from user utterances.\n\nContains AI-interpreted guidance specifically for the test code\ngeneration phase. Should focus ONLY on test scenarios, coverage\npriorities, edge cases, and validation strategies. Must NOT include\nimplementation or API design details.\n\n**CRITICAL**: Only include what the user actually said. NEVER fabricate\nor invent requirements the user didn't mention.\n\nExamples:\n\n- \"Prioritize payment flow testing with failure scenarios\"\n- \"Generate comprehensive tests for concurrent user operations\"\n- \"Focus on data integrity validation across all endpoints\"",
                        type: "string"
                    }
                },
                required: [
                    "instruction"
                ],
                additionalProperties: false,
                $defs: {
                    IAutoBeApplicationResult: {
                        type: "object",
                        properties: {
                            type: {
                                oneOf: [
                                    {
                                        "const": "success"
                                    },
                                    {
                                        "const": "failure"
                                    },
                                    {
                                        "const": "exception"
                                    },
                                    {
                                        "const": "in-progress"
                                    },
                                    {
                                        "const": "prerequisites-not-satisfied"
                                    }
                                ]
                            },
                            description: {
                                type: "string"
                            }
                        },
                        required: [
                            "type",
                            "description"
                        ]
                    }
                }
            },
            output: {
                $ref: "#/$defs/IAutoBeApplicationResult"
            },
            description: "Run test program agent.\n\nExecutes the Test agent to generate comprehensive E2E test suites for all\n{@link interface API interfaces}. This agent synthesizes outputs from\nprevious agents to create tests that validate both individual endpoints and\ntheir interactions.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Test agent requires the completed API interface definitions,\nOpenAPI schemas, and TypeScript code to generate appropriate test\nscenarios. Without completed interface design, this function should NOT be\ncalled.\n\nThe agent will analyze dependency relationships between API functions,\nstructure integrated test scenarios with correct execution sequences, and\nenhance pre-generated test scaffolds with business logic validation.\nTypeScript compiler validation and internal review ensure test quality and\noptimal coverage.",
            validate: (() => { const _io0 = input => "string" === typeof input.instruction; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.instruction || _report(_exceptionable, {
                    path: _path + ".instruction",
                    expected: "string",
                    value: input.instruction
                })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
                if (false === __is(input)) {
                    errors = [];
                    _report = __typia_transform__validateReport._validateReport(errors);
                    ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
                        path: _path + "",
                        expected: "__type",
                        value: input
                    })) && _vo0(input, _path + "", true) || _report(true, {
                        path: _path + "",
                        expected: "__type",
                        value: input
                    }))(input, "$input", true);
                    const success = 0 === errors.length;
                    return success ? {
                        success,
                        data: input
                    } : {
                        success,
                        errors,
                        data: input
                    };
                }
                return {
                    success: true,
                    data: input
                };
            }; })()
        },
        {
            name: "realize",
            parameters: {
                type: "object",
                properties: {
                    instruction: {
                        description: "Implementation instructions extracted from user utterances.\n\nContains AI-interpreted guidance specifically for the business logic\nimplementation phase. Should focus ONLY on architectural patterns,\nperformance requirements, business logic details, and service layer\ndecisions. Must NOT include database schema or API interface\nspecifications.\n\n**CRITICAL**: Only include what the user actually said. NEVER fabricate\nor invent requirements the user didn't mention.\n\nExamples:\n\n- \"Implement with caching for frequently accessed data\"\n- \"Use transaction patterns for financial operations\"\n- \"Optimize for 10K concurrent users with rate limiting\"",
                        type: "string"
                    }
                },
                required: [
                    "instruction"
                ],
                additionalProperties: false,
                $defs: {
                    IAutoBeApplicationResult: {
                        type: "object",
                        properties: {
                            type: {
                                oneOf: [
                                    {
                                        "const": "success"
                                    },
                                    {
                                        "const": "failure"
                                    },
                                    {
                                        "const": "exception"
                                    },
                                    {
                                        "const": "in-progress"
                                    },
                                    {
                                        "const": "prerequisites-not-satisfied"
                                    }
                                ]
                            },
                            description: {
                                type: "string"
                            }
                        },
                        required: [
                            "type",
                            "description"
                        ]
                    }
                }
            },
            output: {
                $ref: "#/$defs/IAutoBeApplicationResult"
            },
            description: "Run realize agent.\n\nExecutes the Realize agent to implement the actual business logic for each\nAPI endpoint. This agent synthesizes all outputs from previous agents to\ngenerate fully functional service provider code.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Realize agent requires the completed API interface\ndefinitions to implement the corresponding service logic. It also benefits\nfrom having test code available for validation. Without completed interface\ndesign, this function should NOT be called.\n\nThe agent will create service implementations with multiple validation\nlayers: TypeScript compiler feedback, runtime validation through test\nexecution, and quality optimization through internal review. The generated\ncode handles database interactions through Prisma, implements security and\nvalidation checks, and processes business rules according to\nspecifications.",
            validate: (() => { const _io0 = input => "string" === typeof input.instruction; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.instruction || _report(_exceptionable, {
                    path: _path + ".instruction",
                    expected: "string",
                    value: input.instruction
                })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
                if (false === __is(input)) {
                    errors = [];
                    _report = __typia_transform__validateReport._validateReport(errors);
                    ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
                        path: _path + "",
                        expected: "__type",
                        value: input
                    })) && _vo0(input, _path + "", true) || _report(true, {
                        path: _path + "",
                        expected: "__type",
                        value: input
                    }))(input, "$input", true);
                    const success = 0 === errors.length;
                    return success ? {
                        success,
                        data: input
                    } : {
                        success,
                        errors,
                        data: input
                    };
                }
                return {
                    success: true,
                    data: input
                };
            }; })()
        }
    ]
};
const collection = {
    chatgpt: {
        model: "chatgpt",
        options: {
            reference: true,
            strict: false,
            separate: null
        },
        functions: [
            {
                name: "analyze",
                parameters: {
                    type: "object",
                    properties: {
                        instruction: {
                            description: "Requirements-focused instructions extracted from user utterances.\n\nContains AI-interpreted guidance specifically for the requirements\nanalysis phase. Should focus ONLY on features, business rules, user\nstories, and functional specifications. Must NOT include database design,\nAPI patterns, or implementation details which belong to other phases.\n\n**CRITICAL**: Only include what the user actually said. NEVER fabricate\nor invent requirements the user didn't mention.\n\nExamples:\n\n- \"Focus on inventory management with real-time stock tracking\"\n- \"Prioritize user authentication with role-based permissions\"\n- \"Emphasize order processing workflow with approval stages\"",
                            type: "string"
                        }
                    },
                    required: [
                        "instruction"
                    ],
                    additionalProperties: false,
                    $defs: {
                        IAutoBeApplicationResult: {
                            type: "object",
                            properties: {
                                type: {
                                    type: "string",
                                    "enum": [
                                        "success",
                                        "failure",
                                        "exception",
                                        "in-progress",
                                        "prerequisites-not-satisfied"
                                    ]
                                },
                                description: {
                                    type: "string"
                                }
                            },
                            required: [
                                "type",
                                "description"
                            ]
                        }
                    }
                },
                output: {
                    $ref: "#/$defs/IAutoBeApplicationResult"
                },
                description: "Run Analyze Agent.\n\nExecutes the Analyze agent to process user requirements and generate a\nstructured specification document. This agent analyzes all conversation\nhistory between users and AI, separates business logic from technical\nrequirements, and establishes development priorities and scope.\n\n**IMPORTANT**: Only call this function when sufficient requirements have\nbeen discussed to generate a comprehensive specification. The context must\ncontain enough detail about the system's purpose, core features, data\nmodels, and business rules. If requirements are unclear or incomplete,\ncontinue gathering information through conversation instead.\n\nThe agent will automatically generate follow-up questions for any ambiguous\nrequirements and continuously refine its understanding through iterative\nconversation. When executed after other agents have generated code, it can\nalso interpret change requests in the context of existing implementations.",
                validate: (() => { const _io0 = input => "string" === typeof input.instruction; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.instruction || _report(_exceptionable, {
                        path: _path + ".instruction",
                        expected: "string",
                        value: input.instruction
                    })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
                    if (false === __is(input)) {
                        errors = [];
                        _report = __typia_transform__validateReport._validateReport(errors);
                        ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
                            path: _path + "",
                            expected: "__type",
                            value: input
                        })) && _vo0(input, _path + "", true) || _report(true, {
                            path: _path + "",
                            expected: "__type",
                            value: input
                        }))(input, "$input", true);
                        const success = 0 === errors.length;
                        return success ? {
                            success,
                            data: input
                        } : {
                            success,
                            errors,
                            data: input
                        };
                    }
                    return {
                        success: true,
                        data: input
                    };
                }; })()
            },
            {
                name: "prisma",
                parameters: {
                    type: "object",
                    properties: {
                        instruction: {
                            description: "Database design instructions extracted from user utterances.\n\nContains AI-interpreted guidance specifically for the database schema\ndesign phase. Should focus ONLY on schema structure, relationships,\nconstraints, and indexing strategies. Must NOT include API design or\nbusiness logic implementation details.\n\n**CRITICAL**: Only include what the user actually said. NEVER fabricate\nor invent requirements the user didn't mention.\n\nExamples:\n\n- \"Design flexible product catalog with variant support\"\n- \"Optimize for high-volume transaction queries\"\n- \"Implement strict referential integrity for financial data\"",
                            type: "string"
                        }
                    },
                    required: [
                        "instruction"
                    ],
                    additionalProperties: false,
                    $defs: {
                        IAutoBeApplicationResult: {
                            type: "object",
                            properties: {
                                type: {
                                    type: "string",
                                    "enum": [
                                        "success",
                                        "failure",
                                        "exception",
                                        "in-progress",
                                        "prerequisites-not-satisfied"
                                    ]
                                },
                                description: {
                                    type: "string"
                                }
                            },
                            required: [
                                "type",
                                "description"
                            ]
                        }
                    }
                },
                output: {
                    $ref: "#/$defs/IAutoBeApplicationResult"
                },
                description: "Run prisma agent.\n\nExecutes the Prisma agent to generate database schema files and ERD\ndocumentation. This agent reads the requirements specification created by\nthe {@link analyze Analyze agent} and produces a complete Prisma schema with\ncomprehensive documentation for each entity and attribute.\n\n**PREREQUISITE**: Only call this function after the {@link analyze} function\nhas been successfully executed and a requirements specification document\nhas been generated. The Prisma agent depends on the structured requirements\nanalysis to design the database schema properly. Without a completed\nrequirements specification, this function should NOT be called.\n\nThe agent will automatically validate the generated schema using the Prisma\ncompiler, self-correct any compilation errors through feedback loops, and\ngenerate ERD documentation using prisma-markdown. An internal review\nprocess ensures schema quality and optimization.",
                validate: (() => { const _io0 = input => "string" === typeof input.instruction; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.instruction || _report(_exceptionable, {
                        path: _path + ".instruction",
                        expected: "string",
                        value: input.instruction
                    })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
                    if (false === __is(input)) {
                        errors = [];
                        _report = __typia_transform__validateReport._validateReport(errors);
                        ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
                            path: _path + "",
                            expected: "__type",
                            value: input
                        })) && _vo0(input, _path + "", true) || _report(true, {
                            path: _path + "",
                            expected: "__type",
                            value: input
                        }))(input, "$input", true);
                        const success = 0 === errors.length;
                        return success ? {
                            success,
                            data: input
                        } : {
                            success,
                            errors,
                            data: input
                        };
                    }
                    return {
                        success: true,
                        data: input
                    };
                }; })()
            },
            {
                name: "interface",
                parameters: {
                    type: "object",
                    properties: {
                        instruction: {
                            description: "API design instructions extracted from user utterances.\n\nContains AI-interpreted guidance specifically for the API interface\ndesign phase. Should focus ONLY on endpoint patterns, request/response\nformats, DTO schemas, and operation specifications. Must NOT include\ndatabase details or implementation logic.\n\n**CRITICAL**: Only include what the user actually said. NEVER fabricate\nor invent requirements the user didn't mention.\n\nExamples:\n\n- \"Create RESTful endpoints with pagination for all list operations\"\n- \"Design mobile-friendly APIs with minimal response payloads\"\n- \"Follow OpenAPI 3.0 patterns with comprehensive error responses\"",
                            type: "string"
                        }
                    },
                    required: [
                        "instruction"
                    ],
                    additionalProperties: false,
                    $defs: {
                        IAutoBeApplicationResult: {
                            type: "object",
                            properties: {
                                type: {
                                    type: "string",
                                    "enum": [
                                        "success",
                                        "failure",
                                        "exception",
                                        "in-progress",
                                        "prerequisites-not-satisfied"
                                    ]
                                },
                                description: {
                                    type: "string"
                                }
                            },
                            required: [
                                "type",
                                "description"
                            ]
                        }
                    }
                },
                output: {
                    $ref: "#/$defs/IAutoBeApplicationResult"
                },
                description: "Run interface agent.\n\nExecutes the Interface agent to design and generate API interfaces. This\nagent creates OpenAPI schemas and TypeScript/NestJS code based on the\nrequirements specification and ERD documentation from previous agents.\n\nThe agent follows a sophisticated pipeline: first constructing formal\nOpenAPI Operation Schemas and JSON Schemas, then validating these schemas,\nand finally transforming them into NestJS controllers and DTOs. Each\ngenerated interface includes comprehensive JSDoc comments and undergoes\ninternal review for consistency.",
                validate: (() => { const _io0 = input => "string" === typeof input.instruction; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.instruction || _report(_exceptionable, {
                        path: _path + ".instruction",
                        expected: "string",
                        value: input.instruction
                    })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
                    if (false === __is(input)) {
                        errors = [];
                        _report = __typia_transform__validateReport._validateReport(errors);
                        ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
                            path: _path + "",
                            expected: "__type",
                            value: input
                        })) && _vo0(input, _path + "", true) || _report(true, {
                            path: _path + "",
                            expected: "__type",
                            value: input
                        }))(input, "$input", true);
                        const success = 0 === errors.length;
                        return success ? {
                            success,
                            data: input
                        } : {
                            success,
                            errors,
                            data: input
                        };
                    }
                    return {
                        success: true,
                        data: input
                    };
                }; })()
            },
            {
                name: "test",
                parameters: {
                    type: "object",
                    properties: {
                        instruction: {
                            description: "Testing strategy instructions extracted from user utterances.\n\nContains AI-interpreted guidance specifically for the test code\ngeneration phase. Should focus ONLY on test scenarios, coverage\npriorities, edge cases, and validation strategies. Must NOT include\nimplementation or API design details.\n\n**CRITICAL**: Only include what the user actually said. NEVER fabricate\nor invent requirements the user didn't mention.\n\nExamples:\n\n- \"Prioritize payment flow testing with failure scenarios\"\n- \"Generate comprehensive tests for concurrent user operations\"\n- \"Focus on data integrity validation across all endpoints\"",
                            type: "string"
                        }
                    },
                    required: [
                        "instruction"
                    ],
                    additionalProperties: false,
                    $defs: {
                        IAutoBeApplicationResult: {
                            type: "object",
                            properties: {
                                type: {
                                    type: "string",
                                    "enum": [
                                        "success",
                                        "failure",
                                        "exception",
                                        "in-progress",
                                        "prerequisites-not-satisfied"
                                    ]
                                },
                                description: {
                                    type: "string"
                                }
                            },
                            required: [
                                "type",
                                "description"
                            ]
                        }
                    }
                },
                output: {
                    $ref: "#/$defs/IAutoBeApplicationResult"
                },
                description: "Run test program agent.\n\nExecutes the Test agent to generate comprehensive E2E test suites for all\n{@link interface API interfaces}. This agent synthesizes outputs from\nprevious agents to create tests that validate both individual endpoints and\ntheir interactions.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Test agent requires the completed API interface definitions,\nOpenAPI schemas, and TypeScript code to generate appropriate test\nscenarios. Without completed interface design, this function should NOT be\ncalled.\n\nThe agent will analyze dependency relationships between API functions,\nstructure integrated test scenarios with correct execution sequences, and\nenhance pre-generated test scaffolds with business logic validation.\nTypeScript compiler validation and internal review ensure test quality and\noptimal coverage.",
                validate: (() => { const _io0 = input => "string" === typeof input.instruction; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.instruction || _report(_exceptionable, {
                        path: _path + ".instruction",
                        expected: "string",
                        value: input.instruction
                    })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
                    if (false === __is(input)) {
                        errors = [];
                        _report = __typia_transform__validateReport._validateReport(errors);
                        ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
                            path: _path + "",
                            expected: "__type",
                            value: input
                        })) && _vo0(input, _path + "", true) || _report(true, {
                            path: _path + "",
                            expected: "__type",
                            value: input
                        }))(input, "$input", true);
                        const success = 0 === errors.length;
                        return success ? {
                            success,
                            data: input
                        } : {
                            success,
                            errors,
                            data: input
                        };
                    }
                    return {
                        success: true,
                        data: input
                    };
                }; })()
            },
            {
                name: "realize",
                parameters: {
                    type: "object",
                    properties: {
                        instruction: {
                            description: "Implementation instructions extracted from user utterances.\n\nContains AI-interpreted guidance specifically for the business logic\nimplementation phase. Should focus ONLY on architectural patterns,\nperformance requirements, business logic details, and service layer\ndecisions. Must NOT include database schema or API interface\nspecifications.\n\n**CRITICAL**: Only include what the user actually said. NEVER fabricate\nor invent requirements the user didn't mention.\n\nExamples:\n\n- \"Implement with caching for frequently accessed data\"\n- \"Use transaction patterns for financial operations\"\n- \"Optimize for 10K concurrent users with rate limiting\"",
                            type: "string"
                        }
                    },
                    required: [
                        "instruction"
                    ],
                    additionalProperties: false,
                    $defs: {
                        IAutoBeApplicationResult: {
                            type: "object",
                            properties: {
                                type: {
                                    type: "string",
                                    "enum": [
                                        "success",
                                        "failure",
                                        "exception",
                                        "in-progress",
                                        "prerequisites-not-satisfied"
                                    ]
                                },
                                description: {
                                    type: "string"
                                }
                            },
                            required: [
                                "type",
                                "description"
                            ]
                        }
                    }
                },
                output: {
                    $ref: "#/$defs/IAutoBeApplicationResult"
                },
                description: "Run realize agent.\n\nExecutes the Realize agent to implement the actual business logic for each\nAPI endpoint. This agent synthesizes all outputs from previous agents to\ngenerate fully functional service provider code.\n\n**PREREQUISITE**: Only call this function after the {@link interface}\nfunction has been successfully executed and API interfaces have been\ngenerated. The Realize agent requires the completed API interface\ndefinitions to implement the corresponding service logic. It also benefits\nfrom having test code available for validation. Without completed interface\ndesign, this function should NOT be called.\n\nThe agent will create service implementations with multiple validation\nlayers: TypeScript compiler feedback, runtime validation through test\nexecution, and quality optimization through internal review. The generated\ncode handles database interactions through Prisma, implements security and\nvalidation checks, and processes business rules according to\nspecifications.",
                validate: (() => { const _io0 = input => "string" === typeof input.instruction; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.instruction || _report(_exceptionable, {
                        path: _path + ".instruction",
                        expected: "string",
                        value: input.instruction
                    })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
                    if (false === __is(input)) {
                        errors = [];
                        _report = __typia_transform__validateReport._validateReport(errors);
                        ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
                            path: _path + "",
                            expected: "__type",
                            value: input
                        })) && _vo0(input, _path + "", true) || _report(true, {
                            path: _path + "",
                            expected: "__type",
                            value: input
                        }))(input, "$input", true);
                        const success = 0 === errors.length;
                        return success ? {
                            success,
                            data: input
                        } : {
                            success,
                            errors,
                            data: input
                        };
                    }
                    return {
                        success: true,
                        data: input
                    };
                }; })()
            }
        ]
    },
    claude,
    llama: claude,
    deepseek: claude,
    "3.1": claude,
};
//# sourceMappingURL=createAutoBeApplication.js.map