UNPKG

@autobe/agent

Version:

AI backend server code generator

743 lines 47.9 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.orchestrateAnalyzeWriteSectionPatch = 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 tstl_1 = require("tstl"); const typia_1 = __importDefault(require("typia")); const uuid_1 = require("uuid"); const validateEnglishOnly_1 = require("../../utils/validateEnglishOnly"); const AutoBePreliminaryController_1 = require("../common/AutoBePreliminaryController"); const transformAnalyzeWriteSectionPatchHistory_1 = require("./histories/transformAnalyzeWriteSectionPatchHistory"); const buildHardValidators_1 = require("./utils/buildHardValidators"); const detectInventedEntities_1 = require("./utils/detectInventedEntities"); const orchestrateAnalyzeWriteSectionPatch = (ctx, props) => __awaiter(void 0, void 0, void 0, function* () { const preliminary = new AutoBePreliminaryController_1.AutoBePreliminaryController({ application: { version: "3.1", components: { schemas: { "IAutoBeAnalyzeWriteSectionApplication.IProps": { type: "object", properties: { thinking: { oneOf: [ { type: "null" }, { type: "string" } ], description: "Think before you act.\n\nBefore requesting preliminary data or completing your task, reflect on\nyour current state and explain your reasoning:\n\nFor preliminary requests:\n\n- What additional context do you need for detailed content?\n\nFor write submissions:\n\n- If this is an initial write, summarize your plan.\n- If this is a revision, what issues are you improving and how?\n\nFor complete:\n\n- State why you consider the last write final." }, request: { oneOf: [ { $ref: "#/components/schemas/IAutoBePreliminaryComplete" }, { $ref: "#/components/schemas/IAutoBePreliminaryGetPreviousAnalysisSections" }, { $ref: "#/components/schemas/IAutoBeAnalyzeWriteSectionApplication.IWrite" } ], discriminator: { propertyName: "type", mapping: { complete: "#/components/schemas/IAutoBePreliminaryComplete", getPreviousAnalysisSections: "#/components/schemas/IAutoBePreliminaryGetPreviousAnalysisSections", write: "#/components/schemas/IAutoBeAnalyzeWriteSectionApplication.IWrite" } }, description: "Action to perform. Exhausted preliminary types are removed from the\nunion." } }, 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." }, "IAutoBeAnalyzeWriteSectionApplication.IWrite": { type: "object", properties: { type: { "const": "write", description: "Type discriminator for write submission." }, moduleIndex: { type: "number", description: "Index of the grandparent module section." }, unitIndex: { type: "number", description: "Index of the parent unit section." }, sectionSections: { type: "array", items: { $ref: "#/components/schemas/IAutoBeAnalyzeWriteSectionApplication.ISectionOfSection" }, description: "Array of sections for this unit section.\n\nEach section represents a detailed subsection (#### level) containing\nspecific requirements, specifications, or process descriptions. The\ncontent should:\n\n- Use EARS format for requirements in 03-functional-requirements and\n 04-business-rules files; use natural language prose for other files\n- Include Mermaid diagrams with proper syntax\n- Be specific and implementation-ready\n- Avoid prohibited content (DB schemas, API specs)" } }, required: [ "type", "moduleIndex", "unitIndex", "sectionSections" ], description: "Submit section content for review.\n\nThe submitted content should use English-only text, technology-neutral\nlanguage, and correct entity references." }, "IAutoBeAnalyzeWriteSectionApplication.ISectionOfSection": { type: "object", properties: { title: { type: "string", description: "Title of the section (#### level heading).\n\nShould clearly indicate the specific requirement, process, or feature\nbeing detailed." }, content: { type: "string", description: "Complete content for the section.\n\nContains detailed requirements, specifications, and diagrams. Content\nguidelines:\n\nEARS Format (ONLY for 03-functional-requirements, 04-business-rules):\n\n- Ubiquitous: \"THE <system> SHALL <function>\"\n- Event-driven: \"WHEN <trigger>, THE <system> SHALL <function>\"\n- State-driven: \"WHILE <state>, THE <system> SHALL <function>\"\n- Unwanted: \"IF <condition>, THEN THE <system> SHALL <function>\"\n- Optional: \"WHERE <feature>, THE <system> SHALL <function>\"\n\nNatural Language (for 00-toc, 01-actors-and-auth, 02-domain-model,\n05-non-functional):\n\n- Use clear, descriptive prose for definitions, concepts, and policies\n- Focus on readability over formal structure\n- Tables and bullet points are preferred for structured data\n\nMermaid Diagram Rules:\n\n- ALL labels must use double quotes: A[\"User Login\"]\n- NO spaces between brackets and quotes\n- Arrow syntax: --> (NOT --|)\n- LR orientation preferred for flowcharts\n\nProhibited Content:\n\n- Database schemas or ERD\n- API endpoint specifications\n- Technical implementation details\n- Frontend UI/UX specifications\n\nHallucination Prevention:\n\n- Every requirement must trace to the original user input\n- Do NOT invent SLA numbers, timeout values, or performance targets\n- Do NOT add security mechanisms (2FA, JWT, encryption) user did not\n mention\n- Do NOT add infrastructure requirements (CDN, caching) user did not\n mention\n- 05-non-functional: only describe aspects the user explicitly mentioned\n\nConciseness:\n\n- One concept = one section, not multiple sections rephrasing the same idea\n- 02-domain-model: max 1-3 sections per business concept" } }, required: [ "title", "content" ], description: "Structure representing a single section." } } }, functions: [ { name: "process", async: false, parameters: [ { name: "props", description: " Request containing preliminary data request, write submission,\nor completion signal", required: true, schema: { $ref: "#/components/schemas/IAutoBeAnalyzeWriteSectionApplication.IProps" } } ], description: "Process section generation, write submission, or preliminary data requests.\n\nSubmit section content via `write`, then review your own output. Call\n`complete` if satisfied, or submit another `write` to improve (3 writes\nmaximum)." } ] }, 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, scenarioEntityNames: props.scenarioEntityNames, }), enforceFunctionCall: true, promptCacheKey: props.promptCacheKey }, (0, transformAnalyzeWriteSectionPatchHistory_1.transformAnalyzeWriteSectionPatchHistory)(ctx, { scenario: props.scenario, file: props.file, moduleEvent: props.moduleEvent, unitEvent: props.unitEvent, moduleIndex: props.moduleIndex, unitIndex: props.unitIndex, previousSectionEvent: props.previousSectionEvent, feedback: props.feedback, preliminary, sectionIndices: props.sectionIndices, }))); if (pointer.value === null) return out(result)(null); // Section-level merge: preserve originals for non-targeted sections let finalSectionSections = pointer.value.sectionSections; if (props.sectionIndices != null && props.sectionIndices.length > 0 && props.previousSectionEvent.sectionSections.length === pointer.value.sectionSections.length) { const targetSet = new Set(props.sectionIndices); finalSectionSections = pointer.value.sectionSections.map((section, idx) => targetSet.has(idx) ? section : props.previousSectionEvent.sectionSections[idx]); } const event = { type: SOURCE, id: (0, uuid_1.v7)(), moduleIndex: pointer.value.moduleIndex, unitIndex: pointer.value.unitIndex, sectionSections: finalSectionSections, 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.orchestrateAnalyzeWriteSectionPatch = orchestrateAnalyzeWriteSectionPatch; 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 && "number" === typeof input.moduleIndex && "number" === typeof input.unitIndex && (Array.isArray(input.sectionSections) && input.sectionSections.every(elem => "object" === typeof elem && null !== elem && _io4(elem))); const _io4 = input => "string" === typeof input.title && "string" === typeof input.content; 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: "(IAutoBeAnalyzeWriteSectionApplication.IWrite | IAutoBePreliminaryComplete | IAutoBePreliminaryGetPreviousAnalysisSections)", value: input.request })) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, { path: _path + ".request", expected: "(IAutoBeAnalyzeWriteSectionApplication.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, _index3) => "number" === typeof elem && (__typia_transform__isTypeUint32._isTypeUint32(elem) || _report(_exceptionable, { path: _path + ".sectionIds[" + _index3 + "]", expected: "number & Type<\"uint32\">", value: elem })) || _report(_exceptionable, { path: _path + ".sectionIds[" + _index3 + "]", 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 }), "number" === typeof input.moduleIndex || _report(_exceptionable, { path: _path + ".moduleIndex", expected: "number", value: input.moduleIndex }), "number" === typeof input.unitIndex || _report(_exceptionable, { path: _path + ".unitIndex", expected: "number", value: input.unitIndex }), (Array.isArray(input.sectionSections) || _report(_exceptionable, { path: _path + ".sectionSections", expected: "Array<IAutoBeAnalyzeWriteSectionApplication.ISectionOfSection>", value: input.sectionSections })) && input.sectionSections.map((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".sectionSections[" + _index4 + "]", expected: "IAutoBeAnalyzeWriteSectionApplication.ISectionOfSection", value: elem })) && _vo4(elem, _path + ".sectionSections[" + _index4 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".sectionSections[" + _index4 + "]", expected: "IAutoBeAnalyzeWriteSectionApplication.ISectionOfSection", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".sectionSections", expected: "Array<IAutoBeAnalyzeWriteSectionApplication.ISectionOfSection>", value: input.sectionSections })].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.title || _report(_exceptionable, { path: _path + ".title", expected: "string", value: input.title }), "string" === typeof input.content || _report(_exceptionable, { path: _path + ".content", expected: "string", value: input.content })].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 | IAutoBeAnalyzeWriteSectionApplication.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: "IAutoBeAnalyzeWriteSectionApplication.IProps", value: input })) && _vo0(input, _path + "", true) || _report(true, { path: _path + "", expected: "IAutoBeAnalyzeWriteSectionApplication.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; // Validate English-only content for complete requests if (result.data.request.type === "write") { const englishValidation = (0, validateEnglishOnly_1.validateSectionSectionContent)(result.data.request.sectionSections); if (!englishValidation.valid) { return { success: false, errors: englishValidation.errors.map((error) => ({ path: "$input.request.sectionSections", expected: "English-only content (no Chinese, Korean, Japanese)", value: error, })), data: result.data, }; } // Validate no technology lock-in const techViolations = (0, buildHardValidators_1.detectTechLockin)(result.data.request.sectionSections); if (techViolations.length > 0) { return { success: false, errors: techViolations.map((error) => ({ path: "$input.request.sectionSections", expected: "Technology-neutral content (no specific DB/framework/infrastructure names)", value: error, })), data: result.data, }; } // Validate no invented entities (P0-B) if (props.scenarioEntityNames && props.scenarioEntityNames.length > 0) { const inventionViolations = (0, detectInventedEntities_1.detectInventedEntities)(result.data.request.sectionSections, props.scenarioEntityNames); if (inventionViolations.length > 0) { return { success: false, errors: inventionViolations.map((error) => ({ path: "$input.request.sectionSections", expected: `Only entities from scenario catalog: ${props.scenarioEntityNames.join(", ")}`, value: error, })), data: result.data, }; } } 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 IAutoBeAnalyzeWriteSectionApplication.IProps}", type: "object", properties: { thinking: { description: "Think before you act.\n\nBefore requesting preliminary data or completing your task, reflect on\nyour current state and explain your reasoning:\n\nFor preliminary requests:\n\n- What additional context do you need for detailed content?\n\nFor write submissions:\n\n- If this is an initial write, summarize your plan.\n- If this is a revision, what issues are you improving and how?\n\nFor complete:\n\n- State why you consider the last write final.", anyOf: [ { type: "null" }, { type: "string" } ] }, request: { description: "Action to perform. Exhausted preliminary types are removed from the\nunion.", anyOf: [ { $ref: "#/$defs/IAutoBePreliminaryComplete" }, { $ref: "#/$defs/IAutoBePreliminaryGetPreviousAnalysisSections" }, { $ref: "#/$defs/IAutoBeAnalyzeWriteSectionApplication.IWrite" } ], "x-discriminator": { propertyName: "type", mapping: { complete: "#/$defs/IAutoBePreliminaryComplete", getPreviousAnalysisSections: "#/$defs/IAutoBePreliminaryGetPreviousAnalysisSections", write: "#/$defs/IAutoBeAnalyzeWriteSectionApplication.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" ] }, "IAutoBeAnalyzeWriteSectionApplication.IWrite": { description: "Submit section content for review.\n\nThe submitted content should use English-only text, technology-neutral\nlanguage, and correct entity references.", type: "object", properties: { type: { description: "Type discriminator for write submission.", type: "string", "enum": [ "write" ] }, moduleIndex: { description: "Index of the grandparent module section.", type: "number" }, unitIndex: { description: "Index of the parent unit section.", type: "number" }, sectionSections: { description: "Array of sections for this unit section.\n\nEach section represents a detailed subsection (#### level) containing\nspecific requirements, specifications, or process descriptions. The\ncontent should:\n\n- Use EARS format for requirements in 03-functional-requirements and\n 04-business-rules files; use natural language prose for other files\n- Include Mermaid diagrams with proper syntax\n- Be specific and implementation-ready\n- Avoid prohibited content (DB schemas, API specs)", type: "array", items: { $ref: "#/$defs/IAutoBeAnalyzeWriteSectionApplication.ISectionOfSection" } } }, required: [ "type", "moduleIndex", "unitIndex", "sectionSections" ] }, "IAutoBeAnalyzeWriteSectionApplication.ISectionOfSection": { description: "Structure representing a single section.", type: "object", properties: { title: { description: "Title of the section (#### level heading).\n\nShould clearly indicate the specific requirement, process, or feature\nbeing detailed.", type: "string" }, content: { description: "Complete content for the section.\n\nContains detailed requirements, specifications, and diagrams. Content\nguidelines:\n\nEARS Format (ONLY for 03-functional-requirements, 04-business-rules):\n\n- Ubiquitous: \"THE <system> SHALL <function>\"\n- Event-driven: \"WHEN <trigger>, THE <system> SHALL <function>\"\n- State-driven: \"WHILE <state>, THE <system> SHALL <function>\"\n- Unwanted: \"IF <condition>, THEN THE <system> SHALL <function>\"\n- Optional: \"WHERE <feature>, THE <system> SHALL <function>\"\n\nNatural Language (for 00-toc, 01-actors-and-auth, 02-domain-model,\n05-non-functional):\n\n- Use clear, descriptive prose for definitions, concepts, and policies\n- Focus on readability over formal structure\n- Tables and bullet points are preferred for structured data\n\nMermaid Diagram Rules:\n\n- ALL labels must use double quotes: A[\"User Login\"]\n- NO spaces between brackets and quotes\n- Arrow syntax: --> (NOT --|)\n- LR orientation preferred for flowcharts\n\nProhibited Content:\n\n- Database schemas or ERD\n- API endpoint specifications\n- Technical implementation details\n- Frontend UI/UX specifications\n\nHallucination Prevention:\n\n- Every requirement must trace to the original user input\n- Do NOT invent SLA numbers, timeout values, or performance targets\n- Do NOT add security mechanisms (2FA, JWT, encryption) user did not\n mention\n- Do NOT add infrastructure requirements (CDN, caching) user did not\n mention\n- 05-non-functional: only describe aspects the user explicitly mentioned\n\nConciseness:\n\n- One concept = one section, not multiple sections rephrasing the same idea\n- 02-domain-model: max 1-3 sections per business concept", type: "string" } }, required: [ "title", "content" ] } } }, description: "Process section generation, write submission, or preliminary data requests.\n\nSubmit section content via `write`, then review your own output. Call\n`complete` if satisfied, or submit another `write` to improve (3 writes\nmaximum).", validate: (() => { 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 && "number" === typeof input.moduleIndex && "number" === typeof input.unitIndex && (Array.isArray(input.sectionSections) && input.sectionSections.every(elem => "object" === typeof elem && null !== elem && _io4(elem))); const _io4 = input => "string" === typeof input.title && "string" === typeof input.content; 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: "(IAutoBeAnalyzeWriteSectionApplication.IWrite | IAutoBePreliminaryComplete | IAutoBePreliminaryGetPreviousAnalysisSections)", value: input.request })) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, { path: _path + ".request", expected: "(IAutoBeAnalyzeWriteSectionApplication.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, _index3) => "number" === typeof elem && (__typia_transform__isTypeUint32._isTypeUint32(elem) || _report(_exceptionable, { path: _path + ".sectionIds[" + _index3 + "]", expected: "number & Type<\"uint32\">", value: elem })) || _report(_exceptionable, { path: _path + ".sectionIds[" + _index3 + "]", 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 }), "number" === typeof input.moduleIndex || _report(_exceptionable, { path: _path + ".moduleIndex", expected: "number", value: input.moduleIndex }), "number" === typeof input.unitIndex || _report(_exceptionable, { path: _path + ".unitIndex", expected: "number", value: input.unitIndex }), (Array.isArray(input.sectionSections) || _report(_exceptionable, { path: _path + ".sectionSections", expected: "Array<IAutoBeAnalyzeWriteSectionApplication.ISectionOfSection>", value: input.sectionSections })) && input.sectionSections.map((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".sectionSections[" + _index4 + "]", expected: "IAutoBeAnalyzeWriteSectionApplication.ISectionOfSection", value: elem })) && _vo4(elem, _path + ".sectionSections[" + _index4 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".sectionSections[" + _index4 + "]", expected: "IAutoBeAnalyzeWriteSectionApplication.ISectionOfSection", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".sectionSections", expected: "Array<IAutoBeAnalyzeWriteSectionApplication.ISectionOfSection>", value: input.sectionSections })].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.title || _report(_exceptionable, { path: _path + ".title", expected: "string", value: input.title }), "string" === typeof input.content || _report(_exceptionable, { path: _path + ".content", expected: "string", value: input.content })].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 | IAutoBeAnalyzeWriteSectionApplication.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: "IAutoBeAnalyzeWriteSectionApplication.IProps", value: input })) && _vo0(input, _path + "", true) || _report(true, { path: _path + "", expected: "IAutoBeAnalyzeWriteSectionApplication.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 }; }; })() } ] }, { validate: { process: validate, }, })); return { protocol: "class", name: SOURCE, application, execute: { process: (input) => { if (input.request.type === "write") props.pointer.value = input.request; }, }, }; } const SOURCE = "analyzeWriteSection"; //# sourceMappingURL=orchestrateAnalyzeWriteSectionPatch.js.map