@autobe/agent 0.16.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/LICENSE +661 -21
  2. package/lib/AutoBeAgent.js +9 -9
  3. package/lib/AutoBeAgent.js.map +1 -1
  4. package/lib/constants/AutoBeSystemPromptConstant.d.ts +2 -2
  5. package/lib/context/AutoBeContext.d.ts +16 -4
  6. package/lib/context/AutoBeTokenUsage.d.ts +168 -11
  7. package/lib/context/AutoBeTokenUsage.js +152 -32
  8. package/lib/context/AutoBeTokenUsage.js.map +1 -1
  9. package/lib/context/AutoBeTokenUsageComponent.d.ts +116 -0
  10. package/lib/context/AutoBeTokenUsageComponent.js +120 -0
  11. package/lib/context/AutoBeTokenUsageComponent.js.map +1 -0
  12. package/lib/factory/createAutoBeApplication.js +1 -1
  13. package/lib/factory/createAutoBeApplication.js.map +1 -1
  14. package/lib/factory/createAutoBeContext.d.ts +19 -0
  15. package/lib/factory/createAutoBeContext.js +141 -0
  16. package/lib/factory/createAutoBeContext.js.map +1 -0
  17. package/lib/factory/getAutoBeGenerated.d.ts +1 -1
  18. package/lib/factory/getAutoBeGenerated.js +14 -11
  19. package/lib/factory/getAutoBeGenerated.js.map +1 -1
  20. package/lib/factory/getAutoBeRealizeGenerated.d.ts +7 -0
  21. package/lib/factory/getAutoBeRealizeGenerated.js +27 -0
  22. package/lib/factory/getAutoBeRealizeGenerated.js.map +1 -0
  23. package/lib/index.d.ts +1 -0
  24. package/lib/index.js +1 -0
  25. package/lib/index.js.map +1 -1
  26. package/lib/index.mjs +1090 -927
  27. package/lib/index.mjs.map +1 -1
  28. package/lib/orchestrate/analyze/orchestrateAnalyze.js +9 -36
  29. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  30. package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js +9 -9
  31. package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js.map +1 -1
  32. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js +1 -1
  33. package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js.map +1 -1
  34. package/lib/orchestrate/interface/orchestrateInterface.js +6 -23
  35. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  36. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +1 -1
  37. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  38. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +1 -1
  39. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  40. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +1 -1
  41. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  42. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +1 -1
  43. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  44. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +1 -1
  45. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  46. package/lib/orchestrate/prisma/{transformPrismaComponentsHistories.d.ts → histories/transformPrismaComponentsHistories.d.ts} +1 -1
  47. package/lib/orchestrate/prisma/{transformPrismaComponentsHistories.js → histories/transformPrismaComponentsHistories.js} +1 -1
  48. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -0
  49. package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +1 -0
  50. package/lib/orchestrate/prisma/{transformPrismaHistories.d.ts → histories/transformPrismaHistories.d.ts} +1 -1
  51. package/lib/orchestrate/prisma/histories/transformPrismaHistories.js.map +1 -0
  52. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +48 -0
  53. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -0
  54. package/lib/orchestrate/prisma/orchestratePrisma.d.ts +1 -1
  55. package/lib/orchestrate/prisma/orchestratePrisma.js +9 -29
  56. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  57. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +126 -19
  58. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  59. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +10 -10
  60. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  61. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +128 -150
  62. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  63. package/lib/orchestrate/prisma/structures/IAutoBePrismaComponentApplication.d.ts +120 -0
  64. package/lib/orchestrate/prisma/structures/IAutoBePrismaComponentApplication.js +3 -0
  65. package/lib/orchestrate/prisma/structures/IAutoBePrismaComponentApplication.js.map +1 -0
  66. package/lib/orchestrate/prisma/structures/IAutoBePrismaCorrectApplication.d.ts +142 -0
  67. package/lib/orchestrate/prisma/structures/IAutoBePrismaCorrectApplication.js +3 -0
  68. package/lib/orchestrate/prisma/structures/IAutoBePrismaCorrectApplication.js.map +1 -0
  69. package/lib/orchestrate/prisma/structures/IAutoBePrismaSchemaApplication.d.ts +209 -0
  70. package/lib/orchestrate/prisma/structures/IAutoBePrismaSchemaApplication.js +3 -0
  71. package/lib/orchestrate/prisma/structures/IAutoBePrismaSchemaApplication.js.map +1 -0
  72. package/lib/orchestrate/realize/orchestrateRealize.js +13 -24
  73. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  74. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +1 -1
  75. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  76. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +1 -1
  77. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  78. package/lib/orchestrate/realize/orchestrateRealizeCoder.js +23 -23
  79. package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -1
  80. package/lib/orchestrate/test/orchestrateTest.js +8 -26
  81. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  82. package/lib/orchestrate/test/orchestrateTestCorrect.js +1 -1
  83. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  84. package/lib/orchestrate/test/orchestrateTestScenario.js +1 -1
  85. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  86. package/lib/orchestrate/test/orchestrateTestWrite.js +1 -1
  87. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  88. package/package.json +8 -8
  89. package/src/AutoBeAgent.ts +10 -9
  90. package/src/constants/AutoBeSystemPromptConstant.ts +2 -2
  91. package/src/context/AutoBeContext.ts +30 -3
  92. package/src/context/AutoBeTokenUsage.ts +252 -54
  93. package/src/context/AutoBeTokenUsageComponent.ts +180 -0
  94. package/src/factory/createAutoBeApplication.ts +1 -1
  95. package/src/factory/createAutoBeContext.ts +193 -0
  96. package/src/factory/getAutoBeGenerated.ts +14 -21
  97. package/src/factory/getAutoBeRealizeGenerated.ts +30 -0
  98. package/src/index.ts +1 -0
  99. package/src/orchestrate/analyze/orchestrateAnalyze.ts +9 -38
  100. package/src/orchestrate/analyze/orchestrateAnalyzeReviewer.ts +1 -1
  101. package/src/orchestrate/analyze/writeDocumentUntilReviewPassed.ts +1 -1
  102. package/src/orchestrate/interface/orchestrateInterface.ts +4 -21
  103. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +1 -1
  104. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +1 -1
  105. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +1 -1
  106. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +1 -1
  107. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +1 -1
  108. package/src/orchestrate/prisma/{transformPrismaComponentsHistories.ts → histories/transformPrismaComponentsHistories.ts} +2 -2
  109. package/src/orchestrate/prisma/{transformPrismaCorrectHistories.ts → histories/transformPrismaCorrectHistories.ts} +1 -1
  110. package/src/orchestrate/prisma/{transformPrismaHistories.ts → histories/transformPrismaHistories.ts} +2 -2
  111. package/src/orchestrate/prisma/{transformPrismaSchemaHistories.ts → histories/transformPrismaSchemaHistories.ts} +1 -1
  112. package/src/orchestrate/prisma/orchestratePrisma.ts +45 -68
  113. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +13 -81
  114. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +8 -148
  115. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +15 -82
  116. package/src/orchestrate/prisma/structures/IAutoBePrismaComponentApplication.ts +124 -0
  117. package/src/orchestrate/prisma/structures/IAutoBePrismaCorrectApplication.ts +144 -0
  118. package/src/orchestrate/prisma/structures/IAutoBePrismaSchemaApplication.ts +214 -0
  119. package/src/orchestrate/realize/orchestrateRealize.ts +19 -32
  120. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +1 -1
  121. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +1 -1
  122. package/src/orchestrate/realize/orchestrateRealizeCoder.ts +1 -1
  123. package/src/orchestrate/test/orchestrateTest.ts +6 -26
  124. package/src/orchestrate/test/orchestrateTestCorrect.ts +1 -1
  125. package/src/orchestrate/test/orchestrateTestScenario.ts +1 -1
  126. package/src/orchestrate/test/orchestrateTestWrite.ts +1 -1
  127. package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +0 -1
  128. package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js.map +0 -1
  129. package/lib/orchestrate/prisma/transformPrismaHistories.js.map +0 -1
  130. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +0 -48
  131. package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +0 -1
  132. /package/lib/orchestrate/prisma/{transformPrismaCorrectHistories.d.ts → histories/transformPrismaCorrectHistories.d.ts} +0 -0
  133. /package/lib/orchestrate/prisma/{transformPrismaCorrectHistories.js → histories/transformPrismaCorrectHistories.js} +0 -0
  134. /package/lib/orchestrate/prisma/{transformPrismaHistories.js → histories/transformPrismaHistories.js} +0 -0
  135. /package/lib/orchestrate/prisma/{transformPrismaSchemaHistories.d.ts → histories/transformPrismaSchemaHistories.d.ts} +0 -0
