UNPKG

@autobe/agent

Version:

AI backend server code generator

834 lines 64.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.orchestrateAnalyzeScenario = void 0; const __typia_transform__isTypeUint32 = __importStar(require("typia/lib/internal/_isTypeUint32")); const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport")); const __typia_transform__llmApplicationFinalize = __importStar(require("typia/lib/internal/_llmApplicationFinalize")); const typia_1 = __importDefault(require("typia")); const uuid_1 = require("uuid"); const AutoBePreliminaryController_1 = require("../common/AutoBePreliminaryController"); const transformAnalyzeScenarioHistory_1 = require("./histories/transformAnalyzeScenarioHistory"); const FixedAnalyzeTemplate_1 = require("./structures/FixedAnalyzeTemplate"); const orchestrateAnalyzeScenario = (ctx, props) => __awaiter(void 0, void 0, void 0, function* () { const start = new Date(); const preliminary = new AutoBePreliminaryController_1.AutoBePreliminaryController({ application: { version: "3.1", components: { schemas: { "IAutoBeAnalyzeScenarioApplication.IProps": { type: "object", properties: { thinking: { oneOf: [ { type: "null" }, { type: "string" } ], description: "Think before you act.\n\nFor preliminary requests: what previous analysis sections are missing?\n\nFor completion: is the DTO transformable or non-transformable? What\nactors, entities, and prefix were chosen based on requirements?" }, request: { oneOf: [ { $ref: "#/components/schemas/IAutoBePreliminaryComplete" }, { $ref: "#/components/schemas/IAutoBePreliminaryGetPreviousAnalysisSections" }, { $ref: "#/components/schemas/IAutoBeAnalyzeScenarioApplication.IWrite" } ], discriminator: { propertyName: "type", mapping: { complete: "#/components/schemas/IAutoBePreliminaryComplete", getPreviousAnalysisSections: "#/components/schemas/IAutoBePreliminaryGetPreviousAnalysisSections", write: "#/components/schemas/IAutoBeAnalyzeScenarioApplication.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." }, "IAutoBeAnalyzeScenarioApplication.IWrite": { type: "object", properties: { type: { "const": "write", description: "Type discriminator for write submission." }, reason: { type: "string", description: "Why these actors, entities, and prefix were chosen based on requirements." }, prefix: { type: "string", pattern: "^[a-z][a-zA-Z0-9]*$", description: "Prefix for file/variable names (camelCase)." }, actors: { type: "array", items: { $ref: "#/components/schemas/AutoBeAnalyze.IActor" }, description: "Actors for the project (name, kind, description)." }, language: { oneOf: [ { type: "null" }, { type: "string" } ], description: "Language for document content. Overrides locale if set; null if not\nspecified." }, entities: { type: "array", items: { $ref: "#/components/schemas/AutoBeAnalyzeScenarioEntity" }, description: "AUTHORITATIVE entity list \u2014 all downstream writers MUST reference only\nthese entities. Include ALL domain entities; do NOT include meta-entities\ndescribing the requirements process." }, features: { type: "array", items: { $ref: "#/components/schemas/FixedAnalyzeTemplateFeature" }, description: "Features activating conditional modules. DEFAULT IS EMPTY ARRAY [].\n\nWARNING: Wrong activation causes cascading hallucination across ALL SRS\nfiles. Include ONLY if user used exact trigger keywords:\n\n- \"file-storage\": \"file upload\", \"attachment\", \"image upload\"\n- \"real-time\": \"real-time\", \"WebSocket\", \"live updates\", \"chat\"\n- \"external-integration\": \"payment\", \"Stripe\", \"OAuth\", \"email service\"\n\nStandard CRUD with auth = []. Do NOT activate based on inference." } }, required: [ "type", "reason", "prefix", "actors", "language", "entities", "features" ], description: "Submit project structure with actors and entities (6-file SRS template)." }, "AutoBeAnalyze.IActor": { type: "object", properties: { name: { type: "string", pattern: "^[a-z][a-zA-Z0-9]*$", minLength: 1, description: "MUST use camelCase. Referenced in schema models and auth decorators." }, kind: { oneOf: [ { "const": "guest" }, { "const": "member" }, { "const": "admin" } ], description: "Permission level:\n\n- \"guest\": Unauthenticated, limited to public resources.\n- \"member\": Authenticated with standard access.\n- \"admin\": Elevated permissions, can manage users and system settings." }, description: { type: "string", description: "Description of this actor's permissions and capabilities." } }, required: [ "name", "kind", "description" ], description: "An authenticated user type used for authorization throughout the app." }, AutoBeAnalyzeScenarioEntity: { type: "object", properties: { name: { type: "string" }, attributes: { type: "array", items: { type: "string" } }, relationships: { type: "array", items: { type: "string" } } }, required: [ "name", "attributes" ], description: "Core domain entity identified during scenario planning." }, FixedAnalyzeTemplateFeature: { type: "object", properties: { id: { $ref: "#/components/schemas/FixedAnalyzeTemplateFeatureId" }, providers: { type: "array", items: { type: "string" }, description: "Provider names for external-integration (e.g., [\"stripe\", \"sendgrid\"])" } }, required: [ "id" ] }, FixedAnalyzeTemplateFeatureId: { oneOf: [ { "const": "real-time" }, { "const": "external-integration" }, { "const": "file-storage" } ] } } }, functions: [ { name: "process", async: false, parameters: [ { name: "props", required: true, schema: { $ref: "#/components/schemas/IAutoBeAnalyzeScenarioApplication.IProps" } } ], description: "Compose project structure (actors, entities, prefix, language) or request\npreliminary data." } ] }, source: SOURCE, kinds: ["previousAnalysisSections", "complete"], state: ctx.state(), dispatch: (e) => ctx.dispatch(e), }); return yield preliminary.orchestrate(ctx, (out) => __awaiter(void 0, void 0, void 0, function* () { var _a, _b, _c, _d; const pointer = { value: null, }; const result = yield ctx.conversate(Object.assign({ source: SOURCE, controller: createController({ pointer, preliminary, }), enforceFunctionCall: false }, (0, transformAnalyzeScenarioHistory_1.transformAnalyzeScenarioHistory)(ctx, preliminary, props === null || props === void 0 ? void 0 : props.feedback))); if (((_a = result.histories.at(-1)) === null || _a === void 0 ? void 0 : _a.type) === "assistantMessage") return out(result)(Object.assign(Object.assign({}, result.histories.at(-1)), { created_at: start.toISOString(), completed_at: new Date().toISOString(), id: (0, uuid_1.v7)() })); else if (pointer.value === null) return out(result)(null); const features = (_b = pointer.value.features) !== null && _b !== void 0 ? _b : []; const event = { type: SOURCE, id: (0, uuid_1.v7)(), prefix: pointer.value.prefix, language: pointer.value.language, actors: pointer.value.actors, entities: pointer.value.entities, features: features.map((f) => (Object.assign({ id: f.id }, (f.providers ? { providers: f.providers } : {})))), files: (0, FixedAnalyzeTemplate_1.buildFixedAnalyzeScenarioFiles)(pointer.value.prefix, features), acquisition: preliminary.getAcquisition(), metric: result.metric, tokenUsage: result.tokenUsage, step: ((_d = (_c = ctx.state().analyze) === null || _c === void 0 ? void 0 : _c.step) !== null && _d !== void 0 ? _d : -1) + 1, created_at: start.toISOString(), }; return out(result)(event); })); }); exports.orchestrateAnalyzeScenario = orchestrateAnalyzeScenario; 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 && "string" === typeof input.reason && ("string" === typeof input.prefix && RegExp("^[a-z][a-zA-Z0-9]*$").test(input.prefix)) && (Array.isArray(input.actors) && input.actors.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.language || "string" === typeof input.language) && (Array.isArray(input.entities) && input.entities.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (Array.isArray(input.features) && input.features.every(elem => "object" === typeof elem && null !== elem && _io6(elem))); const _io4 = input => "string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) && 1 <= input.name.length) && ("guest" === input.kind || "member" === input.kind || "admin" === input.kind) && "string" === typeof input.description; const _io5 = input => "string" === typeof input.name && (Array.isArray(input.attributes) && input.attributes.every(elem => "string" === typeof elem)) && (undefined === input.relationships || Array.isArray(input.relationships) && input.relationships.every(elem => "string" === typeof elem)); const _io6 = input => ("real-time" === input.id || "external-integration" === input.id || "file-storage" === input.id) && (undefined === input.providers || Array.isArray(input.providers) && input.providers.every(elem => "string" === typeof elem)); 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: "(IAutoBeAnalyzeScenarioApplication.IWrite | IAutoBePreliminaryComplete | IAutoBePreliminaryGetPreviousAnalysisSections)", value: input.request })) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, { path: _path + ".request", expected: "(IAutoBeAnalyzeScenarioApplication.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 }), "string" === typeof input.reason || _report(_exceptionable, { path: _path + ".reason", expected: "string", value: input.reason }), "string" === typeof input.prefix && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.prefix) || _report(_exceptionable, { path: _path + ".prefix", expected: "string & CamelCasePattern", value: input.prefix })) || _report(_exceptionable, { path: _path + ".prefix", expected: "(string & CamelCasePattern)", value: input.prefix }), (Array.isArray(input.actors) || _report(_exceptionable, { path: _path + ".actors", expected: "Array<AutoBeAnalyze.IActor>", value: input.actors })) && input.actors.map((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".actors[" + _index9 + "]", expected: "AutoBeAnalyze.IActor", value: elem })) && _vo4(elem, _path + ".actors[" + _index9 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".actors[" + _index9 + "]", expected: "AutoBeAnalyze.IActor", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".actors", expected: "Array<AutoBeAnalyze.IActor>", value: input.actors }), null === input.language || "string" === typeof input.language || _report(_exceptionable, { path: _path + ".language", expected: "(null | string)", value: input.language }), (Array.isArray(input.entities) || _report(_exceptionable, { path: _path + ".entities", expected: "Array<AutoBeAnalyzeScenarioEntity>", value: input.entities })) && input.entities.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".entities[" + _index10 + "]", expected: "AutoBeAnalyzeScenarioEntity", value: elem })) && _vo5(elem, _path + ".entities[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".entities[" + _index10 + "]", expected: "AutoBeAnalyzeScenarioEntity", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".entities", expected: "Array<AutoBeAnalyzeScenarioEntity>", value: input.entities }), (Array.isArray(input.features) || _report(_exceptionable, { path: _path + ".features", expected: "Array<FixedAnalyzeTemplateFeature>", value: input.features })) && input.features.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".features[" + _index11 + "]", expected: "FixedAnalyzeTemplateFeature", value: elem })) && _vo6(elem, _path + ".features[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".features[" + _index11 + "]", expected: "FixedAnalyzeTemplateFeature", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".features", expected: "Array<FixedAnalyzeTemplateFeature>", value: input.features })].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, { path: _path + ".name", expected: "string & CamelCasePattern", value: input.name })) && (1 <= input.name.length || _report(_exceptionable, { path: _path + ".name", expected: "string & MinLength<1>", value: input.name })) || _report(_exceptionable, { path: _path + ".name", expected: "(string & CamelCasePattern & MinLength<1>)", value: input.name }), "guest" === input.kind || "member" === input.kind || "admin" === input.kind || _report(_exceptionable, { path: _path + ".kind", expected: "(\"admin\" | \"guest\" | \"member\")", value: input.kind }), "string" === typeof input.description || _report(_exceptionable, { path: _path + ".description", expected: "string", value: input.description })].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => ["string" === typeof input.name || _report(_exceptionable, { path: _path + ".name", expected: "string", value: input.name }), (Array.isArray(input.attributes) || _report(_exceptionable, { path: _path + ".attributes", expected: "Array<string>", value: input.attributes })) && input.attributes.map((elem, _index12) => "string" === typeof elem || _report(_exceptionable, { path: _path + ".attributes[" + _index12 + "]", expected: "string", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".attributes", expected: "Array<string>", value: input.attributes }), undefined === input.relationships || (Array.isArray(input.relationships) || _report(_exceptionable, { path: _path + ".relationships", expected: "(Array<string> | undefined)", value: input.relationships })) && input.relationships.map((elem, _index13) => "string" === typeof elem || _report(_exceptionable, { path: _path + ".relationships[" + _index13 + "]", expected: "string", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".relationships", expected: "(Array<string> | undefined)", value: input.relationships })].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => ["real-time" === input.id || "external-integration" === input.id || "file-storage" === input.id || _report(_exceptionable, { path: _path + ".id", expected: "(\"external-integration\" | \"file-storage\" | \"real-time\")", value: input.id }), undefined === input.providers || (Array.isArray(input.providers) || _report(_exceptionable, { path: _path + ".providers", expected: "(Array<string> | undefined)", value: input.providers })) && input.providers.map((elem, _index14) => "string" === typeof elem || _report(_exceptionable, { path: _path + ".providers[" + _index14 + "]", expected: "string", value: elem })).every(flag => flag) || _report(_exceptionable, { path: _path + ".providers", expected: "(Array<string> | undefined)", value: input.providers })].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 | IAutoBeAnalyzeScenarioApplication.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: "IAutoBeAnalyzeScenarioApplication.IProps", value: input })) && _vo0(input, _path + "", true) || _report(true, { path: _path + "", expected: "IAutoBeAnalyzeScenarioApplication.IProps", value: input }))(input, "$input", true); const success = 0 === errors.length; return success ? { success, data: input } : { success, errors, data: input }; } return { success: true, data: input }; }; })()(input); if (result.success === false) return result; else if (result.data.request.type === "write") return 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 IAutoBeAnalyzeScenarioApplication.IProps}", type: "object", properties: { thinking: { description: "Think before you act.\n\nFor preliminary requests: what previous analysis sections are missing?\n\nFor completion: is the DTO transformable or non-transformable? What\nactors, entities, and prefix were chosen based on requirements?", 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/IAutoBeAnalyzeScenarioApplication.IWrite" } ], "x-discriminator": { propertyName: "type", mapping: { complete: "#/$defs/IAutoBePreliminaryComplete", getPreviousAnalysisSections: "#/$defs/IAutoBePreliminaryGetPreviousAnalysisSections", write: "#/$defs/IAutoBeAnalyzeScenarioApplication.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" ] }, "IAutoBeAnalyzeScenarioApplication.IWrite": { description: "Submit project structure with actors and entities (6-file SRS template).", type: "object", properties: { type: { description: "Type discriminator for write submission.", type: "string", "enum": [ "write" ] }, reason: { description: "Why these actors, entities, and prefix were chosen based on requirements.", type: "string" }, prefix: { description: "Prefix for file/variable names (camelCase).", type: "string", pattern: "^[a-z][a-zA-Z0-9]*$" }, actors: { description: "Actors for the project (name, kind, description).", type: "array", items: { $ref: "#/$defs/AutoBeAnalyze.IActor" } }, language: { description: "Language for document content. Overrides locale if set; null if not\nspecified.", anyOf: [ { type: "null" }, { type: "string" } ] }, entities: { description: "AUTHORITATIVE entity list \u2014 all downstream writers MUST reference only\nthese entities. Include ALL domain entities; do NOT include meta-entities\ndescribing the requirements process.", type: "array", items: { $ref: "#/$defs/AutoBeAnalyzeScenarioEntity" } }, features: { description: "Features activating conditional modules. DEFAULT IS EMPTY ARRAY [].\n\nWARNING: Wrong activation causes cascading hallucination across ALL SRS\nfiles. Include ONLY if user used exact trigger keywords:\n\n- \"file-storage\": \"file upload\", \"attachment\", \"image upload\"\n- \"real-time\": \"real-time\", \"WebSocket\", \"live updates\", \"chat\"\n- \"external-integration\": \"payment\", \"Stripe\", \"OAuth\", \"email service\"\n\nStandard CRUD with auth = []. Do NOT activate based on inference.", type: "array", items: { $ref: "#/$defs/FixedAnalyzeTemplateFeature" } } }, required: [ "type", "reason", "prefix", "actors", "language", "entities", "features" ] }, "AutoBeAnalyze.IActor": { description: "An authenticated user type used for authorization throughout the app.", type: "object", properties: { name: { description: "MUST use camelCase. Referenced in schema models and auth decorators.", type: "string", pattern: "^[a-z][a-zA-Z0-9]*$", minLength: 1 }, kind: { description: "Permission level:\n\n- \"guest\": Unauthenticated, limited to public resources.\n- \"member\": Authenticated with standard access.\n- \"admin\": Elevated permissions, can manage users and system settings.", type: "string", "enum": [ "guest", "member", "admin" ] }, description: { description: "Description of this actor's permissions and capabilities.", type: "string" } }, required: [ "name", "kind", "description" ] }, AutoBeAnalyzeScenarioEntity: { description: "Core domain entity identified during scenario planning.", type: "object", properties: { name: { type: "string" }, attributes: { type: "array", items: { type: "string" } }, relationships: { type: "array", items: { type: "string" } } }, required: [ "name", "attributes" ] }, FixedAnalyzeTemplateFeature: { type: "object", properties: { id: { $ref: "#/$defs/FixedAnalyzeTemplateFeatureId" }, providers: { description: "Provider names for external-integration (e.g., [\"stripe\", \"sendgrid\"])", type: "array", items: { type: "string" } } }, required: [ "id" ] }, FixedAnalyzeTemplateFeatureId: { type: "string", "enum": [ "real-time", "external-integration", "file-storage" ] } } }, description: "Compose project structure (actors, entities, prefix, language) or request\npreliminary data.", 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 && "string" === typeof input.reason && ("string" === typeof input.prefix && RegExp("^[a-z][a-zA-Z0-9]*$").test(input.prefix)) && (Array.isArray(input.actors) && input.actors.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (null === input.language || "string" === typeof input.language) && (Array.isArray(input.entities) && input.entities.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (Array.isArray(input.features) && input.features.every(elem => "object" === typeof elem && null !== elem && _io6(elem))); const _io4 = input => "string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) && 1 <= input.name.length) && ("guest" === input.kind || "member" === input.kind || "admin" === input.kind) && "string" === typeof input.description; const _io5 = input => "string" === typeof input.name && (Array.isArray(input.attributes) && input.attributes.every(elem => "string" === typeof elem)) && (undefined === input.relationships || Array.isArray(input.relationships) && input.relationships.every(elem => "string" === typeof elem)); const _io6 = input => ("real-time" === input.id || "external-integration" === input.id || "file-storage" === input.id) && (undefined === input.providers || Array.isArray(input.providers) && input.providers.every(elem => "string" === typeof elem)); 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: "(IAutoBeAnalyzeScenarioApplication.IWrite | IAutoBePreliminaryComplete | IAutoBePreliminaryGetPreviousAnalysisS