UNPKG

@autobe/agent

Version:

AI backend server code generator

751 lines (750 loc) 67.8 kB
"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.orchestrateRealizeOperationCorrectOverall = void 0; const __typia_transform__isTypeUint32 = __importStar(require("typia/lib/internal/_isTypeUint32")); const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport")); const __typia_transform__llmApplicationFinalize = __importStar(require("typia/lib/internal/_llmApplicationFinalize")); const typia_1 = __importDefault(require("typia")); const validateEmptyCode_1 = require("../../utils/validateEmptyCode"); const AutoBePreliminaryController_1 = require("../common/AutoBePreliminaryController"); const orchestrateRealizeCorrectOverall_1 = require("./correct/orchestrateRealizeCorrectOverall"); const transformRealizeOperationCorrectHistory_1 = require("./histories/transformRealizeOperationCorrectHistory"); const AutoBeRealizeOperationProgrammer_1 = require("./programmers/AutoBeRealizeOperationProgrammer"); const orchestrateRealizeOperationCorrectOverall = (ctx, props) => __awaiter(void 0, void 0, void 0, function* () { const document = ctx.state().interface.document; return yield (0, orchestrateRealizeCorrectOverall_1.orchestrateRealizeCorrectOverall)(ctx, { programmer: { location: "src/providers", template: (func) => AutoBeRealizeOperationProgrammer_1.AutoBeRealizeOperationProgrammer.writeTemplate({ authorizations: props.authorizations, schemas: document.components.schemas, operation: document.operations.find((o) => o.method === func.endpoint.method && o.path === func.endpoint.path), collectors: props.collectors, transformers: props.transformers, }), replaceImportStatements: (next) => __awaiter(void 0, void 0, void 0, function* () { var _a; const scenario = AutoBeRealizeOperationProgrammer_1.AutoBeRealizeOperationProgrammer.getScenario({ authorizations: props.authorizations, operation: document.operations.find((o) => o.method === next.function.endpoint.method && o.path === next.function.endpoint.path), }); return yield AutoBeRealizeOperationProgrammer_1.AutoBeRealizeOperationProgrammer.replaceImportStatements(ctx, { operation: scenario.operation, schemas: document.components.schemas, code: next.code, payload: (_a = scenario.decoratorEvent) === null || _a === void 0 ? void 0 : _a.payload.name, }); }), additional: () => AutoBeRealizeOperationProgrammer_1.AutoBeRealizeOperationProgrammer.getAdditional({ authorizations: props.authorizations, collectors: props.collectors, transformers: props.transformers, }), preliminary: (next) => { const scenario = AutoBeRealizeOperationProgrammer_1.AutoBeRealizeOperationProgrammer.getScenario({ authorizations: props.authorizations, operation: document.operations.find((o) => o.method === next.function.endpoint.method && o.path === next.function.endpoint.path), }); return new AutoBePreliminaryController_1.AutoBePreliminaryController({ source: next.source, dispatch: (e) => ctx.dispatch(e), application: { version: "3.1", components: { schemas: { "IAutoBeRealizeOperationCorrectApplication.IProps": { type: "object", properties: { thinking: { type: "string", description: "Think before you act.\n\nFor preliminary requests: what critical information is missing and why?\n\nFor write: what errors you're fixing and the correction strategy." }, request: { oneOf: [ { $ref: "#/components/schemas/IAutoBePreliminaryGetAnalysisSections" }, { $ref: "#/components/schemas/IAutoBePreliminaryGetDatabaseSchemas" }, { $ref: "#/components/schemas/IAutoBePreliminaryGetRealizeTransformers" }, { $ref: "#/components/schemas/IAutoBePreliminaryGetRealizeCollectors" }, { $ref: "#/components/schemas/IAutoBeRealizeOperationCorrectApplication.IWrite" } ], discriminator: { propertyName: "type", mapping: { getAnalysisSections: "#/components/schemas/IAutoBePreliminaryGetAnalysisSections", getDatabaseSchemas: "#/components/schemas/IAutoBePreliminaryGetDatabaseSchemas", getRealizeTransformers: "#/components/schemas/IAutoBePreliminaryGetRealizeTransformers", getRealizeCollectors: "#/components/schemas/IAutoBePreliminaryGetRealizeCollectors", write: "#/components/schemas/IAutoBeRealizeOperationCorrectApplication.IWrite" } }, description: "Action to perform. Exhausted preliminary types are removed from the\nunion, physically preventing repeated calls." } }, required: [ "thinking", "request" ] }, IAutoBePreliminaryGetAnalysisSections: { type: "object", properties: { type: { "const": "getAnalysisSections", description: "Type discriminator." }, sectionIds: { type: "array", items: { type: "integer", minimum: 0 }, minItems: 1, maxItems: 100, description: "Section IDs to retrieve. DO NOT request same IDs already requested in\nprevious calls." } }, required: [ "type", "sectionIds" ], description: "Request to retrieve individual analysis sections by numeric ID." }, IAutoBePreliminaryGetDatabaseSchemas: { type: "object", properties: { type: { "const": "getDatabaseSchemas", description: "Type discriminator." }, schemaNames: { type: "array", items: { type: "string" }, minItems: 1, description: "Database table names to retrieve. DO NOT request same names already\nrequested in previous calls." } }, required: [ "type", "schemaNames" ], description: "Request to retrieve database schema definitions for context." }, IAutoBePreliminaryGetRealizeTransformers: { type: "object", properties: { type: { "const": "getRealizeTransformers", description: "Type discriminator." }, dtoTypeNames: { type: "array", items: { type: "string" }, minItems: 1, description: "Transformer DTO type names to retrieve. DO NOT request same names already\nrequested in previous calls." } }, required: [ "type", "dtoTypeNames" ], description: "Request to retrieve Realize Transformer function definitions for context." }, IAutoBePreliminaryGetRealizeCollectors: { type: "object", properties: { type: { "const": "getRealizeCollectors", description: "Type discriminator." }, dtoTypeNames: { type: "array", items: { type: "string" }, minItems: 1, description: "Collector DTO type names to retrieve. DO NOT request same names already\nrequested in previous calls." } }, required: [ "type", "dtoTypeNames" ], description: "Request to retrieve Realize Collector function definitions for context." }, "IAutoBeRealizeOperationCorrectApplication.IWrite": { type: "object", properties: { type: { "const": "write", description: "Type discriminator for write submission." }, think: { type: "string", description: "Error analysis and correction strategy. Understand:\n\n- Error patterns and root causes\n- Required fixes and their impact\n- Whether quick fixes or deep refactoring is needed\n- Database schema and API contract constraints" }, draft: { type: "string", description: "Corrected implementation applying all fixes from think phase." }, revise: { $ref: "#/components/schemas/IAutoBeRealizeOperationCorrectApplication.IReviseProps", description: "Reviews draft corrections and produces final error-free code." } }, required: [ "type", "think", "draft", "revise" ], description: "Correct provider compilation errors via think/draft/revise." }, "IAutoBeRealizeOperationCorrectApplication.IReviseProps": { type: "object", properties: { review: { type: "string", description: "Verify corrections:\n\n- All TypeScript errors resolved\n- Business logic remains intact\n- No new errors introduced\n- Performance and security preserved" }, final: { oneOf: [ { type: "null" }, { type: "string" } ], description: "Final error-free code with all corrections applied, or null if draft\nneeds no changes." } }, required: [ "review", "final" ] } } }, functions: [ { name: "process", async: false, parameters: [ { name: "props", description: " Preliminary data request or write submission", required: true, schema: { $ref: "#/components/schemas/IAutoBeRealizeOperationCorrectApplication.IProps" } } ], description: "Process provider correction task or preliminary data requests." } ] }, kinds: [ "analysisSections", "databaseSchemas", "realizeCollectors", "realizeTransformers", ], state: ctx.state(), all: { realizeCollectors: props.collectors, realizeTransformers: props.transformers, }, local: { realizeCollectors: props.collectors.filter((c) => { var _a; return c.plan.dtoTypeName === ((_a = scenario.operation.requestBody) === null || _a === void 0 ? void 0 : _a.typeName); }), realizeTransformers: AutoBeRealizeOperationProgrammer_1.AutoBeRealizeOperationProgrammer.getLocalTransformers({ operation: scenario.operation, schemas: document.components.schemas, transformers: props.transformers, }), }, }); }, histories: (next) => __awaiter(void 0, void 0, void 0, function* () { const operation = document.operations.find((o) => o.method === next.function.endpoint.method && o.path === next.function.endpoint.path); const dto = yield AutoBeRealizeOperationProgrammer_1.AutoBeRealizeOperationProgrammer.writeStructures(ctx, operation); return (0, transformRealizeOperationCorrectHistory_1.transformRealizeOperationCorrectHistory)({ state: ctx.state(), authorizations: props.authorizations, collectors: props.collectors, transformers: props.transformers, function: next.function, preliminary: next.preliminary, dto, failures: next.failures, }); }), controller: (next) => { const validate = (input) => { const result = (() => { const _io0 = input => "string" === typeof input.thinking && ("object" === typeof input.request && null !== input.request && _iu0(input.request)); const _io1 = input => "getAnalysisSections" === input.type && (Array.isArray(input.sectionIds) && (1 <= input.sectionIds.length && input.sectionIds.length <= 100 && input.sectionIds.every(elem => "number" === typeof elem && __typia_transform__isTypeUint32._isTypeUint32(elem)))); const _io2 = input => "getDatabaseSchemas" === input.type && (Array.isArray(input.schemaNames) && (1 <= input.schemaNames.length && input.schemaNames.every(elem => "string" === typeof elem))); const _io3 = input => "getRealizeCollectors" === input.type && (Array.isArray(input.dtoTypeNames) && (1 <= input.dtoTypeNames.length && input.dtoTypeNames.every(elem => "string" === typeof elem))); const _io4 = input => "getRealizeTransformers" === input.type && (Array.isArray(input.dtoTypeNames) && (1 <= input.dtoTypeNames.length && input.dtoTypeNames.every(elem => "string" === typeof elem))); const _io5 = input => "write" === input.type && "string" === typeof input.think && "string" === typeof input.draft && ("object" === typeof input.revise && null !== input.revise && _io6(input.revise)); const _io6 = input => "string" === typeof input.review && (null === input.final || "string" === typeof input.final); const _iu0 = input => (() => { if ("getAnalysisSections" === input.type) return _io1(input); else if ("getDatabaseSchemas" === input.type) return _io2(input); else if ("getRealizeTransformers" === input.type) return _io4(input); else if ("getRealizeCollectors" === input.type) return _io3(input); else if ("write" === input.type) return _io5(input); else return false; })(); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.thinking || _report(_exceptionable, { path: _path + ".thinking", expected: "string", value: input.thinking }), ("object" === typeof input.request && null !== input.request || _report(_exceptionable, { path: _path + ".request", expected: "(IAutoBePreliminaryGetAnalysisSections | IAutoBePreliminaryGetDatabaseSchemas | IAutoBePreliminaryGetRealizeCollectors | IAutoBePreliminaryGetRealizeTransformers | IAutoBeRealizeOperationCorrectApplication.IWrite)", value: input.request })) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, { path: _path + ".request", expected: "(IAutoBePreliminaryGetAnalysisSections | IAutoBePreliminaryGetDatabaseSchemas | IAutoBePreliminaryGetRealizeCollectors | IAutoBePreliminaryGetRealizeTransformers | IAutoBeRealizeOperationCorrectApplication.IWrite)", value: input.request })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["getAnalysisSections" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"getAnalysisSections\"", value: input.type }), (Array.isArray(input.sectionIds) || _report(_exceptionable, { path: _path + ".sectionIds", expected: "(Array<number & Type<\"uint32\">> & MinItems<1> & MaxItems<100>)", value: input.sectionIds })) && ((1 <= input.sectionIds.length || _report(_exceptionable, { path: _path + ".sectionIds", expected: "Array<> & MinItems<1>", value: input.sectionIds })) && (input.sectionIds.length <= 100 || _report(_exceptionable, { path: _path + ".sectionIds", expected: "Array<> & MaxItems<100>", value: input.sectionIds })) && input.sectionIds.map((elem, _index5) => "number" === typeof elem && (__typia_transform__isTypeUint32._isTypeUint32(elem) || _report(_exceptionable, { path: _path + ".sectionIds[" + _index5 + "]", expected: "number & Type<\"uint32\">", value: elem })) || _report(_exceptionable, { path: _path + ".sectionIds[" + _index5 + "]", expected: "(number & Type<\"uint32\">)", value: elem })).every(flag => flag)) || _report(_exceptionable, { path: _path + ".sectionIds", expected: "(Array<number & Type<\"uint32\">> & MinItems<1> & MaxItems<100>)", value: input.sectionIds })].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["getDatabaseSchemas" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"getDatabaseSchemas\"", value: input.type }), (Array.isArray(input.schemaNames) || _report(_exceptionable, { path: _path + ".schemaNames", expected: "(Array<string> & MinItems<1>)", value: input.schemaNames })) && ((1 <= input.schemaNames.length || _report(_exceptionable, { path: _path + ".schemaNames", expected: "Array<> & MinItems<1>", value: input.schemaNames })) && input.schemaNames.map((elem, _index6) => "string" === typeof elem || _report(_exceptionable, { path: _path + ".schemaNames[" + _index6 + "]", expected: "string", value: elem })).every(flag => flag)) || _report(_exceptionable, { path: _path + ".schemaNames", expected: "(Array<string> & MinItems<1>)", value: input.schemaNames })].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["getRealizeCollectors" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"getRealizeCollectors\"", value: input.type }), (Array.isArray(input.dtoTypeNames) || _report(_exceptionable, { path: _path + ".dtoTypeNames", expected: "(Array<string> & MinItems<1>)", value: input.dtoTypeNames })) && ((1 <= input.dtoTypeNames.length || _report(_exceptionable, { path: _path + ".dtoTypeNames", expected: "Array<> & MinItems<1>", value: input.dtoTypeNames })) && input.dtoTypeNames.map((elem, _index7) => "string" === typeof elem || _report(_exceptionable, { path: _path + ".dtoTypeNames[" + _index7 + "]", expected: "string", value: elem })).every(flag => flag)) || _report(_exceptionable, { path: _path + ".dtoTypeNames", expected: "(Array<string> & MinItems<1>)", value: input.dtoTypeNames })].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["getRealizeTransformers" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"getRealizeTransformers\"", value: input.type }), (Array.isArray(input.dtoTypeNames) || _report(_exceptionable, { path: _path + ".dtoTypeNames", expected: "(Array<string> & MinItems<1>)", value: input.dtoTypeNames })) && ((1 <= input.dtoTypeNames.length || _report(_exceptionable, { path: _path + ".dtoTypeNames", expected: "Array<> & MinItems<1>", value: input.dtoTypeNames })) && input.dtoTypeNames.map((elem, _index8) => "string" === typeof elem || _report(_exceptionable, { path: _path + ".dtoTypeNames[" + _index8 + "]", expected: "string", value: elem })).every(flag => flag)) || _report(_exceptionable, { path: _path + ".dtoTypeNames", expected: "(Array<string> & MinItems<1>)", value: input.dtoTypeNames })].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => ["write" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"write\"", value: input.type }), "string" === typeof input.think || _report(_exceptionable, { path: _path + ".think", expected: "string", value: input.think }), "string" === typeof input.draft || _report(_exceptionable, { path: _path + ".draft", expected: "string", value: input.draft }), ("object" === typeof input.revise && null !== input.revise || _report(_exceptionable, { path: _path + ".revise", expected: "IAutoBeRealizeOperationCorrectApplication.IReviseProps", value: input.revise })) && _vo6(input.revise, _path + ".revise", true && _exceptionable) || _report(_exceptionable, { path: _path + ".revise", expected: "IAutoBeRealizeOperationCorrectApplication.IReviseProps", value: input.revise })].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => ["string" === typeof input.review || _report(_exceptionable, { path: _path + ".review", expected: "string", value: input.review }), null === input.final || "string" === typeof input.final || _report(_exceptionable, { path: _path + ".final", expected: "(null | string)", value: input.final })].every(flag => flag); const _vu0 = (input, _path, _exceptionable = true) => (() => { if ("getAnalysisSections" === input.type) return _vo1(input, _path, true && _exceptionable); else if ("getDatabaseSchemas" === input.type) return _vo2(input, _path, true && _exceptionable); else if ("getRealizeTransformers" === input.type) return _vo4(input, _path, true && _exceptionable); else if ("getRealizeCollectors" === input.type) return _vo3(input, _path, true && _exceptionable); else if ("write" === input.type) return _vo5(input, _path, true && _exceptionable); else return _report(_exceptionable, { path: _path, expected: "(IAutoBePreliminaryGetAnalysisSections | IAutoBePreliminaryGetDatabaseSchemas | IAutoBePreliminaryGetRealizeTransformers | IAutoBePreliminaryGetRealizeCollectors | IAutoBeRealizeOperationCorrectApplication.IWrite)", value: input }); })(); 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: "IAutoBeRealizeOperationCorrectApplication.IProps", value: input })) && _vo0(input, _path + "", true) || _report(true, { path: _path + "", expected: "IAutoBeRealizeOperationCorrectApplication.IProps", value: input }))(input, "$input", true); const success = 0 === errors.length; return success ? { success, data: input } : { success, errors, data: input }; } return { success: true, data: input }; }; })()(input); if (result.success === false) return result; else if (result.data.request.type !== "write") return next.preliminary.validate({ thinking: result.data.thinking, request: result.data.request, }); const errors = [ ...(0, validateEmptyCode_1.validateEmptyCode)({ name: next.function.name, draft: result.data.request.draft, revise: result.data.request.revise, path: "$input.request", asynchronous: true, }), ...AutoBeRealizeOperationProgrammer_1.AutoBeRealizeOperationProgrammer.validateSelectTransformContract({ draft: result.data.request.draft, revise: result.data.request.revise, }), ]; return errors.length ? { success: false, errors, data: result.data, } : result; }; const application = next.preliminary.fixApplication(__typia_transform__llmApplicationFinalize._llmApplicationFinalize({ functions: [ { name: "process", parameters: { description: "Current Type: {@link IAutoBeRealizeOperationCorrectApplication.IProps}", type: "object", properties: { thinking: { description: "Think before you act.\n\nFor preliminary requests: what critical information is missing and why?\n\nFor write: what errors you're fixing and the correction strategy.", type: "string" }, request: { description: "Action to perform. Exhausted preliminary types are removed from the\nunion, physically preventing repeated calls.", anyOf: [ { $ref: "#/$defs/IAutoBePreliminaryGetAnalysisSections" }, { $ref: "#/$defs/IAutoBePreliminaryGetDatabaseSchemas" }, { $ref: "#/$defs/IAutoBePreliminaryGetRealizeTransformers" }, { $ref: "#/$defs/IAutoBePreliminaryGetRealizeCollectors" }, { $ref: "#/$defs/IAutoBeRealizeOperationCorrectApplication.IWrite" } ], "x-discriminator": { propertyName: "type", mapping: { getAnalysisSections: "#/$defs/IAutoBePreliminaryGetAnalysisSections", getDatabaseSchemas: "#/$defs/IAutoBePreliminaryGetDatabaseSchemas", getRealizeTransformers: "#/$defs/IAutoBePreliminaryGetRealizeTransformers", getRealizeCollectors: "#/$defs/IAutoBePreliminaryGetRealizeCollectors", write: "#/$defs/IAutoBeRealizeOperationCorrectApplication.IWrite" } } } }, required: [ "thinking", "request" ], additionalProperties: false, $defs: { IAutoBePreliminaryGetAnalysisSections: { description: "Request to retrieve individual analysis sections by numeric ID.", type: "object", properties: { type: { description: "Type discriminator.", type: "string", "enum": [ "getAnalysisSections" ] }, sectionIds: { description: "Section IDs to retrieve. DO NOT request same IDs already requested in\nprevious calls.", type: "array", items: { type: "integer", minimum: 0 }, minItems: 1, maxItems: 100 } }, required: [ "type", "sectionIds" ] }, IAutoBePreliminaryGetDatabaseSchemas: { description: "Request to retrieve database schema definitions for context.", type: "object", properties: { type: { description: "Type discriminator.", type: "string", "enum": [ "getDatabaseSchemas" ] }, schemaNames: { description: "Database table names to retrieve. DO NOT request same names already\nrequested in previous calls.", type: "array", items: { type: "string" }, minItems: 1 } }, required: [ "type", "schemaNames" ] }, IAutoBePreliminaryGetRealizeTransformers: { description: "Request to retrieve Realize Transformer function definitions for context.", type: "object", properties: { type: { description: "Type discriminator.", type: "string", "enum": [ "getRealizeTransformers" ] }, dtoTypeNames: { description: "Transformer DTO type names to retrieve. DO NOT request same names already\nrequested in previous calls.", type: "array", items: { type: "string" }, minItems: 1 } }, required: [ "type", "dtoTypeNames" ] }, IAutoBePreliminaryGetRealizeCollectors: { description: "Request to retrieve Realize Collector function definitions for context.", type: "object", properties: { type: { description: "Type discriminator.", type: "string", "enum": [ "getRealizeCollectors" ] }, dtoTypeNames: { description: "Collector DTO type names to retrieve. DO NOT request same names already\nrequested in previous calls.", type: "array", items: { type: "string" }, minItems: 1 } }, required: [ "type", "dtoTypeNames" ] }, "IAutoBeRealizeOperationCorrectApplication.IWrite": { description: "Correct provider compilation errors via think/draft/revise.", type: "object", properties: { type: { description: "Type discriminator for write submission.", type: "string", "enum": [ "write" ] }, think: { description: "Error analysis and correction strategy. Understand:\n\n- Error patterns and root causes\n- Required fixes and their impact\n- Whether quick fixes or deep refactoring is needed\n- Database schema and API contract constraints", type: "string" }, draft: { description: "Corrected implementation applying all fixes from think phase.", type: "string" }, revise: { description: "Reviews draft corrections and produces final error-free code.", $ref: "#/$defs/IAutoBeRealizeOperationCorrectApplication.IReviseProps" } }, required: [ "type", "think", "draft", "revise" ] }, "IAutoBeRealizeOperationCorrectApplication.IReviseProps": { type: "object", properties: { review: { description: "Verify corrections:\n\n- All TypeScript errors resolved\n- Business logic remains intact\n- No new errors introduced\n- Performance and security preserved", type: "string" }, final: { description: "Final error-free code with all corrections applied, or null if draft\nneeds no changes.",