@@ -53,7 +53,7 @@ const typia_1 = __importDefault(require("typia"));
53
53
  const assertSchemaModel_1 = require("../../context/assertSchemaModel");
54
54
  const enforceToolCall_1 = require("../../utils/enforceToolCall");
55
55
  const forceRetry_1 = require("../../utils/forceRetry");
56
- const transformPrismaSchemaHistories_1 = require("./transformPrismaSchemaHistories");
56
+ const transformPrismaSchemaHistories_1 = require("./histories/transformPrismaSchemaHistories");
57
57
  function orchestratePrismaSchemas(ctx, components) {
58
58
  return __awaiter(this, void 0, void 0, function* () {
59
59
  const start = new Date();
@@ -69,6 +69,10 @@ function orchestratePrismaSchemas(ctx, components) {
69
69
  const event = {
70
70
  type: "prismaSchemas",
71
71
  created_at: start.toISOString(),
72
+ thinking: result.thinking,
73
+ draft: result.draft,
74
+ review: result.review,
75
+ final: result.final,
72
76
  file: {
73
77
  filename: comp.filename,
74
78
  namespace: comp.namespace,
@@ -108,7 +112,7 @@ function process(ctx, targetComponent, otherComponents) {
108
112
  });
109
113
  (0, enforceToolCall_1.enforceToolCall)(agentica);
110
114
  yield agentica.conversate("Make prisma schema file please").finally(() => {
111
- const tokenUsage = agentica.getTokenUsage();
115
+ const tokenUsage = agentica.getTokenUsage().aggregate;
112
116
  ctx.usage().record(tokenUsage, ["prisma"]);
113
117
  });
114
118
  if (pointer.value === null)
@@ -198,29 +202,27 @@ const claude = {
198
202
  {
199
203
  name: "makePrismaSchemaFile",
200
204
  parameters: {
201
- description: " Properties containing the file\n\n------------------------------\n\nCurrent Type: {@link IMakePrismaSchemaFileProps}",
205
+ description: " Properties containing the file\n\n------------------------------\n\nCurrent Type: {@link IAutoBePrismaSchemaApplication.IProps}",
202
206
  type: "object",
203
207
  properties: {
204
- tablesToCreate: {
205
- description: "STEP 1: First enumeration of tables that must be created\n\nList all table names that need to be created based on the\n`targetComponent.tables`. This should be an exact copy of the\n`targetComponent.tables` array.\n\nExample: [\"shopping_goods\", \"shopping_goods_options\"]",
206
- type: "array",
207
- items: {
208
- type: "string"
209
- }
208
+ thinking: {
209
+ description: "Step 1: Strategic database design analysis and planning.\n\nAI analyzes the target component and business requirements to formulate a\ncomprehensive database design strategy. This planning phase is crucial\nfor creating well-structured, normalized schemas that align with business\nobjectives. The AI must define table structures, relationships, indexing\nstrategies, and data integrity constraints before proceeding to schema\nimplementation.\n\n**Key Considerations:**\n\n- **Assignment Validation**: Extract targetComponent.tables as the complete\n specification\n- **Table Count**: Must create exactly targetComponent.tables.length models\n- **Other Components**: Identify already-created tables for foreign key\n references only\n- **Normalization**: Strict adherence to 1NF, 2NF, 3NF principles\n- **Snapshot Architecture**: Design for historical data preservation and\n audit trails\n- **Junction Tables**: Plan M:N relationships with proper naming\n ({table1}_{table2})\n- **Materialized Views**: Identify needs for mv_ prefixed denormalized\n tables\n\nWorkflow: Component analysis \u2192 Strategic planning \u2192 Design rationale",
210
+ type: "string"
210
211
  },
211
- validationReview: {
212
- description: "STEP 2: Validation review of the first enumeration\n\nCompare `tablesToCreate` against `targetComponent.tables` and\n`otherComponents[].tables`. Write a review statement that validates:\n\n- All tables from `targetComponent.tables` are included\n- No tables from `otherComponents[].tables` are included\n- Additional tables (if any) are for M:N junction relationships or\n domain-specific needs\n- No forbidden tables from other domains are included\n\nExample: \"VALIDATION PASSED: All required tables from\n`targetComponent.tables` included: shopping_goods, shopping_goods_options.\nFORBIDDEN CHECK: No tables from `otherComponents` included\n(shopping_customers, shopping_sellers are correctly excluded). Additional\ntables: none needed for this domain.\"",
212
+ draft: {
213
+ description: "Step 2: Initial Prisma schema code implementation.\n\nAI generates the first working version of the Prisma schema based on the\nstrategic plan. This draft must be syntactically correct Prisma Schema\nLanguage (PSL) code that implements all planned tables, relationships,\nand constraints. The schema should follow Prisma conventions while\nincorporating enterprise patterns like snapshot tables and materialized\nviews.\n\n**Implementation Requirements:**\n\n- **Exact Table Names**: Use EXACT names from targetComponent.tables (NO\n CHANGES)\n- **Valid PSL Syntax**: Proper model blocks, field definitions, and\n directives\n- **Primary Keys**: Always UUID type with `@id` directive\n- **Foreign Keys**: UUID type following {target_model}_id naming pattern\n- **Data Types**: uuid, string, int, double, datetime, boolean, uri (no\n pre-calculated fields)\n- **Relationships**: Proper `@relation` directives for 1:1, 1:N, M:N\n patterns\n- **Descriptions**: Follow format with requirements mapping and business\n purpose\n- **NO Prohibited Fields**: No totals, cached values, aggregates in regular\n tables\n\nWorkflow: Strategic plan \u2192 PSL implementation \u2192 Functional schema code",
213
214
  type: "string"
214
215
  },
215
- confirmedTables: {
216
- description: "STEP 3: Second enumeration of tables to create\n\nAfter validation, re-list the tables that will be created. This should be\nidentical to `tablesToCreate` if validation passed. This serves as the\nfinal confirmed list before model creation.\n\nExample: [\"shopping_goods\", \"shopping_goods_options\"]",
217
- type: "array",
218
- items: {
219
- type: "string"
220
- }
216
+ review: {
217
+ description: "Step 3: Schema code review and quality assessment.\n\nAI performs a thorough review of the draft schema implementation,\nexamining multiple quality dimensions to ensure production readiness.\nThis review process identifies issues, suggests improvements, and\nvalidates compliance with best practices.\n\n**Review Dimensions:**\n\n**Syntax & Compilation:**\n\n- Prisma schema syntax errors and invalid directives\n- Model naming matches targetComponent.tables EXACTLY\n- Field type appropriateness (uuid for keys, no calculated fields)\n- Relationship definition correctness (`@relation` syntax)\n\n**Database Design Quality:**\n\n- **Normalization Compliance**:\n\n - 1NF: Atomic values, no repeating groups\n - 2NF: No partial dependencies on composite keys\n - 3NF: No transitive dependencies\n- **Prohibited Fields Check**: No pre-calculated totals, cached values, or\n aggregates in regular tables\n- **Snapshot Pattern**: Proper implementation for audit trails\n- **Junction Tables**: Correct naming ({table1}_{table2}) and structure\n\n**Index Strategy Validation:**\n\n- NO single foreign key indexes (Prisma auto-creates these)\n- Composite indexes for query patterns\n- Unique indexes for business constraints\n- GIN indexes for full-text search fields\n\n**Description Quality:**\n\n- Models include: requirement mapping, business purpose, relationships,\n behaviors\n- Fields include: requirement aspect, business meaning, normalization\n rationale\n\nWorkflow: Draft schema \u2192 Systematic analysis \u2192 Specific improvements",
218
+ type: "string"
219
+ },
220
+ final: {
221
+ description: "Step 4: Final production-ready Prisma schema code.\n\nAI produces the final, polished version of the Prisma schema\nincorporating all review feedback. This code represents the completed\nschema implementation, ready for database migration and production\ndeployment. All identified issues must be resolved, and the schema must\nmeet enterprise-grade quality standards.\n\n**Final Schema Characteristics:**\n\n- **Complete Coverage**: All targetComponent.tables implemented with exact\n names\n- **Zero Errors**: Valid PSL syntax, no compilation warnings\n- **Proper Relationships**: All foreign keys reference existing tables\n correctly\n- **Optimized Indexes**: Strategic indexes without redundant foreign key\n indexes\n- **Full Normalization**: Strict 3NF compliance, denormalization only in\n mv_ tables\n- **Enterprise Documentation**: Complete descriptions with business context\n- **Audit Support**: Proper snapshot patterns and temporal fields\n (created_at, updated_at, deleted_at)\n- **Type Safety**: Consistent use of UUID for all keys, appropriate field\n types\n\nWorkflow: Review feedback \u2192 Schema refinement \u2192 Production-ready PSL code",
222
+ type: "string"
221
223
  },
222
224
  models: {
223
- description: "STEP 4: Array of Prisma models (database tables) within the domain\n\nCreate exactly one model for each table in `confirmedTables`. Each model\nrepresents a business entity or concept within the namespace. Models can\nreference each other through foreign key relationships.\n\nThe `models` array length must equal `confirmedTables.length`. Each\n`model.name` must match an entry in `confirmedTables`.",
225
+ description: "Step 5: Structured AST representation of the Prisma schema models.\n\nAI transforms the final Prisma schema code into a structured Abstract\nSyntax Tree (AST) representation using the AutoBePrisma.IModel interface.\nThis involves critical reinterpretation and reclassification of the final\ncode to conform to AST constraints.\n\n**CRITICAL: Reinterpretation & Post-Processing Required**\n\nThe AI-generated final code may not directly map to valid AST structures\ndue to:\n\n- Complex Prisma directives that need decomposition\n- Field attributes that require reclassification\n- Implicit relationships that need explicit AST representation\n- Schema-level constructs that must be distributed to models\n\n**Required Post-Processing Steps:**\n\n1. **Field Reclassification**: Separate fields into primary, foreign, and\n plain categories\n2. **Relationship Extraction**: Convert `@relation` directives to IRelation\n structures\n3. **Index Decomposition**: Parse `@@index`, `@@unique` into appropriate\n index arrays\n4. **Type Normalization**: Map Prisma types to AST type enum values\n5. **Constraint Resolution**: Convert schema constraints to AST properties\n\n**AST Structure Requirements:**\n\n- **Model Array**: Each table from targetComponent.tables as IModel\n- **Primary Field**: Always UUID type with name \"id\"\n- **Foreign Fields**: Proper IRelation configurations for all relationships\n- **Plain Fields**: Business fields with correct types (no calculated\n fields)\n- **Indexes**:\n\n - UniqueIndexes: Business constraints and composite unique keys\n - PlainIndexes: Query optimization (no single foreign key indexes)\n - GinIndexes: Full-text search on string fields\n- **Material Flag**: true only for mv_ prefixed tables\n\n**Relationship Patterns in AST:**\n\n- 1:1: Foreign field with unique: true\n- 1:N: Foreign field with unique: false\n- M:N: Separate junction table model with composite indexes\n\nWorkflow: Final PSL code \u2192 Reinterpretation \u2192 AST transformation \u2192\nStructured models\n\nThis structured representation serves as the ultimate deliverable for\nprogrammatic schema generation and manipulation.",
224
226
  type: "array",
225
227
  items: {
226
228
  $ref: "#/$defs/AutoBePrisma.IModel"
@@ -228,9 +230,10 @@ const claude = {
228
230
  }
229
231
  },
230
232
  required: [
231
- "tablesToCreate",
232
- "validationReview",
233
- "confirmedTables",
233
+ "thinking",
234
+ "draft",
235
+ "review",
236
+ "final",
234
237
  "models"
235
238
  ],
236
239
  additionalProperties: false,
@@ -494,44 +497,32 @@ const claude = {
494
497
  }
495
498
  },
496
499
  description: "Generates comprehensive Prisma schema files based on detailed requirements\nanalysis.\n\nCreates multiple organized schema files following enterprise patterns\nincluding proper domain separation, relationship modeling, snapshot\npatterns, inheritance, materialized views, and comprehensive documentation.\nThe generated schemas implement best practices for scalability,\nmaintainability, and data integrity.",
497
- validate: (() => { const _io0 = input => Array.isArray(input.tablesToCreate) && input.tablesToCreate.every(elem => "string" === typeof elem) && "string" === typeof input.validationReview && (Array.isArray(input.confirmedTables) && input.confirmedTables.every(elem => "string" === typeof elem)) && (Array.isArray(input.models) && input.models.every(elem => "object" === typeof elem && null !== elem && _io1(elem))); const _io1 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "string" === typeof input.description && "boolean" === typeof input.material && ("object" === typeof input.primaryField && null !== input.primaryField && _io2(input.primaryField)) && (Array.isArray(input.foreignFields) && input.foreignFields.every(elem => "object" === typeof elem && null !== elem && _io3(elem))) && (Array.isArray(input.plainFields) && input.plainFields.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (Array.isArray(input.uniqueIndexes) && input.uniqueIndexes.every(elem => "object" === typeof elem && null !== elem && _io6(elem))) && (Array.isArray(input.plainIndexes) && input.plainIndexes.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (Array.isArray(input.ginIndexes) && input.ginIndexes.every(elem => "object" === typeof elem && null !== elem && _io8(elem))); const _io2 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description; const _io3 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description && ("object" === typeof input.relation && null !== input.relation && _io4(input.relation)) && "boolean" === typeof input.unique && "boolean" === typeof input.nullable; const _io4 = input => "string" === typeof input.name && RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) && "string" === typeof input.targetModel; const _io5 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && ("string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type) && "string" === typeof input.description && "boolean" === typeof input.nullable; const _io6 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)) && true === input.unique; const _io7 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)); const _io8 = input => "string" === typeof input.fieldName; const _vo0 = (input, _path, _exceptionable = true) => [(Array.isArray(input.tablesToCreate) || _report(_exceptionable, {
498
- path: _path + ".tablesToCreate",
499
- expected: "Array<string>",
500
- value: input.tablesToCreate
501
- })) && input.tablesToCreate.map((elem, _index11) => "string" === typeof elem || _report(_exceptionable, {
502
- path: _path + ".tablesToCreate[" + _index11 + "]",
500
+ validate: (() => { const _io0 = input => "string" === typeof input.thinking && "string" === typeof input.draft && "string" === typeof input.review && "string" === typeof input.final && (Array.isArray(input.models) && input.models.every(elem => "object" === typeof elem && null !== elem && _io1(elem))); const _io1 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "string" === typeof input.description && "boolean" === typeof input.material && ("object" === typeof input.primaryField && null !== input.primaryField && _io2(input.primaryField)) && (Array.isArray(input.foreignFields) && input.foreignFields.every(elem => "object" === typeof elem && null !== elem && _io3(elem))) && (Array.isArray(input.plainFields) && input.plainFields.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (Array.isArray(input.uniqueIndexes) && input.uniqueIndexes.every(elem => "object" === typeof elem && null !== elem && _io6(elem))) && (Array.isArray(input.plainIndexes) && input.plainIndexes.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (Array.isArray(input.ginIndexes) && input.ginIndexes.every(elem => "object" === typeof elem && null !== elem && _io8(elem))); const _io2 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description; const _io3 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description && ("object" === typeof input.relation && null !== input.relation && _io4(input.relation)) && "boolean" === typeof input.unique && "boolean" === typeof input.nullable; const _io4 = input => "string" === typeof input.name && RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) && "string" === typeof input.targetModel; const _io5 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && ("string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type) && "string" === typeof input.description && "boolean" === typeof input.nullable; const _io6 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)) && true === input.unique; const _io7 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)); const _io8 = input => "string" === typeof input.fieldName; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.thinking || _report(_exceptionable, {
501
+ path: _path + ".thinking",
503
502
  expected: "string",
504
- value: elem
505
- })).every(flag => flag) || _report(_exceptionable, {
506
- path: _path + ".tablesToCreate",
507
- expected: "Array<string>",
508
- value: input.tablesToCreate
509
- }), "string" === typeof input.validationReview || _report(_exceptionable, {
510
- path: _path + ".validationReview",
503
+ value: input.thinking
504
+ }), "string" === typeof input.draft || _report(_exceptionable, {
505
+ path: _path + ".draft",
511
506
  expected: "string",
512
- value: input.validationReview
513
- }), (Array.isArray(input.confirmedTables) || _report(_exceptionable, {
514
- path: _path + ".confirmedTables",
515
- expected: "Array<string>",
516
- value: input.confirmedTables
517
- })) && input.confirmedTables.map((elem, _index12) => "string" === typeof elem || _report(_exceptionable, {
518
- path: _path + ".confirmedTables[" + _index12 + "]",
507
+ value: input.draft
508
+ }), "string" === typeof input.review || _report(_exceptionable, {
509
+ path: _path + ".review",
519
510
  expected: "string",
520
- value: elem
521
- })).every(flag => flag) || _report(_exceptionable, {
522
- path: _path + ".confirmedTables",
523
- expected: "Array<string>",
524
- value: input.confirmedTables
511
+ value: input.review
512
+ }), "string" === typeof input.final || _report(_exceptionable, {
513
+ path: _path + ".final",
514
+ expected: "string",
515
+ value: input.final
525
516
  }), (Array.isArray(input.models) || _report(_exceptionable, {
526
517
  path: _path + ".models",
527
518
  expected: "Array<AutoBePrisma.IModel>",
528
519
  value: input.models
529
- })) && input.models.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
530
- path: _path + ".models[" + _index13 + "]",
520
+ })) && input.models.map((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
521
+ path: _path + ".models[" + _index9 + "]",
531
522
  expected: "AutoBePrisma.IModel",
532
523
  value: elem
533
- })) && _vo1(elem, _path + ".models[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
534
- path: _path + ".models[" + _index13 + "]",
524
+ })) && _vo1(elem, _path + ".models[" + _index9 + "]", true && _exceptionable) || _report(_exceptionable, {
525
+ path: _path + ".models[" + _index9 + "]",
535
526
  expected: "AutoBePrisma.IModel",
536
527
  value: elem
537
528
  })).every(flag => flag) || _report(_exceptionable, {
@@ -566,12 +557,12 @@ const claude = {
566
557
  path: _path + ".foreignFields",
567
558
  expected: "Array<AutoBePrisma.IForeignField>",
568
559
  value: input.foreignFields
569
- })) && input.foreignFields.map((elem, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
570
- path: _path + ".foreignFields[" + _index14 + "]",
560
+ })) && input.foreignFields.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
561
+ path: _path + ".foreignFields[" + _index10 + "]",
571
562
  expected: "AutoBePrisma.IForeignField",
572
563
  value: elem
573
- })) && _vo3(elem, _path + ".foreignFields[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, {
574
- path: _path + ".foreignFields[" + _index14 + "]",
564
+ })) && _vo3(elem, _path + ".foreignFields[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, {
565
+ path: _path + ".foreignFields[" + _index10 + "]",
575
566
  expected: "AutoBePrisma.IForeignField",
576
567
  value: elem
577
568
  })).every(flag => flag) || _report(_exceptionable, {
@@ -582,12 +573,12 @@ const claude = {
582
573
  path: _path + ".plainFields",
583
574
  expected: "Array<AutoBePrisma.IPlainField>",
584
575
  value: input.plainFields
585
- })) && input.plainFields.map((elem, _index15) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
586
- path: _path + ".plainFields[" + _index15 + "]",
576
+ })) && input.plainFields.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
577
+ path: _path + ".plainFields[" + _index11 + "]",
587
578
  expected: "AutoBePrisma.IPlainField",
