@autobe/agent
Version:
AI backend server code generator
643 lines • 73.1 kB
JavaScript
"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.orchestrateAnalyzeReview = void 0;
const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
const __typia_transform__llmApplicationFinalize = __importStar(require("typia/lib/internal/_llmApplicationFinalize.js"));
const typia_1 = __importDefault(require("typia"));
const uuid_1 = require("uuid");
const assertSchemaModel_1 = require("../../context/assertSchemaModel");
const AutoBePreliminaryController_1 = require("../common/AutoBePreliminaryController");
const transformAnalyzeReviewHistories_1 = require("./histories/transformAnalyzeReviewHistories");
const orchestrateAnalyzeReview = (ctx, props) => __awaiter(void 0, void 0, void 0, function* () {
const preliminary = new AutoBePreliminaryController_1.AutoBePreliminaryController({
application: {
version: "3.1",
components: {
schemas: {
"IAutoBeAnalyzeReviewApplication.IProps": {
type: "object",
properties: {
thinking: {
type: "string",
description: "Think before you act.\n\nBefore requesting preliminary data or completing your task, reflect on your\ncurrent state and explain your reasoning:\n\nFor preliminary requests (getAnalysisFiles, getPrismaSchemas, etc.):\n- What critical information is missing that you don't already have?\n- Why do you need it specifically right now?\n- Be brief - state the gap, don't list everything you have.\n\nFor completion (complete):\n- What key assets did you acquire?\n- What did you accomplish?\n- Why is it sufficient to complete?\n- Summarize - don't enumerate every single item.\n\nThis reflection helps you avoid duplicate requests and premature completion."
},
request: {
oneOf: [
{
$ref: "#/components/schemas/IAutoBePreliminaryGetAnalysisFiles"
},
{
$ref: "#/components/schemas/IAutoBeAnalyzeReviewApplication.IComplete"
}
],
discriminator: {
propertyName: "type",
mapping: {
getAnalysisFiles: "#/components/schemas/IAutoBePreliminaryGetAnalysisFiles",
complete: "#/components/schemas/IAutoBeAnalyzeReviewApplication.IComplete"
}
},
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval\n(getAnalysisFiles) or final document enhancement (complete). When\npreliminary returns empty array, that type is removed from the union,\nphysically preventing repeated calls."
}
},
required: [
"thinking",
"request"
]
},
IAutoBePreliminaryGetAnalysisFiles: {
type: "object",
properties: {
type: {
"const": "getAnalysisFiles",
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"getAnalysisFiles\" indicates this is a preliminary\ndata request for analysis files."
},
fileNames: {
type: "array",
items: {
type: "string"
},
minItems: 1,
description: "List of analysis file names to retrieve.\n\nFile names from the analyze phase containing requirements, use cases, and\nbusiness logic documentation.\n\nCRITICAL: DO NOT request the same file names that you have already\nrequested in previous calls."
}
},
required: [
"type",
"fileNames"
],
description: "Request to retrieve requirements analysis files for context.\n\nThis type is used in the preliminary phase to request specific analysis files\nthat provide business requirements and domain context."
},
"IAutoBeAnalyzeReviewApplication.IComplete": {
type: "object",
properties: {
type: {
"const": "complete",
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"complete\" indicates this is the final task\nexecution request."
},
review: {
type: "string",
description: "Enhancement criteria and quality standards.\n\nComprehensive guidelines that define document quality requirements and\nenhancement strategies. These criteria ensure the final documentation is\nimplementation-ready and removes all ambiguity for backend developers.\n\nKey enhancement criteria include:\n\n- Minimum document length requirements for thoroughness\n- Section completeness checks ensuring all required topics are covered\n- Link validation rules for internal and external references\n- Mermaid syntax validation (especially parentheses in labels)\n- Content specificity requirements to avoid vague statements\n- EARS format compliance for requirements specification\n- Natural language business requirement descriptions\n\nCritical quality standards:\n\n- DO: Use double quotes for ALL labels in Mermaid diagrams\n- DO NOT: Use spaces between brackets and quotes in Mermaid syntax\n- DO: Make requirements specific and measurable in natural language\n- DO: Focus on business requirements and user scenarios\n- DO NOT: Accept documents containing database schemas or API\n specifications\n- DO: Describe business model and authentication requirements in natural\n language\n- DO: Expand brief sections with comprehensive business context\n- DO: Convert vague statements to EARS format with clear conditions\n\nThe review criteria guide the enhancement process to ensure production-ready\ndocumentation that serves as a solid foundation for subsequent pipeline\nphases."
},
plan: {
type: "string",
description: "Original document structure plan.\n\nThe document plan that was used to create the initial content draft. This\nplanning blueprint helps the enhancement agent understand the intended\nstructure, organization, and coverage expectations.\n\nUnderstanding from the plan:\n\n- Required sections and their purposes\n- Intended document structure and organization hierarchy\n- Target audience and documentation purpose\n- Expected level of detail and technical depth\n- Content coverage scope and boundaries\n\nThe enhancer uses this plan to ensure the improved content aligns with the\noriginal architectural vision while meeting all quality standards and\ncompleteness requirements."
},
content: {
type: "string",
description: "Enhanced, production-ready markdown document.\n\nINPUT: The document written by Write Agent (may have quality issues)\nOUTPUT: The enhanced, complete markdown document ready for production use\n\nEnhancement transformation requirements:\n\n- Fix all Mermaid syntax errors (add quotes, fix arrows, proper formatting)\n- Convert vague statements to EARS format with specific conditions\n- Expand sections that are too brief with comprehensive business context\n- Add missing business processes and workflow descriptions\n- Ensure all sections meet minimum length requirements\n- Validate and correct all internal and external links\n- Remove any database schema or API specification details\n- Enhance business model descriptions with natural language clarity\n- Improve requirements specificity and measurability\n\nOutput characteristics:\n\n- Must be the actual enhanced document content (not review comments)\n- Must be valid markdown with proper formatting\n- Must meet all quality criteria specified in review field\n- Must align with the original plan structure\n- Must be implementation-ready for subsequent pipeline phases\n\nThe enhanced document serves as the authoritative requirements specification\nthat will guide all downstream generation phases (Prisma, Interface, Test,\nRealize)."
}
},
required: [
"type",
"review",
"plan",
"content"
],
description: "Request to enhance and finalize planning documentation.\n\nExecutes document enhancement to produce improved, complete markdown\ndocumentation following quality standards and best practices. The output\nis the enhanced document itself, not review comments."
}
}
},
functions: [
{
name: "process",
async: false,
parameters: [
{
name: "props",
description: " Request containing either preliminary data request or complete\ntask",
required: true,
schema: {
$ref: "#/components/schemas/IAutoBeAnalyzeReviewApplication.IProps"
}
}
],
description: "Process document enhancement task or preliminary data requests.\n\nEnhances and finalizes planning documentation by retrieving necessary\nanalysis files via RAG (Retrieval-Augmented Generation) and producing\nimproved, complete markdown documents ready for production use."
}
]
},
source: SOURCE,
kinds: ["analysisFiles"],
state: ctx.state(),
all: {
analysisFiles: props.allFiles,
},
local: {
analysisFiles: [props.myFile],
},
});
return yield preliminary.orchestrate(ctx, (out) => __awaiter(void 0, void 0, void 0, function* () {
var _a, _b;
const pointer = {
value: null,
};
const result = yield ctx.conversate(Object.assign({ source: SOURCE, controller: createController({
model: ctx.model,
pointer,
preliminary,
}), enforceFunctionCall: true, promptCacheKey: props.promptCacheKey }, (0, transformAnalyzeReviewHistories_1.transformAnalyzeReviewHistories)(ctx, {
preliminary,
scenario: props.scenario,
myFile: props.myFile,
})));
if (pointer.value === null)
return out(result)(null);
const event = {
type: SOURCE,
id: (0, uuid_1.v7)(),
file: props.myFile,
plan: pointer.value.plan,
review: pointer.value.review,
content: pointer.value.content,
tokenUsage: result.tokenUsage,
metric: result.metric,
total: props.progress.total,
completed: ++props.progress.completed,
step: ((_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : -1) + 1,
created_at: new Date().toISOString(),
};
ctx.dispatch(event);
return out(result)(event);
}));
});
exports.orchestrateAnalyzeReview = orchestrateAnalyzeReview;
function createController(props) {
(0, assertSchemaModel_1.assertSchemaModel)(props.model);
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 => "getAnalysisFiles" === input.type && (Array.isArray(input.fileNames) && (1 <= input.fileNames.length && input.fileNames.every(elem => "string" === typeof elem))); const _io2 = input => "complete" === input.type && "string" === typeof input.review && "string" === typeof input.plan && "string" === typeof input.content; const _iu0 = input => (() => {
if ("getAnalysisFiles" === input.type)
return _io1(input);
else if ("complete" === input.type)
return _io2(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: "(IAutoBeAnalyzeReviewApplication.IComplete | IAutoBePreliminaryGetAnalysisFiles)",
value: input.request
})) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".request",
expected: "(IAutoBeAnalyzeReviewApplication.IComplete | IAutoBePreliminaryGetAnalysisFiles)",
value: input.request
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["getAnalysisFiles" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "\"getAnalysisFiles\"",
value: input.type
}), (Array.isArray(input.fileNames) || _report(_exceptionable, {
path: _path + ".fileNames",
expected: "(Array<string> & MinItems<1>)",
value: input.fileNames
})) && ((1 <= input.fileNames.length || _report(_exceptionable, {
path: _path + ".fileNames",
expected: "Array<> & MinItems<1>",
value: input.fileNames
})) && input.fileNames.map((elem, _index2) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".fileNames[" + _index2 + "]",
expected: "string",
value: elem
})).every(flag => flag)) || _report(_exceptionable, {
path: _path + ".fileNames",
expected: "(Array<string> & MinItems<1>)",
value: input.fileNames
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["complete" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "\"complete\"",
value: input.type
}), "string" === typeof input.review || _report(_exceptionable, {
path: _path + ".review",
expected: "string",
value: input.review
}), "string" === typeof input.plan || _report(_exceptionable, {
path: _path + ".plan",
expected: "string",
value: input.plan
}), "string" === typeof input.content || _report(_exceptionable, {
path: _path + ".content",
expected: "string",
value: input.content
})].every(flag => flag); const _vu0 = (input, _path, _exceptionable = true) => (() => {
if ("getAnalysisFiles" === input.type)
return _vo1(input, _path, true && _exceptionable);
else if ("complete" === input.type)
return _vo2(input, _path, true && _exceptionable);
else
return _report(_exceptionable, {
path: _path,
expected: "(IAutoBePreliminaryGetAnalysisFiles | IAutoBeAnalyzeReviewApplication.IComplete)",
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: "IAutoBeAnalyzeReviewApplication.IProps",
value: input
})) && _vo0(input, _path + "", true) || _report(true, {
path: _path + "",
expected: "IAutoBeAnalyzeReviewApplication.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 || result.data.request.type === "complete")
return result;
return props.preliminary.validate({
thinking: result.data.thinking,
request: result.data.request,
});
};
const application = collection[props.model === "chatgpt"
? "chatgpt"
: props.model === "gemini"
? "gemini"
: "claude"](validate);
return {
protocol: "class",
name: SOURCE,
application,
execute: {
process: (input) => {
if (input.request.type === "complete")
props.pointer.value = input.request;
},
},
};
}
const collection = {
chatgpt: (validate) => (() => {
const application = {
model: "chatgpt",
options: {
reference: true,
strict: false,
separate: null
},
functions: [
{
name: "process",
parameters: {
description: " Request containing either preliminary data request or complete\ntask\n\n------------------------------\n\nCurrent Type: {@link IAutoBeAnalyzeReviewApplication.IProps}",
type: "object",
properties: {
thinking: {
description: "Think before you act.\n\nBefore requesting preliminary data or completing your task, reflect on your\ncurrent state and explain your reasoning:\n\nFor preliminary requests (getAnalysisFiles, getPrismaSchemas, etc.):\n- What critical information is missing that you don't already have?\n- Why do you need it specifically right now?\n- Be brief - state the gap, don't list everything you have.\n\nFor completion (complete):\n- What key assets did you acquire?\n- What did you accomplish?\n- Why is it sufficient to complete?\n- Summarize - don't enumerate every single item.\n\nThis reflection helps you avoid duplicate requests and premature completion.",
type: "string"
},
request: {
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval\n(getAnalysisFiles) or final document enhancement (complete). When\npreliminary returns empty array, that type is removed from the union,\nphysically preventing repeated calls.",
anyOf: [
{
$ref: "#/$defs/IAutoBePreliminaryGetAnalysisFiles"
},
{
$ref: "#/$defs/IAutoBeAnalyzeReviewApplication.IComplete"
}
],
"x-discriminator": {
propertyName: "type",
mapping: {
getAnalysisFiles: "#/$defs/IAutoBePreliminaryGetAnalysisFiles",
complete: "#/$defs/IAutoBeAnalyzeReviewApplication.IComplete"
}
}
}
},
required: [
"thinking",
"request"
],
additionalProperties: false,
$defs: {
IAutoBePreliminaryGetAnalysisFiles: {
description: "Request to retrieve requirements analysis files for context.\n\nThis type is used in the preliminary phase to request specific analysis files\nthat provide business requirements and domain context.",
type: "object",
properties: {
type: {
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"getAnalysisFiles\" indicates this is a preliminary\ndata request for analysis files.",
type: "string",
"enum": [
"getAnalysisFiles"
]
},
fileNames: {
description: "List of analysis file names to retrieve.\n\nFile names from the analyze phase containing requirements, use cases, and\nbusiness logic documentation.\n\nCRITICAL: DO NOT request the same file names that you have already\nrequested in previous calls.\n\n\n@minItems 1",
type: "array",
items: {
type: "string"
}
}
},
required: [
"type",
"fileNames"
]
},
"IAutoBeAnalyzeReviewApplication.IComplete": {
description: "Request to enhance and finalize planning documentation.\n\nExecutes document enhancement to produce improved, complete markdown\ndocumentation following quality standards and best practices. The output\nis the enhanced document itself, not review comments.",
type: "object",
properties: {
type: {
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"complete\" indicates this is the final task\nexecution request.",
type: "string",
"enum": [
"complete"
]
},
review: {
description: "Enhancement criteria and quality standards.\n\nComprehensive guidelines that define document quality requirements and\nenhancement strategies. These criteria ensure the final documentation is\nimplementation-ready and removes all ambiguity for backend developers.\n\nKey enhancement criteria include:\n\n- Minimum document length requirements for thoroughness\n- Section completeness checks ensuring all required topics are covered\n- Link validation rules for internal and external references\n- Mermaid syntax validation (especially parentheses in labels)\n- Content specificity requirements to avoid vague statements\n- EARS format compliance for requirements specification\n- Natural language business requirement descriptions\n\nCritical quality standards:\n\n- DO: Use double quotes for ALL labels in Mermaid diagrams\n- DO NOT: Use spaces between brackets and quotes in Mermaid syntax\n- DO: Make requirements specific and measurable in natural language\n- DO: Focus on business requirements and user scenarios\n- DO NOT: Accept documents containing database schemas or API\n specifications\n- DO: Describe business model and authentication requirements in natural\n language\n- DO: Expand brief sections with comprehensive business context\n- DO: Convert vague statements to EARS format with clear conditions\n\nThe review criteria guide the enhancement process to ensure production-ready\ndocumentation that serves as a solid foundation for subsequent pipeline\nphases.",
type: "string"
},
plan: {
description: "Original document structure plan.\n\nThe document plan that was used to create the initial content draft. This\nplanning blueprint helps the enhancement agent understand the intended\nstructure, organization, and coverage expectations.\n\nUnderstanding from the plan:\n\n- Required sections and their purposes\n- Intended document structure and organization hierarchy\n- Target audience and documentation purpose\n- Expected level of detail and technical depth\n- Content coverage scope and boundaries\n\nThe enhancer uses this plan to ensure the improved content aligns with the\noriginal architectural vision while meeting all quality standards and\ncompleteness requirements.",
type: "string"
},
content: {
description: "Enhanced, production-ready markdown document.\n\nINPUT: The document written by Write Agent (may have quality issues)\nOUTPUT: The enhanced, complete markdown document ready for production use\n\nEnhancement transformation requirements:\n\n- Fix all Mermaid syntax errors (add quotes, fix arrows, proper formatting)\n- Convert vague statements to EARS format with specific conditions\n- Expand sections that are too brief with comprehensive business context\n- Add missing business processes and workflow descriptions\n- Ensure all sections meet minimum length requirements\n- Validate and correct all internal and external links\n- Remove any database schema or API specification details\n- Enhance business model descriptions with natural language clarity\n- Improve requirements specificity and measurability\n\nOutput characteristics:\n\n- Must be the actual enhanced document content (not review comments)\n- Must be valid markdown with proper formatting\n- Must meet all quality criteria specified in review field\n- Must align with the original plan structure\n- Must be implementation-ready for subsequent pipeline phases\n\nThe enhanced document serves as the authoritative requirements specification\nthat will guide all downstream generation phases (Prisma, Interface, Test,\nRealize).",
type: "string"
}
},
required: [
"type",
"review",
"plan",
"content"
]
}
}
},
description: "Process document enhancement task or preliminary data requests.\n\nEnhances and finalizes planning documentation by retrieving necessary\nanalysis files via RAG (Retrieval-Augmented Generation) and producing\nimproved, complete markdown documents ready for production use.",
validate: (() => { const _io0 = input => "string" === typeof input.thinking && ("object" === typeof input.request && null !== input.request && _iu0(input.request)); const _io1 = input => "getAnalysisFiles" === input.type && (Array.isArray(input.fileNames) && (1 <= input.fileNames.length && input.fileNames.every(elem => "string" === typeof elem))); const _io2 = input => "complete" === input.type && "string" === typeof input.review && "string" === typeof input.plan && "string" === typeof input.content; const _iu0 = input => (() => {
if ("getAnalysisFiles" === input.type)
return _io1(input);
else if ("complete" === input.type)
return _io2(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: "(IAutoBeAnalyzeReviewApplication.IComplete | IAutoBePreliminaryGetAnalysisFiles)",
value: input.request
})) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".request",
expected: "(IAutoBeAnalyzeReviewApplication.IComplete | IAutoBePreliminaryGetAnalysisFiles)",
value: input.request
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["getAnalysisFiles" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "\"getAnalysisFiles\"",
value: input.type
}), (Array.isArray(input.fileNames) || _report(_exceptionable, {
path: _path + ".fileNames",
expected: "(Array<string> & MinItems<1>)",
value: input.fileNames
})) && ((1 <= input.fileNames.length || _report(_exceptionable, {
path: _path + ".fileNames",
expected: "Array<> & MinItems<1>",
value: input.fileNames
})) && input.fileNames.map((elem, _index2) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".fileNames[" + _index2 + "]",
expected: "string",
value: elem
})).every(flag => flag)) || _report(_exceptionable, {
path: _path + ".fileNames",
expected: "(Array<string> & MinItems<1>)",
value: input.fileNames
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["complete" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "\"complete\"",
value: input.type
}), "string" === typeof input.review || _report(_exceptionable, {
path: _path + ".review",
expected: "string",
value: input.review
}), "string" === typeof input.plan || _report(_exceptionable, {
path: _path + ".plan",
expected: "string",
value: input.plan
}), "string" === typeof input.content || _report(_exceptionable, {
path: _path + ".content",
expected: "string",
value: input.content
})].every(flag => flag); const _vu0 = (input, _path, _exceptionable = true) => (() => {
if ("getAnalysisFiles" === input.type)
return _vo1(input, _path, true && _exceptionable);
else if ("complete" === input.type)
return _vo2(input, _path, true && _exceptionable);
else
return _report(_exceptionable, {
path: _path,
expected: "(IAutoBePreliminaryGetAnalysisFiles | IAutoBeAnalyzeReviewApplication.IComplete)",
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: "IAutoBeAnalyzeReviewApplication.IProps",
value: input
})) && _vo0(input, _path + "", true) || _report(true, {
path: _path + "",
expected: "IAutoBeAnalyzeReviewApplication.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
};
}; })()
}
]
};
__typia_transform__llmApplicationFinalize._llmApplicationFinalize(application, Object.assign(Object.assign({}, {
validate: {
process: validate,
},
}), { equals: false }));
return application;
})(),
claude: (validate) => (() => {
const application = {
model: "claude",
options: {
reference: true,
separate: null
},
functions: [
{
name: "process",
parameters: {
description: " Request containing either preliminary data request or complete\ntask\n\n------------------------------\n\nCurrent Type: {@link IAutoBeAnalyzeReviewApplication.IProps}",
type: "object",
properties: {
thinking: {
description: "Think before you act.\n\nBefore requesting preliminary data or completing your task, reflect on your\ncurrent state and explain your reasoning:\n\nFor preliminary requests (getAnalysisFiles, getPrismaSchemas, etc.):\n- What critical information is missing that you don't already have?\n- Why do you need it specifically right now?\n- Be brief - state the gap, don't list everything you have.\n\nFor completion (complete):\n- What key assets did you acquire?\n- What did you accomplish?\n- Why is it sufficient to complete?\n- Summarize - don't enumerate every single item.\n\nThis reflection helps you avoid duplicate requests and premature completion.",
type: "string"
},
request: {
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval\n(getAnalysisFiles) or final document enhancement (complete). When\npreliminary returns empty array, that type is removed from the union,\nphysically preventing repeated calls.",
oneOf: [
{
$ref: "#/$defs/IAutoBePreliminaryGetAnalysisFiles"
},
{
$ref: "#/$defs/IAutoBeAnalyzeReviewApplication.IComplete"
}
],
discriminator: {
propertyName: "type",
mapping: {
getAnalysisFiles: "#/$defs/IAutoBePreliminaryGetAnalysisFiles",
complete: "#/$defs/IAutoBeAnalyzeReviewApplication.IComplete"
}
}
}
},
required: [
"thinking",
"request"
],
additionalProperties: false,
$defs: {
IAutoBePreliminaryGetAnalysisFiles: {
description: "Request to retrieve requirements analysis files for context.\n\nThis type is used in the preliminary phase to request specific analysis files\nthat provide business requirements and domain context.",
type: "object",
properties: {
type: {
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"getAnalysisFiles\" indicates this is a preliminary\ndata request for analysis files.",
"const": "getAnalysisFiles"
},
fileNames: {
description: "List of analysis file names to retrieve.\n\nFile names from the analyze phase containing requirements, use cases, and\nbusiness logic documentation.\n\nCRITICAL: DO NOT request the same file names that you have already\nrequested in previous calls.",
type: "array",
items: {
type: "string"
},
minItems: 1
}
},
required: [
"type",
"fileNames"
]
},
"IAutoBeAnalyzeReviewApplication.IComplete": {
description: "Request to enhance and finalize planning documentation.\n\nExecutes document enhancement to produce improved, complete markdown\ndocumentation following quality standards and best practices. The output\nis the enhanced document itself, not review comments.",
type: "object",
properties: {
type: {
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"complete\" indicates this is the final task\nexecution request.",
"const": "complete"
},
review: {
description: "Enhancement criteria and quality standards.\n\nComprehensive guidelines that define document quality requirements and\nenhancement strategies. These criteria ensure the final documentation is\nimplementation-ready and removes all ambiguity for backend developers.\n\nKey enhancement criteria include:\n\n- Minimum document length requirements for thoroughness\n- Section completeness checks ensuring all required topics are covered\n- Link validation rules for internal and external references\n- Mermaid syntax validation (especially parentheses in labels)\n- Content specificity requirements to avoid vague statements\n- EARS format compliance for requirements specification\n- Natural language business requirement descriptions\n\nCritical quality standards:\n\n- DO: Use double quotes for ALL labels in Mermaid diagrams\n- DO NOT: Use spaces between brackets and quotes in Mermaid syntax\n- DO: Make requirements specific and measurable in natural language\n- DO: Focus on business requirements and user scenarios\n- DO NOT: Accept documents containing database schemas or API\n specifications\n- DO: Describe business model and authentication requirements in natural\n language\n- DO: Expand brief sections with comprehensive business context\n- DO: Convert vague statements to EARS format with clear conditions\n\nThe review criteria guide the enhancement process to ensure production-ready\ndocumentation that serves as a solid foundation for subsequent pipeline\nphases.",
type: "string"
},
plan: {
description: "Original document structure plan.\n\nThe document plan that was used to create the initial content draft. This\nplanning blueprint helps the enhancement agent understand the intended\nstructure, organization, and coverage expectations.\n\nUnderstanding from the plan:\n\n- Required sections and their purposes\n- Intended document structure and organization hierarchy\n- Target audience and documentation purpose\n- Expected level of detail and technical depth\n- Content coverage scope and boundaries\n\nThe enhancer uses this plan to ensure the improved content aligns with the\noriginal architectural vision while meeting all quality standards and\ncompleteness requirements.",
type: "string"
},
content: {
description: "Enhanced, production-ready markdown document.\n\nINPUT: The document written by Write Agent (may have quality issues)\nOUTPUT: The enhanced, complete markdown document ready for production use\n\nEnhancement transformation requirements:\n\n- Fix all Mermaid syntax errors (add quotes, fix arrows, proper formatting)\n- Convert vague statements to EARS format with specific conditions\n- Expand sections that are too brief with comprehensive business context\n- Add missing business processes and workflow descriptions\n- Ensure all sections meet minimum length requirements\n- Validate and correct all internal and external links\n- Remove any database schema or API specification details\n- Enhance business model descriptions with natural language clarity\n- Improve requirements specificity and measurability\n\nOutput characteristics:\n\n- Must be the actual enhanced document content (not review comments)\n- Must be valid markdown with proper formatting\n- Must meet all quality criteria specified in review field\n- Must align with the original plan structure\n- Must be implementation-ready for subsequent pipeline phases\n\nThe enhanced document serves as the authoritative requirements specification\nthat will guide all downstream generation phases (Prisma, Interface, Test,\nRealize).",
type: "string"
}
},
required: [
"type",
"review",
"plan",
"content"
]
}
}
},
description: "Process document enhancement task or preliminary data requests.\n\nEnhances and finalizes planning documentation by retrieving necessary\nanalysis files via RAG (Retrieval-Augmented Generation) and producing\nimproved, complete markdown documents ready for production use.",
validate: (() => { const _io0 = input => "string" === typeof input.thinking && ("object" === typeof input.request && null !== input.request && _iu0(input.request)); const _io1 = input => "getAnalysisFiles" === input.type && (Array.isArray(input.fileNames) && (1 <= input.fileNames.length && input.fileNames.every(elem => "string" === typeof elem))); const _io2 = input => "complete" === input.type && "string" === typeof input.review && "string" === typeof input.plan && "string" === typeof input.content; const _iu0 = input => (() => {
if ("getAnalysisFiles" === input.type)
return _io1(input);
else if ("complete" === input.type)
return _io2(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