UNPKG

@autobe/agent

Version:

AI backend server code generator

819 lines 61.5 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.orchestrateDatabaseGroup = orchestrateDatabaseGroup; 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 transformDatabaseGroupHistory_1 = require("./histories/transformDatabaseGroupHistory"); const AutoBeDatabaseGroupProgrammer_1 = require("./programmers/AutoBeDatabaseGroupProgrammer"); function orchestrateDatabaseGroup(ctx, instruction) { return __awaiter(this, void 0, void 0, function* () { const start = new Date(); const preliminary = new AutoBePreliminaryController_1.AutoBePreliminaryController({ dispatch: (e) => ctx.dispatch(e), application: { version: "3.1", components: { schemas: { "IAutoBeDatabaseGroupApplication.IProps": { type: "object", properties: { thinking: { 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/IAutoBePreliminaryGetAnalysisSections" }, { $ref: "#/components/schemas/IAutoBePreliminaryGetPreviousDatabaseSchemas" }, { $ref: "#/components/schemas/IAutoBeDatabaseGroupApplication.IWrite" } ], discriminator: { propertyName: "type", mapping: { complete: "#/components/schemas/IAutoBePreliminaryComplete", getPreviousAnalysisSections: "#/components/schemas/IAutoBePreliminaryGetPreviousAnalysisSections", getAnalysisSections: "#/components/schemas/IAutoBePreliminaryGetAnalysisSections", getPreviousDatabaseSchemas: "#/components/schemas/IAutoBePreliminaryGetPreviousDatabaseSchemas", write: "#/components/schemas/IAutoBeDatabaseGroupApplication.IWrite" } }, description: "Action to perform. Exhausted preliminary types are removed from the\nunion." } }, required: [ "thinking", "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." }, IAutoBePreliminaryGetAnalysisSections: { type: "object", properties: { type: { "const": "getAnalysisSections", description: "Type discriminator." }, sectionIds: { type: "array", items: { type: "integer", minimum: 0 }, minItems: 1, maxItems: 100, description: "Section IDs to retrieve. DO NOT request same IDs already requested in\nprevious calls." } }, required: [ "type", "sectionIds" ], description: "Request to retrieve individual analysis sections by numeric ID." }, IAutoBePreliminaryGetPreviousDatabaseSchemas: { type: "object", properties: { type: { "const": "getPreviousDatabaseSchemas", description: "Type discriminator." }, schemaNames: { type: "array", items: { type: "string" }, minItems: 1, description: "Table names to retrieve from previous iteration. DO NOT request same names\nalready requested in previous calls." } }, required: [ "type", "schemaNames" ], description: "Request to retrieve database schemas from the previous iteration.\n\nLoads database table definitions from the last successfully generated\nversion, used as reference context during regeneration or modification\ncycles." }, "IAutoBeDatabaseGroupApplication.IWrite": { type: "object", properties: { type: { "const": "write", description: "Type discriminator for write submission." }, analysis: { type: "string", description: "Analysis of the requirements structure, domain organization, and\ncomponent needs." }, rationale: { type: "string", description: "Rationale for component grouping decisions and domain boundaries." }, groups: { type: "array", items: { $ref: "#/components/schemas/AutoBeDatabaseGroup" }, minItems: 1, description: "Database component groups derived from business domains.\n\nSeparate foundational groups (Systematic, Actors) from domain-specific\ngroups. Ensure complete coverage without overlap." } }, required: [ "type", "analysis", "rationale", "groups" ], description: "Submit database component groups." }, AutoBeDatabaseGroup: { type: "object", properties: { thinking: { type: "string", description: "Initial thoughts on why these tables belong together." }, review: { type: "string", description: "Review considerations: relationships with other domains, grouping\nvalidation." }, rationale: { type: "string", description: "Final rationale cementing the component's structure." }, namespace: { type: "string", description: "Business domain namespace for Prisma" }, filename: { type: "string", pattern: "^[a-zA-Z0-9._-]+\\.prisma$", description: "Prisma schema filename. Convention: `schema-{number}-{domain}.prisma` where\nnumber indicates dependency order." }, kind: { oneOf: [ { "const": "authorization" }, { "const": "domain" } ], description: "Component group kind.\n\n- `\"authorization\"`: Auth tables (users, sessions, password resets).\n Processed by Authorization Agent.\n- `\"domain\"`: Business tables (products, orders). Processed by Component\n Agent." } }, required: [ "thinking", "review", "rationale", "namespace", "filename", "kind" ], description: "Database component skeleton generated during the DATABASE_GROUP phase.\n\nField order is deliberate: reasoning fields (thinking \u2192 review \u2192 rationale)\ncome BEFORE technical fields (namespace \u2192 filename \u2192 kind) to ensure the AI\nreasons through purpose before committing to technical details." } } }, functions: [ { name: "process", async: false, parameters: [ { name: "props", required: true, schema: { $ref: "#/components/schemas/IAutoBeDatabaseGroupApplication.IProps" } } ], description: "Process group generation task or retrieve preliminary data." } ] }, source: SOURCE, kinds: [ "analysisSections", "previousAnalysisSections", "previousDatabaseSchemas", "complete", ], state: ctx.state(), }); const event = yield preliminary.orchestrate(ctx, (out) => __awaiter(this, 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 }, (0, transformDatabaseGroupHistory_1.transformDatabaseGroupHistory)(ctx.state(), { instruction, preliminary, }))); if (pointer.value === null) return out(result)(null); return out(result)({ type: SOURCE, id: (0, uuid_1.v7)(), created_at: start.toISOString(), analysis: pointer.value.analysis, rationale: pointer.value.rationale, groups: pointer.value.groups, acquisition: preliminary.getAcquisition(), metric: result.metric, tokenUsage: result.tokenUsage, step: (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0, }); })); ctx.dispatch(event); return event.groups; }); } function createController(props) { const validate = (input) => { const result = (() => { const _io0 = input => "string" === typeof input.thinking && ("object" === typeof input.request && null !== input.request && _iu0(input.request)); const _io1 = input => "complete" === input.type; const _io2 = input => "getAnalysisSections" === input.type && (Array.isArray(input.sectionIds) && (1 <= input.sectionIds.length && input.sectionIds.length <= 100 && input.sectionIds.every(elem => "number" === typeof elem && __typia_transform__isTypeUint32._isTypeUint32(elem)))); const _io3 = 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 _io4 = input => "getPreviousDatabaseSchemas" === input.type && (Array.isArray(input.schemaNames) && (1 <= input.schemaNames.length && input.schemaNames.every(elem => "string" === typeof elem))); const _io5 = input => "write" === input.type && "string" === typeof input.analysis && "string" === typeof input.rationale && (Array.isArray(input.groups) && (1 <= input.groups.length && input.groups.every(elem => "object" === typeof elem && null !== elem && _io6(elem)))); const _io6 = input => "string" === typeof input.thinking && "string" === typeof input.review && "string" === typeof input.rationale && "string" === typeof input.namespace && ("string" === typeof input.filename && RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename)) && ("authorization" === input.kind || "domain" === input.kind); const _iu0 = input => (() => { if ("complete" === input.type) return _io1(input); else if ("getPreviousAnalysisSections" === input.type) return _io3(input); else if ("getAnalysisSections" === input.type) return _io2(input); else if ("getPreviousDatabaseSchemas" === input.type) return _io4(input); else if ("write" === input.type) return _io5(input); else return false; })(); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.thinking || _report(_exceptionable, { path: _path + ".thinking", expected: "string", value: input.thinking }), ("object" === typeof input.request && null !== input.request || _report(_exceptionable, { path: _path + ".request", expected: "(IAutoBeDatabaseGroupApplication.IWrite | IAutoBePreliminaryComplete | IAutoBePreliminaryGetAnalysisSections | IAutoBePreliminaryGetPreviousAnalysisSections | IAutoBePreliminaryGetPreviousDatabaseSchemas)", value: input.request })) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, { path: _path + ".request", expected: "(IAutoBeDatabaseGroupApplication.IWrite | IAutoBePreliminaryComplete | IAutoBePreliminaryGetAnalysisSections | IAutoBePreliminaryGetPreviousAnalysisSections | IAutoBePreliminaryGetPreviousDatabaseSchemas)", 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) => ["getAnalysisSections" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"getAnalysisSections\"", value: input.type }), (Array.isArray(input.sectionIds) || _report(_exceptionable, { path: _path + ".sectionIds", expected: "(Array<number & Type<\"uint32\">> & MinItems<1> & MaxItems<100>)", value: input.sectionIds })) && ((1 <= input.sectionIds.length || _report(_exceptionable, { path: _path + ".sectionIds", expected: "Array<> & MinItems<1>", value: input.sectionIds })) && (input.sectionIds.length <= 100 || _report(_exceptionable, { path: _path + ".sectionIds", expected: "Array<> & MaxItems<100>", value: input.sectionIds })) && input.sectionIds.map((elem, _index5) => "number" === typeof elem && (__typia_transform__isTypeUint32._isTypeUint32(elem) || _report(_exceptionable, { path: _path + ".sectionIds[" + _index5 + "]", expected: "number & Type<\"uint32\">", value: elem })) || _report(_exceptionable, { path: _path + ".sectionIds[" + _index5 + "]", expected: "(number & Type<\"uint32\">)", value: elem })).every(flag => flag)) || _report(_exceptionable, { path: _path + ".sectionIds", expected: "(Array<number & Type<\"uint32\">> & MinItems<1> & MaxItems<100>)", value: input.sectionIds })].every(flag => flag); const _vo3 = (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, _index6) => "number" === typeof elem && (__typia_transform__isTypeUint32._isTypeUint32(elem) || _report(_exceptionable, { path: _path + ".sectionIds[" + _index6 + "]", expected: "number & Type<\"uint32\">", value: elem })) || _report(_exceptionable, { path: _path + ".sectionIds[" + _index6 + "]", 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 _vo4 = (input, _path, _exceptionable = true) => ["getPreviousDatabaseSchemas" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"getPreviousDatabaseSchemas\"", value: input.type }), (Array.isArray(input.schemaNames) || _report(_exceptionable, { path: _path + ".schemaNames", expected: "(Array<string> & MinItems<1>)", value: input.schemaNames })) && ((1 <= input.schemaNames.length || _report(_exceptionable, { path: _path + ".schemaNames", expected: "Array<> & MinItems<1>", value: input.schemaNames })) && input.schemaNames.map((elem, _index7) => "string" === typeof elem || _report(_exceptionable, { path: _path + ".schemaNames[" + _index7 + "]", expected: "string", value: elem })).every(flag => flag)) || _report(_exceptionable, { path: _path + ".schemaNames", expected: "(Array<string> & MinItems<1>)", value: input.schemaNames })].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => ["write" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"write\"", value: input.type }), "string" === typeof input.analysis || _report(_exceptionable, { path: _path + ".analysis", expected: "string", value: input.analysis }), "string" === typeof input.rationale || _report(_exceptionable, { path: _path + ".rationale", expected: "string", value: input.rationale }), (Array.isArray(input.groups) || _report(_exceptionable, { path: _path + ".groups", expected: "(Array<AutoBeDatabaseGroup> & MinItems<1>)", value: input.groups })) && ((1 <= input.groups.length || _report(_exceptionable, { path: _path + ".groups", expected: "Array<> & MinItems<1>", value: input.groups })) && input.groups.map((elem, _index8) => ("object" === typeof elem && null !== elem || _report(_exceptionable, { path: _path + ".groups[" + _index8 + "]", expected: "AutoBeDatabaseGroup", value: elem })) && _vo6(elem, _path + ".groups[" + _index8 + "]", true && _exceptionable) || _report(_exceptionable, { path: _path + ".groups[" + _index8 + "]", expected: "AutoBeDatabaseGroup", value: elem })).every(flag => flag)) || _report(_exceptionable, { path: _path + ".groups", expected: "(Array<AutoBeDatabaseGroup> & MinItems<1>)", value: input.groups })].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => ["string" === typeof input.thinking || _report(_exceptionable, { path: _path + ".thinking", expected: "string", value: input.thinking }), "string" === typeof input.review || _report(_exceptionable, { path: _path + ".review", expected: "string", value: input.review }), "string" === typeof input.rationale || _report(_exceptionable, { path: _path + ".rationale", expected: "string", value: input.rationale }), "string" === typeof input.namespace || _report(_exceptionable, { path: _path + ".namespace", expected: "string", value: input.namespace }), "string" === typeof input.filename && (RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename) || _report(_exceptionable, { path: _path + ".filename", expected: "string & Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">", value: input.filename })) || _report(_exceptionable, { path: _path + ".filename", expected: "(string & Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">)", value: input.filename }), "authorization" === input.kind || "domain" === input.kind || _report(_exceptionable, { path: _path + ".kind", expected: "(\"authorization\" | \"domain\")", value: input.kind })].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 _vo3(input, _path, true && _exceptionable); else if ("getAnalysisSections" === input.type) return _vo2(input, _path, true && _exceptionable); else if ("getPreviousDatabaseSchemas" === input.type) return _vo4(input, _path, true && _exceptionable); else if ("write" === input.type) return _vo5(input, _path, true && _exceptionable); else return _report(_exceptionable, { path: _path, expected: "(IAutoBePreliminaryComplete | IAutoBePreliminaryGetPreviousAnalysisSections | IAutoBePreliminaryGetAnalysisSections | IAutoBePreliminaryGetPreviousDatabaseSchemas | IAutoBeDatabaseGroupApplication.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: "IAutoBeDatabaseGroupApplication.IProps", value: input })) && _vo0(input, _path + "", true) || _report(true, { path: _path + "", expected: "IAutoBeDatabaseGroupApplication.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; // Preliminary request validation if (result.data.request.type !== "write") return props.preliminary.validate({ thinking: result.data.thinking, request: result.data.request, }); // Complete request validation - check group type counts const errors = []; AutoBeDatabaseGroupProgrammer_1.AutoBeDatabaseGroupProgrammer.validate({ errors, path: "$input.request.groups", groups: result.data.request.groups, }); if (errors.length > 0) return { success: false, errors, data: result.data, }; return result; }; const application = props.preliminary.fixApplication(__typia_transform__llmApplicationFinalize._llmApplicationFinalize({ functions: [ { name: "process", parameters: { description: "Current Type: {@link IAutoBeDatabaseGroupApplication.IProps}", type: "object", properties: { thinking: { description: "Reasoning: what's missing (preliminary), what you're submitting (write),\nor why you're finalizing (complete).", type: "string" }, request: { description: "Action to perform. Exhausted preliminary types are removed from the\nunion.", anyOf: [ { $ref: "#/$defs/IAutoBePreliminaryComplete" }, { $ref: "#/$defs/IAutoBePreliminaryGetPreviousAnalysisSections" }, { $ref: "#/$defs/IAutoBePreliminaryGetAnalysisSections" }, { $ref: "#/$defs/IAutoBePreliminaryGetPreviousDatabaseSchemas" }, { $ref: "#/$defs/IAutoBeDatabaseGroupApplication.IWrite" } ], "x-discriminator": { propertyName: "type", mapping: { complete: "#/$defs/IAutoBePreliminaryComplete", getPreviousAnalysisSections: "#/$defs/IAutoBePreliminaryGetPreviousAnalysisSections", getAnalysisSections: "#/$defs/IAutoBePreliminaryGetAnalysisSections", getPreviousDatabaseSchemas: "#/$defs/IAutoBePreliminaryGetPreviousDatabaseSchemas", write: "#/$defs/IAutoBeDatabaseGroupApplication.IWrite" } } } }, required: [ "thinking", "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" ] }, IAutoBePreliminaryGetAnalysisSections: { description: "Request to retrieve individual analysis sections by numeric ID.", type: "object", properties: { type: { description: "Type discriminator.", type: "string", "enum": [ "getAnalysisSections" ] }, sectionIds: { description: "Section IDs to retrieve. DO NOT request same IDs already requested in\nprevious calls.", type: "array", items: { type: "integer", minimum: 0 }, minItems: 1, maxItems: 100 } }, required: [ "type", "sectionIds" ] }, IAutoBePreliminaryGetPreviousDatabaseSchemas: { description: "Request to retrieve database schemas from the previous iteration.\n\nLoads database table definitions from the last successfully generated\nversion, used as reference context during regeneration or modification\ncycles.", type: "object", properties: { type: { description: "Type discriminator.", type: "string", "enum": [ "getPreviousDatabaseSchemas" ] }, schemaNames: { description: "Table names to retrieve from previous iteration. DO NOT request same names\nalready requested in previous calls.", type: "array", items: { type: "string" }, minItems: 1 } }, required: [ "type", "schemaNames" ] }, "IAutoBeDatabaseGroupApplication.IWrite": { description: "Submit database component groups.", type: "object", properties: { type: { description: "Type discriminator for write submission.", type: "string", "enum": [ "write" ] }, analysis: { description: "Analysis of the requirements structure, domain organization, and\ncomponent needs.", type: "string" }, rationale: { description: "Rationale for component grouping decisions and domain boundaries.", type: "string" }, groups: { description: "Database component groups derived from business domains.\n\nSeparate foundational groups (Systematic, Actors) from domain-specific\ngroups. Ensure complete coverage without overlap.", type: "array", items: { $ref: "#/$defs/AutoBeDatabaseGroup" }, minItems: 1 } }, required: [ "type", "analysis", "rationale", "groups" ] }, AutoBeDatabaseGroup: { description: "Database component skeleton generated during the DATABASE_GROUP phase.\n\nField order is deliberate: reasoning fields (thinking \u2192 review \u2192 rationale)\ncome BEFORE technical fields (namespace \u2192 filename \u2192 kind) to ensure the AI\nreasons through purpose before committing to technical details.", type: "object", properties: { thinking: { description: "Initial thoughts on why these tables belong together.", type: "string" }, review: { description: "Review considerations: relationships with other domains, grouping\nvalidation.", type: "string" }, rationale: { description: "Final rationale cementing the component's structure.", type: "string" }, namespace: { description: "Business domain namespace for Prisma", type: "string" }, filename: { description: "Prisma schema filename. Convention: `schema-{number}-{domain}.prisma` where\nnumber indicates dependency order.", type: "string", pattern: "^[a-zA-Z0-9._-]+\\.prisma$" }, kind: { description: "Component group kind.\n\n- `\"authorization\"`: Auth tables (users, sessions, password resets).\n Processed by Authorization Agent.\n- `\"domain\"`: Business tables (products, orders). Processed by Component\n Agent.", type: "string", "enum": [ "authorization", "domain" ] } }, required: [ "thinking", "review", "rationale", "namespace", "filename", "kind" ] } } }, description: "Process group generation task or retrieve preliminary data.", validate: (() => { const _io0 = input => "string" === typeof input.thinking && ("object" === typeof input.request && null !== input.request && _iu0(input.request)); const _io1 = input => "complete" === input.type; const _io2 = input => "getAnalysisSections" === input.type && (Array.isArray(input.sectionIds) && (1 <= input.sectionIds.length && input.sectionIds.length <= 100 && input.sectionIds.every(elem => "number" === typeof elem && __typia_transform__isTypeUint32._isTypeUint32(elem)))); const _io3 = 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 _io4 = input => "getPreviousDatabaseSchemas" === input.type && (Array.isArray(input.schemaNames) && (1 <= input.schemaNames.length && input.schemaNames.every(elem => "string" === typeof elem))); const _io5 = input => "write" === input.type && "string" === typeof input.analysis && "string" === typeof input.rationale && (Array.isArray(input.groups) && (1 <= input.groups.length && input.groups.every(elem => "object" === typeof elem && null !== elem && _io6(elem)))); const _io6 = input => "string" === typeof input.thinking && "string" === typeof input.review && "string" === typeof input.rationale && "string" === typeof input.namespace && ("string" === typeof input.filename && RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename)) && ("authorization" === input.kind || "domain" === input.kind); const _iu0 = input => (() => { if ("complete" === input.type) return _io1(input); else if ("getPreviousAnalysisSections" === input.type) return _io3(input); else if ("getAnalysisSections" === input.type) return _io2(input); else if ("getPreviousDatabaseSchemas" === input.type) return _io4(input); else if ("write" === input.type) return _io5(input); else return false; })(); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.thinking || _report(_exceptionable, { path: _path + ".thinking", expected: "string", value: input.thinking }), ("object" === typeof input.request && null !== input.request || _report(_exceptionable, { path: _path + ".request", expected: "(IAutoBeDatabaseGroupApplication.IWrite | IAutoBePreliminaryComplete | IAutoBePreliminaryGetAnalysisSections | IAutoBePreliminaryGetPreviousAnalysisSections | IAutoBePreliminaryGetPreviousDatabaseSchemas)", value: input.request })) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, { path: _path + ".request", expected: "(IAutoBeDatabaseGroupApplication.IWrite | IAutoBePreliminaryComplete | IAutoBePreliminaryGetAnalysisSections | IAutoBePreliminaryGetPreviousAnalysisSections | IAutoBePreliminaryGetPreviousDatabaseSchemas)", 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) => ["getAnalysisSections" === input.type || _report(_exceptionable, { path: _path + ".type", expected: "\"getAnalysisSections\"", value: input.type }), (Array.isArray(input.sectionIds) || _report(_exceptionable, { path: _path + ".sectionIds", expected: "(Array<number & Type<\"uint32\">> & MinItems<1> & MaxItems<100>)", v