588
579
  value: elem
589
- })) && _vo5(elem, _path + ".plainFields[" + _index15 + "]", true && _exceptionable) || _report(_exceptionable, {
590
- path: _path + ".plainFields[" + _index15 + "]",
580
+ })) && _vo5(elem, _path + ".plainFields[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, {
581
+ path: _path + ".plainFields[" + _index11 + "]",
591
582
  expected: "AutoBePrisma.IPlainField",
592
583
  value: elem
593
584
  })).every(flag => flag) || _report(_exceptionable, {
@@ -598,12 +589,12 @@ const claude = {
598
589
  path: _path + ".uniqueIndexes",
599
590
  expected: "Array<AutoBePrisma.IUniqueIndex>",
600
591
  value: input.uniqueIndexes
601
- })) && input.uniqueIndexes.map((elem, _index16) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
602
- path: _path + ".uniqueIndexes[" + _index16 + "]",
592
+ })) && input.uniqueIndexes.map((elem, _index12) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
593
+ path: _path + ".uniqueIndexes[" + _index12 + "]",
603
594
  expected: "AutoBePrisma.IUniqueIndex",
604
595
  value: elem
605
- })) && _vo6(elem, _path + ".uniqueIndexes[" + _index16 + "]", true && _exceptionable) || _report(_exceptionable, {
606
- path: _path + ".uniqueIndexes[" + _index16 + "]",
596
+ })) && _vo6(elem, _path + ".uniqueIndexes[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, {
597
+ path: _path + ".uniqueIndexes[" + _index12 + "]",
607
598
  expected: "AutoBePrisma.IUniqueIndex",
608
599
  value: elem
609
600
  })).every(flag => flag) || _report(_exceptionable, {
@@ -614,12 +605,12 @@ const claude = {
614
605
  path: _path + ".plainIndexes",
615
606
  expected: "Array<AutoBePrisma.IPlainIndex>",
616
607
  value: input.plainIndexes
617
- })) && input.plainIndexes.map((elem, _index17) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
618
- path: _path + ".plainIndexes[" + _index17 + "]",
608
+ })) && input.plainIndexes.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
609
+ path: _path + ".plainIndexes[" + _index13 + "]",
619
610
  expected: "AutoBePrisma.IPlainIndex",
