UNPKG

@autobe/agent

Version:

AI backend server code generator

847 lines (846 loc) 77.1 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.orchestrateAnalyzeSectionCrossFileReview = void 0; const __typia_transform__isTypeUint32 = __importStar(require("typia/lib/internal/_isTypeUint32")); const __typia_transform__accessExpressionAsString = __importStar(require("typia/lib/internal/_accessExpressionAsString")); const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport")); const __typia_transform__llmApplicationFinalize = __importStar(require("typia/lib/internal/_llmApplicationFinalize")); const tstl_1 = require("tstl"); const typia_1 = __importDefault(require("typia")); const uuid_1 = require("uuid"); const AutoBePreliminaryController_1 = require("../common/AutoBePreliminaryController"); const transformAnalyzeSectionCrossFileReviewHistory_1 = require("./histories/transformAnalyzeSectionCrossFileReviewHistory"); /** * Orchestrate cross-file lightweight review of section metadata across ALL * files. * * This function reviews all files' section metadata (titles, keywords, * purposes) together in a single LLM call, providing cross-file validation for * terminology alignment, value consistency, naming conventions, and content * deduplication. * * Unlike the per-file review which checks full content, this review only * receives lightweight metadata to stay within context limits. */ const orchestrateAnalyzeSectionCrossFileReview = (ctx, props) => __awaiter(void 0, void 0, void 0, function* () { const preliminary = new AutoBePreliminaryController_1.AutoBePreliminaryController({ application: { version: "3.1", components: { schemas: { "IAutoBeAnalyzeSectionCrossFileReviewApplication.IProps": { type: "object", properties: { thinking: { oneOf: [ { type: "null" }, { type: "string" } ], description: "Reasoning: what's missing (preliminary), what you're submitting (write),\nor why you're finalizing (complete)." }, request: { oneOf: [ { $ref: "#/components/schemas/IAutoBePreliminaryComplete" }, { $ref: "#/components/schemas/IAutoBePreliminaryGetPreviousAnalysisSections" }, { $ref: "#/components/schemas/IAutoBeAnalyzeSectionCrossFileReviewApplication.IWrite" } ], discriminator: { propertyName: "type", mapping: { complete: "#/components/schemas/IAutoBePreliminaryComplete", getPreviousAnalysisSections: "#/components/schemas/IAutoBePreliminaryGetPreviousAnalysisSections", write: "#/components/schemas/IAutoBeAnalyzeSectionCrossFileReviewApplication.IWrite" } }, description: "Action to perform. Review your own write output \u2014 call `complete` if\nsatisfied, or submit another `write` to improve (3 writes maximum).\nExhausted preliminary types are removed from the union." } }, required: [ "request" ] }, IAutoBePreliminaryComplete: { type: "object", properties: { type: { "const": "complete", description: "Type discriminator for completion request." } }, required: [ "type" ], description: "Finalize the write loop by accepting your most recent `write` as-is.\n\nAfter submitting a `write`, review it yourself thoroughly against the review\nchecklist in your instructions. If you find issues worth fixing, submit\nanother `write` with corrections. When you are satisfied with the quality,\ncall `complete` to finalize.\n\nYou have a maximum of 3 write attempts, but this is a safety cap \u2014 not a\ntarget to fill.\n\nOnly valid after at least one `write` submission \u2014 rejected otherwise." }, IAutoBePreliminaryGetPreviousAnalysisSections: { type: "object", properties: { type: { "const": "getPreviousAnalysisSections", description: "Type discriminator." }, sectionIds: { type: "array", items: { type: "integer", minimum: 0 }, minItems: 1, description: "Section IDs to retrieve from previous iteration. DO NOT request same IDs\nalready requested in previous calls." } }, required: [ "type", "sectionIds" ], description: "Request to retrieve analysis sections from the previous iteration by numeric\nID." }, "IAutoBeAnalyzeSectionCrossFileReviewApplication.IWrite": { type: "object", properties: { type: { "const": "write", description: "Type discriminator for write submission." }, fileResults: { type: "array", items: { $ref: "#/components/schemas/IAutoBeAnalyzeSectionCrossFileReviewApplication.IFileResult" }, description: "Per-file review results." } }, required: [ "type", "fileResults" ], description: "Submit the cross-file section consistency review with per-file verdicts." }, "IAutoBeAnalyzeSectionCrossFileReviewApplication.IFileResult": { type: "object", properties: { fileIndex: { type: "number", description: "Index of the file in the scenario's files array." }, approved: { type: "boolean", description: "Whether this file's sections are consistent with other files." }, feedback: { type: "string", description: "Cross-file consistency feedback. For rejected files, describe specific\ninconsistencies." }, issues: { oneOf: [ { type: "null" }, { type: "array", items: { $ref: "#/components/schemas/IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue" } } ], description: "Structured review issues for targeted rewrites. Optional for backward\ncompatibility." }, rejectedModuleUnits: { oneOf: [ { type: "null" }, { type: "array", items: { $ref: "#/components/schemas/IAutoBeAnalyzeSectionCrossFileReviewApplication.IRejectedModuleUnit" } } ], description: "Module/unit pairs with cross-file consistency issues. Only these are\nregenerated on retry. Set to null if all module/units need regeneration,\nor if approving." } }, required: [ "fileIndex", "approved", "feedback", "rejectedModuleUnits" ], description: "Per-file review result from cross-file consistency check." }, "IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue": { type: "object", properties: { ruleCode: { type: "string", description: "Rule violation code (e.g., \"TERM-001\", \"VALUE-002\")." }, moduleIndex: { oneOf: [ { type: "null" }, { type: "number" } ], description: "Module index where the issue was found, or null if file-level." }, unitIndex: { oneOf: [ { type: "null" }, { type: "number" } ], description: "Unit index where the issue was found, or null if module-level." }, sectionIndex: { oneOf: [ { type: "null" }, { type: "number" } ], description: "Section index where the issue was found, or null if unit-level." }, fixInstruction: { type: "string", description: "Specific instruction for fixing this issue." }, evidence: { oneOf: [ { type: "null" }, { type: "string" } ], description: "Supporting evidence from the source text." } }, required: [ "ruleCode", "moduleIndex", "unitIndex", "fixInstruction" ], description: "A specific review issue found during cross-file consistency check." }, "IAutoBeAnalyzeSectionCrossFileReviewApplication.IRejectedModuleUnit": { type: "object", properties: { moduleIndex: { type: "number", description: "Index of the module section." }, unitIndices: { type: "array", items: { type: "number" }, description: "Unit indices needing section regeneration." }, feedback: { type: "string", description: "Feedback for this module/unit group's issues." }, issues: { oneOf: [ { type: "null" }, { type: "array", items: { $ref: "#/components/schemas/IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue" } } ], description: "Structured issues scoped to this module/unit group. Optional for backward\ncompatibility." }, sectionIndicesPerUnit: { oneOf: [ { type: "null" }, { $ref: "#/components/schemas/RecordnumberArraynumber" } ], description: "Per-unit mapping of section indices needing regeneration. When null or a\nunitIndex is absent, ALL sections for that unit are regenerated." } }, required: [ "moduleIndex", "unitIndices", "feedback" ], description: "Identifies specific module/unit pairs whose sections were rejected." }, RecordnumberArraynumber: { type: "object", properties: {}, required: [], description: "Construct a type with a set of properties K of type T", additionalProperties: { type: "array", items: { type: "number" } } } } }, functions: [ { name: "process", async: false, parameters: [ { name: "props", required: true, schema: { $ref: "#/components/schemas/IAutoBeAnalyzeSectionCrossFileReviewApplication.IProps" } } ], description: "Review section metadata across all files for cross-file consistency." } ] }, source: SOURCE, kinds: ["previousAnalysisSections", "complete"], state: ctx.state(), dispatch: (e) => ctx.dispatch(e), }); const counter = new tstl_1.Singleton(() => ++props.progress.completed); const event = 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({ pointer, preliminary, }), enforceFunctionCall: true, promptCacheKey: props.promptCacheKey }, (0, transformAnalyzeSectionCrossFileReviewHistory_1.transformAnalyzeSectionCrossFileReviewHistory)(ctx, { scenario: props.scenario, allFileSummaries: props.allFileSummaries, mechanicalViolationSummary: props.mechanicalViolationSummary, fileDecisions: props.fileDecisions, preliminary, }))); if (pointer.value === null) return out(result)(null); const event = { type: SOURCE, id: (0, uuid_1.v7)(), fileResults: pointer.value.fileResults.map((fr) => { var _a; return (Object.assign(Object.assign({}, fr), { revisedSections: null, rejectedModuleUnits: (_a = fr.rejectedModuleUnits) !== null && _a !== void 0 ? _a : null })); }), acquisition: preliminary.getAcquisition(), tokenUsage: result.tokenUsage, metric: result.metric, step: ((_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : -1) + 1, total: props.progress.total, completed: counter.get(), retry: props.retry, created_at: new Date().toISOString(), }; return out(result)(event); })); ctx.dispatch(event); return event; }); exports.orchestrateAnalyzeSectionCrossFileReview = orchestrateAnalyzeSectionCrossFileReview; function createController(props) { const validate = (input) => { var _a; const result = (() => { const _io0 = input => (null === input.thinking || undefined === input.thinking || "string" === typeof input.thinking) && ("object" === typeof input.request && null !== input.request && _iu0(input.request)); const _io1 = input => "complete" === input.type; const _io2 = input => "getPreviousAnalysisSections" === input.type && (Array.isArray(input.sectionIds) && (1 <= input.sectionIds.length && input.sectionIds.every(elem => "number" === typeof elem && __typia_transform__isTypeUint32._isTypeUint32(elem)))); const _io3 = input => "write" === input.type && (Array.isArray(input.fileResults) && input.fileResults.every(elem => "object" === typeof elem && null !== elem && _io4(elem))); const _io4 = input => "number" === typeof input.fileIndex && "boolean" === typeof input.approved && "string" === typeof input.feedback && (null === input.issues || undefined === input.issues || Array.isArray(input.issues) && input.issues.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (null === input.rejectedModuleUnits || Array.isArray(input.rejectedModuleUnits) && input.rejectedModuleUnits.every(elem => "object" === typeof elem && null !== elem && _io6(elem))); const _io5 = input => "string" === typeof input.ruleCode && (null === input.moduleIndex || "number" === typeof input.moduleIndex) && (null === input.unitIndex || "number" === typeof input.unitIndex) && (null === input.sectionIndex || undefined === input.sectionIndex || "number" === typeof input.sectionIndex) && "string" === typeof input.fixInstruction && (null === input.evidence || undefined === input.evidence || "string" === typeof input.evidence); const _io6 = input => "number" === typeof input.moduleIndex && (Array.isArray(input.unitIndices) && input.unitIndices.every(elem => "number" === typeof elem)) && "string" === typeof input.feedback && (null === input.issues || undefined === input.issues || Array.isArray(input.issues) && input.issues.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (null === input.sectionIndicesPerUnit || undefined === input.sectionIndicesPerUnit || "object" === typeof input.sectionIndicesPerUnit && null !== input.sectionIndicesPerUnit && false === Array.isArray(input.sectionIndicesPerUnit) && _io7(input.sectionIndicesPerUnit)); const _io7 = input => Object.keys(input).every(key => { const value = input[key]; if (undefined === value) return true; if ("number" === typeof Number(key)) return Array.isArray(value) && value.every(elem => "number" === typeof elem); return true; }); const _iu0 = input => (() => { if ("complete" === input.type) return _io1(input); else if ("getPreviousAnalysisSections" === input.type) return _io2(input); else if ("write" === input.type) return _io3(input); else return false; })(); const _vo0 = (input, _path, _exceptionable = true) => [null === input.thinking || undefined === input.thinking || "string" === typeof input.thinking || _report(_exceptionable, { path: _path + ".thinking", expected: "(null | string | undefined)", value: input.thinking }), ("object" === typeof input.request && null !== input.request || _report(_exceptionable, { path: _path + ".request", expected: "(IAutoBeAnalyzeSectionCrossFileReviewApplication.IWrite | IAutoBePreliminaryComplete | IAutoBePreliminaryGetPreviousAnalysisSections)", value: input.request })) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, { path: _path + ".request", expected: "(IAutoBeAnalyzeSectionCrossFileReviewApplication.IWrite | IAutoBePreliminaryComplete | IAutoBePreliminaryGetPreviousAnalysisSections)", value: input.request })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["complete" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"complete\"", value: input.type })].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["getPreviousAnalysisSections" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"getPreviousAnalysisSections\"", value: input.type }), (Array.isArray(input.sectionIds) || _report(_exceptionable, { path: _path + ".sectionIds", expected: "(Array<number & Type<\"uint32\">> & MinItems<1>)", value: input.sectionIds })) && ((1 <= input.sectionIds.length || _report(_exceptionable, { path: _path + ".sectionIds", expected: "Array<> & MinItems<1>", value: input.sectionIds })) && input.sectionIds.map((elem, _index8) => "number" === typeof elem && (__typia_transform__isTypeUint32._isTypeUint32(elem) || _report(_exceptionable, { path: _path + ".sectionIds[" + _index8 + "]", expected: "number & Type<\"uint32\">", value: elem })) || _report(_exceptionable, { path: _path + ".sectionIds[" + _index8 + "]", expected: "(number & Type<\"uint32\">)", value: elem })).every(flag => flag)) || _report(_exceptionable, { path: _path + ".sectionIds", expected: "(Array<number & Type<\"uint32\">> & MinItems<1>)", value: input.sectionIds })].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["write" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"write\"", value: input.type }), (Array.isArray(input.fileResults) || _report(_exceptionable, { path: _path + ".fileResults", expected: "Array<IAutoBeAnalyzeSectionCrossFileReviewApplication.IFileResult>", value: input.fileResults })) && input.fileResults.map((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".fileResults[" + _index9 + "]", expected: "IAutoBeAnalyzeSectionCrossFileReviewApplication.IFileResult", value: elem })) && _vo4(elem, _path + ".fileResults[" + _index9 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".fileResults[" + _index9 + "]", expected: "IAutoBeAnalyzeSectionCrossFileReviewApplication.IFileResult", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".fileResults", expected: "Array<IAutoBeAnalyzeSectionCrossFileReviewApplication.IFileResult>", value: input.fileResults })].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["number" === typeof input.fileIndex || _report(_exceptionable, { path: _path + ".fileIndex", expected: "number", value: input.fileIndex }), "boolean" === typeof input.approved || _report(_exceptionable, { path: _path + ".approved", expected: "boolean", value: input.approved }), "string" === typeof input.feedback || _report(_exceptionable, { path: _path + ".feedback", expected: "string", value: input.feedback }), null === input.issues || undefined === input.issues || (Array.isArray(input.issues) || _report(_exceptionable, { path: _path + ".issues", expected: "(Array<IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue> | null | undefined)", value: input.issues })) && input.issues.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".issues[" + _index10 + "]", expected: "IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue", value: elem })) && _vo5(elem, _path + ".issues[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".issues[" + _index10 + "]", expected: "IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".issues", expected: "(Array<IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue> | null | undefined)", value: input.issues }), null === input.rejectedModuleUnits || (Array.isArray(input.rejectedModuleUnits) || _report(_exceptionable, { path: _path + ".rejectedModuleUnits", expected: "(Array<IAutoBeAnalyzeSectionCrossFileReviewApplication.IRejectedModuleUnit> | null)", value: input.rejectedModuleUnits })) && input.rejectedModuleUnits.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".rejectedModuleUnits[" + _index11 + "]", expected: "IAutoBeAnalyzeSectionCrossFileReviewApplication.IRejectedModuleUnit", value: elem })) && _vo6(elem, _path + ".rejectedModuleUnits[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".rejectedModuleUnits[" + _index11 + "]", expected: "IAutoBeAnalyzeSectionCrossFileReviewApplication.IRejectedModuleUnit", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".rejectedModuleUnits", expected: "(Array<IAutoBeAnalyzeSectionCrossFileReviewApplication.IRejectedModuleUnit> | null)", value: input.rejectedModuleUnits })].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => ["string" === typeof input.ruleCode || _report(_exceptionable, { path: _path + ".ruleCode", expected: "string", value: input.ruleCode }), null === input.moduleIndex || "number" === typeof input.moduleIndex || _report(_exceptionable, { path: _path + ".moduleIndex", expected: "(null | number)", value: input.moduleIndex }), null === input.unitIndex || "number" === typeof input.unitIndex || _report(_exceptionable, { path: _path + ".unitIndex", expected: "(null | number)", value: input.unitIndex }), null === input.sectionIndex || undefined === input.sectionIndex || "number" === typeof input.sectionIndex || _report(_exceptionable, { path: _path + ".sectionIndex", expected: "(null | number | undefined)", value: input.sectionIndex }), "string" === typeof input.fixInstruction || _report(_exceptionable, { path: _path + ".fixInstruction", expected: "string", value: input.fixInstruction }), null === input.evidence || undefined === input.evidence || "string" === typeof input.evidence || _report(_exceptionable, { path: _path + ".evidence", expected: "(null | string | undefined)", value: input.evidence })].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => ["number" === typeof input.moduleIndex || _report(_exceptionable, { path: _path + ".moduleIndex", expected: "number", value: input.moduleIndex }), (Array.isArray(input.unitIndices) || _report(_exceptionable, { path: _path + ".unitIndices", expected: "Array<number>", value: input.unitIndices })) && input.unitIndices.map((elem, _index12) => "number" === typeof elem || _report(_exceptionable, { path: _path + ".unitIndices[" + _index12 + "]", expected: "number", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".unitIndices", expected: "Array<number>", value: input.unitIndices }), "string" === typeof input.feedback || _report(_exceptionable, { path: _path + ".feedback", expected: "string", value: input.feedback }), null === input.issues || undefined === input.issues || (Array.isArray(input.issues) || _report(_exceptionable, { path: _path + ".issues", expected: "(Array<IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue> | null | undefined)", value: input.issues })) && input.issues.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".issues[" + _index13 + "]", expected: "IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue", value: elem })) && _vo5(elem, _path + ".issues[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".issues[" + _index13 + "]", expected: "IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".issues", expected: "(Array<IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue> | null | undefined)", value: input.issues }), null === input.sectionIndicesPerUnit || undefined === input.sectionIndicesPerUnit || ("object" === typeof input.sectionIndicesPerUnit && null !== input.sectionIndicesPerUnit && false === Array.isArray(input.sectionIndicesPerUnit) || _report(_exceptionable, { path: _path + ".sectionIndicesPerUnit", expected: "(Record<number, Array<number>> | null | undefined)", value: input.sectionIndicesPerUnit })) && _vo7(input.sectionIndicesPerUnit, _path + ".sectionIndicesPerUnit", true && _exceptionable) || _report(_exceptionable, { path: _path + ".sectionIndicesPerUnit", expected: "(Record<number, Array<number>> | null | undefined)", value: input.sectionIndicesPerUnit })].every(flag => flag); const _vo7 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => { const value = input[key]; if (undefined === value) return true; if ("number" === typeof Number(key)) return (Array.isArray(value) || _report(_exceptionable, { path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), expected: "Array<number>", value: value })) && value.map((elem, _index14) => "number" === typeof elem || _report(_exceptionable, { path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key) + "[" + _index14 + "]", expected: "number", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), expected: "Array<number>", value: value }); return true; }).every(flag => flag)].every(flag => flag); const _vu0 = (input, _path, _exceptionable = true) => (() => { if ("complete" === input.type) return _vo1(input, _path, true && _exceptionable); else if ("getPreviousAnalysisSections" === input.type) return _vo2(input, _path, true && _exceptionable); else if ("write" === input.type) return _vo3(input, _path, true && _exceptionable); else return _report(_exceptionable, { path: _path, expected: "(IAutoBePreliminaryComplete | IAutoBePreliminaryGetPreviousAnalysisSections | IAutoBeAnalyzeSectionCrossFileReviewApplication.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: "IAutoBeAnalyzeSectionCrossFileReviewApplication.IProps", value: input })) && _vo0(input, _path + "", true) || _report(true, { path: _path + "", expected: "IAutoBeAnalyzeSectionCrossFileReviewApplication.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 === "write") return result; return props.preliminary.validate({ thinking: (_a = result.data.thinking) !== null && _a !== void 0 ? _a : "", request: result.data.request, }); }; const application = props.preliminary.fixApplication(__typia_transform__llmApplicationFinalize._llmApplicationFinalize({ functions: [ { name: "process", parameters: { description: "Current Type: {@link IAutoBeAnalyzeSectionCrossFileReviewApplication.IProps}", type: "object", properties: { thinking: { description: "Reasoning: what's missing (preliminary), what you're submitting (write),\nor why you're finalizing (complete).", anyOf: [ { type: "null" }, { type: "string" } ] }, request: { description: "Action to perform. Review your own write output \u2014 call `complete` if\nsatisfied, or submit another `write` to improve (3 writes maximum).\nExhausted preliminary types are removed from the union.", anyOf: [ { $ref: "#/$defs/IAutoBePreliminaryComplete" }, { $ref: "#/$defs/IAutoBePreliminaryGetPreviousAnalysisSections" }, { $ref: "#/$defs/IAutoBeAnalyzeSectionCrossFileReviewApplication.IWrite" } ], "x-discriminator": { propertyName: "type", mapping: { complete: "#/$defs/IAutoBePreliminaryComplete", getPreviousAnalysisSections: "#/$defs/IAutoBePreliminaryGetPreviousAnalysisSections", write: "#/$defs/IAutoBeAnalyzeSectionCrossFileReviewApplication.IWrite" } } } }, required: [ "request" ], additionalProperties: false, $defs: { IAutoBePreliminaryComplete: { description: "Finalize the write loop by accepting your most recent `write` as-is.\n\nAfter submitting a `write`, review it yourself thoroughly against the review\nchecklist in your instructions. If you find issues worth fixing, submit\nanother `write` with corrections. When you are satisfied with the quality,\ncall `complete` to finalize.\n\nYou have a maximum of 3 write attempts, but this is a safety cap \u2014 not a\ntarget to fill.\n\nOnly valid after at least one `write` submission \u2014 rejected otherwise.", type: "object", properties: { type: { description: "Type discriminator for completion request.", type: "string", "enum": [ "complete" ] } }, required: [ "type" ] }, IAutoBePreliminaryGetPreviousAnalysisSections: { description: "Request to retrieve analysis sections from the previous iteration by numeric\nID.", type: "object", properties: { type: { description: "Type discriminator.", type: "string", "enum": [ "getPreviousAnalysisSections" ] }, sectionIds: { description: "Section IDs to retrieve from previous iteration. DO NOT request same IDs\nalready requested in previous calls.", type: "array", items: { type: "integer", minimum: 0 }, minItems: 1 } }, required: [ "type", "sectionIds" ] }, "IAutoBeAnalyzeSectionCrossFileReviewApplication.IWrite": { description: "Submit the cross-file section consistency review with per-file verdicts.", type: "object", properties: { type: { description: "Type discriminator for write submission.", type: "string", "enum": [ "write" ] }, fileResults: { description: "Per-file review results.", type: "array", items: { $ref: "#/$defs/IAutoBeAnalyzeSectionCrossFileReviewApplication.IFileResult" } } }, required: [ "type", "fileResults" ] }, "IAutoBeAnalyzeSectionCrossFileReviewApplication.IFileResult": { description: "Per-file review result from cross-file consistency check.", type: "object", properties: { fileIndex: { description: "Index of the file in the scenario's files array.", type: "number" }, approved: { description: "Whether this file's sections are consistent with other files.", type: "boolean" }, feedback: { description: "Cross-file consistency feedback. For rejected files, describe specific\ninconsistencies.", type: "string" }, issues: { description: "Structured review issues for targeted rewrites. Optional for backward\ncompatibility.", anyOf: [ { type: "null" }, { type: "array", items: { $ref: "#/$defs/IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue" } } ] }, rejectedModuleUnits: { description: "Module/unit pairs with cross-file consistency issues. Only these are\nregenerated on retry. Set to null if all module/units need regeneration,\nor if approving.", anyOf: [ { type: "null" }, { type: "array", items: { $ref: "#/$defs/IAutoBeAnalyzeSectionCrossFileReviewApplication.IRejectedModuleUnit" } } ] } }, required: [ "fileIndex", "approved", "feedback", "rejectedModuleUnits" ] }, "IAutoBeAnalyzeSectionCrossFileReviewApplication.IReviewIssue": { description: "A specific review issue found during cross-file consistency check.", type: "object", properties: { ruleCode: { description: "Rule violation code (e.g., \"TERM-001\", \"VALUE-002\").", type: "string"