620
611
  value: elem
621
- })) && _vo7(elem, _path + ".plainIndexes[" + _index17 + "]", true && _exceptionable) || _report(_exceptionable, {
622
- path: _path + ".plainIndexes[" + _index17 + "]",
612
+ })) && _vo7(elem, _path + ".plainIndexes[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
613
+ path: _path + ".plainIndexes[" + _index13 + "]",
623
614
  expected: "AutoBePrisma.IPlainIndex",
624
615
  value: elem
625
616
  })).every(flag => flag) || _report(_exceptionable, {
@@ -630,12 +621,12 @@ const claude = {
630
621
  path: _path + ".ginIndexes",
631
622
  expected: "Array<AutoBePrisma.IGinIndex>",
632
623
  value: input.ginIndexes
633
- })) && input.ginIndexes.map((elem, _index18) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
634
- path: _path + ".ginIndexes[" + _index18 + "]",
624
+ })) && input.ginIndexes.map((elem, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
625
+ path: _path + ".ginIndexes[" + _index14 + "]",
635
626
  expected: "AutoBePrisma.IGinIndex",
636
627
  value: elem
637
- })) && _vo8(elem, _path + ".ginIndexes[" + _index18 + "]", true && _exceptionable) || _report(_exceptionable, {
638
- path: _path + ".ginIndexes[" + _index18 + "]",
628
+ })) && _vo8(elem, _path + ".ginIndexes[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, {
629
+ path: _path + ".ginIndexes[" + _index14 + "]",
639
630
  expected: "AutoBePrisma.IGinIndex",
640
631
  value: elem
641
632
  })).every(flag => flag) || _report(_exceptionable, {
@@ -734,8 +725,8 @@ const claude = {
734
725
  path: _path + ".fieldNames",
735
726
  expected: "Array<> & UniqueItems<true>",
736
727
  value: input.fieldNames
737
- })) && input.fieldNames.map((elem, _index19) => "string" === typeof elem || _report(_exceptionable, {
738
- path: _path + ".fieldNames[" + _index19 + "]",
728
+ })) && input.fieldNames.map((elem, _index15) => "string" === typeof elem || _report(_exceptionable, {
729
+ path: _path + ".fieldNames[" + _index15 + "]",
739
730
  expected: "string",
740
731
  value: elem
741
732
  })).every(flag => flag)) || _report(_exceptionable, {
@@ -758,8 +749,8 @@ const claude = {
758
749
  path: _path + ".fieldNames",
759
750
  expected: "Array<> & UniqueItems<true>",
760
751
  value: input.fieldNames
761
- })) && input.fieldNames.map((elem, _index20) => "string" === typeof elem || _report(_exceptionable, {
762
- path: _path + ".fieldNames[" + _index20 + "]",
752
+ })) && input.fieldNames.map((elem, _index16) => "string" === typeof elem || _report(_exceptionable, {
753
+ path: _path + ".fieldNames[" + _index16 + "]",
763
754
  expected: "string",
764
755
  value: elem
765
756
  })).every(flag => flag)) || _report(_exceptionable, {
@@ -776,11 +767,11 @@ const claude = {
776
767
  _report = __typia_transform__validateReport._validateReport(errors);
777
768
  ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
778
769
  path: _path + "",
779
- expected: "IMakePrismaSchemaFileProps",
770
+ expected: "IAutoBePrismaSchemaApplication.IProps",
780
771
  value: input
781
772
  })) && _vo0(input, _path + "", true) || _report(true, {
782
773
  path: _path + "",
783
- expected: "IMakePrismaSchemaFileProps",
774
+ expected: "IAutoBePrismaSchemaApplication.IProps",
784
775
  value: input
785
776
  }))(input, "$input", true);
786
777
  const success = 0 === errors.length;
@@ -813,29 +804,27 @@ const collection = {
813
804
  {
814
805
  name: "makePrismaSchemaFile",
815
806
  parameters: {
816
- description: " Properties containing the file\n\n------------------------------\n\nCurrent Type: {@link IMakePrismaSchemaFileProps}",
807
+ description: " Properties containing the file\n\n------------------------------\n\nCurrent Type: {@link IAutoBePrismaSchemaApplication.IProps}",
817
808
  type: "object",
818
809
  properties: {
819
- tablesToCreate: {
820
- description: "STEP 1: First enumeration of tables that must be created\n\nList all table names that need to be created based on the\n`targetComponent.tables`. This should be an exact copy of the\n`targetComponent.tables` array.\n\nExample: [\"shopping_goods\", \"shopping_goods_options\"]",
821
- type: "array",
822
- items: {
823
- type: "string"
824
- }
810
+ thinking: {
811
+ description: "Step 1: Strategic database design analysis and planning.\n\nAI analyzes the target component and business requirements to formulate a\ncomprehensive database design strategy. This planning phase is crucial\nfor creating well-structured, normalized schemas that align with business\nobjectives. The AI must define table structures, relationships, indexing\nstrategies, and data integrity constraints before proceeding to schema\nimplementation.\n\n**Key Considerations:**\n\n- **Assignment Validation**: Extract targetComponent.tables as the complete\n specification\n- **Table Count**: Must create exactly targetComponent.tables.length models\n- **Other Components**: Identify already-created tables for foreign key\n references only\n- **Normalization**: Strict adherence to 1NF, 2NF, 3NF principles\n- **Snapshot Architecture**: Design for historical data preservation and\n audit trails\n- **Junction Tables**: Plan M:N relationships with proper naming\n ({table1}_{table2})\n- **Materialized Views**: Identify needs for mv_ prefixed denormalized\n tables\n\nWorkflow: Component analysis \u2192 Strategic planning \u2192 Design rationale",
812
+ type: "string"
825
813
  },
826
- validationReview: {
827
- description: "STEP 2: Validation review of the first enumeration\n\nCompare `tablesToCreate` against `targetComponent.tables` and\n`otherComponents[].tables`. Write a review statement that validates:\n\n- All tables from `targetComponent.tables` are included\n- No tables from `otherComponents[].tables` are included\n- Additional tables (if any) are for M:N junction relationships or\n domain-specific needs\n- No forbidden tables from other domains are included\n\nExample: \"VALIDATION PASSED: All required tables from\n`targetComponent.tables` included: shopping_goods, shopping_goods_options.\nFORBIDDEN CHECK: No tables from `otherComponents` included\n(shopping_customers, shopping_sellers are correctly excluded). Additional\ntables: none needed for this domain.\"",
814
+ draft: {
815
+ description: "Step 2: Initial Prisma schema code implementation.\n\nAI generates the first working version of the Prisma schema based on the\nstrategic plan. This draft must be syntactically correct Prisma Schema\nLanguage (PSL) code that implements all planned tables, relationships,\nand constraints. The schema should follow Prisma conventions while\nincorporating enterprise patterns like snapshot tables and materialized\nviews.\n\n**Implementation Requirements:**\n\n- **Exact Table Names**: Use EXACT names from targetComponent.tables (NO\n CHANGES)\n- **Valid PSL Syntax**: Proper model blocks, field definitions, and\n directives\n- **Primary Keys**: Always UUID type with `@id` directive\n- **Foreign Keys**: UUID type following {target_model}_id naming pattern\n- **Data Types**: uuid, string, int, double, datetime, boolean, uri (no\n pre-calculated fields)\n- **Relationships**: Proper `@relation` directives for 1:1, 1:N, M:N\n patterns\n- **Descriptions**: Follow format with requirements mapping and business\n purpose\n- **NO Prohibited Fields**: No totals, cached values, aggregates in regular\n tables\n\nWorkflow: Strategic plan \u2192 PSL implementation \u2192 Functional schema code",
828
816
  type: "string"
829
817
  },
830
- confirmedTables: {
831
- description: "STEP 3: Second enumeration of tables to create\n\nAfter validation, re-list the tables that will be created. This should be\nidentical to `tablesToCreate` if validation passed. This serves as the\nfinal confirmed list before model creation.\n\nExample: [\"shopping_goods\", \"shopping_goods_options\"]",
832
- type: "array",
833
- items: {
834
- type: "string"
835
- }
818
+ review: {
819
+ description: "Step 3: Schema code review and quality assessment.\n\nAI performs a thorough review of the draft schema implementation,\nexamining multiple quality dimensions to ensure production readiness.\nThis review process identifies issues, suggests improvements, and\nvalidates compliance with best practices.\n\n**Review Dimensions:**\n\n**Syntax & Compilation:**\n\n- Prisma schema syntax errors and invalid directives\n- Model naming matches targetComponent.tables EXACTLY\n- Field type appropriateness (uuid for keys, no calculated fields)\n- Relationship definition correctness (`@relation` syntax)\n\n**Database Design Quality:**\n\n- **Normalization Compliance**:\n\n - 1NF: Atomic values, no repeating groups\n - 2NF: No partial dependencies on composite keys\n - 3NF: No transitive dependencies\n- **Prohibited Fields Check**: No pre-calculated totals, cached values, or\n aggregates in regular tables\n- **Snapshot Pattern**: Proper implementation for audit trails\n- **Junction Tables**: Correct naming ({table1}_{table2}) and structure\n\n**Index Strategy Validation:**\n\n- NO single foreign key indexes (Prisma auto-creates these)\n- Composite indexes for query patterns\n- Unique indexes for business constraints\n- GIN indexes for full-text search fields\n\n**Description Quality:**\n\n- Models include: requirement mapping, business purpose, relationships,\n behaviors\n- Fields include: requirement aspect, business meaning, normalization\n rationale\n\nWorkflow: Draft schema \u2192 Systematic analysis \u2192 Specific improvements",
820
+ type: "string"
821
+ },
822
+ final: {
823
+ description: "Step 4: Final production-ready Prisma schema code.\n\nAI produces the final, polished version of the Prisma schema\nincorporating all review feedback. This code represents the completed\nschema implementation, ready for database migration and production\ndeployment. All identified issues must be resolved, and the schema must\nmeet enterprise-grade quality standards.\n\n**Final Schema Characteristics:**\n\n- **Complete Coverage**: All targetComponent.tables implemented with exact\n names\n- **Zero Errors**: Valid PSL syntax, no compilation warnings\n- **Proper Relationships**: All foreign keys reference existing tables\n correctly\n- **Optimized Indexes**: Strategic indexes without redundant foreign key\n indexes\n- **Full Normalization**: Strict 3NF compliance, denormalization only in\n mv_ tables\n- **Enterprise Documentation**: Complete descriptions with business context\n- **Audit Support**: Proper snapshot patterns and temporal fields\n (created_at, updated_at, deleted_at)\n- **Type Safety**: Consistent use of UUID for all keys, appropriate field\n types\n\nWorkflow: Review feedback \u2192 Schema refinement \u2192 Production-ready PSL code",
824
+ type: "string"
836
825
  },
837
826
  models: {
838
- description: "STEP 4: Array of Prisma models (database tables) within the domain\n\nCreate exactly one model for each table in `confirmedTables`. Each model\nrepresents a business entity or concept within the namespace. Models can\nreference each other through foreign key relationships.\n\nThe `models` array length must equal `confirmedTables.length`. Each\n`model.name` must match an entry in `confirmedTables`.",
827
+ description: "Step 5: Structured AST representation of the Prisma schema models.\n\nAI transforms the final Prisma schema code into a structured Abstract\nSyntax Tree (AST) representation using the AutoBePrisma.IModel interface.\nThis involves critical reinterpretation and reclassification of the final\ncode to conform to AST constraints.\n\n**CRITICAL: Reinterpretation & Post-Processing Required**\n\nThe AI-generated final code may not directly map to valid AST structures\ndue to:\n\n- Complex Prisma directives that need decomposition\n- Field attributes that require reclassification\n- Implicit relationships that need explicit AST representation\n- Schema-level constructs that must be distributed to models\n\n**Required Post-Processing Steps:**\n\n1. **Field Reclassification**: Separate fields into primary, foreign, and\n plain categories\n2. **Relationship Extraction**: Convert `@relation` directives to IRelation\n structures\n3. **Index Decomposition**: Parse `@@index`, `@@unique` into appropriate\n index arrays\n4. **Type Normalization**: Map Prisma types to AST type enum values\n5. **Constraint Resolution**: Convert schema constraints to AST properties\n\n**AST Structure Requirements:**\n\n- **Model Array**: Each table from targetComponent.tables as IModel\n- **Primary Field**: Always UUID type with name \"id\"\n- **Foreign Fields**: Proper IRelation configurations for all relationships\n- **Plain Fields**: Business fields with correct types (no calculated\n fields)\n- **Indexes**:\n\n - UniqueIndexes: Business constraints and composite unique keys\n - PlainIndexes: Query optimization (no single foreign key indexes)\n - GinIndexes: Full-text search on string fields\n- **Material Flag**: true only for mv_ prefixed tables\n\n**Relationship Patterns in AST:**\n\n- 1:1: Foreign field with unique: true\n- 1:N: Foreign field with unique: false\n- M:N: Separate junction table model with composite indexes\n\nWorkflow: Final PSL code \u2192 Reinterpretation \u2192 AST transformation \u2192\nStructured models\n\nThis structured representation serves as the ultimate deliverable for\nprogrammatic schema generation and manipulation.",
839
828
  type: "array",
840
829
  items: {
841
830
  $ref: "#/$defs/AutoBePrisma.IModel"
@@ -843,9 +832,10 @@ const collection = {
843
832
  }
844
833
  },
845
834
  required: [
846
- "tablesToCreate",
847
- "validationReview",
848
- "confirmedTables",
835
+ "thinking",
836
+ "draft",
837
+ "review",
838
+ "final",
849
839
  "models"
850
840
  ],
851
841
  additionalProperties: false,
@@ -1094,44 +1084,32 @@ const collection = {
1094
1084
  }
1095
1085
  },
1096
1086
  description: "Generates comprehensive Prisma schema files based on detailed requirements\nanalysis.\n\nCreates multiple organized schema files following enterprise patterns\nincluding proper domain separation, relationship modeling, snapshot\npatterns, inheritance, materialized views, and comprehensive documentation.\nThe generated schemas implement best practices for scalability,\nmaintainability, and data integrity.",
1097
- validate: (() => { const _io0 = input => Array.isArray(input.tablesToCreate) && input.tablesToCreate.every(elem => "string" === typeof elem) && "string" === typeof input.validationReview && (Array.isArray(input.confirmedTables) && input.confirmedTables.every(elem => "string" === typeof elem)) && (Array.isArray(input.models) && input.models.every(elem => "object" === typeof elem && null !== elem && _io1(elem))); const _io1 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "string" === typeof input.description && "boolean" === typeof input.material && ("object" === typeof input.primaryField && null !== input.primaryField && _io2(input.primaryField)) && (Array.isArray(input.foreignFields) && input.foreignFields.every(elem => "object" === typeof elem && null !== elem && _io3(elem))) && (Array.isArray(input.plainFields) && input.plainFields.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (Array.isArray(input.uniqueIndexes) && input.uniqueIndexes.every(elem => "object" === typeof elem && null !== elem && _io6(elem))) && (Array.isArray(input.plainIndexes) && input.plainIndexes.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (Array.isArray(input.ginIndexes) && input.ginIndexes.every(elem => "object" === typeof elem && null !== elem && _io8(elem))); const _io2 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description; const _io3 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description && ("object" === typeof input.relation && null !== input.relation && _io4(input.relation)) && "boolean" === typeof input.unique && "boolean" === typeof input.nullable; const _io4 = input => "string" === typeof input.name && RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) && "string" === typeof input.targetModel; const _io5 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && ("string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type) && "string" === typeof input.description && "boolean" === typeof input.nullable; const _io6 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)) && true === input.unique; const _io7 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)); const _io8 = input => "string" === typeof input.fieldName; const _vo0 = (input, _path, _exceptionable = true) => [(Array.isArray(input.tablesToCreate) || _report(_exceptionable, {
1098
- path: _path + ".tablesToCreate",
1099
- expected: "Array<string>",
1100
- value: input.tablesToCreate
1101
- })) && input.tablesToCreate.map((elem, _index11) => "string" === typeof elem || _report(_exceptionable, {
1102
- path: _path + ".tablesToCreate[" + _index11 + "]",
1087
+ validate: (() => { const _io0 = input => "string" === typeof input.thinking && "string" === typeof input.draft && "string" === typeof input.review && "string" === typeof input.final && (Array.isArray(input.models) && input.models.every(elem => "object" === typeof elem && null !== elem && _io1(elem))); const _io1 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "string" === typeof input.description && "boolean" === typeof input.material && ("object" === typeof input.primaryField && null !== input.primaryField && _io2(input.primaryField)) && (Array.isArray(input.foreignFields) && input.foreignFields.every(elem => "object" === typeof elem && null !== elem && _io3(elem))) && (Array.isArray(input.plainFields) && input.plainFields.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (Array.isArray(input.uniqueIndexes) && input.uniqueIndexes.every(elem => "object" === typeof elem && null !== elem && _io6(elem))) && (Array.isArray(input.plainIndexes) && input.plainIndexes.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (Array.isArray(input.ginIndexes) && input.ginIndexes.every(elem => "object" === typeof elem && null !== elem && _io8(elem))); const _io2 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description; const _io3 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description && ("object" === typeof input.relation && null !== input.relation && _io4(input.relation)) && "boolean" === typeof input.unique && "boolean" === typeof input.nullable; const _io4 = input => "string" === typeof input.name && RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) && "string" === typeof input.targetModel; const _io5 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && ("string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type) && "string" === typeof input.description && "boolean" === typeof input.nullable; const _io6 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)) && true === input.unique; const _io7 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)); const _io8 = input => "string" === typeof input.fieldName; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.thinking || _report(_exceptionable, {
1088
+ path: _path + ".thinking",
1103
1089
  expected: "string",
1104
- value: elem
1105
- })).every(flag => flag) || _report(_exceptionable, {
1106
- path: _path + ".tablesToCreate",
1107
- expected: "Array<string>",
1108
- value: input.tablesToCreate
1109
- }), "string" === typeof input.validationReview || _report(_exceptionable, {
1110
- path: _path + ".validationReview",
1090
+ value: input.thinking
1091
+ }), "string" === typeof input.draft || _report(_exceptionable, {
1092
+ path: _path + ".draft",
1111
1093
  expected: "string",
1112
- value: input.validationReview
1113
- }), (Array.isArray(input.confirmedTables) || _report(_exceptionable, {
1114
- path: _path + ".confirmedTables",
1115
- expected: "Array<string>",
1116
- value: input.confirmedTables
1117
- })) && input.confirmedTables.map((elem, _index12) => "string" === typeof elem || _report(_exceptionable, {
1118
- path: _path + ".confirmedTables[" + _index12 + "]",
1094
+ value: input.draft
1095
+ }), "string" === typeof input.review || _report(_exceptionable, {
1096
+ path: _path + ".review",
1119
1097
  expected: "string",
1120
- value: elem
1121
- })).every(flag => flag) || _report(_exceptionable, {
1122
- path: _path + ".confirmedTables",
1123
- expected: "Array<string>",
1124
- value: input.confirmedTables
1098
+ value: input.review
1099
+ }), "string" === typeof input.final || _report(_exceptionable, {
1100
+ path: _path + ".final",
1101
+ expected: "string",
1102
+ value: input.final
1125
1103
  }), (Array.isArray(input.models) || _report(_exceptionable, {
1126
1104
  path: _path + ".models",
1127
1105
  expected: "Array<AutoBePrisma.IModel>",
1128
1106
  value: input.models
1129
- })) && input.models.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1130
- path: _path + ".models[" + _index13 + "]",
1107
+ })) && input.models.map((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1108
+ path: _path + ".models[" + _index9 + "]",
1131
1109
  expected: "AutoBePrisma.IModel",
1132
1110
  value: elem
1133
- })) && _vo1(elem, _path + ".models[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
1134
- path: _path + ".models[" + _index13 + "]",
1111
+ })) && _vo1(elem, _path + ".models[" + _index9 + "]", true && _exceptionable) || _report(_exceptionable, {
1112
+ path: _path + ".models[" + _index9 + "]",
1135
1113
  expected: "AutoBePrisma.IModel",
1136
1114
  value: elem
1137
1115
  })).every(flag => flag) || _report(_exceptionable, {
@@ -1166,12 +1144,12 @@ const collection = {
1166
1144
  path: _path + ".foreignFields",
1167
1145
  expected: "Array<AutoBePrisma.IForeignField>",
1168
1146
  value: input.foreignFields
1169
- })) && input.foreignFields.map((elem, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1170
- path: _path + ".foreignFields[" + _index14 + "]",
1147
+ })) && input.foreignFields.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1148
+ path: _path + ".foreignFields[" + _index10 + "]",
1171
1149
  expected: "AutoBePrisma.IForeignField",
1172
1150
  value: elem
1173
- })) && _vo3(elem, _path + ".foreignFields[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, {
1174
- path: _path + ".foreignFields[" + _index14 + "]",
1151
+ })) && _vo3(elem, _path + ".foreignFields[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, {
1152
+ path: _path + ".foreignFields[" + _index10 + "]",
1175
1153
  expected: "AutoBePrisma.IForeignField",
1176
1154
  value: elem
1177
1155
  })).every(flag => flag) || _report(_exceptionable, {
@@ -1182,12 +1160,12 @@ const collection = {
1182
1160
  path: _path + ".plainFields",
1183
1161
  expected: "Array<AutoBePrisma.IPlainField>",
1184
1162
  value: input.plainFields
1185
- })) && input.plainFields.map((elem, _index15) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1186
- path: _path + ".plainFields[" + _index15 + "]",
1163
+ })) && input.plainFields.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1164
+ path: _path + ".plainFields[" + _index11 + "]",
1187
1165
  expected: "AutoBePrisma.IPlainField",
1188
1166
  value: elem
1189
- })) && _vo5(elem, _path + ".plainFields[" + _index15 + "]", true && _exceptionable) || _report(_exceptionable, {
1190
- path: _path + ".plainFields[" + _index15 + "]",
1167
+ })) && _vo5(elem, _path + ".plainFields[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, {
1168
+ path: _path + ".plainFields[" + _index11 + "]",
1191
1169
  expected: "AutoBePrisma.IPlainField",
1192
1170
  value: elem
1193
1171
  })).every(flag => flag) || _report(_exceptionable, {
@@ -1198,12 +1176,12 @@ const collection = {
1198
1176
  path: _path + ".uniqueIndexes",
1199
1177
  expected: "Array<AutoBePrisma.IUniqueIndex>",
1200
1178
  value: input.uniqueIndexes
1201
- })) && input.uniqueIndexes.map((elem, _index16) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1202
- path: _path + ".uniqueIndexes[" + _index16 + "]",
1179
+ })) && input.uniqueIndexes.map((elem, _index12) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1180
+ path: _path + ".uniqueIndexes[" + _index12 + "]",
1203
1181
  expected: "AutoBePrisma.IUniqueIndex",
1204
1182
  value: elem
1205
- })) && _vo6(elem, _path + ".uniqueIndexes[" + _index16 + "]", true && _exceptionable) || _report(_exceptionable, {
1206
- path: _path + ".uniqueIndexes[" + _index16 + "]",
1183
+ })) && _vo6(elem, _path + ".uniqueIndexes[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, {
1184
+ path: _path + ".uniqueIndexes[" + _index12 + "]",
1207
1185
  expected: "AutoBePrisma.IUniqueIndex",
1208
1186
  value: elem
1209
1187
  })).every(flag => flag) || _report(_exceptionable, {
@@ -1214,12 +1192,12 @@ const collection = {
1214
1192
  path: _path + ".plainIndexes",
1215
1193
  expected: "Array<AutoBePrisma.IPlainIndex>",
1216
1194
  value: input.plainIndexes
1217
- })) && input.plainIndexes.map((elem, _index17) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1218
- path: _path + ".plainIndexes[" + _index17 + "]",
1195
+ })) && input.plainIndexes.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1196
+ path: _path + ".plainIndexes[" + _index13 + "]",
1219
1197
  expected: "AutoBePrisma.IPlainIndex",
1220
1198
  value: elem
1221
- })) && _vo7(elem, _path + ".plainIndexes[" + _index17 + "]", true && _exceptionable) || _report(_exceptionable, {
1222
- path: _path + ".plainIndexes[" + _index17 + "]",
1199
+ })) && _vo7(elem, _path + ".plainIndexes[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
1200
+ path: _path + ".plainIndexes[" + _index13 + "]",
1223
1201
  expected: "AutoBePrisma.IPlainIndex",
1224
1202
  value: elem
1225
1203
  })).every(flag => flag) || _report(_exceptionable, {
@@ -1230,12 +1208,12 @@ const collection = {
1230
1208
  path: _path + ".ginIndexes",
1231
1209
  expected: "Array<AutoBePrisma.IGinIndex>",
1232
1210
  value: input.ginIndexes
1233
- })) && input.ginIndexes.map((elem, _index18) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1234
- path: _path + ".ginIndexes[" + _index18 + "]",
1211
+ })) && input.ginIndexes.map((elem, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1212
+ path: _path + ".ginIndexes[" + _index14 + "]",
1235
1213
  expected: "AutoBePrisma.IGinIndex",
1236
1214
  value: elem
1237
- })) && _vo8(elem, _path + ".ginIndexes[" + _index18 + "]", true && _exceptionable) || _report(_exceptionable, {
1238
- path: _path + ".ginIndexes[" + _index18 + "]",
1215
+ })) && _vo8(elem, _path + ".ginIndexes[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, {
1216
+ path: _path + ".ginIndexes[" + _index14 + "]",
1239
1217
  expected: "AutoBePrisma.IGinIndex",
1240
1218
  value: elem
1241
1219
  })).every(flag => flag) || _report(_exceptionable, {
@@ -1334,8 +1312,8 @@ const collection = {
1334
1312
  path: _path + ".fieldNames",
1335
1313
  expected: "Array<> & UniqueItems<true>",
1336
1314
  value: input.fieldNames
1337
- })) && input.fieldNames.map((elem, _index19) => "string" === typeof elem || _report(_exceptionable, {
1338
- path: _path + ".fieldNames[" + _index19 + "]",
1315
+ })) && input.fieldNames.map((elem, _index15) => "string" === typeof elem || _report(_exceptionable, {
1316
+ path: _path + ".fieldNames[" + _index15 + "]",
1339
1317
  expected: "string",
1340
1318
  value: elem
1341
1319
  })).every(flag => flag)) || _report(_exceptionable, {
@@ -1358,8 +1336,8 @@ const collection = {
1358
1336
  path: _path + ".fieldNames",
1359
1337
  expected: "Array<> & UniqueItems<true>",
1360
1338
  value: input.fieldNames
1361
- })) && input.fieldNames.map((elem, _index20) => "string" === typeof elem || _report(_exceptionable, {
1362
- path: _path + ".fieldNames[" + _index20 + "]",
1339
+ })) && input.fieldNames.map((elem, _index16) => "string" === typeof elem || _report(_exceptionable, {
1340
+ path: _path + ".fieldNames[" + _index16 + "]",
1363
1341
  expected: "string",
1364
1342
  value: elem
1365
1343
  })).every(flag => flag)) || _report(_exceptionable, {
@@ -1376,11 +1354,11 @@ const collection = {
1376
1354
  _report = __typia_transform__validateReport._validateReport(errors);
1377
1355
  ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
1378
1356
  path: _path + "",
1379
- expected: "IMakePrismaSchemaFileProps",
1357
+ expected: "IAutoBePrismaSchemaApplication.IProps",
1380
1358
  value: input
1381
1359
  })) && _vo0(input, _path + "", true) || _report(true, {
1382
1360
  path: _path + "",
1383
- expected: "IMakePrismaSchemaFileProps",
1361
+ expected: "IAutoBePrismaSchemaApplication.IProps",
1384
1362
  value: input
1385
1363
  }))(input, "$input", true);
1386
1364
  const success = 0 === errors.length;